@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,341 @@
|
|
|
1
|
+
import { ChevronDown } from "lucide-react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import type { TentacleGitStatusSnapshot, TentaclePullRequestSnapshot } from "../app/types";
|
|
5
|
+
import { ActionButton } from "./ui/ActionButton";
|
|
6
|
+
|
|
7
|
+
type TentacleGitActionsDialogProps = {
|
|
8
|
+
tentacleId: string;
|
|
9
|
+
tentacleName: string;
|
|
10
|
+
gitStatus: TentacleGitStatusSnapshot | null;
|
|
11
|
+
gitPullRequest: TentaclePullRequestSnapshot | null;
|
|
12
|
+
gitCommitMessage: string;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
isMutating: boolean;
|
|
15
|
+
errorMessage: string | null;
|
|
16
|
+
onCommitMessageChange: (value: string) => void;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onCommit: () => void;
|
|
19
|
+
onCommitAndPush: () => void;
|
|
20
|
+
onPush: () => void;
|
|
21
|
+
onSync: () => void;
|
|
22
|
+
onMergePullRequest: () => void;
|
|
23
|
+
onCleanupWorktree: () => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const renderDirtyState = (isDirty: boolean) => (isDirty ? "Dirty" : "Clean");
|
|
27
|
+
|
|
28
|
+
export const TentacleGitActionsDialog = ({
|
|
29
|
+
tentacleId,
|
|
30
|
+
tentacleName,
|
|
31
|
+
gitStatus,
|
|
32
|
+
gitPullRequest,
|
|
33
|
+
gitCommitMessage,
|
|
34
|
+
isLoading,
|
|
35
|
+
isMutating,
|
|
36
|
+
errorMessage,
|
|
37
|
+
onCommitMessageChange,
|
|
38
|
+
onClose,
|
|
39
|
+
onCommit,
|
|
40
|
+
onCommitAndPush,
|
|
41
|
+
onPush,
|
|
42
|
+
onSync,
|
|
43
|
+
onMergePullRequest,
|
|
44
|
+
onCleanupWorktree,
|
|
45
|
+
}: TentacleGitActionsDialogProps) => {
|
|
46
|
+
const [isCommitMenuOpen, setIsCommitMenuOpen] = useState(false);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (isLoading || isMutating) {
|
|
50
|
+
setIsCommitMenuOpen(false);
|
|
51
|
+
}
|
|
52
|
+
}, [isLoading, isMutating]);
|
|
53
|
+
|
|
54
|
+
const globalDisabledReason = isLoading
|
|
55
|
+
? "Git lifecycle snapshot is loading."
|
|
56
|
+
: isMutating
|
|
57
|
+
? "Another git action is currently running."
|
|
58
|
+
: null;
|
|
59
|
+
|
|
60
|
+
const commitDisabledReason =
|
|
61
|
+
globalDisabledReason ??
|
|
62
|
+
(gitCommitMessage.trim().length === 0 ? "Commit blocked: enter a commit message." : null);
|
|
63
|
+
const commitAndPushDisabledReason = commitDisabledReason;
|
|
64
|
+
|
|
65
|
+
const pushDisabledReason =
|
|
66
|
+
globalDisabledReason ??
|
|
67
|
+
((gitStatus?.aheadCount ?? 0) <= 0
|
|
68
|
+
? "Push blocked: no local commits ahead of upstream."
|
|
69
|
+
: null);
|
|
70
|
+
|
|
71
|
+
const syncDisabledReason =
|
|
72
|
+
globalDisabledReason ??
|
|
73
|
+
(gitStatus?.isDirty ? "Sync blocked: worktree has uncommitted changes." : null);
|
|
74
|
+
|
|
75
|
+
const hasOpenPullRequest = gitPullRequest?.status === "open";
|
|
76
|
+
const canMergePullRequest =
|
|
77
|
+
hasOpenPullRequest &&
|
|
78
|
+
gitPullRequest?.isDraft !== true &&
|
|
79
|
+
gitPullRequest?.mergeable !== "CONFLICTING";
|
|
80
|
+
const mergePullRequestDisabledReason =
|
|
81
|
+
globalDisabledReason ??
|
|
82
|
+
(!hasOpenPullRequest
|
|
83
|
+
? "Merge blocked: no open pull request."
|
|
84
|
+
: gitPullRequest?.isDraft === true
|
|
85
|
+
? "Merge blocked: pull request is still a draft."
|
|
86
|
+
: gitPullRequest?.mergeable === "CONFLICTING"
|
|
87
|
+
? "Merge blocked: pull request has merge conflicts."
|
|
88
|
+
: canMergePullRequest
|
|
89
|
+
? null
|
|
90
|
+
: "Merge blocked: pull request is not mergeable yet.");
|
|
91
|
+
|
|
92
|
+
const cleanupDisabledReason = globalDisabledReason;
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<section
|
|
96
|
+
aria-label={`Git actions for ${tentacleId}`}
|
|
97
|
+
className="git-actions-dialog"
|
|
98
|
+
onKeyDown={(event) => {
|
|
99
|
+
if (event.key === "Escape") {
|
|
100
|
+
if (isCommitMenuOpen) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
setIsCommitMenuOpen(false);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!isMutating) {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
onClose();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}}
|
|
111
|
+
tabIndex={-1}
|
|
112
|
+
>
|
|
113
|
+
<header className="git-actions-header">
|
|
114
|
+
<h2>Worktree Git Actions</h2>
|
|
115
|
+
<div className="git-actions-header-actions">
|
|
116
|
+
<span className="pill git-actions-worktree-badge">WORKTREE</span>
|
|
117
|
+
<ActionButton
|
|
118
|
+
aria-label="Close sidebar action panel"
|
|
119
|
+
className="git-actions-close"
|
|
120
|
+
disabled={isMutating}
|
|
121
|
+
onClick={onClose}
|
|
122
|
+
size="dense"
|
|
123
|
+
variant="accent"
|
|
124
|
+
>
|
|
125
|
+
Close
|
|
126
|
+
</ActionButton>
|
|
127
|
+
</div>
|
|
128
|
+
</header>
|
|
129
|
+
<div className="git-actions-body">
|
|
130
|
+
<p className="git-actions-message">
|
|
131
|
+
Manage git lifecycle for <strong>{tentacleName}</strong> ({tentacleId}).
|
|
132
|
+
</p>
|
|
133
|
+
{isLoading ? (
|
|
134
|
+
<p className="git-actions-loading">Loading git status...</p>
|
|
135
|
+
) : gitStatus ? (
|
|
136
|
+
<dl className="git-actions-status">
|
|
137
|
+
<div>
|
|
138
|
+
<dt>Branch</dt>
|
|
139
|
+
<dd>{gitStatus.branchName}</dd>
|
|
140
|
+
</div>
|
|
141
|
+
<div>
|
|
142
|
+
<dt>Upstream</dt>
|
|
143
|
+
<dd>{gitStatus.upstreamBranchName ?? "Not set"}</dd>
|
|
144
|
+
</div>
|
|
145
|
+
<div>
|
|
146
|
+
<dt>State</dt>
|
|
147
|
+
<dd>{renderDirtyState(gitStatus.isDirty)}</dd>
|
|
148
|
+
</div>
|
|
149
|
+
<div>
|
|
150
|
+
<dt>Sync</dt>
|
|
151
|
+
<dd className="git-actions-sync-metric">
|
|
152
|
+
<span className="git-actions-ahead-count">{gitStatus.aheadCount}</span>
|
|
153
|
+
<span className="git-actions-metric-separator">/</span>
|
|
154
|
+
<span className="git-actions-behind-count">{gitStatus.behindCount}</span>
|
|
155
|
+
</dd>
|
|
156
|
+
</div>
|
|
157
|
+
<div>
|
|
158
|
+
<dt>Line diff</dt>
|
|
159
|
+
<dd className="git-actions-line-diff-metric">
|
|
160
|
+
<span className="git-actions-insertions-count">+{gitStatus.insertedLineCount}</span>
|
|
161
|
+
<span className="git-actions-metric-separator">/</span>
|
|
162
|
+
<span className="git-actions-deletions-count">-{gitStatus.deletedLineCount}</span>
|
|
163
|
+
</dd>
|
|
164
|
+
</div>
|
|
165
|
+
</dl>
|
|
166
|
+
) : (
|
|
167
|
+
<p className="git-actions-loading">No git status available.</p>
|
|
168
|
+
)}
|
|
169
|
+
|
|
170
|
+
<section className="git-actions-commit-panel" aria-label="Source control composer">
|
|
171
|
+
<label className="git-actions-commit-label" htmlFor="git-actions-commit-input">
|
|
172
|
+
Message
|
|
173
|
+
</label>
|
|
174
|
+
<textarea
|
|
175
|
+
aria-label={`Commit message for ${tentacleId}`}
|
|
176
|
+
className="git-actions-message-input"
|
|
177
|
+
id="git-actions-commit-input"
|
|
178
|
+
onChange={(event) => {
|
|
179
|
+
onCommitMessageChange(event.target.value);
|
|
180
|
+
}}
|
|
181
|
+
placeholder="feat: something"
|
|
182
|
+
rows={3}
|
|
183
|
+
value={gitCommitMessage}
|
|
184
|
+
/>
|
|
185
|
+
<div className="git-actions-commit-controls">
|
|
186
|
+
<ActionButton
|
|
187
|
+
aria-label="Commit changes"
|
|
188
|
+
className="git-actions-commit-main"
|
|
189
|
+
disabled={Boolean(commitDisabledReason)}
|
|
190
|
+
onClick={onCommit}
|
|
191
|
+
size="dense"
|
|
192
|
+
variant="accent"
|
|
193
|
+
>
|
|
194
|
+
{isMutating ? "Running..." : "Commit"}
|
|
195
|
+
</ActionButton>
|
|
196
|
+
<button
|
|
197
|
+
aria-expanded={isCommitMenuOpen}
|
|
198
|
+
aria-haspopup="menu"
|
|
199
|
+
aria-label="Open commit options"
|
|
200
|
+
className="git-actions-commit-toggle"
|
|
201
|
+
disabled={Boolean(globalDisabledReason)}
|
|
202
|
+
onClick={() => {
|
|
203
|
+
setIsCommitMenuOpen((current) => !current);
|
|
204
|
+
}}
|
|
205
|
+
type="button"
|
|
206
|
+
>
|
|
207
|
+
<ChevronDown size={14} />
|
|
208
|
+
</button>
|
|
209
|
+
</div>
|
|
210
|
+
{isCommitMenuOpen && (
|
|
211
|
+
<div className="git-actions-commit-menu" role="menu">
|
|
212
|
+
<button
|
|
213
|
+
className="git-actions-commit-menu-item"
|
|
214
|
+
disabled={Boolean(commitDisabledReason)}
|
|
215
|
+
onClick={() => {
|
|
216
|
+
setIsCommitMenuOpen(false);
|
|
217
|
+
onCommit();
|
|
218
|
+
}}
|
|
219
|
+
role="menuitem"
|
|
220
|
+
type="button"
|
|
221
|
+
>
|
|
222
|
+
Commit
|
|
223
|
+
</button>
|
|
224
|
+
<button
|
|
225
|
+
className="git-actions-commit-menu-item"
|
|
226
|
+
disabled={Boolean(commitAndPushDisabledReason)}
|
|
227
|
+
onClick={() => {
|
|
228
|
+
setIsCommitMenuOpen(false);
|
|
229
|
+
onCommitAndPush();
|
|
230
|
+
}}
|
|
231
|
+
role="menuitem"
|
|
232
|
+
type="button"
|
|
233
|
+
>
|
|
234
|
+
Commit & Push
|
|
235
|
+
</button>
|
|
236
|
+
<button
|
|
237
|
+
className="git-actions-commit-menu-item"
|
|
238
|
+
disabled={Boolean(pushDisabledReason)}
|
|
239
|
+
onClick={() => {
|
|
240
|
+
setIsCommitMenuOpen(false);
|
|
241
|
+
onPush();
|
|
242
|
+
}}
|
|
243
|
+
role="menuitem"
|
|
244
|
+
type="button"
|
|
245
|
+
>
|
|
246
|
+
Push
|
|
247
|
+
</button>
|
|
248
|
+
<button
|
|
249
|
+
className="git-actions-commit-menu-item"
|
|
250
|
+
disabled={Boolean(syncDisabledReason)}
|
|
251
|
+
onClick={() => {
|
|
252
|
+
setIsCommitMenuOpen(false);
|
|
253
|
+
onSync();
|
|
254
|
+
}}
|
|
255
|
+
role="menuitem"
|
|
256
|
+
type="button"
|
|
257
|
+
>
|
|
258
|
+
Sync with Base
|
|
259
|
+
</button>
|
|
260
|
+
</div>
|
|
261
|
+
)}
|
|
262
|
+
{commitDisabledReason && <p className="git-action-reason">{commitDisabledReason}</p>}
|
|
263
|
+
{pushDisabledReason && <p className="git-action-hint">{pushDisabledReason}</p>}
|
|
264
|
+
{syncDisabledReason ? (
|
|
265
|
+
<p className="git-action-hint">{syncDisabledReason}</p>
|
|
266
|
+
) : (
|
|
267
|
+
<p className="git-action-hint">Sync is ready. Use the commit menu to run sync.</p>
|
|
268
|
+
)}
|
|
269
|
+
</section>
|
|
270
|
+
|
|
271
|
+
<section className="git-actions-pr-section" aria-label="Pull request workflow">
|
|
272
|
+
<div className="git-actions-pr-header">
|
|
273
|
+
<h3>Pull request</h3>
|
|
274
|
+
<p className="git-actions-pr-status">
|
|
275
|
+
Status: {gitPullRequest?.status ?? "none"}
|
|
276
|
+
{gitPullRequest?.number ? ` · #${gitPullRequest.number}` : ""}
|
|
277
|
+
</p>
|
|
278
|
+
</div>
|
|
279
|
+
<p className="git-action-hint">
|
|
280
|
+
Create pull requests directly in GitHub after pushing your branch.
|
|
281
|
+
</p>
|
|
282
|
+
<div className="git-actions-pr-buttons">
|
|
283
|
+
<ActionButton
|
|
284
|
+
aria-label="Merge pull request"
|
|
285
|
+
className="git-actions-merge-pr"
|
|
286
|
+
disabled={Boolean(mergePullRequestDisabledReason)}
|
|
287
|
+
onClick={onMergePullRequest}
|
|
288
|
+
size="dense"
|
|
289
|
+
variant="info"
|
|
290
|
+
>
|
|
291
|
+
Merge pull request
|
|
292
|
+
</ActionButton>
|
|
293
|
+
<ActionButton
|
|
294
|
+
aria-label="Open pull request in GitHub"
|
|
295
|
+
className="git-actions-open-pr"
|
|
296
|
+
disabled={!gitPullRequest?.url}
|
|
297
|
+
onClick={() => {
|
|
298
|
+
if (!gitPullRequest?.url) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
globalThis.open?.(gitPullRequest.url, "_blank", "noopener,noreferrer");
|
|
302
|
+
}}
|
|
303
|
+
size="dense"
|
|
304
|
+
variant="accent"
|
|
305
|
+
>
|
|
306
|
+
Open on GitHub
|
|
307
|
+
</ActionButton>
|
|
308
|
+
</div>
|
|
309
|
+
{mergePullRequestDisabledReason && (
|
|
310
|
+
<p className="git-action-reason">{mergePullRequestDisabledReason}</p>
|
|
311
|
+
)}
|
|
312
|
+
{!gitPullRequest?.url && (
|
|
313
|
+
<p className="git-action-hint">No pull request URL detected for this branch yet.</p>
|
|
314
|
+
)}
|
|
315
|
+
</section>
|
|
316
|
+
|
|
317
|
+
<div className="git-action-row git-action-row--cleanup">
|
|
318
|
+
<div className="git-action-content">
|
|
319
|
+
<p className="git-action-title">Cleanup worktree</p>
|
|
320
|
+
<p className="git-action-hint">
|
|
321
|
+
Deletes the worktree directory and branch after confirmation.
|
|
322
|
+
</p>
|
|
323
|
+
{cleanupDisabledReason && <p className="git-action-reason">{cleanupDisabledReason}</p>}
|
|
324
|
+
</div>
|
|
325
|
+
<ActionButton
|
|
326
|
+
aria-label="Cleanup worktree"
|
|
327
|
+
className="git-actions-cleanup"
|
|
328
|
+
disabled={Boolean(cleanupDisabledReason)}
|
|
329
|
+
onClick={onCleanupWorktree}
|
|
330
|
+
size="dense"
|
|
331
|
+
variant="danger"
|
|
332
|
+
>
|
|
333
|
+
Cleanup worktree
|
|
334
|
+
</ActionButton>
|
|
335
|
+
</div>
|
|
336
|
+
|
|
337
|
+
{errorMessage && <p className="git-actions-error">{errorMessage}</p>}
|
|
338
|
+
</div>
|
|
339
|
+
</section>
|
|
340
|
+
);
|
|
341
|
+
};
|