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,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pull request list's search box, as GitHub's reads it: an issue's qualifiers, and
|
|
3
|
+
* `is:merged`, `is:unmerged`, `draft:`, `review:` and `review-requested:`. As on the issue list,
|
|
4
|
+
* each is one of the drop-in's filters, or one the page applies to what it lists (Q514).
|
|
5
|
+
*/
|
|
6
|
+
import type { RepoPlace } from '../code/places.ts';
|
|
7
|
+
import {
|
|
8
|
+
filterOf,
|
|
9
|
+
keptOf,
|
|
10
|
+
qualifiersOf,
|
|
11
|
+
searchQueryOf,
|
|
12
|
+
termsOf,
|
|
13
|
+
valueOf,
|
|
14
|
+
type IssueFilter,
|
|
15
|
+
} from '../issues/search.ts';
|
|
16
|
+
|
|
17
|
+
/** A review state `review:` filters by: none yet, or what the reviews decided. */
|
|
18
|
+
export type ReviewFilter = 'none' | 'approved' | 'changes_requested';
|
|
19
|
+
|
|
20
|
+
/** What the list asks the drop-in for, and what it keeps of its answer. */
|
|
21
|
+
export interface PullFilter extends IssueFilter {
|
|
22
|
+
/**
|
|
23
|
+
* Merged ones alone, or unmerged ones, or either: apart from `state`, as GitHub's are, so
|
|
24
|
+
* `is:closed is:unmerged` names those closed without merging. A merged one is closed.
|
|
25
|
+
*/
|
|
26
|
+
readonly merged: boolean | undefined;
|
|
27
|
+
/** Drafts alone, or none, or either. */
|
|
28
|
+
readonly draft: boolean | undefined;
|
|
29
|
+
readonly review: ReviewFilter | undefined;
|
|
30
|
+
/** Whose review is asked for, by login, or `@me` for the viewer's. */
|
|
31
|
+
readonly reviewRequested: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The box's text when the list opens, as GitHub's has it. */
|
|
35
|
+
export const defaultPullQuery = 'is:pr is:open';
|
|
36
|
+
|
|
37
|
+
const reviews: ReadonlySet<string> = new Set<ReviewFilter>([
|
|
38
|
+
'none',
|
|
39
|
+
'approved',
|
|
40
|
+
'changes_requested',
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const isReview = (value: string): value is ReviewFilter => reviews.has(value);
|
|
44
|
+
|
|
45
|
+
/** The filter `query` names; what no filter takes is in `unfiltered`. */
|
|
46
|
+
export const pullFilterOf = (query: string): PullFilter => {
|
|
47
|
+
let merged: boolean | undefined;
|
|
48
|
+
let draft: boolean | undefined;
|
|
49
|
+
let review: ReviewFilter | undefined;
|
|
50
|
+
let reviewRequested: string | undefined;
|
|
51
|
+
const shared: string[] = [];
|
|
52
|
+
const unfiltered: string[] = [];
|
|
53
|
+
|
|
54
|
+
for (const { written, name, value } of termsOf(query)) {
|
|
55
|
+
if (name === 'is' && value === 'pr') continue;
|
|
56
|
+
else if (name === 'is' && (value === 'merged' || value === 'unmerged')) {
|
|
57
|
+
merged = value === 'merged';
|
|
58
|
+
} else if (name === 'is' && value === 'draft') draft = true;
|
|
59
|
+
else if (name === 'draft' && (value === 'true' || value === 'false')) draft = value === 'true';
|
|
60
|
+
else if (name === 'review' && isReview(value)) review = value;
|
|
61
|
+
else if (name === 'review-requested' && value !== '') reviewRequested = value;
|
|
62
|
+
// `is:issue` is the issue list's, which the issue filter takes: here it filters nothing.
|
|
63
|
+
else if (name === 'is' && value === 'issue') unfiltered.push(written);
|
|
64
|
+
else shared.push(written);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const issue = filterOf(shared.join(' '));
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
...issue,
|
|
71
|
+
merged,
|
|
72
|
+
draft,
|
|
73
|
+
review,
|
|
74
|
+
reviewRequested,
|
|
75
|
+
unfiltered: [...unfiltered, ...issue.unfiltered],
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** The box's text for `filter`: the query `pullFilterOf` reads back as the same filter. */
|
|
80
|
+
export const pullQueryOf = (filter: PullFilter) => {
|
|
81
|
+
const terms = ['is:pr'];
|
|
82
|
+
if (filter.state !== 'all') terms.push(`is:${filter.state}`);
|
|
83
|
+
|
|
84
|
+
if (filter.merged !== undefined) terms.push(filter.merged ? 'is:merged' : 'is:unmerged');
|
|
85
|
+
|
|
86
|
+
if (filter.draft !== undefined) terms.push(`draft:${filter.draft}`);
|
|
87
|
+
|
|
88
|
+
if (filter.review !== undefined) terms.push(`review:${filter.review}`);
|
|
89
|
+
|
|
90
|
+
if (filter.reviewRequested !== undefined) {
|
|
91
|
+
terms.push(`review-requested:${valueOf(filter.reviewRequested)}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return [...terms, ...qualifiersOf(filter), ...keptOf(filter)].join(' ');
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The drop-in's search query for `filter` in `place`'s repo, or `undefined` when a name holds a
|
|
99
|
+
* quote. Search takes no review qualifier, so `review:` and `review-requested:` are left for the
|
|
100
|
+
* list to filter by, reading each pull request's reviews.
|
|
101
|
+
*/
|
|
102
|
+
export const pullSearchQueryOf = (place: RepoPlace, filter: PullFilter) => {
|
|
103
|
+
const terms: string[] = [];
|
|
104
|
+
if (filter.merged !== undefined) terms.push(filter.merged ? 'is:merged' : 'is:unmerged');
|
|
105
|
+
|
|
106
|
+
if (filter.draft !== undefined) terms.push(`draft:${filter.draft}`);
|
|
107
|
+
|
|
108
|
+
return searchQueryOf(place, filter, 'pr', terms);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** GitHub's name for the signed-in viewer, in any qualifier that takes a login. */
|
|
112
|
+
const me = '@me';
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* `filter` with `@me` as `viewer`'s login in its author, assignee and requested reviewer, as
|
|
116
|
+
* GitHub reads it. A visitor's stays `@me`, which no login is, so it matches nothing.
|
|
117
|
+
*/
|
|
118
|
+
export const asViewer = (filter: PullFilter, viewer: string | undefined): PullFilter => {
|
|
119
|
+
if (viewer === undefined) return filter;
|
|
120
|
+
|
|
121
|
+
const login = (name: string) => (name === me ? viewer : name);
|
|
122
|
+
const { author, assignee, reviewRequested } = filter;
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
...filter,
|
|
126
|
+
author: author === undefined ? undefined : login(author),
|
|
127
|
+
assignee: assignee?.kind === 'named' ? { kind: 'named', name: login(assignee.name) } : assignee,
|
|
128
|
+
reviewRequested: reviewRequested === undefined ? undefined : login(reviewRequested),
|
|
129
|
+
};
|
|
130
|
+
};
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { ListOrderedIcon, PauseIcon } from 'lucide-react';
|
|
3
|
+
import { useCallback, useState, type ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Go } from '../code/controls.tsx';
|
|
6
|
+
import type { RepoPlace } from '../code/places.ts';
|
|
7
|
+
import { ConfirmAction } from '../components/confirm-action.tsx';
|
|
8
|
+
import { Alert, AlertDescription, AlertTitle } from '../components/ui/alert.tsx';
|
|
9
|
+
import { Badge } from '../components/ui/badge.tsx';
|
|
10
|
+
import { Button } from '../components/ui/button.tsx';
|
|
11
|
+
import { Card, CardContent, CardFooter } from '../components/ui/card.tsx';
|
|
12
|
+
import {
|
|
13
|
+
Empty,
|
|
14
|
+
EmptyDescription,
|
|
15
|
+
EmptyHeader,
|
|
16
|
+
EmptyMedia,
|
|
17
|
+
EmptyTitle,
|
|
18
|
+
} from '../components/ui/empty.tsx';
|
|
19
|
+
import { Field, FieldError } from '../components/ui/field.tsx';
|
|
20
|
+
import {
|
|
21
|
+
InputGroup,
|
|
22
|
+
InputGroupAddon,
|
|
23
|
+
InputGroupButton,
|
|
24
|
+
InputGroupInput,
|
|
25
|
+
} from '../components/ui/input-group.tsx';
|
|
26
|
+
import { Skeleton } from '../components/ui/skeleton.tsx';
|
|
27
|
+
import {
|
|
28
|
+
Table,
|
|
29
|
+
TableBody,
|
|
30
|
+
TableCell,
|
|
31
|
+
TableHead,
|
|
32
|
+
TableHeader,
|
|
33
|
+
TableRow,
|
|
34
|
+
} from '../components/ui/table.tsx';
|
|
35
|
+
import { useAllowed } from '../hooks/allowed.ts';
|
|
36
|
+
import { Failed } from '../issues/issue-page.tsx';
|
|
37
|
+
import { CommitChecks } from '../pulls/pull-page.tsx';
|
|
38
|
+
import type { PullDetail } from '../pulls/pull.ts';
|
|
39
|
+
import {
|
|
40
|
+
addPull,
|
|
41
|
+
entryHolds,
|
|
42
|
+
pullOfEntry,
|
|
43
|
+
queueable,
|
|
44
|
+
queueCandidates,
|
|
45
|
+
queuedBranch,
|
|
46
|
+
queuedTitles,
|
|
47
|
+
queueEntries,
|
|
48
|
+
queueHolds,
|
|
49
|
+
queuePoll,
|
|
50
|
+
refreshQueue,
|
|
51
|
+
removePull,
|
|
52
|
+
type QueueEntry,
|
|
53
|
+
type QueueHold,
|
|
54
|
+
} from './queue.ts';
|
|
55
|
+
|
|
56
|
+
/** How each entry's state reads in its row. */
|
|
57
|
+
const entryStates: Readonly<Record<QueueEntry['state'], string>> = {
|
|
58
|
+
waiting: 'Queued',
|
|
59
|
+
checking: 'Checking',
|
|
60
|
+
held: 'Held',
|
|
61
|
+
merged: 'Merged',
|
|
62
|
+
failed: 'Failed',
|
|
63
|
+
removed: 'Removed',
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** A change to the queue the page makes, and reads the queue again after. */
|
|
67
|
+
const useQueueChange = <Input,>(place: RepoPlace, change: (input: Input) => Promise<void>) => {
|
|
68
|
+
const client = useQueryClient();
|
|
69
|
+
|
|
70
|
+
return useMutation({
|
|
71
|
+
mutationFn: change,
|
|
72
|
+
onSettled: () => refreshQueue(client, place),
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** One entry's row: its place, its pull request, where it stands, why it's held, and Remove. */
|
|
77
|
+
function EntryRow({
|
|
78
|
+
place,
|
|
79
|
+
entry,
|
|
80
|
+
position,
|
|
81
|
+
title,
|
|
82
|
+
allowed,
|
|
83
|
+
}: {
|
|
84
|
+
readonly place: RepoPlace;
|
|
85
|
+
readonly entry: QueueEntry;
|
|
86
|
+
readonly position: number;
|
|
87
|
+
readonly title: string | undefined;
|
|
88
|
+
readonly allowed: boolean;
|
|
89
|
+
}) {
|
|
90
|
+
const pull = pullOfEntry(entry);
|
|
91
|
+
const source = entry.source.replace(/^refs\/heads\//, '');
|
|
92
|
+
const client = useQueryClient();
|
|
93
|
+
// Only a pull request's entry goes through the drop-in; a host's own has no Remove here (Q527).
|
|
94
|
+
const remove = useQueueChange<void>(place, async () => {
|
|
95
|
+
if (pull !== undefined) await removePull(client, place, pull);
|
|
96
|
+
});
|
|
97
|
+
// Only a held entry has holds to read: its own, and those of entries it replaced.
|
|
98
|
+
const isHeld = entry.state === 'held';
|
|
99
|
+
const holds = useQuery({
|
|
100
|
+
...entryHolds(place, entry.id),
|
|
101
|
+
enabled: isHeld,
|
|
102
|
+
refetchInterval: queuePoll,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<TableRow>
|
|
107
|
+
<TableCell className="w-10 text-right align-top font-mono text-muted-foreground tabular-nums">
|
|
108
|
+
{position}
|
|
109
|
+
</TableCell>
|
|
110
|
+
{/* A title, a branch or a hold's reason can be long: the cell wraps, not the page. */}
|
|
111
|
+
<TableCell className="whitespace-normal">
|
|
112
|
+
<div className="flex min-w-0 flex-col gap-1">
|
|
113
|
+
{pull === undefined ? (
|
|
114
|
+
<span className="font-medium">{source}</span>
|
|
115
|
+
) : (
|
|
116
|
+
<Go
|
|
117
|
+
href={`/${place.owner}/${place.repo}/pull/${pull}`}
|
|
118
|
+
className="font-medium wrap-anywhere hover:underline"
|
|
119
|
+
>
|
|
120
|
+
{title ?? `Pull request #${pull}`}
|
|
121
|
+
<span className="font-normal text-muted-foreground"> #{pull}</span>
|
|
122
|
+
</Go>
|
|
123
|
+
)}
|
|
124
|
+
<span className="text-muted-foreground wrap-anywhere">
|
|
125
|
+
{source} at <span className="font-mono">{entry.head.slice(0, 7)}</span>, added by{' '}
|
|
126
|
+
{entry.subject?.id ?? entry.actor.id}
|
|
127
|
+
</span>
|
|
128
|
+
{(isHeld ? (holds.data ?? []) : []).map((held) => (
|
|
129
|
+
<span key={held.id} className="flex items-center gap-1.5 wrap-anywhere">
|
|
130
|
+
<PauseIcon aria-hidden className="size-3 shrink-0" />
|
|
131
|
+
Held: {held.reason}
|
|
132
|
+
</span>
|
|
133
|
+
))}
|
|
134
|
+
<Failed error={holds.error} />
|
|
135
|
+
<Failed error={remove.error} />
|
|
136
|
+
</div>
|
|
137
|
+
</TableCell>
|
|
138
|
+
<TableCell className="align-top">
|
|
139
|
+
<Badge variant={entry.state === 'checking' ? 'default' : 'outline'}>
|
|
140
|
+
{entryStates[entry.state]}
|
|
141
|
+
</Badge>
|
|
142
|
+
</TableCell>
|
|
143
|
+
<TableCell className="text-right align-top">
|
|
144
|
+
{allowed && pull !== undefined && (
|
|
145
|
+
<ConfirmAction
|
|
146
|
+
label="Remove"
|
|
147
|
+
title={`Remove pull request #${pull} from the queue?`}
|
|
148
|
+
description="It leaves the queue, and isn't merged by it. You can add it again."
|
|
149
|
+
disabled={remove.isPending}
|
|
150
|
+
onConfirm={() => remove.mutate()}
|
|
151
|
+
/>
|
|
152
|
+
)}
|
|
153
|
+
</TableCell>
|
|
154
|
+
</TableRow>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Adds a pull request by its number, for whoever may merge: it shows which one first, and adds it
|
|
160
|
+
* once the viewer confirms, since with no checks required it can merge at once.
|
|
161
|
+
*/
|
|
162
|
+
function AddPull({ place }: { readonly place: RepoPlace }) {
|
|
163
|
+
const client = useQueryClient();
|
|
164
|
+
const [number, setNumber] = useState('');
|
|
165
|
+
// Add with no number asks nothing of the drop-in, and says what's missing instead.
|
|
166
|
+
const [missing, setMissing] = useState(false);
|
|
167
|
+
const find = useMutation({ mutationFn: (pull: number) => queueable(client, place, pull) });
|
|
168
|
+
const add = useQueueChange(place, async (pull: PullDetail) => {
|
|
169
|
+
await addPull(client, place, pull);
|
|
170
|
+
});
|
|
171
|
+
const focus = useCallback((button: HTMLButtonElement | null) => button?.focus(), []);
|
|
172
|
+
const found = find.data;
|
|
173
|
+
|
|
174
|
+
if (found !== undefined) {
|
|
175
|
+
const cancel = () => {
|
|
176
|
+
find.reset();
|
|
177
|
+
add.reset();
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<Card size="sm" role="group" aria-label="Confirm">
|
|
182
|
+
<CardContent className="flex flex-col gap-2">
|
|
183
|
+
<p className="wrap-anywhere">
|
|
184
|
+
Add <span className="font-medium">{found.title}</span>{' '}
|
|
185
|
+
<span className="text-muted-foreground">#{found.number}</span> to the queue? It merges
|
|
186
|
+
into {queuedBranch} once its checks pass with everything ahead of it.
|
|
187
|
+
</p>
|
|
188
|
+
<Failed error={add.error} />
|
|
189
|
+
</CardContent>
|
|
190
|
+
<CardFooter className="gap-2">
|
|
191
|
+
<Button
|
|
192
|
+
ref={focus}
|
|
193
|
+
size="sm"
|
|
194
|
+
disabled={add.isPending}
|
|
195
|
+
onClick={() =>
|
|
196
|
+
add.mutate(found, {
|
|
197
|
+
onSuccess: () => {
|
|
198
|
+
find.reset();
|
|
199
|
+
setNumber('');
|
|
200
|
+
},
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
>
|
|
204
|
+
Confirm add to queue
|
|
205
|
+
</Button>
|
|
206
|
+
<Button size="sm" variant="ghost" disabled={add.isPending} onClick={cancel}>
|
|
207
|
+
Cancel
|
|
208
|
+
</Button>
|
|
209
|
+
</CardFooter>
|
|
210
|
+
</Card>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<form
|
|
216
|
+
className="flex flex-col gap-2"
|
|
217
|
+
onSubmit={(event) => {
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
setMissing(number === '');
|
|
220
|
+
|
|
221
|
+
if (number !== '' && !find.isPending) find.mutate(Number(number));
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
<Field data-invalid={missing || undefined} className="max-w-xs">
|
|
225
|
+
<InputGroup>
|
|
226
|
+
<InputGroupInput
|
|
227
|
+
aria-label="Pull request number"
|
|
228
|
+
aria-invalid={missing || undefined}
|
|
229
|
+
inputMode="numeric"
|
|
230
|
+
placeholder="Pull request #"
|
|
231
|
+
value={number}
|
|
232
|
+
onChange={(event) => {
|
|
233
|
+
setNumber(event.target.value.replace(/\D/g, ''));
|
|
234
|
+
setMissing(false);
|
|
235
|
+
}}
|
|
236
|
+
/>
|
|
237
|
+
<InputGroupAddon align="inline-end">
|
|
238
|
+
{/* Never disabled: InputGroup greys its whole field when a part of it is. */}
|
|
239
|
+
<InputGroupButton type="submit" variant="secondary">
|
|
240
|
+
Add to queue
|
|
241
|
+
</InputGroupButton>
|
|
242
|
+
</InputGroupAddon>
|
|
243
|
+
</InputGroup>
|
|
244
|
+
{missing && <FieldError>Enter a pull request number.</FieldError>}
|
|
245
|
+
</Field>
|
|
246
|
+
<Failed error={find.error} />
|
|
247
|
+
</form>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The queue's being held whole, and why: read only, since no one's sign-in reaches a hold's
|
|
253
|
+
* release through Git's REST, which keeps holds for the host's own sign-in.
|
|
254
|
+
*/
|
|
255
|
+
function QueueHeld({ holds }: { readonly holds: readonly QueueHold[] }) {
|
|
256
|
+
return holds.map((held) => (
|
|
257
|
+
<Alert key={held.id}>
|
|
258
|
+
<PauseIcon />
|
|
259
|
+
<AlertTitle>The queue is held</AlertTitle>
|
|
260
|
+
<AlertDescription>{held.reason}</AlertDescription>
|
|
261
|
+
</Alert>
|
|
262
|
+
));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** A section's heading, with how many it holds. */
|
|
266
|
+
function Section({
|
|
267
|
+
title,
|
|
268
|
+
count,
|
|
269
|
+
children,
|
|
270
|
+
}: {
|
|
271
|
+
readonly title: string;
|
|
272
|
+
readonly count?: ReactNode;
|
|
273
|
+
readonly children: ReactNode;
|
|
274
|
+
}) {
|
|
275
|
+
return (
|
|
276
|
+
<section className="flex flex-col gap-2" aria-label={title}>
|
|
277
|
+
<h2 className="flex items-center gap-2 text-sm font-semibold">
|
|
278
|
+
{title}
|
|
279
|
+
{count !== undefined && <Badge variant="secondary">{count}</Badge>}
|
|
280
|
+
</h2>
|
|
281
|
+
{children}
|
|
282
|
+
</section>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** The commits the queue is trying now, each with its checks as they run. */
|
|
287
|
+
function Candidates({ place }: { readonly place: RepoPlace }) {
|
|
288
|
+
const candidates = useQuery({ ...queueCandidates(place), refetchInterval: queuePoll });
|
|
289
|
+
if (candidates.error !== null) return <Failed error={candidates.error} />;
|
|
290
|
+
|
|
291
|
+
if (candidates.data === undefined) return <Skeleton className="h-16 w-full" />;
|
|
292
|
+
|
|
293
|
+
if (candidates.data.length === 0) return null;
|
|
294
|
+
|
|
295
|
+
return (
|
|
296
|
+
<Section title="Being checked" count={candidates.data.length}>
|
|
297
|
+
{candidates.data.map((candidate) => (
|
|
298
|
+
<div key={candidate.id} className="flex flex-col gap-1">
|
|
299
|
+
<p className="text-sm text-muted-foreground">
|
|
300
|
+
Trying{' '}
|
|
301
|
+
<Go
|
|
302
|
+
href={`/${place.owner}/${place.repo}/commit/${candidate.sha}`}
|
|
303
|
+
className="font-mono hover:underline"
|
|
304
|
+
>
|
|
305
|
+
{candidate.sha.slice(0, 7)}
|
|
306
|
+
</Go>
|
|
307
|
+
</p>
|
|
308
|
+
<CommitChecks place={place} sha={candidate.sha} />
|
|
309
|
+
</div>
|
|
310
|
+
))}
|
|
311
|
+
</Section>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* A repository's merge queue: what it's trying and the checks on each try, its entries in the
|
|
317
|
+
* order it tries them, and its holds, read again every few seconds while the page shows them.
|
|
318
|
+
* Whoever may merge adds pull requests and removes them, through the drop-in's
|
|
319
|
+
* `enqueuePullRequest` and `dequeuePullRequest` (Q527). Holds show read only: Git keeps holding
|
|
320
|
+
* and releasing for the host's own sign-in, which no session's token reaches.
|
|
321
|
+
*/
|
|
322
|
+
export function QueuePage({ place }: { readonly place: RepoPlace }) {
|
|
323
|
+
const allowed = useAllowed(place).has('pull.merge');
|
|
324
|
+
const pages = useInfiniteQuery({ ...queueEntries(place), refetchInterval: queuePoll });
|
|
325
|
+
const holds = useQuery({ ...queueHolds(place), refetchInterval: queuePoll });
|
|
326
|
+
const titles = useQuery(queuedTitles(place)).data;
|
|
327
|
+
const entries = pages.data?.pages.flatMap((page) => page.entries) ?? [];
|
|
328
|
+
|
|
329
|
+
return (
|
|
330
|
+
<div className="flex flex-col gap-4">
|
|
331
|
+
<header className="flex flex-wrap items-center gap-2">
|
|
332
|
+
<h1 className="flex items-center gap-2 text-lg font-semibold">
|
|
333
|
+
<ListOrderedIcon aria-hidden className="size-4" />
|
|
334
|
+
Merge queue
|
|
335
|
+
</h1>
|
|
336
|
+
<Badge variant="outline" className="font-mono">
|
|
337
|
+
{queuedBranch}
|
|
338
|
+
</Badge>
|
|
339
|
+
</header>
|
|
340
|
+
<QueueHeld holds={holds.data ?? []} />
|
|
341
|
+
<Failed error={holds.error} />
|
|
342
|
+
<Candidates place={place} />
|
|
343
|
+
<Section title="Queued" count={pages.data === undefined ? undefined : entries.length}>
|
|
344
|
+
{allowed && <AddPull place={place} />}
|
|
345
|
+
{pages.error !== null ? (
|
|
346
|
+
<Failed error={pages.error} />
|
|
347
|
+
) : pages.data === undefined ? (
|
|
348
|
+
<Skeleton className="h-40 w-full" />
|
|
349
|
+
) : entries.length === 0 ? (
|
|
350
|
+
<Empty className="border">
|
|
351
|
+
<EmptyHeader>
|
|
352
|
+
<EmptyMedia variant="icon">
|
|
353
|
+
<ListOrderedIcon />
|
|
354
|
+
</EmptyMedia>
|
|
355
|
+
<EmptyTitle>The queue is empty</EmptyTitle>
|
|
356
|
+
<EmptyDescription>
|
|
357
|
+
A pull request added to the queue merges into {queuedBranch} once its checks pass
|
|
358
|
+
with everything ahead of it.
|
|
359
|
+
</EmptyDescription>
|
|
360
|
+
</EmptyHeader>
|
|
361
|
+
</Empty>
|
|
362
|
+
) : (
|
|
363
|
+
<Table aria-label="Queued pull requests" className="border">
|
|
364
|
+
<TableHeader>
|
|
365
|
+
<TableRow>
|
|
366
|
+
<TableHead className="text-right">#</TableHead>
|
|
367
|
+
<TableHead>Pull request</TableHead>
|
|
368
|
+
<TableHead>State</TableHead>
|
|
369
|
+
<TableHead>
|
|
370
|
+
<span className="sr-only">Remove</span>
|
|
371
|
+
</TableHead>
|
|
372
|
+
</TableRow>
|
|
373
|
+
</TableHeader>
|
|
374
|
+
<TableBody>
|
|
375
|
+
{entries.map((entry, index) => {
|
|
376
|
+
const pull = pullOfEntry(entry);
|
|
377
|
+
|
|
378
|
+
return (
|
|
379
|
+
<EntryRow
|
|
380
|
+
key={entry.id}
|
|
381
|
+
place={place}
|
|
382
|
+
entry={entry}
|
|
383
|
+
position={index + 1}
|
|
384
|
+
title={pull === undefined ? undefined : titles?.get(pull)}
|
|
385
|
+
allowed={allowed}
|
|
386
|
+
/>
|
|
387
|
+
);
|
|
388
|
+
})}
|
|
389
|
+
</TableBody>
|
|
390
|
+
</Table>
|
|
391
|
+
)}
|
|
392
|
+
{pages.hasNextPage && (
|
|
393
|
+
<Button
|
|
394
|
+
variant="outline"
|
|
395
|
+
className="self-center"
|
|
396
|
+
disabled={pages.isFetchingNextPage}
|
|
397
|
+
onClick={() => void pages.fetchNextPage()}
|
|
398
|
+
>
|
|
399
|
+
More of the queue
|
|
400
|
+
</Button>
|
|
401
|
+
)}
|
|
402
|
+
</Section>
|
|
403
|
+
</div>
|
|
404
|
+
);
|
|
405
|
+
}
|