@gokulvenkatareddy/cortex 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1295 -0
- package/apps/octogent/.github/workflows/ci.yml +40 -0
- package/apps/octogent/.shims/claude +4 -0
- package/apps/octogent/AGENTS.md +71 -0
- package/apps/octogent/CONTRIBUTING.md +72 -0
- package/apps/octogent/LICENSE +21 -0
- package/apps/octogent/README.md +184 -0
- package/apps/octogent/apps/api/AGENTS.md +32 -0
- package/apps/octogent/apps/api/package.json +19 -0
- package/apps/octogent/apps/api/src/agentStateDetection.ts +181 -0
- package/apps/octogent/apps/api/src/claudeSessionScanner.ts +235 -0
- package/apps/octogent/apps/api/src/claudeSkills.ts +182 -0
- package/apps/octogent/apps/api/src/claudeUsage.ts +922 -0
- package/apps/octogent/apps/api/src/cli.ts +595 -0
- package/apps/octogent/apps/api/src/codeIntelStore.ts +46 -0
- package/apps/octogent/apps/api/src/codexUsage.ts +278 -0
- package/apps/octogent/apps/api/src/createApiServer/codeIntelRoutes.ts +60 -0
- package/apps/octogent/apps/api/src/createApiServer/conversationRoutes.ts +128 -0
- package/apps/octogent/apps/api/src/createApiServer/deckRoutes.ts +873 -0
- package/apps/octogent/apps/api/src/createApiServer/gitParsers.ts +140 -0
- package/apps/octogent/apps/api/src/createApiServer/gitRoutes.ts +214 -0
- package/apps/octogent/apps/api/src/createApiServer/miscRoutes.ts +316 -0
- package/apps/octogent/apps/api/src/createApiServer/monitorParsers.ts +137 -0
- package/apps/octogent/apps/api/src/createApiServer/monitorRoutes.ts +95 -0
- package/apps/octogent/apps/api/src/createApiServer/requestHandler.ts +311 -0
- package/apps/octogent/apps/api/src/createApiServer/requestParsers.ts +25 -0
- package/apps/octogent/apps/api/src/createApiServer/routeHelpers.ts +97 -0
- package/apps/octogent/apps/api/src/createApiServer/security.ts +70 -0
- package/apps/octogent/apps/api/src/createApiServer/terminalParsers.ts +167 -0
- package/apps/octogent/apps/api/src/createApiServer/terminalRoutes.ts +315 -0
- package/apps/octogent/apps/api/src/createApiServer/types.ts +24 -0
- package/apps/octogent/apps/api/src/createApiServer/uiStateParsers.ts +255 -0
- package/apps/octogent/apps/api/src/createApiServer/upgradeHandler.ts +38 -0
- package/apps/octogent/apps/api/src/createApiServer/usageRoutes.ts +84 -0
- package/apps/octogent/apps/api/src/createApiServer.ts +176 -0
- package/apps/octogent/apps/api/src/deck/readDeckTentacles.ts +595 -0
- package/apps/octogent/apps/api/src/githubRepoSummary.ts +397 -0
- package/apps/octogent/apps/api/src/logging.ts +9 -0
- package/apps/octogent/apps/api/src/monitor/defaults.ts +3 -0
- package/apps/octogent/apps/api/src/monitor/index.ts +8 -0
- package/apps/octogent/apps/api/src/monitor/repository.ts +303 -0
- package/apps/octogent/apps/api/src/monitor/service.ts +349 -0
- package/apps/octogent/apps/api/src/monitor/types.ts +120 -0
- package/apps/octogent/apps/api/src/monitor/xProvider.ts +587 -0
- package/apps/octogent/apps/api/src/projectPersistence.ts +377 -0
- package/apps/octogent/apps/api/src/prompts/index.ts +10 -0
- package/apps/octogent/apps/api/src/prompts/promptResolver.ts +145 -0
- package/apps/octogent/apps/api/src/runtimeMetadata.ts +69 -0
- package/apps/octogent/apps/api/src/server.ts +80 -0
- package/apps/octogent/apps/api/src/setupState.ts +80 -0
- package/apps/octogent/apps/api/src/setupStatus.ts +174 -0
- package/apps/octogent/apps/api/src/startupPrerequisites.ts +146 -0
- package/apps/octogent/apps/api/src/terminalRuntime/channelMessaging.ts +87 -0
- package/apps/octogent/apps/api/src/terminalRuntime/claudeTranscript.ts +279 -0
- package/apps/octogent/apps/api/src/terminalRuntime/constants.ts +15 -0
- package/apps/octogent/apps/api/src/terminalRuntime/conversations.ts +492 -0
- package/apps/octogent/apps/api/src/terminalRuntime/gitOperations.ts +341 -0
- package/apps/octogent/apps/api/src/terminalRuntime/hookProcessor.ts +405 -0
- package/apps/octogent/apps/api/src/terminalRuntime/protocol.ts +46 -0
- package/apps/octogent/apps/api/src/terminalRuntime/ptyEnvironment.ts +50 -0
- package/apps/octogent/apps/api/src/terminalRuntime/registry.ts +423 -0
- package/apps/octogent/apps/api/src/terminalRuntime/sessionRuntime.ts +671 -0
- package/apps/octogent/apps/api/src/terminalRuntime/systemClients.ts +432 -0
- package/apps/octogent/apps/api/src/terminalRuntime/types.ts +157 -0
- package/apps/octogent/apps/api/src/terminalRuntime/worktreeManager.ts +135 -0
- package/apps/octogent/apps/api/src/terminalRuntime.ts +567 -0
- package/apps/octogent/apps/api/src/usageUtils.ts +16 -0
- package/apps/octogent/apps/api/src/ws-shim.d.ts +28 -0
- package/apps/octogent/apps/api/tests/agentStateDetection.test.ts +67 -0
- package/apps/octogent/apps/api/tests/claudeUsage.test.ts +583 -0
- package/apps/octogent/apps/api/tests/codexUsage.test.ts +107 -0
- package/apps/octogent/apps/api/tests/createApiServer.test.ts +3207 -0
- package/apps/octogent/apps/api/tests/githubRepoSummary.test.ts +100 -0
- package/apps/octogent/apps/api/tests/logging.test.ts +33 -0
- package/apps/octogent/apps/api/tests/monitorApi.test.ts +467 -0
- package/apps/octogent/apps/api/tests/monitorCore.test.ts +104 -0
- package/apps/octogent/apps/api/tests/promptResolver.test.ts +109 -0
- package/apps/octogent/apps/api/tests/protocol.test.ts +14 -0
- package/apps/octogent/apps/api/tests/sessionRuntime.test.ts +608 -0
- package/apps/octogent/apps/api/tests/startupPrerequisites.test.ts +70 -0
- package/apps/octogent/apps/api/tests/upgradeHandler.test.ts +40 -0
- package/apps/octogent/apps/api/tests/xMonitorProvider.test.ts +109 -0
- package/apps/octogent/apps/api/tsconfig.json +7 -0
- package/apps/octogent/apps/api/vitest.config.ts +7 -0
- package/apps/octogent/apps/web/AGENTS.md +38 -0
- package/apps/octogent/apps/web/index.html +13 -0
- package/apps/octogent/apps/web/package.json +32 -0
- package/apps/octogent/apps/web/public/octopus-favicon.svg +26 -0
- package/apps/octogent/apps/web/src/App.tsx +646 -0
- package/apps/octogent/apps/web/src/app/canvas/types.ts +34 -0
- package/apps/octogent/apps/web/src/app/codeIntelAggregation.ts +278 -0
- package/apps/octogent/apps/web/src/app/constants.ts +28 -0
- package/apps/octogent/apps/web/src/app/conversationNormalizers.ts +135 -0
- package/apps/octogent/apps/web/src/app/formatTimestamp.ts +18 -0
- package/apps/octogent/apps/web/src/app/githubMetrics.ts +76 -0
- package/apps/octogent/apps/web/src/app/githubNormalizers.ts +91 -0
- package/apps/octogent/apps/web/src/app/hooks/useAgentRuntimeStates.ts +18 -0
- package/apps/octogent/apps/web/src/app/hooks/useBackendLivenessPolling.ts +53 -0
- package/apps/octogent/apps/web/src/app/hooks/useCanvasGraphData.ts +449 -0
- package/apps/octogent/apps/web/src/app/hooks/useCanvasTransform.ts +260 -0
- package/apps/octogent/apps/web/src/app/hooks/useClaudeUsagePolling.ts +40 -0
- package/apps/octogent/apps/web/src/app/hooks/useClickOutside.ts +30 -0
- package/apps/octogent/apps/web/src/app/hooks/useCodeIntelRuntime.ts +83 -0
- package/apps/octogent/apps/web/src/app/hooks/useCodexUsagePolling.ts +35 -0
- package/apps/octogent/apps/web/src/app/hooks/useConsoleKeyboardShortcuts.ts +31 -0
- package/apps/octogent/apps/web/src/app/hooks/useConversationsRuntime.ts +377 -0
- package/apps/octogent/apps/web/src/app/hooks/useForceSimulation.ts +319 -0
- package/apps/octogent/apps/web/src/app/hooks/useGitHubPrimaryViewModel.ts +143 -0
- package/apps/octogent/apps/web/src/app/hooks/useGithubSummaryPolling.ts +28 -0
- package/apps/octogent/apps/web/src/app/hooks/useInitialColumnsHydration.ts +64 -0
- package/apps/octogent/apps/web/src/app/hooks/useMonitorRuntime.ts +220 -0
- package/apps/octogent/apps/web/src/app/hooks/usePersistedUiState.ts +536 -0
- package/apps/octogent/apps/web/src/app/hooks/usePollingData.ts +79 -0
- package/apps/octogent/apps/web/src/app/hooks/usePromptLibrary.ts +185 -0
- package/apps/octogent/apps/web/src/app/hooks/useTentacleGitLifecycle.ts +530 -0
- package/apps/octogent/apps/web/src/app/hooks/useTerminalCompletionNotification.ts +94 -0
- package/apps/octogent/apps/web/src/app/hooks/useTerminalMutations.ts +266 -0
- package/apps/octogent/apps/web/src/app/hooks/useTerminalStateReconciliation.ts +23 -0
- package/apps/octogent/apps/web/src/app/hooks/useUsageHeatmapPolling.ts +43 -0
- package/apps/octogent/apps/web/src/app/hooks/useWorkspaceSetup.ts +80 -0
- package/apps/octogent/apps/web/src/app/hotkeys.ts +31 -0
- package/apps/octogent/apps/web/src/app/monitorNormalizers.ts +145 -0
- package/apps/octogent/apps/web/src/app/notificationSounds.ts +164 -0
- package/apps/octogent/apps/web/src/app/terminalRuntimeStateStore.ts +261 -0
- package/apps/octogent/apps/web/src/app/terminalState.ts +21 -0
- package/apps/octogent/apps/web/src/app/types.ts +42 -0
- package/apps/octogent/apps/web/src/app/uiStateNormalizers.ts +113 -0
- package/apps/octogent/apps/web/src/app/usageNormalizers.ts +58 -0
- package/apps/octogent/apps/web/src/components/ActiveAgentsSidebar.tsx +60 -0
- package/apps/octogent/apps/web/src/components/ActivityPrimaryView.tsx +21 -0
- package/apps/octogent/apps/web/src/components/AgentStateBadge.tsx +47 -0
- package/apps/octogent/apps/web/src/components/CanvasPrimaryView.tsx +1532 -0
- package/apps/octogent/apps/web/src/components/ClearAllConversationsDialog.tsx +33 -0
- package/apps/octogent/apps/web/src/components/CodeIntelArcDiagram.tsx +245 -0
- package/apps/octogent/apps/web/src/components/CodeIntelPrimaryView.tsx +104 -0
- package/apps/octogent/apps/web/src/components/CodeIntelTreemap.tsx +138 -0
- package/apps/octogent/apps/web/src/components/ConsolePrimaryNav.tsx +31 -0
- package/apps/octogent/apps/web/src/components/ConversationsPrimaryView.tsx +243 -0
- package/apps/octogent/apps/web/src/components/DeckPrimaryView.tsx +613 -0
- package/apps/octogent/apps/web/src/components/DeleteTentacleDialog.tsx +91 -0
- package/apps/octogent/apps/web/src/components/EmptyOctopus.tsx +715 -0
- package/apps/octogent/apps/web/src/components/GitHubPrimaryView.tsx +494 -0
- package/apps/octogent/apps/web/src/components/MonitorPrimaryView.tsx +475 -0
- package/apps/octogent/apps/web/src/components/PrimaryViewRouter.tsx +99 -0
- package/apps/octogent/apps/web/src/components/PromptsPrimaryView.tsx +243 -0
- package/apps/octogent/apps/web/src/components/RuntimeStatusStrip.tsx +273 -0
- package/apps/octogent/apps/web/src/components/SettingsPrimaryView.tsx +92 -0
- package/apps/octogent/apps/web/src/components/SidebarActionPanel.tsx +124 -0
- package/apps/octogent/apps/web/src/components/SidebarConversationsList.tsx +279 -0
- package/apps/octogent/apps/web/src/components/SidebarPromptsList.tsx +116 -0
- package/apps/octogent/apps/web/src/components/TelemetryTape.tsx +106 -0
- package/apps/octogent/apps/web/src/components/TentacleGitActionsDialog.tsx +341 -0
- package/apps/octogent/apps/web/src/components/Terminal.tsx +524 -0
- package/apps/octogent/apps/web/src/components/TerminalPromptPicker.tsx +140 -0
- package/apps/octogent/apps/web/src/components/UsageHeatmap.tsx +702 -0
- package/apps/octogent/apps/web/src/components/canvas/CanvasTentaclePanel.tsx +485 -0
- package/apps/octogent/apps/web/src/components/canvas/CanvasTerminalColumn.tsx +89 -0
- package/apps/octogent/apps/web/src/components/canvas/DeleteAllTerminalsDialog.tsx +221 -0
- package/apps/octogent/apps/web/src/components/canvas/OctopusNode.tsx +307 -0
- package/apps/octogent/apps/web/src/components/canvas/SessionNode.tsx +185 -0
- package/apps/octogent/apps/web/src/components/deck/ActionCards.tsx +118 -0
- package/apps/octogent/apps/web/src/components/deck/AddTentacleForm.tsx +269 -0
- package/apps/octogent/apps/web/src/components/deck/DeckBottomActions.tsx +56 -0
- package/apps/octogent/apps/web/src/components/deck/TentaclePod.tsx +334 -0
- package/apps/octogent/apps/web/src/components/deck/WorkspaceSetupCard.tsx +105 -0
- package/apps/octogent/apps/web/src/components/deck/octopusVisuals.ts +72 -0
- package/apps/octogent/apps/web/src/components/terminalReplay.ts +62 -0
- package/apps/octogent/apps/web/src/components/terminalWheel.ts +54 -0
- package/apps/octogent/apps/web/src/components/ui/ActionButton.tsx +34 -0
- package/apps/octogent/apps/web/src/components/ui/ConfirmationDialog.tsx +86 -0
- package/apps/octogent/apps/web/src/components/ui/MarkdownContent.tsx +43 -0
- package/apps/octogent/apps/web/src/components/ui/SettingsToggle.tsx +34 -0
- package/apps/octogent/apps/web/src/components/ui/StatusBadge.tsx +24 -0
- package/apps/octogent/apps/web/src/main.tsx +17 -0
- package/apps/octogent/apps/web/src/runtime/HttpTerminalSnapshotReader.ts +87 -0
- package/apps/octogent/apps/web/src/runtime/runtimeEndpoints.ts +412 -0
- package/apps/octogent/apps/web/src/styles/chrome-and-buttons.css +272 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-activity.css +358 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-canvas.css +1843 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-code-intel.css +227 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-conversations.css +705 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-deck.css +1524 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-github.css +541 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-monitor.css +595 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-pixpack.css +81 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-prompts.css +474 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-settings.css +207 -0
- package/apps/octogent/apps/web/src/styles/console-chrome-status-nav.css +441 -0
- package/apps/octogent/apps/web/src/styles/console-overrides-telemetry.css +320 -0
- package/apps/octogent/apps/web/src/styles/console-theme-tokens.css +25 -0
- package/apps/octogent/apps/web/src/styles/cortex-theme.css +412 -0
- package/apps/octogent/apps/web/src/styles/foundation.css +100 -0
- package/apps/octogent/apps/web/src/styles/sidebar-and-scrollbars.css +447 -0
- package/apps/octogent/apps/web/src/styles/terminal-and-status.css +356 -0
- package/apps/octogent/apps/web/src/styles.css +25 -0
- package/apps/octogent/apps/web/src/types/ws.d.ts +23 -0
- package/apps/octogent/apps/web/tests/CanvasPrimaryView.test.tsx +347 -0
- package/apps/octogent/apps/web/tests/HttpTerminalSnapshotReader.test.tsx +54 -0
- package/apps/octogent/apps/web/tests/RuntimeStatusStrip.test.tsx +70 -0
- package/apps/octogent/apps/web/tests/Terminal.test.tsx +87 -0
- package/apps/octogent/apps/web/tests/add-tentacle-form.test.tsx +48 -0
- package/apps/octogent/apps/web/tests/app-github-runtime.test.tsx +162 -0
- package/apps/octogent/apps/web/tests/app-monitor-runtime.test.tsx +657 -0
- package/apps/octogent/apps/web/tests/app-shell-navigation.test.tsx +109 -0
- package/apps/octogent/apps/web/tests/app-swarm-refresh.test.tsx +268 -0
- package/apps/octogent/apps/web/tests/app-ui-state-persistence.test.tsx +116 -0
- package/apps/octogent/apps/web/tests/app-workspace-setup.test.tsx +217 -0
- package/apps/octogent/apps/web/tests/canvas-tentacle-panel.test.tsx +195 -0
- package/apps/octogent/apps/web/tests/delete-all-terminals-dialog.test.tsx +76 -0
- package/apps/octogent/apps/web/tests/githubMetrics.test.tsx +52 -0
- package/apps/octogent/apps/web/tests/hotkeys.test.tsx +44 -0
- package/apps/octogent/apps/web/tests/runtimeEndpoints.test.tsx +240 -0
- package/apps/octogent/apps/web/tests/setup.ts +39 -0
- package/apps/octogent/apps/web/tests/tentacle-pod.test.tsx +62 -0
- package/apps/octogent/apps/web/tests/terminalReplay.test.ts +71 -0
- package/apps/octogent/apps/web/tests/terminalState.test.tsx +49 -0
- package/apps/octogent/apps/web/tests/terminalWheel.test.tsx +51 -0
- package/apps/octogent/apps/web/tests/test-utils/appTestHarness.ts +48 -0
- package/apps/octogent/apps/web/tests/uiPrimitives.test.tsx +31 -0
- package/apps/octogent/apps/web/tests/useAgentRuntimeStates.test.tsx +47 -0
- package/apps/octogent/apps/web/tsconfig.json +8 -0
- package/apps/octogent/apps/web/vite.api.bundle.config.mts +32 -0
- package/apps/octogent/apps/web/vite.config.ts +22 -0
- package/apps/octogent/bin/octogent +3 -0
- package/apps/octogent/biome.json +21 -0
- package/apps/octogent/docs/concepts/mental-model.md +79 -0
- package/apps/octogent/docs/concepts/runtime-and-api.md +60 -0
- package/apps/octogent/docs/concepts/tentacles.md +85 -0
- package/apps/octogent/docs/getting-started/installation.md +54 -0
- package/apps/octogent/docs/getting-started/quickstart.md +79 -0
- package/apps/octogent/docs/guides/inter-agent-messaging.md +43 -0
- package/apps/octogent/docs/guides/orchestrating-child-agents.md +49 -0
- package/apps/octogent/docs/guides/working-with-todos.md +56 -0
- package/apps/octogent/docs/index.md +40 -0
- package/apps/octogent/docs/reference/api.md +103 -0
- package/apps/octogent/docs/reference/cli.md +71 -0
- package/apps/octogent/docs/reference/experimental-features.md +28 -0
- package/apps/octogent/docs/reference/filesystem-layout.md +62 -0
- package/apps/octogent/docs/reference/troubleshooting.md +49 -0
- package/apps/octogent/package.json +35 -0
- package/apps/octogent/packages/core/AGENTS.md +31 -0
- package/apps/octogent/packages/core/package.json +12 -0
- package/apps/octogent/packages/core/src/adapters/InMemoryTerminalSnapshotReader.ts +10 -0
- package/apps/octogent/packages/core/src/application/buildTerminalList.ts +13 -0
- package/apps/octogent/packages/core/src/domain/agentRuntime.ts +18 -0
- package/apps/octogent/packages/core/src/domain/channel.ts +8 -0
- package/apps/octogent/packages/core/src/domain/completionSound.ts +14 -0
- package/apps/octogent/packages/core/src/domain/conversation.ts +48 -0
- package/apps/octogent/packages/core/src/domain/deck.ts +33 -0
- package/apps/octogent/packages/core/src/domain/git.ts +32 -0
- package/apps/octogent/packages/core/src/domain/monitor.ts +62 -0
- package/apps/octogent/packages/core/src/domain/setup.ts +27 -0
- package/apps/octogent/packages/core/src/domain/terminal.ts +17 -0
- package/apps/octogent/packages/core/src/domain/uiState.ts +22 -0
- package/apps/octogent/packages/core/src/domain/usage.ts +60 -0
- package/apps/octogent/packages/core/src/index.ts +15 -0
- package/apps/octogent/packages/core/src/ports/TerminalSnapshotReader.ts +5 -0
- package/apps/octogent/packages/core/src/util/typeCoercion.ts +20 -0
- package/apps/octogent/packages/core/tests/buildTerminalList.test.ts +75 -0
- package/apps/octogent/packages/core/tsconfig.json +7 -0
- package/apps/octogent/packages/core/tsconfig.tsbuildinfo +1 -0
- package/apps/octogent/packages/core/vitest.config.ts +7 -0
- package/apps/octogent/pnpm-lock.yaml +3212 -0
- package/apps/octogent/pnpm-workspace.yaml +3 -0
- package/apps/octogent/prompts/meta-prompt-generator.md +223 -0
- package/apps/octogent/prompts/octoboss-clean-contexts.md +30 -0
- package/apps/octogent/prompts/octoboss-reorganize-tentacles.md +29 -0
- package/apps/octogent/prompts/octoboss-reorganize-todos.md +27 -0
- package/apps/octogent/prompts/sandbox-init.md +3 -0
- package/apps/octogent/prompts/swarm-parent.md +83 -0
- package/apps/octogent/prompts/swarm-worker.md +50 -0
- package/apps/octogent/prompts/tentacle-context-init.md +1 -0
- package/apps/octogent/prompts/tentacle-planner.md +110 -0
- package/apps/octogent/prompts/tentacle-reorganize-todos.md +20 -0
- package/apps/octogent/prompts/tentacle-update-tentacle.md +18 -0
- package/apps/octogent/scripts/build-package.mjs +23 -0
- package/apps/octogent/scripts/dev.mjs +158 -0
- package/apps/octogent/scripts/smoke-public-install.mjs +271 -0
- package/apps/octogent/static/images/octogent-header.png +0 -0
- package/apps/octogent/static/images/preview_1.jpg +0 -0
- package/apps/octogent/static/images/preview_2.jpg +0 -0
- package/apps/octogent/static/images/preview_3.jpg +0 -0
- package/apps/octogent/static/images/preview_4.jpg +0 -0
- package/apps/octogent/static/images/preview_5.jpg +0 -0
- package/apps/octogent/static/images/preview_6.jpg +0 -0
- package/apps/octogent/tsconfig.base.json +16 -0
- package/bin/AGI +3 -0
- package/bin/AGI-install-app +71 -0
- package/bin/AGI-ui +16 -0
- package/bin/AGI-voice +15 -0
- package/bin/AGI-web +16 -0
- package/bin/cortex +109 -0
- package/bin/cortex-octogent +99 -0
- package/bin/import-specifier.mjs +13 -0
- package/bin/import-specifier.test.mjs +13 -0
- package/bin/octo +150 -0
- package/dist/cli.mjs +555650 -0
- package/package.json +157 -0
- package/scripts/setup-wizard.ts +390 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { GITHUB_OVERVIEW_GRAPH_HEIGHT, GITHUB_OVERVIEW_GRAPH_WIDTH } from "../app/constants";
|
|
4
|
+
import { formatGitHubCommitHoverLabel } from "../app/githubMetrics";
|
|
5
|
+
import type { GitHubCommitSparkPoint, GitHubRecentCommit } from "../app/types";
|
|
6
|
+
import { ActionButton } from "./ui/ActionButton";
|
|
7
|
+
|
|
8
|
+
type GitHubPrimaryViewProps = {
|
|
9
|
+
githubRepoLabel: string;
|
|
10
|
+
githubStatusPill: string;
|
|
11
|
+
isRefreshingGitHubSummary: boolean;
|
|
12
|
+
onRefresh: () => void;
|
|
13
|
+
githubStarCountLabel: string;
|
|
14
|
+
githubOpenIssuesLabel: string;
|
|
15
|
+
githubOpenPrsLabel: string;
|
|
16
|
+
githubRecentCommits: GitHubRecentCommit[];
|
|
17
|
+
githubCommitCount30d: number;
|
|
18
|
+
githubOverviewHoverLabel: string;
|
|
19
|
+
githubOverviewGraphPolylinePoints: string;
|
|
20
|
+
githubOverviewGraphSeries: GitHubCommitSparkPoint[];
|
|
21
|
+
hoveredGitHubOverviewPointIndex: number | null;
|
|
22
|
+
onHoveredGitHubOverviewPointIndexChange: (index: number | null) => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const GITHUB_OVERVIEW_GRAPH_VIEWBOX_INSET = 8;
|
|
26
|
+
const GITHUB_RECENT_COMMITS_LIMIT = 50;
|
|
27
|
+
|
|
28
|
+
const formatSparkDate = (date: string): string => {
|
|
29
|
+
if (date.startsWith("n/a")) return "";
|
|
30
|
+
const d = new Date(`${date}T00:00:00`);
|
|
31
|
+
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const buildCommitYTicks = (series: GitHubCommitSparkPoint[]): { count: number; y: number }[] => {
|
|
35
|
+
if (series.length === 0) return [];
|
|
36
|
+
const counts = series.map((p) => p.count);
|
|
37
|
+
const maxCount = Math.max(...counts);
|
|
38
|
+
const minCount = Math.min(...counts);
|
|
39
|
+
const range = Math.max(1, maxCount - minCount);
|
|
40
|
+
const H = GITHUB_OVERVIEW_GRAPH_HEIGHT;
|
|
41
|
+
const tickCount = 4;
|
|
42
|
+
const ticks: { count: number; y: number }[] = [];
|
|
43
|
+
for (let i = 0; i <= tickCount; i++) {
|
|
44
|
+
const count = Math.round(minCount + range * (i / tickCount));
|
|
45
|
+
const y = H - ((count - minCount) / range) * H;
|
|
46
|
+
ticks.push({ count, y });
|
|
47
|
+
}
|
|
48
|
+
return ticks;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const buildAreaPolygonPoints = (series: GitHubCommitSparkPoint[]): string => {
|
|
52
|
+
if (series.length === 0) return "";
|
|
53
|
+
const H = GITHUB_OVERVIEW_GRAPH_HEIGHT;
|
|
54
|
+
const first = series[0];
|
|
55
|
+
const last = series[series.length - 1];
|
|
56
|
+
if (!first || !last) return "";
|
|
57
|
+
const linePoints = series.map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(" ");
|
|
58
|
+
return `${first.x.toFixed(1)},${H} ${linePoints} ${last.x.toFixed(1)},${H}`;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const formatRecentCommitTimestamp = (value: string) => {
|
|
62
|
+
const parsed = Date.parse(value);
|
|
63
|
+
if (!Number.isFinite(parsed)) {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return new Date(parsed).toLocaleString("en-US", {
|
|
68
|
+
month: "short",
|
|
69
|
+
day: "2-digit",
|
|
70
|
+
hour: "2-digit",
|
|
71
|
+
minute: "2-digit",
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const GitHubPrimaryView = ({
|
|
76
|
+
githubRepoLabel,
|
|
77
|
+
githubStatusPill,
|
|
78
|
+
isRefreshingGitHubSummary,
|
|
79
|
+
onRefresh,
|
|
80
|
+
githubStarCountLabel,
|
|
81
|
+
githubOpenIssuesLabel,
|
|
82
|
+
githubOpenPrsLabel,
|
|
83
|
+
githubRecentCommits,
|
|
84
|
+
githubCommitCount30d,
|
|
85
|
+
githubOverviewHoverLabel,
|
|
86
|
+
githubOverviewGraphPolylinePoints,
|
|
87
|
+
githubOverviewGraphSeries,
|
|
88
|
+
hoveredGitHubOverviewPointIndex,
|
|
89
|
+
onHoveredGitHubOverviewPointIndexChange,
|
|
90
|
+
}: GitHubPrimaryViewProps) => {
|
|
91
|
+
const [hoverCursorPosition, setHoverCursorPosition] = useState<{ x: number; y: number } | null>(
|
|
92
|
+
null,
|
|
93
|
+
);
|
|
94
|
+
const [pinnedCommitHash, setPinnedCommitHash] = useState<string | null>(null);
|
|
95
|
+
const [hoveredCommitHash, setHoveredCommitHash] = useState<string | null>(null);
|
|
96
|
+
const [commitTooltipY, setCommitTooltipY] = useState<number | null>(null);
|
|
97
|
+
const recentSectionRef = useRef<HTMLElement>(null);
|
|
98
|
+
const tooltipRef = useRef<HTMLDivElement>(null);
|
|
99
|
+
const activeCommitHash = pinnedCommitHash ?? hoveredCommitHash;
|
|
100
|
+
const activeCommit = activeCommitHash
|
|
101
|
+
? (githubRecentCommits.find((c) => c.hash === activeCommitHash) ?? null)
|
|
102
|
+
: null;
|
|
103
|
+
|
|
104
|
+
const dismissCommitTooltip = useCallback(() => {
|
|
105
|
+
setPinnedCommitHash(null);
|
|
106
|
+
setCommitTooltipY(null);
|
|
107
|
+
}, []);
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (pinnedCommitHash === null) return;
|
|
111
|
+
|
|
112
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
113
|
+
const target = event.target as Node;
|
|
114
|
+
if (recentSectionRef.current?.contains(target) || tooltipRef.current?.contains(target)) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
dismissCommitTooltip();
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
121
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
122
|
+
}, [pinnedCommitHash, dismissCommitTooltip]);
|
|
123
|
+
const yTicks = useMemo(
|
|
124
|
+
() => buildCommitYTicks(githubOverviewGraphSeries),
|
|
125
|
+
[githubOverviewGraphSeries],
|
|
126
|
+
);
|
|
127
|
+
const areaPolygonPoints = useMemo(
|
|
128
|
+
() => buildAreaPolygonPoints(githubOverviewGraphSeries),
|
|
129
|
+
[githubOverviewGraphSeries],
|
|
130
|
+
);
|
|
131
|
+
const xLabelStep = Math.max(1, Math.ceil(githubOverviewGraphSeries.length / 6));
|
|
132
|
+
|
|
133
|
+
const hoveredGitHubOverviewPoint =
|
|
134
|
+
hoveredGitHubOverviewPointIndex !== null
|
|
135
|
+
? (githubOverviewGraphSeries[hoveredGitHubOverviewPointIndex] ?? null)
|
|
136
|
+
: null;
|
|
137
|
+
const tooltipLabel = hoveredGitHubOverviewPoint
|
|
138
|
+
? formatGitHubCommitHoverLabel(hoveredGitHubOverviewPoint)
|
|
139
|
+
: null;
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<section className="github-view" aria-label="GitHub primary view">
|
|
143
|
+
<section className="github-overview" aria-label="GitHub overview">
|
|
144
|
+
<header className="github-overview-header">
|
|
145
|
+
<h2>{githubRepoLabel}</h2>
|
|
146
|
+
<div className="github-overview-header-actions">
|
|
147
|
+
<span className="console-status-pill">{githubStatusPill}</span>
|
|
148
|
+
<ActionButton
|
|
149
|
+
aria-label="Refresh GitHub overview data"
|
|
150
|
+
className="github-overview-refresh"
|
|
151
|
+
disabled={isRefreshingGitHubSummary}
|
|
152
|
+
onClick={onRefresh}
|
|
153
|
+
size="dense"
|
|
154
|
+
variant="accent"
|
|
155
|
+
>
|
|
156
|
+
{isRefreshingGitHubSummary ? "Refreshing..." : "Refresh"}
|
|
157
|
+
</ActionButton>
|
|
158
|
+
</div>
|
|
159
|
+
</header>
|
|
160
|
+
<div className="github-overview-content">
|
|
161
|
+
<section className="github-overview-main">
|
|
162
|
+
<section className="github-overview-graph" aria-label="GitHub commits graph">
|
|
163
|
+
<div className="github-overview-graph-meta">
|
|
164
|
+
<strong>Commits Per Day</strong>
|
|
165
|
+
<span>{githubOverviewHoverLabel}</span>
|
|
166
|
+
</div>
|
|
167
|
+
<div className="github-overview-graph-surface">
|
|
168
|
+
<svg
|
|
169
|
+
onMouseLeave={() => {
|
|
170
|
+
onHoveredGitHubOverviewPointIndexChange(null);
|
|
171
|
+
setHoverCursorPosition(null);
|
|
172
|
+
}}
|
|
173
|
+
onMouseMove={(event) => {
|
|
174
|
+
if (githubOverviewGraphSeries.length === 0) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
179
|
+
if (rect.width <= 0) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const clampedRatio = Math.min(
|
|
184
|
+
1,
|
|
185
|
+
Math.max(0, (event.clientX - rect.left) / rect.width),
|
|
186
|
+
);
|
|
187
|
+
const viewBox = event.currentTarget.viewBox.baseVal;
|
|
188
|
+
const pointerX = viewBox.x + viewBox.width * clampedRatio;
|
|
189
|
+
const pointerY = Math.max(0, event.clientY - rect.top);
|
|
190
|
+
|
|
191
|
+
let nearestPointIndex = 0;
|
|
192
|
+
let nearestDistance = Number.POSITIVE_INFINITY;
|
|
193
|
+
githubOverviewGraphSeries.forEach((point, index) => {
|
|
194
|
+
const distance = Math.abs(point.x - pointerX);
|
|
195
|
+
if (distance < nearestDistance) {
|
|
196
|
+
nearestDistance = distance;
|
|
197
|
+
nearestPointIndex = index;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
if (nearestPointIndex !== hoveredGitHubOverviewPointIndex) {
|
|
202
|
+
onHoveredGitHubOverviewPointIndexChange(nearestPointIndex);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
setHoverCursorPosition({
|
|
206
|
+
x: Math.max(0, Math.min(rect.width, event.clientX - rect.left)),
|
|
207
|
+
y: Math.max(0, Math.min(rect.height, pointerY)),
|
|
208
|
+
});
|
|
209
|
+
}}
|
|
210
|
+
viewBox={`${-GITHUB_OVERVIEW_GRAPH_VIEWBOX_INSET} ${-GITHUB_OVERVIEW_GRAPH_VIEWBOX_INSET} ${
|
|
211
|
+
GITHUB_OVERVIEW_GRAPH_WIDTH + GITHUB_OVERVIEW_GRAPH_VIEWBOX_INSET * 2
|
|
212
|
+
} ${GITHUB_OVERVIEW_GRAPH_HEIGHT + GITHUB_OVERVIEW_GRAPH_VIEWBOX_INSET * 2}`}
|
|
213
|
+
preserveAspectRatio="none"
|
|
214
|
+
role="presentation"
|
|
215
|
+
>
|
|
216
|
+
<defs>
|
|
217
|
+
<linearGradient id="commitAreaGrad" x1="0" y1="0" x2="0" y2="1">
|
|
218
|
+
<stop offset="0%" stopColor="var(--accent-primary)" stopOpacity="0.16" />
|
|
219
|
+
<stop offset="100%" stopColor="var(--accent-primary)" stopOpacity="0.01" />
|
|
220
|
+
</linearGradient>
|
|
221
|
+
<linearGradient id="commitLineGrad" x1="0" y1="0" x2="0" y2="1">
|
|
222
|
+
<stop offset="0%" stopColor="#fce8a8" />
|
|
223
|
+
<stop offset="60%" stopColor="#e8820a" />
|
|
224
|
+
<stop offset="100%" stopColor="#ff6a00" />
|
|
225
|
+
</linearGradient>
|
|
226
|
+
</defs>
|
|
227
|
+
|
|
228
|
+
{yTicks.map((tick, index) => (
|
|
229
|
+
<g key={`${tick.count}-${index}`}>
|
|
230
|
+
<line
|
|
231
|
+
x1={0}
|
|
232
|
+
y1={tick.y}
|
|
233
|
+
x2={GITHUB_OVERVIEW_GRAPH_WIDTH}
|
|
234
|
+
y2={tick.y}
|
|
235
|
+
className="github-overview-graph-grid"
|
|
236
|
+
/>
|
|
237
|
+
<text x={4} y={tick.y - 4} className="github-overview-graph-y-label">
|
|
238
|
+
{tick.count}
|
|
239
|
+
</text>
|
|
240
|
+
</g>
|
|
241
|
+
))}
|
|
242
|
+
|
|
243
|
+
{areaPolygonPoints && (
|
|
244
|
+
<polygon points={areaPolygonPoints} fill="url(#commitAreaGrad)" />
|
|
245
|
+
)}
|
|
246
|
+
|
|
247
|
+
<polyline
|
|
248
|
+
points={githubOverviewGraphPolylinePoints}
|
|
249
|
+
stroke="url(#commitLineGrad)"
|
|
250
|
+
/>
|
|
251
|
+
|
|
252
|
+
{githubOverviewGraphSeries
|
|
253
|
+
.filter((_, i) => i % xLabelStep === 0)
|
|
254
|
+
.map((point) => {
|
|
255
|
+
const label = formatSparkDate(point.date);
|
|
256
|
+
if (!label) return null;
|
|
257
|
+
return (
|
|
258
|
+
<text
|
|
259
|
+
key={`xl-${point.date}`}
|
|
260
|
+
x={point.x}
|
|
261
|
+
y={GITHUB_OVERVIEW_GRAPH_HEIGHT + GITHUB_OVERVIEW_GRAPH_VIEWBOX_INSET}
|
|
262
|
+
className="github-overview-graph-x-label"
|
|
263
|
+
>
|
|
264
|
+
{label}
|
|
265
|
+
</text>
|
|
266
|
+
);
|
|
267
|
+
})}
|
|
268
|
+
|
|
269
|
+
{githubOverviewGraphSeries.map((point, index) => (
|
|
270
|
+
<circle
|
|
271
|
+
aria-label={formatGitHubCommitHoverLabel(point)}
|
|
272
|
+
className={`github-overview-graph-point${
|
|
273
|
+
hoveredGitHubOverviewPointIndex === index ? " is-active" : ""
|
|
274
|
+
}`}
|
|
275
|
+
cx={point.x}
|
|
276
|
+
cy={point.y}
|
|
277
|
+
key={`${point.date}-${index}`}
|
|
278
|
+
onFocus={() => {
|
|
279
|
+
onHoveredGitHubOverviewPointIndexChange(index);
|
|
280
|
+
}}
|
|
281
|
+
onMouseEnter={() => {
|
|
282
|
+
onHoveredGitHubOverviewPointIndexChange(index);
|
|
283
|
+
}}
|
|
284
|
+
r={6}
|
|
285
|
+
tabIndex={0}
|
|
286
|
+
>
|
|
287
|
+
<title>{formatGitHubCommitHoverLabel(point)}</title>
|
|
288
|
+
</circle>
|
|
289
|
+
))}
|
|
290
|
+
</svg>
|
|
291
|
+
{hoverCursorPosition && tooltipLabel && (
|
|
292
|
+
<div
|
|
293
|
+
className="github-overview-graph-tooltip"
|
|
294
|
+
style={{
|
|
295
|
+
left: `${hoverCursorPosition.x}px`,
|
|
296
|
+
top: `${Math.max(8, hoverCursorPosition.y - 14)}px`,
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
{tooltipLabel}
|
|
300
|
+
</div>
|
|
301
|
+
)}
|
|
302
|
+
</div>
|
|
303
|
+
</section>
|
|
304
|
+
</section>
|
|
305
|
+
|
|
306
|
+
<aside className="github-overview-side" aria-label="GitHub recent activity">
|
|
307
|
+
<dl className="github-overview-stats" aria-label="Repository stats">
|
|
308
|
+
<div
|
|
309
|
+
aria-label={`Stars ${githubStarCountLabel}`}
|
|
310
|
+
className="github-overview-stat"
|
|
311
|
+
data-metric="st"
|
|
312
|
+
data-label="Stars"
|
|
313
|
+
title="Stars"
|
|
314
|
+
>
|
|
315
|
+
<dt>
|
|
316
|
+
<span aria-hidden="true" className="github-overview-stat-icon">
|
|
317
|
+
<svg aria-hidden="true" focusable="false" viewBox="0 0 16 16">
|
|
318
|
+
<path d="M8 1.5 9.9 5.5 14.3 6 11 9.1 11.9 13.5 8 11.3 4.1 13.5 5 9.1 1.7 6 6.1 5.5z" />
|
|
319
|
+
</svg>
|
|
320
|
+
</span>
|
|
321
|
+
</dt>
|
|
322
|
+
<dd>{githubStarCountLabel}</dd>
|
|
323
|
+
</div>
|
|
324
|
+
<div
|
|
325
|
+
aria-label={`Open issues ${githubOpenIssuesLabel}`}
|
|
326
|
+
className="github-overview-stat"
|
|
327
|
+
data-metric="is"
|
|
328
|
+
data-label="Open issues"
|
|
329
|
+
title="Open issues"
|
|
330
|
+
>
|
|
331
|
+
<dt>
|
|
332
|
+
<span aria-hidden="true" className="github-overview-stat-icon">
|
|
333
|
+
<svg aria-hidden="true" focusable="false" viewBox="0 0 16 16">
|
|
334
|
+
<path d="M8 2.2a5.8 5.8 0 1 0 0 11.6A5.8 5.8 0 0 0 8 2.2z" />
|
|
335
|
+
<path d="M8 5.1v3.6m0 2.2h.01" />
|
|
336
|
+
</svg>
|
|
337
|
+
</span>
|
|
338
|
+
</dt>
|
|
339
|
+
<dd>{githubOpenIssuesLabel}</dd>
|
|
340
|
+
</div>
|
|
341
|
+
<div
|
|
342
|
+
aria-label={`Open PRs ${githubOpenPrsLabel}`}
|
|
343
|
+
className="github-overview-stat"
|
|
344
|
+
data-metric="pr"
|
|
345
|
+
data-label="Open PRs"
|
|
346
|
+
title="Open PRs"
|
|
347
|
+
>
|
|
348
|
+
<dt>
|
|
349
|
+
<span aria-hidden="true" className="github-overview-stat-icon">
|
|
350
|
+
<svg aria-hidden="true" focusable="false" viewBox="0 0 16 16">
|
|
351
|
+
<path d="M5 2.5a2 2 0 1 0 0 4 2 2 0 0 0 0-4zM11 9.5a2 2 0 1 0 0 4 2 2 0 0 0 0-4zM5 6.5v7m0-3.5h4.2" />
|
|
352
|
+
</svg>
|
|
353
|
+
</span>
|
|
354
|
+
</dt>
|
|
355
|
+
<dd>{githubOpenPrsLabel}</dd>
|
|
356
|
+
</div>
|
|
357
|
+
<div
|
|
358
|
+
aria-label={`Commits in 30 days ${githubCommitCount30d}`}
|
|
359
|
+
className="github-overview-stat"
|
|
360
|
+
data-metric="30d"
|
|
361
|
+
data-label="Commits (30d)"
|
|
362
|
+
title="Commits (30d)"
|
|
363
|
+
>
|
|
364
|
+
<dt>
|
|
365
|
+
<span aria-hidden="true" className="github-overview-stat-icon">
|
|
366
|
+
<svg aria-hidden="true" focusable="false" viewBox="0 0 16 16">
|
|
367
|
+
<path d="M2 11.8h12M4 9.7l2.2-2.2 2 1.7L12 5.6" />
|
|
368
|
+
</svg>
|
|
369
|
+
</span>
|
|
370
|
+
</dt>
|
|
371
|
+
<dd>{githubCommitCount30d}</dd>
|
|
372
|
+
</div>
|
|
373
|
+
</dl>
|
|
374
|
+
<section
|
|
375
|
+
className="github-overview-recent"
|
|
376
|
+
aria-label="Recent commits"
|
|
377
|
+
ref={recentSectionRef}
|
|
378
|
+
>
|
|
379
|
+
<header className="github-overview-recent-header">
|
|
380
|
+
<h3>Recent commits</h3>
|
|
381
|
+
<span>{`Showing last ${GITHUB_RECENT_COMMITS_LIMIT}`}</span>
|
|
382
|
+
</header>
|
|
383
|
+
{githubRecentCommits.length > 0 ? (
|
|
384
|
+
<ol className="github-overview-recent-list">
|
|
385
|
+
{githubRecentCommits.map((commit) => (
|
|
386
|
+
<li key={commit.hash}>
|
|
387
|
+
<button
|
|
388
|
+
type="button"
|
|
389
|
+
className={`github-overview-recent-item${pinnedCommitHash === commit.hash ? " is-selected" : ""}`}
|
|
390
|
+
onMouseEnter={(event) => {
|
|
391
|
+
if (pinnedCommitHash) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
setHoveredCommitHash(commit.hash);
|
|
395
|
+
const sectionRect = recentSectionRef.current?.getBoundingClientRect();
|
|
396
|
+
if (sectionRect) {
|
|
397
|
+
const itemRect = event.currentTarget.getBoundingClientRect();
|
|
398
|
+
setCommitTooltipY(itemRect.top - sectionRect.top + itemRect.height / 2);
|
|
399
|
+
}
|
|
400
|
+
}}
|
|
401
|
+
onMouseLeave={() => {
|
|
402
|
+
if (pinnedCommitHash) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
setHoveredCommitHash(null);
|
|
406
|
+
setCommitTooltipY(null);
|
|
407
|
+
}}
|
|
408
|
+
onClick={(event) => {
|
|
409
|
+
if (pinnedCommitHash === commit.hash) {
|
|
410
|
+
dismissCommitTooltip();
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
setPinnedCommitHash(commit.hash);
|
|
414
|
+
const sectionRect = recentSectionRef.current?.getBoundingClientRect();
|
|
415
|
+
if (sectionRect) {
|
|
416
|
+
const itemRect = event.currentTarget.getBoundingClientRect();
|
|
417
|
+
setCommitTooltipY(itemRect.top - sectionRect.top + itemRect.height / 2);
|
|
418
|
+
}
|
|
419
|
+
}}
|
|
420
|
+
>
|
|
421
|
+
<span aria-hidden="true" className="github-overview-recent-node" />
|
|
422
|
+
<span className="github-overview-recent-sha">{commit.shortHash}</span>
|
|
423
|
+
<div className="github-overview-recent-copy">
|
|
424
|
+
<p className="github-overview-recent-subject">{commit.subject}</p>
|
|
425
|
+
<p className="github-overview-recent-meta">
|
|
426
|
+
<span>{commit.authorName}</span>
|
|
427
|
+
<span>{formatRecentCommitTimestamp(commit.authoredAt)}</span>
|
|
428
|
+
</p>
|
|
429
|
+
</div>
|
|
430
|
+
</button>
|
|
431
|
+
</li>
|
|
432
|
+
))}
|
|
433
|
+
</ol>
|
|
434
|
+
) : (
|
|
435
|
+
<p className="github-overview-recent-empty">Recent commit data is unavailable.</p>
|
|
436
|
+
)}
|
|
437
|
+
<div
|
|
438
|
+
ref={tooltipRef}
|
|
439
|
+
className={`github-overview-recent-tooltip${activeCommit ? " is-visible" : ""}`}
|
|
440
|
+
style={{
|
|
441
|
+
top: commitTooltipY !== null ? `${commitTooltipY}px` : undefined,
|
|
442
|
+
}}
|
|
443
|
+
>
|
|
444
|
+
{activeCommit && (
|
|
445
|
+
<>
|
|
446
|
+
<p className="github-overview-recent-tooltip-hash">
|
|
447
|
+
<span>{activeCommit.shortHash}</span>
|
|
448
|
+
<button
|
|
449
|
+
className="github-overview-recent-tooltip-copy"
|
|
450
|
+
type="button"
|
|
451
|
+
title="Copy full hash"
|
|
452
|
+
onClick={() => {
|
|
453
|
+
navigator.clipboard.writeText(activeCommit.hash);
|
|
454
|
+
}}
|
|
455
|
+
>
|
|
456
|
+
<svg viewBox="0 0 16 16" aria-hidden="true">
|
|
457
|
+
<rect x="5.5" y="5.5" width="8" height="8" rx="1.2" />
|
|
458
|
+
<path d="M10.5 5.5V3.7a1.2 1.2 0 0 0-1.2-1.2H3.7a1.2 1.2 0 0 0-1.2 1.2v5.6a1.2 1.2 0 0 0 1.2 1.2H5.5" />
|
|
459
|
+
</svg>
|
|
460
|
+
</button>
|
|
461
|
+
</p>
|
|
462
|
+
<p className="github-overview-recent-tooltip-author">
|
|
463
|
+
{activeCommit.authorName}
|
|
464
|
+
{activeCommit.authorEmail ? ` <${activeCommit.authorEmail}>` : ""}
|
|
465
|
+
</p>
|
|
466
|
+
<p className="github-overview-recent-tooltip-message">
|
|
467
|
+
{activeCommit.body
|
|
468
|
+
? `${activeCommit.subject}\n\n${activeCommit.body}`
|
|
469
|
+
: activeCommit.subject}
|
|
470
|
+
</p>
|
|
471
|
+
{activeCommit.filesChanged > 0 && (
|
|
472
|
+
<p className="github-overview-recent-tooltip-diff">
|
|
473
|
+
<span>
|
|
474
|
+
{activeCommit.filesChanged}{" "}
|
|
475
|
+
{activeCommit.filesChanged === 1 ? "file" : "files"}
|
|
476
|
+
</span>
|
|
477
|
+
<span className="github-overview-recent-tooltip-ins">
|
|
478
|
+
+{activeCommit.insertions}
|
|
479
|
+
</span>
|
|
480
|
+
<span className="github-overview-recent-tooltip-del">
|
|
481
|
+
-{activeCommit.deletions}
|
|
482
|
+
</span>
|
|
483
|
+
</p>
|
|
484
|
+
)}
|
|
485
|
+
</>
|
|
486
|
+
)}
|
|
487
|
+
</div>
|
|
488
|
+
</section>
|
|
489
|
+
</aside>
|
|
490
|
+
</div>
|
|
491
|
+
</section>
|
|
492
|
+
</section>
|
|
493
|
+
);
|
|
494
|
+
};
|