@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,134 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
8
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
9
|
+
import * as ToolkitHooks from '@dxos/app-toolkit/Hooks';
|
|
10
|
+
import * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';
|
|
11
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
12
|
+
import { useQuery } from '@dxos/echo-react';
|
|
13
|
+
import { log } from '@dxos/log';
|
|
14
|
+
import { createMenuAction, useMenuContribution } from '@dxos/react-ui-menu';
|
|
15
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
16
|
+
import { PullRequest } from '@dxos/types';
|
|
17
|
+
|
|
18
|
+
import { meta } from '#meta';
|
|
19
|
+
import { GitHubOperation, Walkthrough } from '#types';
|
|
20
|
+
|
|
21
|
+
import { useOpenObject } from '../../hooks/index.ts';
|
|
22
|
+
import { newestWalkthrough } from '../../walkthrough/index.ts';
|
|
23
|
+
|
|
24
|
+
const WALKTHROUGH_ICON = 'ph--path--regular';
|
|
25
|
+
|
|
26
|
+
export type PullRequestCardMenuProps = AppSurface.CardMenuData<PullRequest.PullRequest>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Adds "Open walkthrough" or "Generate walkthrough" to a pull request card's menu, whichever applies.
|
|
30
|
+
*
|
|
31
|
+
* Either way what opens is the pull request: the walkthrough is what its article renders, so a
|
|
32
|
+
* generation that is still running does not leave the reader with nothing to open. A preview card
|
|
33
|
+
* holds a pull request minted in memory from its URL, so the stored copy with the same
|
|
34
|
+
* owner/repo/number is what the menu acts on — in the pull request's own space when it has one,
|
|
35
|
+
* otherwise the space the user is working in.
|
|
36
|
+
*/
|
|
37
|
+
export const PullRequestCardMenu = ({ subject, menu }: PullRequestCardMenuProps) => {
|
|
38
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
39
|
+
const { invokePromise } = Hooks.useOperationInvoker();
|
|
40
|
+
const openObject = useOpenObject();
|
|
41
|
+
const activeSpace = ToolkitHooks.useActiveSpace();
|
|
42
|
+
const db = Obj.getDatabase(subject) ?? activeSpace?.db;
|
|
43
|
+
const { owner, repo, number } = subject;
|
|
44
|
+
|
|
45
|
+
const [stored] = useQuery(db, Filter.type(PullRequest.PullRequest, { owner, repo, number }));
|
|
46
|
+
const walkthroughs = useQuery(
|
|
47
|
+
db,
|
|
48
|
+
stored ? Filter.type(Walkthrough.Walkthrough, { pullRequest: Ref.make(stored) }) : Filter.nothing(),
|
|
49
|
+
);
|
|
50
|
+
const walkthrough = useMemo(() => newestWalkthrough(walkthroughs), [walkthroughs]);
|
|
51
|
+
|
|
52
|
+
const generateWalkthrough = useCallback(async () => {
|
|
53
|
+
if (!db) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const pullRequest = stored ?? db.add(PullRequest.make(toStoredFields(subject)));
|
|
57
|
+
const reference = PullRequest.reference(pullRequest);
|
|
58
|
+
const toastId = `${meta.profile.key}.walkthrough.${pullRequest.id}`;
|
|
59
|
+
const { data, error } = await invokePromise(
|
|
60
|
+
GitHubOperation.GenerateWalkthrough,
|
|
61
|
+
{ pullRequest: Ref.make(pullRequest) },
|
|
62
|
+
{ spaceId: db.spaceId },
|
|
63
|
+
);
|
|
64
|
+
if (error || !data?.walkthrough.target) {
|
|
65
|
+
log.warn('walkthrough generation failed', { reference, error });
|
|
66
|
+
await invokePromise(LayoutOperation.AddToast, {
|
|
67
|
+
id: toastId,
|
|
68
|
+
icon: 'ph--warning--regular',
|
|
69
|
+
title: ['walkthrough-failed.title', { ns: meta.profile.key }],
|
|
70
|
+
description: reference,
|
|
71
|
+
});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
await invokePromise(LayoutOperation.AddToast, {
|
|
75
|
+
id: toastId,
|
|
76
|
+
icon: WALKTHROUGH_ICON,
|
|
77
|
+
title: ['walkthrough-ready.title', { ns: meta.profile.key }],
|
|
78
|
+
description: reference,
|
|
79
|
+
actionLabel: ['open-walkthrough.label', { ns: meta.profile.key }],
|
|
80
|
+
actionAlt: ['open-walkthrough.label', { ns: meta.profile.key }],
|
|
81
|
+
onAction: () => void openObject(pullRequest),
|
|
82
|
+
});
|
|
83
|
+
}, [db, stored, subject, invokePromise, openObject]);
|
|
84
|
+
|
|
85
|
+
const items = useMemo(() => {
|
|
86
|
+
if (!db) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
return [
|
|
90
|
+
walkthrough && stored
|
|
91
|
+
? createMenuAction('open-walkthrough', () => void openObject(stored), {
|
|
92
|
+
label: t('open-walkthrough.label'),
|
|
93
|
+
icon: WALKTHROUGH_ICON,
|
|
94
|
+
})
|
|
95
|
+
: createMenuAction('generate-walkthrough', () => void generateWalkthrough(), {
|
|
96
|
+
label: t('generate-walkthrough.label'),
|
|
97
|
+
icon: WALKTHROUGH_ICON,
|
|
98
|
+
}),
|
|
99
|
+
];
|
|
100
|
+
}, [db, stored, walkthrough, openObject, generateWalkthrough, t]);
|
|
101
|
+
|
|
102
|
+
useMenuContribution(menu, { id: `${meta.profile.key}.walkthrough`, mode: 'additive', items });
|
|
103
|
+
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** The fields of an in-memory pull request, copied into a new object the space can store. */
|
|
108
|
+
const toStoredFields = ({
|
|
109
|
+
owner,
|
|
110
|
+
repo,
|
|
111
|
+
number,
|
|
112
|
+
title,
|
|
113
|
+
url,
|
|
114
|
+
state,
|
|
115
|
+
author,
|
|
116
|
+
description,
|
|
117
|
+
baseBranch,
|
|
118
|
+
headBranch,
|
|
119
|
+
additions,
|
|
120
|
+
deletions,
|
|
121
|
+
}: PullRequest.PullRequest): Obj.MakeProps<typeof PullRequest.PullRequest> => ({
|
|
122
|
+
owner,
|
|
123
|
+
repo,
|
|
124
|
+
number,
|
|
125
|
+
title,
|
|
126
|
+
url,
|
|
127
|
+
state,
|
|
128
|
+
author,
|
|
129
|
+
description,
|
|
130
|
+
baseBranch,
|
|
131
|
+
headBranch,
|
|
132
|
+
additions,
|
|
133
|
+
deletions,
|
|
134
|
+
});
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useAtomValue } from '@effect/atom-react/Hooks';
|
|
6
|
+
import * as Atom from 'effect/reactivity/Atom';
|
|
7
|
+
import React, { useCallback, useMemo, useRef } from 'react';
|
|
8
|
+
|
|
9
|
+
import { type Database, Filter, Obj, Tag, Type } from '@dxos/echo';
|
|
10
|
+
import { QueryBuilder } from '@dxos/echo-query';
|
|
11
|
+
import { useQuery } from '@dxos/echo-react';
|
|
12
|
+
import { useAttention, useViewState, useViewStateActions } from '@dxos/react-ui-attention';
|
|
13
|
+
import { type EditorController } from '@dxos/react-ui-editor';
|
|
14
|
+
import { Listbox } from '@dxos/react-ui-list';
|
|
15
|
+
import { GroupMenu, SortMenu } from '@dxos/react-ui-menu';
|
|
16
|
+
import { QueryEditor, usePersistentQuery } from '@dxos/react-ui-query';
|
|
17
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
18
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
19
|
+
import * as Icon from '@dxos/react-ui/Icon';
|
|
20
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
21
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
22
|
+
import * as Status from '@dxos/react-ui/Status';
|
|
23
|
+
import * as Toolbar from '@dxos/react-ui/Toolbar';
|
|
24
|
+
import { PullRequest, Task } from '@dxos/types';
|
|
25
|
+
|
|
26
|
+
import { meta } from '#meta';
|
|
27
|
+
|
|
28
|
+
import { useOpenObject, usePullRequestChecks } from '../../hooks/index.ts';
|
|
29
|
+
import * as PullRequestsView from '../../types/PullRequestsView.ts';
|
|
30
|
+
import {
|
|
31
|
+
CI_HUE,
|
|
32
|
+
type PullRequestChecks,
|
|
33
|
+
type PullRequestRow,
|
|
34
|
+
type PullRequestRowGroup,
|
|
35
|
+
STATE_HUE,
|
|
36
|
+
filterRows,
|
|
37
|
+
groupRows,
|
|
38
|
+
sortRows,
|
|
39
|
+
} from './arrange.ts';
|
|
40
|
+
import { formatRelative } from './format.ts';
|
|
41
|
+
|
|
42
|
+
const PULL_REQUEST_TYPENAME = Type.getTypename(PullRequest.PullRequest);
|
|
43
|
+
|
|
44
|
+
const SORT_ICONS: Record<PullRequestsView.SortField, string> = {
|
|
45
|
+
relevance: 'ph--lightning--regular',
|
|
46
|
+
updated: 'ph--clock-clockwise--regular',
|
|
47
|
+
created: 'ph--calendar-plus--regular',
|
|
48
|
+
number: 'ph--hash--regular',
|
|
49
|
+
title: 'ph--text-aa--regular',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const GROUP_ICONS: Record<PullRequestsView.GroupField, string> = {
|
|
53
|
+
none: 'ph--list--regular',
|
|
54
|
+
repo: 'ph--git-branch--regular',
|
|
55
|
+
state: 'ph--git-pull-request--regular',
|
|
56
|
+
checks: 'ph--check-circle--regular',
|
|
57
|
+
author: 'ph--user--regular',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type PullRequestsArticleProps = {
|
|
61
|
+
role?: string;
|
|
62
|
+
attendableId: string;
|
|
63
|
+
/** The space's database; absent when the type node carries no space, which renders nothing. */
|
|
64
|
+
db?: Database.Database;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Every pull request in a space as one list a reader triages from: repository, title, CI checks,
|
|
69
|
+
* the tasks that track it and its state, ordered by relevance (what needs the reader first) or time.
|
|
70
|
+
* The filter, order and grouping persist per device and per space, through the same view-state
|
|
71
|
+
* aspect, query editor and sort/group menus a task set's list uses.
|
|
72
|
+
*/
|
|
73
|
+
export const PullRequestsArticle = ({ db, ...props }: PullRequestsArticleProps) =>
|
|
74
|
+
db ? <PullRequestList db={db} {...props} /> : null;
|
|
75
|
+
|
|
76
|
+
PullRequestsArticle.displayName = 'PullRequestsArticle';
|
|
77
|
+
|
|
78
|
+
const PullRequestList = ({ role, attendableId, db }: PullRequestsArticleProps & { db: Database.Database }) => {
|
|
79
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
80
|
+
const { hasAttention } = useAttention(attendableId);
|
|
81
|
+
const editorRef = useRef<EditorController>(null);
|
|
82
|
+
const contextId = db.spaceId;
|
|
83
|
+
|
|
84
|
+
const [query, setQuery] = usePersistentQuery(PullRequestsView.aspect, contextId, editorRef);
|
|
85
|
+
const { sort = PullRequestsView.DEFAULT_SORT, group = 'none' } = useViewState(PullRequestsView.aspect, contextId);
|
|
86
|
+
const { update } = useViewStateActions(PullRequestsView.aspect, contextId);
|
|
87
|
+
const handleSortChange = useCallback(
|
|
88
|
+
(sort: PullRequestsView.Sort) => update((view) => ({ ...view, sort })),
|
|
89
|
+
[update],
|
|
90
|
+
);
|
|
91
|
+
const handleGroupChange = useCallback(
|
|
92
|
+
(group: PullRequestsView.GroupField) => update((view) => ({ ...view, group })),
|
|
93
|
+
[update],
|
|
94
|
+
);
|
|
95
|
+
const handleClear = useCallback(() => setQuery(''), [setQuery]);
|
|
96
|
+
|
|
97
|
+
const tags = useTagMap(db);
|
|
98
|
+
// A query that does not parse matches nothing rather than everything.
|
|
99
|
+
const filter = useMemo(() => {
|
|
100
|
+
const text = query.trim();
|
|
101
|
+
return text.length === 0 ? undefined : (new QueryBuilder(tags).build(text).filter ?? Filter.nothing());
|
|
102
|
+
}, [query, tags]);
|
|
103
|
+
|
|
104
|
+
const pullRequests = useQuery(db, Filter.type(PullRequest.PullRequest));
|
|
105
|
+
const tasks = useQuery(db, Filter.type(Task.Task));
|
|
106
|
+
const checks = usePullRequestChecks(pullRequests, db.spaceId);
|
|
107
|
+
const { rows, groups } = useArrangedRows(pullRequests, tasks, checks, { filter, sort, group });
|
|
108
|
+
// In display order, so keyboard order follows the groups the reader sees.
|
|
109
|
+
const options = useMemo(
|
|
110
|
+
() =>
|
|
111
|
+
(groups ? groups.flatMap((group) => group.rows) : rows).map(({ pullRequest }) => ({
|
|
112
|
+
value: pullRequest.id,
|
|
113
|
+
label: pullRequest.title,
|
|
114
|
+
})),
|
|
115
|
+
[groups, rows],
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const sortFields = useMemo(
|
|
119
|
+
() =>
|
|
120
|
+
PullRequestsView.SortField.literals.map((id) => ({
|
|
121
|
+
id,
|
|
122
|
+
label: t(`pull-requests-sort-${id}.label`),
|
|
123
|
+
icon: SORT_ICONS[id],
|
|
124
|
+
})),
|
|
125
|
+
[t],
|
|
126
|
+
);
|
|
127
|
+
const directionLabels = useMemo(
|
|
128
|
+
() => ({ asc: t('pull-requests-sort-asc.label'), desc: t('pull-requests-sort-desc.label') }),
|
|
129
|
+
[t],
|
|
130
|
+
);
|
|
131
|
+
const groupFields = useMemo(
|
|
132
|
+
() =>
|
|
133
|
+
PullRequestsView.GroupField.literals.map((id) => ({
|
|
134
|
+
id,
|
|
135
|
+
label: t(`pull-requests-group-${id}.label`),
|
|
136
|
+
icon: GROUP_ICONS[id],
|
|
137
|
+
})),
|
|
138
|
+
[t],
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const openObject = useOpenObject();
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<Panel.Root role={role} data-testid='pull-requests'>
|
|
145
|
+
<Panel.Header>
|
|
146
|
+
<Toolbar.Root inactive={!hasAttention}>
|
|
147
|
+
<QueryEditor
|
|
148
|
+
classNames='grow min-w-0 ps-1'
|
|
149
|
+
db={db}
|
|
150
|
+
tags={tags}
|
|
151
|
+
value={query}
|
|
152
|
+
onChange={setQuery}
|
|
153
|
+
ref={editorRef}
|
|
154
|
+
/>
|
|
155
|
+
<SortMenu
|
|
156
|
+
fields={sortFields}
|
|
157
|
+
value={sort}
|
|
158
|
+
onChange={handleSortChange}
|
|
159
|
+
label={t('pull-requests-sort.label')}
|
|
160
|
+
directionLabels={directionLabels}
|
|
161
|
+
testId='pull-requests.sort'
|
|
162
|
+
/>
|
|
163
|
+
<GroupMenu
|
|
164
|
+
fields={groupFields}
|
|
165
|
+
value={group}
|
|
166
|
+
onChange={handleGroupChange}
|
|
167
|
+
label={t('pull-requests-group.label')}
|
|
168
|
+
none='none'
|
|
169
|
+
testId='pull-requests.group'
|
|
170
|
+
/>
|
|
171
|
+
<Button.Root
|
|
172
|
+
icon='ph--x--regular'
|
|
173
|
+
iconOnly
|
|
174
|
+
disabled={query.trim().length === 0}
|
|
175
|
+
label={t('pull-requests-filter-clear.label')}
|
|
176
|
+
data-testid='pull-requests.filter.clear'
|
|
177
|
+
onClick={handleClear}
|
|
178
|
+
/>
|
|
179
|
+
</Toolbar.Root>
|
|
180
|
+
</Panel.Header>
|
|
181
|
+
<Panel.Body>
|
|
182
|
+
{rows.length === 0 ? (
|
|
183
|
+
<Status.Empty classNames='dx-expand'>
|
|
184
|
+
{t(pullRequests.length === 0 ? 'pull-requests-empty.message' : 'pull-requests-no-match.message')}
|
|
185
|
+
</Status.Empty>
|
|
186
|
+
) : (
|
|
187
|
+
<Listbox.Root items={options}>
|
|
188
|
+
<Listbox.Content
|
|
189
|
+
classNames='dx-expand'
|
|
190
|
+
aria-label={t('typename.label_other', { ns: PULL_REQUEST_TYPENAME })}
|
|
191
|
+
>
|
|
192
|
+
{groups
|
|
193
|
+
? groups
|
|
194
|
+
.filter((group) => group.rows.length > 0)
|
|
195
|
+
.map((group) => <GroupSection key={group.id} group={group} onOpen={openObject} />)
|
|
196
|
+
: rows.map((row) => <PullRequestListRow key={row.pullRequest.id} row={row} onOpen={openObject} />)}
|
|
197
|
+
</Listbox.Content>
|
|
198
|
+
</Listbox.Root>
|
|
199
|
+
)}
|
|
200
|
+
</Panel.Body>
|
|
201
|
+
</Panel.Root>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
type OpenHandler = (object: Obj.Any) => Promise<void>;
|
|
206
|
+
|
|
207
|
+
const GroupSection = ({ group, onOpen }: { group: PullRequestRowGroup; onOpen: OpenHandler }) => {
|
|
208
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
209
|
+
return (
|
|
210
|
+
<Listbox.ItemGroup>
|
|
211
|
+
<Listbox.ItemGroupLabel>
|
|
212
|
+
<Layout.Flex align='center' gap='sm'>
|
|
213
|
+
<Icon.Icon icon={group.icon} classNames='dx-text' data-hue={group.hue} />
|
|
214
|
+
<span className='truncate'>{group.translate ? t(group.label) : group.label}</span>
|
|
215
|
+
<span className='text-description'>{group.rows.length}</span>
|
|
216
|
+
</Layout.Flex>
|
|
217
|
+
</Listbox.ItemGroupLabel>
|
|
218
|
+
{group.rows.map((row) => (
|
|
219
|
+
<PullRequestListRow key={row.pullRequest.id} row={row} onOpen={onOpen} />
|
|
220
|
+
))}
|
|
221
|
+
</Listbox.ItemGroup>
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/** One pull request: its repository and number, title, author and time, then checks, tasks and state. */
|
|
226
|
+
const PullRequestListRow = ({
|
|
227
|
+
row: { pullRequest, checks, tasks },
|
|
228
|
+
onOpen,
|
|
229
|
+
}: {
|
|
230
|
+
row: PullRequestRow;
|
|
231
|
+
onOpen: OpenHandler;
|
|
232
|
+
}) => {
|
|
233
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
234
|
+
const time = pullRequest.updatedAt ?? pullRequest.createdAt;
|
|
235
|
+
return (
|
|
236
|
+
<Listbox.Item
|
|
237
|
+
id={pullRequest.id}
|
|
238
|
+
classNames='cursor-pointer py-2'
|
|
239
|
+
data-testid='pull-requests.row'
|
|
240
|
+
onClick={() => void onOpen(pullRequest)}
|
|
241
|
+
>
|
|
242
|
+
<Layout.Flex column gap='xs' grow>
|
|
243
|
+
<Layout.Flex align='center' gap='sm' classNames='min-w-0'>
|
|
244
|
+
<span className='dx-tag dx-tag-inline shrink-0' data-hue='neutral'>
|
|
245
|
+
{PullRequest.reference(pullRequest)}
|
|
246
|
+
</span>
|
|
247
|
+
<span className='truncate grow'>{pullRequest.title}</span>
|
|
248
|
+
<ChecksTag pullRequest={pullRequest} checks={checks} />
|
|
249
|
+
<span
|
|
250
|
+
className='dx-tag dx-tag-inline shrink-0'
|
|
251
|
+
data-hue={STATE_HUE[pullRequest.state]}
|
|
252
|
+
data-testid='pull-requests.row.state'
|
|
253
|
+
>
|
|
254
|
+
{t(`pull-request-state.${pullRequest.state}.label`)}
|
|
255
|
+
</span>
|
|
256
|
+
</Layout.Flex>
|
|
257
|
+
<Layout.Flex align='center' gap='sm' classNames='min-w-0 text-xs text-description'>
|
|
258
|
+
{pullRequest.author && <span className='shrink-0'>{pullRequest.author}</span>}
|
|
259
|
+
{time && (
|
|
260
|
+
<time className='shrink-0' dateTime={time} title={new Date(time).toLocaleString()}>
|
|
261
|
+
{formatRelative(time)}
|
|
262
|
+
</time>
|
|
263
|
+
)}
|
|
264
|
+
{tasks.length > 0 && (
|
|
265
|
+
<Layout.Flex align='center' gap='xs' classNames='min-w-0' data-testid='pull-requests.row.tasks'>
|
|
266
|
+
<Icon.Icon icon='ph--check-square-offset--regular' size='xs' classNames='shrink-0' />
|
|
267
|
+
<span className='truncate'>{tasks.map((task) => task.title || t('untitled-task.label')).join(', ')}</span>
|
|
268
|
+
</Layout.Flex>
|
|
269
|
+
)}
|
|
270
|
+
</Layout.Flex>
|
|
271
|
+
</Layout.Flex>
|
|
272
|
+
</Listbox.Item>
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const ChecksTag = ({ pullRequest, checks }: { pullRequest: PullRequest.PullRequest; checks?: PullRequestChecks }) => {
|
|
277
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
278
|
+
// A finished pull request's checks are not read (see `usePullRequestChecks`), so it shows none.
|
|
279
|
+
if (!checks) {
|
|
280
|
+
return pullRequest.state === 'open' || pullRequest.state === 'draft' ? (
|
|
281
|
+
<span className='dx-tag dx-tag-inline' data-hue='neutral' data-testid='pull-requests.row.checks'>
|
|
282
|
+
{t('ci-status.unknown.label')}
|
|
283
|
+
</span>
|
|
284
|
+
) : null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<>
|
|
289
|
+
{checks.review !== 'none' && (
|
|
290
|
+
<span
|
|
291
|
+
className='dx-tag dx-tag-inline'
|
|
292
|
+
data-hue={checks.review === 'approved' ? 'green' : 'red'}
|
|
293
|
+
data-testid='pull-requests.row.review'
|
|
294
|
+
>
|
|
295
|
+
{t(`review-status.${checks.review}.label`, { count: checks.approvals })}
|
|
296
|
+
</span>
|
|
297
|
+
)}
|
|
298
|
+
<span className='dx-tag dx-tag-inline' data-hue={CI_HUE[checks.ci]} data-testid='pull-requests.row.checks'>
|
|
299
|
+
{t(`ci-status.${checks.ci}.label`)}
|
|
300
|
+
{checks.checks.total > 0 && ` ${checks.checks.passed}/${checks.checks.total}`}
|
|
301
|
+
</span>
|
|
302
|
+
</>
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
type ArrangeOptions = {
|
|
307
|
+
filter: Filter.Any | undefined;
|
|
308
|
+
sort: PullRequestsView.Sort;
|
|
309
|
+
group: PullRequestsView.GroupField;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* The rows the toolbar keeps, in the order it asks for, partitioned into its groups. Read through
|
|
314
|
+
* atoms so a re-sync (a new state, a new title) or a task gaining the pull request as an artifact
|
|
315
|
+
* re-arranges the list without the queries re-emitting.
|
|
316
|
+
*/
|
|
317
|
+
const useArrangedRows = (
|
|
318
|
+
pullRequests: readonly PullRequest.PullRequest[],
|
|
319
|
+
tasks: readonly Task.Task[],
|
|
320
|
+
checks: ReadonlyMap<string, PullRequestChecks>,
|
|
321
|
+
{ filter, sort, group }: ArrangeOptions,
|
|
322
|
+
): { rows: readonly PullRequestRow[]; groups?: PullRequestRowGroup[] } => {
|
|
323
|
+
const atom = useMemo(
|
|
324
|
+
() =>
|
|
325
|
+
Atom.make((get) => {
|
|
326
|
+
pullRequests.forEach((pullRequest) => get(Obj.atom(pullRequest)));
|
|
327
|
+
const tasksByPullRequest = new Map<string, Task.Task[]>();
|
|
328
|
+
for (const task of tasks) {
|
|
329
|
+
for (const ref of get(Obj.atomProperty(task, 'artifacts')) ?? []) {
|
|
330
|
+
const id = Task.refEntityId(ref);
|
|
331
|
+
if (id) {
|
|
332
|
+
tasksByPullRequest.set(id, [...(tasksByPullRequest.get(id) ?? []), task]);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const all = pullRequests.map((pullRequest) => ({
|
|
337
|
+
pullRequest,
|
|
338
|
+
checks: checks.get(pullRequest.id),
|
|
339
|
+
tasks: tasksByPullRequest.get(pullRequest.id) ?? [],
|
|
340
|
+
}));
|
|
341
|
+
const rows = sortRows(filterRows(all, filter), sort);
|
|
342
|
+
return { rows, groups: groupRows(rows, group) };
|
|
343
|
+
}),
|
|
344
|
+
[pullRequests, tasks, checks, filter, sort, group],
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
return useAtomValue(atom);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
/** Tag registry keyed by the `Tag` object's uri — the id space `#tag` terms and `meta.tags` share. */
|
|
351
|
+
const useTagMap = (db: Database.Database): Tag.Map => {
|
|
352
|
+
const tags = useQuery(db, Filter.type(Tag.Tag));
|
|
353
|
+
return useMemo(
|
|
354
|
+
() =>
|
|
355
|
+
tags.reduce<Tag.Map>((acc, tag) => {
|
|
356
|
+
acc[Obj.getURI(tag).toString()] = tag;
|
|
357
|
+
return acc;
|
|
358
|
+
}, {}),
|
|
359
|
+
[tags],
|
|
360
|
+
);
|
|
361
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { QueryBuilder } from '@dxos/echo-query';
|
|
8
|
+
import { PullRequest, Task } from '@dxos/types';
|
|
9
|
+
|
|
10
|
+
import { type PullRequestChecks, type PullRequestRow, filterRows, groupRows, relevance, sortRows } from './arrange.ts';
|
|
11
|
+
import { formatRelative } from './format.ts';
|
|
12
|
+
|
|
13
|
+
const make = (
|
|
14
|
+
number: number,
|
|
15
|
+
props: Partial<Pick<PullRequest.PullRequest, 'state' | 'repo' | 'author' | 'title' | 'updatedAt' | 'createdAt'>> = {},
|
|
16
|
+
): PullRequest.PullRequest =>
|
|
17
|
+
PullRequest.make({ owner: 'dxos', repo: 'dxos', number, title: `Change ${number}`, state: 'open', ...props });
|
|
18
|
+
|
|
19
|
+
const checks = (ci: PullRequestChecks['ci'], review: PullRequestChecks['review'] = 'none'): PullRequestChecks => ({
|
|
20
|
+
ci,
|
|
21
|
+
review,
|
|
22
|
+
approvals: review === 'approved' ? 1 : 0,
|
|
23
|
+
checks: { total: 1, passed: ci === 'success' ? 1 : 0, failed: ci === 'failure' ? 1 : 0, pending: 0 },
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const row = (pullRequest: PullRequest.PullRequest, extra: Partial<Omit<PullRequestRow, 'pullRequest'>> = {}) => ({
|
|
27
|
+
pullRequest,
|
|
28
|
+
tasks: [],
|
|
29
|
+
...extra,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const numbers = (rows: readonly PullRequestRow[]) => rows.map(({ pullRequest }) => pullRequest.number);
|
|
33
|
+
|
|
34
|
+
describe('relevance', () => {
|
|
35
|
+
test('an open pull request with something to fix outranks one ready to merge, then one waiting', ({ expect }) => {
|
|
36
|
+
const failing = row(make(1), { checks: checks('failure') });
|
|
37
|
+
const ready = row(make(2), { checks: checks('success', 'approved') });
|
|
38
|
+
const waiting = row(make(3), { checks: checks('success') });
|
|
39
|
+
const merged = row(make(4, { state: 'merged' }));
|
|
40
|
+
expect(relevance(failing)).toBeGreaterThan(relevance(ready));
|
|
41
|
+
expect(relevance(ready)).toBeGreaterThan(relevance(waiting));
|
|
42
|
+
expect(relevance(waiting)).toBeGreaterThan(relevance(merged));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('a pull request a task tracks is nudged above an otherwise equal one', ({ expect }) => {
|
|
46
|
+
const task = Task.make({ title: 'Ship it' });
|
|
47
|
+
expect(relevance(row(make(1), { tasks: [task] }))).toBeGreaterThan(relevance(row(make(2))));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('sortRows', () => {
|
|
52
|
+
test('relevance descending puts the most urgent first and breaks ties by recency', ({ expect }) => {
|
|
53
|
+
const rows = [
|
|
54
|
+
row(make(1, { state: 'closed' })),
|
|
55
|
+
row(make(2, { updatedAt: '2026-09-01T00:00:00Z' })),
|
|
56
|
+
row(make(3, { updatedAt: '2026-10-01T00:00:00Z' })),
|
|
57
|
+
row(make(4), { checks: checks('failure') }),
|
|
58
|
+
];
|
|
59
|
+
expect(numbers(sortRows(rows, { field: 'relevance', direction: 'desc' }))).toEqual([4, 3, 2, 1]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('updated falls back to when it was opened', ({ expect }) => {
|
|
63
|
+
const rows = [
|
|
64
|
+
row(make(1, { updatedAt: '2026-01-01T00:00:00Z' })),
|
|
65
|
+
row(make(2, { createdAt: '2026-06-01T00:00:00Z' })),
|
|
66
|
+
];
|
|
67
|
+
expect(numbers(sortRows(rows, { field: 'updated', direction: 'desc' }))).toEqual([2, 1]);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('groupRows', () => {
|
|
72
|
+
test('none leaves the list ungrouped', ({ expect }) => {
|
|
73
|
+
expect(groupRows([row(make(1))], 'none')).toBeUndefined();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('state groups come in lifecycle order and keep the sort within each', ({ expect }) => {
|
|
77
|
+
const rows = [row(make(1, { state: 'merged' })), row(make(3)), row(make(2))];
|
|
78
|
+
const groups = groupRows(rows, 'state') ?? [];
|
|
79
|
+
expect(groups.map((group) => group.id)).toEqual(['state-open', 'state-merged']);
|
|
80
|
+
expect(numbers(groups[0].rows)).toEqual([3, 2]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('checks put failures first and rows without checks last', ({ expect }) => {
|
|
84
|
+
const rows = [
|
|
85
|
+
row(make(1)),
|
|
86
|
+
row(make(2), { checks: checks('success') }),
|
|
87
|
+
row(make(3), { checks: checks('failure') }),
|
|
88
|
+
];
|
|
89
|
+
expect((groupRows(rows, 'checks') ?? []).map((group) => group.id)).toEqual([
|
|
90
|
+
'checks-failure',
|
|
91
|
+
'checks-success',
|
|
92
|
+
'checks-unknown',
|
|
93
|
+
]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('repositories are grouped by owner and name', ({ expect }) => {
|
|
97
|
+
const rows = [row(make(1, { repo: 'edge' })), row(make(2)), row(make(3, { repo: 'edge' }))];
|
|
98
|
+
const groups = groupRows(rows, 'repo') ?? [];
|
|
99
|
+
expect(groups.map((group) => [group.label, numbers(group.rows)])).toEqual([
|
|
100
|
+
['dxos/dxos', [2]],
|
|
101
|
+
['dxos/edge', [1, 3]],
|
|
102
|
+
]);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('filterRows', () => {
|
|
107
|
+
test('free text searches the title, reference and author', ({ expect }) => {
|
|
108
|
+
const rows = [row(make(1, { title: 'Fix sync' })), row(make(2, { author: 'burdon' })), row(make(3))];
|
|
109
|
+
const build = (text: string) => new QueryBuilder().build(text).filter;
|
|
110
|
+
expect(numbers(filterRows(rows, build('sync')))).toEqual([1]);
|
|
111
|
+
expect(numbers(filterRows(rows, build('burdon')))).toEqual([2]);
|
|
112
|
+
expect(numbers(filterRows(rows, undefined))).toEqual([1, 2, 3]);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('formatRelative', () => {
|
|
117
|
+
test('uses the largest unit that fits', ({ expect }) => {
|
|
118
|
+
const now = Date.parse('2026-10-07T12:00:00Z');
|
|
119
|
+
expect(formatRelative('2026-10-07T09:00:00Z', now)).toMatch(/3 hours ago/);
|
|
120
|
+
expect(formatRelative('not a date', now)).toEqual('');
|
|
121
|
+
});
|
|
122
|
+
});
|