@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,1486 @@
|
|
|
1
|
+
import { y as responseStatus } from "./chunk-github-api.mjs";
|
|
2
|
+
import { a as renderHunks, i as parsePatch, n as newestWalkthrough, r as spaceHeadings } from "./chunk-generate.mjs";
|
|
3
|
+
import { n as useSyncPullRequest } from "./chunk-react-surface.mjs";
|
|
4
|
+
import { t as githubConnection } from "./chunk-pull-request2.mjs";
|
|
5
|
+
import * as PreviewCapabilities from "@dxos/plugin-preview/PreviewCapabilities";
|
|
6
|
+
import { meta } from "#meta";
|
|
7
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
+
import { createBasicExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown, diffBlocks, scrollbarAutohide, walkthroughSidebar, walkthroughTheme } from "@dxos/ui-editor";
|
|
9
|
+
import { GitHubOperation, Walkthrough } from "#types";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { PullRequest } from "@dxos/types";
|
|
12
|
+
import { Database, Filter, Obj, Ref } from "@dxos/echo";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import * as AppCapabilities from "@dxos/app-toolkit/AppCapabilities";
|
|
15
|
+
import * as LayoutOperation from "@dxos/app-toolkit/LayoutOperation";
|
|
16
|
+
import { log } from "@dxos/log";
|
|
17
|
+
import * as Card from "@dxos/react-ui/Card";
|
|
18
|
+
import * as Hooks from "@dxos/react-ui/Hooks";
|
|
19
|
+
import * as Layout from "@dxos/react-ui/Layout";
|
|
20
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { useObject, useQuery } from "@dxos/echo-react";
|
|
22
|
+
import * as Hooks$1 from "@dxos/app-framework/Hooks";
|
|
23
|
+
import * as ToolkitHooks from "@dxos/app-toolkit/Hooks";
|
|
24
|
+
import * as EffectEx from "@dxos/effect/EffectEx";
|
|
25
|
+
import { Form } from "@dxos/react-ui-form";
|
|
26
|
+
import * as Binding from "@dxos/plugin-connector/Binding";
|
|
27
|
+
import { ProgressMeter } from "@dxos/react-ui-components";
|
|
28
|
+
import { ActionToolbar, MenuBuilder, useMenuBuilder } from "@dxos/react-ui-menu";
|
|
29
|
+
import * as Panel from "@dxos/react-ui/Panel";
|
|
30
|
+
import * as Tabs from "@dxos/react-ui/Tabs";
|
|
31
|
+
import * as Button from "@dxos/react-ui/Button";
|
|
32
|
+
import * as Field from "@dxos/react-ui/Field";
|
|
33
|
+
import * as Input from "@dxos/react-ui/Input";
|
|
34
|
+
import * as Popover from "@dxos/react-ui/Popover";
|
|
35
|
+
import * as VirtualAnchor from "@dxos/react-ui/VirtualAnchor";
|
|
36
|
+
import { Listbox, Tree, createStaticTreeModel } from "@dxos/react-ui-list";
|
|
37
|
+
import * as ScrollArea from "@dxos/react-ui/ScrollArea";
|
|
38
|
+
import * as Status from "@dxos/react-ui/Status";
|
|
39
|
+
import { TextEditor } from "@dxos/react-ui-editor";
|
|
40
|
+
import { DxAnchor } from "@dxos/lit-ui/react";
|
|
41
|
+
import { MarkdownLink, MarkdownView } from "@dxos/react-ui-markdown";
|
|
42
|
+
import * as Icon from "@dxos/react-ui/Icon";
|
|
43
|
+
import { Masonry } from "@dxos/react-ui-masonry";
|
|
44
|
+
//#region src/components/PullRequestFiles/files.ts
|
|
45
|
+
/** Id of the synthetic root the tree model anchors its top-level rows to; never rendered. */
|
|
46
|
+
var FILE_TREE_ROOT = "root";
|
|
47
|
+
/**
|
|
48
|
+
* The changed files as a directory tree, directories before files and each alphabetical — the order
|
|
49
|
+
* GitHub's own file tree uses. A directory whose only child is another directory is folded into one
|
|
50
|
+
* row (`src/components`), since a chain of single-entry folders is depth without information.
|
|
51
|
+
*/
|
|
52
|
+
var buildFileTree = (files) => {
|
|
53
|
+
let count = 0;
|
|
54
|
+
const nextId = () => `node-${++count}`;
|
|
55
|
+
const root = {
|
|
56
|
+
id: FILE_TREE_ROOT,
|
|
57
|
+
path: "",
|
|
58
|
+
name: "",
|
|
59
|
+
children: [],
|
|
60
|
+
added: 0,
|
|
61
|
+
removed: 0
|
|
62
|
+
};
|
|
63
|
+
for (const file of files) {
|
|
64
|
+
const segments = file.path.split("/");
|
|
65
|
+
let parent = root;
|
|
66
|
+
for (let index = 0; index < segments.length - 1; index++) {
|
|
67
|
+
const path = segments.slice(0, index + 1).join("/");
|
|
68
|
+
let directory = parent.children.find((child) => !child.file && child.path === path);
|
|
69
|
+
if (!directory) {
|
|
70
|
+
directory = {
|
|
71
|
+
id: nextId(),
|
|
72
|
+
path,
|
|
73
|
+
name: segments[index],
|
|
74
|
+
children: [],
|
|
75
|
+
added: 0,
|
|
76
|
+
removed: 0
|
|
77
|
+
};
|
|
78
|
+
parent.children.push(directory);
|
|
79
|
+
}
|
|
80
|
+
parent = directory;
|
|
81
|
+
}
|
|
82
|
+
parent.children.push({
|
|
83
|
+
id: nextId(),
|
|
84
|
+
path: file.path,
|
|
85
|
+
name: segments.at(-1) ?? file.path,
|
|
86
|
+
file,
|
|
87
|
+
children: [],
|
|
88
|
+
added: file.added,
|
|
89
|
+
removed: file.removed
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const finish = (node) => {
|
|
93
|
+
const children = node.children.map(finish).sort(compareNodes);
|
|
94
|
+
let folded = {
|
|
95
|
+
...node,
|
|
96
|
+
children,
|
|
97
|
+
added: node.file ? node.added : children.reduce((sum, child) => sum + child.added, 0),
|
|
98
|
+
removed: node.file ? node.removed : children.reduce((sum, child) => sum + child.removed, 0)
|
|
99
|
+
};
|
|
100
|
+
while (folded !== root && !folded.file && folded.children.length === 1 && !folded.children[0].file) {
|
|
101
|
+
const [only] = folded.children;
|
|
102
|
+
folded = {
|
|
103
|
+
...only,
|
|
104
|
+
name: `${folded.name}/${only.name}`
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return folded;
|
|
108
|
+
};
|
|
109
|
+
return finish(root);
|
|
110
|
+
};
|
|
111
|
+
var compareNodes = (left, right) => Number(!!left.file) - Number(!!right.file) || left.name.localeCompare(right.name);
|
|
112
|
+
/** The files in the order the tree lists them, which is the order previous/next walks. */
|
|
113
|
+
var flattenFiles = (node) => node.file ? [node.file] : node.children.flatMap(flattenFiles);
|
|
114
|
+
/**
|
|
115
|
+
* One file's change as the ```diff fence the walkthrough renders, so the files view shows a file
|
|
116
|
+
* exactly as a walkthrough chunk would. The fence is one backtick longer than any run in the body:
|
|
117
|
+
* a context line of a markdown file can itself be a fence, which would otherwise close this one.
|
|
118
|
+
*/
|
|
119
|
+
var diffFence = (file) => {
|
|
120
|
+
const body = renderHunks(file.hunks);
|
|
121
|
+
const longest = Math.max(0, ...(body.match(/`+/g) ?? []).map((run) => run.length));
|
|
122
|
+
const fence = "`".repeat(Math.max(3, longest + 1));
|
|
123
|
+
return `${fence}diff file=${file.path}\n${body}\n${fence}`;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* A short digest of a file's change. A file is reviewed at a signature: when a push changes the
|
|
127
|
+
* file its signature moves and the check falls away, as GitHub's "Viewed" does.
|
|
128
|
+
*/
|
|
129
|
+
var fileSignature = (file) => {
|
|
130
|
+
let hash = 2166136261;
|
|
131
|
+
for (const hunk of file.hunks) for (const line of [hunk.header, ...hunk.lines]) {
|
|
132
|
+
for (let index = 0; index < line.length; index++) {
|
|
133
|
+
hash ^= line.charCodeAt(index);
|
|
134
|
+
hash = Math.imul(hash, 16777619);
|
|
135
|
+
}
|
|
136
|
+
hash ^= 10;
|
|
137
|
+
hash = Math.imul(hash, 16777619);
|
|
138
|
+
}
|
|
139
|
+
return (hash >>> 0).toString(36);
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/hooks/usePullRequestFiles.ts
|
|
143
|
+
var __dxlog_file$2 = "/__w/dxos/dxos/packages/plugins/plugin-github/src/hooks/usePullRequestFiles.ts";
|
|
144
|
+
var readRecord = (key) => {
|
|
145
|
+
try {
|
|
146
|
+
const value = localStorage.getItem(key);
|
|
147
|
+
return value ? JSON.parse(value) : {};
|
|
148
|
+
} catch (error) {
|
|
149
|
+
log.warn("reviewed files unreadable", { error }, {
|
|
150
|
+
"~LogMeta": "~LogMeta",
|
|
151
|
+
F: __dxlog_file$2,
|
|
152
|
+
L: 33,
|
|
153
|
+
S: void 0
|
|
154
|
+
});
|
|
155
|
+
return {};
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
var writeRecord = (key, record) => {
|
|
159
|
+
try {
|
|
160
|
+
localStorage.setItem(key, JSON.stringify(record));
|
|
161
|
+
} catch (error) {
|
|
162
|
+
log.warn("reviewed files not saved", { error }, {
|
|
163
|
+
"~LogMeta": "~LogMeta",
|
|
164
|
+
F: __dxlog_file$2,
|
|
165
|
+
L: 42,
|
|
166
|
+
S: void 0
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* A pull request's changed files, the one on screen, and which the reader has reviewed.
|
|
172
|
+
*
|
|
173
|
+
* Reviewed state is the reader's own, so it lives in their browser under `storageKey` rather than in
|
|
174
|
+
* the space. A file is reviewed at the change it had when checked: a push that changes it unchecks
|
|
175
|
+
* it, as GitHub's "Viewed" does.
|
|
176
|
+
*/
|
|
177
|
+
var usePullRequestFiles = (diff, storageKey) => {
|
|
178
|
+
const files = useMemo(() => diff === void 0 ? [] : parsePatch(diff), [diff]);
|
|
179
|
+
const tree = useMemo(() => diff === void 0 ? void 0 : buildFileTree(files), [diff, files]);
|
|
180
|
+
const order = useMemo(() => tree ? flattenFiles(tree) : [], [tree]);
|
|
181
|
+
const signatures = useMemo(() => new Map(files.map((file) => [file.path, fileSignature(file)])), [files]);
|
|
182
|
+
const [record, setRecord] = useState(() => readRecord(storageKey));
|
|
183
|
+
useEffect(() => setRecord(readRecord(storageKey)), [storageKey]);
|
|
184
|
+
const reviewed = useMemo(() => new Set(Object.keys(record).filter((path) => signatures.get(path) === record[path])), [record, signatures]);
|
|
185
|
+
const setReviewed = useCallback((path, value) => {
|
|
186
|
+
setRecord((previous) => {
|
|
187
|
+
const next = { ...previous };
|
|
188
|
+
const signature = signatures.get(path);
|
|
189
|
+
if (value && signature) next[path] = signature;
|
|
190
|
+
else delete next[path];
|
|
191
|
+
writeRecord(storageKey, next);
|
|
192
|
+
return next;
|
|
193
|
+
});
|
|
194
|
+
}, [signatures, storageKey]);
|
|
195
|
+
const [selected, setSelected] = useState();
|
|
196
|
+
const file = order.find((candidate) => candidate.path === selected) ?? order[0];
|
|
197
|
+
return {
|
|
198
|
+
tree,
|
|
199
|
+
files,
|
|
200
|
+
file,
|
|
201
|
+
reviewed,
|
|
202
|
+
select: setSelected,
|
|
203
|
+
step: useCallback((delta) => {
|
|
204
|
+
const index = order.findIndex((candidate) => candidate.path === file?.path);
|
|
205
|
+
const next = order[index + delta];
|
|
206
|
+
if (next) setSelected(next.path);
|
|
207
|
+
}, [order, file]),
|
|
208
|
+
setReviewed
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/hooks/usePullRequestDiff.ts
|
|
213
|
+
var __dxlog_file$1 = "/__w/dxos/dxos/packages/plugins/plugin-github/src/hooks/usePullRequestDiff.ts";
|
|
214
|
+
/** Reads a pull request's diff through the space's GitHub connection, once `enabled` first turns true. */
|
|
215
|
+
var usePullRequestDiff = (pullRequest, spaceId, enabled) => {
|
|
216
|
+
const { invokePromise } = Hooks$1.useOperationInvoker();
|
|
217
|
+
const [result, setResult] = useState({});
|
|
218
|
+
const [requested, setRequested] = useState(false);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (enabled) setRequested(true);
|
|
221
|
+
}, [enabled]);
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
if (!requested) return;
|
|
224
|
+
let cancelled = false;
|
|
225
|
+
invokePromise(GitHubOperation.GetPullRequestDiff, { pullRequest }, { spaceId }).then(({ data, error }) => {
|
|
226
|
+
if (cancelled) return;
|
|
227
|
+
if (error) log.warn("pull request diff failed", { error }, {
|
|
228
|
+
"~LogMeta": "~LogMeta",
|
|
229
|
+
F: __dxlog_file$1,
|
|
230
|
+
L: 47,
|
|
231
|
+
S: void 0
|
|
232
|
+
});
|
|
233
|
+
setResult({
|
|
234
|
+
diff: data?.diff,
|
|
235
|
+
commit: data?.commit,
|
|
236
|
+
error
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
return () => {
|
|
240
|
+
cancelled = true;
|
|
241
|
+
};
|
|
242
|
+
}, [
|
|
243
|
+
requested,
|
|
244
|
+
invokePromise,
|
|
245
|
+
pullRequest,
|
|
246
|
+
spaceId
|
|
247
|
+
]);
|
|
248
|
+
return result;
|
|
249
|
+
};
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/components/CommentComposer/CommentComposer.tsx
|
|
252
|
+
/**
|
|
253
|
+
* The comment field, its target and its buttons — rendered as a band under the pull request header
|
|
254
|
+
* when the comment is about the pull request, and inside {@link LineCommentPopover} when it is
|
|
255
|
+
* about one line of a diff.
|
|
256
|
+
*/
|
|
257
|
+
var CommentComposer = ({ value, busy, target, onValueChange, onSubmit, onCancel }) => {
|
|
258
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
259
|
+
const handleKeyDown = useCallback((event) => {
|
|
260
|
+
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
if (!busy && value.trim()) onSubmit();
|
|
263
|
+
}
|
|
264
|
+
}, [
|
|
265
|
+
busy,
|
|
266
|
+
value,
|
|
267
|
+
onSubmit
|
|
268
|
+
]);
|
|
269
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
270
|
+
target && /* @__PURE__ */ jsx("span", {
|
|
271
|
+
className: "text-sm text-fg-muted",
|
|
272
|
+
children: t("comment-line.label", {
|
|
273
|
+
file: target.file,
|
|
274
|
+
line: target.line
|
|
275
|
+
})
|
|
276
|
+
}),
|
|
277
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(Input.Textarea, {
|
|
278
|
+
autoFocus: true,
|
|
279
|
+
rows: 4,
|
|
280
|
+
placeholder: t("comment-placeholder.label"),
|
|
281
|
+
value,
|
|
282
|
+
onChange: (event) => onValueChange(event.target.value),
|
|
283
|
+
onKeyDown: handleKeyDown
|
|
284
|
+
}) }),
|
|
285
|
+
/* @__PURE__ */ jsxs(Layout.Flex, {
|
|
286
|
+
justify: "end",
|
|
287
|
+
gap: "sm",
|
|
288
|
+
children: [/* @__PURE__ */ jsx(Button.Root, {
|
|
289
|
+
onClick: onCancel,
|
|
290
|
+
children: t("comment-cancel.label")
|
|
291
|
+
}), /* @__PURE__ */ jsx(Button.Root, {
|
|
292
|
+
variant: "primary",
|
|
293
|
+
disabled: busy || !value.trim(),
|
|
294
|
+
onClick: onSubmit,
|
|
295
|
+
children: t("comment-submit.label")
|
|
296
|
+
})]
|
|
297
|
+
})
|
|
298
|
+
] });
|
|
299
|
+
};
|
|
300
|
+
/** The composer as a band under the toolbar, for a comment on the pull request as a whole. */
|
|
301
|
+
var CommentBand = (props) => /* @__PURE__ */ jsx(Layout.Flex, {
|
|
302
|
+
column: true,
|
|
303
|
+
gap: "sm",
|
|
304
|
+
classNames: "p-3 border-b border-separator",
|
|
305
|
+
children: /* @__PURE__ */ jsx(CommentComposer, { ...props })
|
|
306
|
+
});
|
|
307
|
+
/**
|
|
308
|
+
* The composer floated at the diff line it addresses, so the reader reads the comment against the
|
|
309
|
+
* code it is about rather than against a band at the other end of the document.
|
|
310
|
+
*/
|
|
311
|
+
var LineCommentPopover = ({ open, anchorRef, ...props }) => /* @__PURE__ */ jsx(Popover.Root, {
|
|
312
|
+
open,
|
|
313
|
+
onOpenChange: ({ open: next }) => {
|
|
314
|
+
if (!next) props.onCancel();
|
|
315
|
+
},
|
|
316
|
+
positioning: {
|
|
317
|
+
...VirtualAnchor.virtualAnchor(anchorRef),
|
|
318
|
+
placement: "bottom-start"
|
|
319
|
+
},
|
|
320
|
+
children: /* @__PURE__ */ jsx(Popover.Content, {
|
|
321
|
+
classNames: "w-[28rem] max-w-[90cqi]",
|
|
322
|
+
children: /* @__PURE__ */ jsx(Popover.Body, {
|
|
323
|
+
classNames: "flex flex-col gap-2 p-2",
|
|
324
|
+
children: /* @__PURE__ */ jsx(CommentComposer, { ...props })
|
|
325
|
+
})
|
|
326
|
+
})
|
|
327
|
+
});
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/components/PullRequestFiles/DiffStat.tsx
|
|
330
|
+
/** `+12 -3`, coloured as the diff gutters are, with a zero count left out. */
|
|
331
|
+
var DiffStat = ({ added, removed }) => /* @__PURE__ */ jsxs("span", {
|
|
332
|
+
className: "flex items-center gap-1 ps-2 text-xs tabular-nums whitespace-nowrap",
|
|
333
|
+
children: [added > 0 && /* @__PURE__ */ jsxs("span", {
|
|
334
|
+
className: "text-(--color-cm-diff-add-gutter)",
|
|
335
|
+
children: ["+", added]
|
|
336
|
+
}), removed > 0 && /* @__PURE__ */ jsxs("span", {
|
|
337
|
+
className: "text-(--color-cm-diff-remove-gutter)",
|
|
338
|
+
children: ["-", removed]
|
|
339
|
+
})]
|
|
340
|
+
});
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/components/PullRequestFiles/FileTree.tsx
|
|
343
|
+
/**
|
|
344
|
+
* The changed files as a tree: a checkbox per file to mark it reviewed, its change counts at the
|
|
345
|
+
* trailing edge, and the file on screen as the current row.
|
|
346
|
+
*/
|
|
347
|
+
var FileTree = ({ root, selected, reviewed, onSelect, onReviewedChange }) => {
|
|
348
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
349
|
+
const [closed, setClosed] = useState(() => /* @__PURE__ */ new Set());
|
|
350
|
+
const model = useMemo(() => createStaticTreeModel(root, {
|
|
351
|
+
getChildren: (node) => node.children,
|
|
352
|
+
getProps: (node) => ({
|
|
353
|
+
label: node.name,
|
|
354
|
+
count: void 0,
|
|
355
|
+
testId: "pull-request.files.row"
|
|
356
|
+
}),
|
|
357
|
+
isOpen: (node) => !closed.has(node.id),
|
|
358
|
+
isCurrent: (node) => node.file !== void 0 && node.path === selected
|
|
359
|
+
}), [
|
|
360
|
+
root,
|
|
361
|
+
selected,
|
|
362
|
+
closed
|
|
363
|
+
]);
|
|
364
|
+
const handleOpenChange = useCallback(({ item, open }) => setClosed((previous) => {
|
|
365
|
+
const next = new Set(previous);
|
|
366
|
+
if (open) next.delete(item.id);
|
|
367
|
+
else next.add(item.id);
|
|
368
|
+
return next;
|
|
369
|
+
}), []);
|
|
370
|
+
const handleSelect = useCallback(({ item }) => {
|
|
371
|
+
if (item.file) onSelect(item.path);
|
|
372
|
+
}, [onSelect]);
|
|
373
|
+
const renderRow = useCallback((node) => {
|
|
374
|
+
const item = node.item;
|
|
375
|
+
return /* @__PURE__ */ jsxs(Tree.Item, {
|
|
376
|
+
node,
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ jsx(Tree.ItemIndicator, {}),
|
|
379
|
+
/* @__PURE__ */ jsx(Tree.ItemIcon, {
|
|
380
|
+
icon: item?.file ? void 0 : "ph--folder--regular",
|
|
381
|
+
children: item?.file && /* @__PURE__ */ jsx(Input.Checkbox, {
|
|
382
|
+
checked: reviewed.has(item.path),
|
|
383
|
+
onCheckedChange: ({ checked }) => onReviewedChange(item.path, checked === true),
|
|
384
|
+
onClick: (event) => event.stopPropagation(),
|
|
385
|
+
"aria-label": t("file-reviewed.label"),
|
|
386
|
+
"data-testid": "pull-request.files.reviewed"
|
|
387
|
+
})
|
|
388
|
+
}),
|
|
389
|
+
/* @__PURE__ */ jsx(Tree.ItemText, {}),
|
|
390
|
+
item && /* @__PURE__ */ jsx(DiffStat, {
|
|
391
|
+
added: item.added,
|
|
392
|
+
removed: item.removed
|
|
393
|
+
})
|
|
394
|
+
]
|
|
395
|
+
});
|
|
396
|
+
}, [
|
|
397
|
+
reviewed,
|
|
398
|
+
onReviewedChange,
|
|
399
|
+
t
|
|
400
|
+
]);
|
|
401
|
+
return /* @__PURE__ */ jsxs(Tree.Root, {
|
|
402
|
+
id: root.id,
|
|
403
|
+
model,
|
|
404
|
+
size: "sm",
|
|
405
|
+
onOpenChange: handleOpenChange,
|
|
406
|
+
onSelect: handleSelect,
|
|
407
|
+
children: [/* @__PURE__ */ jsx(Tree.Label, {
|
|
408
|
+
srOnly: true,
|
|
409
|
+
children: t("files-tree.label")
|
|
410
|
+
}), /* @__PURE__ */ jsx(Tree.Content, { children: renderRow })]
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/components/WalkthroughView/extensions.ts
|
|
415
|
+
/** A definite content width, which the diff chunks cap themselves against. */
|
|
416
|
+
var slots = { content: { className: "dx-container-type-inline-size w-full mx-auto! max-w-[min(72rem,100%-3rem)] py-3!" } };
|
|
417
|
+
/**
|
|
418
|
+
* A read-only markdown document whose ```diff fences render as diff chunks — the one reading surface
|
|
419
|
+
* both a walkthrough and a single changed file are shown in, so the two cannot drift apart.
|
|
420
|
+
*/
|
|
421
|
+
var diffDocumentExtensions = ({ themeMode, sidebar = "none", layout, onLineComment }) => [
|
|
422
|
+
createThemeExtensions({
|
|
423
|
+
themeMode,
|
|
424
|
+
slots
|
|
425
|
+
}),
|
|
426
|
+
createBasicExtensions({
|
|
427
|
+
lineWrapping: true,
|
|
428
|
+
readOnly: true
|
|
429
|
+
}),
|
|
430
|
+
createMarkdownExtensions(),
|
|
431
|
+
decorateMarkdown(),
|
|
432
|
+
scrollbarAutohide(),
|
|
433
|
+
walkthroughTheme(),
|
|
434
|
+
diffBlocks({
|
|
435
|
+
layout,
|
|
436
|
+
...onLineComment ? { onLineComment } : {}
|
|
437
|
+
}),
|
|
438
|
+
sidebar === "none" ? [] : walkthroughSidebar({ variant: sidebar })
|
|
439
|
+
];
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/components/WalkthroughView/WalkthroughView.tsx
|
|
442
|
+
/**
|
|
443
|
+
* A read-only diff document: a whole walkthrough with its navigation rail, or one file's change as a
|
|
444
|
+
* single fence. Either way the chunks are the walkthrough's own, so a file reads the same in both.
|
|
445
|
+
*/
|
|
446
|
+
var WalkthroughView = ({ value, sidebar, layout, onLineComment }) => {
|
|
447
|
+
const themeMode = Hooks.useThemeMode();
|
|
448
|
+
const extensions = useMemo(() => diffDocumentExtensions({
|
|
449
|
+
themeMode,
|
|
450
|
+
sidebar,
|
|
451
|
+
layout,
|
|
452
|
+
onLineComment
|
|
453
|
+
}), [
|
|
454
|
+
themeMode,
|
|
455
|
+
sidebar,
|
|
456
|
+
layout,
|
|
457
|
+
onLineComment
|
|
458
|
+
]);
|
|
459
|
+
const markdown = useMemo(() => spaceHeadings(value), [value]);
|
|
460
|
+
return /* @__PURE__ */ jsx(TextEditor, {
|
|
461
|
+
value: markdown,
|
|
462
|
+
extensions,
|
|
463
|
+
focusable: false,
|
|
464
|
+
classNames: "dx-expand overflow-hidden"
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
/** What the walkthrough tab shows before there is a walkthrough: the offer to write one, or its progress. */
|
|
468
|
+
var WalkthroughPlaceholder = ({ generating, onGenerate }) => {
|
|
469
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
470
|
+
return /* @__PURE__ */ jsxs(Layout.Flex, {
|
|
471
|
+
column: true,
|
|
472
|
+
center: true,
|
|
473
|
+
gap: "md",
|
|
474
|
+
classNames: "dx-expand",
|
|
475
|
+
children: [/* @__PURE__ */ jsx(Status.Empty, { children: t(generating ? "walkthrough-generating.message" : "no-walkthrough.message") }), !generating && /* @__PURE__ */ jsx(Button.Root, {
|
|
476
|
+
variant: "primary",
|
|
477
|
+
onClick: onGenerate,
|
|
478
|
+
children: t("generate-walkthrough.label")
|
|
479
|
+
})]
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/components/PullRequestFiles/PullRequestFiles.tsx
|
|
484
|
+
/**
|
|
485
|
+
* Every changed file, one at a time: the file's diff rendered as a walkthrough chunk, beside a rail
|
|
486
|
+
* listing the changed files as a tree the reader checks off as they go.
|
|
487
|
+
*/
|
|
488
|
+
var PullRequestFiles = ({ tree, file, reviewed, total, error, onSelect, onReviewedChange, onLineComment }) => {
|
|
489
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
490
|
+
const fence = useMemo(() => file && file.hunks.length > 0 ? diffFence(file) : void 0, [file]);
|
|
491
|
+
if (error) return /* @__PURE__ */ jsx(Status.Empty, {
|
|
492
|
+
icon: "ph--warning--regular",
|
|
493
|
+
classNames: "dx-expand",
|
|
494
|
+
children: error
|
|
495
|
+
});
|
|
496
|
+
if (!tree) return /* @__PURE__ */ jsx(Status.Empty, {
|
|
497
|
+
classNames: "dx-expand",
|
|
498
|
+
children: t("files-loading.message")
|
|
499
|
+
});
|
|
500
|
+
return /* @__PURE__ */ jsxs(Layout.Grid, {
|
|
501
|
+
grow: true,
|
|
502
|
+
cols: ["fill", "18rem"],
|
|
503
|
+
"data-testid": "pull-request.files",
|
|
504
|
+
children: [fence ? /* @__PURE__ */ jsx(WalkthroughView, {
|
|
505
|
+
value: fence,
|
|
506
|
+
onLineComment
|
|
507
|
+
}, file?.path) : /* @__PURE__ */ jsx(Status.Empty, {
|
|
508
|
+
classNames: "dx-expand",
|
|
509
|
+
children: t(file ? "file-no-diff.message" : "no-files.message")
|
|
510
|
+
}), /* @__PURE__ */ jsx(ScrollArea.Root, {
|
|
511
|
+
classNames: "border-s border-separator-subtle",
|
|
512
|
+
children: /* @__PURE__ */ jsxs(ScrollArea.Viewport, {
|
|
513
|
+
classNames: "p-2",
|
|
514
|
+
children: [/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(Field.Label, {
|
|
515
|
+
classNames: "px-2",
|
|
516
|
+
children: t("files-reviewed.label", {
|
|
517
|
+
reviewed: reviewed.size,
|
|
518
|
+
total
|
|
519
|
+
})
|
|
520
|
+
}) }), /* @__PURE__ */ jsx(FileTree, {
|
|
521
|
+
root: tree,
|
|
522
|
+
selected: file?.path,
|
|
523
|
+
reviewed,
|
|
524
|
+
onSelect,
|
|
525
|
+
onReviewedChange
|
|
526
|
+
})]
|
|
527
|
+
})
|
|
528
|
+
})]
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/components/PullRequestOverview/ArtifactPill.tsx
|
|
533
|
+
/** The leading icon for each kind of artifact. */
|
|
534
|
+
var artifactIcon = {
|
|
535
|
+
video: "ph--film-strip--regular",
|
|
536
|
+
image: "ph--image--regular",
|
|
537
|
+
file: "ph--file--regular"
|
|
538
|
+
};
|
|
539
|
+
/** The image or video itself, or nothing for a file the browser cannot show inline. */
|
|
540
|
+
var ArtifactMedia = ({ artifact, classNames }) => artifact.kind === "video" ? /* @__PURE__ */ jsx("video", {
|
|
541
|
+
src: artifact.url,
|
|
542
|
+
controls: true,
|
|
543
|
+
muted: true,
|
|
544
|
+
playsInline: true,
|
|
545
|
+
preload: "metadata",
|
|
546
|
+
className: ["block w-full bg-black rounded-sm", classNames].filter(Boolean).join(" "),
|
|
547
|
+
"data-testid": "pull-request.artifact.video"
|
|
548
|
+
}) : artifact.kind === "image" ? /* @__PURE__ */ jsx("img", {
|
|
549
|
+
src: artifact.url,
|
|
550
|
+
alt: artifact.label ?? artifact.name,
|
|
551
|
+
loading: "lazy",
|
|
552
|
+
className: ["block w-full object-contain rounded-sm", classNames].filter(Boolean).join(" "),
|
|
553
|
+
"data-testid": "pull-request.artifact.image"
|
|
554
|
+
}) : null;
|
|
555
|
+
/**
|
|
556
|
+
* An artifact link as a pill that previews its image or video in place, so a reader sees the demo
|
|
557
|
+
* without leaving the pull request. The outline matches the anchor chip a GitHub link becomes, so
|
|
558
|
+
* the body's links read as one kind of thing.
|
|
559
|
+
*/
|
|
560
|
+
var ArtifactPill = ({ artifact, children }) => {
|
|
561
|
+
const label = typeof children === "string" && children !== artifact.url ? children : artifact.name;
|
|
562
|
+
if (artifact.kind === "file") return /* @__PURE__ */ jsx("a", {
|
|
563
|
+
href: artifact.url,
|
|
564
|
+
target: "_blank",
|
|
565
|
+
rel: "noopener noreferrer",
|
|
566
|
+
className: "dx-tag-anchor",
|
|
567
|
+
children: label
|
|
568
|
+
});
|
|
569
|
+
return /* @__PURE__ */ jsxs(Popover.Root, {
|
|
570
|
+
autoFocus: false,
|
|
571
|
+
children: [/* @__PURE__ */ jsx(Popover.Trigger, {
|
|
572
|
+
asChild: true,
|
|
573
|
+
children: /* @__PURE__ */ jsx(Button.Root, {
|
|
574
|
+
hue: "neutral",
|
|
575
|
+
size: "sm",
|
|
576
|
+
classNames: "bg-input-surface text-fg font-normal ring-inset ring ring-neutral-border hover:bg-hover-surface hover:ring-info-border align-baseline",
|
|
577
|
+
icon: artifactIcon[artifact.kind],
|
|
578
|
+
iconClassNames: artifact.kind === "video" ? "text-violet-500" : "text-sky-500",
|
|
579
|
+
label,
|
|
580
|
+
"data-testid": "pull-request.artifact.pill"
|
|
581
|
+
})
|
|
582
|
+
}), /* @__PURE__ */ jsx(Popover.Content, {
|
|
583
|
+
classNames: "w-[min(40rem,90vw)]",
|
|
584
|
+
children: /* @__PURE__ */ jsx(Popover.Body, {
|
|
585
|
+
classNames: "p-1",
|
|
586
|
+
children: /* @__PURE__ */ jsx(ArtifactMedia, { artifact })
|
|
587
|
+
})
|
|
588
|
+
})]
|
|
589
|
+
});
|
|
590
|
+
};
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/components/PullRequestOverview/CheckRunList.tsx
|
|
593
|
+
var outcomeIcon = {
|
|
594
|
+
failure: {
|
|
595
|
+
icon: "ph--x-circle--fill",
|
|
596
|
+
classNames: "text-error-text"
|
|
597
|
+
},
|
|
598
|
+
pending: {
|
|
599
|
+
icon: "ph--circle-notch--regular",
|
|
600
|
+
classNames: "text-warning-text animate-spin"
|
|
601
|
+
},
|
|
602
|
+
success: {
|
|
603
|
+
icon: "ph--check-circle--fill",
|
|
604
|
+
classNames: "text-success-text"
|
|
605
|
+
},
|
|
606
|
+
neutral: {
|
|
607
|
+
icon: "ph--minus-circle--regular",
|
|
608
|
+
classNames: "text-fg-muted"
|
|
609
|
+
},
|
|
610
|
+
skipped: {
|
|
611
|
+
icon: "ph--prohibit--regular",
|
|
612
|
+
classNames: "text-fg-muted"
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
var outcomeOrder = [
|
|
616
|
+
"failure",
|
|
617
|
+
"pending",
|
|
618
|
+
"success",
|
|
619
|
+
"neutral",
|
|
620
|
+
"skipped"
|
|
621
|
+
];
|
|
622
|
+
/** `4m 12s`, or undefined for a run that has not both started and finished. */
|
|
623
|
+
var formatDuration = (startedAt, completedAt) => {
|
|
624
|
+
if (!startedAt || !completedAt) return;
|
|
625
|
+
const seconds = Math.max(0, Math.round((Date.parse(completedAt) - Date.parse(startedAt)) / 1e3));
|
|
626
|
+
if (Number.isNaN(seconds)) return;
|
|
627
|
+
const minutes = Math.floor(seconds / 60);
|
|
628
|
+
return minutes > 0 ? `${minutes}m ${seconds % 60}s` : `${seconds}s`;
|
|
629
|
+
};
|
|
630
|
+
/** Sorts runs by what needs attention, then by name so shards read in order. */
|
|
631
|
+
var sortCheckRuns = (runs) => [...runs].sort((a, b) => outcomeOrder.indexOf(a.outcome) - outcomeOrder.indexOf(b.outcome) || a.name.localeCompare(b.name, void 0, { numeric: true }));
|
|
632
|
+
/** Every check on the head commit: its outcome, how long it took, and its logs a click away. */
|
|
633
|
+
var CheckRunList = ({ runs }) => {
|
|
634
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
635
|
+
const sorted = useMemo(() => runs ? sortCheckRuns(runs) : void 0, [runs]);
|
|
636
|
+
const summary = useCheckSummary(runs);
|
|
637
|
+
if (!sorted || sorted.length === 0) return /* @__PURE__ */ jsx(Status.Empty, { children: t(sorted ? "no-checks.message" : "checks-loading.message") });
|
|
638
|
+
return /* @__PURE__ */ jsx(Listbox.Root, {
|
|
639
|
+
items: sorted.map((run) => ({
|
|
640
|
+
value: `${run.name}-${run.url ?? ""}`,
|
|
641
|
+
label: run.name
|
|
642
|
+
})),
|
|
643
|
+
children: /* @__PURE__ */ jsx(Listbox.Content, {
|
|
644
|
+
"aria-label": summary,
|
|
645
|
+
"data-testid": "pull-request.checks",
|
|
646
|
+
children: sorted.map((run) => {
|
|
647
|
+
const { icon, classNames } = outcomeIcon[run.outcome];
|
|
648
|
+
const duration = formatDuration(run.startedAt, run.completedAt);
|
|
649
|
+
const detail = run.conclusion && run.conclusion !== run.outcome && run.conclusion !== "failure" ? run.conclusion.replace(/_/g, " ") : void 0;
|
|
650
|
+
const outcome = run.outcome === "skipped" ? t("check-outcome.skipped.label") : duration ?? t(`check-outcome.${run.outcome}.label`);
|
|
651
|
+
const url = run.url;
|
|
652
|
+
return /* @__PURE__ */ jsxs(Listbox.Item, {
|
|
653
|
+
id: `${run.name}-${url ?? ""}`,
|
|
654
|
+
"data-outcome": run.outcome,
|
|
655
|
+
"data-testid": "pull-request.check",
|
|
656
|
+
onClick: url ? () => window.open(url, "_blank", "noopener,noreferrer") : void 0,
|
|
657
|
+
children: [
|
|
658
|
+
/* @__PURE__ */ jsx(Listbox.ItemIcon, {
|
|
659
|
+
icon,
|
|
660
|
+
classNames
|
|
661
|
+
}),
|
|
662
|
+
/* @__PURE__ */ jsx(Listbox.ItemText, { children: run.name }),
|
|
663
|
+
/* @__PURE__ */ jsx(Listbox.ItemDescription, { children: [detail, outcome].filter(Boolean).join(" · ") })
|
|
664
|
+
]
|
|
665
|
+
}, `${run.name}-${url ?? ""}`);
|
|
666
|
+
})
|
|
667
|
+
})
|
|
668
|
+
});
|
|
669
|
+
};
|
|
670
|
+
/** The label the checks section carries: the counts once there are runs to count. */
|
|
671
|
+
var useCheckSummary = (runs) => {
|
|
672
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
673
|
+
return useMemo(() => {
|
|
674
|
+
if (!runs || runs.length === 0) return t("checks.label");
|
|
675
|
+
const counts = {
|
|
676
|
+
success: 0,
|
|
677
|
+
failure: 0,
|
|
678
|
+
pending: 0,
|
|
679
|
+
skipped: 0,
|
|
680
|
+
neutral: 0
|
|
681
|
+
};
|
|
682
|
+
for (const run of runs) counts[run.outcome]++;
|
|
683
|
+
return t("checks-summary.label", {
|
|
684
|
+
passed: counts.success + counts.neutral,
|
|
685
|
+
failed: counts.failure,
|
|
686
|
+
pending: counts.pending,
|
|
687
|
+
skipped: counts.skipped
|
|
688
|
+
});
|
|
689
|
+
}, [runs, t]);
|
|
690
|
+
};
|
|
691
|
+
//#endregion
|
|
692
|
+
//#region src/components/PullRequestOverview/PullRequestDetails.tsx
|
|
693
|
+
/** What the overview's details section shows, as a read-only form: one row per fact about the pull request. */
|
|
694
|
+
var PullRequestDetailsSchema = Schema.Struct({
|
|
695
|
+
reference: Schema.String.annotate({ title: "Pull request" }),
|
|
696
|
+
state: Schema.optional(Schema.String.annotate({ title: "State" })),
|
|
697
|
+
checks: Schema.optional(Schema.String.annotate({ title: "Checks" })),
|
|
698
|
+
branches: Schema.optional(Schema.String.annotate({ title: "Branches" }))
|
|
699
|
+
});
|
|
700
|
+
var VIDEO_EXTENSIONS = [
|
|
701
|
+
"webm",
|
|
702
|
+
"mp4",
|
|
703
|
+
"mov",
|
|
704
|
+
"m4v",
|
|
705
|
+
"ogv"
|
|
706
|
+
];
|
|
707
|
+
var IMAGE_EXTENSIONS = [
|
|
708
|
+
"png",
|
|
709
|
+
"jpg",
|
|
710
|
+
"jpeg",
|
|
711
|
+
"gif",
|
|
712
|
+
"webp",
|
|
713
|
+
"svg",
|
|
714
|
+
"avif"
|
|
715
|
+
];
|
|
716
|
+
/** The artifact a URL names, or undefined when it is not in the artifacts bucket. */
|
|
717
|
+
var parseArtifactLink = (url) => {
|
|
718
|
+
let parsed;
|
|
719
|
+
try {
|
|
720
|
+
parsed = new URL(url);
|
|
721
|
+
} catch {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (parsed.protocol !== "https:" || parsed.hostname !== "pub-39066a86073446d7b77b1c157b660bb5.r2.dev") return;
|
|
725
|
+
const segment = parsed.pathname.split("/").at(-1) ?? "";
|
|
726
|
+
if (!segment) return;
|
|
727
|
+
const name = safeDecode(segment);
|
|
728
|
+
const extension = name.split(".").at(-1)?.toLowerCase() ?? "";
|
|
729
|
+
return {
|
|
730
|
+
url,
|
|
731
|
+
kind: VIDEO_EXTENSIONS.includes(extension) ? "video" : IMAGE_EXTENSIONS.includes(extension) ? "image" : "file",
|
|
732
|
+
name
|
|
733
|
+
};
|
|
734
|
+
};
|
|
735
|
+
var CLAUDE_SESSION = /https:\/\/claude\.ai\/code\/session_[A-Za-z0-9]+/;
|
|
736
|
+
var PREVIEW_BLOCK = /<!--\s*composer-preview:begin\s*-->([\s\S]*?)<!--\s*composer-preview:end\s*-->/;
|
|
737
|
+
var PREVIEW_LINE = /^\s*🚀\s*Composer preview:\s*(https?:\/\/\S+)\s*$/m;
|
|
738
|
+
var FOOTER_LINES = [
|
|
739
|
+
/^\s*🤖\s*Generated with \[?Claude Code\]?(\([^)]*\))?\s*$/,
|
|
740
|
+
/^\s*_?Generated by \[Claude Code\]\([^)]*\)_?\s*$/,
|
|
741
|
+
new RegExp(`^\\s*<?${CLAUDE_SESSION.source}>?\\s*$`)
|
|
742
|
+
];
|
|
743
|
+
var MARKDOWN_LINK = /!?\[([^\]]*)\]\((https?:\/\/[^\s)]+)\)/g;
|
|
744
|
+
var BARE_URL = /https?:\/\/[^\s)<>\]|]+/g;
|
|
745
|
+
/**
|
|
746
|
+
* Splits a pull request body into its prose and what the footers and links say.
|
|
747
|
+
*
|
|
748
|
+
* The footers are the harness's (`🤖 Generated with Claude Code` and the session URL) and CI's
|
|
749
|
+
* (the Composer preview block); the article shows them as cards, so they are taken out of the prose
|
|
750
|
+
* rather than rendered twice.
|
|
751
|
+
*/
|
|
752
|
+
var parsePullRequestBody = (body) => {
|
|
753
|
+
let text = (body ?? "").replace(/\r\n/g, "\n");
|
|
754
|
+
const sessionUrl = text.match(CLAUDE_SESSION)?.[0];
|
|
755
|
+
const hasClaudeFooter = FOOTER_LINES.slice(0, 2).some((pattern) => text.split("\n").some((line) => pattern.test(line)));
|
|
756
|
+
let previewUrl;
|
|
757
|
+
const block = text.match(PREVIEW_BLOCK);
|
|
758
|
+
if (block) {
|
|
759
|
+
previewUrl = block[1].match(PREVIEW_LINE)?.[1];
|
|
760
|
+
text = text.replace(PREVIEW_BLOCK, "");
|
|
761
|
+
}
|
|
762
|
+
const line = text.match(PREVIEW_LINE);
|
|
763
|
+
if (line) {
|
|
764
|
+
previewUrl ??= line[1];
|
|
765
|
+
text = text.replace(PREVIEW_LINE, "");
|
|
766
|
+
}
|
|
767
|
+
const lines = text.split("\n").filter((line) => !FOOTER_LINES.some((pattern) => pattern.test(line)));
|
|
768
|
+
while (lines.length > 0 && /^\s*(---+|\*\*\*+|___+)?\s*$/.test(lines[lines.length - 1])) lines.pop();
|
|
769
|
+
const markdown = lines.join("\n").trim();
|
|
770
|
+
return {
|
|
771
|
+
markdown,
|
|
772
|
+
...hasClaudeFooter || sessionUrl ? { claudeCode: sessionUrl ? { sessionUrl } : {} } : {},
|
|
773
|
+
...previewUrl ? { previewUrl } : {},
|
|
774
|
+
artifacts: findArtifacts(markdown)
|
|
775
|
+
};
|
|
776
|
+
};
|
|
777
|
+
/** Every artifact the prose links, in order of first mention. */
|
|
778
|
+
var findArtifacts = (markdown) => {
|
|
779
|
+
const found = /* @__PURE__ */ new Map();
|
|
780
|
+
const add = (url, label) => {
|
|
781
|
+
const artifact = found.has(url) ? void 0 : parseArtifactLink(url);
|
|
782
|
+
if (artifact) found.set(url, {
|
|
783
|
+
...artifact,
|
|
784
|
+
...label && label !== url ? { label } : {}
|
|
785
|
+
});
|
|
786
|
+
};
|
|
787
|
+
for (const [, label, url] of markdown.matchAll(MARKDOWN_LINK)) add(url, label);
|
|
788
|
+
for (const [url] of markdown.replace(MARKDOWN_LINK, "").matchAll(BARE_URL)) add(url);
|
|
789
|
+
return [...found.values()].sort((a, b) => markdown.indexOf(a.url) - markdown.indexOf(b.url));
|
|
790
|
+
};
|
|
791
|
+
var safeDecode = (segment) => {
|
|
792
|
+
try {
|
|
793
|
+
return decodeURIComponent(segment);
|
|
794
|
+
} catch {
|
|
795
|
+
return segment;
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
//#endregion
|
|
799
|
+
//#region src/components/PullRequestOverview/RelatedCards.tsx
|
|
800
|
+
/** What {@link RelatedCards} would show; empty when the pull request links to nothing beyond its diff. */
|
|
801
|
+
var useRelatedItems = ({ artifacts, claudeCode, previewUrl }) => {
|
|
802
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
803
|
+
return useMemo(() => {
|
|
804
|
+
const items = artifacts.map((artifact) => ({
|
|
805
|
+
kind: "artifact",
|
|
806
|
+
id: artifact.url,
|
|
807
|
+
artifact
|
|
808
|
+
}));
|
|
809
|
+
if (previewUrl) items.push({
|
|
810
|
+
kind: "link",
|
|
811
|
+
id: "preview",
|
|
812
|
+
icon: "ph--rocket-launch--regular",
|
|
813
|
+
iconClassNames: "text-success-text",
|
|
814
|
+
title: t("preview-deployment.label"),
|
|
815
|
+
href: previewUrl,
|
|
816
|
+
detail: hostOf(previewUrl)
|
|
817
|
+
});
|
|
818
|
+
if (claudeCode) items.push({
|
|
819
|
+
kind: "link",
|
|
820
|
+
id: "claude",
|
|
821
|
+
icon: "px--anthropic--regular",
|
|
822
|
+
iconClassNames: "text-warning-text",
|
|
823
|
+
title: claudeCode.sessionUrl ? t("claude-session.label") : t("claude-generated.label"),
|
|
824
|
+
href: claudeCode.sessionUrl,
|
|
825
|
+
detail: claudeCode.sessionUrl?.split("/").at(-1)
|
|
826
|
+
});
|
|
827
|
+
return items;
|
|
828
|
+
}, [
|
|
829
|
+
artifacts,
|
|
830
|
+
claudeCode,
|
|
831
|
+
previewUrl,
|
|
832
|
+
t
|
|
833
|
+
]);
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* What the pull request points at beyond its diff, one card each — its demo media, the preview
|
|
837
|
+
* deployment built from it, and the session that wrote it — in the masonry grid related objects
|
|
838
|
+
* use everywhere else. Renders inside its host's scroller rather than owning one.
|
|
839
|
+
*/
|
|
840
|
+
var RelatedCards = ({ items }) => /* @__PURE__ */ jsx(Masonry.Root, {
|
|
841
|
+
Tile: RelatedCard,
|
|
842
|
+
centered: false,
|
|
843
|
+
children: /* @__PURE__ */ jsx(Masonry.Viewport, {
|
|
844
|
+
items,
|
|
845
|
+
getId: (item) => item.id,
|
|
846
|
+
scroll: false
|
|
847
|
+
})
|
|
848
|
+
});
|
|
849
|
+
var RelatedCard = ({ data: item }) => {
|
|
850
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
851
|
+
if (item.kind === "link") return /* @__PURE__ */ jsxs(Card.Root, {
|
|
852
|
+
"data-testid": `pull-request.related.${item.id}`,
|
|
853
|
+
children: [/* @__PURE__ */ jsx(CardHeading, {
|
|
854
|
+
icon: item.icon,
|
|
855
|
+
iconClassNames: item.iconClassNames,
|
|
856
|
+
title: item.title,
|
|
857
|
+
href: item.href
|
|
858
|
+
}), item.detail && /* @__PURE__ */ jsx(Card.Row, { children: /* @__PURE__ */ jsx(Card.Text, {
|
|
859
|
+
variant: "muted",
|
|
860
|
+
truncate: true,
|
|
861
|
+
children: item.detail
|
|
862
|
+
}) })]
|
|
863
|
+
});
|
|
864
|
+
const { artifact } = item;
|
|
865
|
+
return /* @__PURE__ */ jsxs(Card.Root, {
|
|
866
|
+
"data-testid": "pull-request.related.artifact",
|
|
867
|
+
children: [
|
|
868
|
+
/* @__PURE__ */ jsx(CardHeading, {
|
|
869
|
+
icon: artifactIcon[artifact.kind],
|
|
870
|
+
title: artifact.label ?? t(`artifact-${artifact.kind}.label`),
|
|
871
|
+
href: artifact.url
|
|
872
|
+
}),
|
|
873
|
+
/* @__PURE__ */ jsx(Card.Row, { children: /* @__PURE__ */ jsx(Card.Text, {
|
|
874
|
+
variant: "muted",
|
|
875
|
+
truncate: true,
|
|
876
|
+
children: artifact.name
|
|
877
|
+
}) }),
|
|
878
|
+
artifact.kind !== "file" && /* @__PURE__ */ jsx(Card.Body, { children: /* @__PURE__ */ jsx(ArtifactMedia, {
|
|
879
|
+
artifact,
|
|
880
|
+
classNames: "col-span-3 aspect-video max-h-[200px] object-cover"
|
|
881
|
+
}) })
|
|
882
|
+
]
|
|
883
|
+
});
|
|
884
|
+
};
|
|
885
|
+
var CardHeading = ({ icon, iconClassNames, title, href }) => {
|
|
886
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
887
|
+
return /* @__PURE__ */ jsxs(Card.Header, { children: [
|
|
888
|
+
/* @__PURE__ */ jsx(Layout.Block, { children: /* @__PURE__ */ jsx(Icon.Icon, {
|
|
889
|
+
icon,
|
|
890
|
+
classNames: iconClassNames
|
|
891
|
+
}) }),
|
|
892
|
+
/* @__PURE__ */ jsx(Card.Title, { children: title }),
|
|
893
|
+
href && /* @__PURE__ */ jsx(Layout.Block, {
|
|
894
|
+
rail: "end",
|
|
895
|
+
children: /* @__PURE__ */ jsx(Button.Root, {
|
|
896
|
+
iconOnly: true,
|
|
897
|
+
variant: "ghost",
|
|
898
|
+
icon: "ph--arrow-square-out--regular",
|
|
899
|
+
label: t("open-link.label"),
|
|
900
|
+
onClick: () => window.open(href, "_blank", "noopener,noreferrer")
|
|
901
|
+
})
|
|
902
|
+
})
|
|
903
|
+
] });
|
|
904
|
+
};
|
|
905
|
+
var hostOf = (url) => {
|
|
906
|
+
try {
|
|
907
|
+
return new URL(url).host;
|
|
908
|
+
} catch {
|
|
909
|
+
return url;
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
//#endregion
|
|
913
|
+
//#region src/components/PullRequestOverview/PullRequestOverview.tsx
|
|
914
|
+
/**
|
|
915
|
+
* A pull request as its author presented it: the description, the facts about it, what it links to
|
|
916
|
+
* beyond the diff, and every check on its head commit.
|
|
917
|
+
*/
|
|
918
|
+
var PullRequestOverview = ({ body, details, runs }) => {
|
|
919
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
920
|
+
const parsed = useMemo(() => parsePullRequestBody(body), [body]);
|
|
921
|
+
const components = useBodyComponents();
|
|
922
|
+
const related = useRelatedItems(parsed);
|
|
923
|
+
const checkSummary = useCheckSummary(runs);
|
|
924
|
+
return /* @__PURE__ */ jsx(Form.Root, {
|
|
925
|
+
schema: PullRequestDetailsSchema,
|
|
926
|
+
values: details,
|
|
927
|
+
layout: "static",
|
|
928
|
+
readonly: true,
|
|
929
|
+
children: /* @__PURE__ */ jsx(Form.Viewport, {
|
|
930
|
+
scroll: true,
|
|
931
|
+
width: "document",
|
|
932
|
+
children: /* @__PURE__ */ jsxs(Form.Content, { children: [
|
|
933
|
+
parsed.markdown ? /* @__PURE__ */ jsx(MarkdownView, {
|
|
934
|
+
content: parsed.markdown,
|
|
935
|
+
components,
|
|
936
|
+
"data-testid": "pull-request.body"
|
|
937
|
+
}) : /* @__PURE__ */ jsx(Status.Empty, { children: t("no-description.message") }),
|
|
938
|
+
/* @__PURE__ */ jsx(Form.FieldSet, {
|
|
939
|
+
label: t("details.label"),
|
|
940
|
+
"data-testid": "pull-request.details",
|
|
941
|
+
children: /* @__PURE__ */ jsx(Form.Fields, {})
|
|
942
|
+
}),
|
|
943
|
+
related.length > 0 && /* @__PURE__ */ jsx(Form.FieldSet, {
|
|
944
|
+
label: t("related.label"),
|
|
945
|
+
children: /* @__PURE__ */ jsx(RelatedCards, { items: related })
|
|
946
|
+
}),
|
|
947
|
+
/* @__PURE__ */ jsx(Form.FieldSet, {
|
|
948
|
+
label: checkSummary,
|
|
949
|
+
children: /* @__PURE__ */ jsx(CheckRunList, { runs })
|
|
950
|
+
})
|
|
951
|
+
] })
|
|
952
|
+
})
|
|
953
|
+
});
|
|
954
|
+
};
|
|
955
|
+
/**
|
|
956
|
+
* Links in the body as pills: an artifact previews its media in place, and a link a preview
|
|
957
|
+
* resolver answers (another pull request, an issue) becomes the anchor chip the editor makes of it.
|
|
958
|
+
*/
|
|
959
|
+
var useBodyComponents = () => {
|
|
960
|
+
const resolvers = Hooks$1.useCapabilities(PreviewCapabilities.LinkResolver);
|
|
961
|
+
return useMemo(() => ({ a: ({ children, href, node: _node, ...props }) => {
|
|
962
|
+
const artifact = href ? parseArtifactLink(href) : void 0;
|
|
963
|
+
if (artifact) return /* @__PURE__ */ jsx(ArtifactPill, {
|
|
964
|
+
artifact,
|
|
965
|
+
children
|
|
966
|
+
});
|
|
967
|
+
const all = resolvers.flat();
|
|
968
|
+
if (!href || !PreviewCapabilities.isPreviewLink(all, href)) return /* @__PURE__ */ jsx(MarkdownLink, {
|
|
969
|
+
href,
|
|
970
|
+
...props,
|
|
971
|
+
children
|
|
972
|
+
});
|
|
973
|
+
const icon = PreviewCapabilities.linkIcon(all, href);
|
|
974
|
+
return /* @__PURE__ */ jsxs(DxAnchor, {
|
|
975
|
+
eid: href,
|
|
976
|
+
className: "dx-tag-anchor",
|
|
977
|
+
children: [icon && /* @__PURE__ */ jsx(Icon.Icon, {
|
|
978
|
+
icon: icon.icon,
|
|
979
|
+
size: "md",
|
|
980
|
+
classNames: ["inline-block align-[-0.125em] me-1", icon.classNames]
|
|
981
|
+
}), children === href ? PreviewCapabilities.linkLabel(all, href) ?? children : children]
|
|
982
|
+
});
|
|
983
|
+
} }), [resolvers]);
|
|
984
|
+
};
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region src/components/PullRequestStatus/PullRequestStatus.tsx
|
|
987
|
+
var stateHue = {
|
|
988
|
+
open: "green",
|
|
989
|
+
closed: "red",
|
|
990
|
+
merged: "purple",
|
|
991
|
+
draft: "neutral"
|
|
992
|
+
};
|
|
993
|
+
var reviewHue = {
|
|
994
|
+
approved: "green",
|
|
995
|
+
changes_requested: "red",
|
|
996
|
+
none: "neutral"
|
|
997
|
+
};
|
|
998
|
+
var ciHue = {
|
|
999
|
+
success: "green",
|
|
1000
|
+
failure: "red",
|
|
1001
|
+
pending: "amber",
|
|
1002
|
+
none: "neutral"
|
|
1003
|
+
};
|
|
1004
|
+
/** One line answering where the pull request stands: open or merged, approved or not, CI green or red. */
|
|
1005
|
+
var PullRequestStatus = ({ reference, title, state, review, ci }) => {
|
|
1006
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
1007
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1008
|
+
role: "status",
|
|
1009
|
+
className: "flex items-center gap-2 px-3 py-1.5 border-b border-separator-subtle text-sm min-w-0",
|
|
1010
|
+
"data-testid": "pull-request.status",
|
|
1011
|
+
children: [
|
|
1012
|
+
/* @__PURE__ */ jsx("span", {
|
|
1013
|
+
className: "dx-tag dx-tag-inline shrink-0",
|
|
1014
|
+
"data-hue": "neutral",
|
|
1015
|
+
children: reference
|
|
1016
|
+
}),
|
|
1017
|
+
title && /* @__PURE__ */ jsx("span", {
|
|
1018
|
+
className: "truncate grow",
|
|
1019
|
+
children: title
|
|
1020
|
+
}),
|
|
1021
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1022
|
+
className: "flex items-center gap-2 shrink-0 ml-auto",
|
|
1023
|
+
children: [
|
|
1024
|
+
state && /* @__PURE__ */ jsx("span", {
|
|
1025
|
+
className: "dx-tag dx-tag-inline",
|
|
1026
|
+
"data-hue": stateHue[state],
|
|
1027
|
+
"data-testid": "pull-request.status.state",
|
|
1028
|
+
children: t(`pull-request-state.${state}.label`)
|
|
1029
|
+
}),
|
|
1030
|
+
/* @__PURE__ */ jsx("span", {
|
|
1031
|
+
className: "dx-tag dx-tag-inline",
|
|
1032
|
+
"data-hue": review ? reviewHue[review.state] : "neutral",
|
|
1033
|
+
"data-testid": "pull-request.status.review",
|
|
1034
|
+
children: review ? t(`review-status.${review.state}.label`, { count: review.approvals }) : t("review-status.unknown.label")
|
|
1035
|
+
}),
|
|
1036
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1037
|
+
className: "dx-tag dx-tag-inline",
|
|
1038
|
+
"data-hue": ci ? ciHue[ci.state] : "neutral",
|
|
1039
|
+
"data-testid": "pull-request.status.ci",
|
|
1040
|
+
children: [ci ? t(`ci-status.${ci.state}.label`) : t("ci-status.unknown.label"), ci && ci.checks.total > 0 && ` ${ci.checks.passed}/${ci.checks.total}`]
|
|
1041
|
+
})
|
|
1042
|
+
]
|
|
1043
|
+
})
|
|
1044
|
+
]
|
|
1045
|
+
});
|
|
1046
|
+
};
|
|
1047
|
+
//#endregion
|
|
1048
|
+
//#region src/containers/PullRequestArticle/failure.ts
|
|
1049
|
+
/**
|
|
1050
|
+
* Names a pull-request action's failure so the user knows what to do about it.
|
|
1051
|
+
*
|
|
1052
|
+
* A rejected credential is the one failure the user can fix themselves, and it is indistinguishable
|
|
1053
|
+
* from any other error once it reaches the toast as `error.message` — GitHub answers it as a bare
|
|
1054
|
+
* `401`, which surfaces as `StatusCode: non 2xx status code (401 GET …)`. Matches the same
|
|
1055
|
+
* distinction `ImportPullRequestDialog` already draws on `tokenStatus`.
|
|
1056
|
+
*/
|
|
1057
|
+
var pullRequestFailureKey = (error, fallbackKey) => responseStatus(error) === 401 ? "github-token-rejected.title" : fallbackKey;
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region src/containers/PullRequestArticle/PullRequestArticle.tsx
|
|
1060
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-github/src/containers/PullRequestArticle/PullRequestArticle.tsx";
|
|
1061
|
+
var ciLabel = {
|
|
1062
|
+
success: "ci-status.success.label",
|
|
1063
|
+
failure: "ci-status.failure.label",
|
|
1064
|
+
pending: "ci-status.pending.label",
|
|
1065
|
+
none: "ci-status.none.label"
|
|
1066
|
+
};
|
|
1067
|
+
var TABS = [
|
|
1068
|
+
"overview",
|
|
1069
|
+
"walkthrough",
|
|
1070
|
+
"files"
|
|
1071
|
+
];
|
|
1072
|
+
/**
|
|
1073
|
+
* A pull request read as a review: its number, state and CI outcome above whatever narration the
|
|
1074
|
+
* space holds, with approving and commenting one click away. Everything GitHub-side goes through
|
|
1075
|
+
* the space's GitHub connection.
|
|
1076
|
+
*
|
|
1077
|
+
* The pull request is the subject rather than the walkthrough because one exists before the other
|
|
1078
|
+
* does: a pull request just imported has no narration yet, and generating it is an action ON the
|
|
1079
|
+
* pull request, not a different object to open.
|
|
1080
|
+
*/
|
|
1081
|
+
var PullRequestArticle = ({ role, attendableId, subject: pullRequest }) => {
|
|
1082
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
1083
|
+
const { invokePromise } = Hooks$1.useOperationInvoker();
|
|
1084
|
+
const [subject] = useObject(pullRequest);
|
|
1085
|
+
const db = Obj.getDatabase(pullRequest);
|
|
1086
|
+
const spaceId = db?.spaceId;
|
|
1087
|
+
const walkthroughs = useQuery(db, Filter.type(Walkthrough.Walkthrough, { pullRequest: Ref.make(pullRequest) }));
|
|
1088
|
+
const walkthrough = useMemo(() => newestWalkthrough(walkthroughs), [walkthroughs]);
|
|
1089
|
+
const walkthroughProgress = ToolkitHooks.useProgressMonitor(GitHubOperation.createWalkthroughProgressKey(pullRequest));
|
|
1090
|
+
const progressRegistry = Hooks$1.useOptionalCapability(AppCapabilities.ProgressRegistry);
|
|
1091
|
+
const [status, setStatus] = useState();
|
|
1092
|
+
const state = status?.state ?? subject.state;
|
|
1093
|
+
const [tab, setTab] = useState("overview");
|
|
1094
|
+
const [busy, setBusy] = useState(false);
|
|
1095
|
+
const [generating, setGenerating] = useState(false);
|
|
1096
|
+
const [composing, setComposing] = useState(false);
|
|
1097
|
+
const [comment, setComment] = useState("");
|
|
1098
|
+
const [lineTarget, setLineTarget] = useState();
|
|
1099
|
+
const lineAnchorRef = useRef(null);
|
|
1100
|
+
const openLineComment = useCallback((target, anchor, commit) => {
|
|
1101
|
+
lineAnchorRef.current = anchor;
|
|
1102
|
+
setLineTarget({
|
|
1103
|
+
target,
|
|
1104
|
+
commit
|
|
1105
|
+
});
|
|
1106
|
+
setComposing(true);
|
|
1107
|
+
}, []);
|
|
1108
|
+
const handleWalkthroughLineComment = useCallback((target, anchor) => walkthrough && openLineComment(target, anchor, walkthrough.commit), [walkthrough, openLineComment]);
|
|
1109
|
+
/** The toolbar's composer is about the pull request, so it drops whatever line was targeted. */
|
|
1110
|
+
const handleToggleComposer = useCallback(() => {
|
|
1111
|
+
setLineTarget(void 0);
|
|
1112
|
+
lineAnchorRef.current = null;
|
|
1113
|
+
setComposing((value) => value === false || lineTarget !== void 0);
|
|
1114
|
+
}, [lineTarget]);
|
|
1115
|
+
const handleCloseComposer = useCallback(() => {
|
|
1116
|
+
setComposing(false);
|
|
1117
|
+
setLineTarget(void 0);
|
|
1118
|
+
lineAnchorRef.current = null;
|
|
1119
|
+
}, []);
|
|
1120
|
+
const pullRequestRef = useMemo(() => Ref.make(pullRequest), [pullRequest]);
|
|
1121
|
+
const reference = PullRequest.reference(pullRequest);
|
|
1122
|
+
const diff = usePullRequestDiff(pullRequestRef, spaceId, tab === "files");
|
|
1123
|
+
const files = usePullRequestFiles(diff.diff, `${meta.profile.key}.reviewed.${reference}`);
|
|
1124
|
+
const { file, step, setReviewed } = files;
|
|
1125
|
+
const handleFilesLineComment = useCallback((target, anchor) => diff.commit && openLineComment(target, anchor, diff.commit), [diff.commit, openLineComment]);
|
|
1126
|
+
/** Checking a file off moves on to the next one, the way a reader works down the list. */
|
|
1127
|
+
const handleToggleReviewed = useCallback(() => {
|
|
1128
|
+
if (!file) return;
|
|
1129
|
+
const reviewed = !files.reviewed.has(file.path);
|
|
1130
|
+
setReviewed(file.path, reviewed);
|
|
1131
|
+
if (reviewed) step(1);
|
|
1132
|
+
}, [
|
|
1133
|
+
file,
|
|
1134
|
+
files.reviewed,
|
|
1135
|
+
setReviewed,
|
|
1136
|
+
step
|
|
1137
|
+
]);
|
|
1138
|
+
const refreshStatus = useCallback(async () => {
|
|
1139
|
+
const { data, error } = await invokePromise(GitHubOperation.GetPullRequestStatus, { pullRequest: pullRequestRef }, { spaceId });
|
|
1140
|
+
if (error) {
|
|
1141
|
+
log.warn("pull request status failed", { error }, {
|
|
1142
|
+
"~LogMeta": "~LogMeta",
|
|
1143
|
+
F: __dxlog_file,
|
|
1144
|
+
L: 167,
|
|
1145
|
+
S: void 0
|
|
1146
|
+
});
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
if (data) setStatus({
|
|
1150
|
+
state: data.state,
|
|
1151
|
+
body: data.body,
|
|
1152
|
+
ci: data.ci,
|
|
1153
|
+
checks: data.checks,
|
|
1154
|
+
runs: data.runs,
|
|
1155
|
+
review: data.review,
|
|
1156
|
+
approvals: data.approvals
|
|
1157
|
+
});
|
|
1158
|
+
}, [
|
|
1159
|
+
invokePromise,
|
|
1160
|
+
pullRequestRef,
|
|
1161
|
+
spaceId
|
|
1162
|
+
]);
|
|
1163
|
+
useEffect(() => {
|
|
1164
|
+
refreshStatus();
|
|
1165
|
+
}, [refreshStatus]);
|
|
1166
|
+
useSyncPullRequest(pullRequest);
|
|
1167
|
+
const toast = useCallback((id, title, success, description) => invokePromise(LayoutOperation.AddToast, {
|
|
1168
|
+
id: `${meta.profile.key}.${id}`,
|
|
1169
|
+
icon: success ? "ph--check-circle--regular" : "ph--warning--regular",
|
|
1170
|
+
title: [title, { ns: meta.profile.key }],
|
|
1171
|
+
...description ? { description } : {}
|
|
1172
|
+
}), [invokePromise]);
|
|
1173
|
+
/**
|
|
1174
|
+
* A rejected credential is the one failure the user can fix, so it names the fix and links to the
|
|
1175
|
+
* connection; any other failure shows the raw error under the action's own title.
|
|
1176
|
+
*/
|
|
1177
|
+
const failureToast = useCallback(async (id, fallbackKey, error) => {
|
|
1178
|
+
const key = pullRequestFailureKey(error, fallbackKey);
|
|
1179
|
+
if (key === fallbackKey || !db) return toast(id, key, false, error.message);
|
|
1180
|
+
const connection = (await EffectEx.runPromise(githubConnection().pipe(Effect.provide(Database.layer(db)), Effect.orElseSucceed(() => void 0))))?.connection;
|
|
1181
|
+
return invokePromise(LayoutOperation.AddToast, {
|
|
1182
|
+
id: `${meta.profile.key}.${id}`,
|
|
1183
|
+
icon: "ph--warning--regular",
|
|
1184
|
+
title: [key, { ns: meta.profile.key }],
|
|
1185
|
+
...connection ? {
|
|
1186
|
+
actionLabel: ["open-github-connection.label", { ns: meta.profile.key }],
|
|
1187
|
+
actionAlt: ["open-github-connection.label", { ns: meta.profile.key }],
|
|
1188
|
+
onAction: () => void invokePromise(LayoutOperation.Open, {
|
|
1189
|
+
subject: [Binding.connectionSubject(db.spaceId, connection.id)],
|
|
1190
|
+
navigation: "immediate"
|
|
1191
|
+
})
|
|
1192
|
+
} : {}
|
|
1193
|
+
});
|
|
1194
|
+
}, [
|
|
1195
|
+
db,
|
|
1196
|
+
invokePromise,
|
|
1197
|
+
toast
|
|
1198
|
+
]);
|
|
1199
|
+
const handleApprove = useCallback(async () => {
|
|
1200
|
+
setBusy(true);
|
|
1201
|
+
const { data, error } = await invokePromise(GitHubOperation.SubmitPullRequestApproval, { pullRequest: pullRequestRef }, { spaceId });
|
|
1202
|
+
setBusy(false);
|
|
1203
|
+
if (error) {
|
|
1204
|
+
log.warn("approve failed", { error }, {
|
|
1205
|
+
"~LogMeta": "~LogMeta",
|
|
1206
|
+
F: __dxlog_file,
|
|
1207
|
+
L: 248,
|
|
1208
|
+
S: void 0
|
|
1209
|
+
});
|
|
1210
|
+
await failureToast("approve", "approve-pull-request-error.title", error);
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
await toast("approve", data?.commented ? "approve-pull-request-commented.title" : "approve-pull-request-success.title", true);
|
|
1214
|
+
refreshStatus();
|
|
1215
|
+
}, [
|
|
1216
|
+
invokePromise,
|
|
1217
|
+
pullRequestRef,
|
|
1218
|
+
spaceId,
|
|
1219
|
+
toast,
|
|
1220
|
+
failureToast,
|
|
1221
|
+
refreshStatus
|
|
1222
|
+
]);
|
|
1223
|
+
/** `force` is what makes the toolbar's entry a REgeneration: the same head would otherwise no-op. */
|
|
1224
|
+
const handleGenerate = useCallback(async () => {
|
|
1225
|
+
setTab("walkthrough");
|
|
1226
|
+
setGenerating(true);
|
|
1227
|
+
const { error } = await invokePromise(GitHubOperation.GenerateWalkthrough, {
|
|
1228
|
+
pullRequest: pullRequestRef,
|
|
1229
|
+
force: walkthrough !== void 0
|
|
1230
|
+
}, { spaceId });
|
|
1231
|
+
setGenerating(false);
|
|
1232
|
+
if (error) {
|
|
1233
|
+
log.warn("walkthrough generation failed", { error }, {
|
|
1234
|
+
"~LogMeta": "~LogMeta",
|
|
1235
|
+
F: __dxlog_file,
|
|
1236
|
+
L: 272,
|
|
1237
|
+
S: void 0
|
|
1238
|
+
});
|
|
1239
|
+
await failureToast("walkthrough", "walkthrough-failed.title", error);
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
await toast("walkthrough", "walkthrough-ready.title", true);
|
|
1243
|
+
}, [
|
|
1244
|
+
invokePromise,
|
|
1245
|
+
pullRequestRef,
|
|
1246
|
+
spaceId,
|
|
1247
|
+
walkthrough,
|
|
1248
|
+
toast,
|
|
1249
|
+
failureToast
|
|
1250
|
+
]);
|
|
1251
|
+
const handleCopyLink = useCallback(async () => {
|
|
1252
|
+
if (!subject.url) return;
|
|
1253
|
+
try {
|
|
1254
|
+
await navigator.clipboard.writeText(subject.url);
|
|
1255
|
+
} catch (error) {
|
|
1256
|
+
log.warn("copy link failed", { error }, {
|
|
1257
|
+
"~LogMeta": "~LogMeta",
|
|
1258
|
+
F: __dxlog_file,
|
|
1259
|
+
L: 289,
|
|
1260
|
+
S: void 0
|
|
1261
|
+
});
|
|
1262
|
+
await toast("copy-link", "copy-link-error.title", false);
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
await toast("copy-link", "copy-link-success.title", true);
|
|
1266
|
+
}, [subject.url, toast]);
|
|
1267
|
+
const handleComment = useCallback(async () => {
|
|
1268
|
+
const text = comment.trim();
|
|
1269
|
+
if (!text) return;
|
|
1270
|
+
setBusy(true);
|
|
1271
|
+
const { error } = lineTarget ? await invokePromise(GitHubOperation.AddPullRequestReviewComment, {
|
|
1272
|
+
pullRequest: pullRequestRef,
|
|
1273
|
+
body: text,
|
|
1274
|
+
commit: lineTarget.commit,
|
|
1275
|
+
path: lineTarget.target.file,
|
|
1276
|
+
line: lineTarget.target.line,
|
|
1277
|
+
side: lineTarget.target.side === "before" ? "LEFT" : "RIGHT"
|
|
1278
|
+
}, { spaceId }) : await invokePromise(GitHubOperation.AddPullRequestComment, {
|
|
1279
|
+
pullRequest: pullRequestRef,
|
|
1280
|
+
body: text
|
|
1281
|
+
}, { spaceId });
|
|
1282
|
+
setBusy(false);
|
|
1283
|
+
if (error) {
|
|
1284
|
+
log.warn("comment failed", { error }, {
|
|
1285
|
+
"~LogMeta": "~LogMeta",
|
|
1286
|
+
F: __dxlog_file,
|
|
1287
|
+
L: 322,
|
|
1288
|
+
S: void 0
|
|
1289
|
+
});
|
|
1290
|
+
await failureToast("comment", "comment-error.title", error);
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
setComment("");
|
|
1294
|
+
handleCloseComposer();
|
|
1295
|
+
await toast("comment", "comment-success.title", true);
|
|
1296
|
+
}, [
|
|
1297
|
+
comment,
|
|
1298
|
+
lineTarget,
|
|
1299
|
+
invokePromise,
|
|
1300
|
+
pullRequestRef,
|
|
1301
|
+
spaceId,
|
|
1302
|
+
toast,
|
|
1303
|
+
failureToast,
|
|
1304
|
+
handleCloseComposer
|
|
1305
|
+
]);
|
|
1306
|
+
const tabs = useMemo(() => /* @__PURE__ */ jsx(Tabs.List, { children: TABS.map((value) => /* @__PURE__ */ jsx(Tabs.Trigger, {
|
|
1307
|
+
value,
|
|
1308
|
+
"data-testid": `pull-request.tab.${value}`,
|
|
1309
|
+
children: t(`${value}-tab.label`)
|
|
1310
|
+
}, value)) }), [t]);
|
|
1311
|
+
const fileReviewed = file !== void 0 && files.reviewed.has(file.path);
|
|
1312
|
+
const menuActions = useMenuBuilder(() => {
|
|
1313
|
+
const builder = MenuBuilder.make().action("tabs", {
|
|
1314
|
+
variant: "custom",
|
|
1315
|
+
label: ["views.label", { ns: meta.profile.key }],
|
|
1316
|
+
render: () => tabs
|
|
1317
|
+
}, () => {}).separator();
|
|
1318
|
+
if (tab === "files") builder.action("previousFile", {
|
|
1319
|
+
label: ["previous-file.label", { ns: meta.profile.key }],
|
|
1320
|
+
icon: "ph--caret-up--regular",
|
|
1321
|
+
disabled: !file,
|
|
1322
|
+
disposition: "toolbar",
|
|
1323
|
+
testId: "pull-request.toolbar.previous-file"
|
|
1324
|
+
}, () => step(-1)).action("nextFile", {
|
|
1325
|
+
label: ["next-file.label", { ns: meta.profile.key }],
|
|
1326
|
+
icon: "ph--caret-down--regular",
|
|
1327
|
+
disabled: !file,
|
|
1328
|
+
disposition: "toolbar",
|
|
1329
|
+
testId: "pull-request.toolbar.next-file"
|
|
1330
|
+
}, () => step(1)).action("reviewed", {
|
|
1331
|
+
label: ["file-reviewed.label", { ns: meta.profile.key }],
|
|
1332
|
+
icon: fileReviewed ? "ph--check-square--fill" : "ph--square--regular",
|
|
1333
|
+
iconOnly: false,
|
|
1334
|
+
disabled: !file,
|
|
1335
|
+
disposition: "toolbar",
|
|
1336
|
+
testId: "pull-request.toolbar.reviewed"
|
|
1337
|
+
}, () => handleToggleReviewed()).separator("line");
|
|
1338
|
+
return builder.action("approve", {
|
|
1339
|
+
label: ["approve-pull-request.label", { ns: meta.profile.key }],
|
|
1340
|
+
icon: "ph--check-circle--regular",
|
|
1341
|
+
variant: "primary",
|
|
1342
|
+
iconOnly: false,
|
|
1343
|
+
disabled: busy || state === "merged" || state === "closed",
|
|
1344
|
+
disposition: "toolbar",
|
|
1345
|
+
testId: "pull-request.toolbar.approve"
|
|
1346
|
+
}, () => void handleApprove()).action("comment", {
|
|
1347
|
+
label: ["comment-pull-request.label", { ns: meta.profile.key }],
|
|
1348
|
+
icon: "ph--chat-text--regular",
|
|
1349
|
+
disabled: busy,
|
|
1350
|
+
disposition: "toolbar",
|
|
1351
|
+
testId: "pull-request.toolbar.comment"
|
|
1352
|
+
}, () => handleToggleComposer()).separator("line").action("generateWalkthrough", {
|
|
1353
|
+
label: [walkthrough ? "regenerate-walkthrough.label" : "generate-walkthrough.label", { ns: meta.profile.key }],
|
|
1354
|
+
icon: "ph--path--regular",
|
|
1355
|
+
disabled: generating,
|
|
1356
|
+
disposition: "toolbar",
|
|
1357
|
+
testId: "pull-request.toolbar.generate-walkthrough"
|
|
1358
|
+
}, () => void handleGenerate()).action("openOnGitHub", {
|
|
1359
|
+
label: ["open-on-github.label", { ns: meta.profile.key }],
|
|
1360
|
+
icon: "ph--arrow-square-out--regular",
|
|
1361
|
+
disabled: !subject.url,
|
|
1362
|
+
disposition: "toolbar",
|
|
1363
|
+
testId: "pull-request.toolbar.open-on-github"
|
|
1364
|
+
}, () => subject.url && window.open(subject.url, "_blank", "noopener,noreferrer")).action("copyLink", {
|
|
1365
|
+
label: ["copy-link.label", { ns: meta.profile.key }],
|
|
1366
|
+
icon: "ph--link--regular",
|
|
1367
|
+
disabled: !subject.url,
|
|
1368
|
+
disposition: "toolbar",
|
|
1369
|
+
testId: "pull-request.toolbar.copy-link"
|
|
1370
|
+
}, () => void handleCopyLink()).build();
|
|
1371
|
+
}, [
|
|
1372
|
+
tabs,
|
|
1373
|
+
tab,
|
|
1374
|
+
file,
|
|
1375
|
+
fileReviewed,
|
|
1376
|
+
step,
|
|
1377
|
+
handleToggleReviewed,
|
|
1378
|
+
busy,
|
|
1379
|
+
generating,
|
|
1380
|
+
walkthrough,
|
|
1381
|
+
subject.url,
|
|
1382
|
+
state,
|
|
1383
|
+
handleApprove,
|
|
1384
|
+
handleGenerate,
|
|
1385
|
+
handleCopyLink,
|
|
1386
|
+
handleToggleComposer
|
|
1387
|
+
]);
|
|
1388
|
+
const details = useMemo(() => ({
|
|
1389
|
+
reference,
|
|
1390
|
+
state,
|
|
1391
|
+
checks: status ? `${t(ciLabel[status.ci])}${status.checks.total > 0 ? ` ${status.checks.passed}/${status.checks.total}` : ""}` : t("ci-status.unknown.label"),
|
|
1392
|
+
branches: subject.headBranch && (subject.baseBranch ? `${subject.headBranch} → ${subject.baseBranch}` : subject.headBranch)
|
|
1393
|
+
}), [
|
|
1394
|
+
reference,
|
|
1395
|
+
state,
|
|
1396
|
+
status,
|
|
1397
|
+
subject.headBranch,
|
|
1398
|
+
subject.baseBranch,
|
|
1399
|
+
t
|
|
1400
|
+
]);
|
|
1401
|
+
const composerProps = {
|
|
1402
|
+
value: comment,
|
|
1403
|
+
busy,
|
|
1404
|
+
onValueChange: setComment,
|
|
1405
|
+
onSubmit: () => void handleComment(),
|
|
1406
|
+
onCancel: handleCloseComposer
|
|
1407
|
+
};
|
|
1408
|
+
return /* @__PURE__ */ jsx(Tabs.Root, {
|
|
1409
|
+
asChild: true,
|
|
1410
|
+
orientation: "horizontal",
|
|
1411
|
+
value: tab,
|
|
1412
|
+
onValueChange: (value) => setTab(TABS.find((candidate) => candidate === value) ?? "overview"),
|
|
1413
|
+
children: /* @__PURE__ */ jsxs(Panel.Root, {
|
|
1414
|
+
role,
|
|
1415
|
+
children: [
|
|
1416
|
+
/* @__PURE__ */ jsx(Panel.Header, { children: /* @__PURE__ */ jsx(ActionToolbar, {
|
|
1417
|
+
...menuActions,
|
|
1418
|
+
attendableId,
|
|
1419
|
+
alwaysActive: true
|
|
1420
|
+
}) }),
|
|
1421
|
+
/* @__PURE__ */ jsx(Panel.Body, {
|
|
1422
|
+
asChild: true,
|
|
1423
|
+
children: /* @__PURE__ */ jsxs(Layout.Flex, {
|
|
1424
|
+
column: true,
|
|
1425
|
+
children: [
|
|
1426
|
+
/* @__PURE__ */ jsx(PullRequestStatus, {
|
|
1427
|
+
reference,
|
|
1428
|
+
title: subject.title,
|
|
1429
|
+
state,
|
|
1430
|
+
review: status && {
|
|
1431
|
+
state: status.review,
|
|
1432
|
+
approvals: status.approvals
|
|
1433
|
+
},
|
|
1434
|
+
ci: status && {
|
|
1435
|
+
state: status.ci,
|
|
1436
|
+
checks: status.checks
|
|
1437
|
+
}
|
|
1438
|
+
}),
|
|
1439
|
+
composing && !lineTarget && /* @__PURE__ */ jsx(CommentBand, { ...composerProps }),
|
|
1440
|
+
/* @__PURE__ */ jsx(LineCommentPopover, {
|
|
1441
|
+
...composerProps,
|
|
1442
|
+
open: composing && !!lineTarget,
|
|
1443
|
+
anchorRef: lineAnchorRef,
|
|
1444
|
+
target: lineTarget?.target
|
|
1445
|
+
}),
|
|
1446
|
+
tab === "overview" && /* @__PURE__ */ jsx(PullRequestOverview, {
|
|
1447
|
+
body: status?.body ?? subject.description,
|
|
1448
|
+
details,
|
|
1449
|
+
runs: status?.runs
|
|
1450
|
+
}),
|
|
1451
|
+
tab === "walkthrough" && (walkthrough ? /* @__PURE__ */ jsx(WalkthroughView, {
|
|
1452
|
+
value: walkthrough.body,
|
|
1453
|
+
sidebar: "full",
|
|
1454
|
+
onLineComment: handleWalkthroughLineComment
|
|
1455
|
+
}) : /* @__PURE__ */ jsx(WalkthroughPlaceholder, {
|
|
1456
|
+
generating,
|
|
1457
|
+
onGenerate: () => void handleGenerate()
|
|
1458
|
+
})),
|
|
1459
|
+
tab === "files" && /* @__PURE__ */ jsx(PullRequestFiles, {
|
|
1460
|
+
tree: files.tree,
|
|
1461
|
+
file,
|
|
1462
|
+
reviewed: files.reviewed,
|
|
1463
|
+
total: files.files.length,
|
|
1464
|
+
error: diff.error && t("files-error.message"),
|
|
1465
|
+
onSelect: files.select,
|
|
1466
|
+
onReviewedChange: setReviewed,
|
|
1467
|
+
onLineComment: diff.commit ? handleFilesLineComment : void 0
|
|
1468
|
+
})
|
|
1469
|
+
]
|
|
1470
|
+
})
|
|
1471
|
+
}),
|
|
1472
|
+
/* @__PURE__ */ jsx(Panel.Footer, {
|
|
1473
|
+
classNames: "border-t border-separator-subtle",
|
|
1474
|
+
children: /* @__PURE__ */ jsx(ProgressMeter, {
|
|
1475
|
+
state: walkthroughProgress?.status === "running" || walkthroughProgress?.status === "error" ? walkthroughProgress : void 0,
|
|
1476
|
+
onCancel: progressRegistry && walkthroughProgress ? () => progressRegistry.cancel(walkthroughProgress.name) : void 0
|
|
1477
|
+
})
|
|
1478
|
+
})
|
|
1479
|
+
]
|
|
1480
|
+
})
|
|
1481
|
+
});
|
|
1482
|
+
};
|
|
1483
|
+
//#endregion
|
|
1484
|
+
export { PullRequestArticle as t };
|
|
1485
|
+
|
|
1486
|
+
//# sourceMappingURL=chunk-PullRequestArticle.mjs.map
|