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.
- package/app/apps/github/.dev.vars.example +6 -0
- package/app/apps/github/README.md +70 -0
- package/app/apps/github/THIRD_PARTY_NOTICES.md +214 -0
- package/app/apps/github/components.json +25 -0
- package/app/apps/github/generated/git-rest.ts +10444 -0
- package/app/apps/github/generated/routeTree.gen.ts +1242 -0
- package/app/apps/github/migrations/postgres/0001_auth.sql +46 -0
- package/app/apps/github/migrations/sql/0001_auth.sql +19 -0
- package/app/apps/github/migrations/sql/0002_passkeys.sql +9 -0
- package/app/apps/github/migrations/sql/0003_orgs.sql +22 -0
- package/app/apps/github/migrations/sql/0004_avatars.sql +6 -0
- package/app/apps/github/package.json +80 -0
- package/app/apps/github/src/branches/branch-list.tsx +385 -0
- package/app/apps/github/src/branches/branches.ts +55 -0
- package/app/apps/github/src/clients/allowed.ts +213 -0
- package/app/apps/github/src/clients/at-most.ts +17 -0
- package/app/apps/github/src/clients/avatars.ts +410 -0
- package/app/apps/github/src/clients/cached.ts +65 -0
- package/app/apps/github/src/clients/calls.ts +160 -0
- package/app/apps/github/src/clients/clients.ts +82 -0
- package/app/apps/github/src/clients/graphql.ts +50 -0
- package/app/apps/github/src/clients/host-answer.ts +28 -0
- package/app/apps/github/src/clients/host-calls.ts +382 -0
- package/app/apps/github/src/clients/icon-bytes.ts +203 -0
- package/app/apps/github/src/clients/proxy.ts +59 -0
- package/app/apps/github/src/clients/session-ended.ts +18 -0
- package/app/apps/github/src/clients/transfers.ts +212 -0
- package/app/apps/github/src/code/breadcrumbs.tsx +50 -0
- package/app/apps/github/src/code/code-page.tsx +147 -0
- package/app/apps/github/src/code/code-tree.tsx +338 -0
- package/app/apps/github/src/code/controls.tsx +230 -0
- package/app/apps/github/src/code/file-view.tsx +450 -0
- package/app/apps/github/src/code/files.ts +332 -0
- package/app/apps/github/src/code/folder-list.tsx +122 -0
- package/app/apps/github/src/code/go-to-file.tsx +131 -0
- package/app/apps/github/src/code/highlighted.tsx +58 -0
- package/app/apps/github/src/code/lines.ts +46 -0
- package/app/apps/github/src/code/load.ts +147 -0
- package/app/apps/github/src/code/markdown-files.ts +58 -0
- package/app/apps/github/src/code/places.ts +88 -0
- package/app/apps/github/src/code/ref-pages.ts +179 -0
- package/app/apps/github/src/code/ref-switcher.tsx +203 -0
- package/app/apps/github/src/code/refs.ts +142 -0
- package/app/apps/github/src/code/repo-home.tsx +240 -0
- package/app/apps/github/src/code/repo.ts +105 -0
- package/app/apps/github/src/code/saved-reads.ts +199 -0
- package/app/apps/github/src/code/saved.ts +110 -0
- package/app/apps/github/src/code/tree-fold.ts +186 -0
- package/app/apps/github/src/code/trees.ts +136 -0
- package/app/apps/github/src/components/avatar-picture.ts +53 -0
- package/app/apps/github/src/components/avatar-url.ts +16 -0
- package/app/apps/github/src/components/confirm-action.tsx +100 -0
- package/app/apps/github/src/components/count.tsx +24 -0
- package/app/apps/github/src/components/create-button.tsx +38 -0
- package/app/apps/github/src/components/file-icons/file-icons.css +225 -0
- package/app/apps/github/src/components/file-icons/file-icons.tsx +138 -0
- package/app/apps/github/src/components/filter.tsx +35 -0
- package/app/apps/github/src/components/hotkeys/hotkeys.tsx +255 -0
- package/app/apps/github/src/components/item-list.tsx +65 -0
- package/app/apps/github/src/components/language-dot.tsx +29 -0
- package/app/apps/github/src/components/list-toolbar.tsx +82 -0
- package/app/apps/github/src/components/markdown/editor.tsx +57 -0
- package/app/apps/github/src/components/markdown/markdown.css +177 -0
- package/app/apps/github/src/components/markdown/markdown.tsx +82 -0
- package/app/apps/github/src/components/owner-card.tsx +196 -0
- package/app/apps/github/src/components/pull-status.tsx +34 -0
- package/app/apps/github/src/components/recent.ts +41 -0
- package/app/apps/github/src/components/relative-time.tsx +78 -0
- package/app/apps/github/src/components/repos/icon-hashes.ts +91 -0
- package/app/apps/github/src/components/repos/new-repo-form.tsx +196 -0
- package/app/apps/github/src/components/repos/repo-icon.tsx +47 -0
- package/app/apps/github/src/components/repos/repo-list.tsx +528 -0
- package/app/apps/github/src/components/repos/your-repos.tsx +124 -0
- package/app/apps/github/src/components/review-state.tsx +75 -0
- package/app/apps/github/src/components/route-dialog.tsx +137 -0
- package/app/apps/github/src/components/save-button.tsx +58 -0
- package/app/apps/github/src/components/shell/app-shell.tsx +164 -0
- package/app/apps/github/src/components/shell/create-org-dialog.tsx +118 -0
- package/app/apps/github/src/components/shell/create-row.tsx +49 -0
- package/app/apps/github/src/components/shell/link-menu.tsx +94 -0
- package/app/apps/github/src/components/shell/nav-user.tsx +97 -0
- package/app/apps/github/src/components/shell/owner-repos.tsx +247 -0
- package/app/apps/github/src/components/shell/owner-switcher.tsx +104 -0
- package/app/apps/github/src/components/shell/repo-switcher.tsx +179 -0
- package/app/apps/github/src/components/shell/sections.ts +31 -0
- package/app/apps/github/src/components/shell/submenu-chevron.ts +147 -0
- package/app/apps/github/src/components/signin/device-card.tsx +139 -0
- package/app/apps/github/src/components/signin/login-form.tsx +88 -0
- package/app/apps/github/src/components/signin/signin-page.tsx +33 -0
- package/app/apps/github/src/components/signin/signup-form.tsx +106 -0
- package/app/apps/github/src/components/states/live-status.tsx +42 -0
- package/app/apps/github/src/components/states/states.tsx +126 -0
- package/app/apps/github/src/components/tab-indicator.tsx +143 -0
- package/app/apps/github/src/components/theme-choice.tsx +108 -0
- package/app/apps/github/src/components/theme-provider.tsx +126 -0
- package/app/apps/github/src/components/tones.ts +23 -0
- package/app/apps/github/src/components/ui/alert-dialog.tsx +187 -0
- package/app/apps/github/src/components/ui/alert.tsx +78 -0
- package/app/apps/github/src/components/ui/avatar.tsx +106 -0
- package/app/apps/github/src/components/ui/badge.tsx +51 -0
- package/app/apps/github/src/components/ui/breadcrumb.tsx +124 -0
- package/app/apps/github/src/components/ui/button-group.tsx +87 -0
- package/app/apps/github/src/components/ui/button.tsx +61 -0
- package/app/apps/github/src/components/ui/calendar.tsx +221 -0
- package/app/apps/github/src/components/ui/card.tsx +102 -0
- package/app/apps/github/src/components/ui/checkbox.tsx +26 -0
- package/app/apps/github/src/components/ui/collapsible.tsx +19 -0
- package/app/apps/github/src/components/ui/combobox.tsx +304 -0
- package/app/apps/github/src/components/ui/command.tsx +208 -0
- package/app/apps/github/src/components/ui/dialog.tsx +156 -0
- package/app/apps/github/src/components/ui/dropdown-menu.tsx +290 -0
- package/app/apps/github/src/components/ui/empty.tsx +100 -0
- package/app/apps/github/src/components/ui/field.tsx +236 -0
- package/app/apps/github/src/components/ui/hover-card.tsx +48 -0
- package/app/apps/github/src/components/ui/input-group.tsx +163 -0
- package/app/apps/github/src/components/ui/input.tsx +19 -0
- package/app/apps/github/src/components/ui/item.tsx +201 -0
- package/app/apps/github/src/components/ui/kbd.tsx +27 -0
- package/app/apps/github/src/components/ui/label.tsx +33 -0
- package/app/apps/github/src/components/ui/popover.tsx +87 -0
- package/app/apps/github/src/components/ui/radio-group.tsx +35 -0
- package/app/apps/github/src/components/ui/select.tsx +198 -0
- package/app/apps/github/src/components/ui/separator.tsx +22 -0
- package/app/apps/github/src/components/ui/sheet.tsx +138 -0
- package/app/apps/github/src/components/ui/sidebar.tsx +724 -0
- package/app/apps/github/src/components/ui/skeleton.tsx +13 -0
- package/app/apps/github/src/components/ui/sonner.tsx +47 -0
- package/app/apps/github/src/components/ui/styles.css +242 -0
- package/app/apps/github/src/components/ui/table.tsx +113 -0
- package/app/apps/github/src/components/ui/tabs.tsx +79 -0
- package/app/apps/github/src/components/ui/textarea.tsx +17 -0
- package/app/apps/github/src/components/ui/title.ts +6 -0
- package/app/apps/github/src/components/ui/toggle-group.tsx +89 -0
- package/app/apps/github/src/components/ui/toggle.tsx +42 -0
- package/app/apps/github/src/components/ui/tooltip.tsx +63 -0
- package/app/apps/github/src/components/user-avatar.tsx +145 -0
- package/app/apps/github/src/components/view-tabs.tsx +42 -0
- package/app/apps/github/src/context/context.ts +133 -0
- package/app/apps/github/src/diffs/blobs.ts +94 -0
- package/app/apps/github/src/diffs/diff-view.tsx +155 -0
- package/app/apps/github/src/diffs/files.ts +121 -0
- package/app/apps/github/src/diffs/hunks.tsx +454 -0
- package/app/apps/github/src/diffs/patch.ts +131 -0
- package/app/apps/github/src/diffs/rows.ts +137 -0
- package/app/apps/github/src/history/commit-diff.ts +54 -0
- package/app/apps/github/src/history/commit-list.tsx +207 -0
- package/app/apps/github/src/history/commit-page.tsx +147 -0
- package/app/apps/github/src/history/history.ts +129 -0
- package/app/apps/github/src/hooks/allowed.ts +31 -0
- package/app/apps/github/src/hooks/answers.ts +65 -0
- package/app/apps/github/src/hooks/avatars.ts +54 -0
- package/app/apps/github/src/hooks/draft.ts +38 -0
- package/app/apps/github/src/hooks/open-counts.ts +127 -0
- package/app/apps/github/src/hooks/profiles.ts +120 -0
- package/app/apps/github/src/hooks/repos.ts +440 -0
- package/app/apps/github/src/hooks/use-mobile.ts +19 -0
- package/app/apps/github/src/hooks/viewer.ts +39 -0
- package/app/apps/github/src/inbox/count.ts +70 -0
- package/app/apps/github/src/inbox/inbox-item.tsx +66 -0
- package/app/apps/github/src/inbox/inbox-page.tsx +572 -0
- package/app/apps/github/src/inbox/marks.ts +130 -0
- package/app/apps/github/src/inbox/release-tags.ts +65 -0
- package/app/apps/github/src/inbox/search.ts +97 -0
- package/app/apps/github/src/inbox/subjects.ts +184 -0
- package/app/apps/github/src/inbox/subscription-controls.tsx +184 -0
- package/app/apps/github/src/inbox/subscriptions.ts +189 -0
- package/app/apps/github/src/inbox/threads.ts +198 -0
- package/app/apps/github/src/issues/changes.ts +332 -0
- package/app/apps/github/src/issues/counts.ts +62 -0
- package/app/apps/github/src/issues/issue-list.tsx +682 -0
- package/app/apps/github/src/issues/issue-page.tsx +533 -0
- package/app/apps/github/src/issues/issues.ts +566 -0
- package/app/apps/github/src/issues/label-dialog.tsx +310 -0
- package/app/apps/github/src/issues/labels-page.tsx +119 -0
- package/app/apps/github/src/issues/new-issue.tsx +79 -0
- package/app/apps/github/src/issues/parts.tsx +71 -0
- package/app/apps/github/src/issues/picker.tsx +298 -0
- package/app/apps/github/src/issues/search.ts +238 -0
- package/app/apps/github/src/issues/sidebar.tsx +236 -0
- package/app/apps/github/src/lib/cn.ts +8 -0
- package/app/apps/github/src/lib/highlighting.ts +13 -0
- package/app/apps/github/src/live/follow.ts +129 -0
- package/app/apps/github/src/live/sse.ts +74 -0
- package/app/apps/github/src/live/use-follow.ts +37 -0
- package/app/apps/github/src/markdown/README.md +53 -0
- package/app/apps/github/src/markdown/allowed-html.ts +69 -0
- package/app/apps/github/src/markdown/context.ts +206 -0
- package/app/apps/github/src/markdown/images.ts +81 -0
- package/app/apps/github/src/markdown/lookup.ts +122 -0
- package/app/apps/github/src/markdown/patches.ts +299 -0
- package/app/apps/github/src/markdown/query.ts +25 -0
- package/app/apps/github/src/markdown/references.ts +158 -0
- package/app/apps/github/src/markdown/render.ts +103 -0
- package/app/apps/github/src/names/owners.ts +51 -0
- package/app/apps/github/src/names/repos.ts +24 -0
- package/app/apps/github/src/palette/palette.tsx +547 -0
- package/app/apps/github/src/palette/recent.ts +116 -0
- package/app/apps/github/src/palette/rows.tsx +455 -0
- package/app/apps/github/src/palette/server.ts +104 -0
- package/app/apps/github/src/palette/targets.ts +306 -0
- package/app/apps/github/src/policy.ts +600 -0
- package/app/apps/github/src/private-repos.ts +47 -0
- package/app/apps/github/src/pulls/compare-page.tsx +342 -0
- package/app/apps/github/src/pulls/files-tab.tsx +776 -0
- package/app/apps/github/src/pulls/live.ts +124 -0
- package/app/apps/github/src/pulls/merge-box.tsx +367 -0
- package/app/apps/github/src/pulls/merge-button.ts +86 -0
- package/app/apps/github/src/pulls/pull-list.tsx +235 -0
- package/app/apps/github/src/pulls/pull-page.tsx +474 -0
- package/app/apps/github/src/pulls/pull.ts +468 -0
- package/app/apps/github/src/pulls/pulls.ts +318 -0
- package/app/apps/github/src/pulls/review.ts +350 -0
- package/app/apps/github/src/pulls/search.ts +130 -0
- package/app/apps/github/src/queue/queue-page.tsx +405 -0
- package/app/apps/github/src/queue/queue.ts +231 -0
- package/app/apps/github/src/releases/latest-release.tsx +55 -0
- package/app/apps/github/src/releases/overview.tsx +30 -0
- package/app/apps/github/src/releases/release-form.tsx +353 -0
- package/app/apps/github/src/releases/release-list.tsx +173 -0
- package/app/apps/github/src/releases/release-view.tsx +183 -0
- package/app/apps/github/src/releases/releases.ts +308 -0
- package/app/apps/github/src/releases/tag-list.tsx +134 -0
- package/app/apps/github/src/router.tsx +46 -0
- package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +33 -0
- package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +28 -0
- package/app/apps/github/src/routes/$owner/$repo/_code.tsx +11 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases.tsx +23 -0
- package/app/apps/github/src/routes/$owner/$repo/branches.tsx +39 -0
- package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +34 -0
- package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +42 -0
- package/app/apps/github/src/routes/$owner/$repo/compare/$.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/index.tsx +24 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +50 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +53 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +43 -0
- package/app/apps/github/src/routes/$owner/$repo/labels.tsx +22 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/checks.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/commits.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/files.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/index.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +52 -0
- package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +48 -0
- package/app/apps/github/src/routes/$owner/$repo/queue.tsx +22 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +58 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +40 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +35 -0
- package/app/apps/github/src/routes/$owner/$repo/route.tsx +102 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/access.tsx +9 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +16 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/new.tsx +25 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +17 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/route.tsx +28 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/rules.tsx +12 -0
- package/app/apps/github/src/routes/$owner/$repo/tokens.tsx +16 -0
- package/app/apps/github/src/routes/$owner/index.tsx +45 -0
- package/app/apps/github/src/routes/-nav.tsx +293 -0
- package/app/apps/github/src/routes/-root-testing.ts +107 -0
- package/app/apps/github/src/routes/__root.tsx +225 -0
- package/app/apps/github/src/routes/api.auth.$.ts +18 -0
- package/app/apps/github/src/routes/downloads/$owner/$repo/$asset.tsx +10 -0
- package/app/apps/github/src/routes/file-icons[.]svg.ts +21 -0
- package/app/apps/github/src/routes/icons/$owner/$repo.tsx +14 -0
- package/app/apps/github/src/routes/icons/$owner/index.tsx +14 -0
- package/app/apps/github/src/routes/icons/index.tsx +12 -0
- package/app/apps/github/src/routes/index.tsx +48 -0
- package/app/apps/github/src/routes/login.tsx +24 -0
- package/app/apps/github/src/routes/login_.code.tsx +31 -0
- package/app/apps/github/src/routes/new.tsx +91 -0
- package/app/apps/github/src/routes/notifications.tsx +20 -0
- package/app/apps/github/src/routes/orgs/$owner/issues.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/pulls.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/releases.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/route.tsx +25 -0
- package/app/apps/github/src/routes/orgs/$owner/settings.tsx +30 -0
- package/app/apps/github/src/routes/orgs/$owner/tokens.tsx +15 -0
- package/app/apps/github/src/routes/settings.tsx +54 -0
- package/app/apps/github/src/routes/signup.tsx +24 -0
- package/app/apps/github/src/routes/uploads/$owner/$repo/$release.tsx +10 -0
- package/app/apps/github/src/seed/acme.ts +498 -0
- package/app/apps/github/src/seed/licenses.ts +114 -0
- package/app/apps/github/src/seed/seed.ts +538 -0
- package/app/apps/github/src/server.ts +97 -0
- package/app/apps/github/src/settings/account-avatar.tsx +43 -0
- package/app/apps/github/src/settings/avatar-section.tsx +140 -0
- package/app/apps/github/src/settings/avatar.ts +58 -0
- package/app/apps/github/src/settings/general-settings.tsx +439 -0
- package/app/apps/github/src/settings/general.ts +73 -0
- package/app/apps/github/src/settings/hook-form.tsx +195 -0
- package/app/apps/github/src/settings/hook-list.tsx +166 -0
- package/app/apps/github/src/settings/hooks.ts +87 -0
- package/app/apps/github/src/settings/org-settings.tsx +228 -0
- package/app/apps/github/src/settings/orgs.ts +116 -0
- package/app/apps/github/src/settings/rule-list.tsx +72 -0
- package/app/apps/github/src/settings/rules.ts +27 -0
- package/app/apps/github/src/settings/settings-layout.tsx +114 -0
- package/app/apps/github/src/signin/approval.ts +186 -0
- package/app/apps/github/src/signin/auth-client.ts +127 -0
- package/app/apps/github/src/signin/auth.ts +753 -0
- package/app/apps/github/src/signin/avatars.ts +126 -0
- package/app/apps/github/src/signin/client-ip.ts +39 -0
- package/app/apps/github/src/signin/credentials.ts +26 -0
- package/app/apps/github/src/signin/device-code.ts +95 -0
- package/app/apps/github/src/signin/device-prompt.ts +125 -0
- package/app/apps/github/src/signin/errors.ts +135 -0
- package/app/apps/github/src/signin/host-session.ts +68 -0
- package/app/apps/github/src/signin/orgs.ts +283 -0
- package/app/apps/github/src/signin/owner-names.ts +183 -0
- package/app/apps/github/src/signin/person-lock.ts +104 -0
- package/app/apps/github/src/signin/seal.ts +88 -0
- package/app/apps/github/src/signin/seed-people.ts +92 -0
- package/app/apps/github/src/signin/session.ts +48 -0
- package/app/apps/github/src/signin/unborn.ts +110 -0
- package/app/apps/github/src/signin/viewer-orgs.ts +47 -0
- package/app/apps/github/src/signin/viewer.ts +74 -0
- package/app/apps/github/src/signin/with-headers.ts +14 -0
- package/app/apps/github/src/tokens/tokens-page.tsx +529 -0
- package/app/apps/github/src/tokens/tokens.ts +54 -0
- package/app/apps/github/tsconfig.json +25 -0
- package/app/apps/github/tsconfig.worker.json +24 -0
- package/app/apps/github/vite.config.ts +21 -0
- package/app/pnpm-workspace.yaml +216 -0
- package/app/tsconfig.base.json +127 -0
- package/dist/LICENSE +202 -0
- package/dist/cli/child.mjs +42 -0
- package/dist/cli/commands.mjs +23 -0
- package/dist/cli/credentials.mjs +84 -0
- package/dist/cli/documents.mjs +214 -0
- package/dist/cli/events.mjs +55 -0
- package/dist/cli/failure.mjs +105 -0
- package/dist/cli/folders.mjs +32 -0
- package/dist/cli/git-remote-ref0.d.mts +1 -0
- package/dist/cli/git-remote-ref0.mjs +29 -0
- package/dist/cli/git.mjs +48 -0
- package/dist/cli/helpers.mjs +51 -0
- package/dist/cli/hosts.mjs +127 -0
- package/dist/cli/node.mjs +15 -0
- package/dist/cli/output.mjs +135 -0
- package/dist/cli/prompt.mjs +35 -0
- package/dist/cli/queue.mjs +215 -0
- package/dist/cli/ref0-git.d.mts +1 -0
- package/dist/cli/ref0-git.mjs +144 -0
- package/dist/cli/repos.mjs +162 -0
- package/dist/cli/resources.mjs +131 -0
- package/dist/cli/run-end.mjs +57 -0
- package/dist/cli/runtime.mjs +50 -0
- package/dist/cli/setup.mjs +1410 -0
- package/dist/cli/sign-in.mjs +162 -0
- package/dist/cli/sign-ins.mjs +79 -0
- package/dist/cli/sqlite.mjs +28 -0
- package/dist/cli/tokens.mjs +141 -0
- package/dist/cli/vendor.mjs +123 -0
- package/dist/init/app.mjs +231 -0
- package/dist/init/astro.mjs +49 -0
- package/dist/init/choices.mjs +497 -0
- package/dist/init/cloudflare.mjs +324 -0
- package/dist/init/create.mjs +151 -0
- package/dist/init/detect.mjs +297 -0
- package/dist/init/files.mjs +75 -0
- package/dist/init/frameworks.mjs +248 -0
- package/dist/init/git-module.mjs +49 -0
- package/dist/init/github-routes.mjs +66 -0
- package/dist/init/jsonc.mjs +143 -0
- package/dist/init/metadata.mjs +48 -0
- package/dist/init/mounts.mjs +109 -0
- package/dist/init/next.mjs +205 -0
- package/dist/init/node-app.mjs +189 -0
- package/dist/init/node.mjs +458 -0
- package/dist/init/nuxt.mjs +115 -0
- package/dist/init/output.mjs +21 -0
- package/dist/init/plan.mjs +82 -0
- package/dist/init/range-major.mjs +257 -0
- package/dist/init/react-router.mjs +59 -0
- package/dist/init/routes.mjs +148 -0
- package/dist/init/shell.mjs +4 -0
- package/dist/init/stores.mjs +51 -0
- package/dist/init/sveltekit.mjs +139 -0
- package/dist/init/template.mjs +142 -0
- package/dist/init/templates.mjs +343 -0
- package/dist/init/vercel.mjs +383 -0
- package/dist/init/versions.mjs +32 -0
- package/dist/init/workspace.mjs +20 -0
- package/package.json +52 -3
- package/README.md +0 -3
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ApprovalPageInput,
|
|
3
|
+
Caller,
|
|
4
|
+
ConfirmApprovalPage,
|
|
5
|
+
DeviceApproval,
|
|
6
|
+
DeviceCodePage,
|
|
7
|
+
Result,
|
|
8
|
+
} from '@ref0/git';
|
|
9
|
+
|
|
10
|
+
import { ownerProblem } from '../names/owners.ts';
|
|
11
|
+
import { type StarterAuth, sessionFrom } from './auth.ts';
|
|
12
|
+
import { openPrompt, sealPrompt, sealRetry } from './device-prompt.ts';
|
|
13
|
+
|
|
14
|
+
/** What the starter's approval page decides with: the person's session, and where it's served. */
|
|
15
|
+
export interface StarterApprovalOptions {
|
|
16
|
+
/** Better Auth, made at the first request: the signed-in person approves for themselves. */
|
|
17
|
+
readonly auth: () => Promise<StarterAuth>;
|
|
18
|
+
/** The key prompts and sessions' Git tokens are sealed under, from `SESSION_SECRET`. */
|
|
19
|
+
readonly sealKey: Promise<CryptoKey>;
|
|
20
|
+
/** Git's `identify`: whether the session's Git token still names its person. */
|
|
21
|
+
readonly identify: (request: Request) => Promise<Result<Caller>>;
|
|
22
|
+
/** `APP_ORIGIN`: the one origin a decision is posted from. */
|
|
23
|
+
readonly origin: string;
|
|
24
|
+
/** How long a token the person approves lasts. */
|
|
25
|
+
readonly tokenDays: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const day = 24 * 60 * 60 * 1000;
|
|
29
|
+
|
|
30
|
+
/** The app's page for the device flow, which shows what Git's redirects name. */
|
|
31
|
+
const codePage = '/login/code';
|
|
32
|
+
|
|
33
|
+
const seeOther = (location: string) =>
|
|
34
|
+
new Response(null, { status: 303, headers: { location, 'cache-control': 'no-store' } });
|
|
35
|
+
|
|
36
|
+
const codePageWith = (query: Readonly<Record<string, string>>) =>
|
|
37
|
+
`${codePage}?${new URLSearchParams(query).toString()}`;
|
|
38
|
+
|
|
39
|
+
const plain = (status: number, text: string) =>
|
|
40
|
+
new Response(text, {
|
|
41
|
+
status,
|
|
42
|
+
headers: { 'cache-control': 'no-store', 'content-type': 'text/plain; charset=utf-8' },
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const formType = 'application/x-www-form-urlencoded';
|
|
46
|
+
|
|
47
|
+
/** The longest code the Code field gets back after an error: a user code is 9 characters. */
|
|
48
|
+
const typedMost = 32;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* What the person typed, for the Code field after an error: the Code field's own form, which is the
|
|
52
|
+
* code Git read, since a body's field wins over the query's. Never the query, or a JSON body, which
|
|
53
|
+
* a link or a script sends. After an Approve, which read its own form, the field starts empty.
|
|
54
|
+
*/
|
|
55
|
+
const typedCode = async (request: Request) => {
|
|
56
|
+
const type = request.headers.get('content-type')?.split(';')[0]?.trim().toLowerCase();
|
|
57
|
+
const form = request.method === 'POST' && type === formType && !request.bodyUsed;
|
|
58
|
+
const posted = form ? new URLSearchParams(await request.text()).get('user_code') : null;
|
|
59
|
+
const typed = (posted ?? '').trim();
|
|
60
|
+
|
|
61
|
+
return typed.length <= typedMost ? typed : '';
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** The browser's session, from Better Auth's cookie. */
|
|
65
|
+
const sessionOf = async (request: Request, options: StarterApprovalOptions) =>
|
|
66
|
+
sessionFrom(await options.auth(), options.sealKey)(request);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* No code yet: the app's page, with the query kept. Git's error for one: the app's page with the
|
|
70
|
+
* error, and what was typed sealed as `retry` for the session that typed it, so only this Worker
|
|
71
|
+
* can fill the Code field, and only that session's.
|
|
72
|
+
*/
|
|
73
|
+
const enterCode = async (input: DeviceCodePage, options: StarterApprovalOptions) => {
|
|
74
|
+
if (input.error === undefined) return seeOther(`${codePage}${new URL(input.request.url).search}`);
|
|
75
|
+
|
|
76
|
+
const typed = await typedCode(input.request);
|
|
77
|
+
const session = typed === '' ? undefined : await sessionOf(input.request, options);
|
|
78
|
+
if (session === undefined) return seeOther(codePageWith({ error: input.error }));
|
|
79
|
+
|
|
80
|
+
const retry = await sealRetry(await options.sealKey, typed, session, Date.now());
|
|
81
|
+
|
|
82
|
+
return seeOther(codePageWith({ error: input.error, retry }));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/** Git's 200 for a decision made, as the app's page shows it; its redirects pass through. */
|
|
86
|
+
const settled = (answer: Response, done: 'approved' | 'denied') =>
|
|
87
|
+
answer.status === 200 ? seeOther(codePageWith({ done })) : answer;
|
|
88
|
+
|
|
89
|
+
/** Whether the request was posted from the app's own page: one with no `Origin` wasn't. */
|
|
90
|
+
const fromApp = (request: Request, options: StarterApprovalOptions) =>
|
|
91
|
+
request.method === 'POST' && request.headers.get('origin') === new URL(options.origin).origin;
|
|
92
|
+
|
|
93
|
+
/** The session's login, when the browser has one and its Git token still names that person. */
|
|
94
|
+
const signedIn = async (input: ConfirmApprovalPage, options: StarterApprovalOptions) => {
|
|
95
|
+
const session = await sessionOf(input.request, options);
|
|
96
|
+
if (session === undefined) return undefined;
|
|
97
|
+
|
|
98
|
+
const headers = { authorization: `Bearer ${session.token}` };
|
|
99
|
+
const held = await options.identify(new Request(options.origin, { headers }));
|
|
100
|
+
const actor = held.kind === 'success' ? held.value.actor : undefined;
|
|
101
|
+
|
|
102
|
+
return actor?.anonymous !== true && actor?.id === session.login ? session.login : undefined;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A code posted from the Code field, by a live session: Git's prompt, sealed for that person. A
|
|
107
|
+
* link or another site's form that names a code gets the empty Code field, so no one is shown a
|
|
108
|
+
* code they didn't type.
|
|
109
|
+
*/
|
|
110
|
+
const shown = async (
|
|
111
|
+
input: ConfirmApprovalPage,
|
|
112
|
+
prompt: DeviceApproval,
|
|
113
|
+
options: StarterApprovalOptions,
|
|
114
|
+
) => {
|
|
115
|
+
const login = fromApp(input.request, options) ? await signedIn(input, options) : undefined;
|
|
116
|
+
if (login === undefined) return seeOther(codePage);
|
|
117
|
+
|
|
118
|
+
const grant = { login, days: options.tokenDays };
|
|
119
|
+
const sealed = await sealPrompt(await options.sealKey, prompt, grant, Date.now());
|
|
120
|
+
|
|
121
|
+
return seeOther(codePageWith({ prompt: sealed }));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* A decision posted from the Card: from the app's own page, by a live session, with the sealed
|
|
126
|
+
* prompt it showed, for that person, unexpired and for the code Git found. It decides on Git's
|
|
127
|
+
* prompt, never the sealed one, and Git checks the code is still pending as it settles.
|
|
128
|
+
*/
|
|
129
|
+
const decided = async (
|
|
130
|
+
input: ConfirmApprovalPage,
|
|
131
|
+
prompt: DeviceApproval,
|
|
132
|
+
form: URLSearchParams,
|
|
133
|
+
options: StarterApprovalOptions,
|
|
134
|
+
) => {
|
|
135
|
+
const sealed = form.get('prompt') ?? '';
|
|
136
|
+
const signInFirst = seeOther(
|
|
137
|
+
`/login?${new URLSearchParams({ return_to: codePageWith({ prompt: sealed }) }).toString()}`,
|
|
138
|
+
);
|
|
139
|
+
if (!fromApp(input.request, options)) return signInFirst;
|
|
140
|
+
|
|
141
|
+
const login = await signedIn(input, options);
|
|
142
|
+
if (login === undefined) return signInFirst;
|
|
143
|
+
|
|
144
|
+
const opened = await openPrompt(await options.sealKey, sealed, login, Date.now());
|
|
145
|
+
if (opened?.userCode !== prompt.userCode)
|
|
146
|
+
return seeOther(codePageWith({ error: 'expired-code' }));
|
|
147
|
+
|
|
148
|
+
const decision = form.get('decision');
|
|
149
|
+
if (decision === 'deny') return settled(await input.decide({ kind: 'deny' }), 'denied');
|
|
150
|
+
|
|
151
|
+
if (decision !== 'approve') return seeOther(codePageWith({ prompt: sealed }));
|
|
152
|
+
|
|
153
|
+
const problem = ownerProblem(login);
|
|
154
|
+
if (problem !== undefined) return plain(403, problem);
|
|
155
|
+
|
|
156
|
+
const approved = await input.decide({
|
|
157
|
+
kind: 'approve',
|
|
158
|
+
actor: { id: login },
|
|
159
|
+
target: { prefix: '' },
|
|
160
|
+
scope: 'write',
|
|
161
|
+
expiresAt: Date.now() + options.tokenDays * day,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
return settled(approved, 'approved');
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The starter's `approvalPage`, which keeps no HTML: Git's pages become redirects to the app's
|
|
169
|
+
* `/login/code`, which shows a code's prompt sealed from Git's record, and whose Card posts the
|
|
170
|
+
* signed-in person's decision back here. A host with its own accounts decides with its own.
|
|
171
|
+
*/
|
|
172
|
+
export const starterApprovalPage =
|
|
173
|
+
(options: StarterApprovalOptions) =>
|
|
174
|
+
async (input: ApprovalPageInput): Promise<Response> => {
|
|
175
|
+
if (input.kind === 'enter-code') return enterCode(input, options);
|
|
176
|
+
|
|
177
|
+
const { prompt } = input;
|
|
178
|
+
if (prompt.kind === 'web') return plain(400, 'This host signs people in at /login');
|
|
179
|
+
|
|
180
|
+
// A code arrives posted too, from the Code field: only the Card's own post names a decision.
|
|
181
|
+
const form =
|
|
182
|
+
input.request.method === 'POST' ? new URLSearchParams(await input.request.text()) : undefined;
|
|
183
|
+
if (form?.has('decision') !== true) return shown(input, prompt, options);
|
|
184
|
+
|
|
185
|
+
return decided(input, prompt, form, options);
|
|
186
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { passkeyClient } from '@better-auth/passkey/client';
|
|
2
|
+
import { createAuthClient } from 'better-auth/client';
|
|
3
|
+
import { organizationClient, usernameClient } from 'better-auth/client/plugins';
|
|
4
|
+
import { toast } from 'sonner';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Better Auth's client, for the sign-in pages: its HTTP routes at `/api/auth`, which its rate
|
|
8
|
+
* limit holds, never `auth.api`, which it doesn't. The pages call it through the functions below.
|
|
9
|
+
*/
|
|
10
|
+
const authClient = createAuthClient({
|
|
11
|
+
plugins: [usernameClient(), passkeyClient(), organizationClient()],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What a sign-up form sends: no email, which the server sets from the login, and a name only when
|
|
16
|
+
* the person gave one, since the server names them by their login otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export interface SignUp {
|
|
19
|
+
readonly login: string;
|
|
20
|
+
readonly name?: string;
|
|
21
|
+
readonly password: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A person signed up, and signed in, by login: the server hides the email and names them. */
|
|
25
|
+
export const signUp = ({ login, name = '', password }: SignUp) =>
|
|
26
|
+
authClient.signUp.email({ username: login, name, password, email: '' });
|
|
27
|
+
|
|
28
|
+
/** What a passkey sign-up sends: a login, and a name as a sign-up form's, both checked first. */
|
|
29
|
+
export interface PasskeySignUp {
|
|
30
|
+
readonly login: string;
|
|
31
|
+
readonly name?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A person signed up with a passkey alone, and signed in: the browser makes it, the server them. */
|
|
35
|
+
export const signUpWithPasskey = ({ login, name }: PasskeySignUp) =>
|
|
36
|
+
authClient.passkey.addPasskey({ context: JSON.stringify({ login, name }), createSession: true });
|
|
37
|
+
|
|
38
|
+
/** A passkey added to the signed-in person, from their settings. */
|
|
39
|
+
export const addPasskey = () => authClient.passkey.addPasskey();
|
|
40
|
+
|
|
41
|
+
/** The signed-in person's passkeys, for their settings. */
|
|
42
|
+
export const listPasskeys = () => authClient.passkey.listUserPasskeys();
|
|
43
|
+
|
|
44
|
+
/** One of the signed-in person's passkeys renamed. */
|
|
45
|
+
export const renamePasskey = (id: string, name: string) =>
|
|
46
|
+
authClient.passkey.updatePasskey({ id, name });
|
|
47
|
+
|
|
48
|
+
/** One of the signed-in person's passkeys removed: never the last, when they have no password. */
|
|
49
|
+
export const removePasskey = (id: string) => authClient.passkey.deletePasskey({ id });
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A person signed in by a passkey, with no login typed. With `autoFill`, the browser offers its
|
|
53
|
+
* passkeys in the login field's own suggestions, and the call waits until one is picked.
|
|
54
|
+
*/
|
|
55
|
+
export const signInWithPasskey = (autoFill = false) => authClient.signIn.passkey({ autoFill });
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* An org made by the signed-in person, who becomes its owner: its login is its slug, which the
|
|
59
|
+
* server checks as a login and claims, and its name is the login too until its settings change it.
|
|
60
|
+
*/
|
|
61
|
+
export const createOrg = (login: string) =>
|
|
62
|
+
authClient.organization.create({ name: login, slug: login });
|
|
63
|
+
|
|
64
|
+
/** A person signed in by their login and password. */
|
|
65
|
+
export const signIn = (login: string, password: string) =>
|
|
66
|
+
authClient.signIn.username({ username: login, password });
|
|
67
|
+
|
|
68
|
+
/** What runs before a sign-out, each once it's added: the page's saved reads, dropped. */
|
|
69
|
+
const beforeSignOut = new Set<() => Promise<void>>();
|
|
70
|
+
|
|
71
|
+
/** Runs `listener` before each sign-out, until the returned call stops it. */
|
|
72
|
+
export const onSignOut = (listener: () => Promise<void>): (() => void) => {
|
|
73
|
+
beforeSignOut.add(listener);
|
|
74
|
+
|
|
75
|
+
return () => {
|
|
76
|
+
beforeSignOut.delete(listener);
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** What runs once a sign-out has ended the session, before the browser goes home. */
|
|
81
|
+
const afterSignOut = new Set<() => void>();
|
|
82
|
+
|
|
83
|
+
/** Runs `listener` once each sign-out has ended the session, until the returned call stops it. */
|
|
84
|
+
export const onSignedOut = (listener: () => void): (() => void) => {
|
|
85
|
+
afterSignOut.add(listener);
|
|
86
|
+
|
|
87
|
+
return () => {
|
|
88
|
+
afterSignOut.delete(listener);
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Sign-out: what the page keeps for the person dropped, then the session ended, which revokes its
|
|
94
|
+
* Git token, then the page told, so it names no one while the browser goes home. A refused call
|
|
95
|
+
* leaves the person signed in, so the page keeps naming them, stays put and says why.
|
|
96
|
+
*/
|
|
97
|
+
export const signOutAndLeave = async () => {
|
|
98
|
+
await Promise.all([...beforeSignOut].map((listener) => listener()));
|
|
99
|
+
const { error } = await authClient.signOut();
|
|
100
|
+
|
|
101
|
+
if (error !== null) {
|
|
102
|
+
// An empty message or status text, as an answer with no body over HTTP/2 has, says the status.
|
|
103
|
+
toast.error(`Couldn't sign out: ${error.message || error.statusText || error.status}`);
|
|
104
|
+
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
for (const listener of afterSignOut) listener();
|
|
109
|
+
|
|
110
|
+
window.location.assign('/');
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** What a passkey sign-up or sign-in answers: the session made, or Better Auth's refusal. */
|
|
114
|
+
export type PasskeySignedIn = Awaited<ReturnType<typeof signInWithPasskey>>;
|
|
115
|
+
|
|
116
|
+
export type PasskeySignedUp = Awaited<ReturnType<typeof signUpWithPasskey>>;
|
|
117
|
+
|
|
118
|
+
/** What adding a passkey answers: the passkey, or Better Auth's refusal. */
|
|
119
|
+
export type PasskeyAdded = Awaited<ReturnType<typeof addPasskey>>;
|
|
120
|
+
|
|
121
|
+
/** One of a person's passkeys, as their settings list it. */
|
|
122
|
+
export type Passkey = NonNullable<Awaited<ReturnType<typeof listPasskeys>>['data']>[number];
|
|
123
|
+
|
|
124
|
+
/** What renaming or removing a passkey answers: done, or Better Auth's refusal. */
|
|
125
|
+
export type PasskeyRenamed = Awaited<ReturnType<typeof renamePasskey>>;
|
|
126
|
+
|
|
127
|
+
export type PasskeyRemoved = Awaited<ReturnType<typeof removePasskey>>;
|