@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,33 @@
|
|
|
1
|
+
import { ConfirmationDialog } from "./ui/ConfirmationDialog";
|
|
2
|
+
|
|
3
|
+
type ClearAllConversationsDialogProps = {
|
|
4
|
+
sessionCount: number;
|
|
5
|
+
isClearing: boolean;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
onConfirm: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const ClearAllConversationsDialog = ({
|
|
11
|
+
sessionCount,
|
|
12
|
+
isClearing,
|
|
13
|
+
onCancel,
|
|
14
|
+
onConfirm,
|
|
15
|
+
}: ClearAllConversationsDialogProps) => (
|
|
16
|
+
<ConfirmationDialog
|
|
17
|
+
title="Clear All Conversations"
|
|
18
|
+
ariaLabel="Clear all conversations confirmation"
|
|
19
|
+
message={
|
|
20
|
+
<>
|
|
21
|
+
Delete all <strong>{sessionCount}</strong> conversation
|
|
22
|
+
{sessionCount === 1 ? "" : "s"} and their transcript data.
|
|
23
|
+
</>
|
|
24
|
+
}
|
|
25
|
+
warning="This action cannot be undone."
|
|
26
|
+
confirmLabel={isClearing ? "Clearing..." : "Clear All"}
|
|
27
|
+
isConfirmDisabled={isClearing}
|
|
28
|
+
isBusy={isClearing}
|
|
29
|
+
cancelAriaLabel="Cancel clear all"
|
|
30
|
+
onCancel={onCancel}
|
|
31
|
+
onConfirm={onConfirm}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import type { CouplingData } from "../app/codeIntelAggregation";
|
|
4
|
+
import { heatColor } from "../app/codeIntelAggregation";
|
|
5
|
+
|
|
6
|
+
type CodeIntelArcDiagramProps = {
|
|
7
|
+
data: CouplingData;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const ROW_HEIGHT = 22;
|
|
11
|
+
const LABEL_WIDTH = 100;
|
|
12
|
+
const PADDING_Y = 8;
|
|
13
|
+
const MAX_ARCS = 40;
|
|
14
|
+
|
|
15
|
+
const ACCENT = "#d4a017";
|
|
16
|
+
|
|
17
|
+
export const CodeIntelArcDiagram = ({ data }: CodeIntelArcDiagramProps) => {
|
|
18
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
19
|
+
const [size, setSize] = useState({ width: 300, height: 400 });
|
|
20
|
+
const [hoveredPair, setHoveredPair] = useState<string | null>(null);
|
|
21
|
+
const [hoveredFile, setHoveredFile] = useState<string | null>(null);
|
|
22
|
+
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
|
|
23
|
+
|
|
24
|
+
const measure = useCallback(() => {
|
|
25
|
+
if (containerRef.current) {
|
|
26
|
+
setSize({
|
|
27
|
+
width: containerRef.current.clientWidth,
|
|
28
|
+
height: containerRef.current.clientHeight,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
measure();
|
|
35
|
+
const observer = new ResizeObserver(measure);
|
|
36
|
+
if (containerRef.current) observer.observe(containerRef.current);
|
|
37
|
+
return () => observer.disconnect();
|
|
38
|
+
}, [measure]);
|
|
39
|
+
|
|
40
|
+
const files = useMemo(() => data.files, [data.files]);
|
|
41
|
+
const pairs = useMemo(() => data.pairs.slice(0, MAX_ARCS), [data.pairs]);
|
|
42
|
+
|
|
43
|
+
const fileIndexMap = useMemo(() => {
|
|
44
|
+
const map = new Map<string, number>();
|
|
45
|
+
for (let i = 0; i < files.length; i++) {
|
|
46
|
+
const file = files[i];
|
|
47
|
+
if (!file) continue;
|
|
48
|
+
map.set(file.file, i);
|
|
49
|
+
}
|
|
50
|
+
return map;
|
|
51
|
+
}, [files]);
|
|
52
|
+
|
|
53
|
+
const fileCouplingMap = useMemo(() => {
|
|
54
|
+
const map = new Map<string, { partner: string; coSessions: number }[]>();
|
|
55
|
+
for (const p of pairs) {
|
|
56
|
+
if (!map.has(p.fileA)) map.set(p.fileA, []);
|
|
57
|
+
if (!map.has(p.fileB)) map.set(p.fileB, []);
|
|
58
|
+
map.get(p.fileA)?.push({ partner: p.fileB, coSessions: p.coSessions });
|
|
59
|
+
map.get(p.fileB)?.push({ partner: p.fileA, coSessions: p.coSessions });
|
|
60
|
+
}
|
|
61
|
+
for (const entries of map.values()) {
|
|
62
|
+
entries.sort((a, b) => b.coSessions - a.coSessions);
|
|
63
|
+
}
|
|
64
|
+
return map;
|
|
65
|
+
}, [pairs]);
|
|
66
|
+
|
|
67
|
+
const dotX = LABEL_WIDTH;
|
|
68
|
+
const arcAreaWidth = size.width - LABEL_WIDTH - 8;
|
|
69
|
+
const minSvgHeight = PADDING_Y + files.length * ROW_HEIGHT + PADDING_Y;
|
|
70
|
+
const svgHeight = Math.max(minSvgHeight, size.height);
|
|
71
|
+
const dynamicRowHeight =
|
|
72
|
+
files.length > 0 ? (svgHeight - PADDING_Y * 2) / files.length : ROW_HEIGHT;
|
|
73
|
+
|
|
74
|
+
const maxCoSessions = useMemo(() => {
|
|
75
|
+
let max = 0;
|
|
76
|
+
for (const p of pairs) {
|
|
77
|
+
if (p.coSessions > max) max = p.coSessions;
|
|
78
|
+
}
|
|
79
|
+
return max;
|
|
80
|
+
}, [pairs]);
|
|
81
|
+
|
|
82
|
+
const fileY = (index: number) => PADDING_Y + index * dynamicRowHeight + dynamicRowHeight / 2;
|
|
83
|
+
|
|
84
|
+
const hoveredPairData = useMemo(() => {
|
|
85
|
+
if (!hoveredPair) return null;
|
|
86
|
+
return pairs.find((p) => pairKey(p.fileA, p.fileB) === hoveredPair) ?? null;
|
|
87
|
+
}, [hoveredPair, pairs]);
|
|
88
|
+
|
|
89
|
+
const handleMouseMove = useCallback((e: React.MouseEvent) => {
|
|
90
|
+
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
91
|
+
setMousePos({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div className="code-intel-arc-diagram" ref={containerRef} onMouseMove={handleMouseMove}>
|
|
96
|
+
<svg
|
|
97
|
+
className="code-intel-arc-svg"
|
|
98
|
+
width={size.width}
|
|
99
|
+
height={Math.max(svgHeight, size.height)}
|
|
100
|
+
viewBox={`0 0 ${size.width} ${Math.max(svgHeight, size.height)}`}
|
|
101
|
+
role="img"
|
|
102
|
+
aria-label="File coupling arc diagram"
|
|
103
|
+
>
|
|
104
|
+
{/* Arcs — curve to the right */}
|
|
105
|
+
{pairs.map((pair) => {
|
|
106
|
+
const idxA = fileIndexMap.get(pair.fileA);
|
|
107
|
+
const idxB = fileIndexMap.get(pair.fileB);
|
|
108
|
+
if (idxA === undefined || idxB === undefined) return null;
|
|
109
|
+
|
|
110
|
+
const y1 = fileY(idxA);
|
|
111
|
+
const y2 = fileY(idxB);
|
|
112
|
+
const span = Math.abs(idxB - idxA);
|
|
113
|
+
const curveX = dotX + Math.min(span * 16, arcAreaWidth);
|
|
114
|
+
const key = pairKey(pair.fileA, pair.fileB);
|
|
115
|
+
const isHovered =
|
|
116
|
+
hoveredPair === key || hoveredFile === pair.fileA || hoveredFile === pair.fileB;
|
|
117
|
+
|
|
118
|
+
const d = `M ${dotX} ${y1} C ${curveX} ${y1}, ${curveX} ${y2}, ${dotX} ${y2}`;
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<g key={key}>
|
|
122
|
+
<path
|
|
123
|
+
d={d}
|
|
124
|
+
fill="none"
|
|
125
|
+
stroke="transparent"
|
|
126
|
+
strokeWidth={12}
|
|
127
|
+
onMouseEnter={() => setHoveredPair(key)}
|
|
128
|
+
onMouseLeave={() => setHoveredPair(null)}
|
|
129
|
+
style={{ cursor: "crosshair" }}
|
|
130
|
+
/>
|
|
131
|
+
<path
|
|
132
|
+
d={d}
|
|
133
|
+
fill="none"
|
|
134
|
+
stroke={heatColor(pair.coSessions, maxCoSessions)}
|
|
135
|
+
strokeWidth={isHovered ? 1.5 : 0.75}
|
|
136
|
+
strokeOpacity={isHovered ? 1 : 0.4}
|
|
137
|
+
className="code-intel-arc-path"
|
|
138
|
+
pointerEvents="none"
|
|
139
|
+
/>
|
|
140
|
+
</g>
|
|
141
|
+
);
|
|
142
|
+
})}
|
|
143
|
+
|
|
144
|
+
{/* File dots and labels — vertical list on the left */}
|
|
145
|
+
{files.map((f, i) => {
|
|
146
|
+
const y = fileY(i);
|
|
147
|
+
const isHighlighted =
|
|
148
|
+
hoveredFile === f.file ||
|
|
149
|
+
(hoveredPair !== null &&
|
|
150
|
+
pairs.some(
|
|
151
|
+
(p) =>
|
|
152
|
+
pairKey(p.fileA, p.fileB) === hoveredPair &&
|
|
153
|
+
(p.fileA === f.file || p.fileB === f.file),
|
|
154
|
+
));
|
|
155
|
+
|
|
156
|
+
const shortName = f.file.split("/").pop() ?? f.file;
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<g
|
|
160
|
+
key={f.file}
|
|
161
|
+
onMouseEnter={() => setHoveredFile(f.file)}
|
|
162
|
+
onMouseLeave={() => setHoveredFile(null)}
|
|
163
|
+
className="code-intel-arc-file-group"
|
|
164
|
+
>
|
|
165
|
+
<circle
|
|
166
|
+
cx={dotX}
|
|
167
|
+
cy={y}
|
|
168
|
+
r={3.5}
|
|
169
|
+
fill={ACCENT}
|
|
170
|
+
fillOpacity={isHighlighted ? 1 : 0.7}
|
|
171
|
+
stroke={isHighlighted ? "#fff" : "none"}
|
|
172
|
+
strokeWidth={isHighlighted ? 1.5 : 0}
|
|
173
|
+
/>
|
|
174
|
+
<text
|
|
175
|
+
x={dotX - 8}
|
|
176
|
+
y={y + 3.5}
|
|
177
|
+
textAnchor="end"
|
|
178
|
+
className={`code-intel-arc-label${isHighlighted ? " code-intel-arc-label--active" : ""}`}
|
|
179
|
+
>
|
|
180
|
+
{truncateLabel(shortName, LABEL_WIDTH - 12)}
|
|
181
|
+
</text>
|
|
182
|
+
</g>
|
|
183
|
+
);
|
|
184
|
+
})}
|
|
185
|
+
</svg>
|
|
186
|
+
|
|
187
|
+
{/* Edge hover tooltip */}
|
|
188
|
+
{hoveredPairData && !hoveredFile && (
|
|
189
|
+
<div
|
|
190
|
+
className="code-intel-tooltip"
|
|
191
|
+
style={{
|
|
192
|
+
left: Math.min(mousePos.x + 12, size.width - 200),
|
|
193
|
+
top: Math.max(mousePos.y - 40, 4),
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<div className="code-intel-tooltip-path">
|
|
197
|
+
{shortFileName(hoveredPairData.fileA)} ↔ {shortFileName(hoveredPairData.fileB)}
|
|
198
|
+
</div>
|
|
199
|
+
<div className="code-intel-tooltip-value">
|
|
200
|
+
{hoveredPairData.coSessions} co-edit{hoveredPairData.coSessions !== 1 ? "s" : ""}
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
)}
|
|
204
|
+
|
|
205
|
+
{/* Node hover tooltip — to the right of the dot */}
|
|
206
|
+
{hoveredFile && (
|
|
207
|
+
<div
|
|
208
|
+
className="code-intel-tooltip code-intel-tooltip--node"
|
|
209
|
+
style={{
|
|
210
|
+
left: dotX + 12,
|
|
211
|
+
top: Math.max(fileY(fileIndexMap.get(hoveredFile) ?? 0) - 20, 4),
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
<div className="code-intel-tooltip-path">{hoveredFile}</div>
|
|
215
|
+
{fileCouplingMap.has(hoveredFile) ? (
|
|
216
|
+
<div className="code-intel-tooltip-coupling-list">
|
|
217
|
+
{fileCouplingMap.get(hoveredFile)?.map((c) => (
|
|
218
|
+
<div key={c.partner} className="code-intel-tooltip-coupling-row">
|
|
219
|
+
<span className="code-intel-tooltip-coupling-partner">
|
|
220
|
+
{shortFileName(c.partner)}
|
|
221
|
+
</span>
|
|
222
|
+
<span className="code-intel-tooltip-coupling-count">{c.coSessions}×</span>
|
|
223
|
+
</div>
|
|
224
|
+
))}
|
|
225
|
+
</div>
|
|
226
|
+
) : (
|
|
227
|
+
<div className="code-intel-tooltip-value">No coupling detected</div>
|
|
228
|
+
)}
|
|
229
|
+
</div>
|
|
230
|
+
)}
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const pairKey = (a: string, b: string) => (a < b ? `${a}\0${b}` : `${b}\0${a}`);
|
|
236
|
+
|
|
237
|
+
const shortFileName = (path: string): string => path.split("/").pop() ?? path;
|
|
238
|
+
|
|
239
|
+
const truncateLabel = (label: string, maxWidth: number): string => {
|
|
240
|
+
const charWidth = 6.5;
|
|
241
|
+
const maxChars = Math.floor(maxWidth / charWidth);
|
|
242
|
+
if (label.length <= maxChars) return label;
|
|
243
|
+
if (maxChars <= 3) return "";
|
|
244
|
+
return `${label.slice(0, maxChars - 1)}\u2026`;
|
|
245
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { FileCode2, GitFork, PenLine, Terminal } from "lucide-react";
|
|
2
|
+
|
|
3
|
+
import { useCodeIntelRuntime } from "../app/hooks/useCodeIntelRuntime";
|
|
4
|
+
import { CodeIntelArcDiagram } from "./CodeIntelArcDiagram";
|
|
5
|
+
import { CodeIntelTreemap } from "./CodeIntelTreemap";
|
|
6
|
+
import { ActionButton } from "./ui/ActionButton";
|
|
7
|
+
|
|
8
|
+
type CodeIntelPrimaryViewProps = {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const CodeIntelPrimaryView = ({ enabled }: CodeIntelPrimaryViewProps) => {
|
|
13
|
+
const { events, treemapRoot, couplingData, isLoading, error, refresh } =
|
|
14
|
+
useCodeIntelRuntime(enabled);
|
|
15
|
+
|
|
16
|
+
if (isLoading && events.length === 0) {
|
|
17
|
+
return (
|
|
18
|
+
<section className="code-intel-view" aria-label="Code Intel primary view">
|
|
19
|
+
<section className="code-intel-panel">
|
|
20
|
+
<header className="code-intel-panel-header">
|
|
21
|
+
<h2>Code Intel</h2>
|
|
22
|
+
<p>Loading edit events...</p>
|
|
23
|
+
</header>
|
|
24
|
+
</section>
|
|
25
|
+
</section>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (error) {
|
|
30
|
+
return (
|
|
31
|
+
<section className="code-intel-view" aria-label="Code Intel primary view">
|
|
32
|
+
<section className="code-intel-panel">
|
|
33
|
+
<header className="code-intel-panel-header">
|
|
34
|
+
<h2>Code Intel</h2>
|
|
35
|
+
<p className="code-intel-error">{error}</p>
|
|
36
|
+
</header>
|
|
37
|
+
</section>
|
|
38
|
+
</section>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (events.length === 0) {
|
|
43
|
+
return (
|
|
44
|
+
<section className="code-intel-view" aria-label="Code Intel primary view">
|
|
45
|
+
<section className="code-intel-panel">
|
|
46
|
+
<header className="code-intel-panel-header">
|
|
47
|
+
<h2>Code Intel</h2>
|
|
48
|
+
<p>No edit events recorded yet. Events are tracked as agents edit files.</p>
|
|
49
|
+
</header>
|
|
50
|
+
</section>
|
|
51
|
+
</section>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<section className="code-intel-view" aria-label="Code Intel primary view">
|
|
57
|
+
<header className="code-intel-view-header">
|
|
58
|
+
<span className="code-intel-stat">
|
|
59
|
+
<PenLine size={13} className="code-intel-stat-icon code-intel-stat-icon--edits" />
|
|
60
|
+
<span className="code-intel-stat-value">{events.length}</span>
|
|
61
|
+
<span className="code-intel-stat-label">edits</span>
|
|
62
|
+
</span>
|
|
63
|
+
<span className="code-intel-stat">
|
|
64
|
+
<FileCode2 size={13} className="code-intel-stat-icon code-intel-stat-icon--files" />
|
|
65
|
+
<span className="code-intel-stat-value">{couplingData?.files.length ?? 0}</span>
|
|
66
|
+
<span className="code-intel-stat-label">files</span>
|
|
67
|
+
</span>
|
|
68
|
+
<span className="code-intel-stat">
|
|
69
|
+
<Terminal size={13} className="code-intel-stat-icon code-intel-stat-icon--sessions" />
|
|
70
|
+
<span className="code-intel-stat-value">
|
|
71
|
+
{new Set(events.map((e) => e.sessionId)).size}
|
|
72
|
+
</span>
|
|
73
|
+
<span className="code-intel-stat-label">sessions</span>
|
|
74
|
+
</span>
|
|
75
|
+
<span className="code-intel-stat">
|
|
76
|
+
<GitFork size={13} className="code-intel-stat-icon code-intel-stat-icon--pairs" />
|
|
77
|
+
<span className="code-intel-stat-value">{couplingData?.pairs.length ?? 0}</span>
|
|
78
|
+
<span className="code-intel-stat-label">pairs</span>
|
|
79
|
+
</span>
|
|
80
|
+
<ActionButton size="dense" variant="accent" onClick={refresh}>
|
|
81
|
+
Refresh
|
|
82
|
+
</ActionButton>
|
|
83
|
+
</header>
|
|
84
|
+
|
|
85
|
+
<div className="code-intel-panels">
|
|
86
|
+
<section className="code-intel-panel code-intel-panel--treemap">
|
|
87
|
+
<header className="code-intel-panel-header">
|
|
88
|
+
<h2>Edit Frequency</h2>
|
|
89
|
+
<p>File size = number of edits.</p>
|
|
90
|
+
</header>
|
|
91
|
+
{treemapRoot && <CodeIntelTreemap root={treemapRoot} />}
|
|
92
|
+
</section>
|
|
93
|
+
|
|
94
|
+
<section className="code-intel-panel code-intel-panel--coupling">
|
|
95
|
+
<header className="code-intel-panel-header">
|
|
96
|
+
<h2>Change Coupling</h2>
|
|
97
|
+
<p>Files that change together in the same session.</p>
|
|
98
|
+
</header>
|
|
99
|
+
{couplingData && <CodeIntelArcDiagram data={couplingData} />}
|
|
100
|
+
</section>
|
|
101
|
+
</div>
|
|
102
|
+
</section>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type TreemapNode,
|
|
5
|
+
type TreemapRect,
|
|
6
|
+
heatColor,
|
|
7
|
+
layoutTreemap,
|
|
8
|
+
} from "../app/codeIntelAggregation";
|
|
9
|
+
|
|
10
|
+
type CodeIntelTreemapProps = {
|
|
11
|
+
root: TreemapNode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const GAP = 2;
|
|
15
|
+
const MIN_LABEL_WIDTH = 48;
|
|
16
|
+
const MIN_LABEL_HEIGHT = 18;
|
|
17
|
+
|
|
18
|
+
export const CodeIntelTreemap = ({ root }: CodeIntelTreemapProps) => {
|
|
19
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
20
|
+
const [size, setSize] = useState({ width: 600, height: 400 });
|
|
21
|
+
const [hoveredRect, setHoveredRect] = useState<TreemapRect | null>(null);
|
|
22
|
+
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
|
|
23
|
+
|
|
24
|
+
const measure = useCallback(() => {
|
|
25
|
+
if (containerRef.current) {
|
|
26
|
+
setSize({
|
|
27
|
+
width: containerRef.current.clientWidth,
|
|
28
|
+
height: containerRef.current.clientHeight,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
measure();
|
|
35
|
+
const observer = new ResizeObserver(measure);
|
|
36
|
+
if (containerRef.current) observer.observe(containerRef.current);
|
|
37
|
+
return () => observer.disconnect();
|
|
38
|
+
}, [measure]);
|
|
39
|
+
|
|
40
|
+
const rects = useMemo(
|
|
41
|
+
() => layoutTreemap(root, size.width, size.height),
|
|
42
|
+
[root, size.width, size.height],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const maxValue = useMemo(() => {
|
|
46
|
+
let max = 0;
|
|
47
|
+
for (const r of rects) {
|
|
48
|
+
if (r.value > max) max = r.value;
|
|
49
|
+
}
|
|
50
|
+
return max;
|
|
51
|
+
}, [rects]);
|
|
52
|
+
|
|
53
|
+
const handleMouseMove = useCallback((e: React.MouseEvent) => {
|
|
54
|
+
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
55
|
+
setMousePos({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className="code-intel-treemap" ref={containerRef} onMouseMove={handleMouseMove}>
|
|
60
|
+
<svg
|
|
61
|
+
className="code-intel-treemap-svg"
|
|
62
|
+
viewBox={`0 0 ${size.width} ${size.height}`}
|
|
63
|
+
width={size.width}
|
|
64
|
+
height={size.height}
|
|
65
|
+
role="img"
|
|
66
|
+
aria-label="File edit frequency treemap"
|
|
67
|
+
>
|
|
68
|
+
{rects.map((r) => {
|
|
69
|
+
const gapX = GAP;
|
|
70
|
+
const gapY = GAP;
|
|
71
|
+
const rx = r.x + gapX / 2;
|
|
72
|
+
const ry = r.y + gapY / 2;
|
|
73
|
+
const rw = Math.max(r.width - gapX, 0);
|
|
74
|
+
const rh = Math.max(r.height - gapY, 0);
|
|
75
|
+
if (rw <= 0 || rh <= 0) return null;
|
|
76
|
+
|
|
77
|
+
const isHovered = hoveredRect?.path === r.path;
|
|
78
|
+
const showLabel = rw >= MIN_LABEL_WIDTH && rh >= MIN_LABEL_HEIGHT;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<g
|
|
82
|
+
key={r.path}
|
|
83
|
+
onMouseEnter={() => setHoveredRect(r)}
|
|
84
|
+
onMouseLeave={() => setHoveredRect(null)}
|
|
85
|
+
>
|
|
86
|
+
<rect
|
|
87
|
+
x={rx}
|
|
88
|
+
y={ry}
|
|
89
|
+
width={rw}
|
|
90
|
+
height={rh}
|
|
91
|
+
rx={2}
|
|
92
|
+
fill={heatColor(r.value, maxValue)}
|
|
93
|
+
className="code-intel-treemap-cell"
|
|
94
|
+
style={{
|
|
95
|
+
filter: isHovered ? "brightness(1.35)" : undefined,
|
|
96
|
+
stroke: isHovered ? "#d4a017" : "#0b0d10",
|
|
97
|
+
strokeWidth: isHovered ? 1.5 : 0.5,
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
{showLabel && (
|
|
101
|
+
<text
|
|
102
|
+
x={rx + 4}
|
|
103
|
+
y={ry + 13}
|
|
104
|
+
className="code-intel-treemap-label"
|
|
105
|
+
clipPath={"inset(0 0 0 0)"}
|
|
106
|
+
>
|
|
107
|
+
<tspan className="code-intel-treemap-count">{r.value}:</tspan>
|
|
108
|
+
<tspan>{truncateLabel(r.name, rw - 8 - `${r.value}:`.length * 6.5)}</tspan>
|
|
109
|
+
</text>
|
|
110
|
+
)}
|
|
111
|
+
</g>
|
|
112
|
+
);
|
|
113
|
+
})}
|
|
114
|
+
</svg>
|
|
115
|
+
|
|
116
|
+
{hoveredRect && (
|
|
117
|
+
<div
|
|
118
|
+
className="code-intel-tooltip"
|
|
119
|
+
style={{
|
|
120
|
+
left: mousePos.x > size.width / 2 ? mousePos.x - 200 : mousePos.x + 12,
|
|
121
|
+
top: mousePos.y > size.height / 2 ? mousePos.y - 52 : mousePos.y + 12,
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<div className="code-intel-tooltip-path">{hoveredRect.path}</div>
|
|
125
|
+
<div className="code-intel-tooltip-value">{hoveredRect.value} edits</div>
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const truncateLabel = (label: string, maxWidth: number): string => {
|
|
133
|
+
const charWidth = 6.5;
|
|
134
|
+
const maxChars = Math.floor(maxWidth / charWidth);
|
|
135
|
+
if (label.length <= maxChars) return label;
|
|
136
|
+
if (maxChars <= 3) return "";
|
|
137
|
+
return `${label.slice(0, maxChars - 1)}\u2026`;
|
|
138
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PRIMARY_NAV_ITEMS, type PrimaryNavIndex } from "../app/constants";
|
|
2
|
+
|
|
3
|
+
type ConsolePrimaryNavProps = {
|
|
4
|
+
activePrimaryNav: PrimaryNavIndex;
|
|
5
|
+
onPrimaryNavChange: (index: PrimaryNavIndex) => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const ConsolePrimaryNav = ({
|
|
9
|
+
activePrimaryNav,
|
|
10
|
+
onPrimaryNavChange,
|
|
11
|
+
}: ConsolePrimaryNavProps) => (
|
|
12
|
+
<nav className="console-primary-nav" aria-label="Primary navigation">
|
|
13
|
+
<div className="console-primary-nav-tabs">
|
|
14
|
+
{PRIMARY_NAV_ITEMS.map((item) => (
|
|
15
|
+
<button
|
|
16
|
+
aria-current={item.index === activePrimaryNav ? "page" : undefined}
|
|
17
|
+
className="console-primary-nav-tab"
|
|
18
|
+
data-active={item.index === activePrimaryNav ? "true" : "false"}
|
|
19
|
+
key={item.index}
|
|
20
|
+
onClick={() => {
|
|
21
|
+
onPrimaryNavChange(item.index);
|
|
22
|
+
}}
|
|
23
|
+
type="button"
|
|
24
|
+
>
|
|
25
|
+
[{item.index}] {item.label}
|
|
26
|
+
</button>
|
|
27
|
+
))}
|
|
28
|
+
</div>
|
|
29
|
+
<p className="console-primary-nav-hint">Press 1-{PRIMARY_NAV_ITEMS.length} to navigate</p>
|
|
30
|
+
</nav>
|
|
31
|
+
);
|