ref0-git 0.0.0 → 0.2.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 (385) hide show
  1. package/app/apps/github/.dev.vars.example +6 -0
  2. package/app/apps/github/README.md +70 -0
  3. package/app/apps/github/THIRD_PARTY_NOTICES.md +214 -0
  4. package/app/apps/github/components.json +25 -0
  5. package/app/apps/github/generated/git-rest.ts +10444 -0
  6. package/app/apps/github/generated/routeTree.gen.ts +1242 -0
  7. package/app/apps/github/migrations/postgres/0001_auth.sql +46 -0
  8. package/app/apps/github/migrations/sql/0001_auth.sql +19 -0
  9. package/app/apps/github/migrations/sql/0002_passkeys.sql +9 -0
  10. package/app/apps/github/migrations/sql/0003_orgs.sql +22 -0
  11. package/app/apps/github/migrations/sql/0004_avatars.sql +6 -0
  12. package/app/apps/github/package.json +80 -0
  13. package/app/apps/github/src/branches/branch-list.tsx +385 -0
  14. package/app/apps/github/src/branches/branches.ts +55 -0
  15. package/app/apps/github/src/clients/allowed.ts +213 -0
  16. package/app/apps/github/src/clients/at-most.ts +17 -0
  17. package/app/apps/github/src/clients/avatars.ts +410 -0
  18. package/app/apps/github/src/clients/cached.ts +65 -0
  19. package/app/apps/github/src/clients/calls.ts +160 -0
  20. package/app/apps/github/src/clients/clients.ts +82 -0
  21. package/app/apps/github/src/clients/graphql.ts +50 -0
  22. package/app/apps/github/src/clients/host-answer.ts +28 -0
  23. package/app/apps/github/src/clients/host-calls.ts +382 -0
  24. package/app/apps/github/src/clients/icon-bytes.ts +203 -0
  25. package/app/apps/github/src/clients/proxy.ts +59 -0
  26. package/app/apps/github/src/clients/session-ended.ts +18 -0
  27. package/app/apps/github/src/clients/transfers.ts +212 -0
  28. package/app/apps/github/src/code/breadcrumbs.tsx +50 -0
  29. package/app/apps/github/src/code/code-page.tsx +147 -0
  30. package/app/apps/github/src/code/code-tree.tsx +338 -0
  31. package/app/apps/github/src/code/controls.tsx +230 -0
  32. package/app/apps/github/src/code/file-view.tsx +450 -0
  33. package/app/apps/github/src/code/files.ts +332 -0
  34. package/app/apps/github/src/code/folder-list.tsx +122 -0
  35. package/app/apps/github/src/code/go-to-file.tsx +131 -0
  36. package/app/apps/github/src/code/highlighted.tsx +58 -0
  37. package/app/apps/github/src/code/lines.ts +46 -0
  38. package/app/apps/github/src/code/load.ts +147 -0
  39. package/app/apps/github/src/code/markdown-files.ts +58 -0
  40. package/app/apps/github/src/code/places.ts +88 -0
  41. package/app/apps/github/src/code/ref-pages.ts +179 -0
  42. package/app/apps/github/src/code/ref-switcher.tsx +203 -0
  43. package/app/apps/github/src/code/refs.ts +142 -0
  44. package/app/apps/github/src/code/repo-home.tsx +240 -0
  45. package/app/apps/github/src/code/repo.ts +105 -0
  46. package/app/apps/github/src/code/saved-reads.ts +199 -0
  47. package/app/apps/github/src/code/saved.ts +110 -0
  48. package/app/apps/github/src/code/tree-fold.ts +186 -0
  49. package/app/apps/github/src/code/trees.ts +136 -0
  50. package/app/apps/github/src/components/avatar-picture.ts +53 -0
  51. package/app/apps/github/src/components/avatar-url.ts +16 -0
  52. package/app/apps/github/src/components/confirm-action.tsx +100 -0
  53. package/app/apps/github/src/components/count.tsx +24 -0
  54. package/app/apps/github/src/components/create-button.tsx +38 -0
  55. package/app/apps/github/src/components/file-icons/file-icons.css +225 -0
  56. package/app/apps/github/src/components/file-icons/file-icons.tsx +138 -0
  57. package/app/apps/github/src/components/filter.tsx +35 -0
  58. package/app/apps/github/src/components/hotkeys/hotkeys.tsx +255 -0
  59. package/app/apps/github/src/components/item-list.tsx +65 -0
  60. package/app/apps/github/src/components/language-dot.tsx +29 -0
  61. package/app/apps/github/src/components/list-toolbar.tsx +82 -0
  62. package/app/apps/github/src/components/markdown/editor.tsx +57 -0
  63. package/app/apps/github/src/components/markdown/markdown.css +177 -0
  64. package/app/apps/github/src/components/markdown/markdown.tsx +82 -0
  65. package/app/apps/github/src/components/owner-card.tsx +196 -0
  66. package/app/apps/github/src/components/pull-status.tsx +34 -0
  67. package/app/apps/github/src/components/recent.ts +41 -0
  68. package/app/apps/github/src/components/relative-time.tsx +78 -0
  69. package/app/apps/github/src/components/repos/icon-hashes.ts +91 -0
  70. package/app/apps/github/src/components/repos/new-repo-form.tsx +196 -0
  71. package/app/apps/github/src/components/repos/repo-icon.tsx +47 -0
  72. package/app/apps/github/src/components/repos/repo-list.tsx +528 -0
  73. package/app/apps/github/src/components/repos/your-repos.tsx +124 -0
  74. package/app/apps/github/src/components/review-state.tsx +75 -0
  75. package/app/apps/github/src/components/route-dialog.tsx +137 -0
  76. package/app/apps/github/src/components/save-button.tsx +58 -0
  77. package/app/apps/github/src/components/shell/app-shell.tsx +164 -0
  78. package/app/apps/github/src/components/shell/create-org-dialog.tsx +118 -0
  79. package/app/apps/github/src/components/shell/create-row.tsx +49 -0
  80. package/app/apps/github/src/components/shell/link-menu.tsx +94 -0
  81. package/app/apps/github/src/components/shell/nav-user.tsx +97 -0
  82. package/app/apps/github/src/components/shell/owner-repos.tsx +247 -0
  83. package/app/apps/github/src/components/shell/owner-switcher.tsx +104 -0
  84. package/app/apps/github/src/components/shell/repo-switcher.tsx +179 -0
  85. package/app/apps/github/src/components/shell/sections.ts +31 -0
  86. package/app/apps/github/src/components/shell/submenu-chevron.ts +147 -0
  87. package/app/apps/github/src/components/signin/device-card.tsx +139 -0
  88. package/app/apps/github/src/components/signin/login-form.tsx +88 -0
  89. package/app/apps/github/src/components/signin/signin-page.tsx +33 -0
  90. package/app/apps/github/src/components/signin/signup-form.tsx +106 -0
  91. package/app/apps/github/src/components/states/live-status.tsx +42 -0
  92. package/app/apps/github/src/components/states/states.tsx +126 -0
  93. package/app/apps/github/src/components/tab-indicator.tsx +143 -0
  94. package/app/apps/github/src/components/theme-choice.tsx +108 -0
  95. package/app/apps/github/src/components/theme-provider.tsx +126 -0
  96. package/app/apps/github/src/components/tones.ts +23 -0
  97. package/app/apps/github/src/components/ui/alert-dialog.tsx +187 -0
  98. package/app/apps/github/src/components/ui/alert.tsx +78 -0
  99. package/app/apps/github/src/components/ui/avatar.tsx +106 -0
  100. package/app/apps/github/src/components/ui/badge.tsx +51 -0
  101. package/app/apps/github/src/components/ui/breadcrumb.tsx +124 -0
  102. package/app/apps/github/src/components/ui/button-group.tsx +87 -0
  103. package/app/apps/github/src/components/ui/button.tsx +61 -0
  104. package/app/apps/github/src/components/ui/calendar.tsx +221 -0
  105. package/app/apps/github/src/components/ui/card.tsx +102 -0
  106. package/app/apps/github/src/components/ui/checkbox.tsx +26 -0
  107. package/app/apps/github/src/components/ui/collapsible.tsx +19 -0
  108. package/app/apps/github/src/components/ui/combobox.tsx +304 -0
  109. package/app/apps/github/src/components/ui/command.tsx +208 -0
  110. package/app/apps/github/src/components/ui/dialog.tsx +156 -0
  111. package/app/apps/github/src/components/ui/dropdown-menu.tsx +290 -0
  112. package/app/apps/github/src/components/ui/empty.tsx +100 -0
  113. package/app/apps/github/src/components/ui/field.tsx +236 -0
  114. package/app/apps/github/src/components/ui/hover-card.tsx +48 -0
  115. package/app/apps/github/src/components/ui/input-group.tsx +163 -0
  116. package/app/apps/github/src/components/ui/input.tsx +19 -0
  117. package/app/apps/github/src/components/ui/item.tsx +201 -0
  118. package/app/apps/github/src/components/ui/kbd.tsx +27 -0
  119. package/app/apps/github/src/components/ui/label.tsx +33 -0
  120. package/app/apps/github/src/components/ui/popover.tsx +87 -0
  121. package/app/apps/github/src/components/ui/radio-group.tsx +35 -0
  122. package/app/apps/github/src/components/ui/select.tsx +198 -0
  123. package/app/apps/github/src/components/ui/separator.tsx +22 -0
  124. package/app/apps/github/src/components/ui/sheet.tsx +138 -0
  125. package/app/apps/github/src/components/ui/sidebar.tsx +724 -0
  126. package/app/apps/github/src/components/ui/skeleton.tsx +13 -0
  127. package/app/apps/github/src/components/ui/sonner.tsx +47 -0
  128. package/app/apps/github/src/components/ui/styles.css +242 -0
  129. package/app/apps/github/src/components/ui/table.tsx +113 -0
  130. package/app/apps/github/src/components/ui/tabs.tsx +79 -0
  131. package/app/apps/github/src/components/ui/textarea.tsx +17 -0
  132. package/app/apps/github/src/components/ui/title.ts +6 -0
  133. package/app/apps/github/src/components/ui/toggle-group.tsx +89 -0
  134. package/app/apps/github/src/components/ui/toggle.tsx +42 -0
  135. package/app/apps/github/src/components/ui/tooltip.tsx +63 -0
  136. package/app/apps/github/src/components/user-avatar.tsx +145 -0
  137. package/app/apps/github/src/components/view-tabs.tsx +42 -0
  138. package/app/apps/github/src/context/context.ts +133 -0
  139. package/app/apps/github/src/diffs/blobs.ts +94 -0
  140. package/app/apps/github/src/diffs/diff-view.tsx +155 -0
  141. package/app/apps/github/src/diffs/files.ts +121 -0
  142. package/app/apps/github/src/diffs/hunks.tsx +454 -0
  143. package/app/apps/github/src/diffs/patch.ts +131 -0
  144. package/app/apps/github/src/diffs/rows.ts +137 -0
  145. package/app/apps/github/src/history/commit-diff.ts +54 -0
  146. package/app/apps/github/src/history/commit-list.tsx +207 -0
  147. package/app/apps/github/src/history/commit-page.tsx +147 -0
  148. package/app/apps/github/src/history/history.ts +129 -0
  149. package/app/apps/github/src/hooks/allowed.ts +31 -0
  150. package/app/apps/github/src/hooks/answers.ts +65 -0
  151. package/app/apps/github/src/hooks/avatars.ts +54 -0
  152. package/app/apps/github/src/hooks/draft.ts +38 -0
  153. package/app/apps/github/src/hooks/open-counts.ts +127 -0
  154. package/app/apps/github/src/hooks/profiles.ts +120 -0
  155. package/app/apps/github/src/hooks/repos.ts +440 -0
  156. package/app/apps/github/src/hooks/use-mobile.ts +19 -0
  157. package/app/apps/github/src/hooks/viewer.ts +39 -0
  158. package/app/apps/github/src/inbox/count.ts +70 -0
  159. package/app/apps/github/src/inbox/inbox-item.tsx +66 -0
  160. package/app/apps/github/src/inbox/inbox-page.tsx +572 -0
  161. package/app/apps/github/src/inbox/marks.ts +130 -0
  162. package/app/apps/github/src/inbox/release-tags.ts +65 -0
  163. package/app/apps/github/src/inbox/search.ts +97 -0
  164. package/app/apps/github/src/inbox/subjects.ts +184 -0
  165. package/app/apps/github/src/inbox/subscription-controls.tsx +184 -0
  166. package/app/apps/github/src/inbox/subscriptions.ts +189 -0
  167. package/app/apps/github/src/inbox/threads.ts +198 -0
  168. package/app/apps/github/src/issues/changes.ts +332 -0
  169. package/app/apps/github/src/issues/counts.ts +62 -0
  170. package/app/apps/github/src/issues/issue-list.tsx +682 -0
  171. package/app/apps/github/src/issues/issue-page.tsx +533 -0
  172. package/app/apps/github/src/issues/issues.ts +566 -0
  173. package/app/apps/github/src/issues/label-dialog.tsx +310 -0
  174. package/app/apps/github/src/issues/labels-page.tsx +119 -0
  175. package/app/apps/github/src/issues/new-issue.tsx +79 -0
  176. package/app/apps/github/src/issues/parts.tsx +71 -0
  177. package/app/apps/github/src/issues/picker.tsx +298 -0
  178. package/app/apps/github/src/issues/search.ts +238 -0
  179. package/app/apps/github/src/issues/sidebar.tsx +236 -0
  180. package/app/apps/github/src/lib/cn.ts +8 -0
  181. package/app/apps/github/src/lib/highlighting.ts +13 -0
  182. package/app/apps/github/src/live/follow.ts +129 -0
  183. package/app/apps/github/src/live/sse.ts +74 -0
  184. package/app/apps/github/src/live/use-follow.ts +37 -0
  185. package/app/apps/github/src/markdown/README.md +53 -0
  186. package/app/apps/github/src/markdown/allowed-html.ts +69 -0
  187. package/app/apps/github/src/markdown/context.ts +206 -0
  188. package/app/apps/github/src/markdown/images.ts +81 -0
  189. package/app/apps/github/src/markdown/lookup.ts +122 -0
  190. package/app/apps/github/src/markdown/patches.ts +299 -0
  191. package/app/apps/github/src/markdown/query.ts +25 -0
  192. package/app/apps/github/src/markdown/references.ts +158 -0
  193. package/app/apps/github/src/markdown/render.ts +103 -0
  194. package/app/apps/github/src/names/owners.ts +51 -0
  195. package/app/apps/github/src/names/repos.ts +24 -0
  196. package/app/apps/github/src/palette/palette.tsx +547 -0
  197. package/app/apps/github/src/palette/recent.ts +116 -0
  198. package/app/apps/github/src/palette/rows.tsx +455 -0
  199. package/app/apps/github/src/palette/server.ts +104 -0
  200. package/app/apps/github/src/palette/targets.ts +306 -0
  201. package/app/apps/github/src/policy.ts +600 -0
  202. package/app/apps/github/src/private-repos.ts +47 -0
  203. package/app/apps/github/src/pulls/compare-page.tsx +342 -0
  204. package/app/apps/github/src/pulls/files-tab.tsx +776 -0
  205. package/app/apps/github/src/pulls/live.ts +124 -0
  206. package/app/apps/github/src/pulls/merge-box.tsx +367 -0
  207. package/app/apps/github/src/pulls/merge-button.ts +86 -0
  208. package/app/apps/github/src/pulls/pull-list.tsx +235 -0
  209. package/app/apps/github/src/pulls/pull-page.tsx +474 -0
  210. package/app/apps/github/src/pulls/pull.ts +468 -0
  211. package/app/apps/github/src/pulls/pulls.ts +318 -0
  212. package/app/apps/github/src/pulls/review.ts +350 -0
  213. package/app/apps/github/src/pulls/search.ts +130 -0
  214. package/app/apps/github/src/queue/queue-page.tsx +405 -0
  215. package/app/apps/github/src/queue/queue.ts +231 -0
  216. package/app/apps/github/src/releases/latest-release.tsx +55 -0
  217. package/app/apps/github/src/releases/overview.tsx +30 -0
  218. package/app/apps/github/src/releases/release-form.tsx +353 -0
  219. package/app/apps/github/src/releases/release-list.tsx +173 -0
  220. package/app/apps/github/src/releases/release-view.tsx +183 -0
  221. package/app/apps/github/src/releases/releases.ts +308 -0
  222. package/app/apps/github/src/releases/tag-list.tsx +134 -0
  223. package/app/apps/github/src/router.tsx +46 -0
  224. package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +33 -0
  225. package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +28 -0
  226. package/app/apps/github/src/routes/$owner/$repo/_code.tsx +11 -0
  227. package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +19 -0
  228. package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +19 -0
  229. package/app/apps/github/src/routes/$owner/$repo/_releases.tsx +23 -0
  230. package/app/apps/github/src/routes/$owner/$repo/branches.tsx +39 -0
  231. package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +34 -0
  232. package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +42 -0
  233. package/app/apps/github/src/routes/$owner/$repo/compare/$.tsx +19 -0
  234. package/app/apps/github/src/routes/$owner/$repo/index.tsx +24 -0
  235. package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +50 -0
  236. package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +53 -0
  237. package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +43 -0
  238. package/app/apps/github/src/routes/$owner/$repo/labels.tsx +22 -0
  239. package/app/apps/github/src/routes/$owner/$repo/pull/$number/checks.tsx +15 -0
  240. package/app/apps/github/src/routes/$owner/$repo/pull/$number/commits.tsx +15 -0
  241. package/app/apps/github/src/routes/$owner/$repo/pull/$number/files.tsx +15 -0
  242. package/app/apps/github/src/routes/$owner/$repo/pull/$number/index.tsx +19 -0
  243. package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +52 -0
  244. package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +48 -0
  245. package/app/apps/github/src/routes/$owner/$repo/queue.tsx +22 -0
  246. package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +58 -0
  247. package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +40 -0
  248. package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +35 -0
  249. package/app/apps/github/src/routes/$owner/$repo/route.tsx +102 -0
  250. package/app/apps/github/src/routes/$owner/$repo/settings/access.tsx +9 -0
  251. package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +16 -0
  252. package/app/apps/github/src/routes/$owner/$repo/settings/hooks/new.tsx +25 -0
  253. package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +17 -0
  254. package/app/apps/github/src/routes/$owner/$repo/settings/route.tsx +28 -0
  255. package/app/apps/github/src/routes/$owner/$repo/settings/rules.tsx +12 -0
  256. package/app/apps/github/src/routes/$owner/$repo/tokens.tsx +16 -0
  257. package/app/apps/github/src/routes/$owner/index.tsx +45 -0
  258. package/app/apps/github/src/routes/-nav.tsx +293 -0
  259. package/app/apps/github/src/routes/-root-testing.ts +107 -0
  260. package/app/apps/github/src/routes/__root.tsx +225 -0
  261. package/app/apps/github/src/routes/api.auth.$.ts +18 -0
  262. package/app/apps/github/src/routes/downloads/$owner/$repo/$asset.tsx +10 -0
  263. package/app/apps/github/src/routes/file-icons[.]svg.ts +21 -0
  264. package/app/apps/github/src/routes/icons/$owner/$repo.tsx +14 -0
  265. package/app/apps/github/src/routes/icons/$owner/index.tsx +14 -0
  266. package/app/apps/github/src/routes/icons/index.tsx +12 -0
  267. package/app/apps/github/src/routes/index.tsx +48 -0
  268. package/app/apps/github/src/routes/login.tsx +24 -0
  269. package/app/apps/github/src/routes/login_.code.tsx +31 -0
  270. package/app/apps/github/src/routes/new.tsx +91 -0
  271. package/app/apps/github/src/routes/notifications.tsx +20 -0
  272. package/app/apps/github/src/routes/orgs/$owner/issues.tsx +8 -0
  273. package/app/apps/github/src/routes/orgs/$owner/pulls.tsx +8 -0
  274. package/app/apps/github/src/routes/orgs/$owner/releases.tsx +8 -0
  275. package/app/apps/github/src/routes/orgs/$owner/route.tsx +25 -0
  276. package/app/apps/github/src/routes/orgs/$owner/settings.tsx +30 -0
  277. package/app/apps/github/src/routes/orgs/$owner/tokens.tsx +15 -0
  278. package/app/apps/github/src/routes/settings.tsx +54 -0
  279. package/app/apps/github/src/routes/signup.tsx +24 -0
  280. package/app/apps/github/src/routes/uploads/$owner/$repo/$release.tsx +10 -0
  281. package/app/apps/github/src/seed/acme.ts +498 -0
  282. package/app/apps/github/src/seed/licenses.ts +114 -0
  283. package/app/apps/github/src/seed/seed.ts +538 -0
  284. package/app/apps/github/src/server.ts +97 -0
  285. package/app/apps/github/src/settings/account-avatar.tsx +43 -0
  286. package/app/apps/github/src/settings/avatar-section.tsx +140 -0
  287. package/app/apps/github/src/settings/avatar.ts +58 -0
  288. package/app/apps/github/src/settings/general-settings.tsx +439 -0
  289. package/app/apps/github/src/settings/general.ts +73 -0
  290. package/app/apps/github/src/settings/hook-form.tsx +195 -0
  291. package/app/apps/github/src/settings/hook-list.tsx +166 -0
  292. package/app/apps/github/src/settings/hooks.ts +87 -0
  293. package/app/apps/github/src/settings/org-settings.tsx +228 -0
  294. package/app/apps/github/src/settings/orgs.ts +116 -0
  295. package/app/apps/github/src/settings/rule-list.tsx +72 -0
  296. package/app/apps/github/src/settings/rules.ts +27 -0
  297. package/app/apps/github/src/settings/settings-layout.tsx +114 -0
  298. package/app/apps/github/src/signin/approval.ts +186 -0
  299. package/app/apps/github/src/signin/auth-client.ts +127 -0
  300. package/app/apps/github/src/signin/auth.ts +753 -0
  301. package/app/apps/github/src/signin/avatars.ts +126 -0
  302. package/app/apps/github/src/signin/client-ip.ts +39 -0
  303. package/app/apps/github/src/signin/credentials.ts +26 -0
  304. package/app/apps/github/src/signin/device-code.ts +95 -0
  305. package/app/apps/github/src/signin/device-prompt.ts +125 -0
  306. package/app/apps/github/src/signin/errors.ts +135 -0
  307. package/app/apps/github/src/signin/host-session.ts +68 -0
  308. package/app/apps/github/src/signin/orgs.ts +283 -0
  309. package/app/apps/github/src/signin/owner-names.ts +183 -0
  310. package/app/apps/github/src/signin/person-lock.ts +104 -0
  311. package/app/apps/github/src/signin/seal.ts +88 -0
  312. package/app/apps/github/src/signin/seed-people.ts +92 -0
  313. package/app/apps/github/src/signin/session.ts +48 -0
  314. package/app/apps/github/src/signin/unborn.ts +110 -0
  315. package/app/apps/github/src/signin/viewer-orgs.ts +47 -0
  316. package/app/apps/github/src/signin/viewer.ts +74 -0
  317. package/app/apps/github/src/signin/with-headers.ts +14 -0
  318. package/app/apps/github/src/tokens/tokens-page.tsx +529 -0
  319. package/app/apps/github/src/tokens/tokens.ts +54 -0
  320. package/app/apps/github/tsconfig.json +25 -0
  321. package/app/apps/github/tsconfig.worker.json +24 -0
  322. package/app/apps/github/vite.config.ts +21 -0
  323. package/app/pnpm-workspace.yaml +216 -0
  324. package/app/tsconfig.base.json +127 -0
  325. package/dist/LICENSE +202 -0
  326. package/dist/cli/child.mjs +42 -0
  327. package/dist/cli/commands.mjs +23 -0
  328. package/dist/cli/credentials.mjs +84 -0
  329. package/dist/cli/documents.mjs +214 -0
  330. package/dist/cli/events.mjs +55 -0
  331. package/dist/cli/failure.mjs +105 -0
  332. package/dist/cli/folders.mjs +32 -0
  333. package/dist/cli/git-remote-ref0.d.mts +1 -0
  334. package/dist/cli/git-remote-ref0.mjs +29 -0
  335. package/dist/cli/git.mjs +48 -0
  336. package/dist/cli/helpers.mjs +51 -0
  337. package/dist/cli/hosts.mjs +127 -0
  338. package/dist/cli/node.mjs +15 -0
  339. package/dist/cli/output.mjs +135 -0
  340. package/dist/cli/prompt.mjs +35 -0
  341. package/dist/cli/queue.mjs +215 -0
  342. package/dist/cli/ref0-git.d.mts +1 -0
  343. package/dist/cli/ref0-git.mjs +144 -0
  344. package/dist/cli/repos.mjs +162 -0
  345. package/dist/cli/resources.mjs +131 -0
  346. package/dist/cli/run-end.mjs +57 -0
  347. package/dist/cli/runtime.mjs +50 -0
  348. package/dist/cli/setup.mjs +1410 -0
  349. package/dist/cli/sign-in.mjs +162 -0
  350. package/dist/cli/sign-ins.mjs +79 -0
  351. package/dist/cli/sqlite.mjs +28 -0
  352. package/dist/cli/tokens.mjs +141 -0
  353. package/dist/cli/vendor.mjs +123 -0
  354. package/dist/init/app.mjs +231 -0
  355. package/dist/init/astro.mjs +49 -0
  356. package/dist/init/choices.mjs +497 -0
  357. package/dist/init/cloudflare.mjs +324 -0
  358. package/dist/init/create.mjs +151 -0
  359. package/dist/init/detect.mjs +297 -0
  360. package/dist/init/files.mjs +75 -0
  361. package/dist/init/frameworks.mjs +248 -0
  362. package/dist/init/git-module.mjs +49 -0
  363. package/dist/init/github-routes.mjs +66 -0
  364. package/dist/init/jsonc.mjs +143 -0
  365. package/dist/init/metadata.mjs +48 -0
  366. package/dist/init/mounts.mjs +109 -0
  367. package/dist/init/next.mjs +205 -0
  368. package/dist/init/node-app.mjs +189 -0
  369. package/dist/init/node.mjs +458 -0
  370. package/dist/init/nuxt.mjs +115 -0
  371. package/dist/init/output.mjs +21 -0
  372. package/dist/init/plan.mjs +82 -0
  373. package/dist/init/range-major.mjs +257 -0
  374. package/dist/init/react-router.mjs +59 -0
  375. package/dist/init/routes.mjs +148 -0
  376. package/dist/init/shell.mjs +4 -0
  377. package/dist/init/stores.mjs +51 -0
  378. package/dist/init/sveltekit.mjs +139 -0
  379. package/dist/init/template.mjs +142 -0
  380. package/dist/init/templates.mjs +343 -0
  381. package/dist/init/vercel.mjs +383 -0
  382. package/dist/init/versions.mjs +32 -0
  383. package/dist/init/workspace.mjs +20 -0
  384. package/package.json +48 -6
  385. package/README.md +0 -5
@@ -0,0 +1,497 @@
1
+ import { looseSays } from "./git-module.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ // src/init/choices.ts
4
+ const valued = (flag) => (value) => [`--${flag}`, value];
5
+ /** Each platform's name, as a headline says it. */
6
+ const platformNames = {
7
+ cloudflare: "Cloudflare",
8
+ vercel: "Vercel",
9
+ node: "Node"
10
+ };
11
+ /** `value`, when it names a platform. */
12
+ const platformNamed = (value) => value === "cloudflare" || value === "vercel" || value === "node" ? value : void 0;
13
+ /** The values `offered`, as a headline lists them. */
14
+ const takes = (offered) => offered.map((offer) => offer.value).join(" or ");
15
+ /** Refused unless `context` offers it, as `not_on_platform`. */
16
+ const onPlatform = (choice, value, context) => {
17
+ const offered = choice.offers(context);
18
+ if (offered.some((offer) => offer.value === value)) return void 0;
19
+ const on = platformNamed(context.chosen.platform);
20
+ return {
21
+ reason: "not_on_platform",
22
+ headline: `On ${on === void 0 ? "this platform" : platformNames[on]}, --${choice.flag} takes ${takes(offered)}`
23
+ };
24
+ };
25
+ const serve = {
26
+ key: "serve",
27
+ flag: "serve",
28
+ row: "Serve",
29
+ question: "What should it serve?",
30
+ offers: () => [
31
+ {
32
+ value: "github",
33
+ says: "GitHub-compatible",
34
+ why: "gh, Octokit and GitHub's Actions work against it"
35
+ },
36
+ {
37
+ value: "api",
38
+ says: "Git and its REST API",
39
+ why: "repos, tokens and the merge queue over REST"
40
+ },
41
+ {
42
+ value: "git",
43
+ says: "Git only",
44
+ why: "Git's protocol, and your code makes the repos"
45
+ }
46
+ ],
47
+ named: valued("serve")
48
+ };
49
+ /** The platforms the app is written for: its pages and sign-in run there. */
50
+ const appPlatforms = ["cloudflare", "node"];
51
+ const appBuilt = (platform) => appPlatforms.some((each) => each === platform);
52
+ /** `--app` on a platform it isn't written for: the flag the platform can't take, as any other's. */
53
+ const appOffPlatform = {
54
+ reason: "not_on_platform",
55
+ headline: `The app runs on ${appPlatforms.map((each) => platformNames[each]).join(" and ")}: --platform takes ${appPlatforms.join(" or ")} with --app`
56
+ };
57
+ /**
58
+ * The app's pages read GitHub's REST, and own `/` and their routes: only a new project's, and on
59
+ * the platforms it's written for.
60
+ */
61
+ const app = {
62
+ key: "app",
63
+ flag: "app",
64
+ row: "App",
65
+ question: "Add the web app?",
66
+ offers: ({ project, chosen, creating }) => {
67
+ if (creating !== void 0) return [{
68
+ value: "framework",
69
+ says: `A new ${creating.says} app`,
70
+ why: "its own create command, then Git in it"
71
+ }, {
72
+ value: "none",
73
+ says: "No",
74
+ why: "only the APIs"
75
+ }];
76
+ const ref0 = project === "new" && chosen.serve === "github" && appBuilt(chosen.platform) ? [{
77
+ value: "ref0",
78
+ says: "The ref0 app",
79
+ why: "pages for code, pull requests and issues"
80
+ }] : [];
81
+ const none = [{
82
+ value: "none",
83
+ says: "No",
84
+ why: project === "new" ? "only the APIs" : "the app starts a project of its own"
85
+ }];
86
+ return chosen.platform === "node" ? [...none, ...ref0] : [...ref0, ...none];
87
+ },
88
+ refuse: (value, { project, chosen, held, creating }) => value === "framework" !== (creating !== void 0) ? {
89
+ reason: "app_choices_conflict",
90
+ headline: "--app, --framework and --no-app are one choice: pass one of them"
91
+ } : value === "framework" ? void 0 : value === "none" ? held?.app === "ref0" ? {
92
+ reason: "app_held",
93
+ headline: "This setup has the app, which init can't take out: its pages are yours. Set up Git without it in an empty folder"
94
+ } : void 0 : project === "existing" ? {
95
+ reason: "app_needs_new_project",
96
+ headline: "The web app starts a project of its own: run init with --app in an empty folder"
97
+ } : chosen.serve !== "github" ? {
98
+ reason: "app_needs_github",
99
+ headline: "The web app reads GitHub's REST: it takes --serve github"
100
+ } : appBuilt(chosen.platform) ? void 0 : appOffPlatform,
101
+ named: (value) => [Object.entries(appFlags).find(([answer]) => answer === value)?.[1] ?? "--no-app"]
102
+ };
103
+ /** The flag that names each answer of the app's. */
104
+ const appFlags = {
105
+ ref0: "--app",
106
+ framework: "--framework",
107
+ none: "--no-app"
108
+ };
109
+ const platforms = [
110
+ {
111
+ value: "cloudflare",
112
+ says: "Cloudflare",
113
+ why: "Git, its records and its packs in one Worker"
114
+ },
115
+ {
116
+ value: "vercel",
117
+ says: "Vercel",
118
+ why: "Git in Vercel's functions, its jobs woken by Vercel Queues"
119
+ },
120
+ {
121
+ value: "node",
122
+ says: "Node",
123
+ why: "one process of your own, on a server or a VM"
124
+ }
125
+ ];
126
+ /**
127
+ * The platforms a folder on `folder` can move to: a Node project stays on Node, and a Worker or a
128
+ * Vercel project moves between the two, each held store a conflict to settle.
129
+ */
130
+ const movesTo = {
131
+ cloudflare: ["cloudflare", "vercel"],
132
+ vercel: ["cloudflare", "vercel"],
133
+ node: ["node"]
134
+ };
135
+ const platform = {
136
+ key: "platform",
137
+ flag: "platform",
138
+ row: "Platform",
139
+ question: "Where will it run?",
140
+ offers: ({ folder, creating }) => creating === void 0 ? platforms.filter((each) => folder === void 0 || movesTo[folder].some((value) => value === each.value)) : creating.platforms.flatMap((each) => platforms.filter((offer) => offer.value === each)),
141
+ refuse: (value, context) => {
142
+ const offered = platform.offers(context);
143
+ if (offered.some((offer) => offer.value === value)) return void 0;
144
+ return {
145
+ reason: "not_on_platform",
146
+ headline: context.creating !== void 0 ? `A new ${context.creating.says} app runs on ${offered.map((offer) => offer.says).join(" or ")}: --platform takes ${takes(offered)}` : context.folder === void 0 ? `--platform takes ${takes(offered)}` : `This folder runs on ${platformNames[context.folder]}: --platform takes ${takes(offered)}`
147
+ };
148
+ },
149
+ named: valued("platform")
150
+ };
151
+ /** The records stores each platform offers. */
152
+ const recordsOffered = {
153
+ cloudflare: [{
154
+ value: "durable-objects",
155
+ says: "Durable Objects",
156
+ why: "the one store a Worker can wake"
157
+ }],
158
+ vercel: [{
159
+ value: "postgres",
160
+ says: "Postgres",
161
+ why: "Vercel's Marketplace Postgres takes each commit in one transaction"
162
+ }, {
163
+ value: "turso",
164
+ says: "Turso",
165
+ why: "a database per repo, at the cost of a Platform API token"
166
+ }],
167
+ node: [
168
+ {
169
+ value: "sqlite",
170
+ says: "SQLite",
171
+ why: "one file, with no server, and one process owns the jobs"
172
+ },
173
+ {
174
+ value: "postgres",
175
+ says: "Postgres",
176
+ why: "several replicas share the work"
177
+ },
178
+ {
179
+ value: "turso",
180
+ says: "Turso",
181
+ why: "a database for each repo, in one Turso group"
182
+ }
183
+ ]
184
+ };
185
+ const records = {
186
+ key: "records",
187
+ flag: "records",
188
+ row: "Records",
189
+ question: "Where should it keep its records?",
190
+ offers: ({ chosen }) => recordsOffered[platformNamed(chosen.platform) ?? "cloudflare"],
191
+ named: valued("records")
192
+ };
193
+ const objects = {
194
+ key: "objects",
195
+ flag: "objects",
196
+ row: "Objects",
197
+ question: "How should it keep objects?",
198
+ offers: ({ chosen }) => {
199
+ const packs = {
200
+ value: "packs",
201
+ says: "Packs",
202
+ why: "pushes of any size, streamed clones, and Git LFS"
203
+ };
204
+ const loose = {
205
+ value: "loose",
206
+ says: "Loose",
207
+ why: `no bucket, ${looseSays}`
208
+ };
209
+ return chosen.platform === "vercel" ? [packs] : [packs, loose];
210
+ },
211
+ refuse: (value, context) => value === "loose" && context.chosen.platform === "vercel" ? {
212
+ reason: "not_on_platform",
213
+ headline: "On Vercel, --objects takes packs: a request body is at most 4.5 MB, so a larger push needs a bucket to upload its pack to"
214
+ } : onPlatform(objects, value, context),
215
+ named: valued("objects")
216
+ };
217
+ const bucket = {
218
+ key: "bucket",
219
+ flag: "bucket",
220
+ row: "Bucket",
221
+ question: "Where should it keep its packs?",
222
+ offers: ({ chosen }) => chosen.objects === "loose" ? [{
223
+ value: "none",
224
+ says: "None",
225
+ why: "loose objects keep no bucket"
226
+ }] : chosen.platform === "node" ? [{
227
+ value: "disk",
228
+ says: "A folder",
229
+ why: "beside the records, with no keys to keep"
230
+ }, {
231
+ value: "s3",
232
+ says: "S3",
233
+ why: "any S3-compatible bucket, which signs large pushes' parts and LFS's links"
234
+ }] : chosen.platform === "vercel" ? [{
235
+ value: "vercel-blob",
236
+ says: "Vercel Blob",
237
+ why: "it comes with the project, with no account elsewhere"
238
+ }, {
239
+ value: "s3",
240
+ says: "S3",
241
+ why: "any S3 bucket, and LFS files past 4.5 MB"
242
+ }] : [{
243
+ value: "r2",
244
+ says: "R2",
245
+ why: "bound to the Worker, with no keys to keep"
246
+ }],
247
+ refuse: (value, context) => context.chosen.objects !== "loose" ? onPlatform(bucket, value, context) : value === "none" ? void 0 : {
248
+ reason: "loose_has_no_bucket",
249
+ headline: "--bucket goes with --objects packs"
250
+ },
251
+ named: (value) => value === "none" ? [] : ["--bucket", value]
252
+ };
253
+ const queue = {
254
+ key: "queue",
255
+ flag: "queue",
256
+ row: "Merge queue",
257
+ question: "Run a merge queue on main?",
258
+ offers: () => [{
259
+ value: "on",
260
+ says: "On main",
261
+ why: "one change at a time, each built on the tip first"
262
+ }, {
263
+ value: "off",
264
+ says: "Off",
265
+ why: "changes merge to main as they are"
266
+ }],
267
+ named: (value) => [value === "on" ? "--queue" : "--no-queue"]
268
+ };
269
+ const basePath = {
270
+ key: "basePath",
271
+ flag: "base-path",
272
+ row: "Base path",
273
+ question: "Where should Git's URLs live?",
274
+ offers: ({ project, chosen, framework }) => {
275
+ const root = {
276
+ value: "/",
277
+ says: "At the root",
278
+ why: "clone URLs as short as GitHub's"
279
+ };
280
+ const under = {
281
+ value: "/git",
282
+ says: "Under /git",
283
+ why: "Git's URLs stay out of your routes"
284
+ };
285
+ if (chosen.app === "ref0") return [root];
286
+ if (framework !== void 0) return [under];
287
+ return project === "new" ? [root, under] : [under, root];
288
+ },
289
+ refuse: (value, { chosen, framework }) => !/^\/([\w.-]+\/?)*$/.test(value) ? {
290
+ reason: "invalid_base_path",
291
+ headline: `${value} isn't a path, such as /git`
292
+ } : framework !== void 0 && value === "/" ? {
293
+ reason: "invalid_base_path",
294
+ headline: `--base-path / would put a catch-all route at the root of this ${framework} app, taking the URLs its own pages don't match: pass --base-path /git, or another path`
295
+ } : chosen.app === "ref0" && value !== "/" ? {
296
+ reason: "app_needs_root",
297
+ headline: "The web app serves Git at the root so far: pass --base-path /"
298
+ } : void 0,
299
+ named: valued("base-path")
300
+ };
301
+ const vercelPlan = {
302
+ key: "vercelPlan",
303
+ flag: "vercel-plan",
304
+ row: "Vercel plan",
305
+ question: "Which Vercel plan does the project's team have?",
306
+ offers: ({ chosen }) => chosen.platform === "vercel" ? [{
307
+ value: "hobby",
308
+ says: "Hobby",
309
+ why: "deploys on every plan; Pro sweeps each minute and lets a clone run 800 s"
310
+ }, {
311
+ value: "pro",
312
+ says: "Pro",
313
+ why: "the cron sweeps each minute, and a clone may run 800 s"
314
+ }] : [{
315
+ value: "none",
316
+ says: "None",
317
+ why: ""
318
+ }],
319
+ refuse: (value, context) => context.chosen.platform !== "vercel" && value !== "none" ? {
320
+ reason: "not_on_platform",
321
+ headline: "--vercel-plan goes with --platform vercel"
322
+ } : onPlatform(vercelPlan, value, context),
323
+ named: (value) => value === "none" ? [] : ["--vercel-plan", value],
324
+ shown: ({ chosen }) => chosen.platform === "vercel"
325
+ };
326
+ /** Why `value` can't be `choice`'s answer here, if it can't. */
327
+ const refusalOf = (choice, value, context) => choice.refuse === void 0 ? onPlatform(choice, value, context) : choice.refuse(value, context);
328
+ /** Every choice, in the order `init` asks them. */
329
+ const choices = [
330
+ serve,
331
+ platform,
332
+ app,
333
+ records,
334
+ objects,
335
+ bucket,
336
+ queue,
337
+ basePath,
338
+ vercelPlan
339
+ ];
340
+ /**
341
+ * What each held answer a flag moved costs, as the receipt and `--dry-run` say it: a line for each
342
+ * move that leaves stored data behind or stops URLs in use from answering, since `init` moves no
343
+ * data. A move that does neither, as the Vercel plan's or the queue's, has none, and a platform's
344
+ * data is named by the records and objects it moves.
345
+ */
346
+ const movesOf = (settled) => {
347
+ const moves = [];
348
+ const { serve, records, objects, bucket, basePath } = settled;
349
+ if (serve.moved === "github" && serve.value !== "github") moves.push(`GitHub's APIs stop answering: \`gh\` and GitHub's clients pointed at this host stop working, and it serves ${serve.value === "api" ? "Git's REST" : "Git's protocol"} only`);
350
+ if (records.moved !== void 0) moves.push(`Records move from ${records.moved} to ${records.value}; init moves no data, the existing records stay in ${records.moved}, and the new store starts empty`);
351
+ if (objects.moved === "loose") moves.push(`Repos' loose objects stay in ${records.moved ?? records.value}; the new setup starts with none of them`);
352
+ if (objects.moved === "packs") moves.push(`Repos' packs stay in ${bucket.moved ?? bucket.value}; the new setup starts with none of them`);
353
+ if (bucket.moved === "none") moves.push(`Packs start in ${bucket.value}`);
354
+ else if (bucket.moved !== void 0 && bucket.value !== "none") moves.push(`The bucket moves from ${bucket.moved} to ${bucket.value}; init moves no packs, the existing packs stay in ${bucket.moved}, and the new bucket starts empty`);
355
+ if (basePath.moved !== void 0) moves.push(`Git's URLs move from \`${basePath.moved}\` to \`${basePath.value}\`; existing remotes need \`git remote set-url\``);
356
+ return moves;
357
+ };
358
+ /** The receipt's words for a value: an offer's, else the value itself, as a base path's. */
359
+ const saysOf = (choice, value, context) => choice.offers(context).find((offer) => offer.value === value) ?? {
360
+ value,
361
+ says: value,
362
+ why: ""
363
+ };
364
+ /** The platform a folder runs on, from what detection read: none for a new project. */
365
+ const platformOf = (detected) => platformNamed(detected.platform?.value);
366
+ /** `answers` as `Choices`. */
367
+ const asChoices = (answers) => answers;
368
+ /**
369
+ * Each choice settled in order: a flag, then the folder's while the answers before it allow it,
370
+ * then a value the folder alone offers. A held answer they refuse, which a flag could move, is asked
371
+ * again, or with `yes` or no answer is a conflict,
372
+ * then `ask`'s answer, or with `yes` the recommended one. `ask` answers `undefined` to leave a
373
+ * choice open, and the recommended answer stands in for it, so the later choices' offers still
374
+ * follow. A refused flag fails at once.
375
+ */
376
+ const settle = Effect.fnUntraced(function* (given, detected, project, yes, ask, creating, framework) {
377
+ const chosen = {};
378
+ const settled = {};
379
+ const open = [];
380
+ const conflicts = [];
381
+ const folder = platformOf(detected);
382
+ const holds = Object.fromEntries(Object.entries(detected).map(([key, each]) => [key, each?.value]));
383
+ for (const choice of choices) {
384
+ const context = {
385
+ project,
386
+ chosen,
387
+ held: holds,
388
+ folder,
389
+ creating,
390
+ framework
391
+ };
392
+ const offers = choice.offers(context);
393
+ const flagged = given[choice.key];
394
+ const refused = flagged === void 0 ? void 0 : refusalOf(choice, flagged, context);
395
+ if (refused !== void 0) return yield* Effect.fail(refused);
396
+ const recommended = {
397
+ value: offers[0]?.value ?? "",
398
+ from: "recommended"
399
+ };
400
+ const held = detected[choice.key];
401
+ const heldRefused = held === void 0 ? void 0 : refusalOf(choice, held.value, context);
402
+ const movable = offers.filter((offer) => refusalOf(choice, offer.value, context) === void 0);
403
+ const moved = choices.filter((each) => each.key in chosen && ![void 0, detected[each.key]?.value].includes(given[each.key]));
404
+ const alone = moved.find((each) => held !== void 0 && refusalOf(choice, held.value, {
405
+ ...context,
406
+ chosen: {
407
+ ...chosen,
408
+ [each.key]: detected[each.key]?.value
409
+ }
410
+ }) === void 0);
411
+ const causes = alone !== void 0 ? [alone] : movable.length > 0 ? moved.slice(0, 1) : moved;
412
+ const by = causes.flatMap((each) => each.named(given[each.key] ?? ""));
413
+ const change = movable.length > 0 ? choice.named(recommended.value) : causes.flatMap((each) => {
414
+ const value = detected[each.key]?.value;
415
+ return value === void 0 ? [] : each.named(value);
416
+ });
417
+ const conflicted = flagged === void 0 && heldRefused !== void 0 && change.length > 0;
418
+ const answer = flagged !== void 0 ? held === void 0 || held.value === flagged ? {
419
+ value: flagged,
420
+ from: "flag"
421
+ } : {
422
+ value: flagged,
423
+ from: "flag",
424
+ moved: held.value
425
+ } : held !== void 0 && heldRefused === void 0 ? held : movable.length === 1 && !conflicted ? held === void 0 ? recommended : {
426
+ ...recommended,
427
+ moved: held.value
428
+ } : void 0;
429
+ const asked = answer === void 0 && !yes && movable.length > 0 ? yield* ask(choice, movable) : void 0;
430
+ if (answer === void 0 && asked === void 0 && conflicted && held !== void 0) conflicts.push({
431
+ key: choice.key,
432
+ held: choice.named(held.value),
433
+ by,
434
+ refusal: heldRefused,
435
+ change
436
+ });
437
+ else if (answer === void 0 && !yes && asked === void 0) open.push(choice.key);
438
+ const made = answer ?? (asked === void 0 ? recommended : {
439
+ value: asked,
440
+ from: "prompt"
441
+ });
442
+ chosen[choice.key] = made.value;
443
+ settled[choice.key] = made;
444
+ }
445
+ return {
446
+ settled,
447
+ chosen: asChoices(chosen),
448
+ open,
449
+ conflicts
450
+ };
451
+ });
452
+ /**
453
+ * The flags that settle `conflicts`: `given` with each flag a settling conflict names taken back to
454
+ * what the folder holds, then each choice in order as `settle` takes it, so a flag the new answers
455
+ * refuse is left out and a held answer they refuse moves to the recommended one. Every answer it
456
+ * names is one the answers before it allow, so the command it makes settles.
457
+ */
458
+ const recovered = (given, detected, project, conflicts) => {
459
+ const holds = Object.fromEntries(Object.entries(detected).map(([key, each]) => [key, each?.value]));
460
+ const restored = conflicts.filter((each) => each.change[0] === each.by[0]).flatMap((each) => choices.filter((choice) => each.by.includes(`--${choice.flag}`)));
461
+ const wanted = {
462
+ ...given,
463
+ ...Object.fromEntries(restored.flatMap((choice) => {
464
+ const value = holds[choice.key];
465
+ return value === void 0 ? [] : [[choice.key, value]];
466
+ }))
467
+ };
468
+ const folder = platformOf(detected);
469
+ const chosen = {};
470
+ const named = {};
471
+ for (const choice of choices) {
472
+ const context = {
473
+ project,
474
+ chosen,
475
+ held: holds,
476
+ folder
477
+ };
478
+ const flagged = wanted[choice.key];
479
+ const held = holds[choice.key];
480
+ const allowed = (value) => value !== void 0 && refusalOf(choice, value, context) === void 0;
481
+ const value = allowed(flagged) ? flagged : allowed(held) ? held : choice.offers(context).find((offer) => allowed(offer.value))?.value;
482
+ if (value === void 0) continue;
483
+ chosen[choice.key] = value;
484
+ if (value === flagged || held !== void 0 && value !== held) named[choice.key] = value;
485
+ }
486
+ return named;
487
+ };
488
+ /** `given`, with each choice it leaves out at its recommended answer for `project`. */
489
+ const withDefaults = (given, project) => {
490
+ const chosen = {};
491
+ for (const choice of choices) chosen[choice.key] = given[choice.key] ?? choice.offers({
492
+ project,
493
+ chosen
494
+ })[0]?.value ?? "";
495
+ return asChoices(chosen);
496
+ };
497
+ export { choices, movesOf, platformOf, recovered, saysOf, settle, withDefaults };