@dxos/plugin-github 0.7.4 → 0.14.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/LICENSE +102 -5
- package/PLUGIN.mdl +784 -0
- package/dist/lib/GitHubCapabilities.mjs +10 -0
- package/dist/lib/GitHubCapabilities.mjs.map +1 -0
- package/dist/lib/GitHubEvents.mjs +15 -0
- package/dist/lib/GitHubEvents.mjs.map +1 -0
- package/dist/lib/GitHubOperation.mjs +384 -0
- package/dist/lib/GitHubOperation.mjs.map +1 -0
- package/dist/lib/GitHubPlugin.mjs +16 -0
- package/dist/lib/GitHubPlugin.mjs.map +1 -0
- package/dist/lib/Walkthrough.mjs +59 -0
- package/dist/lib/Walkthrough.mjs.map +1 -0
- package/dist/lib/capabilities.browser.mjs +54 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +54 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/capabilities.node.mjs +30 -0
- package/dist/lib/capabilities.node.mjs.map +1 -0
- package/dist/lib/capabilities.tauri.mjs +54 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs +30 -0
- package/dist/lib/capabilities.workerd.mjs.map +1 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs +116 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs.map +1 -0
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle.mjs +1506 -0
- package/dist/lib/chunk-PullRequestArticle.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle2.mjs +2 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs +123 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs +594 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs.map +1 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs +26 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs +19 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs +25 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +39 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-connector.mjs +70 -0
- package/dist/lib/chunk-connector.mjs.map +1 -0
- package/dist/lib/chunk-constants.mjs +11 -0
- package/dist/lib/chunk-constants.mjs.map +1 -0
- package/dist/lib/chunk-errors.mjs +29 -0
- package/dist/lib/chunk-errors.mjs.map +1 -0
- package/dist/lib/chunk-generate-walkthrough.mjs +86 -0
- package/dist/lib/chunk-generate-walkthrough.mjs.map +1 -0
- package/dist/lib/chunk-generate.mjs +719 -0
- package/dist/lib/chunk-generate.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs +25 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-status.mjs +29 -0
- package/dist/lib/chunk-get-pull-request-status.mjs.map +1 -0
- package/dist/lib/chunk-get-repositories.mjs +32 -0
- package/dist/lib/chunk-get-repositories.mjs.map +1 -0
- package/dist/lib/chunk-github-api.mjs +375 -0
- package/dist/lib/chunk-github-api.mjs.map +1 -0
- package/dist/lib/chunk-github-link.mjs +59 -0
- package/dist/lib/chunk-github-link.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs +25 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request.mjs +171 -0
- package/dist/lib/chunk-import-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-link-resolver.mjs +109 -0
- package/dist/lib/chunk-link-resolver.mjs.map +1 -0
- package/dist/lib/chunk-markdown-extension.mjs +92 -0
- package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
- package/dist/lib/chunk-materialize-target.mjs +36 -0
- package/dist/lib/chunk-materialize-target.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +12 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-page-action.mjs +22 -0
- package/dist/lib/chunk-page-action.mjs.map +1 -0
- package/dist/lib/chunk-pull-request.mjs +58 -0
- package/dist/lib/chunk-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-pull-request2.mjs +110 -0
- package/dist/lib/chunk-pull-request2.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +233 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-refresh-pull-requests.mjs +49 -0
- package/dist/lib/chunk-refresh-pull-requests.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/chunk-schema.mjs +15 -0
- package/dist/lib/chunk-schema.mjs.map +1 -0
- package/dist/lib/chunk-skill-definition.mjs +10 -0
- package/dist/lib/chunk-skill-definition.mjs.map +1 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs +56 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs.map +1 -0
- package/dist/lib/chunk-sync-pull-request.mjs +26 -0
- package/dist/lib/chunk-sync-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-sync.mjs +481 -0
- package/dist/lib/chunk-sync.mjs.map +1 -0
- package/dist/lib/chunk-useOpenObject.mjs +43 -0
- package/dist/lib/chunk-useOpenObject.mjs.map +1 -0
- package/dist/lib/extensions.mjs +132 -0
- package/dist/lib/extensions.mjs.map +1 -0
- package/dist/lib/index.mjs +4 -0
- package/dist/lib/meta.mjs +47 -0
- package/dist/lib/meta.mjs.map +1 -0
- package/dist/lib/ns/Extensions.mjs +18 -0
- package/dist/lib/ns/Extensions.mjs.map +1 -0
- package/dist/lib/operations.mjs +23 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/skills.mjs +44 -0
- package/dist/lib/skills.mjs.map +1 -0
- package/dist/lib/testing.mjs +189 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/translations.mjs +136 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +5 -0
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/Extensions.d.ts +2 -0
- package/dist/types/src/Extensions.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.d.ts +37 -0
- package/dist/types/src/GitHubPlugin.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts +2 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts.map +1 -0
- package/dist/types/src/approval.d.ts +21 -0
- package/dist/types/src/approval.d.ts.map +1 -0
- package/dist/types/src/approval.test.d.ts +2 -0
- package/dist/types/src/approval.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +9 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/connector.d.ts +17 -0
- package/dist/types/src/capabilities/connector.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/browser.d.ts +13 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts +13 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts +13 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts +13 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +13 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/link-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/link-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts +14 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +5 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/page-action.d.ts +5 -0
- package/dist/types/src/capabilities/page-action.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +12 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.d.ts +11 -0
- package/dist/types/src/cards/GitHubCard.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts +45 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts.map +1 -0
- package/dist/types/src/cards/PullRequestCard.d.ts +9 -0
- package/dist/types/src/cards/PullRequestCard.d.ts.map +1 -0
- package/dist/types/src/cards/index.d.ts +3 -0
- package/dist/types/src/cards/index.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts +30 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/index.d.ts +2 -0
- package/dist/types/src/components/CommentComposer/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts +8 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts +17 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts +23 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts +39 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts +5 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts +21 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts +18 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts +10 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts +16 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts +28 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts +6 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts +20 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts +2 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts +18 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts +16 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts +3 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +5 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +7 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts +6 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts +15 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts +10 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts +14 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts +13 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts +44 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts +3 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts +13 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts +2 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +157 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +3 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/links.d.ts +21 -0
- package/dist/types/src/extensions/links.d.ts.map +1 -0
- package/dist/types/src/extensions/links.test.d.ts +2 -0
- package/dist/types/src/extensions/links.test.d.ts.map +1 -0
- package/dist/types/src/extensions/references.d.ts +23 -0
- package/dist/types/src/extensions/references.d.ts.map +1 -0
- package/dist/types/src/extensions/references.test.d.ts +2 -0
- package/dist/types/src/extensions/references.test.d.ts.map +1 -0
- package/dist/types/src/github-link.d.ts +29 -0
- package/dist/types/src/github-link.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useOpenObject.d.ts +9 -0
- package/dist/types/src/hooks/useOpenObject.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts +10 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts +12 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts +22 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts +10 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +34 -11
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/add-pull-request-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-comment.d.ts.map +1 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts.map +1 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts +11 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts.map +1 -0
- package/dist/types/src/operations/get-repositories.d.ts +13 -0
- package/dist/types/src/operations/get-repositories.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts +12 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.d.ts +63 -0
- package/dist/types/src/operations/import-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/materialize-target.d.ts +12 -0
- package/dist/types/src/operations/materialize-target.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.d.ts +48 -0
- package/dist/types/src/operations/pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/refresh-pull-requests.d.ts +5 -0
- package/dist/types/src/operations/refresh-pull-requests.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.d.ts +37 -0
- package/dist/types/src/operations/refresh.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.test.d.ts +2 -0
- package/dist/types/src/operations/refresh.test.d.ts.map +1 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts +5 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts.map +1 -0
- package/dist/types/src/operations/sync-pull-request.d.ts +5 -0
- package/dist/types/src/operations/sync-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/sync.d.ts +123 -0
- package/dist/types/src/operations/sync.d.ts.map +1 -0
- package/dist/types/src/operations/sync.test.d.ts +2 -0
- package/dist/types/src/operations/sync.test.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/plugin.test.d.ts +2 -0
- package/dist/types/src/plugin.test.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.d.ts +37 -0
- package/dist/types/src/pull-request-body.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.test.d.ts +2 -0
- package/dist/types/src/pull-request-body.test.d.ts.map +1 -0
- package/dist/types/src/pull-request.d.ts +28 -0
- package/dist/types/src/pull-request.d.ts.map +1 -0
- package/dist/types/src/pull-request.test.d.ts +2 -0
- package/dist/types/src/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/services/github-api.d.ts +332 -0
- package/dist/types/src/services/github-api.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +2 -0
- package/dist/types/src/services/index.d.ts.map +1 -0
- package/dist/types/src/skills/GitHubSkill.d.ts +12 -0
- package/dist/types/src/skills/GitHubSkill.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/stories/Generate.stories.d.ts +27 -0
- package/dist/types/src/stories/Generate.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Links.stories.d.ts +23 -0
- package/dist/types/src/stories/Links.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts +359 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts +365 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts +367 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts +357 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts +380 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts.map +1 -0
- package/dist/types/src/stories/github.d.ts +23 -0
- package/dist/types/src/stories/github.d.ts.map +1 -0
- package/dist/types/src/stories/github.test.d.ts +2 -0
- package/dist/types/src/stories/github.test.d.ts.map +1 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts +8 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures.d.ts +14 -0
- package/dist/types/src/testing/fixtures.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/plugin.d.ts +4 -0
- package/dist/types/src/testing/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/pull-request-13348.d.ts +6 -0
- package/dist/types/src/testing/pull-request-13348.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +339 -53
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/GitHubCapabilities.d.ts +13 -0
- package/dist/types/src/types/GitHubCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/GitHubEvents.d.ts +8 -0
- package/dist/types/src/types/GitHubEvents.d.ts.map +1 -0
- package/dist/types/src/types/GitHubOperation.d.ts +281 -0
- package/dist/types/src/types/GitHubOperation.d.ts.map +1 -0
- package/dist/types/src/types/PullRequestsView.d.ts +35 -0
- package/dist/types/src/types/PullRequestsView.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.d.ts +31 -0
- package/dist/types/src/types/Walkthrough.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.test.d.ts +2 -0
- package/dist/types/src/types/Walkthrough.test.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.d.ts +28 -0
- package/dist/types/src/walkthrough/fill.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.test.d.ts +2 -0
- package/dist/types/src/walkthrough/fill.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.d.ts +67 -0
- package/dist/types/src/walkthrough/generate.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generate.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.d.ts +20 -0
- package/dist/types/src/walkthrough/generated.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generated.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.d.ts +8 -0
- package/dist/types/src/walkthrough/headings.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.test.d.ts +2 -0
- package/dist/types/src/walkthrough/headings.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/index.d.ts +9 -0
- package/dist/types/src/walkthrough/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/patch.d.ts +48 -0
- package/dist/types/src/walkthrough/patch.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.d.ts +55 -0
- package/dist/types/src/walkthrough/plan.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.test.d.ts +2 -0
- package/dist/types/src/walkthrough/plan.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.d.ts +33 -0
- package/dist/types/src/walkthrough/prompt.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts +2 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.d.ts +43 -0
- package/dist/types/src/walkthrough/score.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.test.d.ts +2 -0
- package/dist/types/src/walkthrough/score.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dx.config.ts +39 -0
- package/package.json +167 -48
- package/src/Extensions.ts +7 -0
- package/src/GitHubPlugin.ts +15 -0
- package/src/GitHubPlugin.workerd.test.ts +23 -0
- package/src/approval.test.ts +40 -0
- package/src/approval.ts +39 -0
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/connector.ts +95 -0
- package/src/capabilities/gen/browser.ts +82 -0
- package/src/capabilities/gen/node.ts +43 -0
- package/src/capabilities/gen/tauri.ts +82 -0
- package/src/capabilities/gen/workerd.ts +43 -0
- package/src/capabilities/index.ts +71 -0
- package/src/capabilities/link-resolver.ts +137 -0
- package/src/capabilities/markdown-extension.ts +146 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/page-action.ts +32 -0
- package/src/capabilities/react-surface.ts +98 -0
- package/src/capabilities/schema.ts +16 -0
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/cards/GitHubCard.stories.tsx +165 -0
- package/src/cards/GitHubCard.tsx +93 -0
- package/src/cards/PullRequestCard.tsx +23 -0
- package/src/cards/index.ts +6 -0
- package/src/components/CommentComposer/CommentComposer.tsx +109 -0
- package/src/components/CommentComposer/index.ts +5 -0
- package/src/components/PullRequestFiles/DiffStat.tsx +15 -0
- package/src/components/PullRequestFiles/FileTree.tsx +102 -0
- package/src/components/PullRequestFiles/PullRequestFiles.tsx +87 -0
- package/src/components/PullRequestFiles/files.test.ts +59 -0
- package/src/components/PullRequestFiles/files.ts +115 -0
- package/src/components/PullRequestFiles/index.ts +8 -0
- package/src/components/PullRequestOverview/ArtifactPill.tsx +82 -0
- package/src/components/PullRequestOverview/CheckRunList.test.ts +29 -0
- package/src/components/PullRequestOverview/CheckRunList.tsx +141 -0
- package/src/components/PullRequestOverview/PullRequestDetails.tsx +15 -0
- package/src/components/PullRequestOverview/PullRequestOverview.tsx +110 -0
- package/src/components/PullRequestOverview/RelatedCards.tsx +147 -0
- package/src/components/PullRequestOverview/index.ts +9 -0
- package/src/components/PullRequestStatus/PullRequestStatus.tsx +84 -0
- package/src/components/PullRequestStatus/index.ts +5 -0
- package/src/components/WalkthroughView/WalkthroughView.tsx +62 -0
- package/src/components/WalkthroughView/extensions.ts +53 -0
- package/src/components/WalkthroughView/index.ts +6 -0
- package/src/components/index.ts +6 -9
- package/src/constants.ts +12 -0
- package/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.tsx +160 -0
- package/src/containers/ImportPullRequestDialog/index.ts +7 -0
- package/src/containers/PullRequestArticle/PullRequestArticle.tsx +573 -0
- package/src/containers/PullRequestArticle/failure.test.ts +42 -0
- package/src/containers/PullRequestArticle/failure.ts +16 -0
- package/src/containers/PullRequestArticle/index.ts +5 -0
- package/src/containers/PullRequestCardMenu/PullRequestCardMenu.tsx +134 -0
- package/src/containers/PullRequestCardMenu/index.ts +5 -0
- package/src/containers/PullRequestsArticle/PullRequestsArticle.tsx +361 -0
- package/src/containers/PullRequestsArticle/arrange.test.ts +122 -0
- package/src/containers/PullRequestsArticle/arrange.ts +245 -0
- package/src/containers/PullRequestsArticle/format.ts +31 -0
- package/src/containers/PullRequestsArticle/index.ts +5 -0
- package/src/containers/WalkthroughArticle/WalkthroughArticle.tsx +31 -0
- package/src/containers/WalkthroughArticle/index.ts +5 -0
- package/src/containers/index.ts +11 -0
- package/src/errors.ts +61 -0
- package/src/extensions/index.ts +6 -0
- package/src/extensions/links.test.ts +133 -0
- package/src/extensions/links.ts +91 -0
- package/src/extensions/references.test.ts +83 -0
- package/src/extensions/references.ts +100 -0
- package/src/github-link.ts +70 -0
- package/src/hooks/index.ts +6 -3
- package/src/hooks/useOpenObject.ts +48 -0
- package/src/hooks/usePullRequestChecks.ts +81 -0
- package/src/hooks/usePullRequestDiff.ts +57 -0
- package/src/hooks/usePullRequestFiles.ts +98 -0
- package/src/hooks/useSyncPullRequest.ts +51 -0
- package/src/index.ts +4 -6
- package/src/meta.ts +8 -13
- package/src/operations/add-pull-request-comment.ts +31 -0
- package/src/operations/add-pull-request-review-comment.ts +32 -0
- package/src/operations/generate-walkthrough.ts +124 -0
- package/src/operations/get-pull-request-diff.ts +37 -0
- package/src/operations/get-pull-request-status.ts +44 -0
- package/src/operations/get-repositories.ts +53 -0
- package/src/operations/import-pull-request-from-snapshot.ts +48 -0
- package/src/operations/import-pull-request.test.ts +151 -0
- package/src/operations/import-pull-request.ts +149 -0
- package/src/operations/index.ts +30 -0
- package/src/operations/materialize-target.ts +60 -0
- package/src/operations/pull-request.test.ts +120 -0
- package/src/operations/pull-request.ts +141 -0
- package/src/operations/refresh-pull-requests.ts +69 -0
- package/src/operations/refresh.test.ts +112 -0
- package/src/operations/refresh.ts +111 -0
- package/src/operations/submit-pull-request-approval.ts +41 -0
- package/src/operations/sync-pull-request.ts +34 -0
- package/src/operations/sync.test.ts +453 -0
- package/src/operations/sync.ts +807 -0
- package/src/plugin.test.ts +40 -0
- package/src/plugin.ts +37 -0
- package/src/pull-request-body.test.ts +61 -0
- package/src/pull-request-body.ts +144 -0
- package/src/pull-request.test.ts +67 -0
- package/src/pull-request.ts +80 -0
- package/src/services/github-api.ts +735 -0
- package/src/services/index.ts +5 -0
- package/src/skills/GitHubSkill.ts +46 -0
- package/src/skills/index.ts +5 -0
- package/src/stories/Generate.stories.tsx +152 -0
- package/src/stories/Links.stories.tsx +153 -0
- package/src/stories/PullRequestArticle.stories.tsx +107 -0
- package/src/stories/PullRequestFiles.stories.tsx +69 -0
- package/src/stories/PullRequestOverview.stories.tsx +114 -0
- package/src/stories/PullRequestsArticle.stories.tsx +170 -0
- package/src/stories/Walkthrough.stories.tsx +110 -0
- package/src/stories/github.test.ts +65 -0
- package/src/stories/github.ts +70 -0
- package/src/stories/walkthrough-fixture.ts +115 -0
- package/src/testing/fixtures.ts +99 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/plugin.ts +25 -0
- package/src/testing/pull-request-13348.ts +104 -0
- package/src/testing/pull-request-13363.patch +2981 -0
- package/src/translations.ts +135 -63
- package/src/types/GitHubCapabilities.ts +27 -0
- package/src/types/GitHubEvents.ts +16 -0
- package/src/types/GitHubOperation.ts +397 -0
- package/src/types/PullRequestsView.ts +45 -0
- package/src/types/Walkthrough.test.ts +75 -0
- package/src/types/Walkthrough.ts +66 -0
- package/src/types/index.ts +8 -0
- package/src/vite-env.d.ts +15 -0
- package/src/walkthrough/fill.test.ts +337 -0
- package/src/walkthrough/fill.ts +246 -0
- package/src/walkthrough/generate.test.ts +219 -0
- package/src/walkthrough/generate.ts +248 -0
- package/src/walkthrough/generated.test.ts +70 -0
- package/src/walkthrough/generated.ts +70 -0
- package/src/walkthrough/headings.test.ts +40 -0
- package/src/walkthrough/headings.ts +39 -0
- package/src/walkthrough/index.ts +12 -0
- package/src/walkthrough/patch.ts +154 -0
- package/src/walkthrough/plan.test.ts +178 -0
- package/src/walkthrough/plan.ts +251 -0
- package/src/walkthrough/prompt.test.ts +100 -0
- package/src/walkthrough/prompt.ts +147 -0
- package/src/walkthrough/score.test.ts +272 -0
- package/src/walkthrough/score.ts +430 -0
- package/README.md +0 -15
- package/dist/lib/browser/chunk-S4MPSBA5.mjs +0 -21
- package/dist/lib/browser/chunk-S4MPSBA5.mjs.map +0 -7
- package/dist/lib/browser/index.css +0 -7
- package/dist/lib/browser/index.css.map +0 -7
- package/dist/lib/browser/index.mjs +0 -1535
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/meta.mjs +0 -11
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/GithubPlugin.d.ts +0 -4
- package/dist/types/src/GithubPlugin.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts +0 -4
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts +0 -9
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/index.d.ts +0 -2
- package/dist/types/src/components/EmbeddedMain/index.d.ts.map +0 -1
- package/dist/types/src/components/ExportDialog.d.ts +0 -8
- package/dist/types/src/components/ExportDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts +0 -15
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts +0 -7
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts +0 -16
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts +0 -11
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts.map +0 -1
- package/dist/types/src/components/ImportDialog.d.ts +0 -7
- package/dist/types/src/components/ImportDialog.d.ts.map +0 -1
- package/dist/types/src/components/Issue.d.ts +0 -5
- package/dist/types/src/components/Issue.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.d.ts +0 -15
- package/dist/types/src/components/Loading/Loading.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts +0 -40
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Loading/index.d.ts +0 -2
- package/dist/types/src/components/Loading/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownActions.d.ts +0 -7
- package/dist/types/src/components/MarkdownActions.d.ts.map +0 -1
- package/dist/types/src/components/UrlDialog.d.ts +0 -6
- package/dist/types/src/components/UrlDialog.d.ts.map +0 -1
- package/dist/types/src/hooks/useDocGhId.d.ts +0 -6
- package/dist/types/src/hooks/useDocGhId.d.ts.map +0 -1
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts +0 -2
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -30
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/GithubPlugin.tsx +0 -127
- package/src/components/EmbeddedMain/EmbeddedMain.tsx +0 -294
- package/src/components/EmbeddedMain/GfmPreview.tsx +0 -110
- package/src/components/EmbeddedMain/embedded.css +0 -3
- package/src/components/EmbeddedMain/index.ts +0 -5
- package/src/components/ExportDialog.tsx +0 -157
- package/src/components/GithubApiProviders/GitHubSettings.tsx +0 -72
- package/src/components/GithubApiProviders/OctokitProvider.tsx +0 -60
- package/src/components/GithubApiProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/DocumentTreeItem.tsx +0 -26
- package/src/components/GithubEchoResolverProviders/ResolverContext.tsx +0 -137
- package/src/components/GithubEchoResolverProviders/ResolverDialog.tsx +0 -34
- package/src/components/GithubEchoResolverProviders/ResolverProps.ts +0 -23
- package/src/components/GithubEchoResolverProviders/ResolverTree.tsx +0 -86
- package/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.tsx +0 -105
- package/src/components/GithubEchoResolverProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/spaceResolvers.ts +0 -86
- package/src/components/ImportDialog.tsx +0 -72
- package/src/components/Issue.tsx +0 -62
- package/src/components/Loading/Loading.stories.tsx +0 -32
- package/src/components/Loading/Loading.tsx +0 -70
- package/src/components/Loading/index.ts +0 -5
- package/src/components/MarkdownActions.tsx +0 -136
- package/src/components/UrlDialog.tsx +0 -52
- package/src/hooks/useDocGhId.ts +0 -38
- package/src/hooks/useGhIdFromUrl.ts +0 -26
- package/src/types.ts +0 -51
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
9
|
+
import * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';
|
|
10
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
11
|
+
import * as ToolkitHooks from '@dxos/app-toolkit/Hooks';
|
|
12
|
+
import * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';
|
|
13
|
+
import { Database, Filter, Obj, Ref } from '@dxos/echo';
|
|
14
|
+
import { useObject, useQuery } from '@dxos/echo-react';
|
|
15
|
+
import * as EffectEx from '@dxos/effect/EffectEx';
|
|
16
|
+
import { log } from '@dxos/log';
|
|
17
|
+
import * as Binding from '@dxos/plugin-connector/Binding';
|
|
18
|
+
import { ProgressMeter } from '@dxos/react-ui-components';
|
|
19
|
+
import { ActionToolbar, MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';
|
|
20
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
21
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
22
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
23
|
+
import * as Tabs from '@dxos/react-ui/Tabs';
|
|
24
|
+
import { PullRequest } from '@dxos/types';
|
|
25
|
+
import { type DiffLineTarget } from '@dxos/ui-editor';
|
|
26
|
+
|
|
27
|
+
import { meta } from '#meta';
|
|
28
|
+
import { GitHubOperation, Walkthrough } from '#types';
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
CommentBand,
|
|
32
|
+
LineCommentPopover,
|
|
33
|
+
type PullRequestDetailsValues,
|
|
34
|
+
PullRequestFiles,
|
|
35
|
+
PullRequestOverview,
|
|
36
|
+
PullRequestStatus,
|
|
37
|
+
WalkthroughPlaceholder,
|
|
38
|
+
WalkthroughView,
|
|
39
|
+
} from '../../components/index.ts';
|
|
40
|
+
import { usePullRequestDiff, usePullRequestFiles, useSyncPullRequest } from '../../hooks/index.ts';
|
|
41
|
+
import { githubConnection } from '../../operations/pull-request.ts';
|
|
42
|
+
import { newestWalkthrough } from '../../walkthrough/index.ts';
|
|
43
|
+
import { pullRequestFailureKey } from './failure.ts';
|
|
44
|
+
|
|
45
|
+
const ciLabel: Record<GitHubOperation.CiState, string> = {
|
|
46
|
+
success: 'ci-status.success.label',
|
|
47
|
+
failure: 'ci-status.failure.label',
|
|
48
|
+
pending: 'ci-status.pending.label',
|
|
49
|
+
none: 'ci-status.none.label',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type Status = {
|
|
53
|
+
state: PullRequest.State;
|
|
54
|
+
body?: string;
|
|
55
|
+
ci: GitHubOperation.CiState;
|
|
56
|
+
checks: GitHubOperation.CheckCounts;
|
|
57
|
+
runs: readonly GitHubOperation.CheckRun[];
|
|
58
|
+
review: GitHubOperation.ReviewState;
|
|
59
|
+
approvals: number;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type Tab = 'overview' | 'walkthrough' | 'files';
|
|
63
|
+
|
|
64
|
+
const TABS: readonly Tab[] = ['overview', 'walkthrough', 'files'];
|
|
65
|
+
|
|
66
|
+
export type PullRequestArticleProps = AppSurface.ObjectArticleProps<PullRequest.PullRequest>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A pull request read as a review: its number, state and CI outcome above whatever narration the
|
|
70
|
+
* space holds, with approving and commenting one click away. Everything GitHub-side goes through
|
|
71
|
+
* the space's GitHub connection.
|
|
72
|
+
*
|
|
73
|
+
* The pull request is the subject rather than the walkthrough because one exists before the other
|
|
74
|
+
* does: a pull request just imported has no narration yet, and generating it is an action ON the
|
|
75
|
+
* pull request, not a different object to open.
|
|
76
|
+
*/
|
|
77
|
+
export const PullRequestArticle = ({ role, attendableId, subject: pullRequest }: PullRequestArticleProps) => {
|
|
78
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
79
|
+
const { invokePromise } = Hooks.useOperationInvoker();
|
|
80
|
+
const [subject] = useObject(pullRequest);
|
|
81
|
+
const db = Obj.getDatabase(pullRequest);
|
|
82
|
+
const spaceId = db?.spaceId;
|
|
83
|
+
|
|
84
|
+
const walkthroughs = useQuery(db, Filter.type(Walkthrough.Walkthrough, { pullRequest: Ref.make(pullRequest) }));
|
|
85
|
+
const walkthrough = useMemo(() => newestWalkthrough(walkthroughs), [walkthroughs]);
|
|
86
|
+
// Watched by key rather than tied to `generating`, so a run started elsewhere shows here too.
|
|
87
|
+
const walkthroughProgress = ToolkitHooks.useProgressMonitor(
|
|
88
|
+
GitHubOperation.createWalkthroughProgressKey(pullRequest),
|
|
89
|
+
);
|
|
90
|
+
// Present only when plugin-progress is loaded; it is what lets the meter cancel or dismiss a run.
|
|
91
|
+
const progressRegistry = Hooks.useOptionalCapability(AppCapabilities.ProgressRegistry);
|
|
92
|
+
|
|
93
|
+
const [status, setStatus] = useState<Status>();
|
|
94
|
+
// The live state where it has arrived, the stored one until then — an absent status is unknown,
|
|
95
|
+
// not "open", and GitHub accepts an approval on a merged pull request rather than rejecting it.
|
|
96
|
+
const state = status?.state ?? subject.state;
|
|
97
|
+
const [tab, setTab] = useState<Tab>('overview');
|
|
98
|
+
const [busy, setBusy] = useState(false);
|
|
99
|
+
const [generating, setGenerating] = useState(false);
|
|
100
|
+
const [composing, setComposing] = useState(false);
|
|
101
|
+
const [comment, setComment] = useState('');
|
|
102
|
+
// Set when the composer was opened from a diff line; the comment then goes on that line.
|
|
103
|
+
const [lineTarget, setLineTarget] = useState<{ target: DiffLineTarget; commit: string }>();
|
|
104
|
+
// The diff line's own button, which the composer is positioned at: the anchor is a DOM node
|
|
105
|
+
// CodeMirror owns, so it is held in a ref rather than state and never re-renders the article.
|
|
106
|
+
const lineAnchorRef = useRef<HTMLElement | null>(null);
|
|
107
|
+
|
|
108
|
+
const openLineComment = useCallback((target: DiffLineTarget, anchor: HTMLElement, commit: string) => {
|
|
109
|
+
lineAnchorRef.current = anchor;
|
|
110
|
+
// The commit travels with the target: a regeneration or push between opening the composer and
|
|
111
|
+
// posting would otherwise pair the NEW commit with line numbers read from the old diff, which
|
|
112
|
+
// GitHub either rejects or anchors to the wrong line.
|
|
113
|
+
setLineTarget({ target, commit });
|
|
114
|
+
setComposing(true);
|
|
115
|
+
}, []);
|
|
116
|
+
|
|
117
|
+
const handleWalkthroughLineComment = useCallback(
|
|
118
|
+
(target: DiffLineTarget, anchor: HTMLElement) => walkthrough && openLineComment(target, anchor, walkthrough.commit),
|
|
119
|
+
[walkthrough, openLineComment],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
/** The toolbar's composer is about the pull request, so it drops whatever line was targeted. */
|
|
123
|
+
const handleToggleComposer = useCallback(() => {
|
|
124
|
+
setLineTarget(undefined);
|
|
125
|
+
lineAnchorRef.current = null;
|
|
126
|
+
setComposing((value) => value === false || lineTarget !== undefined);
|
|
127
|
+
}, [lineTarget]);
|
|
128
|
+
|
|
129
|
+
const handleCloseComposer = useCallback(() => {
|
|
130
|
+
setComposing(false);
|
|
131
|
+
setLineTarget(undefined);
|
|
132
|
+
lineAnchorRef.current = null;
|
|
133
|
+
}, []);
|
|
134
|
+
|
|
135
|
+
const pullRequestRef = useMemo(() => Ref.make(pullRequest), [pullRequest]);
|
|
136
|
+
const reference = PullRequest.reference(pullRequest);
|
|
137
|
+
|
|
138
|
+
// The diff is only read once the files tab is first opened: most visits never look at it.
|
|
139
|
+
const diff = usePullRequestDiff(pullRequestRef, spaceId, tab === 'files');
|
|
140
|
+
const files = usePullRequestFiles(diff.diff, `${meta.profile.key}.reviewed.${reference}`);
|
|
141
|
+
const { file, step, setReviewed } = files;
|
|
142
|
+
|
|
143
|
+
const handleFilesLineComment = useCallback(
|
|
144
|
+
(target: DiffLineTarget, anchor: HTMLElement) => diff.commit && openLineComment(target, anchor, diff.commit),
|
|
145
|
+
[diff.commit, openLineComment],
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
/** Checking a file off moves on to the next one, the way a reader works down the list. */
|
|
149
|
+
const handleToggleReviewed = useCallback(() => {
|
|
150
|
+
if (!file) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const reviewed = !files.reviewed.has(file.path);
|
|
154
|
+
setReviewed(file.path, reviewed);
|
|
155
|
+
if (reviewed) {
|
|
156
|
+
step(1);
|
|
157
|
+
}
|
|
158
|
+
}, [file, files.reviewed, setReviewed, step]);
|
|
159
|
+
|
|
160
|
+
const refreshStatus = useCallback(async () => {
|
|
161
|
+
const { data, error } = await invokePromise(
|
|
162
|
+
GitHubOperation.GetPullRequestStatus,
|
|
163
|
+
{ pullRequest: pullRequestRef },
|
|
164
|
+
{ spaceId },
|
|
165
|
+
);
|
|
166
|
+
if (error) {
|
|
167
|
+
log.warn('pull request status failed', { error });
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (data) {
|
|
171
|
+
setStatus({
|
|
172
|
+
state: data.state,
|
|
173
|
+
body: data.body,
|
|
174
|
+
ci: data.ci,
|
|
175
|
+
checks: data.checks,
|
|
176
|
+
runs: data.runs,
|
|
177
|
+
review: data.review,
|
|
178
|
+
approvals: data.approvals,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}, [invokePromise, pullRequestRef, spaceId]);
|
|
182
|
+
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
void refreshStatus();
|
|
185
|
+
}, [refreshStatus]);
|
|
186
|
+
|
|
187
|
+
useSyncPullRequest(pullRequest);
|
|
188
|
+
|
|
189
|
+
const toast = useCallback(
|
|
190
|
+
(id: string, title: string, success: boolean, description?: string) =>
|
|
191
|
+
invokePromise(LayoutOperation.AddToast, {
|
|
192
|
+
id: `${meta.profile.key}.${id}`,
|
|
193
|
+
icon: success ? 'ph--check-circle--regular' : 'ph--warning--regular',
|
|
194
|
+
title: [title, { ns: meta.profile.key }],
|
|
195
|
+
...(description ? { description } : {}),
|
|
196
|
+
}),
|
|
197
|
+
[invokePromise],
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* A rejected credential is the one failure the user can fix, so it names the fix and links to the
|
|
202
|
+
* connection; any other failure shows the raw error under the action's own title.
|
|
203
|
+
*/
|
|
204
|
+
const failureToast = useCallback(
|
|
205
|
+
async (id: string, fallbackKey: string, error: Error) => {
|
|
206
|
+
const key = pullRequestFailureKey(error, fallbackKey);
|
|
207
|
+
if (key === fallbackKey || !db) {
|
|
208
|
+
return toast(id, key, false, error.message);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const connection = (
|
|
212
|
+
await EffectEx.runPromise(
|
|
213
|
+
githubConnection().pipe(
|
|
214
|
+
Effect.provide(Database.layer(db)),
|
|
215
|
+
Effect.orElseSucceed(() => undefined),
|
|
216
|
+
),
|
|
217
|
+
)
|
|
218
|
+
)?.connection;
|
|
219
|
+
return invokePromise(LayoutOperation.AddToast, {
|
|
220
|
+
id: `${meta.profile.key}.${id}`,
|
|
221
|
+
icon: 'ph--warning--regular',
|
|
222
|
+
title: [key, { ns: meta.profile.key }],
|
|
223
|
+
...(connection
|
|
224
|
+
? {
|
|
225
|
+
actionLabel: ['open-github-connection.label', { ns: meta.profile.key }],
|
|
226
|
+
actionAlt: ['open-github-connection.label', { ns: meta.profile.key }],
|
|
227
|
+
onAction: () =>
|
|
228
|
+
void invokePromise(LayoutOperation.Open, {
|
|
229
|
+
subject: [Binding.connectionSubject(db.spaceId, connection.id)],
|
|
230
|
+
navigation: 'immediate',
|
|
231
|
+
}),
|
|
232
|
+
}
|
|
233
|
+
: {}),
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
[db, invokePromise, toast],
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
const handleApprove = useCallback(async () => {
|
|
240
|
+
setBusy(true);
|
|
241
|
+
const { data, error } = await invokePromise(
|
|
242
|
+
GitHubOperation.SubmitPullRequestApproval,
|
|
243
|
+
{ pullRequest: pullRequestRef },
|
|
244
|
+
{ spaceId },
|
|
245
|
+
);
|
|
246
|
+
setBusy(false);
|
|
247
|
+
if (error) {
|
|
248
|
+
log.warn('approve failed', { error });
|
|
249
|
+
await failureToast('approve', 'approve-pull-request-error.title', error);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
await toast(
|
|
253
|
+
'approve',
|
|
254
|
+
data?.commented ? 'approve-pull-request-commented.title' : 'approve-pull-request-success.title',
|
|
255
|
+
true,
|
|
256
|
+
);
|
|
257
|
+
void refreshStatus();
|
|
258
|
+
}, [invokePromise, pullRequestRef, spaceId, toast, failureToast, refreshStatus]);
|
|
259
|
+
|
|
260
|
+
/** `force` is what makes the toolbar's entry a REgeneration: the same head would otherwise no-op. */
|
|
261
|
+
const handleGenerate = useCallback(async () => {
|
|
262
|
+
setTab('walkthrough');
|
|
263
|
+
setGenerating(true);
|
|
264
|
+
const { error } = await invokePromise(
|
|
265
|
+
GitHubOperation.GenerateWalkthrough,
|
|
266
|
+
{ pullRequest: pullRequestRef, force: walkthrough !== undefined },
|
|
267
|
+
{ spaceId },
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
setGenerating(false);
|
|
271
|
+
if (error) {
|
|
272
|
+
log.warn('walkthrough generation failed', { error });
|
|
273
|
+
await failureToast('walkthrough', 'walkthrough-failed.title', error);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
await toast('walkthrough', 'walkthrough-ready.title', true);
|
|
277
|
+
}, [invokePromise, pullRequestRef, spaceId, walkthrough, toast, failureToast]);
|
|
278
|
+
|
|
279
|
+
const handleCopyLink = useCallback(async () => {
|
|
280
|
+
if (!subject.url) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
try {
|
|
285
|
+
await navigator.clipboard.writeText(subject.url);
|
|
286
|
+
} catch (error) {
|
|
287
|
+
// Denied permission, or a document that is not focused; either way the link is not on the
|
|
288
|
+
// clipboard and the success toast would be a lie.
|
|
289
|
+
log.warn('copy link failed', { error });
|
|
290
|
+
await toast('copy-link', 'copy-link-error.title', false);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
await toast('copy-link', 'copy-link-success.title', true);
|
|
294
|
+
}, [subject.url, toast]);
|
|
295
|
+
|
|
296
|
+
const handleComment = useCallback(async () => {
|
|
297
|
+
const text = comment.trim();
|
|
298
|
+
if (!text) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
setBusy(true);
|
|
302
|
+
const { error } = lineTarget
|
|
303
|
+
? await invokePromise(
|
|
304
|
+
GitHubOperation.AddPullRequestReviewComment,
|
|
305
|
+
{
|
|
306
|
+
pullRequest: pullRequestRef,
|
|
307
|
+
body: text,
|
|
308
|
+
commit: lineTarget.commit,
|
|
309
|
+
path: lineTarget.target.file,
|
|
310
|
+
line: lineTarget.target.line,
|
|
311
|
+
side: lineTarget.target.side === 'before' ? ('LEFT' as const) : ('RIGHT' as const),
|
|
312
|
+
},
|
|
313
|
+
{ spaceId },
|
|
314
|
+
)
|
|
315
|
+
: await invokePromise(
|
|
316
|
+
GitHubOperation.AddPullRequestComment,
|
|
317
|
+
{ pullRequest: pullRequestRef, body: text },
|
|
318
|
+
{ spaceId },
|
|
319
|
+
);
|
|
320
|
+
setBusy(false);
|
|
321
|
+
if (error) {
|
|
322
|
+
log.warn('comment failed', { error });
|
|
323
|
+
await failureToast('comment', 'comment-error.title', error);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
setComment('');
|
|
327
|
+
handleCloseComposer();
|
|
328
|
+
await toast('comment', 'comment-success.title', true);
|
|
329
|
+
}, [comment, lineTarget, invokePromise, pullRequestRef, spaceId, toast, failureToast, handleCloseComposer]);
|
|
330
|
+
|
|
331
|
+
// The tablist only needs the `Tabs.Root` context, which wraps the whole panel.
|
|
332
|
+
const tabs = useMemo(
|
|
333
|
+
() => (
|
|
334
|
+
<Tabs.List>
|
|
335
|
+
{TABS.map((value) => (
|
|
336
|
+
<Tabs.Trigger key={value} value={value} data-testid={`pull-request.tab.${value}`}>
|
|
337
|
+
{t(`${value}-tab.label`)}
|
|
338
|
+
</Tabs.Trigger>
|
|
339
|
+
))}
|
|
340
|
+
</Tabs.List>
|
|
341
|
+
),
|
|
342
|
+
[t],
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
const fileReviewed = file !== undefined && files.reviewed.has(file.path);
|
|
346
|
+
const menuActions = useMenuBuilder(() => {
|
|
347
|
+
const builder = MenuBuilder.make()
|
|
348
|
+
.action(
|
|
349
|
+
'tabs',
|
|
350
|
+
{
|
|
351
|
+
variant: 'custom',
|
|
352
|
+
label: ['views.label', { ns: meta.profile.key }],
|
|
353
|
+
render: () => tabs,
|
|
354
|
+
},
|
|
355
|
+
() => {},
|
|
356
|
+
)
|
|
357
|
+
// The one growing gap: everything after it sits at the trailing edge.
|
|
358
|
+
.separator();
|
|
359
|
+
|
|
360
|
+
if (tab === 'files') {
|
|
361
|
+
builder
|
|
362
|
+
.action(
|
|
363
|
+
'previousFile',
|
|
364
|
+
{
|
|
365
|
+
label: ['previous-file.label', { ns: meta.profile.key }],
|
|
366
|
+
icon: 'ph--caret-up--regular',
|
|
367
|
+
disabled: !file,
|
|
368
|
+
disposition: 'toolbar',
|
|
369
|
+
testId: 'pull-request.toolbar.previous-file',
|
|
370
|
+
},
|
|
371
|
+
() => step(-1),
|
|
372
|
+
)
|
|
373
|
+
.action(
|
|
374
|
+
'nextFile',
|
|
375
|
+
{
|
|
376
|
+
label: ['next-file.label', { ns: meta.profile.key }],
|
|
377
|
+
icon: 'ph--caret-down--regular',
|
|
378
|
+
disabled: !file,
|
|
379
|
+
disposition: 'toolbar',
|
|
380
|
+
testId: 'pull-request.toolbar.next-file',
|
|
381
|
+
},
|
|
382
|
+
() => step(1),
|
|
383
|
+
)
|
|
384
|
+
.action(
|
|
385
|
+
'reviewed',
|
|
386
|
+
{
|
|
387
|
+
label: ['file-reviewed.label', { ns: meta.profile.key }],
|
|
388
|
+
icon: fileReviewed ? 'ph--check-square--fill' : 'ph--square--regular',
|
|
389
|
+
iconOnly: false,
|
|
390
|
+
disabled: !file,
|
|
391
|
+
disposition: 'toolbar',
|
|
392
|
+
testId: 'pull-request.toolbar.reviewed',
|
|
393
|
+
},
|
|
394
|
+
() => handleToggleReviewed(),
|
|
395
|
+
)
|
|
396
|
+
.separator('line');
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return builder
|
|
400
|
+
.action(
|
|
401
|
+
'approve',
|
|
402
|
+
{
|
|
403
|
+
label: ['approve-pull-request.label', { ns: meta.profile.key }],
|
|
404
|
+
icon: 'ph--check-circle--regular',
|
|
405
|
+
variant: 'primary',
|
|
406
|
+
iconOnly: false,
|
|
407
|
+
disabled: busy || state === 'merged' || state === 'closed',
|
|
408
|
+
disposition: 'toolbar',
|
|
409
|
+
testId: 'pull-request.toolbar.approve',
|
|
410
|
+
},
|
|
411
|
+
() => void handleApprove(),
|
|
412
|
+
)
|
|
413
|
+
.action(
|
|
414
|
+
'comment',
|
|
415
|
+
{
|
|
416
|
+
label: ['comment-pull-request.label', { ns: meta.profile.key }],
|
|
417
|
+
icon: 'ph--chat-text--regular',
|
|
418
|
+
disabled: busy,
|
|
419
|
+
disposition: 'toolbar',
|
|
420
|
+
testId: 'pull-request.toolbar.comment',
|
|
421
|
+
},
|
|
422
|
+
() => handleToggleComposer(),
|
|
423
|
+
)
|
|
424
|
+
.separator('line')
|
|
425
|
+
.action(
|
|
426
|
+
'generateWalkthrough',
|
|
427
|
+
{
|
|
428
|
+
label: [
|
|
429
|
+
walkthrough ? 'regenerate-walkthrough.label' : 'generate-walkthrough.label',
|
|
430
|
+
{ ns: meta.profile.key },
|
|
431
|
+
],
|
|
432
|
+
icon: 'ph--path--regular',
|
|
433
|
+
disabled: generating,
|
|
434
|
+
disposition: 'toolbar',
|
|
435
|
+
testId: 'pull-request.toolbar.generate-walkthrough',
|
|
436
|
+
},
|
|
437
|
+
() => void handleGenerate(),
|
|
438
|
+
)
|
|
439
|
+
.action(
|
|
440
|
+
'openOnGitHub',
|
|
441
|
+
{
|
|
442
|
+
label: ['open-on-github.label', { ns: meta.profile.key }],
|
|
443
|
+
icon: 'ph--arrow-square-out--regular',
|
|
444
|
+
disabled: !subject.url,
|
|
445
|
+
disposition: 'toolbar',
|
|
446
|
+
testId: 'pull-request.toolbar.open-on-github',
|
|
447
|
+
},
|
|
448
|
+
() => subject.url && window.open(subject.url, '_blank', 'noopener,noreferrer'),
|
|
449
|
+
)
|
|
450
|
+
.action(
|
|
451
|
+
'copyLink',
|
|
452
|
+
{
|
|
453
|
+
label: ['copy-link.label', { ns: meta.profile.key }],
|
|
454
|
+
icon: 'ph--link--regular',
|
|
455
|
+
disabled: !subject.url,
|
|
456
|
+
disposition: 'toolbar',
|
|
457
|
+
testId: 'pull-request.toolbar.copy-link',
|
|
458
|
+
},
|
|
459
|
+
() => void handleCopyLink(),
|
|
460
|
+
)
|
|
461
|
+
.build();
|
|
462
|
+
}, [
|
|
463
|
+
tabs,
|
|
464
|
+
tab,
|
|
465
|
+
file,
|
|
466
|
+
fileReviewed,
|
|
467
|
+
step,
|
|
468
|
+
handleToggleReviewed,
|
|
469
|
+
busy,
|
|
470
|
+
generating,
|
|
471
|
+
walkthrough,
|
|
472
|
+
subject.url,
|
|
473
|
+
state,
|
|
474
|
+
handleApprove,
|
|
475
|
+
handleGenerate,
|
|
476
|
+
handleCopyLink,
|
|
477
|
+
handleToggleComposer,
|
|
478
|
+
]);
|
|
479
|
+
|
|
480
|
+
const details = useMemo<PullRequestDetailsValues>(
|
|
481
|
+
() => ({
|
|
482
|
+
reference,
|
|
483
|
+
state,
|
|
484
|
+
checks: status
|
|
485
|
+
? `${t(ciLabel[status.ci])}${status.checks.total > 0 ? ` ${status.checks.passed}/${status.checks.total}` : ''}`
|
|
486
|
+
: t('ci-status.unknown.label'),
|
|
487
|
+
branches:
|
|
488
|
+
subject.headBranch &&
|
|
489
|
+
(subject.baseBranch ? `${subject.headBranch} → ${subject.baseBranch}` : subject.headBranch),
|
|
490
|
+
}),
|
|
491
|
+
[reference, state, status, subject.headBranch, subject.baseBranch, t],
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
const composerProps = {
|
|
495
|
+
value: comment,
|
|
496
|
+
busy,
|
|
497
|
+
onValueChange: setComment,
|
|
498
|
+
onSubmit: () => void handleComment(),
|
|
499
|
+
onCancel: handleCloseComposer,
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
return (
|
|
503
|
+
<Tabs.Root
|
|
504
|
+
asChild
|
|
505
|
+
orientation='horizontal'
|
|
506
|
+
value={tab}
|
|
507
|
+
onValueChange={(value) => setTab(TABS.find((candidate) => candidate === value) ?? 'overview')}
|
|
508
|
+
>
|
|
509
|
+
<Panel.Root role={role}>
|
|
510
|
+
<Panel.Header>
|
|
511
|
+
{/* `alwaysActive`: the tablist is navigation, not an attention-gated action, and a disabled
|
|
512
|
+
Next toolbar disables every item in it. */}
|
|
513
|
+
<ActionToolbar {...menuActions} attendableId={attendableId} alwaysActive />
|
|
514
|
+
</Panel.Header>
|
|
515
|
+
<Panel.Body asChild>
|
|
516
|
+
<Layout.Flex column>
|
|
517
|
+
<PullRequestStatus
|
|
518
|
+
reference={reference}
|
|
519
|
+
title={subject.title}
|
|
520
|
+
state={state}
|
|
521
|
+
review={status && { state: status.review, approvals: status.approvals }}
|
|
522
|
+
ci={status && { state: status.ci, checks: status.checks }}
|
|
523
|
+
/>
|
|
524
|
+
{composing && !lineTarget && <CommentBand {...composerProps} />}
|
|
525
|
+
<LineCommentPopover
|
|
526
|
+
{...composerProps}
|
|
527
|
+
open={composing && !!lineTarget}
|
|
528
|
+
anchorRef={lineAnchorRef}
|
|
529
|
+
target={lineTarget?.target}
|
|
530
|
+
/>
|
|
531
|
+
{/* Rendered by hand rather than through `Tabs.Panel`, so each tab's editor exists only while
|
|
532
|
+
the tab is shown and is built against a visible, measured element. */}
|
|
533
|
+
{tab === 'overview' && (
|
|
534
|
+
<PullRequestOverview body={status?.body ?? subject.description} details={details} runs={status?.runs} />
|
|
535
|
+
)}
|
|
536
|
+
{tab === 'walkthrough' &&
|
|
537
|
+
(walkthrough ? (
|
|
538
|
+
<WalkthroughView value={walkthrough.body} sidebar='full' onLineComment={handleWalkthroughLineComment} />
|
|
539
|
+
) : (
|
|
540
|
+
<WalkthroughPlaceholder generating={generating} onGenerate={() => void handleGenerate()} />
|
|
541
|
+
))}
|
|
542
|
+
{tab === 'files' && (
|
|
543
|
+
<PullRequestFiles
|
|
544
|
+
tree={files.tree}
|
|
545
|
+
file={file}
|
|
546
|
+
reviewed={files.reviewed}
|
|
547
|
+
total={files.files.length}
|
|
548
|
+
error={diff.error && t('files-error.message')}
|
|
549
|
+
onSelect={files.select}
|
|
550
|
+
onReviewedChange={setReviewed}
|
|
551
|
+
onLineComment={diff.commit ? handleFilesLineComment : undefined}
|
|
552
|
+
/>
|
|
553
|
+
)}
|
|
554
|
+
</Layout.Flex>
|
|
555
|
+
</Panel.Body>
|
|
556
|
+
<Panel.Footer classNames='border-t border-separator-subtle'>
|
|
557
|
+
<ProgressMeter
|
|
558
|
+
state={
|
|
559
|
+
walkthroughProgress?.status === 'running' || walkthroughProgress?.status === 'error'
|
|
560
|
+
? walkthroughProgress
|
|
561
|
+
: undefined
|
|
562
|
+
}
|
|
563
|
+
onCancel={
|
|
564
|
+
progressRegistry && walkthroughProgress
|
|
565
|
+
? () => progressRegistry.cancel(walkthroughProgress.name)
|
|
566
|
+
: undefined
|
|
567
|
+
}
|
|
568
|
+
/>
|
|
569
|
+
</Panel.Footer>
|
|
570
|
+
</Panel.Root>
|
|
571
|
+
</Tabs.Root>
|
|
572
|
+
);
|
|
573
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as HttpClientError from 'effect/http/HttpClientError';
|
|
6
|
+
import * as HttpClientRequest from 'effect/http/HttpClientRequest';
|
|
7
|
+
import * as HttpClientResponse from 'effect/http/HttpClientResponse';
|
|
8
|
+
import { describe, test } from 'vitest';
|
|
9
|
+
|
|
10
|
+
import { pullRequestFailureKey } from './failure.ts';
|
|
11
|
+
|
|
12
|
+
const FALLBACK = 'walkthrough-failed.title';
|
|
13
|
+
|
|
14
|
+
/** The failure `HttpClient.filterStatusOk` produces for a non-2xx GitHub response. */
|
|
15
|
+
const statusError = (status: number) => {
|
|
16
|
+
const request = HttpClientRequest.get('https://api.github.com/repos/dxos/dxos/pulls/13272');
|
|
17
|
+
return new HttpClientError.HttpClientError({
|
|
18
|
+
reason: new HttpClientError.StatusCodeError({
|
|
19
|
+
request,
|
|
20
|
+
response: HttpClientResponse.fromWeb(request, new Response(null, { status })),
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe('pullRequestFailureKey', () => {
|
|
26
|
+
// A revoked or expired connection token is the only one of these the user can act on, and it
|
|
27
|
+
// reached the toast as the raw `StatusCode: non 2xx status code (401 GET …)` (DX-1301).
|
|
28
|
+
test('a rejected credential names the reconnect message', ({ expect }) => {
|
|
29
|
+
expect(pullRequestFailureKey(statusError(401), FALLBACK)).toBe('github-token-rejected.title');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('any other status keeps the caller-supplied message', ({ expect }) => {
|
|
33
|
+
expect(pullRequestFailureKey(statusError(404), FALLBACK)).toBe(FALLBACK);
|
|
34
|
+
expect(pullRequestFailureKey(statusError(500), FALLBACK)).toBe(FALLBACK);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// A transport or decode failure carries no status at all, so it must not be read as an auth error.
|
|
38
|
+
test('a non-HTTP failure keeps the caller-supplied message', ({ expect }) => {
|
|
39
|
+
expect(pullRequestFailureKey(new Error('boom'), FALLBACK)).toBe(FALLBACK);
|
|
40
|
+
expect(pullRequestFailureKey(undefined, FALLBACK)).toBe(FALLBACK);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { GitHubApi } from '../../services/index.ts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Names a pull-request action's failure so the user knows what to do about it.
|
|
9
|
+
*
|
|
10
|
+
* A rejected credential is the one failure the user can fix themselves, and it is indistinguishable
|
|
11
|
+
* from any other error once it reaches the toast as `error.message` — GitHub answers it as a bare
|
|
12
|
+
* `401`, which surfaces as `StatusCode: non 2xx status code (401 GET …)`. Matches the same
|
|
13
|
+
* distinction `ImportPullRequestDialog` already draws on `tokenStatus`.
|
|
14
|
+
*/
|
|
15
|
+
export const pullRequestFailureKey = (error: unknown, fallbackKey: string): string =>
|
|
16
|
+
GitHubApi.responseStatus(error) === 401 ? 'github-token-rejected.title' : fallbackKey;
|