ref0-git 0.3.0 → 0.6.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 (210) hide show
  1. package/app/apps/github/.dev.vars.example +2 -1
  2. package/app/apps/github/generated/git-rest.ts +191 -25
  3. package/app/apps/github/generated/routeTree.gen.ts +21 -0
  4. package/app/apps/github/package.json +1 -1
  5. package/app/apps/github/src/branches/branch-list.tsx +8 -4
  6. package/app/apps/github/src/branches/branches.ts +10 -5
  7. package/app/apps/github/src/camo/addresses.ts +120 -0
  8. package/app/apps/github/src/camo/client.ts +125 -0
  9. package/app/apps/github/src/camo/fetch.ts +201 -0
  10. package/app/apps/github/src/camo/lookup.ts +23 -0
  11. package/app/apps/github/src/camo/node.ts +50 -0
  12. package/app/apps/github/src/camo/proxy.ts +116 -0
  13. package/app/apps/github/src/camo/sign-images.ts +307 -0
  14. package/app/apps/github/src/camo/signing.ts +80 -0
  15. package/app/apps/github/src/clients/allowed.ts +111 -18
  16. package/app/apps/github/src/clients/clients.ts +76 -61
  17. package/app/apps/github/src/clients/transport.ts +13 -0
  18. package/app/apps/github/src/code/code-tree.tsx +3 -1
  19. package/app/apps/github/src/code/file-view.tsx +15 -6
  20. package/app/apps/github/src/code/files.ts +26 -19
  21. package/app/apps/github/src/code/go-to-file.tsx +2 -1
  22. package/app/apps/github/src/code/load.ts +41 -23
  23. package/app/apps/github/src/code/markdown-files.ts +13 -2
  24. package/app/apps/github/src/code/ref-pages.ts +14 -5
  25. package/app/apps/github/src/code/ref-switcher.tsx +4 -3
  26. package/app/apps/github/src/code/refs.ts +42 -8
  27. package/app/apps/github/src/code/repo-home.tsx +6 -2
  28. package/app/apps/github/src/code/repo.ts +12 -6
  29. package/app/apps/github/src/code/saved.ts +5 -3
  30. package/app/apps/github/src/code/trees.ts +11 -9
  31. package/app/apps/github/src/components/markdown/markdown.css +6 -0
  32. package/app/apps/github/src/components/markdown/markdown.tsx +95 -10
  33. package/app/apps/github/src/components/owner-card.tsx +3 -1
  34. package/app/apps/github/src/components/repos/your-repos.tsx +3 -1
  35. package/app/apps/github/src/components/shell/owner-repos.tsx +7 -12
  36. package/app/apps/github/src/components/shell/repo-switcher.tsx +10 -16
  37. package/app/apps/github/src/components/signin/device-card.tsx +9 -2
  38. package/app/apps/github/src/components/user-avatar.tsx +2 -1
  39. package/app/apps/github/src/context/context.ts +13 -0
  40. package/app/apps/github/src/diffs/blobs.ts +37 -14
  41. package/app/apps/github/src/diffs/diff-job.ts +53 -0
  42. package/app/apps/github/src/diffs/diff-worker.ts +6 -0
  43. package/app/apps/github/src/diffs/diffing.ts +136 -0
  44. package/app/apps/github/src/diffs/files.ts +4 -3
  45. package/app/apps/github/src/diffs/hunks.tsx +101 -53
  46. package/app/apps/github/src/diffs/patch.ts +20 -11
  47. package/app/apps/github/src/history/commit-diff.ts +10 -5
  48. package/app/apps/github/src/history/commit-list.tsx +3 -1
  49. package/app/apps/github/src/history/commit-page.tsx +4 -2
  50. package/app/apps/github/src/history/history.ts +12 -10
  51. package/app/apps/github/src/hooks/allowed.ts +9 -9
  52. package/app/apps/github/src/hooks/avatars.ts +3 -3
  53. package/app/apps/github/src/hooks/open-counts.ts +5 -4
  54. package/app/apps/github/src/hooks/profiles.ts +26 -12
  55. package/app/apps/github/src/hooks/repos.ts +78 -25
  56. package/app/apps/github/src/inbox/count.ts +30 -29
  57. package/app/apps/github/src/inbox/inbox-item.tsx +3 -1
  58. package/app/apps/github/src/inbox/inbox-page.tsx +5 -2
  59. package/app/apps/github/src/inbox/marks.ts +26 -15
  60. package/app/apps/github/src/inbox/release-tags.ts +7 -6
  61. package/app/apps/github/src/inbox/subjects.ts +5 -4
  62. package/app/apps/github/src/inbox/subscription-controls.tsx +14 -5
  63. package/app/apps/github/src/inbox/subscriptions.ts +95 -35
  64. package/app/apps/github/src/inbox/threads.ts +6 -6
  65. package/app/apps/github/src/issues/changes.ts +40 -16
  66. package/app/apps/github/src/issues/counts.ts +8 -5
  67. package/app/apps/github/src/issues/issue-list.tsx +20 -6
  68. package/app/apps/github/src/issues/issue-page.tsx +30 -14
  69. package/app/apps/github/src/issues/issues.ts +195 -46
  70. package/app/apps/github/src/issues/label-dialog.tsx +8 -11
  71. package/app/apps/github/src/issues/labels-page.tsx +35 -3
  72. package/app/apps/github/src/issues/milestone-dialog.tsx +197 -0
  73. package/app/apps/github/src/issues/milestones-page.tsx +269 -0
  74. package/app/apps/github/src/issues/new-issue.tsx +3 -1
  75. package/app/apps/github/src/issues/sidebar.tsx +8 -6
  76. package/app/apps/github/src/markdown/README.md +22 -17
  77. package/app/apps/github/src/markdown/context.ts +83 -10
  78. package/app/apps/github/src/markdown/images.ts +3 -2
  79. package/app/apps/github/src/markdown/lookup.ts +9 -8
  80. package/app/apps/github/src/markdown/page-budget.ts +50 -0
  81. package/app/apps/github/src/markdown/patches.ts +74 -32
  82. package/app/apps/github/src/markdown/query.ts +7 -2
  83. package/app/apps/github/src/markdown/remote.ts +106 -0
  84. package/app/apps/github/src/markdown/render.ts +101 -24
  85. package/app/apps/github/src/markdown/texts.ts +43 -0
  86. package/app/apps/github/src/markdown/words-module.d.ts +5 -0
  87. package/app/apps/github/src/markdown/words-plugin.ts +135 -0
  88. package/app/apps/github/src/names/repos.ts +1 -1
  89. package/app/apps/github/src/palette/palette.tsx +7 -4
  90. package/app/apps/github/src/palette/rows.tsx +54 -33
  91. package/app/apps/github/src/palette/server.ts +5 -5
  92. package/app/apps/github/src/palette/targets.ts +1 -0
  93. package/app/apps/github/src/policy.ts +165 -66
  94. package/app/apps/github/src/private-repos.ts +2 -2
  95. package/app/apps/github/src/pulls/compare-page.tsx +6 -3
  96. package/app/apps/github/src/pulls/files-tab.tsx +480 -214
  97. package/app/apps/github/src/pulls/held-summary.ts +178 -0
  98. package/app/apps/github/src/pulls/live.ts +6 -4
  99. package/app/apps/github/src/pulls/merge-box.tsx +17 -10
  100. package/app/apps/github/src/pulls/pull-list.tsx +6 -3
  101. package/app/apps/github/src/pulls/pull-page.tsx +19 -10
  102. package/app/apps/github/src/pulls/pull.ts +68 -40
  103. package/app/apps/github/src/pulls/pulls.ts +39 -22
  104. package/app/apps/github/src/pulls/review-drafts.ts +131 -0
  105. package/app/apps/github/src/pulls/review.ts +374 -99
  106. package/app/apps/github/src/pulls/threads.tsx +152 -0
  107. package/app/apps/github/src/queue/queue-page.tsx +15 -8
  108. package/app/apps/github/src/queue/queue.ts +35 -20
  109. package/app/apps/github/src/releases/latest-release.tsx +3 -1
  110. package/app/apps/github/src/releases/overview.tsx +4 -2
  111. package/app/apps/github/src/releases/release-form.tsx +8 -5
  112. package/app/apps/github/src/releases/release-list.tsx +8 -5
  113. package/app/apps/github/src/releases/release-view.tsx +1 -0
  114. package/app/apps/github/src/releases/releases.ts +33 -23
  115. package/app/apps/github/src/releases/tag-list.tsx +3 -1
  116. package/app/apps/github/src/router.tsx +5 -2
  117. package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +7 -1
  118. package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +6 -1
  119. package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +2 -1
  120. package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +1 -1
  121. package/app/apps/github/src/routes/$owner/$repo/branches.tsx +5 -1
  122. package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +1 -1
  123. package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +6 -1
  124. package/app/apps/github/src/routes/$owner/$repo/index.tsx +1 -1
  125. package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +4 -2
  126. package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +2 -2
  127. package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +5 -2
  128. package/app/apps/github/src/routes/$owner/$repo/labels.tsx +2 -1
  129. package/app/apps/github/src/routes/$owner/$repo/milestones.tsx +36 -0
  130. package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +4 -2
  131. package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +2 -2
  132. package/app/apps/github/src/routes/$owner/$repo/queue.tsx +2 -1
  133. package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +5 -2
  134. package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +2 -1
  135. package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +4 -2
  136. package/app/apps/github/src/routes/$owner/$repo/route.tsx +9 -5
  137. package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +3 -1
  138. package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +3 -1
  139. package/app/apps/github/src/routes/-nav.tsx +10 -2
  140. package/app/apps/github/src/routes/-root-testing.ts +29 -6
  141. package/app/apps/github/src/routes/__root.tsx +9 -4
  142. package/app/apps/github/src/routes/index.tsx +3 -1
  143. package/app/apps/github/src/routes/orgs/$owner/route.tsx +4 -1
  144. package/app/apps/github/src/routes/orgs/$owner/settings.tsx +4 -1
  145. package/app/apps/github/src/seed/acme.ts +1 -1
  146. package/app/apps/github/src/seed/seed.ts +199 -110
  147. package/app/apps/github/src/server.ts +24 -15
  148. package/app/apps/github/src/settings/account-avatar.tsx +4 -1
  149. package/app/apps/github/src/settings/general-settings.tsx +3 -1
  150. package/app/apps/github/src/settings/general.ts +4 -4
  151. package/app/apps/github/src/settings/hook-form.tsx +3 -1
  152. package/app/apps/github/src/settings/hook-list.tsx +5 -2
  153. package/app/apps/github/src/settings/hooks.ts +7 -7
  154. package/app/apps/github/src/settings/org-settings.tsx +3 -1
  155. package/app/apps/github/src/settings/orgs.ts +21 -11
  156. package/app/apps/github/src/settings/settings-layout.tsx +3 -1
  157. package/app/apps/github/src/signin/approval.ts +4 -3
  158. package/app/apps/github/src/signin/auth.ts +9 -2
  159. package/app/apps/github/src/signin/device-code.ts +8 -3
  160. package/app/apps/github/src/signin/device-prompt.ts +28 -3
  161. package/app/apps/github/src/signin/revoke.ts +36 -0
  162. package/app/apps/github/tsconfig.json +4 -1
  163. package/app/apps/github/vite.config.ts +8 -0
  164. package/app/pnpm-workspace.yaml +12 -5
  165. package/app/tsconfig.base.json +1 -0
  166. package/dist/cli/child.mjs +1 -1
  167. package/dist/cli/credentials.mjs +4 -4
  168. package/dist/cli/documents.mjs +32 -22
  169. package/dist/cli/events.mjs +1 -1
  170. package/dist/cli/failure.mjs +20 -7
  171. package/dist/cli/folders.mjs +2 -2
  172. package/dist/cli/git-remote-ref0.mjs +47 -22
  173. package/dist/cli/git.mjs +1 -1
  174. package/dist/cli/helpers.mjs +2 -2
  175. package/dist/cli/hosts.mjs +3 -3
  176. package/dist/cli/output.mjs +2 -2
  177. package/dist/cli/prompt.mjs +1 -1
  178. package/dist/cli/queue.mjs +7 -7
  179. package/dist/cli/ref0-git.mjs +2 -2
  180. package/dist/cli/repos.mjs +35 -18
  181. package/dist/cli/resources.mjs +5 -5
  182. package/dist/cli/retry-after.mjs +8 -0
  183. package/dist/cli/setup.mjs +172 -66
  184. package/dist/cli/sign-in.mjs +65 -23
  185. package/dist/cli/sign-ins.mjs +4 -4
  186. package/dist/cli/sqlite.mjs +2 -2
  187. package/dist/cli/tokens.mjs +3 -3
  188. package/dist/cli/vendor.mjs +1 -1
  189. package/dist/init/app.mjs +20 -21
  190. package/dist/init/choices.mjs +1 -1
  191. package/dist/init/cloudflare.mjs +15 -19
  192. package/dist/init/create.mjs +3 -2
  193. package/dist/init/detect.mjs +4 -4
  194. package/dist/init/files.mjs +120 -13
  195. package/dist/init/frameworks.mjs +16 -0
  196. package/dist/init/git-module.mjs +22 -7
  197. package/dist/init/jsonc.mjs +9 -7
  198. package/dist/init/metadata.mjs +9 -3
  199. package/dist/init/mounts.mjs +13 -10
  200. package/dist/init/next.mjs +2 -2
  201. package/dist/init/node-app.mjs +3 -3
  202. package/dist/init/node.mjs +42 -45
  203. package/dist/init/nuxt.mjs +153 -27
  204. package/dist/init/stores.mjs +14 -9
  205. package/dist/init/sveltekit.mjs +4 -2
  206. package/dist/init/template.mjs +9 -6
  207. package/dist/init/templates.mjs +63 -47
  208. package/dist/init/vercel.mjs +37 -37
  209. package/dist/init/versions.mjs +3 -3
  210. package/package.json +6 -5
@@ -1,5 +1,6 @@
1
1
  # Copy to .dev.vars for `npm run dev`: wrangler reads it, and git ignores it. SESSION_SECRET signs
2
- # Better Auth's session cookie and seals each session's Git token. SIGN_UP=closed would stop sign-up.
2
+ # Better Auth's session cookie and seals each session's Git token. SIGN_UP=closed would stop sign-up,
3
+ # and IMAGE_PROXY=off would load a text's remote images from their own origin, not through /_camo/.
3
4
  # DEMO_PASSWORD is what the dev seed signs Pip and Mo up with, so you can sign in as either.
4
5
  ADMIN_TOKEN=change-me-the-admin-secret
5
6
  SESSION_SECRET=change-me-at-least-32-characters-long
@@ -180,6 +180,22 @@ export interface paths {
180
180
  patch?: never;
181
181
  trace?: never;
182
182
  };
183
+ "/repos/{repo}/-/protections": {
184
+ parameters: {
185
+ query?: never;
186
+ header?: never;
187
+ path?: never;
188
+ cookie?: never;
189
+ };
190
+ get?: never;
191
+ put?: never;
192
+ post: operations["refs.protections"];
193
+ delete?: never;
194
+ options?: never;
195
+ head?: never;
196
+ patch?: never;
197
+ trace?: never;
198
+ };
183
199
  "/repos/{repo}/-/sees": {
184
200
  parameters: {
185
201
  query?: never;
@@ -873,6 +889,8 @@ export interface components {
873
889
  message: string;
874
890
  hint?: string;
875
891
  context?: {
892
+ reason?: ("graph-length" | "merge-incomplete") | string;
893
+ } & {
876
894
  [key: string]: string | number | ("Infinity" | "-Infinity" | "NaN") | boolean | string[] | null;
877
895
  };
878
896
  };
@@ -883,6 +901,9 @@ export interface components {
883
901
  hint?: string;
884
902
  context?: {
885
903
  id?: string;
904
+ reason?: ("busy" | "packs-awaiting-repack" | "awaiting-index" | "may-have-saved" | "too-many-writes") | string;
905
+ packs?: number | ("Infinity" | "-Infinity" | "NaN");
906
+ most?: number | ("Infinity" | "-Infinity" | "NaN");
886
907
  } & {
887
908
  [key: string]: string | number | ("Infinity" | "-Infinity" | "NaN") | boolean | string[] | null;
888
909
  };
@@ -904,8 +925,10 @@ export interface components {
904
925
  message: string;
905
926
  hint?: string;
906
927
  context?: {
907
- /** @enum {string} */
908
- reason?: "too-large" | "walk-limit" | "diff-limit" | "object-too-large" | "response-too-large" | "too-many-packs" | "too-many-pointers" | "fetch-plan-too-large" | "too-many-store-calls" | "call-budget" | "events-undelivered" | "events-waiting" | "name-churn" | "queue-full" | "too-many-repeated-files" | "too-many-gitmodules-and-gitattributes" | "rate-limited";
928
+ reason?: ("too-large" | "rate-limited" | "walk-limit" | "diff-limit" | "object-too-large" | "delta-too-large" | "response-too-large" | "too-many-pointers" | "fetch-plan-too-large" | "too-many-store-calls" | "call-budget" | "events-undelivered" | "events-waiting" | "name-churn" | "queue-full" | "queue-targets-full" | "too-many-gitmodules-and-gitattributes" | "prune-walk-too-large") | string;
929
+ indexBytes?: number | ("Infinity" | "-Infinity" | "NaN");
930
+ pushBytes?: number | ("Infinity" | "-Infinity" | "NaN");
931
+ most?: number | ("Infinity" | "-Infinity" | "NaN");
909
932
  } & {
910
933
  [key: string]: string | number | ("Infinity" | "-Infinity" | "NaN") | boolean | string[] | null;
911
934
  };
@@ -928,8 +951,9 @@ export interface components {
928
951
  message: string;
929
952
  hint?: string;
930
953
  context?: {
954
+ reason?: ("cursor-expired" | "diverged" | "merge-conflict" | "candidate-superseded" | "candidate-cancelled" | "entry-gone" | "ref-conflict" | "newer-format" | "changed-while-checked" | "unsupported-attribute" | "unrelated-histories" | "unsupported-virtual-base" | "own-repo" | "not-a-fork" | "no-copy-rows" | "shallow-root" | "shallow-upload" | "sync-unbound" | "import-cancelled" | "importing" | "history-not-imported" | "stage-gone" | "remote-refused" | "atomic-partner" | "merges-off") | string;
931
955
  /** @enum {string} */
932
- reason?: "cursor-expired" | "diverged" | "merge-conflict" | "candidate-superseded" | "candidate-cancelled" | "entry-gone" | "ref-conflict" | "newer-format" | "changed-while-checked" | "unsupported-attribute" | "unrelated-histories" | "unsupported-virtual-base" | "own-repo" | "not-a-fork" | "shallow-root" | "shallow-upload" | "sync-unbound" | "import-cancelled" | "importing";
956
+ importState?: "running" | "cancelled" | "failed";
933
957
  attribute?: string;
934
958
  paths?: string[];
935
959
  total?: number | ("Infinity" | "-Infinity" | "NaN");
@@ -944,7 +968,7 @@ export interface components {
944
968
  message: string;
945
969
  hint?: string;
946
970
  context?: {
947
- reason?: "key-reused";
971
+ reason?: "key-reused" | string;
948
972
  /** @enum {string} */
949
973
  verdict?: "pass" | "fail";
950
974
  } & {
@@ -957,8 +981,8 @@ export interface components {
957
981
  message: string;
958
982
  hint?: string;
959
983
  context?: {
960
- /** @enum {string} */
961
- reason?: "no-queue" | "no-topics";
984
+ reason?: ("no-queue" | "no-topics" | "ambiguous") | string;
985
+ target?: string;
962
986
  } & {
963
987
  [key: string]: string | number | ("Infinity" | "-Infinity" | "NaN") | boolean | string[] | null;
964
988
  };
@@ -969,6 +993,11 @@ export interface components {
969
993
  message: string;
970
994
  hint?: string;
971
995
  context?: {
996
+ reason?: ("files-refused" | "entry-unpublishable") | string;
997
+ entries?: string[];
998
+ paths?: string[];
999
+ total?: number | ("Infinity" | "-Infinity" | "NaN");
1000
+ } & {
972
1001
  [key: string]: string | number | ("Infinity" | "-Infinity" | "NaN") | boolean | string[] | null;
973
1002
  };
974
1003
  };
@@ -987,9 +1016,10 @@ export interface components {
987
1016
  message: string;
988
1017
  hint?: string;
989
1018
  context?: {
990
- /** @enum {string} */
991
- reason?: "ofs-delta" | "fsck" | "provider-unknown" | "body-ended";
1019
+ reason?: ("ofs-delta" | "fsck" | "provider-unknown" | "body-ended" | "link-wrong-type" | "tag-target-missing" | "object-missing" | "boundary-not-in-pack" | "too-many-short-ids" | "too-many-parents") | string;
992
1020
  msgId?: string;
1021
+ most?: number | ("Infinity" | "-Infinity" | "NaN");
1022
+ given?: number | ("Infinity" | "-Infinity" | "NaN");
993
1023
  } & {
994
1024
  [key: string]: string | number | ("Infinity" | "-Infinity" | "NaN") | boolean | string[] | null;
995
1025
  };
@@ -1010,6 +1040,13 @@ export interface components {
1010
1040
  source: string;
1011
1041
  head: string;
1012
1042
  }[];
1043
+ pending: {
1044
+ repo: string;
1045
+ target: string;
1046
+ source: string;
1047
+ head: string;
1048
+ key: string;
1049
+ }[];
1013
1050
  candidates: {
1014
1051
  repo: string;
1015
1052
  target: string;
@@ -1305,7 +1342,7 @@ export interface components {
1305
1342
  pathBytes?: string;
1306
1343
  /** Format: byte */
1307
1344
  fromPathBytes?: string;
1308
- lines: {
1345
+ lines?: {
1309
1346
  added: number;
1310
1347
  deleted: number;
1311
1348
  } | "binary";
@@ -1452,17 +1489,6 @@ export interface components {
1452
1489
  attempt: number | ("Infinity" | "-Infinity" | "NaN");
1453
1490
  at: number | ("Infinity" | "-Infinity" | "NaN");
1454
1491
  };
1455
- run?: {
1456
- id: string;
1457
- startedAt: number | ("Infinity" | "-Infinity" | "NaN");
1458
- completedSteps: number | ("Infinity" | "-Infinity" | "NaN");
1459
- measures: {
1460
- /** @enum {string} */
1461
- unit: "bytes" | "objects" | "entries" | "packs";
1462
- completed: number | ("Infinity" | "-Infinity" | "NaN");
1463
- total?: number | ("Infinity" | "-Infinity" | "NaN");
1464
- }[];
1465
- };
1466
1492
  };
1467
1493
  RefProtection: {
1468
1494
  sources?: ("git" | "api" | "queue" | "import")[];
@@ -1488,11 +1514,11 @@ export interface components {
1488
1514
  };
1489
1515
  ForkFetched: {
1490
1516
  source: string;
1491
- head: string;
1517
+ head?: string;
1492
1518
  tips: components["schemas"]["Ref"][];
1493
1519
  };
1494
1520
  RepoInfo: {
1495
- id: string;
1521
+ name: string;
1496
1522
  defaultBranch?: string;
1497
1523
  public: boolean;
1498
1524
  upstream?: string;
@@ -1513,6 +1539,14 @@ export interface components {
1513
1539
  oldestDue?: number | ("Infinity" | "-Infinity" | "NaN");
1514
1540
  failed: number | ("Infinity" | "-Infinity" | "NaN");
1515
1541
  oldestFailed?: number | ("Infinity" | "-Infinity" | "NaN");
1542
+ index?: {
1543
+ /** @enum {string} */
1544
+ state: "refused";
1545
+ retryAt: number | ("Infinity" | "-Infinity" | "NaN");
1546
+ } | {
1547
+ /** @enum {string} */
1548
+ state: "too-large";
1549
+ };
1516
1550
  };
1517
1551
  };
1518
1552
  };
@@ -1532,6 +1566,7 @@ export interface operations {
1532
1566
  past?: string;
1533
1567
  perOwner?: "true";
1534
1568
  sameBudget?: "true";
1569
+ readBudget?: string;
1535
1570
  after?: string;
1536
1571
  limit?: string;
1537
1572
  };
@@ -1666,7 +1701,7 @@ export interface operations {
1666
1701
  requestBody: {
1667
1702
  content: {
1668
1703
  "application/json": {
1669
- id: string;
1704
+ name: string;
1670
1705
  defaultBranch?: string;
1671
1706
  public?: boolean;
1672
1707
  key?: string;
@@ -2437,7 +2472,7 @@ export interface operations {
2437
2472
  content: {
2438
2473
  "application/json": {
2439
2474
  holder: string;
2440
- id?: string;
2475
+ name?: string;
2441
2476
  key?: string;
2442
2477
  };
2443
2478
  };
@@ -2936,6 +2971,7 @@ export interface operations {
2936
2971
  query?: {
2937
2972
  prefix?: string;
2938
2973
  pointsAt?: string;
2974
+ protected?: "true" | "false";
2939
2975
  after?: string;
2940
2976
  limit?: string;
2941
2977
  };
@@ -3570,6 +3606,136 @@ export interface operations {
3570
3606
  };
3571
3607
  };
3572
3608
  };
3609
+ "refs.protections": {
3610
+ parameters: {
3611
+ query?: never;
3612
+ header?: never;
3613
+ path: {
3614
+ repo: string;
3615
+ };
3616
+ cookie?: never;
3617
+ };
3618
+ requestBody: {
3619
+ content: {
3620
+ "application/json": {
3621
+ /** @description Full ref names, 100 at most, which needn't exist */
3622
+ refs: string[];
3623
+ };
3624
+ };
3625
+ };
3626
+ responses: {
3627
+ /** @description Success */
3628
+ 200: {
3629
+ headers: {
3630
+ [name: string]: unknown;
3631
+ };
3632
+ content: {
3633
+ "application/json": (components["schemas"]["RefProtection"] | null)[];
3634
+ };
3635
+ };
3636
+ /** @description GitError.INVALID_ARGUMENT */
3637
+ 400: {
3638
+ headers: {
3639
+ "ref0-code": string;
3640
+ [name: string]: unknown;
3641
+ };
3642
+ content: {
3643
+ "application/json": components["schemas"]["GitError.INVALID_ARGUMENT"];
3644
+ };
3645
+ };
3646
+ /** @description GitError.UNAUTHENTICATED */
3647
+ 401: {
3648
+ headers: {
3649
+ "ref0-code": string;
3650
+ "www-authenticate": string;
3651
+ [name: string]: unknown;
3652
+ };
3653
+ content: {
3654
+ "application/json": components["schemas"]["GitError.UNAUTHENTICATED"];
3655
+ };
3656
+ };
3657
+ /** @description GitError.NOT_ALLOWED */
3658
+ 403: {
3659
+ headers: {
3660
+ "ref0-code": string;
3661
+ [name: string]: unknown;
3662
+ };
3663
+ content: {
3664
+ "application/json": components["schemas"]["GitError.NOT_ALLOWED"];
3665
+ };
3666
+ };
3667
+ /** @description GitError.NOT_FOUND */
3668
+ 404: {
3669
+ headers: {
3670
+ "ref0-code": string;
3671
+ [name: string]: unknown;
3672
+ };
3673
+ content: {
3674
+ "application/json": components["schemas"]["GitError.NOT_FOUND"];
3675
+ };
3676
+ };
3677
+ /** @description GitError.ALREADY_EXISTS | GitError.FAILED_PRECONDITION */
3678
+ 409: {
3679
+ headers: {
3680
+ "ref0-code": string;
3681
+ [name: string]: unknown;
3682
+ };
3683
+ content: {
3684
+ "application/json": components["schemas"]["GitError.ALREADY_EXISTS"] | components["schemas"]["GitError.FAILED_PRECONDITION"];
3685
+ };
3686
+ };
3687
+ /** @description GitError.RESOURCE_EXHAUSTED */
3688
+ 413: {
3689
+ headers: {
3690
+ "ref0-code": string;
3691
+ [name: string]: unknown;
3692
+ };
3693
+ content: {
3694
+ "application/json": components["schemas"]["GitError.RESOURCE_EXHAUSTED"];
3695
+ };
3696
+ };
3697
+ /** @description GitError.RESOURCE_EXHAUSTED.rate-limited */
3698
+ 429: {
3699
+ headers: {
3700
+ "ref0-code": string;
3701
+ [name: string]: unknown;
3702
+ };
3703
+ content: {
3704
+ "application/json": components["schemas"]["GitError.RESOURCE_EXHAUSTED.rate-limited"];
3705
+ };
3706
+ };
3707
+ /** @description GitError.DATA_LOSS | GitError.INTERNAL */
3708
+ 500: {
3709
+ headers: {
3710
+ "ref0-code": string;
3711
+ [name: string]: unknown;
3712
+ };
3713
+ content: {
3714
+ "application/json": components["schemas"]["GitError.DATA_LOSS"] | components["schemas"]["GitError.INTERNAL"];
3715
+ };
3716
+ };
3717
+ /** @description GitError.UNAVAILABLE */
3718
+ 503: {
3719
+ headers: {
3720
+ "ref0-code": string;
3721
+ [name: string]: unknown;
3722
+ };
3723
+ content: {
3724
+ "application/json": components["schemas"]["GitError.UNAVAILABLE"];
3725
+ };
3726
+ };
3727
+ /** @description GitError.DEADLINE_EXCEEDED */
3728
+ 504: {
3729
+ headers: {
3730
+ "ref0-code": string;
3731
+ [name: string]: unknown;
3732
+ };
3733
+ content: {
3734
+ "application/json": components["schemas"]["GitError.DEADLINE_EXCEEDED"];
3735
+ };
3736
+ };
3737
+ };
3738
+ };
3573
3739
  "refs.sees": {
3574
3740
  parameters: {
3575
3741
  query?: never;
@@ -5674,7 +5840,7 @@ export interface operations {
5674
5840
  requestBody: {
5675
5841
  content: {
5676
5842
  "application/json": {
5677
- base: string;
5843
+ base?: string;
5678
5844
  ours: string;
5679
5845
  theirs: string;
5680
5846
  limits?: {
@@ -26,6 +26,7 @@ import { Route as OwnerRepoCodeRouteImport } from './../src/routes/$owner/$repo/
26
26
  import { Route as OwnerRepoReleasesRouteImport } from './../src/routes/$owner/$repo/_releases.tsx'
27
27
  import { Route as OwnerRepoBranchesRouteImport } from './../src/routes/$owner/$repo/branches.tsx'
28
28
  import { Route as OwnerRepoLabelsRouteImport } from './../src/routes/$owner/$repo/labels.tsx'
29
+ import { Route as OwnerRepoMilestonesRouteImport } from './../src/routes/$owner/$repo/milestones.tsx'
29
30
  import { Route as OwnerRepoQueueRouteImport } from './../src/routes/$owner/$repo/queue.tsx'
30
31
  import { Route as OwnerRepoSettingsRouteRouteImport } from './../src/routes/$owner/$repo/settings/route.tsx'
31
32
  import { Route as OwnerRepoTokensRouteImport } from './../src/routes/$owner/$repo/tokens.tsx'
@@ -147,6 +148,11 @@ const OwnerRepoLabelsRoute = OwnerRepoLabelsRouteImport.update({
147
148
  path: '/labels',
148
149
  getParentRoute: () => OwnerRepoRouteRoute,
149
150
  } as any)
151
+ const OwnerRepoMilestonesRoute = OwnerRepoMilestonesRouteImport.update({
152
+ id: '/milestones',
153
+ path: '/milestones',
154
+ getParentRoute: () => OwnerRepoRouteRoute,
155
+ } as any)
150
156
  const OwnerRepoQueueRoute = OwnerRepoQueueRouteImport.update({
151
157
  id: '/queue',
152
158
  path: '/queue',
@@ -359,6 +365,7 @@ export interface FileRoutesByFullPath {
359
365
  '/$owner/$repo/settings': typeof OwnerRepoSettingsRouteRouteWithChildren
360
366
  '/$owner/$repo/branches': typeof OwnerRepoBranchesRoute
361
367
  '/$owner/$repo/labels': typeof OwnerRepoLabelsRoute
368
+ '/$owner/$repo/milestones': typeof OwnerRepoMilestonesRoute
362
369
  '/$owner/$repo/queue': typeof OwnerRepoQueueRoute
363
370
  '/$owner/$repo/tokens': typeof OwnerRepoTokensRoute
364
371
  '/api/auth/$': typeof ApiAuthSplatRoute
@@ -412,6 +419,7 @@ export interface FileRoutesByTo {
412
419
  '/$owner/$repo': typeof OwnerRepoIndexRoute
413
420
  '/$owner/$repo/branches': typeof OwnerRepoBranchesRoute
414
421
  '/$owner/$repo/labels': typeof OwnerRepoLabelsRoute
422
+ '/$owner/$repo/milestones': typeof OwnerRepoMilestonesRoute
415
423
  '/$owner/$repo/queue': typeof OwnerRepoQueueRoute
416
424
  '/$owner/$repo/tokens': typeof OwnerRepoTokensRoute
417
425
  '/api/auth/$': typeof ApiAuthSplatRoute
@@ -467,6 +475,7 @@ export interface FileRoutesById {
467
475
  '/$owner/$repo/_releases': typeof OwnerRepoReleasesRouteWithChildren
468
476
  '/$owner/$repo/branches': typeof OwnerRepoBranchesRoute
469
477
  '/$owner/$repo/labels': typeof OwnerRepoLabelsRoute
478
+ '/$owner/$repo/milestones': typeof OwnerRepoMilestonesRoute
470
479
  '/$owner/$repo/queue': typeof OwnerRepoQueueRoute
471
480
  '/$owner/$repo/tokens': typeof OwnerRepoTokensRoute
472
481
  '/api/auth/$': typeof ApiAuthSplatRoute
@@ -523,6 +532,7 @@ export interface FileRouteTypes {
523
532
  | '/$owner/$repo/settings'
524
533
  | '/$owner/$repo/branches'
525
534
  | '/$owner/$repo/labels'
535
+ | '/$owner/$repo/milestones'
526
536
  | '/$owner/$repo/queue'
527
537
  | '/$owner/$repo/tokens'
528
538
  | '/api/auth/$'
@@ -576,6 +586,7 @@ export interface FileRouteTypes {
576
586
  | '/$owner/$repo'
577
587
  | '/$owner/$repo/branches'
578
588
  | '/$owner/$repo/labels'
589
+ | '/$owner/$repo/milestones'
579
590
  | '/$owner/$repo/queue'
580
591
  | '/$owner/$repo/tokens'
581
592
  | '/api/auth/$'
@@ -630,6 +641,7 @@ export interface FileRouteTypes {
630
641
  | '/$owner/$repo/_releases'
631
642
  | '/$owner/$repo/branches'
632
643
  | '/$owner/$repo/labels'
644
+ | '/$owner/$repo/milestones'
633
645
  | '/$owner/$repo/queue'
634
646
  | '/$owner/$repo/tokens'
635
647
  | '/api/auth/$'
@@ -810,6 +822,13 @@ declare module '@tanstack/react-router' {
810
822
  preLoaderRoute: typeof OwnerRepoLabelsRouteImport
811
823
  parentRoute: typeof OwnerRepoRouteRoute
812
824
  }
825
+ '/$owner/$repo/milestones': {
826
+ id: '/$owner/$repo/milestones'
827
+ path: '/milestones'
828
+ fullPath: '/$owner/$repo/milestones'
829
+ preLoaderRoute: typeof OwnerRepoMilestonesRouteImport
830
+ parentRoute: typeof OwnerRepoRouteRoute
831
+ }
813
832
  '/$owner/$repo/queue': {
814
833
  id: '/$owner/$repo/queue'
815
834
  path: '/queue'
@@ -1147,6 +1166,7 @@ interface OwnerRepoRouteRouteChildren {
1147
1166
  OwnerRepoReleasesRoute: typeof OwnerRepoReleasesRouteWithChildren
1148
1167
  OwnerRepoBranchesRoute: typeof OwnerRepoBranchesRoute
1149
1168
  OwnerRepoLabelsRoute: typeof OwnerRepoLabelsRoute
1169
+ OwnerRepoMilestonesRoute: typeof OwnerRepoMilestonesRoute
1150
1170
  OwnerRepoQueueRoute: typeof OwnerRepoQueueRoute
1151
1171
  OwnerRepoTokensRoute: typeof OwnerRepoTokensRoute
1152
1172
  OwnerRepoIndexRoute: typeof OwnerRepoIndexRoute
@@ -1169,6 +1189,7 @@ const OwnerRepoRouteRouteChildren: OwnerRepoRouteRouteChildren = {
1169
1189
  OwnerRepoReleasesRoute: OwnerRepoReleasesRouteWithChildren,
1170
1190
  OwnerRepoBranchesRoute: OwnerRepoBranchesRoute,
1171
1191
  OwnerRepoLabelsRoute: OwnerRepoLabelsRoute,
1192
+ OwnerRepoMilestonesRoute: OwnerRepoMilestonesRoute,
1172
1193
  OwnerRepoQueueRoute: OwnerRepoQueueRoute,
1173
1194
  OwnerRepoTokensRoute: OwnerRepoTokensRoute,
1174
1195
  OwnerRepoIndexRoute: OwnerRepoIndexRoute,
@@ -32,6 +32,7 @@
32
32
  "@ref0/git": "workspace:*",
33
33
  "@ref0/github": "workspace:*",
34
34
  "@ref0/infra": "workspace:*",
35
+ "@ref0/xdiff-wasm": "workspace:*",
35
36
  "@tanstack/react-query": "catalog:",
36
37
  "@tanstack/react-router": "catalog:",
37
38
  "@tanstack/react-router-ssr-query": "catalog:",
@@ -47,7 +48,6 @@
47
48
  "kysely": "catalog:",
48
49
  "lucide-react": "catalog:",
49
50
  "openapi-fetch": "catalog:",
50
- "openapi-react-query": "catalog:",
51
51
  "pele": "catalog:",
52
52
  "react": "catalog:",
53
53
  "react-day-picker": "catalog:",
@@ -6,6 +6,7 @@ import { toast } from 'sonner';
6
6
 
7
7
  import { Go } from '../code/controls.tsx';
8
8
  import { treeHref, type RepoPlace } from '../code/places.ts';
9
+ import { useClients } from '../clients/clients.ts';
9
10
  import { refPages, type RefRow } from '../code/ref-pages.ts';
10
11
  import { More } from '../components/item-list.tsx';
11
12
  import { RelativeTime } from '../components/relative-time.tsx';
@@ -104,10 +105,11 @@ function BranchRow({
104
105
  * answers, so a refusal, such as a protected branch's, shows in it in the server's words.
105
106
  */
106
107
  function DeleteBranch({ place, name }: { readonly place: RepoPlace; readonly name: string }) {
108
+ const clients = useClients();
107
109
  const client = useQueryClient();
108
110
  const [open, setOpen] = useState(false);
109
111
  const remove = useMutation({
110
- mutationFn: () => deleteBranch(place, name),
112
+ mutationFn: () => deleteBranch(clients, place, name),
111
113
  onSuccess: async () => {
112
114
  setOpen(false);
113
115
  toast.success(`Deleted ${name}`);
@@ -164,6 +166,7 @@ function NewBranch({
164
166
  readonly place: RepoPlace;
165
167
  readonly from: readonly RefRow[];
166
168
  }) {
169
+ const clients = useClients();
167
170
  const client = useQueryClient();
168
171
  const [open, setOpen] = useState(false);
169
172
  const [name, setName] = useState('');
@@ -174,7 +177,7 @@ function NewBranch({
174
177
  const asked = useDeferredValue(typed ?? '');
175
178
  const searching = asked !== '' && asked !== picked?.name;
176
179
  const found = useInfiniteQuery({
177
- ...refPages(place, { prefix: 'refs/heads/', first: branchesPerPage, search: asked }),
180
+ ...refPages(clients, place, { prefix: 'refs/heads/', first: branchesPerPage, search: asked }),
178
181
  enabled: open && searching,
179
182
  });
180
183
  const matches = (found.data?.pages[0]?.rows ?? []).filter((row) => row.commit !== undefined);
@@ -184,7 +187,7 @@ function NewBranch({
184
187
  mutationFn: async () => {
185
188
  if (picked?.commit === undefined) throw new Error('Pick a branch to start from');
186
189
 
187
- await createBranch(place, name.trim(), picked.commit);
190
+ await createBranch(clients, place, name.trim(), picked.commit);
188
191
  },
189
192
  onSuccess: async () => {
190
193
  setOpen(false);
@@ -326,10 +329,11 @@ export function BranchList({
326
329
  readonly place: RepoPlace;
327
330
  readonly search: string;
328
331
  }) {
332
+ const clients = useClients();
329
333
  const allowed = useAllowed(place);
330
334
  const canPush = allowed.has('push');
331
335
  const pages = useInfiniteQuery(
332
- refPages(place, { prefix: 'refs/heads/', first: branchesPerPage, search }),
336
+ refPages(clients, place, { prefix: 'refs/heads/', first: branchesPerPage, search }),
333
337
  );
334
338
  const read = pages.data?.pages ?? [];
335
339
  const rows = read.flatMap((page, index) => listedBranches(page, index === 0, search));
@@ -1,6 +1,6 @@
1
1
  import type { QueryClient } from '@tanstack/react-query';
2
2
 
3
- import { github } from '../clients/clients.ts';
3
+ import type { Clients } from '../clients/clients.ts';
4
4
  import type { RepoPlace } from '../code/places.ts';
5
5
  import type { RefPage, RefRow } from '../code/ref-pages.ts';
6
6
  import { failure } from '../hooks/answers.ts';
@@ -27,8 +27,13 @@ export const listedBranches = (
27
27
  };
28
28
 
29
29
  /** Makes branch `name` at commit `sha`: GitHub's `POST git/refs`, or its refusal's words. */
30
- export const createBranch = async (place: RepoPlace, name: string, sha: string) => {
31
- const answer = await github.POST('/repos/{owner}/{repo}/git/refs', {
30
+ export const createBranch = async (
31
+ clients: Clients,
32
+ place: RepoPlace,
33
+ name: string,
34
+ sha: string,
35
+ ) => {
36
+ const answer = await clients.github.POST('/repos/{owner}/{repo}/git/refs', {
32
37
  params: { path: place },
33
38
  body: { ref: `refs/heads/${name}`, sha },
34
39
  });
@@ -39,8 +44,8 @@ export const createBranch = async (place: RepoPlace, name: string, sha: string)
39
44
  * Deletes branch `name`: GitHub's `DELETE git/refs`, or its refusal's words, such as a protected
40
45
  * branch's.
41
46
  */
42
- export const deleteBranch = async (place: RepoPlace, name: string) => {
43
- const answer = await github.DELETE('/repos/{owner}/{repo}/git/refs/{ref}', {
47
+ export const deleteBranch = async (clients: Clients, place: RepoPlace, name: string) => {
48
+ const answer = await clients.github.DELETE('/repos/{owner}/{repo}/git/refs/{ref}', {
44
49
  params: { path: { ...place, ref: `heads/${name}` } },
45
50
  });
46
51
  if (!answer.response.ok) throw failure("The branch wasn't deleted", answer);