@dxos/plugin-github 0.7.4 → 0.13.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 +358 -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 +1486 -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 +96 -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-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 +24 -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 +22 -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 +15 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.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/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 +270 -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.tsx +120 -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 +81 -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 +141 -0
- package/src/operations/index.ts +29 -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/submit-pull-request-approval.ts +41 -0
- package/src/operations/sync-pull-request.ts +37 -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 +113 -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 +371 -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,594 @@
|
|
|
1
|
+
import { t as useOpenObject } from "./chunk-useOpenObject.mjs";
|
|
2
|
+
import { meta } from "#meta";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { GitHubOperation } from "#types";
|
|
5
|
+
import { PullRequest, Task } from "@dxos/types";
|
|
6
|
+
import { Filter, Obj, Ref, Tag, Type } from "@dxos/echo";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
import { log } from "@dxos/log";
|
|
9
|
+
import * as UiHooks from "@dxos/react-ui/Hooks";
|
|
10
|
+
import * as Layout from "@dxos/react-ui/Layout";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { useQuery } from "@dxos/echo-react";
|
|
13
|
+
import * as Hooks from "@dxos/app-framework/Hooks";
|
|
14
|
+
import { GroupMenu, SortMenu } from "@dxos/react-ui-menu";
|
|
15
|
+
import * as Panel from "@dxos/react-ui/Panel";
|
|
16
|
+
import * as Button from "@dxos/react-ui/Button";
|
|
17
|
+
import { Listbox } from "@dxos/react-ui-list";
|
|
18
|
+
import * as Status from "@dxos/react-ui/Status";
|
|
19
|
+
import * as Icon from "@dxos/react-ui/Icon";
|
|
20
|
+
import { useAtomValue } from "@effect/atom-react/Hooks";
|
|
21
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
22
|
+
import { QueryBuilder, matchesFilter } from "@dxos/echo-query";
|
|
23
|
+
import { useAttention, useViewState, useViewStateActions } from "@dxos/react-ui-attention";
|
|
24
|
+
import { QueryEditor, usePersistentQuery } from "@dxos/react-ui-query";
|
|
25
|
+
import * as Toolbar from "@dxos/react-ui/Toolbar";
|
|
26
|
+
import { ViewState } from "@dxos/react-ui-attention/types";
|
|
27
|
+
//#region src/hooks/usePullRequestChecks.ts
|
|
28
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-github/src/hooks/usePullRequestChecks.ts";
|
|
29
|
+
/** How long a pull request's checks stand before they are read from GitHub again. */
|
|
30
|
+
var CHECKS_INTERVAL = 3e5;
|
|
31
|
+
/** Status reads in flight at once: each costs three GitHub requests, and a list can hold hundreds. */
|
|
32
|
+
var CONCURRENCY = 4;
|
|
33
|
+
var cache = /* @__PURE__ */ new Map();
|
|
34
|
+
/** Whether a pull request's checks still change; a merged or closed one's head is settled. */
|
|
35
|
+
var isLive = (pullRequest) => pullRequest.state === "open" || pullRequest.state === "draft";
|
|
36
|
+
/**
|
|
37
|
+
* The CI and review standing of every live pull request in `pullRequests`, keyed by object id and
|
|
38
|
+
* filled in as each read lands. Finished pull requests are not read: their checks no longer ask
|
|
39
|
+
* anything of the reader.
|
|
40
|
+
*/
|
|
41
|
+
var usePullRequestChecks = (pullRequests, spaceId) => {
|
|
42
|
+
const { invokePromise } = Hooks.useOperationInvoker();
|
|
43
|
+
const [checks, setChecks] = useState(() => new Map([...cache].map(([id, { checks }]) => [id, checks])));
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!spaceId) return;
|
|
46
|
+
let cancelled = false;
|
|
47
|
+
const now = Date.now();
|
|
48
|
+
const queue = pullRequests.filter((pullRequest) => isLive(pullRequest) && now - (cache.get(pullRequest.id)?.at ?? 0) >= CHECKS_INTERVAL);
|
|
49
|
+
const worker = async () => {
|
|
50
|
+
for (let pullRequest = queue.shift(); pullRequest && !cancelled; pullRequest = queue.shift()) {
|
|
51
|
+
const { data, error } = await invokePromise(GitHubOperation.GetPullRequestStatus, { pullRequest: Ref.make(pullRequest) }, { spaceId });
|
|
52
|
+
if (error || !data) {
|
|
53
|
+
log.warn("pull request checks failed", {
|
|
54
|
+
pullRequest: pullRequest.id,
|
|
55
|
+
error
|
|
56
|
+
}, {
|
|
57
|
+
"~LogMeta": "~LogMeta",
|
|
58
|
+
F: __dxlog_file,
|
|
59
|
+
L: 62,
|
|
60
|
+
S: void 0
|
|
61
|
+
});
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const next = {
|
|
65
|
+
ci: data.ci,
|
|
66
|
+
checks: data.checks,
|
|
67
|
+
review: data.review,
|
|
68
|
+
approvals: data.approvals
|
|
69
|
+
};
|
|
70
|
+
cache.set(pullRequest.id, {
|
|
71
|
+
at: Date.now(),
|
|
72
|
+
checks: next
|
|
73
|
+
});
|
|
74
|
+
const id = pullRequest.id;
|
|
75
|
+
setChecks((previous) => new Map(previous).set(id, next));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
Promise.all(Array.from({ length: Math.min(CONCURRENCY, queue.length) }, worker));
|
|
79
|
+
return () => {
|
|
80
|
+
cancelled = true;
|
|
81
|
+
};
|
|
82
|
+
}, [
|
|
83
|
+
invokePromise,
|
|
84
|
+
pullRequests,
|
|
85
|
+
spaceId
|
|
86
|
+
]);
|
|
87
|
+
return checks;
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/types/PullRequestsView.ts
|
|
91
|
+
/**
|
|
92
|
+
* The fields the pull request list can be ordered by. `relevance` ranks what needs the reader first
|
|
93
|
+
* (see `relevance`); `updated` and `created` are GitHub's times.
|
|
94
|
+
*/
|
|
95
|
+
var SortField = Schema.Literals([
|
|
96
|
+
"relevance",
|
|
97
|
+
"updated",
|
|
98
|
+
"created",
|
|
99
|
+
"number",
|
|
100
|
+
"title"
|
|
101
|
+
]);
|
|
102
|
+
var SortDirection = Schema.Literals(["asc", "desc"]);
|
|
103
|
+
var Sort = Schema.Struct({
|
|
104
|
+
field: SortField,
|
|
105
|
+
direction: SortDirection
|
|
106
|
+
});
|
|
107
|
+
/** The fields the list can be grouped by; `none` is one ungrouped list. */
|
|
108
|
+
var GroupField = Schema.Literals([
|
|
109
|
+
"none",
|
|
110
|
+
"repo",
|
|
111
|
+
"state",
|
|
112
|
+
"checks",
|
|
113
|
+
"author"
|
|
114
|
+
]);
|
|
115
|
+
var DEFAULT_SORT = {
|
|
116
|
+
field: "relevance",
|
|
117
|
+
direction: "desc"
|
|
118
|
+
};
|
|
119
|
+
var View = Schema.Struct({
|
|
120
|
+
query: Schema.String,
|
|
121
|
+
sort: Schema.optional(Sort),
|
|
122
|
+
group: Schema.optional(GroupField)
|
|
123
|
+
});
|
|
124
|
+
/**
|
|
125
|
+
* How a reader has the space's pull requests arranged, keyed by the space and held per device
|
|
126
|
+
* (`local`), as a task set's list is: the filter, order and grouping are how this reader looks at the
|
|
127
|
+
* list here, not a property of the space every member would see.
|
|
128
|
+
*/
|
|
129
|
+
var aspect = ViewState.define({
|
|
130
|
+
key: "github-pull-requests-view",
|
|
131
|
+
backend: "local",
|
|
132
|
+
schema: View,
|
|
133
|
+
defaultValue: () => ({ query: "" })
|
|
134
|
+
});
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/containers/PullRequestsArticle/arrange.ts
|
|
137
|
+
/** What a free-text term searches: what a reader sees in the row. */
|
|
138
|
+
var rowText = (pullRequest) => [
|
|
139
|
+
pullRequest.title,
|
|
140
|
+
PullRequest.reference(pullRequest),
|
|
141
|
+
pullRequest.author,
|
|
142
|
+
pullRequest.headBranch
|
|
143
|
+
];
|
|
144
|
+
/** The rows the toolbar's query keeps, in input order; an absent filter keeps every row. */
|
|
145
|
+
var filterRows = (rows, filter) => filter ? rows.filter(({ pullRequest }) => matchesFilter(filter, pullRequest, { text: rowText })) : rows;
|
|
146
|
+
var STATE_WEIGHT = {
|
|
147
|
+
open: 1e3,
|
|
148
|
+
draft: 600,
|
|
149
|
+
merged: 100,
|
|
150
|
+
closed: 0
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* How much a row asks of the reader now: an open pull request outranks a draft, which outranks a
|
|
154
|
+
* finished one; within those, red CI or requested changes (something to fix) outrank one ready to
|
|
155
|
+
* merge, which outranks one still waiting; and a pull request some task tracks is nudged up.
|
|
156
|
+
*/
|
|
157
|
+
var relevance = ({ pullRequest, checks, tasks }) => {
|
|
158
|
+
let score = STATE_WEIGHT[pullRequest.state];
|
|
159
|
+
if (pullRequest.state === "open" || pullRequest.state === "draft") {
|
|
160
|
+
if (checks?.ci === "failure") score += 300;
|
|
161
|
+
if (checks?.review === "changes_requested") score += 250;
|
|
162
|
+
if (checks?.review === "approved" && checks.ci !== "failure" && checks.ci !== "pending") score += 200;
|
|
163
|
+
if (checks?.ci === "pending") score += 50;
|
|
164
|
+
}
|
|
165
|
+
if (tasks.length > 0) score += 25;
|
|
166
|
+
return score;
|
|
167
|
+
};
|
|
168
|
+
var time = (value) => {
|
|
169
|
+
const parsed = value ? Date.parse(value) : NaN;
|
|
170
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
171
|
+
};
|
|
172
|
+
/** Newest activity GitHub reported, falling back to when it was opened. */
|
|
173
|
+
var activity = (pullRequest) => time(pullRequest.updatedAt) || time(pullRequest.createdAt);
|
|
174
|
+
var byRecency = (left, right) => activity(left.pullRequest) - activity(right.pullRequest) || left.pullRequest.number - right.pullRequest.number;
|
|
175
|
+
var compareBy = {
|
|
176
|
+
relevance: (left, right) => relevance(left) - relevance(right) || byRecency(left, right),
|
|
177
|
+
updated: byRecency,
|
|
178
|
+
created: (left, right) => time(left.pullRequest.createdAt) - time(right.pullRequest.createdAt) || left.pullRequest.number - right.pullRequest.number,
|
|
179
|
+
number: (left, right) => left.pullRequest.number - right.pullRequest.number,
|
|
180
|
+
title: (left, right) => (left.pullRequest.title ?? "").localeCompare(right.pullRequest.title ?? "", void 0, { sensitivity: "base" })
|
|
181
|
+
};
|
|
182
|
+
/** The rows reordered by `sort`, ties kept in input order. */
|
|
183
|
+
var sortRows = (rows, sort) => {
|
|
184
|
+
const compare = compareBy[sort.field];
|
|
185
|
+
const sign = sort.direction === "desc" ? -1 : 1;
|
|
186
|
+
const index = new Map(rows.map((row, position) => [row.pullRequest.id, position]));
|
|
187
|
+
return [...rows].sort((left, right) => sign * compare(left, right) || (index.get(left.pullRequest.id) ?? 0) - (index.get(right.pullRequest.id) ?? 0));
|
|
188
|
+
};
|
|
189
|
+
var STATE_ORDER = [
|
|
190
|
+
"open",
|
|
191
|
+
"draft",
|
|
192
|
+
"merged",
|
|
193
|
+
"closed"
|
|
194
|
+
];
|
|
195
|
+
var STATE_ICON = {
|
|
196
|
+
open: "ph--git-pull-request--regular",
|
|
197
|
+
draft: "ph--git-pull-request--regular",
|
|
198
|
+
merged: "ph--git-merge--regular",
|
|
199
|
+
closed: "ph--x-circle--regular"
|
|
200
|
+
};
|
|
201
|
+
var STATE_HUE = {
|
|
202
|
+
open: "green",
|
|
203
|
+
closed: "red",
|
|
204
|
+
merged: "purple",
|
|
205
|
+
draft: "neutral"
|
|
206
|
+
};
|
|
207
|
+
var CI_ORDER = [
|
|
208
|
+
"failure",
|
|
209
|
+
"pending",
|
|
210
|
+
"success",
|
|
211
|
+
"none"
|
|
212
|
+
];
|
|
213
|
+
var CI_ICON = {
|
|
214
|
+
failure: "ph--x-circle--regular",
|
|
215
|
+
pending: "ph--circle-notch--regular",
|
|
216
|
+
success: "ph--check-circle--regular",
|
|
217
|
+
none: "ph--minus-circle--regular"
|
|
218
|
+
};
|
|
219
|
+
var CI_HUE = {
|
|
220
|
+
success: "green",
|
|
221
|
+
failure: "red",
|
|
222
|
+
pending: "amber",
|
|
223
|
+
none: "neutral"
|
|
224
|
+
};
|
|
225
|
+
/** Rows partitioned by a string key, groups in first-seen order unless `order` ranks them; empty groups dropped. */
|
|
226
|
+
var partition = (rows, key, make, order) => {
|
|
227
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const row of rows) {
|
|
229
|
+
const value = key(row);
|
|
230
|
+
byKey.set(value, [...byKey.get(value) ?? [], row]);
|
|
231
|
+
}
|
|
232
|
+
const keys = [...byKey.keys()];
|
|
233
|
+
if (order) keys.sort(order);
|
|
234
|
+
return keys.map((value) => make(value, byKey.get(value) ?? []));
|
|
235
|
+
};
|
|
236
|
+
var rankOf = (values) => (left, right) => values.indexOf(left) - values.indexOf(right);
|
|
237
|
+
/**
|
|
238
|
+
* The rows partitioned by `field`, each group's rows in input order (so a sort applies within every
|
|
239
|
+
* group). Absent for `none`: an ungrouped list has no headers.
|
|
240
|
+
*/
|
|
241
|
+
var groupRows = (rows, field) => {
|
|
242
|
+
switch (field) {
|
|
243
|
+
case "none": return;
|
|
244
|
+
case "repo": return partition(rows, ({ pullRequest }) => `${pullRequest.owner}/${pullRequest.repo}`, (repo, rows) => ({
|
|
245
|
+
id: `repo-${repo}`,
|
|
246
|
+
label: repo,
|
|
247
|
+
icon: "ph--git-branch--regular",
|
|
248
|
+
rows
|
|
249
|
+
}), (left, right) => left.localeCompare(right));
|
|
250
|
+
case "state": return partition(rows, ({ pullRequest }) => pullRequest.state, (state, rows) => ({
|
|
251
|
+
id: `state-${state}`,
|
|
252
|
+
label: `pull-request-state.${state}.label`,
|
|
253
|
+
translate: true,
|
|
254
|
+
icon: STATE_ICON[state],
|
|
255
|
+
hue: STATE_HUE[state],
|
|
256
|
+
rows
|
|
257
|
+
}), rankOf(STATE_ORDER));
|
|
258
|
+
case "checks": return [...partition(rows.filter((row) => row.checks), ({ checks }) => checks?.ci ?? "none", (ci, rows) => ({
|
|
259
|
+
id: `checks-${ci}`,
|
|
260
|
+
label: `ci-status.${ci}.label`,
|
|
261
|
+
translate: true,
|
|
262
|
+
icon: CI_ICON[ci],
|
|
263
|
+
hue: CI_HUE[ci],
|
|
264
|
+
rows
|
|
265
|
+
}), rankOf(CI_ORDER)), ...partition(rows.filter((row) => !row.checks), () => "unknown", (_, rows) => ({
|
|
266
|
+
id: "checks-unknown",
|
|
267
|
+
label: "ci-status.unknown.label",
|
|
268
|
+
translate: true,
|
|
269
|
+
icon: "ph--question--regular",
|
|
270
|
+
rows
|
|
271
|
+
}))];
|
|
272
|
+
case "author": return partition(rows, ({ pullRequest }) => pullRequest.author ?? "", (author, rows) => ({
|
|
273
|
+
id: `author-${author}`,
|
|
274
|
+
label: author || "group-no-author.label",
|
|
275
|
+
translate: !author,
|
|
276
|
+
icon: author ? "ph--user--regular" : "ph--user-circle-dashed--regular",
|
|
277
|
+
rows
|
|
278
|
+
}), (left, right) => left === "" ? 1 : right === "" ? -1 : left.localeCompare(right));
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/containers/PullRequestsArticle/format.ts
|
|
283
|
+
var UNITS = [
|
|
284
|
+
["year", 31536e6],
|
|
285
|
+
["month", 2592e6],
|
|
286
|
+
["week", 6048e5],
|
|
287
|
+
["day", 864e5],
|
|
288
|
+
["hour", 36e5],
|
|
289
|
+
["minute", 6e4]
|
|
290
|
+
];
|
|
291
|
+
var formatter;
|
|
292
|
+
/** `5 minutes ago`, `yesterday`, `3 weeks ago` — in the largest unit that fits; empty for an invalid date. */
|
|
293
|
+
var formatRelative = (value, now = Date.now()) => {
|
|
294
|
+
const date = Date.parse(value);
|
|
295
|
+
if (Number.isNaN(date)) return "";
|
|
296
|
+
formatter ??= new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
297
|
+
const elapsed = date - now;
|
|
298
|
+
for (const [unit, size] of UNITS) if (Math.abs(elapsed) >= size) return formatter.format(Math.round(elapsed / size), unit);
|
|
299
|
+
return formatter.format(0, "minute");
|
|
300
|
+
};
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/containers/PullRequestsArticle/PullRequestsArticle.tsx
|
|
303
|
+
var PULL_REQUEST_TYPENAME = Type.getTypename(PullRequest.PullRequest);
|
|
304
|
+
var SORT_ICONS = {
|
|
305
|
+
relevance: "ph--lightning--regular",
|
|
306
|
+
updated: "ph--clock-clockwise--regular",
|
|
307
|
+
created: "ph--calendar-plus--regular",
|
|
308
|
+
number: "ph--hash--regular",
|
|
309
|
+
title: "ph--text-aa--regular"
|
|
310
|
+
};
|
|
311
|
+
var GROUP_ICONS = {
|
|
312
|
+
none: "ph--list--regular",
|
|
313
|
+
repo: "ph--git-branch--regular",
|
|
314
|
+
state: "ph--git-pull-request--regular",
|
|
315
|
+
checks: "ph--check-circle--regular",
|
|
316
|
+
author: "ph--user--regular"
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Every pull request in a space as one list a reader triages from: repository, title, CI checks,
|
|
320
|
+
* the tasks that track it and its state, ordered by relevance (what needs the reader first) or time.
|
|
321
|
+
* The filter, order and grouping persist per device and per space, through the same view-state
|
|
322
|
+
* aspect, query editor and sort/group menus a task set's list uses.
|
|
323
|
+
*/
|
|
324
|
+
var PullRequestsArticle = ({ db, ...props }) => db ? /* @__PURE__ */ jsx(PullRequestList, {
|
|
325
|
+
db,
|
|
326
|
+
...props
|
|
327
|
+
}) : null;
|
|
328
|
+
PullRequestsArticle.displayName = "PullRequestsArticle";
|
|
329
|
+
var PullRequestList = ({ role, attendableId, db }) => {
|
|
330
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
331
|
+
const { hasAttention } = useAttention(attendableId);
|
|
332
|
+
const editorRef = useRef(null);
|
|
333
|
+
const contextId = db.spaceId;
|
|
334
|
+
const [query, setQuery] = usePersistentQuery(aspect, contextId, editorRef);
|
|
335
|
+
const { sort = DEFAULT_SORT, group = "none" } = useViewState(aspect, contextId);
|
|
336
|
+
const { update } = useViewStateActions(aspect, contextId);
|
|
337
|
+
const handleSortChange = useCallback((sort) => update((view) => ({
|
|
338
|
+
...view,
|
|
339
|
+
sort
|
|
340
|
+
})), [update]);
|
|
341
|
+
const handleGroupChange = useCallback((group) => update((view) => ({
|
|
342
|
+
...view,
|
|
343
|
+
group
|
|
344
|
+
})), [update]);
|
|
345
|
+
const handleClear = useCallback(() => setQuery(""), [setQuery]);
|
|
346
|
+
const tags = useTagMap(db);
|
|
347
|
+
const filter = useMemo(() => {
|
|
348
|
+
const text = query.trim();
|
|
349
|
+
return text.length === 0 ? void 0 : new QueryBuilder(tags).build(text).filter ?? Filter.nothing();
|
|
350
|
+
}, [query, tags]);
|
|
351
|
+
const pullRequests = useQuery(db, Filter.type(PullRequest.PullRequest));
|
|
352
|
+
const { rows, groups } = useArrangedRows(pullRequests, useQuery(db, Filter.type(Task.Task)), usePullRequestChecks(pullRequests, db.spaceId), {
|
|
353
|
+
filter,
|
|
354
|
+
sort,
|
|
355
|
+
group
|
|
356
|
+
});
|
|
357
|
+
const options = useMemo(() => (groups ? groups.flatMap((group) => group.rows) : rows).map(({ pullRequest }) => ({
|
|
358
|
+
value: pullRequest.id,
|
|
359
|
+
label: pullRequest.title
|
|
360
|
+
})), [groups, rows]);
|
|
361
|
+
const sortFields = useMemo(() => SortField.literals.map((id) => ({
|
|
362
|
+
id,
|
|
363
|
+
label: t(`pull-requests-sort-${id}.label`),
|
|
364
|
+
icon: SORT_ICONS[id]
|
|
365
|
+
})), [t]);
|
|
366
|
+
const directionLabels = useMemo(() => ({
|
|
367
|
+
asc: t("pull-requests-sort-asc.label"),
|
|
368
|
+
desc: t("pull-requests-sort-desc.label")
|
|
369
|
+
}), [t]);
|
|
370
|
+
const groupFields = useMemo(() => GroupField.literals.map((id) => ({
|
|
371
|
+
id,
|
|
372
|
+
label: t(`pull-requests-group-${id}.label`),
|
|
373
|
+
icon: GROUP_ICONS[id]
|
|
374
|
+
})), [t]);
|
|
375
|
+
const openObject = useOpenObject();
|
|
376
|
+
return /* @__PURE__ */ jsxs(Panel.Root, {
|
|
377
|
+
role,
|
|
378
|
+
"data-testid": "pull-requests",
|
|
379
|
+
children: [/* @__PURE__ */ jsx(Panel.Header, { children: /* @__PURE__ */ jsxs(Toolbar.Root, {
|
|
380
|
+
inactive: !hasAttention,
|
|
381
|
+
children: [
|
|
382
|
+
/* @__PURE__ */ jsx(QueryEditor, {
|
|
383
|
+
classNames: "grow min-w-0 ps-1",
|
|
384
|
+
db,
|
|
385
|
+
tags,
|
|
386
|
+
value: query,
|
|
387
|
+
onChange: setQuery,
|
|
388
|
+
ref: editorRef
|
|
389
|
+
}),
|
|
390
|
+
/* @__PURE__ */ jsx(SortMenu, {
|
|
391
|
+
fields: sortFields,
|
|
392
|
+
value: sort,
|
|
393
|
+
onChange: handleSortChange,
|
|
394
|
+
label: t("pull-requests-sort.label"),
|
|
395
|
+
directionLabels,
|
|
396
|
+
testId: "pull-requests.sort"
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ jsx(GroupMenu, {
|
|
399
|
+
fields: groupFields,
|
|
400
|
+
value: group,
|
|
401
|
+
onChange: handleGroupChange,
|
|
402
|
+
label: t("pull-requests-group.label"),
|
|
403
|
+
none: "none",
|
|
404
|
+
testId: "pull-requests.group"
|
|
405
|
+
}),
|
|
406
|
+
/* @__PURE__ */ jsx(Button.Root, {
|
|
407
|
+
icon: "ph--x--regular",
|
|
408
|
+
iconOnly: true,
|
|
409
|
+
disabled: query.trim().length === 0,
|
|
410
|
+
label: t("pull-requests-filter-clear.label"),
|
|
411
|
+
"data-testid": "pull-requests.filter.clear",
|
|
412
|
+
onClick: handleClear
|
|
413
|
+
})
|
|
414
|
+
]
|
|
415
|
+
}) }), /* @__PURE__ */ jsx(Panel.Body, { children: rows.length === 0 ? /* @__PURE__ */ jsx(Status.Empty, {
|
|
416
|
+
classNames: "dx-expand",
|
|
417
|
+
children: t(pullRequests.length === 0 ? "pull-requests-empty.message" : "pull-requests-no-match.message")
|
|
418
|
+
}) : /* @__PURE__ */ jsx(Listbox.Root, {
|
|
419
|
+
items: options,
|
|
420
|
+
children: /* @__PURE__ */ jsx(Listbox.Content, {
|
|
421
|
+
classNames: "dx-expand",
|
|
422
|
+
"aria-label": t("typename.label_other", { ns: PULL_REQUEST_TYPENAME }),
|
|
423
|
+
children: groups ? groups.filter((group) => group.rows.length > 0).map((group) => /* @__PURE__ */ jsx(GroupSection, {
|
|
424
|
+
group,
|
|
425
|
+
onOpen: openObject
|
|
426
|
+
}, group.id)) : rows.map((row) => /* @__PURE__ */ jsx(PullRequestListRow, {
|
|
427
|
+
row,
|
|
428
|
+
onOpen: openObject
|
|
429
|
+
}, row.pullRequest.id))
|
|
430
|
+
})
|
|
431
|
+
}) })]
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
var GroupSection = ({ group, onOpen }) => {
|
|
435
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
436
|
+
return /* @__PURE__ */ jsxs(Listbox.ItemGroup, { children: [/* @__PURE__ */ jsx(Listbox.ItemGroupLabel, { children: /* @__PURE__ */ jsxs(Layout.Flex, {
|
|
437
|
+
align: "center",
|
|
438
|
+
gap: "sm",
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsx(Icon.Icon, {
|
|
441
|
+
icon: group.icon,
|
|
442
|
+
classNames: "dx-text",
|
|
443
|
+
"data-hue": group.hue
|
|
444
|
+
}),
|
|
445
|
+
/* @__PURE__ */ jsx("span", {
|
|
446
|
+
className: "truncate",
|
|
447
|
+
children: group.translate ? t(group.label) : group.label
|
|
448
|
+
}),
|
|
449
|
+
/* @__PURE__ */ jsx("span", {
|
|
450
|
+
className: "text-description",
|
|
451
|
+
children: group.rows.length
|
|
452
|
+
})
|
|
453
|
+
]
|
|
454
|
+
}) }), group.rows.map((row) => /* @__PURE__ */ jsx(PullRequestListRow, {
|
|
455
|
+
row,
|
|
456
|
+
onOpen
|
|
457
|
+
}, row.pullRequest.id))] });
|
|
458
|
+
};
|
|
459
|
+
/** One pull request: its repository and number, title, author and time, then checks, tasks and state. */
|
|
460
|
+
var PullRequestListRow = ({ row: { pullRequest, checks, tasks }, onOpen }) => {
|
|
461
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
462
|
+
const time = pullRequest.updatedAt ?? pullRequest.createdAt;
|
|
463
|
+
return /* @__PURE__ */ jsx(Listbox.Item, {
|
|
464
|
+
id: pullRequest.id,
|
|
465
|
+
classNames: "cursor-pointer py-2",
|
|
466
|
+
"data-testid": "pull-requests.row",
|
|
467
|
+
onClick: () => void onOpen(pullRequest),
|
|
468
|
+
children: /* @__PURE__ */ jsxs(Layout.Flex, {
|
|
469
|
+
column: true,
|
|
470
|
+
gap: "xs",
|
|
471
|
+
grow: true,
|
|
472
|
+
children: [/* @__PURE__ */ jsxs(Layout.Flex, {
|
|
473
|
+
align: "center",
|
|
474
|
+
gap: "sm",
|
|
475
|
+
classNames: "min-w-0",
|
|
476
|
+
children: [
|
|
477
|
+
/* @__PURE__ */ jsx("span", {
|
|
478
|
+
className: "dx-tag dx-tag-inline shrink-0",
|
|
479
|
+
"data-hue": "neutral",
|
|
480
|
+
children: PullRequest.reference(pullRequest)
|
|
481
|
+
}),
|
|
482
|
+
/* @__PURE__ */ jsx("span", {
|
|
483
|
+
className: "truncate grow",
|
|
484
|
+
children: pullRequest.title
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ jsx(ChecksTag, {
|
|
487
|
+
pullRequest,
|
|
488
|
+
checks
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ jsx("span", {
|
|
491
|
+
className: "dx-tag dx-tag-inline shrink-0",
|
|
492
|
+
"data-hue": STATE_HUE[pullRequest.state],
|
|
493
|
+
"data-testid": "pull-requests.row.state",
|
|
494
|
+
children: t(`pull-request-state.${pullRequest.state}.label`)
|
|
495
|
+
})
|
|
496
|
+
]
|
|
497
|
+
}), /* @__PURE__ */ jsxs(Layout.Flex, {
|
|
498
|
+
align: "center",
|
|
499
|
+
gap: "sm",
|
|
500
|
+
classNames: "min-w-0 text-xs text-description",
|
|
501
|
+
children: [
|
|
502
|
+
pullRequest.author && /* @__PURE__ */ jsx("span", {
|
|
503
|
+
className: "shrink-0",
|
|
504
|
+
children: pullRequest.author
|
|
505
|
+
}),
|
|
506
|
+
time && /* @__PURE__ */ jsx("time", {
|
|
507
|
+
className: "shrink-0",
|
|
508
|
+
dateTime: time,
|
|
509
|
+
title: new Date(time).toLocaleString(),
|
|
510
|
+
children: formatRelative(time)
|
|
511
|
+
}),
|
|
512
|
+
tasks.length > 0 && /* @__PURE__ */ jsxs(Layout.Flex, {
|
|
513
|
+
align: "center",
|
|
514
|
+
gap: "xs",
|
|
515
|
+
classNames: "min-w-0",
|
|
516
|
+
"data-testid": "pull-requests.row.tasks",
|
|
517
|
+
children: [/* @__PURE__ */ jsx(Icon.Icon, {
|
|
518
|
+
icon: "ph--check-square-offset--regular",
|
|
519
|
+
size: "xs",
|
|
520
|
+
classNames: "shrink-0"
|
|
521
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
522
|
+
className: "truncate",
|
|
523
|
+
children: tasks.map((task) => task.title || t("untitled-task.label")).join(", ")
|
|
524
|
+
})]
|
|
525
|
+
})
|
|
526
|
+
]
|
|
527
|
+
})]
|
|
528
|
+
})
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
var ChecksTag = ({ pullRequest, checks }) => {
|
|
532
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
533
|
+
if (!checks) return pullRequest.state === "open" || pullRequest.state === "draft" ? /* @__PURE__ */ jsx("span", {
|
|
534
|
+
className: "dx-tag dx-tag-inline",
|
|
535
|
+
"data-hue": "neutral",
|
|
536
|
+
"data-testid": "pull-requests.row.checks",
|
|
537
|
+
children: t("ci-status.unknown.label")
|
|
538
|
+
}) : null;
|
|
539
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [checks.review !== "none" && /* @__PURE__ */ jsx("span", {
|
|
540
|
+
className: "dx-tag dx-tag-inline",
|
|
541
|
+
"data-hue": checks.review === "approved" ? "green" : "red",
|
|
542
|
+
"data-testid": "pull-requests.row.review",
|
|
543
|
+
children: t(`review-status.${checks.review}.label`, { count: checks.approvals })
|
|
544
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
545
|
+
className: "dx-tag dx-tag-inline",
|
|
546
|
+
"data-hue": CI_HUE[checks.ci],
|
|
547
|
+
"data-testid": "pull-requests.row.checks",
|
|
548
|
+
children: [t(`ci-status.${checks.ci}.label`), checks.checks.total > 0 && ` ${checks.checks.passed}/${checks.checks.total}`]
|
|
549
|
+
})] });
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* The rows the toolbar keeps, in the order it asks for, partitioned into its groups. Read through
|
|
553
|
+
* atoms so a re-sync (a new state, a new title) or a task gaining the pull request as an artifact
|
|
554
|
+
* re-arranges the list without the queries re-emitting.
|
|
555
|
+
*/
|
|
556
|
+
var useArrangedRows = (pullRequests, tasks, checks, { filter, sort, group }) => {
|
|
557
|
+
const atom = useMemo(() => Atom.make((get) => {
|
|
558
|
+
pullRequests.forEach((pullRequest) => get(Obj.atom(pullRequest)));
|
|
559
|
+
const tasksByPullRequest = /* @__PURE__ */ new Map();
|
|
560
|
+
for (const task of tasks) for (const ref of get(Obj.atomProperty(task, "artifacts")) ?? []) {
|
|
561
|
+
const id = Task.refEntityId(ref);
|
|
562
|
+
if (id) tasksByPullRequest.set(id, [...tasksByPullRequest.get(id) ?? [], task]);
|
|
563
|
+
}
|
|
564
|
+
const rows = sortRows(filterRows(pullRequests.map((pullRequest) => ({
|
|
565
|
+
pullRequest,
|
|
566
|
+
checks: checks.get(pullRequest.id),
|
|
567
|
+
tasks: tasksByPullRequest.get(pullRequest.id) ?? []
|
|
568
|
+
})), filter), sort);
|
|
569
|
+
return {
|
|
570
|
+
rows,
|
|
571
|
+
groups: groupRows(rows, group)
|
|
572
|
+
};
|
|
573
|
+
}), [
|
|
574
|
+
pullRequests,
|
|
575
|
+
tasks,
|
|
576
|
+
checks,
|
|
577
|
+
filter,
|
|
578
|
+
sort,
|
|
579
|
+
group
|
|
580
|
+
]);
|
|
581
|
+
return useAtomValue(atom);
|
|
582
|
+
};
|
|
583
|
+
/** Tag registry keyed by the `Tag` object's uri — the id space `#tag` terms and `meta.tags` share. */
|
|
584
|
+
var useTagMap = (db) => {
|
|
585
|
+
const tags = useQuery(db, Filter.type(Tag.Tag));
|
|
586
|
+
return useMemo(() => tags.reduce((acc, tag) => {
|
|
587
|
+
acc[Obj.getURI(tag).toString()] = tag;
|
|
588
|
+
return acc;
|
|
589
|
+
}, {}), [tags]);
|
|
590
|
+
};
|
|
591
|
+
//#endregion
|
|
592
|
+
export { PullRequestsArticle as default };
|
|
593
|
+
|
|
594
|
+
//# sourceMappingURL=chunk-PullRequestsArticle.mjs.map
|