@dxos/plugin-github 0.7.4 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +784 -0
- package/dist/lib/GitHubCapabilities.mjs +10 -0
- package/dist/lib/GitHubCapabilities.mjs.map +1 -0
- package/dist/lib/GitHubEvents.mjs +15 -0
- package/dist/lib/GitHubEvents.mjs.map +1 -0
- package/dist/lib/GitHubOperation.mjs +384 -0
- package/dist/lib/GitHubOperation.mjs.map +1 -0
- package/dist/lib/GitHubPlugin.mjs +16 -0
- package/dist/lib/GitHubPlugin.mjs.map +1 -0
- package/dist/lib/Walkthrough.mjs +59 -0
- package/dist/lib/Walkthrough.mjs.map +1 -0
- package/dist/lib/capabilities.browser.mjs +54 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +54 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/capabilities.node.mjs +30 -0
- package/dist/lib/capabilities.node.mjs.map +1 -0
- package/dist/lib/capabilities.tauri.mjs +54 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs +30 -0
- package/dist/lib/capabilities.workerd.mjs.map +1 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs +116 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs.map +1 -0
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle.mjs +1506 -0
- package/dist/lib/chunk-PullRequestArticle.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle2.mjs +2 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs +123 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs +594 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs.map +1 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs +26 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs +19 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs +25 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +39 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-connector.mjs +70 -0
- package/dist/lib/chunk-connector.mjs.map +1 -0
- package/dist/lib/chunk-constants.mjs +11 -0
- package/dist/lib/chunk-constants.mjs.map +1 -0
- package/dist/lib/chunk-errors.mjs +29 -0
- package/dist/lib/chunk-errors.mjs.map +1 -0
- package/dist/lib/chunk-generate-walkthrough.mjs +86 -0
- package/dist/lib/chunk-generate-walkthrough.mjs.map +1 -0
- package/dist/lib/chunk-generate.mjs +719 -0
- package/dist/lib/chunk-generate.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs +25 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-status.mjs +29 -0
- package/dist/lib/chunk-get-pull-request-status.mjs.map +1 -0
- package/dist/lib/chunk-get-repositories.mjs +32 -0
- package/dist/lib/chunk-get-repositories.mjs.map +1 -0
- package/dist/lib/chunk-github-api.mjs +375 -0
- package/dist/lib/chunk-github-api.mjs.map +1 -0
- package/dist/lib/chunk-github-link.mjs +59 -0
- package/dist/lib/chunk-github-link.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs +25 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request.mjs +171 -0
- package/dist/lib/chunk-import-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-link-resolver.mjs +109 -0
- package/dist/lib/chunk-link-resolver.mjs.map +1 -0
- package/dist/lib/chunk-markdown-extension.mjs +92 -0
- package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
- package/dist/lib/chunk-materialize-target.mjs +36 -0
- package/dist/lib/chunk-materialize-target.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +12 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-page-action.mjs +22 -0
- package/dist/lib/chunk-page-action.mjs.map +1 -0
- package/dist/lib/chunk-pull-request.mjs +58 -0
- package/dist/lib/chunk-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-pull-request2.mjs +110 -0
- package/dist/lib/chunk-pull-request2.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +233 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-refresh-pull-requests.mjs +49 -0
- package/dist/lib/chunk-refresh-pull-requests.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/chunk-schema.mjs +15 -0
- package/dist/lib/chunk-schema.mjs.map +1 -0
- package/dist/lib/chunk-skill-definition.mjs +10 -0
- package/dist/lib/chunk-skill-definition.mjs.map +1 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs +56 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs.map +1 -0
- package/dist/lib/chunk-sync-pull-request.mjs +26 -0
- package/dist/lib/chunk-sync-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-sync.mjs +481 -0
- package/dist/lib/chunk-sync.mjs.map +1 -0
- package/dist/lib/chunk-useOpenObject.mjs +43 -0
- package/dist/lib/chunk-useOpenObject.mjs.map +1 -0
- package/dist/lib/extensions.mjs +132 -0
- package/dist/lib/extensions.mjs.map +1 -0
- package/dist/lib/index.mjs +4 -0
- package/dist/lib/meta.mjs +47 -0
- package/dist/lib/meta.mjs.map +1 -0
- package/dist/lib/ns/Extensions.mjs +18 -0
- package/dist/lib/ns/Extensions.mjs.map +1 -0
- package/dist/lib/operations.mjs +23 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/skills.mjs +44 -0
- package/dist/lib/skills.mjs.map +1 -0
- package/dist/lib/testing.mjs +189 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/translations.mjs +136 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +5 -0
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/Extensions.d.ts +2 -0
- package/dist/types/src/Extensions.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.d.ts +37 -0
- package/dist/types/src/GitHubPlugin.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts +2 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts.map +1 -0
- package/dist/types/src/approval.d.ts +21 -0
- package/dist/types/src/approval.d.ts.map +1 -0
- package/dist/types/src/approval.test.d.ts +2 -0
- package/dist/types/src/approval.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +9 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/connector.d.ts +17 -0
- package/dist/types/src/capabilities/connector.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/browser.d.ts +13 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts +13 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts +13 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts +13 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +13 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/link-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/link-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts +14 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +5 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/page-action.d.ts +5 -0
- package/dist/types/src/capabilities/page-action.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +12 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.d.ts +11 -0
- package/dist/types/src/cards/GitHubCard.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts +45 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts.map +1 -0
- package/dist/types/src/cards/PullRequestCard.d.ts +9 -0
- package/dist/types/src/cards/PullRequestCard.d.ts.map +1 -0
- package/dist/types/src/cards/index.d.ts +3 -0
- package/dist/types/src/cards/index.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts +30 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/index.d.ts +2 -0
- package/dist/types/src/components/CommentComposer/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts +8 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts +17 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts +23 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts +39 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts +5 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts +21 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts +18 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts +10 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts +16 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts +28 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts +6 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts +20 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts +2 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts +18 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts +16 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts +3 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +5 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +7 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts +6 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts +15 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts +10 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts +14 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts +13 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts +44 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts +3 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts +13 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts +2 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +157 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +3 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/links.d.ts +21 -0
- package/dist/types/src/extensions/links.d.ts.map +1 -0
- package/dist/types/src/extensions/links.test.d.ts +2 -0
- package/dist/types/src/extensions/links.test.d.ts.map +1 -0
- package/dist/types/src/extensions/references.d.ts +23 -0
- package/dist/types/src/extensions/references.d.ts.map +1 -0
- package/dist/types/src/extensions/references.test.d.ts +2 -0
- package/dist/types/src/extensions/references.test.d.ts.map +1 -0
- package/dist/types/src/github-link.d.ts +29 -0
- package/dist/types/src/github-link.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useOpenObject.d.ts +9 -0
- package/dist/types/src/hooks/useOpenObject.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts +10 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts +12 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts +22 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts +10 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +34 -11
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/add-pull-request-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-comment.d.ts.map +1 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts.map +1 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts +11 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts.map +1 -0
- package/dist/types/src/operations/get-repositories.d.ts +13 -0
- package/dist/types/src/operations/get-repositories.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts +12 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.d.ts +63 -0
- package/dist/types/src/operations/import-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/materialize-target.d.ts +12 -0
- package/dist/types/src/operations/materialize-target.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.d.ts +48 -0
- package/dist/types/src/operations/pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/refresh-pull-requests.d.ts +5 -0
- package/dist/types/src/operations/refresh-pull-requests.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.d.ts +37 -0
- package/dist/types/src/operations/refresh.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.test.d.ts +2 -0
- package/dist/types/src/operations/refresh.test.d.ts.map +1 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts +5 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts.map +1 -0
- package/dist/types/src/operations/sync-pull-request.d.ts +5 -0
- package/dist/types/src/operations/sync-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/sync.d.ts +123 -0
- package/dist/types/src/operations/sync.d.ts.map +1 -0
- package/dist/types/src/operations/sync.test.d.ts +2 -0
- package/dist/types/src/operations/sync.test.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/plugin.test.d.ts +2 -0
- package/dist/types/src/plugin.test.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.d.ts +37 -0
- package/dist/types/src/pull-request-body.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.test.d.ts +2 -0
- package/dist/types/src/pull-request-body.test.d.ts.map +1 -0
- package/dist/types/src/pull-request.d.ts +28 -0
- package/dist/types/src/pull-request.d.ts.map +1 -0
- package/dist/types/src/pull-request.test.d.ts +2 -0
- package/dist/types/src/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/services/github-api.d.ts +332 -0
- package/dist/types/src/services/github-api.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +2 -0
- package/dist/types/src/services/index.d.ts.map +1 -0
- package/dist/types/src/skills/GitHubSkill.d.ts +12 -0
- package/dist/types/src/skills/GitHubSkill.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/stories/Generate.stories.d.ts +27 -0
- package/dist/types/src/stories/Generate.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Links.stories.d.ts +23 -0
- package/dist/types/src/stories/Links.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts +359 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts +365 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts +367 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts +357 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts +380 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts.map +1 -0
- package/dist/types/src/stories/github.d.ts +23 -0
- package/dist/types/src/stories/github.d.ts.map +1 -0
- package/dist/types/src/stories/github.test.d.ts +2 -0
- package/dist/types/src/stories/github.test.d.ts.map +1 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts +8 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures.d.ts +14 -0
- package/dist/types/src/testing/fixtures.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/plugin.d.ts +4 -0
- package/dist/types/src/testing/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/pull-request-13348.d.ts +6 -0
- package/dist/types/src/testing/pull-request-13348.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +339 -53
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/GitHubCapabilities.d.ts +13 -0
- package/dist/types/src/types/GitHubCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/GitHubEvents.d.ts +8 -0
- package/dist/types/src/types/GitHubEvents.d.ts.map +1 -0
- package/dist/types/src/types/GitHubOperation.d.ts +281 -0
- package/dist/types/src/types/GitHubOperation.d.ts.map +1 -0
- package/dist/types/src/types/PullRequestsView.d.ts +35 -0
- package/dist/types/src/types/PullRequestsView.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.d.ts +31 -0
- package/dist/types/src/types/Walkthrough.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.test.d.ts +2 -0
- package/dist/types/src/types/Walkthrough.test.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.d.ts +28 -0
- package/dist/types/src/walkthrough/fill.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.test.d.ts +2 -0
- package/dist/types/src/walkthrough/fill.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.d.ts +67 -0
- package/dist/types/src/walkthrough/generate.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generate.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.d.ts +20 -0
- package/dist/types/src/walkthrough/generated.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generated.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.d.ts +8 -0
- package/dist/types/src/walkthrough/headings.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.test.d.ts +2 -0
- package/dist/types/src/walkthrough/headings.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/index.d.ts +9 -0
- package/dist/types/src/walkthrough/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/patch.d.ts +48 -0
- package/dist/types/src/walkthrough/patch.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.d.ts +55 -0
- package/dist/types/src/walkthrough/plan.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.test.d.ts +2 -0
- package/dist/types/src/walkthrough/plan.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.d.ts +33 -0
- package/dist/types/src/walkthrough/prompt.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts +2 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.d.ts +43 -0
- package/dist/types/src/walkthrough/score.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.test.d.ts +2 -0
- package/dist/types/src/walkthrough/score.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dx.config.ts +39 -0
- package/package.json +167 -48
- package/src/Extensions.ts +7 -0
- package/src/GitHubPlugin.ts +15 -0
- package/src/GitHubPlugin.workerd.test.ts +23 -0
- package/src/approval.test.ts +40 -0
- package/src/approval.ts +39 -0
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/connector.ts +95 -0
- package/src/capabilities/gen/browser.ts +82 -0
- package/src/capabilities/gen/node.ts +43 -0
- package/src/capabilities/gen/tauri.ts +82 -0
- package/src/capabilities/gen/workerd.ts +43 -0
- package/src/capabilities/index.ts +71 -0
- package/src/capabilities/link-resolver.ts +137 -0
- package/src/capabilities/markdown-extension.ts +146 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/page-action.ts +32 -0
- package/src/capabilities/react-surface.ts +98 -0
- package/src/capabilities/schema.ts +16 -0
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/cards/GitHubCard.stories.tsx +165 -0
- package/src/cards/GitHubCard.tsx +93 -0
- package/src/cards/PullRequestCard.tsx +23 -0
- package/src/cards/index.ts +6 -0
- package/src/components/CommentComposer/CommentComposer.tsx +109 -0
- package/src/components/CommentComposer/index.ts +5 -0
- package/src/components/PullRequestFiles/DiffStat.tsx +15 -0
- package/src/components/PullRequestFiles/FileTree.tsx +102 -0
- package/src/components/PullRequestFiles/PullRequestFiles.tsx +87 -0
- package/src/components/PullRequestFiles/files.test.ts +59 -0
- package/src/components/PullRequestFiles/files.ts +115 -0
- package/src/components/PullRequestFiles/index.ts +8 -0
- package/src/components/PullRequestOverview/ArtifactPill.tsx +82 -0
- package/src/components/PullRequestOverview/CheckRunList.test.ts +29 -0
- package/src/components/PullRequestOverview/CheckRunList.tsx +141 -0
- package/src/components/PullRequestOverview/PullRequestDetails.tsx +15 -0
- package/src/components/PullRequestOverview/PullRequestOverview.tsx +110 -0
- package/src/components/PullRequestOverview/RelatedCards.tsx +147 -0
- package/src/components/PullRequestOverview/index.ts +9 -0
- package/src/components/PullRequestStatus/PullRequestStatus.tsx +84 -0
- package/src/components/PullRequestStatus/index.ts +5 -0
- package/src/components/WalkthroughView/WalkthroughView.tsx +62 -0
- package/src/components/WalkthroughView/extensions.ts +53 -0
- package/src/components/WalkthroughView/index.ts +6 -0
- package/src/components/index.ts +6 -9
- package/src/constants.ts +12 -0
- package/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.tsx +160 -0
- package/src/containers/ImportPullRequestDialog/index.ts +7 -0
- package/src/containers/PullRequestArticle/PullRequestArticle.tsx +573 -0
- package/src/containers/PullRequestArticle/failure.test.ts +42 -0
- package/src/containers/PullRequestArticle/failure.ts +16 -0
- package/src/containers/PullRequestArticle/index.ts +5 -0
- package/src/containers/PullRequestCardMenu/PullRequestCardMenu.tsx +134 -0
- package/src/containers/PullRequestCardMenu/index.ts +5 -0
- package/src/containers/PullRequestsArticle/PullRequestsArticle.tsx +361 -0
- package/src/containers/PullRequestsArticle/arrange.test.ts +122 -0
- package/src/containers/PullRequestsArticle/arrange.ts +245 -0
- package/src/containers/PullRequestsArticle/format.ts +31 -0
- package/src/containers/PullRequestsArticle/index.ts +5 -0
- package/src/containers/WalkthroughArticle/WalkthroughArticle.tsx +31 -0
- package/src/containers/WalkthroughArticle/index.ts +5 -0
- package/src/containers/index.ts +11 -0
- package/src/errors.ts +61 -0
- package/src/extensions/index.ts +6 -0
- package/src/extensions/links.test.ts +133 -0
- package/src/extensions/links.ts +91 -0
- package/src/extensions/references.test.ts +83 -0
- package/src/extensions/references.ts +100 -0
- package/src/github-link.ts +70 -0
- package/src/hooks/index.ts +6 -3
- package/src/hooks/useOpenObject.ts +48 -0
- package/src/hooks/usePullRequestChecks.ts +81 -0
- package/src/hooks/usePullRequestDiff.ts +57 -0
- package/src/hooks/usePullRequestFiles.ts +98 -0
- package/src/hooks/useSyncPullRequest.ts +51 -0
- package/src/index.ts +4 -6
- package/src/meta.ts +8 -13
- package/src/operations/add-pull-request-comment.ts +31 -0
- package/src/operations/add-pull-request-review-comment.ts +32 -0
- package/src/operations/generate-walkthrough.ts +124 -0
- package/src/operations/get-pull-request-diff.ts +37 -0
- package/src/operations/get-pull-request-status.ts +44 -0
- package/src/operations/get-repositories.ts +53 -0
- package/src/operations/import-pull-request-from-snapshot.ts +48 -0
- package/src/operations/import-pull-request.test.ts +151 -0
- package/src/operations/import-pull-request.ts +149 -0
- package/src/operations/index.ts +30 -0
- package/src/operations/materialize-target.ts +60 -0
- package/src/operations/pull-request.test.ts +120 -0
- package/src/operations/pull-request.ts +141 -0
- package/src/operations/refresh-pull-requests.ts +69 -0
- package/src/operations/refresh.test.ts +112 -0
- package/src/operations/refresh.ts +111 -0
- package/src/operations/submit-pull-request-approval.ts +41 -0
- package/src/operations/sync-pull-request.ts +34 -0
- package/src/operations/sync.test.ts +453 -0
- package/src/operations/sync.ts +807 -0
- package/src/plugin.test.ts +40 -0
- package/src/plugin.ts +37 -0
- package/src/pull-request-body.test.ts +61 -0
- package/src/pull-request-body.ts +144 -0
- package/src/pull-request.test.ts +67 -0
- package/src/pull-request.ts +80 -0
- package/src/services/github-api.ts +735 -0
- package/src/services/index.ts +5 -0
- package/src/skills/GitHubSkill.ts +46 -0
- package/src/skills/index.ts +5 -0
- package/src/stories/Generate.stories.tsx +152 -0
- package/src/stories/Links.stories.tsx +153 -0
- package/src/stories/PullRequestArticle.stories.tsx +107 -0
- package/src/stories/PullRequestFiles.stories.tsx +69 -0
- package/src/stories/PullRequestOverview.stories.tsx +114 -0
- package/src/stories/PullRequestsArticle.stories.tsx +170 -0
- package/src/stories/Walkthrough.stories.tsx +110 -0
- package/src/stories/github.test.ts +65 -0
- package/src/stories/github.ts +70 -0
- package/src/stories/walkthrough-fixture.ts +115 -0
- package/src/testing/fixtures.ts +99 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/plugin.ts +25 -0
- package/src/testing/pull-request-13348.ts +104 -0
- package/src/testing/pull-request-13363.patch +2981 -0
- package/src/translations.ts +135 -63
- package/src/types/GitHubCapabilities.ts +27 -0
- package/src/types/GitHubEvents.ts +16 -0
- package/src/types/GitHubOperation.ts +397 -0
- package/src/types/PullRequestsView.ts +45 -0
- package/src/types/Walkthrough.test.ts +75 -0
- package/src/types/Walkthrough.ts +66 -0
- package/src/types/index.ts +8 -0
- package/src/vite-env.d.ts +15 -0
- package/src/walkthrough/fill.test.ts +337 -0
- package/src/walkthrough/fill.ts +246 -0
- package/src/walkthrough/generate.test.ts +219 -0
- package/src/walkthrough/generate.ts +248 -0
- package/src/walkthrough/generated.test.ts +70 -0
- package/src/walkthrough/generated.ts +70 -0
- package/src/walkthrough/headings.test.ts +40 -0
- package/src/walkthrough/headings.ts +39 -0
- package/src/walkthrough/index.ts +12 -0
- package/src/walkthrough/patch.ts +154 -0
- package/src/walkthrough/plan.test.ts +178 -0
- package/src/walkthrough/plan.ts +251 -0
- package/src/walkthrough/prompt.test.ts +100 -0
- package/src/walkthrough/prompt.ts +147 -0
- package/src/walkthrough/score.test.ts +272 -0
- package/src/walkthrough/score.ts +430 -0
- package/README.md +0 -15
- package/dist/lib/browser/chunk-S4MPSBA5.mjs +0 -21
- package/dist/lib/browser/chunk-S4MPSBA5.mjs.map +0 -7
- package/dist/lib/browser/index.css +0 -7
- package/dist/lib/browser/index.css.map +0 -7
- package/dist/lib/browser/index.mjs +0 -1535
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/meta.mjs +0 -11
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/GithubPlugin.d.ts +0 -4
- package/dist/types/src/GithubPlugin.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts +0 -4
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts +0 -9
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/index.d.ts +0 -2
- package/dist/types/src/components/EmbeddedMain/index.d.ts.map +0 -1
- package/dist/types/src/components/ExportDialog.d.ts +0 -8
- package/dist/types/src/components/ExportDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts +0 -15
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts +0 -7
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts +0 -16
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts +0 -11
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts.map +0 -1
- package/dist/types/src/components/ImportDialog.d.ts +0 -7
- package/dist/types/src/components/ImportDialog.d.ts.map +0 -1
- package/dist/types/src/components/Issue.d.ts +0 -5
- package/dist/types/src/components/Issue.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.d.ts +0 -15
- package/dist/types/src/components/Loading/Loading.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts +0 -40
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Loading/index.d.ts +0 -2
- package/dist/types/src/components/Loading/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownActions.d.ts +0 -7
- package/dist/types/src/components/MarkdownActions.d.ts.map +0 -1
- package/dist/types/src/components/UrlDialog.d.ts +0 -6
- package/dist/types/src/components/UrlDialog.d.ts.map +0 -1
- package/dist/types/src/hooks/useDocGhId.d.ts +0 -6
- package/dist/types/src/hooks/useDocGhId.d.ts.map +0 -1
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts +0 -2
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -30
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/GithubPlugin.tsx +0 -127
- package/src/components/EmbeddedMain/EmbeddedMain.tsx +0 -294
- package/src/components/EmbeddedMain/GfmPreview.tsx +0 -110
- package/src/components/EmbeddedMain/embedded.css +0 -3
- package/src/components/EmbeddedMain/index.ts +0 -5
- package/src/components/ExportDialog.tsx +0 -157
- package/src/components/GithubApiProviders/GitHubSettings.tsx +0 -72
- package/src/components/GithubApiProviders/OctokitProvider.tsx +0 -60
- package/src/components/GithubApiProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/DocumentTreeItem.tsx +0 -26
- package/src/components/GithubEchoResolverProviders/ResolverContext.tsx +0 -137
- package/src/components/GithubEchoResolverProviders/ResolverDialog.tsx +0 -34
- package/src/components/GithubEchoResolverProviders/ResolverProps.ts +0 -23
- package/src/components/GithubEchoResolverProviders/ResolverTree.tsx +0 -86
- package/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.tsx +0 -105
- package/src/components/GithubEchoResolverProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/spaceResolvers.ts +0 -86
- package/src/components/ImportDialog.tsx +0 -72
- package/src/components/Issue.tsx +0 -62
- package/src/components/Loading/Loading.stories.tsx +0 -32
- package/src/components/Loading/Loading.tsx +0 -70
- package/src/components/Loading/index.ts +0 -5
- package/src/components/MarkdownActions.tsx +0 -136
- package/src/components/UrlDialog.tsx +0 -52
- package/src/hooks/useDocGhId.ts +0 -38
- package/src/hooks/useGhIdFromUrl.ts +0 -26
- package/src/types.ts +0 -51
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { PullRequest } from '@dxos/types';
|
|
6
|
+
|
|
7
|
+
import { Walkthrough } from '#types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Schemas this plugin registers, in a module of their own so they are loaded on demand rather than
|
|
11
|
+
* from the plugin body's graph.
|
|
12
|
+
*
|
|
13
|
+
* `PullRequest` comes with `Walkthrough` because a walkthrough holds a ref to one, and a space that
|
|
14
|
+
* can read the walkthrough has to be able to resolve what it points at.
|
|
15
|
+
*/
|
|
16
|
+
export default [Walkthrough.Walkthrough, PullRequest.PullRequest];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import * as Capability from '@dxos/app-framework/Capability';
|
|
8
|
+
import * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';
|
|
9
|
+
|
|
10
|
+
import { GitHubSkill } from '#skills';
|
|
11
|
+
|
|
12
|
+
const skillDefinition = () => Effect.succeed([Capability.contribute(AppCapabilities.SkillDefinition, GitHubSkill)]);
|
|
13
|
+
|
|
14
|
+
export default skillDefinition;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
|
+
import { expect, within } from 'storybook/test';
|
|
8
|
+
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import * as ObjectCard from '@dxos/app-toolkit/ObjectCard';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
13
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
|
+
|
|
16
|
+
import { createIssue, createPullRequest, createRepo } from '../testing/index.ts';
|
|
17
|
+
import { GitHubCard } from './GitHubCard.tsx';
|
|
18
|
+
|
|
19
|
+
const subjects = {
|
|
20
|
+
repo: createRepo,
|
|
21
|
+
pr: createPullRequest,
|
|
22
|
+
issue: createIssue,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type StoryArgs = {
|
|
26
|
+
kind: keyof typeof subjects;
|
|
27
|
+
/** Replaces the subject's label, to try a title longer than the card. */
|
|
28
|
+
title?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The card as the popover hosts it: the host's header carries the label, the plugin's card the body.
|
|
33
|
+
* `dx-card-popover` is the deck popover's own sizing, so every kind renders at the same width.
|
|
34
|
+
*/
|
|
35
|
+
const DefaultStory = ({ kind, title }: StoryArgs) => {
|
|
36
|
+
const subject = useMemo(() => subjects[kind](), [kind]);
|
|
37
|
+
return (
|
|
38
|
+
<ObjectCard.Root classNames='dx-card-popover dx-card-min-width'>
|
|
39
|
+
<ObjectCard.Header subject={subject}>{title ?? Obj.getLabel(subject)}</ObjectCard.Header>
|
|
40
|
+
<GitHubCard role='card--content' subject={subject} />
|
|
41
|
+
</ObjectCard.Root>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const meta = {
|
|
46
|
+
title: 'plugins/plugin-github/cards/GitHubCard',
|
|
47
|
+
render: DefaultStory,
|
|
48
|
+
argTypes: {
|
|
49
|
+
kind: { control: 'select', options: Object.keys(subjects) },
|
|
50
|
+
},
|
|
51
|
+
decorators: [withTheme(), withLayout({ layout: 'centered' }), withPluginManager()],
|
|
52
|
+
parameters: { layout: 'centered' },
|
|
53
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
|
|
57
|
+
type Story = StoryObj<typeof meta>;
|
|
58
|
+
|
|
59
|
+
export const Repo: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
kind: 'repo',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const PullRequest: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
kind: 'pr',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const Issue: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
kind: 'issue',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** A title longer than the card stays on one line, truncated, as the popover and gallery show it. */
|
|
78
|
+
export const TestLongTitle: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
kind: 'pr',
|
|
81
|
+
title: 'plugin-tasks: order-by and group-by controls for the task list, with persistent filters',
|
|
82
|
+
},
|
|
83
|
+
play: async ({ canvasElement }) => {
|
|
84
|
+
const title = within(canvasElement).getByRole('heading');
|
|
85
|
+
const { lineHeight } = getComputedStyle(title);
|
|
86
|
+
// Under two lines tall (the box has padding, so not exactly one), and its text runs past the end.
|
|
87
|
+
await expect(title.getBoundingClientRect().height).toBeLessThan(2 * Number.parseFloat(lineHeight));
|
|
88
|
+
await expect(title.scrollWidth).toBeGreaterThan(title.clientWidth);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const LONG_TITLE =
|
|
93
|
+
'plugin-interlocutor: agents reachable from Discord threads, with a memory graph and an interview skill';
|
|
94
|
+
|
|
95
|
+
const LONG_DESCRIPTION = [
|
|
96
|
+
'## Summary',
|
|
97
|
+
'Adds `@dxos/plugin-agent`, a plugin that lets agents be reached from Discord threads. It keeps a memory graph per',
|
|
98
|
+
'thread and ships an interview skill, so the agent can gather requirements before it acts.',
|
|
99
|
+
'It also adds stories and a fixture for the interview flow.',
|
|
100
|
+
].join('\n\n');
|
|
101
|
+
|
|
102
|
+
/** The deck popover's host: the regular size, a header menu in the end rail, and the card body under it. */
|
|
103
|
+
const PopoverStory = () => {
|
|
104
|
+
const subject = useMemo(() => {
|
|
105
|
+
const pullRequest = createPullRequest();
|
|
106
|
+
Obj.update(pullRequest, (pullRequest) => {
|
|
107
|
+
pullRequest.description = LONG_DESCRIPTION;
|
|
108
|
+
});
|
|
109
|
+
return pullRequest;
|
|
110
|
+
}, []);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<div className='dx-scope' data-size='md'>
|
|
114
|
+
<ObjectCard.Root border={false} classNames='dx-card-popover dx-card-min-width'>
|
|
115
|
+
<ObjectCard.Header
|
|
116
|
+
subject={subject}
|
|
117
|
+
menu={
|
|
118
|
+
<Layout.Block rail='end'>
|
|
119
|
+
<Button.Root variant='ghost' icon='ph--dots-three-vertical--regular' iconOnly label='Actions' />
|
|
120
|
+
</Layout.Block>
|
|
121
|
+
}
|
|
122
|
+
>
|
|
123
|
+
{LONG_TITLE}
|
|
124
|
+
</ObjectCard.Header>
|
|
125
|
+
<GitHubCard role='card--content' subject={subject} />
|
|
126
|
+
</ObjectCard.Root>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* In the popover a long title stays on one line, the description wraps to at most three lines with its icon beside the
|
|
133
|
+
* first, and the card ends at its last row.
|
|
134
|
+
*/
|
|
135
|
+
export const TestPopover: Story = {
|
|
136
|
+
args: { kind: 'pr' },
|
|
137
|
+
render: () => <PopoverStory />,
|
|
138
|
+
play: async ({ canvasElement }) => {
|
|
139
|
+
const card = canvasElement.querySelector<HTMLElement>('.dx-card-popover');
|
|
140
|
+
await expect(card).not.toBeNull();
|
|
141
|
+
const title = within(canvasElement).getByRole('heading');
|
|
142
|
+
const lineHeight = Number.parseFloat(getComputedStyle(title).lineHeight);
|
|
143
|
+
await expect(title.getBoundingClientRect().height).toBeLessThan(2 * lineHeight);
|
|
144
|
+
await expect(title.scrollWidth).toBeGreaterThan(title.clientWidth);
|
|
145
|
+
|
|
146
|
+
const description = within(canvasElement).getByText(/^## Summary/);
|
|
147
|
+
const descriptionStyle = getComputedStyle(description);
|
|
148
|
+
const padding = Number.parseFloat(descriptionStyle.paddingTop) + Number.parseFloat(descriptionStyle.paddingBottom);
|
|
149
|
+
const lines = Math.round((description.clientHeight - padding) / Number.parseFloat(descriptionStyle.lineHeight));
|
|
150
|
+
await expect(lines).toBe(3);
|
|
151
|
+
const row = description.closest<HTMLElement>('.dx-card-row');
|
|
152
|
+
const icon = row?.querySelector<HTMLElement>('.dx-block, [data-rail="start"]');
|
|
153
|
+
await expect(
|
|
154
|
+
Math.abs((icon?.getBoundingClientRect().top ?? Number.NaN) - (row?.getBoundingClientRect().top ?? 0)),
|
|
155
|
+
).toBeLessThanOrEqual(1);
|
|
156
|
+
|
|
157
|
+
// As far below the last row as the header is below the top: no empty band at the foot.
|
|
158
|
+
const rows = Array.from(card?.querySelectorAll<HTMLElement>('.dx-card-row') ?? []);
|
|
159
|
+
const header = card?.querySelector<HTMLElement>('.dx-card-header');
|
|
160
|
+
const cardRect = card?.getBoundingClientRect();
|
|
161
|
+
const top = (header?.getBoundingClientRect().top ?? 0) - (cardRect?.top ?? 0);
|
|
162
|
+
const bottom = (cardRect?.bottom ?? 0) - (rows.at(-1)?.getBoundingClientRect().bottom ?? 0);
|
|
163
|
+
await expect(Math.abs(bottom - top)).toBeLessThanOrEqual(2);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
8
|
+
import * as Card from '@dxos/react-ui/Card';
|
|
9
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
10
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
11
|
+
import * as Tag from '@dxos/react-ui/Tag';
|
|
12
|
+
import { type Issue, type PullRequest, type Repo } from '@dxos/types';
|
|
13
|
+
|
|
14
|
+
import { meta } from '#meta';
|
|
15
|
+
|
|
16
|
+
type Subject = Repo.Repo | Issue.Issue | PullRequest.PullRequest;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* What the card reads off any of the three types: each field is present on some of them and
|
|
20
|
+
* optional here, so one render path shows whatever the subject carries.
|
|
21
|
+
*/
|
|
22
|
+
type Fields = {
|
|
23
|
+
owner: string;
|
|
24
|
+
number?: number;
|
|
25
|
+
state?: PullRequest.State;
|
|
26
|
+
author?: string;
|
|
27
|
+
additions?: number;
|
|
28
|
+
deletions?: number;
|
|
29
|
+
defaultBranch?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const stateHue: Record<PullRequest.State, Tag.TagHue> = {
|
|
35
|
+
open: 'green',
|
|
36
|
+
closed: 'red',
|
|
37
|
+
merged: 'purple',
|
|
38
|
+
draft: 'neutral',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Card content for a repository, pull request or issue: reference, state or branch, author, diff size, description and
|
|
43
|
+
* the link out. Each row leads with an icon in the card's start rail, so the text lines up with the title.
|
|
44
|
+
*/
|
|
45
|
+
export const GitHubCard = ({ subject }: AppSurface.ObjectCardProps<Subject>) => {
|
|
46
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
47
|
+
const { owner, number, state, author, additions, deletions, defaultBranch, description, url }: Fields = subject;
|
|
48
|
+
const name = 'name' in subject ? subject.name : subject.repo;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Card.Body>
|
|
52
|
+
<Card.Row
|
|
53
|
+
icon='ph--github-logo--regular'
|
|
54
|
+
trailing={
|
|
55
|
+
state ? (
|
|
56
|
+
<Tag.Tag hue={stateHue[state]}>{state}</Tag.Tag>
|
|
57
|
+
) : defaultBranch ? (
|
|
58
|
+
<Tag.Tag hue='neutral'>{defaultBranch}</Tag.Tag>
|
|
59
|
+
) : undefined
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
<Card.Text variant='muted'>{[`${owner}/${name}`, number].filter(Boolean).join('#')}</Card.Text>
|
|
63
|
+
</Card.Row>
|
|
64
|
+
{author && (
|
|
65
|
+
<Card.Row icon='ph--user--regular'>
|
|
66
|
+
<Card.Text variant='muted'>{author}</Card.Text>
|
|
67
|
+
</Card.Row>
|
|
68
|
+
)}
|
|
69
|
+
{(additions !== undefined || deletions !== undefined) && (
|
|
70
|
+
<Card.Row icon='ph--plus-minus--regular'>
|
|
71
|
+
<Layout.Flex gap='sm' align='center'>
|
|
72
|
+
{additions !== undefined && <span className='text-green-500'>+{additions}</span>}
|
|
73
|
+
{deletions !== undefined && <span className='text-red-500'>−{deletions}</span>}
|
|
74
|
+
</Layout.Flex>
|
|
75
|
+
</Card.Row>
|
|
76
|
+
)}
|
|
77
|
+
{description && (
|
|
78
|
+
<Card.Row icon='ph--text-align-left--regular'>
|
|
79
|
+
<Card.Text lines={3} variant='muted'>
|
|
80
|
+
{description}
|
|
81
|
+
</Card.Text>
|
|
82
|
+
</Card.Row>
|
|
83
|
+
)}
|
|
84
|
+
{url && (
|
|
85
|
+
<Card.Row icon='ph--arrow-square-out--regular'>
|
|
86
|
+
<a className='dx-link-accent' href={url} target='_blank' rel='noopener noreferrer'>
|
|
87
|
+
{t('open-on-github.label')}
|
|
88
|
+
</a>
|
|
89
|
+
</Card.Row>
|
|
90
|
+
)}
|
|
91
|
+
</Card.Body>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
8
|
+
import { useObject } from '@dxos/echo-react';
|
|
9
|
+
import { type PullRequest } from '@dxos/types';
|
|
10
|
+
|
|
11
|
+
import { useSyncPullRequest } from '../hooks/index.ts';
|
|
12
|
+
import { GitHubCard } from './GitHubCard.tsx';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A pull request's card, re-synced from GitHub whenever it is shown: the card is often where a stale
|
|
16
|
+
* pull request is first read, e.g. in a task list's popover.
|
|
17
|
+
*/
|
|
18
|
+
export const PullRequestCard = ({ role, subject }: AppSurface.ObjectCardProps<PullRequest.PullRequest>) => {
|
|
19
|
+
// Subscribed so the fields the sync writes back re-render the card.
|
|
20
|
+
useObject(subject);
|
|
21
|
+
useSyncPullRequest(subject);
|
|
22
|
+
return <GitHubCard role={role} subject={subject} />;
|
|
23
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type KeyboardEvent, type RefObject, useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
8
|
+
import * as Field from '@dxos/react-ui/Field';
|
|
9
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
10
|
+
import * as Input from '@dxos/react-ui/Input';
|
|
11
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
12
|
+
import * as Popover from '@dxos/react-ui/Popover';
|
|
13
|
+
import * as VirtualAnchor from '@dxos/react-ui/VirtualAnchor';
|
|
14
|
+
import { type DiffLineTarget } from '@dxos/ui-editor';
|
|
15
|
+
|
|
16
|
+
import { meta } from '#meta';
|
|
17
|
+
|
|
18
|
+
export type CommentComposerProps = {
|
|
19
|
+
value: string;
|
|
20
|
+
busy?: boolean;
|
|
21
|
+
/** The diff line the comment is addressed to, named above the field; absent for a pull request comment. */
|
|
22
|
+
target?: DiffLineTarget;
|
|
23
|
+
onValueChange: (value: string) => void;
|
|
24
|
+
onSubmit: () => void;
|
|
25
|
+
onCancel: () => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The comment field, its target and its buttons — rendered as a band under the pull request header
|
|
30
|
+
* when the comment is about the pull request, and inside {@link LineCommentPopover} when it is
|
|
31
|
+
* about one line of a diff.
|
|
32
|
+
*/
|
|
33
|
+
export const CommentComposer = ({ value, busy, target, onValueChange, onSubmit, onCancel }: CommentComposerProps) => {
|
|
34
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
35
|
+
|
|
36
|
+
// Cmd/Ctrl+Enter submits, matching GitHub's own comment form.
|
|
37
|
+
const handleKeyDown = useCallback(
|
|
38
|
+
(event: KeyboardEvent<HTMLTextAreaElement>) => {
|
|
39
|
+
if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
if (!busy && value.trim()) {
|
|
42
|
+
onSubmit();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[busy, value, onSubmit],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
{target && (
|
|
52
|
+
<span className='text-sm text-fg-muted'>
|
|
53
|
+
{t('comment-line.label', { file: target.file, line: target.line })}
|
|
54
|
+
</span>
|
|
55
|
+
)}
|
|
56
|
+
<Field.Root>
|
|
57
|
+
<Input.Textarea
|
|
58
|
+
autoFocus
|
|
59
|
+
rows={4}
|
|
60
|
+
placeholder={t('comment-placeholder.label')}
|
|
61
|
+
value={value}
|
|
62
|
+
onChange={(event) => onValueChange(event.target.value)}
|
|
63
|
+
onKeyDown={handleKeyDown}
|
|
64
|
+
/>
|
|
65
|
+
</Field.Root>
|
|
66
|
+
<Layout.Flex justify='end' gap='sm'>
|
|
67
|
+
<Button.Root onClick={onCancel}>{t('comment-cancel.label')}</Button.Root>
|
|
68
|
+
<Button.Root variant='primary' disabled={busy || !value.trim()} onClick={onSubmit}>
|
|
69
|
+
{t('comment-submit.label')}
|
|
70
|
+
</Button.Root>
|
|
71
|
+
</Layout.Flex>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** The composer as a band under the toolbar, for a comment on the pull request as a whole. */
|
|
77
|
+
export const CommentBand = (props: CommentComposerProps) => (
|
|
78
|
+
<Layout.Flex column gap='sm' classNames='p-3 border-b border-separator'>
|
|
79
|
+
<CommentComposer {...props} />
|
|
80
|
+
</Layout.Flex>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export type LineCommentPopoverProps = CommentComposerProps & {
|
|
84
|
+
open: boolean;
|
|
85
|
+
/** The diff line's comment button, which CodeMirror owns; the popover is positioned at it. */
|
|
86
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The composer floated at the diff line it addresses, so the reader reads the comment against the
|
|
91
|
+
* code it is about rather than against a band at the other end of the document.
|
|
92
|
+
*/
|
|
93
|
+
export const LineCommentPopover = ({ open, anchorRef, ...props }: LineCommentPopoverProps) => (
|
|
94
|
+
<Popover.Root
|
|
95
|
+
open={open}
|
|
96
|
+
onOpenChange={({ open: next }) => {
|
|
97
|
+
if (!next) {
|
|
98
|
+
props.onCancel();
|
|
99
|
+
}
|
|
100
|
+
}}
|
|
101
|
+
positioning={{ ...VirtualAnchor.virtualAnchor(anchorRef), placement: 'bottom-start' }}
|
|
102
|
+
>
|
|
103
|
+
<Popover.Content classNames='w-[28rem] max-w-[90cqi]'>
|
|
104
|
+
<Popover.Body classNames='flex flex-col gap-2 p-2'>
|
|
105
|
+
<CommentComposer {...props} />
|
|
106
|
+
</Popover.Body>
|
|
107
|
+
</Popover.Content>
|
|
108
|
+
</Popover.Root>
|
|
109
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
export type DiffStatProps = { added: number; removed: number };
|
|
8
|
+
|
|
9
|
+
/** `+12 -3`, coloured as the diff gutters are, with a zero count left out. */
|
|
10
|
+
export const DiffStat = ({ added, removed }: DiffStatProps) => (
|
|
11
|
+
<span className='flex items-center gap-1 ps-2 text-xs tabular-nums whitespace-nowrap'>
|
|
12
|
+
{added > 0 && <span className='text-(--color-cm-diff-add-gutter)'>+{added}</span>}
|
|
13
|
+
{removed > 0 && <span className='text-(--color-cm-diff-remove-gutter)'>-{removed}</span>}
|
|
14
|
+
</span>
|
|
15
|
+
);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Tree, type TreeNode, type TreeSelectEvent, createStaticTreeModel } from '@dxos/react-ui-list';
|
|
8
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
9
|
+
import * as Input from '@dxos/react-ui/Input';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import { DiffStat } from './DiffStat.tsx';
|
|
14
|
+
import { type FileNode } from './files.ts';
|
|
15
|
+
|
|
16
|
+
export type FileTreeProps = {
|
|
17
|
+
root: FileNode;
|
|
18
|
+
/** Path of the file on screen. */
|
|
19
|
+
selected?: string;
|
|
20
|
+
/** Paths of the files the reader has checked off. */
|
|
21
|
+
reviewed: ReadonlySet<string>;
|
|
22
|
+
onSelect: (path: string) => void;
|
|
23
|
+
onReviewedChange: (path: string, reviewed: boolean) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The changed files as a tree: a checkbox per file to mark it reviewed, its change counts at the
|
|
28
|
+
* trailing edge, and the file on screen as the current row.
|
|
29
|
+
*/
|
|
30
|
+
export const FileTree = ({ root, selected, reviewed, onSelect, onReviewedChange }: FileTreeProps) => {
|
|
31
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
32
|
+
// The model is rebuilt whenever the selection moves, so the reader's collapses live outside it.
|
|
33
|
+
const [closed, setClosed] = useState<ReadonlySet<string>>(() => new Set());
|
|
34
|
+
|
|
35
|
+
const model = useMemo(
|
|
36
|
+
() =>
|
|
37
|
+
createStaticTreeModel<FileNode>(root, {
|
|
38
|
+
getChildren: (node) => node.children,
|
|
39
|
+
// `count` off: the counts that matter here are the change counts in the trailing column.
|
|
40
|
+
getProps: (node) => ({ label: node.name, count: undefined, testId: 'pull-request.files.row' }),
|
|
41
|
+
isOpen: (node) => !closed.has(node.id),
|
|
42
|
+
isCurrent: (node) => node.file !== undefined && node.path === selected,
|
|
43
|
+
}),
|
|
44
|
+
[root, selected, closed],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const handleOpenChange = useCallback(
|
|
48
|
+
({ item, open }: { item: FileNode; open: boolean }) =>
|
|
49
|
+
setClosed((previous) => {
|
|
50
|
+
const next = new Set(previous);
|
|
51
|
+
if (open) {
|
|
52
|
+
next.delete(item.id);
|
|
53
|
+
} else {
|
|
54
|
+
next.add(item.id);
|
|
55
|
+
}
|
|
56
|
+
return next;
|
|
57
|
+
}),
|
|
58
|
+
[],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const handleSelect = useCallback(
|
|
62
|
+
({ item }: TreeSelectEvent<FileNode>) => {
|
|
63
|
+
if (item.file) {
|
|
64
|
+
onSelect(item.path);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[onSelect],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const renderRow = useCallback(
|
|
71
|
+
(node: TreeNode<FileNode>) => {
|
|
72
|
+
const item = node.item;
|
|
73
|
+
return (
|
|
74
|
+
<Tree.Item node={node}>
|
|
75
|
+
<Tree.ItemIndicator />
|
|
76
|
+
<Tree.ItemIcon icon={item?.file ? undefined : 'ph--folder--regular'}>
|
|
77
|
+
{item?.file && (
|
|
78
|
+
<Input.Checkbox
|
|
79
|
+
checked={reviewed.has(item.path)}
|
|
80
|
+
onCheckedChange={({ checked }) => onReviewedChange(item.path, checked === true)}
|
|
81
|
+
// Checking a file off is not a request to open it.
|
|
82
|
+
onClick={(event) => event.stopPropagation()}
|
|
83
|
+
aria-label={t('file-reviewed.label')}
|
|
84
|
+
data-testid='pull-request.files.reviewed'
|
|
85
|
+
/>
|
|
86
|
+
)}
|
|
87
|
+
</Tree.ItemIcon>
|
|
88
|
+
<Tree.ItemText />
|
|
89
|
+
{item && <DiffStat added={item.added} removed={item.removed} />}
|
|
90
|
+
</Tree.Item>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
[reviewed, onReviewedChange, t],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Tree.Root id={root.id} model={model} size='sm' onOpenChange={handleOpenChange} onSelect={handleSelect}>
|
|
98
|
+
<Tree.Label srOnly>{t('files-tree.label')}</Tree.Label>
|
|
99
|
+
<Tree.Content>{renderRow}</Tree.Content>
|
|
100
|
+
</Tree.Root>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import * as Field from '@dxos/react-ui/Field';
|
|
8
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
9
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
10
|
+
import * as ScrollArea from '@dxos/react-ui/ScrollArea';
|
|
11
|
+
import * as Status from '@dxos/react-ui/Status';
|
|
12
|
+
import { type DiffLineTarget } from '@dxos/ui-editor';
|
|
13
|
+
|
|
14
|
+
import { meta } from '#meta';
|
|
15
|
+
|
|
16
|
+
import { type PatchFile } from '../../walkthrough/patch.ts';
|
|
17
|
+
import { WalkthroughView } from '../WalkthroughView/index.ts';
|
|
18
|
+
import { type FileNode, diffFence } from './files.ts';
|
|
19
|
+
import { FileTree } from './FileTree.tsx';
|
|
20
|
+
|
|
21
|
+
export type PullRequestFilesProps = {
|
|
22
|
+
/** Undefined while the diff is loading. */
|
|
23
|
+
tree?: FileNode;
|
|
24
|
+
/** The file on screen. */
|
|
25
|
+
file?: PatchFile;
|
|
26
|
+
reviewed: ReadonlySet<string>;
|
|
27
|
+
total: number;
|
|
28
|
+
/** Shown in place of the files when the diff could not be read. */
|
|
29
|
+
error?: string;
|
|
30
|
+
onSelect: (path: string) => void;
|
|
31
|
+
onReviewedChange: (path: string, reviewed: boolean) => void;
|
|
32
|
+
onLineComment?: (target: DiffLineTarget, anchor: HTMLElement) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Every changed file, one at a time: the file's diff rendered as a walkthrough chunk, beside a rail
|
|
37
|
+
* listing the changed files as a tree the reader checks off as they go.
|
|
38
|
+
*/
|
|
39
|
+
export const PullRequestFiles = ({
|
|
40
|
+
tree,
|
|
41
|
+
file,
|
|
42
|
+
reviewed,
|
|
43
|
+
total,
|
|
44
|
+
error,
|
|
45
|
+
onSelect,
|
|
46
|
+
onReviewedChange,
|
|
47
|
+
onLineComment,
|
|
48
|
+
}: PullRequestFilesProps) => {
|
|
49
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
50
|
+
const fence = useMemo(() => (file && file.hunks.length > 0 ? diffFence(file) : undefined), [file]);
|
|
51
|
+
|
|
52
|
+
if (error) {
|
|
53
|
+
return (
|
|
54
|
+
<Status.Empty icon='ph--warning--regular' classNames='dx-expand'>
|
|
55
|
+
{error}
|
|
56
|
+
</Status.Empty>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (!tree) {
|
|
60
|
+
return <Status.Empty classNames='dx-expand'>{t('files-loading.message')}</Status.Empty>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Layout.Grid grow cols={['fill', '18rem']} data-testid='pull-request.files'>
|
|
65
|
+
{fence ? (
|
|
66
|
+
// Keyed by file so the next file opens at its top rather than at the previous one's scroll.
|
|
67
|
+
<WalkthroughView key={file?.path} value={fence} onLineComment={onLineComment} />
|
|
68
|
+
) : (
|
|
69
|
+
<Status.Empty classNames='dx-expand'>{t(file ? 'file-no-diff.message' : 'no-files.message')}</Status.Empty>
|
|
70
|
+
)}
|
|
71
|
+
<ScrollArea.Root classNames='border-s border-separator-subtle'>
|
|
72
|
+
<ScrollArea.Viewport classNames='p-2'>
|
|
73
|
+
<Field.Root>
|
|
74
|
+
<Field.Label classNames='px-2'>{t('files-reviewed.label', { reviewed: reviewed.size, total })}</Field.Label>
|
|
75
|
+
</Field.Root>
|
|
76
|
+
<FileTree
|
|
77
|
+
root={tree}
|
|
78
|
+
selected={file?.path}
|
|
79
|
+
reviewed={reviewed}
|
|
80
|
+
onSelect={onSelect}
|
|
81
|
+
onReviewedChange={onReviewedChange}
|
|
82
|
+
/>
|
|
83
|
+
</ScrollArea.Viewport>
|
|
84
|
+
</ScrollArea.Root>
|
|
85
|
+
</Layout.Grid>
|
|
86
|
+
);
|
|
87
|
+
};
|