@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,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Operation from '@dxos/compute/Operation';
|
|
6
|
+
import * as Skill from '@dxos/compute/Skill';
|
|
7
|
+
import * as Template from '@dxos/compute/Template';
|
|
8
|
+
import { trim } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
import { GitHubOperation } from '#types';
|
|
11
|
+
|
|
12
|
+
export const key = 'org.dxos.skill.github';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Imported rather than named as strings: an unresolvable tool id is dropped from the toolkit with
|
|
16
|
+
* only a log line. Verbs that write to GitHub (approvals, comments) are left out so an agent cannot
|
|
17
|
+
* post under the user's account without a skill that asks for it.
|
|
18
|
+
*/
|
|
19
|
+
export const operations: readonly Operation.Definition.Any[] = [
|
|
20
|
+
GitHubOperation.ImportPullRequest,
|
|
21
|
+
GitHubOperation.GetPullRequestStatus,
|
|
22
|
+
GitHubOperation.GenerateWalkthrough,
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
/** GitHub pull requests: import them into a space by URL, read their live state, and walk through them. */
|
|
26
|
+
export const make = (): Skill.Skill =>
|
|
27
|
+
Skill.make({
|
|
28
|
+
key,
|
|
29
|
+
name: 'GitHub',
|
|
30
|
+
description:
|
|
31
|
+
'Import GitHub pull requests into a space by URL or owner/repo#number, read their state and CI ' +
|
|
32
|
+
'status, and generate walkthroughs. Use when a task, message or the user names a pull request.',
|
|
33
|
+
agentCanEnable: true,
|
|
34
|
+
mcpPrompt: true,
|
|
35
|
+
tools: Skill.toolDefinitions({ operations }),
|
|
36
|
+
instructions: Template.make({
|
|
37
|
+
source: trim`
|
|
38
|
+
Pull requests live in the space as org.dxos.type.pullRequest objects, fetched from GitHub through the space's GitHub connection.
|
|
39
|
+
Whenever you have a pull request -- one you just opened, or one a task, message or the user names -- import it with ${Operation.toolName(GitHubOperation.ImportPullRequest)}, passing its github.com URL or owner/repo#number.
|
|
40
|
+
Never create the object by hand, since only an import fills its title, state and diff.
|
|
41
|
+
Importing is idempotent: a pull request the space already holds is returned unchanged, so import before referencing one rather than searching first.
|
|
42
|
+
Pass the returned pullRequest reference to the other tools, and use it wherever the pull request must be attached to another object, such as a task's artifacts.
|
|
43
|
+
Read the state and CI status with ${Operation.toolName(GitHubOperation.GetPullRequestStatus)} before reporting whether a pull request is open, merged or green; the stored object may be stale.
|
|
44
|
+
`,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as LanguageModel from 'effect/ai/LanguageModel';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import React, { useCallback, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
import { AiService } from '@dxos/ai';
|
|
12
|
+
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
13
|
+
import * as EffectEx from '@dxos/effect/EffectEx';
|
|
14
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
15
|
+
import * as Field from '@dxos/react-ui/Field';
|
|
16
|
+
import * as Icon from '@dxos/react-ui/Icon';
|
|
17
|
+
import * as Input from '@dxos/react-ui/Input';
|
|
18
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
19
|
+
|
|
20
|
+
import { WalkthroughView } from '../components/WalkthroughView/index.ts';
|
|
21
|
+
// Imported directly rather than through the barrel: that also exports the generation logic, which
|
|
22
|
+
// pulls ECHO into a bundle that only needs the pure parsing.
|
|
23
|
+
import { fillWalkthrough } from '../walkthrough/fill.ts';
|
|
24
|
+
import { SYSTEM_PROMPT, buildPrompt } from '../walkthrough/prompt.ts';
|
|
25
|
+
import { fetchPullRequest, parsePullRequestUrl } from './github.ts';
|
|
26
|
+
|
|
27
|
+
const MODEL = 'com.anthropic.model.claude-sonnet-5.default';
|
|
28
|
+
|
|
29
|
+
type Phase = 'idle' | 'fetching' | 'generating' | 'filling' | 'done';
|
|
30
|
+
|
|
31
|
+
type Result = {
|
|
32
|
+
body: string;
|
|
33
|
+
covered: number;
|
|
34
|
+
total: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The generation path end to end, against a real pull request: fetch its diff from GitHub, have the
|
|
39
|
+
* model narrate it as placeholder fences, splice the real hunks in, and render the result.
|
|
40
|
+
*
|
|
41
|
+
* The model runs against the live edge service (the `edge-remote` testing preset), so this story
|
|
42
|
+
* needs network but no credentials.
|
|
43
|
+
*/
|
|
44
|
+
const DefaultStory = ({ url: initialUrl }: { url: string }) => {
|
|
45
|
+
const [url, setUrl] = useState(initialUrl);
|
|
46
|
+
const [phase, setPhase] = useState<Phase>('idle');
|
|
47
|
+
const [error, setError] = useState<string>();
|
|
48
|
+
const [result, setResult] = useState<Result>();
|
|
49
|
+
|
|
50
|
+
const handleGenerate = useCallback(async () => {
|
|
51
|
+
const ref = parsePullRequestUrl(url);
|
|
52
|
+
if (!ref) {
|
|
53
|
+
setError('Not a pull request URL: expected https://github.com/owner/repo/pull/123.');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setError(undefined);
|
|
58
|
+
setResult(undefined);
|
|
59
|
+
try {
|
|
60
|
+
setPhase('fetching');
|
|
61
|
+
const pullRequest = await fetchPullRequest(ref);
|
|
62
|
+
|
|
63
|
+
setPhase('generating');
|
|
64
|
+
// Named rather than spread: `RemotePullRequest.body` is the prompt's `description`, and a
|
|
65
|
+
// spread would drop it without a type error.
|
|
66
|
+
const prompt = buildPrompt({
|
|
67
|
+
...ref,
|
|
68
|
+
title: pullRequest.title,
|
|
69
|
+
description: pullRequest.body,
|
|
70
|
+
baseBranch: pullRequest.baseBranch,
|
|
71
|
+
headBranch: pullRequest.headBranch,
|
|
72
|
+
diff: pullRequest.diff,
|
|
73
|
+
});
|
|
74
|
+
const { text } = await EffectEx.runPromise(
|
|
75
|
+
LanguageModel.generateText({ prompt: `${SYSTEM_PROMPT}\n\n---\n\n${prompt}` }).pipe(
|
|
76
|
+
Effect.provide(
|
|
77
|
+
Layer.provideMerge(
|
|
78
|
+
AiService.languageModel(MODEL).pipe(Layer.orDie),
|
|
79
|
+
AiServiceTestingPreset('edge-remote').pipe(Layer.orDie),
|
|
80
|
+
),
|
|
81
|
+
),
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// The model names the chunks; the bytes come from the patch it was shown.
|
|
86
|
+
setPhase('filling');
|
|
87
|
+
const filled = fillWalkthrough(text, pullRequest.diff);
|
|
88
|
+
setResult({ body: filled.body, covered: filled.covered, total: filled.total });
|
|
89
|
+
setPhase('done');
|
|
90
|
+
} catch (err) {
|
|
91
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
92
|
+
setPhase('idle');
|
|
93
|
+
}
|
|
94
|
+
}, [url]);
|
|
95
|
+
|
|
96
|
+
const busy = phase !== 'idle' && phase !== 'done';
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<div className='dx-fill grid grid-rows-[auto_1fr]'>
|
|
100
|
+
<div className='flex items-center gap-2 p-2 border-be border-separator'>
|
|
101
|
+
<Field.Root classNames='flex-1'>
|
|
102
|
+
<Input.Root
|
|
103
|
+
placeholder='https://github.com/owner/repo/pull/123'
|
|
104
|
+
value={url}
|
|
105
|
+
disabled={busy}
|
|
106
|
+
onChange={(event) => setUrl(event.target.value)}
|
|
107
|
+
/>
|
|
108
|
+
</Field.Root>
|
|
109
|
+
<Button.Root disabled={busy} onClick={handleGenerate}>
|
|
110
|
+
<Icon.Icon
|
|
111
|
+
icon={busy ? 'ph--circle-notch--regular' : 'ph--path--regular'}
|
|
112
|
+
classNames={busy ? 'animate-spin' : ''}
|
|
113
|
+
/>
|
|
114
|
+
<span className='ms-2'>{busy ? PHASE_LABEL[phase] : 'Generate'}</span>
|
|
115
|
+
</Button.Root>
|
|
116
|
+
{result && (
|
|
117
|
+
<span className='text-sm text-fg-muted whitespace-nowrap'>
|
|
118
|
+
{result.covered} of {result.total} hunks narrated
|
|
119
|
+
</span>
|
|
120
|
+
)}
|
|
121
|
+
</div>
|
|
122
|
+
{error ? (
|
|
123
|
+
<div className='p-4 text-sm text-error-text'>{error}</div>
|
|
124
|
+
) : (
|
|
125
|
+
<WalkthroughView value={result?.body ?? ''} sidebar='full' />
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const PHASE_LABEL: Record<Phase, string> = {
|
|
132
|
+
idle: 'Generate',
|
|
133
|
+
fetching: 'Fetching the diff',
|
|
134
|
+
generating: 'Writing',
|
|
135
|
+
filling: 'Filling chunks',
|
|
136
|
+
done: 'Generate',
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const meta = {
|
|
140
|
+
title: 'plugins/plugin-github/stories/Generate',
|
|
141
|
+
render: DefaultStory,
|
|
142
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
143
|
+
parameters: { layout: 'fullscreen', controls: { disable: true } },
|
|
144
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
145
|
+
|
|
146
|
+
export default meta;
|
|
147
|
+
|
|
148
|
+
type Story = StoryObj<typeof meta>;
|
|
149
|
+
|
|
150
|
+
export const Default: Story = {
|
|
151
|
+
args: { url: 'https://github.com/dxos/dxos/pull/13082' },
|
|
152
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
9
|
+
import * as Surface from '@dxos/app-framework/Surface';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
12
|
+
import { Obj } from '@dxos/echo';
|
|
13
|
+
import * as EffectEx from '@dxos/effect/EffectEx';
|
|
14
|
+
import * as PreviewCapabilities from '@dxos/plugin-preview/PreviewCapabilities';
|
|
15
|
+
import * as PreviewEvents from '@dxos/plugin-preview/PreviewEvents';
|
|
16
|
+
import * as CorePlugins from '@dxos/plugin-testing/CorePlugins';
|
|
17
|
+
import {
|
|
18
|
+
EditorPreviewProvider,
|
|
19
|
+
type EditorPreviewProviderProps,
|
|
20
|
+
useEditorPreview,
|
|
21
|
+
useTextEditor,
|
|
22
|
+
} from '@dxos/react-ui-editor';
|
|
23
|
+
import * as Card from '@dxos/react-ui/Card';
|
|
24
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
25
|
+
import * as Icon from '@dxos/react-ui/Icon';
|
|
26
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
27
|
+
import * as Popover from '@dxos/react-ui/Popover';
|
|
28
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
29
|
+
import {
|
|
30
|
+
createBasicExtensions,
|
|
31
|
+
createMarkdownExtensions,
|
|
32
|
+
createThemeExtensions,
|
|
33
|
+
decorateMarkdown,
|
|
34
|
+
} from '@dxos/ui-editor';
|
|
35
|
+
import { trim } from '@dxos/util';
|
|
36
|
+
|
|
37
|
+
import { GitHubPlugin } from '#plugin';
|
|
38
|
+
|
|
39
|
+
import { githubLinks } from '../extensions/index.ts';
|
|
40
|
+
import { FixtureLinkSourcePlugin } from '../testing/index.ts';
|
|
41
|
+
|
|
42
|
+
/** The popover's card is whatever `CardContent` surface the resolved object's type has — this plugin's, for a PR or issue. */
|
|
43
|
+
const PreviewCard = () => {
|
|
44
|
+
const { target } = useEditorPreview('PreviewCard');
|
|
45
|
+
if (!target?.object) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return (
|
|
49
|
+
<Popover.Content
|
|
50
|
+
classNames={[
|
|
51
|
+
'origin-(--transform-origin)',
|
|
52
|
+
'data-[state=open]:animate-popover-in',
|
|
53
|
+
'data-[state=closed]:animate-popover-out',
|
|
54
|
+
]}
|
|
55
|
+
>
|
|
56
|
+
<Popover.Body>
|
|
57
|
+
<Card.Root border={false} classNames='dx-card-popover'>
|
|
58
|
+
<Card.Header>
|
|
59
|
+
<Layout.Block>
|
|
60
|
+
<Icon.Icon icon={Obj.getIcon(target.object)?.icon ?? 'ph--circle-dashed--regular'} />
|
|
61
|
+
</Layout.Block>
|
|
62
|
+
<Card.Title>{Obj.getLabel(target.object) ?? target.label}</Card.Title>
|
|
63
|
+
<Popover.CloseTrigger asChild>
|
|
64
|
+
<Card.Action system='close' />
|
|
65
|
+
</Popover.CloseTrigger>
|
|
66
|
+
</Card.Header>
|
|
67
|
+
<Surface.Surface type={AppSurface.CardContent} data={{ subject: target.object }} limit={1} />
|
|
68
|
+
</Card.Root>
|
|
69
|
+
</Popover.Body>
|
|
70
|
+
</Popover.Content>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
type StoryArgs = {
|
|
75
|
+
text: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The whole mechanism end to end: `githubLinks()` turns the URLs into anchor chips, the chips'
|
|
80
|
+
* activation goes to the contributed `LinkResolver`s, and the resolved object's `CardContent`
|
|
81
|
+
* surface renders the card.
|
|
82
|
+
*/
|
|
83
|
+
const DefaultStory = ({ text }: StoryArgs) => {
|
|
84
|
+
const themeMode = UiHooks.useThemeMode();
|
|
85
|
+
const resolvers = Hooks.useCapabilities(PreviewCapabilities.LinkResolver);
|
|
86
|
+
const handleLookup = useCallback<NonNullable<EditorPreviewProviderProps['onLookup']>>(
|
|
87
|
+
async (ref) => {
|
|
88
|
+
for (const { match, resolve } of resolvers.flat()) {
|
|
89
|
+
if (!match(ref.eid)) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const target = await EffectEx.runPromise(resolve(ref, {}));
|
|
93
|
+
if (target) {
|
|
94
|
+
return target;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
},
|
|
99
|
+
[resolvers],
|
|
100
|
+
);
|
|
101
|
+
const extensions = useMemo(
|
|
102
|
+
() => [
|
|
103
|
+
createThemeExtensions({ themeMode }),
|
|
104
|
+
createBasicExtensions({ lineWrapping: true }),
|
|
105
|
+
createMarkdownExtensions(),
|
|
106
|
+
decorateMarkdown(),
|
|
107
|
+
githubLinks(),
|
|
108
|
+
],
|
|
109
|
+
[themeMode],
|
|
110
|
+
);
|
|
111
|
+
const { parentRef } = useTextEditor({ initialValue: text, extensions }, [extensions]);
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<EditorPreviewProvider onLookup={handleLookup}>
|
|
115
|
+
<div ref={parentRef} className='dx-fill p-4 overflow-auto' />
|
|
116
|
+
<PreviewCard />
|
|
117
|
+
</EditorPreviewProvider>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const meta = {
|
|
122
|
+
title: 'plugins/plugin-github/stories/Links',
|
|
123
|
+
render: DefaultStory,
|
|
124
|
+
decorators: [
|
|
125
|
+
withTheme(),
|
|
126
|
+
withLayout({ layout: 'fullscreen' }),
|
|
127
|
+
// No PreviewPlugin: its popover module would answer the anchors too, through the deck's layout
|
|
128
|
+
// operation, which has no handler here. The start event alone activates this plugin's resolver.
|
|
129
|
+
withPluginManager({
|
|
130
|
+
plugins: [...CorePlugins.make(), GitHubPlugin(), FixtureLinkSourcePlugin()],
|
|
131
|
+
setupEvents: [PreviewEvents.Start],
|
|
132
|
+
}),
|
|
133
|
+
],
|
|
134
|
+
parameters: { layout: 'fullscreen' },
|
|
135
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
136
|
+
|
|
137
|
+
export default meta;
|
|
138
|
+
|
|
139
|
+
type Story = StoryObj<typeof meta>;
|
|
140
|
+
|
|
141
|
+
export const Default: Story = {
|
|
142
|
+
args: {
|
|
143
|
+
text: trim`
|
|
144
|
+
# Repositories, pull requests and issues
|
|
145
|
+
|
|
146
|
+
The drawer landed in [#13007](https://github.com/dxos/dxos/pull/13007), the Main port in
|
|
147
|
+
[#13024](https://github.com/dxos/dxos/pull/13024) and [#13030](https://github.com/dxos/dxos/pull/13030).
|
|
148
|
+
|
|
149
|
+
Issues too: [#1](https://github.com/dxos/dxos/issues/1), and [the repository](https://github.com/dxos/dxos)
|
|
150
|
+
itself. A page below the repository is not an object: [the readme](https://github.com/dxos/dxos/blob/main/README.md).
|
|
151
|
+
`,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import { expect, userEvent, waitFor, within } from 'storybook/test';
|
|
9
|
+
|
|
10
|
+
import * as Capabilities from '@dxos/app-framework/Capabilities';
|
|
11
|
+
import * as Capability from '@dxos/app-framework/Capability';
|
|
12
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
13
|
+
import * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';
|
|
14
|
+
import * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';
|
|
15
|
+
import * as Operation from '@dxos/compute/Operation';
|
|
16
|
+
import * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';
|
|
17
|
+
import * as CorePlugins from '@dxos/plugin-testing/CorePlugins';
|
|
18
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
19
|
+
import { PullRequest } from '@dxos/types';
|
|
20
|
+
|
|
21
|
+
import { translations } from '#translations';
|
|
22
|
+
import { GitHubOperation } from '#types';
|
|
23
|
+
|
|
24
|
+
import { PullRequestArticle } from '../containers/PullRequestArticle/PullRequestArticle.tsx';
|
|
25
|
+
import { PULL_REQUEST_13348_BODY, PULL_REQUEST_13348_RUNS } from '../testing/index.ts';
|
|
26
|
+
import PULL_REQUEST_13363_PATCH from '../testing/pull-request-13363.patch?raw';
|
|
27
|
+
|
|
28
|
+
/** Answers the article's GitHub reads from fixtures, so the story needs no connection or network. */
|
|
29
|
+
const handlers = OperationHandlerSet.make(
|
|
30
|
+
Operation.withHandler(GitHubOperation.GetPullRequestStatus, () =>
|
|
31
|
+
Effect.succeed({
|
|
32
|
+
state: 'open' as const,
|
|
33
|
+
title: 'plugin-preview: open a card for a link no resolver can preview',
|
|
34
|
+
body: PULL_REQUEST_13348_BODY,
|
|
35
|
+
ci: 'success' as const,
|
|
36
|
+
checks: { total: PULL_REQUEST_13348_RUNS.length, passed: PULL_REQUEST_13348_RUNS.length, failed: 0, pending: 0 },
|
|
37
|
+
runs: PULL_REQUEST_13348_RUNS,
|
|
38
|
+
review: 'approved' as const,
|
|
39
|
+
approvals: 1,
|
|
40
|
+
}),
|
|
41
|
+
),
|
|
42
|
+
Operation.withHandler(GitHubOperation.SyncPullRequest, () => Effect.succeed({ updated: [] })),
|
|
43
|
+
Operation.withHandler(GitHubOperation.GetPullRequestDiff, () => Effect.succeed({ diff: PULL_REQUEST_13363_PATCH })),
|
|
44
|
+
Operation.withHandler(LayoutOperation.AddToast, () => Effect.void),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Built inside the render function so each mount gets its own object.
|
|
48
|
+
const DefaultStory = () => {
|
|
49
|
+
const pullRequest = useMemo(
|
|
50
|
+
() =>
|
|
51
|
+
PullRequest.make({
|
|
52
|
+
owner: 'dxos',
|
|
53
|
+
repo: 'dxos',
|
|
54
|
+
number: 13348,
|
|
55
|
+
title: 'plugin-preview: open a card for a link no resolver can preview',
|
|
56
|
+
url: 'https://github.com/dxos/dxos/pull/13348',
|
|
57
|
+
state: 'open',
|
|
58
|
+
baseBranch: 'main',
|
|
59
|
+
headBranch: 'dm/wonderful-thompson-njcels',
|
|
60
|
+
}),
|
|
61
|
+
[],
|
|
62
|
+
);
|
|
63
|
+
return <PullRequestArticle role='article' attendableId='story' subject={pullRequest} />;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const meta = {
|
|
67
|
+
title: 'plugins/plugin-github/stories/PullRequestArticle',
|
|
68
|
+
render: DefaultStory,
|
|
69
|
+
decorators: [
|
|
70
|
+
withTheme(),
|
|
71
|
+
withLayout({ layout: 'fullscreen' }),
|
|
72
|
+
withPluginManager({
|
|
73
|
+
capabilities: [
|
|
74
|
+
Capability.contribute(AppCapabilities.Translations, translations),
|
|
75
|
+
Capability.contribute(Capabilities.OperationHandler, handlers),
|
|
76
|
+
],
|
|
77
|
+
plugins: [...CorePlugins.make()],
|
|
78
|
+
}),
|
|
79
|
+
],
|
|
80
|
+
parameters: { layout: 'fullscreen', translations },
|
|
81
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
82
|
+
|
|
83
|
+
export default meta;
|
|
84
|
+
|
|
85
|
+
type Story = StoryObj<typeof meta>;
|
|
86
|
+
|
|
87
|
+
/** The description reads at document width, inside the article's themed scroll area. */
|
|
88
|
+
export const Default: Story = {
|
|
89
|
+
play: async ({ canvasElement }) => {
|
|
90
|
+
const canvas = within(canvasElement);
|
|
91
|
+
const body = await canvas.findByTestId('pull-request.body', {}, { timeout: 10_000 });
|
|
92
|
+
await expect(body.closest('[data-scope="panel"][data-width="document"]')).not.toBeNull();
|
|
93
|
+
await expect(body.closest('.dx-scroll-viewport')).not.toBeNull();
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** dxos/dxos#13363, one file at a time: only CodeMirror's themed scroller scrolls, never its host. */
|
|
98
|
+
export const Files: Story = {
|
|
99
|
+
play: async ({ canvasElement }) => {
|
|
100
|
+
const canvas = within(canvasElement);
|
|
101
|
+
await userEvent.click(await canvas.findByTestId('pull-request.tab.files', {}, { timeout: 10_000 }));
|
|
102
|
+
const files = await canvas.findByTestId('pull-request.files', {}, { timeout: 10_000 });
|
|
103
|
+
await waitFor(() => expect(files.querySelector('.cm-editor')).not.toBeNull(), { timeout: 10_000 });
|
|
104
|
+
const host = files.querySelector('.cm-editor')?.parentElement;
|
|
105
|
+
await expect(host && getComputedStyle(host).overflowY).toBe('hidden');
|
|
106
|
+
},
|
|
107
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
8
|
+
|
|
9
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
|
|
12
|
+
import { translations } from '#translations';
|
|
13
|
+
|
|
14
|
+
import { PullRequestFiles } from '../components/PullRequestFiles/index.ts';
|
|
15
|
+
import { usePullRequestFiles } from '../hooks/usePullRequestFiles.ts';
|
|
16
|
+
import PULL_REQUEST_13363_PATCH from '../testing/pull-request-13363.patch?raw';
|
|
17
|
+
|
|
18
|
+
type StoryArgs = { diff: string };
|
|
19
|
+
|
|
20
|
+
const STORAGE_KEY = 'story.reviewed.dxos/dxos#13363';
|
|
21
|
+
|
|
22
|
+
const DefaultStory = ({ diff }: StoryArgs) => {
|
|
23
|
+
const files = usePullRequestFiles(diff, STORAGE_KEY);
|
|
24
|
+
return (
|
|
25
|
+
<Panel.Root>
|
|
26
|
+
<Panel.Body>
|
|
27
|
+
<PullRequestFiles
|
|
28
|
+
tree={files.tree}
|
|
29
|
+
file={files.file}
|
|
30
|
+
reviewed={files.reviewed}
|
|
31
|
+
total={files.files.length}
|
|
32
|
+
onSelect={files.select}
|
|
33
|
+
onReviewedChange={files.setReviewed}
|
|
34
|
+
/>
|
|
35
|
+
</Panel.Body>
|
|
36
|
+
</Panel.Root>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const meta = {
|
|
41
|
+
title: 'plugins/plugin-github/stories/PullRequestFiles',
|
|
42
|
+
render: DefaultStory,
|
|
43
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
44
|
+
parameters: { layout: 'fullscreen', controls: { disable: true }, translations },
|
|
45
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
46
|
+
|
|
47
|
+
export default meta;
|
|
48
|
+
|
|
49
|
+
type Story = StoryObj<typeof meta>;
|
|
50
|
+
|
|
51
|
+
/** dxos/dxos#13363 (50 files): one file at a time beside the tree of every changed file. */
|
|
52
|
+
export const Default: Story = {
|
|
53
|
+
args: { diff: PULL_REQUEST_13363_PATCH },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Checking a file off in the tree counts it as reviewed without opening it. */
|
|
57
|
+
export const Reviewed: Story = {
|
|
58
|
+
args: { diff: PULL_REQUEST_13363_PATCH },
|
|
59
|
+
beforeEach: () => {
|
|
60
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
61
|
+
},
|
|
62
|
+
play: async ({ canvasElement }) => {
|
|
63
|
+
const canvas = within(canvasElement);
|
|
64
|
+
// Re-queried per click: checking a file off re-renders the tree, which replaces the rows.
|
|
65
|
+
await userEvent.click((await canvas.findAllByTestId('pull-request.files.reviewed'))[0]);
|
|
66
|
+
await userEvent.click((await canvas.findAllByTestId('pull-request.files.reviewed'))[1]);
|
|
67
|
+
await expect(await canvas.findByText('2 of 50 files reviewed')).toBeInTheDocument();
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
8
|
+
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import * as PreviewEvents from '@dxos/plugin-preview/PreviewEvents';
|
|
11
|
+
import * as CorePlugins from '@dxos/plugin-testing/CorePlugins';
|
|
12
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
|
|
15
|
+
import { GitHubPlugin } from '#plugin';
|
|
16
|
+
import { translations } from '#translations';
|
|
17
|
+
|
|
18
|
+
import { PullRequestOverview, type PullRequestOverviewProps } from '../components/PullRequestOverview/index.ts';
|
|
19
|
+
import { FixtureLinkSourcePlugin, PULL_REQUEST_13348_BODY, PULL_REQUEST_13348_RUNS } from '../testing/index.ts';
|
|
20
|
+
|
|
21
|
+
const meta = {
|
|
22
|
+
title: 'plugins/plugin-github/stories/PullRequestOverview',
|
|
23
|
+
component: PullRequestOverview,
|
|
24
|
+
decorators: [
|
|
25
|
+
(Story) => (
|
|
26
|
+
<Panel.Root>
|
|
27
|
+
<Panel.Body>
|
|
28
|
+
<Story />
|
|
29
|
+
</Panel.Body>
|
|
30
|
+
</Panel.Root>
|
|
31
|
+
),
|
|
32
|
+
withTheme(),
|
|
33
|
+
withLayout({ layout: 'fullscreen' }),
|
|
34
|
+
withPluginManager({
|
|
35
|
+
plugins: [...CorePlugins.make(), GitHubPlugin(), FixtureLinkSourcePlugin()],
|
|
36
|
+
setupEvents: [PreviewEvents.Start],
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
parameters: { layout: 'fullscreen', translations },
|
|
40
|
+
} satisfies Meta<typeof PullRequestOverview>;
|
|
41
|
+
|
|
42
|
+
export default meta;
|
|
43
|
+
|
|
44
|
+
type Story = StoryObj<typeof meta>;
|
|
45
|
+
|
|
46
|
+
const REAL_PULL_REQUEST: PullRequestOverviewProps = {
|
|
47
|
+
body: PULL_REQUEST_13348_BODY,
|
|
48
|
+
details: {
|
|
49
|
+
reference: 'dxos/dxos#13348',
|
|
50
|
+
state: 'open',
|
|
51
|
+
checks: 'CI passing 22/22',
|
|
52
|
+
branches: 'dm/wonderful-thompson-njcels → main',
|
|
53
|
+
},
|
|
54
|
+
runs: PULL_REQUEST_13348_RUNS,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** dxos/dxos#13348 as GitHub returned it: R2 demo media as pills, footers as cards, every check. */
|
|
58
|
+
export const Default: Story = {
|
|
59
|
+
args: { ...REAL_PULL_REQUEST },
|
|
60
|
+
play: async ({ canvasElement }) => {
|
|
61
|
+
const canvas = within(canvasElement);
|
|
62
|
+
// The first story boots the plugin manager and the masonry reveals its tiles only once measured,
|
|
63
|
+
// so both waits are longer than the default second.
|
|
64
|
+
const body = await canvas.findByTestId('pull-request.body', {}, { timeout: 10_000 });
|
|
65
|
+
await expect(body).not.toHaveTextContent('Generated with');
|
|
66
|
+
await expect(body).not.toHaveTextContent('Composer preview');
|
|
67
|
+
await expect(canvas.getAllByTestId('pull-request.artifact.pill')).toHaveLength(3);
|
|
68
|
+
await expect(await canvas.findByTestId('pull-request.related.preview', {}, { timeout: 10_000 })).toHaveTextContent(
|
|
69
|
+
'pr-13348-composer-dev',
|
|
70
|
+
);
|
|
71
|
+
await expect(await canvas.findByTestId('pull-request.related.claude')).toHaveTextContent(
|
|
72
|
+
'session_016GM9fXXzbrr6JGNeeQBCmj',
|
|
73
|
+
);
|
|
74
|
+
await expect(canvas.getAllByTestId('pull-request.check')).toHaveLength(PULL_REQUEST_13348_RUNS.length);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** A failing, a running and a timed-out check sort above the passing ones. */
|
|
79
|
+
export const FailingChecks: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
...REAL_PULL_REQUEST,
|
|
82
|
+
runs: [
|
|
83
|
+
...PULL_REQUEST_13348_RUNS.slice(2),
|
|
84
|
+
{ ...PULL_REQUEST_13348_RUNS[0], name: 'Check / test (shard=6)', outcome: 'failure', conclusion: 'failure' },
|
|
85
|
+
{ ...PULL_REQUEST_13348_RUNS[1], name: 'Check / e2e (shard=7)', outcome: 'failure', conclusion: 'timed_out' },
|
|
86
|
+
{ name: 'Check / storybook', outcome: 'pending', startedAt: new Date(Date.now() - 252_000).toISOString() },
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
play: async ({ canvasElement }) => {
|
|
90
|
+
const canvas = within(canvasElement);
|
|
91
|
+
const [first, second, third] = await canvas.findAllByTestId('pull-request.check');
|
|
92
|
+
await expect(first).toHaveAttribute('data-outcome', 'failure');
|
|
93
|
+
await expect(second).toHaveAttribute('data-outcome', 'failure');
|
|
94
|
+
await expect(third).toHaveAttribute('data-outcome', 'pending');
|
|
95
|
+
await expect(third).toHaveTextContent(/Running · \d+m \d+s/);
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** A pill opens its demo video in place. */
|
|
100
|
+
export const ArtifactPreview: Story = {
|
|
101
|
+
args: { ...REAL_PULL_REQUEST },
|
|
102
|
+
play: async ({ canvasElement }) => {
|
|
103
|
+
const canvas = within(canvasElement);
|
|
104
|
+
const [videoPill] = await canvas.findAllByTestId('pull-request.artifact.pill');
|
|
105
|
+
await userEvent.click(videoPill);
|
|
106
|
+
const popover = within(canvasElement.ownerDocument.body);
|
|
107
|
+
await expect(await popover.findAllByTestId('pull-request.artifact.video')).not.toHaveLength(0);
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** No description, no footers, checks still loading. */
|
|
112
|
+
export const Empty: Story = {
|
|
113
|
+
args: { details: { reference: 'dxos/dxos#1' } },
|
|
114
|
+
};
|