ref0-git 0.0.0-stage → 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 +52 -3
  385. package/README.md +0 -3
@@ -0,0 +1,236 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { useState, type ReactNode } from 'react';
3
+
4
+ import type { RepoPlace } from '../code/places.ts';
5
+ import { OwnerCard } from '../components/owner-card.tsx';
6
+ import { Separator } from '../components/ui/separator.tsx';
7
+ import { SubjectNotifications } from '../inbox/subscription-controls.tsx';
8
+ import type { PageOperation } from '../clients/allowed.ts';
9
+ import {
10
+ assigneesChange,
11
+ labelsChange,
12
+ milestoneChange,
13
+ sameSet,
14
+ useChange,
15
+ useDraft,
16
+ useShown,
17
+ type Holding,
18
+ } from './changes.ts';
19
+ import { vocabularyOf, type Issue, type Label } from './issues.ts';
20
+ import { LabelDialog } from './label-dialog.tsx';
21
+ import { LabelBadge } from './parts.tsx';
22
+ import { LabelRow, Picker, PersonRow } from './picker.tsx';
23
+
24
+ /** A sidebar section: its heading, its picker for those who may change it, and what it holds. */
25
+ export function Section({
26
+ name,
27
+ picker,
28
+ children,
29
+ }: {
30
+ readonly name: string;
31
+ readonly picker: ReactNode;
32
+ readonly children: ReactNode;
33
+ }) {
34
+ return (
35
+ <section aria-label={name} className="flex flex-col gap-1.5 text-sm">
36
+ <div className="flex items-center justify-between">
37
+ <h2 className="text-meta font-semibold text-muted-foreground">{name}</h2>
38
+ {picker}
39
+ </div>
40
+ {children}
41
+ </section>
42
+ );
43
+ }
44
+
45
+ /**
46
+ * An issue's assignees, labels and milestone, after any sections of its own, such as a pull
47
+ * request's reviewers. A viewer the drop-in lets change the issue gets a picker for each, and
48
+ * makes a label or milestone from what they type in its picker, so a new repo can use them: a
49
+ * label in its Dialog, which adds it to the issue once the repo holds it, and a milestone at once. A
50
+ * picker never waits on a save (G8): each pick shows at once, the labels and assignees are sent
51
+ * as their picker closes, none when they're as they were, and the milestone as it's picked.
52
+ */
53
+ export function Sidebar({
54
+ place,
55
+ issue: held,
56
+ allowed,
57
+ holding,
58
+ label = 'Issue details',
59
+ children,
60
+ }: {
61
+ readonly place: RepoPlace;
62
+ readonly issue: Issue;
63
+ readonly allowed: ReadonlySet<PageOperation>;
64
+ readonly holding: Holding;
65
+ readonly label?: string;
66
+ readonly children?: ReactNode;
67
+ }) {
68
+ const vocabulary = useQuery(vocabularyOf(place)).data;
69
+ const issue = useShown(place, held);
70
+ const { commit, changing } = useChange(place, issue.number, holding);
71
+ const editable = allowed.has('issue.update') && vocabulary !== undefined;
72
+ // What an open picker holds, shown at once and sent as it closes.
73
+ const labels = useDraft<readonly string[]>();
74
+ const assignees = useDraft<readonly string[]>();
75
+ // The name typed into the labels picker's Create row, while its Dialog is open.
76
+ const [creating, setCreating] = useState<string>();
77
+
78
+ const known = new Map(
79
+ [...(vocabulary?.labels ?? []), ...issue.labels].map((at) => [at.name, at]),
80
+ );
81
+ const labelOf = (name: string): Label =>
82
+ known.get(name) ?? { name, color: 'ededed', description: null };
83
+ const heldLabels = issue.labels.map((at) => at.name);
84
+ const shownLabels = (labels.draft ?? heldLabels).map(labelOf);
85
+ const shownAssignees = assignees.draft ?? issue.assignees;
86
+ const closeLabels = () => {
87
+ const picked = labels.take();
88
+ if (picked === undefined || sameSet(picked, heldLabels)) return;
89
+
90
+ commit(labelsChange(changing, picked.map(labelOf)));
91
+ };
92
+
93
+ const closeAssignees = () => {
94
+ const picked = assignees.take();
95
+ if (picked === undefined || sameSet(picked, issue.assignees)) return;
96
+
97
+ commit(assigneesChange(changing, picked));
98
+ };
99
+
100
+ // Whoever is assigned can be unassigned, though the repo no longer lists them as assignable.
101
+ const assignable = [...new Set([...shownAssignees, ...(vocabulary?.assignees ?? [])])];
102
+ const offered = [...known.values()];
103
+ const openMilestones = vocabulary?.milestones.filter((held) => held.state === 'open') ?? [];
104
+ const pickMilestone = (value: string) => {
105
+ const next = openMilestones.find((milestone) => String(milestone.number) === value) ?? null;
106
+ if ((next?.number ?? null) === (issue.milestone?.number ?? null)) return;
107
+
108
+ commit(milestoneChange(changing, next));
109
+ };
110
+
111
+ return (
112
+ <aside aria-label={label} className="flex flex-col gap-3">
113
+ {children !== undefined && (
114
+ <>
115
+ {children}
116
+ <Separator />
117
+ </>
118
+ )}
119
+ <Section
120
+ name="Assignees"
121
+ picker={
122
+ editable && (
123
+ <Picker
124
+ name="Assignees"
125
+ trigger={{ settings: 'Edit assignees' }}
126
+ multiple
127
+ choices={assignable.map((login) => ({
128
+ value: login,
129
+ label: login,
130
+ drawn: <PersonRow login={login} />,
131
+ }))}
132
+ picked={shownAssignees}
133
+ onPick={assignees.set}
134
+ onClose={closeAssignees}
135
+ />
136
+ )
137
+ }
138
+ >
139
+ {shownAssignees.length === 0 ? (
140
+ <p className="text-muted-foreground">No one assigned</p>
141
+ ) : (
142
+ <ul aria-label="Assignees" className="flex flex-col gap-1">
143
+ {shownAssignees.map((login) => (
144
+ <li key={login} className="flex">
145
+ <OwnerCard login={login} className="min-w-0">
146
+ <PersonRow login={login} />
147
+ </OwnerCard>
148
+ </li>
149
+ ))}
150
+ </ul>
151
+ )}
152
+ </Section>
153
+ <Separator />
154
+ <Section
155
+ name="Labels"
156
+ picker={
157
+ editable && (
158
+ <Picker
159
+ name="Labels"
160
+ trigger={{ settings: 'Edit labels' }}
161
+ multiple
162
+ choices={offered.map((at) => ({
163
+ value: at.name,
164
+ label: at.name,
165
+ drawn: <LabelRow label={at} />,
166
+ }))}
167
+ picked={shownLabels.map((at) => at.name)}
168
+ making={
169
+ allowed.has('label.create') ? { what: 'label', make: setCreating } : undefined
170
+ }
171
+ onPick={labels.set}
172
+ onClose={closeLabels}
173
+ />
174
+ )
175
+ }
176
+ >
177
+ {creating !== undefined && (
178
+ <LabelDialog
179
+ place={place}
180
+ name={creating}
181
+ taken={offered.map((at) => at.name)}
182
+ open
183
+ onOpenChange={(open) => {
184
+ if (!open) setCreating(undefined);
185
+ }}
186
+ onSaved={(made) => commit(labelsChange(changing, [...issue.labels, made]))}
187
+ />
188
+ )}
189
+ {shownLabels.length === 0 ? (
190
+ <p className="text-muted-foreground">None yet</p>
191
+ ) : (
192
+ <div className="flex flex-wrap gap-1">
193
+ {shownLabels.map((at) => (
194
+ <LabelBadge key={at.name} label={at} />
195
+ ))}
196
+ </div>
197
+ )}
198
+ </Section>
199
+ <Separator />
200
+ <Section
201
+ name="Milestone"
202
+ picker={
203
+ editable && (
204
+ <Picker
205
+ name="Milestone"
206
+ trigger={{ settings: 'Edit milestone' }}
207
+ multiple={false}
208
+ choices={[
209
+ { value: '', label: 'No milestone' },
210
+ ...openMilestones.map((milestone) => ({
211
+ value: String(milestone.number),
212
+ label: milestone.title,
213
+ })),
214
+ ]}
215
+ picked={[String(issue.milestone?.number ?? '')]}
216
+ making={
217
+ allowed.has('milestone.create')
218
+ ? {
219
+ what: 'milestone',
220
+ make: (name) => commit(milestoneChange(changing, null, name)),
221
+ }
222
+ : undefined
223
+ }
224
+ onPick={([value = '']) => pickMilestone(value)}
225
+ />
226
+ )
227
+ }
228
+ >
229
+ <p className={issue.milestone === null ? 'text-muted-foreground' : undefined}>
230
+ {issue.milestone?.title ?? 'No milestone'}
231
+ </p>
232
+ </Section>
233
+ <SubjectNotifications place={place} number={issue.number} />
234
+ </aside>
235
+ );
236
+ }
@@ -0,0 +1,8 @@
1
+ import { createCn } from 'cn/config';
2
+
3
+ /**
4
+ * shadcn's `cn`, told the theme's own font size, `text-meta`, from `styles.css`: the stock one
5
+ * takes it for a colour, so a `text-meta` beside a text colour, such as a tooltip's
6
+ * `text-background`, was dropped and the text drew at 16px.
7
+ */
8
+ export const cn = createCn({ extend: { classGroups: { 'font-size': [{ text: ['meta'] }] } } });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The most lines a text may hold for the app to highlight it whole, as a file's page does, and a
3
+ * diff does once its context expands: past it, or past `highlightedCharsMost`, it shows plain.
4
+ * `@pierre/diffs` drew and highlighted 95,325 short lines in 4.3 s and 296 MB, so this is about
5
+ * half a second.
6
+ */
7
+ export const highlightedLinesMost = 10_000;
8
+
9
+ /**
10
+ * The most characters a text may hold for the app to highlight it whole: highlighting costs by
11
+ * them too, and 126,100 characters of dense JavaScript took 840 ms in Node.
12
+ */
13
+ export const highlightedCharsMost = 128 * 1024;
@@ -0,0 +1,129 @@
1
+ import { messagesOf, type StreamMessage } from './sse.ts';
2
+
3
+ /**
4
+ * Where a followed stream stands: opening, open, waiting to open again after a failure, or stopped
5
+ * because the viewer's sign-in no longer holds.
6
+ */
7
+ export type FollowState = 'connecting' | 'live' | 'retrying' | 'signed-out';
8
+
9
+ /**
10
+ * How a stream's event ends it, if it does: `reconnect` opens it again after its cursor, `restart`
11
+ * from where it starts with none, since what came between is gone, and `signed-out` stops it.
12
+ */
13
+ export type Ending = 'reconnect' | 'restart' | 'signed-out';
14
+
15
+ /** A stream to follow, and what the page does with what it sends. */
16
+ export interface Followed {
17
+ /** Opens the stream after `cursor`, or where it starts when that's `undefined`. */
18
+ readonly open: (cursor: string | undefined, signal: AbortSignal) => Promise<Response>;
19
+ /** The cursor it starts from, and starts again from after a `restart`: none for its start. */
20
+ readonly start: string | undefined;
21
+ /**
22
+ * Once each opening answers: `fresh` when it started from `start`, so the page reads again what
23
+ * it shows, since the stream gives only what happens from now on.
24
+ */
25
+ readonly opened: (fresh: boolean) => void;
26
+ /** Takes one event, saying whether it ends the stream. */
27
+ readonly receive: (message: StreamMessage) => Ending | undefined;
28
+ readonly state: (state: FollowState) => void;
29
+ }
30
+
31
+ /** The first wait before opening again after a failure, doubled each time up to `longestWait`. */
32
+ const firstWait = 1_000;
33
+
34
+ const longestWait = 30_000;
35
+
36
+ /** Waits `ms`, or less when `signal` aborts first. */
37
+ const wait = (ms: number, signal: AbortSignal) =>
38
+ new Promise<void>((resolve) => {
39
+ const timer = setTimeout(done, ms);
40
+ signal.addEventListener('abort', done, { once: true });
41
+
42
+ function done() {
43
+ clearTimeout(timer);
44
+ signal.removeEventListener('abort', done);
45
+ resolve();
46
+ }
47
+ });
48
+
49
+ /**
50
+ * What one opening gave: how it ended, and whether it held: it sent an event
51
+ * or stayed open `firstWait`. One that ends at once each time waits as a failure does.
52
+ */
53
+ type Read = {
54
+ readonly ending: Ending | 'failed';
55
+ readonly held: boolean;
56
+ };
57
+
58
+ /**
59
+ * Follows `followed` until `signal` aborts or the viewer is signed out: it opens the stream after
60
+ * the last event's ID, and opens it again whenever it ends, at once after an answer, or after a
61
+ * wait that doubles with each failure in a row.
62
+ */
63
+ export const follow = async (followed: Followed, signal: AbortSignal) => {
64
+ let cursor = followed.start;
65
+ let failures = 0;
66
+
67
+ while (!signal.aborted) {
68
+ followed.state(failures === 0 ? 'connecting' : 'retrying');
69
+ // Until an event moves it, the cursor is the start's, which skips what came while none was
70
+ // open: each such opening is fresh, so the page reads again what it shows.
71
+ const fresh = cursor === followed.start;
72
+ const read = await readOnce(followed, cursor, fresh, signal, (id) => (cursor = id));
73
+ if (signal.aborted) return;
74
+
75
+ if (read.ending === 'signed-out') return followed.state('signed-out');
76
+
77
+ if (read.ending === 'restart') cursor = followed.start;
78
+
79
+ failures = read.held ? 0 : failures + 1;
80
+
81
+ if (failures > 0) {
82
+ followed.state('retrying');
83
+ await wait(Math.min(firstWait * 2 ** (failures - 1), longestWait), signal);
84
+ }
85
+ }
86
+ };
87
+
88
+ /** Opens the stream once, and reads it until it ends, keeping each event's ID with `moved`. */
89
+ const readOnce = async (
90
+ followed: Followed,
91
+ cursor: string | undefined,
92
+ fresh: boolean,
93
+ signal: AbortSignal,
94
+ moved: (id: string) => void,
95
+ ): Promise<Read> => {
96
+ const answer = await followed.open(cursor, signal).catch(() => undefined);
97
+ if (answer?.status === 401) return { ending: 'signed-out', held: false };
98
+
99
+ if (answer === undefined || !answer.ok || answer.body === null) {
100
+ await answer?.body?.cancel().catch(() => undefined);
101
+
102
+ return { ending: 'failed', held: false };
103
+ }
104
+
105
+ const openedAt = Date.now();
106
+ let sent = false;
107
+ const read = (ending: Ending): Read => ({
108
+ ending,
109
+ held: sent || Date.now() - openedAt >= firstWait,
110
+ });
111
+
112
+ followed.state('live');
113
+ followed.opened(fresh);
114
+
115
+ try {
116
+ for await (const message of messagesOf(answer.body)) {
117
+ if (message.id !== undefined && message.id !== '') moved(message.id);
118
+
119
+ const ending = followed.receive(message);
120
+ if (ending !== undefined) return read(ending);
121
+
122
+ sent = true;
123
+ }
124
+ } catch {
125
+ // A body cut off mid-read ends like one that closed: the stream opens again after its cursor.
126
+ }
127
+
128
+ return read('reconnect');
129
+ };
@@ -0,0 +1,74 @@
1
+ /** One Server-Sent Event: its type, `message` when it names none, its data, and its ID, if any. */
2
+ export interface StreamMessage {
3
+ readonly event: string;
4
+ readonly data: string;
5
+ readonly id: string | undefined;
6
+ }
7
+
8
+ /** A field of an event's block, as `name: value`: a value's one leading space isn't its own. */
9
+ const fieldOf = (line: string) => {
10
+ const colon = line.indexOf(':');
11
+ if (colon === -1) return { name: line, value: '' };
12
+
13
+ const value = line.slice(colon + 1);
14
+
15
+ return { name: line.slice(0, colon), value: value.startsWith(' ') ? value.slice(1) : value };
16
+ };
17
+
18
+ /** The event a block of lines makes, or `undefined` for a comment's, such as a heartbeat. */
19
+ const messageOf = (lines: readonly string[]): StreamMessage | undefined => {
20
+ let event = 'message';
21
+ let id: string | undefined;
22
+ const data: string[] = [];
23
+
24
+ for (const line of lines) {
25
+ if (line.startsWith(':')) continue;
26
+
27
+ const { name, value } = fieldOf(line);
28
+ if (name === 'event') event = value;
29
+ else if (name === 'data') data.push(value);
30
+ else if (name === 'id') id = value;
31
+ }
32
+
33
+ return data.length === 0 ? undefined : { event, data: data.join('\n'), id };
34
+ };
35
+
36
+ /**
37
+ * A stream's events, each once its blank line arrives, as `EventSource` reads them: a body that
38
+ * ends mid-event drops it. Cancelling the iteration cancels the body.
39
+ */
40
+ export async function* messagesOf(
41
+ body: ReadableStream<Uint8Array>,
42
+ ): AsyncGenerator<StreamMessage, void, undefined> {
43
+ const reader = body.getReader();
44
+ const decoder = new TextDecoder();
45
+ let pending = '';
46
+ let lines: string[] = [];
47
+
48
+ try {
49
+ for (;;) {
50
+ const read = await reader.read();
51
+ if (read.done) return;
52
+
53
+ pending += decoder.decode(read.value, { stream: true });
54
+ // A `\r` last may be half of a `\r\n`: it waits for the next chunk, with the line it ends.
55
+ const held = pending.endsWith('\r') ? '\r' : '';
56
+ const parts = pending.slice(0, pending.length - held.length).split(/\r\n|\r|\n/);
57
+ pending = `${parts.pop() ?? ''}${held}`;
58
+
59
+ for (const line of parts) {
60
+ if (line !== '') {
61
+ lines.push(line);
62
+ continue;
63
+ }
64
+
65
+ const message = messageOf(lines);
66
+ lines = [];
67
+
68
+ if (message !== undefined) yield message;
69
+ }
70
+ }
71
+ } finally {
72
+ await reader.cancel().catch(() => undefined);
73
+ }
74
+ }
@@ -0,0 +1,37 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+
3
+ import { follow, type Followed, type FollowState } from './follow.ts';
4
+
5
+ /**
6
+ * Follows the stream `followed` names while the page shows it, and again from its start when
7
+ * `stream` changes, such as for another pull request: where it stands. The page's latest handlers
8
+ * take each event, so a render never reopens it.
9
+ */
10
+ export const useFollow = (stream: string | undefined, followed: Omit<Followed, 'state'>) => {
11
+ const [state, setState] = useState<FollowState>('connecting');
12
+ const latest = useRef(followed);
13
+ latest.current = followed;
14
+
15
+ useEffect(() => {
16
+ if (stream === undefined) return;
17
+
18
+ const stop = new AbortController();
19
+ setState('connecting');
20
+ void follow(
21
+ {
22
+ start: latest.current.start,
23
+ open: (cursor, signal) => latest.current.open(cursor, signal),
24
+ opened: (fresh) => latest.current.opened(fresh),
25
+ receive: (message) => latest.current.receive(message),
26
+ state: (next) => {
27
+ if (!stop.signal.aborted) setState(next);
28
+ },
29
+ },
30
+ stop.signal,
31
+ );
32
+
33
+ return () => stop.abort();
34
+ }, [stream]);
35
+
36
+ return state;
37
+ };
@@ -0,0 +1,53 @@
1
+ # The app's Markdown
2
+
3
+ `render.ts` renders Markdown with [`@pierre/words`](https://www.npmjs.com/package/@pierre/words)' `createHtmlRenderer`, patched to give GitHub's render, in a comment or a file (`context.ts`). The user chose words over unified on 21 Nov (Q213), on spike F's 0.3.0 recheck, the design's `spike-results/f-words-0.3.0.md`.
4
+
5
+ `renderToHtml`, words' other renderer, takes no hooks, so it can't give GitHub's alerts, anchors, references or URLs. The app uses `createHtmlRenderer` alone.
6
+
7
+ ## The patches
8
+
9
+ Each patch in `patches.ts` does what words' own render doesn't. `markdown.test.ts`'s "each patch, which words alone still needs" runs a case for each patch twice: with every patch, it holds, and with every patch but that one, it fails. When a words release does a patch's work itself, that row fails: delete the patch and its row.
10
+
11
+ | Patch | What it's for | The test's case |
12
+ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
13
+ | `githubHtml` | GitHub's raw tags, each with the attributes that act on it. GitHub's whole rule packs to 28,026 bytes, past words' 4,096; this fits in 759 (`allowed-html.ts`) | `<kbd>` kept |
14
+ | `unwrap` | `<form>`, `<button>`, `<center>`, `<font>` and `<u>` kept, then taken off, so their text shows: words drops a block-level tag it doesn't keep, text and all | `<center>`'s text shown |
15
+ | `rawIds` | A raw `id` or `name` with `user-content-`: `idPrefix` reaches only the ids words makes | `<a name="tern">` |
16
+ | `rawUrls` | A raw link's relative URL resolved in a file: `urlTransform` reaches only Markdown's | `<a href="deploy.md">` |
17
+ | `repoImages` | A file's image in its repo named by `data-repo`, `data-ref` and `data-path`, for the browser to read as a blob (Q310) | `![A kite](kite.png)` |
18
+ | `schemes` | `ftp:` and `tel:` dropped, as GitHub's rule drops them and words doesn't | `[Files](ftp://…)` and `<a href="tel:…">` |
19
+ | `alerts` | `> [!NOTE]` and the rest as GitHub's alerts, with their Octicons, but not a quote in a list | `> [!NOTE]` |
20
+ | `references` | `#12`, `GH-12`, `owner/repo#12`, `@login` and SHAs linked where they exist, by `references.ts`; a file links only `owner/repo#12` | `#12` |
21
+ | `lineBreaks` | A comment's soft breaks as `<br>` | `Kites\nfly` |
22
+ | `rawBreaks` | A comment's soft break between two raw tags as `<br>` too, which `lineBreaks` misses, as it needs text after the newline | `<kbd>Ctrl</kbd>\n<kbd>C</kbd>` |
23
+ | `anchors` | A file's headings' anchors, as GitHub's slugs, but not on a raw heading that has an `id` | `## Setup` |
24
+
25
+ Words runs a tag's hooks in the order the patches first name that tag. So `alerts` marks a list's quotes before it reads quotes. The same test file checks that the fitted list is 53 tags and 759 bytes, and that a raw heading with its own `id` keeps that one alone.
26
+
27
+ Words' hooks see serialized HTML, and words finds each element by its tags, which holds only while no `<`, `>` or `"` stands raw inside one. So every value a patch or `render.ts` takes from the text or a URL and writes into HTML goes through words' `escapeHtml`, the one escaper. The rest are fixed strings, or `references`' labels, whose patterns match only `[\w./#@-]`. `references` and `lineBreaks` also split with `htmlParts`, which reads a quoted value as part of its tag. "A file's URLs, as its hooks write them" in `markdown.test.ts` runs `references` after each hook that writes an attribute, and the fuzz test renders with every reference found.
28
+
29
+ Beside the patches, `render.ts` draws Mermaid with Pele, with no links or images and ids of its own. It also sends a fragment link to the prefixed id it means, as GitHub's page script does.
30
+
31
+ ## The accepted gaps
32
+
33
+ The user accepted these on 21 Nov. "The accepted gaps" in `markdown.test.ts` records today's render of each, so a row fails when words closes its gap:
34
+
35
+ - A raw `<script>`, `<iframe>`, `<style>`, `<textarea>`, `<title>` or `<noframes>` on its own line shows nothing. A raw `<xmp>` or `<noembed>` shows what it holds without its tags. GitHub shows each as text.
36
+ - ``$`…`$`` keeps its backticks in the TeX.
37
+ - A block-level tag outside the unwrap list, such as `<aside>`, loses its text.
38
+
39
+ ## Against GitHub's render
40
+
41
+ `fixtures/` holds spike F's eight texts, each with GitHub's render in both contexts. "SF's fixtures, against GitHub's render" compares the facts a reader sees (`testing/facts.ts`).
42
+
43
+ - **The same as GitHub's:** `alerts`, `gfm`, `headings` and `relative`.
44
+ - **Different only where a reader doesn't see it:** in `references` and `hostile`, the hidden language label over a code block, and in `hostile`, a diagram Pele refuses, which stays code.
45
+ - **The accepted gaps:** `html` and `extensions` differ by exactly what the spike recorded.
46
+
47
+ ## Bumping words
48
+
49
+ Pin the new version in the catalog, install it with `pnpm install --ignore-scripts`, and run `markdown.test.ts` and `markdown.fuzz.test.ts`. Each failing row says what changed:
50
+
51
+ - a patch that's no longer needed;
52
+ - a gap that's closed;
53
+ - a fixture's facts that moved.
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The raw HTML tags words keeps, each with the attributes it keeps on that tag: GitHub's rule, as
3
+ * `rehype-sanitize`'s default schema records it, plus `mark`. Its whole rule, every tag with its
4
+ * own and 63 shared attributes, packs to 28,026 bytes, past words' 4,096, so each tag keeps only
5
+ * the attributes that act on it: 759 bytes. It's a subset of GitHub's rule, so it keeps nothing
6
+ * GitHub strips. Raw `<input>` is left out, as GitHub keeps only a task list's.
7
+ */
8
+ export const githubHtml = {
9
+ a: ['href', 'name', 'id', 'title'],
10
+ b: [],
11
+ blockquote: ['cite'],
12
+ br: [],
13
+ code: [],
14
+ dd: [],
15
+ del: ['cite', 'datetime'],
16
+ details: ['open'],
17
+ div: ['align', 'id'],
18
+ dl: [],
19
+ dt: [],
20
+ em: [],
21
+ h1: ['align', 'id'],
22
+ h2: ['align', 'id'],
23
+ h3: ['align', 'id'],
24
+ h4: ['align', 'id'],
25
+ h5: ['align', 'id'],
26
+ h6: ['align', 'id'],
27
+ hr: [],
28
+ i: [],
29
+ img: ['src', 'alt', 'width', 'height', 'align', 'title'],
30
+ ins: ['cite', 'datetime'],
31
+ kbd: [],
32
+ li: ['value'],
33
+ mark: [],
34
+ ol: ['start'],
35
+ p: ['align', 'id'],
36
+ picture: [],
37
+ pre: [],
38
+ q: ['cite'],
39
+ rp: [],
40
+ rt: [],
41
+ ruby: [],
42
+ s: [],
43
+ samp: [],
44
+ section: [],
45
+ source: ['srcset', 'media'],
46
+ span: [],
47
+ strike: [],
48
+ strong: [],
49
+ sub: [],
50
+ summary: [],
51
+ sup: [],
52
+ table: ['align', 'width'],
53
+ tbody: ['align', 'valign'],
54
+ td: ['align', 'valign', 'colspan', 'rowspan'],
55
+ tfoot: ['align', 'valign'],
56
+ th: ['align', 'valign', 'colspan', 'rowspan', 'scope'],
57
+ thead: ['align', 'valign'],
58
+ tr: ['align', 'valign'],
59
+ tt: [],
60
+ ul: [],
61
+ var: [],
62
+ } satisfies Readonly<Record<string, readonly string[]>>;
63
+
64
+ /**
65
+ * Tags GitHub drops while it shows their text. Words drops a block-level tag it doesn't keep, text
66
+ * and all, so the `unwrap` patch has words keep these, then takes them off. A tag missing here, at
67
+ * a block's start, still loses its text: an accepted gap.
68
+ */
69
+ export const unwrapped = ['form', 'button', 'center', 'font', 'u'] as const;