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.
- 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 +48 -6
- package/README.md +0 -5
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { UsersIcon } from 'lucide-react';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { LoadFailed, LoadingSkeleton, NotFound } from '../components/states/states.tsx';
|
|
6
|
+
import { Card, CardContent, CardHeader, CardTitle } from '../components/ui/card.tsx';
|
|
7
|
+
import {
|
|
8
|
+
Empty,
|
|
9
|
+
EmptyDescription,
|
|
10
|
+
EmptyHeader,
|
|
11
|
+
EmptyMedia,
|
|
12
|
+
EmptyTitle,
|
|
13
|
+
} from '../components/ui/empty.tsx';
|
|
14
|
+
import { Skeleton } from '../components/ui/skeleton.tsx';
|
|
15
|
+
import { Table, TableBody, TableCell, TableRow } from '../components/ui/table.tsx';
|
|
16
|
+
import { UserAvatar } from '../components/user-avatar.tsx';
|
|
17
|
+
import { pagesMost, type EveryPage } from '../hooks/answers.ts';
|
|
18
|
+
import type { Pictures } from '../hooks/avatars.ts';
|
|
19
|
+
import { AccountAvatar } from './account-avatar.tsx';
|
|
20
|
+
import { orgDirectory } from './orgs.ts';
|
|
21
|
+
|
|
22
|
+
/** A table of logins, or `none` when it's empty, and a line when it went on past what's read. */
|
|
23
|
+
function Logins({
|
|
24
|
+
label,
|
|
25
|
+
logins,
|
|
26
|
+
pictures,
|
|
27
|
+
none,
|
|
28
|
+
}: {
|
|
29
|
+
readonly label: string;
|
|
30
|
+
readonly logins: EveryPage<string>;
|
|
31
|
+
/** Their pictures, as the lists named them. */
|
|
32
|
+
readonly pictures: Pictures;
|
|
33
|
+
readonly none: string;
|
|
34
|
+
}) {
|
|
35
|
+
if (logins.rows.length === 0) return <p className="text-muted-foreground">{none}</p>;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<Table aria-label={label} className="border">
|
|
40
|
+
<TableBody>
|
|
41
|
+
{logins.rows.map((login) => (
|
|
42
|
+
<TableRow key={login}>
|
|
43
|
+
<TableCell>
|
|
44
|
+
<span className="flex items-center gap-2">
|
|
45
|
+
<UserAvatar login={login} upload={pictures.get(login)} size="sm" account="user" />
|
|
46
|
+
<a href={`/${login}`} className="hover:underline">
|
|
47
|
+
{login}
|
|
48
|
+
</a>
|
|
49
|
+
</span>
|
|
50
|
+
</TableCell>
|
|
51
|
+
</TableRow>
|
|
52
|
+
))}
|
|
53
|
+
</TableBody>
|
|
54
|
+
</Table>
|
|
55
|
+
{logins.more && (
|
|
56
|
+
<p className="text-sm text-muted-foreground">
|
|
57
|
+
The first {(pagesMost * 100).toLocaleString('en')} are shown.
|
|
58
|
+
</p>
|
|
59
|
+
)}
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The page's frame: its picture, then a line over its Members and Teams cards, the same loading or
|
|
66
|
+
* loaded.
|
|
67
|
+
*/
|
|
68
|
+
function Frame({
|
|
69
|
+
picture,
|
|
70
|
+
intro,
|
|
71
|
+
members,
|
|
72
|
+
teams,
|
|
73
|
+
}: {
|
|
74
|
+
readonly picture: ReactNode;
|
|
75
|
+
readonly intro: ReactNode;
|
|
76
|
+
readonly members: ReactNode;
|
|
77
|
+
readonly teams: ReactNode;
|
|
78
|
+
}) {
|
|
79
|
+
return (
|
|
80
|
+
// A form-like page: held to a readable width, in the middle of the page.
|
|
81
|
+
<div className="mx-auto flex w-full max-w-3xl flex-col gap-6">
|
|
82
|
+
{picture}
|
|
83
|
+
{intro}
|
|
84
|
+
<section aria-label="Members">
|
|
85
|
+
<Card>
|
|
86
|
+
<CardHeader>
|
|
87
|
+
<CardTitle>
|
|
88
|
+
<h2>Members</h2>
|
|
89
|
+
</CardTitle>
|
|
90
|
+
</CardHeader>
|
|
91
|
+
<CardContent className="flex flex-col gap-2">{members}</CardContent>
|
|
92
|
+
</Card>
|
|
93
|
+
</section>
|
|
94
|
+
<section aria-label="Teams">
|
|
95
|
+
<Card>
|
|
96
|
+
<CardHeader>
|
|
97
|
+
<CardTitle>
|
|
98
|
+
<h2>Teams</h2>
|
|
99
|
+
</CardTitle>
|
|
100
|
+
</CardHeader>
|
|
101
|
+
<CardContent className="flex flex-col gap-6">{teams}</CardContent>
|
|
102
|
+
</Card>
|
|
103
|
+
</section>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** A table of logins' rows, as its skeleton: an avatar and a name a row, inside the table's border. */
|
|
109
|
+
function LoginsSkeleton({ rows }: { readonly rows: number }) {
|
|
110
|
+
return (
|
|
111
|
+
<div className="divide-y border">
|
|
112
|
+
{Array.from({ length: rows }, (_, row) => (
|
|
113
|
+
<div key={row} className="flex h-10 items-center gap-2 px-2">
|
|
114
|
+
<Skeleton className="size-6 rounded-full" />
|
|
115
|
+
<Skeleton className="h-3.5 w-24" />
|
|
116
|
+
</div>
|
|
117
|
+
))}
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The page while its directory loads: its own cards and headings, their rows still to come. */
|
|
123
|
+
function OrgSettingsSkeleton() {
|
|
124
|
+
return (
|
|
125
|
+
<LoadingSkeleton>
|
|
126
|
+
<Frame
|
|
127
|
+
picture={<Skeleton className="h-40 w-full rounded-xl" />}
|
|
128
|
+
intro={<Skeleton className="h-5 w-full max-w-md" />}
|
|
129
|
+
members={<LoginsSkeleton rows={3} />}
|
|
130
|
+
teams={
|
|
131
|
+
<div className="flex flex-col gap-2">
|
|
132
|
+
<Skeleton className="h-4 w-28" />
|
|
133
|
+
<LoginsSkeleton rows={2} />
|
|
134
|
+
</div>
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
137
|
+
</LoadingSkeleton>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Whether `login` is among `logins`, as GitHub matches a login: in any case. */
|
|
142
|
+
const among = (logins: readonly string[], login: string) =>
|
|
143
|
+
logins.some((each) => each.toLowerCase() === login.toLowerCase());
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* An org's picture, which its owners and admins change (Q757), and its people, read only: its
|
|
147
|
+
* members, and its teams with theirs. The host's directory says who's in each, and nothing here
|
|
148
|
+
* changes it.
|
|
149
|
+
*/
|
|
150
|
+
export function OrgSettings({ org, viewer }: { readonly org: string; readonly viewer: string }) {
|
|
151
|
+
const directory = useQuery(orgDirectory(org));
|
|
152
|
+
if (directory.error !== null) return <LoadFailed message={directory.error.message} />;
|
|
153
|
+
|
|
154
|
+
if (directory.data === undefined) return <OrgSettingsSkeleton />;
|
|
155
|
+
|
|
156
|
+
if (directory.data === null) return <NotFound />;
|
|
157
|
+
|
|
158
|
+
const { members, teams, pictures } = directory.data;
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<Frame
|
|
162
|
+
picture={
|
|
163
|
+
<AccountAvatar
|
|
164
|
+
login={directory.data.login}
|
|
165
|
+
account="org"
|
|
166
|
+
refusal={
|
|
167
|
+
among(directory.data.admins.rows, viewer)
|
|
168
|
+
? undefined
|
|
169
|
+
: "Only the org's owners and admins change its picture."
|
|
170
|
+
}
|
|
171
|
+
/>
|
|
172
|
+
}
|
|
173
|
+
intro={
|
|
174
|
+
<p className="text-sm text-muted-foreground">
|
|
175
|
+
The host sets who's in {directory.data.name ?? directory.data.login} and its teams. They
|
|
176
|
+
can't be changed here.
|
|
177
|
+
</p>
|
|
178
|
+
}
|
|
179
|
+
members={
|
|
180
|
+
<Logins
|
|
181
|
+
label="Members"
|
|
182
|
+
logins={members}
|
|
183
|
+
pictures={pictures}
|
|
184
|
+
none="This organization has no members yet."
|
|
185
|
+
/>
|
|
186
|
+
}
|
|
187
|
+
teams={
|
|
188
|
+
<>
|
|
189
|
+
{teams.rows.length === 0 ? (
|
|
190
|
+
<Empty className="p-6">
|
|
191
|
+
<EmptyHeader>
|
|
192
|
+
<EmptyMedia variant="icon">
|
|
193
|
+
<UsersIcon />
|
|
194
|
+
</EmptyMedia>
|
|
195
|
+
<EmptyTitle>There aren't any teams here</EmptyTitle>
|
|
196
|
+
<EmptyDescription>
|
|
197
|
+
The host's directory gives this organization none.
|
|
198
|
+
</EmptyDescription>
|
|
199
|
+
</EmptyHeader>
|
|
200
|
+
</Empty>
|
|
201
|
+
) : (
|
|
202
|
+
teams.rows.map((team) => (
|
|
203
|
+
<section key={team.slug} aria-label={team.name} className="flex flex-col gap-2">
|
|
204
|
+
<div className="flex flex-col gap-0.5">
|
|
205
|
+
<h3 className="font-medium">{team.name}</h3>
|
|
206
|
+
{team.description !== null && team.description !== '' && (
|
|
207
|
+
<p className="text-muted-foreground">{team.description}</p>
|
|
208
|
+
)}
|
|
209
|
+
</div>
|
|
210
|
+
<Logins
|
|
211
|
+
label={`${team.name}'s members`}
|
|
212
|
+
logins={team.members}
|
|
213
|
+
pictures={pictures}
|
|
214
|
+
none="No members."
|
|
215
|
+
/>
|
|
216
|
+
</section>
|
|
217
|
+
))
|
|
218
|
+
)}
|
|
219
|
+
{teams.more && (
|
|
220
|
+
<p className="text-sm text-muted-foreground">
|
|
221
|
+
The first {(pagesMost * 100).toLocaleString('en')} teams are shown.
|
|
222
|
+
</p>
|
|
223
|
+
)}
|
|
224
|
+
</>
|
|
225
|
+
}
|
|
226
|
+
/>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query';
|
|
2
|
+
|
|
3
|
+
import { github } from '../clients/clients.ts';
|
|
4
|
+
import { everyPage, failure, type EveryPage } from '../hooks/answers.ts';
|
|
5
|
+
import { type Pictures, picturesOf } from '../hooks/avatars.ts';
|
|
6
|
+
|
|
7
|
+
/** A team of an org, and its members. */
|
|
8
|
+
export interface Team {
|
|
9
|
+
readonly slug: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly description: string | null;
|
|
12
|
+
readonly members: EveryPage<string>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** An org as its settings show it: who's in it, and its teams. */
|
|
16
|
+
export interface OrgDirectory {
|
|
17
|
+
readonly login: string;
|
|
18
|
+
readonly name: string | null;
|
|
19
|
+
readonly members: EveryPage<string>;
|
|
20
|
+
/** Its owners and admins, who change its picture (Q757). */
|
|
21
|
+
readonly admins: EveryPage<string>;
|
|
22
|
+
readonly teams: EveryPage<Team>;
|
|
23
|
+
/** Its members' and teams' members' pictures, as each list named them. */
|
|
24
|
+
readonly pictures: Pictures;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// `after` is the drop-in's cursor, which GitHub's types don't name: a spread passes it.
|
|
28
|
+
const paging = (after: string | undefined) => ({ ...{ per_page: 100, after } });
|
|
29
|
+
|
|
30
|
+
/** A list of people's logins, each one's picture kept in `pictures`. */
|
|
31
|
+
const loginsOf = (
|
|
32
|
+
people: readonly { readonly login: string; readonly avatar_url: string }[],
|
|
33
|
+
pictures: Map<string, string | null>,
|
|
34
|
+
) => {
|
|
35
|
+
for (const [login, picture] of picturesOf(people)) pictures.set(login, picture);
|
|
36
|
+
|
|
37
|
+
return people.map((person) => person.login);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Every login of team `slug` in `org`, to the pages `everyPage` reads, into `pictures`. */
|
|
41
|
+
const teamMembers = (org: string, slug: string, pictures: Map<string, string | null>) =>
|
|
42
|
+
everyPage(async (after) => {
|
|
43
|
+
const answer = await github.GET('/orgs/{org}/teams/{team_slug}/members', {
|
|
44
|
+
params: { path: { org, team_slug: slug }, query: paging(after) },
|
|
45
|
+
});
|
|
46
|
+
if (answer.data === undefined) throw failure(`${slug}'s members didn't load`, answer);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
rows: loginsOf(answer.data, pictures),
|
|
50
|
+
link: answer.response.headers.get('link'),
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Every login in `org` with `role`, GitHub's `all` or `admin`, which holds its owners too, into
|
|
56
|
+
* `pictures`.
|
|
57
|
+
*/
|
|
58
|
+
const orgMembers = (org: string, role: 'all' | 'admin', pictures: Map<string, string | null>) =>
|
|
59
|
+
everyPage(async (after) => {
|
|
60
|
+
const answer = await github.GET('/orgs/{org}/members', {
|
|
61
|
+
params: { path: { org }, query: { ...paging(after), role } },
|
|
62
|
+
});
|
|
63
|
+
if (answer.data === undefined) throw failure("The members didn't load", answer);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
rows: loginsOf(answer.data, pictures),
|
|
67
|
+
link: answer.response.headers.get('link'),
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `org`, its members and its teams with theirs, as the drop-in's org routes read them from the
|
|
73
|
+
* host's `people`: `null` when there's no such org.
|
|
74
|
+
*/
|
|
75
|
+
export const orgDirectory = (org: string) =>
|
|
76
|
+
queryOptions({
|
|
77
|
+
queryKey: ['org-directory', org],
|
|
78
|
+
queryFn: async (): Promise<OrgDirectory | null> => {
|
|
79
|
+
const found = await github.GET('/orgs/{org}', { params: { path: { org } } });
|
|
80
|
+
if (found.response.status === 404) return null;
|
|
81
|
+
|
|
82
|
+
if (found.data === undefined) throw failure(`${org} didn't load`, found);
|
|
83
|
+
|
|
84
|
+
const pictures = new Map<string, string | null>();
|
|
85
|
+
const members = orgMembers(org, 'all', pictures);
|
|
86
|
+
const admins = orgMembers(org, 'admin', pictures);
|
|
87
|
+
const teams = everyPage(async (after) => {
|
|
88
|
+
const answer = await github.GET('/orgs/{org}/teams', {
|
|
89
|
+
params: { path: { org }, query: paging(after) },
|
|
90
|
+
});
|
|
91
|
+
if (answer.data === undefined) throw failure("The teams didn't load", answer);
|
|
92
|
+
|
|
93
|
+
const rows = await Promise.all(
|
|
94
|
+
answer.data.map(async (team) => ({
|
|
95
|
+
slug: team.slug,
|
|
96
|
+
name: team.name,
|
|
97
|
+
description: team.description,
|
|
98
|
+
members: await teamMembers(org, team.slug, pictures),
|
|
99
|
+
})),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
return { rows, link: answer.response.headers.get('link') };
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const [people, owners, groups] = await Promise.all([members, admins, teams]);
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
login: found.data.login,
|
|
109
|
+
name: found.data.name ?? null,
|
|
110
|
+
members: people,
|
|
111
|
+
admins: owners,
|
|
112
|
+
teams: groups,
|
|
113
|
+
pictures,
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { ShieldIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
import { LoadFailed } from '../components/states/states.tsx';
|
|
5
|
+
import {
|
|
6
|
+
Empty,
|
|
7
|
+
EmptyDescription,
|
|
8
|
+
EmptyHeader,
|
|
9
|
+
EmptyMedia,
|
|
10
|
+
EmptyTitle,
|
|
11
|
+
} from '../components/ui/empty.tsx';
|
|
12
|
+
import { Skeleton } from '../components/ui/skeleton.tsx';
|
|
13
|
+
import {
|
|
14
|
+
Table,
|
|
15
|
+
TableBody,
|
|
16
|
+
TableCell,
|
|
17
|
+
TableHead,
|
|
18
|
+
TableHeader,
|
|
19
|
+
TableRow,
|
|
20
|
+
} from '../components/ui/table.tsx';
|
|
21
|
+
import { ruleList } from './rules.ts';
|
|
22
|
+
|
|
23
|
+
/** The push rules in effect on every repo, read only: the host's own, by name and the refs each covers. */
|
|
24
|
+
export function RuleList() {
|
|
25
|
+
const rules = useQuery(ruleList);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<section aria-label="Rules" className="flex flex-col gap-3">
|
|
29
|
+
<h2 className="text-lg font-semibold">Rules</h2>
|
|
30
|
+
<p className="text-sm text-muted-foreground">
|
|
31
|
+
The host sets these rules on every repository. They can't be changed here.
|
|
32
|
+
</p>
|
|
33
|
+
{rules.error !== null ? (
|
|
34
|
+
<LoadFailed message="The rules didn't load" />
|
|
35
|
+
) : rules.data === undefined ? (
|
|
36
|
+
<Skeleton className="h-24" />
|
|
37
|
+
) : rules.data.length === 0 ? (
|
|
38
|
+
<Empty>
|
|
39
|
+
<EmptyHeader>
|
|
40
|
+
<EmptyMedia variant="icon">
|
|
41
|
+
<ShieldIcon />
|
|
42
|
+
</EmptyMedia>
|
|
43
|
+
<EmptyTitle>No rules are in effect</EmptyTitle>
|
|
44
|
+
<EmptyDescription>
|
|
45
|
+
Anyone who may push here may move or delete any ref.
|
|
46
|
+
</EmptyDescription>
|
|
47
|
+
</EmptyHeader>
|
|
48
|
+
</Empty>
|
|
49
|
+
) : (
|
|
50
|
+
<Table aria-label="Rules in effect" className="border">
|
|
51
|
+
<TableHeader>
|
|
52
|
+
<TableRow>
|
|
53
|
+
<TableHead>Rule</TableHead>
|
|
54
|
+
<TableHead>Covers</TableHead>
|
|
55
|
+
</TableRow>
|
|
56
|
+
</TableHeader>
|
|
57
|
+
<TableBody>
|
|
58
|
+
{rules.data.map((rule) => (
|
|
59
|
+
<TableRow key={rule.name}>
|
|
60
|
+
<TableCell className="font-mono font-medium">{rule.name}</TableCell>
|
|
61
|
+
{/* A rule can cover many refs: the cell wraps them, not the page. */}
|
|
62
|
+
<TableCell className="whitespace-normal text-muted-foreground wrap-anywhere">
|
|
63
|
+
{rule.covers.join(', ')}
|
|
64
|
+
</TableCell>
|
|
65
|
+
</TableRow>
|
|
66
|
+
))}
|
|
67
|
+
</TableBody>
|
|
68
|
+
</Table>
|
|
69
|
+
)}
|
|
70
|
+
</section>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { createServerFn } from '@tanstack/react-start';
|
|
3
|
+
|
|
4
|
+
import type { AppContext, ShownRule } from '../context/context.ts';
|
|
5
|
+
|
|
6
|
+
/** Each of the host's push rules as a repo's settings show it: its name and the refs it covers. */
|
|
7
|
+
export const shownRules = (
|
|
8
|
+
rules: readonly {
|
|
9
|
+
readonly rule: { readonly name: string };
|
|
10
|
+
readonly covers: ShownRule['covers'];
|
|
11
|
+
}[],
|
|
12
|
+
): readonly ShownRule[] => rules.map(({ rule, covers }) => ({ name: rule.name, covers }));
|
|
13
|
+
|
|
14
|
+
/** The push rules a request's context holds: those `server.ts` made Git with. */
|
|
15
|
+
export const rulesOf = (context: Pick<AppContext, 'rules'>): readonly ShownRule[] => context.rules;
|
|
16
|
+
|
|
17
|
+
/** The push rules Git runs in this Worker, as the host made it: read here, never kept apart. */
|
|
18
|
+
export const hostRules = createServerFn({ method: 'GET' }).handler(({ context }) =>
|
|
19
|
+
rulesOf(context),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/** The host's push rules, which are the same on every repo. */
|
|
23
|
+
export const ruleList = queryOptions({
|
|
24
|
+
queryKey: ['host-rules'],
|
|
25
|
+
queryFn: () => hostRules(),
|
|
26
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
27
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { LockIcon } from 'lucide-react';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import type { PageOperation } from '../clients/allowed.ts';
|
|
6
|
+
import { Go } from '../code/controls.tsx';
|
|
7
|
+
import type { RepoPlace } from '../code/places.ts';
|
|
8
|
+
import { LoadFailed } from '../components/states/states.tsx';
|
|
9
|
+
import { Alert, AlertDescription } from '../components/ui/alert.tsx';
|
|
10
|
+
import { buttonVariants } from '../components/ui/button.tsx';
|
|
11
|
+
import { Skeleton } from '../components/ui/skeleton.tsx';
|
|
12
|
+
import { allowedHere } from '../hooks/allowed.ts';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether a repo's settings open for the viewer: when they may read its webhooks or change its
|
|
16
|
+
* General settings, each as the host's `authorize` decides.
|
|
17
|
+
*/
|
|
18
|
+
export const settingsOpen = (allowed: ReadonlySet<PageOperation>) =>
|
|
19
|
+
allowed.has('hook.read') || allowed.has('repo.update');
|
|
20
|
+
|
|
21
|
+
/** The settings' pages, by group, as GitHub's sidebar names them. */
|
|
22
|
+
const sections = [
|
|
23
|
+
{ group: 'Repository', pages: [{ name: 'General', path: '' }] },
|
|
24
|
+
{ group: 'Access', pages: [{ name: 'Collaborators and teams', path: 'access' }] },
|
|
25
|
+
{
|
|
26
|
+
group: 'Code and automation',
|
|
27
|
+
pages: [
|
|
28
|
+
{ name: 'Rules', path: 'rules' },
|
|
29
|
+
{ name: 'Webhooks', path: 'hooks' },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
34
|
+
/** Where one of the repo's settings pages is. */
|
|
35
|
+
export const settingsHref = (place: RepoPlace, path: string) =>
|
|
36
|
+
`/${place.owner}/${place.repo}/settings${path === '' ? '' : `/${path}`}`;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A repo's settings: the sidebar of its pages beside the one open, for a viewer the drop-in lets
|
|
40
|
+
* change them; anyone else is told they can't, and shown none of them.
|
|
41
|
+
*/
|
|
42
|
+
export function SettingsLayout({
|
|
43
|
+
place,
|
|
44
|
+
current,
|
|
45
|
+
children,
|
|
46
|
+
}: {
|
|
47
|
+
readonly place: RepoPlace;
|
|
48
|
+
readonly current: string;
|
|
49
|
+
readonly children: ReactNode;
|
|
50
|
+
}) {
|
|
51
|
+
const asked = useQuery(allowedHere(place));
|
|
52
|
+
const allowed = asked.data;
|
|
53
|
+
|
|
54
|
+
if (allowed === undefined) {
|
|
55
|
+
return asked.error === null ? (
|
|
56
|
+
<Skeleton className="h-64" />
|
|
57
|
+
) : (
|
|
58
|
+
<LoadFailed message="What you may do here didn't load" />
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!settingsOpen(allowed)) {
|
|
63
|
+
return (
|
|
64
|
+
<Alert>
|
|
65
|
+
<LockIcon />
|
|
66
|
+
<AlertDescription>
|
|
67
|
+
You can't change the settings of {place.owner}/{place.repo}.
|
|
68
|
+
</AlertDescription>
|
|
69
|
+
</Alert>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div className="flex flex-col gap-6 md:flex-row">
|
|
75
|
+
<nav aria-label="Settings" className="flex flex-col gap-3 md:w-56 md:shrink-0">
|
|
76
|
+
{sections.map((section) => (
|
|
77
|
+
<div key={section.group} className="flex flex-col gap-1">
|
|
78
|
+
<h2 className="px-2 text-meta font-semibold text-muted-foreground">{section.group}</h2>
|
|
79
|
+
{section.pages.map((page) => (
|
|
80
|
+
<Go
|
|
81
|
+
key={page.path}
|
|
82
|
+
href={settingsHref(place, page.path)}
|
|
83
|
+
aria-current={current === page.path ? 'page' : undefined}
|
|
84
|
+
className={buttonVariants({
|
|
85
|
+
variant: current === page.path ? 'secondary' : 'ghost',
|
|
86
|
+
className: 'justify-start',
|
|
87
|
+
})}
|
|
88
|
+
>
|
|
89
|
+
{page.name}
|
|
90
|
+
</Go>
|
|
91
|
+
))}
|
|
92
|
+
</div>
|
|
93
|
+
))}
|
|
94
|
+
</nav>
|
|
95
|
+
<div className="flex min-w-0 flex-1 flex-col gap-4">{children}</div>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Who may read and write the repo: the host's policy decides, and nothing here changes it. */
|
|
101
|
+
export function AccessPage({ place }: { readonly place: RepoPlace }) {
|
|
102
|
+
return (
|
|
103
|
+
<section aria-label="Collaborators and teams" className="flex flex-col gap-3">
|
|
104
|
+
<h2 className="text-lg font-semibold">Collaborators and teams</h2>
|
|
105
|
+
<Alert>
|
|
106
|
+
<LockIcon />
|
|
107
|
+
<AlertDescription>
|
|
108
|
+
Access is set by the host. Who may read and write {place.owner}/{place.repo} is decided by
|
|
109
|
+
its policy, and can't be changed here.
|
|
110
|
+
</AlertDescription>
|
|
111
|
+
</Alert>
|
|
112
|
+
</section>
|
|
113
|
+
);
|
|
114
|
+
}
|