@dxos/plugin-github 0.7.4-staging.f7e8224 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +784 -0
- package/dist/lib/GitHubCapabilities.mjs +10 -0
- package/dist/lib/GitHubCapabilities.mjs.map +1 -0
- package/dist/lib/GitHubEvents.mjs +15 -0
- package/dist/lib/GitHubEvents.mjs.map +1 -0
- package/dist/lib/GitHubOperation.mjs +358 -0
- package/dist/lib/GitHubOperation.mjs.map +1 -0
- package/dist/lib/GitHubPlugin.mjs +16 -0
- package/dist/lib/GitHubPlugin.mjs.map +1 -0
- package/dist/lib/Walkthrough.mjs +59 -0
- package/dist/lib/Walkthrough.mjs.map +1 -0
- package/dist/lib/capabilities.browser.mjs +54 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +54 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/capabilities.node.mjs +30 -0
- package/dist/lib/capabilities.node.mjs.map +1 -0
- package/dist/lib/capabilities.tauri.mjs +54 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs +30 -0
- package/dist/lib/capabilities.workerd.mjs.map +1 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs +116 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs.map +1 -0
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle.mjs +1486 -0
- package/dist/lib/chunk-PullRequestArticle.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle2.mjs +2 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs +123 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs +594 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs.map +1 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs +26 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs +19 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs +25 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +39 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-connector.mjs +70 -0
- package/dist/lib/chunk-connector.mjs.map +1 -0
- package/dist/lib/chunk-constants.mjs +11 -0
- package/dist/lib/chunk-constants.mjs.map +1 -0
- package/dist/lib/chunk-errors.mjs +29 -0
- package/dist/lib/chunk-errors.mjs.map +1 -0
- package/dist/lib/chunk-generate-walkthrough.mjs +86 -0
- package/dist/lib/chunk-generate-walkthrough.mjs.map +1 -0
- package/dist/lib/chunk-generate.mjs +719 -0
- package/dist/lib/chunk-generate.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs +25 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-status.mjs +29 -0
- package/dist/lib/chunk-get-pull-request-status.mjs.map +1 -0
- package/dist/lib/chunk-get-repositories.mjs +32 -0
- package/dist/lib/chunk-get-repositories.mjs.map +1 -0
- package/dist/lib/chunk-github-api.mjs +375 -0
- package/dist/lib/chunk-github-api.mjs.map +1 -0
- package/dist/lib/chunk-github-link.mjs +59 -0
- package/dist/lib/chunk-github-link.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs +25 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request.mjs +96 -0
- package/dist/lib/chunk-import-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-link-resolver.mjs +109 -0
- package/dist/lib/chunk-link-resolver.mjs.map +1 -0
- package/dist/lib/chunk-markdown-extension.mjs +92 -0
- package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
- package/dist/lib/chunk-materialize-target.mjs +36 -0
- package/dist/lib/chunk-materialize-target.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +12 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-page-action.mjs +22 -0
- package/dist/lib/chunk-page-action.mjs.map +1 -0
- package/dist/lib/chunk-pull-request.mjs +58 -0
- package/dist/lib/chunk-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-pull-request2.mjs +110 -0
- package/dist/lib/chunk-pull-request2.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +233 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/chunk-schema.mjs +15 -0
- package/dist/lib/chunk-schema.mjs.map +1 -0
- package/dist/lib/chunk-skill-definition.mjs +10 -0
- package/dist/lib/chunk-skill-definition.mjs.map +1 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs +56 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs.map +1 -0
- package/dist/lib/chunk-sync-pull-request.mjs +24 -0
- package/dist/lib/chunk-sync-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-sync.mjs +481 -0
- package/dist/lib/chunk-sync.mjs.map +1 -0
- package/dist/lib/chunk-useOpenObject.mjs +43 -0
- package/dist/lib/chunk-useOpenObject.mjs.map +1 -0
- package/dist/lib/extensions.mjs +132 -0
- package/dist/lib/extensions.mjs.map +1 -0
- package/dist/lib/index.mjs +4 -0
- package/dist/lib/meta.mjs +47 -0
- package/dist/lib/meta.mjs.map +1 -0
- package/dist/lib/ns/Extensions.mjs +18 -0
- package/dist/lib/ns/Extensions.mjs.map +1 -0
- package/dist/lib/operations.mjs +22 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/skills.mjs +44 -0
- package/dist/lib/skills.mjs.map +1 -0
- package/dist/lib/testing.mjs +189 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/translations.mjs +136 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +5 -0
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/Extensions.d.ts +2 -0
- package/dist/types/src/Extensions.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.d.ts +37 -0
- package/dist/types/src/GitHubPlugin.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts +2 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts.map +1 -0
- package/dist/types/src/approval.d.ts +21 -0
- package/dist/types/src/approval.d.ts.map +1 -0
- package/dist/types/src/approval.test.d.ts +2 -0
- package/dist/types/src/approval.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +9 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/connector.d.ts +17 -0
- package/dist/types/src/capabilities/connector.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/browser.d.ts +13 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts +13 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts +13 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts +13 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +13 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/link-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/link-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts +14 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +5 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/page-action.d.ts +5 -0
- package/dist/types/src/capabilities/page-action.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +12 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.d.ts +11 -0
- package/dist/types/src/cards/GitHubCard.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts +45 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts.map +1 -0
- package/dist/types/src/cards/PullRequestCard.d.ts +9 -0
- package/dist/types/src/cards/PullRequestCard.d.ts.map +1 -0
- package/dist/types/src/cards/index.d.ts +3 -0
- package/dist/types/src/cards/index.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts +30 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/index.d.ts +2 -0
- package/dist/types/src/components/CommentComposer/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts +8 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts +17 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts +23 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts +39 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts +5 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts +21 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts +15 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts +10 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts +16 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts +28 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts +6 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts +20 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts +2 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts +18 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts +16 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts +3 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +5 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +7 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts +6 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts +15 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts +10 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts +14 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts +13 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts +44 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts +3 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts +13 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts +2 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +157 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +3 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/links.d.ts +21 -0
- package/dist/types/src/extensions/links.d.ts.map +1 -0
- package/dist/types/src/extensions/links.test.d.ts +2 -0
- package/dist/types/src/extensions/links.test.d.ts.map +1 -0
- package/dist/types/src/extensions/references.d.ts +23 -0
- package/dist/types/src/extensions/references.d.ts.map +1 -0
- package/dist/types/src/extensions/references.test.d.ts +2 -0
- package/dist/types/src/extensions/references.test.d.ts.map +1 -0
- package/dist/types/src/github-link.d.ts +29 -0
- package/dist/types/src/github-link.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useOpenObject.d.ts +9 -0
- package/dist/types/src/hooks/useOpenObject.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts +10 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts +12 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts +22 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts +10 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +34 -11
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/add-pull-request-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-comment.d.ts.map +1 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts.map +1 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts +11 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts.map +1 -0
- package/dist/types/src/operations/get-repositories.d.ts +13 -0
- package/dist/types/src/operations/get-repositories.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts +12 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.d.ts +63 -0
- package/dist/types/src/operations/import-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/materialize-target.d.ts +12 -0
- package/dist/types/src/operations/materialize-target.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.d.ts +48 -0
- package/dist/types/src/operations/pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts +5 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts.map +1 -0
- package/dist/types/src/operations/sync-pull-request.d.ts +5 -0
- package/dist/types/src/operations/sync-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/sync.d.ts +123 -0
- package/dist/types/src/operations/sync.d.ts.map +1 -0
- package/dist/types/src/operations/sync.test.d.ts +2 -0
- package/dist/types/src/operations/sync.test.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/plugin.test.d.ts +2 -0
- package/dist/types/src/plugin.test.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.d.ts +37 -0
- package/dist/types/src/pull-request-body.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.test.d.ts +2 -0
- package/dist/types/src/pull-request-body.test.d.ts.map +1 -0
- package/dist/types/src/pull-request.d.ts +28 -0
- package/dist/types/src/pull-request.d.ts.map +1 -0
- package/dist/types/src/pull-request.test.d.ts +2 -0
- package/dist/types/src/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/services/github-api.d.ts +332 -0
- package/dist/types/src/services/github-api.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +2 -0
- package/dist/types/src/services/index.d.ts.map +1 -0
- package/dist/types/src/skills/GitHubSkill.d.ts +12 -0
- package/dist/types/src/skills/GitHubSkill.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/stories/Generate.stories.d.ts +27 -0
- package/dist/types/src/stories/Generate.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Links.stories.d.ts +23 -0
- package/dist/types/src/stories/Links.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts +359 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts +365 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts +367 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts +357 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts +380 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts.map +1 -0
- package/dist/types/src/stories/github.d.ts +23 -0
- package/dist/types/src/stories/github.d.ts.map +1 -0
- package/dist/types/src/stories/github.test.d.ts +2 -0
- package/dist/types/src/stories/github.test.d.ts.map +1 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts +8 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures.d.ts +14 -0
- package/dist/types/src/testing/fixtures.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/plugin.d.ts +4 -0
- package/dist/types/src/testing/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/pull-request-13348.d.ts +6 -0
- package/dist/types/src/testing/pull-request-13348.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +339 -53
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/GitHubCapabilities.d.ts +13 -0
- package/dist/types/src/types/GitHubCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/GitHubEvents.d.ts +8 -0
- package/dist/types/src/types/GitHubEvents.d.ts.map +1 -0
- package/dist/types/src/types/GitHubOperation.d.ts +270 -0
- package/dist/types/src/types/GitHubOperation.d.ts.map +1 -0
- package/dist/types/src/types/PullRequestsView.d.ts +35 -0
- package/dist/types/src/types/PullRequestsView.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.d.ts +31 -0
- package/dist/types/src/types/Walkthrough.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.test.d.ts +2 -0
- package/dist/types/src/types/Walkthrough.test.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.d.ts +28 -0
- package/dist/types/src/walkthrough/fill.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.test.d.ts +2 -0
- package/dist/types/src/walkthrough/fill.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.d.ts +67 -0
- package/dist/types/src/walkthrough/generate.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generate.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.d.ts +20 -0
- package/dist/types/src/walkthrough/generated.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generated.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.d.ts +8 -0
- package/dist/types/src/walkthrough/headings.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.test.d.ts +2 -0
- package/dist/types/src/walkthrough/headings.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/index.d.ts +9 -0
- package/dist/types/src/walkthrough/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/patch.d.ts +48 -0
- package/dist/types/src/walkthrough/patch.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.d.ts +55 -0
- package/dist/types/src/walkthrough/plan.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.test.d.ts +2 -0
- package/dist/types/src/walkthrough/plan.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.d.ts +33 -0
- package/dist/types/src/walkthrough/prompt.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts +2 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.d.ts +43 -0
- package/dist/types/src/walkthrough/score.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.test.d.ts +2 -0
- package/dist/types/src/walkthrough/score.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dx.config.ts +39 -0
- package/package.json +167 -48
- package/src/Extensions.ts +7 -0
- package/src/GitHubPlugin.ts +15 -0
- package/src/GitHubPlugin.workerd.test.ts +23 -0
- package/src/approval.test.ts +40 -0
- package/src/approval.ts +39 -0
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/connector.ts +95 -0
- package/src/capabilities/gen/browser.ts +82 -0
- package/src/capabilities/gen/node.ts +43 -0
- package/src/capabilities/gen/tauri.ts +82 -0
- package/src/capabilities/gen/workerd.ts +43 -0
- package/src/capabilities/index.ts +71 -0
- package/src/capabilities/link-resolver.ts +137 -0
- package/src/capabilities/markdown-extension.ts +146 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/page-action.ts +32 -0
- package/src/capabilities/react-surface.ts +98 -0
- package/src/capabilities/schema.ts +16 -0
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/cards/GitHubCard.stories.tsx +165 -0
- package/src/cards/GitHubCard.tsx +93 -0
- package/src/cards/PullRequestCard.tsx +23 -0
- package/src/cards/index.ts +6 -0
- package/src/components/CommentComposer/CommentComposer.tsx +109 -0
- package/src/components/CommentComposer/index.ts +5 -0
- package/src/components/PullRequestFiles/DiffStat.tsx +15 -0
- package/src/components/PullRequestFiles/FileTree.tsx +102 -0
- package/src/components/PullRequestFiles/PullRequestFiles.tsx +87 -0
- package/src/components/PullRequestFiles/files.test.ts +59 -0
- package/src/components/PullRequestFiles/files.ts +115 -0
- package/src/components/PullRequestFiles/index.ts +8 -0
- package/src/components/PullRequestOverview/ArtifactPill.tsx +82 -0
- package/src/components/PullRequestOverview/CheckRunList.tsx +120 -0
- package/src/components/PullRequestOverview/PullRequestDetails.tsx +15 -0
- package/src/components/PullRequestOverview/PullRequestOverview.tsx +110 -0
- package/src/components/PullRequestOverview/RelatedCards.tsx +147 -0
- package/src/components/PullRequestOverview/index.ts +9 -0
- package/src/components/PullRequestStatus/PullRequestStatus.tsx +81 -0
- package/src/components/PullRequestStatus/index.ts +5 -0
- package/src/components/WalkthroughView/WalkthroughView.tsx +62 -0
- package/src/components/WalkthroughView/extensions.ts +53 -0
- package/src/components/WalkthroughView/index.ts +6 -0
- package/src/components/index.ts +6 -9
- package/src/constants.ts +12 -0
- package/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.tsx +160 -0
- package/src/containers/ImportPullRequestDialog/index.ts +7 -0
- package/src/containers/PullRequestArticle/PullRequestArticle.tsx +573 -0
- package/src/containers/PullRequestArticle/failure.test.ts +42 -0
- package/src/containers/PullRequestArticle/failure.ts +16 -0
- package/src/containers/PullRequestArticle/index.ts +5 -0
- package/src/containers/PullRequestCardMenu/PullRequestCardMenu.tsx +134 -0
- package/src/containers/PullRequestCardMenu/index.ts +5 -0
- package/src/containers/PullRequestsArticle/PullRequestsArticle.tsx +361 -0
- package/src/containers/PullRequestsArticle/arrange.test.ts +122 -0
- package/src/containers/PullRequestsArticle/arrange.ts +245 -0
- package/src/containers/PullRequestsArticle/format.ts +31 -0
- package/src/containers/PullRequestsArticle/index.ts +5 -0
- package/src/containers/WalkthroughArticle/WalkthroughArticle.tsx +31 -0
- package/src/containers/WalkthroughArticle/index.ts +5 -0
- package/src/containers/index.ts +11 -0
- package/src/errors.ts +61 -0
- package/src/extensions/index.ts +6 -0
- package/src/extensions/links.test.ts +133 -0
- package/src/extensions/links.ts +91 -0
- package/src/extensions/references.test.ts +83 -0
- package/src/extensions/references.ts +100 -0
- package/src/github-link.ts +70 -0
- package/src/hooks/index.ts +6 -3
- package/src/hooks/useOpenObject.ts +48 -0
- package/src/hooks/usePullRequestChecks.ts +81 -0
- package/src/hooks/usePullRequestDiff.ts +57 -0
- package/src/hooks/usePullRequestFiles.ts +98 -0
- package/src/hooks/useSyncPullRequest.ts +51 -0
- package/src/index.ts +4 -6
- package/src/meta.ts +8 -13
- package/src/operations/add-pull-request-comment.ts +31 -0
- package/src/operations/add-pull-request-review-comment.ts +32 -0
- package/src/operations/generate-walkthrough.ts +124 -0
- package/src/operations/get-pull-request-diff.ts +37 -0
- package/src/operations/get-pull-request-status.ts +44 -0
- package/src/operations/get-repositories.ts +53 -0
- package/src/operations/import-pull-request-from-snapshot.ts +48 -0
- package/src/operations/import-pull-request.test.ts +151 -0
- package/src/operations/import-pull-request.ts +141 -0
- package/src/operations/index.ts +29 -0
- package/src/operations/materialize-target.ts +60 -0
- package/src/operations/pull-request.test.ts +120 -0
- package/src/operations/pull-request.ts +141 -0
- package/src/operations/submit-pull-request-approval.ts +41 -0
- package/src/operations/sync-pull-request.ts +37 -0
- package/src/operations/sync.test.ts +453 -0
- package/src/operations/sync.ts +807 -0
- package/src/plugin.test.ts +40 -0
- package/src/plugin.ts +37 -0
- package/src/pull-request-body.test.ts +61 -0
- package/src/pull-request-body.ts +144 -0
- package/src/pull-request.test.ts +67 -0
- package/src/pull-request.ts +80 -0
- package/src/services/github-api.ts +735 -0
- package/src/services/index.ts +5 -0
- package/src/skills/GitHubSkill.ts +46 -0
- package/src/skills/index.ts +5 -0
- package/src/stories/Generate.stories.tsx +152 -0
- package/src/stories/Links.stories.tsx +153 -0
- package/src/stories/PullRequestArticle.stories.tsx +107 -0
- package/src/stories/PullRequestFiles.stories.tsx +69 -0
- package/src/stories/PullRequestOverview.stories.tsx +113 -0
- package/src/stories/PullRequestsArticle.stories.tsx +170 -0
- package/src/stories/Walkthrough.stories.tsx +110 -0
- package/src/stories/github.test.ts +65 -0
- package/src/stories/github.ts +70 -0
- package/src/stories/walkthrough-fixture.ts +115 -0
- package/src/testing/fixtures.ts +99 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/plugin.ts +25 -0
- package/src/testing/pull-request-13348.ts +104 -0
- package/src/testing/pull-request-13363.patch +2981 -0
- package/src/translations.ts +135 -63
- package/src/types/GitHubCapabilities.ts +27 -0
- package/src/types/GitHubEvents.ts +16 -0
- package/src/types/GitHubOperation.ts +371 -0
- package/src/types/PullRequestsView.ts +45 -0
- package/src/types/Walkthrough.test.ts +75 -0
- package/src/types/Walkthrough.ts +66 -0
- package/src/types/index.ts +8 -0
- package/src/vite-env.d.ts +15 -0
- package/src/walkthrough/fill.test.ts +337 -0
- package/src/walkthrough/fill.ts +246 -0
- package/src/walkthrough/generate.test.ts +219 -0
- package/src/walkthrough/generate.ts +248 -0
- package/src/walkthrough/generated.test.ts +70 -0
- package/src/walkthrough/generated.ts +70 -0
- package/src/walkthrough/headings.test.ts +40 -0
- package/src/walkthrough/headings.ts +39 -0
- package/src/walkthrough/index.ts +12 -0
- package/src/walkthrough/patch.ts +154 -0
- package/src/walkthrough/plan.test.ts +178 -0
- package/src/walkthrough/plan.ts +251 -0
- package/src/walkthrough/prompt.test.ts +100 -0
- package/src/walkthrough/prompt.ts +147 -0
- package/src/walkthrough/score.test.ts +272 -0
- package/src/walkthrough/score.ts +430 -0
- package/README.md +0 -15
- package/dist/lib/browser/chunk-S4MPSBA5.mjs +0 -21
- package/dist/lib/browser/chunk-S4MPSBA5.mjs.map +0 -7
- package/dist/lib/browser/index.css +0 -7
- package/dist/lib/browser/index.css.map +0 -7
- package/dist/lib/browser/index.mjs +0 -1535
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/meta.mjs +0 -11
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/GithubPlugin.d.ts +0 -4
- package/dist/types/src/GithubPlugin.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts +0 -4
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts +0 -9
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/index.d.ts +0 -2
- package/dist/types/src/components/EmbeddedMain/index.d.ts.map +0 -1
- package/dist/types/src/components/ExportDialog.d.ts +0 -8
- package/dist/types/src/components/ExportDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts +0 -15
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts +0 -7
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts +0 -16
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts +0 -11
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts.map +0 -1
- package/dist/types/src/components/ImportDialog.d.ts +0 -7
- package/dist/types/src/components/ImportDialog.d.ts.map +0 -1
- package/dist/types/src/components/Issue.d.ts +0 -5
- package/dist/types/src/components/Issue.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.d.ts +0 -15
- package/dist/types/src/components/Loading/Loading.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts +0 -40
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Loading/index.d.ts +0 -2
- package/dist/types/src/components/Loading/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownActions.d.ts +0 -7
- package/dist/types/src/components/MarkdownActions.d.ts.map +0 -1
- package/dist/types/src/components/UrlDialog.d.ts +0 -6
- package/dist/types/src/components/UrlDialog.d.ts.map +0 -1
- package/dist/types/src/hooks/useDocGhId.d.ts +0 -6
- package/dist/types/src/hooks/useDocGhId.d.ts.map +0 -1
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts +0 -2
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -30
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/GithubPlugin.tsx +0 -127
- package/src/components/EmbeddedMain/EmbeddedMain.tsx +0 -294
- package/src/components/EmbeddedMain/GfmPreview.tsx +0 -110
- package/src/components/EmbeddedMain/embedded.css +0 -3
- package/src/components/EmbeddedMain/index.ts +0 -5
- package/src/components/ExportDialog.tsx +0 -157
- package/src/components/GithubApiProviders/GitHubSettings.tsx +0 -72
- package/src/components/GithubApiProviders/OctokitProvider.tsx +0 -60
- package/src/components/GithubApiProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/DocumentTreeItem.tsx +0 -26
- package/src/components/GithubEchoResolverProviders/ResolverContext.tsx +0 -137
- package/src/components/GithubEchoResolverProviders/ResolverDialog.tsx +0 -34
- package/src/components/GithubEchoResolverProviders/ResolverProps.ts +0 -23
- package/src/components/GithubEchoResolverProviders/ResolverTree.tsx +0 -86
- package/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.tsx +0 -105
- package/src/components/GithubEchoResolverProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/spaceResolvers.ts +0 -86
- package/src/components/ImportDialog.tsx +0 -72
- package/src/components/Issue.tsx +0 -62
- package/src/components/Loading/Loading.stories.tsx +0 -32
- package/src/components/Loading/Loading.tsx +0 -70
- package/src/components/Loading/index.ts +0 -5
- package/src/components/MarkdownActions.tsx +0 -136
- package/src/components/UrlDialog.tsx +0 -52
- package/src/hooks/useDocGhId.ts +0 -38
- package/src/hooks/useGhIdFromUrl.ts +0 -26
- package/src/types.ts +0 -51
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { ViewState } from '@dxos/react-ui-attention/types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The fields the pull request list can be ordered by. `relevance` ranks what needs the reader first
|
|
11
|
+
* (see `relevance`); `updated` and `created` are GitHub's times.
|
|
12
|
+
*/
|
|
13
|
+
export const SortField = Schema.Literals(['relevance', 'updated', 'created', 'number', 'title']);
|
|
14
|
+
export type SortField = Schema.Schema.Type<typeof SortField>;
|
|
15
|
+
|
|
16
|
+
export const SortDirection = Schema.Literals(['asc', 'desc']);
|
|
17
|
+
export type SortDirection = Schema.Schema.Type<typeof SortDirection>;
|
|
18
|
+
|
|
19
|
+
export const Sort = Schema.Struct({ field: SortField, direction: SortDirection });
|
|
20
|
+
export type Sort = Schema.Schema.Type<typeof Sort>;
|
|
21
|
+
|
|
22
|
+
/** The fields the list can be grouped by; `none` is one ungrouped list. */
|
|
23
|
+
export const GroupField = Schema.Literals(['none', 'repo', 'state', 'checks', 'author']);
|
|
24
|
+
export type GroupField = Schema.Schema.Type<typeof GroupField>;
|
|
25
|
+
|
|
26
|
+
export const DEFAULT_SORT: Sort = { field: 'relevance', direction: 'desc' };
|
|
27
|
+
|
|
28
|
+
export const View = Schema.Struct({
|
|
29
|
+
query: Schema.String,
|
|
30
|
+
sort: Schema.optional(Sort),
|
|
31
|
+
group: Schema.optional(GroupField),
|
|
32
|
+
});
|
|
33
|
+
export type View = Schema.Schema.Type<typeof View>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* How a reader has the space's pull requests arranged, keyed by the space and held per device
|
|
37
|
+
* (`local`), as a task set's list is: the filter, order and grouping are how this reader looks at the
|
|
38
|
+
* list here, not a property of the space every member would see.
|
|
39
|
+
*/
|
|
40
|
+
export const aspect: ViewState.Aspect<View> = ViewState.define<View>({
|
|
41
|
+
key: 'github-pull-requests-view',
|
|
42
|
+
backend: 'local',
|
|
43
|
+
schema: View,
|
|
44
|
+
defaultValue: (): View => ({ query: '' }),
|
|
45
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
8
|
+
import { PullRequest } from '@dxos/types';
|
|
9
|
+
|
|
10
|
+
import * as Walkthrough from './Walkthrough.ts';
|
|
11
|
+
|
|
12
|
+
describe('Walkthrough', () => {
|
|
13
|
+
test('holds the body, the commit and a ref to the pull request', () => {
|
|
14
|
+
const pullRequest = makePullRequest();
|
|
15
|
+
const walkthrough = Walkthrough.make({
|
|
16
|
+
pullRequest: Ref.make(pullRequest),
|
|
17
|
+
body: '# A change\n\nProse.\n',
|
|
18
|
+
commit: 'deadbeef',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
expect(Walkthrough.instanceOf(walkthrough)).to.eq(true);
|
|
22
|
+
expect(walkthrough.body).to.eq('# A change\n\nProse.\n');
|
|
23
|
+
expect(walkthrough.commit).to.eq('deadbeef');
|
|
24
|
+
expect(walkthrough.pullRequest.target).to.eq(pullRequest);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('is labelled by its title, falling back to the commit', () => {
|
|
28
|
+
const pullRequest = makePullRequest();
|
|
29
|
+
const titled = Walkthrough.make({
|
|
30
|
+
pullRequest: Ref.make(pullRequest),
|
|
31
|
+
title: Walkthrough.makeTitle(pullRequest),
|
|
32
|
+
body: 'text',
|
|
33
|
+
commit: 'abc',
|
|
34
|
+
});
|
|
35
|
+
const untitled = Walkthrough.make({ pullRequest: Ref.make(pullRequest), body: 'text', commit: 'abc' });
|
|
36
|
+
|
|
37
|
+
expect(Obj.getLabel(titled)).to.eq(`${PullRequest.reference(pullRequest)}: ${pullRequest.title}`);
|
|
38
|
+
expect(Obj.getLabel(untitled)).to.eq('abc');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('the body is a plain string, not a text object', () => {
|
|
42
|
+
const walkthrough = Walkthrough.make({
|
|
43
|
+
pullRequest: Ref.make(makePullRequest()),
|
|
44
|
+
body: 'text',
|
|
45
|
+
commit: 'abc',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// A text object would replicate as a CRDT; this is replaced wholesale on every regeneration.
|
|
49
|
+
expect(typeof walkthrough.body).to.eq('string');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('is stale against any commit but the one it was generated from', () => {
|
|
53
|
+
const walkthrough = Walkthrough.make({
|
|
54
|
+
pullRequest: Ref.make(makePullRequest()),
|
|
55
|
+
body: '',
|
|
56
|
+
commit: 'abc123',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(Walkthrough.isStale(walkthrough, 'abc123')).to.eq(false);
|
|
60
|
+
expect(Walkthrough.isStale(walkthrough, 'def456')).to.eq(true);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('is an ECHO object of the expected type', () => {
|
|
64
|
+
const walkthrough = Walkthrough.make({
|
|
65
|
+
pullRequest: Ref.make(makePullRequest()),
|
|
66
|
+
body: '',
|
|
67
|
+
commit: 'abc',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
expect(Obj.getTypename(walkthrough)).to.eq('org.dxos.type.walkthrough');
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const makePullRequest = () =>
|
|
75
|
+
PullRequest.make({ owner: 'dxos', repo: 'dxos', number: 13082, title: 'A change', state: 'open' });
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Annotation, DXN, Format, Obj, Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { PullRequest } from '@dxos/types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A narrated reading of a pull request: one markdown document whose prose, headings and ```diff
|
|
14
|
+
* fences describe the change in the order a reviewer should meet it.
|
|
15
|
+
*
|
|
16
|
+
* Generated against ONE commit and stale the moment the branch moves, which is why `commit` is part
|
|
17
|
+
* of the record rather than something to infer — see {@link isStale}.
|
|
18
|
+
*/
|
|
19
|
+
export class Walkthrough extends Type.makeObject<Walkthrough>(DXN.make('org.dxos.type.walkthrough', '0.1.0'))(
|
|
20
|
+
Schema.Struct({
|
|
21
|
+
/** The pull request this narrates. */
|
|
22
|
+
pullRequest: Ref.Ref(PullRequest.PullRequest),
|
|
23
|
+
|
|
24
|
+
/** `owner/repo#123: title`, copied at generation so the label needs no ref load. */
|
|
25
|
+
title: Schema.String.pipe(Schema.annotate({ title: 'Title' }), Schema.optional),
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The whole document, as a plain string rather than a text object.
|
|
29
|
+
*
|
|
30
|
+
* A walkthrough is replaced wholesale on every regeneration and is never co-edited character by
|
|
31
|
+
* character, so the CRDT a text object would impose is pure cost: it would keep per-character
|
|
32
|
+
* history for a document nobody edits.
|
|
33
|
+
*/
|
|
34
|
+
body: Schema.String.pipe(Schema.annotate({ title: 'Body' })),
|
|
35
|
+
|
|
36
|
+
/** Head SHA the walkthrough was generated from; anything else means it describes another change. */
|
|
37
|
+
commit: Schema.String.pipe(Schema.annotate({ title: 'Commit' })),
|
|
38
|
+
|
|
39
|
+
generatedAt: Format.DateTime.pipe(Schema.annotate({ title: 'Generated' }), Schema.optional),
|
|
40
|
+
|
|
41
|
+
/** Model that produced the prose, so a regression can be attributed after the default moves. */
|
|
42
|
+
model: Schema.String.pipe(Schema.annotate({ title: 'Model' }), Schema.optional),
|
|
43
|
+
|
|
44
|
+
/** Hunks the prose accounts for, over the patch's total — how much of the change it narrates. */
|
|
45
|
+
covered: Schema.Number.pipe(Schema.annotate({ title: 'Hunks covered' }), Schema.optional),
|
|
46
|
+
total: Schema.Number.pipe(Schema.annotate({ title: 'Hunks total' }), Schema.optional),
|
|
47
|
+
}).pipe(
|
|
48
|
+
Schema.annotate({ title: 'Walkthrough', description: 'A narrated reading of a pull request.' }),
|
|
49
|
+
Annotation.LabelAnnotation.set(['title', 'commit']),
|
|
50
|
+
Annotation.IconAnnotation.set({ icon: 'ph--path--regular', hue: 'indigo' }),
|
|
51
|
+
Annotation.UserType.set(),
|
|
52
|
+
),
|
|
53
|
+
) {}
|
|
54
|
+
|
|
55
|
+
/** Factory wrapper around `Obj.make` for {@link Walkthrough}. */
|
|
56
|
+
export const make = (props: Obj.MakeProps<typeof Walkthrough>): Walkthrough => Obj.make(Walkthrough, props);
|
|
57
|
+
|
|
58
|
+
/** Returns true when value is a Walkthrough object. */
|
|
59
|
+
export const instanceOf = (value: unknown): value is Walkthrough => Obj.instanceOf(Walkthrough, value);
|
|
60
|
+
|
|
61
|
+
/** The label a walkthrough of this pull request carries. */
|
|
62
|
+
export const makeTitle = (pullRequest: PullRequest.PullRequest, title = pullRequest.title): string =>
|
|
63
|
+
`${PullRequest.reference(pullRequest)}: ${title}`;
|
|
64
|
+
|
|
65
|
+
/** Whether the walkthrough describes a commit other than the one given. */
|
|
66
|
+
export const isStale = (walkthrough: Walkthrough, head: string): boolean => walkthrough.commit !== head;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
export * as GitHubCapabilities from './GitHubCapabilities.ts';
|
|
6
|
+
export * as GitHubEvents from './GitHubEvents.ts';
|
|
7
|
+
export * as GitHubOperation from './GitHubOperation.ts';
|
|
8
|
+
export * as Walkthrough from './Walkthrough.ts';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
//
|
|
4
|
+
// Copyright 2026 DXOS.org
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
declare module '*.mdl?raw' {
|
|
8
|
+
const content: string;
|
|
9
|
+
export default content;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module '*.patch?raw' {
|
|
13
|
+
const content: string;
|
|
14
|
+
export default content;
|
|
15
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { fillWalkthrough } from './fill.ts';
|
|
8
|
+
import { parsePatch } from './patch.ts';
|
|
9
|
+
|
|
10
|
+
const PATCH = [
|
|
11
|
+
'diff --git a/src/a.ts b/src/a.ts',
|
|
12
|
+
'index 111..222 100644',
|
|
13
|
+
'--- a/src/a.ts',
|
|
14
|
+
'+++ b/src/a.ts',
|
|
15
|
+
'@@ -10,3 +10,4 @@ const first = () => {',
|
|
16
|
+
' keep();',
|
|
17
|
+
'-was();',
|
|
18
|
+
'+is();',
|
|
19
|
+
'+added();',
|
|
20
|
+
'@@ -90,2 +91,2 @@ const second = () => {',
|
|
21
|
+
' context();',
|
|
22
|
+
'-old();',
|
|
23
|
+
'+new();',
|
|
24
|
+
'diff --git a/src/b.ts b/src/b.ts',
|
|
25
|
+
'index 333..444 100644',
|
|
26
|
+
'--- a/src/b.ts',
|
|
27
|
+
'+++ b/src/b.ts',
|
|
28
|
+
'@@ -1,1 +1,2 @@',
|
|
29
|
+
' header();',
|
|
30
|
+
'+extra();',
|
|
31
|
+
'',
|
|
32
|
+
].join('\n');
|
|
33
|
+
|
|
34
|
+
describe('parsePatch', () => {
|
|
35
|
+
test('splits files and hunks with post-change spans', () => {
|
|
36
|
+
const files = parsePatch(PATCH);
|
|
37
|
+
|
|
38
|
+
expect(files.map((file) => file.path)).to.deep.eq(['src/a.ts', 'src/b.ts']);
|
|
39
|
+
expect(files[0].hunks).to.have.length(2);
|
|
40
|
+
expect(files[0].hunks[0].afterStart).to.eq(10);
|
|
41
|
+
expect(files[0].hunks[0].afterEnd).to.eq(13);
|
|
42
|
+
expect(files[0].hunks[1].afterStart).to.eq(91);
|
|
43
|
+
expect(files[0].added).to.eq(3);
|
|
44
|
+
expect(files[0].removed).to.eq(2);
|
|
45
|
+
expect(files[1].hunks[0].lines).to.deep.eq([' header();', '+extra();']);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('keeps hunk bodies verbatim', () => {
|
|
49
|
+
const [first] = parsePatch(PATCH);
|
|
50
|
+
expect(first.hunks[0].header).to.eq('@@ -10,3 +10,4 @@ const first = () => {');
|
|
51
|
+
expect(first.hunks[0].lines).to.deep.eq([' keep();', '-was();', '+is();', '+added();']);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('reads a hunk header with no count', () => {
|
|
55
|
+
const [file] = parsePatch(
|
|
56
|
+
['diff --git a/src/c.ts b/src/c.ts', '--- a/src/c.ts', '+++ b/src/c.ts', '@@ -5 +5 @@', '-a;', '+b;'].join('\n'),
|
|
57
|
+
);
|
|
58
|
+
expect(file.hunks[0].afterStart).to.eq(5);
|
|
59
|
+
expect(file.hunks[0].afterEnd).to.eq(5);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('fillWalkthrough', () => {
|
|
64
|
+
test('fills an empty fence from the patch and states the real range', () => {
|
|
65
|
+
const body = ['# Change', '', 'Some prose.', '', '```diff file=src/a.ts lines=10-13', '```', ''].join('\n');
|
|
66
|
+
const { body: filled, covered } = fillWalkthrough(body, PATCH);
|
|
67
|
+
|
|
68
|
+
expect(filled).to.contain('```diff file=src/a.ts lines=10-13');
|
|
69
|
+
expect(filled).to.contain('@@ -10,3 +10,4 @@ const first = () => {');
|
|
70
|
+
expect(filled).to.contain('+added();');
|
|
71
|
+
// The second hunk of the same file is outside the requested range, so it is not in the chunk
|
|
72
|
+
// (it reappears below, under the section for what the walkthrough missed).
|
|
73
|
+
const [narrated] = filled.split('## Also changed');
|
|
74
|
+
expect(narrated).to.not.contain('+new();');
|
|
75
|
+
expect(covered).to.eq(1);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('takes every hunk of a file when the fence states no range', () => {
|
|
79
|
+
const body = ['```diff file=src/a.ts', '```', ''].join('\n');
|
|
80
|
+
const { body: filled, covered } = fillWalkthrough(body, PATCH);
|
|
81
|
+
|
|
82
|
+
expect(filled).to.contain('@@ -10,3 +10,4 @@');
|
|
83
|
+
expect(filled).to.contain('@@ -90,2 +91,2 @@');
|
|
84
|
+
expect(filled).to.contain('lines=10-92');
|
|
85
|
+
expect(covered).to.eq(2);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('appends the hunks the prose never mentioned', () => {
|
|
89
|
+
const body = ['# Change', '', '```diff file=src/a.ts lines=10-13', '```', ''].join('\n');
|
|
90
|
+
const { body: filled, missed } = fillWalkthrough(body, PATCH);
|
|
91
|
+
|
|
92
|
+
expect(missed.map((file) => file.path)).to.deep.eq(['src/a.ts', 'src/b.ts']);
|
|
93
|
+
expect(filled).to.contain('## Also changed');
|
|
94
|
+
expect(filled).to.contain('2 hunks across 2 files');
|
|
95
|
+
expect(filled).to.contain('+new();');
|
|
96
|
+
expect(filled).to.contain('+extra();');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('appends nothing when the walkthrough covers the patch', () => {
|
|
100
|
+
const body = ['```diff file=src/a.ts', '```', '', '```diff file=src/b.ts', '```', ''].join('\n');
|
|
101
|
+
const { body: filled, missed, covered, total } = fillWalkthrough(body, PATCH);
|
|
102
|
+
|
|
103
|
+
expect(missed).to.deep.eq([]);
|
|
104
|
+
expect(covered).to.eq(total);
|
|
105
|
+
expect(filled).to.not.contain('## Also changed');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('leaves a fence naming an unknown file alone and reports it', () => {
|
|
109
|
+
const body = ['```diff file=src/gone.ts', '```', ''].join('\n');
|
|
110
|
+
const { body: filled, unresolved } = fillWalkthrough(body, PATCH);
|
|
111
|
+
|
|
112
|
+
expect(unresolved).to.deep.eq(['src/gone.ts']);
|
|
113
|
+
expect(filled).to.contain('```diff file=src/gone.ts');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('leaves a fence the model filled itself, and still shows the real hunks below', () => {
|
|
117
|
+
const body = ['```diff file=src/a.ts lines=10-13', '@@ -1,1 +1,1 @@', '+hand written;', '```', ''].join('\n');
|
|
118
|
+
const { body: filled, covered } = fillWalkthrough(body, PATCH);
|
|
119
|
+
|
|
120
|
+
expect(filled).to.contain('+hand written;');
|
|
121
|
+
// Content the model wrote covers nothing: the genuine hunk still has to reach the reader, or a
|
|
122
|
+
// model that ignores the instruction silently replaces the change with its own account of it.
|
|
123
|
+
expect(covered).to.eq(0);
|
|
124
|
+
const [, appended] = filled.split('## Also changed');
|
|
125
|
+
expect(appended).to.contain('+added();');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('accepts a bare path on the fence', () => {
|
|
129
|
+
const { body: filled } = fillWalkthrough(['```diff src/b.ts', '```', ''].join('\n'), PATCH);
|
|
130
|
+
expect(filled).to.contain('+extra();');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('leaves prose around a fence untouched', () => {
|
|
134
|
+
const body = ['Before.', '', '```diff file=src/b.ts', '```', '', 'After.', ''].join('\n');
|
|
135
|
+
const { body: filled } = fillWalkthrough(body, PATCH);
|
|
136
|
+
|
|
137
|
+
expect(filled.startsWith('Before.\n')).to.eq(true);
|
|
138
|
+
expect(filled).to.contain('\nAfter.');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test('reads a patch with carriage returns', () => {
|
|
142
|
+
const { body: filled, total } = fillWalkthrough(
|
|
143
|
+
['```diff file=src/b.ts', '```', ''].join('\n'),
|
|
144
|
+
PATCH.split('\n').join('\r\n'),
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// Left in place the carriage returns defeat every anchored match, and the whole patch parses to
|
|
148
|
+
// nothing: an empty walkthrough that claims to have covered everything.
|
|
149
|
+
expect(total).to.eq(3);
|
|
150
|
+
expect(filled).to.contain('+extra();');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test('selects a pure-deletion hunk by its own reported range', () => {
|
|
154
|
+
const patch = [
|
|
155
|
+
'diff --git a/src/d.ts b/src/d.ts',
|
|
156
|
+
'--- a/src/d.ts',
|
|
157
|
+
'+++ b/src/d.ts',
|
|
158
|
+
'@@ -1,1 +1,1 @@',
|
|
159
|
+
' first();',
|
|
160
|
+
'@@ -10,2 +10,0 @@',
|
|
161
|
+
'-gone();',
|
|
162
|
+
'-also();',
|
|
163
|
+
].join('\n');
|
|
164
|
+
const { body: filled, covered } = fillWalkthrough(['```diff file=src/d.ts lines=10', '```', ''].join('\n'), patch);
|
|
165
|
+
|
|
166
|
+
// The post-image span of a removal is empty, so a naive overlap test can never match it and the
|
|
167
|
+
// fence silently widens to the whole file.
|
|
168
|
+
expect(covered).to.eq(1);
|
|
169
|
+
const [narrated] = filled.split('## Also changed');
|
|
170
|
+
expect(narrated).to.contain('-gone();');
|
|
171
|
+
expect(narrated).to.contain('lines=10-11');
|
|
172
|
+
// The other hunk is not in the fence; it reappears below, as anything unclaimed does.
|
|
173
|
+
expect(narrated).to.not.contain(' first();');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('keeps a fence indented inside a list item', () => {
|
|
177
|
+
const body = ['1. A step:', '', ' ```diff file=src/b.ts', ' ```', ''].join('\n');
|
|
178
|
+
const { body: filled } = fillWalkthrough(body, PATCH);
|
|
179
|
+
|
|
180
|
+
// An unindented closing fence ends the list item's block, not the fence. Scoped to the narrated
|
|
181
|
+
// part: the appended section is top-level prose and its fences are correctly unindented.
|
|
182
|
+
const [narrated] = filled.split('## Also changed');
|
|
183
|
+
expect(narrated).to.contain(' ```diff file=src/b.ts');
|
|
184
|
+
expect(narrated).to.contain(' +extra();');
|
|
185
|
+
expect(
|
|
186
|
+
narrated
|
|
187
|
+
.split('\n')
|
|
188
|
+
.filter((line) => line.trim() === '```')
|
|
189
|
+
.every((line) => line.startsWith(' ')),
|
|
190
|
+
).to.eq(true);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test('reports a fence that names no file', () => {
|
|
194
|
+
const { body: filled, unresolved } = fillWalkthrough(['```diff', '```', ''].join('\n'), PATCH);
|
|
195
|
+
|
|
196
|
+
expect(unresolved).to.have.length(1);
|
|
197
|
+
expect(filled).to.contain('```diff');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test('names a file the patch changed without changing a line', () => {
|
|
201
|
+
const patch = [
|
|
202
|
+
'diff --git a/old.ts b/new.ts',
|
|
203
|
+
'similarity index 100%',
|
|
204
|
+
'rename from old.ts',
|
|
205
|
+
'rename to new.ts',
|
|
206
|
+
].join('\n');
|
|
207
|
+
const { body: filled, textless, total } = fillWalkthrough('# Change\n', patch);
|
|
208
|
+
|
|
209
|
+
expect(total).to.eq(0);
|
|
210
|
+
expect(textless).to.deep.eq(['new.ts']);
|
|
211
|
+
expect(filled).to.contain('renamed or mode-only');
|
|
212
|
+
expect(filled).to.contain('new.ts');
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test('names generated and binary files without rendering their hunks', () => {
|
|
216
|
+
const patch = [
|
|
217
|
+
PATCH,
|
|
218
|
+
'diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml',
|
|
219
|
+
'--- a/pnpm-lock.yaml',
|
|
220
|
+
'+++ b/pnpm-lock.yaml',
|
|
221
|
+
'@@ -1,1 +1,2 @@',
|
|
222
|
+
' lockfileVersion: 9',
|
|
223
|
+
'+ resolution: {integrity: sha512-whatever}',
|
|
224
|
+
'diff --git a/assets/logo.png b/assets/logo.png',
|
|
225
|
+
'Binary files a/assets/logo.png and b/assets/logo.png differ',
|
|
226
|
+
'',
|
|
227
|
+
].join('\n');
|
|
228
|
+
const { body: filled, generated, missed } = fillWalkthrough('# Change\n', patch);
|
|
229
|
+
|
|
230
|
+
expect(generated).to.deep.eq(['pnpm-lock.yaml', 'assets/logo.png']);
|
|
231
|
+
expect(filled).to.contain('Generated or binary, not shown: pnpm-lock.yaml, assets/logo.png.');
|
|
232
|
+
expect(filled).to.not.contain('sha512-whatever');
|
|
233
|
+
expect(missed.map((file) => file.path)).to.not.include('pnpm-lock.yaml');
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test('drops a fence that points at a generated file rather than rendering it', () => {
|
|
237
|
+
const patch = [
|
|
238
|
+
PATCH,
|
|
239
|
+
'diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml',
|
|
240
|
+
'--- a/pnpm-lock.yaml',
|
|
241
|
+
'+++ b/pnpm-lock.yaml',
|
|
242
|
+
'@@ -1,1 +1,2 @@',
|
|
243
|
+
' lockfileVersion: 9',
|
|
244
|
+
'+ resolution: {integrity: sha512-whatever}',
|
|
245
|
+
'',
|
|
246
|
+
].join('\n');
|
|
247
|
+
const body = '# Change\n\nThe lockfile moved too.\n\n```diff file=pnpm-lock.yaml\n```\n';
|
|
248
|
+
const { body: filled, total } = fillWalkthrough(body, patch);
|
|
249
|
+
|
|
250
|
+
expect(filled).to.not.contain('sha512-whatever');
|
|
251
|
+
expect(filled).to.contain('The lockfile moved too.');
|
|
252
|
+
expect(filled).to.contain('Generated or binary, not shown: pnpm-lock.yaml.');
|
|
253
|
+
// The denominator drops with `missed`, or a walkthrough covering everything worth reading
|
|
254
|
+
// would report partial coverage.
|
|
255
|
+
expect(total).to.eq(3);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test('ends the range at a pure removal that a live hunk shares the fence with', () => {
|
|
259
|
+
const patch = [
|
|
260
|
+
'diff --git a/src/mixed.ts b/src/mixed.ts',
|
|
261
|
+
'--- a/src/mixed.ts',
|
|
262
|
+
'+++ b/src/mixed.ts',
|
|
263
|
+
'@@ -1,1 +1,2 @@',
|
|
264
|
+
' keep();',
|
|
265
|
+
'+added();',
|
|
266
|
+
// A pure removal spans nothing after the change: `afterEnd` is 98 while it sits at 99.
|
|
267
|
+
'@@ -100,1 +99,0 @@',
|
|
268
|
+
'-gone();',
|
|
269
|
+
].join('\n');
|
|
270
|
+
const { body: filled } = fillWalkthrough(['```diff file=src/mixed.ts', '```', ''].join('\n'), patch);
|
|
271
|
+
|
|
272
|
+
expect(filled).to.contain('lines=1-99');
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test('does not call a textless file unresolved as well', () => {
|
|
276
|
+
const patch = [
|
|
277
|
+
'diff --git a/old.ts b/new.ts',
|
|
278
|
+
'similarity index 100%',
|
|
279
|
+
'rename from old.ts',
|
|
280
|
+
'rename to new.ts',
|
|
281
|
+
].join('\n');
|
|
282
|
+
const { textless, unresolved } = fillWalkthrough(['```diff file=new.ts', '```', ''].join('\n'), patch);
|
|
283
|
+
|
|
284
|
+
// The patch does contain the file; `unresolved` is for one it does not.
|
|
285
|
+
expect(textless).to.deep.eq(['new.ts']);
|
|
286
|
+
expect(unresolved).to.deep.eq([]);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
test('emits no dangling attribute for a file it cannot fill', () => {
|
|
290
|
+
const patch = ['diff --git a/old.ts b/new.ts', 'similarity index 100%'].join('\n');
|
|
291
|
+
const { body: filled } = fillWalkthrough(['```diff file=new.ts', '```', ''].join('\n'), patch);
|
|
292
|
+
|
|
293
|
+
// `lines=` with no value is not a fence the editor reads; it renders as a bare code block.
|
|
294
|
+
expect(filled).to.not.contain('lines=\n');
|
|
295
|
+
expect(filled).to.not.contain('lines= ');
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test('merges hunks of a path the patch names twice', () => {
|
|
299
|
+
const patch = [
|
|
300
|
+
'diff --git a/src/x.ts b/src/x.ts',
|
|
301
|
+
'@@ -1,1 +1,2 @@',
|
|
302
|
+
' a;',
|
|
303
|
+
'+one();',
|
|
304
|
+
'diff --git a/src/x.ts b/src/x.ts',
|
|
305
|
+
'@@ -50,1 +51,2 @@',
|
|
306
|
+
' b;',
|
|
307
|
+
'+two();',
|
|
308
|
+
].join('\n');
|
|
309
|
+
const { body: filled, total } = fillWalkthrough(['```diff file=src/x.ts', '```', ''].join('\n'), patch);
|
|
310
|
+
|
|
311
|
+
// Keyed by path, the second occurrence would otherwise hide the first from every fence.
|
|
312
|
+
expect(total).to.eq(2);
|
|
313
|
+
expect(filled).to.contain('+one();');
|
|
314
|
+
expect(filled).to.contain('+two();');
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test('quotes a deleted file by the lines it removed', () => {
|
|
318
|
+
const patch = [
|
|
319
|
+
'diff --git a/src/gone.ts b/src/gone.ts',
|
|
320
|
+
'deleted file mode 100644',
|
|
321
|
+
'--- a/src/gone.ts',
|
|
322
|
+
'+++ /dev/null',
|
|
323
|
+
'@@ -1,2 +0,0 @@',
|
|
324
|
+
'-one();',
|
|
325
|
+
'-two();',
|
|
326
|
+
].join('\n');
|
|
327
|
+
const { body: filled } = fillWalkthrough(['```diff file=src/gone.ts', '```', ''].join('\n'), patch);
|
|
328
|
+
|
|
329
|
+
// The post-image is empty, so an after-side range would read as `Lines 0`.
|
|
330
|
+
expect(filled).to.contain('lines=1-2');
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
test('falls back to the whole file when the stated range matches no hunk', () => {
|
|
334
|
+
const { body: filled } = fillWalkthrough(['```diff file=src/b.ts lines=400-500', '```', ''].join('\n'), PATCH);
|
|
335
|
+
expect(filled).to.contain('+extra();');
|
|
336
|
+
});
|
|
337
|
+
});
|