From 8923bb48350bf0b0608b3a6e73c520c1ae464ec8 Mon Sep 17 00:00:00 2001 From: Mark Overholt Date: Thu, 5 Nov 2026 08:27:09 -0800 Subject: [PATCH] Add CodeFlow sample CodeFlow (GitHub pull request review over the public GitHub connector) as a complete sample app under samples/CodeFlow, with its README, setup skill and the add-data-source skill. App data is stored in the browser by default. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .gitignore | 5 + README.md | 1 + .../.claude/skills/add-data-source/SKILL.md | 185 + .../add-data-source/references/custom-api.md | 45 + .../add-data-source/references/dataverse.md | 49 + .../add-data-source/references/sharepoint.md | 59 + .../.claude/skills/setup-codeflow/SKILL.md | 146 + samples/CodeFlow/.env.example | 22 + .../.github/skills/add-data-source/SKILL.md | 185 + .../add-data-source/references/custom-api.md | 45 + .../add-data-source/references/dataverse.md | 49 + .../add-data-source/references/sharepoint.md | 59 + .../.github/skills/setup-codeflow/SKILL.md | 146 + samples/CodeFlow/.gitignore | 30 + samples/CodeFlow/.npmrc | 1 + samples/CodeFlow/AGENTS.md | 35 + samples/CodeFlow/README.md | 275 + samples/CodeFlow/eslint.config.js | 96 + samples/CodeFlow/index.html | 13 + samples/CodeFlow/package-lock.json | 6640 +++++++++++++++++ samples/CodeFlow/package.json | 54 + samples/CodeFlow/public/codeflow-logo.png | Bin 0 -> 3730 bytes samples/CodeFlow/public/codeflow-logo.svg | 7 + samples/CodeFlow/public/favicon.svg | 7 + .../scripts/__tests__/codeFontStyles.test.mjs | 37 + .../scripts/__tests__/contrast.test.mjs | 221 + samples/CodeFlow/scripts/check-setup.mjs | 96 + samples/CodeFlow/scripts/contrastCore.mjs | 335 + samples/CodeFlow/scripts/storage-describe.ts | 15 + samples/CodeFlow/src/App.css | 5636 ++++++++++++++ samples/CodeFlow/src/App.tsx | 42 + .../AutoMergeButton/AutoMergeButton.tsx | 139 + .../__tests__/AutoMergeButton.test.tsx | 159 + .../__tests__/autoMergeGate.test.ts | 158 + .../AutoMergeButton/autoMergeGate.ts | 113 + samples/CodeFlow/src/components/Avatar.tsx | 32 + .../src/components/BugSwarm/BugSwarm.tsx | 58 + .../BugSwarm/__tests__/BugSwarm.test.tsx | 262 + .../src/components/BugSwarm/useBugSwarm.ts | 103 + .../components/ChecksPill/ChecksDialog.tsx | 180 + .../src/components/ChecksPill/ChecksPill.tsx | 51 + .../ChecksPill/__tests__/ChecksPill.test.tsx | 178 + .../CherryPickButton/CherryPickButton.tsx | 264 + .../__tests__/CherryPickButton.test.tsx | 283 + .../CommentSummary/CommentSummary.tsx | 366 + .../__tests__/CommentSummary.test.tsx | 462 ++ .../__tests__/summaryFilter.test.ts | 276 + .../__tests__/summarySort.test.ts | 182 + .../CommentSummary/summaryFilter.ts | 160 + .../components/CommentSummary/summarySort.ts | 121 + .../CommentThread/CollapsedThread.tsx | 37 + .../CommentThread/CommentThread.tsx | 478 ++ .../__tests__/CommentThread.test.tsx | 547 ++ .../__tests__/draftSurvivesReload.test.tsx | 185 + .../__tests__/githubCommentLink.test.tsx | 130 + .../ConnectionBanner/ConnectionBanner.tsx | 48 + .../__tests__/ConnectionBanner.test.tsx | 43 + .../CopyLinkButton/CopyLinkButton.tsx | 51 + .../__tests__/CopyLinkButton.test.tsx | 81 + .../src/components/Dashboard/Dashboard.tsx | 861 +++ .../__tests__/PinnedSection.test.tsx | 202 + .../Dashboard/__tests__/PrRow.test.tsx | 112 + .../__tests__/useFlaggedCleanup.test.ts | 97 + .../components/Dashboard/useFlaggedCleanup.ts | 61 + .../src/components/DiffViewer/ChangeMap.tsx | 70 + .../DiffViewer/CommentLineButton.tsx | 22 + .../components/DiffViewer/DeferredSyntax.tsx | 72 + .../components/DiffViewer/DescriptionView.tsx | 98 + .../components/DiffViewer/DiffBlockNav.tsx | 40 + .../src/components/DiffViewer/DiffHeader.tsx | 222 + .../components/DiffViewer/DiffSearchBox.tsx | 141 + .../src/components/DiffViewer/DiffViewer.tsx | 845 +++ .../DiffViewer/FolderDiffViewer.tsx | 144 + .../src/components/DiffViewer/InlineDiff.tsx | 73 + .../components/DiffViewer/InlineDiffRow.tsx | 68 + .../components/DiffViewer/LineFocusNotice.tsx | 39 + .../components/DiffViewer/MarkdownPreview.tsx | 134 + .../components/DiffViewer/OrphanedThreads.tsx | 63 + .../components/DiffViewer/RenameNotice.tsx | 39 + .../src/components/DiffViewer/SplitDiff.tsx | 158 + .../components/DiffViewer/SplitDiffRow.tsx | 99 + .../src/components/DiffViewer/ThreadBadge.tsx | 27 + .../DiffViewer/WhitespaceNotice.tsx | 57 + .../__tests__/DeferredSyntax.test.tsx | 128 + .../__tests__/DescriptionView.test.tsx | 133 + .../__tests__/DiffBlockNav.test.tsx | 48 + .../DiffViewer/__tests__/DiffHeader.test.tsx | 336 + .../DiffViewer/__tests__/DiffRowMemo.test.tsx | 89 + .../__tests__/DiffSearchBox.test.tsx | 115 + .../__tests__/FolderDiffViewer.test.tsx | 148 + .../FolderDiffViewerComments.test.tsx | 146 + .../__tests__/MarkdownPreview.test.tsx | 186 + .../MarkdownPreviewComments.test.tsx | 180 + .../__tests__/MultiLineComments.test.tsx | 217 + .../__tests__/OrphanedThreads.test.tsx | 128 + .../__tests__/RenameNotice.test.tsx | 56 + .../__tests__/SplitDiffSelection.test.tsx | 86 + .../__tests__/SplitDiffSides.test.tsx | 119 + .../DiffViewer/__tests__/ThreadBadge.test.tsx | 76 + .../__tests__/WhitespaceNotice.test.tsx | 49 + .../DiffViewer/__tests__/cellLayers.test.ts | 193 + .../__tests__/descriptionDraft.test.tsx | 78 + .../DiffViewer/__tests__/diffBlocks.test.ts | 74 + .../__tests__/diffSearchModel.test.ts | 123 + .../__tests__/diffViewerUtils.test.ts | 84 + .../__tests__/fileSwitchContent.test.tsx | 165 + .../__tests__/lineFocusIntegration.test.tsx | 402 + .../__tests__/lineFocusLifecycle.test.tsx | 299 + .../DiffViewer/__tests__/lineReveal.test.ts | 155 + .../DiffViewer/__tests__/renderCell.test.tsx | 87 + .../DiffViewer/__tests__/rowForLine.test.ts | 78 + .../__tests__/selectedCommentRange.test.tsx | 72 + .../__tests__/selectionRange.test.ts | 130 + .../DiffViewer/__tests__/splitRatio.test.ts | 37 + .../__tests__/useDiffBlockNav.test.ts | 134 + .../__tests__/useDiffSearch.test.tsx | 146 + .../__tests__/useFileComments.test.tsx | 199 + .../__tests__/useFileCommentsDraft.test.tsx | 61 + .../__tests__/useSelectionHighlight.test.tsx | 268 + .../__tests__/useSyntaxHighlight.test.ts | 201 + .../DiffViewer/__tests__/useWordDiff.test.tsx | 108 + .../src/components/DiffViewer/cellLayers.ts | 188 + .../src/components/DiffViewer/diffBlocks.ts | 68 + .../components/DiffViewer/diffSearchModel.ts | 130 + .../components/DiffViewer/diffViewerUtils.ts | 85 + .../src/components/DiffViewer/lineReveal.ts | 94 + .../src/components/DiffViewer/renderCell.tsx | 73 + .../src/components/DiffViewer/rowForLine.ts | 59 + .../DiffViewer/selectedCommentRange.ts | 36 + .../components/DiffViewer/selectionRange.ts | 100 + .../components/DiffViewer/useDiffBlockNav.ts | 136 + .../components/DiffViewer/useDiffSearch.tsx | 165 + .../components/DiffViewer/useFileComments.tsx | 283 + .../DiffViewer/useSelectionHighlight.ts | 183 + .../DiffViewer/useSyntaxHighlight.ts | 150 + .../src/components/DiffViewer/useWordDiff.tsx | 158 + .../FeedbackDialog/FeedbackDialog.tsx | 185 + .../components/FeedbackDialog/IssueEditor.tsx | 88 + .../components/FeedbackDialog/IssueRow.tsx | 156 + .../components/FeedbackDialog/IssueThread.tsx | 176 + .../__tests__/FeedbackDialog.test.tsx | 364 + .../__tests__/IssueThread.test.tsx | 215 + .../__tests__/issueFilter.test.ts | 134 + .../components/FeedbackDialog/issueFilter.ts | 107 + .../FeedbackDialog/useIssueComments.ts | 117 + .../components/FeedbackDialog/useIssues.ts | 159 + .../FileCompareDialog/FileCompareDialog.tsx | 177 + .../__tests__/FileCompareDialog.test.tsx | 218 + .../src/components/FileList/FileList.tsx | 516 ++ .../__tests__/FileList.filter.test.tsx | 150 + .../FileList/__tests__/FileList.test.tsx | 299 + samples/CodeFlow/src/components/GearIcon.tsx | 9 + .../components/IterationBar/IterationBar.tsx | 272 + .../__tests__/IterationBar.test.tsx | 448 ++ .../CodeFlow/src/components/Layout/Layout.tsx | 530 ++ .../src/components/Layout/RefreshTimer.tsx | 59 + .../src/components/Layout/ReviewerList.tsx | 87 + .../Layout/__tests__/RefreshTimer.test.tsx | 76 + .../Layout/__tests__/ReviewerList.test.tsx | 104 + .../Layout/__tests__/authorApproval.test.tsx | 82 + .../Layout/__tests__/collapseSidebar.test.tsx | 116 + .../Layout/__tests__/filterReviewers.test.ts | 57 + .../Layout/__tests__/prStateBadge.test.ts | 43 + .../Layout/__tests__/resizeSummary.test.tsx | 200 + .../Layout/__tests__/searchPanel.test.tsx | 199 + .../Layout/__tests__/summaryOpen.test.ts | 29 + .../src/components/Layout/filterReviewers.ts | 15 + .../src/components/Layout/formatCountdown.ts | 6 + .../src/components/Layout/prStateBadge.ts | 27 + .../LocalModeNotice/LocalModeNotice.tsx | 37 + .../components/MarkdownBody/MarkdownBody.tsx | 108 + .../__tests__/MarkdownBody.test.tsx | 57 + .../MarkdownToolbar/MarkdownToolbar.tsx | 395 + .../MentionCandidatesProvider.tsx | 87 + .../__tests__/MarkdownToolbar.test.tsx | 128 + .../MentionCandidatesProvider.test.tsx | 153 + .../__tests__/mentions.test.ts | 135 + .../MarkdownToolbar/mentionContext.ts | 28 + .../components/MarkdownToolbar/mentions.ts | 122 + .../components/MergeButton/MergeButton.tsx | 119 + .../__tests__/MergeButton.test.tsx | 164 + .../MergeButton/__tests__/mergeGate.test.ts | 189 + .../src/components/MergeButton/mergeGate.ts | 109 + .../OpeningSplash/OpeningSplash.tsx | 47 + .../__tests__/OpeningSplash.test.tsx | 70 + .../__tests__/splashTarget.test.ts | 31 + .../OpeningSplash/describeTarget.ts | 16 + .../components/OpeningSplash/splashTarget.ts | 20 + .../PublishDraftButton/PublishDraftButton.tsx | 59 + .../__tests__/PublishDraftButton.test.tsx | 131 + .../__tests__/publishGate.test.ts | 65 + .../PublishDraftButton/publishGate.ts | 48 + .../SearchResults/SearchResults.tsx | 211 + .../__tests__/SearchResults.test.tsx | 163 + .../__tests__/crossFileSearch.test.ts | 190 + .../SearchResults/crossFileSearch.ts | 153 + .../components/SettingsDialog/DataSection.tsx | 102 + .../SettingsDialog/GeneralSection.tsx | 79 + .../components/SettingsDialog/PrsSection.tsx | 284 + .../SettingsDialog/SettingsDialog.tsx | 126 + .../__tests__/SettingsDialog.test.tsx | 339 + .../components/SettingsDialog/controls.tsx | 68 + .../SetupRequired/SetupRequired.tsx | 25 + .../src/components/__tests__/Avatar.test.tsx | 39 + samples/CodeFlow/src/config.ts | 61 + samples/CodeFlow/src/connectors/github.ts | 256 + samples/CodeFlow/src/env.d.ts | 16 + samples/CodeFlow/src/index.css | 37 + .../CodeFlow/src/lib/__tests__/config.test.ts | 28 + .../src/lib/__tests__/safeUrl.test.ts | 31 + samples/CodeFlow/src/lib/logger.ts | 44 + samples/CodeFlow/src/lib/safeUrl.ts | 21 + samples/CodeFlow/src/main.tsx | 17 + .../services/__tests__/authorApproval.test.ts | 95 + .../__tests__/connectionHealth.test.ts | 117 + .../services/__tests__/describeError.test.ts | 52 + .../__tests__/githubService.branches.test.ts | 140 + .../githubService.collaborators.test.ts | 143 + .../githubService.fileContent.test.ts | 52 + .../__tests__/githubService.identity.test.ts | 117 + ...githubService.listPullRequestFiles.test.ts | 98 + .../__tests__/githubService.merge.test.ts | 159 + .../githubService.searchCache.test.ts | 218 + .../__tests__/graphQlEnvelope.test.ts | 41 + .../services/__tests__/searchParse.test.ts | 114 + .../CodeFlow/src/services/authorApproval.ts | 99 + .../autoMerge/__tests__/autoMerge.test.ts | 188 + .../__tests__/autoMergeQuery.test.ts | 177 + .../src/services/autoMerge/autoMergeQuery.ts | 163 + .../CodeFlow/src/services/autoMerge/index.ts | 129 + .../checks/__tests__/checkLinks.test.ts | 65 + .../checks/__tests__/checksQuery.test.ts | 259 + .../checks/__tests__/fetchChecks.test.ts | 109 + .../src/services/checks/checkLinks.ts | 31 + .../src/services/checks/checksQuery.ts | 191 + samples/CodeFlow/src/services/checks/index.ts | 59 + .../cherryPick/__tests__/cherryPick.test.ts | 476 ++ .../__tests__/cherryPickPlan.test.ts | 274 + .../__tests__/threeWayMerge.test.ts | 161 + .../src/services/cherryPick/cherryPick.ts | 480 ++ .../src/services/cherryPick/cherryPickPlan.ts | 242 + .../CodeFlow/src/services/cherryPick/index.ts | 3 + .../src/services/cherryPick/threeWayMerge.ts | 143 + .../src/services/comments/CommentStore.ts | 82 + .../services/comments/GitHubCommentStore.ts | 151 + .../services/comments/LocalCommentStore.ts | 122 + .../__tests__/GitHubCommentStore.test.ts | 133 + .../__tests__/LocalCommentStore.test.ts | 39 + .../github/__tests__/anchorMarker.test.ts | 94 + .../github/__tests__/commentDeleter.test.ts | 67 + .../github/__tests__/commentEditor.test.ts | 132 + .../github/__tests__/graphqlComments.test.ts | 312 + .../comments/github/__tests__/helpers.test.ts | 84 + .../github/__tests__/issueReplyMarker.test.ts | 44 + .../__tests__/multiLineComments.test.ts | 116 + .../github/__tests__/threadParser.test.ts | 505 ++ .../services/comments/github/anchorMarker.ts | 91 + .../comments/github/commentDeleter.ts | 29 + .../services/comments/github/commentEditor.ts | 98 + .../services/comments/github/conversation.ts | 139 + .../src/services/comments/github/helpers.ts | 50 + .../comments/github/issueReplyMarker.ts | 51 + .../services/comments/github/reviewWriter.ts | 360 + .../src/services/comments/github/reviews.ts | 54 + .../services/comments/github/threadParser.ts | 336 + .../comments/github/threadResolution.ts | 46 + .../CodeFlow/src/services/comments/index.ts | 45 + .../CodeFlow/src/services/connectionHealth.ts | 158 + .../draft/__tests__/draftQuery.test.ts | 110 + .../draft/__tests__/publishDraft.test.ts | 134 + .../CodeFlow/src/services/draft/draftQuery.ts | 77 + samples/CodeFlow/src/services/draft/index.ts | 63 + samples/CodeFlow/src/services/errors.ts | 44 + .../CodeFlow/src/services/githubService.ts | 868 +++ samples/CodeFlow/src/services/graphQl.ts | 81 + .../CodeFlow/src/services/graphQlEnvelope.ts | 40 + .../issues/__tests__/commentStore.test.ts | 101 + .../issues/__tests__/issueStore.test.ts | 123 + .../src/services/issues/commentStore.ts | 124 + .../src/services/issues/issueStore.ts | 197 + samples/CodeFlow/src/services/searchParse.ts | 101 + .../src/settings/__tests__/codeFont.test.ts | 47 + .../src/settings/__tests__/settings.test.ts | 315 + .../settings/__tests__/settingsStore.test.ts | 99 + .../src/settings/__tests__/theme.test.ts | 140 + samples/CodeFlow/src/settings/codeFont.ts | 26 + samples/CodeFlow/src/settings/settings.ts | 342 + .../CodeFlow/src/settings/settingsStore.ts | 152 + samples/CodeFlow/src/settings/theme.ts | 87 + samples/CodeFlow/src/settings/useSettings.ts | 36 + .../CodeFlow/src/state/CodeFlowProvider.tsx | 206 + samples/CodeFlow/src/state/codeFlowContext.ts | 195 + .../hooks/__tests__/deleteComment.test.ts | 117 + .../hooks/__tests__/fetchReviewers.test.ts | 137 + .../hooks/__tests__/foldPrStatus.test.ts | 145 + .../hooks/__tests__/reviewedIteration.test.ts | 73 + .../hooks/__tests__/useAutoMerge.test.ts | 165 + .../hooks/__tests__/useCommentActions.test.ts | 665 ++ .../state/hooks/__tests__/useDeepLink.test.ts | 260 + .../hooks/__tests__/useDraftActions.test.ts | 128 + .../hooks/__tests__/useFileSelection.test.ts | 199 + .../hooks/__tests__/useIterations.test.ts | 144 + .../hooks/__tests__/useMergeActions.test.ts | 134 + .../state/hooks/__tests__/usePrLoader.test.ts | 717 ++ .../hooks/__tests__/usePrPolling.test.ts | 431 ++ .../hooks/__tests__/useReviewActions.test.ts | 406 + .../CodeFlow/src/state/hooks/foldPrStatus.ts | 68 + .../src/state/hooks/reviewedIteration.ts | 29 + .../CodeFlow/src/state/hooks/useAutoMerge.ts | 94 + samples/CodeFlow/src/state/hooks/useChecks.ts | 68 + .../src/state/hooks/useCommentActions.ts | 371 + .../CodeFlow/src/state/hooks/useDeepLink.ts | 121 + .../src/state/hooks/useDraftActions.ts | 39 + .../src/state/hooks/useFileSelection.ts | 99 + .../CodeFlow/src/state/hooks/useIterations.ts | 85 + .../CodeFlow/src/state/hooks/useLineFocus.ts | 48 + .../src/state/hooks/useMergeActions.ts | 47 + .../CodeFlow/src/state/hooks/usePrLoader.ts | 362 + .../src/state/hooks/useReviewActions.ts | 132 + .../src/state/hooks/useReviewStateRevision.ts | 37 + samples/CodeFlow/src/state/useCodeFlow.ts | 18 + .../src/storage/__tests__/appStorage.test.ts | 110 + samples/CodeFlow/src/storage/collections.ts | 165 + .../CodeFlow/src/storage/core/StorageRoot.tsx | 7 + .../src/storage/core/__tests__/core.test.ts | 100 + .../core/__tests__/tableBacked.test.ts | 56 + samples/CodeFlow/src/storage/core/context.ts | 4 + samples/CodeFlow/src/storage/core/contract.ts | 177 + samples/CodeFlow/src/storage/core/describe.ts | 24 + samples/CodeFlow/src/storage/core/errors.ts | 58 + samples/CodeFlow/src/storage/core/hooks.ts | 59 + samples/CodeFlow/src/storage/core/index.ts | 22 + samples/CodeFlow/src/storage/core/meta.ts | 10 + .../src/storage/core/providers/local.ts | 37 + .../src/storage/core/providers/memory.ts | 45 + .../src/storage/core/providers/tableBacked.ts | 323 + .../src/storage/core/providers/webStorage.ts | 392 + samples/CodeFlow/src/storage/core/query.ts | 66 + samples/CodeFlow/src/storage/core/retry.ts | 19 + .../src/storage/core/snapshotFiles.ts | 38 + samples/CodeFlow/src/storage/core/types.ts | 140 + samples/CodeFlow/src/storage/index.ts | 201 + samples/CodeFlow/src/storage/mirror.ts | 167 + .../CodeFlow/src/storage/providers/session.ts | 21 + samples/CodeFlow/src/test/selectCode.ts | 22 + samples/CodeFlow/src/test/setup.ts | 8 + samples/CodeFlow/src/types/index.ts | 453 ++ .../src/utils/__tests__/bugSwarm.test.ts | 172 + .../src/utils/__tests__/closedThreads.test.ts | 46 + .../utils/__tests__/commentBackend.test.ts | 20 + .../src/utils/__tests__/commentDrafts.test.ts | 135 + .../src/utils/__tests__/commentEdit.test.ts | 71 + .../utils/__tests__/dashboardReview.test.ts | 160 + .../src/utils/__tests__/deepLink.test.ts | 378 + .../src/utils/__tests__/diffPane.test.ts | 56 + .../src/utils/__tests__/diffParser.test.ts | 188 + .../src/utils/__tests__/diffSearch.test.ts | 117 + .../src/utils/__tests__/diffSide.test.ts | 153 + .../utils/__tests__/fileComparison.test.ts | 94 + .../src/utils/__tests__/forcePush.test.ts | 122 + .../src/utils/__tests__/format.test.ts | 119 + .../utils/__tests__/fullFileBudget.test.ts | 82 + .../src/utils/__tests__/githubLink.test.ts | 117 + .../src/utils/__tests__/lastReviewed.test.ts | 168 + .../utils/__tests__/mergeIterations.test.ts | 235 + .../src/utils/__tests__/motion.test.ts | 48 + .../src/utils/__tests__/openPrMemory.test.ts | 75 + .../src/utils/__tests__/parsePrInput.test.ts | 81 + .../utils/__tests__/pendingComment.test.ts | 23 + .../src/utils/__tests__/preferences.test.ts | 100 + .../src/utils/__tests__/renameInfo.test.ts | 119 + .../src/utils/__tests__/sameThreads.test.ts | 199 + .../utils/__tests__/selectionToken.test.ts | 100 + .../src/utils/__tests__/sharedClosed.test.ts | 161 + .../src/utils/__tests__/storage.test.ts | 470 ++ .../src/utils/__tests__/threadAnchor.test.ts | 66 + .../src/utils/__tests__/threadStatus.test.ts | 78 + .../src/utils/__tests__/useDraft.test.ts | 79 + .../CodeFlow/src/utils/__tests__/zip.test.ts | 80 + samples/CodeFlow/src/utils/bugSwarm.ts | 179 + samples/CodeFlow/src/utils/commentBackend.ts | 12 + samples/CodeFlow/src/utils/commentDrafts.ts | 208 + samples/CodeFlow/src/utils/commentEdit.ts | 29 + samples/CodeFlow/src/utils/commentRange.ts | 27 + samples/CodeFlow/src/utils/dashboardReview.ts | 103 + samples/CodeFlow/src/utils/deepLink.ts | 322 + samples/CodeFlow/src/utils/diffPane.ts | 22 + samples/CodeFlow/src/utils/diffParser.ts | 235 + samples/CodeFlow/src/utils/diffSearch.ts | 105 + samples/CodeFlow/src/utils/diffSide.ts | 87 + samples/CodeFlow/src/utils/fileComparison.ts | 92 + samples/CodeFlow/src/utils/forcePush.ts | 73 + samples/CodeFlow/src/utils/format.ts | 78 + samples/CodeFlow/src/utils/fullFileBudget.ts | 81 + samples/CodeFlow/src/utils/githubLink.ts | 78 + samples/CodeFlow/src/utils/lastReviewed.ts | 92 + samples/CodeFlow/src/utils/lineAlignment.ts | 41 + .../src/utils/markdownPreview.test.ts | 172 + samples/CodeFlow/src/utils/markdownPreview.ts | 244 + samples/CodeFlow/src/utils/mergeIterations.ts | 168 + samples/CodeFlow/src/utils/motion.ts | 22 + samples/CodeFlow/src/utils/openPrMemory.ts | 113 + samples/CodeFlow/src/utils/parsePrInput.ts | 47 + samples/CodeFlow/src/utils/pendingComment.ts | 30 + samples/CodeFlow/src/utils/preferences.ts | 137 + samples/CodeFlow/src/utils/renameInfo.ts | 109 + samples/CodeFlow/src/utils/sameThreads.ts | 155 + samples/CodeFlow/src/utils/selectionToken.ts | 89 + samples/CodeFlow/src/utils/sharedClosed.ts | 126 + samples/CodeFlow/src/utils/storage.ts | 542 ++ .../src/utils/syntax/__tests__/engine.test.ts | 193 + .../utils/syntax/__tests__/languages.test.ts | 80 + .../syntax/__tests__/largeFileSyntax.test.tsx | 39 + .../syntax/__tests__/shikiEngine.test.tsx | 125 + .../syntax/__tests__/sideDocuments.test.ts | 146 + .../src/utils/syntax/__tests__/tokens.test.ts | 59 + samples/CodeFlow/src/utils/syntax/engine.ts | 108 + .../CodeFlow/src/utils/syntax/languages.ts | 220 + .../CodeFlow/src/utils/syntax/shikiEngine.ts | 229 + .../src/utils/syntax/sideDocuments.ts | 152 + samples/CodeFlow/src/utils/syntax/tokens.ts | 199 + samples/CodeFlow/src/utils/threadAnchor.ts | 60 + samples/CodeFlow/src/utils/threadStatus.ts | 43 + samples/CodeFlow/src/utils/useDraft.ts | 69 + .../CodeFlow/src/utils/whitespaceDiff.test.ts | 303 + samples/CodeFlow/src/utils/whitespaceDiff.ts | 186 + samples/CodeFlow/src/utils/wordDiff.test.ts | 88 + samples/CodeFlow/src/utils/wordDiff.ts | 156 + samples/CodeFlow/src/utils/zip.ts | 132 + samples/CodeFlow/tsconfig.app.json | 25 + samples/CodeFlow/tsconfig.json | 7 + samples/CodeFlow/tsconfig.node.json | 24 + samples/CodeFlow/vite.config.ts | 39 + 433 files changed, 71013 insertions(+) create mode 100644 samples/CodeFlow/.claude/skills/add-data-source/SKILL.md create mode 100644 samples/CodeFlow/.claude/skills/add-data-source/references/custom-api.md create mode 100644 samples/CodeFlow/.claude/skills/add-data-source/references/dataverse.md create mode 100644 samples/CodeFlow/.claude/skills/add-data-source/references/sharepoint.md create mode 100644 samples/CodeFlow/.claude/skills/setup-codeflow/SKILL.md create mode 100644 samples/CodeFlow/.env.example create mode 100644 samples/CodeFlow/.github/skills/add-data-source/SKILL.md create mode 100644 samples/CodeFlow/.github/skills/add-data-source/references/custom-api.md create mode 100644 samples/CodeFlow/.github/skills/add-data-source/references/dataverse.md create mode 100644 samples/CodeFlow/.github/skills/add-data-source/references/sharepoint.md create mode 100644 samples/CodeFlow/.github/skills/setup-codeflow/SKILL.md create mode 100644 samples/CodeFlow/.gitignore create mode 100644 samples/CodeFlow/.npmrc create mode 100644 samples/CodeFlow/AGENTS.md create mode 100644 samples/CodeFlow/README.md create mode 100644 samples/CodeFlow/eslint.config.js create mode 100644 samples/CodeFlow/index.html create mode 100644 samples/CodeFlow/package-lock.json create mode 100644 samples/CodeFlow/package.json create mode 100644 samples/CodeFlow/public/codeflow-logo.png create mode 100644 samples/CodeFlow/public/codeflow-logo.svg create mode 100644 samples/CodeFlow/public/favicon.svg create mode 100644 samples/CodeFlow/scripts/__tests__/codeFontStyles.test.mjs create mode 100644 samples/CodeFlow/scripts/__tests__/contrast.test.mjs create mode 100644 samples/CodeFlow/scripts/check-setup.mjs create mode 100644 samples/CodeFlow/scripts/contrastCore.mjs create mode 100644 samples/CodeFlow/scripts/storage-describe.ts create mode 100644 samples/CodeFlow/src/App.css create mode 100644 samples/CodeFlow/src/App.tsx create mode 100644 samples/CodeFlow/src/components/AutoMergeButton/AutoMergeButton.tsx create mode 100644 samples/CodeFlow/src/components/AutoMergeButton/__tests__/AutoMergeButton.test.tsx create mode 100644 samples/CodeFlow/src/components/AutoMergeButton/__tests__/autoMergeGate.test.ts create mode 100644 samples/CodeFlow/src/components/AutoMergeButton/autoMergeGate.ts create mode 100644 samples/CodeFlow/src/components/Avatar.tsx create mode 100644 samples/CodeFlow/src/components/BugSwarm/BugSwarm.tsx create mode 100644 samples/CodeFlow/src/components/BugSwarm/__tests__/BugSwarm.test.tsx create mode 100644 samples/CodeFlow/src/components/BugSwarm/useBugSwarm.ts create mode 100644 samples/CodeFlow/src/components/ChecksPill/ChecksDialog.tsx create mode 100644 samples/CodeFlow/src/components/ChecksPill/ChecksPill.tsx create mode 100644 samples/CodeFlow/src/components/ChecksPill/__tests__/ChecksPill.test.tsx create mode 100644 samples/CodeFlow/src/components/CherryPickButton/CherryPickButton.tsx create mode 100644 samples/CodeFlow/src/components/CherryPickButton/__tests__/CherryPickButton.test.tsx create mode 100644 samples/CodeFlow/src/components/CommentSummary/CommentSummary.tsx create mode 100644 samples/CodeFlow/src/components/CommentSummary/__tests__/CommentSummary.test.tsx create mode 100644 samples/CodeFlow/src/components/CommentSummary/__tests__/summaryFilter.test.ts create mode 100644 samples/CodeFlow/src/components/CommentSummary/__tests__/summarySort.test.ts create mode 100644 samples/CodeFlow/src/components/CommentSummary/summaryFilter.ts create mode 100644 samples/CodeFlow/src/components/CommentSummary/summarySort.ts create mode 100644 samples/CodeFlow/src/components/CommentThread/CollapsedThread.tsx create mode 100644 samples/CodeFlow/src/components/CommentThread/CommentThread.tsx create mode 100644 samples/CodeFlow/src/components/CommentThread/__tests__/CommentThread.test.tsx create mode 100644 samples/CodeFlow/src/components/CommentThread/__tests__/draftSurvivesReload.test.tsx create mode 100644 samples/CodeFlow/src/components/CommentThread/__tests__/githubCommentLink.test.tsx create mode 100644 samples/CodeFlow/src/components/ConnectionBanner/ConnectionBanner.tsx create mode 100644 samples/CodeFlow/src/components/ConnectionBanner/__tests__/ConnectionBanner.test.tsx create mode 100644 samples/CodeFlow/src/components/CopyLinkButton/CopyLinkButton.tsx create mode 100644 samples/CodeFlow/src/components/CopyLinkButton/__tests__/CopyLinkButton.test.tsx create mode 100644 samples/CodeFlow/src/components/Dashboard/Dashboard.tsx create mode 100644 samples/CodeFlow/src/components/Dashboard/__tests__/PinnedSection.test.tsx create mode 100644 samples/CodeFlow/src/components/Dashboard/__tests__/PrRow.test.tsx create mode 100644 samples/CodeFlow/src/components/Dashboard/__tests__/useFlaggedCleanup.test.ts create mode 100644 samples/CodeFlow/src/components/Dashboard/useFlaggedCleanup.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/ChangeMap.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/CommentLineButton.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/DeferredSyntax.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/DescriptionView.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/DiffBlockNav.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/DiffHeader.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/DiffSearchBox.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/DiffViewer.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/FolderDiffViewer.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/InlineDiff.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/InlineDiffRow.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/LineFocusNotice.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/MarkdownPreview.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/OrphanedThreads.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/RenameNotice.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/SplitDiff.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/SplitDiffRow.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/ThreadBadge.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/WhitespaceNotice.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/DeferredSyntax.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/DescriptionView.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/DiffBlockNav.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/DiffHeader.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/DiffRowMemo.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/DiffSearchBox.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/FolderDiffViewer.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/FolderDiffViewerComments.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/MarkdownPreview.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/MarkdownPreviewComments.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/MultiLineComments.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/OrphanedThreads.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/RenameNotice.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/SplitDiffSelection.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/SplitDiffSides.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/ThreadBadge.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/WhitespaceNotice.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/cellLayers.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/descriptionDraft.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/diffBlocks.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/diffSearchModel.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/diffViewerUtils.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/fileSwitchContent.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/lineFocusIntegration.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/lineFocusLifecycle.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/lineReveal.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/renderCell.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/rowForLine.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/selectedCommentRange.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/selectionRange.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/splitRatio.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/useDiffBlockNav.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/useDiffSearch.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/useFileComments.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/useFileCommentsDraft.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/useSelectionHighlight.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/useSyntaxHighlight.test.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/__tests__/useWordDiff.test.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/cellLayers.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/diffBlocks.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/diffSearchModel.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/diffViewerUtils.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/lineReveal.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/renderCell.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/rowForLine.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/selectedCommentRange.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/selectionRange.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/useDiffBlockNav.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/useDiffSearch.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/useFileComments.tsx create mode 100644 samples/CodeFlow/src/components/DiffViewer/useSelectionHighlight.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/useSyntaxHighlight.ts create mode 100644 samples/CodeFlow/src/components/DiffViewer/useWordDiff.tsx create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/FeedbackDialog.tsx create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/IssueEditor.tsx create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/IssueRow.tsx create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/IssueThread.tsx create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/__tests__/FeedbackDialog.test.tsx create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/__tests__/IssueThread.test.tsx create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/__tests__/issueFilter.test.ts create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/issueFilter.ts create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/useIssueComments.ts create mode 100644 samples/CodeFlow/src/components/FeedbackDialog/useIssues.ts create mode 100644 samples/CodeFlow/src/components/FileCompareDialog/FileCompareDialog.tsx create mode 100644 samples/CodeFlow/src/components/FileCompareDialog/__tests__/FileCompareDialog.test.tsx create mode 100644 samples/CodeFlow/src/components/FileList/FileList.tsx create mode 100644 samples/CodeFlow/src/components/FileList/__tests__/FileList.filter.test.tsx create mode 100644 samples/CodeFlow/src/components/FileList/__tests__/FileList.test.tsx create mode 100644 samples/CodeFlow/src/components/GearIcon.tsx create mode 100644 samples/CodeFlow/src/components/IterationBar/IterationBar.tsx create mode 100644 samples/CodeFlow/src/components/IterationBar/__tests__/IterationBar.test.tsx create mode 100644 samples/CodeFlow/src/components/Layout/Layout.tsx create mode 100644 samples/CodeFlow/src/components/Layout/RefreshTimer.tsx create mode 100644 samples/CodeFlow/src/components/Layout/ReviewerList.tsx create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/RefreshTimer.test.tsx create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/ReviewerList.test.tsx create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/authorApproval.test.tsx create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/collapseSidebar.test.tsx create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/filterReviewers.test.ts create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/prStateBadge.test.ts create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/resizeSummary.test.tsx create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/searchPanel.test.tsx create mode 100644 samples/CodeFlow/src/components/Layout/__tests__/summaryOpen.test.ts create mode 100644 samples/CodeFlow/src/components/Layout/filterReviewers.ts create mode 100644 samples/CodeFlow/src/components/Layout/formatCountdown.ts create mode 100644 samples/CodeFlow/src/components/Layout/prStateBadge.ts create mode 100644 samples/CodeFlow/src/components/LocalModeNotice/LocalModeNotice.tsx create mode 100644 samples/CodeFlow/src/components/MarkdownBody/MarkdownBody.tsx create mode 100644 samples/CodeFlow/src/components/MarkdownBody/__tests__/MarkdownBody.test.tsx create mode 100644 samples/CodeFlow/src/components/MarkdownToolbar/MarkdownToolbar.tsx create mode 100644 samples/CodeFlow/src/components/MarkdownToolbar/MentionCandidatesProvider.tsx create mode 100644 samples/CodeFlow/src/components/MarkdownToolbar/__tests__/MarkdownToolbar.test.tsx create mode 100644 samples/CodeFlow/src/components/MarkdownToolbar/__tests__/MentionCandidatesProvider.test.tsx create mode 100644 samples/CodeFlow/src/components/MarkdownToolbar/__tests__/mentions.test.ts create mode 100644 samples/CodeFlow/src/components/MarkdownToolbar/mentionContext.ts create mode 100644 samples/CodeFlow/src/components/MarkdownToolbar/mentions.ts create mode 100644 samples/CodeFlow/src/components/MergeButton/MergeButton.tsx create mode 100644 samples/CodeFlow/src/components/MergeButton/__tests__/MergeButton.test.tsx create mode 100644 samples/CodeFlow/src/components/MergeButton/__tests__/mergeGate.test.ts create mode 100644 samples/CodeFlow/src/components/MergeButton/mergeGate.ts create mode 100644 samples/CodeFlow/src/components/OpeningSplash/OpeningSplash.tsx create mode 100644 samples/CodeFlow/src/components/OpeningSplash/__tests__/OpeningSplash.test.tsx create mode 100644 samples/CodeFlow/src/components/OpeningSplash/__tests__/splashTarget.test.ts create mode 100644 samples/CodeFlow/src/components/OpeningSplash/describeTarget.ts create mode 100644 samples/CodeFlow/src/components/OpeningSplash/splashTarget.ts create mode 100644 samples/CodeFlow/src/components/PublishDraftButton/PublishDraftButton.tsx create mode 100644 samples/CodeFlow/src/components/PublishDraftButton/__tests__/PublishDraftButton.test.tsx create mode 100644 samples/CodeFlow/src/components/PublishDraftButton/__tests__/publishGate.test.ts create mode 100644 samples/CodeFlow/src/components/PublishDraftButton/publishGate.ts create mode 100644 samples/CodeFlow/src/components/SearchResults/SearchResults.tsx create mode 100644 samples/CodeFlow/src/components/SearchResults/__tests__/SearchResults.test.tsx create mode 100644 samples/CodeFlow/src/components/SearchResults/__tests__/crossFileSearch.test.ts create mode 100644 samples/CodeFlow/src/components/SearchResults/crossFileSearch.ts create mode 100644 samples/CodeFlow/src/components/SettingsDialog/DataSection.tsx create mode 100644 samples/CodeFlow/src/components/SettingsDialog/GeneralSection.tsx create mode 100644 samples/CodeFlow/src/components/SettingsDialog/PrsSection.tsx create mode 100644 samples/CodeFlow/src/components/SettingsDialog/SettingsDialog.tsx create mode 100644 samples/CodeFlow/src/components/SettingsDialog/__tests__/SettingsDialog.test.tsx create mode 100644 samples/CodeFlow/src/components/SettingsDialog/controls.tsx create mode 100644 samples/CodeFlow/src/components/SetupRequired/SetupRequired.tsx create mode 100644 samples/CodeFlow/src/components/__tests__/Avatar.test.tsx create mode 100644 samples/CodeFlow/src/config.ts create mode 100644 samples/CodeFlow/src/connectors/github.ts create mode 100644 samples/CodeFlow/src/env.d.ts create mode 100644 samples/CodeFlow/src/index.css create mode 100644 samples/CodeFlow/src/lib/__tests__/config.test.ts create mode 100644 samples/CodeFlow/src/lib/__tests__/safeUrl.test.ts create mode 100644 samples/CodeFlow/src/lib/logger.ts create mode 100644 samples/CodeFlow/src/lib/safeUrl.ts create mode 100644 samples/CodeFlow/src/main.tsx create mode 100644 samples/CodeFlow/src/services/__tests__/authorApproval.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/connectionHealth.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/describeError.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/githubService.branches.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/githubService.collaborators.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/githubService.fileContent.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/githubService.identity.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/githubService.listPullRequestFiles.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/githubService.merge.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/githubService.searchCache.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/graphQlEnvelope.test.ts create mode 100644 samples/CodeFlow/src/services/__tests__/searchParse.test.ts create mode 100644 samples/CodeFlow/src/services/authorApproval.ts create mode 100644 samples/CodeFlow/src/services/autoMerge/__tests__/autoMerge.test.ts create mode 100644 samples/CodeFlow/src/services/autoMerge/__tests__/autoMergeQuery.test.ts create mode 100644 samples/CodeFlow/src/services/autoMerge/autoMergeQuery.ts create mode 100644 samples/CodeFlow/src/services/autoMerge/index.ts create mode 100644 samples/CodeFlow/src/services/checks/__tests__/checkLinks.test.ts create mode 100644 samples/CodeFlow/src/services/checks/__tests__/checksQuery.test.ts create mode 100644 samples/CodeFlow/src/services/checks/__tests__/fetchChecks.test.ts create mode 100644 samples/CodeFlow/src/services/checks/checkLinks.ts create mode 100644 samples/CodeFlow/src/services/checks/checksQuery.ts create mode 100644 samples/CodeFlow/src/services/checks/index.ts create mode 100644 samples/CodeFlow/src/services/cherryPick/__tests__/cherryPick.test.ts create mode 100644 samples/CodeFlow/src/services/cherryPick/__tests__/cherryPickPlan.test.ts create mode 100644 samples/CodeFlow/src/services/cherryPick/__tests__/threeWayMerge.test.ts create mode 100644 samples/CodeFlow/src/services/cherryPick/cherryPick.ts create mode 100644 samples/CodeFlow/src/services/cherryPick/cherryPickPlan.ts create mode 100644 samples/CodeFlow/src/services/cherryPick/index.ts create mode 100644 samples/CodeFlow/src/services/cherryPick/threeWayMerge.ts create mode 100644 samples/CodeFlow/src/services/comments/CommentStore.ts create mode 100644 samples/CodeFlow/src/services/comments/GitHubCommentStore.ts create mode 100644 samples/CodeFlow/src/services/comments/LocalCommentStore.ts create mode 100644 samples/CodeFlow/src/services/comments/__tests__/GitHubCommentStore.test.ts create mode 100644 samples/CodeFlow/src/services/comments/__tests__/LocalCommentStore.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/anchorMarker.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/commentDeleter.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/commentEditor.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/graphqlComments.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/helpers.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/issueReplyMarker.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/multiLineComments.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/__tests__/threadParser.test.ts create mode 100644 samples/CodeFlow/src/services/comments/github/anchorMarker.ts create mode 100644 samples/CodeFlow/src/services/comments/github/commentDeleter.ts create mode 100644 samples/CodeFlow/src/services/comments/github/commentEditor.ts create mode 100644 samples/CodeFlow/src/services/comments/github/conversation.ts create mode 100644 samples/CodeFlow/src/services/comments/github/helpers.ts create mode 100644 samples/CodeFlow/src/services/comments/github/issueReplyMarker.ts create mode 100644 samples/CodeFlow/src/services/comments/github/reviewWriter.ts create mode 100644 samples/CodeFlow/src/services/comments/github/reviews.ts create mode 100644 samples/CodeFlow/src/services/comments/github/threadParser.ts create mode 100644 samples/CodeFlow/src/services/comments/github/threadResolution.ts create mode 100644 samples/CodeFlow/src/services/comments/index.ts create mode 100644 samples/CodeFlow/src/services/connectionHealth.ts create mode 100644 samples/CodeFlow/src/services/draft/__tests__/draftQuery.test.ts create mode 100644 samples/CodeFlow/src/services/draft/__tests__/publishDraft.test.ts create mode 100644 samples/CodeFlow/src/services/draft/draftQuery.ts create mode 100644 samples/CodeFlow/src/services/draft/index.ts create mode 100644 samples/CodeFlow/src/services/errors.ts create mode 100644 samples/CodeFlow/src/services/githubService.ts create mode 100644 samples/CodeFlow/src/services/graphQl.ts create mode 100644 samples/CodeFlow/src/services/graphQlEnvelope.ts create mode 100644 samples/CodeFlow/src/services/issues/__tests__/commentStore.test.ts create mode 100644 samples/CodeFlow/src/services/issues/__tests__/issueStore.test.ts create mode 100644 samples/CodeFlow/src/services/issues/commentStore.ts create mode 100644 samples/CodeFlow/src/services/issues/issueStore.ts create mode 100644 samples/CodeFlow/src/services/searchParse.ts create mode 100644 samples/CodeFlow/src/settings/__tests__/codeFont.test.ts create mode 100644 samples/CodeFlow/src/settings/__tests__/settings.test.ts create mode 100644 samples/CodeFlow/src/settings/__tests__/settingsStore.test.ts create mode 100644 samples/CodeFlow/src/settings/__tests__/theme.test.ts create mode 100644 samples/CodeFlow/src/settings/codeFont.ts create mode 100644 samples/CodeFlow/src/settings/settings.ts create mode 100644 samples/CodeFlow/src/settings/settingsStore.ts create mode 100644 samples/CodeFlow/src/settings/theme.ts create mode 100644 samples/CodeFlow/src/settings/useSettings.ts create mode 100644 samples/CodeFlow/src/state/CodeFlowProvider.tsx create mode 100644 samples/CodeFlow/src/state/codeFlowContext.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/deleteComment.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/fetchReviewers.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/foldPrStatus.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/reviewedIteration.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useAutoMerge.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useCommentActions.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useDeepLink.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useDraftActions.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useFileSelection.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useIterations.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useMergeActions.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/usePrLoader.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/usePrPolling.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/__tests__/useReviewActions.test.ts create mode 100644 samples/CodeFlow/src/state/hooks/foldPrStatus.ts create mode 100644 samples/CodeFlow/src/state/hooks/reviewedIteration.ts create mode 100644 samples/CodeFlow/src/state/hooks/useAutoMerge.ts create mode 100644 samples/CodeFlow/src/state/hooks/useChecks.ts create mode 100644 samples/CodeFlow/src/state/hooks/useCommentActions.ts create mode 100644 samples/CodeFlow/src/state/hooks/useDeepLink.ts create mode 100644 samples/CodeFlow/src/state/hooks/useDraftActions.ts create mode 100644 samples/CodeFlow/src/state/hooks/useFileSelection.ts create mode 100644 samples/CodeFlow/src/state/hooks/useIterations.ts create mode 100644 samples/CodeFlow/src/state/hooks/useLineFocus.ts create mode 100644 samples/CodeFlow/src/state/hooks/useMergeActions.ts create mode 100644 samples/CodeFlow/src/state/hooks/usePrLoader.ts create mode 100644 samples/CodeFlow/src/state/hooks/useReviewActions.ts create mode 100644 samples/CodeFlow/src/state/hooks/useReviewStateRevision.ts create mode 100644 samples/CodeFlow/src/state/useCodeFlow.ts create mode 100644 samples/CodeFlow/src/storage/__tests__/appStorage.test.ts create mode 100644 samples/CodeFlow/src/storage/collections.ts create mode 100644 samples/CodeFlow/src/storage/core/StorageRoot.tsx create mode 100644 samples/CodeFlow/src/storage/core/__tests__/core.test.ts create mode 100644 samples/CodeFlow/src/storage/core/__tests__/tableBacked.test.ts create mode 100644 samples/CodeFlow/src/storage/core/context.ts create mode 100644 samples/CodeFlow/src/storage/core/contract.ts create mode 100644 samples/CodeFlow/src/storage/core/describe.ts create mode 100644 samples/CodeFlow/src/storage/core/errors.ts create mode 100644 samples/CodeFlow/src/storage/core/hooks.ts create mode 100644 samples/CodeFlow/src/storage/core/index.ts create mode 100644 samples/CodeFlow/src/storage/core/meta.ts create mode 100644 samples/CodeFlow/src/storage/core/providers/local.ts create mode 100644 samples/CodeFlow/src/storage/core/providers/memory.ts create mode 100644 samples/CodeFlow/src/storage/core/providers/tableBacked.ts create mode 100644 samples/CodeFlow/src/storage/core/providers/webStorage.ts create mode 100644 samples/CodeFlow/src/storage/core/query.ts create mode 100644 samples/CodeFlow/src/storage/core/retry.ts create mode 100644 samples/CodeFlow/src/storage/core/snapshotFiles.ts create mode 100644 samples/CodeFlow/src/storage/core/types.ts create mode 100644 samples/CodeFlow/src/storage/index.ts create mode 100644 samples/CodeFlow/src/storage/mirror.ts create mode 100644 samples/CodeFlow/src/storage/providers/session.ts create mode 100644 samples/CodeFlow/src/test/selectCode.ts create mode 100644 samples/CodeFlow/src/test/setup.ts create mode 100644 samples/CodeFlow/src/types/index.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/bugSwarm.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/closedThreads.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/commentBackend.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/commentDrafts.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/commentEdit.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/dashboardReview.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/deepLink.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/diffPane.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/diffParser.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/diffSearch.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/diffSide.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/fileComparison.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/forcePush.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/format.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/fullFileBudget.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/githubLink.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/lastReviewed.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/mergeIterations.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/motion.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/openPrMemory.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/parsePrInput.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/pendingComment.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/preferences.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/renameInfo.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/sameThreads.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/selectionToken.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/sharedClosed.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/storage.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/threadAnchor.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/threadStatus.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/useDraft.test.ts create mode 100644 samples/CodeFlow/src/utils/__tests__/zip.test.ts create mode 100644 samples/CodeFlow/src/utils/bugSwarm.ts create mode 100644 samples/CodeFlow/src/utils/commentBackend.ts create mode 100644 samples/CodeFlow/src/utils/commentDrafts.ts create mode 100644 samples/CodeFlow/src/utils/commentEdit.ts create mode 100644 samples/CodeFlow/src/utils/commentRange.ts create mode 100644 samples/CodeFlow/src/utils/dashboardReview.ts create mode 100644 samples/CodeFlow/src/utils/deepLink.ts create mode 100644 samples/CodeFlow/src/utils/diffPane.ts create mode 100644 samples/CodeFlow/src/utils/diffParser.ts create mode 100644 samples/CodeFlow/src/utils/diffSearch.ts create mode 100644 samples/CodeFlow/src/utils/diffSide.ts create mode 100644 samples/CodeFlow/src/utils/fileComparison.ts create mode 100644 samples/CodeFlow/src/utils/forcePush.ts create mode 100644 samples/CodeFlow/src/utils/format.ts create mode 100644 samples/CodeFlow/src/utils/fullFileBudget.ts create mode 100644 samples/CodeFlow/src/utils/githubLink.ts create mode 100644 samples/CodeFlow/src/utils/lastReviewed.ts create mode 100644 samples/CodeFlow/src/utils/lineAlignment.ts create mode 100644 samples/CodeFlow/src/utils/markdownPreview.test.ts create mode 100644 samples/CodeFlow/src/utils/markdownPreview.ts create mode 100644 samples/CodeFlow/src/utils/mergeIterations.ts create mode 100644 samples/CodeFlow/src/utils/motion.ts create mode 100644 samples/CodeFlow/src/utils/openPrMemory.ts create mode 100644 samples/CodeFlow/src/utils/parsePrInput.ts create mode 100644 samples/CodeFlow/src/utils/pendingComment.ts create mode 100644 samples/CodeFlow/src/utils/preferences.ts create mode 100644 samples/CodeFlow/src/utils/renameInfo.ts create mode 100644 samples/CodeFlow/src/utils/sameThreads.ts create mode 100644 samples/CodeFlow/src/utils/selectionToken.ts create mode 100644 samples/CodeFlow/src/utils/sharedClosed.ts create mode 100644 samples/CodeFlow/src/utils/storage.ts create mode 100644 samples/CodeFlow/src/utils/syntax/__tests__/engine.test.ts create mode 100644 samples/CodeFlow/src/utils/syntax/__tests__/languages.test.ts create mode 100644 samples/CodeFlow/src/utils/syntax/__tests__/largeFileSyntax.test.tsx create mode 100644 samples/CodeFlow/src/utils/syntax/__tests__/shikiEngine.test.tsx create mode 100644 samples/CodeFlow/src/utils/syntax/__tests__/sideDocuments.test.ts create mode 100644 samples/CodeFlow/src/utils/syntax/__tests__/tokens.test.ts create mode 100644 samples/CodeFlow/src/utils/syntax/engine.ts create mode 100644 samples/CodeFlow/src/utils/syntax/languages.ts create mode 100644 samples/CodeFlow/src/utils/syntax/shikiEngine.ts create mode 100644 samples/CodeFlow/src/utils/syntax/sideDocuments.ts create mode 100644 samples/CodeFlow/src/utils/syntax/tokens.ts create mode 100644 samples/CodeFlow/src/utils/threadAnchor.ts create mode 100644 samples/CodeFlow/src/utils/threadStatus.ts create mode 100644 samples/CodeFlow/src/utils/useDraft.ts create mode 100644 samples/CodeFlow/src/utils/whitespaceDiff.test.ts create mode 100644 samples/CodeFlow/src/utils/whitespaceDiff.ts create mode 100644 samples/CodeFlow/src/utils/wordDiff.test.ts create mode 100644 samples/CodeFlow/src/utils/wordDiff.ts create mode 100644 samples/CodeFlow/src/utils/zip.ts create mode 100644 samples/CodeFlow/tsconfig.app.json create mode 100644 samples/CodeFlow/tsconfig.json create mode 100644 samples/CodeFlow/tsconfig.node.json create mode 100644 samples/CodeFlow/vite.config.ts diff --git a/.gitignore b/.gitignore index d5a18de..3e3822b 100644 --- a/.gitignore +++ b/.gitignore @@ -427,3 +427,8 @@ FodyWeavers.xsd *.msix *.msm *.msp + +# Sample setup output (ms app init / add data-source); it belongs in your own app repository +samples/*/ms.config.json +samples/*/generated/ +samples/*/.ms/ diff --git a/README.md b/README.md index 483abb4..e5eb899 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ See the [Quickstart - CLI](https://go.microsoft.com/fwlink/?LinkId=2368962) to s ## Repository structure - [`templates/`](templates/) — first-party project templates (currently [`vite8`](templates/vite8), a React + TypeScript + Vite 8 starter). +- [`samples/`](samples/) — complete sample apps you can set up in your own environment. Each sample's README and setup skill walk through copying it into its own folder, `ms app init` (which creates the app's platform-managed repository) and adding its connectors; app data is stored in the browser by default, and the bundled `add-data-source` skill moves it to SharePoint, Dataverse or your own API. - [`plugins/`](plugins/) — the [`copilot-managed-runtime`](plugins/copilot-managed-runtime) plugin: skills, agents, and hooks for building apps hosted on Copilot Managed Runtime with AI coding agents (works with Claude Code and GitHub Copilot). - [`.claude-plugin/`](.claude-plugin/) — marketplace manifest (`marketplace.json`) that registers the plugin so agents can install it via `/plugin marketplace add`. diff --git a/samples/CodeFlow/.claude/skills/add-data-source/SKILL.md b/samples/CodeFlow/.claude/skills/add-data-source/SKILL.md new file mode 100644 index 0000000..bed2d34 --- /dev/null +++ b/samples/CodeFlow/.claude/skills/add-data-source/SKILL.md @@ -0,0 +1,185 @@ +--- +name: add-data-source +description: Moves this app's data from browser-local storage to a shared backend (SharePoint lists, Dataverse tables, a REST API, or any other store) by adding a storage provider. Use when the user wants app data shared between people or devices, kept outside the browser, or stored in a specific system. +--- + +# Add a data source + +Every read and write of app-owned data in this template goes through one storage interface +(`src/storage/core/types.ts`). By default the `local` provider keeps data in the browser +(`localStorage`). This skill adds another provider and switches the app to it **without +changing UI or domain code**. + +## Ground rules + +- **Never edit `src/storage/core/`.** It is shared, tested code. Build on it. +- **Never change UI, hooks or domain modules** to make a backend work. If the interface seems + insufficient, stop and explain the gap to the user. +- Generated connector code is imported **only** from `src/connectors/` (an ESLint rule enforces + this). The provider in `src/storage/providers/` depends on that thin wrapper, not on + `generated/` directly, so it can be tested with fakes. +- A provider is finished when `runProviderContract()` passes against it (step 6). +- Authorization belongs to the backend. Configure list/table permissions; never rely on hiding + UI (step 7). + +## Step 1: Understand what is stored + +1. Read `src/storage/collections.ts`. Every collection is a zod schema plus a name. +2. Run `npm run storage:describe`. It prints each collection as JSON Schema; you will create one + list/table per collection. +3. Note which data uses `provider.kv(...)` (preferences, drafts, UI state). These usually stay + **device-local**, which is the default described in step 5. +4. Ask the user which collections should move (usually all of them) and who should be able to + read and write each one. + +## Step 2: Choose the backend + +| Backend | Good for | Needs | Reference | +|---|---|---|---| +| **SharePoint lists** | Teams that already use SharePoint; simple setup | A SharePoint site where the user can create lists | `references/sharepoint.md` | +| **Dataverse tables** | Relational/business data; role-based security; large volumes | A Power Platform environment with Dataverse, and the matching licenses | `references/dataverse.md` | +| **Your own API** | Existing systems or databases | A connector (or custom connector) that exposes CRUD operations | `references/custom-api.md` | + +If the user has no preference, recommend SharePoint lists for small teams and Dataverse for +anything with roles, auditing or large data. + +## Step 3: Provision the backing store + +Use the **document-in-a-row** layout for every collection. It maps any record shape onto any +tabular store and keeps the provider generic: + +| Column | Type | Purpose | +|---|---|---| +| `RecordKey` | Single line of text, **indexed, unique, required** | Record id (`BackendRow.key`) | +| `Data` | Multiple lines of **plain** text (no rich text, no length cap below ~1 MB) | The record body as JSON | +| *(built-in)* ETag / row version | backend-managed | `BackendRow.etag` | +| *(built-in)* Created / Modified | backend-managed | `createdAt` / `updatedAt` | + +Name each list/table after the collection, optionally with an app prefix, e.g. `LearningHub_sessions`. +You *may* add extra "promoted" columns for fields you want to search in the backend UI, but the +app reads only `RecordKey` and `Data`. + +Create the lists/tables yourself only if the user asks and has permission. Otherwise give them +the exact list of names and columns. + +## Step 4: Add the connector + +Always use the CLI (pinned in `package.json`) so codegen and `ms.config.json` stay consistent. Run +`npx ms app add data-source --help` to see every flag. + +```bash +# SharePoint: one command per list +npx ms app add data-source --connector shared_sharepointonline --as table --dataset "" --table "" + +# Dataverse: one command per table (no connection id needed) +npx ms app add data-source --connector dataverse --as table --table "" + +# Any other connector +npx ms connector list --search "" +npx ms app add data-source --connector --as action +``` + +Then find the generated operations. **Do not read whole generated files**; they are large: + +```bash +# list method names of a generated service +rg "async \w+\(" generated/services/Service.ts +# then read one method and its model +rg "async " -A 25 generated/services/Service.ts +``` + +## Step 5: Implement the provider + +The core already provides `createTableBackedProvider()`. You implement **one `TableBackend` per +collection**, which is five methods. Everything else (validation, queries, paging, conflicts, +export/import) is handled for you. + +1. **Connector wrapper**: `src/connectors/Tables.ts`. This is the only file that imports + `generated/`. Expose plain functions such as `listRows(table, cursor)`, `getRow`, + `createRow`, `updateRow(table, key, data, etag)` and `deleteRow`, and translate connector + results into `BackendRow` (`{ key, data, etag, createdAt, updatedAt }`). +2. **Provider**: `src/storage/providers/.ts`. + +```ts +// Adjust names (config fields, table prefix) to match this app's src/config.ts. +import { createLocalProvider, createTableBackedProvider, type TableBackend } from '../core'; +import * as rows from '../../connectors/sharepointTables'; +import { config } from '../../config'; + +function backendFor(collectionName: string): TableBackend { + const table = `${config.storageTablePrefix}${collectionName}`; + return { + list: (cursor) => rows.listRows(table, cursor), + get: (key) => rows.getRow(table, key), + create: (key, data) => rows.createRow(table, key, data), // ConflictError if key exists + update: (key, data, etag) => rows.updateRow(table, key, data, etag), // ConflictError on etag mismatch, NotFoundError if missing + delete: (key, etag) => rows.deleteRow(table, key, etag), // idempotent; ConflictError on etag mismatch + }; +} + +export function createSharePointProvider() { + const local = createLocalProvider({ prefix: config.storagePrefix }); + return createTableBackedProvider({ + id: 'sharepoint', + shared: true, + tableFor: backendFor, + kv: (namespace) => local.kv(namespace), // keep preferences on the device + }); +} +``` + +3. **Register it** in `src/storage/index.ts` by adding `sharepoint: createSharePointProvider` to + the provider registry. Then set `VITE_STORAGE_PROVIDER=sharepoint` (plus any new variables, + such as the table prefix) in `.env.local`. Document the new variables in `.env.example` and in `src/config.ts`. +4. Remote stores do not push changes. Call `provider.refresh()` on window focus, and optionally + on a timer, so other users' edits appear. + +### Mapping rules every backend must follow + +- `etag` must change on **every** write, and the backend must reject stale etags with a + "precondition failed" error (HTTP 412). Map that error to `ConflictError` from `../core`. +- `create` with an existing key must throw `ConflictError`. Enforce uniqueness on `RecordKey`, + or check first. +- A missing record on `update` throws `NotFoundError`. `delete` of a missing record succeeds. +- `list` must page with the backend's continuation token. Never assume one page holds everything. +- Store `Data` exactly as given. Never reformat the JSON. + +## Step 6: Prove it with the contract suite + +Create `src/storage/providers/.test.ts`: + +```ts +import { runProviderContract } from '../core/contract'; +// Fake the connector wrapper (src/connectors/Tables.ts) with an in-memory map that +// reproduces the backend's real behaviour: etags, 412s, paging. See createInMemoryTableBackend +// in core/providers/tableBacked.ts for the reference behaviour. +runProviderContract('sharepoint', () => createSharePointProviderWithFakeRows()); +``` + +Run `npm test`, `npm run lint` and `npm run typecheck`. All must pass. Then run the app against the +real backend and try each feature, ideally in two browsers with different accounts to see +sharing and conflicts. + +## Step 7: Security and privacy + +- Grant list/table permissions to exactly the people who should read or write each collection. + The app's UI is not a security boundary. +- Review what becomes visible once data is shared. Collections that were per-browser (drafts, + personal notes) may now be readable by others; keep those in `kv` (device-local), or use a + per-user table with item-level permissions. +- Keep connector permissions least-privilege. Add only the tables the app uses. + +## Step 8: Move existing data + +Users can move what they already have: in the app's Settings, choose **Export data** while still +on the `local` provider, switch to the new provider, then **Import data**. Import validates every +record and skips anything invalid. + +## Done checklist + +- [ ] One list/table per moved collection, with `RecordKey` (unique) and `Data` columns +- [ ] Connector added with the CLI; the updated `generated/`, `.ms/` and `ms.config.json` are committed to the app's repository. +- [ ] `src/connectors/Tables.ts` plus `src/storage/providers/.ts`, registered in `src/storage/index.ts` +- [ ] The contract suite passes for the new provider, and `npm test`, `npm run lint` and `npm run typecheck` are green +- [ ] Permissions configured in the backend +- [ ] `.env.example`, `src/config.ts` and the README's "Storage" section updated diff --git a/samples/CodeFlow/.claude/skills/add-data-source/references/custom-api.md b/samples/CodeFlow/.claude/skills/add-data-source/references/custom-api.md new file mode 100644 index 0000000..97b921e --- /dev/null +++ b/samples/CodeFlow/.claude/skills/add-data-source/references/custom-api.md @@ -0,0 +1,45 @@ +# Your own API as a backend + +Use this when data must live in an existing system (an internal service, a SQL database behind an +API, a SaaS product). + +## Requirements for the API + +Expose, per collection (or with the collection as a path segment): + +| Operation | Example | Must | +|---|---|---| +| List | `GET /collections/{name}/rows?cursor=…` | Return `{ rows: BackendRow[], nextCursor? }` and page results | +| Get | `GET /collections/{name}/rows/{key}` | Return 404 when missing | +| Create | `POST /collections/{name}/rows` with `{ key, data }` | Return 409 when the key exists | +| Update | `PUT /collections/{name}/rows/{key}` with `If-Match: ` | Return 412 on a stale etag and 404 when missing | +| Delete | `DELETE /collections/{name}/rows/{key}` with optional `If-Match` | Succeed when already gone; return 412 on a stale etag | + +Rows carry `key`, `data` (an opaque JSON string, stored verbatim), `etag` (changes on every +write), `createdAt` and `updatedAt`. The API must authenticate the caller and enforce +authorization itself. + +## Reach it through a connector + +Wrap the API in a **custom connector** (OpenAPI definition plus authentication) in your Power +Platform environment. Then add it like any other connector: + +```bash +npx ms connector list --search "" +npx ms app add data-source --connector --as action +``` + +Calling arbitrary URLs with `fetch` from the app is discouraged: it bypasses connector +authentication, data-loss-prevention policies and auditing. + +## Map responses + +In `src/connectors/Tables.ts`, translate: + +- 404 on get → `undefined` +- 409 on create → `ConflictError` +- 412 on update/delete → `ConflictError` +- 404 on update → `NotFoundError` + +Then build the provider with `createTableBackedProvider()` exactly as in `SKILL.md` step 5, and +run the contract suite against a fake of the wrapper. diff --git a/samples/CodeFlow/.claude/skills/add-data-source/references/dataverse.md b/samples/CodeFlow/.claude/skills/add-data-source/references/dataverse.md new file mode 100644 index 0000000..5ca3734 --- /dev/null +++ b/samples/CodeFlow/.claude/skills/add-data-source/references/dataverse.md @@ -0,0 +1,49 @@ +# Dataverse tables backend + +## Provision + +For each collection, create a table (for example display name `LearningHub Session`, logical +name `_learninghubsession`): + +| Column | Dataverse type | Settings | +|---|---|---| +| `RecordKey` | Text (single line), max length 200 | Business required, plus an **alternate key** on this column | +| `Data` | Multiline text (plain) | Max length 1,048,576 | + +The primary name column can hold a readable label (for example the record's title) for +browsing in Dataverse. Ownership: choose **User or team** if you need per-user security, or +**Organization** for data everyone shares. + +Security: create or extend a **security role** with Create/Read/Write/Delete privileges on each +table at the right depth (User, Business Unit or Organization), and assign it to the app's users. + +## Add the connector + +```bash +npx ms app add data-source --connector dataverse --as table --table "_learninghubsession" +``` + +No connection id is needed; the CLI binds to the active environment's Dataverse. Repeat per +table, then inspect the generated services with `rg "async \w+\(" generated/services`. + +## Mapping to `BackendRow` + +| BackendRow | Dataverse row | +|---|---| +| `key` | `RecordKey` column (the alternate key) | +| `data` | `Data` column | +| `etag` | `@odata.etag` | +| `createdAt` / `updatedAt` | `createdon` / `modifiedon` | + +- **Lookups by key**: retrieve by alternate key, or filter `RecordKey eq ''`. Keep the row's + primary GUID in the wrapper for updates and deletes. +- **Paging**: follow `@odata.nextLink`, or the paging cookie the generated list operation exposes. +- **Conflicts**: Dataverse supports optimistic concurrency. Send `If-Match: ` on update + and delete, and map HTTP 412 to `ConflictError`. A duplicate alternate key on create fails, so + map that to `ConflictError` too. +- **Timestamps** are UTC ISO strings, so pass them through unchanged. + +## Notes + +- Use a **solution** to hold the tables and security role, so the setup can be exported to other environments. +- Dataverse capacity is metered. JSON in `Data` is compact, but avoid storing large blobs; use file columns or SharePoint for documents. diff --git a/samples/CodeFlow/.claude/skills/add-data-source/references/sharepoint.md b/samples/CodeFlow/.claude/skills/add-data-source/references/sharepoint.md new file mode 100644 index 0000000..a1a5484 --- /dev/null +++ b/samples/CodeFlow/.claude/skills/add-data-source/references/sharepoint.md @@ -0,0 +1,59 @@ +# SharePoint lists backend + +## Provision + +For each collection, create a list (for example `LearningHub_sessions`): + +| Column | SharePoint type | Settings | +|---|---|---| +| `RecordKey` | Single line of text | Required, **Enforce unique values: Yes** (this also indexes it) | +| `Data` | Multiple lines of text | **Plain text** (not rich/enhanced), "Append changes" **off** | + +Rename or hide the built-in `Title` column if you like; the app does not use it. You can set +`Title` to a human-readable value (e.g. the record's name) in `createRow` to make the list browsable. + +Permissions: break inheritance on each list only if it needs different access than the site. +Grant **Contribute** to people who write and **Read** to people who only read. + +## Add the connector + +```bash +npx ms app add data-source --connector shared_sharepointonline --as table --dataset "https://.sharepoint.com/sites/" --table "LearningHub_sessions" +``` + +Repeat for each list. Then inspect the generated services: + +```bash +rg "async \w+\(" generated/services +``` + +Typical operations are "get items" (with `$filter`, `$top` and a continuation/skip token), +"get item", "create item", "update item" and "delete item". Exact names depend on the CLI version, +so use what the grep shows. + +## Mapping to `BackendRow` + +| BackendRow | SharePoint item | +|---|---| +| `key` | `RecordKey` | +| `data` | `Data` | +| `etag` | `@odata.etag` (or `ETag`) from the item | +| `createdAt` / `updatedAt` | `Created` / `Modified` | + +- **Lookups by key**: SharePoint item ids are numeric and differ from `RecordKey`. Find items with + a filter such as `$filter=RecordKey eq ''` (escape single quotes by doubling them). Cache + `RecordKey → item id` inside the wrapper if you want fewer calls. +- **Paging**: follow the continuation value the "get items" operation returns (`@odata.nextLink` + or a skip token). Return it as `nextCursor`. +- **Conflicts**: if the update/delete operation accepts an `If-Match` header or etag parameter, pass + the etag and map HTTP 412 to `ConflictError`. If it does not, re-read the item, compare `etag`, + then write. Document in the README that a small race window remains. +- **Create uniqueness**: with "Enforce unique values" on, a duplicate `RecordKey` fails. Map that + failure to `ConflictError`. +- **Size**: keep each record well under a few hundred KB. Large attachments belong in a document + library, with only a link stored in the record. + +## Throttling + +SharePoint throttles bursts. Keep `list` page sizes moderate (100–500). If the connector reports +HTTP 429, wait for `Retry-After` and retry. diff --git a/samples/CodeFlow/.claude/skills/setup-codeflow/SKILL.md b/samples/CodeFlow/.claude/skills/setup-codeflow/SKILL.md new file mode 100644 index 0000000..2f16559 --- /dev/null +++ b/samples/CodeFlow/.claude/skills/setup-codeflow/SKILL.md @@ -0,0 +1,146 @@ +--- +name: setup-codeflow +description: Sets up a fresh copy of the CodeFlow sample so it runs as an app hosted on Copilot Managed Runtime — copies the sample into its own folder, signs in with the ms CLI, creates the app and its platform-managed git repository (which writes ms.config.json), applies its settings, adds the GitHub connector, configures .env.local, starts local development, and commits and pushes to the app's repository. Use when someone has just cloned CodeFlow, or when `npm run dev` / `npm run build` stops at "CodeFlow setup is incomplete". +--- + +# Set up CodeFlow + +CodeFlow ships **without** `ms.config.json`, **without** connector code and **without** any +environment identifiers. This skill creates them for the user's own environment. Run every +command from the sample folder (the one that contains `package.json`). + +The app gets its own platform-managed git repository. Commit `ms.config.json`, `generated/` and +`.ms/` to it with the rest of the app; only `.env.local` stays local (it is gitignored). + +Background: Quickstart https://go.microsoft.com/fwlink/?LinkId=2368962 and documentation +https://go.microsoft.com/fwlink/?LinkId=2372842 for Copilot Managed Runtime (public preview). + +## Prerequisites + +- Node.js 24.11 or later, npm and git. +- Access to a Power Platform environment where the user can create apps on Copilot Managed + Runtime. +- A GitHub account the app will act as (the GitHub connector signs in with it). +- The sample must be in **its own folder**, not inside a clone of the samples repository: that + folder becomes the app's repository. If `git rev-parse --show-toplevel` succeeds in the sample + folder, copy the folder out first (for example `cp -r Copilot-Managed-Runtime/samples/CodeFlow my-codeflow`; + PowerShell: `Copy-Item -Recurse`) and continue from the copy. +- Install dependencies once: `npm install`. + +Check the installed CLI before using any command below, because flags change between versions: + +```bash +npx ms --help +npx ms app init --help +npx ms app add data-source --help +``` + +## Step 1: Sign in + +```bash +npx ms auth login +``` + +`npx ms auth status` shows cached accounts. Ask the user which environment to use if they have +more than one, and note its environment id. + +## Step 2: Create the app + +```bash +npx ms app init --display-name "CodeFlow" --icon-path ./public/codeflow-logo.png +``` + +Don't pass `--repo`: with no git repository in the folder, `init` creates the app's +platform-managed git repository and sets it up as `origin`. Add `--environment-id ` to pick +the environment without a prompt. Leave `--build-path` (`./dist`) and `--build-command` +(`npm run build`) at their defaults. + +This writes `ms.config.json`. Confirm it contains an `appId`, an `environmentId` and +`"repoType": "native"` (`npx ms app info` shows the app). + +## Step 3: Apply app settings + +CodeFlow draws its own header, so hide the host header: + +```bash +npx ms app set-setting --show-header false +``` + +## Step 4: Add the GitHub connector (always required) + +CodeFlow reads and writes pull requests only through the public **GitHub** connector +(`shared_github`). Add it as an action data source; the CLI prompts for (or creates) a GitHub +connection and generates `generated/`: + +```bash +npx ms app add data-source --connector shared_github --as action +``` + +If the CLI reports actions "skipped due to your organization's connector policy", continue: +`npm run check-setup` (Step 6) reports any operation CodeFlow needs that is missing. + +No other connectors are needed. The app uses exactly these GitHub connector operations (least +privilege — do not add others): `GetUser`, `GetPullRequest`, `GetPullRequests`, +`MergePullRequest`, `SearchIssues`, `CompareRepositoryCommits`, `ListCollaborators`, +`checkCollaborator`, `CreateReference`, `CreatePullRequest` and `SearchGithubWithQuery` +(GraphQL queries and mutations for comments, reviews, files, branches and cherry-pick commits). + +If the generated service or method names differ from what `src/connectors/github.ts` expects, +adapt **only** that file (it is the single module that imports `generated/`), then run +`npm run typecheck`. + +## Step 5: Local configuration + +```bash +cp .env.example .env.local +``` + +All values are optional. Leave `VITE_GITHUB_HOST` at `https://github.com`: the public GitHub +connector this app uses talks to github.com. Set `VITE_APP_URL` to the deployed app URL (from +`npx ms app play`) once the app is deployed, so shared deep links point at it. + +## Step 6: Verify and run + +```bash +npm run check-setup # must print "CodeFlow setup looks complete." +npm run typecheck +npm test +npm run dev # or: npx ms app dev — open the "Local Play" URL it prints +``` + +## Step 7: Commit and push + +Commit everything (including `ms.config.json`, `generated/` and `.ms/`) and push to the app's +repository. Git asks the user to sign in the first time. + +```bash +git fetch origin +git reset origin/main # start from the new repository's initial commit; your files stay as they are +git branch -M main +git add -A +git commit -m "Set up CodeFlow" +git push -u origin main +``` + +Deploy only when the user asks, from a pushed commit: `npm run build`, then `npx ms app deploy`. + +## Storage + +By default CodeFlow keeps its own data (seen marks, review notes, app-only approvals, +notes/feedback, settings) in the **browser** (`VITE_STORAGE_PROVIDER=local`), and shows +"Local mode: data stays in this browser". Nothing else is needed for local mode. + +To share that data between people or devices (SharePoint lists, Dataverse, your own API), follow +`.github/skills/add-data-source/SKILL.md`. Users can move existing data with +**Settings → Data → Export / Import**. + +## Done checklist + +- [ ] Sample in its own folder; `ms.config.json` created by `npx ms app init` (no `--repo`), with + `appId`, `environmentId` and `"repoType": "native"` +- [ ] Host header hidden (`npx ms app set-setting --show-header false`) +- [ ] GitHub connector added; `npm run check-setup` passes +- [ ] `.env.local` created (optional values reviewed) +- [ ] `npm run typecheck` and `npm test` pass +- [ ] `npm run dev` opens the app and the dashboard loads pull requests +- [ ] Everything committed and pushed to `origin` diff --git a/samples/CodeFlow/.env.example b/samples/CodeFlow/.env.example new file mode 100644 index 0000000..e5d24ca --- /dev/null +++ b/samples/CodeFlow/.env.example @@ -0,0 +1,22 @@ +# Copy to .env.local and adjust. Every value is optional; defaults are shown. +# Vite inlines VITE_* values into the client bundle, so never put secrets here. + +# Name shown in the page header. +VITE_APP_NAME=CodeFlow + +# Web origin of GitHub, used for "Open on GitHub" links when the API response doesn't +# include one. The public GitHub connector only reaches github.com, so leave this as is. +VITE_GITHUB_HOST=https://github.com + +# Shareable URL of the deployed app (from `npx ms app play`). Deep links append their +# query to it. Leave empty to link to the current page. +VITE_APP_URL= + +# Player used to build share links while running `npm run dev`. +VITE_DEV_PLAYER_URL=https://play.preview.managedapps.cloud.microsoft + +# Storage provider registered in src/storage/index.ts. `local` keeps data in this browser. +VITE_STORAGE_PROVIDER=local + +# Prefix that isolates this app's browser storage from other apps on the same origin. +VITE_APP_STORAGE_PREFIX=codeflow diff --git a/samples/CodeFlow/.github/skills/add-data-source/SKILL.md b/samples/CodeFlow/.github/skills/add-data-source/SKILL.md new file mode 100644 index 0000000..bed2d34 --- /dev/null +++ b/samples/CodeFlow/.github/skills/add-data-source/SKILL.md @@ -0,0 +1,185 @@ +--- +name: add-data-source +description: Moves this app's data from browser-local storage to a shared backend (SharePoint lists, Dataverse tables, a REST API, or any other store) by adding a storage provider. Use when the user wants app data shared between people or devices, kept outside the browser, or stored in a specific system. +--- + +# Add a data source + +Every read and write of app-owned data in this template goes through one storage interface +(`src/storage/core/types.ts`). By default the `local` provider keeps data in the browser +(`localStorage`). This skill adds another provider and switches the app to it **without +changing UI or domain code**. + +## Ground rules + +- **Never edit `src/storage/core/`.** It is shared, tested code. Build on it. +- **Never change UI, hooks or domain modules** to make a backend work. If the interface seems + insufficient, stop and explain the gap to the user. +- Generated connector code is imported **only** from `src/connectors/` (an ESLint rule enforces + this). The provider in `src/storage/providers/` depends on that thin wrapper, not on + `generated/` directly, so it can be tested with fakes. +- A provider is finished when `runProviderContract()` passes against it (step 6). +- Authorization belongs to the backend. Configure list/table permissions; never rely on hiding + UI (step 7). + +## Step 1: Understand what is stored + +1. Read `src/storage/collections.ts`. Every collection is a zod schema plus a name. +2. Run `npm run storage:describe`. It prints each collection as JSON Schema; you will create one + list/table per collection. +3. Note which data uses `provider.kv(...)` (preferences, drafts, UI state). These usually stay + **device-local**, which is the default described in step 5. +4. Ask the user which collections should move (usually all of them) and who should be able to + read and write each one. + +## Step 2: Choose the backend + +| Backend | Good for | Needs | Reference | +|---|---|---|---| +| **SharePoint lists** | Teams that already use SharePoint; simple setup | A SharePoint site where the user can create lists | `references/sharepoint.md` | +| **Dataverse tables** | Relational/business data; role-based security; large volumes | A Power Platform environment with Dataverse, and the matching licenses | `references/dataverse.md` | +| **Your own API** | Existing systems or databases | A connector (or custom connector) that exposes CRUD operations | `references/custom-api.md` | + +If the user has no preference, recommend SharePoint lists for small teams and Dataverse for +anything with roles, auditing or large data. + +## Step 3: Provision the backing store + +Use the **document-in-a-row** layout for every collection. It maps any record shape onto any +tabular store and keeps the provider generic: + +| Column | Type | Purpose | +|---|---|---| +| `RecordKey` | Single line of text, **indexed, unique, required** | Record id (`BackendRow.key`) | +| `Data` | Multiple lines of **plain** text (no rich text, no length cap below ~1 MB) | The record body as JSON | +| *(built-in)* ETag / row version | backend-managed | `BackendRow.etag` | +| *(built-in)* Created / Modified | backend-managed | `createdAt` / `updatedAt` | + +Name each list/table after the collection, optionally with an app prefix, e.g. `LearningHub_sessions`. +You *may* add extra "promoted" columns for fields you want to search in the backend UI, but the +app reads only `RecordKey` and `Data`. + +Create the lists/tables yourself only if the user asks and has permission. Otherwise give them +the exact list of names and columns. + +## Step 4: Add the connector + +Always use the CLI (pinned in `package.json`) so codegen and `ms.config.json` stay consistent. Run +`npx ms app add data-source --help` to see every flag. + +```bash +# SharePoint: one command per list +npx ms app add data-source --connector shared_sharepointonline --as table --dataset "" --table "" + +# Dataverse: one command per table (no connection id needed) +npx ms app add data-source --connector dataverse --as table --table "
" + +# Any other connector +npx ms connector list --search "" +npx ms app add data-source --connector --as action +``` + +Then find the generated operations. **Do not read whole generated files**; they are large: + +```bash +# list method names of a generated service +rg "async \w+\(" generated/services/Service.ts +# then read one method and its model +rg "async " -A 25 generated/services/Service.ts +``` + +## Step 5: Implement the provider + +The core already provides `createTableBackedProvider()`. You implement **one `TableBackend` per +collection**, which is five methods. Everything else (validation, queries, paging, conflicts, +export/import) is handled for you. + +1. **Connector wrapper**: `src/connectors/Tables.ts`. This is the only file that imports + `generated/`. Expose plain functions such as `listRows(table, cursor)`, `getRow`, + `createRow`, `updateRow(table, key, data, etag)` and `deleteRow`, and translate connector + results into `BackendRow` (`{ key, data, etag, createdAt, updatedAt }`). +2. **Provider**: `src/storage/providers/.ts`. + +```ts +// Adjust names (config fields, table prefix) to match this app's src/config.ts. +import { createLocalProvider, createTableBackedProvider, type TableBackend } from '../core'; +import * as rows from '../../connectors/sharepointTables'; +import { config } from '../../config'; + +function backendFor(collectionName: string): TableBackend { + const table = `${config.storageTablePrefix}${collectionName}`; + return { + list: (cursor) => rows.listRows(table, cursor), + get: (key) => rows.getRow(table, key), + create: (key, data) => rows.createRow(table, key, data), // ConflictError if key exists + update: (key, data, etag) => rows.updateRow(table, key, data, etag), // ConflictError on etag mismatch, NotFoundError if missing + delete: (key, etag) => rows.deleteRow(table, key, etag), // idempotent; ConflictError on etag mismatch + }; +} + +export function createSharePointProvider() { + const local = createLocalProvider({ prefix: config.storagePrefix }); + return createTableBackedProvider({ + id: 'sharepoint', + shared: true, + tableFor: backendFor, + kv: (namespace) => local.kv(namespace), // keep preferences on the device + }); +} +``` + +3. **Register it** in `src/storage/index.ts` by adding `sharepoint: createSharePointProvider` to + the provider registry. Then set `VITE_STORAGE_PROVIDER=sharepoint` (plus any new variables, + such as the table prefix) in `.env.local`. Document the new variables in `.env.example` and in `src/config.ts`. +4. Remote stores do not push changes. Call `provider.refresh()` on window focus, and optionally + on a timer, so other users' edits appear. + +### Mapping rules every backend must follow + +- `etag` must change on **every** write, and the backend must reject stale etags with a + "precondition failed" error (HTTP 412). Map that error to `ConflictError` from `../core`. +- `create` with an existing key must throw `ConflictError`. Enforce uniqueness on `RecordKey`, + or check first. +- A missing record on `update` throws `NotFoundError`. `delete` of a missing record succeeds. +- `list` must page with the backend's continuation token. Never assume one page holds everything. +- Store `Data` exactly as given. Never reformat the JSON. + +## Step 6: Prove it with the contract suite + +Create `src/storage/providers/.test.ts`: + +```ts +import { runProviderContract } from '../core/contract'; +// Fake the connector wrapper (src/connectors/Tables.ts) with an in-memory map that +// reproduces the backend's real behaviour: etags, 412s, paging. See createInMemoryTableBackend +// in core/providers/tableBacked.ts for the reference behaviour. +runProviderContract('sharepoint', () => createSharePointProviderWithFakeRows()); +``` + +Run `npm test`, `npm run lint` and `npm run typecheck`. All must pass. Then run the app against the +real backend and try each feature, ideally in two browsers with different accounts to see +sharing and conflicts. + +## Step 7: Security and privacy + +- Grant list/table permissions to exactly the people who should read or write each collection. + The app's UI is not a security boundary. +- Review what becomes visible once data is shared. Collections that were per-browser (drafts, + personal notes) may now be readable by others; keep those in `kv` (device-local), or use a + per-user table with item-level permissions. +- Keep connector permissions least-privilege. Add only the tables the app uses. + +## Step 8: Move existing data + +Users can move what they already have: in the app's Settings, choose **Export data** while still +on the `local` provider, switch to the new provider, then **Import data**. Import validates every +record and skips anything invalid. + +## Done checklist + +- [ ] One list/table per moved collection, with `RecordKey` (unique) and `Data` columns +- [ ] Connector added with the CLI; the updated `generated/`, `.ms/` and `ms.config.json` are committed to the app's repository. +- [ ] `src/connectors/Tables.ts` plus `src/storage/providers/.ts`, registered in `src/storage/index.ts` +- [ ] The contract suite passes for the new provider, and `npm test`, `npm run lint` and `npm run typecheck` are green +- [ ] Permissions configured in the backend +- [ ] `.env.example`, `src/config.ts` and the README's "Storage" section updated diff --git a/samples/CodeFlow/.github/skills/add-data-source/references/custom-api.md b/samples/CodeFlow/.github/skills/add-data-source/references/custom-api.md new file mode 100644 index 0000000..97b921e --- /dev/null +++ b/samples/CodeFlow/.github/skills/add-data-source/references/custom-api.md @@ -0,0 +1,45 @@ +# Your own API as a backend + +Use this when data must live in an existing system (an internal service, a SQL database behind an +API, a SaaS product). + +## Requirements for the API + +Expose, per collection (or with the collection as a path segment): + +| Operation | Example | Must | +|---|---|---| +| List | `GET /collections/{name}/rows?cursor=…` | Return `{ rows: BackendRow[], nextCursor? }` and page results | +| Get | `GET /collections/{name}/rows/{key}` | Return 404 when missing | +| Create | `POST /collections/{name}/rows` with `{ key, data }` | Return 409 when the key exists | +| Update | `PUT /collections/{name}/rows/{key}` with `If-Match: ` | Return 412 on a stale etag and 404 when missing | +| Delete | `DELETE /collections/{name}/rows/{key}` with optional `If-Match` | Succeed when already gone; return 412 on a stale etag | + +Rows carry `key`, `data` (an opaque JSON string, stored verbatim), `etag` (changes on every +write), `createdAt` and `updatedAt`. The API must authenticate the caller and enforce +authorization itself. + +## Reach it through a connector + +Wrap the API in a **custom connector** (OpenAPI definition plus authentication) in your Power +Platform environment. Then add it like any other connector: + +```bash +npx ms connector list --search "" +npx ms app add data-source --connector --as action +``` + +Calling arbitrary URLs with `fetch` from the app is discouraged: it bypasses connector +authentication, data-loss-prevention policies and auditing. + +## Map responses + +In `src/connectors/Tables.ts`, translate: + +- 404 on get → `undefined` +- 409 on create → `ConflictError` +- 412 on update/delete → `ConflictError` +- 404 on update → `NotFoundError` + +Then build the provider with `createTableBackedProvider()` exactly as in `SKILL.md` step 5, and +run the contract suite against a fake of the wrapper. diff --git a/samples/CodeFlow/.github/skills/add-data-source/references/dataverse.md b/samples/CodeFlow/.github/skills/add-data-source/references/dataverse.md new file mode 100644 index 0000000..5ca3734 --- /dev/null +++ b/samples/CodeFlow/.github/skills/add-data-source/references/dataverse.md @@ -0,0 +1,49 @@ +# Dataverse tables backend + +## Provision + +For each collection, create a table (for example display name `LearningHub Session`, logical +name `_learninghubsession`): + +| Column | Dataverse type | Settings | +|---|---|---| +| `RecordKey` | Text (single line), max length 200 | Business required, plus an **alternate key** on this column | +| `Data` | Multiline text (plain) | Max length 1,048,576 | + +The primary name column can hold a readable label (for example the record's title) for +browsing in Dataverse. Ownership: choose **User or team** if you need per-user security, or +**Organization** for data everyone shares. + +Security: create or extend a **security role** with Create/Read/Write/Delete privileges on each +table at the right depth (User, Business Unit or Organization), and assign it to the app's users. + +## Add the connector + +```bash +npx ms app add data-source --connector dataverse --as table --table "_learninghubsession" +``` + +No connection id is needed; the CLI binds to the active environment's Dataverse. Repeat per +table, then inspect the generated services with `rg "async \w+\(" generated/services`. + +## Mapping to `BackendRow` + +| BackendRow | Dataverse row | +|---|---| +| `key` | `RecordKey` column (the alternate key) | +| `data` | `Data` column | +| `etag` | `@odata.etag` | +| `createdAt` / `updatedAt` | `createdon` / `modifiedon` | + +- **Lookups by key**: retrieve by alternate key, or filter `RecordKey eq ''`. Keep the row's + primary GUID in the wrapper for updates and deletes. +- **Paging**: follow `@odata.nextLink`, or the paging cookie the generated list operation exposes. +- **Conflicts**: Dataverse supports optimistic concurrency. Send `If-Match: ` on update + and delete, and map HTTP 412 to `ConflictError`. A duplicate alternate key on create fails, so + map that to `ConflictError` too. +- **Timestamps** are UTC ISO strings, so pass them through unchanged. + +## Notes + +- Use a **solution** to hold the tables and security role, so the setup can be exported to other environments. +- Dataverse capacity is metered. JSON in `Data` is compact, but avoid storing large blobs; use file columns or SharePoint for documents. diff --git a/samples/CodeFlow/.github/skills/add-data-source/references/sharepoint.md b/samples/CodeFlow/.github/skills/add-data-source/references/sharepoint.md new file mode 100644 index 0000000..a1a5484 --- /dev/null +++ b/samples/CodeFlow/.github/skills/add-data-source/references/sharepoint.md @@ -0,0 +1,59 @@ +# SharePoint lists backend + +## Provision + +For each collection, create a list (for example `LearningHub_sessions`): + +| Column | SharePoint type | Settings | +|---|---|---| +| `RecordKey` | Single line of text | Required, **Enforce unique values: Yes** (this also indexes it) | +| `Data` | Multiple lines of text | **Plain text** (not rich/enhanced), "Append changes" **off** | + +Rename or hide the built-in `Title` column if you like; the app does not use it. You can set +`Title` to a human-readable value (e.g. the record's name) in `createRow` to make the list browsable. + +Permissions: break inheritance on each list only if it needs different access than the site. +Grant **Contribute** to people who write and **Read** to people who only read. + +## Add the connector + +```bash +npx ms app add data-source --connector shared_sharepointonline --as table --dataset "https://.sharepoint.com/sites/" --table "LearningHub_sessions" +``` + +Repeat for each list. Then inspect the generated services: + +```bash +rg "async \w+\(" generated/services +``` + +Typical operations are "get items" (with `$filter`, `$top` and a continuation/skip token), +"get item", "create item", "update item" and "delete item". Exact names depend on the CLI version, +so use what the grep shows. + +## Mapping to `BackendRow` + +| BackendRow | SharePoint item | +|---|---| +| `key` | `RecordKey` | +| `data` | `Data` | +| `etag` | `@odata.etag` (or `ETag`) from the item | +| `createdAt` / `updatedAt` | `Created` / `Modified` | + +- **Lookups by key**: SharePoint item ids are numeric and differ from `RecordKey`. Find items with + a filter such as `$filter=RecordKey eq ''` (escape single quotes by doubling them). Cache + `RecordKey → item id` inside the wrapper if you want fewer calls. +- **Paging**: follow the continuation value the "get items" operation returns (`@odata.nextLink` + or a skip token). Return it as `nextCursor`. +- **Conflicts**: if the update/delete operation accepts an `If-Match` header or etag parameter, pass + the etag and map HTTP 412 to `ConflictError`. If it does not, re-read the item, compare `etag`, + then write. Document in the README that a small race window remains. +- **Create uniqueness**: with "Enforce unique values" on, a duplicate `RecordKey` fails. Map that + failure to `ConflictError`. +- **Size**: keep each record well under a few hundred KB. Large attachments belong in a document + library, with only a link stored in the record. + +## Throttling + +SharePoint throttles bursts. Keep `list` page sizes moderate (100–500). If the connector reports +HTTP 429, wait for `Retry-After` and retry. diff --git a/samples/CodeFlow/.github/skills/setup-codeflow/SKILL.md b/samples/CodeFlow/.github/skills/setup-codeflow/SKILL.md new file mode 100644 index 0000000..2f16559 --- /dev/null +++ b/samples/CodeFlow/.github/skills/setup-codeflow/SKILL.md @@ -0,0 +1,146 @@ +--- +name: setup-codeflow +description: Sets up a fresh copy of the CodeFlow sample so it runs as an app hosted on Copilot Managed Runtime — copies the sample into its own folder, signs in with the ms CLI, creates the app and its platform-managed git repository (which writes ms.config.json), applies its settings, adds the GitHub connector, configures .env.local, starts local development, and commits and pushes to the app's repository. Use when someone has just cloned CodeFlow, or when `npm run dev` / `npm run build` stops at "CodeFlow setup is incomplete". +--- + +# Set up CodeFlow + +CodeFlow ships **without** `ms.config.json`, **without** connector code and **without** any +environment identifiers. This skill creates them for the user's own environment. Run every +command from the sample folder (the one that contains `package.json`). + +The app gets its own platform-managed git repository. Commit `ms.config.json`, `generated/` and +`.ms/` to it with the rest of the app; only `.env.local` stays local (it is gitignored). + +Background: Quickstart https://go.microsoft.com/fwlink/?LinkId=2368962 and documentation +https://go.microsoft.com/fwlink/?LinkId=2372842 for Copilot Managed Runtime (public preview). + +## Prerequisites + +- Node.js 24.11 or later, npm and git. +- Access to a Power Platform environment where the user can create apps on Copilot Managed + Runtime. +- A GitHub account the app will act as (the GitHub connector signs in with it). +- The sample must be in **its own folder**, not inside a clone of the samples repository: that + folder becomes the app's repository. If `git rev-parse --show-toplevel` succeeds in the sample + folder, copy the folder out first (for example `cp -r Copilot-Managed-Runtime/samples/CodeFlow my-codeflow`; + PowerShell: `Copy-Item -Recurse`) and continue from the copy. +- Install dependencies once: `npm install`. + +Check the installed CLI before using any command below, because flags change between versions: + +```bash +npx ms --help +npx ms app init --help +npx ms app add data-source --help +``` + +## Step 1: Sign in + +```bash +npx ms auth login +``` + +`npx ms auth status` shows cached accounts. Ask the user which environment to use if they have +more than one, and note its environment id. + +## Step 2: Create the app + +```bash +npx ms app init --display-name "CodeFlow" --icon-path ./public/codeflow-logo.png +``` + +Don't pass `--repo`: with no git repository in the folder, `init` creates the app's +platform-managed git repository and sets it up as `origin`. Add `--environment-id ` to pick +the environment without a prompt. Leave `--build-path` (`./dist`) and `--build-command` +(`npm run build`) at their defaults. + +This writes `ms.config.json`. Confirm it contains an `appId`, an `environmentId` and +`"repoType": "native"` (`npx ms app info` shows the app). + +## Step 3: Apply app settings + +CodeFlow draws its own header, so hide the host header: + +```bash +npx ms app set-setting --show-header false +``` + +## Step 4: Add the GitHub connector (always required) + +CodeFlow reads and writes pull requests only through the public **GitHub** connector +(`shared_github`). Add it as an action data source; the CLI prompts for (or creates) a GitHub +connection and generates `generated/`: + +```bash +npx ms app add data-source --connector shared_github --as action +``` + +If the CLI reports actions "skipped due to your organization's connector policy", continue: +`npm run check-setup` (Step 6) reports any operation CodeFlow needs that is missing. + +No other connectors are needed. The app uses exactly these GitHub connector operations (least +privilege — do not add others): `GetUser`, `GetPullRequest`, `GetPullRequests`, +`MergePullRequest`, `SearchIssues`, `CompareRepositoryCommits`, `ListCollaborators`, +`checkCollaborator`, `CreateReference`, `CreatePullRequest` and `SearchGithubWithQuery` +(GraphQL queries and mutations for comments, reviews, files, branches and cherry-pick commits). + +If the generated service or method names differ from what `src/connectors/github.ts` expects, +adapt **only** that file (it is the single module that imports `generated/`), then run +`npm run typecheck`. + +## Step 5: Local configuration + +```bash +cp .env.example .env.local +``` + +All values are optional. Leave `VITE_GITHUB_HOST` at `https://github.com`: the public GitHub +connector this app uses talks to github.com. Set `VITE_APP_URL` to the deployed app URL (from +`npx ms app play`) once the app is deployed, so shared deep links point at it. + +## Step 6: Verify and run + +```bash +npm run check-setup # must print "CodeFlow setup looks complete." +npm run typecheck +npm test +npm run dev # or: npx ms app dev — open the "Local Play" URL it prints +``` + +## Step 7: Commit and push + +Commit everything (including `ms.config.json`, `generated/` and `.ms/`) and push to the app's +repository. Git asks the user to sign in the first time. + +```bash +git fetch origin +git reset origin/main # start from the new repository's initial commit; your files stay as they are +git branch -M main +git add -A +git commit -m "Set up CodeFlow" +git push -u origin main +``` + +Deploy only when the user asks, from a pushed commit: `npm run build`, then `npx ms app deploy`. + +## Storage + +By default CodeFlow keeps its own data (seen marks, review notes, app-only approvals, +notes/feedback, settings) in the **browser** (`VITE_STORAGE_PROVIDER=local`), and shows +"Local mode: data stays in this browser". Nothing else is needed for local mode. + +To share that data between people or devices (SharePoint lists, Dataverse, your own API), follow +`.github/skills/add-data-source/SKILL.md`. Users can move existing data with +**Settings → Data → Export / Import**. + +## Done checklist + +- [ ] Sample in its own folder; `ms.config.json` created by `npx ms app init` (no `--repo`), with + `appId`, `environmentId` and `"repoType": "native"` +- [ ] Host header hidden (`npx ms app set-setting --show-header false`) +- [ ] GitHub connector added; `npm run check-setup` passes +- [ ] `.env.local` created (optional values reviewed) +- [ ] `npm run typecheck` and `npm test` pass +- [ ] `npm run dev` opens the app and the dashboard loads pull requests +- [ ] Everything committed and pushed to `origin` diff --git a/samples/CodeFlow/.gitignore b/samples/CodeFlow/.gitignore new file mode 100644 index 0000000..5fc8392 --- /dev/null +++ b/samples/CodeFlow/.gitignore @@ -0,0 +1,30 @@ +# Logs +logs +*.log +npm-debug.log* + +node_modules +dist +dist-ssr +coverage +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# Managed Apps: ms.config.json, generated/ and .ms/ belong in your app's repository; +# only the packed build output stays local. +.ms/packed/ + +# Local environment +.env +.env.* +!.env.example diff --git a/samples/CodeFlow/.npmrc b/samples/CodeFlow/.npmrc new file mode 100644 index 0000000..214c29d --- /dev/null +++ b/samples/CodeFlow/.npmrc @@ -0,0 +1 @@ +registry=https://registry.npmjs.org/ diff --git a/samples/CodeFlow/AGENTS.md b/samples/CodeFlow/AGENTS.md new file mode 100644 index 0000000..7642cc1 --- /dev/null +++ b/samples/CodeFlow/AGENTS.md @@ -0,0 +1,35 @@ +# Agent guide + +CodeFlow is a React + Vite + TypeScript app hosted on Copilot Managed Runtime that reviews GitHub +pull requests through the public GitHub connector. Start with `README.md`. + +## Skills + +- `.github/skills/setup-codeflow/SKILL.md` — first-time setup (`ms app init`, app settings, GitHub + connector, `.env.local`). +- `.github/skills/add-data-source/SKILL.md` — move app data from browser storage to a shared backend. + +## Rules + +- The sample ships without `ms.config.json` and connector code generation (`generated/`, `.ms/`). + Setup creates them (`npx ms app init`, `npx ms app add data-source`) in the user's copy, which + is the app's own repository; they are committed there. Only `src/connectors/*` may import + `generated/`; everything else uses the `GitHubClient` interface. +- Anything the connector has no REST operation for goes through GraphQL + (`githubClient.graphql`, via `src/services/graphQl.ts`). The operation takes no variables: + inline values with `gqlString` and treat any GraphQL `errors` entry on a mutation as failure. +- All app-owned data goes through `src/storage` (collections in `src/storage/collections.ts`). + Don't use `localStorage`, `sessionStorage` or `indexedDB` directly, and never edit + `src/storage/core/` (it is shared, synced code). +- Don't log payloads, identities or connector responses; use `src/lib/logger.ts`. +- Render external links through `safeUrl` / `githubLink`. +- Keep test data synthetic (`octo-org/octo-repo#123`, `octocat`, `example.com`). + +## Checks + +```bash +npm run lint +npm test +npm run typecheck # after setup (needs generated/) +npm run build # after setup +``` diff --git a/samples/CodeFlow/README.md b/samples/CodeFlow/README.md new file mode 100644 index 0000000..b6d650d --- /dev/null +++ b/samples/CodeFlow/README.md @@ -0,0 +1,275 @@ +# CodeFlow + +An iteration-aware pull request review app for **GitHub** — an app hosted on +**Copilot Managed Runtime** (React + Vite + TypeScript), built on the public **GitHub connector** +(`shared_github`). + +> **Preview:** Copilot Managed Runtime is in public preview. Features, the `ms` CLI and the +> `@microsoft/cmr-*` packages may change. See the +> [Quickstart](https://go.microsoft.com/fwlink/?LinkId=2368962) and the +> [documentation](https://go.microsoft.com/fwlink/?LinkId=2372842). + +This is a sample: clone it, connect it to your own environment and GitHub account, and adapt it. + +## What it demonstrates + +- A connector-backed UI where **every** connector call goes through one small adapter + (`src/connectors/github.ts`), so the rest of the app — and the tests — never touch generated + code. +- A pluggable **storage interface** (`src/storage`): data stays in the browser by default and can + be moved to SharePoint, Dataverse or your own API with the bundled `add-data-source` skill, + without touching UI code. +- Diffing, iteration tracking, syntax highlighting (Shiki, grammars loaded on demand), + Markdown rendering without raw HTML, and a large unit-test suite (Vitest + Testing Library). + +## Features + +- **Dashboard** — review requests, your PRs, PRs you reviewed, in-progress reviews, flagged PRs, + recently viewed PRs and pinned repositories. Jump to any PR by `octo-org/octo-repo#123` or by + pasting its URL. +- **Iterations** — each commit on the PR branch is an iteration (the base is Iteration 0). + Compare any two iterations; "new since your last review" counts commits after the iteration + you last reviewed. Force-pushes are detected and reported. +- **File list** with change badges, `+`/`−` counts, a name filter (with invert), and + **mark as seen**. Seen marks carry forward across pushes when a file's diff did not change. +- **Diff viewer** — inline or side-by-side, whitespace-insensitive mode, word-level diff, + syntax highlighting, find-in-file, full-file expansion, and Markdown preview with comments. +- **Compare any two changed files** side by side (e.g. `v2.sql` vs `v3.sql`). +- **Comment threads** — single- and multi-line comments, replies, edits, deletes, and status + (active / resolved / closed). A comment summary panel filters by status, level and author. +- **Checks** — required vs optional checks for the PR head, with links to each check. +- **Merge, auto-merge, publish draft, cherry-pick** (with an optional follow-up PR). +- **App-only author approval** — the PR author can record "approved (app only)" for a head + commit. This is stored by the app, never sent to GitHub, and does not count toward GitHub's + merge rules. +- **Notes & feedback** — a small list of bugs, ideas and questions with comments and a simple + status, stored like the rest of the app's data. +- **Settings** — theme, code font and ligatures, diff defaults, refresh cadence, and + **Data → Export / Import**. +- **Deep links** — `?org=&repo=&pull=[&file=][&comment=]`. + +## Architecture + +``` +src/ + connectors/github.ts The only module that uses connector codegen (generated/). Defines the + GitHubClient interface; tests replace it with fakes. + services/ Domain services over GitHubClient: PRs, compare, checks (GraphQL), + comments and reviews (GraphQL), merge, cherry-pick, feedback + storage/ + core/ Shared storage core (provider interface, local + memory providers, + contract tests). Synced from the template set; do not edit. + collections.ts Every stored collection as a zod schema + index.ts createStorage(): picks the provider from VITE_STORAGE_PROVIDER + mirror.ts Synchronous in-memory view of a collection with write-through + state/ CodeFlowProvider plus focused hooks (load, iterations, files, comments, + reviews, merge, checks, polling, deep links) + components/ Dashboard, Layout, FileList, IterationBar, DiffViewer, CommentThread, … + settings/ Settings document (stored in the `prefs` key/value namespace) + config.ts Typed configuration from VITE_* variables + lib/ logger (silent in production builds) and safeUrl +scripts/ + check-setup.mjs Runs before dev/build; explains what setup is missing + storage-describe.ts Prints every collection as JSON Schema (npm run storage:describe) +``` + +``` +UI components ──► state hooks ──► services ──► connectors/github.ts ──► generated/ (local only) + │ + └──────────► utils/storage, settings ──► storage provider (local by default) +``` + +## Setup + +The short version is below; `.github/skills/setup-codeflow/SKILL.md` has the full steps and can be +run by a coding agent. For AI-assisted setup you can optionally install this repository's agent +plugin ([`../../plugins/copilot-managed-runtime`](../../plugins/copilot-managed-runtime)). + +The sample ships without `ms.config.json` or connector code; the steps below create them for your +environment. Your app gets its own platform-managed git repository, and you commit everything to +it except `.env.local`. + +1. **Prerequisites:** Node.js 24.11+, npm, git, access to a Power Platform environment where you + can create apps on Copilot Managed Runtime, and a GitHub account. +2. **Copy the sample into its own folder.** It becomes your app's repository, so it can't stay + inside a clone of this samples repository: + + ```bash + git clone --depth 1 https://github.com/microsoft/Copilot-Managed-Runtime + cp -r Copilot-Managed-Runtime/samples/CodeFlow my-codeflow # PowerShell: Copy-Item -Recurse Copilot-Managed-Runtime/samples/CodeFlow my-codeflow + cd my-codeflow + ``` + +3. **Install:** `npm install` +4. **Sign in:** `npx ms auth login` +5. **Create the app.** This creates the app, its platform-managed git repository (set up as + `origin`) and `ms.config.json`: + + ```bash + npx ms app init --display-name "CodeFlow" --icon-path ./public/codeflow-logo.png + ``` + + Optionally add `--environment-id ` to pick the environment without a prompt. +6. **Hide the host header** (CodeFlow draws its own): + + ```bash + npx ms app set-setting --show-header false + ``` + +7. **Add the GitHub connector (required):** + + ```bash + npx ms app add data-source --connector shared_github --as action + ``` + + This generates `generated/` and `.ms/`; commit them with the app. The CLI asks you to pick or + create a GitHub connection. If it reports actions "skipped due to your organization's + connector policy", `npm run check-setup` tells you whether CodeFlow needs any of them. +8. **Configure (optional):** `cp .env.example .env.local` and adjust. +9. **Check and run:** + + ```bash + npm run check-setup + npm run dev # or: npx ms app dev + ``` + + Open the **Local Play** URL that the dev server prints to run the app inside the player with + the live connector. +10. **Commit and push** to your app's repository (git asks you to sign in the first time), then + deploy from the pushed commit: + + ```bash + git fetch origin + git reset origin/main # start from the new repository's initial commit; your files stay as they are + git branch -M main + git add -A + git commit -m "Set up CodeFlow" + git push -u origin main + npm run build && npx ms app deploy + ``` + +`npm run dev` and `npm run build` run `check-setup` first and stop with the steps above if +something is missing. `npm test` and `npm run lint` work without any setup. + +## Connector operations used + +CodeFlow uses only these operations of the GitHub connector (`shared_github`): + +| Operation | Used for | +| --- | --- | +| `GetUser` | The signed-in GitHub identity (votes, authorship, mentions) | +| `GetPullRequest`, `GetPullRequests` | PR details and repository PR lists | +| `SearchIssues` | Dashboard queues (`is:pr review-requested:@me`, …) | +| `CompareRepositoryCommits` | Changed files and iterations | +| `MergePullRequest` | Merge (guarded by the expected head SHA) | +| `ListCollaborators`, `checkCollaborator` | @mention suggestions | +| `CreateReference`, `CreatePullRequest` | Cherry-pick branches and follow-up PRs | +| `SearchGithubWithQuery` | GraphQL queries and mutations (below) | + +GraphQL documents sent through `SearchGithubWithQuery` (values are inlined; the operation takes +no variables): + +| Feature | GraphQL | +| --- | --- | +| Read comments | `pullRequest { reviewThreads { … comments { … } } comments { … } }` (paged) | +| New diff comment | `addPullRequestReview` (pending) → `addPullRequestReviewThread` → `submitPullRequestReview` (`COMMENT`); `deletePullRequestReview` discards the pending review on failure | +| Reply | `addPullRequestReviewThreadReply`; Description replies use `addComment` | +| PR-level comment | `addComment` | +| Resolve / reactivate | `resolveReviewThread` / `unresolveReviewThread` | +| Edit | `updatePullRequestReviewComment` / `updateIssueComment` | +| Delete | `deletePullRequestReviewComment` / `deleteIssueComment` | +| Votes | read `pullRequest { reviews }`; submit `addPullRequestReview(event: APPROVE \| REQUEST_CHANGES \| COMMENT)` | +| Changed files | `pullRequest { files }` (complements compare, which caps at about 300 files) | +| File contents | `object(expression: ":") { ... on Blob }` | +| Branches | `refs(refPrefix: "refs/heads/")`, `ref(qualifiedName:)` | +| Cherry-pick | `createCommitOnBranch` (one commit, `expectedHeadOid`); on failure `ref { id }` + `deleteRef` | +| Checks, auto-merge, publish draft | `statusCheckRollup`, `enablePullRequestAutoMerge` / `disablePullRequestAutoMerge`, `markPullRequestReadyForReview` | + +The token scopes are those of the connector's GitHub OAuth app; the app can't request more. + +**Least privilege:** the connection acts as the GitHub user who created it; the app can do only +what that user can do. Don't add connector operations the app doesn't call, and review +`src/connectors/github.ts` before extending it. + +### Capability notes and gaps + +- **Branches and file contents** use GraphQL (`refs(refPrefix: "refs/heads/")` and + `object(expression: ":")`), because the public connector has no raw-file or + list-branches operation. Binary files and blobs GitHub won't return as text show as + unavailable rather than as content. +- **Comment sync** goes to GitHub whenever GraphQL succeeds. Only when GitHub genuinely can't be + read (offline, no permission, an API error) do comments fall back to **local comments** stored + by the app, and the header shows "Local (this device)". +- **Cherry-pick** writes text files only: GraphQL returns no binary content, so a pull request + that changes a binary file is refused cleanly before anything is written. Each file is merged + three-way against the pull request's base, so changes already on the target are kept and a + real conflict (including a file the target doesn't have) refuses the whole cherry-pick. The + cherry-pick is one `createCommitOnBranch` commit; if it fails, the new branch is deleted again. +- **Comments on lines outside the diff:** GitHub's API can't anchor a review comment there, so the + app posts a file-level comment with a hidden marker naming the line, and re-anchors it on read. +- **Branch names with `/`** (for example `release/1.0`) can't be passed to the connector's + path-based REST operations, so the app resolves branches to commits through GraphQL first. +- **Large PRs:** GitHub caps compare results (about 300 files / 250 commits). The complete file + list is read through GraphQL; files beyond the compare cap are listed without a diff. + +## Storage modes and privacy + +All app-owned data goes through the storage interface: + +| Collection / namespace | Holds | +| --- | --- | +| `reviewState` | Per PR (`owner/repo#number`): seen marks, last reviewed iteration, iteration history, local comments, recent/flagged/in-progress markers | +| `prNotes` | Per PR: which comment threads were closed in the app, and by whom | +| `approvals` | App-only author approvals (append-only) | +| `feedback`, `feedbackComments` | Notes & feedback items and their replies | +| `prefs` (key/value) | Settings and pinned repositories | +| `drafts` (key/value) | Unsent comment text (expires after 14 days) | +| `ui` (key/value) | Pane sizes and collapsed sections | + +- **Local mode (default, `VITE_STORAGE_PROVIDER=local`)** keeps everything in this browser's + storage under the `VITE_APP_STORAGE_PREFIX` prefix. Nothing is shared with other reviewers — + the app says so with a "Local mode: data stays in this browser" notice. Clearing site data + removes it; use **Settings → Data → Export** to keep a copy. +- **Shared mode:** follow `.github/skills/add-data-source/SKILL.md` to add a SharePoint, + Dataverse or custom-API provider, then **Import** your export. Who can read or change shared + data is decided by the backend's permissions, not by the app's UI. +- GitHub data (PRs, comments, reviews) is read live through the connector and is not copied + into app storage, except local comments when GitHub comment sync is unavailable. +- Run `npm run storage:describe` to print every collection's JSON Schema. + +## Configuration + +| Variable | Default | Purpose | +| --- | --- | --- | +| `VITE_APP_NAME` | `CodeFlow` | Name shown in the header | +| `VITE_GITHUB_HOST` | `https://github.com` | GitHub web origin for links when the API gives none | +| `VITE_APP_URL` | *(empty)* | Deployed app URL used for shareable deep links | +| `VITE_DEV_PLAYER_URL` | `https://play.preview.managedapps.cloud.microsoft` | Player used for share links during `npm run dev` (the same host the Vite plugin prints as "Local Play") | +| `VITE_STORAGE_PROVIDER` | `local` | Storage provider id registered in `src/storage/index.ts` | +| `VITE_APP_STORAGE_PREFIX` | `codeflow` | Prefix isolating this app's browser storage | + +## Scripts + +| Script | What it does | +| --- | --- | +| `npm run dev` | Local development (runs `check-setup` first) | +| `npm run build` | Type-check and build to `dist/` (runs `check-setup` first) | +| `npm run check-setup` | Verify `ms.config.json` (from `ms app init`) and the GitHub connector codegen | +| `npm run typecheck` | `tsc -b` (needs the connector codegen) | +| `npm run lint` | ESLint, including storage and connector boundary rules | +| `npm test` | Vitest (no setup or codegen needed) | +| `npm run storage:describe` | Print collections as JSON Schema | +| `npm run verify` | Lint, test and build | + +## Customizing + +- Add GitHub features in `src/services/*` against the `GitHubClient` interface; add the connector + operation to `src/connectors/github.ts` only when you need a new one. +- Add stored data by declaring a collection in `src/storage/collections.ts`. +- Lint rules block `localStorage`/`sessionStorage` outside storage providers, `/.ms/` routes, + imports of `generated/` outside `src/connectors`, and `any`. + +## License + +This sample is licensed under the MIT license; see [LICENSE](../../LICENSE) at the root of the +repository. diff --git a/samples/CodeFlow/eslint.config.js b/samples/CodeFlow/eslint.config.js new file mode 100644 index 0000000..e539f51 --- /dev/null +++ b/samples/CodeFlow/eslint.config.js @@ -0,0 +1,96 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' +import { defineConfig, globalIgnores } from 'eslint/config' + +/** Browser storage must go through `src/storage` (see `.github/skills/add-data-source`). */ +const storageGlobals = ['localStorage', 'sessionStorage', 'indexedDB'].map((name) => ({ + name, + message: 'Use the storage layer in src/storage instead of browser storage directly.', +})) + +/** Platform-internal routes are not part of the public app surface. */ +const internalRouteSyntax = { + selector: 'Literal[value=/\\/\\.ms\\//], TemplateElement[value.raw=/\\/\\.ms\\//]', + message: 'Do not call platform-internal /.ms/ routes. Persist data through src/storage.', +} + +export default defineConfig([ + globalIgnores(['dist', 'generated', '.ms', 'node_modules', 'coverage']), + { + files: ['**/*.{ts,tsx}'], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + ], + languageOptions: { + globals: globals.browser, + }, + rules: { + '@typescript-eslint/no-explicit-any': 'error', + // Honour the `_name` convention for deliberately-unused bindings. + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + }, + }, + { + files: ['src/**/*.{ts,tsx}'], + ignores: ['src/storage/core/providers/**'], + rules: { + 'no-restricted-globals': ['error', ...storageGlobals], + }, + }, + { + files: ['src/**/*.{ts,tsx}'], + ignores: ['src/storage/core/providers/**', 'src/storage/providers/**'], + rules: { + 'no-restricted-properties': [ + 'error', + ...storageGlobals.map(({ name, message }) => ({ object: 'window', property: name, message })), + ...storageGlobals.map(({ name, message }) => ({ object: 'globalThis', property: name, message })), + ], + }, + }, + { + files: ['src/**/*.{ts,tsx}'], + ignores: ['src/storage/core/providers/**'], + rules: { + 'no-restricted-syntax': ['error', internalRouteSyntax], + }, + }, + { + // Connector code generation is only ever imported through the adapters. + files: ['src/**/*.{ts,tsx}'], + ignores: ['src/connectors/**'], + rules: { + 'no-restricted-imports': [ + 'error', + { + patterns: [ + { + regex: '(^|/)generated(/|$)', + message: 'Import connector code through src/connectors/* instead of generated/.', + }, + ], + }, + ], + }, + }, + { + files: ['scripts/**/*.{js,mjs}'], + extends: [js.configs.recommended], + languageOptions: { + globals: globals.node, + }, + }, +]) diff --git a/samples/CodeFlow/index.html b/samples/CodeFlow/index.html new file mode 100644 index 0000000..11a4228 --- /dev/null +++ b/samples/CodeFlow/index.html @@ -0,0 +1,13 @@ + + + + + + + CodeFlow + + +
+ + + diff --git a/samples/CodeFlow/package-lock.json b/samples/CodeFlow/package-lock.json new file mode 100644 index 0000000..d600945 --- /dev/null +++ b/samples/CodeFlow/package-lock.json @@ -0,0 +1,6640 @@ +{ + "name": "codeflow-template", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "codeflow-template", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "@microsoft/cmr-apps": "^0.6.5", + "react": "^19.2.6", + "react-dom": "^19.2.6", + "react-markdown": "^10.1.0", + "remark-gfm": "^4.0.1", + "shiki": "^4.4.3", + "zod": "^4.6.7" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@microsoft/cmr-apps-vite-plugin": "^0.5.0", + "@microsoft/cmr-cli": "0.33.0", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", + "@types/node": "^24.12.3", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.1", + "eslint": "^10.3.0", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-plugin-react-refresh": "^0.5.2", + "globals": "^17.6.0", + "jsdom": "^29.1.1", + "tsx": "^4.23.15", + "typescript": "~6.0.2", + "typescript-eslint": "^8.59.2", + "vite": "^8.0.12", + "vitest": "^4.1.9" + }, + "engines": { + "node": ">=24.11.0" + } + }, + "node_modules/@adobe/css-tools": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.5.0.tgz", + "integrity": "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@asamuzakjp/css-color": { + "version": "5.1.11", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-5.1.11.tgz", + "integrity": "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@csstools/css-calc": "^3.2.0", + "@csstools/css-color-parser": "^4.1.0", + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-7.1.1.tgz", + "integrity": "sha512-67RZDnYRc8H/8MLDgQCDE//zoqVFwajkepHZgmXrbwybzXOEwOWGPYGmALYl9J2DOLfFPPs6kKCqmbzV895hTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@asamuzakjp/nwsapi": "^2.3.9", + "bidi-js": "^1.0.3", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/generational-cache": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/generational-cache/-/generational-cache-1.0.1.tgz", + "integrity": "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/nwsapi": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz", + "integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@azure/msal-node-runtime": { + "version": "0.20.6", + "resolved": "https://registry.npmjs.org/@azure/msal-node-runtime/-/msal-node-runtime-0.20.6.tgz", + "integrity": "sha512-89Al7l5c8sOEA954d35WZOg1sCa2WKfgf7KyTbN9vIkKsoZrXdJ5+CPjy8+tQqWcsJTAMbQD4OWr7V09/xN8KA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.12", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.12.tgz", + "integrity": "sha512-2W76mhjrpQFO1lK5e8IvGYB2D0YZ7S2R1Z2BjO2ZUYuW+amcpK/z60U6ZZmzskwoa7sJ6XohP/Wg8H5KxXI/IA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.12", + "@babel/types": "^7.29.11", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.11", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.11.tgz", + "integrity": "sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.10.tgz", + "integrity": "sha512-EMCx3AGZ3WfAl6ht7AyQoPm2Lh+BGYEMdc4Q6Hf7uSCDOZFuLq44qNwL+iaim8VlyYhRAo4X43+weadK8ZB4Yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.12", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.12.tgz", + "integrity": "sha512-WJ7JBp/Q4+z/ImydtI7jS6NVco5++632ExBemSX+Ysb+G1lCwQ5BVo3SY+jGGOcZXI4ZccbZSUSJLNBW6eEpJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.11" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.10.tgz", + "integrity": "sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.12", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.12.tgz", + "integrity": "sha512-MscXe/NAZcOkYEsRajHZFt3ynsb22PUi6CTrp5U7+RYycR9By84mn9mFN54YgfITiqK4hFx3Ju3tZSyzfpS5ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.12", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.12", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.11", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.11", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.11.tgz", + "integrity": "sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.11", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bramus/specificity": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.3.tgz", + "integrity": "sha512-0GEz8qJWokkUVYQYRukmkSHIFNoBH8QTreeHrAFbvz1XFYc3Y+puhMs8PQ5x8GNugiC2l5jvDBXKLbBIByeSBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.2.1" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", + "integrity": "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.3.tgz", + "integrity": "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.7.tgz", + "integrity": "sha512-zgm9yjQz5iJB4VL8RyVwd71TWB8Q89FSxt/NzXoWqPSkEBOVtn9L6vAPtSc9hpKfB0Awo/AL2VKFHjYetBLFHQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.2.tgz", + "integrity": "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.16.tgz", + "integrity": "sha512-LsDbJPP/B8cPasUJyTA5S99F7C4G93ngW8hUluXz8CFeOaaRnBPtBiIlvgcPYU0HmHNz8CXg+1vwFrIB4F6Dgw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.2.tgz", + "integrity": "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@microsoft/cmr-apps": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@microsoft/cmr-apps/-/cmr-apps-0.6.5.tgz", + "integrity": "sha512-fCa7FTBh+Xa6Q1hz19sCCiE84ob1SQwJA0/vRRbOP2QwGVrQGDCejPvJGkW/1kPLeDhzuXczxL72xMiW7zvn2w==", + "license": "MIT", + "dependencies": { + "@microsoft/cmr-apps-common": "0.33.0" + } + }, + "node_modules/@microsoft/cmr-apps-common": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@microsoft/cmr-apps-common/-/cmr-apps-common-0.33.0.tgz", + "integrity": "sha512-L+FdOF4BO2h2RQvwFZIQzQYadci9MWz4D8V2695xvdQSxJkaMUxKEvsjTxsLYaJLvY2W+2lFi4roWLc+t97g/A==", + "license": "MIT", + "dependencies": { + "zod": "4.4.3" + }, + "peerDependencies": { + "@microsoft/1ds-core-js": "4.3.11", + "@microsoft/1ds-post-js": "4.3.11" + }, + "peerDependenciesMeta": { + "@microsoft/1ds-core-js": { + "optional": true + }, + "@microsoft/1ds-post-js": { + "optional": true + } + } + }, + "node_modules/@microsoft/cmr-apps-common/node_modules/zod": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/@microsoft/cmr-apps-dev-gateway": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@microsoft/cmr-apps-dev-gateway/-/cmr-apps-dev-gateway-0.5.3.tgz", + "integrity": "sha512-QqdeHn9hjzZMULqqQKswy9CX66Gqv1caKecWdxMEuoGfPHZpgG00hMzT4ANPr6vTQ/gdXPxjf7uw3H1nui2uAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@microsoft/cmr-apps-common": "0.33.0", + "zod": "4.4.3" + } + }, + "node_modules/@microsoft/cmr-apps-dev-gateway/node_modules/zod": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/@microsoft/cmr-apps-vite-plugin": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@microsoft/cmr-apps-vite-plugin/-/cmr-apps-vite-plugin-0.5.0.tgz", + "integrity": "sha512-JF2embnwBkXSdQV9pdswH7Q6/7NvuMjbhc19yIBzFTR0+wgUsdPFbACcyYIeKes9UaZR/GhZmh7nwsNNAD3htA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@microsoft/cmr-apps-common": "0.33.0", + "@microsoft/cmr-apps-dev-gateway": "0.5.3", + "picocolors": "1.1.1" + }, + "peerDependencies": { + "vite": ">=5.0.0" + } + }, + "node_modules/@microsoft/cmr-cli": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@microsoft/cmr-cli/-/cmr-cli-0.33.0.tgz", + "integrity": "sha512-Q/QAxV7A0abRdSOoqk4iG7YNUFHWNv9hhBPFRRIzBKLp2f49Cv0N9s77M0KQt7vTUhBMv25RyZzQiB/2Aj8mzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/msal-node-runtime": "0.20.6", + "@napi-rs/keyring": "2.1.0", + "esbuild": "0.28.1", + "open": "11.0.0" + }, + "bin": { + "ms": "dist/Bin.js" + }, + "engines": { + "git": ">=2.27.0", + "node": ">=24.11.0" + } + }, + "node_modules/@napi-rs/keyring": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring/-/keyring-2.1.0.tgz", + "integrity": "sha512-km9J3fomkGSLpImpelq0cMvLBrJ5eVlTzuWdG3Iy0laP6gU90MmHYjqhUhG32aYq0/0++r2TLuAA9xlnh4XU1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "optionalDependencies": { + "@napi-rs/keyring-darwin-arm64": "2.1.0", + "@napi-rs/keyring-darwin-x64": "2.1.0", + "@napi-rs/keyring-freebsd-x64": "2.1.0", + "@napi-rs/keyring-linux-arm-gnueabihf": "2.1.0", + "@napi-rs/keyring-linux-arm64-gnu": "2.1.0", + "@napi-rs/keyring-linux-arm64-musl": "2.1.0", + "@napi-rs/keyring-linux-riscv64-gnu": "2.1.0", + "@napi-rs/keyring-linux-x64-gnu": "2.1.0", + "@napi-rs/keyring-linux-x64-musl": "2.1.0", + "@napi-rs/keyring-win32-arm64-msvc": "2.1.0", + "@napi-rs/keyring-win32-ia32-msvc": "2.1.0", + "@napi-rs/keyring-win32-x64-msvc": "2.1.0" + } + }, + "node_modules/@napi-rs/keyring-darwin-arm64": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-darwin-arm64/-/keyring-darwin-arm64-2.1.0.tgz", + "integrity": "sha512-j6ATTOhmPW+N5EKwi8Yzn6P4Bz/uqnxzyYvqOL73/dgzDSYG5pS5eprqpVmOLse68WUTf79ZMqz97HnfvirJ9g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-darwin-x64": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-darwin-x64/-/keyring-darwin-x64-2.1.0.tgz", + "integrity": "sha512-54Q803nguiOaQzBG2h4uIkacI0eLGAlzzdpxPNi6IZtXbjqbPI4AQ86GrQy25tw3czBqRPBoGu0lHP2U+/f5iA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-freebsd-x64": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-freebsd-x64/-/keyring-freebsd-x64-2.1.0.tgz", + "integrity": "sha512-BL7ngJAYQBrUp1PTF8enOXOIVfxN51RbwVOEQ+8eAjWypF/5Ipqs8oQoMqkuc0wAbk+vatnNVjdKCIFa/HPglg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-arm-gnueabihf": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm-gnueabihf/-/keyring-linux-arm-gnueabihf-2.1.0.tgz", + "integrity": "sha512-JYgbCDk+giss7lKla8NTXhM/fLj+Hrfgr3xwKQ8jKn8qMD6vXLwYcfK8HJ9VoAcjIeYEUpCL6dRszJC5M4zFNg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-arm64-gnu": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm64-gnu/-/keyring-linux-arm64-gnu-2.1.0.tgz", + "integrity": "sha512-+PMONFQ+2GkBXG7vRG2spgR73bNCMeVpNopHoSmhj2E+5Gu6zJooRBjoaIZKj6hCyrOU8pXAhoZ22EEFQ/4YeQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-arm64-musl": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm64-musl/-/keyring-linux-arm64-musl-2.1.0.tgz", + "integrity": "sha512-dKjiXKTHQjAS57hL0HVzLpW9XYNGFpfYkr/51FzIIvbZR08PAnzIDYKwShoNYGvjQP6+rDFf1a5Utl0aWwcFrA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-riscv64-gnu": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-riscv64-gnu/-/keyring-linux-riscv64-gnu-2.1.0.tgz", + "integrity": "sha512-tqhb0ofhtEJ2+ZfmlKTDHbmIoNSz+SSTPWRgMfSVCgI4JVkqDdfcmIOcThZfRffJ3QI9C3Tng+rZL24acmD+GA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-x64-gnu": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-x64-gnu/-/keyring-linux-x64-gnu-2.1.0.tgz", + "integrity": "sha512-7ZA0ssxfpuGXV8S5Ct1ZJoEL3sKg/8u7mIL4SK9/PwKBhxIq7K+FVcjnggNsuFnEhHTX+HYl9hHDrlX0odZnHg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-x64-musl": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-x64-musl/-/keyring-linux-x64-musl-2.1.0.tgz", + "integrity": "sha512-dI74Fzl03CrN2TEP7YVBtUBFgyRTRPyK1LMcIgAUfgW3o6f5SD1a8EsfT82+brpFOltjOhacIlFiYOkYtSI5Fg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-win32-arm64-msvc": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-arm64-msvc/-/keyring-win32-arm64-msvc-2.1.0.tgz", + "integrity": "sha512-SltrXXkEe9a+Jv8ConDkZW2Mdr0srpWurS7oYkYP1Mp07DNBpFyqawRnyo4p7ZvQU3e+R6irj/Fq0epCCvVUXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-win32-ia32-msvc": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-ia32-msvc/-/keyring-win32-ia32-msvc-2.1.0.tgz", + "integrity": "sha512-l5wJQhqXkAfQ4FGxoRh0wMpL9VxVmfiYI5TTeOGNupuVsQvbHmysh8gfDQBBWVhyMENHJS2OqOSYIuqVjumAtA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-win32-x64-msvc": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-x64-msvc/-/keyring-win32-x64-msvc-2.1.0.tgz", + "integrity": "sha512-3zYwO7dhJiUNyv2te81ujXm2vGxHwgx+z2eBm0dTYe3aWpvKQVzpfxCp/7cViJs8duVYE04wVOgXiRhRCMEq2w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz", + "integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz", + "integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz", + "integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz", + "integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz", + "integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz", + "integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz", + "integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz", + "integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz", + "integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz", + "integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz", + "integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz", + "integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz", + "integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz", + "integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz", + "integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@shikijs/core": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.6.0.tgz", + "integrity": "sha512-bfd4OKgvoyXYiYmMRuleA656P4V7M/Du9lcTl38Ngm6KszMj7bq4J1IGZwSYR4c95Tv5UQALtYNWUwaI9UT3xw==", + "license": "MIT", + "dependencies": { + "@shikijs/primitive": "4.6.0", + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", + "@types/hast": "^3.0.5", + "hast-util-to-html": "^9.0.6" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/engine-javascript": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.6.0.tgz", + "integrity": "sha512-K0oqxFoL+kEMdz89mHLFO15Tsbv3kFZ6WR1cXZKMvLSc+oqaM00A6pyga1qSeXB22dP0tTiSApRcGBaKWsEccg==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", + "oniguruma-to-es": "^4.3.6" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.6.0.tgz", + "integrity": "sha512-aggd6Q7SuJOXNnsUbfG2XesxBJKBMAw/PDTUo9PyRjMaaJJ2dNrI+q0C+25ARXAK9yLHAlwxc9oRT2u68YKZ7w==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/langs": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.6.0.tgz", + "integrity": "sha512-1yMEX3oCVV54LUq/ovfpRkDQoYDkcvjSWFFa/YLUDMiSoRzMi2uxLJYbv41ahT8Lu9lFMaa7hecd3Q39trqUyg==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.6.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.6.0.tgz", + "integrity": "sha512-c54+TQEo9ToqgfL/AU8FpjnV09+GA9Oa7M5ROkkXteZfp5XzpAJGXjjvZQFQioJOwm/w/6Z3lIzQstAkl8coag==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", + "@types/hast": "^3.0.5" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/themes": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.6.0.tgz", + "integrity": "sha512-qHAVAs80RiGD+IRuH9G+JPDOEc9A/kHsng4EzCUCwB9bLzW6Z0y9WETh2YyCcADJBmfrIaJ1Jp7KBNP6FHkgtQ==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.6.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/types": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.6.0.tgz", + "integrity": "sha512-+ENG1adsKt/X7cRYw1Nl7BEpBmPOjmQ7bR/eGmHuMlT8gtOFf3KEi5l31DJYyAWhW6Y6bjP1plU7FmaxWGENFw==", + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.1.0", + "@types/hast": "^3.0.5" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.1.0.tgz", + "integrity": "sha512-cVBuhDQjBZaNMTwBquYfPydrUP+E3hE6oYGasx8h6ZrODIM7/r+gxLDXdd66oszbrggZHEntdE6j+5gYIVyMWQ==", + "license": "MIT" + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@testing-library/dom": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz", + "integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "picocolors": "1.1.1", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@testing-library/jest-dom": { + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.9.1.tgz", + "integrity": "sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@adobe/css-tools": "^4.4.0", + "aria-query": "^5.0.0", + "css.escape": "^1.5.1", + "dom-accessibility-api": "^0.6.3", + "picocolors": "^1.1.1", + "redent": "^3.0.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", + "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@testing-library/react": { + "version": "16.3.3", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz", + "integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@testing-library/dom": "^10.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.5.tgz", + "integrity": "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz", + "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": ">=7.24.0 <7.24.7" + } + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.1.tgz", + "integrity": "sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.72.1", + "@typescript-eslint/type-utils": "8.72.1", + "@typescript-eslint/utils": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.72.1", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.14.tgz", + "integrity": "sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.72.1.tgz", + "integrity": "sha512-ZGwZP4OCfyA0AQTpEAMWz+rtX01DRhQWW5hB0ucKDEIX5U7jdmPSaMx94rQfaPAQzIYz2BimOgKOJtjfpRFQ9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.72.1", + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.1.tgz", + "integrity": "sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.72.1", + "@typescript-eslint/types": "^8.72.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.1.tgz", + "integrity": "sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.1.tgz", + "integrity": "sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.72.1.tgz", + "integrity": "sha512-iY2wlmyrXJmx4yxUGP3aYCFF3cA/6ShddOKmLU2dx7LnEykbAM8WThlxZEfd1NddqceF6eJmZUayxx9oKIYNlg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1", + "@typescript-eslint/utils": "8.72.1", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.1.tgz", + "integrity": "sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.1.tgz", + "integrity": "sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.72.1", + "@typescript-eslint/tsconfig-utils": "8.72.1", + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.1.tgz", + "integrity": "sha512-5v5liypurJBFHCBNqh/RjsymAD+VWcE0djuGY/BUqp5fC3Qn+luWDEksjuTtWjPn6i5zQlUtkZCRG/CYG0yCkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.72.1", + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.1.tgz", + "integrity": "sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.72.1", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.4.0.tgz", + "integrity": "sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==", + "license": "ISC" + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.2.1.tgz", + "integrity": "sha512-9KyWCij3r0+qLG3Q62vBmv0VyevmYibAtxaCIVK9o0k6CXgaajZRIe8tpfchQcdZArJ5b/7OrIz4W3b2uxVRDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0 || ^0.3.0", + "babel-plugin-react-compiler": "^1.0.0", + "oxc-transform-react": ">=0.152.0 <0.157.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "oxc-transform-react": { + "optional": true + } + } + }, + "node_modules/@vitest/expect": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.12.tgz", + "integrity": "sha512-vFlTt+YEu9WBpNjdGayNmlMVzrWPi1+sv853/7t2FU7hpO5gAFBKHzQmkCq5Xjpr+evegF2994LQT3hF3mRlqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.12", + "@vitest/utils": "4.1.12", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.12.tgz", + "integrity": "sha512-fKShNpKZzupWZuY0z7egydvL0sqW4INEZBEExMBMAa6izlENEVHwoXgdaTCaBZ5fwlr4xf2o1wXC83n9RpO+NA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.12", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.12.tgz", + "integrity": "sha512-XW9O8+Mxx4VpCtkYdMJLZQQwsVryP9wk7cPKDxtXFfwSak6yRh5+2fep/Y0XF/ElBvJHq8bcYdi6aeuai0opZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.12.tgz", + "integrity": "sha512-NKlVKCr5QnCe8jijdMnmkpHHU+WTqiLFR6G0pHji9uRjXK9xJl1k1nTw6F3pOOj2PDcsDt2GKQMI7wIsaT491w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.12", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.12.tgz", + "integrity": "sha512-ko1y1Qgb/slzQ9mr+b89Cuqud8WG1TKtsPD8r7ZUBdvVOGt85Af2HwCqHujrhwJq95hs/9RM7fcAPg57o1vlzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.12", + "@vitest/utils": "4.1.12", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.12.tgz", + "integrity": "sha512-RGq9x4JNGNTZHEJxvN0oSiJjeSCExm0n2gZKKJZHY9cX5AVA6M7VJILBT3ZJ/tJ/0J9uWT7fETV9/btoi//vSg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.12.tgz", + "integrity": "sha512-Q3awXrwOfEV+qc3WmO5ONyE0yO7Q1gQ9/oyHxGLZ/pl7N3NO/ZztqQwKLuwMkV+CA1JYSIeO3gkHnRDIo4AVaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.12", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.35", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.35.tgz", + "integrity": "sha512-GNk8KX52CHqeNKGk8+7tZnQab/2k1t/BgrUHPKNdijzpEhF1saPQZHVKb6m5loSAxB39gyrTYw34Qf9CQ3u1qQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/browserslist": { + "version": "4.29.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.5.tgz", + "integrity": "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.11.33", + "caniuse-lite": "^1.0.30001819", + "electron-to-chromium": "^1.5.464", + "node-releases": "^2.0.60", + "update-browserslist-db": "^1.3.4" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bundle-name": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.1.tgz", + "integrity": "sha512-DdH81/zPLVS11EUgWq3tEu/xn+EzljlMYooDNdzWEnFha3R3NBMpMV1UqYIpjYHV/SgpFKMIX1Oh7o06SjM/oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001820", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001820.tgz", + "integrity": "sha512-gfWD6MxqVCqAOwmODfZf7DchWvlrA+SRdNX7ceLfg3xRqe5ssjjpF7EgslC/0tiLiNTajdaNN/q8c/5u/7Gz8w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "dev": true, + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/data-urls": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", + "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/decode-named-character-reference": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/default-browser": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.1.tgz", + "integrity": "sha512-m1pAzaJgZ/gssEqlOhJkPJp8Xly7QyW6xcrkUa2KKcDeDSEMP7X8xipU3snUcfisTQx0w1AGae+9UtJSfVnXGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz", + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/electron-to-chromium": { + "version": "1.5.474", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.474.tgz", + "integrity": "sha512-t1DE2RM6wtco58TQ47NcKw0CXw4fT3gWQvj49kkNBzMrUX3m9Sq/SoKcjEfwa9vvQ6sKYlqi/g05vG2tKLWH4w==", + "dev": true, + "license": "ISC" + }, + "node_modules/entities": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz", + "integrity": "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.1", + "@esbuild/android-arm": "0.28.1", + "@esbuild/android-arm64": "0.28.1", + "@esbuild/android-x64": "0.28.1", + "@esbuild/darwin-arm64": "0.28.1", + "@esbuild/darwin-x64": "0.28.1", + "@esbuild/freebsd-arm64": "0.28.1", + "@esbuild/freebsd-x64": "0.28.1", + "@esbuild/linux-arm": "0.28.1", + "@esbuild/linux-arm64": "0.28.1", + "@esbuild/linux-ia32": "0.28.1", + "@esbuild/linux-loong64": "0.28.1", + "@esbuild/linux-mips64el": "0.28.1", + "@esbuild/linux-ppc64": "0.28.1", + "@esbuild/linux-riscv64": "0.28.1", + "@esbuild/linux-s390x": "0.28.1", + "@esbuild/linux-x64": "0.28.1", + "@esbuild/netbsd-arm64": "0.28.1", + "@esbuild/netbsd-x64": "0.28.1", + "@esbuild/openbsd-arm64": "0.28.1", + "@esbuild/openbsd-x64": "0.28.1", + "@esbuild/openharmony-arm64": "0.28.1", + "@esbuild/sunos-x64": "0.28.1", + "@esbuild/win32-arm64": "0.28.1", + "@esbuild/win32-ia32": "0.28.1", + "@esbuild/win32-x64": "0.28.1" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.14.0.tgz", + "integrity": "sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.6", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.5.7.tgz", + "integrity": "sha512-XhJSzLljuYD4UjNuFGJu2v7aD3sqNVK12w5/DCUfrNfHWegZo2+TsavNx8MuxMwEquuFAzNbNfXKU0WoZ+YUIg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": "^9 || ^10" + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^6.1.23" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "17.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.14.0.tgz", + "integrity": "sha512-UtdkTVyAJePQv0J2M9Xe4L0ruNSDV314XiIJsADI2Zf40bcdAonE/D/OhAU8AT99oij9mhLByb+NvA3QWZYgCg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/hast-util-to-html": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.6.tgz", + "integrity": "sha512-1SZUxCN3TtJAE7e2BQN2MBHsoZ1gnmi9GoCP5Di59CSWptIezSAW09yDZyVbanb78V9eCwrKqdQsjtfVTxYHWA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.7.tgz", + "integrity": "sha512-F7DNV2NMcTxA4GqPVHnXzX+mpoPHAIY9rJAVH3CZ1FdBZOcBUEjUuvMkMpHVs/sicEtznh9tMGj5WUR9S4E2rg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-object": "^2.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/html-encoding-sniffer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", + "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.6.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inline-style-parser": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.9.tgz", + "integrity": "sha512-IttN8BqKLxzUrnTqHI+/hwAJQItBAUjdoHERCDv+oOuX48VP6bzW8+QjOXSfoevzq3YrYAwX1uLHp8TqO9yIeg==", + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-in-ssh": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-in-ssh/-/is-in-ssh-1.0.0.tgz", + "integrity": "sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-wsl": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz", + "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz", + "integrity": "sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^5.1.11", + "@asamuzakjp/dom-selector": "^7.1.1", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.3", + "@exodus/bytes": "^1.15.0", + "css-tree": "^3.2.1", + "data-urls": "^7.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^6.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.3.5", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^6.0.1", + "undici": "^7.25.0", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.1", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.4.tgz", + "integrity": "sha512-z4B5c6jrnJ1ltOQemhWYPBSAo6y42Z8Gt2yEgfgNTMcLSU59B8bfj8Z8AnAlJrBGLnqkdAUZ7jdDEqQw3KuipQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.1.0.tgz", + "integrity": "sha512-KRLgmPaP2H1ul2bpoJkOS+9pAcDAAj9Nu1mqLnh8NLeJG5tlvj42TH80PIGBpROWlRXLk0lDrWNuZCFy/tsB4A==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.1.tgz", + "integrity": "sha512-OuJHqvr455pwu2OaOrir7dbzqs4jlWKOtlu9L6GjcIjjQwNyw02VntQsr/Ek6/A13vgnXfUhBekWRUP1OkNivw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.1.tgz", + "integrity": "sha512-oXp1GIa+E9IwIs3a106+tr3Bz2MlTTBvlXjOZMoIat11kk7vjqgmBnksB9WHmWv+gZh7k3IUgpAHlwHB7DH4GQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.2.2.tgz", + "integrity": "sha512-ELNT5jYDUdx0B/hlUSSAiAEtvqkY3Oriwkp1KEYseF1Ccu4MnKkmE5yK3oE3WGT/Pq8VTE+XwP0GLL5pafY8yA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/micromark": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.3.tgz", + "integrity": "sha512-oGYfQzHSG5dOMovQcJ3fyTmZlWAWpi0XA0sJwJs+i6OT88o1+Jtw/8z0CmdowSLxGhhFK89rQ/oXph/wN02PNw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-edit-map": "^1.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.4.tgz", + "integrity": "sha512-wxEeE8v8XVvOrxn1TZj74qYhAtTQsSqufHVS3uNVyT1MupXxhyaHk8/9xDNPh9BmL77QNDgWTkZ3RsYHB2ry7w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.1.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-edit-map": "^1.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.3" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.2.tgz", + "integrity": "sha512-pRzm4kDTu0MjlmBkxmS9yYhw60nncfcEwu9NNdPFSQEFXS95ZKyIIyTSHu/o3ReBUrLKYEq+7YaXCRn/bPB4MA==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.1.0.tgz", + "integrity": "sha512-fS8hnLIjnjvdQIj39Geug8wWsR0HrYZ43KShKxNfwT7t2LOHo/LbWZEzEaSOjwtjdCsjoE6syHhonEzW0zv0+Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-edit-map": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-edit-map/-/micromark-util-edit-map-1.0.0.tgz", + "integrity": "sha512-Pa2ljlsEL6sVwFaYeyrOLSYbQt73JvGbPOYFq+9AElXiSnfI5Q4465RRZ1sHv7lDjDOnGRDDaqPXqClqWK/q1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.3.tgz", + "integrity": "sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.63", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.63.tgz", + "integrity": "sha512-6li2QanLsAXpIH2R6j77MzRyvOyrvdTqlKtO4CgBdHGNvN99ZZfyxszHc5o5+IZBWD5u6Hzwg83JoGXmqZNG9Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/oniguruma-parser": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", + "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", + "license": "MIT" + }, + "node_modules/oniguruma-to-es": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", + "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", + "license": "MIT", + "dependencies": { + "oniguruma-parser": "^0.12.2", + "regex": "^6.1.0", + "regex-recursion": "^6.0.2" + } + }, + "node_modules/open": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/open/-/open-11.0.0.tgz", + "integrity": "sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^5.4.0", + "define-lazy-prop": "^3.0.0", + "is-in-ssh": "^1.0.0", + "is-inside-container": "^1.0.0", + "powershell-utils": "^0.1.0", + "wsl-utils": "^0.3.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/parse5": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.0.tgz", + "integrity": "sha512-sq3qBFpee5jeocbFbO48VHlGr8sT7mbXS0vxlKN6sottBtJzrOG3998sr0llSZcQAGgfpdmEYAIZE0P9z0dE8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^9.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/powershell-utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.1.0.tgz", + "integrity": "sha512-dM0jVuXJPsDN6DvRpea484tCUaMiXWjuCn++HGTqUWzGDjv5tZkEZldAJ/UMlqRYGFrD/etByo4/xOuC/snX2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/property-information": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/react-markdown": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz", + "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz", + "integrity": "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==", + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-recursion": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz", + "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==", + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", + "license": "MIT" + }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rolldown": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz", + "integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.16", + "@rolldown/binding-android-arm64": "1.2.16", + "@rolldown/binding-darwin-arm64": "1.2.16", + "@rolldown/binding-darwin-x64": "1.2.16", + "@rolldown/binding-freebsd-x64": "1.2.16", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.16", + "@rolldown/binding-linux-arm64-gnu": "1.2.16", + "@rolldown/binding-linux-arm64-musl": "1.2.16", + "@rolldown/binding-linux-ppc64-gnu": "1.2.16", + "@rolldown/binding-linux-s390x-gnu": "1.2.16", + "@rolldown/binding-linux-x64-gnu": "1.2.16", + "@rolldown/binding-linux-x64-musl": "1.2.16", + "@rolldown/binding-openharmony-arm64": "1.2.16", + "@rolldown/binding-win32-arm64-msvc": "1.2.16", + "@rolldown/binding-win32-x64-msvc": "1.2.16" + } + }, + "node_modules/run-applescript": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz", + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.2.tgz", + "integrity": "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/shiki": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.6.0.tgz", + "integrity": "sha512-imjLsVHgPuWhvpU3P+zOekvMYqnel7QmKsFC4Sn0fCuAvaaalBsxwKEsrU8Ko5BdFnZA6Go/8a0RzahS634UgA==", + "license": "MIT", + "dependencies": { + "@shikijs/core": "4.6.0", + "@shikijs/engine-javascript": "4.6.0", + "@shikijs/engine-oniguruma": "4.6.0", + "@shikijs/langs": "4.6.0", + "@shikijs/themes": "4.6.0", + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", + "@types/hast": "^3.0.5" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/style-to-object": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-2.0.2.tgz", + "integrity": "sha512-QmbXPUylqU80HAgTOJeEOdbA40W9KtxmjMhQy+tq+b8F2aoh3aQLuy82hh2jm2qsC9hR9eI0+eQidTMydKcqRA==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.9" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyrainbow": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz", + "integrity": "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tldts": { + "version": "7.4.19", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.19.tgz", + "integrity": "sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.19" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.20", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.20.tgz", + "integrity": "sha512-C630TWXZCZmLq0F2bW4QqwnaaxCQ/svpAqvJwnC4JvgEM5ohhBnGsEzTLSOXcN+xjz+kEaHS5uoWIw2klnqd0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tsx": { + "version": "4.23.15", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.15.tgz", + "integrity": "sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.72.1.tgz", + "integrity": "sha512-3Li9FfPmQp45nxEtFD1ZCrYFI3cYK5kpyNtmm1H7lMagm8u9sy6PTjy3ytwQZs7KNukOyKFHAZ6z6GjYFeaeXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.72.1", + "@typescript-eslint/parser": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1", + "@typescript-eslint/utils": "8.72.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/undici": { + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz", + "integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", + "dev": true, + "license": "MIT" + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.2.0.tgz", + "integrity": "sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.1.0.tgz", + "integrity": "sha512-vKXxz6O38sKDj1mtx/k2cWvkkFBuYGx6uGrlzBkVeWCRF/F8sdI0j3Wbkz/5rVNRRuVc8UrgRdbCxNhmYXgP3w==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz", + "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz", + "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.30", + "rolldown": "~1.2.14", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.12.tgz", + "integrity": "sha512-5eWdz2yb3ajxWF3C8C4TjkXl7FGm3n2E/VlazALrQHzK7nYMSGFnCZto0bbPNl77AwkOZVLk0YnBAejUu0NiWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.12", + "@vitest/mocker": "4.1.12", + "@vitest/pretty-format": "4.1.12", + "@vitest/runner": "4.1.12", + "@vitest/snapshot": "4.1.12", + "@vitest/spy": "4.1.12", + "@vitest/utils": "4.1.12", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.12", + "@vitest/browser-preview": "4.1.12", + "@vitest/browser-webdriverio": "^4.1.11", + "@vitest/coverage-istanbul": "4.1.12", + "@vitest/coverage-v8": "4.1.12", + "@vitest/ui": "4.1.12", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", + "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.11.0", + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wsl-utils": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.3.1.tgz", + "integrity": "sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-wsl": "^3.1.0", + "powershell-utils": "^0.1.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/samples/CodeFlow/package.json b/samples/CodeFlow/package.json new file mode 100644 index 0000000..d98aa2d --- /dev/null +++ b/samples/CodeFlow/package.json @@ -0,0 +1,54 @@ +{ + "name": "codeflow-template", + "private": true, + "version": "0.1.0", + "license": "MIT", + "type": "module", + "engines": { + "node": ">=24.11.0" + }, + "scripts": { + "check-setup": "node scripts/check-setup.mjs", + "predev": "node scripts/check-setup.mjs", + "dev": "vite", + "prebuild": "node scripts/check-setup.mjs", + "build": "tsc -b && vite build", + "typecheck": "tsc -b", + "lint": "eslint .", + "test": "vitest run", + "test:watch": "vitest", + "storage:describe": "tsx scripts/storage-describe.ts", + "verify": "npm run lint && npm test && npm run build", + "preview": "vite preview" + }, + "dependencies": { + "@microsoft/cmr-apps": "^0.6.5", + "react": "^19.2.6", + "react-dom": "^19.2.6", + "react-markdown": "^10.1.0", + "remark-gfm": "^4.0.1", + "shiki": "^4.4.3", + "zod": "^4.6.7" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@microsoft/cmr-cli": "0.33.0", + "@microsoft/cmr-apps-vite-plugin": "^0.5.0", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", + "@types/node": "^24.12.3", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.1", + "eslint": "^10.3.0", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-plugin-react-refresh": "^0.5.2", + "globals": "^17.6.0", + "jsdom": "^29.1.1", + "tsx": "^4.23.15", + "typescript": "~6.0.2", + "typescript-eslint": "^8.59.2", + "vite": "^8.0.12", + "vitest": "^4.1.9" + } +} diff --git a/samples/CodeFlow/public/codeflow-logo.png b/samples/CodeFlow/public/codeflow-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b60434902bdd9b965cfadaa91456d2a436502c38 GIT binary patch literal 3730 zcmeHKZ9G)l9^PZJi6KQ8jz+mBb!fbd=!LoQx2Wj<+y_yvs0XhMC!S@9F&Rm;1Y4@25WO-(J7}ex9}d>%Z38&$F%` z_<4_pnt>Vs02*$4T@C>N3T~nRRSe|SI0&eH&1AwNBn~U?| zn7rw}fs8y)Bi=0Q6EAJfz1FO7YJ2Wq^Y^qUEtKH(n^9a+(gQb~WPKXyPe=0QmhB!t zuB|fPZD9#+%HF6SW~~3`fyBMXDzz?!Ke~Qfb>E|lH6zXV>Elt$A<-lDgn=(vdCL@{ z$bosMlSpXw@YHbl*z%XM_9LT>uAl{)e%a!ix!%Neqm<-TJ$E9h9@fis{_ zeyu$tf*?7P-zI;uJ5n??f^B)`6X&>9?&Vl6nbdx{xIjF^$`EX2+SJttku#bwl~u`I z4&Co7+t#4c<>IF z_e4e(xyRMB!ZY{t9z1hE3;g@l@sa1={8C`hOMZOZp*wV7>HXnu3&*B8c+YSvEVaKvLU?h-J)B`P0j1BpviW$)gR*l zlaJ4Iq=%7wB^tPeZP1%Aj#k<3ohc7Z@O0C@0zu zBhP~30XDtFq_8gFTCG=$Q^z&wn>bm=Qbf^4qmbxe?w;u_>$Dh{v&|f{khnWdj~_@2 zTE9=|pdIiE^bZEPC?>c5X)c=;;)`KkUzOqtE(UR2WxcF$k6UkXz23eZqlLTtuO%(u zOsekJ&}$@Fp9k0YN$i-eU?M&RtG6>+lOp1U8&M@#`^G(KjWD+}x-JdfCzTD@vV^C{ z^_n)IgPa(rgv=xv+0t(!;^6Yi{I@*J!!qo!*#)!2tEJ^Nk?D-Ms(A+a8j5f?i=tH? z?aDSE_7E%AK9l62(tZN*6BM(j64OIsqTkFGi2k&J!<2W@Uzmr8NcCoTL8=30-KT_=AE+uk9dsqZ8?^s!WXrOz^J+RTaGi<424oH%S&!3cgC7bK+FjQMJ3! zm2+GQ+8X_AC_jlIxcr(Z$KewKkc@1^N_z#2H=FOU`6blRsAP)B3T>U`{Aw`z2@nwT zWPW8?0}cC5sAhb+^G9gLB;MATU`)VPKD5&nGgablChqbIoQ`MehKy zKAiBP^;qQb8>H$N;;W@FKgTEv#M5g;dbH|GtzaM+Xqh5B@aa%Yg;eobxC>fwmnAX< z)`@F{2c6yof)<~YVro#PT(}y>8aq=;EvPE|UGxkA84Sduv$-l&faZ1LYDFOuQ7+RZ zKJDuj^Rv!QVl4e}hI`c}vbeYWe3S@R(dEk?u=XZ7a&E8t35=fVI}u;MnWlZ|nc!+j zV;DDi^7d%OQwdAuD6P}s#SNw4xiioreK5ClxO!G{TPbIq4{FTLZY}dX5tV10SCkm- zJ-grQLTGH{PGw7nN+mC->w}Jyhn}1VE#xdSNr0&;2n|7T%`y^<*Oz8MlU83GmBW+$ zg^uzP-bYA>v*vd`RqAIbbW|>N*(An6ouHJ2GGDC*cTtXlJOKAg$g0BQfDbgfL=EkNM$~DOkPlR%u{;ou3YRe_q4JYZ zE*^j@7cwNb^92+c%EGDvq=0G50~b+>Oun$YmEd{cpr&(3AOkw}0zvSgr``xb`7%fyqH>IH2_w zVn2Coa}u9*3UV5;4nMdYfr|H9a#3imSUHoca)S|oI@ahP)Mt|0QZ#qXLdAxE2^s&sAdr8re=JO%i275g|8<-!SU20q%9%S} zWE0mbgy#h6e#@3U>YVAbzI^hwW<$=#K+t9pTdDJ^0b1U99FVQK5?3~VRiU4jYJ3UQ zD@_3BcdS}NG|a^6L)e_LiB}~$9D6j;Ea8Geia8i=?N*O$Kk*Hvv23Syfamwt zx_#0J<#$zu(v?qPITfNCIg!0~7RP`OXUiK+_Y-IsW5h^s3WYy!^(=;c!sExc_X_g= zwi9N4Kv@JOvYp&o@ho0#W==8hwEeImf0^qi#-a{;ZpB7Y$F+ly3f(ZHofEfh4wYLt zD#NDpYmw68LHy-TlB5L6=1CKjg7z`(kyYGcnu3MR-^5RvxVn_KN$GvYq=c!)XJve4!zt%H}~ zxW*vthoh|GxqvmiXAH8PsbNti(tamfsBO*Ic#qU)w%y{UE7(j+50&5FmE~rKxhTSI zN$RS~vRGM$>ZYC92NH>|K-fg@?$^QUJf z7#BQdPv4dDOLyCUHSwlHYqJj*L^aD&4*bGMZP<{qIuDgS(^y{c@{z$fvb=KzS1Q|r zB}oBkd%=U$>4CbLi(x|_#^5W)9gVCR(h+-qU93$6_yE3Mh#WhL${d1Rat>Pn|H`Ap~?eXdt^y<_lw?4fd!02M{*HSVm4z2MI&iA7W zznnBl*T^_0?r|wec$v{NPL4@4Q$1UM{)a%lg;yCTzXXzcZ^rMi;FXb)BbLjCIDNzk zfpmDVD$J0cAhYz?mPu7TxRiFPyM?nrvHUKF`6eND_h?K}>hiPR$>($Cc9CJws#M)s W)2UPA>hL8KaC80H + + + + + + diff --git a/samples/CodeFlow/public/favicon.svg b/samples/CodeFlow/public/favicon.svg new file mode 100644 index 0000000..8a63f46 --- /dev/null +++ b/samples/CodeFlow/public/favicon.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/samples/CodeFlow/scripts/__tests__/codeFontStyles.test.mjs b/samples/CodeFlow/scripts/__tests__/codeFontStyles.test.mjs new file mode 100644 index 0000000..431e15c --- /dev/null +++ b/samples/CodeFlow/scripts/__tests__/codeFontStyles.test.mjs @@ -0,0 +1,37 @@ +import { describe, expect, it } from 'vitest'; +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; +import { JSDOM } from 'jsdom'; + +const css = readFileSync(resolve(process.cwd(), 'src', 'App.css'), 'utf8'); + +describe('code surface styles', () => { + it('wires both diff layouts, snippets, suggestions, search and preview to the preferences', () => { + const dom = new JSDOM(` +
+
+
+
+ +

+      
+    `);
+    try {
+      const { document, getComputedStyle } = dom.window;
+      const surfaces = document.querySelectorAll(
+        '.diff__table, .markdown-body code, .suggestion-block__diff, .results__hit, .set__code-preview',
+      );
+      expect(surfaces).toHaveLength(7);
+      for (const surface of surfaces) {
+        const style = getComputedStyle(surface);
+        expect(style.fontFamily).toContain('var(--code-font-family,');
+        expect(style.fontVariantLigatures).toBe('var(--code-font-ligatures, normal)');
+        expect(style.fontFeatureSettings).toBe('var(--code-font-features, normal)');
+      }
+      expect(getComputedStyle(document.querySelector('.diff__filename')).fontFamily)
+        .toBe('var(--mono)');
+    } finally {
+      dom.window.close();
+    }
+  });
+});
diff --git a/samples/CodeFlow/scripts/__tests__/contrast.test.mjs b/samples/CodeFlow/scripts/__tests__/contrast.test.mjs
new file mode 100644
index 0000000..ff7fa3d
--- /dev/null
+++ b/samples/CodeFlow/scripts/__tests__/contrast.test.mjs
@@ -0,0 +1,221 @@
+import { describe, expect, it } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import {
+  auditPalette,
+  composite,
+  contrastRatio,
+  flatten,
+  parseColor,
+  parseThemeTokens,
+  ratio,
+  relativeLuminance,
+  tokenColor,
+} from '../contrastCore.mjs';
+
+const css = readFileSync(resolve(process.cwd(), 'src/App.css'), 'utf8');
+const themes = parseThemeTokens(css);
+
+describe('parseColor', () => {
+  it('reads 6- and 3-digit hex', () => {
+    expect(parseColor('#ffffff')).toEqual({ r: 255, g: 255, b: 255, a: 1 });
+    expect(parseColor('#000')).toEqual({ r: 0, g: 0, b: 0, a: 1 });
+  });
+
+  it('reads rgb() and rgba() including fractional alpha', () => {
+    expect(parseColor('rgb(1, 2, 3)')).toEqual({ r: 1, g: 2, b: 3, a: 1 });
+    expect(parseColor('rgba(255, 255, 255, 0.09)')).toEqual({ r: 255, g: 255, b: 255, a: 0.09 });
+  });
+
+  it('returns null for values that are not colours', () => {
+    expect(parseColor('var(--text)')).toBeNull();
+    expect(parseColor('none')).toBeNull();
+  });
+});
+
+describe('relativeLuminance and contrastRatio', () => {
+  it('anchors on the WCAG reference values', () => {
+    expect(relativeLuminance({ r: 255, g: 255, b: 255 })).toBeCloseTo(1, 5);
+    expect(relativeLuminance({ r: 0, g: 0, b: 0 })).toBeCloseTo(0, 5);
+    expect(contrastRatio({ r: 255, g: 255, b: 255 }, { r: 0, g: 0, b: 0 })).toBeCloseTo(21, 5);
+  });
+
+  it('is symmetric, so argument order cannot change a verdict', () => {
+    const a = parseColor('#1b2027');
+    const b = parseColor('#adbac7');
+    expect(ratio(a, b)).toBe(ratio(b, a));
+  });
+
+  it('reports 1 for a colour against itself', () => {
+    expect(ratio(parseColor('#57ab5a'), parseColor('#57ab5a'))).toBe(1);
+  });
+});
+
+describe('composite', () => {
+  it('leaves the backdrop untouched at zero alpha', () => {
+    const backdrop = parseColor('#1b2027');
+    expect(composite(parseColor('rgba(255,255,255,0)'), backdrop)).toMatchObject({ r: 27, g: 32, b: 39 });
+  });
+
+  it('replaces the backdrop at full alpha', () => {
+    const out = composite(parseColor('#ffffff'), parseColor('#1b2027'));
+    expect(out).toMatchObject({ r: 255, g: 255, b: 255 });
+  });
+
+  it('blends layers in paint order, so stacking is not commutative', () => {
+    const base = parseColor('#000000');
+    const green = parseColor('rgba(0,255,0,0.5)');
+    const red = parseColor('rgba(255,0,0,0.5)');
+    expect(flatten(base, green, red)).not.toEqual(flatten(base, red, green));
+  });
+});
+
+describe('parseThemeTokens', () => {
+  it('finds every theme the app can render', () => {
+    expect([...themes.keys()].sort()).toEqual(['dark', 'dogfood', 'light']);
+  });
+
+  it('gives all themes the same colour vocabulary, so no theme silently inherits', () => {
+    // Compared on colour tokens only: the dark block doubles as `:root`, so it
+    // also carries non-colour tokens (fonts, shadows) the others do not repeat.
+    const colourNames = (theme) =>
+      [...themes.get(theme).entries()]
+        .filter(([, value]) => parseColor(value) !== null)
+        .map(([name]) => name)
+        .sort();
+    const dark = colourNames('dark');
+    for (const name of ['light', 'dogfood']) {
+      expect(colourNames(name), `${name} token set`).toEqual(dark);
+    }
+  });
+
+  it('throws a useful error rather than skipping an unknown token', () => {
+    expect(() => tokenColor(themes.get('dark'), '--not-a-token')).toThrow(/missing token/);
+  });
+});
+
+// The dogfood easter egg is deliberately garish and is exempt by design.
+describe.each(['dark', 'light'])('%s palette', (theme) => {
+  const results = auditPalette(themes.get(theme));
+
+  it('renders every foreground/background pair at its WCAG minimum', () => {
+    const failures = results
+      .filter((r) => !r.pass)
+      .map((r) => `${r.label}: ${r.ratio}:1 (needs ${r.min}:1)`);
+    expect(failures).toEqual([]);
+  });
+
+  it('audits a meaningful number of pairs', () => {
+    expect(results.length).toBeGreaterThan(60);
+  });
+
+  it('keeps body text below the halation threshold that caused eye strain', () => {
+    // Contrast this far above AAA makes glyph edges bloom on a dark field. The
+    // ceiling only applies to dark themes: dark-on-light does not halate, so
+    // the light palette is deliberately allowed to sit at its natural ~15:1.
+    //
+    // It is checked against *every* surface that carries body text, not just
+    // --bg: a recessed well like --input-bg is darker than the canvas, so it
+    // is the first place halation reappears when --text is brightened.
+    const tokens = themes.get(theme);
+    const text = tokenColor(tokens, '--text');
+    const surfaces = ['--bg', '--bg-2', '--bg-3', '--panel', '--panel-2', '--input-bg', '--page-grad'];
+    const isDark = relativeLuminance(tokenColor(tokens, '--bg')) < 0.5;
+
+    expect(ratio(text, tokenColor(tokens, '--bg'))).toBeGreaterThanOrEqual(7);
+    if (!isDark) return;
+
+    const halating = surfaces
+      .map((s) => [s, ratio(text, tokenColor(tokens, s))])
+      .filter(([, r]) => r > 10)
+      .map(([s, r]) => `${s}: ${r}:1`);
+    expect(halating).toEqual([]);
+  });
+});
+
+describe('App.css', () => {
+  /** Every `selector { ... }` block, ignoring at-rule preludes. */
+  const rules = [...css.matchAll(/([^{}]+)\{([^{}]*)\}/g)].map(([, selector, body]) => ({
+    selector: selector.trim().split('\n').pop().trim(),
+    body,
+  }));
+
+  it('defines colours only in the theme blocks, so the audit sees the whole palette', () => {
+    // Everything after the last theme block must reach for a var(); a literal
+    // colour here would be invisible to auditPalette().
+    const start = css.indexOf('/* ----------------------------- Focus');
+    expect(start, 'the Focus section marker moved — this test is slicing nothing').toBeGreaterThan(0);
+    const hardCoded = css.slice(start).match(/(? {
+    // The --st-* tones are tuned to be readable *as text*; their -fill twins are
+    // the only ones dark enough to sit under white. Mixing them up is the exact
+    // regression this pair of token families exists to prevent.
+    const statusRules = css.match(/\.thread__status--\w+\s*\{[^}]*\}/g) ?? [];
+    expect(statusRules.length).toBeGreaterThan(0);
+    for (const rule of statusRules) {
+      if (!/--on-emphasis/.test(rule)) continue;
+      expect(rule, rule).toMatch(/background:\s*var\(--st-\w+-fill\)/);
+    }
+  });
+
+  it('gives keyboard users a focus ring on every interactive element', () => {
+    expect(css).toMatch(/:where\([^)]*button[^)]*\):focus-visible\s*\{[^}]*outline:/);
+  });
+
+  it('keeps the add-comment chip out of the code you select', () => {
+    // In split view the chip has to live inside the code cell, so without this
+    // its `+` joins the line: select and copy a row and you get `+const foo…`,
+    // and a drag from the start of a line grabs the plus before the code.
+    const rule = rules.find((r) => r.selector === '.diff__addcomment');
+    expect(rule, 'the .diff__addcomment rule moved').toBeTruthy();
+    expect(rule.body).toMatch(/user-select:\s*none/);
+  });
+
+  it('only suppresses a focus outline where a wrapper draws one instead', () => {
+    // A bare `outline: none` on :focus is the classic WCAG 2.4.7 failure. The
+    // few opt-outs left are inputs whose wrapper carries the ring, so they are
+    // written as :focus-visible and must stay that way.
+    const suppressors = rules.filter((r) => /outline:\s*none/.test(r.body));
+    expect(suppressors.length).toBeGreaterThan(0);
+    for (const rule of suppressors) {
+      expect(rule.selector, rule.selector).toMatch(/:focus-visible$/);
+    }
+    for (const rule of suppressors) {
+      const base = rule.selector.replace(/:focus-visible$/, '');
+      // The ring lives on an ancestor block: `.md-editor__textarea` is wrapped
+      // by `.md-editor`, `.diff__search-input` by `.diff__search-field`.
+      const candidates = [base.replace(/__[\w-]+$/, ''), base.replace(/-[\w]+$/, '')];
+      const ringed = candidates.some((prefix) =>
+        new RegExp(`${prefix.replace(/\./g, '\\.')}[\\w-]*:has\\([^)]*:focus-visible\\)`).test(css),
+      );
+      expect(ringed, `${base} suppresses its outline but no wrapper draws one`).toBe(true);
+    }
+  });
+
+  it('keeps every font-size at or above an 11px floor', () => {
+    const sizes = [...css.matchAll(/font-size:\s*(\d+)px/g)].map(([, px]) => Number(px));
+    expect(sizes.length).toBeGreaterThan(50);
+    expect(Math.min(...sizes)).toBeGreaterThanOrEqual(11);
+  });
+
+  it('gives icon-only buttons a 24px target', () => {
+    for (const selector of ['.iconbtn', '.copy-link-btn']) {
+      const rule = rules.find((r) => r.selector === selector);
+      expect(rule, selector).toBeDefined();
+      expect(rule.body, selector).toMatch(/min-width:\s*24px/);
+      expect(rule.body, selector).toMatch(/min-height:\s*24px/);
+    }
+  });
+
+  it('grows the inline add-comment button past its visual size', () => {
+    // It sits inside a diff row, so it cannot get bigger without shifting the
+    // code; the transparent ::before is what makes the target 24px.
+    const rule = rules.find((r) => r.selector === '.diff__addcomment::before');
+    expect(rule).toBeDefined();
+    expect(rule.body).toMatch(/width:\s*24px/);
+    expect(rule.body).toMatch(/height:\s*24px/);
+  });
+});
diff --git a/samples/CodeFlow/scripts/check-setup.mjs b/samples/CodeFlow/scripts/check-setup.mjs
new file mode 100644
index 0000000..d47aefd
--- /dev/null
+++ b/samples/CodeFlow/scripts/check-setup.mjs
@@ -0,0 +1,96 @@
+#!/usr/bin/env node
+// Verifies this copy of the sample has been set up before `npm run dev` / `npm run build`:
+//   1. ms.config.json exists (created by `npx ms app init`) with an appId and environmentId.
+//   2. The GitHub connector has been added, so generated/ exports `GitHubService`
+//      with every operation src/connectors/github.ts uses.
+// Prints the setup steps and exits 1 when something is missing. Usage: npm run check-setup
+import { existsSync, readFileSync, readdirSync } from 'node:fs';
+import { join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const root = fileURLToPath(new URL('..', import.meta.url));
+const SKILL = '.github/skills/setup-codeflow/SKILL.md';
+
+const SETUP_STEPS = [
+  'npx ms auth login',
+  'npx ms app init --display-name "CodeFlow" --icon-path ./public/codeflow-logo.png   (optional: --environment-id )',
+  'npx ms app set-setting --show-header false',
+  'npx ms app add data-source --connector shared_github --as action',
+  'cp .env.example .env.local   (optional; adjust values)',
+  'npm run check-setup',
+  'npm run dev   (or: npx ms app dev)',
+];
+
+/** Connector operations the adapter (src/connectors/github.ts) calls. */
+const REQUIRED_OPERATIONS = [
+  'GetUser',
+  'GetPullRequest',
+  'GetPullRequests',
+  'MergePullRequest',
+  'SearchIssues',
+  'CompareRepositoryCommits',
+  'ListCollaborators',
+  'checkCollaborator',
+  'CreateReference',
+  'CreatePullRequest',
+  'SearchGithubWithQuery',
+];
+// SearchGithubWithQuery carries every GraphQL query and mutation the app sends (comments,
+// reviews, files, branches, cherry-pick commits).
+
+const problems = [];
+
+// 1. ms.config.json, created by `npx ms app init`
+const configPath = join(root, 'ms.config.json');
+if (!existsSync(configPath)) {
+  problems.push('ms.config.json is missing. Create the app with `npx ms app init` (step 2 below).');
+} else {
+  let config;
+  try {
+    config = JSON.parse(readFileSync(configPath, 'utf8'));
+  } catch {
+    problems.push('ms.config.json is not valid JSON. Re-run `npx ms app init`.');
+  }
+  if (config) {
+    const missing = ['appId', 'environmentId'].filter((key) => typeof config[key] !== 'string' || !config[key].trim());
+    if (missing.length) {
+      problems.push(`ms.config.json has no ${missing.join(' or ')}. Re-run \`npx ms app init\`.`);
+    }
+  }
+}
+
+// 2. GitHub connector codegen
+const generatedDir = join(root, 'generated');
+const indexPath = join(generatedDir, 'index.ts');
+const servicesDir = join(generatedDir, 'services');
+const serviceFile = existsSync(servicesDir)
+  ? readdirSync(servicesDir).map((name) => join(servicesDir, name)).find((file) => /export class GitHubService\b/.test(readFileSync(file, 'utf8')))
+  : undefined;
+
+if (!existsSync(indexPath) || !serviceFile) {
+  problems.push('The GitHub connector has not been added (generated/ does not export GitHubService). Run step 4 below.');
+} else {
+  const index = readFileSync(indexPath, 'utf8');
+  if (!/GitHubService/.test(index) && !/export \* from '\.\/services\//.test(index)) {
+    problems.push('generated/index.ts does not export GitHubService. Re-run the connector command (step 4) to regenerate it.');
+  }
+  const source = readFileSync(serviceFile, 'utf8');
+  const missing = REQUIRED_OPERATIONS.filter((op) => !new RegExp(`static async ${op}\\(`).test(source));
+  if (missing.length) {
+    problems.push(
+      `GitHubService is missing operations this app uses: ${missing.join(', ')}. ` +
+        'Re-add the connector (step 4) or adapt src/connectors/github.ts.',
+    );
+  }
+}
+
+if (problems.length) {
+  console.error('\nCodeFlow setup is incomplete:\n');
+  for (const problem of problems) console.error(` - ${problem}`);
+  console.error('\nSetup steps (run from this folder):\n');
+  SETUP_STEPS.forEach((step, i) => console.error(`  ${i + 1}. ${step}`));
+  console.error(`\nDetails: README.md ("Setup") or the setup skill in ${SKILL}.\n`);
+  process.exit(1);
+}
+
+console.log('CodeFlow setup looks complete.');
diff --git a/samples/CodeFlow/scripts/contrastCore.mjs b/samples/CodeFlow/scripts/contrastCore.mjs
new file mode 100644
index 0000000..84b338f
--- /dev/null
+++ b/samples/CodeFlow/scripts/contrastCore.mjs
@@ -0,0 +1,335 @@
+/**
+ * Colour maths for the palette accessibility check.
+ *
+ * `App.css` paints every surface from a design token, and the tokens are the
+ * only place a colour is written down. That means the whole palette can be
+ * audited by reading the stylesheet: parse the `:root[data-theme=…]` blocks,
+ * composite any translucent token over the surface it actually sits on, and
+ * measure the WCAG contrast ratio of the pairs the UI really renders.
+ *
+ * Everything here is pure so `scripts/__tests__/contrast.test.mjs` can hold the
+ * palette to a contrast floor on every build.
+ */
+
+/** Named CSS colours the stylesheet actually uses. Not a full CSS colour table. */
+const NAMED = {
+  transparent: { r: 0, g: 0, b: 0, a: 0 },
+  white: { r: 255, g: 255, b: 255, a: 1 },
+  black: { r: 0, g: 0, b: 0, a: 1 },
+};
+
+/**
+ * Parse a hex / rgb() / rgba() / named colour into channels plus alpha.
+ *
+ * Returns `null` for anything that is not a colour (gradients, lengths, font
+ * stacks), so callers can filter a token block down to just its colours.
+ */
+export function parseColor(input) {
+  if (typeof input !== 'string') return null;
+  const value = input.trim().toLowerCase();
+
+  if (Object.prototype.hasOwnProperty.call(NAMED, value)) return { ...NAMED[value] };
+
+  const hex = /^#([0-9a-f]{3,8})$/.exec(value);
+  if (hex) {
+    const digits = hex[1];
+    // #rgb and #rgba are shorthand for doubled digits.
+    const expand = (s) => s.split('').map((c) => c + c).join('');
+    const full =
+      digits.length === 3 || digits.length === 4 ? expand(digits) : digits;
+    if (full.length !== 6 && full.length !== 8) return null;
+    const int = (i) => parseInt(full.slice(i, i + 2), 16);
+    return {
+      r: int(0),
+      g: int(2),
+      b: int(4),
+      a: full.length === 8 ? int(6) / 255 : 1,
+    };
+  }
+
+  const fn = /^rgba?\(([^)]+)\)$/.exec(value);
+  if (fn) {
+    const parts = fn[1].split(/[\s,/]+/).filter(Boolean);
+    if (parts.length < 3) return null;
+    const chan = (raw) => {
+      const n = raw.endsWith('%') ? (parseFloat(raw) / 100) * 255 : parseFloat(raw);
+      return Number.isFinite(n) ? Math.min(255, Math.max(0, n)) : null;
+    };
+    const [r, g, b] = [chan(parts[0]), chan(parts[1]), chan(parts[2])];
+    if (r === null || g === null || b === null) return null;
+    let a = 1;
+    if (parts.length > 3) {
+      const raw = parts[3];
+      const n = raw.endsWith('%') ? parseFloat(raw) / 100 : parseFloat(raw);
+      a = Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 1;
+    }
+    return { r, g, b, a };
+  }
+
+  return null;
+}
+
+/**
+ * Composite a (possibly translucent) colour over an opaque backdrop.
+ *
+ * Diff rows, find-in-file matches and status pills are all translucent washes
+ * layered over a surface, so the colour a reviewer actually sees — and the one
+ * that has to pass contrast — only exists after this step.
+ */
+export function composite(fg, bg) {
+  const a = fg.a ?? 1;
+  return {
+    r: fg.r * a + bg.r * (1 - a),
+    g: fg.g * a + bg.g * (1 - a),
+    b: fg.b * a + bg.b * (1 - a),
+    a: 1,
+  };
+}
+
+/** Stack several translucent layers bottom-up onto an opaque base. */
+export function flatten(base, ...layers) {
+  return layers.reduce((acc, layer) => composite(layer, acc), { ...base, a: 1 });
+}
+
+/** WCAG 2.x relative luminance. */
+export function relativeLuminance({ r, g, b }) {
+  const lin = (c) => {
+    const s = c / 255;
+    return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
+  };
+  return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
+}
+
+/** WCAG 2.x contrast ratio between two opaque colours, 1–21. */
+export function contrastRatio(a, b) {
+  const la = relativeLuminance(a);
+  const lb = relativeLuminance(b);
+  const [hi, lo] = la >= lb ? [la, lb] : [lb, la];
+  return (hi + 0.05) / (lo + 0.05);
+}
+
+/** Round to 2dp for stable, readable assertion messages. */
+export function ratio(a, b) {
+  return Math.round(contrastRatio(a, b) * 100) / 100;
+}
+
+/**
+ * Pull the design tokens out of a stylesheet, keyed by `data-theme` value.
+ *
+ * The bare `:root` selector is treated as `dark`, matching the stylesheet's own
+ * `:root, :root[data-theme='dark']` pairing.
+ */
+export function parseThemeTokens(css) {
+  const themes = new Map();
+  // Match each top-level `:root…{ … }` rule. Token blocks contain no nested
+  // braces, so a non-greedy run up to the first `}` is exact here.
+  const blockRe = /(:root[^{]*)\{([^}]*)\}/g;
+  let match;
+
+  while ((match = blockRe.exec(css)) !== null) {
+    const [, selector, body] = match;
+    if (!body.includes('--')) continue;
+
+    const names = new Set();
+    for (const part of selector.split(',')) {
+      const themed = /\[data-theme=['"]?([\w-]+)['"]?\]/.exec(part);
+      if (themed) names.add(themed[1]);
+      else if (part.trim() === ':root') names.add('dark');
+    }
+    if (names.size === 0) continue;
+
+    const declRe = /(--[\w-]+)\s*:\s*([^;]+);/g;
+    let decl;
+    const parsed = [];
+    while ((decl = declRe.exec(body)) !== null) {
+      parsed.push([decl[1], decl[2].trim()]);
+    }
+
+    for (const name of names) {
+      const existing = themes.get(name) ?? new Map();
+      for (const [token, value] of parsed) existing.set(token, value);
+      themes.set(name, existing);
+    }
+  }
+
+  return themes;
+}
+
+/**
+ * Read a token as a colour, throwing when it is missing or unparseable.
+ *
+ * A typo in a token name would otherwise silently skip a contrast assertion,
+ * which is exactly the failure mode this check exists to prevent.
+ */
+export function tokenColor(tokens, name) {
+  if (!tokens.has(name)) throw new Error(`missing token ${name}`);
+  const raw = tokens.get(name);
+  const parsed = parseColor(raw);
+  if (!parsed) throw new Error(`token ${name} is not a colour: ${raw}`);
+  return parsed;
+}
+
+/**
+ * WCAG 2.1 minimums, as used by the audit below.
+ *
+ * `TEXT` is 1.4.3 Contrast (Minimum) for body-sized copy. `UI` is 1.4.11
+ * Non-text Contrast, which covers control boundaries and other graphics a
+ * reviewer has to perceive to operate the app. The stylesheet has no text at
+ * WCAG's "large" size (18.66px bold / 24px), so there is no large-text tier —
+ * the 10–11px labels are firmly in the `TEXT` bucket.
+ */
+export const WCAG = { TEXT: 4.5, UI: 3 };
+
+/**
+ * Every foreground/background pair the UI actually paints, with the surface
+ * each one is composited over.
+ *
+ * The list is written against `App.css` rule by rule, so a pair here means "the
+ * app really renders this combination". Translucent tokens are layered in the
+ * same order the browser paints them, including the three-deep case of a
+ * find-in-file match sitting on top of a diff row.
+ */
+export function auditPalette(tokens) {
+  const c = (name) => tokenColor(tokens, name);
+  const results = [];
+  const check = (label, fg, bg, min) =>
+    results.push({ label, ratio: ratio(fg, bg), min, pass: ratio(fg, bg) >= min });
+
+  const bg = c('--bg');
+  const panel = c('--panel');
+  const panel2 = c('--panel-2');
+  const surfaces = [
+    ['bg', bg],
+    ['bg-2', c('--bg-2')],
+    ['bg-3', c('--bg-3')],
+    ['panel', panel],
+    ['panel-2', panel2],
+    ['hover', c('--hover')],
+    ['input-bg', c('--input-bg')],
+  ];
+
+  // Body copy and muted labels have to hold up on every surface they land on.
+  for (const [name, surface] of surfaces) {
+    check(`--text on --${name}`, c('--text'), surface, WCAG.TEXT);
+    check(`--text-dim on --${name}`, c('--text-dim'), surface, WCAG.TEXT);
+    check(`--text-bright on --${name}`, c('--text-bright'), surface, WCAG.TEXT);
+  }
+
+  // Diff rows: the reviewer's complaint lives here — code on a green or red wash.
+  const addRow = flatten(bg, c('--diff-add-bg'));
+  const delRow = flatten(bg, c('--diff-del-bg'));
+  check('--text on an added line', c('--text'), addRow, WCAG.TEXT);
+  check('--text on a removed line', c('--text'), delRow, WCAG.TEXT);
+  check('--text-dim on an added line', c('--text-dim'), addRow, WCAG.TEXT);
+  check('--text-dim on a removed line', c('--text-dim'), delRow, WCAG.TEXT);
+  check('--add marker on an added line', c('--add'), addRow, WCAG.TEXT);
+  check('--del marker on a removed line', c('--del'), delRow, WCAG.TEXT);
+  check(
+    '--diff-add-gutter-fg on the added gutter',
+    c('--diff-add-gutter-fg'),
+    flatten(panel2, c('--diff-add-gutter-bg')),
+    WCAG.TEXT,
+  );
+  check(
+    '--diff-del-gutter-fg on the removed gutter',
+    c('--diff-del-gutter-fg'),
+    flatten(panel2, c('--diff-del-gutter-bg')),
+    WCAG.TEXT,
+  );
+  check('--diff-lineno on --panel-2', c('--diff-lineno'), panel2, WCAG.TEXT);
+  check('--diff-lineno on --diff-empty-bg', c('--diff-lineno'), c('--diff-empty-bg'), WCAG.TEXT);
+  check('--text on a suggested addition', c('--text'), flatten(panel, c('--suggest-add-bg')), WCAG.TEXT);
+  check('--text on a suggested removal', c('--text'), flatten(panel, c('--suggest-del-bg')), WCAG.TEXT);
+
+  // Find-in-file, including a hit that lands inside a diff row.
+  check('--text on a find match', c('--text'), flatten(bg, c('--match-bg')), WCAG.TEXT);
+  check(
+    '--text on a find match over an added line',
+    c('--text'),
+    flatten(bg, c('--diff-add-bg'), c('--match-bg')),
+    WCAG.TEXT,
+  );
+  check(
+    '--text on a find match over a removed line',
+    c('--text'),
+    flatten(bg, c('--diff-del-bg'), c('--match-bg')),
+    WCAG.TEXT,
+  );
+  check(
+    '--match-active-fg on --match-active-bg',
+    c('--match-active-fg'),
+    c('--match-active-bg'),
+    WCAG.TEXT,
+  );
+
+  // Occurrence highlights for the selected word, which stack on diff rows the
+  // same way find hits do.
+  check('--text on a selection match', c('--text'), flatten(bg, c('--selmatch-bg')), WCAG.TEXT);
+  check(
+    '--text on a selection match over an added line',
+    c('--text'),
+    flatten(bg, c('--diff-add-bg'), c('--selmatch-bg')),
+    WCAG.TEXT,
+  );
+  check(
+    '--text on a selection match over a removed line',
+    c('--text'),
+    flatten(bg, c('--diff-del-bg'), c('--selmatch-bg')),
+    WCAG.TEXT,
+  );
+
+  // Anything that carries white `--on-emphasis` text has to stay dark enough.
+  for (const fill of [
+    '--success',
+    '--success-hover',
+    '--danger',
+    '--danger-hover',
+    '--warn',
+    '--warn-hover',
+    '--merged',
+    '--draft',
+    '--accent-fill',
+    '--st-active-fill',
+    '--st-pending-fill',
+    '--st-resolved-fill',
+    '--st-wontfix-fill',
+    '--st-closed-fill',
+  ]) {
+    check(`--on-emphasis on ${fill}`, c('--on-emphasis'), c(fill), WCAG.TEXT);
+  }
+
+  // Semantic tones used as text rather than as a fill.
+  for (const tone of ['--accent', '--add', '--del', '--green', '--st-rejected']) {
+    check(`${tone} as text on --bg`, c(tone), bg, WCAG.TEXT);
+    check(`${tone} as text on --panel`, c(tone), panel, WCAG.TEXT);
+  }
+  check('--st-active as text on --accent-bg', c('--st-active'), flatten(panel, c('--accent-bg')), WCAG.TEXT);
+  check('--danger-fg on --danger-surface over --bg', c('--danger-fg'), flatten(bg, c('--danger-surface')), WCAG.TEXT);
+  check('--danger-fg on --danger-surface over --panel', c('--danger-fg'), flatten(panel, c('--danger-surface')), WCAG.TEXT);
+
+  // File-status squares and gutter badges: small, tinted, easy to get wrong.
+  check('--fstat-mod-fg on --fstat-mod-bg', c('--fstat-mod-fg'), flatten(panel, c('--fstat-mod-bg')), WCAG.TEXT);
+  check('--add on --fstat-add-bg', c('--add'), flatten(panel, c('--fstat-add-bg')), WCAG.TEXT);
+  check('--del on --fstat-del-bg', c('--del'), flatten(panel, c('--fstat-del-bg')), WCAG.TEXT);
+  check('--accent on --fstat-ren-bg', c('--accent'), flatten(panel, c('--fstat-ren-bg')), WCAG.TEXT);
+  check(
+    '--badge-resolved-fg on --badge-resolved-bg over an added line',
+    c('--badge-resolved-fg'),
+    flatten(addRow, c('--badge-resolved-bg')),
+    WCAG.TEXT,
+  );
+  check('--badge-closed-fg on --badge-closed-bg', c('--badge-closed-fg'), c('--badge-closed-bg'), WCAG.TEXT);
+
+  // Non-text: control outlines and the status rail down a thread's left edge.
+  for (const [name, surface] of surfaces) {
+    if (name === 'bg-3' || name === 'hover') continue;
+    check(`--border-strong on --${name}`, c('--border-strong'), surface, WCAG.UI);
+  }
+  check('--accent-border on --panel', c('--accent-border'), panel, WCAG.UI);
+  for (const tone of ['--st-active', '--st-pending', '--st-resolved', '--st-wontfix', '--st-closed']) {
+    check(`${tone} rail on --panel`, c(tone), panel, WCAG.UI);
+  }
+
+  return results;
+}
+
diff --git a/samples/CodeFlow/scripts/storage-describe.ts b/samples/CodeFlow/scripts/storage-describe.ts
new file mode 100644
index 0000000..d05b377
--- /dev/null
+++ b/samples/CodeFlow/scripts/storage-describe.ts
@@ -0,0 +1,15 @@
+/**
+ * Prints every storage collection as provider-neutral JSON (JSON Schema per
+ * collection). Used by the add-data-source skill to provision lists/tables.
+ *
+ *   npm run storage:describe
+ */
+import { describeCollections } from '../src/storage/core/describe';
+import { allCollections, KV_NAMESPACES } from '../src/storage/collections';
+
+const output = {
+  collections: describeCollections(allCollections),
+  keyValueNamespaces: KV_NAMESPACES,
+};
+
+console.log(JSON.stringify(output, null, 2));
diff --git a/samples/CodeFlow/src/App.css b/samples/CodeFlow/src/App.css
new file mode 100644
index 0000000..7d65f4a
--- /dev/null
+++ b/samples/CodeFlow/src/App.css
@@ -0,0 +1,5636 @@
+.app-surface { display: contents; }
+.app-surface[hidden] { display: none; }
+
+/* ===================== CodeFlow theme =====================
+ *
+ * Every colour in this file comes from a token below. `data-theme` on the
+ * document element (set by `settings/theme`) picks the palette; `system`
+ * is resolved to `dark` or `light` before it gets here, so there is never a
+ * third case to style.
+ */
+:root,
+:root[data-theme='dark'] {
+  /* Surfaces.
+   *
+   * A dimmed charcoal rather than near-black. The old canvas (#0d1117) put body
+   * text at ~12:1, well past the 7:1 AAA bar, and that much luminance contrast
+   * on an almost-black field makes glyph edges bloom — the "can't focus on it"
+   * fatigue that shows up after an hour in a diff. Lifting the canvas and
+   * softening the text lands around 9.6:1: still AAA, far calmer to read.
+   *
+   * Every surface that carries body text is kept light enough that --text stays
+   * under the 10:1 halation ceiling, which is why --bg-2 and --input-bg are not
+   * as deep as they would otherwise be. */
+  --bg: #1b2027;
+  --bg-2: #191e25;
+  --bg-3: #2d333b;
+  --panel: #22272e;
+  --panel-2: #1b2027;
+  --input-bg: #191e25;
+  /* Warm centre of the radial backdrop behind the loader and dashboard. */
+  --page-grad: #232932;
+  --hover: #2d333b;
+  --hover-subtle: rgba(255, 255, 255, 0.06);
+  --hover-subtle-2: rgba(255, 255, 255, 0.09);
+
+  /* Lines. Bright enough to clear the 3:1 non-text bar of WCAG 1.4.11, which
+     the old #30363d missed by a wide margin (1.5:1). `--border` divides
+     regions; `--border-strong` outlines controls a reviewer has to find and
+     click, which is what 1.4.11 actually governs. */
+  --border: #444c56;
+  --border-2: #343b45;
+  --border-strong: #6d7986;
+
+  /* Text */
+  --text: #bcc8d4;
+  --text-1: #bcc8d4;
+  --text-dim: #9daab8;
+  --text-bright: #cdd9e5;
+  --fg-muted: #9daab8;
+  /* Text that sits on a saturated fill (buttons, status pills). */
+  --on-emphasis: #ffffff;
+  --emphasis-border: rgba(205, 217, 229, 0.12);
+
+  /* Accent. `--accent` is the *foreground* blue (links, active labels);
+     `--accent-fill` is the darker blue used behind white glyphs, because one
+     blue cannot be both readable on charcoal and readable under white. */
+  --accent: #6cb6ff;
+  --accent-fill: #1f6feb;
+  --accent-bg: rgba(65, 132, 228, 0.18);
+  --accent-border: rgba(108, 182, 255, 0.55);
+
+  --add: #6bbf6e;
+  --green: #6bbf6e;
+  --del: #ff7b72;
+  --mono: ui-monospace, SFMono-Regular, 'Cascadia Code', Consolas, monospace;
+  --font-ui: ui-sans-serif, system-ui, 'Segoe UI', Roboto, sans-serif;
+
+  /* Intent fills — all carry white text, so they stay dark enough for 4.5:1.
+     That caps how light a hover can go, so hover presses *darker* rather than
+     lighter; on a dark theme that still reads as a state change. */
+  --success: #22863a;
+  --success-hover: #19692c;
+  --danger: #cb2431;
+  --danger-hover: #a91d28;
+  --warn: #96690a;
+  --warn-hover: #7a5408;
+  --merged: #6f42c1;
+  /* Draft: a neutral grey, deliberately the *absence* of a status colour —
+     nothing is happening to this pull request yet. */
+  --draft: #5c6672;
+
+  /* Inline notices */
+  --danger-fg: #ff9d94;
+  --danger-surface: rgba(229, 83, 75, 0.14);
+  --danger-border: rgba(229, 83, 75, 0.45);
+  --success-border: rgba(87, 171, 90, 0.45);
+  --warn-surface: rgba(198, 144, 38, 0.14);
+  --warn-border: rgba(198, 144, 38, 0.45);
+
+  /* Depth */
+  --overlay: rgba(1, 4, 9, 0.7);
+  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
+  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
+  --shadow-lg: 0 16px 48px rgba(1, 4, 9, 0.6);
+
+  /* Thread statuses. Same split as the accent: `--st-x` is the foreground tone
+     (status text, the thread's left border), `--st-x-fill` is the pill behind
+     white text. */
+  --st-active: #6cb6ff;
+  --st-pending: #d9a441;
+  --st-resolved: #6bbf6e;
+  --st-wontfix: #909dab;
+  --st-closed: #b083f0;
+  --st-rejected: #ff7b72;
+  --st-active-fill: #1f6feb;
+  --st-pending-fill: #96690a;
+  --st-resolved-fill: #22863a;
+  --st-wontfix-fill: #5c6672;
+  --st-closed-fill: #6f42c1;
+
+  /* Diff cells. Tints are a touch stronger than before because the lifted
+     canvas would otherwise wash them out; `+`/`-` markers and the gutter mean
+     the change is never signalled by hue alone (WCAG 1.4.1). */
+  --diff-add-bg: rgba(70, 149, 74, 0.18);
+  --diff-add-gutter-bg: rgba(70, 149, 74, 0.28);
+  --diff-add-gutter-fg: #8ddb90;
+  --diff-del-bg: rgba(229, 83, 75, 0.16);
+  --diff-del-gutter-bg: rgba(229, 83, 75, 0.26);
+  --diff-del-gutter-fg: #ffada5;
+  --diff-empty-bg: #181c22;
+  --diff-lineno: #8b98a5;
+  --suggest-add-bg: rgba(70, 149, 74, 0.18);
+  --suggest-del-bg: rgba(229, 83, 75, 0.16);
+
+  /* File-status squares in the file list */
+  --fstat-add-bg: rgba(87, 171, 90, 0.16);
+  --fstat-del-bg: rgba(229, 83, 75, 0.16);
+  --fstat-mod-bg: rgba(217, 164, 65, 0.16);
+  --fstat-mod-fg: #e3b341;
+  --fstat-ren-bg: rgba(108, 182, 255, 0.16);
+
+  /* In-file find. The tint has to survive stacking on top of a diff row without
+     burying the code underneath, which caps how opaque it can be. */
+  --match-bg: rgba(217, 155, 40, 0.2);
+  --match-active-bg: #f0a020;
+  --match-active-fg: #14181e;
+
+  /* Occurrence highlight for the word under the selection. A different hue from
+     find's amber on purpose: the two mean different things and can land on the
+     same line. */
+  --selmatch-bg: rgba(88, 166, 255, 0.22);
+  --selmatch-outline: rgba(88, 166, 255, 0.55);
+
+  /* Word-level diff highlights: stronger tint than the line background so the
+     changed token is immediately obvious, but still translucent so the code
+     colour is not lost. */
+  --word-add-bg: rgba(70, 149, 74, 0.50);
+  --word-del-bg: rgba(229, 83, 75, 0.48);
+
+  /* Syntax tokens. Two colours are deliberately doing nothing: `variable` is the
+     ordinary text colour, and `operator` shares the keyword hue, because
+     colouring every identifier and every bracket turns a diff into confetti. */
+  --tok-variable: #c9d1d9;
+  --tok-property: #79c0ff;
+  --tok-constant: #79c0ff;
+  --tok-number: #79c0ff;
+  --tok-string: #a5d6ff;
+  --tok-regexp: #7ee787;
+  --tok-comment: #8b949e;
+  --tok-keyword: #ff7b72;
+  --tok-operator: #ff7b72;
+  --tok-type: #ffa657;
+  --tok-function: #d2a8ff;
+  --tok-tag: #7ee787;
+  --tok-attr: #79c0ff;
+
+  /* Weaker add/del tints, used only while syntax highlighting is on. The full
+     strength versions are tuned to be legible under one flat text colour; with
+     a dozen hues on top they start to muddy the darker tokens. The gutter and
+     the `+`/`-` marker keep their full strength, so the WCAG 1.4.1 argument
+     above still holds — change is never signalled by the row tint alone. */
+  --diff-add-bg-syntax: rgba(70, 149, 74, 0.11);
+  --diff-del-bg-syntax: rgba(229, 83, 75, 0.10);
+
+  /* Scrollbar change map */
+  --changemap-bg: rgba(20, 24, 30, 0.6);
+  --changemap-border: rgba(255, 255, 255, 0.14);
+
+  /* Gutter thread badges */
+  --badge-resolved-bg: rgba(255, 255, 255, 0.22);
+  --badge-resolved-fg: #ffffff;
+  --badge-resolved-border: rgba(255, 255, 255, 0.4);
+  --badge-closed-bg: #6f42c1;
+  --badge-closed-fg: #ffffff;
+  --badge-closed-border: #b083f0;
+
+  /* Deep-link landing flashes */
+  --flash-ring: rgba(108, 182, 255, 0.6);
+  --flash-row: rgba(108, 182, 255, 0.3);
+
+  --reviewer-dismissed-border: #909dab;
+}
+
+:root[data-theme='light'] {
+  /* Surfaces: white is the reading canvas, greys are chrome. */
+  --bg: #ffffff;
+  --bg-2: #f6f8fa;
+  --bg-3: #eaeef2;
+  --panel: #f6f8fa;
+  --panel-2: #eef1f5;
+  --input-bg: #ffffff;
+  --page-grad: #eef2f7;
+  --hover: #eaeef2;
+  --hover-subtle: rgba(31, 35, 40, 0.06);
+  --hover-subtle-2: rgba(31, 35, 40, 0.1);
+
+  --border: #d0d7de;
+  --border-2: #e3e8ee;
+  --border-strong: #818a95;
+
+  --text: #1f2328;
+  --text-1: #1f2328;
+  --text-dim: #59636e;
+  --text-bright: #010409;
+  --fg-muted: #59636e;
+  --on-emphasis: #ffffff;
+  --emphasis-border: rgba(31, 35, 40, 0.15);
+
+  /* Deepened a step from Primer's defaults: the originals cleared 4.5:1 on
+     white by hundredths, which left nothing for the tinted chips they sit on. */
+  --accent: #0860c6;
+  --accent-fill: #0860c6;
+  --accent-bg: rgba(8, 96, 198, 0.09);
+  --accent-border: rgba(8, 96, 198, 0.45);
+
+  --add: #177231;
+  --green: #177231;
+  --del: #bd1f2a;
+
+  --success: #1f883d;
+  --success-hover: #177231;
+  --danger: #bd1f2a;
+  --danger-hover: #a40e26;
+  --warn: #9a6700;
+  --warn-hover: #7d5300;
+  --merged: #8250df;
+  --draft: #59636e;
+
+  --danger-fg: #bd1f2a;
+  --danger-surface: #ffebe9;
+  --danger-border: rgba(189, 31, 42, 0.45);
+  --success-border: rgba(23, 114, 49, 0.45);
+  --warn-surface: rgba(154, 103, 0, 0.1);
+  --warn-border: rgba(154, 103, 0, 0.4);
+
+  --overlay: rgba(31, 35, 40, 0.45);
+  --shadow-sm: 0 4px 12px rgba(31, 35, 40, 0.15);
+  --shadow-md: 0 6px 20px rgba(31, 35, 40, 0.15);
+  --shadow-lg: 0 16px 48px rgba(31, 35, 40, 0.2);
+
+  --st-active: #0860c6;
+  --st-pending: #9a6700;
+  --st-resolved: #177231;
+  --st-wontfix: #59636e;
+  --st-closed: #8250df;
+  --st-rejected: #bd1f2a;
+  /* Light fills are already dark enough to carry white text, so the pill and
+     the foreground tone can be the same colour here. */
+  --st-active-fill: #0860c6;
+  --st-pending-fill: #9a6700;
+  --st-resolved-fill: #177231;
+  --st-wontfix-fill: #59636e;
+  --st-closed-fill: #8250df;
+
+  --diff-add-bg: #e6ffec;
+  --diff-add-gutter-bg: #ccffd8;
+  --diff-add-gutter-fg: #116329;
+  --diff-del-bg: #ffebe9;
+  --diff-del-gutter-bg: #ffd7d5;
+  --diff-del-gutter-fg: #82071e;
+  --diff-empty-bg: #f6f8fa;
+  --diff-lineno: #656d76;
+  --suggest-add-bg: #e6ffec;
+  --suggest-del-bg: #ffebe9;
+
+  --fstat-add-bg: rgba(23, 114, 49, 0.12);
+  --fstat-del-bg: rgba(189, 31, 42, 0.12);
+  --fstat-mod-bg: rgba(154, 103, 0, 0.12);
+  --fstat-mod-fg: #6a4700;
+  --fstat-ren-bg: rgba(8, 96, 198, 0.12);
+
+  --match-bg: rgba(255, 212, 0, 0.55);
+  --match-active-bg: #ffb700;
+  --match-active-fg: #1f2328;
+
+  --selmatch-bg: rgba(9, 105, 218, 0.16);
+  --selmatch-outline: rgba(9, 105, 218, 0.5);
+
+  --word-add-bg: #9ee8ac;
+  --word-del-bg: #ffa9a4;
+
+  --tok-variable: #1f2328;
+  --tok-property: #0550ae;
+  --tok-constant: #0550ae;
+  --tok-number: #0550ae;
+  --tok-string: #0a3069;
+  --tok-regexp: #116329;
+  --tok-comment: #6e7781;
+  --tok-keyword: #cf222e;
+  --tok-operator: #cf222e;
+  --tok-type: #953800;
+  --tok-function: #8250df;
+  --tok-tag: #116329;
+  --tok-attr: #0550ae;
+
+  --diff-add-bg-syntax: rgba(35, 134, 54, 0.10);
+  --diff-del-bg-syntax: rgba(207, 34, 46, 0.09);
+
+  --changemap-bg: rgba(208, 215, 222, 0.55);
+  --changemap-border: rgba(31, 35, 40, 0.12);
+
+  /* Solid fills, because the dark badges rely on white overlays that vanish
+     against a light gutter. */
+  --badge-resolved-bg: #6e7781;
+  --badge-resolved-fg: #ffffff;
+  --badge-resolved-border: rgba(31, 35, 40, 0.2);
+  --badge-closed-bg: #8250df;
+  --badge-closed-fg: #ffffff;
+  --badge-closed-border: #6639ba;
+
+  --flash-ring: rgba(9, 105, 218, 0.5);
+  --flash-row: rgba(9, 105, 218, 0.18);
+
+  --reviewer-dismissed-border: #8c959f;
+}
+
+/* ===================== Dogfood 🐶 =====================
+ *
+ * The easter egg, switched on under Settings → Easter eggs and then picked from
+ * the theme row. It is deliberately
+ * garish and is exempt from the contrast audit in
+ * `scripts/__tests__/contrast.test.mjs` — being hard to look at is the joke. It
+ * still defines the full token set so no rule falls back to an inherited value.
+ */
+:root[data-theme='dogfood'] {
+  --bg: #ffdbef;
+  --bg-2: #ffc8e6;
+  --bg-3: #ff8ac9;
+  --panel: #ff5fb0;
+  --panel-2: #ffc2e2;
+  --input-bg: #fff2f9;
+  --page-grad: #ff9ed2;
+  --hover: #ff8ac9;
+  --hover-subtle: rgba(123, 0, 66, 0.08);
+  --hover-subtle-2: rgba(123, 0, 66, 0.14);
+
+  --border: #ff2d95;
+  --border-2: #ff8ac9;
+  --border-strong: #7a0042;
+
+  --text: #3d0022;
+  --text-1: #3d0022;
+  --text-dim: #8a1259;
+  --text-bright: #1a000e;
+  --fg-muted: #8a1259;
+  --on-emphasis: #ffffff;
+  --emphasis-border: rgba(61, 0, 34, 0.2);
+
+  --accent: #7b2ff7;
+  --accent-fill: #6021c9;
+  --accent-bg: rgba(123, 47, 247, 0.14);
+  --accent-border: rgba(123, 47, 247, 0.5);
+
+  --add: #0f7a3d;
+  --green: #0f7a3d;
+  --del: #c2003c;
+  --font-ui: 'Comic Sans MS', 'Comic Neue', 'Chalkboard SE', 'Segoe Print', cursive;
+
+  --success: #14883f;
+  --success-hover: #0f7a3d;
+  --danger: #d4004b;
+  --danger-hover: #a80039;
+  --warn: #a35a00;
+  --warn-hover: #8a4c00;
+  --merged: #7b2ff7;
+  --draft: #6b4a5e;
+
+  --danger-fg: #8c0030;
+  --danger-surface: #ffd6e4;
+  --danger-border: rgba(196, 0, 60, 0.45);
+  --success-border: rgba(15, 122, 61, 0.45);
+  --warn-surface: rgba(163, 90, 0, 0.14);
+  --warn-border: rgba(163, 90, 0, 0.45);
+
+  --overlay: rgba(123, 0, 66, 0.45);
+  --shadow-sm: 0 4px 12px rgba(123, 0, 66, 0.25);
+  --shadow-md: 0 6px 20px rgba(123, 0, 66, 0.25);
+  --shadow-lg: 0 16px 48px rgba(123, 0, 66, 0.35);
+
+  --st-active: #7b2ff7;
+  --st-pending: #a35a00;
+  --st-resolved: #0f7a3d;
+  --st-wontfix: #8a1259;
+  --st-closed: #b026ff;
+  --st-rejected: #c2003c;
+  /* Pills sit on the loud pink panel, so the fills are the deep end of each
+     hue: they carry white text and still separate from #ff5fb0. */
+  --st-active-fill: #6021c9;
+  --st-pending-fill: #7a4300;
+  --st-resolved-fill: #0b5c2e;
+  --st-wontfix-fill: #6b0e45;
+  --st-closed-fill: #8400c9;
+
+  /* Mint and blush, so a diff still reads as green/red against the pink. */
+  --diff-add-bg: #d6ffe6;
+  --diff-add-gutter-bg: #b3f7cd;
+  --diff-add-gutter-fg: #0b5c2e;
+  --diff-del-bg: #ffd2cd;
+  --diff-del-gutter-bg: #ffb6ae;
+  --diff-del-gutter-fg: #8c0018;
+  --diff-empty-bg: #ffcbe6;
+  --diff-lineno: #c2589a;
+  --suggest-add-bg: #d6ffe6;
+  --suggest-del-bg: #ffd2cd;
+
+  --fstat-add-bg: rgba(15, 122, 61, 0.2);
+  --fstat-del-bg: rgba(194, 0, 60, 0.2);
+  --fstat-mod-bg: rgba(163, 90, 0, 0.2);
+  --fstat-mod-fg: #7a4300;
+  --fstat-ren-bg: rgba(123, 47, 247, 0.2);
+
+  --match-bg: rgba(255, 237, 78, 0.75);
+  --match-active-bg: #ffed4e;
+  --match-active-fg: #3d0022;
+
+  --selmatch-bg: rgba(11, 90, 220, 0.16);
+  --selmatch-outline: rgba(11, 90, 220, 0.5);
+
+  --word-add-bg: #84d9a8;
+  --word-del-bg: #ff9990;
+
+  /* Deep and saturated, because everything here sits on pink. */
+  --tok-variable: #3d0022;
+  --tok-property: #0b3ea8;
+  --tok-constant: #0b3ea8;
+  --tok-number: #0b3ea8;
+  --tok-string: #7a0060;
+  --tok-regexp: #0b5c2e;
+  --tok-comment: #a8447f;
+  --tok-keyword: #c2003c;
+  --tok-operator: #c2003c;
+  --tok-type: #8c4a00;
+  --tok-function: #6a1fd0;
+  --tok-tag: #0b5c2e;
+  --tok-attr: #0b3ea8;
+
+  --diff-add-bg-syntax: rgba(15, 122, 61, 0.16);
+  --diff-del-bg-syntax: rgba(194, 0, 60, 0.13);
+
+  --changemap-bg: rgba(255, 194, 226, 0.7);
+  --changemap-border: rgba(255, 45, 149, 0.4);
+
+  --badge-resolved-bg: #8a1259;
+  --badge-resolved-fg: #ffffff;
+  --badge-resolved-border: rgba(61, 0, 34, 0.25);
+  --badge-closed-bg: #b026ff;
+  --badge-closed-fg: #ffffff;
+  --badge-closed-border: #7b2ff7;
+
+  --flash-ring: rgba(123, 47, 247, 0.6);
+  --flash-row: rgba(255, 237, 78, 0.5);
+
+  --reviewer-dismissed-border: #c2589a;
+}
+
+/* ----------------------------- Focus ----------------------------- */
+/*
+ * One ring for everything keyboard-reachable (WCAG 2.4.7 Focus Visible).
+ *
+ * `:focus-visible` means it never fires on a mouse click, which is why the
+ * component rules below could get away with suppressing focus entirely — the
+ * ring only ever showed up when it was "in the way". `:where()` keeps the
+ * selector at zero specificity so any component can still opt into a tighter
+ * ring, and `outline` is used rather than `box-shadow` because Windows
+ * forced-colors mode repaints outlines but drops shadows.
+ */
+:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
+  outline: 2px solid var(--accent);
+  outline-offset: 2px;
+}
+
+/* ----------------------------- Buttons ----------------------------- */
+.btn {
+  font: inherit;
+  font-size: 12px;
+  padding: 5px 12px;
+  border-radius: 6px;
+  border: 1px solid var(--border-strong);
+  background: var(--panel);
+  color: var(--text);
+  cursor: pointer;
+  white-space: nowrap;
+}
+.btn:hover:not(:disabled) {
+  border-color: var(--text-dim);
+  background: var(--hover);
+}
+.btn:disabled {
+  opacity: 0.5;
+  cursor: default;
+}
+.btn--primary {
+  background: var(--success);
+  border-color: var(--emphasis-border);
+  color: var(--on-emphasis);
+}
+.btn--primary:hover:not(:disabled) {
+  background: var(--success-hover);
+}
+.btn--sm {
+  font-size: 11px;
+  padding: 3px 8px;
+}
+.btn--active {
+  border-color: var(--accent);
+  color: var(--text-bright);
+  background: var(--accent-bg);
+}
+/*
+ * A toggle reduced to its glyph. The state it names lives in `title` and
+ * `aria-label` instead of on the face of the button, so a crowded toolbar stays
+ * readable; the fixed width keeps the row from twitching as the glyph changes.
+ */
+.btn--glyph {
+  min-width: 28px;
+  padding-inline: 6px;
+  text-align: center;
+}
+.linkbtn {
+  background: none;
+  border: none;
+  color: var(--accent);
+  cursor: pointer;
+  font: inherit;
+  font-size: 11px;
+  padding: 0 2px;
+}
+.linkbtn:hover {
+  text-decoration: underline;
+}
+.iconbtn {
+  background: none;
+  border: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  font-size: 12px;
+  padding: 2px 4px;
+  border-radius: 4px;
+  /* WCAG 2.2 target size: the glyph stays small, the box does not. */
+  min-width: 24px;
+  min-height: 24px;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+}
+.iconbtn:hover {
+  background: var(--border-2);
+  color: var(--text);
+}
+
+/* ----------------------------- Copy link button ------------------------------ */
+.copy-link-btn {
+  background: none;
+  border: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  font-size: 12px;
+  padding: 2px 5px;
+  border-radius: 4px;
+  opacity: 0.6;
+  flex: none;
+  min-width: 24px;
+  min-height: 24px;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  transition: opacity 0.15s, background 0.15s;
+}
+.copy-link-btn:hover:not(:disabled) {
+  background: var(--border-2);
+  color: var(--text);
+  opacity: 1;
+}
+.copy-link-btn:disabled {
+  cursor: default;
+  opacity: 0.25;
+}
+.copy-link-btn--copied {
+  color: var(--add);
+  opacity: 1;
+}
+.copy-link-btn--failed {
+  color: var(--del);
+  opacity: 1;
+}
+
+/* ----------------------------- Avatar ------------------------------ */
+.avatar {
+  border-radius: 50%;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  vertical-align: middle;
+  flex: none;
+  object-fit: cover;
+}
+.avatar--initials {
+  font-weight: 600;
+  text-transform: uppercase;
+  overflow: hidden;
+  user-select: none;
+}
+
+/* ------------------------------ Loader ----------------------------- */
+.loader {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 24px;
+  background: radial-gradient(1200px 600px at 50% -10%, var(--page-grad), var(--bg));
+}
+.loader__card {
+  width: 480px;
+  max-width: 100%;
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-radius: 12px;
+  padding: 28px;
+  box-shadow: var(--shadow-lg);
+}
+.loader__brand {
+  display: flex;
+  align-items: center;
+  gap: 14px;
+  margin-bottom: 22px;
+}
+.loader__logo {
+  width: 46px;
+  height: 46px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex: none;
+}
+.loader__card h1 {
+  margin: 0;
+  font-size: 20px;
+  color: var(--text-bright);
+}
+.loader__tag {
+  margin: 2px 0 0;
+  color: var(--text-dim);
+  font-size: 12px;
+}
+.loader__label {
+  display: block;
+  font-size: 12px;
+  color: var(--text-dim);
+  margin-bottom: 6px;
+}
+.loader__input {
+  width: 100%;
+  font: inherit;
+  padding: 9px 11px;
+  border-radius: 6px;
+  border: 1px solid var(--border-strong);
+  background: var(--input-bg);
+  color: var(--text);
+}
+.loader__input:focus {
+  border-color: var(--accent);
+  box-shadow: 0 0 0 3px var(--accent-bg);
+}
+.loader__or {
+  text-align: center;
+  color: var(--text-dim);
+  font-size: 11px;
+  margin: 12px 0 8px;
+}
+.loader__fields {
+  display: grid;
+  grid-template-columns: 1fr 1fr 80px;
+  gap: 8px;
+}
+.loader__input--num {
+  text-align: center;
+}
+.loader__actions {
+  display: flex;
+  gap: 10px;
+  margin-top: 18px;
+}
+.loader__actions .btn {
+  flex: 1;
+  padding: 9px 12px;
+  font-size: 13px;
+}
+.loader__error {
+  margin-top: 14px;
+  padding: 9px 11px;
+  border-radius: 6px;
+  background: var(--danger-surface);
+  border: 1px solid var(--danger-border);
+  color: var(--danger-fg);
+  font-size: 12px;
+  word-break: break-word;
+}
+.loader__recent,
+.picker {
+  margin-top: 18px;
+  border-top: 1px solid var(--border-2);
+  padding-top: 12px;
+}
+
+/* Deep-link splash: indeterminate bar shown while a ?dl= link resolves. */
+.splash__bar {
+  height: 4px;
+  border-radius: 999px;
+  background: var(--panel-2);
+  overflow: hidden;
+}
+.splash__bar > span {
+  display: block;
+  height: 100%;
+  width: 40%;
+  border-radius: 999px;
+  background: var(--accent);
+  animation: splash-slide 1.1s ease-in-out infinite;
+}
+.splash__hint {
+  margin: 12px 0 0;
+  font-size: 12px;
+  color: var(--text-dim);
+  word-break: break-word;
+}
+.splash__hint--slow {
+  margin-top: 6px;
+  opacity: 0.75;
+  font-style: italic;
+}
+@keyframes splash-slide {
+  0% {
+    transform: translateX(-100%);
+  }
+  100% {
+    transform: translateX(250%);
+  }
+}
+@media (prefers-reduced-motion: reduce) {
+  .splash__bar > span {
+    animation: none;
+    width: 100%;
+  }
+}
+.loader__recent-head {
+  font-size: 11px;
+  text-transform: uppercase;
+  letter-spacing: 0.04em;
+  color: var(--text-dim);
+  margin-bottom: 6px;
+}
+.loader__recent-item,
+.picker__item {
+  width: 100%;
+  text-align: left;
+  display: flex;
+  align-items: baseline;
+  gap: 8px;
+  padding: 7px 9px;
+  border-radius: 6px;
+  border: 1px solid transparent;
+  background: none;
+  color: var(--text);
+  cursor: pointer;
+  font: inherit;
+  font-size: 12px;
+}
+.loader__recent-item:hover,
+.picker__item:hover {
+  background: var(--panel-2);
+  border-color: var(--border-2);
+}
+.picker__msg {
+  font-size: 12px;
+  color: var(--text-dim);
+  padding: 8px 4px;
+}
+.picker__msg--err {
+  color: var(--danger-fg);
+}
+.picker__num {
+  color: var(--accent);
+  font-family: var(--mono);
+  font-size: 11px;
+  flex: none;
+}
+.picker__title {
+  color: var(--text);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.picker__author {
+  margin-left: auto;
+  color: var(--text-dim);
+  font-size: 11px;
+  flex: none;
+}
+
+/* ----------------------------- Dashboard --------------------------- */
+.dash {
+  flex: 1;
+  overflow-y: auto;
+  background: radial-gradient(1200px 600px at 50% -10%, var(--page-grad), var(--bg));
+}
+.dash__inner {
+  width: 960px;
+  max-width: 100%;
+  margin: 0 auto;
+  padding: 28px 24px 48px;
+}
+.dash__header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  gap: 16px;
+  margin-bottom: 20px;
+}
+.dash__brand {
+  display: flex;
+  align-items: center;
+  gap: 14px;
+}
+.dash__brand img {
+  flex: none;
+}
+.dash__brand h1 {
+  margin: 0;
+  font-size: 20px;
+  color: var(--text-bright);
+}
+.dash__tag {
+  margin: 2px 0 0;
+  color: var(--text-dim);
+  font-size: 12px;
+}
+.dash__version {
+  margin-left: 8px;
+}
+.dash__headright {
+  display: flex;
+  align-items: center;
+  gap: 12px;
+}
+.dash__me {
+  display: inline-flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 12px;
+  color: var(--text-dim);
+  white-space: nowrap;
+}
+.dash__gear {
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  flex: none;
+  width: 28px;
+  height: 28px;
+  padding: 0;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.dash__gear:hover {
+  color: var(--text-bright);
+  background: var(--border-2);
+}
+.dash__feedback {
+  font: inherit;
+  font-size: 12px;
+  display: inline-flex;
+  align-items: center;
+  gap: 5px;
+  height: 28px;
+  padding: 0 10px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  white-space: nowrap;
+}
+.dash__feedback:hover {
+  color: var(--text-bright);
+  background: var(--border-2);
+}
+
+/* --------------------------- Feedback / issues --------------------------- */
+
+.topbar__feedback {
+  font: inherit;
+  flex: none;
+  width: 28px;
+  height: 26px;
+  padding: 0;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.topbar__gear {
+  font: inherit;
+  flex: none;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  width: 28px;
+  height: 26px;
+  padding: 0;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.topbar__feedback:hover,
+.topbar__gear:hover {
+  background: var(--border-2);
+}
+.fb__backdrop {
+  position: fixed;
+  inset: 0;
+  z-index: 60;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 24px;
+  background: var(--overlay);
+}
+.fb {
+  display: flex;
+  flex-direction: column;
+  width: min(820px, 100%);
+  max-height: min(760px, 100%);
+  border: 1px solid var(--border);
+  border-radius: 10px;
+  background: var(--panel);
+  box-shadow: var(--shadow-lg);
+}
+.fb__head {
+  display: flex;
+  align-items: flex-start;
+  justify-content: space-between;
+  gap: 12px;
+  padding: 14px 16px;
+  border-bottom: 1px solid var(--border);
+}
+.fb__title {
+  margin: 0;
+  font-size: 16px;
+  color: var(--text-bright);
+}
+.fb__sub {
+  margin: 2px 0 0;
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.fb__close {
+  font: inherit;
+  flex: none;
+  border: 0;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  padding: 2px 6px;
+  border-radius: 6px;
+}
+.fb__close:hover {
+  color: var(--text-bright);
+  background: var(--border-2);
+}
+.fb__toolbar {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  gap: 12px;
+  flex-wrap: wrap;
+  padding: 10px 16px;
+  border-bottom: 1px solid var(--border-2);
+}
+.fb__filters {
+  display: inline-flex;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  overflow: hidden;
+}
+.fb__filter {
+  font: inherit;
+  font-size: 12px;
+  padding: 4px 12px;
+  border: 0;
+  border-right: 1px solid var(--border-2);
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.fb__filter:last-child {
+  border-right: 0;
+}
+.fb__filter:hover {
+  background: var(--hover-subtle);
+}
+.fb__filter--active {
+  background: var(--accent-bg);
+  color: var(--accent);
+}
+.fb__count {
+  font-family: var(--mono);
+  font-size: 11px;
+  opacity: 0.75;
+}
+.fb__toolbar-right {
+  display: inline-flex;
+  align-items: center;
+  gap: 8px;
+}
+.fb__error {
+  display: flex;
+  align-items: flex-start;
+  justify-content: space-between;
+  gap: 8px;
+  margin: 10px 16px 0;
+  padding: 8px 10px;
+  font-size: 12px;
+  border: 1px solid var(--danger-border);
+  border-radius: 6px;
+  background: var(--danger-surface);
+  color: var(--danger-fg);
+}
+.fb__error-x {
+  font: inherit;
+  flex: none;
+  border: 0;
+  background: none;
+  color: inherit;
+  cursor: pointer;
+}
+.fb__body {
+  overflow-y: auto;
+  padding: 12px 16px 16px;
+}
+.fb__empty {
+  margin: 12px 0;
+  color: var(--text-dim);
+  font-size: 13px;
+}
+.fb__list {
+  margin: 0;
+  padding: 0;
+  list-style: none;
+  display: flex;
+  flex-direction: column;
+  gap: 6px;
+}
+
+/* One issue */
+.issue {
+  border: 1px solid var(--border-2);
+  border-radius: 8px;
+  background: var(--panel-2);
+}
+.issue--closed,
+.issue--wontfix {
+  opacity: 0.78;
+}
+.issue__head {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  padding: 6px 10px;
+}
+.issue__disclose {
+  font: inherit;
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  flex: 1;
+  min-width: 0;
+  padding: 0;
+  border: 0;
+  background: none;
+  color: var(--text);
+  cursor: pointer;
+  text-align: left;
+}
+.issue__caret {
+  flex: none;
+  width: 12px;
+  color: var(--text-dim);
+}
+.issue__status {
+  flex: none;
+  font-size: 11px;
+  text-transform: uppercase;
+  letter-spacing: 0.04em;
+  padding: 1px 8px;
+  border-radius: 999px;
+  color: var(--on-emphasis);
+}
+.issue__status--open {
+  background: var(--success);
+}
+.issue__status--pending {
+  background: var(--warn);
+}
+.issue__status--blocked {
+  background: var(--danger);
+}
+/* The two endings share a tab but must not share a badge: purple for done,
+   grey for declined, matching what the same words mean on a thread. */
+.issue__status--closed {
+  background: var(--st-closed-fill);
+}
+.issue__status--wontfix {
+  background: var(--st-wontfix-fill);
+}
+.issue__kind {
+  flex: none;
+  font-size: 11px;
+  padding: 1px 7px;
+  border-radius: 999px;
+  border: 1px solid var(--border);
+  color: var(--text-dim);
+}
+.issue__kind--bug {
+  color: var(--del);
+  border-color: var(--danger-border);
+}
+.issue__kind--idea {
+  color: var(--st-pending);
+  border-color: var(--warn-border);
+}
+.issue__title {
+  flex: 1;
+  min-width: 0;
+  font-size: 13px;
+  color: var(--text-bright);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+/* Open the row and it stops being a one-liner, so the title wraps in full
+   rather than clipping the very thing you just asked to read. */
+.issue__title--full {
+  overflow: visible;
+  text-overflow: clip;
+  white-space: normal;
+  overflow-wrap: anywhere;
+}
+/* Keep the badges and the byline beside the first line once the title runs to
+   several. */
+.issue__head--open,
+.issue__disclose--open {
+  align-items: flex-start;
+}
+.issue__meta {
+  flex: none;
+  display: inline-flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.issue__time {
+  font-family: var(--mono);
+}
+.issue__detail {
+  padding: 8px 16px 16px 32px;
+  border-top: 1px solid var(--border-2);
+}
+.issue__body {
+  font-size: 13px;
+}
+.issue__nobody {
+  font-size: 13px;
+  font-style: italic;
+  color: var(--text-dim);
+}
+.issue__foot {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  gap: 10px;
+  flex-wrap: wrap;
+  margin-top: 8px;
+  padding-top: 8px;
+  border-top: 1px solid var(--border-2);
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.issue__actions {
+  display: inline-flex;
+  gap: 6px;
+}
+/* Pipeline picker — sized to sit level with the small buttons beside it. */
+.issue__triage {
+  font: inherit;
+  font-size: 12px;
+  padding: 2px 6px;
+  border-radius: 6px;
+  border: 1px solid var(--border);
+  background: var(--panel);
+  color: var(--text);
+  cursor: pointer;
+}
+.issue__triage:disabled {
+  opacity: 0.6;
+  cursor: default;
+}
+
+/* Create / edit form */
+.issue-editor {
+  display: flex;
+  flex-direction: column;
+  gap: 8px;
+  margin-bottom: 12px;
+  padding: 12px;
+  border: 1px solid var(--border);
+  border-radius: 8px;
+  background: var(--panel-2);
+}
+.issue-editor__row {
+  display: flex;
+  gap: 8px;
+}
+.issue-editor__title {
+  font: inherit;
+  flex: 1;
+  min-width: 0;
+  padding: 6px 8px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--input-bg);
+  color: var(--text);
+}
+.issue-editor__kind {
+  font: inherit;
+  flex: none;
+  padding: 6px 8px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--input-bg);
+  color: var(--text);
+}
+.issue-editor__body {
+  font: inherit;
+  width: 100%;
+  box-sizing: border-box;
+  padding: 8px;
+  resize: vertical;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--input-bg);
+  color: var(--text);
+}
+.issue-editor__actions {
+  display: flex;
+  gap: 8px;
+}
+
+/* Issue comment thread.
+   Deliberately namespaced away from the PR review `.thread` block further down
+   this file: these are two unrelated widgets, and while they shared a namespace
+   the later block silently won and wrapped every issue comment in a second card. */
+.issue-thread {
+  margin-top: 10px;
+  padding-top: 10px;
+  border-top: 1px solid var(--border-2);
+}
+.issue-thread__empty {
+  margin: 0 0 8px;
+  font-size: 12px;
+  font-style: italic;
+  color: var(--text-dim);
+}
+.issue-thread__error {
+  margin: 0 0 8px;
+  font-size: 12px;
+  color: var(--del);
+}
+.issue-thread__list {
+  list-style: none;
+  margin: 0 0 10px;
+  padding: 0;
+  display: flex;
+  flex-direction: column;
+  gap: 8px;
+}
+.issue-thread__item {
+  padding: 8px 10px;
+  border: 1px solid var(--border-2);
+  border-radius: 6px;
+  background: var(--panel-2);
+}
+/* An automated note is context, not conversation — recede it. */
+.issue-thread__item--status {
+  background: none;
+  border-style: dashed;
+}
+.issue-thread__item--question {
+  border-color: var(--warn-border);
+}
+.issue-thread__head {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.issue-thread__author {
+  color: var(--text-bright);
+}
+.issue-thread__badge {
+  flex: none;
+  font-size: 11px;
+  text-transform: uppercase;
+  letter-spacing: 0.04em;
+  padding: 1px 6px;
+  border-radius: 999px;
+  border: 1px solid var(--border);
+}
+.issue-thread__badge--status {
+  color: var(--text-dim);
+}
+.issue-thread__badge--question {
+  color: var(--st-pending);
+  border-color: var(--warn-border);
+}
+.issue-thread__time {
+  flex: 1;
+  font-family: var(--mono);
+}
+.issue-thread__edit {
+  flex: none;
+  font: inherit;
+  font-size: 11px;
+  padding: 0;
+  border: 0;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  text-decoration: underline;
+}
+.issue-thread__edit:hover:not(:disabled) {
+  color: var(--text-bright);
+}
+.issue-thread__body {
+  margin-top: 4px;
+  font-size: 13px;
+}
+.issue-thread__form {
+  display: flex;
+  flex-direction: column;
+  gap: 6px;
+  margin-top: 6px;
+}
+.issue-thread__input {
+  font: inherit;
+  font-size: 13px;
+  width: 100%;
+  box-sizing: border-box;
+  padding: 6px 8px;
+  resize: vertical;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--input-bg);
+  color: var(--text);
+}
+.issue-thread__input:focus {
+  border-color: var(--accent);
+}
+.issue-thread__actions {
+  display: flex;
+  gap: 6px;
+}
+
+/* ------------------------------- Settings ------------------------------- */
+
+.set__backdrop {
+  position: fixed;
+  inset: 0;
+  z-index: 60;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 24px;
+  background: var(--overlay);
+}
+.set {
+  display: flex;
+  flex-direction: column;
+  width: min(760px, 100%);
+  max-height: min(720px, 100%);
+  border: 1px solid var(--border);
+  border-radius: 10px;
+  background: var(--panel);
+  box-shadow: var(--shadow-lg);
+}
+.set__head {
+  display: flex;
+  align-items: flex-start;
+  justify-content: space-between;
+  gap: 12px;
+  padding: 14px 16px;
+  border-bottom: 1px solid var(--border);
+}
+.set__title {
+  margin: 0;
+  font-size: 16px;
+  color: var(--text-bright);
+}
+.set__sub {
+  margin: 2px 0 0;
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.set__close {
+  font: inherit;
+  flex: none;
+  border: 0;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  padding: 2px 6px;
+  border-radius: 6px;
+}
+.set__close:hover {
+  color: var(--text-bright);
+  background: var(--border-2);
+}
+.set__body {
+  display: flex;
+  min-height: 0;
+  flex: 1;
+}
+.set__tabs {
+  display: flex;
+  flex-direction: column;
+  flex: none;
+  gap: 2px;
+  width: 150px;
+  padding: 12px 8px;
+  border-right: 1px solid var(--border);
+}
+.set__tab {
+  font: inherit;
+  text-align: left;
+  padding: 7px 10px;
+  border: 0;
+  border-radius: 6px;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.set__tab:hover {
+  color: var(--text);
+  background: var(--border-2);
+}
+.set__tab--active,
+.set__tab--active:hover {
+  color: var(--text-bright);
+  background: var(--accent-bg);
+}
+.set__panel {
+  flex: 1;
+  min-width: 0;
+  overflow-y: auto;
+  padding: 12px 16px 20px;
+}
+.set__group {
+  margin-bottom: 20px;
+}
+.set__grouptitle {
+  margin: 0 0 6px;
+  font-size: 11px;
+  font-weight: 600;
+  text-transform: uppercase;
+  letter-spacing: 0.06em;
+  color: var(--text-dim);
+}
+.set__row {
+  display: flex;
+  align-items: flex-start;
+  justify-content: space-between;
+  gap: 16px;
+  padding: 10px 0;
+  border-bottom: 1px solid var(--border);
+}
+.set__row:last-child {
+  border-bottom: 0;
+}
+.set__rowtext {
+  display: flex;
+  flex-direction: column;
+  gap: 2px;
+  min-width: 0;
+}
+.set__label {
+  font-size: 13px;
+  color: var(--text-bright);
+}
+.set__hint {
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.set__note {
+  font-size: 11px;
+  font-style: italic;
+  color: var(--text-dim);
+}
+.set__control {
+  flex: none;
+  display: flex;
+  align-items: center;
+}
+.set__radios,
+.set__checks {
+  display: flex;
+  gap: 12px;
+  flex-wrap: wrap;
+}
+
+.set__radio,
+.set__check,
+.set__toggle {
+  display: inline-flex;
+  align-items: center;
+  gap: 5px;
+  font-size: 12px;
+  color: var(--text);
+  cursor: pointer;
+  white-space: nowrap;
+}
+.set__togglelabel {
+  min-width: 22px;
+  color: var(--text-dim);
+}
+.set__select {
+  font: inherit;
+  font-size: 12px;
+  padding: 4px 8px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--input-bg);
+  color: var(--text);
+}
+.set__inline {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+}
+.set__mono {
+  font-family: var(--mono);
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.set__code-preview {
+  font-family: var(--code-font-family, var(--mono));
+  line-height: 1.5;
+  margin: 8px 0;
+  padding: 10px 12px;
+  overflow-x: auto;
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  background: var(--bg-2);
+  color: var(--text);
+}
+.set__count {
+  font-family: var(--mono);
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.set__empty {
+  margin: 6px 0;
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.set__error {
+  margin: 6px 0;
+  font-size: 12px;
+  color: var(--st-rejected);
+}
+.set__pre {
+  margin: 6px 0 0;
+  padding: 8px 10px;
+  max-height: 220px;
+  overflow: auto;
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  background: var(--bg-2);
+  font-family: var(--mono);
+  font-size: 11px;
+  line-height: 1.5;
+  color: var(--text-dim);
+  white-space: pre-wrap;
+  word-break: break-all;
+}
+.set__log {
+  margin: 0;
+  padding: 0;
+  list-style: none;
+  max-height: 260px;
+  overflow-y: auto;
+  border: 1px solid var(--border);
+  border-radius: 6px;
+}
+.set__logrow {
+  display: grid;
+  grid-template-columns: 76px 92px minmax(120px, 1fr) minmax(0, 1.4fr);
+  gap: 8px;
+  padding: 4px 8px;
+  border-bottom: 1px solid var(--border);
+  font-family: var(--mono);
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.set__logrow:last-child {
+  border-bottom: 0;
+}
+.set__logrow--warn {
+  color: var(--st-pending);
+}
+.set__logrow--error {
+  color: var(--st-rejected);
+}
+.set__logtime,
+.set__logscope {
+  opacity: 0.75;
+}
+.set__logevent {
+  color: var(--text);
+}
+.set__logrow--warn .set__logevent,
+.set__logrow--error .set__logevent {
+  color: inherit;
+}
+.set__logdetail {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.set__datahead {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  gap: 12px;
+  margin-bottom: 12px;
+}
+.set__doc {
+  margin-top: 6px;
+}
+.set__docHead {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  width: 100%;
+  font: inherit;
+  font-size: 12px;
+  text-align: left;
+  padding: 6px 8px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: none;
+  color: var(--text);
+  cursor: pointer;
+}
+.set__docHead:hover {
+  background: var(--border-2);
+}
+.set__docToggle {
+  flex: none;
+  color: var(--text-dim);
+}
+.set__docName {
+  flex: 1;
+  min-width: 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  font-family: var(--mono);
+}
+.set__docMeta {
+  flex: none;
+  color: var(--text-dim);
+}
+.set__foot {
+  display: flex;
+  justify-content: flex-end;
+  padding: 10px 16px;
+  border-top: 1px solid var(--border);
+}
+.dash__jump {
+  display: flex;
+  gap: 10px;
+  margin-bottom: 8px;
+}
+.dash__jump-input {
+  flex: 1;
+  font: inherit;
+  padding: 9px 12px;
+  border-radius: 8px;
+  border: 1px solid var(--border-strong);
+  background: var(--input-bg);
+  color: var(--text);
+}
+.dash__jump-input:focus {
+  border-color: var(--accent);
+  box-shadow: 0 0 0 3px var(--accent-bg);
+}
+.dash__error {
+  margin: 8px 0 0;
+  padding: 9px 11px;
+  border-radius: 6px;
+  background: var(--danger-surface);
+  border: 1px solid var(--danger-border);
+  color: var(--danger-fg);
+  font-size: 12px;
+  word-break: break-word;
+}
+/* Browser-extension promo banner */
+.connban {
+  display: flex;
+  align-items: center;
+  gap: 12px;
+  margin-top: 10px;
+  padding: 10px 12px;
+  border-radius: 8px;
+  border: 1px solid var(--danger-border);
+  background: var(--danger-surface);
+}
+.connban__icon {
+  font-size: 20px;
+  line-height: 1;
+  flex: none;
+}
+.connban__text {
+  display: flex;
+  flex-direction: column;
+  gap: 2px;
+  min-width: 0;
+  flex: 1;
+}
+.connban__title {
+  font-size: 13px;
+  color: var(--danger-fg);
+}
+.connban__sub {
+  font-size: 12px;
+  color: var(--muted);
+}
+.connban__cta,
+.connban__retry {
+  flex: none;
+  text-decoration: none;
+}
+
+.dash__grid {
+  display: grid;
+  grid-template-columns: repeat(2, minmax(0, 1fr));
+  gap: 16px;
+  margin-top: 18px;
+  align-items: start;
+}
+.dash__empty {
+  margin: 0;
+  padding: 10px 4px;
+  color: var(--text-dim);
+  font-size: 12px;
+}
+.dash-section--wide {
+  grid-column: 1 / -1;
+}
+.dash__empty--err {
+  color: var(--danger-fg);
+}
+
+@media (max-width: 720px) {
+  .dash__grid {
+    grid-template-columns: 1fr;
+  }
+}
+
+/* Sections */
+.dash-section {
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-radius: 10px;
+  overflow: hidden;
+}
+.dash-section__head {
+  width: 100%;
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  padding: 11px 14px;
+  background: none;
+  border: none;
+  border-bottom: 1px solid var(--border-2);
+  color: var(--text-bright);
+  font: inherit;
+  font-size: 13px;
+  font-weight: 600;
+  cursor: pointer;
+  text-align: left;
+}
+.dash-section__head:hover {
+  background: var(--panel-2);
+}
+.dash-section__caret {
+  color: var(--text-dim);
+  font-size: 11px;
+  flex: none;
+  width: 10px;
+}
+.dash-section__icon {
+  flex: none;
+}
+.dash-section__title {
+  flex: 1;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.dash-section__count {
+  flex: none;
+  min-width: 20px;
+  text-align: center;
+  padding: 1px 7px;
+  border-radius: 999px;
+  background: var(--panel-2);
+  border: 1px solid var(--border-2);
+  color: var(--text-dim);
+  font-size: 11px;
+  font-weight: 600;
+}
+.dash-section__body {
+  padding: 8px 10px 10px;
+}
+.dash-section__foot {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  margin-top: 8px;
+  padding-top: 8px;
+  border-top: 1px solid var(--border-2);
+}
+.dash-section__footnote {
+  color: var(--text-dim);
+  font-size: 11px;
+}
+
+/* PR rows */
+.prlist {
+  list-style: none;
+  margin: 0;
+  padding: 0;
+  display: flex;
+  flex-direction: column;
+  gap: 2px;
+}
+.prrow {
+  display: flex;
+  align-items: stretch;
+  gap: 2px;
+  border-radius: 6px;
+}
+.prrow:hover {
+  background: var(--panel-2);
+}
+.prrow__flag {
+  flex: none;
+  width: 30px;
+  border: none;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  font-size: 15px;
+  line-height: 1;
+  border-radius: 6px;
+}
+.prrow__flag:hover {
+  color: var(--st-pending);
+}
+.prrow__flag--on {
+  color: var(--st-pending);
+}
+.prrow__main {
+  flex: 1;
+  min-width: 0;
+  display: flex;
+  flex-direction: column;
+  gap: 3px;
+  padding: 7px 6px;
+  border: none;
+  background: none;
+  color: var(--text);
+  cursor: pointer;
+  font: inherit;
+  text-align: left;
+}
+.prrow__toprow {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  flex-wrap: wrap;
+}
+.prrow__repo {
+  color: var(--text-dim);
+  font-size: 11px;
+  font-family: var(--mono);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  max-width: 60%;
+}
+.prrow__num {
+  color: var(--accent);
+  font-size: 11px;
+  font-family: var(--mono);
+  flex: none;
+}
+.prrow__chip {
+  flex: none;
+  font-size: 11px;
+  padding: 1px 6px;
+  border-radius: 999px;
+  border: 1px solid var(--border-2);
+  color: var(--text-dim);
+  text-transform: uppercase;
+  letter-spacing: 0.03em;
+}
+/* The draft chip was a no-op — same dim grey as every other chip. Give it the
+   badge fill so the dashboard says "draft" as loudly as the topbar does. */
+.prrow__chip--draft {
+  background: var(--draft);
+  border-color: var(--draft);
+  color: var(--on-emphasis);
+}
+.prrow__chip--review {
+  color: var(--st-active);
+  border-color: var(--accent-border);
+  background: var(--accent-bg);
+}
+.prrow__title {
+  color: var(--text-bright);
+  font-size: 13px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.prrow__meta {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  color: var(--text-dim);
+  font-size: 11px;
+}
+.prrow__author {
+  display: inline-flex;
+  align-items: center;
+  gap: 5px;
+}
+.prrow__time {
+  flex: none;
+}
+.prrow__dismiss {
+  flex: none;
+  width: 30px;
+  border: none;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  font-size: 12px;
+  border-radius: 6px;
+}
+.prrow__dismiss:hover {
+  color: var(--del);
+}
+
+/* Pinned repos */
+.pinadd {
+  display: flex;
+  gap: 8px;
+  margin-bottom: 8px;
+}
+.pinadd__input {
+  flex: 1;
+  min-width: 0;
+  font: inherit;
+  font-size: 12px;
+  padding: 6px 10px;
+  border-radius: 6px;
+  border: 1px solid var(--border-strong);
+  background: var(--input-bg);
+  color: var(--text);
+}
+.pinadd__input:focus {
+  border-color: var(--accent);
+  box-shadow: 0 0 0 3px var(--accent-bg);
+}
+.repolist {
+  list-style: none;
+  margin: 0;
+  padding: 0;
+  display: flex;
+  flex-direction: column;
+  gap: 2px;
+}
+.repoitem__row {
+  display: flex;
+  align-items: center;
+  gap: 2px;
+  border-radius: 6px;
+}
+.repoitem__row:hover {
+  background: var(--panel-2);
+}
+.repoitem__name {
+  flex: 1;
+  min-width: 0;
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  padding: 7px 8px;
+  border: none;
+  background: none;
+  color: var(--text);
+  cursor: pointer;
+  font: inherit;
+  font-size: 12px;
+  text-align: left;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.repoitem__caret {
+  color: var(--text-dim);
+  font-size: 11px;
+  flex: none;
+}
+.repoitem__unpin {
+  flex: none;
+  width: 30px;
+  border: none;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  font-size: 12px;
+  border-radius: 6px;
+}
+.repoitem__unpin:hover {
+  color: var(--del);
+}
+.repoitem__prs {
+  padding: 2px 0 6px 18px;
+  border-left: 1px solid var(--border-2);
+  margin-left: 12px;
+}
+.repoitem__filters {
+  display: flex;
+  gap: 6px;
+  padding: 6px 0;
+}
+.repoitem__filters [aria-pressed='true'] {
+  color: var(--accent);
+  border-color: var(--accent-border);
+  background: var(--accent-bg);
+}
+
+/* ------------------------------ App shell -------------------------- */
+.app {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  overflow: hidden;
+}
+
+/* ------------------------------ Top bar ---------------------------- */
+.topbar {
+  border-bottom: 1px solid var(--border);
+  background: var(--panel);
+  flex: none;
+}
+.topbar__main {
+  display: flex;
+  align-items: flex-start;
+  gap: 12px;
+  padding: 10px 14px 8px;
+}
+.topbar__back {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  padding: 8px 12px 8px 8px;
+  flex: none;
+  border-radius: 6px;
+  border: 1px solid var(--border-strong);
+  background: var(--panel-2);
+  color: var(--accent);
+  font-size: 16px;
+  cursor: pointer;
+  align-self: center;
+}
+.topbar__back-label {
+  font-size: 12px;
+  font-weight: 600;
+  color: var(--text-dim);
+  white-space: nowrap;
+}
+.topbar__back:hover {
+  background: var(--hover);
+}
+.topbar__back:hover .topbar__back-label {
+  color: var(--text-1);
+}
+.topbar__titlewrap {
+  /* `flex: 1` makes this element the header's leftover space, so anything that
+     grows to its right (the reviewer row) can squeeze it to zero and force
+     `.topbar__sub` to wrap into a tall stack. The floor keeps the metadata on
+     one line and pushes the pressure onto the reviewer row instead. */
+  min-width: 240px;
+  flex: 1;
+}
+.topbar__titlerow {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  min-width: 0;
+}
+.topbar__title {
+  margin: 0;
+  font-size: 15px;
+  font-weight: 600;
+  color: var(--text-bright);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.topbar__num {
+  color: var(--text-dim);
+  font-size: 12px;
+  font-family: var(--mono);
+  flex: none;
+}
+.topbar__sub {
+  display: flex;
+  align-items: center;
+  gap: 14px;
+  margin-top: 5px;
+  font-size: 12px;
+  color: var(--text-dim);
+  flex-wrap: wrap;
+}
+.topbar__author {
+  display: inline-flex;
+  align-items: center;
+  gap: 5px;
+  color: var(--text);
+}
+.topbar__branches code {
+  background: var(--panel-2);
+  border: 1px solid var(--border-2);
+  border-radius: 4px;
+  padding: 1px 5px;
+  font-size: 11px;
+  color: var(--text);
+}
+.topbar__link {
+  color: var(--accent);
+  text-decoration: none;
+}
+.topbar__link:hover {
+  text-decoration: underline;
+}
+.topbar__backend {
+  margin-left: auto;
+  display: inline-flex;
+  align-items: center;
+  gap: 4px;
+  padding: 1px 7px;
+  border: 1px solid var(--st-pending);
+  border-radius: 999px;
+  background: var(--warn-surface);
+  color: var(--st-pending);
+}
+
+/* Checks: the topbar pill and the dialog behind it */
+.checks-pill {
+  font: inherit;
+  font-size: 12px;
+  display: inline-flex;
+  align-items: center;
+  gap: 4px;
+  padding: 1px 8px;
+  border: 1px solid var(--border-2);
+  border-radius: 999px;
+  background: var(--panel-2);
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.checks-pill:hover {
+  background: var(--border-2);
+}
+.checks-pill--loading {
+  cursor: default;
+}
+.checks-pill__count {
+  font-weight: 600;
+  /* Keeps the pill from twitching as the count climbs. */
+  font-variant-numeric: tabular-nums;
+}
+.checks-pill--passing {
+  border-color: var(--success-border);
+  color: var(--st-resolved);
+}
+.checks-pill--pending {
+  border-color: var(--warn-border);
+  color: var(--st-pending);
+}
+.checks-pill--failing {
+  border-color: var(--danger-border);
+  color: var(--st-rejected);
+}
+
+.checks-dialog {
+  display: flex;
+  flex-direction: column;
+  width: min(620px, 100%);
+  max-height: min(680px, 100%);
+  border: 1px solid var(--border);
+  border-radius: 10px;
+  background: var(--panel);
+  box-shadow: var(--shadow-lg);
+}
+.checks-dialog__hint {
+  margin: 0;
+  padding: 10px 16px;
+  font-size: 12px;
+  color: var(--st-pending);
+  background: var(--warn-surface);
+  border-bottom: 1px solid var(--warn-border);
+}
+.checks-dialog__requirements {
+  margin: 0;
+  padding: 10px 16px;
+  font-size: 12px;
+  color: var(--text-dim);
+  border-bottom: 1px solid var(--border-2);
+}
+.checks-dialog__list {
+  flex: 1 1 auto;
+  margin: 0;
+  padding: 0;
+  list-style: none;
+  overflow: auto;
+}
+.checks-dialog__row {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  padding: 8px 16px;
+  border-bottom: 1px solid var(--border-2);
+}
+.checks-dialog__row:last-child {
+  border-bottom: 0;
+}
+.checks-dialog__icon {
+  flex: none;
+  width: 16px;
+  text-align: center;
+  font-size: 12px;
+}
+.checks-dialog__row--success .checks-dialog__icon {
+  color: var(--st-resolved);
+}
+.checks-dialog__row--failure .checks-dialog__icon {
+  color: var(--st-rejected);
+}
+.checks-dialog__row--pending .checks-dialog__icon {
+  color: var(--st-pending);
+}
+.checks-dialog__row--neutral .checks-dialog__icon {
+  color: var(--st-wontfix);
+}
+.checks-dialog__body {
+  display: flex;
+  flex-direction: column;
+  gap: 2px;
+  flex: 1 1 auto;
+  min-width: 0;
+}
+.checks-dialog__name {
+  font-size: 12px;
+  color: var(--text);
+}
+.checks-dialog__requirement {
+  display: inline-block;
+  padding: 1px 5px;
+  border: 1px solid var(--border-2);
+  border-radius: 4px;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.checks-dialog__requirement--required {
+  font-weight: 600;
+  color: var(--text);
+}
+.checks-dialog__desc {
+  font-size: 11px;
+  color: var(--text-dim);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.checks-dialog__action {
+  flex: none;
+  font-size: 11px;
+  color: var(--accent);
+  text-decoration: none;
+}
+.checks-dialog__action:hover {
+  text-decoration: underline;
+}
+.checks-dialog__action--prove {
+  font-weight: 600;
+}
+.checks-dialog__foot {
+  display: flex;
+  justify-content: flex-end;
+  padding: 10px 16px;
+  border-top: 1px solid var(--border);
+}
+
+/* Reviewer badges */
+.topbar__reviewers {
+  display: flex;
+  gap: 8px;
+  align-items: center;
+  margin-left: 12px;
+  /* Stay one row high: the list is capped at MAX_VISIBLE_REVIEWERS badges plus
+     a "+N" toggle, and shrinks rather than pushing the title block out. Only
+     the expanded state is allowed to wrap, because the reviewer asked for it. */
+  flex: 0 1 auto;
+  min-width: 0;
+  flex-wrap: nowrap;
+  overflow: hidden;
+}
+.topbar__reviewers--expanded {
+  flex-wrap: wrap;
+  overflow: visible;
+}
+.reviewer {
+  display: inline-flex;
+  align-items: center;
+  gap: 4px;
+  padding: 2px 8px;
+  border-radius: 12px;
+  font-size: 12px;
+  background: var(--panel);
+  border: 1px solid var(--border);
+  flex: none;
+}
+.reviewer--more {
+  color: var(--text-dim);
+  border-color: var(--border-strong);
+  font: inherit;
+  font-size: 12px;
+  cursor: pointer;
+  white-space: nowrap;
+}
+.reviewer--more:hover {
+  background: var(--hover);
+  color: var(--text-1);
+}
+.reviewer__icon {
+  font-size: 11px;
+}
+.reviewer__name {
+  max-width: 100px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.reviewer--approved {
+  border-color: var(--success);
+  color: var(--add);
+}
+.reviewer--rejected {
+  border-color: var(--danger);
+  color: var(--del);
+}
+.reviewer--commented {
+  border-color: var(--st-pending);
+  color: var(--st-pending);
+}
+.reviewer--dismissed {
+  border-color: var(--reviewer-dismissed-border);
+  color: var(--text-dim);
+  opacity: 0.6;
+}
+.reviewer--pending {
+  border-color: var(--st-pending);
+  color: var(--st-pending);
+}
+
+/* Review action buttons */
+.topbar__review {
+  display: flex;
+  gap: 6px;
+  align-items: center;
+  margin-left: 12px;
+  flex: none;
+  position: relative;
+}
+.topbar__account {
+  display: flex;
+  gap: 6px;
+  align-items: center;
+  margin-left: 10px;
+  padding-left: 10px;
+  border-left: 1px solid var(--border-strong);
+  flex: none;
+}
+.topbar__me {
+  display: inline-flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 12px;
+  color: var(--text-dim);
+  white-space: nowrap;
+}
+.topbar__refresh {
+  font: inherit;
+  font-size: 12px;
+  font-variant-numeric: tabular-nums;
+  flex: none;
+  min-width: 58px;
+  height: 26px;
+  padding: 0 8px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  white-space: nowrap;
+}
+.topbar__refresh:hover:not(:disabled) {
+  background: var(--border-2);
+}
+.topbar__refresh:disabled {
+  cursor: default;
+  opacity: 0.6;
+}
+.btn--approve {
+  background: var(--success);
+  color: var(--on-emphasis);
+  border: none;
+}
+.btn--approve:hover:not(:disabled) {
+  background: var(--success-hover);
+}
+.btn--wait {
+  background: var(--warn);
+  color: var(--on-emphasis);
+  border: none;
+}
+.btn--wait:hover:not(:disabled) {
+  background: var(--warn-hover);
+}
+.btn--reject {
+  background: var(--danger);
+  color: var(--on-emphasis);
+  border: none;
+}
+.btn--reject:hover:not(:disabled) {
+  background: var(--danger-hover);
+}
+/* Publishing is the author's own housekeeping, not a review verdict, so it
+   stays an outlined button and leaves the solid fills to approve/wait/reject. */
+.btn--publish {
+  border-color: var(--accent-border);
+  color: var(--accent);
+}
+.btn--publish:hover:not(:disabled) {
+  border-color: var(--accent);
+}
+.btn--approve:disabled,
+.btn--wait:disabled,
+.btn--publish:disabled,
+.btn--reject:disabled {
+  opacity: 0.5;
+  cursor: not-allowed;
+}
+.topbar__review-toast {
+  font-size: 12px;
+  padding: 3px 10px;
+  border-radius: 4px;
+  animation: toast-in 0.2s ease;
+}
+.topbar__review-toast--success {
+  background: var(--success);
+  color: var(--on-emphasis);
+}
+.topbar__review-toast--error {
+  background: var(--danger);
+  color: var(--on-emphasis);
+}
+@keyframes toast-in {
+  from { opacity: 0; transform: translateY(-4px); }
+  to { opacity: 1; transform: translateY(0); }
+}
+
+/* Review body prompt */
+.review-prompt {
+  position: absolute;
+  top: 100%;
+  right: 0;
+  margin-top: 4px;
+  background: var(--bg);
+  border: 1px solid var(--border);
+  border-radius: 8px;
+  padding: 10px;
+  z-index: 100;
+  min-width: 300px;
+  box-shadow: var(--shadow-sm);
+}
+.review-prompt__input {
+  width: 100%;
+  min-height: 60px;
+  background: var(--input-bg);
+  border: 1px solid var(--border-strong);
+  border-radius: 4px;
+  color: var(--text);
+  padding: 8px;
+  font-size: 13px;
+  resize: vertical;
+  font-family: inherit;
+}
+.review-prompt__input:focus {
+  border-color: var(--accent);
+}
+.review-prompt__actions {
+  display: flex;
+  gap: 6px;
+  margin-top: 8px;
+  justify-content: flex-end;
+}
+
+/* Merge — author-only, and the one action in here that can't be undone. */
+.btn--merge {
+  background: var(--merged);
+  color: var(--on-emphasis);
+  border: none;
+}
+.btn--merge:hover:not(:disabled) {
+  filter: brightness(1.12);
+}
+.btn--merge:disabled {
+  opacity: 0.5;
+  cursor: not-allowed;
+}
+.merge-prompt {
+  position: absolute;
+  top: 100%;
+  right: 0;
+  margin-top: 4px;
+  background: var(--bg);
+  border: 1px solid var(--border);
+  border-radius: 8px;
+  padding: 12px;
+  z-index: 100;
+  min-width: 320px;
+  box-shadow: var(--shadow-sm);
+  text-align: left;
+}
+.merge-prompt__lead {
+  margin: 0 0 10px;
+  font-size: 13px;
+  color: var(--text);
+}
+.merge-prompt__warning {
+  margin: 0 0 10px;
+  padding: 6px 8px;
+  border-radius: 6px;
+  background: var(--warn);
+  color: var(--on-emphasis);
+  font-size: 12px;
+  line-height: 1.4;
+}
+.merge-prompt__methods {
+  display: flex;
+  flex-direction: column;
+  gap: 6px;
+}
+.merge-prompt__method {
+  display: grid;
+  grid-template-columns: auto 1fr;
+  align-items: baseline;
+  gap: 2px 8px;
+  cursor: pointer;
+}
+.merge-prompt__method-label {
+  font-size: 13px;
+  color: var(--text);
+}
+.merge-prompt__method-hint {
+  grid-column: 2;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.merge-prompt__note {
+  margin: 10px 0 0;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.merge-prompt__actions {
+  display: flex;
+  gap: 6px;
+  margin-top: 10px;
+  justify-content: flex-end;
+}
+
+/* Auto-merge — the same commitment as merging, made in advance. Outlined
+   while it is off so it reads as an option rather than a verdict, and filled
+   once it is armed, because "something will happen without me" is a state the
+   author should be able to spot from across the topbar. */
+.btn--automerge {
+  border-color: var(--merged);
+  color: var(--merged);
+}
+.btn--automerge:hover:not(:disabled) {
+  border-color: var(--merged);
+  filter: brightness(1.12);
+}
+.btn--automerge:disabled {
+  opacity: 0.5;
+  cursor: not-allowed;
+}
+.btn--automerge-on {
+  background: var(--merged);
+  color: var(--on-emphasis);
+  border-color: var(--merged);
+}
+.btn--automerge-go {
+  background: var(--merged);
+  color: var(--on-emphasis);
+  border: none;
+}
+.btn--automerge-go:hover:not(:disabled) {
+  filter: brightness(1.12);
+}
+
+/* Cherry-pick — writes a new branch, so it is offered to everyone, not just
+   the author, and nothing it does touches the pull request on screen. */
+.btn--cherry {
+  background: var(--accent);
+  color: var(--on-emphasis);
+  border: none;
+}
+.btn--cherry:hover:not(:disabled) {
+  filter: brightness(1.12);
+}
+.btn--cherry:disabled {
+  opacity: 0.5;
+  cursor: not-allowed;
+}
+.cherry-prompt,
+.cherry-result {
+  position: absolute;
+  top: 100%;
+  right: 0;
+  margin-top: 4px;
+  background: var(--bg);
+  border: 1px solid var(--border);
+  border-radius: 8px;
+  padding: 12px;
+  z-index: 100;
+  min-width: 340px;
+  max-width: 460px;
+  box-shadow: var(--shadow-sm);
+  text-align: left;
+}
+.cherry-prompt__lead {
+  margin: 0 0 10px;
+  font-size: 13px;
+  color: var(--text);
+}
+.cherry-prompt__field {
+  display: block;
+  margin-bottom: 8px;
+}
+.cherry-prompt__label {
+  display: block;
+  font-size: 11px;
+  color: var(--text-dim);
+  margin-bottom: 3px;
+}
+.cherry-prompt__input {
+  width: 100%;
+  background: var(--input-bg);
+  border: 1px solid var(--border-strong);
+  border-radius: 4px;
+  color: var(--text);
+  padding: 5px 7px;
+  font-size: 13px;
+  font-family: inherit;
+}
+.cherry-prompt__input:focus {
+  border-color: var(--accent);
+}
+.cherry-prompt__check {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 12px;
+  color: var(--text);
+  cursor: pointer;
+}
+.cherry-prompt__note {
+  margin: 8px 0 0;
+  font-size: 11px;
+  color: var(--text-dim);
+  line-height: 1.4;
+}
+.cherry-prompt__note--merge {
+  padding: 6px 8px;
+  border-radius: 6px;
+  border: 1px solid var(--border);
+  background: var(--bg-3);
+}
+.cherry-prompt__error {
+  margin: 8px 0 0;
+  padding: 6px 8px;
+  border-radius: 6px;
+  background: var(--danger);
+  color: var(--on-emphasis);
+  font-size: 12px;
+  line-height: 1.4;
+  /* A refusal lists the files that blocked it, one per line. */
+  white-space: pre-line;
+  max-height: 180px;
+  overflow-y: auto;
+}
+.cherry-prompt__actions {
+  display: flex;
+  gap: 6px;
+  margin-top: 10px;
+  justify-content: flex-end;
+}
+.cherry-result__lead {
+  margin: 0 0 6px;
+  font-size: 13px;
+  color: var(--text);
+}
+.cherry-result__detail {
+  margin: 0;
+  font-size: 12px;
+  color: var(--text-dim);
+}
+
+.pr-state {
+  font-size: 11px;
+  font-weight: 600;
+  padding: 2px 9px;
+  border-radius: 999px;
+  color: var(--on-emphasis);
+  flex: none;
+}
+.pr-state--open {
+  background: var(--success);
+}
+.pr-state--closed {
+  background: var(--danger);
+}
+.pr-state--merged {
+  background: var(--merged);
+}
+/* Grey, not green: a draft is not open for review, and the chip is the only
+   thing on the topbar that says so. */
+.pr-state--draft {
+  background: var(--draft);
+}
+
+/* --------------------------- Iteration bar ------------------------- */
+.iterbar {
+  display: flex;
+  align-items: center;
+  gap: 12px;
+  padding: 7px 14px;
+  border-top: 1px solid var(--border-2);
+  background: var(--panel-2);
+  flex-wrap: wrap;
+}
+.iterbar__count {
+  font-size: 12px;
+  color: var(--text-dim);
+  font-variant-numeric: tabular-nums;
+}
+/* "N new since your last review" — a pill that also jumps to that range. */
+.iterbar__since {
+  border: 1px solid var(--accent-border);
+  border-radius: 999px;
+  background: var(--accent-bg);
+  color: var(--accent);
+  padding: 2px 10px;
+  font: inherit;
+  font-size: 12px;
+  line-height: 1.5;
+  cursor: pointer;
+  white-space: nowrap;
+  font-variant-numeric: tabular-nums;
+}
+.iterbar__since:hover {
+  border-color: var(--accent);
+  color: var(--text-bright);
+}
+.iterbar__compare {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.iterbar__vs {
+  color: var(--text-dim);
+}
+.iterbar__loading {
+  font-size: 12px;
+  color: var(--accent);
+}
+.iterbar__detail {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  flex: 1;
+  min-width: 0;
+  font-size: 12px;
+  color: var(--text-dim);
+  padding-left: 12px;
+  border-left: 1px solid var(--border-2);
+}
+.iterbar__detail-idx {
+  font-family: var(--mono);
+  color: var(--text-dim);
+}
+.iterbar__detail-msg {
+  flex: 0 1 auto;
+  min-width: 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  color: var(--text);
+}
+.iterbar__detail-time {
+  white-space: nowrap;
+  font-variant-numeric: tabular-nums;
+}
+/* Force-push notice: wraps onto its own row so the full sentence stays legible. */
+.iterbar__warning {
+  flex-basis: 100%;
+  display: flex;
+  align-items: baseline;
+  gap: 6px;
+  font-size: 12px;
+  line-height: 1.5;
+  color: var(--st-pending);
+}
+.iterbar__warning-icon {
+  flex: none;
+}
+.iterbar__warning-text {
+  min-width: 0;
+}
+.iterbar__warning-link {
+  flex: none;
+  color: var(--accent);
+  text-decoration: none;
+  white-space: nowrap;
+}
+.iterbar__warning-link:hover {
+  text-decoration: underline;
+}
+
+/* Iteration picker: compact trigger + scrollable popover. */
+.iterpick {
+  position: relative;
+}
+.iterpick__trigger {
+  display: inline-flex;
+  align-items: center;
+  gap: 6px;
+  height: 26px;
+  padding: 0 8px;
+  border-radius: 5px;
+  border: 1px solid var(--border-strong);
+  background: var(--panel);
+  color: var(--text);
+  font: inherit;
+  font-size: 12px;
+  cursor: pointer;
+}
+.iterpick__trigger:hover {
+  border-color: var(--text-dim);
+}
+.iterpick__caret {
+  color: var(--text-dim);
+  font-size: 11px;
+}
+.iterpick__menu {
+  position: absolute;
+  top: calc(100% + 4px);
+  left: 0;
+  z-index: 30;
+  min-width: 300px;
+  max-width: 440px;
+  max-height: 320px;
+  overflow-y: auto;
+  margin: 0;
+  padding: 4px;
+  list-style: none;
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  box-shadow: var(--shadow-md);
+}
+.iterpick__opt {
+  display: grid;
+  grid-template-columns: auto 1fr auto;
+  align-items: center;
+  gap: 8px;
+  width: 100%;
+  padding: 5px 8px;
+  border: none;
+  border-radius: 4px;
+  background: transparent;
+  color: var(--text);
+  font: inherit;
+  font-size: 12px;
+  text-align: left;
+  cursor: pointer;
+}
+.iterpick__opt:hover {
+  background: var(--accent-bg);
+}
+.iterpick__opt--active {
+  background: var(--accent-bg);
+  color: var(--text-bright);
+}
+.iterpick__opt-idx {
+  display: inline-flex;
+  align-items: center;
+  gap: 4px;
+  font-family: var(--mono);
+  color: var(--text-dim);
+  min-width: 34px;
+}
+.iterpick__opt--active .iterpick__opt-idx {
+  color: var(--accent);
+}
+.iterpick__approved {
+  color: var(--green);
+  font-weight: 700;
+}
+.iterpick__opt-msg {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.iterpick__opt-time {
+  color: var(--text-dim);
+  white-space: nowrap;
+  font-variant-numeric: tabular-nums;
+}
+
+/* ------------------------------ Workarea --------------------------- */
+.workarea {
+  flex: 1;
+  display: flex;
+  min-height: 0;
+}
+.workarea__side {
+  width: 320px;
+  flex: none;
+  border-right: 1px solid var(--border);
+  background: var(--panel-2);
+  display: flex;
+  flex-direction: column;
+  min-height: 0;
+}
+.workarea__center {
+  flex: 1;
+  min-width: 0;
+  overflow: auto;
+  background: var(--bg);
+  position: relative;
+}
+.workarea__resizer {
+  flex: none;
+  width: 6px;
+  margin-left: -3px;
+  margin-right: -3px;
+  cursor: col-resize;
+  background: transparent;
+  position: relative;
+  z-index: 3;
+  touch-action: none;
+}
+.workarea__resizer::after {
+  content: '';
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 50%;
+  width: 2px;
+  transform: translateX(-50%);
+  background: transparent;
+  transition: background 0.12s ease;
+}
+.workarea__resizer:hover::after,
+.workarea__resizer:active::after {
+  background: var(--accent);
+}
+/* Collapsed file explorer: a rail just wide enough to get the panel back. */
+.workarea__rail {
+  flex: none;
+  width: 24px;
+  border-right: 1px solid var(--border);
+  background: var(--panel-2);
+  display: flex;
+  flex-direction: column;
+}
+.workarea__rail-btn {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  gap: 8px;
+  padding: 8px 0;
+  border: none;
+  background: transparent;
+  color: var(--text-dim);
+  cursor: pointer;
+  font: inherit;
+  font-size: 11px;
+}
+.workarea__rail-btn:hover {
+  background: var(--panel);
+  color: var(--text);
+}
+.workarea__rail-label {
+  writing-mode: vertical-rl;
+  letter-spacing: 0.08em;
+}
+
+/* ------------------------------ File list -------------------------- */
+.filelist {
+  display: flex;
+  flex-direction: column;
+  min-height: 0;
+  height: 100%;
+}
+.filelist__toolbar {
+  padding: 8px;
+  border-bottom: 1px solid var(--border-2);
+  display: flex;
+  align-items: center;
+  gap: 6px;
+}
+.filelist__heading {
+  display: flex;
+  align-items: center;
+  gap: 12px;
+  padding: 8px 10px 0;
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.filelist__heading > span {
+  flex: 1;
+}
+.filelist__heading .linkbtn:disabled {
+  color: var(--text-dim);
+  cursor: default;
+  text-decoration: none;
+}
+.filelist__collapse {
+  flex: none;
+  border: 1px solid var(--border-strong);
+  background: var(--input-bg);
+  color: var(--text-dim);
+  border-radius: 6px;
+  padding: 5px 8px;
+  font: inherit;
+  font-size: 12px;
+  line-height: 1;
+  cursor: pointer;
+}
+.filelist__collapse:hover {
+  color: var(--text);
+  border-color: var(--accent);
+}
+.filelist__filter {
+  flex: 1;
+  min-width: 0;
+  width: 100%;
+  font: inherit;
+  font-size: 12px;
+  padding: 6px 9px;
+  border-radius: 6px;
+  border: 1px solid var(--border-strong);
+  background: var(--input-bg);
+  color: var(--text);
+}
+.filelist__filter:focus {
+  border-color: var(--accent);
+}
+.filelist__invert {
+  flex: none;
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.filelist__meta {
+  display: flex;
+  flex-wrap: wrap;
+  align-items: center;
+  justify-content: space-between;
+  gap: 4px 8px;
+  padding: 6px 10px;
+  font-size: 11px;
+  color: var(--text-dim);
+  border-bottom: 1px solid var(--border-2);
+}
+.filelist__meta-actions {
+  display: flex;
+  flex-wrap: wrap;
+  align-items: center;
+  gap: 8px;
+}
+.filelist__meta-actions .linkbtn:disabled {
+  color: var(--text-dim);
+  cursor: default;
+  text-decoration: none;
+}
+.filelist__check {
+  display: inline-flex;
+  align-items: center;
+  gap: 4px;
+  cursor: pointer;
+}
+.filelist__items {
+  list-style: none;
+  margin: 0;
+  padding: 4px;
+  overflow: auto;
+  flex: 1;
+}
+.filelist__empty {
+  padding: 16px;
+  color: var(--text-dim);
+  font-size: 12px;
+  text-align: center;
+}
+.ffolder {
+  display: flex;
+  align-items: center;
+  gap: 4px;
+  padding: 4px 8px;
+  cursor: pointer;
+  user-select: none;
+  font-size: 12px;
+  color: var(--text-dim);
+  border-radius: 4px;
+}
+.ffolder:hover {
+  background: var(--panel);
+  color: var(--text);
+}
+.ffolder__chevron {
+  flex: none;
+  font-size: 11px;
+  transition: transform 0.15s ease;
+  transform: rotate(90deg);
+}
+.ffolder__chevron--collapsed {
+  transform: rotate(0deg);
+}
+.ffolder__icon {
+  flex: none;
+  font-size: 13px;
+}
+.ffolder__name {
+  flex: 1;
+  min-width: 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  font-family: var(--mono);
+}
+.ffolder__threads {
+  flex: none;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.ffolder__seen {
+  flex: none;
+  cursor: pointer;
+  accent-color: var(--add);
+}
+.ffolder--seen .ffolder__name {
+  color: var(--add);
+  opacity: 0.75;
+}
+.ffolder--selected {
+  background: var(--accent-bg);
+}
+.ffolder--selected:hover {
+  background: var(--accent-bg);
+}
+.frow {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  border-radius: 6px;
+}
+.frow:hover {
+  background: var(--panel);
+}
+.frow--selected {
+  background: var(--accent-bg);
+}
+.frow--selected:hover {
+  background: var(--accent-bg);
+}
+.frow--seen .frow__name {
+  color: var(--add);
+  opacity: 0.75;
+}
+.frow--seen .frow__seen {
+  accent-color: var(--add);
+}
+.frow__seen {
+  flex: none;
+  cursor: pointer;
+  accent-color: var(--accent);
+}
+.frow__main {
+  flex: 1;
+  min-width: 0;
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  background: none;
+  border: none;
+  color: var(--text);
+  cursor: pointer;
+  font: inherit;
+  text-align: left;
+  padding: 6px 8px 6px 2px;
+}
+.filecompare {
+  width: calc(100vw - 48px);
+  max-width: 1600px;
+  height: calc(100vh - 48px);
+  max-height: 100vh;
+  margin: auto;
+  padding: 0;
+  border: 1px solid var(--border);
+  border-radius: 8px;
+  background: var(--bg);
+  color: var(--text);
+  font: inherit;
+}
+.filecompare[open] {
+  display: flex;
+  flex-direction: column;
+}
+.filecompare::backdrop {
+  background: var(--overlay);
+}
+.filecompare--picker {
+  max-width: 720px;
+  height: fit-content;
+  max-height: calc(100vh - 48px);
+  padding-bottom: 12px;
+}
+.filecompare__picker {
+  display: flex;
+  flex-direction: column;
+  gap: 20px;
+  padding: 20px;
+  overflow: auto;
+}
+.filecompare__picker p {
+  margin: 0;
+  color: var(--text-dim);
+  font-size: 13px;
+}
+.filecompare__picker label {
+  display: flex;
+  flex-direction: column;
+  gap: 8px;
+  font-size: 13px;
+}
+.filecompare__picker select {
+  width: 100%;
+  min-width: 0;
+  padding: 8px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--input-bg);
+  color: var(--text);
+  font: inherit;
+}
+.filecompare__picker-actions {
+  display: flex;
+  justify-content: flex-end;
+  gap: 8px;
+}
+.filecompare__header {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  gap: 8px;
+  padding: 12px;
+  border-bottom: 1px solid var(--border);
+}
+.filecompare__header h2 {
+  flex: 1;
+  margin: 0;
+  font-size: 16px;
+}
+.filecompare__paths {
+  display: grid;
+  grid-template-columns: repeat(2, minmax(0, 1fr));
+  gap: 16px;
+  padding: 12px;
+  font-family: var(--mono);
+  font-size: 12px;
+  overflow-wrap: anywhere;
+}
+.filecompare__paths span {
+  color: var(--text-dim);
+}
+.filecompare__notice {
+  margin: 0;
+  padding: 6px 12px;
+  color: var(--text-dim);
+  font-size: 12px;
+}
+.filecompare__notice[role="alert"] {
+  color: var(--del);
+}
+.filecompare__body {
+  flex: 1;
+  min-height: 0;
+  overflow: auto;
+}
+.fstat {
+  flex: none;
+  width: 16px;
+  height: 16px;
+  border-radius: 3px;
+  font-size: 11px;
+  font-weight: 700;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-family: var(--mono);
+}
+.fstat--added {
+  background: var(--fstat-add-bg);
+  color: var(--add);
+}
+.fstat--removed {
+  background: var(--fstat-del-bg);
+  color: var(--del);
+}
+.fstat--modified {
+  background: var(--fstat-mod-bg);
+  color: var(--fstat-mod-fg);
+}
+.fstat--renamed {
+  background: var(--fstat-ren-bg);
+  color: var(--accent);
+}
+.frow__name {
+  flex: 1;
+  min-width: 0;
+  font-size: 12px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  text-align: left;
+}
+.frow__base {
+  color: var(--text);
+}
+.frow__counts {
+  flex: none;
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 11px;
+  font-family: var(--mono);
+}
+.frow__threads {
+  color: var(--text-dim);
+}
+/* Shares the rename accent with .diff__moved so the same fact reads the same
+   way in the list and in the diff. */
+.frow__moved {
+  padding: 0 5px;
+  border-radius: 9px;
+  background: var(--fstat-ren-bg);
+  color: var(--accent);
+  font-size: 11px;
+  white-space: nowrap;
+}
+.frow__add {
+  color: var(--add);
+}
+.frow__del {
+  color: var(--del);
+}
+
+/* Description pseudo-file row in file list */
+.frow--description {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  padding: 6px 12px;
+  border-radius: 6px;
+  cursor: pointer;
+  font-weight: 500;
+  border-bottom: 1px solid var(--border);
+  margin-bottom: 4px;
+}
+.frow--description:hover {
+  background: var(--panel);
+}
+.frow--description.frow--selected {
+  background: var(--accent-bg);
+}
+.frow__desc-icon {
+  font-size: 14px;
+}
+.frow__desc-label {
+  flex: 1;
+}
+
+/* Description view in center panel */
+.diff--description {
+  padding: 0;
+}
+.description__body {
+  padding: 20px 24px;
+  border-bottom: 1px solid var(--border);
+}
+.description__title {
+  font-size: 18px;
+  margin: 0 0 12px;
+  color: var(--text);
+}
+.description__text {
+  word-wrap: break-word;
+  font-size: 13px;
+  margin: 0;
+  color: var(--text-dim);
+}
+.description__empty {
+  color: var(--text-dim);
+  font-style: italic;
+}
+.description__threads {
+  padding: 16px 24px;
+}
+.description__threads-heading {
+  font-size: 14px;
+  font-weight: 600;
+  margin: 0 0 12px;
+  color: var(--text-dim);
+}
+
+/* ------------------------------- Diff ------------------------------ */
+.diff {
+  display: flex;
+  flex-direction: column;
+  min-height: 100%;
+}
+.diff--empty {
+  align-items: center;
+  justify-content: center;
+  color: var(--text-dim);
+  padding: 60px;
+}
+.diff__header {
+  position: sticky;
+  top: 0;
+  z-index: 2;
+  display: flex;
+  align-items: center;
+  gap: 14px;
+  padding: 8px 14px;
+  background: var(--panel);
+  border-bottom: 1px solid var(--border);
+}
+.diff__filename {
+  font-family: var(--mono);
+  font-size: 12px;
+  color: var(--text-bright);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  flex: 1 1 auto;
+  min-width: 40px;
+}
+/* Clip the *start* of the path so the file name stays visible, letting the
+   header controls win the space fight. */
+.diff__filename--elide-left {
+  direction: rtl;
+  text-align: left;
+}
+.diff__filename--elide-left > bdi {
+  direction: ltr;
+  unicode-bidi: bidi-override;
+}
+/* A move is the one change that looks like nothing: the diff is empty, the
+   counts are +0/−0 and the basename is unchanged. Every place that calls one
+   out borrows the rename accent, so a moved file is recognisable at a glance
+   whether it is spotted in the file list, the sticky header or the banner. */
+.diff__moved {
+  flex: none;
+  margin: 0 6px;
+  padding: 1px 6px;
+  border-radius: 10px;
+  background: var(--fstat-ren-bg);
+  color: var(--accent);
+  font-size: 11px;
+  white-space: nowrap;
+  cursor: help;
+}
+.diff__counts {
+  display: flex;
+  gap: 8px;
+  font-family: var(--mono);
+  font-size: 12px;
+  flex: none;
+}
+.diff__viewtoggle {
+  margin-left: auto;
+  display: flex;
+  gap: 4px;
+  flex: none;
+}
+/* Each toggle names the state it's in, so the labels must not wrap. */
+.diff__viewtoggle .btn {
+  white-space: nowrap;
+}
+.diff__zoom {
+  display: flex;
+  align-items: center;
+  gap: 2px;
+  flex: none;
+}
+.diff__zoom-btn {
+  width: 24px;
+  padding: 4px 0;
+  text-align: center;
+  font-weight: 600;
+}
+.diff__zoom-label {
+  min-width: 40px;
+  padding: 4px 4px;
+  text-align: center;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.diff__blocknav {
+  display: flex;
+  align-items: center;
+  gap: 2px;
+  flex: none;
+}
+.diff__blocknav-btn {
+  width: 24px;
+  padding: 4px 0;
+  text-align: center;
+  font-weight: 600;
+}
+.diff__blocknav-count {
+  min-width: 42px;
+  padding: 0 2px;
+  text-align: center;
+  font-family: var(--mono);
+  font-size: 11px;
+  color: var(--text-dim);
+  font-variant-numeric: tabular-nums;
+}
+
+/* ---- In-file find widget (VSCode-style) ---- */
+.diff__topbar {
+  position: sticky;
+  top: 0;
+  z-index: 3;
+}
+.diff__search {
+  position: absolute;
+  top: calc(100% + 6px);
+  right: 16px;
+  z-index: 5;
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  padding: 4px 6px;
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  box-shadow: var(--shadow-md);
+}
+.diff__search-field {
+  display: flex;
+  align-items: center;
+  gap: 4px;
+  padding: 2px 4px;
+  background: var(--input-bg);
+  border: 1px solid var(--border-strong);
+  border-radius: 4px;
+}
+.diff__search-field--error {
+  border-color: var(--del);
+}
+/* The input fills the field, so the ring goes on the wrapper — otherwise it
+   would be drawn inside the border and read as a second box. */
+.diff__search-field:has(:focus-visible) {
+  outline: 2px solid var(--accent);
+  outline-offset: 1px;
+}
+.diff__search-input:focus-visible {
+  outline: none;
+}
+.diff__search-input {
+  width: 200px;
+  padding: 2px 4px;
+  background: transparent;
+  border: none;
+  color: var(--text-bright);
+  font-family: var(--mono);
+  font-size: 12px;
+}
+.diff__search-input::placeholder {
+  color: var(--text-dim);
+}
+.diff__search-toggles {
+  display: flex;
+  align-items: center;
+  gap: 2px;
+}
+.diff__search-toggle {
+  min-width: 20px;
+  height: 20px;
+  padding: 0 3px;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  background: transparent;
+  border: 1px solid transparent;
+  border-radius: 3px;
+  color: var(--text-dim);
+  font-family: var(--mono);
+  font-size: 11px;
+  line-height: 1;
+  cursor: pointer;
+}
+.diff__search-toggle:hover {
+  background: var(--hover-subtle);
+  color: var(--text-bright);
+}
+.diff__search-toggle--active {
+  background: var(--accent-bg);
+  border-color: var(--accent);
+  color: var(--text-bright);
+}
+.diff__search-word {
+  text-decoration: underline;
+}
+.diff__search-count {
+  min-width: 62px;
+  text-align: right;
+  font-size: 11px;
+  color: var(--text-dim);
+  white-space: nowrap;
+}
+.diff__search-count--none {
+  color: var(--del);
+}
+.diff__search-nav {
+  display: flex;
+  align-items: center;
+  gap: 2px;
+}
+.diff__search-btn {
+  width: 22px;
+  height: 22px;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  background: transparent;
+  border: none;
+  border-radius: 3px;
+  color: var(--text-dim);
+  font-size: 12px;
+  cursor: pointer;
+}
+.diff__search-btn:hover:not(:disabled) {
+  background: var(--hover-subtle-2);
+  color: var(--text-bright);
+}
+.diff__search-btn:disabled {
+  opacity: 0.4;
+  cursor: default;
+}
+.diff__search-btn--close:hover {
+  color: var(--del);
+}
+
+/* Match highlights rendered inline in the diff code cells. */
+.diff__match {
+  background: var(--match-bg);
+  color: inherit;
+  border-radius: 2px;
+}
+.diff__match--active {
+  background: var(--match-active-bg);
+  color: var(--match-active-fg);
+}
+/* Word-level diff: changed tokens on add lines and del lines get a stronger
+   tint so reviewers can spot the exact change without scanning the whole line.
+   `color: inherit` ensures the code's own syntax colour is preserved. */
+.diff__line--add .diff__word-change {
+  background: var(--word-add-bg);
+  border-radius: 2px;
+  color: inherit;
+}
+.diff__line--del .diff__word-change {
+  background: var(--word-del-bg);
+  border-radius: 2px;
+  color: inherit;
+}
+/* Every other occurrence of the word you have selected. Fainter than a find hit
+   — this is ambient information nobody asked for — with a thin ring so it still
+   reads on top of an add or del line background. */
+.diff__selmatch {
+  background: var(--selmatch-bg);
+  color: inherit;
+  border-radius: 2px;
+  outline: 1px solid var(--selmatch-outline);
+  outline-offset: -1px;
+}
+.diff__nopatch {
+  padding: 30px;
+  color: var(--text-dim);
+  font-size: 13px;
+}
+/* Says out loud when the diff on screen is hiding whitespace-only changes,
+   because hiding them is the default and a silent omission would be worse than
+   the noise it removes. */
+.diff__wsnotice {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  padding: 7px 14px;
+  border-bottom: 1px solid var(--border);
+  background: var(--panel-2);
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.diff__wsnotice-icon {
+  flex: none;
+  font-size: 14px;
+  line-height: 1;
+  opacity: 0.7;
+}
+.diff__wsnotice-text {
+  flex: 1 1 auto;
+  min-width: 0;
+  line-height: 1.5;
+}
+.diff__wsnotice-text strong {
+  color: var(--text);
+}
+.diff__wsnotice-counts {
+  white-space: nowrap;
+  opacity: 0.8;
+}
+.diff__wsnotice-btn {
+  flex: none;
+}
+/* Same shape as the whitespace notice, but this one reports a failed jump, so
+   it borrows the warning colour rather than the muted panel text. */
+.diff__linenotice {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  padding: 7px 14px;
+  border-bottom: 1px solid var(--border);
+  background: var(--panel-2);
+  font-size: 12px;
+  color: var(--text);
+}
+.diff__linenotice-icon {
+  flex: none;
+  font-size: 14px;
+  line-height: 1;
+  color: var(--warn);
+}
+.diff__linenotice-text {
+  flex: 1 1 auto;
+  min-width: 0;
+  line-height: 1.5;
+}
+.diff__linenotice-btn {
+  flex: none;
+}
+/* Text for screen readers only — for the cases where a glyph carries meaning
+   that assistive tech would otherwise skip. */
+.u-sronly {
+  position: absolute;
+  width: 1px;
+  height: 1px;
+  margin: -1px;
+  padding: 0;
+  overflow: hidden;
+  clip-path: inset(50%);
+  white-space: nowrap;
+  border: 0;
+}
+/* Spells out a path change, because the diff underneath it cannot: a pure move
+   renders as an empty pane, which is indistinguishable from a file that failed
+   to load. Both paths are shown in full — where the file came from is the
+   entire change, and it is the part every truncated path elides. */
+.diff__renamenotice {
+  display: flex;
+  align-items: flex-start;
+  gap: 10px;
+  padding: 7px 14px;
+  border-bottom: 1px solid var(--border);
+  background: var(--panel-2);
+  font-size: 12px;
+  color: var(--text-dim);
+}
+.diff__renamenotice-icon {
+  flex: none;
+  font-size: 14px;
+  line-height: 1.3;
+  color: var(--accent);
+}
+.diff__renamenotice-text {
+  flex: 1 1 auto;
+  min-width: 0;
+  line-height: 1.5;
+}
+.diff__renamenotice-text strong {
+  color: var(--text);
+}
+.diff__renamenotice-paths {
+  display: flex;
+  flex-wrap: wrap;
+  align-items: baseline;
+  gap: 6px;
+  margin-top: 3px;
+  font-family: var(--mono);
+  font-size: 11px;
+  word-break: break-all;
+}
+.diff__renamenotice-path {
+  color: var(--text);
+}
+.diff__renamenotice-path--from {
+  color: var(--text-dim);
+  text-decoration: line-through;
+}
+.diff__renamenotice-arrow {
+  color: var(--accent);
+}
+/* The counts no longer match GitHub's once lines are folded away; dim them so
+   the difference reads as deliberate, and the tooltip carries the real totals. */
+.diff__counts--reduced {
+  opacity: 0.75;
+  cursor: help;
+}
+.diff__outdated {
+  margin-left: 12px;
+  font-size: 11px;
+  color: var(--text-dim);
+  font-style: italic;
+}
+.diff__orphaned {
+  border-top: 1px solid var(--border);
+  padding: 12px 16px;
+}
+.diff__orphaned-header {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  font-size: 12px;
+  color: var(--text-dim);
+  margin-bottom: 8px;
+}
+.diff__orphaned-icon {
+  font-size: 14px;
+}
+.diff__orphaned-thread {
+  display: flex;
+  align-items: flex-start;
+  gap: 8px;
+  margin-bottom: 4px;
+}
+.diff__orphaned-anchor {
+  flex: none;
+  font-family: var(--mono);
+  font-size: 11px;
+  color: var(--text-dim);
+  background: var(--panel);
+  padding: 2px 6px;
+  border-radius: 3px;
+  margin-top: 4px;
+}
+.collapsed-thread {
+  flex: 1;
+  min-width: 0;
+  width: 100%;
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  padding: 6px 10px;
+  cursor: pointer;
+  text-align: left;
+  color: var(--text);
+  font-size: 12px;
+}
+.collapsed-thread:hover {
+  border-color: var(--st-active);
+}
+.collapsed-thread__chevron {
+  flex: none;
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.collapsed-thread__count {
+  flex: none;
+  color: var(--text-dim);
+  font-size: 11px;
+}
+.collapsed-thread__preview {
+  flex: 1;
+  min-width: 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  color: var(--text-dim);
+}
+.collapsed-thread--description {
+  margin-bottom: 8px;
+}
+@keyframes thread-flash {
+  0% {
+    box-shadow: 0 0 0 2px var(--st-active), 0 0 12px 2px var(--flash-ring);
+  }
+  100% {
+    box-shadow: 0 0 0 0 transparent;
+  }
+}
+.thread--flash {
+  animation: thread-flash 1.5s ease-out;
+  border-radius: 8px;
+}
+
+@keyframes diff-row-flash {
+  0% {
+    background-color: var(--flash-row);
+  }
+  100% {
+    background-color: transparent;
+  }
+}
+.diff__line--flash > td {
+  animation: diff-row-flash 1.2s ease-out;
+}
+
+/* ---------- Change map (scrollbar minimap) ---------- */
+.diff__changemap {
+  position: fixed;
+  right: 14px;
+  width: 10px;
+  pointer-events: none;
+  z-index: 10;
+  background: var(--changemap-bg);
+  border-left: 1px solid var(--changemap-border);
+}
+.diff__changemap-mark {
+  position: absolute;
+  right: 0;
+  width: 100%;
+  min-height: 3px;
+  cursor: pointer;
+  border-radius: 1px;
+  pointer-events: auto;
+}
+.diff__changemap-mark--add {
+  background: var(--add);
+}
+.diff__changemap-mark--del {
+  background: var(--del);
+}
+.diff__changemap-mark:hover {
+  filter: brightness(1.4);
+  box-shadow: 0 0 3px currentColor;
+}
+.diff__table {
+  width: 100%;
+  border-collapse: collapse;
+  font-family: var(--code-font-family, var(--mono));
+  font-size: var(--diff-font-size, 12px);
+  line-height: 1.5;
+}
+.diff__gutter {
+  width: 1%;
+  min-width: 40px;
+  text-align: right;
+  padding: 0 8px;
+  color: var(--diff-lineno);
+  background: var(--panel-2);
+  user-select: none;
+  white-space: nowrap;
+  border-right: 1px solid var(--border-2);
+  vertical-align: top;
+}
+.diff__gutter--old,
+.diff__gutter--new {
+  position: relative;
+}
+.diff__lineno {
+  pointer-events: none;
+}
+/* Keep comment controls out of copied code and native range selections. */
+.diff__addcomment {
+  position: absolute;
+  left: 2px;
+  top: 0;
+  width: 16px;
+  height: 16px;
+  border-radius: 4px;
+  border: none;
+  background: var(--accent-fill);
+  color: var(--on-emphasis);
+  font-size: 12px;
+  line-height: 1;
+  cursor: pointer;
+  display: inline-flex;
+  opacity: 0;
+  align-items: center;
+  justify-content: center;
+  padding: 0;
+  user-select: none;
+}
+/* The visible chip is capped by the code line-height, so the *hit* area is
+   grown past it instead — 24×24 for WCAG 2.2 target size without pushing the
+   diff rows apart. */
+.diff__addcomment::before {
+  content: '';
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  width: 24px;
+  height: 24px;
+  transform: translate(-50%, -50%);
+}
+.diff__line:hover .diff__addcomment,
+.diff__splitrow:hover .diff__addcomment,
+.diff__addcomment:focus-visible {
+  opacity: 1;
+}
+.diff__line--comment-range {
+  outline: 1px solid var(--accent);
+  outline-offset: -1px;
+}
+.composer__range {
+  color: var(--text-dim);
+  font-size: 12px;
+  margin-bottom: 6px;
+}
+/* Thread badge indicators in the gutter for collapsed threads */
+.diff__badges {
+  position: absolute;
+  left: 0;
+  top: 0;
+  display: flex;
+  flex-direction: column;
+  gap: 1px;
+  z-index: 1;
+}
+.diff__gutter--old {
+  position: relative;
+}
+.diff__thread-badge {
+  display: inline-flex;
+  align-items: center;
+  gap: 2px;
+  border: none;
+  border-radius: 3px;
+  padding: 1px 5px;
+  height: 20px;
+  font-size: 11px;
+  font-weight: 600;
+  cursor: pointer;
+  white-space: nowrap;
+  line-height: 1;
+}
+.diff__thread-badge--active {
+  background: var(--st-active-fill);
+  color: var(--on-emphasis);
+}
+.diff__thread-badge--resolved {
+  background: var(--badge-resolved-bg);
+  color: var(--badge-resolved-fg);
+  border: 1px solid var(--badge-resolved-border);
+}
+.diff__thread-badge--closed {
+  background: var(--badge-closed-bg);
+  color: var(--badge-closed-fg);
+  border: 1px solid var(--badge-closed-border);
+}
+.diff__thread-badge:hover {
+  filter: brightness(1.15);
+  transform: scale(1.05);
+}
+.diff__marker {
+  width: 14px;
+  text-align: center;
+  user-select: none;
+  color: var(--text-dim);
+  vertical-align: top;
+}
+.diff__code {
+  white-space: pre-wrap;
+  word-break: break-word;
+  padding: 0 10px;
+  vertical-align: top;
+}
+.diff__line--add {
+  background: var(--diff-add-bg);
+}
+.diff__line--add .diff__gutter {
+  background: var(--diff-add-gutter-bg);
+  color: var(--diff-add-gutter-fg);
+}
+.diff__line--add .diff__marker--add {
+  color: var(--add);
+}
+.diff__line--del {
+  background: var(--diff-del-bg);
+}
+.diff__line--del .diff__gutter {
+  background: var(--diff-del-gutter-bg);
+  color: var(--diff-del-gutter-fg);
+}
+.diff__line--del .diff__marker--del {
+  color: var(--del);
+}
+.diff__line--empty {
+  background: var(--diff-empty-bg);
+}
+
+/* Syntax highlighting. `.diff--syntax` is on the diff root whenever the file's
+   language was recognised and the setting is on, so the whole switch is one
+   class and turning the feature off restores the original palette exactly. */
+.diff--syntax .diff__line--add {
+  background: var(--diff-add-bg-syntax);
+}
+.diff--syntax .diff__line--del {
+  background: var(--diff-del-bg-syntax);
+}
+
+/* Rendered Markdown preview. Deliberately laid out like the source view —
+   line numbers on the left, the same red/green wash — so switching between
+   the two feels like turning the same page over rather than opening a
+   different document. */
+.mdpreview {
+  padding: 8px 0 16px;
+}
+.mdpreview__block {
+  display: grid;
+  grid-template-columns: 76px minmax(0, 1fr);
+  gap: 12px;
+  padding: 4px 16px 4px 0;
+  border-left: 3px solid transparent;
+}
+.mdpreview__block--added {
+  background: var(--diff-add-bg);
+  border-left-color: var(--add);
+}
+.mdpreview__block--removed {
+  background: var(--diff-del-bg);
+  border-left-color: var(--del);
+}
+.mdpreview__block--changed {
+  border-left-color: var(--accent);
+}
+.mdpreview__gutter {
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: flex-end;
+  align-items: baseline;
+  gap: 6px;
+  padding-top: 2px;
+  font-family: var(--mono);
+  font-size: 11px;
+  line-height: 1.5;
+  color: var(--text-dim);
+  user-select: none;
+}
+.mdpreview__add {
+  color: var(--add);
+}
+.mdpreview__del {
+  color: var(--del);
+}
+.mdpreview__body {
+  min-width: 0;
+}
+/* The two halves of a rewrite are stacked, so each needs its own wash to be
+   told apart; the block itself stays neutral rather than picking a side. */
+.mdpreview__side {
+  padding: 2px 8px;
+  border-radius: 4px;
+}
+.mdpreview__side--old {
+  background: var(--diff-del-bg);
+  margin-bottom: 4px;
+}
+.mdpreview__block--unchanged .mdpreview__side--old {
+  background: none;
+}
+.mdpreview__block--changed .mdpreview__side--new {
+  background: var(--diff-add-bg);
+}
+.mdpreview__comment {
+  display: block;
+  margin-left: auto;
+  padding: 4px 8px;
+  border: 1px solid var(--border);
+  border-radius: 4px;
+  background: var(--panel-2);
+  color: var(--text-dim);
+  font-size: 12px;
+  cursor: pointer;
+}
+.mdpreview__comment:hover,
+.mdpreview__comment:focus-visible {
+  color: var(--accent);
+  border-color: var(--accent);
+}
+.mdpreview__composer {
+  padding: 8px 16px 12px;
+}
+.mdpreview__gap {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  margin: 10px 0;
+  padding: 2px 16px;
+  border-top: 1px dashed var(--border);
+  font-family: var(--mono);
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.mdpreview__gap-label {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.tok--variable {
+  color: var(--tok-variable);
+}
+.tok--property {
+  color: var(--tok-property);
+}
+.tok--constant {
+  color: var(--tok-constant);
+}
+.tok--number {
+  color: var(--tok-number);
+}
+.tok--string {
+  color: var(--tok-string);
+}
+.tok--regexp {
+  color: var(--tok-regexp);
+}
+.tok--comment {
+  color: var(--tok-comment);
+  font-style: italic;
+}
+.tok--keyword {
+  color: var(--tok-keyword);
+}
+.tok--operator {
+  color: var(--tok-operator);
+}
+.tok--type {
+  color: var(--tok-type);
+}
+.tok--function {
+  color: var(--tok-function);
+}
+.tok--tag {
+  color: var(--tok-tag);
+}
+.tok--attr {
+  color: var(--tok-attr);
+}
+/* The active find hit is the one place a solid fill is painted behind code, and
+   a token colour on top of it can land anywhere from invisible to illegible.
+   Inside that one span, syntax colour gives way. */
+.diff__match--active .tok {
+  color: inherit;
+}
+.diff__hunkrow .diff__hunkhead {
+  background: var(--accent-bg);
+  color: var(--text-dim);
+  padding: 2px 10px;
+  font-size: 11px;
+}
+.diff__metarow .diff__meta {
+  color: var(--text-dim);
+  padding: 0 10px;
+  font-style: italic;
+}
+
+/* Split view */
+.diff__split-wrap {
+  position: relative;
+}
+.diff__table--split .diff__half {
+  border-right: none;
+  position: relative;
+  overflow: hidden;
+}
+.diff__table--split .diff__half--left {
+  border-right: none;
+}
+.diff__col-gutter {
+  width: 40px;
+}
+.diff__col-splitter {
+  width: 0;
+}
+.diff__splitter-col {
+  width: 0;
+  padding: 0;
+  border-left: 1px solid var(--border);
+}
+.diff__splitter-handle {
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  width: 7px;
+  transform: translateX(-3px);
+  cursor: col-resize;
+  z-index: 3;
+  background: transparent;
+}
+.diff__splitter-handle:hover,
+.diff__splitter-handle:active {
+  background: var(--accent);
+  opacity: 0.4;
+}
+.diff__splitrow .diff__addcomment {
+  left: 2px;
+}
+
+/* Inline comment extras row */
+.diff__extra {
+  background: var(--panel-2);
+  padding: 8px 14px 10px 48px;
+  border-top: 1px solid var(--border-2);
+  border-bottom: 1px solid var(--border-2);
+}
+
+/* ----------------------- Folder combined diff view ---------------------- */
+.diff--folder {
+  /* No own scroll container: let .workarea__center scroll so the per-file
+     sticky headers pin to the real viewport and push/replace each other. */
+  padding: 0;
+}
+.folder-file {
+  border-bottom: 2px solid var(--border);
+}
+.folder-file__header {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  padding: 10px 16px;
+  background: var(--panel-2);
+  border-top: 1px dashed var(--border);
+  border-bottom: 1px dashed var(--border);
+  cursor: pointer;
+  user-select: none;
+  position: sticky;
+  top: 0;
+  z-index: 2;
+}
+.folder-file__header:hover {
+  background: var(--panel);
+}
+.folder-file__name {
+  font-weight: 600;
+  font-size: 13px;
+  font-family: var(--mono);
+  color: var(--text);
+}
+.folder-file__stat {
+  font-weight: 400;
+  margin-left: 8px;
+}
+.folder-file__path {
+  flex: 1;
+  min-width: 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  font-size: 11px;
+  color: var(--text-dim);
+  font-family: var(--mono);
+}
+.folder-file__view {
+  flex: none;
+}
+
+/* ----------------------------- Threads ----------------------------- */
+.thread {
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-left: 3px solid var(--st-active);
+  border-radius: 6px;
+  margin: 6px 0;
+  font-family: ui-sans-serif, system-ui, sans-serif;
+  max-width: 760px;
+}
+.thread--resolved {
+  border-left-color: var(--st-resolved);
+}
+.thread--pending {
+  border-left-color: var(--st-pending);
+}
+.thread--wontfix {
+  border-left-color: var(--st-wontfix);
+}
+.thread--closed {
+  border-left-color: var(--st-closed);
+}
+.thread__head {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  padding: 6px 10px;
+  border-bottom: 1px solid var(--border-2);
+  cursor: default;
+  user-select: none;
+}
+.thread__head--collapsible {
+  cursor: pointer;
+}
+.thread--collapsed .thread__head {
+  border-bottom: none;
+}
+.thread__head-author {
+  font-size: 11px;
+  color: var(--text-dim);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  min-width: 0;
+}
+.thread__chevron {
+  font-size: 11px;
+  color: var(--text-dim);
+  transition: transform 0.15s ease;
+  flex-shrink: 0;
+}
+.thread__chevron--open {
+  transform: rotate(90deg);
+}
+.thread__preview {
+  font-size: 12px;
+  color: var(--text-dim);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  min-width: 0;
+  flex: 1;
+}
+.thread__preview-author {
+  font-weight: 600;
+  color: var(--text-1);
+}
+.thread__preview-text {
+  opacity: 0.8;
+}
+.thread__preview-count {
+  margin-left: 6px;
+  font-size: 11px;
+  background: var(--bg-3);
+  padding: 1px 5px;
+  border-radius: 999px;
+}
+.thread__status {
+  font-size: 11px;
+  font-weight: 700;
+  text-transform: uppercase;
+  letter-spacing: 0.03em;
+  padding: 2px 7px;
+  border-radius: 999px;
+  color: var(--on-emphasis);
+}
+.thread__status--active {
+  background: var(--st-active-fill);
+}
+.thread__status--pending {
+  background: var(--st-pending-fill);
+}
+.thread__status--resolved {
+  background: var(--st-resolved-fill);
+}
+.thread__status--wontfix {
+  background: var(--st-wontfix-fill);
+}
+.thread__status--closed {
+  background: var(--st-closed-fill);
+}
+.thread__anchor {
+  font-family: var(--mono);
+  font-size: 11px;
+  color: var(--text-dim);
+}
+.thread__head-actions {
+  margin-left: auto;
+  display: flex;
+  align-items: center;
+  gap: 6px;
+}
+.thread__statussel {
+  font: inherit;
+  font-size: 11px;
+  background: var(--input-bg);
+  color: var(--text);
+  border: 1px solid var(--border-strong);
+  border-radius: 5px;
+  padding: 2px 4px;
+}
+/* Local "closed" review flag: dim the thread + a subtle close/reopen button. */
+.thread--closed {
+  opacity: 0.72;
+}
+.thread--closed:hover,
+.thread--closed:focus-within {
+  opacity: 1;
+}
+.thread__closebtn {
+  background: transparent;
+  border: 1px solid var(--border-strong);
+  color: var(--text-dim);
+}
+.thread__closebtn:hover {
+  color: var(--text);
+  border-color: var(--st-closed);
+}
+.thread__closebtn--reopen {
+  color: var(--st-closed);
+  border-color: var(--st-closed);
+}
+.thread__comments {
+  list-style: none;
+  margin: 0;
+  padding: 6px 10px;
+}
+.comment {
+  display: flex;
+  gap: 8px;
+  padding: 6px 0;
+}
+.comment + .comment {
+  border-top: 1px solid var(--border-2);
+}
+.comment__body {
+  flex: 1;
+  min-width: 0;
+}
+.comment__meta {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  font-size: 11px;
+}
+.comment__author {
+  font-weight: 600;
+  color: var(--text-bright);
+}
+.comment__time {
+  color: var(--text-dim);
+}
+.comment__local {
+  font-size: 11px;
+  color: var(--text-dim);
+  border: 1px solid var(--border);
+  border-radius: 4px;
+  padding: 0 4px;
+}
+.comment__text {
+  margin-top: 2px;
+  font-size: 13px;
+  word-break: break-word;
+}
+/* Pushed to the end of the meta row so it doesn't sit between the author and
+   the timestamp, which read as one phrase. */
+.comment__edit {
+  margin-left: auto;
+  color: var(--text-dim);
+}
+.comment__edit:hover {
+  color: var(--accent);
+}
+.comment__delete {
+  color: var(--text-dim);
+}
+.comment__delete:hover:not(:disabled),
+.comment__delete-confirm .btn--danger {
+  color: var(--danger-fg);
+}
+.comment__delete-confirm {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  gap: 8px;
+  margin: 8px 0;
+}
+.comment__editor {
+  margin-top: 4px;
+}
+
+/* Markdown body styles */
+.markdown-body {
+  line-height: 1.5;
+}
+.markdown-body p {
+  margin: 0 0 8px;
+}
+.markdown-body p:last-child {
+  margin-bottom: 0;
+}
+.markdown-body ul,
+.markdown-body ol {
+  margin: 4px 0 8px;
+  padding-left: 20px;
+}
+.markdown-body li {
+  margin: 2px 0;
+}
+.markdown-body li input[type="checkbox"] {
+  margin-right: 6px;
+}
+.markdown-body a {
+  color: var(--accent);
+  text-decoration: none;
+}
+.markdown-body a:hover {
+  text-decoration: underline;
+}
+.markdown-body code {
+  background: var(--bg-2);
+  border: 1px solid var(--border);
+  border-radius: 4px;
+  padding: 1px 4px;
+  font-size: 0.9em;
+  font-family: var(--code-font-family, monospace);
+}
+.markdown-body pre {
+  background: var(--bg-2);
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  padding: 10px 12px;
+  margin: 8px 0;
+  overflow-x: auto;
+}
+.markdown-body pre code {
+  background: none;
+  border: none;
+  padding: 0;
+  font-size: 12px;
+}
+.markdown-body blockquote {
+  border-left: 3px solid var(--border);
+  margin: 8px 0;
+  padding: 2px 12px;
+  color: var(--fg-muted);
+}
+.markdown-body h1, .markdown-body h2, .markdown-body h3,
+.markdown-body h4, .markdown-body h5, .markdown-body h6 {
+  margin: 12px 0 4px;
+  font-weight: 600;
+}
+.markdown-body h1 { font-size: 1.3em; }
+.markdown-body h2 { font-size: 1.2em; }
+.markdown-body h3 { font-size: 1.1em; }
+.markdown-body img {
+  max-width: 100%;
+  border-radius: 4px;
+}
+.markdown-body hr {
+  border: none;
+  border-top: 1px solid var(--border);
+  margin: 12px 0;
+}
+.markdown-body table {
+  border-collapse: collapse;
+  margin: 8px 0;
+  font-size: 12px;
+}
+.markdown-body th, .markdown-body td {
+  border: 1px solid var(--border);
+  padding: 4px 8px;
+}
+.markdown-body th {
+  background: var(--bg-2);
+}
+
+/* Suggestion block (GitHub-style suggested change) */
+.suggestion-block {
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  margin: 8px 0;
+  overflow: hidden;
+}
+.suggestion-block__header {
+  padding: 6px 12px;
+  font-size: 12px;
+  color: var(--fg-muted);
+  background: var(--bg-2);
+  border-bottom: 1px solid var(--border);
+}
+.suggestion-block__diff {
+  width: 100%;
+  border-collapse: collapse;
+  font-family: var(--code-font-family, monospace);
+  font-size: 12px;
+  table-layout: fixed;
+}
+.suggestion-block__line--del {
+  background: var(--suggest-del-bg);
+}
+.suggestion-block__line--add {
+  background: var(--suggest-add-bg);
+}
+.suggestion-block__lineno {
+  width: 40px;
+  padding: 2px 8px;
+  text-align: right;
+  color: var(--fg-muted);
+  user-select: none;
+}
+.suggestion-block__marker {
+  width: 20px;
+  padding: 2px 4px;
+  text-align: center;
+  user-select: none;
+  color: var(--fg-muted);
+}
+.suggestion-block__line--del .suggestion-block__marker {
+  color: var(--del);
+}
+.suggestion-block__line--add .suggestion-block__marker {
+  color: var(--add);
+}
+.suggestion-block__code {
+  padding: 2px 8px;
+  white-space: pre-wrap;
+  word-break: break-all;
+  overflow-wrap: break-word;
+}
+.thread__reply,
+.composer {
+  padding: 8px 10px;
+  border-top: 1px solid var(--border-2);
+}
+.composer {
+  border-top: none;
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  margin: 6px 0;
+  max-width: 760px;
+}
+.thread__input {
+  width: 100%;
+  font: inherit;
+  font-size: 13px;
+  padding: 7px 9px;
+  border-radius: 6px;
+  border: 1px solid var(--border-strong);
+  background: var(--input-bg);
+  color: var(--text);
+  resize: vertical;
+}
+.thread__input:focus {
+  border-color: var(--accent);
+}
+.thread__reply-actions,
+.composer__actions {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  margin-top: 6px;
+}
+.composer__hint {
+  color: var(--text-dim);
+  font-size: 11px;
+}
+
+.composer__error {
+  margin-top: 6px;
+  padding: 6px 8px;
+  border: 1px solid var(--danger-border);
+  border-radius: 6px;
+  background: var(--danger-surface);
+  color: var(--danger-fg);
+  font-size: 12px;
+  line-height: 1.4;
+  overflow-wrap: anywhere;
+}
+
+/* ----------------------------- Markdown Editor ----------------------------- */
+.md-editor {
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  overflow: hidden;
+}
+.md-editor__toolbar {
+  display: flex;
+  align-items: center;
+  gap: 4px;
+  padding: 4px 8px;
+  background: var(--panel);
+  border-bottom: 1px solid var(--border);
+  flex-wrap: wrap;
+}
+.md-editor__tabs {
+  display: flex;
+  gap: 2px;
+  margin-right: 12px;
+}
+.md-editor__tab {
+  all: unset;
+  cursor: pointer;
+  padding: 3px 10px;
+  font-size: 12px;
+  font-weight: 500;
+  color: var(--text-dim);
+  border-radius: 4px;
+}
+.md-editor__tab:hover {
+  color: var(--text);
+  background: var(--hover);
+}
+.md-editor__tab--active {
+  color: var(--text);
+  border-bottom: 2px solid var(--accent);
+}
+.md-editor__actions {
+  display: flex;
+  gap: 1px;
+  align-items: center;
+}
+.md-editor__btn {
+  all: unset;
+  cursor: pointer;
+  padding: 3px 7px;
+  font-size: 13px;
+  font-weight: 600;
+  color: var(--text-dim);
+  border-radius: 4px;
+  line-height: 1;
+}
+.md-editor__btn:hover {
+  color: var(--text);
+  background: var(--hover);
+}
+.md-editor__btn--suggestion {
+  border-left: 1px solid var(--border);
+  margin-left: 6px;
+  padding-left: 10px;
+  color: var(--green);
+}
+.md-editor__textarea {
+  border: none;
+  border-radius: 0;
+}
+.md-editor__textarea:focus {
+  border-color: transparent;
+}
+/* Same reasoning as the diff search field: the textarea is edge-to-edge inside
+   the editor shell, so the shell carries the ring. */
+.md-editor:has(.md-editor__textarea:focus-visible) {
+  outline: 2px solid var(--accent);
+  outline-offset: 1px;
+}
+.md-editor__textarea:focus-visible {
+  outline: none;
+}
+.md-editor__preview {
+  padding: 8px 12px;
+  min-height: 60px;
+  font-size: 13px;
+  color: var(--text);
+}
+.md-editor__empty {
+  color: var(--text-dim);
+  font-style: italic;
+  margin: 0;
+}
+
+/* @mention autocomplete */
+.md-editor-wrap {
+  position: relative;
+}
+.md-mention {
+  position: absolute;
+  top: 100%;
+  left: 0;
+  right: 0;
+  z-index: 30;
+  margin: 2px 0 0;
+  padding: 4px;
+  list-style: none;
+  max-height: 220px;
+  overflow-y: auto;
+  background: var(--panel);
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  box-shadow: var(--shadow-lg);
+}
+.md-mention__item {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  padding: 5px 8px;
+  border-radius: 4px;
+  cursor: pointer;
+  font-size: 13px;
+  color: var(--text);
+}
+.md-mention__item--active {
+  background: var(--accent-bg);
+}
+.md-mention__login {
+  font-weight: 600;
+}
+.md-mention__name {
+  color: var(--text-dim);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+/* --------------------------- Comment summary ----------------------- */
+.bottompanel {
+  flex: none;
+  height: 240px;
+  border-top: 1px solid var(--border);
+  background: var(--panel);
+  display: flex;
+  flex-direction: column;
+  min-height: 0;
+}
+.bottompanel--collapsed {
+  height: auto;
+}
+/* Drag handle on the summary's top edge — the panel grows upwards from it. */
+.bottompanel__resizer {
+  flex: none;
+  height: 6px;
+  margin-top: -3px;
+  margin-bottom: -3px;
+  cursor: row-resize;
+  background: transparent;
+  position: relative;
+  z-index: 3;
+  touch-action: none;
+}
+.bottompanel__resizer::after {
+  content: '';
+  position: absolute;
+  left: 0;
+  right: 0;
+  top: 50%;
+  height: 2px;
+  transform: translateY(-50%);
+  background: transparent;
+  transition: background 0.12s ease;
+}
+.bottompanel__resizer:hover::after,
+.bottompanel__resizer:focus-visible::after,
+.bottompanel__resizer:active::after {
+  background: var(--accent);
+}
+.bottompanel__tabs {
+  display: flex;
+  flex: none;
+  background: var(--panel-2);
+  border-bottom: 1px solid var(--border-2);
+}
+.bottompanel__toggle {
+  text-align: left;
+  background: none;
+  border: none;
+  border-bottom: 2px solid transparent;
+  color: var(--text-dim);
+  font: inherit;
+  font-size: 12px;
+  font-weight: 600;
+  padding: 7px 14px;
+  cursor: pointer;
+  flex: none;
+}
+.bottompanel__toggle:hover {
+  color: var(--text);
+  background: var(--hover-subtle);
+}
+.bottompanel__toggle--active {
+  color: var(--text);
+  border-bottom-color: var(--accent);
+}
+
+/* ------------------------- Search in files ------------------------- */
+.results {
+  display: flex;
+  flex-direction: column;
+  min-height: 0;
+  flex: 1;
+}
+.results__bar {
+  display: flex;
+  align-items: center;
+  gap: 14px;
+  padding: 7px 14px;
+  border-bottom: 1px solid var(--border-2);
+  flex-wrap: wrap;
+}
+.results__title {
+  font-size: 12px;
+  font-weight: 600;
+  color: var(--text-bright);
+}
+.results__field {
+  display: flex;
+  align-items: center;
+  gap: 4px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--input-bg);
+  padding: 0 4px 0 0;
+  flex: 1 1 260px;
+  max-width: 520px;
+}
+.results__field--error {
+  border-color: var(--danger);
+}
+/* The input fills the field, so the ring goes on the wrapper — otherwise it
+   would be drawn inside the border and read as a second box. */
+.results__field:has(:focus-visible) {
+  outline: 2px solid var(--accent);
+  outline-offset: 1px;
+}
+.results__input:focus-visible {
+  outline: none;
+}
+.results__input {
+  font: inherit;
+  font-size: 12px;
+  padding: 4px 9px;
+  border: 0;
+  background: none;
+  color: var(--text);
+  flex: 1;
+  min-width: 0;
+}
+.results__toggles {
+  display: inline-flex;
+  gap: 2px;
+}
+.results__toggle {
+  font: inherit;
+  font-size: 11px;
+  line-height: 1;
+  min-width: 22px;
+  padding: 3px 4px;
+  border: 0;
+  border-radius: 4px;
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.results__toggle:hover {
+  background: var(--hover-subtle);
+  color: var(--text);
+}
+.results__toggle--active {
+  background: var(--accent-bg);
+  color: var(--accent);
+}
+.results__word {
+  text-decoration: underline;
+}
+.results__count {
+  font-size: 11px;
+  color: var(--text-dim);
+  font-family: var(--mono);
+  margin-left: auto;
+}
+.results__count--none {
+  color: var(--text-dim);
+  opacity: 0.8;
+}
+.results__listwrap {
+  overflow: auto;
+  flex: 1;
+  min-height: 0;
+}
+.results__empty {
+  padding: 24px;
+  text-align: center;
+  color: var(--text-dim);
+  font-size: 12px;
+}
+.results__empty--error {
+  color: var(--danger);
+  font-family: var(--mono);
+}
+.results__capped {
+  padding: 8px 14px;
+  font-size: 11px;
+  color: var(--text-dim);
+  border-top: 1px solid var(--border-2);
+}
+.results__files,
+.results__hits {
+  list-style: none;
+  margin: 0;
+  padding: 0;
+}
+.results__filename {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  padding: 5px 14px;
+  font-size: 11px;
+  font-weight: 600;
+  color: var(--text-dim);
+  background: var(--panel-2);
+  border-bottom: 1px solid var(--border-2);
+  position: sticky;
+  top: 0;
+  z-index: 1;
+}
+.results__filename--current {
+  color: var(--accent);
+}
+.results__path {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  direction: rtl;
+  text-align: left;
+}
+.results__filecount {
+  margin-left: auto;
+  font-family: var(--mono);
+  font-weight: 400;
+}
+.results__hit {
+  display: flex;
+  align-items: baseline;
+  gap: 8px;
+  width: 100%;
+  text-align: left;
+  border: 0;
+  background: none;
+  color: var(--text);
+  font: inherit;
+  font-family: var(--code-font-family, var(--mono));
+  font-size: 12px;
+  padding: 2px 14px;
+  cursor: pointer;
+  white-space: pre;
+  overflow: hidden;
+}
+.results__hit:hover {
+  background: var(--hover-subtle);
+}
+/* Keep after font shorthands, which reset ligature settings. */
+.diff__table,
+.markdown-body code,
+.suggestion-block__diff,
+.results__hit,
+.set__code-preview {
+  font-variant-ligatures: var(--code-font-ligatures, normal);
+  font-feature-settings: var(--code-font-features, normal);
+}
+.results__hit--current {
+  background: var(--accent-bg);
+}
+.results__hit--add .results__sigil {
+  color: var(--add);
+}
+.results__hit--del .results__sigil {
+  color: var(--del);
+}
+.results__lineno {
+  flex: none;
+  min-width: 44px;
+  text-align: right;
+  color: var(--text-dim);
+  font-size: 11px;
+}
+.results__sigil {
+  flex: none;
+  width: 1ch;
+  color: var(--text-dim);
+}
+.results__text {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  flex: 1;
+  min-width: 0;
+}
+.summary {
+  display: flex;
+  flex-direction: column;
+  min-height: 0;
+  flex: 1;
+}
+.summary__bar {
+  display: flex;
+  align-items: center;
+  gap: 14px;
+  padding: 7px 14px;
+  border-bottom: 1px solid var(--border-2);
+  flex-wrap: wrap;
+}
+.summary__title {
+  font-size: 12px;
+  font-weight: 600;
+  color: var(--text-bright);
+}
+.summary__total {
+  color: var(--text-dim);
+  font-weight: 400;
+}
+.summary__filters {
+  display: flex;
+  gap: 10px;
+  flex-wrap: wrap;
+}
+.summary__filter {
+  display: inline-flex;
+  align-items: center;
+  gap: 4px;
+  font-size: 11px;
+  color: var(--text-dim);
+  cursor: pointer;
+}
+.summary__filter input {
+  accent-color: var(--accent);
+}
+.summary__scopes {
+  display: inline-flex;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  overflow: hidden;
+}
+.summary__scope {
+  font: inherit;
+  font-size: 11px;
+  padding: 3px 10px;
+  border: 0;
+  border-right: 1px solid var(--border-2);
+  background: none;
+  color: var(--text-dim);
+  cursor: pointer;
+  white-space: nowrap;
+}
+.summary__scope:last-child {
+  border-right: 0;
+}
+.summary__scope:hover {
+  background: var(--hover-subtle);
+}
+.summary__scope--active {
+  background: var(--accent-bg);
+  color: var(--accent);
+}
+.summary__scope--active .summary__count {
+  color: inherit;
+}
+.summary__count {
+  color: var(--text-dim);
+  font-family: var(--mono);
+}
+.summary__author-trigger {
+  font: inherit;
+  font-size: 11px;
+  padding: 4px 9px;
+  border: 1px solid var(--border-strong);
+  border-radius: 6px;
+  background: var(--panel);
+  color: var(--text);
+  cursor: pointer;
+  white-space: nowrap;
+}
+.summary__author-trigger:hover {
+  border-color: var(--text-dim);
+}
+.summary__author-trigger--active {
+  background: var(--accent-bg);
+  color: var(--accent);
+}
+.summary__author-menu {
+  position: fixed;
+  z-index: 30;
+  width: 280px;
+  max-width: calc(100vw - 28px);
+  overflow-y: auto;
+  padding: 6px;
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  background: var(--panel);
+  box-shadow: var(--shadow-md);
+}
+.summary__author-actions {
+  display: flex;
+  gap: 6px;
+}
+.summary__author-help {
+  margin: 8px 4px;
+  color: var(--text-dim);
+  font-size: 11px;
+}
+.summary__author-option {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  padding: 5px 4px;
+  border-radius: 4px;
+  color: var(--text);
+  font-size: 12px;
+  overflow-wrap: anywhere;
+  cursor: pointer;
+}
+.summary__author-option:hover,
+.summary__author-option:focus-within {
+  background: var(--accent-bg);
+}
+.summary__author-option input {
+  flex: none;
+  accent-color: var(--accent);
+}
+.summary__author-login {
+  color: var(--text-dim);
+}
+.summary__search {
+  margin-left: auto;
+  font: inherit;
+  font-size: 12px;
+  padding: 4px 9px;
+  border-radius: 6px;
+  border: 1px solid var(--border-strong);
+  background: var(--input-bg);
+  color: var(--text);
+  min-width: 180px;
+}
+.summary__tablewrap {
+  overflow: auto;
+  flex: 1;
+  min-height: 0;
+}
+.summary__empty {
+  padding: 24px;
+  text-align: center;
+  color: var(--text-dim);
+  font-size: 12px;
+}
+.summary__loading {
+  animation: pulse 1.5s ease-in-out infinite;
+}
+.summary__total--loading {
+  animation: pulse 1.5s ease-in-out infinite;
+}
+@keyframes pulse {
+  0%, 100% { opacity: 1; }
+  50% { opacity: 0.4; }
+}
+.summary__table {
+  width: 100%;
+  border-collapse: collapse;
+  font-size: 12px;
+}
+.summary__table th {
+  text-align: left;
+  padding: 6px 12px;
+  color: var(--text-dim);
+  font-weight: 500;
+  font-size: 11px;
+  position: sticky;
+  top: 0;
+  background: var(--panel);
+  border-bottom: 1px solid var(--border-2);
+}
+.summary__sort {
+  font: inherit;
+  font-size: 11px;
+  font-weight: 500;
+  color: inherit;
+  background: none;
+  border: 0;
+  padding: 0;
+  cursor: pointer;
+  display: inline-flex;
+  align-items: center;
+  gap: 4px;
+  white-space: nowrap;
+}
+.summary__sort:hover {
+  color: var(--text-bright);
+}
+.summary__sort--active {
+  color: var(--text-bright);
+}
+.summary__sortarrow {
+  font-size: 11px;
+  line-height: 1;
+  opacity: 0.35;
+}
+.summary__sort:hover .summary__sortarrow,
+.summary__sort--active .summary__sortarrow {
+  opacity: 1;
+}
+.summary__row {
+  cursor: pointer;
+  border-bottom: 1px solid var(--border-2);
+}
+.summary__row:hover {
+  background: var(--panel-2);
+}
+.summary__row--current {
+  background: var(--accent-bg);
+}
+.summary__row--closed td {
+  opacity: 0.6;
+}
+.summary__row--closed:hover td {
+  opacity: 1;
+}
+.summary__actions {
+  text-align: right;
+  white-space: nowrap;
+}
+.summary__table td {
+  padding: 6px 12px;
+  vertical-align: top;
+}
+.summary__file {
+  font-family: var(--mono);
+  font-size: 11px;
+  color: var(--text);
+  max-width: 280px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  direction: rtl;
+  text-align: left;
+}
+.summary__line {
+  font-family: var(--mono);
+  color: var(--text-dim);
+}
+/*
+ * An outdated thread's line is historical — where the comment was written, not
+ * where that code is now. Italics mark it as approximate without dimming the
+ * text further; it is already the dimmest column in the table.
+ */
+.summary__line--outdated {
+  font-style: italic;
+}
+.summary__author {
+  color: var(--text);
+  white-space: nowrap;
+}
+.summary__preview {
+  color: var(--text-dim);
+  max-width: 460px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.summary__more {
+  color: var(--accent);
+}
+.summary__updated {
+  color: var(--text-dim);
+  white-space: nowrap;
+}
+.summary__iter {
+  color: var(--text-dim);
+  white-space: nowrap;
+  text-align: center;
+  font-family: var(--mono);
+  font-size: 11px;
+}
+
+/* ---------------------------------------------------------------------------
+   Bug swarm
+   A comment lands, and a few insects wander out across the app and are gone.
+   Purely decorative: it never takes a pointer event and it is out of the
+   accessibility tree, so the review carries on underneath it untouched.
+--------------------------------------------------------------------------- */
+.bugswarm {
+  position: fixed;
+  inset: 0;
+  overflow: hidden;
+  pointer-events: none;
+  z-index: 200;
+}
+.bugswarm__bug {
+  position: absolute;
+  /* Big enough to read as an insect rather than as a rendering artefact; this
+     is a glyph, not text, so the stylesheet's font-size floor doesn't apply. */
+  font-size: 22px;
+  line-height: 1;
+  will-change: transform, opacity;
+  animation-name: bug-fly;
+  /* Eased at both ends of each half of the flight, which puts a slight hesitation
+     at the turn. Insects don't hold a constant speed, and the old single ease-out
+     spent most of the animation already decelerating — it looked launched. */
+  animation-timing-function: cubic-bezier(0.4, 0, 0.5, 1);
+  animation-fill-mode: both;
+}
+@keyframes bug-fly {
+  0% {
+    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.4);
+    opacity: 0;
+  }
+  12% {
+    opacity: 1;
+  }
+  /* The bend. Halfway along, but pushed off the straight line between the two
+     ends, so the insect arcs across the screen instead of running a ruled line. */
+  50% {
+    transform: translate3d(var(--bug-mx), var(--bug-my), 0) rotate(calc(var(--bug-spin) / 2))
+      scale(var(--bug-scale));
+  }
+  85% {
+    opacity: 1;
+  }
+  100% {
+    transform: translate3d(var(--bug-dx), var(--bug-dy), 0) rotate(var(--bug-spin))
+      scale(var(--bug-scale));
+    opacity: 0;
+  }
+}
+@media (prefers-reduced-motion: reduce) {
+  /* The hook already declines to schedule a swarm here. This is the backstop
+     for a preference that changes mid-flight. */
+  .bugswarm {
+    display: none;
+  }
+}
+
+/* ------------------------------ Local mode notice ------------------------------ */
+.local-mode {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  margin: 8px 0;
+  padding: 6px 10px;
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  color: var(--text-dim);
+  font-size: 12px;
+}
+.local-mode--warning {
+  justify-content: space-between;
+  color: var(--text-bright);
+  border-color: var(--warn, var(--accent));
+}
+
+/* ------------------------------ Setup required ------------------------------ */
+.setup-required {
+  max-width: 640px;
+  margin: 10vh auto;
+  padding: 24px;
+  color: var(--text);
+  line-height: 1.6;
+}
+.setup-required pre {
+  padding: 12px;
+  border: 1px solid var(--border);
+  border-radius: 6px;
+  overflow-x: auto;
+}
diff --git a/samples/CodeFlow/src/App.tsx b/samples/CodeFlow/src/App.tsx
new file mode 100644
index 0000000..f9df68d
--- /dev/null
+++ b/samples/CodeFlow/src/App.tsx
@@ -0,0 +1,42 @@
+import { CodeFlowProvider } from './state/CodeFlowProvider';
+import { useCodeFlow } from './state/useCodeFlow';
+import { Dashboard } from './components/Dashboard/Dashboard';
+import { ReviewLayout } from './components/Layout/Layout';
+import { OpeningSplash } from './components/OpeningSplash/OpeningSplash';
+import { openingSplashTarget } from './components/OpeningSplash/splashTarget';
+import { SetupRequired } from './components/SetupRequired/SetupRequired';
+import { useDeepLinkPending } from './state/hooks/useDeepLink';
+import { redirectToPlayerIfTopLevel } from './utils/deepLink';
+import { isGitHubConnectorConfigured } from './connectors/github';
+import './App.css';
+
+// A deep link opened outside the player has no connector context, so bounce to
+// the player (carrying the link) before rendering anything.
+const redirecting = redirectToPlayerIfTopLevel();
+
+function Shell() {
+  const { status, pr, pendingPr } = useCodeFlow();
+  const pendingDeepLink = useDeepLinkPending(status);
+  // Opening a PR from the dashboard gets the same splash, so the click reads as
+  // "on it" rather than leaving the reviewer staring at an unchanged dashboard.
+  const opening = openingSplashTarget(status, pendingPr, !!pr);
+  const content = pendingDeepLink ? 
+    : opening ? 
+    : status === 'ready' ? 
+    : ;
+  return 
{content}
; +} + +export default function App() { + if (redirecting) { + return ; + } + if (!isGitHubConnectorConfigured()) { + return ; + } + return ( + + + + ); +} diff --git a/samples/CodeFlow/src/components/AutoMergeButton/AutoMergeButton.tsx b/samples/CodeFlow/src/components/AutoMergeButton/AutoMergeButton.tsx new file mode 100644 index 0000000..283a29f --- /dev/null +++ b/samples/CodeFlow/src/components/AutoMergeButton/AutoMergeButton.tsx @@ -0,0 +1,139 @@ +import { useEffect, useRef, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import type { MergeMethod } from '../../types'; +import { MERGE_METHODS } from '../MergeButton/mergeGate'; +import { describeAutoMerge, evaluateAutoMergeGate } from './autoMergeGate'; + +/** + * "Auto-merge" — hand the pull request to GitHub to land on the author's + * behalf once its requirements are met. + * + * The counterpart to the merge button next door, and the answer to the case it + * can't serve: a pull request that is approved and simply waiting on a long CI + * run. Without this the author either sits on the tab until the checks go + * green or leaves for GitHub to press the same button there. + * + * Arming it asks first, because it is a standing instruction to merge code + * that may not be written yet. Disarming it doesn't — cancelling something + * that hasn't happened costs nothing, and a confirmation would only stand + * between the author and calling it off. + */ +export function AutoMergeButton() { + const { pr, currentUser, autoMerge, autoMergeLoading, actions } = useCodeFlow(); + const [open, setOpen] = useState(false); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + const [method, setMethod] = useState('merge'); + const timer = useRef | undefined>(undefined); + + useEffect(() => () => clearTimeout(timer.current), []); + + const gate = evaluateAutoMergeGate({ pr, currentUser, autoMerge, autoMergeLoading }); + if (!gate.visible) return null; + + const armed = !!autoMerge?.enabled; + + const flashError = (e: unknown, fallback: string) => { + setError(e instanceof Error ? e.message : fallback); + clearTimeout(timer.current); + timer.current = setTimeout(() => setError(null), 8000); + }; + + const arm = async () => { + setOpen(false); + setBusy(true); + setError(null); + try { + await actions.enableAutoMerge(method); + } catch (e) { + flashError(e, 'Could not enable auto-merge.'); + } finally { + setBusy(false); + } + }; + + const disarm = async () => { + setOpen(false); + setBusy(true); + setError(null); + try { + await actions.disableAutoMerge(); + } catch (e) { + flashError(e, 'Could not turn auto-merge off.'); + } finally { + setBusy(false); + } + }; + + // Armed is a state, not a prompt: the button says what pressing it does, and + // the summary of what is pending sits on the panel behind it. + const label = armed ? 'Auto-merge on' : 'Auto-merge'; + const title = armed + ? (describeAutoMerge(autoMerge) ?? 'Auto-merge is on for this pull request') + : (gate.reason ?? 'Merge this pull request automatically once it is ready'); + + return ( + <> + + {error && {error}} + {open && armed && ( +
+

{describeAutoMerge(autoMerge)}

+
+ + +
+
+ )} + {open && !armed && ( +
+

+ Merge {pr?.headRef} into {pr?.baseRef} as soon as it + is ready? +

+
+ {MERGE_METHODS.map((m) => ( + + ))} +
+

+ GitHub merges it once every required review and check passes — including commits pushed + after this. Turn it off from here or from GitHub at any point before then. +

+
+ + +
+
+ )} + + ); +} diff --git a/samples/CodeFlow/src/components/AutoMergeButton/__tests__/AutoMergeButton.test.tsx b/samples/CodeFlow/src/components/AutoMergeButton/__tests__/AutoMergeButton.test.tsx new file mode 100644 index 0000000..b22df1f --- /dev/null +++ b/samples/CodeFlow/src/components/AutoMergeButton/__tests__/AutoMergeButton.test.tsx @@ -0,0 +1,159 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { AutoMergeButton } from '../AutoMergeButton'; +import type { AutoMergeStatus } from '../../../services/autoMerge'; +import type { GitUserRef, PrSummary } from '../../../types'; + +const enableAutoMerge = vi.fn(async () => {}); +const disableAutoMerge = vi.fn(async () => {}); + +let pr: PrSummary | undefined; +let currentUser: GitUserRef | undefined; +let autoMerge: AutoMergeStatus | undefined; +let autoMergeLoading = false; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => ({ + pr, + currentUser, + autoMerge, + autoMergeLoading, + actions: { enableAutoMerge, disableAutoMerge }, + }), +})); + +function makePr(over: Partial = {}): PrSummary { + return { + coordinates: { owner: 'octo', name: 'repo', number: 7 }, + title: 'Do the thing', + state: 'open', + draft: false, + merged: false, + author: { login: 'alice' }, + baseRef: 'main', + baseSha: 'base', + headRef: 'feature', + headSha: 'head', + ...over, + }; +} + +const trigger = () => screen.getByRole('button', { name: /auto-merge/i }); + +beforeEach(() => { + enableAutoMerge.mockClear(); + enableAutoMerge.mockResolvedValue(undefined); + disableAutoMerge.mockClear(); + disableAutoMerge.mockResolvedValue(undefined); + pr = makePr(); + currentUser = { login: 'alice' }; + autoMerge = { enabled: false, viewerCanEnable: true }; + autoMergeLoading = false; +}); + +describe('AutoMergeButton', () => { + it('renders nothing for someone who is not the author', () => { + currentUser = { login: 'bob' }; + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); + + it('offers the author a way to arm it', () => { + render(); + expect(trigger()).toBeEnabled(); + }); + + it('stays disabled, with GitHub’s reason, when it cannot be armed', () => { + autoMerge = { enabled: false, viewerCanEnable: false }; + pr = makePr({ mergeableState: 'clean' }); + render(); + expect(trigger()).toBeDisabled(); + expect(trigger().getAttribute('title')).toMatch(/merge it now/i); + }); + + it('does not arm on the first click — it asks first', () => { + render(); + fireEvent.click(trigger()); + expect(enableAutoMerge).not.toHaveBeenCalled(); + expect(screen.getByRole('dialog', { name: /enable auto-merge/i })).toBeInTheDocument(); + }); + + it('names both branches, so the direction is unambiguous', () => { + render(); + fireEvent.click(trigger()); + const dialog = screen.getByRole('dialog'); + expect(dialog.textContent).toContain('feature'); + expect(dialog.textContent).toContain('main'); + }); + + it('arms it with a merge commit by default', async () => { + render(); + fireEvent.click(trigger()); + fireEvent.click(screen.getByRole('button', { name: /^Enable auto-merge$/ })); + await waitFor(() => expect(enableAutoMerge).toHaveBeenCalledWith('merge')); + }); + + it('arms it with the strategy the author picked', async () => { + render(); + fireEvent.click(trigger()); + fireEvent.click(screen.getByRole('radio', { name: /squash/i })); + fireEvent.click(screen.getByRole('button', { name: /^Enable auto-merge$/ })); + await waitFor(() => expect(enableAutoMerge).toHaveBeenCalledWith('squash')); + }); + + it('lets the author back out', () => { + render(); + fireEvent.click(trigger()); + fireEvent.click(screen.getByRole('button', { name: /cancel/i })); + expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); + expect(enableAutoMerge).not.toHaveBeenCalled(); + }); + + it('surfaces GitHub’s own refusal rather than a generic failure', async () => { + enableAutoMerge.mockRejectedValue(new Error('Pull request is in clean status')); + render(); + fireEvent.click(trigger()); + fireEvent.click(screen.getByRole('button', { name: /^Enable auto-merge$/ })); + await waitFor(() => + expect(screen.getByText(/Pull request is in clean status/)).toBeInTheDocument(), + ); + }); + + it('shows it as armed once auto-merge is on, and says what will happen', () => { + autoMerge = { enabled: true, method: 'squash', enabledBy: 'alice' }; + render(); + expect(trigger()).toHaveAttribute('aria-pressed', 'true'); + expect(trigger().textContent).toMatch(/auto-merge on/i); + expect(trigger().getAttribute('title')).toMatch(/squash/); + }); + + it('turns it off from the same control', async () => { + autoMerge = { enabled: true, method: 'merge' }; + render(); + fireEvent.click(trigger()); + fireEvent.click(screen.getByRole('button', { name: /turn auto-merge off/i })); + await waitFor(() => expect(disableAutoMerge).toHaveBeenCalled()); + }); + + it('lets the author keep it on after opening the panel', () => { + autoMerge = { enabled: true, method: 'merge' }; + render(); + fireEvent.click(trigger()); + fireEvent.click(screen.getByRole('button', { name: /keep it on/i })); + expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); + expect(disableAutoMerge).not.toHaveBeenCalled(); + }); + + it('waits rather than offering a control it cannot yet honour', () => { + autoMerge = undefined; + autoMergeLoading = true; + render(); + expect(trigger()).toBeDisabled(); + }); + + it('disappears once the PR is merged', () => { + pr = makePr({ merged: true }); + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); +}); diff --git a/samples/CodeFlow/src/components/AutoMergeButton/__tests__/autoMergeGate.test.ts b/samples/CodeFlow/src/components/AutoMergeButton/__tests__/autoMergeGate.test.ts new file mode 100644 index 0000000..12fb044 --- /dev/null +++ b/samples/CodeFlow/src/components/AutoMergeButton/__tests__/autoMergeGate.test.ts @@ -0,0 +1,158 @@ +import { describe, it, expect } from 'vitest'; +import type { AutoMergeStatus } from '../../../services/autoMerge'; +import type { PrSummary } from '../../../types'; +import { + describeAutoMerge, + evaluateAutoMergeGate, + shouldTrackAutoMerge, +} from '../autoMergeGate'; + +function pr(over: Partial = {}): PrSummary { + return { + coordinates: { owner: 'octo', name: 'repo', number: 7 }, + title: 'Do the thing', + state: 'open', + draft: false, + merged: false, + author: { login: 'alice' }, + baseRef: 'main', + baseSha: 'base', + headRef: 'feature', + headSha: 'head', + ...over, + }; +} + +const ALICE = { login: 'alice' }; +const OFF: AutoMergeStatus = { enabled: false, viewerCanEnable: true }; + +describe('shouldTrackAutoMerge', () => { + it('reads the state for the author, who is the only one offered the control', () => { + expect(shouldTrackAutoMerge(pr(), ALICE)).toBe(true); + }); + + it('spends nothing on a reviewer’s session', () => { + expect(shouldTrackAutoMerge(pr(), { login: 'bob' })).toBe(false); + }); + + it('ignores case, the way GitHub does', () => { + expect(shouldTrackAutoMerge(pr({ author: { login: 'Alice' } }), ALICE)).toBe(true); + }); + + it('stops once the pull request is finished', () => { + expect(shouldTrackAutoMerge(pr({ merged: true }), ALICE)).toBe(false); + expect(shouldTrackAutoMerge(pr({ state: 'closed' }), ALICE)).toBe(false); + }); + + it('answers no before a pull request or a user is known', () => { + expect(shouldTrackAutoMerge(undefined, ALICE)).toBe(false); + expect(shouldTrackAutoMerge(pr(), undefined)).toBe(false); + }); +}); + +describe('evaluateAutoMergeGate', () => { + it('hides the control from anyone but the author', () => { + expect( + evaluateAutoMergeGate({ pr: pr(), currentUser: { login: 'bob' }, autoMerge: OFF }), + ).toMatchObject({ visible: false }); + }); + + it('hides it once the pull request is merged or closed', () => { + expect( + evaluateAutoMergeGate({ pr: pr({ merged: true }), currentUser: ALICE, autoMerge: OFF }), + ).toMatchObject({ visible: false }); + expect( + evaluateAutoMergeGate({ pr: pr({ state: 'closed' }), currentUser: ALICE, autoMerge: OFF }), + ).toMatchObject({ visible: false }); + }); + + it('offers it when GitHub says the author could turn it on', () => { + expect(evaluateAutoMergeGate({ pr: pr(), currentUser: ALICE, autoMerge: OFF })).toEqual({ + visible: true, + ready: true, + }); + }); + + it('waits rather than guessing while the state is still loading', () => { + const gate = evaluateAutoMergeGate({ pr: pr(), currentUser: ALICE, autoMergeLoading: true }); + expect(gate).toMatchObject({ visible: true, ready: false }); + expect(gate.reason).toMatch(/reading/i); + }); + + it('stays disabled when the state could not be read at all', () => { + expect(evaluateAutoMergeGate({ pr: pr(), currentUser: ALICE })).toMatchObject({ + visible: true, + ready: false, + }); + }); + + it('explains that a draft cannot be auto-merged', () => { + const gate = evaluateAutoMergeGate({ + pr: pr({ draft: true }), + currentUser: ALICE, + autoMerge: OFF, + }); + expect(gate).toMatchObject({ visible: true, ready: false }); + expect(gate.reason).toMatch(/draft/i); + }); + + it('points a mergeable pull request at the merge button instead', () => { + const gate = evaluateAutoMergeGate({ + pr: pr({ mergeableState: 'clean' }), + currentUser: ALICE, + autoMerge: { enabled: false, viewerCanEnable: false }, + }); + expect(gate.ready).toBe(false); + expect(gate.reason).toMatch(/merge it now/i); + }); + + it('blames the repository when GitHub refuses for any other reason', () => { + const gate = evaluateAutoMergeGate({ + pr: pr({ mergeableState: 'blocked' }), + currentUser: ALICE, + autoMerge: { enabled: false, viewerCanEnable: false }, + }); + expect(gate.ready).toBe(false); + expect(gate.reason).toMatch(/repository/i); + }); + + it('always lets the author turn it back off — even on a draft', () => { + expect( + evaluateAutoMergeGate({ + pr: pr({ draft: true, mergeableState: 'clean' }), + currentUser: ALICE, + autoMerge: { enabled: true, method: 'squash' }, + }), + ).toEqual({ visible: true, ready: true }); + }); + + it('lets it be turned off even while a refresh is in flight', () => { + expect( + evaluateAutoMergeGate({ + pr: pr(), + currentUser: ALICE, + autoMerge: { enabled: true }, + autoMergeLoading: true, + }), + ).toEqual({ visible: true, ready: true }); + }); +}); + +describe('describeAutoMerge', () => { + it('says nothing when auto-merge is off', () => { + expect(describeAutoMerge(undefined)).toBeUndefined(); + expect(describeAutoMerge({ enabled: false })).toBeUndefined(); + }); + + it('names the strategy and who armed it', () => { + const text = describeAutoMerge({ enabled: true, method: 'squash', enabledBy: 'bob' }); + expect(text).toMatch(/squash/); + expect(text).toMatch(/@bob/); + }); + + it('still says what will happen when the strategy is unreadable', () => { + const text = describeAutoMerge({ enabled: true }); + expect(text).toMatch(/will merge/); + expect(text).not.toMatch(/undefined/); + }); +}); diff --git a/samples/CodeFlow/src/components/AutoMergeButton/autoMergeGate.ts b/samples/CodeFlow/src/components/AutoMergeButton/autoMergeGate.ts new file mode 100644 index 0000000..947c301 --- /dev/null +++ b/samples/CodeFlow/src/components/AutoMergeButton/autoMergeGate.ts @@ -0,0 +1,113 @@ +import type { AutoMergeStatus } from '../../services/autoMerge'; +import type { GitUserRef, PrSummary } from '../../types'; + +/** + * Whether the auto-merge control should appear, and if so whether it can be + * pressed. + * + * Same two-level shape as the merge gate, and for the same reason: invisible + * means "not your decision", while visible-but-not-ready always carries a + * `reason` saying what is in the way. Auto-merge leans on that second state far + * more heavily, because GitHub refuses it for several unrelated reasons that a + * hidden button would leave the author guessing about. + */ +export interface AutoMergeGate { + visible: boolean; + ready: boolean; + /** Why it can't be armed yet, phrased for a tooltip. */ + reason?: string; +} + +/** What {@link evaluateAutoMergeGate} needs. */ +export interface AutoMergeGateInput { + pr?: PrSummary; + currentUser?: GitUserRef; + autoMerge?: AutoMergeStatus; + autoMergeLoading?: boolean; +} + +const HIDDEN: AutoMergeGate = { visible: false, ready: false }; + +/** Logins differ only by display case; GitHub itself treats them as equal. */ +function sameUser(a?: string, b?: string): boolean { + if (!a || !b) return false; + return a.toLowerCase() === b.toLowerCase(); +} + +/** + * Whether this pull request's auto-merge state is worth reading at all. + * + * The state costs a GraphQL round trip on every poll, and only the author can + * act on it, so a reviewer's session shouldn't pay for it. Kept next to the + * gate rather than in the hook that uses it so the two answers can't drift: + * anything the gate would hide is something nothing needs to fetch. + */ +export function shouldTrackAutoMerge(pr?: PrSummary, currentUser?: GitUserRef): boolean { + if (!pr) return false; + if (pr.merged || pr.state === 'closed') return false; + return sameUser(currentUser?.login, pr.author?.login); +} + +/** + * Decide whether the signed-in user may arm or disarm auto-merge right now. + * + * Author-only, like merging and publishing: arming auto-merge is a commitment + * to land someone's branch unattended, and a review tool is the wrong place to + * be able to make that commitment on their behalf. + * + * Once it is on, the button is always ready — turning it back off is the one + * thing that should never be blocked, whatever else is true of the branch. + * Turning it on defers to GitHub's own `viewerCanEnableAutoMerge`, which is the + * only answer that accounts for repository settings, branch protection and the + * "already mergeable, so there is nothing to wait for" case at once. A local + * rule would be guessing at three things GitHub has already computed. + */ +export function evaluateAutoMergeGate(input: AutoMergeGateInput): AutoMergeGate { + const { pr, currentUser, autoMerge, autoMergeLoading } = input; + if (!shouldTrackAutoMerge(pr, currentUser)) return HIDDEN; + + if (autoMerge?.enabled) return { visible: true, ready: true }; + + if (pr?.draft) { + return { + visible: true, + ready: false, + reason: 'GitHub can’t auto-merge a draft. Publish it first.', + }; + } + if (autoMergeLoading || !autoMerge) { + return { visible: true, ready: false, reason: 'Reading auto-merge status…' }; + } + if (autoMerge.viewerCanEnable === false) { + return { + visible: true, + ready: false, + reason: + pr?.mergeableState === 'clean' + ? 'Nothing is holding this up — merge it now instead.' + : 'GitHub won’t allow auto-merge here. It may be turned off for this repository.', + }; + } + return { visible: true, ready: true }; +} + +/** How each strategy is named in prose, as opposed to on a radio button. */ +const LABELS: Record, string> = { + merge: 'merge commit', + squash: 'squash', + rebase: 'rebase', +}; + +/** + * One line saying what auto-merge will do, or `undefined` when it is off. + * + * Names the person who armed it, because they are not always the author — a + * reviewer with write access can arm it too, and an author who finds their own + * pull request merging itself deserves to know who asked for that. + */ +export function describeAutoMerge(autoMerge?: AutoMergeStatus): string | undefined { + if (!autoMerge?.enabled) return undefined; + const how = autoMerge.method ? ` with a ${LABELS[autoMerge.method]}` : ''; + const who = autoMerge.enabledBy ? ` Armed by @${autoMerge.enabledBy}.` : ''; + return `This pull request will merge${how} as soon as its requirements are met.${who}`; +} diff --git a/samples/CodeFlow/src/components/Avatar.tsx b/samples/CodeFlow/src/components/Avatar.tsx new file mode 100644 index 0000000..2bb634a --- /dev/null +++ b/samples/CodeFlow/src/components/Avatar.tsx @@ -0,0 +1,32 @@ +import type { GitUserRef } from '../types'; +import { initials, avatarColors } from '../utils/format'; + +interface AvatarProps { + user?: GitUserRef; + size?: number; + title?: string; +} + +/** + * Small circular avatar generated from the user's initials over a deterministic + * color. We intentionally do not load remote avatar images: the deployed app's + * CSP blocks GitHub's avatar host, so `` tags render broken. Generating the + * avatar locally keeps it working everywhere and stays stable per user. + */ +export function Avatar({ user, size = 20, title }: AvatarProps) { + const label = user?.name || user?.login || 'unknown'; + const seed = user?.login || user?.name || label; + const { background, color } = avatarColors(seed); + const style = { + width: size, + height: size, + fontSize: Math.round(size * 0.42), + background, + color, + }; + return ( + + {initials(label)} + + ); +} diff --git a/samples/CodeFlow/src/components/BugSwarm/BugSwarm.tsx b/samples/CodeFlow/src/components/BugSwarm/BugSwarm.tsx new file mode 100644 index 0000000..4d04af1 --- /dev/null +++ b/samples/CodeFlow/src/components/BugSwarm/BugSwarm.tsx @@ -0,0 +1,58 @@ +import type { CSSProperties } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { useSettings } from '../../settings/useSettings'; +import { useBugSwarm, type Swarm } from './useBugSwarm'; + +/** + * The swarm itself. + * + * Split from the connected component so it can be rendered — and looked at — on + * its own, without a whole review's worth of context standing behind it. + * + * Geometry travels as custom properties rather than as a per-bug keyframe: + * there is one `@keyframes` in the stylesheet and every insect reads its own + * launch point, heading, bend, spin and speed out of its inline style. + */ +export function BugSwarmOverlay({ swarm }: { swarm: Swarm }) { + if (!swarm.bugs.length) return null; + + return ( + // Decoration, and several seconds of it — so it is hidden from assistive + // tech and cannot swallow a click meant for the diff underneath. + + ); +} + +/** + * Watches the loaded PR's comments and sends up a swarm when one arrives — + * for the reviewers who turned it on in Settings. + */ +export function BugSwarm() { + const { threads, threadsLoading, prKey } = useCodeFlow(); + const { settings } = useSettings(); + const swarm = useBugSwarm({ threads, threadsLoading, prKey, enabled: settings.bugSwarm }); + return ; +} diff --git a/samples/CodeFlow/src/components/BugSwarm/__tests__/BugSwarm.test.tsx b/samples/CodeFlow/src/components/BugSwarm/__tests__/BugSwarm.test.tsx new file mode 100644 index 0000000..4f0f96a --- /dev/null +++ b/samples/CodeFlow/src/components/BugSwarm/__tests__/BugSwarm.test.tsx @@ -0,0 +1,262 @@ +import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; +import { render, screen, act } from '@testing-library/react'; +import { renderHook } from '@testing-library/react'; +import { BugSwarmOverlay } from '../BugSwarm'; +import { useBugSwarm, type BugSwarmInput } from '../useBugSwarm'; +import { BUG_SWARM_MS, planSwarm } from '../../../utils/bugSwarm'; +import { newPendingId } from '../../../utils/pendingComment'; +import type { Comment, CommentThread } from '../../../types'; + +function comment(id: string): Comment { + return { id, author: { login: 'octocat' }, body: 'nit', createdAt: '2024-01-01T00:00:00Z' }; +} + +/** A fresh array each call — the provider replaces `threads` on every poll. */ +function threads(...commentIds: string[]): CommentThread[] { + return [ + { + id: 't1', + prKey: 'o/r#1', + filename: 'src/App.tsx', + line: 1, + side: 'right', + status: 'active', + comments: commentIds.map(comment), + createdAt: '2024-01-01T00:00:00Z', + updatedAt: '2024-01-01T00:00:00Z', + }, + ]; +} + +const settled = (input: Partial = {}): BugSwarmInput => ({ + threads: threads(), + threadsLoading: false, + prKey: 'o/r#1', + enabled: true, + ...input, +}); + +describe('useBugSwarm', () => { + beforeEach(() => { + vi.useFakeTimers(); + // jsdom has no matchMedia; the swarm needs to know motion is welcome. + Object.defineProperty(window, 'matchMedia', { + configurable: true, + writable: true, + value: vi.fn(() => ({ matches: false })), + }); + }); + + afterEach(() => { + vi.useRealTimers(); + Reflect.deleteProperty(window as unknown as Record, 'matchMedia'); + }); + + it('stays still for the comments that were already there', () => { + const { result } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1', 'c2', 'c3') }), + }); + expect(result.current.bugs).toHaveLength(0); + }); + + it('sends up a swarm when a comment arrives', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + + rerender(settled({ threads: threads('c1', 'c2') })); + expect(result.current.bugs.length).toBeGreaterThan(0); + }); + + it('clears the swarm once the last bug has landed', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + rerender(settled({ threads: threads('c1', 'c2') })); + expect(result.current.bugs.length).toBeGreaterThan(0); + + act(() => { + vi.advanceTimersByTime(BUG_SWARM_MS + 1); + }); + expect(result.current.bugs).toHaveLength(0); + }); + + it('does not fire twice for one comment the reviewer posted', () => { + const pending = newPendingId(); + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + + // Optimistic render: on screen instantly, but not acknowledged yet. + rerender(settled({ threads: threads('c1', pending) })); + expect(result.current.bugs).toHaveLength(0); + + // The server's id replaces it — this is the one and only swarm. + rerender(settled({ threads: threads('c1', 'c2') })); + const first = result.current.seq; + expect(result.current.bugs.length).toBeGreaterThan(0); + + // A later poll returns the same comments; nothing new happened. + rerender(settled({ threads: threads('c1', 'c2') })); + expect(result.current.seq).toBe(first); + }); + + it('waits for the comments to settle before taking a baseline', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: [], threadsLoading: true }), + }); + + // The initial fetch landing is not forty people commenting at once. + rerender(settled({ threads: threads('c1', 'c2', 'c3'), threadsLoading: false })); + expect(result.current.bugs).toHaveLength(0); + + rerender(settled({ threads: threads('c1', 'c2', 'c3', 'c4') })); + expect(result.current.bugs.length).toBeGreaterThan(0); + }); + + it('absorbs the next PR\u2019s existing comments instead of celebrating them', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + + rerender(settled({ prKey: 'o/r#2', threads: threads('z1', 'z2') })); + expect(result.current.bugs).toHaveLength(0); + + rerender(settled({ prKey: 'o/r#2', threads: threads('z1', 'z2', 'z3') })); + expect(result.current.bugs.length).toBeGreaterThan(0); + }); + + it('scales the swarm when several comments land together', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + + rerender(settled({ threads: threads('c1', 'c2') })); + const one = result.current.bugs.length; + + act(() => { + vi.advanceTimersByTime(BUG_SWARM_MS + 1); + }); + rerender(settled({ threads: threads('c1', 'c2', 'c3', 'c4', 'c5') })); + expect(result.current.bugs.length).toBeGreaterThan(one); + }); + + it('restarts the animation when a comment lands mid-flight', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + + rerender(settled({ threads: threads('c1', 'c2') })); + const first = result.current.seq; + + rerender(settled({ threads: threads('c1', 'c2', 'c3') })); + expect(result.current.seq).toBeGreaterThan(first); + }); + + it('keeps a swarm in the air while the thread list is refreshed underneath it', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + rerender(settled({ threads: threads('c1', 'c2') })); + + // A poll returns an identical-but-new array partway through the flight. + act(() => { + vi.advanceTimersByTime(BUG_SWARM_MS / 2); + }); + rerender(settled({ threads: threads('c1', 'c2') })); + expect(result.current.bugs.length).toBeGreaterThan(0); + }); + + it('stays out of the way when the reviewer has asked for less motion', () => { + Object.defineProperty(window, 'matchMedia', { + configurable: true, + writable: true, + value: vi.fn(() => ({ matches: true })), + }); + + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + rerender(settled({ threads: threads('c1', 'c2') })); + expect(result.current.bugs).toHaveLength(0); + }); + + it('stays down while the reviewer has it switched off', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1'), enabled: false }), + }); + rerender(settled({ threads: threads('c1', 'c2'), enabled: false })); + expect(result.current.bugs).toHaveLength(0); + }); + + it('does not make up for lost time when it is switched on mid-review', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1'), enabled: false }), + }); + // Three comments land while nobody wanted to see them. + rerender(settled({ threads: threads('c1', 'c2', 'c3', 'c4'), enabled: false })); + rerender(settled({ threads: threads('c1', 'c2', 'c3', 'c4'), enabled: true })); + expect(result.current.bugs).toHaveLength(0); + + // The next one to arrive, though, is fair game. + rerender(settled({ threads: threads('c1', 'c2', 'c3', 'c4', 'c5'), enabled: true })); + expect(result.current.bugs.length).toBeGreaterThan(0); + }); + + it('takes a swarm down mid-flight when the reviewer switches it off', () => { + const { result, rerender } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + rerender(settled({ threads: threads('c1', 'c2') })); + expect(result.current.bugs.length).toBeGreaterThan(0); + + rerender(settled({ threads: threads('c1', 'c2'), enabled: false })); + expect(result.current.bugs).toHaveLength(0); + }); + + it('does not leave a timer running after the review is closed', () => { const { rerender, unmount } = renderHook(useBugSwarm, { + initialProps: settled({ threads: threads('c1') }), + }); + rerender(settled({ threads: threads('c1', 'c2') })); + + unmount(); + expect(() => vi.advanceTimersByTime(BUG_SWARM_MS + 1)).not.toThrow(); + expect(vi.getTimerCount()).toBe(0); + }); +}); + +describe('BugSwarmOverlay', () => { + it('draws nothing when no swarm is in the air', () => { + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); + + it('draws one insect per bug', () => { + const bugs = planSwarm(1, () => 0.5); + render(); + expect(screen.getByTestId('bugswarm').children).toHaveLength(bugs.length); + }); + + it('is decoration, so it is hidden from assistive tech', () => { + render( 0.5) }} />); + expect(screen.getByTestId('bugswarm')).toHaveAttribute('aria-hidden', 'true'); + }); + + it('gives each insect its own heading to fly along', () => { + const bugs = planSwarm(1, () => 0.5); + render(); + const first = screen.getByTestId('bugswarm').children[0] as HTMLElement; + expect(first.style.getPropertyValue('--bug-dx')).toBe(`${bugs[0].driftX}vw`); + expect(first.style.getPropertyValue('--bug-dy')).toBe(`${bugs[0].driftY}vh`); + expect(first.style.left).toBe(`${bugs[0].startX}%`); + }); + + it('gives each insect the bend in its path and its own speed', () => { + const bugs = planSwarm(1, () => 0.5); + render(); + const first = screen.getByTestId('bugswarm').children[0] as HTMLElement; + expect(first.style.getPropertyValue('--bug-mx')).toBe(`${bugs[0].midX}vw`); + expect(first.style.getPropertyValue('--bug-my')).toBe(`${bugs[0].midY}vh`); + expect(first.style.animationDuration).toBe(`${bugs[0].durationMs}ms`); + }); +}); diff --git a/samples/CodeFlow/src/components/BugSwarm/useBugSwarm.ts b/samples/CodeFlow/src/components/BugSwarm/useBugSwarm.ts new file mode 100644 index 0000000..a9baab6 --- /dev/null +++ b/samples/CodeFlow/src/components/BugSwarm/useBugSwarm.ts @@ -0,0 +1,103 @@ +import { useEffect, useRef, useState } from 'react'; +import type { CommentThread } from '../../types'; +import { + BUG_SWARM_MS, + freshCommentIds, + planSwarm, + settledCommentIds, + type Bug, +} from '../../utils/bugSwarm'; +import { prefersReducedMotion } from '../../utils/motion'; + +export interface Swarm { + /** + * Bumped for every swarm. Used as part of the React key so a second swarm + * starting while the first is still in the air gets fresh DOM, and therefore + * restarts the animation instead of inheriting a half-finished one. + */ + seq: number; + bugs: Bug[]; +} + +const NO_SWARM: Swarm = { seq: 0, bugs: [] }; + +export interface BugSwarmInput { + threads: CommentThread[]; + /** True while the first full set of comments is still being fetched. */ + threadsLoading: boolean; + /** Which PR these threads belong to; a change starts the tally over. */ + prKey?: string; + /** The reviewer's opt-in. Off unless they went looking for it. */ + enabled: boolean; +} + +/** + * Send up a swarm whenever a comment appears on screen. + * + * Two things stop this from firing on comments that were already there: + * + * - The first settled snapshot only establishes the baseline. Opening a PR with + * forty comments is not forty events, and the whole point is to react to a + * comment *arriving*. + * - The baseline is thrown away when the reviewer moves to another PR, so the + * next PR's existing comments are likewise absorbed rather than celebrated. + * + * Switched off, the tally is still kept — only the swarm is suppressed — so + * turning it on mid-review reacts to the next comment rather than to every one + * that arrived while it was off. + * + * A reviewer who has asked for reduced motion gets no swarm at all — this is + * decoration, and it is the first thing that should go quiet. + */ +export function useBugSwarm({ threads, threadsLoading, prKey, enabled }: BugSwarmInput): Swarm { + const seen = useRef | null>(null); + const loadedKey = useRef(undefined); + const seq = useRef(0); + const timer = useRef | null>(null); + const [swarm, setSwarm] = useState(NO_SWARM); + + // Cleared on unmount only. Deliberately *not* tied to the effect below, which + // re-runs on every poll: a swarm cancelled each time the thread list is + // replaced would flicker out well short of its full flight. + useEffect( + () => () => { + if (timer.current) clearTimeout(timer.current); + }, + [], + ); + + useEffect(() => { + if (prKey !== loadedKey.current) { + loadedKey.current = prKey; + seen.current = null; + } + + // Wait for the comments to settle before taking the baseline, or the + // initial fetch reads as everyone commenting at once. + if (threadsLoading) return; + + if (seen.current === null) { + seen.current = settledCommentIds(threads); + return; + } + + const fresh = freshCommentIds(threads, seen.current); + seen.current = settledCommentIds(threads); + if (!fresh.length || !enabled || prefersReducedMotion()) return; + + seq.current += 1; + setSwarm({ seq: seq.current, bugs: planSwarm(fresh.length) }); + + if (timer.current) clearTimeout(timer.current); + timer.current = setTimeout(() => { + timer.current = null; + setSwarm(NO_SWARM); + }, BUG_SWARM_MS); + }, [threads, threadsLoading, prKey, enabled]); + + // Switched off, nothing shows — including a swarm that was already in flight + // when the reviewer said stop. The state is left alone rather than reset, + // because its own timer clears it a moment later either way, and resetting it + // here would be a synchronous render-triggering write inside an effect. + return enabled ? swarm : NO_SWARM; +} diff --git a/samples/CodeFlow/src/components/ChecksPill/ChecksDialog.tsx b/samples/CodeFlow/src/components/ChecksPill/ChecksDialog.tsx new file mode 100644 index 0000000..2144b58 --- /dev/null +++ b/samples/CodeFlow/src/components/ChecksPill/ChecksDialog.tsx @@ -0,0 +1,180 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +// Imported from the module rather than the package barrel: the barrel also +// exports the connector-backed fetch, and pulling that into a component drags +// the whole SDK data client along with it. +import { checkLink } from '../../services/checks/checkLinks'; +import { tallyRequired } from '../../services/checks/checksQuery'; +import type { CheckOutcome, PrCheck, PrCoordinates } from '../../types'; + +export interface ChecksDialogProps { + onClose: () => void; +} + +const ICON: Record = { + success: '✓', + failure: '✗', + pending: '⏳', + neutral: '–', +}; + +const OUTCOME_LABEL: Record = { + success: 'Passed', + failure: 'Failed', + pending: 'Running', + neutral: 'Skipped', +}; + +function CheckRow({ + check, + coords, + prHtmlUrl, +}: { + check: PrCheck; + coords: PrCoordinates; + prHtmlUrl?: string; +}) { + const href = checkLink(check, coords, prHtmlUrl); + + return ( +
  • + + {ICON[check.outcome]} + + + + {check.name}{' '} + + {check.isRequired === true ? 'Required' : check.isRequired === false ? 'Optional' : 'Requirement unknown'} + + + {check.description && ( + + {check.description} + + )} + + {href && ( + + Details ↗ + + )} +
  • + ); +} + +/** + * The full check list behind the pill. + * + * Every row links somewhere useful, which is more than GitHub's own summary + * manages for some providers — a check can report a placeholder details URL, so + * the links are rebuilt against GitHub rather than followed blindly. + */ +export function ChecksDialog({ onClose }: ChecksDialogProps) { + const { checks, pr, actions } = useCodeFlow(); + const closeRef = useRef(null); + const [refreshing, setRefreshing] = useState(false); + + useEffect(() => { + closeRef.current?.focus(); + }, []); + + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (e.key === 'Escape') { + e.stopPropagation(); + onClose(); + } + }; + document.addEventListener('keydown', onKey); + return () => document.removeEventListener('keydown', onKey); + }, [onClose]); + + const onBackdrop = useCallback( + (e: React.MouseEvent) => { + if (e.target === e.currentTarget) onClose(); + }, + [onClose], + ); + + const recheck = useCallback(async () => { + setRefreshing(true); + try { + await actions.refreshChecks(); + } finally { + setRefreshing(false); + } + }, [actions]); + + if (!checks || !pr) return null; + + const required = tallyRequired(checks.checks); + const unknown = checks.checks.some((check) => check.isRequired === undefined); + + return ( +
    +
    +
    +
    +

    + Checks +

    +

    + {checks.passed} of {checks.total} passing + {checks.failed > 0 ? `, ${checks.failed} failing` : ''} + {checks.pending > 0 ? `, ${checks.pending} still running` : ''} + {checks.sha ? ` · ${checks.sha.slice(0, 7)}` : ''} +

    +
    + +
    + +

    + {required.passed} of {required.total} reported required checks passing. + {' '}Optional checks are informational and do not block merging. + {unknown ? ' Some check requirements could not be determined.' : ''} +

    + +
      + {checks.checks.map((check) => ( + + ))} +
    + +
    + +
    +
    +
    + ); +} diff --git a/samples/CodeFlow/src/components/ChecksPill/ChecksPill.tsx b/samples/CodeFlow/src/components/ChecksPill/ChecksPill.tsx new file mode 100644 index 0000000..0f30681 --- /dev/null +++ b/samples/CodeFlow/src/components/ChecksPill/ChecksPill.tsx @@ -0,0 +1,51 @@ +import { useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { tallyRequired } from '../../services/checks/checksQuery'; +import { ChecksDialog } from './ChecksDialog'; + +/** Required-check progress, with optional results one click away. */ +export function ChecksPill() { + const { checks, checksLoading } = useCodeFlow(); + const [open, setOpen] = useState(false); + + // Nothing to say: still loading, unreadable, or a PR with no CI at all. In + // every case an empty space beats a pill that explains itself. + if (!checks || checks.total === 0) { + return checksLoading ? Checks… : null; + } + + const required = tallyRequired(checks.checks); + const optional = checks.checks.filter((check) => check.isRequired === false).length; + const unknown = checks.total - required.total - optional; + const label = required.total > 0 + ? 'required checks passing' + : `${unknown > 0 ? '' : 'optional '}check${checks.total === 1 ? '' : 's'}`; + const tone = required.failed > 0 ? 'failing' + : required.pending > 0 ? 'pending' + : required.total > 0 && unknown === 0 ? 'passing' : 'informational'; + const detail = [ + required.total > 0 ? `${required.passed}/${required.total} reported required checks passing` : undefined, + required.failed > 0 ? `${required.failed} required checks failing` : undefined, + required.pending > 0 ? `${required.pending} required checks still running` : undefined, + optional > 0 ? `${optional} optional checks (informational)` : undefined, + unknown > 0 ? `${unknown} checks with unknown requirements` : undefined, + ].filter(Boolean); + + return ( + <> + + {open && setOpen(false)} />} + + ); +} diff --git a/samples/CodeFlow/src/components/ChecksPill/__tests__/ChecksPill.test.tsx b/samples/CodeFlow/src/components/ChecksPill/__tests__/ChecksPill.test.tsx new file mode 100644 index 0000000..611c924 --- /dev/null +++ b/samples/CodeFlow/src/components/ChecksPill/__tests__/ChecksPill.test.tsx @@ -0,0 +1,178 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent, within } from '@testing-library/react'; +import { ChecksPill } from '../ChecksPill'; +import type { ChecksSummary, PrCheck } from '../../../types'; + +const refreshChecks = vi.fn(async () => {}); + +let checks: ChecksSummary | undefined; +let checksLoading = false; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => ({ + checks, + checksLoading, + pr: { + coordinates: { owner: 'octo-org', name: 'octo-repo', number: 123 }, + htmlUrl: 'https://github.com/octo-org/octo-repo/pull/123', + }, + actions: { refreshChecks }, + }), +})); + +function check(over: Partial = {}): PrCheck { + return { + id: '1', + name: 'Build', + outcome: 'success', + rawState: 'SUCCESS', + kind: 'check', + + isRequired: true, + ...over, + }; +} + +function summary(list: PrCheck[]): ChecksSummary { + return { + checks: list, + sha: 'abc1234def', + total: list.length, + passed: list.filter((c) => c.outcome === 'success' || c.outcome === 'neutral').length, + failed: list.filter((c) => c.outcome === 'failure').length, + pending: list.filter((c) => c.outcome === 'pending').length, + }; +} + +beforeEach(() => { + refreshChecks.mockClear(); + checksLoading = false; + checks = undefined; +}); + +describe('ChecksPill', () => { + it('stays out of the way when the PR has no checks', () => { + checks = summary([]); + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); + + it('says nothing at all when checks could not be read', () => { + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); + + it('shows a placeholder while the first read is in flight', () => { + checksLoading = true; + render(); + expect(screen.getByText('Checks…')).toBeTruthy(); + }); + + it('counts passing against the total', () => { + checks = summary([check(), check({ id: '2', name: 'Lint', outcome: 'failure' })]); + render(); + expect(screen.getByTestId('checks-pill').textContent).toContain('1/2'); + }); + + it('takes its tone from the worst required outcome', () => { + checks = summary([check(), check({ id: '2', outcome: 'pending' })]); + const { rerender } = render(); + expect(screen.getByTestId('checks-pill').className).toContain('checks-pill--pending'); + + checks = summary([check(), check({ id: '2', outcome: 'failure' }), check({ id: '3', outcome: 'pending' })]); + rerender(); + expect(screen.getByTestId('checks-pill').className).toContain('checks-pill--failing'); + + checks = summary([check()]); + rerender(); + expect(screen.getByTestId('checks-pill').className).toContain('checks-pill--passing'); + }); + + it('excludes optional failures and pending statuses from required progress and tone', () => { + checks = summary([ + check(), + check({ id: '2', isRequired: false, outcome: 'failure' }), + check({ id: '3', kind: 'status', isRequired: false, outcome: 'pending' }), + ]); + render(); + const pill = screen.getByTestId('checks-pill'); + expect(pill).toHaveTextContent('1/1 required checks passing'); + expect(pill).toHaveClass('checks-pill--passing'); + expect(pill.title).toContain('2 optional checks (informational)'); + }); + + it('shows optional-only checks as informational even when they fail or run', () => { + checks = summary([ + check({ isRequired: false, outcome: 'failure' }), + check({ id: '2', isRequired: false, outcome: 'pending' }), + ]); + render(); + expect(screen.getByTestId('checks-pill')).toHaveClass('checks-pill--informational'); + expect(screen.getByTestId('checks-pill')).toHaveTextContent('2 optional checks'); + expect(screen.getByTestId('checks-pill')).not.toHaveTextContent('passing'); + }); + + it('does not claim unknown requirements are optional or all passing', () => { + checks = summary([check({ isRequired: undefined, outcome: 'failure' })]); + const { rerender } = render(); + expect(screen.getByTestId('checks-pill')).toHaveTextContent('1 check'); + expect(screen.getByTestId('checks-pill').title).toContain('unknown requirements'); + + checks = summary([check(), check({ id: '2', isRequired: undefined })]); + rerender(); + expect(screen.getByTestId('checks-pill')).toHaveClass('checks-pill--informational'); + }); +}); + +describe('ChecksDialog', () => { + function open(list: PrCheck[]) { + checks = summary(list); + render(); + fireEvent.click(screen.getByTestId('checks-pill')); + } + + it('opens from the pill and closes again', () => { + open([check()]); + expect(screen.getByTestId('checks-dialog')).toBeTruthy(); + fireEvent.click(screen.getByLabelText('Close')); + expect(screen.queryByTestId('checks-dialog')).toBeNull(); + }); + + it('lists every check with a link to its page on GitHub', () => { + open([check({ name: 'Build', description: 'Build succeeded' })]); + expect(screen.getByText('Build succeeded')).toBeTruthy(); + const link = screen.getByText('Details ↗') as HTMLAnchorElement; + expect(link.href).toContain('/pull/123/checks?check_run_id=1'); + }); + + it('labels required, optional and unknown rows without hiding optional failures', () => { + open([ + check({ name: 'Required build' }), + check({ id: '2', name: 'Optional scan', kind: 'status', isRequired: false, outcome: 'failure' }), + check({ id: '3', name: 'Unknown check', isRequired: undefined }), + ]); + const rows = screen.getAllByRole('listitem'); + expect(within(rows[0]).getByText('Required')).toBeInTheDocument(); + expect(within(rows[1]).getByText('Optional')).toBeInTheDocument(); + expect(within(rows[1]).getByRole('img', { name: 'Failed' })).toBeInTheDocument(); + expect(within(rows[2]).getByText('Requirement unknown')).toBeInTheDocument(); + expect(screen.getByText(/1 of 1 reported required checks passing/)).toHaveTextContent( + 'Optional checks are informational and do not block merging.', + ); + expect(screen.getByText(/Some check requirements could not be determined/)).toBeInTheDocument(); + }); + + + + it('re-reads the checks on request', () => { + open([check()]); + fireEvent.click(screen.getByTestId('checks-recheck')); + expect(refreshChecks).toHaveBeenCalledTimes(1); + }); + + it('closes on Escape', () => { + open([check()]); + fireEvent.keyDown(document, { key: 'Escape' }); + expect(screen.queryByTestId('checks-dialog')).toBeNull(); + }); +}); diff --git a/samples/CodeFlow/src/components/CherryPickButton/CherryPickButton.tsx b/samples/CodeFlow/src/components/CherryPickButton/CherryPickButton.tsx new file mode 100644 index 0000000..c7515a5 --- /dev/null +++ b/samples/CodeFlow/src/components/CherryPickButton/CherryPickButton.tsx @@ -0,0 +1,264 @@ +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { GitHubService } from '../../services/githubService'; +import { + cherryPickPullRequest, + cherryPickTargets, + evaluateCherryPickGate, + previewCherryPick, + suggestCherryPickBranch, + validateBranchName, + type CherryPickPreview, + type CherryPickResult, +} from '../../services/cherryPick'; + +/** + * Take this pull request's changes to another branch. + * + * The shape deliberately echoes the merge button — a small topbar control that + * opens a confirmation panel rather than acting on the first click — because + * this also writes to the repository. It differs in who may press it (anyone; + * see `evaluateCherryPickGate`) and in being undoable: everything it creates is + * a new branch, and optionally a new pull request. + * + * The panel does its own reading rather than going through the provider. A + * cherry-pick changes nothing about the pull request on screen, so there is no + * state for the provider to fold in and nothing for it to own. + */ +export function CherryPickButton() { + const { pr } = useCodeFlow(); + const [open, setOpen] = useState(false); + const [branches, setBranches] = useState([]); + const [target, setTarget] = useState(''); + const [branchName, setBranchName] = useState(''); + const [branchEdited, setBranchEdited] = useState(false); + const [openPr, setOpenPr] = useState(true); + /** + * The last preview and the target it belongs to. + * + * Storing the target alongside it is what keeps a stale warning off the + * screen without clearing state from inside an effect: a preview whose + * target no longer matches simply isn't the current one, and the panel reads + * as still working. + */ + const [previewFor, setPreviewFor] = useState<{ + target: string; + preview?: CherryPickPreview; + }>(); + const [busy, setBusy] = useState(false); + const [result, setResult] = useState(); + const [error, setError] = useState(); + + const alive = useRef(true); + useEffect(() => { + alive.current = true; + return () => { + alive.current = false; + }; + }, []); + + // Branch list, read once per opening. Cheap enough not to cache, and a stale + // list is exactly the thing that makes a release branch impossible to find. + useEffect(() => { + if (!open || !pr) return; + let cancelled = false; + void GitHubService.listBranches({ + owner: pr.coordinates.owner, + name: pr.coordinates.name, + }).then((names) => { + if (!cancelled) setBranches(names); + }); + return () => { + cancelled = true; + }; + }, [open, pr]); + + const targets = useMemo(() => cherryPickTargets(branches, pr), [branches, pr]); + + // Re-read what the cherry-pick would do whenever the target changes, so the + // divergence warning belongs to the branch actually selected. + useEffect(() => { + if (!open || !pr || !target) return; + let cancelled = false; + void previewCherryPick(pr, target) + .then((p) => { + if (!cancelled) setPreviewFor({ target, preview: p }); + }) + .catch(() => { + // Nothing to preview is not a reason to refuse: the cherry-pick works + // it out again for itself, and will fail loudly there if it must. + if (!cancelled) setPreviewFor({ target }); + }); + return () => { + cancelled = true; + }; + }, [open, pr, target]); + + const preview = previewFor?.target === target ? previewFor.preview : undefined; + const previewing = Boolean(target) && previewFor?.target !== target; + + const chooseTarget = useCallback( + (value: string) => { + setTarget(value); + setError(undefined); + // Keep the suggested branch name in step with the target until the + // reviewer types their own, at which point it is theirs to manage. + if (pr && !branchEdited) setBranchName(suggestCherryPickBranch(pr, value)); + }, + [pr, branchEdited], + ); + + const reset = () => { + setOpen(false); + setTarget(''); + setBranchName(''); + setBranchEdited(false); + setPreviewFor(undefined); + setError(undefined); + }; + + const gate = evaluateCherryPickGate(pr); + if (!gate.visible || !pr) return null; + + const nameError = branchName ? validateBranchName(branchName) : undefined; + const touched = preview ? preview.plan.writes.length + preview.plan.deletes.length : 0; + const canRun = Boolean(target) && Boolean(branchName) && !nameError && !busy && !previewing; + + const run = async () => { + setBusy(true); + setError(undefined); + try { + const outcome = await cherryPickPullRequest({ + pr, + targetBranch: target, + newBranch: branchName.trim(), + openPullRequest: openPr, + preview, + }); + if (!alive.current) return; + setResult(outcome); + reset(); + } catch (e) { + if (!alive.current) return; + setError(e instanceof Error ? e.message : 'The cherry-pick failed.'); + } finally { + if (alive.current) setBusy(false); + } + }; + + return ( + <> + + {result && ( +
    +

    + Cherry-picked onto{' '} + + {result.branch} + + {result.pullRequestOpened ? ' and opened a pull request.' : '.'} +

    +

    + {result.written.length} file{result.written.length === 1 ? '' : 's'} written + {result.deleted.length > 0 ? `, ${result.deleted.length} deleted` : ''} + {result.unchanged.length > 0 + ? `, ${result.unchanged.length} already up to date` + : ''} + . +

    + {result.merged.length > 0 && ( +

    + {result.merged.length} file{result.merged.length === 1 ? ' was' : 's were'} merged + with changes already on that branch. +

    + )} + +
    + )} + {open && ( +
    +

    + Apply the changes in {pr.headRef} to another branch. +

    + + + {nameError && ( +

    + {nameError} +

    + )} + + {previewing &&

    Working out what would change…

    } + {preview && ( +

    + {touched} file{touched === 1 ? '' : 's'} would be cherry-picked. +

    + )} + {preview?.warning && ( +

    + {preview.warning} +

    + )} + {error && ( +

    + {error} +

    + )} +

    + This uses the pull request's recorded head commit, even after it is merged or its + source branch is deleted. Changes on the target branch are merged; conflicts stop + the cherry-pick. Nothing about this pull request changes. +

    +
    + + +
    +
    + )} + + ); +} diff --git a/samples/CodeFlow/src/components/CherryPickButton/__tests__/CherryPickButton.test.tsx b/samples/CodeFlow/src/components/CherryPickButton/__tests__/CherryPickButton.test.tsx new file mode 100644 index 0000000..9b6f016 --- /dev/null +++ b/samples/CodeFlow/src/components/CherryPickButton/__tests__/CherryPickButton.test.tsx @@ -0,0 +1,283 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import type { PrSummary } from '../../../types'; + +let pr: PrSummary | undefined; + +vi.mock('../../../state/useCodeFlow', () => ({ useCodeFlow: () => ({ pr }) })); +vi.mock('../../../services/githubService', () => ({ + GitHubService: { listBranches: vi.fn() }, +})); +vi.mock('../../../services/cherryPick', async () => { + // Only the pure half is real: importing the orchestration would drag the + // generated connector in with it. + const plan = await vi.importActual< + typeof import('../../../services/cherryPick/cherryPickPlan') + >('../../../services/cherryPick/cherryPickPlan'); + return { + ...plan, + previewCherryPick: vi.fn(), + cherryPickPullRequest: vi.fn(), + }; +}); + +import { GitHubService } from '../../../services/githubService'; +import { cherryPickPullRequest, previewCherryPick } from '../../../services/cherryPick'; +import { CherryPickButton } from '../CherryPickButton'; + +const listBranches = vi.mocked(GitHubService.listBranches); +const preview = vi.mocked(previewCherryPick); +const run = vi.mocked(cherryPickPullRequest); + +function makePr(over: Partial = {}): PrSummary { + return { + coordinates: { owner: 'octo', name: 'repo', number: 42 }, + title: 'Fix the crash', + state: 'closed', + draft: false, + merged: true, + author: { login: 'alice' }, + baseRef: 'main', + baseSha: 'basesha', + headRef: 'fix/crash', + headSha: 'headsha', + ...over, + }; +} + +const OPEN = { name: /^🍒 Cherry-pick$/ }; +const CONFIRM = { name: /cherry-pick pull request/i }; + +beforeEach(() => { + vi.clearAllMocks(); + pr = makePr(); + listBranches.mockResolvedValue(['main', 'release/1.0', 'fix/crash']); + preview.mockResolvedValue({ + files: [], + plan: { writes: ['a.ts', 'b.ts'], deletes: [], skipped: [] }, + overlap: [], + divergence: { known: true, changed: new Map() }, + }); + run.mockResolvedValue({ + branch: 'cherry-pick/pr-42-to-release/1.0', + branchUrl: 'https://github.com/octo/repo/tree/cherry-pick/pr-42-to-release/1.0', + written: ['a.ts', 'b.ts'], + deleted: [], + unchanged: [], + merged: [], + pullRequestOpened: true, + }); +}); + +/** Open the panel and choose a target, which is what every case starts from. */ +async function openWithTarget(target = 'release/1.0') { + fireEvent.click(screen.getByRole('button', OPEN)); + fireEvent.change(screen.getByRole('combobox', { name: /target branch/i }), { + target: { value: target }, + }); + await waitFor(() => expect(preview).toHaveBeenCalled()); +} + +describe('CherryPickButton', () => { + it('renders nothing without a pull request', () => { + pr = undefined; + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); + + it('offers the cherry-pick to someone who is not the author', () => { + pr = makePr({ author: { login: 'bob' } }); + render(); + expect(screen.getByRole('button', OPEN)).toBeEnabled(); + }); + + it('does not act on the first click — it asks first', () => { + render(); + fireEvent.click(screen.getByRole('button', OPEN)); + expect(run).not.toHaveBeenCalled(); + expect(screen.getByRole('dialog', { name: /cherry-pick pull request/i })).toBeInTheDocument(); + }); + + it('leaves out the branches this pull request already lives on', async () => { + render(); + fireEvent.click(screen.getByRole('button', OPEN)); + await waitFor(() => expect(listBranches).toHaveBeenCalled()); + await waitFor(() => { + const values = [...document.querySelectorAll('#cherry-pick-branches option')].map( + (o) => (o as HTMLOptionElement).value, + ); + expect(values).toEqual(['release/1.0']); + }); + }); + + it('suggests a branch name once a target is chosen', async () => { + render(); + await openWithTarget(); + expect(screen.getByRole('textbox', { name: /new branch/i })).toHaveValue( + 'cherry-pick/pr-42-to-release/1.0', + ); + }); + + it('stops re-suggesting once the reviewer names the branch themselves', async () => { + render(); + await openWithTarget(); + const name = screen.getByRole('textbox', { name: /new branch/i }); + fireEvent.change(name, { target: { value: 'my-backport' } }); + fireEvent.change(screen.getByRole('combobox', { name: /target branch/i }), { + target: { value: 'main' }, + }); + expect(name).toHaveValue('my-backport'); + }); + + it('says how many files would move', async () => { + render(); + await openWithTarget(); + await waitFor(() => + expect(screen.getByText(/2 files would be cherry-picked/i)).toBeInTheDocument(), + ); + }); + + it('says which files will be merged when the target has moved', async () => { + preview.mockResolvedValue({ + files: [], + plan: { writes: ['a.ts'], deletes: [], skipped: [] }, + overlap: ['a.ts'], + divergence: { known: true, changed: new Map([['a.ts', 'modified']]) }, + warning: + '1 file has also changed on release/1.0 since this pull request branched (a.ts). They’ll be merged; if any of them conflict, nothing is written.', + }); + render(); + await openWithTarget(); + await waitFor(() => + expect(screen.getByRole('status').textContent).toMatch(/also changed on release\/1\.0/), + ); + expect(screen.getByRole('status').textContent).toMatch(/merged/); + }); + + it('refuses a branch name git would reject, without calling out', async () => { + render(); + await openWithTarget(); + fireEvent.change(screen.getByRole('textbox', { name: /new branch/i }), { + target: { value: 'bad name' }, + }); + expect(screen.getByRole('alert').textContent).toMatch(/space/i); + expect(screen.getByRole('button', CONFIRM)).toBeDisabled(); + }); + + it('cherry-picks onto the chosen branch', async () => { + render(); + await openWithTarget(); + await waitFor(() => expect(screen.getByRole('button', CONFIRM)).toBeEnabled()); + fireEvent.click(screen.getByRole('button', CONFIRM)); + await waitFor(() => + expect(run).toHaveBeenCalledWith( + expect.objectContaining({ + targetBranch: 'release/1.0', + newBranch: 'cherry-pick/pr-42-to-release/1.0', + openPullRequest: true, + }), + ), + ); + }); + + it('cherry-picks a merged PR even when its source branch is no longer listed', async () => { + pr = makePr({ state: 'closed', merged: true, headRef: 'deleted/fix' }); + listBranches.mockResolvedValue(['main', 'release/1.0']); + render(); + expect(screen.getByRole('button', OPEN)).toBeEnabled(); + await openWithTarget(); + expect(screen.getByText(/even after it is merged or its source branch is deleted/)) + .toBeInTheDocument(); + await waitFor(() => expect(screen.getByRole('button', CONFIRM)).toBeEnabled()); + fireEvent.click(screen.getByRole('button', CONFIRM)); + + await waitFor(() => expect(run).toHaveBeenCalledWith(expect.objectContaining({ + pr, + targetBranch: 'release/1.0', + openPullRequest: true, + }))); + expect(await screen.findByRole('status')).toHaveTextContent('opened a pull request'); + }); + + it('can be told not to open a pull request', async () => { + render(); + await openWithTarget(); + fireEvent.click(screen.getByRole('checkbox')); + await waitFor(() => expect(screen.getByRole('button', CONFIRM)).toBeEnabled()); + fireEvent.click(screen.getByRole('button', CONFIRM)); + await waitFor(() => + expect(run).toHaveBeenCalledWith(expect.objectContaining({ openPullRequest: false })), + ); + }); + + it('closes the panel and links the branch it made', async () => { + render(); + await openWithTarget(); + await waitFor(() => expect(screen.getByRole('button', CONFIRM)).toBeEnabled()); + fireEvent.click(screen.getByRole('button', CONFIRM)); + await waitFor(() => + expect(screen.getByRole('link', { name: /cherry-pick\/pr-42/ })).toHaveAttribute( + 'href', + expect.stringContaining('/tree/cherry-pick/pr-42-to-release/1.0'), + ), + ); + expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); + }); + + it('reports which files had to be merged', async () => { + run.mockResolvedValue({ + branch: 'b', + branchUrl: 'https://github.com/octo/repo/tree/b', + written: ['a.ts'], + deleted: [], + unchanged: [], + merged: ['a.ts'], + pullRequestOpened: false, + }); + render(); + await openWithTarget(); + await waitFor(() => expect(screen.getByRole('button', CONFIRM)).toBeEnabled()); + fireEvent.click(screen.getByRole('button', CONFIRM)); + await waitFor(() => + expect( + screen.getByText(/1 file was merged with changes already on that branch/i), + ).toBeInTheDocument(), + ); + }); + + it('shows a conflict refusal in full, so the blocking files can be read', async () => { + run.mockRejectedValue( + new Error( + 'This pull request can’t be cherry-picked cleanly, so nothing was changed.\n\n• src/a.ts — it conflicts with release/1.0 in 2 places\n\nCherry-pick this one locally, where you can resolve the conflicts.', + ), + ); + render(); + await openWithTarget(); + await waitFor(() => expect(screen.getByRole('button', CONFIRM)).toBeEnabled()); + fireEvent.click(screen.getByRole('button', CONFIRM)); + await waitFor(() => + expect(screen.getByRole('alert').textContent).toMatch(/nothing was changed/), + ); + expect(screen.getByRole('alert').textContent).toMatch(/src\/a\.ts — it conflicts/); + }); + + it('surfaces the failure and keeps the panel open so it can be retried', async () => { + run.mockRejectedValue(new Error('Reference already exists')); + render(); + await openWithTarget(); + await waitFor(() => expect(screen.getByRole('button', CONFIRM)).toBeEnabled()); + fireEvent.click(screen.getByRole('button', CONFIRM)); + await waitFor(() => + expect(screen.getByRole('alert').textContent).toMatch(/Reference already exists/), + ); + expect(screen.getByRole('dialog')).toBeInTheDocument(); + }); + + it('lets the reviewer back out', async () => { + render(); + await openWithTarget(); + fireEvent.click(screen.getByRole('button', { name: /cancel/i })); + expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); + expect(run).not.toHaveBeenCalled(); + }); +}); diff --git a/samples/CodeFlow/src/components/CommentSummary/CommentSummary.tsx b/samples/CodeFlow/src/components/CommentSummary/CommentSummary.tsx new file mode 100644 index 0000000..df77082 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentSummary/CommentSummary.tsx @@ -0,0 +1,366 @@ +import { useEffect, useId, useMemo, useRef, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { getSettings } from '../../settings/settingsStore'; +import { relativeTime, timeTitle } from '../../utils/format'; +import { + countScopes, + countThreads, + filterThreadAuthors, + filterThreads, + scopeThreads, + summaryAuthors, + SUMMARY_SCOPE_LABELS, + SUMMARY_SCOPE_TITLES, + SUMMARY_SCOPES, + type SummaryAuthor, + type SummaryFilters, + type SummaryScope, +} from './summaryFilter'; +import { + ariaSort, + DEFAULT_SUMMARY_SORT, + nextSort, + sortHint, + sortThreads, + threadAuthor, + type SummarySort, + type SummarySortKey, +} from './summarySort'; +import { + THREAD_STATUS_LABELS, + threadDisplayStatus, + threadStatusLabel, + threadStatusTitle, +} from '../../utils/threadStatus'; +import { threadAnchorLabel, threadAnchorTitle } from '../../utils/threadAnchor'; + +type FilterKey = keyof SummaryFilters; + +const ALL_FILTERS: FilterKey[] = ['active', 'resolved', 'closed']; + +function AuthorFilter({ + authors, + excluded, + onChange, +}: { + authors: SummaryAuthor[]; + excluded: ReadonlySet; + onChange: (excluded: Set) => void; +}) { + const [open, setOpen] = useState(false); + const [placement, setPlacement] = useState({ above: true, maxHeight: 280, left: 0, edge: 0 }); + const rootRef = useRef(null); + const triggerRef = useRef(null); + const menuId = useId(); + const selectedCount = authors.filter((author) => !excluded.has(author.key)).length; + const allSelected = selectedCount === authors.length; + + useEffect(() => { + if (!open) return; + const onDown = (event: MouseEvent) => { + if (event.target instanceof Node && !rootRef.current?.contains(event.target)) { + setOpen(false); + } + }; + const onKey = (event: KeyboardEvent) => { + if (event.key === 'Escape') { + setOpen(false); + triggerRef.current?.focus(); + } + }; + const onResize = () => setOpen(false); + document.addEventListener('mousedown', onDown); + document.addEventListener('keydown', onKey); + window.addEventListener('resize', onResize); + return () => { + document.removeEventListener('mousedown', onDown); + document.removeEventListener('keydown', onKey); + window.removeEventListener('resize', onResize); + }; + }, [open]); + + const toggleOpen = () => { + const rect = triggerRef.current?.getBoundingClientRect(); + if (rect) { + const above = rect.top > window.innerHeight - rect.bottom; + const space = above ? rect.top : window.innerHeight - rect.bottom; + // Checkbox counts can reflow the toolbar; keep the open picker in place. + setPlacement({ + above, + maxHeight: Math.max(0, Math.min(280, space - 12)), + left: Math.max(14, Math.min(rect.left, window.innerWidth - 294)), + edge: (above ? window.innerHeight - rect.top : rect.bottom) + 4, + }); + } + setOpen((previous) => !previous); + }; + + const toggleAuthor = (key: string) => { + const next = new Set(excluded); + if (next.has(key)) next.delete(key); + else next.add(key); + onChange(next); + }; + + return ( +
    { + if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false); + }} + > + + {open && ( +
    +
    + + +
    +

    Authors who started threads, not replies.

    + {authors.length === 0 ? ( +

    No authors yet.

    + ) : authors.map((author) => ( + + ))} +
    + )} +
    + ); +} + +/** A column header you can click to order the list by that column. */ +function SortHeader({ + label, + sortKey, + sort, + onSort, +}: { + label: string; + sortKey: SummarySortKey; + sort: SummarySort; + onSort: (key: SummarySortKey) => void; +}) { + const active = sort.key === sortKey; + return ( + + + + ); +} + +export function CommentSummary() { + const { prKey } = useCodeFlow(); + return ; +} + +function PrCommentSummary() { + const { threads, threadsLoading, actions, focusRequest } = useCodeFlow(); + const [enabled, setEnabled] = useState(() => ({ + ...getSettings().summaryFilters, + })); + const [search, setSearch] = useState(''); + const [scope, setScope] = useState('all'); + const [sort, setSort] = useState(DEFAULT_SUMMARY_SORT); + const [excludedAuthors, setExcludedAuthors] = useState>(() => new Set()); + + const authors = useMemo(() => summaryAuthors(threads), [threads]); + const byAuthor = useMemo( + () => filterThreadAuthors(threads, excludedAuthors), + [threads, excludedAuthors], + ); + const scopeCounts = useMemo(() => countScopes(byAuthor), [byAuthor]); + + // Author and scope filters also narrow the status counts. + const scoped = useMemo(() => scopeThreads(byAuthor, scope), [byAuthor, scope]); + + const counts = useMemo(() => countThreads(scoped), [scoped]); + + const visible = useMemo( + () => sortThreads(filterThreads(scoped, enabled, search), sort), + [scoped, enabled, search, sort], + ); + + const toggle = (s: FilterKey) => + setEnabled((prev) => ({ ...prev, [s]: !prev[s] })); + + const applySort = (key: SummarySortKey) => setSort((prev) => nextSort(prev, key)); + + return ( +
    +
    + + Comments{' '} + {threadsLoading ? ( + … + ) : ( + {threads.length} + )} + +
    + {SUMMARY_SCOPES.map((s) => ( + + ))} +
    +
    + {ALL_FILTERS.map((s) => ( + + ))} +
    + + setSearch(e.target.value)} + /> +
    + +
    + {threadsLoading ? ( +
    + ⏳ Loading comments from GitHub… +
    + ) : visible.length === 0 ? ( +
    + {threads.length === 0 + ? 'No comments yet. Hover a line in the diff and click + to start a thread.' + : 'No comments match the current filters.'} +
    + ) : ( + + + + + + + + + + + + + + {visible.map((t) => { + const last = t.comments[t.comments.length - 1]; + const isCurrent = focusRequest?.threadId === t.id; + return ( + actions.focusThread(t.id)} + title="Jump to this comment" + > + + + + + + + + + ); + })} + +
    LineLast Comment
    + + {threadStatusLabel(t)} + + {t.filename} + {threadAnchorLabel(t)} + {threadAuthor(t)} + {last?.body} + {t.comments.length > 1 && ( + · {t.comments.length} comments + )} + + {relativeTime(t.updatedAt)} + e.stopPropagation()}> + +
    + )} +
    +
    + ); +} diff --git a/samples/CodeFlow/src/components/CommentSummary/__tests__/CommentSummary.test.tsx b/samples/CodeFlow/src/components/CommentSummary/__tests__/CommentSummary.test.tsx new file mode 100644 index 0000000..95e256c --- /dev/null +++ b/samples/CodeFlow/src/components/CommentSummary/__tests__/CommentSummary.test.tsx @@ -0,0 +1,462 @@ +import { describe, it, expect, vi } from 'vitest'; +import { render, screen, fireEvent, within } from '@testing-library/react'; +import { CommentSummary } from '../CommentSummary'; +import { absoluteTime } from '../../../utils/format'; +import type { CommentThread } from '../../../types'; + +function makeThread( + id: string, + filename = 'src/app.ts', + updatedAt = '2024-01-01T00:00:00Z', + extra: Partial = {}, +): CommentThread { + const now = '2024-01-01T00:00:00Z'; + return { + id, + prKey: 'owner/repo#1', + filename, + side: 'right', + line: 1, + status: 'active', + comments: [{ id: `${id}-c1`, author: { login: 'alice' }, body: `comment-${id}`, createdAt: now }], + createdAt: now, + updatedAt, + ...extra, + } as CommentThread; +} + +function makeCtx(threads: CommentThread[], focusedThreadId?: string) { + return { + prKey: 'owner/repo#1', + threads, + threadsLoading: false, + focusRequest: focusedThreadId ? { threadId: focusedThreadId, seq: 1 } : undefined, + actions: { + focusThread: vi.fn(), + setThreadClosed: vi.fn(), + }, + }; +} + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: vi.fn(), +})); + +vi.mock('../../../settings/settingsStore', () => ({ + getSettings: () => ({ summaryFilters: { active: true, resolved: true, closed: true } }), +})); + +import { useCodeFlow } from '../../../state/useCodeFlow'; +const mockUseCodeFlow = vi.mocked(useCodeFlow); + +describe('CommentSummary author filter', () => { + function authored( + id: string, + login: string, + extra: Partial = {}, + ): CommentThread { + return makeThread(id, 'src/app.ts', '2024-01-01T00:00:00Z', { + comments: [{ + id: `${id}-c1`, + author: { login, name: login === 'alice' ? 'Alice Ng' : undefined }, + body: `comment-${id}`, + createdAt: '2024-01-01T00:00:00Z', + }], + ...extra, + }); + } + + const mixed = () => [ + authored('alice', 'alice'), + authored('bob', 'bob'), + authored('bot', 'copilot[bot]'), + ]; + const trigger = () => screen.getByRole('button', { name: /^Authors:/ }); + const picker = () => screen.getByRole('group', { name: 'Filter comments by author' }); + const option = (login: string) => within(picker()).getByRole('checkbox', { + name: (name) => name.includes(`@${login}`), + }); + const setContext = (threads: CommentThread[], prKey = 'owner/repo#1') => { + const context = { ...makeCtx(threads), prKey }; + mockUseCodeFlow.mockReturnValue(context as unknown as ReturnType); + return context; + }; + + it('starts with all authors selected and lets you exclude a bot without losing row actions', () => { + const context = setContext(mixed()); + const { container } = render(); + expect(container.querySelectorAll('.summary__row')).toHaveLength(3); + expect(trigger()).toHaveTextContent('Authors: All'); + fireEvent.click(trigger()); + expect(within(picker()).getAllByRole('checkbox').every( + (checkbox) => (checkbox as HTMLInputElement).checked, + )).toBe(true); + + fireEvent.click(option('copilot[bot]')); + expect(trigger()).toHaveTextContent('Authors: 2 of 3'); + expect(screen.queryByText('comment-bot')).not.toBeInTheDocument(); + expect(screen.getByText('comment-alice')).toBeInTheDocument(); + expect(screen.getByText('comment-bob')).toBeInTheDocument(); + expect(option('copilot[bot]')).not.toBeChecked(); + fireEvent.click(screen.getByText('comment-alice')); + expect(context.actions.focusThread).toHaveBeenCalledWith('alice'); + const row = screen.getByText('comment-alice').closest('tr')!; + fireEvent.click(within(row).getByRole('button', { name: 'Close' })); + expect(context.actions.setThreadClosed).toHaveBeenCalledWith('alice', true); + }); + + it('can clear all, select multiple authors, and restore all', () => { + setContext(mixed()); + render(); + fireEvent.click(trigger()); + fireEvent.click(within(picker()).getByRole('button', { name: 'Clear all' })); + expect(trigger()).toHaveTextContent('Authors: 0 of 3'); + expect(screen.getByText('No comments match the current filters.')).toBeInTheDocument(); + + fireEvent.click(option('alice')); + fireEvent.click(option('bob')); + expect(screen.getByText('comment-alice')).toBeInTheDocument(); + expect(screen.getByText('comment-bob')).toBeInTheDocument(); + expect(screen.queryByText('comment-bot')).not.toBeInTheDocument(); + + fireEvent.click(within(picker()).getByRole('button', { name: 'Select all' })); + expect(trigger()).toHaveTextContent('Authors: All'); + expect(screen.getByText('comment-bot')).toBeInTheDocument(); + }); + + it('combines author selection with scope, status, search and sorting without removing picker options', () => { + setContext([ + authored('alice-inline', 'alice'), + authored('bob-inline', 'bob'), + authored('alice-top', 'alice', { isIssueComment: true, filename: '' }), + authored('alice-closed', 'alice', { closed: true }), + authored('bot', 'copilot[bot]'), + ]); + const { container } = render(); + fireEvent.click(trigger()); + fireEvent.click(option('copilot[bot]')); + expect(container.querySelector('.summary__filter--active .summary__count')).toHaveTextContent('3'); + const scopes = screen.getByRole('group', { name: 'Filter comments by level' }); + expect(within(scopes).getByRole('button', { name: /^All/ })).toHaveTextContent('4'); + + fireEvent.click(within(scopes).getByRole('button', { name: /^File-level/ })); + fireEvent.click(screen.getByRole('checkbox', { name: /^Closed/ })); + fireEvent.change(screen.getByPlaceholderText('Search comments'), { target: { value: 'inline' } }); + fireEvent.click(screen.getByRole('button', { name: 'Author' })); + expect(Array.from(container.querySelectorAll('.summary__author')).map((cell) => cell.textContent)) + .toEqual(['Alice Ng', 'bob']); + expect(container.querySelector('.summary__filter--active .summary__count')).toHaveTextContent('2'); + expect(within(picker()).getAllByRole('checkbox')).toHaveLength(3); + }); + + it('preserves exclusions across refreshes and includes newly arriving authors', () => { + setContext(mixed()); + const { rerender } = render(); + fireEvent.click(trigger()); + fireEvent.click(option('copilot[bot]')); + + setContext([]); + rerender(); + setContext([...mixed(), authored('carol', 'carol')]); + rerender(); + expect(option('copilot[bot]')).not.toBeChecked(); + expect(option('carol')).toBeChecked(); + expect(screen.queryByText('comment-bot')).not.toBeInTheDocument(); + expect(screen.getByText('comment-carol')).toBeInTheDocument(); + expect(trigger()).toHaveTextContent('Authors: 3 of 4'); + }); + + it('resets author selection when switching pull requests', () => { + setContext(mixed()); + const { rerender } = render(); + fireEvent.click(trigger()); + fireEvent.click(option('copilot[bot]')); + + setContext(mixed().map((thread) => ({ ...thread, prKey: 'owner/repo#2' })), 'owner/repo#2'); + rerender(); + expect(trigger()).toHaveTextContent('Authors: All'); + expect(trigger()).toHaveAttribute('aria-expanded', 'false'); + expect(screen.getByText('comment-bot')).toBeInTheDocument(); + }); + + it('closes on Escape with focus restored, outside click, and keyboard focus leaving the picker', () => { + setContext(mixed()); + render(); + fireEvent.click(trigger()); + option('alice').focus(); + fireEvent.keyDown(option('alice'), { key: 'Escape' }); + expect(trigger()).toHaveAttribute('aria-expanded', 'false'); + expect(trigger()).toHaveFocus(); + + fireEvent.click(trigger()); + fireEvent.mouseDown(screen.getByPlaceholderText('Search comments')); + expect(trigger()).toHaveAttribute('aria-expanded', 'false'); + fireEvent.click(trigger()); + fireEvent.blur(option('alice'), { relatedTarget: screen.getByPlaceholderText('Search comments') }); + expect(trigger()).toHaveAttribute('aria-expanded', 'false'); + }); + + it('keeps an empty picker and comment loading state explicit', () => { + const context = { ...makeCtx([]), threadsLoading: true }; + mockUseCodeFlow.mockReturnValue(context as unknown as ReturnType); + render(); + fireEvent.click(trigger()); + expect(screen.getByText('No authors yet.')).toBeInTheDocument(); + expect(screen.getByText(/Loading comments from GitHub/)).toBeInTheDocument(); + }); + + it('clamps the picker to the viewport and keeps its position when selections reflow the toolbar', () => { + setContext(mixed()); + render(); + const button = trigger(); + button.getBoundingClientRect = () => + new DOMRect(window.innerWidth - 80, window.innerHeight - 80, 80, 25); + fireEvent.click(button); + expect(picker()).toHaveStyle({ + left: `${window.innerWidth - 294}px`, + bottom: '84px', + maxHeight: '280px', + }); + + button.getBoundingClientRect = () => new DOMRect(14, window.innerHeight - 40, 120, 25); + fireEvent.click(option('copilot[bot]')); + expect(picker()).toHaveStyle({ left: `${window.innerWidth - 294}px`, bottom: '84px' }); + + fireEvent.keyDown(button, { key: 'Escape' }); + button.getBoundingClientRect = () => new DOMRect(14, 20, 120, 25); + fireEvent.click(button); + expect(picker()).toHaveStyle({ left: '14px', top: '49px', bottom: 'auto' }); + fireEvent(window, new Event('resize')); + expect(button).toHaveAttribute('aria-expanded', 'false'); + }); +}); + +describe('CommentSummary row highlighting', () => { + it('highlights only the focused thread, not other threads in the same file', () => { + const threads = [ + makeThread('t1', 'src/app.ts', '2024-03-01T00:00:00Z'), // newest → first row + makeThread('t2', 'src/app.ts', '2024-02-01T00:00:00Z'), + makeThread('t3', 'src/other.ts', '2024-01-01T00:00:00Z'), + ]; + mockUseCodeFlow.mockReturnValue(makeCtx(threads, 't1') as unknown as ReturnType); + + const { container } = render(); + const rows = container.querySelectorAll('tr.summary__row'); + const currentRows = container.querySelectorAll('tr.summary__row--current'); + + expect(rows.length).toBe(3); + // Exactly one row is highlighted + expect(currentRows.length).toBe(1); + // The highlighted row contains t1's unique preview body + expect(currentRows[0].textContent).toContain('comment-t1'); + // t2 (same file) and t3 (different file) are NOT highlighted + const notCurrent = Array.from(rows).filter((r) => !r.classList.contains('summary__row--current')); + expect(notCurrent.length).toBe(2); + }); + + it('does not highlight any row when no thread is focused', () => { + const threads = [makeThread('t1'), makeThread('t2')]; + mockUseCodeFlow.mockReturnValue(makeCtx(threads) as unknown as ReturnType); + + const { container } = render(); + const currentRows = container.querySelectorAll('tr.summary__row--current'); + expect(currentRows.length).toBe(0); + }); +}); + +describe('CommentSummary updated column', () => { + it('reveals the full datetime when you hover the relative time', () => { + const threads = [makeThread('t1', 'src/app.ts', '2024-03-01T09:15:00Z')]; + mockUseCodeFlow.mockReturnValue(makeCtx(threads) as unknown as ReturnType); + + const { container } = render(); + const cell = container.querySelector('td.summary__updated'); + expect(cell?.getAttribute('title')).toBe(absoluteTime('2024-03-01T09:15:00Z')); + }); +}); + +describe('CommentSummary level filter', () => { + const mixed = () => [ + makeThread('pr1', '', '2024-03-01T00:00:00Z', { isIssueComment: true }), + makeThread('inline1', 'src/app.ts', '2024-02-01T00:00:00Z'), + makeThread('inline2', 'src/other.ts', '2024-01-01T00:00:00Z'), + ]; + + const scopeButton = (label: string) => + within(screen.getByRole('group', { name: 'Filter comments by level' })).getByRole( + 'button', + { name: new RegExp(`^${label}`) }, + ); + + it('shows every comment until you narrow it', () => { + mockUseCodeFlow.mockReturnValue(makeCtx(mixed()) as unknown as ReturnType); + + const { container } = render(); + expect(container.querySelectorAll('tr.summary__row').length).toBe(3); + expect(scopeButton('All')).toHaveAttribute('aria-pressed', 'true'); + }); + + it('shows only file-level comments — the ones that can block the merge', () => { + mockUseCodeFlow.mockReturnValue(makeCtx(mixed()) as unknown as ReturnType); + + const { container } = render(); + fireEvent.click(scopeButton('File-level')); + + const rows = container.querySelectorAll('tr.summary__row'); + expect(rows.length).toBe(2); + expect(container.textContent).toContain('comment-inline1'); + expect(container.textContent).not.toContain('comment-pr1'); + expect(scopeButton('File-level')).toHaveAttribute('aria-pressed', 'true'); + }); + + it('shows only top-level comments', () => { + mockUseCodeFlow.mockReturnValue(makeCtx(mixed()) as unknown as ReturnType); + + const { container } = render(); + fireEvent.click(scopeButton('Top-level')); + + expect(container.querySelectorAll('tr.summary__row').length).toBe(1); + expect(container.textContent).toContain('comment-pr1'); + expect(container.textContent).not.toContain('comment-inline1'); + }); + + it('labels each level with how many comments it holds', () => { + mockUseCodeFlow.mockReturnValue(makeCtx(mixed()) as unknown as ReturnType); + + render(); + expect(scopeButton('All').textContent).toContain('3'); + expect(scopeButton('Top-level').textContent).toContain('1'); + expect(scopeButton('File-level').textContent).toContain('2'); + }); + + it('narrows the status counts to the chosen level', () => { + const threads = [ + makeThread('pr1', '', '2024-03-01T00:00:00Z', { isIssueComment: true }), + makeThread('inline1', 'src/app.ts', '2024-02-01T00:00:00Z'), + ]; + mockUseCodeFlow.mockReturnValue(makeCtx(threads) as unknown as ReturnType); + + const { container } = render(); + const activeCount = () => + container.querySelector('.summary__filter--active .summary__count')?.textContent; + + expect(activeCount()).toBe('2'); + fireEvent.click(scopeButton('Top-level')); + expect(activeCount()).toBe('1'); + }); + + it('explains that the level filter is why nothing is listed', () => { + const threads = [makeThread('pr1', '', '2024-03-01T00:00:00Z', { isIssueComment: true })]; + mockUseCodeFlow.mockReturnValue(makeCtx(threads) as unknown as ReturnType); + + const { container } = render(); + fireEvent.click(scopeButton('File-level')); + + expect(container.querySelector('.summary__empty')?.textContent).toContain( + 'No comments match the current filters', + ); + }); +}); + +describe('CommentSummary sorting', () => { + const byThreeAuthors = () => [ + makeThread('t-carol', 'src/app.ts', '2024-03-01T00:00:00Z', { + comments: [ + { id: 'c1', author: { login: 'carol' }, body: 'comment-t-carol', createdAt: '2024-01-01T00:00:00Z' }, + ], + }), + makeThread('t-alice', 'src/app.ts', '2024-02-01T00:00:00Z', { + comments: [ + { id: 'c2', author: { login: 'alice', name: 'Alice Ng' }, body: 'comment-t-alice', createdAt: '2024-01-01T00:00:00Z' }, + ], + }), + makeThread('t-bob', 'src/app.ts', '2024-01-01T00:00:00Z', { + comments: [ + { id: 'c3', author: { login: 'bob' }, body: 'comment-t-bob', createdAt: '2024-01-01T00:00:00Z' }, + ], + }), + ]; + + const authors = (container: HTMLElement) => + Array.from(container.querySelectorAll('td.summary__author')).map((c) => c.textContent); + + const header = (name: string) => screen.getByRole('button', { name }); + + const scopeButton = (label: string) => + within(screen.getByRole('group', { name: 'Filter comments by level' })).getByRole('button', { + name: new RegExp(`^${label}`), + }); + + it('lists newest activity first until you ask for something else', () => { + mockUseCodeFlow.mockReturnValue( + makeCtx(byThreeAuthors()) as unknown as ReturnType, + ); + + const { container } = render(); + expect(authors(container)).toEqual(['carol', 'Alice Ng', 'bob']); + }); + + it('sorts the comments by author when you click the Author header', () => { + mockUseCodeFlow.mockReturnValue( + makeCtx(byThreeAuthors()) as unknown as ReturnType, + ); + + const { container } = render(); + fireEvent.click(header('Author')); + + expect(authors(container)).toEqual(['Alice Ng', 'bob', 'carol']); + }); + + it('reverses the author order on a second click', () => { + mockUseCodeFlow.mockReturnValue( + makeCtx(byThreeAuthors()) as unknown as ReturnType, + ); + + const { container } = render(); + fireEvent.click(header('Author')); + fireEvent.click(header('Author')); + + expect(authors(container)).toEqual(['carol', 'bob', 'Alice Ng']); + }); + + it('announces which column the list is ordered by', () => { + mockUseCodeFlow.mockReturnValue( + makeCtx(byThreeAuthors()) as unknown as ReturnType, + ); + + render(); + expect(screen.getByRole('columnheader', { name: 'Updated' })).toHaveAttribute( + 'aria-sort', + 'descending', + ); + + fireEvent.click(header('Author')); + expect(screen.getByRole('columnheader', { name: 'Author' })).toHaveAttribute( + 'aria-sort', + 'ascending', + ); + expect(screen.getByRole('columnheader', { name: 'Updated' })).toHaveAttribute( + 'aria-sort', + 'none', + ); + }); + + it('keeps the chosen order while you narrow the list', () => { + const threads = [ + ...byThreeAuthors(), + makeThread('t-pr', '', '2024-04-01T00:00:00Z', { + isIssueComment: true, + comments: [ + { id: 'c4', author: { login: 'dave' }, body: 'comment-t-pr', createdAt: '2024-01-01T00:00:00Z' }, + ], + }), + ]; + mockUseCodeFlow.mockReturnValue(makeCtx(threads) as unknown as ReturnType); + + const { container } = render(); + fireEvent.click(header('Author')); + fireEvent.click(scopeButton('File-level')); + + expect(authors(container)).toEqual(['Alice Ng', 'bob', 'carol']); + }); +}); diff --git a/samples/CodeFlow/src/components/CommentSummary/__tests__/summaryFilter.test.ts b/samples/CodeFlow/src/components/CommentSummary/__tests__/summaryFilter.test.ts new file mode 100644 index 0000000..38fc58d --- /dev/null +++ b/samples/CodeFlow/src/components/CommentSummary/__tests__/summaryFilter.test.ts @@ -0,0 +1,276 @@ +import { describe, it, expect } from 'vitest'; +import { + countScopes, + countThreads, + filterThreadAuthors, + filterThreads, + scopeThreads, + summaryAuthors, + threadScope, + type SummaryFilters, +} from '../summaryFilter'; +import { DESCRIPTION_FILE, type CommentThread, type CommentThreadStatus } from '../../../types'; + +interface ThreadOpts { + id: string; + status?: CommentThreadStatus; + closed?: boolean; + filename?: string; + body?: string; + updatedAt?: string; + isIssueComment?: boolean; +} + +function makeThread(o: ThreadOpts): CommentThread { + return { + id: o.id, + prKey: 'owner/repo#1', + filename: o.filename ?? 'src/app.ts', + side: 'right', + line: 1, + status: o.status ?? 'active', + closed: o.closed, + isIssueComment: o.isIssueComment, + createdAt: '2024-01-01T00:00:00Z', + updatedAt: o.updatedAt ?? '2024-01-01T00:00:00Z', + comments: [ + { + id: `${o.id}-c1`, + author: { login: 'alice' }, + body: o.body ?? 'a comment', + createdAt: '2024-01-01T00:00:00Z', + }, + ], + } as CommentThread; +} + +const ALL: SummaryFilters = { active: true, resolved: true, closed: true }; + +describe('summary author filtering', () => { + const authored = (id: string, login: string, name?: string): CommentThread => { + const thread = makeThread({ id }); + thread.comments[0].author = { login, name }; + return thread; + }; + + it('deduplicates case-insensitive logins, keeps display names, and sorts the picker', () => { + const threads = [ + authored('bot', 'copilot[bot]'), + authored('alice1', 'alice'), + authored('alice2', 'Alice', 'Alice Ng'), + authored('alice3', 'ALICE'), + authored('bob', 'bob', 'Bob'), + ]; + expect(summaryAuthors(threads)).toEqual([ + { key: 'alice', login: 'Alice', label: 'Alice Ng' }, + { key: 'bob', login: 'bob', label: 'Bob' }, + { key: 'copilot[bot]', login: 'copilot[bot]', label: 'copilot[bot]' }, + ]); + }); + + it('distinguishes accounts with the same display name', () => { + const threads = [authored('a', 'alex1', 'Alex'), authored('b', 'alex2', 'Alex')]; + expect(summaryAuthors(threads).map((author) => author.key)).toEqual(['alex1', 'alex2']); + expect(filterThreadAuthors(threads, new Set(['alex1'])).map((thread) => thread.id)) + .toEqual(['b']); + }); + + it('filters whole threads by the starter, not the last reply', () => { + const human = authored('human', 'Alice'); + human.comments.push(authored('bot-reply', 'copilot[bot]').comments[0]); + const bot = authored('bot', 'copilot[bot]'); + bot.comments.push(authored('human-reply', 'bob').comments[0]); + const threads = [human, bot]; + + expect(summaryAuthors(threads).map((author) => author.key)).toEqual(['alice', 'copilot[bot]']); + expect(filterThreadAuthors(threads, new Set(['copilot[bot]']))).toEqual([human]); + expect(filterThreadAuthors(threads, new Set(['alice']))).toEqual([bot]); + expect(human.comments).toHaveLength(2); + }); + + it('defaults to all authors and supports excluding every author', () => { + const threads = [authored('a', 'alice'), authored('b', 'bob'), authored('c', 'carol')]; + expect(filterThreadAuthors(threads, new Set())).toEqual(threads); + expect(filterThreadAuthors(threads, new Set(['alice', 'bob'])).map((thread) => thread.id)) + .toEqual(['c']); + expect(filterThreadAuthors(threads, new Set(['alice', 'bob', 'carol']))).toEqual([]); + expect(summaryAuthors([])).toEqual([]); + }); + + it('includes unknown authors and empty threads without crashing or hiding them by default', () => { + const unknown = authored('unknown', ''); + const empty = { ...makeThread({ id: 'empty' }), comments: [] }; + const threads = [unknown, empty]; + expect(summaryAuthors(threads)).toEqual([{ key: '', login: '', label: 'Unknown author' }]); + expect(filterThreadAuthors(threads, new Set())).toEqual(threads); + expect(filterThreadAuthors(threads, new Set(['']))).toEqual([]); + }); + + it('leaves new authors selected while preserving exclusions', () => { + const threads = [authored('bot', 'copilot[bot]'), authored('new', 'new-reviewer')]; + expect(filterThreadAuthors(threads, new Set(['copilot[bot]'])).map((thread) => thread.id)) + .toEqual(['new']); + }); +}); + +describe('countThreads', () => { + it('buckets by GitHub status when not closed', () => { + const counts = countThreads([ + makeThread({ id: '1', status: 'active' }), + makeThread({ id: '2', status: 'active' }), + makeThread({ id: '3', status: 'resolved' }), + ]); + expect(counts).toEqual({ active: 2, resolved: 1, closed: 0 }); + }); + + it('counts closed threads only toward closed, regardless of status', () => { + const counts = countThreads([ + makeThread({ id: '1', status: 'active', closed: true }), + makeThread({ id: '2', status: 'resolved', closed: true }), + makeThread({ id: '3', status: 'active' }), + ]); + expect(counts).toEqual({ active: 1, resolved: 0, closed: 2 }); + }); +}); + +describe('filterThreads', () => { + it('gates closed threads by the closed filter only', () => { + const threads = [ + makeThread({ id: 'a', status: 'active', closed: true }), + makeThread({ id: 'b', status: 'active' }), + ]; + const hidden = filterThreads(threads, { ...ALL, closed: false }, ''); + expect(hidden.map((t) => t.id)).toEqual(['b']); + + const shown = filterThreads(threads, ALL, ''); + expect(shown.map((t) => t.id).sort()).toEqual(['a', 'b']); + }); + + it('does not additionally filter a closed thread by its GitHub status', () => { + const threads = [makeThread({ id: 'a', status: 'active', closed: true })]; + // active filter off, but closed on -> still visible because closed wins + const result = filterThreads(threads, { active: false, resolved: false, closed: true }, ''); + expect(result.map((t) => t.id)).toEqual(['a']); + }); + + it('filters non-closed threads by their status bucket', () => { + const threads = [ + makeThread({ id: 'a', status: 'active' }), + makeThread({ id: 'b', status: 'resolved' }), + ]; + const result = filterThreads(threads, { active: true, resolved: false, closed: true }, ''); + expect(result.map((t) => t.id)).toEqual(['a']); + }); + + it('matches search against filename and comment body', () => { + const threads = [ + makeThread({ id: 'a', filename: 'src/pipeline.yml', body: 'nothing' }), + makeThread({ id: 'b', filename: 'src/other.ts', body: 'fix the pipeline trigger' }), + makeThread({ id: 'c', filename: 'src/misc.ts', body: 'unrelated' }), + ]; + const result = filterThreads(threads, ALL, 'pipeline'); + expect(result.map((t) => t.id).sort()).toEqual(['a', 'b']); + }); + + it('sorts newest updated first', () => { + const threads = [ + makeThread({ id: 'old', updatedAt: '2024-01-01T00:00:00Z' }), + makeThread({ id: 'new', updatedAt: '2024-03-01T00:00:00Z' }), + makeThread({ id: 'mid', updatedAt: '2024-02-01T00:00:00Z' }), + ]; + const result = filterThreads(threads, ALL, ''); + expect(result.map((t) => t.id)).toEqual(['new', 'mid', 'old']); + }); +}); + +describe('threadScope', () => { + it('treats issue comments as top-level even when a filename came along', () => { + // GitHub hands issue comments an empty filename, but a stale local record + // could carry one; the explicit flag has to win. + expect(threadScope(makeThread({ id: 'a', isIssueComment: true, filename: 'src/app.ts' }))) + .toBe('top'); + }); + + it('treats an unanchored thread as top-level', () => { + expect(threadScope(makeThread({ id: 'a', filename: '' }))).toBe('top'); + expect(threadScope(makeThread({ id: 'b', filename: '(unknown)' }))).toBe('top'); + expect(threadScope(makeThread({ id: 'c', filename: DESCRIPTION_FILE }))).toBe('top'); + }); + + it('treats a thread anchored to a file as file-level', () => { + expect(threadScope(makeThread({ id: 'a', filename: 'src/app.ts' }))).toBe('file'); + }); +}); + +describe('countScopes', () => { + it('counts each scope and the unfiltered total', () => { + const counts = countScopes([ + makeThread({ id: '1', isIssueComment: true }), + makeThread({ id: '2', filename: '' }), + makeThread({ id: '3', filename: 'src/app.ts' }), + makeThread({ id: '4', filename: 'src/other.ts' }), + ]); + expect(counts).toEqual({ all: 4, top: 2, file: 2 }); + }); + + it('counts nothing for an empty PR', () => { + expect(countScopes([])).toEqual({ all: 0, top: 0, file: 0 }); + }); +}); + +describe('scopeThreads', () => { + const threads = [ + makeThread({ id: 'issue', isIssueComment: true }), + makeThread({ id: 'unanchored', filename: '' }), + makeThread({ id: 'inline', filename: 'src/app.ts' }), + ]; + + it('passes everything through for "all"', () => { + expect(scopeThreads(threads, 'all').map((t) => t.id)).toEqual([ + 'issue', + 'unanchored', + 'inline', + ]); + }); + + it('keeps only top-level threads for "top"', () => { + expect(scopeThreads(threads, 'top').map((t) => t.id)).toEqual(['issue', 'unanchored']); + }); + + it('keeps only file-level threads for "file"', () => { + expect(scopeThreads(threads, 'file').map((t) => t.id)).toEqual(['inline']); + }); + + it('narrows the status counts to the chosen scope', () => { + const mixed = [ + makeThread({ id: 'a', isIssueComment: true, status: 'active' }), + makeThread({ id: 'b', filename: 'src/app.ts', status: 'active' }), + makeThread({ id: 'c', filename: 'src/app.ts', status: 'resolved' }), + ]; + expect(countThreads(scopeThreads(mixed, 'file'))).toEqual({ + active: 1, + resolved: 1, + closed: 0, + }); + expect(countThreads(scopeThreads(mixed, 'top'))).toEqual({ + active: 1, + resolved: 0, + closed: 0, + }); + }); + + it('composes with the status filters and the search', () => { + const mixed = [ + makeThread({ id: 'a', isIssueComment: true, body: 'pipeline chatter' }), + makeThread({ id: 'b', filename: 'src/app.ts', body: 'pipeline fix' }), + makeThread({ id: 'c', filename: 'src/app.ts', body: 'unrelated' }), + makeThread({ id: 'd', filename: 'src/app.ts', body: 'pipeline fix', closed: true }), + ]; + const result = filterThreads( + scopeThreads(mixed, 'file'), + { ...ALL, closed: false }, + 'pipeline', + ); + expect(result.map((t) => t.id)).toEqual(['b']); + }); +}); diff --git a/samples/CodeFlow/src/components/CommentSummary/__tests__/summarySort.test.ts b/samples/CodeFlow/src/components/CommentSummary/__tests__/summarySort.test.ts new file mode 100644 index 0000000..ecad86d --- /dev/null +++ b/samples/CodeFlow/src/components/CommentSummary/__tests__/summarySort.test.ts @@ -0,0 +1,182 @@ +import { describe, it, expect } from 'vitest'; +import { + ariaSort, + DEFAULT_SUMMARY_SORT, + nextSort, + sortHint, + sortThreads, + threadAuthor, + type SummarySort, +} from '../summarySort'; +import type { CommentThread, CommentThreadStatus, GitUserRef } from '../../../types'; + +interface ThreadOpts { + id: string; + author?: GitUserRef | null; + filename?: string; + line?: number; + status?: CommentThreadStatus; + closed?: boolean; + updatedAt?: string; +} + +function makeThread(o: ThreadOpts): CommentThread { + const author = o.author === undefined ? { login: 'alice' } : o.author; + return { + id: o.id, + prKey: 'owner/repo#1', + filename: o.filename ?? 'src/app.ts', + side: 'right', + line: o.line ?? 1, + status: o.status ?? 'active', + closed: o.closed, + createdAt: '2024-01-01T00:00:00Z', + updatedAt: o.updatedAt ?? '2024-01-01T00:00:00Z', + comments: author + ? [{ id: `${o.id}-c1`, author, body: 'a comment', createdAt: '2024-01-01T00:00:00Z' }] + : [], + } as CommentThread; +} + +const by = (sort: SummarySort, threads: CommentThread[]) => + sortThreads(threads, sort).map((t) => t.id); + +describe('threadAuthor', () => { + it('prefers the display name, so the column and the order agree', () => { + expect(threadAuthor(makeThread({ id: 'a', author: { login: 'jamie', name: 'Jesse Parsons' } }))) + .toBe('Jesse Parsons'); + }); + + it('falls back to the login when there is no display name', () => { + expect(threadAuthor(makeThread({ id: 'a', author: { login: 'jamie' } }))).toBe('jamie'); + }); + + it('attributes a thread to whoever opened it, not whoever replied last', () => { + const thread = makeThread({ id: 'a', author: { login: 'alice' } }); + thread.comments.push({ + id: 'a-c2', + author: { login: 'zoe' }, + body: 'a reply', + createdAt: '2024-01-02T00:00:00Z', + }); + expect(threadAuthor(thread)).toBe('alice'); + }); + + it('is empty when the thread has no comments to attribute it to', () => { + expect(threadAuthor(makeThread({ id: 'a', author: null }))).toBe(''); + }); +}); + +describe('sortThreads by author', () => { + const cast = () => [ + makeThread({ id: 'carol', author: { login: 'carol' }, updatedAt: '2024-03-01T00:00:00Z' }), + makeThread({ id: 'alice', author: { login: 'alice' }, updatedAt: '2024-02-01T00:00:00Z' }), + makeThread({ id: 'bob', author: { login: 'Bob' }, updatedAt: '2024-01-01T00:00:00Z' }), + ]; + + it('orders A→Z, ignoring case', () => { + expect(by({ key: 'author', dir: 'asc' }, cast())).toEqual(['alice', 'bob', 'carol']); + }); + + it('reverses to Z→A', () => { + expect(by({ key: 'author', dir: 'desc' }, cast())).toEqual(['carol', 'bob', 'alice']); + }); + + it('keeps one author\u2019s threads newest first, so their list still reads chronologically', () => { + const threads = [ + makeThread({ id: 'old', author: { login: 'alice' }, updatedAt: '2024-01-01T00:00:00Z' }), + makeThread({ id: 'new', author: { login: 'alice' }, updatedAt: '2024-03-01T00:00:00Z' }), + makeThread({ id: 'mid', author: { login: 'alice' }, updatedAt: '2024-02-01T00:00:00Z' }), + ]; + expect(by({ key: 'author', dir: 'asc' }, threads)).toEqual(['new', 'mid', 'old']); + }); + + it('sinks unattributed threads to the bottom in both directions', () => { + const threads = [ + makeThread({ id: 'anon', author: null }), + makeThread({ id: 'zoe', author: { login: 'zoe' } }), + makeThread({ id: 'alice', author: { login: 'alice' } }), + ]; + expect(by({ key: 'author', dir: 'asc' }, threads)).toEqual(['alice', 'zoe', 'anon']); + expect(by({ key: 'author', dir: 'desc' }, threads)).toEqual(['zoe', 'alice', 'anon']); + }); + + it('leaves the caller\u2019s array untouched', () => { + const threads = cast(); + const ids = threads.map((t) => t.id); + sortThreads(threads, { key: 'author', dir: 'asc' }); + expect(threads.map((t) => t.id)).toEqual(ids); + }); +}); + +describe('sortThreads by the other columns', () => { + it('defaults to newest updated first', () => { + const threads = [ + makeThread({ id: 'old', updatedAt: '2024-01-01T00:00:00Z' }), + makeThread({ id: 'new', updatedAt: '2024-03-01T00:00:00Z' }), + makeThread({ id: 'mid', updatedAt: '2024-02-01T00:00:00Z' }), + ]; + expect(by(DEFAULT_SUMMARY_SORT, threads)).toEqual(['new', 'mid', 'old']); + expect(by({ key: 'updated', dir: 'asc' }, threads)).toEqual(['old', 'mid', 'new']); + }); + + it('groups a file together and walks it down the lines', () => { + const threads = [ + makeThread({ id: 'b-40', filename: 'src/b.ts', line: 40 }), + makeThread({ id: 'a-90', filename: 'src/a.ts', line: 90 }), + makeThread({ id: 'a-10', filename: 'src/a.ts', line: 10 }), + ]; + expect(by({ key: 'file', dir: 'asc' }, threads)).toEqual(['a-10', 'a-90', 'b-40']); + }); + + it('puts unresolved work first, then resolved, then closed', () => { + const threads = [ + makeThread({ id: 'closed', status: 'active', closed: true }), + makeThread({ id: 'resolved', status: 'resolved' }), + makeThread({ id: 'active', status: 'active' }), + ]; + expect(by({ key: 'status', dir: 'asc' }, threads)).toEqual(['active', 'resolved', 'closed']); + expect(by({ key: 'status', dir: 'desc' }, threads)).toEqual(['closed', 'resolved', 'active']); + }); +}); + +describe('nextSort', () => { + it('starts a name column at A→Z', () => { + expect(nextSort(DEFAULT_SUMMARY_SORT, 'author')).toEqual({ key: 'author', dir: 'asc' }); + expect(nextSort(DEFAULT_SUMMARY_SORT, 'file')).toEqual({ key: 'file', dir: 'asc' }); + }); + + it('starts the time column at newest first', () => { + expect(nextSort({ key: 'author', dir: 'asc' }, 'updated')).toEqual({ + key: 'updated', + dir: 'desc', + }); + }); + + it('flips the direction when the column is already the one in force', () => { + expect(nextSort({ key: 'author', dir: 'asc' }, 'author')).toEqual({ + key: 'author', + dir: 'desc', + }); + expect(nextSort({ key: 'author', dir: 'desc' }, 'author')).toEqual({ + key: 'author', + dir: 'asc', + }); + }); +}); + +describe('sort announcements', () => { + it('marks only the column actually in force', () => { + const sort: SummarySort = { key: 'author', dir: 'asc' }; + expect(ariaSort(sort, 'author')).toBe('ascending'); + expect(ariaSort({ ...sort, dir: 'desc' }, 'author')).toBe('descending'); + expect(ariaSort(sort, 'updated')).toBe('none'); + }); + + it('tells you what the next click would do', () => { + expect(sortHint(DEFAULT_SUMMARY_SORT, 'author', 'Author')).toBe('Sort by author, ascending'); + expect(sortHint({ key: 'author', dir: 'asc' }, 'author', 'Author')).toBe( + 'Sort by author, descending', + ); + }); +}); diff --git a/samples/CodeFlow/src/components/CommentSummary/summaryFilter.ts b/samples/CodeFlow/src/components/CommentSummary/summaryFilter.ts new file mode 100644 index 0000000..0891053 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentSummary/summaryFilter.ts @@ -0,0 +1,160 @@ +import { DESCRIPTION_FILE, type CommentThread } from '../../types'; +import { threadAuthor } from './summarySort'; + +export interface SummaryAuthor { + key: string; + login: string; + label: string; +} + +function authorKey(thread: CommentThread): string { + return (thread.comments[0]?.author.login ?? '').trim().toLowerCase(); +} + +/** Use the thread starter, matching the Author column, rather than reply authors. */ +export function summaryAuthors(threads: CommentThread[]): SummaryAuthor[] { + const authors = new Map(); + for (const thread of threads) { + const key = authorKey(thread); + const login = thread.comments[0]?.author.login.trim() ?? ''; + const label = key ? threadAuthor(thread) : 'Unknown author'; + const existing = authors.get(key); + if (!existing || existing.label === existing.login) { + authors.set(key, { key, login, label }); + } + } + return [...authors.values()].sort((a, b) => + a.label.localeCompare(b.label, undefined, { sensitivity: 'base', numeric: true }) + || a.key.localeCompare(b.key), + ); +} + +/** Exclusions keep newly arriving authors visible until explicitly unchecked. */ +export function filterThreadAuthors( + threads: CommentThread[], + excluded: ReadonlySet, +): CommentThread[] { + return threads.filter((thread) => !excluded.has(authorKey(thread))); +} + +/** + * Which thread buckets are visible in the summary panel. "closed" is the + * local-only review flag and takes precedence over the GitHub status: a closed + * thread is counted/filtered as closed regardless of its active/resolved state. + */ +export interface SummaryFilters { + active: boolean; + resolved: boolean; + closed: boolean; +} + +/** + * Which kind of conversation the summary is listing. + * + * The split earns its place because the two kinds carry different stakes: only + * *file-level* threads — inline review comments anchored to a file and line — + * can hold a merge up as an unresolved conversation. *Top-level* threads are + * GitHub issue comments on the pull request itself and never block it. A + * reviewer clearing the last obstacles to a merge wants one of those lists and + * not the other. + */ +export type SummaryScope = 'all' | 'top' | 'file'; + +export const SUMMARY_SCOPES: SummaryScope[] = ['all', 'top', 'file']; + +export const SUMMARY_SCOPE_LABELS: Record = { + all: 'All', + top: 'Top-level', + file: 'File-level', +}; + +export const SUMMARY_SCOPE_TITLES: Record = { + all: 'Every comment on this pull request', + top: 'Comments on the pull request itself — these never block the merge', + file: 'Inline comments on a file and line — these can block the merge while unresolved', +}; + +/** + * Classify one thread as top-level or file-level. + * + * `isIssueComment` is the authoritative signal, but a thread with no file + * anchor at all cannot be file-level whatever the backend recorded, so a + * missing or placeholder filename counts as top-level too. + * + * Deliberately *not* the rule the Description pane uses. That one also sweeps in + * review threads whose file has dropped out of the comparison, because it is + * choosing where to render something that would otherwise have nowhere to go. + * Here the question is whether the thread can block a merge, and an inline + * comment still can even when its file no longer appears in the diff. + */ +export function threadScope(thread: CommentThread): Exclude { + if (thread.isIssueComment) return 'top'; + if ( + !thread.filename || + thread.filename === '(unknown)' || + thread.filename === DESCRIPTION_FILE + ) { + return 'top'; + } + return 'file'; +} + +export type SummaryScopeCounts = Record; + +/** Count threads per scope, for the labels on the scope picker. */ +export function countScopes(threads: CommentThread[]): SummaryScopeCounts { + const counts: SummaryScopeCounts = { all: threads.length, top: 0, file: 0 }; + for (const t of threads) counts[threadScope(t)] += 1; + return counts; +} + +/** + * Narrow threads to one scope. Applied before the status buckets and the search + * so that both — the checkbox counts included — describe the list on screen. + */ +export function scopeThreads( + threads: CommentThread[], + scope: SummaryScope, +): CommentThread[] { + if (scope === 'all') return threads; + return threads.filter((t) => threadScope(t) === scope); +} + +export interface SummaryCounts { + active: number; + resolved: number; + closed: number; +} + +/** + * Count threads by bucket. Closed threads count only toward `closed`; every + * other thread counts toward its GitHub status. + */ +export function countThreads(threads: CommentThread[]): SummaryCounts { + const counts: SummaryCounts = { active: 0, resolved: 0, closed: 0 }; + for (const t of threads) { + if (t.closed) counts.closed += 1; + else counts[t.status] += 1; + } + return counts; +} + +/** + * Apply the bucket filters + a free-text search, then sort newest-updated + * first. Closed threads are gated solely by the `closed` filter. + */ +export function filterThreads( + threads: CommentThread[], + filters: SummaryFilters, + search: string, +): CommentThread[] { + const q = search.trim().toLowerCase(); + return threads + .filter((t) => (t.closed ? filters.closed : filters[t.status])) + .filter((t) => { + if (!q) return true; + if (t.filename.toLowerCase().includes(q)) return true; + return t.comments.some((c) => c.body.toLowerCase().includes(q)); + }) + .sort((a, b) => (a.updatedAt < b.updatedAt ? 1 : -1)); +} diff --git a/samples/CodeFlow/src/components/CommentSummary/summarySort.ts b/samples/CodeFlow/src/components/CommentSummary/summarySort.ts new file mode 100644 index 0000000..f5f08a3 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentSummary/summarySort.ts @@ -0,0 +1,121 @@ +import type { CommentThread } from '../../types'; +import { threadDisplayStatus, type ThreadDisplayStatus } from '../../utils/threadStatus'; + +/** + * Which column the summary list is ordered by. + * + * Only the columns that answer a question worth asking are sortable. "Author" + * is the one this exists for — reviewers work a PR one correspondent at a time + * ("what did Jesse raise?") and a strictly chronological list scatters that + * across the whole table. The rest come along because the same header row can + * carry them for free, and because "everything still open, oldest first" is the + * other list people build by hand. + */ +export type SummarySortKey = 'status' | 'file' | 'author' | 'updated'; + +export type SummarySortDir = 'asc' | 'desc'; + +export interface SummarySort { + key: SummarySortKey; + dir: SummarySortDir; +} + +/** Newest activity first — what the list showed before it could be re-sorted. */ +export const DEFAULT_SUMMARY_SORT: SummarySort = { key: 'updated', dir: 'desc' }; + +/** + * Where a column starts when you first click it. Names read forwards (A→Z) and + * times read backwards (newest first), so neither needs a second click to be + * useful. + */ +const NATURAL_DIR: Record = { + status: 'asc', + file: 'asc', + author: 'asc', + updated: 'desc', +}; + +/** Unresolved work first, then what has been dealt with. */ +const STATUS_RANK: Record = { + active: 0, + resolved: 1, + closed: 2, +}; + +/** + * Who a thread is filed under: whoever opened it, not whoever replied last. + * That matches the Author column, and it is the person you go looking for when + * you sort by author — a thread belongs to the reviewer who raised it. + */ +export function threadAuthor(thread: CommentThread): string { + const author = thread.comments[0]?.author; + return (author?.name || author?.login || '').trim(); +} + +/** Case-insensitive, and locale-aware so accented names land where they read. */ +function compareNames(a: string, b: string): number { + return a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true }); +} + +function compareBy(key: SummarySortKey, a: CommentThread, b: CommentThread): number { + switch (key) { + case 'status': + return STATUS_RANK[threadDisplayStatus(a)] - STATUS_RANK[threadDisplayStatus(b)]; + case 'file': { + const byName = compareNames(a.filename, b.filename); + // Within one file the line number is the only order that makes sense. + return byName !== 0 ? byName : a.line - b.line; + } + case 'author': + return compareNames(threadAuthor(a), threadAuthor(b)); + case 'updated': + return a.updatedAt < b.updatedAt ? -1 : a.updatedAt > b.updatedAt ? 1 : 0; + } +} + +/** + * Order threads for the summary table. + * + * Two rules keep the list from shuffling under the reader. Threads whose author + * is unknown sink to the bottom in *both* directions — reversing the sort should + * bring the last named author to the top, not a row with an empty cell. And + * every tie falls back to newest-updated first, so re-sorting by a coarse column + * like status leaves the familiar chronological order inside each group. + */ +export function sortThreads(threads: CommentThread[], sort: SummarySort): CommentThread[] { + const sign = sort.dir === 'asc' ? 1 : -1; + return [...threads].sort((a, b) => { + if (sort.key === 'author') { + const anon = Number(!threadAuthor(a)) - Number(!threadAuthor(b)); + if (anon !== 0) return anon; + } + const primary = compareBy(sort.key, a, b); + if (primary !== 0) return primary * sign; + if (a.updatedAt !== b.updatedAt) return a.updatedAt < b.updatedAt ? 1 : -1; + return a.id.localeCompare(b.id); + }); +} + +/** + * What clicking a header does: adopt the column at its natural direction, or + * flip the direction if it is already the one in force. + */ +export function nextSort(current: SummarySort, key: SummarySortKey): SummarySort { + if (current.key !== key) return { key, dir: NATURAL_DIR[key] }; + return { key, dir: current.dir === 'asc' ? 'desc' : 'asc' }; +} + +/** `aria-sort` for a header cell, so screen readers announce the order. */ +export function ariaSort( + sort: SummarySort, + key: SummarySortKey, +): 'ascending' | 'descending' | 'none' { + if (sort.key !== key) return 'none'; + return sort.dir === 'asc' ? 'ascending' : 'descending'; +} + +/** Tooltip explaining what the next click on this header would do. */ +export function sortHint(sort: SummarySort, key: SummarySortKey, label: string): string { + const next = nextSort(sort, key); + return `Sort by ${label.toLowerCase()}, ${next.dir === 'asc' ? 'ascending' : 'descending'}`; +} diff --git a/samples/CodeFlow/src/components/CommentThread/CollapsedThread.tsx b/samples/CodeFlow/src/components/CommentThread/CollapsedThread.tsx new file mode 100644 index 0000000..55f71b8 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentThread/CollapsedThread.tsx @@ -0,0 +1,37 @@ +import type { CommentThread } from '../../types'; +import { threadDisplayStatus, threadStatusLabel, threadStatusTitle } from '../../utils/threadStatus'; + +interface CollapsedThreadProps { + thread: CommentThread; + onExpand(): void; + /** Extra class for context-specific layout. */ + className?: string; +} + +/** + * Compact one-line stand-in for a collapsed thread: status, comment count and a + * preview of the opening comment. Shared by outdated (orphaned) threads in the + * diff and top-level conversations on the description, so both collapse the + * same way. + */ +export function CollapsedThread({ thread, onExpand, className }: CollapsedThreadProps) { + return ( + + ); +} diff --git a/samples/CodeFlow/src/components/CommentThread/CommentThread.tsx b/samples/CodeFlow/src/components/CommentThread/CommentThread.tsx new file mode 100644 index 0000000..81d43e4 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentThread/CommentThread.tsx @@ -0,0 +1,478 @@ +import { useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { Avatar } from '../Avatar'; +import { MarkdownBody } from '../MarkdownBody/MarkdownBody'; +import { MarkdownToolbar } from '../MarkdownToolbar/MarkdownToolbar'; +import { relativeTime, timeTitle } from '../../utils/format'; +import { buildDeepLink } from '../../utils/deepLink'; +import { githubCommentUrl } from '../../utils/githubLink'; +import { isSyncedBackend } from '../../utils/commentBackend'; +import { canDeleteComment, canEditComment } from '../../utils/commentEdit'; +import { editDraftKey, replyDraftKey } from '../../utils/commentDrafts'; +import { useDraft } from '../../utils/useDraft'; +import { CopyLinkButton } from '../CopyLinkButton/CopyLinkButton'; +import { commentLineLabel } from '../../utils/commentRange'; +import { + THREAD_STATUS_LABELS, + threadDisplayStatus, + threadStatusLabel, + threadStatusTitle, +} from '../../utils/threadStatus'; +import type { CommentThread as Thread, CommentThreadStatus } from '../../types'; + +const STATUS_OPTIONS: CommentThreadStatus[] = [ + 'active', + 'resolved', +]; + +interface CommentThreadProps { + thread: Thread; + onClose?(): void; + onCollapse?(): void; + /** Original line content for rendering suggestions. */ + originalLine?: string; + /** Line number the thread is anchored to. */ + lineNumber?: number; +} + +export function CommentThreadView({ thread, onClose, onCollapse, originalLine, lineNumber }: CommentThreadProps) { + const { actions, commentBackendLabel, currentUser, pr, prKey } = useCodeFlow(); + // Kept in storage rather than in memory alone: a poll that finds a new commit + // reloads the pull request, and the reload takes this whole tree down. + const [reply, setReply] = useDraft(replyDraftKey(prKey, thread.id)); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + // At most one comment is open for editing at a time — two half-finished edits + // in the same thread is a state nobody asked for. + const [editingId, setEditingId] = useState(null); + const [deletingId, setDeletingId] = useState(null); + const confirmingDeletion = thread.comments.some((c) => c.id === deletingId); + + const deleteComment = async (commentId: string) => { + setBusy(true); + setError(null); + try { + await actions.deleteComment(thread.id, commentId); + setDeletingId(null); + } catch (err) { + setError(err instanceof Error ? err.message : 'Failed to delete comment.'); + } finally { + setBusy(false); + } + }; + + const submitReply = async (resolve = false) => { + const body = reply.trim(); + if (!body || busy || confirmingDeletion) return; + setBusy(true); + setError(null); + // Empty the box now, not when the write comes back. `addComment` appends an + // optimistic copy to the thread immediately, so a draft still holding the + // same text would show the reply twice for as long as GitHub takes to + // answer — which is what it looked like the app had done. + setReply(''); + try { + await actions.addComment(thread.id, body); + if (resolve) await actions.setThreadStatus(thread.id, 'resolved'); + } catch (err) { + setError(err instanceof Error ? err.message : 'Failed to add reply.'); + // The optimistic copy is rolled back on failure, so put the text back + // rather than lose it — unless something new has been typed since. + setReply((cur) => (cur.trim() ? cur : body)); + } finally { + setBusy(false); + } + }; + + const firstComment = thread.comments[0]; + + const commentLink = pr + ? buildDeepLink({ + owner: pr.coordinates.owner, + repo: pr.coordinates.name, + number: pr.coordinates.number, + commentId: thread.id, + }) + : ''; + + // Two links, because they answer different questions: the deep link reopens + // the thread in CodeFlow, while this one names the comment on GitHub itself — + // the form you can hand to Copilot or anyone without the app. + const githubCommentLink = pr + ? githubCommentUrl({ + coords: pr.coordinates, + prHtmlUrl: pr.htmlUrl, + commentHtmlUrl: firstComment?.htmlUrl, + commentId: firstComment?.id, + isIssueComment: thread.isIssueComment, + }) + : ''; + + return ( +
    + {/* The header only advertises itself as clickable when a collapse handler + is wired up — a chevron that does nothing is worse than no chevron. */} +
    onCollapse() : undefined} + role={onCollapse ? 'button' : undefined} + tabIndex={onCollapse ? 0 : undefined} + title={onCollapse ? 'Collapse thread' : undefined} + onKeyDown={ + onCollapse + ? (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + onCollapse(); + } + } + : undefined + } + > + {onCollapse && ▶} + {/* One badge only: "closed" is a local flag that supersedes the GitHub + status, so a closed thread must not read "Active Closed". */} + + {threadStatusLabel(thread)} + + + {thread.isIssueComment + ? 'PR comment' + : `${thread.filename.split('/').pop()}:${commentLineLabel(thread)}`} + + {firstComment && ( + + {firstComment.author.name || firstComment.author.login} + + )} +
    e.stopPropagation()}> + + + + {/* GitHub can't resolve a PR-level conversation comment — only + review threads have a resolved state. */} + {!thread.isIssueComment && ( + + )} + {!isSyncedBackend(commentBackendLabel) && ( + + )} + {onClose && ( + + )} +
    +
    + +
      + {thread.comments.map((c) => ( +
    • + +
      +
      + {c.author.name || c.author.login} + + {relativeTime(c.createdAt)} + + {c.local && local} + {editingId !== c.id && canEditComment(c, currentUser) && ( + + )} + {editingId === null && canDeleteComment(c, currentUser) && ( + + )} +
      + {deletingId === c.id && ( +
      + + Delete this comment{c.local ? '' : ' from GitHub'}? This cannot be undone. Replies are kept. + + + +
      + )} + {editingId === c.id ? ( + setEditingId(null)} + onSave={async (body) => { + await actions.editComment(thread.id, c.id, body); + setEditingId(null); + }} + /> + ) : ( + + )} +
      +
    • + ))} +
    + +
    + { + if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') + void submitReply(e.shiftKey && !thread.isIssueComment); + }} + /> +
    + + {thread.status !== 'resolved' && !thread.isIssueComment && ( + + )} +
    + {error &&
    {error}
    } +
    +
    + ); +} + +interface CommentEditorProps { + initialBody: string; + onSave(body: string): Promise; + onCancel(): void; + /** Original source line for the code suggestion button. */ + originalLine?: string; + /** Where to persist the in-progress edit; `null` keeps it in memory only. */ + draftKey?: string | null; +} + +/** + * In-place editor for a comment that's already been posted. + * + * Deliberately not the same component as {@link NewCommentComposer}: the draft + * starts populated, an empty body is a no-op rather than a submission, and a + * failure has to keep the editor open with the text intact — the alternative is + * a rejected edit that discards what the author just wrote. + */ +export function CommentEditor({ initialBody, onSave, onCancel, originalLine, draftKey = null }: CommentEditorProps) { + const [body, setBody, clearBody] = useDraft(draftKey, initialBody); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + + const changed = body.trim() !== initialBody.trim(); + + // Cancelling is an explicit discard, so the stored copy goes with it — + // otherwise reopening the editor would resurrect text the author rejected. + const cancel = () => { + clearBody(); + onCancel(); + }; + + const submit = async () => { + const text = body.trim(); + // Saving an unchanged comment would burn a round trip and a version in + // GitHub's edit history to achieve nothing. + if (!text || !changed) { + cancel(); + return; + } + setBusy(true); + setError(null); + try { + await onSave(text); + clearBody(); + } catch (err) { + setError(err instanceof Error ? err.message : 'Failed to save this comment.'); + } finally { + setBusy(false); + } + }; + + return ( +
    + { + if (e.key === 'Escape') cancel(); + if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') void submit(); + }} + /> +
    + + + ⌘/Ctrl + Enter +
    + {error &&
    {error}
    } +
    + ); +} + +interface ComposerProps { + onSubmit(body: string): Promise | void; + onCancel(): void; + placeholder?: string; + /** Original source line for the code suggestion button. */ + originalLine?: string; + /** Where to persist the in-progress comment; `null` keeps it in memory only. */ + draftKey?: string | null; +} + +/** Standalone composer used to start a brand-new thread on a line. */ +export function NewCommentComposer({ onSubmit, onCancel, placeholder, originalLine, draftKey = null }: ComposerProps) { + const [body, setBody, clearBody] = useDraft(draftKey); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + + const cancel = () => { + if (busy) return; + clearBody(); + onCancel(); + }; + + const submit = async () => { + const text = body.trim(); + if (!text || busy) return; + setBusy(true); + setError(null); + // Clear the draft at the moment the thread appears optimistically above the + // composer, so the comment isn't rendered twice while the write is in + // flight. The button carries the progress instead. + setBody(''); + try { + await onSubmit(text); + } catch (err) { + // Keep the composer open and put the draft back so the text isn't lost. + setError(err instanceof Error ? err.message : 'Failed to add comment.'); + setBody((cur) => (cur.trim() ? cur : text)); + } finally { + setBusy(false); + } + }; + + return ( +
    + { + if (e.key === 'Escape') cancel(); + if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') void submit(); + }} + /> +
    + + + ⌘/Ctrl + Enter +
    + {error &&
    {error}
    } +
    + ); +} diff --git a/samples/CodeFlow/src/components/CommentThread/__tests__/CommentThread.test.tsx b/samples/CodeFlow/src/components/CommentThread/__tests__/CommentThread.test.tsx new file mode 100644 index 0000000..e020512 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentThread/__tests__/CommentThread.test.tsx @@ -0,0 +1,547 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent, waitFor, act } from '@testing-library/react'; +import { CommentThreadView, NewCommentComposer } from '../CommentThread'; +import { absoluteTime } from '../../../utils/format'; +import type { CommentThread } from '../../../types'; + +const addComment = vi.fn(async () => {}); +const setThreadStatus = vi.fn(async () => {}); +const editComment = vi.fn(async () => {}); +const deleteComment = vi.fn(async () => {}); + +const mockCtx: { + pr: null; + commentBackendLabel: string; + currentUser?: { login: string }; + actions: Record; +} = { + pr: null, + commentBackendLabel: 'GitHub', + currentUser: { login: 'alice' }, + actions: { + addComment, + setThreadStatus, + editComment, + deleteComment, + setThreadClosed: vi.fn(), + deleteThread: vi.fn(), + }, +}; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => mockCtx, +})); + +function thread(overrides: Partial = {}): CommentThread { + const now = '2024-01-01T00:00:00Z'; + return { + id: 't1', + prKey: 'o/r#1', + filename: 'src/app.ts', + side: 'right', + line: 12, + status: 'active', + comments: [ + { id: 'c1', author: { login: 'alice' }, body: 'please fix', createdAt: now, nodeId: 'PRRC_1' }, + ], + createdAt: now, + updatedAt: now, + ...overrides, + }; +} + +function typeReply(text: string) { + const box = screen.getByPlaceholderText('Reply…') as HTMLTextAreaElement; + fireEvent.change(box, { target: { value: text, selectionStart: text.length } }); + return box; +} + +describe('CommentThreadView reply actions', () => { + beforeEach(() => { + addComment.mockClear(); + setThreadStatus.mockClear(); + }); + + it('replies without resolving', async () => { + render(); + typeReply('done'); + fireEvent.click(screen.getByRole('button', { name: 'Reply' })); + + await waitFor(() => expect(addComment).toHaveBeenCalledWith('t1', 'done')); + expect(setThreadStatus).not.toHaveBeenCalled(); + }); + + it('replies and resolves the thread', async () => { + render(); + typeReply('fixed it'); + fireEvent.click(screen.getByRole('button', { name: /Reply & Resolve/ })); + + await waitFor(() => expect(addComment).toHaveBeenCalledWith('t1', 'fixed it')); + await waitFor(() => expect(setThreadStatus).toHaveBeenCalledWith('t1', 'resolved')); + }); + + it('does not resolve when the reply fails', async () => { + addComment.mockRejectedValueOnce(new Error('nope')); + render(); + typeReply('fixed it'); + fireEvent.click(screen.getByRole('button', { name: /Reply & Resolve/ })); + + expect(await screen.findByRole('alert')).toHaveTextContent('nope'); + expect(setThreadStatus).not.toHaveBeenCalled(); + }); + + it('hides Reply & Resolve on an already resolved thread', () => { + render(); + expect(screen.getByRole('button', { name: 'Reply' })).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /Reply & Resolve/ })).toBeNull(); + }); + + it('resolves on Ctrl+Shift+Enter and only replies on Ctrl+Enter', async () => { + render(); + const box = typeReply('shortcut'); + + fireEvent.keyDown(box, { key: 'Enter', ctrlKey: true }); + await waitFor(() => expect(addComment).toHaveBeenCalledTimes(1)); + expect(setThreadStatus).not.toHaveBeenCalled(); + + fireEvent.change(box, { target: { value: 'shortcut 2', selectionStart: 10 } }); + fireEvent.keyDown(box, { key: 'Enter', ctrlKey: true, shiftKey: true }); + await waitFor(() => expect(setThreadStatus).toHaveBeenCalledWith('t1', 'resolved')); + }); +}); + +describe('CommentThreadView status picker', () => { + beforeEach(() => { + setThreadStatus.mockClear(); + setThreadStatus.mockResolvedValue(undefined); + }); + + it('asks for the status the reviewer picked', async () => { + render(); + fireEvent.change(screen.getByLabelText('Thread status'), { target: { value: 'active' } }); + await waitFor(() => expect(setThreadStatus).toHaveBeenCalledWith('t1', 'active')); + }); + + /** + * A revert with nothing said is indistinguishable from the app undoing the + * change by itself, which is how the re-resolving thread was first reported. + */ + it('says why the status snapped back when the change is refused', async () => { + setThreadStatus.mockRejectedValueOnce(new Error('Failed to unresolve_review_thread')); + render(); + fireEvent.change(screen.getByLabelText('Thread status'), { target: { value: 'active' } }); + + expect(await screen.findByRole('alert')).toHaveTextContent( + 'Failed to unresolve_review_thread', + ); + }); +}); + +describe('CommentThreadView reply draft', () => { + beforeEach(() => { + addComment.mockClear(); + addComment.mockResolvedValue(undefined); + }); + + const replyBox = () => screen.getByPlaceholderText('Reply…') as HTMLTextAreaElement; + + it('empties the box the moment the reply is sent, not when it lands', async () => { + // The thread shows an optimistic copy of the reply straight away, so a + // draft still holding the same text renders it twice until GitHub answers. + let land!: () => void; + addComment.mockImplementationOnce( + () => new Promise((resolve) => { land = () => resolve(); }), + ); + render(); + typeReply('done'); + fireEvent.click(screen.getByRole('button', { name: 'Reply' })); + + await waitFor(() => expect(addComment).toHaveBeenCalledWith('t1', 'done')); + expect(replyBox().value).toBe(''); + + await act(async () => { land(); }); + expect(replyBox().value).toBe(''); + }); + + it('puts the text back when the reply is refused', async () => { + addComment.mockRejectedValueOnce(new Error('nope')); + render(); + typeReply('done'); + fireEvent.click(screen.getByRole('button', { name: 'Reply' })); + + expect(await screen.findByRole('alert')).toHaveTextContent('nope'); + expect(replyBox().value).toBe('done'); + }); + + it('keeps a newly typed draft rather than restoring the failed one', async () => { + let fail!: () => void; + addComment.mockImplementationOnce( + () => new Promise((_, reject) => { fail = () => reject(new Error('nope')); }), + ); + render(); + typeReply('first'); + fireEvent.click(screen.getByRole('button', { name: 'Reply' })); + await waitFor(() => expect(addComment).toHaveBeenCalled()); + + typeReply('second thoughts'); + await act(async () => { fail(); }); + + expect(replyBox().value).toBe('second thoughts'); + }); +}); + +describe('CommentThreadView collapse affordance', () => { + it('calls onCollapse when the header is clicked', () => { + const onCollapse = vi.fn(); + const { container } = render( + , + ); + fireEvent.click(container.querySelector('.thread__head')!); + expect(onCollapse).toHaveBeenCalledTimes(1); + }); + + it('collapses on Enter and Space from the keyboard', () => { + const onCollapse = vi.fn(); + const { container } = render(); + const head = container.querySelector('.thread__head')!; + fireEvent.keyDown(head, { key: 'Enter' }); + fireEvent.keyDown(head, { key: ' ' }); + expect(onCollapse).toHaveBeenCalledTimes(2); + }); + + it('shows the chevron only when the thread can actually be collapsed', () => { + const withHandler = render( {}} />); + expect(withHandler.container.querySelector('.thread__chevron')).not.toBeNull(); + expect(withHandler.container.querySelector('.thread__head')!.getAttribute('role')).toBe('button'); + withHandler.unmount(); + + const withoutHandler = render(); + expect(withoutHandler.container.querySelector('.thread__chevron')).toBeNull(); + expect(withoutHandler.container.querySelector('.thread__head')!.getAttribute('role')).toBeNull(); + }); +}); + +describe('CommentThreadView status dropdown', () => { + it('shows Active in the dropdown on an open active thread', () => { + render(); + const select = screen.getByRole('combobox', { name: 'Thread status' }) as HTMLSelectElement; + expect(select.value).toBe('active'); + expect(select).not.toBeDisabled(); + }); + + it('shows Closed in the status dropdown when the thread is closed', () => { + render(); + const select = screen.getByRole('combobox', { name: 'Thread status' }) as HTMLSelectElement; + expect(select.value).toBe('closed'); + expect(select).toBeDisabled(); + }); + + it('shows Closed even when the underlying GitHub status is resolved', () => { + render(); + const select = screen.getByRole('combobox', { name: 'Thread status' }) as HTMLSelectElement; + expect(select.value).toBe('closed'); + expect(select).toBeDisabled(); + }); +}); + +describe('CommentThreadView status badge', () => { + it('shows the GitHub status on an open thread', () => { + const { container } = render(); + const badges = container.querySelectorAll('.thread__status'); + expect(badges).toHaveLength(1); + expect(badges[0].textContent).toBe('Active'); + }); + + it('shows only Closed — never "Active Closed" — on a closed thread', () => { + const { container } = render(); + const badges = container.querySelectorAll('.thread__status'); + expect(badges).toHaveLength(1); + expect(badges[0].textContent).toBe('Closed'); + expect(container.querySelector('.thread__head')!.textContent).not.toContain('Active Closed'); + }); + + it('shows only Closed on a closed description (issue) comment thread', () => { + const { container } = render( + , + ); + const badges = container.querySelectorAll('.thread__status'); + expect(badges).toHaveLength(1); + expect(badges[0].textContent).toBe('Closed'); + expect(badges[0].getAttribute('title')).toContain('GitHub status: Active'); + }); + + it('collapses a resolved + closed thread to a single Closed badge', () => { + const { container } = render( + , + ); + const badges = container.querySelectorAll('.thread__status'); + expect(badges).toHaveLength(1); + expect(badges[0].textContent).toBe('Closed'); + }); +}); + +describe('CommentThreadView editing your own comment', () => { + beforeEach(() => { + editComment.mockClear(); + editComment.mockResolvedValue(undefined); + mockCtx.currentUser = { login: 'alice' }; + }); + + it('offers Edit on your own comment', () => { + render(); + expect(screen.getByRole('button', { name: 'Edit' })).toBeInTheDocument(); + }); + + it('does not offer Edit on somebody else’s comment', () => { + // GitHub refuses an edit by anyone but the author, so the button would only + // ever produce a permission error. + mockCtx.currentUser = { login: 'bob' }; + render(); + expect(screen.queryByRole('button', { name: 'Edit' })).toBeNull(); + }); + + it('does not offer Edit when nobody is signed in', () => { + mockCtx.currentUser = undefined; + render(); + expect(screen.queryByRole('button', { name: 'Edit' })).toBeNull(); + }); + + it('saves the edited text and closes the editor', async () => { + render(); + fireEvent.click(screen.getByRole('button', { name: 'Edit' })); + + const box = screen.getByPlaceholderText('Edit your comment…') as HTMLTextAreaElement; + // The draft starts populated, which is the point — an edit is a revision. + expect(box.value).toBe('please fix'); + fireEvent.change(box, { target: { value: 'fixed, thanks' } }); + fireEvent.click(screen.getByRole('button', { name: 'Save' })); + + await waitFor(() => expect(editComment).toHaveBeenCalledWith('t1', 'c1', 'fixed, thanks')); + await waitFor(() => + expect(screen.queryByPlaceholderText('Edit your comment…')).toBeNull(), + ); + }); + + it('keeps the editor open with the draft when the save is refused', async () => { + // Losing what the author just typed is worse than the failed save. + editComment.mockRejectedValueOnce(new Error('not the author')); + render(); + fireEvent.click(screen.getByRole('button', { name: 'Edit' })); + + const box = screen.getByPlaceholderText('Edit your comment…') as HTMLTextAreaElement; + fireEvent.change(box, { target: { value: 'fixed, thanks' } }); + fireEvent.click(screen.getByRole('button', { name: 'Save' })); + + expect(await screen.findByRole('alert')).toHaveTextContent('not the author'); + expect( + (screen.getByPlaceholderText('Edit your comment…') as HTMLTextAreaElement).value, + ).toBe('fixed, thanks'); + }); + + it('discards the draft on Cancel', () => { + render(); + fireEvent.click(screen.getByRole('button', { name: 'Edit' })); + fireEvent.change(screen.getByPlaceholderText('Edit your comment…'), { + target: { value: 'never mind' }, + }); + fireEvent.click(screen.getByRole('button', { name: 'Cancel' })); + + expect(screen.queryByPlaceholderText('Edit your comment…')).toBeNull(); + expect(editComment).not.toHaveBeenCalled(); + }); + + it('does not spend a round trip when nothing changed', async () => { + // An unchanged save would still burn a version in GitHub's edit history. + render(); + fireEvent.click(screen.getByRole('button', { name: 'Edit' })); + fireEvent.click(screen.getByRole('button', { name: 'Save' })); + + await waitFor(() => expect(screen.queryByPlaceholderText('Edit your comment…')).toBeNull()); + expect(editComment).not.toHaveBeenCalled(); + }); +}); + +describe('CommentThreadView deleting your own comment', () => { + beforeEach(() => { + deleteComment.mockReset(); + deleteComment.mockResolvedValue(undefined); + addComment.mockClear(); + mockCtx.currentUser = { login: 'alice' }; + mockCtx.commentBackendLabel = 'GitHub'; + }); + + it.each([false, true])('confirms before deleting a saved comment (PR-level: %s)', async (isIssueComment) => { + render(); + expect(screen.getByRole('button', { name: 'Close' })).toBeInTheDocument(); + fireEvent.click(screen.getByRole('button', { name: 'Delete' })); + expect(deleteComment).not.toHaveBeenCalled(); + expect(screen.getByRole('group', { name: 'Confirm comment deletion' })).toHaveTextContent( + 'Delete this comment from GitHub? This cannot be undone. Replies are kept.', + ); + fireEvent.click(screen.getByRole('button', { name: 'Delete comment' })); + await waitFor(() => expect(deleteComment).toHaveBeenCalledExactlyOnceWith('t1', 'c1')); + await waitFor(() => expect(screen.queryByRole('group', { name: 'Confirm comment deletion' })).toBeNull()); + }); + + it('cancels without deleting or losing the reply draft', () => { + render(); + typeReply('unsent reply'); + fireEvent.click(screen.getByRole('button', { name: 'Delete' })); + fireEvent.click(screen.getByRole('button', { name: 'Cancel deletion' })); + expect(deleteComment).not.toHaveBeenCalled(); + expect(screen.getByText('please fix')).toBeInTheDocument(); + expect(screen.getByPlaceholderText('Reply…')).toHaveValue('unsent reply'); + }); + + it('shows a failure with the comment and draft intact, and allows a retry', async () => { + deleteComment.mockRejectedValueOnce(new Error('permission denied')); + render(); + typeReply('unsent reply'); + fireEvent.click(screen.getByRole('button', { name: 'Delete' })); + fireEvent.click(screen.getByRole('button', { name: 'Delete comment' })); + expect(await screen.findByRole('alert')).toHaveTextContent('permission denied'); + expect(screen.getByText('please fix')).toBeInTheDocument(); + expect(screen.getByPlaceholderText('Reply…')).toHaveValue('unsent reply'); + expect(screen.getByRole('button', { name: 'Delete comment' })).toBeEnabled(); + fireEvent.click(screen.getByRole('button', { name: 'Delete comment' })); + await waitFor(() => expect(deleteComment).toHaveBeenCalledTimes(2)); + await waitFor(() => expect(screen.queryByRole('alert')).toBeNull()); + }); + + it('disables duplicate deletion, edits and keyboard replies while deleting', async () => { + let finish!: () => void; + deleteComment.mockImplementationOnce( + () => new Promise((resolve) => { finish = resolve; }), + ); + render(); + const box = typeReply('unsent'); + fireEvent.click(screen.getByRole('button', { name: 'Delete' })); + fireEvent.click(screen.getByRole('button', { name: 'Delete comment' })); + expect(screen.getByRole('button', { name: 'Deleting...' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Cancel deletion' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Edit' })).toBeDisabled(); + fireEvent.keyDown(box, { key: 'Enter', ctrlKey: true }); + expect(addComment).not.toHaveBeenCalled(); + await act(async () => { finish(); }); + expect(deleteComment).toHaveBeenCalledTimes(1); + }); + + it('targets an authored reply rather than deleting its conversation', async () => { + const root = thread().comments[0]; + render(); + expect(screen.getAllByRole('button', { name: 'Delete' })).toHaveLength(1); + fireEvent.click(screen.getByRole('button', { name: 'Delete' })); + fireEvent.click(screen.getByRole('button', { name: 'Delete comment' })); + await waitFor(() => expect(deleteComment).toHaveBeenCalledWith('t1', 'reply')); + }); + + it('does not offer deletion on another author, a pending comment or an unaddressable comment', () => { + const root = thread().comments[0]; + render(); + expect(screen.queryByRole('button', { name: 'Delete' })).toBeNull(); + }); + + it('does not offer deletion while signed out or editing', () => { + mockCtx.currentUser = undefined; + const { rerender } = render(); + expect(screen.queryByRole('button', { name: 'Delete' })).toBeNull(); + mockCtx.currentUser = { login: 'alice' }; + rerender(); + fireEvent.click(screen.getByRole('button', { name: 'Edit' })); + expect(screen.queryByRole('button', { name: 'Delete' })).toBeNull(); + }); + + it('also offers individual local-comment deletion without promising a GitHub write', () => { + mockCtx.commentBackendLabel = 'Local (this device)'; + render(); + fireEvent.click(screen.getByRole('button', { name: 'Delete' })); + expect(screen.getByRole('group', { name: 'Confirm comment deletion' })).not.toHaveTextContent('from GitHub'); + }); + + it('does not strand the thread if a refresh removes the comment being confirmed', () => { + const root = thread().comments[0]; + const reply = { ...root, id: 'reply', body: 'kept reply' }; + const { rerender } = render(); + typeReply('draft'); + fireEvent.click(screen.getAllByRole('button', { name: 'Delete' })[0]); + rerender(); + expect(screen.getByRole('button', { name: 'Delete' })).toBeEnabled(); + expect(screen.getByRole('button', { name: 'Reply' })).toBeEnabled(); + }); +}); + +describe('NewCommentComposer draft', () => { + const composerBox = () => + screen.getByPlaceholderText('Start a comment thread…') as HTMLTextAreaElement; + + function type(text: string) { + fireEvent.change(composerBox(), { target: { value: text, selectionStart: text.length } }); + } + + it('empties the box as the comment is sent, not when it lands', async () => { + // The new thread is rendered optimistically directly above this composer, + // so holding the draft until the write returns showed the comment twice. + let land!: () => void; + const onSubmit = vi.fn(() => new Promise((resolve) => { land = () => resolve(); })); + render( {}} />); + type('looks wrong'); + fireEvent.click(screen.getByRole('button', { name: 'Comment' })); + + await waitFor(() => expect(onSubmit).toHaveBeenCalledWith('looks wrong')); + expect(composerBox().value).toBe(''); + // …and the button says so, so an empty box doesn't read as a lost draft. + expect(screen.getByRole('button', { name: 'Sending…' })).toBeDisabled(); + + await act(async () => { land(); }); + expect(composerBox().value).toBe(''); + }); + + it('puts the text back when the comment is refused', async () => { + const onSubmit = vi.fn(async () => { throw new Error('outside the diff'); }); + render( {}} />); + type('looks wrong'); + fireEvent.click(screen.getByRole('button', { name: 'Comment' })); + + expect(await screen.findByRole('alert')).toHaveTextContent('outside the diff'); + expect(composerBox().value).toBe('looks wrong'); + }); +}); + +describe('CommentThreadView comment timestamp', () => { + it('reveals the full datetime when you hover the relative time', () => { + // "2h ago" is unhelpful when you need to know which day it was. + const twoHoursAgo = new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString(); + const { container } = render( + , + ); + + const time = container.querySelector('.comment__time'); + expect(time?.textContent).toBe('2h ago'); + expect(time?.getAttribute('title')).toBe(absoluteTime(twoHoursAgo)); + expect(time?.getAttribute('title')).toContain(String(new Date(twoHoursAgo).getFullYear())); + }); +}); diff --git a/samples/CodeFlow/src/components/CommentThread/__tests__/draftSurvivesReload.test.tsx b/samples/CodeFlow/src/components/CommentThread/__tests__/draftSurvivesReload.test.tsx new file mode 100644 index 0000000..5eb4e11 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentThread/__tests__/draftSurvivesReload.test.tsx @@ -0,0 +1,185 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { CommentThreadView, NewCommentComposer } from '../CommentThread'; +import type { CommentThread } from '../../../types'; +import { appStorage } from '../../../storage'; + +/** + * The auto-refresh case: a background poll spots a new commit, the app reloads + * the pull request, and `App` swaps the whole review tree out while it does. + * Every composer is unmounted mid-sentence. These tests reproduce that by + * unmounting and re-rendering, and assert the text comes back. + */ + +const addComment = vi.fn(async () => {}); +const editComment = vi.fn(async () => {}); + +const mockCtx = { + pr: null, + prKey: 'o/r#1', + commentBackendLabel: 'GitHub', + currentUser: { login: 'alice' }, + actions: { + addComment, + editComment, + setThreadStatus: vi.fn(async () => {}), + setThreadClosed: vi.fn(), + deleteThread: vi.fn(), + }, +}; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => mockCtx, +})); + +function thread(overrides: Partial = {}): CommentThread { + const now = '2024-01-01T00:00:00Z'; + return { + id: 't1', + prKey: 'o/r#1', + filename: 'src/app.ts', + side: 'right', + line: 12, + status: 'active', + comments: [ + { id: 'c1', author: { login: 'alice' }, body: 'please fix', createdAt: now, nodeId: 'PRRC_1' }, + ], + createdAt: now, + updatedAt: now, + ...overrides, + }; +} + +function type(placeholder: string, text: string) { + fireEvent.change(screen.getByPlaceholderText(placeholder), { + target: { value: text, selectionStart: text.length }, + }); +} + +const valueOf = (placeholder: string) => + (screen.getByPlaceholderText(placeholder) as HTMLTextAreaElement).value; + +beforeEach(() => { + addComment.mockClear(); + addComment.mockResolvedValue(undefined); + editComment.mockClear(); + editComment.mockResolvedValue(undefined); +}); + +describe('a reply in progress', () => { + it('is still there after the refresh takes the thread down and puts it back', () => { + const view = render(); + type('Reply…', 'most of a reply'); + view.unmount(); + + render(); + expect(valueOf('Reply…')).toBe('most of a reply'); + }); + + it('does not follow the reviewer onto a different thread', () => { + const view = render(); + type('Reply…', 'about thread one'); + view.unmount(); + + render(); + expect(valueOf('Reply…')).toBe(''); + }); + + it('is gone once the reply has actually been posted', async () => { + const view = render(); + type('Reply…', 'ship it'); + fireEvent.click(screen.getByRole('button', { name: 'Reply' })); + await waitFor(() => expect(addComment).toHaveBeenCalledWith('t1', 'ship it')); + view.unmount(); + + render(); + expect(valueOf('Reply…')).toBe(''); + }); + + it('survives a refresh that lands while a failed reply is on screen', async () => { + addComment.mockRejectedValueOnce(new Error('offline')); + const view = render(); + type('Reply…', 'worth keeping'); + fireEvent.click(screen.getByRole('button', { name: 'Reply' })); + expect(await screen.findByRole('alert')).toHaveTextContent('offline'); + view.unmount(); + + render(); + expect(valueOf('Reply…')).toBe('worth keeping'); + }); +}); + +describe('an edit in progress', () => { + const openEditor = () => fireEvent.click(screen.getByRole('button', { name: 'Edit' })); + + it('comes back to the edited text, not the original comment', () => { + const view = render(); + openEditor(); + type('Edit your comment…', 'please fix, with detail'); + view.unmount(); + + render(); + openEditor(); + expect(valueOf('Edit your comment…')).toBe('please fix, with detail'); + }); + + it('is discarded when the reviewer cancels out of it', () => { + const view = render(); + openEditor(); + type('Edit your comment…', 'never mind'); + fireEvent.click(screen.getByRole('button', { name: 'Cancel' })); + view.unmount(); + + render(); + openEditor(); + expect(valueOf('Edit your comment…')).toBe('please fix'); + }); + + it('is discarded once the edit has been saved', async () => { + const view = render(); + openEditor(); + type('Edit your comment…', 'fixed, thanks'); + fireEvent.click(screen.getByRole('button', { name: 'Save' })); + await waitFor(() => expect(editComment).toHaveBeenCalledWith('t1', 'c1', 'fixed, thanks')); + view.unmount(); + + render(); + openEditor(); + expect(valueOf('Edit your comment…')).toBe('please fix'); + }); +}); + +describe('a new thread in progress', () => { + const draftKey = 'codeflow:draft:o/r#1|line|right|12|src/app.ts'; + + it('is restored into the composer it was typed in', () => { + const view = render( + , + ); + type('Start a comment thread…', 'this needs a test'); + view.unmount(); + + render(); + expect(valueOf('Start a comment thread…')).toBe('this needs a test'); + }); + + it('is dropped when the composer is cancelled', () => { + const view = render( + , + ); + type('Start a comment thread…', 'on reflection, no'); + fireEvent.click(screen.getByRole('button', { name: 'Cancel' })); + view.unmount(); + + render(); + expect(valueOf('Start a comment thread…')).toBe(''); + }); + + it('stays in memory when there is nowhere to save it', () => { + // No pull request in context yet, so no key — the composer must still work. + render(); + type('Start a comment thread…', 'unsaved but usable'); + expect(valueOf('Start a comment thread…')).toBe('unsaved but usable'); + expect(appStorage().drafts.keys()).toHaveLength(0); + }); +}); diff --git a/samples/CodeFlow/src/components/CommentThread/__tests__/githubCommentLink.test.tsx b/samples/CodeFlow/src/components/CommentThread/__tests__/githubCommentLink.test.tsx new file mode 100644 index 0000000..9da36b9 --- /dev/null +++ b/samples/CodeFlow/src/components/CommentThread/__tests__/githubCommentLink.test.tsx @@ -0,0 +1,130 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { CommentThreadView } from '../CommentThread'; +import type { CommentThread, PrSummary } from '../../../types'; + +const copyToClipboard = vi.fn(async (_text: string) => true); + +// Only the clipboard is stubbed: the link the button hands it is exactly what +// this is testing, so `buildDeepLink` and friends stay real. +vi.mock('../../../utils/deepLink', async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, copyToClipboard: (text: string) => copyToClipboard(text) }; +}); + +const pr = { + coordinates: { owner: 'octo', name: 'repo', number: 42 }, + htmlUrl: 'https://github.com/octo/repo/pull/42', +} as PrSummary; + +const mockCtx = { + pr, + commentBackendLabel: 'GitHub', + currentUser: { login: 'alice' }, + prKey: 'octo/repo#42', + actions: { + addComment: vi.fn(), + setThreadStatus: vi.fn(), + editComment: vi.fn(), + setThreadClosed: vi.fn(), + deleteThread: vi.fn(), + }, +}; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => mockCtx, +})); + +const NOW = '2024-01-01T00:00:00Z'; + +function thread(overrides: Partial = {}): CommentThread { + return { + id: 'PRRT_kwDOAbc', + prKey: 'octo/repo#42', + filename: 'src/app.ts', + side: 'right', + line: 12, + status: 'active', + comments: [{ id: '97166796', author: { login: 'alice' }, body: 'please fix', createdAt: NOW }], + createdAt: NOW, + updatedAt: NOW, + ...overrides, + }; +} + +function clickGithubLink() { + fireEvent.click(screen.getByRole('button', { name: 'Copy the GitHub link to this comment' })); +} + +beforeEach(() => { + vi.clearAllMocks(); + copyToClipboard.mockResolvedValue(true); +}); + +describe('GitHub comment link button', () => { + it('sits alongside the CodeFlow deep-link button', () => { + render(); + expect(screen.getByRole('button', { name: 'Copy link to this comment' })).toBeTruthy(); + expect( + screen.getByRole('button', { name: 'Copy the GitHub link to this comment' }), + ).toBeTruthy(); + }); + + it('copies the GitHub URL rather than the CodeFlow deep link', async () => { + render(); + clickGithubLink(); + + await waitFor(() => + expect(copyToClipboard).toHaveBeenCalledWith( + 'https://github.com/octo/repo/pull/42#discussion_r97166796', + ), + ); + }); + + it('prefers the permalink GitHub gave the comment', async () => { + render( + , + ); + clickGithubLink(); + + await waitFor(() => + expect(copyToClipboard).toHaveBeenCalledWith( + 'https://github.com/octo/repo/pull/42#discussion_r55', + ), + ); + }); + + it('anchors a PR-level conversation comment as an issue comment', async () => { + render( + , + ); + clickGithubLink(); + + await waitFor(() => + expect(copyToClipboard).toHaveBeenCalledWith( + 'https://github.com/octo/repo/pull/42#issuecomment-225307116', + ), + ); + }); +}); diff --git a/samples/CodeFlow/src/components/ConnectionBanner/ConnectionBanner.tsx b/samples/CodeFlow/src/components/ConnectionBanner/ConnectionBanner.tsx new file mode 100644 index 0000000..fbff358 --- /dev/null +++ b/samples/CodeFlow/src/components/ConnectionBanner/ConnectionBanner.tsx @@ -0,0 +1,48 @@ +import type { ConnectionFaultKind } from '../../services/connectionHealth'; + +interface Props { + kind: ConnectionFaultKind; + onRetry?: () => void; +} + +/** + * Explains a connection that has stopped authenticating. + * + * This exists because the failure is otherwise deeply misleading. GitHub + * answers an uncredentialed request with a rate-limit error, so the reviewer + * sees "API rate limit exceeded" and reasonably concludes they are being + * throttled for using the app too hard — when in fact they are the only person + * *not* signed in, and are sharing a 60-requests-an-hour anonymous pool with + * every other anonymous caller on the gateway. + * + * It does not offer a self-service link: the host's connection repair flow is + * not callable from app code (see `connectionHealth.ts`). + */ +export function ConnectionBanner({ kind, onRetry }: Props) { + const unauthenticated = kind === 'unauthenticated'; + + return ( + + ); +} diff --git a/samples/CodeFlow/src/components/ConnectionBanner/__tests__/ConnectionBanner.test.tsx b/samples/CodeFlow/src/components/ConnectionBanner/__tests__/ConnectionBanner.test.tsx new file mode 100644 index 0000000..73e68ab --- /dev/null +++ b/samples/CodeFlow/src/components/ConnectionBanner/__tests__/ConnectionBanner.test.tsx @@ -0,0 +1,43 @@ +import { render, screen, fireEvent } from '@testing-library/react'; +import { describe, it, expect, vi } from 'vitest'; +import { ConnectionBanner } from '../ConnectionBanner'; + +describe('ConnectionBanner', () => { + it('names the real cause rather than repeating GitHub’s misleading wording', () => { + render(); + + expect(screen.getByRole('alert')).toBeTruthy(); + expect(screen.getByText(/cannot sign in to GitHub as you/i)).toBeTruthy(); + expect(screen.getByText(/without your credentials/i)).toBeTruthy(); + }); + + it('says the fault will not clear itself, because waiting is the wrong instinct', () => { + render(); + expect(screen.getByText(/will not clear on its own/i)).toBeTruthy(); + }); + + it('tells the reviewer how to repair the connection', () => { + render(); + expect(screen.getByText(/Reconnect or recreate it/i)).toBeTruthy(); + }); + + it('never offers a self-service link that the reviewer would be denied', () => { + render(); + expect(screen.queryByRole('link')).toBeNull(); + }); + + it('treats a genuine quota as temporary', () => { + render(); + + expect(screen.getByText(/hit GitHub's rate limit/i)).toBeTruthy(); + expect(screen.getByText(/reset shortly/i)).toBeTruthy(); + }); + + it('lets the reviewer retry once they believe it is fixed', () => { + const onRetry = vi.fn(); + render(); + + fireEvent.click(screen.getByRole('button', { name: /retry/i })); + expect(onRetry).toHaveBeenCalledTimes(1); + }); +}); diff --git a/samples/CodeFlow/src/components/CopyLinkButton/CopyLinkButton.tsx b/samples/CodeFlow/src/components/CopyLinkButton/CopyLinkButton.tsx new file mode 100644 index 0000000..0d798e5 --- /dev/null +++ b/samples/CodeFlow/src/components/CopyLinkButton/CopyLinkButton.tsx @@ -0,0 +1,51 @@ +import { useState } from 'react'; +import { copyToClipboard, copyRichLink } from '../../utils/deepLink'; + +interface Props { + /** Deep link to copy. The button is disabled while this is empty. */ + link: string; + title?: string; + /** Glyph shown while idle. Defaults to a link icon. */ + label?: string; + /** PR number — when provided together with `prTitle`, copies a rich ADO-style link. */ + prNumber?: number; + /** PR title — when provided together with `prNumber`, copies a rich ADO-style link. */ + prTitle?: string; +} + +/** Copies a deep link to the clipboard, with transient success/failure feedback. */ +export function CopyLinkButton({ link, title, label = '🔗', prNumber, prTitle }: Props) { + const [state, setState] = useState<'idle' | 'copied' | 'failed'>('idle'); + + const handleClick = async (e: React.MouseEvent) => { + e.stopPropagation(); + e.preventDefault(); + if (!link) return; + const ok = + prNumber !== undefined && prTitle !== undefined + ? await copyRichLink(link, `Pull Request ${prNumber}: ${prTitle}`) + : await copyToClipboard(link); + setState(ok ? 'copied' : 'failed'); + setTimeout(() => setState('idle'), 2500); + }; + + const glyph = state === 'copied' ? '✓ Copied' : state === 'failed' ? '⚠ Failed' : label; + const modifier = + state === 'copied' + ? ' copy-link-btn--copied' + : state === 'failed' + ? ' copy-link-btn--failed' + : ''; + + return ( + + ); +} diff --git a/samples/CodeFlow/src/components/CopyLinkButton/__tests__/CopyLinkButton.test.tsx b/samples/CodeFlow/src/components/CopyLinkButton/__tests__/CopyLinkButton.test.tsx new file mode 100644 index 0000000..bdbedc4 --- /dev/null +++ b/samples/CodeFlow/src/components/CopyLinkButton/__tests__/CopyLinkButton.test.tsx @@ -0,0 +1,81 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { CopyLinkButton } from '../CopyLinkButton'; + +const copyToClipboard = vi.fn(); +const copyRichLink = vi.fn(); +vi.mock('../../../utils/deepLink', () => ({ + copyToClipboard: (...a: unknown[]) => copyToClipboard(...a), + copyRichLink: (...a: unknown[]) => copyRichLink(...a), +})); + +beforeEach(() => { + vi.clearAllMocks(); +}); + +describe('CopyLinkButton', () => { + it('copies the link and reports success', async () => { + copyToClipboard.mockResolvedValue(true); + render( + , + ); + + fireEvent.click(screen.getByRole('button', { name: 'Copy link to this PR' })); + + expect(copyToClipboard).toHaveBeenCalledWith( + 'https://apps.example.com/codeflow?org=o&repo=r&pull=12', + ); + await waitFor(() => expect(screen.getByRole('button')).toHaveTextContent('Copied')); + }); + + it('copies a rich ADO-style link when prNumber and prTitle are provided', async () => { + copyRichLink.mockResolvedValue(true); + render( + , + ); + + fireEvent.click(screen.getByRole('button', { name: 'Copy link to this PR' })); + + expect(copyRichLink).toHaveBeenCalledWith( + 'https://apps.example.com/codeflow?org=o&repo=r&pull=42', + 'Pull Request 42: Fix the widget', + ); + expect(copyToClipboard).not.toHaveBeenCalled(); + await waitFor(() => expect(screen.getByRole('button')).toHaveTextContent('Copied')); + }); + + it('reports failure when the clipboard is blocked', async () => { + copyToClipboard.mockResolvedValue(false); + render(); + + fireEvent.click(screen.getByRole('button')); + + await waitFor(() => expect(screen.getByRole('button')).toHaveTextContent('Failed')); + }); + + it('is disabled without a link', () => { + render(); + const btn = screen.getByRole('button'); + expect(btn).toBeDisabled(); + fireEvent.click(btn); + expect(copyToClipboard).not.toHaveBeenCalled(); + }); + + it('renders a custom glyph instead of the link icon', async () => { + copyToClipboard.mockResolvedValue(true); + render(); + const btn = screen.getByRole('button'); + expect(btn).toHaveTextContent('GH'); + + fireEvent.click(btn); + await waitFor(() => expect(btn).toHaveTextContent('Copied')); + }); +}); diff --git a/samples/CodeFlow/src/components/Dashboard/Dashboard.tsx b/samples/CodeFlow/src/components/Dashboard/Dashboard.tsx new file mode 100644 index 0000000..86d6dd1 --- /dev/null +++ b/samples/CodeFlow/src/components/Dashboard/Dashboard.tsx @@ -0,0 +1,861 @@ +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { GitHubService } from '../../services/githubService'; +import { Avatar } from '../Avatar'; +import { GearIcon } from '../GearIcon'; +import { SettingsDialog } from '../SettingsDialog/SettingsDialog'; +import { FeedbackDialog } from '../FeedbackDialog/FeedbackDialog'; +import { APP_VERSION, config } from '../../config'; +import { LocalModeNotice } from '../LocalModeNotice/LocalModeNotice'; +import { ConnectionBanner } from '../ConnectionBanner/ConnectionBanner'; +import { classifyConnectionFault } from '../../services/connectionHealth'; +import { parsePrInput, parseRepoInput } from '../../utils/parsePrInput'; +import { relativeTime, timeTitle } from '../../utils/format'; +import { buildDeepLink } from '../../utils/deepLink'; +import { + getPinnedRepos, + getFlaggedPrs, + getInProgressReviews, + isPrFlagged, + toggleFlaggedPr, + addPinnedRepo, + removePinnedRepo, + removeInProgressReview, + type PinnedRepo, +} from '../../utils/storage'; +import { useFlaggedCleanup } from './useFlaggedCleanup'; +import { useReviewStateRevision } from '../../state/hooks/useReviewStateRevision'; +import { loadCollapsedSections, saveCollapsedSections } from '../../utils/preferences'; +import { + classifyAll, + enrichedToItem, + indexByPrKey, + prKeyOf, +} from '../../utils/dashboardReview'; +import type { GitUserRef, PrCoordinates, PrListItem } from '../../types'; + +/** + * GitHub issue-search queries powering the live queues. `@me` = signed-in user. + * + * These three searches are the dashboard's entire network budget. Everything + * else on the page — including which tracked reviews are still outstanding — + * is derived from their results rather than fetched per PR. + */ +const QUERY_REVIEW = 'is:pr is:open review-requested:@me archived:false'; +const QUERY_MINE = 'is:pr is:open author:@me archived:false'; +const QUERY_REVIEWED = 'is:pr is:open reviewed-by:@me archived:false'; + +type AsyncState = { status: 'loading' | 'ready' | 'error'; items: T; error?: string }; + +function toItem(e: { + owner: string; + name: string; + number: number; + title?: string; +}): PrListItem { + return { + coordinates: { owner: e.owner, name: e.name, number: e.number }, + title: e.title ?? `PR #${e.number}`, + }; +} + + +export function Dashboard() { + const { actions, status, error } = useCodeFlow(); + const [jump, setJump] = useState(''); + const [me, setMe] = useState(undefined); + + // Live queues from GitHub search. + const [reviewQueue, setReviewQueue] = useState>({ + status: 'loading', + items: [], + }); + const [myPrs, setMyPrs] = useState>({ + status: 'loading', + items: [], + }); + const [reviewedByMe, setReviewedByMe] = useState>({ + status: 'loading', + items: [], + }); + + // Local personalization is read fresh from storage on each render; `bump` + // forces a re-render after a mutation (flag / pin / dismiss). Changes from + // other tabs (or a shared storage provider) land outside React, so track the + // review-state revision here too. + const [, setTick] = useState(0); + const bump = useCallback(() => setTick((t) => t + 1), []); + useReviewStateRevision(); + const flags = getFlaggedPrs(); + const inProgress = getInProgressReviews(); + const pins = getPinnedRepos(); + + const [collapsed, setCollapsed] = useState>(loadCollapsedSections); + const toggleSection = useCallback((id: string) => { + setCollapsed((prev) => { + const next = { ...prev, [id]: !prev[id] }; + saveCollapsedSections(next); + return next; + }); + }, []); + + // Bucket the locally-tracked reviews using only the search results above — + // no per-PR requests. `sigInProgress` keys the memo off list membership + // because storage hands back a fresh array on every render. + const sigInProgress = useMemo( + () => inProgress.map(prKeyOf).sort().join('|'), + [inProgress], + ); + const enrichLoading = reviewedByMe.status === 'loading'; + const enriched = useMemo( + () => + classifyAll(inProgress, { + reviewed: indexByPrKey(reviewedByMe.items), + requested: indexByPrKey(reviewQueue.items), + authored: indexByPrKey(myPrs.items), + }), + // `inProgress` is intentionally keyed by signature, not identity. + // eslint-disable-next-line react-hooks/exhaustive-deps + [sigInProgress, reviewedByMe.items, reviewQueue.items, myPrs.items], + ); + + const actionItems = useMemo(() => enriched.filter((i) => i.bucket === 'action'), [enriched]); + const waitingItems = useMemo(() => enriched.filter((i) => i.bucket === 'waiting'), [enriched]); + + // "Needs your attention" merges GitHub review requests with in-progress PRs + // that need another pass. Drop action items already surfaced as a review + // request so a PR that's both doesn't appear twice. + const reviewKeys = useMemo( + () => new Set(reviewQueue.items.map((i) => prKeyOf(i.coordinates))), + [reviewQueue.items], + ); + const attentionActionItems = useMemo( + () => actionItems.filter((it) => !reviewKeys.has(prKeyOf(it.entry))), + [actionItems, reviewKeys], + ); + const attentionCount = reviewQueue.items.length + attentionActionItems.length; + const attentionLoading = reviewQueue.status === 'loading' || enrichLoading; + + // Flagged rows render straight from what was stored when they were starred. + // Clearing out merged/closed ones is an explicit, user-initiated action. + const flaggedCleanup = useFlaggedCleanup(flags, bump); + + const runSearch = useCallback( + (query: string, set: (s: AsyncState) => void, force = false) => { + void GitHubService.searchPullRequests(query, undefined, { force }) + .then((items) => set({ status: 'ready', items })) + .catch((e) => + set({ + status: 'error', + items: [], + error: e instanceof Error ? e.message : 'Search failed', + }), + ); + }, + [], + ); + + // Boot loads share the service-level search cache, so a double mount costs + // nothing. An explicit refresh always goes to the network. + const fetchAll = useCallback( + (force = false) => { + runSearch(QUERY_REVIEW, setReviewQueue, force); + runSearch(QUERY_MINE, setMyPrs, force); + runSearch(QUERY_REVIEWED, setReviewedByMe, force); + }, + [runSearch], + ); + + const refresh = useCallback(() => { + setReviewQueue({ status: 'loading', items: [] }); + setMyPrs({ status: 'loading', items: [] }); + setReviewedByMe({ status: 'loading', items: [] }); + fetchAll(true); + }, [fetchAll]); + + useEffect(() => { + // Initial load. The queues start in the 'loading' state, so the effect body + // performs no synchronous setState — the setters only run inside the async + // then/catch callbacks below. `getAuthenticatedUser` is cached in the + // service, so this shares one request with every other identity lookup. + fetchAll(); + void GitHubService.getAuthenticatedUser().then((u) => setMe(u)); + }, [fetchAll]); + + + const open = useCallback((coords: PrCoordinates) => void actions.loadPr(coords), [actions]); + + const jumpCoords = useMemo(() => parsePrInput(jump), [jump]); + const submitJump = useCallback(() => { + if (jumpCoords) open(jumpCoords); + }, [jumpCoords, open]); + + const onFlag = useCallback( + (item: PrListItem) => { + toggleFlaggedPr({ + owner: item.coordinates.owner, + name: item.coordinates.name, + number: item.coordinates.number, + title: item.title, + }); + bump(); + }, + [bump], + ); + + const loading = status === 'loading'; + const [settingsOpen, setSettingsOpen] = useState(false); + const [feedbackOpen, setFeedbackOpen] = useState(false); + + /** + * A connection problem, if that's what the queues are actually reporting. + * + * All three searches share one connection, so they fail together and the + * first classifiable error speaks for all of them. Worth separating from the + * generic per-section error text because the message GitHub sends — "API + * rate limit exceeded" — points the reviewer at entirely the wrong culprit. + */ + const connectionFault = useMemo(() => { + for (const s of [reviewQueue, myPrs, reviewedByMe]) { + if (s.status !== 'error') continue; + const kind = classifyConnectionFault(s.error); + if (kind) return kind; + } + return undefined; + }, [reviewQueue, myPrs, reviewedByMe]); + + return ( +
    + {settingsOpen && setSettingsOpen(false)} />} + {feedbackOpen && setFeedbackOpen(false)} />} +
    +
    +
    + +
    +

    {config.appName}

    +

    + Iteration-aware pull request review for GitHub + v{APP_VERSION} +

    +
    +
    +
    + {me?.login && ( + + {me.login} + + )} + + + +
    +
    + +
    + setJump(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter' && jumpCoords) submitJump(); + }} + aria-label="Jump to a pull request" + autoFocus + /> + +
    + {error &&
    {error}
    } + + {connectionFault && ( + + )} + + + +
    +
    + {reviewQueue.status === 'error' && ( +

    + Couldn't load review requests: {reviewQueue.error} +

    + )} + {attentionCount === 0 ? ( + attentionLoading ? ( +

    Loading…

    + ) : ( + reviewQueue.status !== 'error' && ( +

    + You're all caught up — nothing needs your attention. +

    + ) + ) + ) : ( +
      + {reviewQueue.items.map((item) => { + const c = item.coordinates; + const flagged = flags.some( + (f) => f.owner === c.owner && f.name === c.name && f.number === c.number, + ); + const reviewing = inProgress.some( + (f) => f.owner === c.owner && f.name === c.name && f.number === c.number, + ); + return ( + + ); + })} + {attentionActionItems.map((it) => ( + { + removeInProgressReview(it.entry.owner, it.entry.name, it.entry.number); + bump(); + }} + /> + ))} +
    + )} +
    + +
    + {enrichLoading ? ( +

    Checking review status…

    + ) : waitingItems.length === 0 ? ( +

    + PRs you've reviewed that are still open will appear here. +

    + ) : ( +
      + {waitingItems.map((it) => ( + { + removeInProgressReview(it.entry.owner, it.entry.name, it.entry.number); + bump(); + }} + /> + ))} +
    + )} +
    + +
    + {flags.length === 0 ? ( +

    Star a PR to keep an eye on it here.

    + ) : ( + <> +
      + {flags.map((f) => ( + + ))} +
    +
    + + {flaggedCleanup.removed !== undefined && !flaggedCleanup.running && ( + + {flaggedCleanup.removed === 0 + ? 'All still open.' + : `Removed ${flaggedCleanup.removed}.`} + + )} +
    + + )} +
    + +
    + +
    + + +
    +
    +
    + ); +} + +/* ------------------------------ Sections ------------------------------- */ + +interface SectionProps { + id: string; + icon: string; + title: string; + count: number; + collapsed?: boolean; + onToggle: (id: string) => void; + className?: string; + children: React.ReactNode; +} + +function Section({ id, icon, title, count, collapsed, onToggle, className, children }: SectionProps) { + return ( +
    + + {!collapsed &&
    {children}
    } +
    + ); +} + +interface PrQueueProps { + state: AsyncState; + empty: string; + onOpen: (c: PrCoordinates) => void; + onFlag: (item: PrListItem) => void; + flags: { owner: string; name: string; number: number }[]; + inProgress: { owner: string; name: string; number: number }[]; +} + +function PrQueue({ state, empty, onOpen, onFlag, flags, inProgress }: PrQueueProps) { + if (state.status === 'loading') return

    Loading…

    ; + if (state.status === 'error') { + return

    Couldn't load: {state.error}

    ; + } + if (state.items.length === 0) return

    {empty}

    ; + return ( +
      + {state.items.map((item) => { + const c = item.coordinates; + const flagged = flags.some( + (f) => f.owner === c.owner && f.name === c.name && f.number === c.number, + ); + const reviewing = inProgress.some( + (f) => f.owner === c.owner && f.name === c.name && f.number === c.number, + ); + return ( + + ); + })} +
    + ); +} + +/* -------------------------------- Rows --------------------------------- */ + +interface PrRowProps { + item: PrListItem; + meta?: string; + /** Tooltip for `meta`, used when it is a relative timestamp. */ + metaTitle?: string; + reviewing?: boolean; + flagged?: boolean; + onOpen: (c: PrCoordinates) => void; + onFlag: (item: PrListItem) => void; + onDismiss?: () => void; +} + +export function PrRow({ + item, + meta, + metaTitle, + reviewing, + flagged, + onOpen, + onFlag, + onDismiss, +}: PrRowProps) { + const c = item.coordinates; + return ( +
  • + + + {onDismiss && ( + + )} +
  • + ); +} + +/* ---------------------------- Pinned repos ----------------------------- */ + +interface PinnedSectionProps { + pins: PinnedRepo[]; + onOpen: (c: PrCoordinates) => void; + onFlag: (item: PrListItem) => void; + flags: { owner: string; name: string; number: number }[]; + onChange: () => void; + collapsed?: boolean; + onToggle: (id: string) => void; +} + +export function PinnedSection({ + pins, + onOpen, + onFlag, + flags, + onChange, + collapsed, + onToggle, +}: PinnedSectionProps) { + const [repoInput, setRepoInput] = useState(''); + const [expanded, setExpanded] = useState(null); + const [browseMode, setBrowseMode] = useState<'open' | 'merged'>('open'); + const [browse, setBrowse] = useState>({ status: 'ready', items: [] }); + const browseSeq = useRef(0); + + useEffect(() => () => { browseSeq.current += 1; }, []); + + const parsedRepo = useMemo(() => parseRepoInput(repoInput), [repoInput]); + + const addRepo = useCallback(() => { + if (!parsedRepo) return; + addPinnedRepo(parsedRepo.owner, parsedRepo.name); + setRepoInput(''); + onChange(); + }, [parsedRepo, onChange]); + + const loadRepo = useCallback((repo: PinnedRepo, mode: 'open' | 'merged') => { + const seq = ++browseSeq.current; + setBrowse({ status: 'loading', items: [] }); + // Search merged PRs server-side: filtering one page of closed PRs can miss + // every merged result when that page contains only abandoned PRs. + const request = mode === 'merged' + ? GitHubService.searchPullRequests( + `is:pr is:merged repo:${repo.owner}/${repo.name}`, 100, { force: true }, + ) + : GitHubService.listPullRequests({ owner: repo.owner, name: repo.name }, 'open'); + void request + .then((items) => { + if (seq === browseSeq.current) setBrowse({ status: 'ready', items }); + }) + .catch((e) => { + if (seq !== browseSeq.current) return; + setBrowse({ + status: 'error', + items: [], + error: e instanceof Error ? e.message : 'Failed to load PRs', + }); + }); + }, []); + + const openRepo = useCallback((repo: PinnedRepo) => { + const key = `${repo.owner}/${repo.name}`; + if (expanded === key) { + browseSeq.current += 1; + setExpanded(null); + return; + } + setExpanded(key); + loadRepo(repo, browseMode); + }, [expanded, loadRepo, browseMode]); + + return ( +
    +
    + setRepoInput(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter' && parsedRepo) addRepo(); + }} + aria-label="Pin a repository" + /> + +
    + {pins.length === 0 ? ( +

    Pin the repos you review most for one-click browsing.

    + ) : ( +
      + {pins.map((repo) => { + const key = `${repo.owner}/${repo.name}`; + const isOpen = expanded === key; + return ( +
    • +
      + + +
      + {isOpen && ( +
      +
      + {(['open', 'merged'] as const).map((mode) => ( + + ))} +
      + {browseMode === 'merged' && ( +

      + Open a merged PR, then choose Cherry-pick to apply its changes to another + branch. Showing up to 100 recently updated results; use Jump to a PR above + for an older PR. +

      + )} + {browse.status === 'loading' && ( +

      Loading {browseMode} PRs…

      + )} + {browse.status === 'error' && ( +

      + Couldn't load: {browse.error}{' '} + +

      + )} + {browse.status === 'ready' && browse.items.length === 0 && ( +

      No {browseMode} pull requests.

      + )} + {browse.status === 'ready' && browse.items.length > 0 && ( +
        + {browse.items.map((item) => { + const c = item.coordinates; + const flagged = flags.some( + (f) => + f.owner === c.owner && + f.name === c.name && + f.number === c.number, + ); + return ( + + ); + })} +
      + )} +
      + )} +
    • + ); + })} +
    + )} +
    + ); +} diff --git a/samples/CodeFlow/src/components/Dashboard/__tests__/PinnedSection.test.tsx b/samples/CodeFlow/src/components/Dashboard/__tests__/PinnedSection.test.tsx new file mode 100644 index 0000000..ef1a189 --- /dev/null +++ b/samples/CodeFlow/src/components/Dashboard/__tests__/PinnedSection.test.tsx @@ -0,0 +1,202 @@ +import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; +import type { PrListItem, PrSummary } from '../../../types'; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => ({ state: {}, actions: {} }), +})); +vi.mock('../../../services/githubService', () => ({ + GitHubService: { + listPullRequests: vi.fn(), + searchPullRequests: vi.fn(), + getAuthenticatedUser: vi.fn(async () => undefined), + }, +})); +vi.mock('../../../state/hooks/useReviewStateRevision', () => ({ + useReviewStateRevision: () => '0', +})); + +import { GitHubService } from '../../../services/githubService'; +import { PinnedSection } from '../Dashboard'; + +const list = vi.mocked(GitHubService.listPullRequests); +const search = vi.mocked(GitHubService.searchPullRequests); +const openPr: PrSummary = { + coordinates: { owner: 'octo', name: 'repo', number: 41 }, + title: 'Work in progress', + state: 'open', + draft: false, + merged: false, + baseRef: 'main', + baseSha: 'base', + headRef: 'feature', + headSha: 'head', +}; +const mergedPr: PrListItem = { + coordinates: { owner: 'octo', name: 'repo', number: 42 }, + title: 'Merged fix', + state: 'closed', +}; + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: Error) => void; + const promise = new Promise((res, rej) => { resolve = res; reject = rej; }); + return { promise, resolve, reject }; +} + +function renderPinned() { + const onOpen = vi.fn(); + const view = render( + , + ); + return { ...view, onOpen }; +} + +function expandRepo(name = 'repo') { + fireEvent.click(screen.getByRole('button', { name: new RegExp(`octo/${name}$`) })); +} + +function chooseMerged() { + fireEvent.click(screen.getByRole('button', { name: 'Merged PRs' })); +} + +beforeEach(() => { + vi.resetAllMocks(); + list.mockResolvedValue([openPr]); + search.mockResolvedValue([mergedPr]); +}); + +describe('pinned repository PR browsing', () => { + it('keeps open PRs as the default and does not fetch until expanded', async () => { + renderPinned(); + expect(list).not.toHaveBeenCalled(); + expect(search).not.toHaveBeenCalled(); + + expandRepo(); + + expect(list).toHaveBeenCalledWith({ owner: 'octo', name: 'repo' }, 'open'); + expect(await screen.findByTitle('Work in progress')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Open PRs' })).toHaveAttribute('aria-pressed', 'true'); + expect(search).not.toHaveBeenCalled(); + }); + + it('finds merged PRs server-side and opens the selected PR for cherry-picking', async () => { + const { onOpen } = renderPinned(); + expandRepo(); + await screen.findByTitle('Work in progress'); + chooseMerged(); + + expect(search).toHaveBeenCalledWith('is:pr is:merged repo:octo/repo', 100, { force: true }); + expect(screen.getByRole('button', { name: 'Merged PRs' })).toHaveAttribute('aria-pressed', 'true'); + expect(screen.getByText(/Open a merged PR, then choose Cherry-pick/)).toBeInTheDocument(); + expect(screen.getByText(/up to 100 recently updated results/)).toBeInTheDocument(); + fireEvent.click(await screen.findByTitle('Merged fix')); + + expect(onOpen).toHaveBeenCalledWith(mergedPr.coordinates); + expect(screen.queryByTitle('Work in progress')).not.toBeInTheDocument(); + expect(list).toHaveBeenCalledTimes(1); + }); + + it('switches back to open PRs without showing the merged results', async () => { + renderPinned(); + expandRepo(); + chooseMerged(); + await screen.findByTitle('Merged fix'); + fireEvent.click(screen.getByRole('button', { name: 'Open PRs' })); + + expect(await screen.findByTitle('Work in progress')).toBeInTheDocument(); + expect(screen.queryByTitle('Merged fix')).not.toBeInTheDocument(); + expect(list).toHaveBeenCalledTimes(2); + }); + + it('reports an empty merged view rather than saying there are no open PRs', async () => { + search.mockResolvedValue([]); + renderPinned(); + expandRepo(); + chooseMerged(); + + expect(await screen.findByText('No merged pull requests.')).toBeInTheDocument(); + expect(screen.queryByText('No open pull requests.')).not.toBeInTheDocument(); + }); + + it('surfaces merged search failures and retries the same repository and mode', async () => { + search.mockRejectedValueOnce(new Error('Search unavailable')); + renderPinned(); + expandRepo(); + chooseMerged(); + + expect(await screen.findByRole('alert')).toHaveTextContent('Search unavailable'); + expect(screen.queryByText('No merged pull requests.')).not.toBeInTheDocument(); + fireEvent.click(screen.getByRole('button', { name: 'Retry' })); + + expect(await screen.findByTitle('Merged fix')).toBeInTheDocument(); + expect(search).toHaveBeenCalledTimes(2); + expect(search).toHaveBeenLastCalledWith('is:pr is:merged repo:octo/repo', 100, { force: true }); + expect(screen.queryByRole('alert')).not.toBeInTheDocument(); + }); + + it.each(['success', 'failure'] as const)( + 'ignores a late open request %s after switching to merged', + async (outcome) => { + const pending = deferred(); + list.mockReturnValueOnce(pending.promise); + renderPinned(); + expandRepo(); + chooseMerged(); + await screen.findByTitle('Merged fix'); + + await act(async () => { + if (outcome === 'success') pending.resolve([openPr]); + else pending.reject(new Error('Old failure')); + }); + + expect(screen.getByTitle('Merged fix')).toBeInTheDocument(); + expect(screen.queryByTitle('Work in progress')).not.toBeInTheDocument(); + expect(screen.queryByRole('alert')).not.toBeInTheDocument(); + }, + ); + + it('ignores a late merged request after switching repositories', async () => { + const pending = deferred(); + search.mockReturnValueOnce(pending.promise).mockResolvedValueOnce([]); + renderPinned(); + expandRepo(); + chooseMerged(); + expandRepo('other'); + await screen.findByText('No merged pull requests.'); + + await act(async () => pending.resolve([mergedPr])); + + expect(search).toHaveBeenLastCalledWith('is:pr is:merged repo:octo/other', 100, { force: true }); + expect(screen.queryByTitle('Merged fix')).not.toBeInTheDocument(); + expect(screen.getByText('No merged pull requests.')).toBeInTheDocument(); + }); + + it('does not refetch on collapse and ignores a stale result after reopening', async () => { + const pending = deferred(); + list.mockReturnValueOnce(pending.promise).mockResolvedValueOnce([]); + renderPinned(); + expandRepo(); + expandRepo(); + expect(list).toHaveBeenCalledTimes(1); + expect(screen.queryByRole('group', { name: 'Pull request status' })).not.toBeInTheDocument(); + expandRepo(); + await screen.findByText('No open pull requests.'); + + await act(async () => pending.resolve([openPr])); + + expect(screen.queryByTitle('Work in progress')).not.toBeInTheDocument(); + await waitFor(() => expect(list).toHaveBeenCalledTimes(2)); + }); +}); diff --git a/samples/CodeFlow/src/components/Dashboard/__tests__/PrRow.test.tsx b/samples/CodeFlow/src/components/Dashboard/__tests__/PrRow.test.tsx new file mode 100644 index 0000000..64ee9f6 --- /dev/null +++ b/samples/CodeFlow/src/components/Dashboard/__tests__/PrRow.test.tsx @@ -0,0 +1,112 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import { render, screen } from '@testing-library/react'; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => ({ state: {}, actions: {} }), +})); + +vi.mock('../../../services/githubService', () => ({ + GitHubService: { + searchPullRequests: vi.fn(async () => []), + getAuthenticatedUser: vi.fn(async () => undefined), + }, +})); + +vi.mock('../../../state/hooks/useReviewStateRevision', () => ({ + useReviewStateRevision: () => '0', +})); + +import { PrRow } from '../Dashboard'; +import type { PrListItem } from '../../../types'; +import { buildDeepLink } from '../../../utils/deepLink'; +import { absoluteTime } from '../../../utils/format'; + +function makeItem(overrides: Partial = {}): PrListItem { + return { + coordinates: { owner: 'octo', name: 'repo', number: 42 }, + title: 'My PR', + ...overrides, + }; +} + +describe('PrRow middle-click', () => { + let openSpy: ReturnType; + + beforeEach(() => { + openSpy = vi.spyOn(window, 'open').mockImplementation(() => null); + }); + + afterEach(() => { + openSpy.mockRestore(); + }); + + it('opens the CodeFlow deep link in a new tab on middle-click', () => { + const item = makeItem(); + render(); + const btn = screen.getByTitle('My PR'); + btn.dispatchEvent(new MouseEvent('auxclick', { button: 1, bubbles: true })); + const expectedUrl = buildDeepLink({ owner: 'octo', repo: 'repo', number: 42 }); + expect(openSpy).toHaveBeenCalledWith(expectedUrl, '_blank', 'noopener,noreferrer'); + }); + + it('does not call window.open for non-middle-button auxclick', () => { + const item = makeItem(); + render(); + const btn = screen.getByTitle('My PR'); + btn.dispatchEvent(new MouseEvent('auxclick', { button: 2, bubbles: true })); + expect(openSpy).not.toHaveBeenCalled(); + }); + + it('does not call onOpen when the button is middle-clicked', () => { + const onOpen = vi.fn(); + const item = makeItem(); + render(); + const btn = screen.getByTitle('My PR'); + btn.dispatchEvent(new MouseEvent('auxclick', { button: 1, bubbles: true })); + expect(onOpen).not.toHaveBeenCalled(); + }); + + it('suppresses the default mousedown action so autoscroll never engages', () => { + const item = makeItem(); + render(); + const btn = screen.getByTitle('My PR'); + const down = new MouseEvent('mousedown', { button: 1, bubbles: true, cancelable: true }); + btn.dispatchEvent(down); + expect(down.defaultPrevented).toBe(true); + }); + + it('leaves left-button mousedown alone', () => { + const item = makeItem(); + render(); + const btn = screen.getByTitle('My PR'); + const down = new MouseEvent('mousedown', { button: 0, bubbles: true, cancelable: true }); + btn.dispatchEvent(down); + expect(down.defaultPrevented).toBe(false); + }); +}); + +describe('PrRow meta tooltip', () => { + it('reveals the full datetime when you hover the relative time', () => { + const updatedAt = '2024-03-05T14:30:00Z'; + const { container } = render( + , + ); + const time = container.querySelector('.prrow__time'); + expect(time?.textContent).toBe('updated 2h ago'); + expect(time?.getAttribute('title')).toBe(absoluteTime(updatedAt)); + }); + + it('leaves the tooltip off when the meta is not a timestamp', () => { + const { container } = render( + , + ); + const time = container.querySelector('.prrow__time'); + expect(time?.hasAttribute('title')).toBe(false); + }); +}); diff --git a/samples/CodeFlow/src/components/Dashboard/__tests__/useFlaggedCleanup.test.ts b/samples/CodeFlow/src/components/Dashboard/__tests__/useFlaggedCleanup.test.ts new file mode 100644 index 0000000..dfb6d61 --- /dev/null +++ b/samples/CodeFlow/src/components/Dashboard/__tests__/useFlaggedCleanup.test.ts @@ -0,0 +1,97 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { renderHook, act, waitFor } from '@testing-library/react'; + +const getPullRequest = vi.fn(); +vi.mock('../../../services/githubService', () => ({ + GitHubService: { getPullRequest: (...a: unknown[]) => getPullRequest(...a) }, +})); + +import { useFlaggedCleanup } from '../useFlaggedCleanup'; +import { getFlaggedPrs, toggleFlaggedPr, type FlaggedPr } from '../../../utils/storage'; + +function pr(state: 'open' | 'closed', merged = false) { + return { state, merged }; +} + +function seedFlags(...numbers: number[]): FlaggedPr[] { + for (const n of numbers) toggleFlaggedPr({ owner: 'o', name: 'r', number: n }); + return getFlaggedPrs(); +} + +beforeEach(() => { + getPullRequest.mockReset(); +}); + +describe('useFlaggedCleanup', () => { + it('makes no requests until it is explicitly run', () => { + const flags = seedFlags(1, 2); + renderHook(() => useFlaggedCleanup(flags, vi.fn())); + expect(getPullRequest).not.toHaveBeenCalled(); + }); + + it('removes flags for merged and closed PRs, keeping open ones', async () => { + const flags = seedFlags(1, 2, 3); // stored newest-first: [3, 2, 1] + getPullRequest.mockImplementation(({ number }: { number: number }) => + Promise.resolve( + number === 1 ? pr('open') : number === 2 ? pr('closed', true) : pr('closed'), + ), + ); + const onChange = vi.fn(); + + const { result } = renderHook(() => useFlaggedCleanup(flags, onChange)); + act(() => result.current.run()); + + await waitFor(() => expect(result.current.running).toBe(false)); + expect(getFlaggedPrs().map((f) => f.number)).toEqual([1]); + expect(result.current.removed).toBe(2); + expect(onChange).toHaveBeenCalledTimes(1); + }); + + it('keeps a flag when its status request fails (fails open)', async () => { + const flags = seedFlags(1, 2); + getPullRequest.mockImplementation(({ number }: { number: number }) => + number === 1 ? Promise.reject(new Error('rate limited')) : Promise.resolve(pr('closed')), + ); + const onChange = vi.fn(); + + const { result } = renderHook(() => useFlaggedCleanup(flags, onChange)); + act(() => result.current.run()); + + await waitFor(() => expect(result.current.running).toBe(false)); + expect(getFlaggedPrs().map((f) => f.number)).toEqual([1]); + expect(result.current.removed).toBe(1); + }); + + it('reports zero removals and does not notify when everything is still open', async () => { + const flags = seedFlags(1, 2); + getPullRequest.mockResolvedValue(pr('open')); + const onChange = vi.fn(); + + const { result } = renderHook(() => useFlaggedCleanup(flags, onChange)); + act(() => result.current.run()); + + await waitFor(() => expect(result.current.removed).toBe(0)); + expect(getFlaggedPrs().map((f) => f.number)).toEqual([2, 1]); + expect(onChange).not.toHaveBeenCalled(); + }); + + it('issues exactly one request per flag, sequentially', async () => { + const flags = seedFlags(1, 2, 3); + let inFlight = 0; + let maxInFlight = 0; + getPullRequest.mockImplementation(async () => { + inFlight += 1; + maxInFlight = Math.max(maxInFlight, inFlight); + await Promise.resolve(); + inFlight -= 1; + return pr('open'); + }); + + const { result } = renderHook(() => useFlaggedCleanup(flags, vi.fn())); + act(() => result.current.run()); + + await waitFor(() => expect(result.current.running).toBe(false)); + expect(getPullRequest).toHaveBeenCalledTimes(3); + expect(maxInFlight).toBe(1); + }); +}); diff --git a/samples/CodeFlow/src/components/Dashboard/useFlaggedCleanup.ts b/samples/CodeFlow/src/components/Dashboard/useFlaggedCleanup.ts new file mode 100644 index 0000000..e7a5d78 --- /dev/null +++ b/samples/CodeFlow/src/components/Dashboard/useFlaggedCleanup.ts @@ -0,0 +1,61 @@ +import { useCallback, useState } from 'react'; +import { GitHubService } from '../../services/githubService'; +import { prKeyOf } from '../../utils/dashboardReview'; +import { pruneFlaggedPrs, type FlaggedPr } from '../../utils/storage'; + +/** + * On-demand cleanup for the Flagged list. + * + * The dashboard used to fetch every flagged PR's live status on load purely so + * merged/closed ones could be hidden — one connector request per star, on an + * uncapped list, every single render pass. Flagged rows render fine from the + * title captured when they were starred, so that work now happens only when the + * reviewer explicitly asks for it. + * + * Fetches fail open: a PR whose status can't be read is left flagged. + */ +export interface FlaggedCleanup { + running: boolean; + /** Number of flags removed by the last run, or undefined if it hasn't run. */ + removed?: number; + run: () => void; +} + +export function useFlaggedCleanup(flags: FlaggedPr[], onChange: () => void): FlaggedCleanup { + const [running, setRunning] = useState(false); + const [removed, setRemoved] = useState(undefined); + + const run = useCallback(() => { + if (running) return; + setRunning(true); + setRemoved(undefined); + + const work = async () => { + const resolved = new Set(); + // Sequential on purpose: a burst of parallel requests is exactly what got + // this dashboard rate-limited. The list is short and this is user-initiated. + for (const f of flags) { + try { + const pr = await GitHubService.getPullRequest({ + owner: f.owner, + name: f.name, + number: f.number, + }); + if (pr.merged || pr.state !== 'open') resolved.add(prKeyOf(f)); + } catch { + /* fail open — keep the flag */ + } + } + if (resolved.size > 0) { + pruneFlaggedPrs((f) => resolved.has(prKeyOf(f))); + onChange(); + } + setRemoved(resolved.size); + setRunning(false); + }; + + void work(); + }, [flags, onChange, running]); + + return { running, removed, run }; +} diff --git a/samples/CodeFlow/src/components/DiffViewer/ChangeMap.tsx b/samples/CodeFlow/src/components/DiffViewer/ChangeMap.tsx new file mode 100644 index 0000000..b75105d --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/ChangeMap.tsx @@ -0,0 +1,70 @@ +import { useEffect, useState } from 'react'; + +/** + * Scrollbar minimap showing colored markers where changes are in the file. + * Aligns with the actual scrollbar of .workarea__center. + */ +export function ChangeMap({ markers }: { markers: Array<{ position: number; type: 'add' | 'del' }> }) { + const [rect, setRect] = useState<{ top: number; height: number } | null>(null); + const [hasOverflow, setHasOverflow] = useState(false); + + useEffect(() => { + const el = document.querySelector('.workarea__center'); + if (!el) return; + const update = () => { + const r = el.getBoundingClientRect(); + setRect({ top: r.top, height: r.height }); + setHasOverflow(el.scrollHeight > el.clientHeight + 1); + }; + update(); + const observer = new ResizeObserver(update); + observer.observe(el); + return () => observer.disconnect(); + }, []); + + // Hide when no markers, no rect, or content doesn't scroll. + if (markers.length === 0 || !rect || !hasOverflow) return null; + + // Consolidate adjacent markers into ranges. + const minHeight = 0.003; + const consolidated: Array<{ top: number; height: number; type: 'add' | 'del' }> = []; + let i = 0; + while (i < markers.length) { + const start = markers[i]; + let end = start; + const type = start.type; + while (i + 1 < markers.length && markers[i + 1].type === type && markers[i + 1].position - end.position < 0.005) { + i++; + end = markers[i]; + } + consolidated.push({ + top: start.position, + height: Math.max(end.position - start.position + minHeight, minHeight), + type, + }); + i++; + } + + const handleClick = (position: number) => { + const scrollEl = document.querySelector('.workarea__center'); + if (!scrollEl) return; + const scrollTarget = position * (scrollEl.scrollHeight - scrollEl.clientHeight); + scrollEl.scrollTo({ top: scrollTarget, behavior: 'smooth' }); + }; + + return ( +
    + {consolidated.map((m, idx) => ( +
    handleClick(m.top)} + /> + ))} +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/CommentLineButton.tsx b/samples/CodeFlow/src/components/DiffViewer/CommentLineButton.tsx new file mode 100644 index 0000000..896d9dd --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/CommentLineButton.tsx @@ -0,0 +1,22 @@ +import type { Anchor } from './diffViewerUtils'; +import { selectedCommentRange } from './selectedCommentRange'; + +export type StartComment = (anchor: Anchor) => void; + +export function CommentLineButton({ anchor, onStartComment }: { + anchor: Anchor | null; + onStartComment?: StartComment; +}) { + if (!anchor || !onStartComment) return null; + return ( + + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/DeferredSyntax.tsx b/samples/CodeFlow/src/components/DiffViewer/DeferredSyntax.tsx new file mode 100644 index 0000000..db49306 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/DeferredSyntax.tsx @@ -0,0 +1,72 @@ +import { useEffect, useRef, useState, type ReactNode } from 'react'; + +interface Cell { + visible: boolean; + update(visible: boolean): void; +} + +const cells = new Map(); +const selectedCells = new Set(); +let observer: IntersectionObserver | null = null; + +function updateCell(target: Element, cell: Cell): void { + const selection = target.ownerDocument.getSelection(); + // Replacing text nodes under a selection would collapse it, including a + // selection spanning multiple rows. Wait until it leaves this cell. + if (selection && !selection.isCollapsed) { + for (let i = 0; i < selection.rangeCount; i += 1) { + if (selection.getRangeAt(i).intersectsNode(target)) { + selectedCells.add(target); + return; + } + } + } + selectedCells.delete(target); + cell.update(cell.visible); +} + +function updateSelectedCells(): void { + for (const target of selectedCells) { + const cell = cells.get(target); + if (cell) updateCell(target, cell); + } +} + +function observe(target: Element, update: Cell['update']): () => void { + if (!observer) { + observer = new IntersectionObserver((entries) => { + for (const entry of entries) { + const cell = cells.get(entry.target); + if (!cell) continue; + cell.visible = entry.isIntersecting; + updateCell(entry.target, cell); + } + }, { rootMargin: '600px 0px' }); + document.addEventListener('selectionchange', updateSelectedCells); + } + cells.set(target, { visible: false, update }); + observer.observe(target); + return () => { + observer?.unobserve(target); + cells.delete(target); + selectedCells.delete(target); + if (cells.size === 0) { + observer?.disconnect(); + observer = null; + document.removeEventListener('selectionchange', updateSelectedCells); + } + }; +} + +/** Keep text and marks mounted, but only pay for nearby syntax token spans. */ +export function DeferredSyntax({ children }: { children(visible: boolean): ReactNode }) { + const ref = useRef(null); + const [visible, setVisible] = useState(() => typeof IntersectionObserver === 'undefined'); + + useEffect(() => { + if (!ref.current || typeof IntersectionObserver === 'undefined') return; + return observe(ref.current, setVisible); + }, []); + + return {children(visible)}; +} diff --git a/samples/CodeFlow/src/components/DiffViewer/DescriptionView.tsx b/samples/CodeFlow/src/components/DiffViewer/DescriptionView.tsx new file mode 100644 index 0000000..6f306f8 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/DescriptionView.tsx @@ -0,0 +1,98 @@ +import { useCallback, useMemo, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import type { CommentThread } from '../../types'; +import { CommentThreadView, NewCommentComposer } from '../CommentThread/CommentThread'; +import { CollapsedThread } from '../CommentThread/CollapsedThread'; +import { MarkdownBody } from '../MarkdownBody/MarkdownBody'; +import { hasDraft, prDraftKey } from '../../utils/commentDrafts'; + +/** Shows the PR description and any top-level (non-file) comments. */ +export function DescriptionView() { + const { pr, threads, comparison, actions, prKey } = useCodeFlow(); + const draftKey = prDraftKey(prKey); + // Reopen the box if there's a comment part-written in it. A reload wipes this + // component out, and a restored draft with nothing on screen to hold it would + // look exactly like the text having been thrown away. + const [showComposer, setShowComposer] = useState(() => hasDraft(draftKey)); + // Threads the reviewer has collapsed. Conversations start expanded; clicking + // a thread header (or its chevron) folds it down to a one-line summary. + const [collapsed, setCollapsed] = useState>(() => new Set()); + + const collapseThread = useCallback((id: string) => { + setCollapsed((prev) => new Set(prev).add(id)); + }, []); + + const expandThread = useCallback((id: string) => { + setCollapsed((prev) => { + const next = new Set(prev); + next.delete(id); + return next; + }); + }, []); + + // Non-file threads: no filename, unknown path, or path not in the comparison. + const changedFiles = useMemo( + () => new Set((comparison?.files ?? []).map((f) => f.filename)), + [comparison], + ); + const prThreads = useMemo( + () => + threads.filter( + (t: CommentThread) => !t.filename || t.filename === '(unknown)' || !changedFiles.has(t.filename), + ), + [threads, changedFiles], + ); + + const handleSubmit = async (body: string) => { + await actions.addIssueComment(body); + setShowComposer(false); + }; + + return ( +
    +
    + Description + +
    +
    + {pr?.title &&

    {pr.title}

    } + {pr?.body ? ( + + ) : ( +

    No description provided.

    + )} +
    + {showComposer && ( +
    + setShowComposer(false)} + draftKey={draftKey} + placeholder="Leave a comment on this pull request…" + /> +
    + )} + {prThreads.length > 0 && ( +
    +

    + Conversations ({prThreads.length}) +

    + {prThreads.map((t) => + collapsed.has(t.id) ? ( + expandThread(t.id)} + className="collapsed-thread--description" + /> + ) : ( + collapseThread(t.id)} /> + ), + )} +
    + )} +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/DiffBlockNav.tsx b/samples/CodeFlow/src/components/DiffViewer/DiffBlockNav.tsx new file mode 100644 index 0000000..bd025b3 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/DiffBlockNav.tsx @@ -0,0 +1,40 @@ +import type { DiffBlockNav as Nav } from './useDiffBlockNav'; + +/** + * Previous/Next controls that jump between change blocks in the diff, rolling + * over into the neighbouring changed file at either end. + */ +export function DiffBlockNav({ nav }: { nav: Nav }) { + const label = nav.total === 0 ? '0' : `${nav.ordinal ?? '–'}/${nav.total}`; + return ( +
    + + + {label} + + +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/DiffHeader.tsx b/samples/CodeFlow/src/components/DiffViewer/DiffHeader.tsx new file mode 100644 index 0000000..ed16776 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/DiffHeader.tsx @@ -0,0 +1,222 @@ +import type { FileChange } from '../../types'; +import { diffSideLabel, diffSideTitle, type DiffSideMode } from '../../utils/diffSide'; +import { getRenameInfo } from '../../utils/renameInfo'; +import { CopyLinkButton } from '../CopyLinkButton/CopyLinkButton'; +import { DiffBlockNav } from './DiffBlockNav'; +import type { DiffBlockNav as Nav } from './useDiffBlockNav'; + +/** + * Why the viewer is showing what it is showing. + * + * `off` is the reviewer's own choice; the other three are the viewer declining, + * for three different reasons that want three different sentences — it is still + * fetching, it could not fetch, or it could but the file is long enough that + * expanding it would make the app crawl. + */ +export type FullFileStatus = 'off' | 'loading' | 'ready' | 'unavailable' | 'too-large'; + +export function DiffHeader({ + file, + viewMode, + onViewMode, + sideMode, + onCycleSide, + showFullFile, + onToggleFullFile, + fullFileLoading, + fullFileStatus, + fontSize, + onZoomIn, + onZoomOut, + onZoomReset, + ignoreWhitespace, + onToggleWhitespace, + hiddenWhitespace, + additions, + deletions, + wordDiff, + onToggleWordDiff, + canPreview, + markdownPreview, + onToggleMarkdownPreview, + blockNav, + deepLink, +}: { + file: FileChange; + viewMode: 'inline' | 'split'; + onViewMode: (m: 'inline' | 'split') => void; + sideMode: DiffSideMode; + onCycleSide: () => void; + showFullFile: boolean; + onToggleFullFile: () => void; + fullFileLoading: boolean; + fullFileStatus: FullFileStatus; + fontSize: number; + onZoomIn: () => void; + onZoomOut: () => void; + onZoomReset: () => void; + /** Whether whitespace-only changes are currently folded away. */ + ignoreWhitespace: boolean; + onToggleWhitespace: () => void; + /** How many whitespace-only lines are being hidden right now. */ + hiddenWhitespace: number; + /** Change counts as rendered, which differ from GitHub's when hiding. */ + additions: number; + deletions: number; + /** Whether word-level diff highlights are enabled. */ + wordDiff: boolean; + onToggleWordDiff: () => void; + /** Whether this file can be shown rendered — true only for Markdown. */ + canPreview: boolean; + /** Whether the rendered view is the one currently on screen. */ + markdownPreview: boolean; + onToggleMarkdownPreview: () => void; + blockNav: Nav; + /** Shareable link to this file. Empty when no PR is loaded. */ + deepLink?: string; +}) { + // Every control in the toggle group is a flip: the label always names the + // state you are in, and clicking moves on to the next one. + const tooLarge = fullFileStatus === 'too-large'; + const scopeName = showFullFile ? 'Full file' : 'Diff only'; + const scopeIcon = fullFileLoading + ? '⏳' + : fullFileStatus === 'unavailable' || tooLarge + ? '⚠️' + : showFullFile + ? '📄' + : '📝'; + const scopeTitle = tooLarge + ? 'This file is long enough that expanding it would make the app crawl — showing only the changed lines. Click to expand it anyway.' + : fullFileStatus === 'unavailable' + ? 'Full file content unavailable — showing changes only. Click to switch to diff only.' + : showFullFile + ? 'Showing the whole file — click to show only the changed lines' + : 'Showing only the changed lines — click to show the whole file'; + + const layoutName = viewMode === 'inline' ? 'Inline' : 'Side by side'; + const layoutTitle = + viewMode === 'inline' + ? 'Inline layout — click to switch to side by side' + : 'Side-by-side layout — click to switch to inline'; + + const wsName = ignoreWhitespace ? 'Whitespace hidden' : 'Whitespace shown'; + const wsTitle = ignoreWhitespace + ? 'Whitespace hidden — hiding changes that are only whitespace. Click to show them.' + : 'Whitespace shown — showing every change, whitespace included. Click to hide whitespace-only ones.'; + + const wdTitle = wordDiff + ? 'Word diff on — highlighting the changed words within a line. Click to turn off.' + : 'Word diff off — a rewritten line is coloured whole. Click to highlight the changed words.'; + + // Markdown is the one language whose source is harder to read than its + // output, so it gets a switch the others don't need. + const mdName = markdownPreview ? 'Preview' : 'Source'; + const mdTitle = markdownPreview + ? 'Showing rendered Markdown, with each block marked as changed — click to read the raw source' + : 'Showing the raw Markdown source — click to read it rendered'; + + // Neither of these describes anything in a rendered view: there are no lines + // to align side by side, and no line to highlight words within. + const notInPreview = markdownPreview + ? 'Not available while previewing rendered Markdown' + : undefined; + + // The filename clips from the left so the basename survives, which is exactly + // where an "old → new" prefix would be cut off. Give the move its own pill + // ahead of the path instead: the header is sticky, so this is the one label + // that stays on screen once the banner has scrolled away. + const rename = getRenameInfo(file); + + return ( +
    + {rename && ( + + ↪ {rename.badge} + + )} + + {file.filename} + + + 0 ? 'diff__counts--reduced' : ''}`} + title={ + hiddenWhitespace > 0 + ? `+${additions} / −${deletions} after hiding whitespace-only changes. ` + + `GitHub reports +${file.additions} / −${file.deletions} for this file.` + : undefined + } + > + +{additions} + −{deletions} + +
    + + + +
    + +
    + {canPreview && ( + + )} + + + + + +
    +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/DiffSearchBox.tsx b/samples/CodeFlow/src/components/DiffViewer/DiffSearchBox.tsx new file mode 100644 index 0000000..2ad7370 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/DiffSearchBox.tsx @@ -0,0 +1,141 @@ +import { useEffect, useRef, type KeyboardEvent } from 'react'; +import type { DiffSearch } from './useDiffSearch'; + +function toggleClass(active: boolean): string { + return active ? 'diff__search-toggle diff__search-toggle--active' : 'diff__search-toggle'; +} + +/** + * VSCode-style find widget for the diff viewer: query input with Match Case, + * Match Whole Word and Use Regex toggles, a live result count, and + * previous / next / close controls. + * + * The widget mounts only while find is open, so it focuses (and selects) its + * input on mount to mirror VSCode's Ctrl+F behavior. + */ +export function DiffSearchBox({ search }: { search: DiffSearch }) { + const { query, options, total, activeOrdinal, error, capped, focusTick } = search; + const inputRef = useRef(null); + + // Focus and select the input whenever the find widget opens or re-opens + // (i.e. every time openFind() is called, including when the widget is already + // visible — e.g. the user selected text and pressed Ctrl+F again). + useEffect(() => { + const el = inputRef.current; + if (el) { + el.focus(); + el.select(); + } + }, [focusTick]); + + const onInputKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault(); + if (e.shiftKey) search.prev(); + else search.next(); + } else if (e.key === 'Escape') { + e.preventDefault(); + search.close(); + } + }; + + const hasQuery = query.length > 0; + const noResults = !error && hasQuery && total === 0; + const countLabel = error + ? 'Invalid regex' + : !hasQuery + ? '' + : total === 0 + ? 'No results' + : `${activeOrdinal} of ${total}${capped ? '+' : ''}`; + + return ( +
    +
    + search.setQuery(e.target.value)} + onKeyDown={onInputKeyDown} + /> +
    + + + +
    +
    + + + {countLabel} + + +
    + + + +
    +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/DiffViewer.tsx b/samples/CodeFlow/src/components/DiffViewer/DiffViewer.tsx new file mode 100644 index 0000000..494f528 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/DiffViewer.tsx @@ -0,0 +1,845 @@ +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { parsePatch, buildFullFileDiff } from '../../utils/diffParser'; +import { collapseWhitespaceOnlyChanges } from '../../utils/whitespaceDiff'; +import type { DiffSide, ParsedDiff } from '../../types'; +import { DESCRIPTION_FILE } from '../../types'; +import { GitHubService } from '../../services/githubService'; +import { buildDeepLink } from '../../utils/deepLink'; +import { anchorKey, lineAnchor, scrollDiffRowIntoView, scrollThreadIntoView, cssEscape } from './diffViewerUtils'; +import { findRowKeyForLine } from './rowForLine'; +import { planLineReveal, type RevealPresentation } from './lineReveal'; +import { LineFocusNotice } from './LineFocusNotice'; +import { DiffHeader, type FullFileStatus } from './DiffHeader'; +import { WhitespaceNotice } from './WhitespaceNotice'; +import { RenameNotice } from './RenameNotice'; +import { getRenameInfo, noDiffMessage } from '../../utils/renameInfo'; +import { computeDiffBlocks, countDiffBlocks } from './diffBlocks'; +import { useDiffBlockNav, type NavFile } from './useDiffBlockNav'; +import { InlineDiff } from './InlineDiff'; +import { SplitDiff } from './SplitDiff'; +import { MarkdownPreview } from './MarkdownPreview'; +import { buildMarkdownPreview, isMarkdownPath } from '../../utils/markdownPreview'; +import { OrphanedThreads } from './OrphanedThreads'; +import { ChangeMap } from './ChangeMap'; +import { FolderDiffViewer } from './FolderDiffViewer'; +import { DescriptionView } from './DescriptionView'; +import { useFileComments } from './useFileComments'; +import { buildSearchCells, type SearchColumn } from './diffSearchModel'; +import { useDiffSearch } from './useDiffSearch'; +import { DiffSearchBox } from './DiffSearchBox'; +import { filterDiffToSide, nextDiffSideMode, sideFilterEmptyMessage, type DiffSideMode } from '../../utils/diffSide'; +import { isOversizeForFullFile } from '../../utils/fullFileBudget'; +import { + DEFAULT_SETTINGS, + MAX_SETTINGS_FONT_SIZE, + MIN_SETTINGS_FONT_SIZE, + SETTINGS_FONT_SIZE_STEP, +} from '../../settings/settings'; +import { useSettings } from '../../settings/useSettings'; +import { useWordDiff } from './useWordDiff'; +import { useSelectionHighlight } from './useSelectionHighlight'; +import { useSyntaxHighlight } from './useSyntaxHighlight'; +import { renderCell } from './renderCell'; +import { overlayMarks, type MarkRange } from './cellLayers'; +import { findSeed } from '../../utils/selectionToken'; +import { commentTopLine } from '../../utils/commentRange'; +import { createLogger } from '../../lib/logger'; + +const log = createLogger('diff'); + +const NO_MARKS: MarkRange[] = []; + + +export function DiffViewer() { + const { comparison, selectedFile, selectedFolder, viewMode, actions, pr, focusRequest, lineFocusRequest } = useCodeFlow(); + const { consumeLineFocus } = actions; + const { settings, update } = useSettings(); + + // Whole file or changed lines only is a persisted preference, not session + // state: the toolbar button writes straight back to it, the same way the diff + // side cycle does below. A reviewer who wants whole files wants them on the + // next file and after the next reload too, so there is nothing to reset. + const showFullFile = settings.defaultFullFile; + + // Both/left/right cycles from one button, and the choice is the setting, so + // it follows the reviewer from file to file. + // + // The one exception is the override below, which exists so that clicking a + // cross-file search result can reveal a line this filter is hiding. It is + // keyed to the filename like the whitespace and word-diff overrides, so it + // lapses on its own, and cycling the button clears it — a deliberate choice + // still beats one the viewer made on the reviewer's behalf. + const [sideOverride, setSideOverride] = useState<{ file: string; value: DiffSideMode } | null>(null); + const sideMode = + sideOverride && sideOverride.file === selectedFile ? sideOverride.value : settings.diffSide; + const cycleSide = useCallback(() => { + setSideOverride(null); + update({ diffSide: nextDiffSideMode(sideMode) }); + }, [sideMode, update]); + + // Zoom is the same value the settings panel exposes as "code font size", so the + // toolbar buttons and the settings slider stay in agreement — and the choice + // is remembered with the reviewer's settings. + const fontSize = settings.defaultFontSize; + + const zoomIn = useCallback(() => { + update({ + defaultFontSize: Math.min(fontSize + SETTINGS_FONT_SIZE_STEP, MAX_SETTINGS_FONT_SIZE), + }); + }, [fontSize, update]); + + const zoomOut = useCallback(() => { + update({ + defaultFontSize: Math.max(fontSize - SETTINGS_FONT_SIZE_STEP, MIN_SETTINGS_FONT_SIZE), + }); + }, [fontSize, update]); + + const zoomReset = useCallback(() => { + update({ defaultFontSize: DEFAULT_SETTINGS.defaultFontSize }); + }, [update]); + + const file = comparison?.files.find((f) => f.filename === selectedFile); + + const shouldFetchFullFile = !!( + selectedFile && + selectedFile !== DESCRIPTION_FILE && + pr && + comparison && + showFullFile && + file && + file.status !== 'removed' + ); + const owner = pr?.coordinates.owner; + const repoName = pr?.coordinates.name; + const headSha = comparison?.headSha; + const contentRequest = useMemo( + () => shouldFetchFullFile && owner && repoName && selectedFile && headSha + ? { repo: { owner, name: repoName }, path: selectedFile, ref: headSha } + : null, + [shouldFetchFullFile, owner, repoName, selectedFile, headSha], + ); + const [loadedContent, setLoadedContent] = useState<{ + request: NonNullable; + content: string | undefined; + } | null>(null); + // Never combine the next patch with the previous file's content, even for the + // render before effects run: that bypasses the size guard and expands stale rows. + const fullFileContent = contentRequest && loadedContent?.request === contentRequest + ? loadedContent.content + : undefined; + const fullFileLoading = !!contentRequest && loadedContent?.request !== contentRequest; + + useEffect(() => { + if (!contentRequest) return; + let cancelled = false; + GitHubService.getFileContent(contentRequest.repo, contentRequest.path, contentRequest.ref).then((content) => { + if (!cancelled) { + setLoadedContent({ request: contentRequest, content }); + } + }).catch((error: unknown) => { + if (!cancelled) { + log.warn('Full-file content could not be loaded', error); + setLoadedContent({ request: contentRequest, content: undefined }); + } + }); + return () => { cancelled = true; }; + }, [contentRequest]); + + // Expanding to the whole file costs per line of the *file*, and pays it again + // on every re-render; past a point that reads as the app hanging rather than + // as a big file. Over budget it waits to be asked a second time, and the + // answer is remembered per file so it lapses when the reviewer moves on — + // the same shape as the whitespace and word-diff overrides below. Where that + // point sits is the reviewer's to move, and they can switch it off entirely. + const [fullFileOverride, setFullFileOverride] = useState<{ file: string; value: boolean } | null>(null); + const forcedFullFile = + fullFileOverride && fullFileOverride.file === selectedFile ? fullFileOverride.value : false; + + const oversizeFullFile = useMemo( + () => isOversizeForFullFile(fullFileContent, settings.fullFileLineLimit), + [fullFileContent, settings.fullFileLineLimit], + ); + + /** Asked for, too big, and not yet insisted upon. */ + const fullFileSuppressed = showFullFile && oversizeFullFile && !forcedFullFile; + const effectiveFullFile = showFullFile && !fullFileSuppressed; + + const toggleFullFile = useCallback(() => { + // While it is being held back, the button's job is to let it through. + if (fullFileSuppressed) { + if (selectedFile) setFullFileOverride({ file: selectedFile, value: true }); + return; + } + setFullFileOverride(null); + update({ defaultFullFile: !showFullFile }); + }, [fullFileSuppressed, selectedFile, showFullFile, update]); + + const rawDiff: ParsedDiff = useMemo(() => { + if (effectiveFullFile && fullFileContent != null) { + return buildFullFileDiff(file?.patch, fullFileContent); + } + return parsePatch(file?.patch); + }, [file?.patch, effectiveFullFile, fullFileContent]); + + // Hiding whitespace-only changes and highlighting changed words are both + // persisted defaults, but a reviewer needs to be able to overrule either one + // for the file in front of them without changing it for every file. Keying the + // override to the filename means it lapses on its own when they move on — no + // effect, no stale state. + const [wsOverride, setWsOverride] = useState<{ file: string; value: boolean } | null>(null); + const ignoreWhitespace = + wsOverride && wsOverride.file === selectedFile ? wsOverride.value : settings.ignoreWhitespace; + + const toggleWhitespace = useCallback(() => { + if (!selectedFile) return; + setWsOverride({ file: selectedFile, value: !ignoreWhitespace }); + }, [selectedFile, ignoreWhitespace]); + + const showWhitespace = useCallback(() => { + if (!selectedFile) return; + setWsOverride({ file: selectedFile, value: false }); + }, [selectedFile]); + + const [wdOverride, setWdOverride] = useState<{ file: string; value: boolean } | null>(null); + const wordDiffEnabled = + wdOverride && wdOverride.file === selectedFile ? wdOverride.value : settings.wordDiff; + + const toggleWordDiff = useCallback(() => { + if (!selectedFile) return; + setWdOverride({ file: selectedFile, value: !wordDiffEnabled }); + }, [selectedFile, wordDiffEnabled]); + + // Same per-file override again, for reading a Markdown file rendered rather + // than as source. Only ever true for Markdown: every other language reviews + // better as text, so the switch isn't offered at all. + const canPreview = isMarkdownPath(selectedFile); + const [mdOverride, setMdOverride] = useState<{ file: string; value: boolean } | null>(null); + const markdownPreview = + canPreview + && (mdOverride && mdOverride.file === selectedFile + ? mdOverride.value + : settings.markdownPreview); + + const toggleMarkdownPreview = useCallback(() => { + if (!selectedFile) return; + setMdOverride({ file: selectedFile, value: !markdownPreview }); + }, [selectedFile, markdownPreview]); + + // Collapse before anything else reads the model. A side filter, the change + // map, search and block navigation are all presentation over this shape, and + // they must agree with what is on screen; collapsing afterwards would leave + // them navigating to changes the reviewer cannot see. It also has to run + // first on its own terms: pairing a deletion with its replacement is only + // possible while both sides are still present. + const whitespace = useMemo( + () => + ignoreWhitespace + ? collapseWhitespaceOnlyChanges(rawDiff) + : { + diff: rawDiff, + collapsed: 0, + additions: file?.additions ?? 0, + deletions: file?.deletions ?? 0, + rawAdditions: file?.additions ?? 0, + rawDeletions: file?.deletions ?? 0, + }, + [ignoreWhitespace, rawDiff, file?.additions, file?.deletions], + ); + + const collapsedDiff = whitespace.diff; + + // Everything downstream (find, block nav, minimap, orphaned threads) works off + // the *visible* diff, so hiding a side keeps them all in agreement. + // + // The two transforms do not commute, so the order here is load-bearing. + // Recognising a deletion and its replacement as the same line requires seeing + // both of them; the side filter's whole job is to throw one of them away. + // Collapse first, narrow second. Reversed, the collapse would only ever see + // half of each pair, would never match anything, and would fail silently. + const diff: ParsedDiff = useMemo( + () => filterDiffToSide(collapsedDiff, sideMode), + [collapsedDiff, sideMode], + ); + + // Built from the diff *after* whitespace collapsing and the side filter, so + // the preview and the source view are always two renderings of one model. + const previewBlocks = useMemo( + () => (markdownPreview ? buildMarkdownPreview(diff) : []), + [markdownPreview, diff], + ); + + // A line the reviewer asked for that is in no rendering of this diff. Kept in + // state rather than merely logged, because silence is the failure mode this + // is here to prevent. It belongs to one visit to one file: a warning raised + // about `a.ts` has nothing to say about the next file opened, and nothing to + // say about the next visit back either — by then the reviewer has navigated + // twice since the click that failed. + const [unreachableLine, setUnreachableLine] = useState< + { file: string; side: DiffSide; line: number } | null + >(null); + // Retiring it on the way past, during render, rather than from an effect: the + // warning must already be gone in the commit that first paints the new file, + // or it flashes on a file it was never about. This is React's documented way + // to reset state when the thing it describes changes. + const [noticeFile, setNoticeFile] = useState(selectedFile); + if (noticeFile !== selectedFile) { + setNoticeFile(selectedFile); + setUnreachableLine(null); + } + const unreachableHere = unreachableLine?.file === selectedFile ? unreachableLine : null; + + // Whichever navigation started most recently owns the viewport. Both the + // cross-file landing below and the thread focus further down take a token, so + // an older retry loop stands down instead of dragging the reviewer back. + const navTokenRef = useRef(0); + + // The file on screen right now, for the landing loop to consult between + // retries. It cannot read `selectedFile` from its closure: that would be the + // file as it stood when the request arrived, which is exactly the thing it + // needs to notice has changed. + const selectedFileRef = useRef(selectedFile); + useEffect(() => { + selectedFileRef.current = selectedFile; + }); + + // Everything the landing loop needs, refreshed every render. It reads through + // this rather than closing over the values so that re-renders — a toggle, a + // full file arriving — never restart a landing. Same pattern as `livePrRef` + // in usePrLoader. + const presentation: RevealPresentation = { markdownPreview, ignoreWhitespace, sideMode }; + const landingRef = useRef({ rawDiff, collapsedDiff, diff, viewMode, presentation }); + useEffect(() => { + landingRef.current = { rawDiff, collapsedDiff, diff, viewMode, presentation }; + }); + + // "The whole file" in the sense that matters to the reviewer: nothing real is + // left once the whitespace is folded away. + const whitespaceWholeFile = whitespace.collapsed > 0 + && whitespace.additions === 0 + && whitespace.deletions === 0; + + const fullFileStatus: FullFileStatus = !showFullFile + ? 'off' + : fullFileLoading + ? 'loading' + : fullFileSuppressed + ? 'too-large' + : fullFileContent != null + ? 'ready' + : 'unavailable'; + + const { + threads, + expandedThreads, + expandThread, + collapseThread, + composer, + startComment, + renderComposer, + extrasRow, + threadBadges, + } = useFileComments(selectedFile, diff); + + // ---- In-file find (VSCode-style) ---------------------------------------- + const diffRootRef = useRef(null); + const searchCells = useMemo( + () => buildSearchCells(diff, viewMode, sideMode), + [diff, viewMode, sideMode], + ); + const search = useDiffSearch(searchCells, selectedFile ?? undefined); + const { + open: searchOpen, + openFind: openSearch, + close: closeSearch, + activeHitId: searchActiveHitId, + } = search; + const searchable = + !!file + && !diff.isEmpty + && !markdownPreview + && selectedFile !== DESCRIPTION_FILE + && !selectedFolder; + + // ---- Word-level diff highlights ----------------------------------------- + const wordDiff = useWordDiff(diff, viewMode, sideMode); + + // ---- Occurrence highlights for the selected word ------------------------- + // Off while the find widget is open: the two would fight over the same layer, + // and find is the more deliberate of the two. + const selection = useSelectionHighlight( + searchCells, + searchable && !searchOpen && settings.selectionHighlight, + diffRootRef, + ); + + // ---- Syntax highlighting ------------------------------------------------- + const syntax = useSyntaxHighlight( + diff, + viewMode, + sideMode, + selectedFile ?? undefined, + settings.syntaxHighlight, + ); + + // Marks and syntax tokens are different layers, not competing ones: a find + // hit inside a string literal is both at once. Only the mark layer is + // exclusive — search takes it over from word diff while the find widget is + // open, because two overlapping sets of s would be unreadable. + // + // Selection highlights are the exception: they answer "where else is this + // word", which is worth knowing on a changed line too, so they are layered + // over the word diff rather than replacing it. + const searchMarksFor = search.marksFor; + const wordMarksFor = wordDiffEnabled && wordDiff.hasHighlights ? wordDiff.marksFor : null; + const selectionMarksFor = selection.active ? selection.marksFor : null; + + const marksFor = useMemo(() => { + if (searchOpen) return searchMarksFor; + if (!selectionMarksFor) return wordMarksFor; + if (!wordMarksFor) return selectionMarksFor; + return (column: SearchColumn, rowKey: string): readonly MarkRange[] => + overlayMarks(wordMarksFor(column, rowKey), selectionMarksFor(column, rowKey)); + }, [searchOpen, searchMarksFor, wordMarksFor, selectionMarksFor]); + + const renderContent = useMemo(() => { + if (!marksFor && !syntax.active) return undefined; + return (column: SearchColumn, rowKey: string, text: string) => + renderCell(text, marksFor?.(column, rowKey) ?? NO_MARKS, syntax.tokensFor(column, rowKey), syntax.deferRendering); + }, [marksFor, syntax]); + + // ---- Change-block navigation (Prev/Next delta) -------------------------- + const blocks = useMemo(() => computeDiffBlocks(diff, viewMode), [diff, viewMode]); + const navFiles: NavFile[] = useMemo( + () => + (comparison?.files ?? []) + .filter((f) => f.status !== 'unchanged') + .map((f) => ({ filename: f.filename, hasBlocks: countDiffBlocks(f.patch) > 0 })), + [comparison], + ); + const blockNav = useDiffBlockNav({ + blocks, + selectedFile, + files: navFiles, + selectFile: actions.selectFile, + rootRef: diffRootRef, + }); + const { next: nextBlock, prev: prevBlock } = blockNav; + + // Alt+Down / Alt+Up jump between change blocks, mirroring the header buttons. + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (!e.altKey || e.ctrlKey || e.metaKey) return; + if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return; + const target = e.target as HTMLElement | null; + const tag = target?.tagName; + if (tag === 'INPUT' || tag === 'TEXTAREA' || target?.isContentEditable) return; + e.preventDefault(); + if (e.key === 'ArrowDown') nextBlock(); + else prevBlock(); + }; + window.addEventListener('keydown', onKey); + return () => window.removeEventListener('keydown', onKey); + }, [nextBlock, prevBlock]); + + // Ctrl/Cmd+F opens the find widget (suppressing the browser find bar); + // Escape closes it. Only active when a searchable file diff is shown. + // + // Shift is excluded because Ctrl+Shift+F belongs to the cross-file search + // panel — without that guard both would fire on the one keystroke, and the + // in-file widget would steal the focus the results panel just took. + // + // The seed prefers the live selection but falls back to the word the + // occurrence highlight is drawing, because painting that highlight collapses + // the selection out from under the browser — see findSeed(). + const highlightedToken = selection.token; + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === 'f' || e.key === 'F')) { + if (!searchable) return; + e.preventDefault(); + openSearch(findSeed(window.getSelection()?.toString(), highlightedToken)); + } else if (e.key === 'Escape' && searchOpen) { + closeSearch(); + } + }; + window.addEventListener('keydown', onKey); + return () => window.removeEventListener('keydown', onKey); + }, [searchable, searchOpen, openSearch, closeSearch, highlightedToken]); + + // Scroll the active match into view as the user navigates. + useEffect(() => { + if (!searchOpen || !searchActiveHitId) return; + const root = diffRootRef.current; + if (!root) return; + let el: Element | null; + try { + el = root.querySelector(`[data-hit-id="${cssEscape(searchActiveHitId)}"]`); + } catch { + el = null; + } + el?.scrollIntoView({ block: 'nearest', inline: 'nearest' }); + }, [searchOpen, searchActiveHitId]); + + // Land on a line asked for by a cross-file search result. + // + // The address is a side and a line number, resolved against the diff on + // screen — but that diff is filtered, and the filters can hide the very line + // that was clicked. So this does not merely look: it asks what would have to + // change for the line to be visible, applies that as a per-file override, and + // only gives up — visibly, via the notice — once the line turns out to be in + // no rendering of this file at all. + // + // The request is a one-shot: it is consumed the moment this is done with it, + // whether that is landing, giving up, or being overtaken. An unconsumed + // request would outlive the navigation that raised it, so simply opening that + // file again later would replay the jump — and possibly re-widen the view — + // without the reviewer having clicked anything. Because the request object + // only changes when a new one is raised, depending on it is also what keeps + // unrelated re-renders from restarting a landing already in progress. + useEffect(() => { + if (!lineFocusRequest) return; + const { filename, side, line, seq } = lineFocusRequest; + if (filename !== selectedFileRef.current) { + // The reviewer is somewhere else entirely; this request missed its + // moment and should not be waiting to fire when they come back. + consumeLineFocus(seq); + return; + } + const token = ++navTokenRef.current; + let cancelled = false; + let attempts = 0; + + const finish = () => { + cancelled = true; + consumeLineFocus(seq); + }; + + const tick = () => { + // A later navigation — another result, or a thread from the comment + // summary — owns the viewport now. Abandon this one rather than fight it. + if (cancelled || navTokenRef.current !== token) return; + // The reviewer has opened something else while this was retrying. Their + // choice wins, and the request dies with the file it belonged to. + if (selectedFileRef.current !== filename) { + finish(); + return; + } + // Any previous failure belongs to a request the reviewer has replaced. + if (attempts === 0) setUnreachableLine(null); + + const landing = landingRef.current; + const plan = planLineReveal( + landing.rawDiff, + landing.collapsedDiff, + { side, line }, + landing.presentation, + ); + + if (plan.kind === 'reveal') { + const wanted = plan.presentation; + const now = landing.presentation; + if (wanted.markdownPreview !== now.markdownPreview) { + setMdOverride({ file: filename, value: wanted.markdownPreview }); + } + if (wanted.ignoreWhitespace !== now.ignoreWhitespace) { + setWsOverride({ file: filename, value: wanted.ignoreWhitespace }); + } + if (wanted.sideMode !== now.sideMode) { + setSideOverride({ file: filename, value: wanted.sideMode }); + } + // Re-render, then land against the revealed diff on a later tick. + // Counted against the same budget: a reveal that never takes effect + // must end as "unreachable", not as a spin. + if (attempts++ < 40) { + window.setTimeout(tick, 50); + return; + } + setUnreachableLine({ file: filename, side, line }); + finish(); + return; + } + + if (plan.kind === 'visible') { + const rowKey = findRowKeyForLine(landing.diff, landing.viewMode, side, line); + if (rowKey && scrollDiffRowIntoView(diffRootRef.current, rowKey)) { + setUnreachableLine(null); + finish(); + return; + } + } + + // Selecting the file and fetching its full content are both async, so an + // early miss usually just means the diff has not arrived yet. Keep + // trying, and only call it unreachable once the budget is spent. + if (attempts++ < 40) { + window.setTimeout(tick, 50); + return; + } + setUnreachableLine({ file: filename, side, line }); + finish(); + }; + + // Deferred rather than called inline: the first pass can flip presentation + // state, and doing that in the effect body is a cascading render. + const timer = window.setTimeout(tick, 0); + return () => { + cancelled = true; + window.clearTimeout(timer); + }; + }, [lineFocusRequest, consumeLineFocus]); + + // Respond to a focus request (e.g. clicking a row in the comment summary): + // expand the target thread and scroll it into view. Retries because switching + // files and fetching the full file are async, so the element may not exist yet. + // + // Takes the navigation token as well, so that a thread the reviewer picks + // after a search result wins — and is not overruled by the older landing. + useEffect(() => { + if (!focusRequest) return; + const { threadId } = focusRequest; + const token = ++navTokenRef.current; + let cancelled = false; + let attempts = 0; + const tick = () => { + if (cancelled || navTokenRef.current !== token) return; + // Expand once (deferred, so this isn't a synchronous setState in the + // effect body) so the reviewer lands on the full thread. + if (attempts === 0) { + expandThread(threadId); + // This navigation supersedes the search result that failed: the + // warning describes a journey the reviewer is no longer on. + setUnreachableLine(null); + } + if (scrollThreadIntoView(threadId)) return; + if (attempts++ < 40) window.setTimeout(tick, 50); + }; + const timer = window.setTimeout(tick, 50); + return () => { + cancelled = true; + window.clearTimeout(timer); + }; + }, [focusRequest, expandThread]); + + // Find threads whose anchor line isn't present in the diff. + // + // Outdated threads are always treated as orphans, even when their recovered + // line happens to exist in the current diff. That line is where the comment + // was *written*, not where the code went, so rendering it inline would put a + // stale comment against unrelated code with nothing to say it had moved. + const orphanedThreads = useMemo(() => { + if (!file || diff.isEmpty) return []; + const diffAnchors = new Set(); + for (const hunk of diff.hunks) { + for (const line of hunk.lines) { + for (const side of ['left', 'right'] as const) { + if (sideMode !== 'both' && sideMode !== side) continue; + const a = lineAnchor(line, side); + if (a) diffAnchors.add(anchorKey(a.side, a.line)); + } + } + } + return threads.filter((t) => t.outdated || !diffAnchors.has(anchorKey(t.side, commentTopLine(t)))); + }, [threads, diff, file, sideMode]); + + // Compute change markers for the scrollbar minimap. + const changeMarkers = useMemo(() => { + const markers: Array<{ position: number; type: 'add' | 'del' }> = []; + let totalLines = 0; + for (const hunk of diff.hunks) { + for (const line of hunk.lines) { + if (line.type === 'add' || line.type === 'del' || line.type === 'context') { + totalLines++; + } + } + } + if (totalLines === 0) return markers; + let lineIdx = 0; + for (const hunk of diff.hunks) { + for (const line of hunk.lines) { + if (line.type === 'add' || line.type === 'del' || line.type === 'context') { + if (line.type === 'add' || line.type === 'del') { + markers.push({ position: lineIdx / totalLines, type: line.type }); + } + lineIdx++; + } + } + } + return markers; + }, [diff]); + + if (!selectedFile && !selectedFolder) { + return ( +
    +

    Select a file to view its changes.

    +
    + ); + } + + // Folder multi-file diff view. + if (selectedFolder) { + return ; + } + + // Description / PR-level comments view. + if (selectedFile === DESCRIPTION_FILE) { + return ; + } + + // File not in comparison but has threads — show threads in an empty-file state. + if (!file) { + if (threads.length === 0) { + return ( +
    +

    Select a file to view its changes.

    +
    + ); + } + return ( +
    +
    + {selectedFile} + File not in current comparison +
    + +
    + ); + } + + const rename = getRenameInfo(file); + + return ( +
    +
    + 0 ? whitespace.additions : file.additions} + deletions={whitespace.collapsed > 0 ? whitespace.deletions : file.deletions} + wordDiff={wordDiffEnabled} + onToggleWordDiff={toggleWordDiff} + canPreview={canPreview} + markdownPreview={markdownPreview} + onToggleMarkdownPreview={toggleMarkdownPreview} + blockNav={blockNav} + deepLink={ + pr + ? buildDeepLink({ + owner: pr.coordinates.owner, + repo: pr.coordinates.name, + number: pr.coordinates.number, + file: file.filename, + }) + : '' + } + /> + {searchOpen && } +
    + + setUnreachableLine(null)} /> +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/FolderDiffViewer.tsx b/samples/CodeFlow/src/components/DiffViewer/FolderDiffViewer.tsx new file mode 100644 index 0000000..dfb896e --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/FolderDiffViewer.tsx @@ -0,0 +1,144 @@ +import { useLayoutEffect, useMemo, useState } from 'react'; +import { useCodeFlow } from '../../state/useCodeFlow'; +import { useSettings } from '../../settings/useSettings'; +import { parsePatch } from '../../utils/diffParser'; +import type { FileChange } from '../../types'; +import { InlineDiff } from './InlineDiff'; +import { SplitDiff } from './SplitDiff'; +import { useFileComments } from './useFileComments'; +import { RenameNotice } from './RenameNotice'; +import { getRenameInfo, noDiffMessage } from '../../utils/renameInfo'; +import { useSyntaxHighlight } from './useSyntaxHighlight'; +import { scrollDiffPaneToTop } from '../../utils/diffPane'; +import { renderCell } from './renderCell'; +import type { MarkRange } from './cellLayers'; +import type { SearchColumn } from './diffSearchModel'; + +/** The folder view has no find widget and no word diff, so syntax is the only layer. */ +const NO_MARKS: MarkRange[] = []; + +/** Renders diffs for all files under the selected folder in a scrollable combined view. */ +export function FolderDiffViewer() { + const { comparison, selectedFolder, viewMode, actions } = useCodeFlow(); + + // Picking a folder swaps what the diff pane renders, but not the pane itself, + // so the scroll offset of whatever was open survives the switch and drops the + // reviewer somewhere in the middle of the folder. Reset it before paint so + // they always start at the top of the folder's first file. + useLayoutEffect(() => { + if (!selectedFolder) return; + scrollDiffPaneToTop(); + }, [selectedFolder]); + + const folderFiles = useMemo(() => { + if (!comparison || !selectedFolder) return []; + const prefix = selectedFolder + '/'; + return comparison.files.filter( + (f) => f.filename.startsWith(prefix) && f.status !== 'unchanged', + ); + }, [comparison, selectedFolder]); + + if (folderFiles.length === 0) { + return ( +
    +

    No changed files in this folder.

    +
    + ); + } + + return ( +
    + {folderFiles.map((file) => ( + + ))} +
    + ); +} + +/** A single file's diff inside the folder combined view, with a collapsible header. */ +function FolderFileDiff({ + file, + viewMode, + onSelectFile, +}: { + file: FileChange; + viewMode: 'inline' | 'split'; + onSelectFile: (filename: string) => void; +}) { + const [collapsed, setCollapsed] = useState(false); + const diff = useMemo(() => parsePatch(file.patch), [file.patch]); + const basename = file.filename.split('/').pop() ?? file.filename; + const { composer, startComment, extrasRow, threadBadges } = useFileComments(file.filename, diff); + const { settings } = useSettings(); + const rename = getRenameInfo(file); + + // 'both' rather than settings.diffSide: the folder view renders SplitDiff + // without a sideMode prop, so both columns are always on screen here. + const syntax = useSyntaxHighlight(diff, viewMode, 'both', file.filename, settings.syntaxHighlight); + const renderContent = useMemo(() => { + if (!syntax.active) return undefined; + return (column: SearchColumn, rowKey: string, text: string) => + renderCell(text, NO_MARKS, syntax.tokensFor(column, rowKey), syntax.deferRendering); + }, [syntax]); + + return ( +
    +
    setCollapsed((v) => !v)}> + + ▸ + + + {basename} + {rename && ( + + ↪ {rename.badge} + + )} + + {file.additions > 0 && +{file.additions}} + {file.deletions > 0 && −{file.deletions}} + + + {file.filename} + +
    + {!collapsed && ( + <> + + {diff.isEmpty ? ( +
    {noDiffMessage(rename)}
    + ) : viewMode === 'inline' ? ( + + ) : ( + + )} + + )} +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/InlineDiff.tsx b/samples/CodeFlow/src/components/DiffViewer/InlineDiff.tsx new file mode 100644 index 0000000..117554f --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/InlineDiff.tsx @@ -0,0 +1,73 @@ +import type { ReactNode } from 'react'; +import type { ParsedDiff } from '../../types'; +import { inCommentRange, lineAnchor, type Anchor } from './diffViewerUtils'; +import type { SearchColumn } from './diffSearchModel'; +import { InlineDiffRow } from './InlineDiffRow'; +import type { StartComment } from './CommentLineButton'; +import type { DiffSideMode } from '../../utils/diffSide'; + +interface DiffBodyProps { + diff: ParsedDiff; + onStartComment?: StartComment; + commentRange?: Anchor | null; + sideMode?: DiffSideMode; + extrasRow(anchor: Anchor | null, colSpan: number, key: string): ReactNode; + threadBadges(anchor: Anchor | null): ReactNode; + /** Optional highlighter for the find feature; falls back to plain text. */ + renderContent?(column: SearchColumn, rowKey: string, text: string): ReactNode; +} + +export function InlineDiff({ diff, onStartComment, commentRange, sideMode = 'both', extrasRow, threadBadges, renderContent }: DiffBodyProps) { + const rows: ReactNode[] = []; + + diff.hunks.forEach((hunk, hi) => { + hunk.lines.forEach((line, li) => { + const key = `${hi}-${li}`; + if (line.type === 'hunk') { + rows.push( + + + + {line.content} + , + ); + return; + } + if (line.type === 'meta') { + rows.push( + + + + {line.content} + , + ); + return; + } + const leftAnchor = sideMode !== 'right' ? lineAnchor(line, 'left') : null; + const rightAnchor = sideMode !== 'left' ? lineAnchor(line, 'right') : null; + rows.push( + , + ); + const leftExtras = extrasRow(leftAnchor, 4, `l-${key}`); + const rightExtras = extrasRow(rightAnchor, 4, `r-${key}`); + if (leftExtras) rows.push(leftExtras); + if (rightExtras) rows.push(rightExtras); + }); + }); + + return ( + + {rows} +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/InlineDiffRow.tsx b/samples/CodeFlow/src/components/DiffViewer/InlineDiffRow.tsx new file mode 100644 index 0000000..6fd9573 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/InlineDiffRow.tsx @@ -0,0 +1,68 @@ +import { memo, type ReactNode } from 'react'; +import type { DiffLine } from '../../types'; +import { lineAnchor, type Anchor } from './diffViewerUtils'; +import type { SearchColumn } from './diffSearchModel'; +import { CommentLineButton, type StartComment } from './CommentLineButton'; + +/** + * One line of the inline diff. + * + * Split out purely so it can be memoised. A long file is thousands of these, + * and without the memo every one of them is rebuilt whenever anything in the + * viewer changes — dragging the splitter, opening a thread, a background poll. + * The props are all stable by construction: `line` comes from a memoised diff, + * and the four callbacks are `useCallback`/`useMemo` results, so a render that + * changes none of them costs nothing per row instead of a millisecond. + */ +export const InlineDiffRow = memo(function InlineDiffRow({ + line, + rowKey, + onStartComment, + threadBadges, + renderContent, + showLeft = true, + showRight = true, + selected = false, +}: { + line: DiffLine; + rowKey: string; + onStartComment?: StartComment; + showLeft?: boolean; + showRight?: boolean; + selected?: boolean; + threadBadges(anchor: Anchor | null): ReactNode; + renderContent?(column: SearchColumn, rowKey: string, text: string): ReactNode; +}) { + const leftAnchor = showLeft ? lineAnchor(line, 'left') : null; + const rightAnchor = showRight ? lineAnchor(line, 'right') : null; + const cls = + line.type === 'add' + ? 'diff__line--add' + : line.type === 'del' + ? 'diff__line--del' + : 'diff__line--ctx'; + const leftBadges = threadBadges(leftAnchor); + const rightBadges = threadBadges(rightAnchor); + return ( + + + {leftBadges && {leftBadges}} + {line.oldLineNo ?? ''} + + + + {line.newLineNo ?? ''} + {rightBadges && {rightBadges}} + + + + {line.type === 'add' ? '+' : line.type === 'del' ? '−' : ''} + + + + {renderContent ? renderContent('inline', rowKey, line.content) : line.content || '\u00a0'} + + + + ); +}); diff --git a/samples/CodeFlow/src/components/DiffViewer/LineFocusNotice.tsx b/samples/CodeFlow/src/components/DiffViewer/LineFocusNotice.tsx new file mode 100644 index 0000000..dc56cb3 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/LineFocusNotice.tsx @@ -0,0 +1,39 @@ +/** + * Says so when a search result could not be reached. + * + * Clicking a cross-file result is a promise to take the reviewer somewhere. + * Almost always the viewer can keep it, widening the presentation if the line + * was filtered out of view. When it genuinely cannot — the line belongs to a + * patch this file no longer has, say, because the iteration moved underneath + * the results — the one thing it must not do is nothing at all, leaving the + * reviewer staring at an unchanged screen wondering whether the click landed. + */ +import type { DiffSide } from '../../types'; + +export function LineFocusNotice({ + target, + onDismiss, +}: { + /** The line that could not be shown, or null to render nothing. */ + target: { side: DiffSide; line: number } | null; + onDismiss: () => void; +}) { + if (!target) return null; + + const side = target.side === 'left' ? 'original' : 'updated'; + + return ( +
    + + + Couldn't jump to line {target.line} on the {side} side — it isn't in this + file's diff any more. The search results may be from an earlier iteration. + + +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/MarkdownPreview.tsx b/samples/CodeFlow/src/components/DiffViewer/MarkdownPreview.tsx new file mode 100644 index 0000000..7c929fa --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/MarkdownPreview.tsx @@ -0,0 +1,134 @@ +import { Fragment } from 'react'; +import { MarkdownBody } from '../MarkdownBody/MarkdownBody'; +import type { DiffSide } from '../../types'; +import type { DiffSideMode } from '../../utils/diffSide'; +import { commentLineLabel, commentTopLine } from '../../utils/commentRange'; +import type { Anchor } from './diffViewerUtils'; +import type { StartComment } from './CommentLineButton'; +import type { FileComments } from './useFileComments'; +import { + markdownBlockStatusLabel, + previewRangeLabel, + type MarkdownPreviewBlock, +} from '../../utils/markdownPreview'; + +/** + * The rendered half of a Markdown diff. + * + * Each block is laid out as gutter + body, exactly like the source view, so the + * two read as the same document seen two ways: the line numbers on the left are + * the ones a reviewer would quote, and the red/green wash is the same palette. + * A block that was rewritten shows both versions stacked, before over after — + * the closest a rendered view gets to a side-by-side line diff. + */ +export function MarkdownPreview({ + blocks, sideMode = 'both', onStartComment, composer, renderComposer, +}: { + blocks: MarkdownPreviewBlock[]; + sideMode?: DiffSideMode; + onStartComment?: StartComment; + composer?: Anchor | null; + renderComposer?: FileComments['renderComposer']; +}) { + const composerBlock = composer ? blocks.findIndex((block) => { + if (block.status === 'gap' || (sideMode !== 'both' && sideMode !== composer.side)) return false; + if (block.status !== 'unchanged' && !(composer.side === 'left' ? block.oldText : block.newText)) return false; + const anchor = blockAnchor(block, composer.side); + return anchor && commentTopLine(composer) >= commentTopLine(anchor) + && commentTopLine(composer) <= anchor.line; + }) : -1; + const editor = composer && renderComposer && ( +
    + {composerBlock === -1 && ( +
    This draft's source lines are not shown in the preview.
    + )} + {renderComposer('Comments are anchored to Markdown source lines.')} +
    + ); + return ( +
    + {blocks.length === 0 &&
    Nothing to preview in this file.
    } + {blocks.map((block, index) => ( + + + {composerBlock === index && editor} + + ))} + {composerBlock === -1 && editor} +
    + ); +} + +function blockAnchor(block: MarkdownPreviewBlock, side: DiffSide): Anchor | null { + const start = side === 'left' ? block.oldStart : block.newStart; + const end = (side === 'left' ? block.oldEnd : block.newEnd) ?? start; + if (start == null || end == null) return null; + return { side, line: end, ...(start < end ? { startLine: start } : {}) }; +} + +function PreviewBlock({ block, sideMode, onStartComment }: { + block: MarkdownPreviewBlock; + sideMode: DiffSideMode; + onStartComment?: StartComment; +}) { + if (block.status === 'gap') { + return ( +
    + {block.label || '…'} +
    + ); + } + + // Quote removals and left-only previews by their original source positions. + const range = + block.status === 'removed' || sideMode === 'left' + ? previewRangeLabel(block.oldStart, block.oldEnd) + : previewRangeLabel(block.newStart, block.newEnd); + const word = markdownBlockStatusLabel(block.status); + + return ( +
    +
    + {range} + {block.added > 0 && +{block.added}} + {block.removed > 0 && −{block.removed}} +
    +
    + {block.oldText !== '' && block.status !== 'unchanged' && ( + + )} + {block.newText !== '' && ( + + )} +
    +
    + ); +} + +function PreviewSide({ text, side, block, onStartComment }: { + text: string; + side: DiffSide; + block: MarkdownPreviewBlock; + onStartComment?: StartComment; +}) { + const anchor = blockAnchor(block, side); + const label = anchor + ? `Comment on ${side} ${anchor.startLine === undefined ? 'line' : 'lines'} ${commentLineLabel(anchor)}` + : ''; + return ( +
    + {anchor && onStartComment && ( + + )} + +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/OrphanedThreads.tsx b/samples/CodeFlow/src/components/DiffViewer/OrphanedThreads.tsx new file mode 100644 index 0000000..5ec97be --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/OrphanedThreads.tsx @@ -0,0 +1,63 @@ +import type { CommentThread } from '../../types'; +import { CommentThreadView } from '../CommentThread/CommentThread'; +import { CollapsedThread } from '../CommentThread/CollapsedThread'; +import { threadAnchorLabel, threadAnchorTitle } from '../../utils/threadAnchor'; + +interface OrphanedThreadsProps { + threads: CommentThread[]; + /** Ids of threads that are currently expanded. */ + expandedThreads: Set; + onExpand(id: string): void; + onCollapse(id: string): void; + /** + * Overrides the header. The default names these threads as outdated, which is + * only true when the caller filtered them that way — the Markdown preview + * reuses this list for *every* thread on the file, because a rendered + * document has no line to hang them off. + */ + heading?: string; + /** Overrides the ⚠️ that goes with the default heading. */ + icon?: string; +} + +/** + * Render threads whose anchor line is no longer in the visible diff. Each thread + * can be collapsed to a compact header (parity with in-diff comment badges) so a + * long list of outdated comments stays manageable. + * + * The anchor shown is where the comment was written, which for an outdated + * thread is a line in an earlier iteration — the point being that a reviewer can + * go and check whether it was addressed. It is deliberately not a live position. + */ +export function OrphanedThreads({ + threads, + expandedThreads, + onExpand, + onCollapse, + heading, + icon = '⚠️', +}: OrphanedThreadsProps) { + return ( +
    +
    + {icon} + {heading ?? `Outdated comments (${threads.length}) — line no longer in diff`} +
    + {threads.map((t) => { + const expanded = expandedThreads.has(t.id); + return ( +
    + + {threadAnchorLabel(t)} + + {expanded ? ( + onCollapse(t.id)} /> + ) : ( + onExpand(t.id)} /> + )} +
    + ); + })} +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/RenameNotice.tsx b/samples/CodeFlow/src/components/DiffViewer/RenameNotice.tsx new file mode 100644 index 0000000..986bf42 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/RenameNotice.tsx @@ -0,0 +1,39 @@ +import type { RenameInfo } from '../../utils/renameInfo'; + +/** + * Says out loud that a file moved, because a pure move is otherwise invisible. + * + * The diff for a move is empty, the counts are +0/−0 and the file list shows + * the same basename it did before, so without this banner the reviewer has no + * way to tell the difference between "this file travelled to another folder" + * and "this file failed to load". Both paths are printed in full: the folder a + * file came from is the whole point of the change, and it is exactly the part + * a truncated path in the header clips away. + */ +export function RenameNotice({ info }: { info: RenameInfo | undefined }) { + if (!info) return null; + + return ( +
    + + + {info.verb}{' '} + {info.pathOnly + ? '— only the file path changed. The contents are identical.' + : '— the file path changed, and so did its contents.'} + + {info.from} + + {/* The arrow carries the whole meaning of the pair, and a screen + reader would skip it, so spell it out for one. */} + moved to + {info.to} + + +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/SplitDiff.tsx b/samples/CodeFlow/src/components/DiffViewer/SplitDiff.tsx new file mode 100644 index 0000000..4814073 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/SplitDiff.tsx @@ -0,0 +1,158 @@ +import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'; +import type { ParsedDiff } from '../../types'; +import { toSideBySideRows, type SideBySideRow } from '../../utils/diffParser'; +import type { DiffSideMode } from '../../utils/diffSide'; +import { inCommentRange, lineAnchor, type Anchor } from './diffViewerUtils'; +import type { SearchColumn } from './diffSearchModel'; +import { SplitDiffRow } from './SplitDiffRow'; +import type { StartComment } from './CommentLineButton'; + +interface DiffBodyProps { + diff: ParsedDiff; + onStartComment?: StartComment; + commentRange?: Anchor | null; + extrasRow(anchor: Anchor | null, colSpan: number, key: string): ReactNode; + threadBadges(anchor: Anchor | null): ReactNode; + /** Optional highlighter for the find feature; falls back to plain text. */ + renderContent?(column: SearchColumn, rowKey: string, text: string): ReactNode; + /** Which side(s) to render. A single side collapses to one full-width pane. */ + sideMode?: DiffSideMode; +} + +import { loadSplitRatio, saveSplitRatio } from '../../utils/preferences'; + +export function SplitDiff({ + diff, + onStartComment, + commentRange, + extrasRow, + threadBadges, + renderContent, + sideMode = 'both', +}: DiffBodyProps) { + const sbsRows = useMemo(() => toSideBySideRows(diff), [diff]); + const [splitPct, setSplitPct] = useState(loadSplitRatio); + const containerRef = useRef(null); + const dragging = useRef(false); + + const showLeft = sideMode !== 'right'; + const showRight = sideMode !== 'left'; + const bothSides = sideMode === 'both'; + const colSpan = bothSides ? 5 : 2; + + const onPointerDown = useCallback((e: React.PointerEvent) => { + e.preventDefault(); + dragging.current = true; + (e.target as HTMLElement).setPointerCapture(e.pointerId); + }, []); + + const onPointerMove = useCallback((e: React.PointerEvent) => { + if (!dragging.current || !containerRef.current) return; + const rect = containerRef.current.getBoundingClientRect(); + const pct = Math.min(80, Math.max(20, ((e.clientX - rect.left) / rect.width) * 100)); + setSplitPct(pct); + }, []); + + const endDrag = useCallback(() => { + if (!dragging.current) return; + dragging.current = false; + setSplitPct((v) => { saveSplitRatio(v); return v; }); + }, []); + + // Suppress text selection while dragging. + // + // The end of the drag is watched at the document, not just on the wrapper, + // because a drag can end somewhere the wrapper never hears about: the pointer + // is cancelled, capture is lost, or the handle itself unmounts when the side + // filter changes mid-drag. Miss it and `dragging` stays true forever — and + // since this handler is on the document, that silently kills text selection + // in the *entire* app until the file is changed. + useEffect(() => { + const onSelectStart = (e: Event) => { if (dragging.current) e.preventDefault(); }; + document.addEventListener('selectstart', onSelectStart); + document.addEventListener('pointerup', endDrag); + document.addEventListener('pointercancel', endDrag); + return () => { + dragging.current = false; + document.removeEventListener('selectstart', onSelectStart); + document.removeEventListener('pointerup', endDrag); + document.removeEventListener('pointercancel', endDrag); + }; + }, [endDrag]); + + const rows: ReactNode[] = []; + + sbsRows.forEach((row: SideBySideRow, ri) => { + if (row.type === 'hunk') { + rows.push( + + + {row.header} + + , + ); + return; + } + const left = row.left; + const right = row.right; + const leftAnchor = left ? lineAnchor(left, 'left') : null; + const rightAnchor = right ? lineAnchor(right, 'right') : null; + + rows.push( + , + ); + + if (showLeft) { + const leftExtras = extrasRow(leftAnchor, colSpan, `l-${ri}`); + if (leftExtras) rows.push(leftExtras); + } + if (showRight) { + const rightExtras = extrasRow(rightAnchor, colSpan, `r-${ri}`); + if (rightExtras) rows.push(rightExtras); + } + }); + + const leftW = bothSides ? `${splitPct}%` : '100%'; + const rightW = bothSides ? `${100 - splitPct}%` : '100%'; + + return ( +
    + + + {showLeft && } + {showLeft && } + {bothSides && } + {showRight && } + {showRight && } + + {rows} +
    + {bothSides && ( +
    + )} +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/SplitDiffRow.tsx b/samples/CodeFlow/src/components/DiffViewer/SplitDiffRow.tsx new file mode 100644 index 0000000..d56f473 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/SplitDiffRow.tsx @@ -0,0 +1,99 @@ +import { memo, type ReactNode } from 'react'; +import type { SideBySideRow } from '../../utils/diffParser'; +import { lineAnchor, type Anchor } from './diffViewerUtils'; +import type { SearchColumn } from './diffSearchModel'; +import { CommentLineButton, type StartComment } from './CommentLineButton'; + +/** + * One side-by-side row. + * + * Split out purely so it can be memoised — see the note on `InlineDiffRow`. It + * matters most here: the splitter width lives on the table's ``, not + * on the rows, so dragging it needs no row to change at all. Without the memo, + * every pointer move rebuilt the entire table. + */ +export const SplitDiffRow = memo(function SplitDiffRow({ + row, + rowIndex, + showLeft, + showRight, + bothSides, + onStartComment, + threadBadges, + renderContent, + leftSelected = false, + rightSelected = false, +}: { + row: SideBySideRow; + rowIndex: number; + showLeft: boolean; + showRight: boolean; + bothSides: boolean; + onStartComment?: StartComment; + leftSelected?: boolean; + rightSelected?: boolean; + threadBadges(anchor: Anchor | null): ReactNode; + renderContent?(column: SearchColumn, rowKey: string, text: string): ReactNode; +}) { + const left = row.left; + const right = row.right; + const leftAnchor = left ? lineAnchor(left, 'left') : null; + const rightAnchor = right ? lineAnchor(right, 'right') : null; + const leftCls = !left + ? 'diff__line--empty' + : left.type === 'del' + ? 'diff__line--del' + : left.type === 'context' + ? 'diff__line--ctx' + : ''; + const rightCls = !right + ? 'diff__line--empty' + : right.type === 'add' + ? 'diff__line--add' + : right.type === 'context' + ? 'diff__line--ctx' + : ''; + const leftBadges = threadBadges(leftAnchor); + const rightBadges = threadBadges(rightAnchor); + const ri = String(rowIndex); + + return ( + + {showLeft && ( + <> + + {leftBadges && {leftBadges}} + {left?.oldLineNo ?? ''} + + + + + {left ? renderContent + ? renderContent('left', ri, left.content) + : left.content || '\u00a0' + : '\u00a0'} + + + + )} + {bothSides && } + {showRight && ( + <> + + {rightBadges && {rightBadges}} + {right?.newLineNo ?? ''} + + + + + {right ? renderContent + ? renderContent('right', ri, right.content) + : right.content || '\u00a0' + : '\u00a0'} + + + + )} + + ); +}); diff --git a/samples/CodeFlow/src/components/DiffViewer/ThreadBadge.tsx b/samples/CodeFlow/src/components/DiffViewer/ThreadBadge.tsx new file mode 100644 index 0000000..95d4b16 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/ThreadBadge.tsx @@ -0,0 +1,27 @@ +import type { CommentThread } from '../../types'; +import { threadDisplayStatus } from '../../utils/threadStatus'; + +interface ThreadBadgeProps { + thread: CommentThread; + onClick: () => void; +} + +/** Small gutter indicator for a collapsed thread — like CodeFlow's inline badges. */ +export function ThreadBadge({ thread, onClick }: ThreadBadgeProps) { + const count = thread.comments.length; + const isResolved = thread.status === 'resolved'; + const isClosed = !!thread.closed; + const state = threadDisplayStatus(thread); + const cls = `diff__thread-badge diff__thread-badge--${state}`; + const glyph = isClosed ? `💬✓ ${count}` : isResolved ? '💬✓' : `💬 ${count}`; + return ( + + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/WhitespaceNotice.tsx b/samples/CodeFlow/src/components/DiffViewer/WhitespaceNotice.tsx new file mode 100644 index 0000000..77d622a --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/WhitespaceNotice.tsx @@ -0,0 +1,57 @@ +/** + * Tells the reviewer when the diff they are looking at is hiding something. + * + * Hiding whitespace-only changes is on by default, which means the app is + * quietly withholding real changes — a line-ending flip is a genuine edit that + * can break a shell script and will show up in blame. Silently hiding it would + * be worse than the noisy diff it replaces, so whenever anything is actually + * folded away the viewer says so, gives the true counts, and offers a one-click + * way back to the unabridged diff. + */ +export function WhitespaceNotice({ + hidden, + rawAdditions, + rawDeletions, + wholeFile, + onShow, +}: { + /** Number of whitespace-only lines folded away. Never rendered when 0. */ + hidden: number; + rawAdditions: number; + rawDeletions: number; + /** True when essentially the whole file was rewritten this way. */ + wholeFile: boolean; + onShow: () => void; +}) { + if (hidden <= 0) return null; + + const lines = hidden === 1 ? '1 line' : `${hidden} lines`; + + return ( +
    + + + {wholeFile ? ( + <> + This file was rewritten end to end — every line changed, but + only its whitespace did. Usually an editor converting line endings (CRLF vs + LF) on save. Showing the {lines} as unchanged so the real edit stands out. + + ) : ( + <> + Hiding {lines} that changed only in whitespace — line endings, indentation or + trailing spaces. + + )}{' '} + + Full diff: +{rawAdditions} / −{rawDeletions}. + + + +
    + ); +} diff --git a/samples/CodeFlow/src/components/DiffViewer/__tests__/DeferredSyntax.test.tsx b/samples/CodeFlow/src/components/DiffViewer/__tests__/DeferredSyntax.test.tsx new file mode 100644 index 0000000..69ef46c --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/__tests__/DeferredSyntax.test.tsx @@ -0,0 +1,128 @@ +import { act, cleanup, render } from '@testing-library/react'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { renderCell } from '../renderCell'; +import type { TokenRange } from '../../../utils/syntax/tokens'; + +const observers: TestObserver[] = []; + +class TestObserver implements IntersectionObserver { + readonly root = null; + readonly rootMargin: string; + readonly scrollMargin = '0px'; + readonly thresholds = [0]; + private callback: IntersectionObserverCallback; + observe = vi.fn<(target: Element) => void>(); + unobserve = vi.fn<(target: Element) => void>(); + disconnect = vi.fn(); + takeRecords = () => []; + + constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit) { + this.callback = callback; + this.rootMargin = options?.rootMargin ?? ''; + observers.push(this); + } + + emit(targets: Element[], isIntersecting: boolean) { + this.callback(targets.map((target) => ({ + target, isIntersecting, time: 0, intersectionRatio: isIntersecting ? 1 : 0, + boundingClientRect: new DOMRect(), intersectionRect: new DOMRect(), rootBounds: null, + })), this); + } +} + +const tokens: TokenRange[] = [{ start: 0, end: 5, kind: 'keyword' }]; +const text = 'const value = 1;'; +const marks = [{ start: 6, end: 11, key: 'hit', className: 'diff__match', hitId: 'inline:0-1:0' }]; + +beforeEach(() => { + observers.length = 0; + vi.stubGlobal('IntersectionObserver', TestObserver); +}); + +afterEach(() => { + cleanup(); + document.getSelection()?.removeAllRanges(); + vi.unstubAllGlobals(); +}); + +describe('deferred syntax rendering', () => { + it('keeps text and navigable marks offscreen, and adds/removes only syntax near the viewport', () => { + const { container } = render(
    {renderCell(text, marks, tokens, true)}
    ); + const observer = observers[0]; + const target = observer.observe.mock.calls[0][0]; + expect(container.textContent).toBe(text); + expect(container.querySelector('.tok')).toBeNull(); + expect(container.querySelector('[data-hit-id="inline:0-1:0"]')?.textContent).toBe('value'); + + act(() => observer.emit([target], true)); + expect(container.querySelector('.tok--keyword')?.textContent).toBe('const'); + act(() => observer.emit([target], false)); + expect(container.querySelector('.tok')).toBeNull(); + expect(container.textContent).toBe(text); + expect(container.querySelectorAll('[data-hit-id="inline:0-1:0"]')).toHaveLength(1); + }); + + it('shares one observer and bounds token spans as the visible rows change', () => { + const { container, unmount } = render( +
    {Array.from({ length: 2501 }, (_, i) =>
    {renderCell(text, [], tokens, true)}
    )}
    , + ); + expect(observers).toHaveLength(1); + const observer = observers[0]; + const targets = observer.observe.mock.calls.map(([target]) => target); + expect(targets).toHaveLength(2501); + expect(container.querySelectorAll('.tok')).toHaveLength(0); + act(() => observer.emit(targets.slice(0, 40), true)); + expect(container.querySelectorAll('.tok')).toHaveLength(40); + act(() => { + observer.emit(targets.slice(0, 40), false); + observer.emit(targets.slice(-40), true); + }); + expect(container.querySelectorAll('.tok')).toHaveLength(40); + expect(targets.at(-1)?.querySelector('.tok--keyword')?.textContent).toBe('const'); + expect(container.textContent).toBe(text.repeat(2501)); + unmount(); + expect(observer.unobserve).toHaveBeenCalledTimes(2501); + expect(observer.disconnect).toHaveBeenCalledOnce(); + + // A late delivery from a disconnected observer must not update retired cells. + act(() => observer.emit(targets, true)); + }); + + it.each([false, true])('does not rewrite a multi-cell selection when visibility becomes %s', (visible) => { + const { container } = render( +
    {renderCell(text, [], tokens, true)}{renderCell(text, [], tokens, true)}
    , + ); + const observer = observers[0]; + const targets = observer.observe.mock.calls.map(([target]) => target); + act(() => observer.emit(targets, !visible)); + const range = document.createRange(); + range.setStart(targets[0], 0); + range.setEnd(targets[1], targets[1].childNodes.length); + const selection = document.getSelection()!; + selection.addRange(range); + expect(selection.toString()).toBe(text.repeat(2)); + + act(() => observer.emit(targets, visible)); + expect(selection.toString()).toBe(text.repeat(2)); + expect(container.querySelectorAll('.tok')).toHaveLength(visible ? 0 : 2); + act(() => { + selection.removeAllRanges(); + document.dispatchEvent(new Event('selectionchange')); + }); + expect(container.querySelectorAll('.tok')).toHaveLength(visible ? 2 : 0); + }); + + it('keeps eager cells and cells without tokens out of the observer', () => { + const { container } = render( +
    {renderCell(text, [], tokens)}{renderCell(text, marks, [], true)}
    , + ); + expect(container.querySelectorAll('.tok')).toHaveLength(1); + expect(observers).toHaveLength(0); + }); + + it('renders tokens eagerly when IntersectionObserver is unavailable', () => { + vi.stubGlobal('IntersectionObserver', undefined); + const { container } = render(
    {renderCell(text, [], tokens, true)}
    ); + expect(container.querySelector('.tok--keyword')?.textContent).toBe('const'); + }); +}); diff --git a/samples/CodeFlow/src/components/DiffViewer/__tests__/DescriptionView.test.tsx b/samples/CodeFlow/src/components/DiffViewer/__tests__/DescriptionView.test.tsx new file mode 100644 index 0000000..fbb51fe --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/__tests__/DescriptionView.test.tsx @@ -0,0 +1,133 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent } from '@testing-library/react'; +import { DescriptionView } from '../DescriptionView'; +import type { CommentThread } from '../../../types'; + +// The real thread view pulls in the markdown editor and the CodeFlow context; +// stub it so this test focuses on DescriptionView's collapse wiring. The +// collapsed pill (CollapsedThread) is deliberately left un-mocked. +vi.mock('../../CommentThread/CommentThread', () => ({ + CommentThreadView: ({ + thread, + onCollapse, + }: { + thread: CommentThread; + onCollapse?: () => void; + }) => ( +
    + +
    + ), + NewCommentComposer: () =>
    , +})); + +const ctx = { + pr: { title: 'Some PR', body: 'body text', coordinates: { owner: 'o', name: 'r', number: 1 } }, + comparison: { files: [{ filename: 'src/app.ts' }] }, + threads: [] as CommentThread[], + actions: { addIssueComment: vi.fn(async () => {}) }, +}; + +vi.mock('../../../state/useCodeFlow', () => ({ + useCodeFlow: () => ctx, +})); + +function makeThread(overrides: Partial = {}): CommentThread { + return { + id: 't1', + prKey: 'o/r#1', + filename: '', + side: 'right', + line: 0, + status: 'active', + isIssueComment: true, + comments: [ + { id: 'c1', body: 'top level note', author: { login: 'alice' }, createdAt: '2026-01-01T00:00:00Z' }, + ], + createdAt: '2026-01-01T00:00:00Z', + updatedAt: '2026-01-01T00:00:00Z', + ...overrides, + }; +} + +describe('DescriptionView body', () => { + beforeEach(() => { + ctx.threads = []; + }); + + it('renders the description as markdown rather than plain text', () => { + ctx.pr.body = '## Heading\n\nSome **bold** text and a [link](https://example.com).'; + const { container } = render(); + + const body = container.querySelector('.description__text.markdown-body'); + expect(body).toBeTruthy(); + expect(container.querySelector('pre.description__text')).toBeNull(); + expect(body?.querySelector('h2')?.textContent).toBe('Heading'); + expect(body?.querySelector('strong')?.textContent).toBe('bold'); + expect(body?.querySelector('a')?.getAttribute('href')).toBe('https://example.com'); + }); + + it('renders GitHub-flavored markdown such as task lists', () => { + ctx.pr.body = '- [x] done\n- [ ] todo'; + const { container } = render(); + + expect(container.querySelectorAll('input[type="checkbox"]')).toHaveLength(2); + }); + + it('shows the empty state when there is no description', () => { + ctx.pr.body = ''; + render(); + + expect(screen.getByText('No description provided.')).toBeTruthy(); + }); +}); + +describe('DescriptionView conversations', () => { + beforeEach(() => { + ctx.pr.body = 'body text'; + }); + + it('renders description threads expanded by default', () => { + ctx.threads = [makeThread()]; + render(); + expect(screen.getByTestId('expanded-t1')).toBeTruthy(); + expect(screen.queryByTitle('Expand thread')).toBeNull(); + }); + + it('wires up a collapse handler on the thread header', () => { + ctx.threads = [makeThread()]; + render(); + expect((screen.getByText('head-t1') as HTMLButtonElement).disabled).toBe(false); + }); + + it('collapses a description thread to a summary pill and expands it again', () => { + ctx.threads = [makeThread()]; + render(); + + fireEvent.click(screen.getByText('head-t1')); + + expect(screen.queryByTestId('expanded-t1')).toBeNull(); + const pill = screen.getByTitle('Expand thread'); + expect(pill.getAttribute('data-thread-id')).toBe('t1'); + expect(pill.textContent).toContain('top level note'); + expect(pill.textContent).toContain('Active'); + + fireEvent.click(pill); + + expect(screen.getByTestId('expanded-t1')).toBeTruthy(); + expect(screen.queryByTitle('Expand thread')).toBeNull(); + }); + + it('collapses each conversation independently', () => { + ctx.threads = [makeThread(), makeThread({ id: 't2' })]; + render(); + + fireEvent.click(screen.getByText('head-t1')); + + expect(screen.queryByTestId('expanded-t1')).toBeNull(); + expect(screen.getByTestId('expanded-t2')).toBeTruthy(); + expect(screen.getAllByTitle('Expand thread')).toHaveLength(1); + }); +}); diff --git a/samples/CodeFlow/src/components/DiffViewer/__tests__/DiffBlockNav.test.tsx b/samples/CodeFlow/src/components/DiffViewer/__tests__/DiffBlockNav.test.tsx new file mode 100644 index 0000000..431ed26 --- /dev/null +++ b/samples/CodeFlow/src/components/DiffViewer/__tests__/DiffBlockNav.test.tsx @@ -0,0 +1,48 @@ +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import { DiffBlockNav } from '../DiffBlockNav'; +import type { DiffBlockNav as Nav } from '../useDiffBlockNav'; + +function makeNav(overrides: Partial