@akiojin/gwt 4.10.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +4 -4
- package/README.md +4 -4
- package/bin/gwt.js +1 -1
- package/dist/claude.d.ts +2 -0
- package/dist/claude.d.ts.map +1 -1
- package/dist/claude.js +97 -68
- package/dist/claude.js.map +1 -1
- package/dist/cli/ui/App.solid.d.ts +29 -0
- package/dist/cli/ui/App.solid.d.ts.map +1 -0
- package/dist/cli/ui/App.solid.js +1395 -0
- package/dist/cli/ui/App.solid.js.map +1 -0
- package/dist/cli/ui/components/solid/Footer.d.ts +10 -0
- package/dist/cli/ui/components/solid/Footer.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/Footer.js +10 -0
- package/dist/cli/ui/components/solid/Footer.js.map +1 -0
- package/dist/cli/ui/components/{parts → solid}/Header.d.ts +1 -6
- package/dist/cli/ui/components/solid/Header.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/Header.js +13 -0
- package/dist/cli/ui/components/solid/Header.js.map +1 -0
- package/dist/cli/ui/components/solid/HelpOverlay.d.ts +8 -0
- package/dist/cli/ui/components/solid/HelpOverlay.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/HelpOverlay.js +118 -0
- package/dist/cli/ui/components/solid/HelpOverlay.js.map +1 -0
- package/dist/cli/ui/components/solid/QuickStartStep.d.ts +17 -0
- package/dist/cli/ui/components/solid/QuickStartStep.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/QuickStartStep.js +152 -0
- package/dist/cli/ui/components/solid/QuickStartStep.js.map +1 -0
- package/dist/cli/ui/components/solid/SelectInput.d.ts +22 -0
- package/dist/cli/ui/components/solid/SelectInput.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/SelectInput.js +45 -0
- package/dist/cli/ui/components/solid/SelectInput.js.map +1 -0
- package/dist/cli/ui/components/solid/TextInput.d.ts +12 -0
- package/dist/cli/ui/components/solid/TextInput.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/TextInput.js +9 -0
- package/dist/cli/ui/components/solid/TextInput.js.map +1 -0
- package/dist/cli/ui/components/solid/WizardController.d.ts +34 -0
- package/dist/cli/ui/components/solid/WizardController.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/WizardController.js +223 -0
- package/dist/cli/ui/components/solid/WizardController.js.map +1 -0
- package/dist/cli/ui/components/solid/WizardPopup.d.ts +26 -0
- package/dist/cli/ui/components/solid/WizardPopup.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/WizardPopup.js +68 -0
- package/dist/cli/ui/components/solid/WizardPopup.js.map +1 -0
- package/dist/cli/ui/components/solid/WizardSteps.d.ts +52 -0
- package/dist/cli/ui/components/solid/WizardSteps.d.ts.map +1 -0
- package/dist/cli/ui/components/solid/WizardSteps.js +419 -0
- package/dist/cli/ui/components/solid/WizardSteps.js.map +1 -0
- package/dist/cli/ui/core/index.d.ts +12 -0
- package/dist/cli/ui/core/index.d.ts.map +1 -0
- package/dist/cli/ui/core/index.js +15 -0
- package/dist/cli/ui/core/index.js.map +1 -0
- package/dist/cli/ui/core/keybindings.d.ts +106 -0
- package/dist/cli/ui/core/keybindings.d.ts.map +1 -0
- package/dist/cli/ui/core/keybindings.js +270 -0
- package/dist/cli/ui/core/keybindings.js.map +1 -0
- package/dist/cli/ui/core/theme.d.ts +123 -0
- package/dist/cli/ui/core/theme.d.ts.map +1 -0
- package/dist/cli/ui/core/theme.js +191 -0
- package/dist/cli/ui/core/theme.js.map +1 -0
- package/dist/cli/ui/core/types.d.ts +156 -0
- package/dist/cli/ui/core/types.d.ts.map +1 -0
- package/dist/cli/ui/core/types.js +10 -0
- package/dist/cli/ui/core/types.js.map +1 -0
- package/dist/cli/ui/hooks/solid/useScrollableList.d.ts +26 -0
- package/dist/cli/ui/hooks/solid/useScrollableList.d.ts.map +1 -0
- package/dist/cli/ui/hooks/solid/useScrollableList.js +89 -0
- package/dist/cli/ui/hooks/solid/useScrollableList.js.map +1 -0
- package/dist/cli/ui/hooks/solid/useTerminalSize.d.ts +10 -0
- package/dist/cli/ui/hooks/solid/useTerminalSize.d.ts.map +1 -0
- package/dist/cli/ui/hooks/solid/useTerminalSize.js +16 -0
- package/dist/cli/ui/hooks/solid/useTerminalSize.js.map +1 -0
- package/dist/cli/ui/index.solid.d.ts +5 -0
- package/dist/cli/ui/index.solid.d.ts.map +1 -0
- package/dist/cli/ui/index.solid.js +21 -0
- package/dist/cli/ui/index.solid.js.map +1 -0
- package/dist/cli/ui/screens/solid/BranchListScreen.d.ts +53 -0
- package/dist/cli/ui/screens/solid/BranchListScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/BranchListScreen.js +829 -0
- package/dist/cli/ui/screens/solid/BranchListScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/ConfirmScreen.d.ts +11 -0
- package/dist/cli/ui/screens/solid/ConfirmScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/ConfirmScreen.js +45 -0
- package/dist/cli/ui/screens/solid/ConfirmScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/EnvironmentScreen.d.ts +14 -0
- package/dist/cli/ui/screens/solid/EnvironmentScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/EnvironmentScreen.js +90 -0
- package/dist/cli/ui/screens/solid/EnvironmentScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/ErrorScreen.d.ts +8 -0
- package/dist/cli/ui/screens/solid/ErrorScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/ErrorScreen.js +18 -0
- package/dist/cli/ui/screens/solid/ErrorScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/InputScreen.d.ts +13 -0
- package/dist/cli/ui/screens/solid/InputScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/InputScreen.js +17 -0
- package/dist/cli/ui/screens/solid/InputScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/LoadingIndicator.d.ts +9 -0
- package/dist/cli/ui/screens/solid/LoadingIndicator.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/LoadingIndicator.js +43 -0
- package/dist/cli/ui/screens/solid/LoadingIndicator.js.map +1 -0
- package/dist/cli/ui/{components/screens → screens/solid}/LogDetailScreen.d.ts +2 -2
- package/dist/cli/ui/screens/solid/LogDetailScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/LogDetailScreen.js +34 -0
- package/dist/cli/ui/screens/solid/LogDetailScreen.js.map +1 -0
- package/dist/cli/ui/{components/screens/LogListScreen.d.ts → screens/solid/LogScreen.d.ts} +10 -4
- package/dist/cli/ui/screens/solid/LogScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/LogScreen.js +333 -0
- package/dist/cli/ui/screens/solid/LogScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/ProfileEnvScreen.d.ts +17 -0
- package/dist/cli/ui/screens/solid/ProfileEnvScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/ProfileEnvScreen.js +115 -0
- package/dist/cli/ui/screens/solid/ProfileEnvScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/ProfileScreen.d.ts +17 -0
- package/dist/cli/ui/screens/solid/ProfileScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/ProfileScreen.js +50 -0
- package/dist/cli/ui/screens/solid/ProfileScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/SelectorScreen.d.ts +20 -0
- package/dist/cli/ui/screens/solid/SelectorScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/SelectorScreen.js +98 -0
- package/dist/cli/ui/screens/solid/SelectorScreen.js.map +1 -0
- package/dist/cli/ui/screens/solid/WorktreeCreateScreen.d.ts +13 -0
- package/dist/cli/ui/screens/solid/WorktreeCreateScreen.d.ts.map +1 -0
- package/dist/cli/ui/screens/solid/WorktreeCreateScreen.js +59 -0
- package/dist/cli/ui/screens/solid/WorktreeCreateScreen.js.map +1 -0
- package/dist/cli/ui/stores/appStore.d.ts +143 -0
- package/dist/cli/ui/stores/appStore.d.ts.map +1 -0
- package/dist/cli/ui/stores/appStore.js +158 -0
- package/dist/cli/ui/stores/appStore.js.map +1 -0
- package/dist/cli/ui/stores/branchStore.d.ts +159 -0
- package/dist/cli/ui/stores/branchStore.d.ts.map +1 -0
- package/dist/cli/ui/stores/branchStore.js +275 -0
- package/dist/cli/ui/stores/branchStore.js.map +1 -0
- package/dist/cli/ui/stores/index.d.ts +11 -0
- package/dist/cli/ui/stores/index.d.ts.map +1 -0
- package/dist/cli/ui/stores/index.js +14 -0
- package/dist/cli/ui/stores/index.js.map +1 -0
- package/dist/cli/ui/stores/uiStore.d.ts +146 -0
- package/dist/cli/ui/stores/uiStore.d.ts.map +1 -0
- package/dist/cli/ui/stores/uiStore.js +166 -0
- package/dist/cli/ui/stores/uiStore.js.map +1 -0
- package/dist/cli/ui/types.d.ts +17 -1
- package/dist/cli/ui/types.d.ts.map +1 -1
- package/dist/cli/ui/utils/branchFormatter.d.ts +1 -0
- package/dist/cli/ui/utils/branchFormatter.d.ts.map +1 -1
- package/dist/cli/ui/utils/branchFormatter.js +36 -217
- package/dist/cli/ui/utils/branchFormatter.js.map +1 -1
- package/dist/cli/ui/utils/continueSession.d.ts +18 -0
- package/dist/cli/ui/utils/continueSession.d.ts.map +1 -1
- package/dist/cli/ui/utils/continueSession.js +90 -2
- package/dist/cli/ui/utils/continueSession.js.map +1 -1
- package/dist/cli/ui/utils/versionCache.d.ts +37 -0
- package/dist/cli/ui/utils/versionCache.d.ts.map +1 -0
- package/dist/cli/ui/utils/versionCache.js +70 -0
- package/dist/cli/ui/utils/versionCache.js.map +1 -0
- package/dist/cli/ui/utils/versionFetcher.d.ts +41 -0
- package/dist/cli/ui/utils/versionFetcher.d.ts.map +1 -0
- package/dist/cli/ui/utils/versionFetcher.js +89 -0
- package/dist/cli/ui/utils/versionFetcher.js.map +1 -0
- package/dist/client/assets/{index-ChHC-Puh.css → index-BbfV7Wuj.css} +1 -1
- package/dist/client/assets/index-CoAyq5x1.js +78 -0
- package/dist/client/index.html +2 -2
- package/dist/codex.d.ts +2 -0
- package/dist/codex.d.ts.map +1 -1
- package/dist/codex.js +109 -39
- package/dist/codex.js.map +1 -1
- package/dist/config/builtin-coding-agents.js +4 -4
- package/dist/config/builtin-coding-agents.js.map +1 -1
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +11 -0
- package/dist/config/index.js.map +1 -1
- package/dist/gemini.d.ts +2 -0
- package/dist/gemini.d.ts.map +1 -1
- package/dist/gemini.js +77 -39
- package/dist/gemini.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +153 -103
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts.map +1 -1
- package/dist/launcher.js +56 -6
- package/dist/launcher.js.map +1 -1
- package/dist/logging/agentOutput.d.ts +21 -0
- package/dist/logging/agentOutput.d.ts.map +1 -0
- package/dist/logging/agentOutput.js +164 -0
- package/dist/logging/agentOutput.js.map +1 -0
- package/dist/logging/formatter.d.ts.map +1 -1
- package/dist/logging/formatter.js +18 -4
- package/dist/logging/formatter.js.map +1 -1
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js +28 -9
- package/dist/logging/logger.js.map +1 -1
- package/dist/logging/reader.d.ts +21 -0
- package/dist/logging/reader.d.ts.map +1 -1
- package/dist/logging/reader.js +79 -0
- package/dist/logging/reader.js.map +1 -1
- package/dist/opentui/highlights-eq9cgrbb.scm +604 -0
- package/dist/opentui/highlights-ghv9g403.scm +205 -0
- package/dist/opentui/highlights-hk7bwhj4.scm +284 -0
- package/dist/opentui/highlights-r812a2qc.scm +150 -0
- package/dist/opentui/highlights-x6tmsnaa.scm +115 -0
- package/dist/opentui/index.solid.d.ts +2 -0
- package/dist/opentui/index.solid.d.ts.map +1 -0
- package/dist/opentui/index.solid.js +53687 -0
- package/dist/opentui/index.solid.js.map +1 -0
- package/dist/opentui/injections-73j83es3.scm +27 -0
- package/dist/opentui/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/dist/opentui/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/dist/opentui/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/dist/opentui/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/dist/opentui/tree-sitter-zig-e78zbjpm.wasm +0 -0
- package/dist/repositories/worktree.repository.d.ts +1 -0
- package/dist/repositories/worktree.repository.d.ts.map +1 -1
- package/dist/repositories/worktree.repository.js +7 -0
- package/dist/repositories/worktree.repository.js.map +1 -1
- package/dist/services/codingAgentResolver.d.ts +2 -0
- package/dist/services/codingAgentResolver.d.ts.map +1 -1
- package/dist/services/codingAgentResolver.js +30 -4
- package/dist/services/codingAgentResolver.js.map +1 -1
- package/dist/services/dependency-installer.d.ts.map +1 -1
- package/dist/services/dependency-installer.js +2 -7
- package/dist/services/dependency-installer.js.map +1 -1
- package/dist/types/api.d.ts +3 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/coding-agent.d.ts +62 -0
- package/dist/types/coding-agent.d.ts.map +1 -0
- package/dist/types/coding-agent.js +29 -0
- package/dist/types/coding-agent.js.map +1 -0
- package/dist/types/tools.d.ts +17 -0
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/coding-agent-colors.d.ts +88 -0
- package/dist/utils/coding-agent-colors.d.ts.map +1 -0
- package/dist/utils/coding-agent-colors.js +137 -0
- package/dist/utils/coding-agent-colors.js.map +1 -0
- package/dist/utils/command.d.ts +1 -1
- package/dist/utils/command.js +1 -1
- package/dist/utils/error-utils.d.ts +27 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/error-utils.js +98 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/npmRegistry.d.ts +61 -0
- package/dist/utils/npmRegistry.d.ts.map +1 -0
- package/dist/utils/npmRegistry.js +180 -0
- package/dist/utils/npmRegistry.js.map +1 -0
- package/dist/utils/prompt.d.ts +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/session/common.d.ts +8 -0
- package/dist/utils/session/common.d.ts.map +1 -1
- package/dist/utils/session/common.js +22 -0
- package/dist/utils/session/common.js.map +1 -1
- package/dist/utils/session/parsers/claude.d.ts +10 -4
- package/dist/utils/session/parsers/claude.d.ts.map +1 -1
- package/dist/utils/session/parsers/claude.js +64 -18
- package/dist/utils/session/parsers/claude.js.map +1 -1
- package/dist/utils/session/parsers/codex.d.ts.map +1 -1
- package/dist/utils/session/parsers/codex.js +47 -20
- package/dist/utils/session/parsers/codex.js.map +1 -1
- package/dist/utils/session/parsers/gemini.d.ts.map +1 -1
- package/dist/utils/session/parsers/gemini.js +43 -6
- package/dist/utils/session/parsers/gemini.js.map +1 -1
- package/dist/utils/session/parsers/opencode.d.ts.map +1 -1
- package/dist/utils/session/parsers/opencode.js +43 -6
- package/dist/utils/session/parsers/opencode.js.map +1 -1
- package/dist/utils/session/types.d.ts +7 -0
- package/dist/utils/session/types.d.ts.map +1 -1
- package/dist/utils/terminal.d.ts +1 -0
- package/dist/utils/terminal.d.ts.map +1 -1
- package/dist/utils/terminal.js +20 -0
- package/dist/utils/terminal.js.map +1 -1
- package/dist/utils.d.ts +9 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +33 -2
- package/dist/utils.js.map +1 -1
- package/dist/web/client/src/components/CodingAgentLaunchModal.d.ts.map +1 -1
- package/dist/web/client/src/components/CodingAgentLaunchModal.js +7 -16
- package/dist/web/client/src/components/CodingAgentLaunchModal.js.map +1 -1
- package/dist/web/client/src/components/branch-detail/BranchInfoCards.d.ts.map +1 -1
- package/dist/web/client/src/components/branch-detail/BranchInfoCards.js +7 -2
- package/dist/web/client/src/components/branch-detail/BranchInfoCards.js.map +1 -1
- package/dist/web/client/src/components/branch-detail/SessionHistoryTable.d.ts.map +1 -1
- package/dist/web/client/src/components/branch-detail/SessionHistoryTable.js +2 -1
- package/dist/web/client/src/components/branch-detail/SessionHistoryTable.js.map +1 -1
- package/dist/web/client/src/components/branch-detail/ToolLauncher.d.ts +2 -2
- package/dist/web/client/src/components/branch-detail/ToolLauncher.d.ts.map +1 -1
- package/dist/web/client/src/components/branch-detail/ToolLauncher.js +5 -5
- package/dist/web/client/src/components/branch-detail/ToolLauncher.js.map +1 -1
- package/dist/web/client/src/components/ui/alert.d.ts +1 -1
- package/dist/web/client/src/lib/coding-agent-colors.d.ts +86 -0
- package/dist/web/client/src/lib/coding-agent-colors.d.ts.map +1 -0
- package/dist/web/client/src/lib/coding-agent-colors.js +135 -0
- package/dist/web/client/src/lib/coding-agent-colors.js.map +1 -0
- package/dist/web/client/src/pages/BranchDetailPage.js +10 -10
- package/dist/web/client/src/pages/BranchDetailPage.js.map +1 -1
- package/dist/web/server/pty/manager.d.ts +2 -0
- package/dist/web/server/pty/manager.d.ts.map +1 -1
- package/dist/web/server/pty/manager.js +104 -0
- package/dist/web/server/pty/manager.js.map +1 -1
- package/dist/web/server/routes/sessions.d.ts.map +1 -1
- package/dist/web/server/routes/sessions.js +5 -1
- package/dist/web/server/routes/sessions.js.map +1 -1
- package/dist/web/server/services/branches.d.ts.map +1 -1
- package/dist/web/server/services/branches.js +10 -8
- package/dist/web/server/services/branches.js.map +1 -1
- package/dist/web/server/services/worktrees.js +2 -2
- package/dist/web/server/services/worktrees.js.map +1 -1
- package/dist/worktree.d.ts +50 -1
- package/dist/worktree.d.ts.map +1 -1
- package/dist/worktree.js +292 -100
- package/dist/worktree.js.map +1 -1
- package/package.json +13 -14
- package/src/claude.ts +129 -95
- package/src/cli/ui/App.solid.tsx +2096 -0
- package/src/cli/ui/__tests__/solid/AppSolid.cleanup.test.tsx +1084 -0
- package/src/cli/ui/__tests__/solid/BranchListScreen.test.tsx +343 -0
- package/src/cli/ui/__tests__/solid/ConfirmScreen.test.tsx +77 -0
- package/src/cli/ui/__tests__/solid/LogScreen.test.tsx +351 -0
- package/src/cli/ui/__tests__/solid/components/QuickStartStep.test.tsx +308 -0
- package/src/cli/ui/__tests__/solid/components/WizardPopup.test.tsx +231 -0
- package/src/cli/ui/__tests__/solid/components/WizardSteps.test.tsx +241 -0
- package/src/cli/ui/__tests__/utils/branchFormatter.test.ts +79 -334
- package/src/cli/ui/__tests__/utils/clipboard.test.ts +3 -3
- package/src/cli/ui/__tests__/utils/statisticsCalculator.test.ts +1 -1
- package/src/cli/ui/components/solid/Footer.tsx +36 -0
- package/src/cli/ui/components/{parts → solid}/Header.tsx +17 -28
- package/src/cli/ui/components/solid/HelpOverlay.tsx +194 -0
- package/src/cli/ui/components/solid/QuickStartStep.tsx +209 -0
- package/src/cli/ui/components/{parts → solid}/ScrollableList.tsx +7 -8
- package/src/cli/ui/components/solid/SearchInput.tsx +42 -0
- package/src/cli/ui/components/solid/SelectInput.tsx +88 -0
- package/src/cli/ui/components/solid/Stats.tsx +92 -0
- package/src/cli/ui/components/solid/TextInput.tsx +49 -0
- package/src/cli/ui/components/solid/WizardController.tsx +393 -0
- package/src/cli/ui/components/solid/WizardPopup.tsx +135 -0
- package/src/cli/ui/components/solid/WizardSteps.tsx +736 -0
- package/src/cli/ui/core/index.ts +17 -0
- package/src/cli/ui/core/keybindings.ts +367 -0
- package/src/cli/ui/core/theme.ts +266 -0
- package/src/cli/ui/core/types.ts +235 -0
- package/src/cli/ui/hooks/solid/useAsyncOperation.ts +78 -0
- package/src/cli/ui/hooks/solid/useFilter.ts +86 -0
- package/src/cli/ui/hooks/solid/useGitOperations.ts +81 -0
- package/src/cli/ui/hooks/solid/useKeyHandler.ts +103 -0
- package/src/cli/ui/hooks/solid/useScrollableList.ts +149 -0
- package/src/cli/ui/hooks/solid/useSelection.ts +77 -0
- package/src/cli/ui/hooks/solid/useTerminalSize.ts +22 -0
- package/src/cli/ui/index.solid.ts +28 -0
- package/src/cli/ui/screens/solid/BranchListScreen.tsx +1153 -0
- package/src/cli/ui/screens/solid/ConfirmScreen.tsx +86 -0
- package/src/cli/ui/screens/solid/EnvironmentScreen.tsx +161 -0
- package/src/cli/ui/screens/solid/ErrorScreen.tsx +42 -0
- package/src/cli/ui/screens/solid/InputScreen.tsx +55 -0
- package/src/cli/ui/screens/solid/LoadingIndicator.tsx +77 -0
- package/src/cli/ui/screens/solid/LogDetailScreen.tsx +75 -0
- package/src/cli/ui/screens/solid/LogScreen.tsx +504 -0
- package/src/cli/ui/screens/solid/ProfileEnvScreen.tsx +196 -0
- package/src/cli/ui/screens/solid/ProfileScreen.tsx +98 -0
- package/src/cli/ui/screens/solid/SelectorScreen.tsx +181 -0
- package/src/cli/ui/screens/solid/SettingsScreen.tsx +52 -0
- package/src/cli/ui/screens/solid/WorktreeCreateScreen.tsx +136 -0
- package/src/cli/ui/screens/solid/WorktreeDeleteScreen.tsx +40 -0
- package/src/cli/ui/stores/appStore.ts +208 -0
- package/src/cli/ui/stores/branchStore.ts +357 -0
- package/src/cli/ui/stores/index.ts +31 -0
- package/src/cli/ui/stores/uiStore.ts +226 -0
- package/src/cli/ui/types.ts +21 -3
- package/src/cli/ui/utils/__tests__/branchFormatter.test.ts +227 -0
- package/src/cli/ui/utils/branchFormatter.ts +43 -222
- package/src/cli/ui/utils/continueSession.ts +133 -2
- package/src/cli/ui/utils/modelOptions.test.ts +1 -1
- package/src/cli/ui/utils/versionCache.ts +93 -0
- package/src/cli/ui/utils/versionFetcher.ts +120 -0
- package/src/codex.ts +138 -39
- package/src/config/__tests__/saveSession.test.ts +143 -0
- package/src/config/builtin-coding-agents.ts +4 -4
- package/src/config/index.ts +14 -0
- package/src/gemini.ts +107 -46
- package/src/index.test.ts +25 -19
- package/src/index.ts +202 -143
- package/src/launcher.ts +66 -6
- package/src/logging/agentOutput.ts +216 -0
- package/src/logging/formatter.ts +23 -4
- package/src/logging/logger.ts +34 -10
- package/src/logging/reader.ts +117 -0
- package/src/opentui/index.solid.ts +1 -0
- package/src/repositories/worktree.repository.ts +8 -0
- package/src/services/__tests__/BatchMergeService.test.ts +83 -67
- package/src/services/__tests__/WorktreeOrchestrator.test.ts +8 -7
- package/src/services/codingAgentResolver.ts +30 -4
- package/src/services/dependency-installer.ts +2 -9
- package/src/types/api.ts +3 -0
- package/src/types/coding-agent.ts +85 -0
- package/src/types/tools.ts +19 -0
- package/src/utils/__tests__/npmRegistry.test.ts +250 -0
- package/src/utils/__tests__/prompt.test.ts +4 -5
- package/src/utils/coding-agent-colors.ts +165 -0
- package/src/utils/command.ts +1 -1
- package/src/utils/error-utils.ts +133 -0
- package/src/utils/npmRegistry.ts +249 -0
- package/src/utils/prompt.ts +1 -1
- package/src/utils/session/common.ts +28 -0
- package/src/utils/session/parsers/claude.ts +79 -29
- package/src/utils/session/parsers/codex.ts +50 -18
- package/src/utils/session/parsers/gemini.ts +46 -5
- package/src/utils/session/parsers/opencode.ts +46 -5
- package/src/utils/session/types.ts +4 -0
- package/src/utils/terminal.ts +24 -0
- package/src/utils.test.ts +1 -1
- package/src/utils.ts +37 -4
- package/src/web/client/src/components/CodingAgentLaunchModal.tsx +12 -21
- package/src/web/client/src/components/branch-detail/BranchInfoCards.tsx +16 -1
- package/src/web/client/src/components/branch-detail/SessionHistoryTable.tsx +7 -1
- package/src/web/client/src/components/branch-detail/ToolLauncher.tsx +11 -6
- package/src/web/client/src/lib/coding-agent-colors.ts +149 -0
- package/src/web/client/src/pages/BranchDetailPage.tsx +11 -11
- package/src/web/server/pty/manager.ts +139 -0
- package/src/web/server/routes/sessions.ts +6 -0
- package/src/web/server/services/branches.ts +11 -8
- package/src/web/server/services/worktrees.ts +2 -2
- package/src/worktree.ts +386 -114
- package/dist/cli/ui/components/App.d.ts +0 -25
- package/dist/cli/ui/components/App.d.ts.map +0 -1
- package/dist/cli/ui/components/App.js +0 -1006
- package/dist/cli/ui/components/App.js.map +0 -1
- package/dist/cli/ui/components/common/Confirm.d.ts +0 -13
- package/dist/cli/ui/components/common/Confirm.d.ts.map +0 -1
- package/dist/cli/ui/components/common/Confirm.js +0 -20
- package/dist/cli/ui/components/common/Confirm.js.map +0 -1
- package/dist/cli/ui/components/common/ErrorBoundary.d.ts +0 -23
- package/dist/cli/ui/components/common/ErrorBoundary.d.ts.map +0 -1
- package/dist/cli/ui/components/common/ErrorBoundary.js +0 -37
- package/dist/cli/ui/components/common/ErrorBoundary.js.map +0 -1
- package/dist/cli/ui/components/common/Input.d.ts +0 -19
- package/dist/cli/ui/components/common/Input.d.ts.map +0 -1
- package/dist/cli/ui/components/common/Input.js +0 -22
- package/dist/cli/ui/components/common/Input.js.map +0 -1
- package/dist/cli/ui/components/common/LoadingIndicator.d.ts +0 -19
- package/dist/cli/ui/components/common/LoadingIndicator.d.ts.map +0 -1
- package/dist/cli/ui/components/common/LoadingIndicator.js +0 -61
- package/dist/cli/ui/components/common/LoadingIndicator.js.map +0 -1
- package/dist/cli/ui/components/common/Select.d.ts +0 -38
- package/dist/cli/ui/components/common/Select.d.ts.map +0 -1
- package/dist/cli/ui/components/common/Select.js +0 -151
- package/dist/cli/ui/components/common/Select.js.map +0 -1
- package/dist/cli/ui/components/common/SpinnerIcon.d.ts +0 -20
- package/dist/cli/ui/components/common/SpinnerIcon.d.ts.map +0 -1
- package/dist/cli/ui/components/common/SpinnerIcon.js +0 -61
- package/dist/cli/ui/components/common/SpinnerIcon.js.map +0 -1
- package/dist/cli/ui/components/parts/Footer.d.ts +0 -15
- package/dist/cli/ui/components/parts/Footer.d.ts.map +0 -1
- package/dist/cli/ui/components/parts/Footer.js +0 -20
- package/dist/cli/ui/components/parts/Footer.js.map +0 -1
- package/dist/cli/ui/components/parts/Header.d.ts.map +0 -1
- package/dist/cli/ui/components/parts/Header.js +0 -24
- package/dist/cli/ui/components/parts/Header.js.map +0 -1
- package/dist/cli/ui/components/parts/MergeStatusList.d.ts +0 -13
- package/dist/cli/ui/components/parts/MergeStatusList.d.ts.map +0 -1
- package/dist/cli/ui/components/parts/MergeStatusList.js +0 -52
- package/dist/cli/ui/components/parts/MergeStatusList.js.map +0 -1
- package/dist/cli/ui/components/parts/ProgressBar.d.ts +0 -13
- package/dist/cli/ui/components/parts/ProgressBar.d.ts.map +0 -1
- package/dist/cli/ui/components/parts/ProgressBar.js +0 -53
- package/dist/cli/ui/components/parts/ProgressBar.js.map +0 -1
- package/dist/cli/ui/components/parts/ScrollableList.d.ts +0 -12
- package/dist/cli/ui/components/parts/ScrollableList.d.ts.map +0 -1
- package/dist/cli/ui/components/parts/ScrollableList.js +0 -11
- package/dist/cli/ui/components/parts/ScrollableList.js.map +0 -1
- package/dist/cli/ui/components/parts/Stats.d.ts +0 -10
- package/dist/cli/ui/components/parts/Stats.d.ts.map +0 -1
- package/dist/cli/ui/components/parts/Stats.js +0 -55
- package/dist/cli/ui/components/parts/Stats.js.map +0 -1
- package/dist/cli/ui/components/screens/BatchMergeProgressScreen.d.ts +0 -17
- package/dist/cli/ui/components/screens/BatchMergeProgressScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/BatchMergeProgressScreen.js +0 -42
- package/dist/cli/ui/components/screens/BatchMergeProgressScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/BatchMergeResultScreen.d.ts +0 -17
- package/dist/cli/ui/components/screens/BatchMergeResultScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/BatchMergeResultScreen.js +0 -72
- package/dist/cli/ui/components/screens/BatchMergeResultScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/BranchCreatorScreen.d.ts +0 -18
- package/dist/cli/ui/components/screens/BranchCreatorScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/BranchCreatorScreen.js +0 -151
- package/dist/cli/ui/components/screens/BranchCreatorScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/BranchListScreen.d.ts +0 -60
- package/dist/cli/ui/components/screens/BranchListScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/BranchListScreen.js +0 -476
- package/dist/cli/ui/components/screens/BranchListScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.d.ts +0 -30
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.js +0 -148
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/CodingAgentSelectorScreen.d.ts +0 -27
- package/dist/cli/ui/components/screens/CodingAgentSelectorScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/CodingAgentSelectorScreen.js +0 -93
- package/dist/cli/ui/components/screens/CodingAgentSelectorScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/EnvironmentProfileScreen.d.ts +0 -19
- package/dist/cli/ui/components/screens/EnvironmentProfileScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/EnvironmentProfileScreen.js +0 -577
- package/dist/cli/ui/components/screens/EnvironmentProfileScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.d.ts +0 -45
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.js +0 -95
- package/dist/cli/ui/components/screens/ExecutionModeSelectorScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/LogDatePickerScreen.d.ts +0 -10
- package/dist/cli/ui/components/screens/LogDatePickerScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/LogDatePickerScreen.js +0 -44
- package/dist/cli/ui/components/screens/LogDatePickerScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/LogDetailScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/LogDetailScreen.js +0 -34
- package/dist/cli/ui/components/screens/LogDetailScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/LogListScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/LogListScreen.js +0 -107
- package/dist/cli/ui/components/screens/LogListScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/ModelSelectorScreen.d.ts +0 -24
- package/dist/cli/ui/components/screens/ModelSelectorScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/ModelSelectorScreen.js +0 -197
- package/dist/cli/ui/components/screens/ModelSelectorScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/PRCleanupScreen.d.ts +0 -29
- package/dist/cli/ui/components/screens/PRCleanupScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/PRCleanupScreen.js +0 -92
- package/dist/cli/ui/components/screens/PRCleanupScreen.js.map +0 -1
- package/dist/cli/ui/components/screens/SessionSelectorScreen.d.ts +0 -31
- package/dist/cli/ui/components/screens/SessionSelectorScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/SessionSelectorScreen.js +0 -67
- package/dist/cli/ui/components/screens/SessionSelectorScreen.js.map +0 -1
- package/dist/cli/ui/hooks/useAppInput.d.ts +0 -21
- package/dist/cli/ui/hooks/useAppInput.d.ts.map +0 -1
- package/dist/cli/ui/hooks/useAppInput.js +0 -138
- package/dist/cli/ui/hooks/useAppInput.js.map +0 -1
- package/dist/cli/ui/hooks/useBatchMerge.d.ts +0 -17
- package/dist/cli/ui/hooks/useBatchMerge.d.ts.map +0 -1
- package/dist/cli/ui/hooks/useBatchMerge.js +0 -77
- package/dist/cli/ui/hooks/useBatchMerge.js.map +0 -1
- package/dist/cli/ui/hooks/useGitData.d.ts +0 -21
- package/dist/cli/ui/hooks/useGitData.d.ts.map +0 -1
- package/dist/cli/ui/hooks/useGitData.js +0 -229
- package/dist/cli/ui/hooks/useGitData.js.map +0 -1
- package/dist/cli/ui/hooks/useProfiles.d.ts +0 -41
- package/dist/cli/ui/hooks/useProfiles.d.ts.map +0 -1
- package/dist/cli/ui/hooks/useProfiles.js +0 -136
- package/dist/cli/ui/hooks/useProfiles.js.map +0 -1
- package/dist/cli/ui/hooks/useScreenState.d.ts +0 -12
- package/dist/cli/ui/hooks/useScreenState.d.ts.map +0 -1
- package/dist/cli/ui/hooks/useScreenState.js +0 -30
- package/dist/cli/ui/hooks/useScreenState.js.map +0 -1
- package/dist/cli/ui/hooks/useTerminalSize.d.ts +0 -9
- package/dist/cli/ui/hooks/useTerminalSize.d.ts.map +0 -1
- package/dist/cli/ui/hooks/useTerminalSize.js +0 -24
- package/dist/cli/ui/hooks/useTerminalSize.js.map +0 -1
- package/dist/cli/ui/hooks/useToolStatus.d.ts +0 -30
- package/dist/cli/ui/hooks/useToolStatus.d.ts.map +0 -1
- package/dist/cli/ui/hooks/useToolStatus.js +0 -49
- package/dist/cli/ui/hooks/useToolStatus.js.map +0 -1
- package/dist/cli/ui/screens/BranchActionSelectorScreen.d.ts +0 -24
- package/dist/cli/ui/screens/BranchActionSelectorScreen.d.ts.map +0 -1
- package/dist/cli/ui/screens/BranchActionSelectorScreen.js +0 -65
- package/dist/cli/ui/screens/BranchActionSelectorScreen.js.map +0 -1
- package/dist/client/assets/index-LNPtOrn3.js +0 -78
- package/src/cli/ui/__tests__/SKIPPED_TESTS.md +0 -119
- package/src/cli/ui/__tests__/acceptance/branchList.acceptance.test.tsx.skip +0 -239
- package/src/cli/ui/__tests__/acceptance/navigation.acceptance.test.tsx +0 -225
- package/src/cli/ui/__tests__/acceptance/realtimeUpdate.acceptance.test.tsx.skip +0 -219
- package/src/cli/ui/__tests__/components/App.protected-branch.test.tsx +0 -212
- package/src/cli/ui/__tests__/components/App.shortcuts.test.tsx +0 -440
- package/src/cli/ui/__tests__/components/App.test.tsx +0 -365
- package/src/cli/ui/__tests__/components/ModelSelectorScreen.initial.test.tsx +0 -91
- package/src/cli/ui/__tests__/components/common/Confirm.test.tsx +0 -80
- package/src/cli/ui/__tests__/components/common/ErrorBoundary.test.tsx +0 -104
- package/src/cli/ui/__tests__/components/common/Input.test.tsx +0 -100
- package/src/cli/ui/__tests__/components/common/LoadingIndicator.test.tsx +0 -148
- package/src/cli/ui/__tests__/components/common/Select.memo.test.tsx +0 -255
- package/src/cli/ui/__tests__/components/common/Select.test.tsx +0 -335
- package/src/cli/ui/__tests__/components/parts/Footer.test.tsx +0 -65
- package/src/cli/ui/__tests__/components/parts/Header.test.tsx +0 -55
- package/src/cli/ui/__tests__/components/parts/ScrollableList.test.tsx +0 -69
- package/src/cli/ui/__tests__/components/parts/Stats.test.tsx +0 -148
- package/src/cli/ui/__tests__/components/screens/BranchCreatorScreen.test.tsx +0 -253
- package/src/cli/ui/__tests__/components/screens/BranchListScreen.test.tsx +0 -1070
- package/src/cli/ui/__tests__/components/screens/BranchQuickStartScreen.test.tsx +0 -142
- package/src/cli/ui/__tests__/components/screens/CodingAgentSelectorScreen.test.tsx +0 -174
- package/src/cli/ui/__tests__/components/screens/ExecutionModeSelectorScreen.test.tsx +0 -182
- package/src/cli/ui/__tests__/components/screens/LogDetailScreen.test.tsx +0 -57
- package/src/cli/ui/__tests__/components/screens/LogListScreen.test.tsx +0 -102
- package/src/cli/ui/__tests__/components/screens/PRCleanupScreen.test.tsx +0 -216
- package/src/cli/ui/__tests__/components/screens/SessionSelectorScreen.test.tsx +0 -147
- package/src/cli/ui/__tests__/hooks/useGitData.nonblocking.test.tsx +0 -206
- package/src/cli/ui/__tests__/hooks/useGitData.test.ts +0 -197
- package/src/cli/ui/__tests__/hooks/useGitData.test.ts.skip +0 -228
- package/src/cli/ui/__tests__/hooks/useScreenState.test.ts +0 -147
- package/src/cli/ui/__tests__/hooks/useTerminalSize.test.ts +0 -99
- package/src/cli/ui/__tests__/integration/branchList.test.tsx.skip +0 -253
- package/src/cli/ui/__tests__/integration/edgeCases.test.tsx +0 -436
- package/src/cli/ui/__tests__/integration/navigation.test.tsx +0 -514
- package/src/cli/ui/__tests__/integration/realtimeUpdate.test.tsx +0 -509
- package/src/cli/ui/__tests__/integration/realtimeUpdate.test.tsx.skip +0 -216
- package/src/cli/ui/__tests__/performance/branchList.performance.test.tsx +0 -193
- package/src/cli/ui/__tests__/performance/useMemoOptimization.test.tsx +0 -234
- package/src/cli/ui/components/App.tsx +0 -1478
- package/src/cli/ui/components/common/Confirm.tsx +0 -44
- package/src/cli/ui/components/common/ErrorBoundary.tsx +0 -60
- package/src/cli/ui/components/common/Input.tsx +0 -58
- package/src/cli/ui/components/common/LoadingIndicator.tsx +0 -98
- package/src/cli/ui/components/common/Select.tsx +0 -247
- package/src/cli/ui/components/common/SpinnerIcon.tsx +0 -86
- package/src/cli/ui/components/parts/Footer.tsx +0 -41
- package/src/cli/ui/components/parts/Header.test.tsx +0 -75
- package/src/cli/ui/components/parts/MergeStatusList.tsx +0 -75
- package/src/cli/ui/components/parts/ProgressBar.tsx +0 -73
- package/src/cli/ui/components/parts/Stats.tsx +0 -88
- package/src/cli/ui/components/screens/BatchMergeProgressScreen.tsx +0 -74
- package/src/cli/ui/components/screens/BatchMergeResultScreen.tsx +0 -108
- package/src/cli/ui/components/screens/BranchCreatorScreen.tsx +0 -242
- package/src/cli/ui/components/screens/BranchListScreen.tsx +0 -744
- package/src/cli/ui/components/screens/BranchQuickStartScreen.tsx +0 -244
- package/src/cli/ui/components/screens/CodingAgentSelectorScreen.tsx +0 -159
- package/src/cli/ui/components/screens/EnvironmentProfileScreen.tsx +0 -928
- package/src/cli/ui/components/screens/ExecutionModeSelectorScreen.tsx +0 -176
- package/src/cli/ui/components/screens/LogDatePickerScreen.tsx +0 -83
- package/src/cli/ui/components/screens/LogDetailScreen.tsx +0 -67
- package/src/cli/ui/components/screens/LogListScreen.tsx +0 -192
- package/src/cli/ui/components/screens/ModelSelectorScreen.tsx +0 -320
- package/src/cli/ui/components/screens/PRCleanupScreen.tsx +0 -171
- package/src/cli/ui/components/screens/SessionSelectorScreen.tsx +0 -135
- package/src/cli/ui/hooks/useAppInput.ts +0 -172
- package/src/cli/ui/hooks/useBatchMerge.ts +0 -96
- package/src/cli/ui/hooks/useGitData.ts +0 -347
- package/src/cli/ui/hooks/useProfiles.ts +0 -211
- package/src/cli/ui/hooks/useScreenState.ts +0 -44
- package/src/cli/ui/hooks/useTerminalSize.ts +0 -33
- package/src/cli/ui/hooks/useToolStatus.ts +0 -68
- package/src/cli/ui/screens/BranchActionSelectorScreen.tsx +0 -111
- package/src/cli/ui/screens/__tests__/BranchActionSelectorScreen.test.tsx +0 -264
|
@@ -1,1006 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
2
|
-
import { useApp } from "ink";
|
|
3
|
-
import { ErrorBoundary } from "./common/ErrorBoundary.js";
|
|
4
|
-
import { BranchListScreen, } from "./screens/BranchListScreen.js";
|
|
5
|
-
import { LogListScreen } from "./screens/LogListScreen.js";
|
|
6
|
-
import { LogDetailScreen } from "./screens/LogDetailScreen.js";
|
|
7
|
-
import { LogDatePickerScreen } from "./screens/LogDatePickerScreen.js";
|
|
8
|
-
import { BranchCreatorScreen } from "./screens/BranchCreatorScreen.js";
|
|
9
|
-
import { BranchActionSelectorScreen } from "../screens/BranchActionSelectorScreen.js";
|
|
10
|
-
import { CodingAgentSelectorScreen } from "./screens/CodingAgentSelectorScreen.js";
|
|
11
|
-
import { ExecutionModeSelectorScreen } from "./screens/ExecutionModeSelectorScreen.js";
|
|
12
|
-
import { BranchQuickStartScreen } from "./screens/BranchQuickStartScreen.js";
|
|
13
|
-
import { ModelSelectorScreen, } from "./screens/ModelSelectorScreen.js";
|
|
14
|
-
import { EnvironmentProfileScreen } from "./screens/EnvironmentProfileScreen.js";
|
|
15
|
-
import { useGitData } from "../hooks/useGitData.js";
|
|
16
|
-
import { useProfiles } from "../hooks/useProfiles.js";
|
|
17
|
-
import { useScreenState } from "../hooks/useScreenState.js";
|
|
18
|
-
import { useToolStatus } from "../hooks/useToolStatus.js";
|
|
19
|
-
import { formatBranchItems } from "../utils/branchFormatter.js";
|
|
20
|
-
import { calculateStatistics } from "../utils/statisticsCalculator.js";
|
|
21
|
-
import { copyToClipboard } from "../utils/clipboard.js";
|
|
22
|
-
import { parseLogLines, } from "../../../logging/formatter.js";
|
|
23
|
-
import { buildLogFilePath, getTodayLogDate, listRecentLogFiles, readLogFileLines, resolveLogDir, } from "../../../logging/reader.js";
|
|
24
|
-
import { getRepositoryRoot, deleteBranch } from "../../../git.js";
|
|
25
|
-
import { loadSession } from "../../../config/index.js";
|
|
26
|
-
import { createWorktree, generateWorktreePath, isProtectedBranchName, removeWorktree, switchToProtectedBranch, } from "../../../worktree.js";
|
|
27
|
-
import { getPackageVersion } from "../../../utils.js";
|
|
28
|
-
import { resolveBaseBranchLabel, resolveBaseBranchRef, } from "../utils/baseBranch.js";
|
|
29
|
-
import { getDefaultInferenceForModel, getDefaultModelOption, normalizeModelId, } from "../utils/modelOptions.js";
|
|
30
|
-
import { resolveContinueSessionId, findLatestBranchSessionsByTool, } from "../utils/continueSession.js";
|
|
31
|
-
import { findLatestCodexSession, findLatestCodexSessionId, findLatestClaudeSession, findLatestGeminiSession, findLatestOpenCodeSession, } from "../../../utils/session.js";
|
|
32
|
-
const COMPLETION_HOLD_DURATION_MS = 3000;
|
|
33
|
-
const PROTECTED_BRANCH_WARNING = "Root branches operate directly in the repository root. Create a new branch if you need a dedicated worktree.";
|
|
34
|
-
/**
|
|
35
|
-
* App - Top-level component for Ink.js UI
|
|
36
|
-
* Integrates ErrorBoundary, data fetching, screen navigation, and all screens
|
|
37
|
-
*/
|
|
38
|
-
export function App({ onExit, loadingIndicatorDelay = 300 }) {
|
|
39
|
-
const { exit } = useApp();
|
|
40
|
-
// 起動ディレクトリの取得
|
|
41
|
-
const workingDirectory = process.cwd();
|
|
42
|
-
const { branches, worktrees, loading, error, refresh, lastUpdated } = useGitData({
|
|
43
|
-
enableAutoRefresh: false, // Manual refresh with 'r' key
|
|
44
|
-
});
|
|
45
|
-
const { currentScreen, navigateTo, goBack } = useScreenState();
|
|
46
|
-
// Profile state
|
|
47
|
-
const { activeProfileName, refresh: refreshProfiles } = useProfiles();
|
|
48
|
-
// Tool status state (FR-017: 起動時に検出してキャッシュ)
|
|
49
|
-
const { tools: toolStatuses } = useToolStatus();
|
|
50
|
-
// Version state
|
|
51
|
-
const [version, setVersion] = useState(null);
|
|
52
|
-
const [repoRoot, setRepoRoot] = useState(null);
|
|
53
|
-
const [continueSessionId, setContinueSessionId] = useState(null);
|
|
54
|
-
const [branchQuickStart, setBranchQuickStart] = useState([]);
|
|
55
|
-
const [branchQuickStartLoading, setBranchQuickStartLoading] = useState(false);
|
|
56
|
-
// Log viewer state
|
|
57
|
-
const logDir = useMemo(() => resolveLogDir(workingDirectory), [workingDirectory]);
|
|
58
|
-
const [logEntries, setLogEntries] = useState([]);
|
|
59
|
-
const [logLoading, setLogLoading] = useState(false);
|
|
60
|
-
const [logError, setLogError] = useState(null);
|
|
61
|
-
const [logSelectedDate, setLogSelectedDate] = useState(getTodayLogDate());
|
|
62
|
-
const [logDates, setLogDates] = useState([]);
|
|
63
|
-
const [logSelectedEntry, setLogSelectedEntry] = useState(null);
|
|
64
|
-
const [logNotification, setLogNotification] = useState(null);
|
|
65
|
-
const logNotificationTimerRef = useRef(null);
|
|
66
|
-
// Selection state (for branch → tool → mode flow)
|
|
67
|
-
const [selectedBranch, setSelectedBranch] = useState(null);
|
|
68
|
-
const [creationSourceBranch, setCreationSourceBranch] = useState(null);
|
|
69
|
-
const [selectedTool, setSelectedTool] = useState(null);
|
|
70
|
-
const [selectedModel, setSelectedModel] = useState(null);
|
|
71
|
-
const [lastModelByTool, setLastModelByTool] = useState({});
|
|
72
|
-
const [preferredToolId, setPreferredToolId] = useState(null);
|
|
73
|
-
// PR cleanup feedback
|
|
74
|
-
const [cleanupIndicators, setCleanupIndicators] = useState({});
|
|
75
|
-
const [_cleanupProcessingBranch, setCleanupProcessingBranch] = useState(null);
|
|
76
|
-
const [cleanupInputLocked, setCleanupInputLocked] = useState(false);
|
|
77
|
-
const [cleanupFooterMessage, setCleanupFooterMessage] = useState(null);
|
|
78
|
-
const [hiddenBranches, setHiddenBranches] = useState([]);
|
|
79
|
-
const [selectedBranches, setSelectedBranches] = useState([]);
|
|
80
|
-
const completionTimerRef = useRef(null);
|
|
81
|
-
// Fetch version on mount
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
getPackageVersion()
|
|
84
|
-
.then(setVersion)
|
|
85
|
-
.catch(() => setVersion(null));
|
|
86
|
-
}, []);
|
|
87
|
-
// Fetch repository root once for session lookups
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
getRepositoryRoot()
|
|
90
|
-
.then(setRepoRoot)
|
|
91
|
-
.catch(() => setRepoRoot(null));
|
|
92
|
-
}, []);
|
|
93
|
-
const showLogNotification = useCallback((message, tone = "success") => {
|
|
94
|
-
setLogNotification({ message, tone });
|
|
95
|
-
if (logNotificationTimerRef.current) {
|
|
96
|
-
clearTimeout(logNotificationTimerRef.current);
|
|
97
|
-
}
|
|
98
|
-
logNotificationTimerRef.current = setTimeout(() => {
|
|
99
|
-
setLogNotification(null);
|
|
100
|
-
}, 2000);
|
|
101
|
-
}, []);
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
return () => {
|
|
104
|
-
if (logNotificationTimerRef.current) {
|
|
105
|
-
clearTimeout(logNotificationTimerRef.current);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}, []);
|
|
109
|
-
const loadLogEntries = useCallback(async (date) => {
|
|
110
|
-
const targetDate = date ?? getTodayLogDate();
|
|
111
|
-
setLogLoading(true);
|
|
112
|
-
setLogError(null);
|
|
113
|
-
try {
|
|
114
|
-
const filePath = buildLogFilePath(logDir, targetDate);
|
|
115
|
-
const lines = await readLogFileLines(filePath);
|
|
116
|
-
const parsed = parseLogLines(lines, { limit: 100 });
|
|
117
|
-
setLogEntries(parsed);
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
setLogEntries([]);
|
|
121
|
-
setLogError(error instanceof Error ? error.message : "Failed to load logs");
|
|
122
|
-
}
|
|
123
|
-
finally {
|
|
124
|
-
setLogLoading(false);
|
|
125
|
-
}
|
|
126
|
-
}, [logDir]);
|
|
127
|
-
const loadLogDates = useCallback(async () => {
|
|
128
|
-
try {
|
|
129
|
-
const files = await listRecentLogFiles(logDir, 7);
|
|
130
|
-
setLogDates(files);
|
|
131
|
-
}
|
|
132
|
-
catch {
|
|
133
|
-
setLogDates([]);
|
|
134
|
-
}
|
|
135
|
-
}, [logDir]);
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
if (currentScreen === "log-list") {
|
|
138
|
-
void loadLogEntries(logSelectedDate);
|
|
139
|
-
}
|
|
140
|
-
}, [currentScreen, loadLogEntries, logSelectedDate]);
|
|
141
|
-
useEffect(() => {
|
|
142
|
-
if (currentScreen === "log-date-picker") {
|
|
143
|
-
void loadLogDates();
|
|
144
|
-
}
|
|
145
|
-
}, [currentScreen, loadLogDates]);
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
if (!hiddenBranches.length) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const existing = new Set(branches.map((branch) => branch.name));
|
|
151
|
-
const filtered = hiddenBranches.filter((name) => existing.has(name));
|
|
152
|
-
if (filtered.length !== hiddenBranches.length) {
|
|
153
|
-
setHiddenBranches(filtered);
|
|
154
|
-
}
|
|
155
|
-
}, [branches, hiddenBranches]);
|
|
156
|
-
// Remove selections that no longer exist (hidden or disappeared)
|
|
157
|
-
useEffect(() => {
|
|
158
|
-
setSelectedBranches((prev) => prev.filter((name) => branches.some((b) => b.name === name) &&
|
|
159
|
-
!hiddenBranches.includes(name)));
|
|
160
|
-
}, [branches, hiddenBranches]);
|
|
161
|
-
// Load quick start options for selected branch (latest per tool)
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
if (!selectedBranch) {
|
|
164
|
-
setBranchQuickStart([]);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
let cancelled = false;
|
|
168
|
-
setBranchQuickStartLoading(true);
|
|
169
|
-
(async () => {
|
|
170
|
-
try {
|
|
171
|
-
const root = repoRoot ?? (await getRepositoryRoot());
|
|
172
|
-
if (!repoRoot && root) {
|
|
173
|
-
setRepoRoot(root);
|
|
174
|
-
}
|
|
175
|
-
if (!root) {
|
|
176
|
-
if (!cancelled)
|
|
177
|
-
setBranchQuickStart([]);
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const sessionData = await loadSession(root);
|
|
181
|
-
const history = sessionData?.history ?? [];
|
|
182
|
-
const combinedHistory = [...history];
|
|
183
|
-
if (sessionData?.lastSessionId &&
|
|
184
|
-
sessionData.lastBranch === selectedBranch.name &&
|
|
185
|
-
sessionData.lastUsedTool) {
|
|
186
|
-
const synthetic = {
|
|
187
|
-
branch: sessionData.lastBranch,
|
|
188
|
-
worktreePath: sessionData.lastWorktreePath ?? null,
|
|
189
|
-
toolId: sessionData.lastUsedTool,
|
|
190
|
-
toolLabel: sessionData.toolLabel ?? sessionData.lastUsedTool,
|
|
191
|
-
sessionId: sessionData.lastSessionId,
|
|
192
|
-
mode: sessionData.mode ?? null,
|
|
193
|
-
model: sessionData.model ?? null,
|
|
194
|
-
reasoningLevel: sessionData.reasoningLevel ?? null,
|
|
195
|
-
skipPermissions: sessionData.skipPermissions ?? null,
|
|
196
|
-
timestamp: sessionData.timestamp ?? Date.now(),
|
|
197
|
-
};
|
|
198
|
-
combinedHistory.push(synthetic);
|
|
199
|
-
}
|
|
200
|
-
const latestPerTool = findLatestBranchSessionsByTool(combinedHistory, selectedBranch.name, selectedWorktreePath);
|
|
201
|
-
const mapped = await Promise.all(latestPerTool.map(async (entry) => {
|
|
202
|
-
let sessionId = entry.sessionId ?? null;
|
|
203
|
-
const worktree = selectedWorktreePath ?? workingDirectory;
|
|
204
|
-
// For Codex, prefer a newer filesystem session over stale history
|
|
205
|
-
if (!sessionId && entry.toolId === "codex-cli") {
|
|
206
|
-
try {
|
|
207
|
-
const historyTs = entry.timestamp ?? null;
|
|
208
|
-
const latestCodex = await findLatestCodexSession({
|
|
209
|
-
...(historyTs
|
|
210
|
-
? {
|
|
211
|
-
since: historyTs - 60_000,
|
|
212
|
-
preferClosestTo: historyTs,
|
|
213
|
-
windowMs: 60 * 60 * 1000,
|
|
214
|
-
}
|
|
215
|
-
: {}),
|
|
216
|
-
cwd: worktree,
|
|
217
|
-
});
|
|
218
|
-
sessionId =
|
|
219
|
-
latestCodex?.id ??
|
|
220
|
-
(await findLatestCodexSessionId({ cwd: worktree })) ??
|
|
221
|
-
null;
|
|
222
|
-
}
|
|
223
|
-
catch {
|
|
224
|
-
// ignore lookup failure
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
// For Claude Code, prefer the newest session file in the worktree even if history is stale.
|
|
228
|
-
if (!sessionId && entry.toolId === "claude-code") {
|
|
229
|
-
try {
|
|
230
|
-
// Always resolve freshest on-disk session for this worktree (no window restriction)
|
|
231
|
-
const latestAny = await findLatestClaudeSession(worktree);
|
|
232
|
-
sessionId = latestAny?.id ?? null;
|
|
233
|
-
}
|
|
234
|
-
catch {
|
|
235
|
-
// ignore lookup failure
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
// For Gemini, prefer newest session file (Gemini keeps per-project chats)
|
|
239
|
-
if (!sessionId && entry.toolId === "gemini-cli") {
|
|
240
|
-
try {
|
|
241
|
-
const gemOptions = {
|
|
242
|
-
windowMs: 60 * 60 * 1000,
|
|
243
|
-
cwd: worktree,
|
|
244
|
-
};
|
|
245
|
-
if (entry.timestamp !== null && entry.timestamp !== undefined) {
|
|
246
|
-
gemOptions.since = entry.timestamp - 60_000;
|
|
247
|
-
gemOptions.preferClosestTo = entry.timestamp;
|
|
248
|
-
}
|
|
249
|
-
const gemSession = await findLatestGeminiSession(gemOptions);
|
|
250
|
-
sessionId = gemSession?.id ?? null;
|
|
251
|
-
}
|
|
252
|
-
catch {
|
|
253
|
-
// ignore
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
// For OpenCode, prefer newest session file
|
|
257
|
-
if (!sessionId && entry.toolId === "opencode") {
|
|
258
|
-
try {
|
|
259
|
-
const openCodeOptions = {
|
|
260
|
-
windowMs: 60 * 60 * 1000,
|
|
261
|
-
cwd: worktree,
|
|
262
|
-
};
|
|
263
|
-
if (entry.timestamp !== null && entry.timestamp !== undefined) {
|
|
264
|
-
openCodeOptions.since = entry.timestamp - 60_000;
|
|
265
|
-
openCodeOptions.preferClosestTo = entry.timestamp;
|
|
266
|
-
}
|
|
267
|
-
const openCodeSession = await findLatestOpenCodeSession(openCodeOptions);
|
|
268
|
-
sessionId = openCodeSession?.id ?? null;
|
|
269
|
-
}
|
|
270
|
-
catch {
|
|
271
|
-
// ignore
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
const normalizedModel = normalizeModelId(entry.toolId, entry.model ?? null);
|
|
275
|
-
return {
|
|
276
|
-
toolId: entry.toolId,
|
|
277
|
-
toolLabel: entry.toolLabel,
|
|
278
|
-
model: normalizedModel ?? null,
|
|
279
|
-
inferenceLevel: (entry.reasoningLevel ??
|
|
280
|
-
sessionData?.reasoningLevel ??
|
|
281
|
-
null),
|
|
282
|
-
sessionId,
|
|
283
|
-
skipPermissions: entry.skipPermissions ?? sessionData?.skipPermissions ?? null,
|
|
284
|
-
timestamp: entry.timestamp ?? null,
|
|
285
|
-
};
|
|
286
|
-
}));
|
|
287
|
-
if (!cancelled) {
|
|
288
|
-
setBranchQuickStart(mapped);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
catch {
|
|
292
|
-
if (!cancelled)
|
|
293
|
-
setBranchQuickStart([]);
|
|
294
|
-
}
|
|
295
|
-
finally {
|
|
296
|
-
if (!cancelled)
|
|
297
|
-
setBranchQuickStartLoading(false);
|
|
298
|
-
}
|
|
299
|
-
})();
|
|
300
|
-
return () => {
|
|
301
|
-
cancelled = true;
|
|
302
|
-
};
|
|
303
|
-
}, [selectedBranch, repoRoot]);
|
|
304
|
-
// Load last session ID for "Continue" label when entering execution mode selector
|
|
305
|
-
useEffect(() => {
|
|
306
|
-
if (currentScreen !== "execution-mode-selector") {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
if (!selectedTool || !selectedBranch) {
|
|
310
|
-
setContinueSessionId(null);
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
(async () => {
|
|
314
|
-
try {
|
|
315
|
-
const root = repoRoot ?? (await getRepositoryRoot());
|
|
316
|
-
if (!repoRoot && root) {
|
|
317
|
-
setRepoRoot(root);
|
|
318
|
-
}
|
|
319
|
-
const sessionData = root ? await loadSession(root) : null;
|
|
320
|
-
const history = sessionData?.history ?? [];
|
|
321
|
-
const found = await resolveContinueSessionId({
|
|
322
|
-
history,
|
|
323
|
-
sessionData,
|
|
324
|
-
branch: selectedBranch.name,
|
|
325
|
-
toolId: selectedTool,
|
|
326
|
-
repoRoot: root,
|
|
327
|
-
});
|
|
328
|
-
setContinueSessionId(found ?? null);
|
|
329
|
-
}
|
|
330
|
-
catch {
|
|
331
|
-
setContinueSessionId(null);
|
|
332
|
-
}
|
|
333
|
-
})();
|
|
334
|
-
}, [currentScreen, selectedTool, selectedBranch, repoRoot]);
|
|
335
|
-
// Update preferred tool when branch or data changes
|
|
336
|
-
useEffect(() => {
|
|
337
|
-
if (!selectedBranch)
|
|
338
|
-
return;
|
|
339
|
-
const branchMatch = branches.find((b) => b.name === selectedBranch.name) ||
|
|
340
|
-
branches.find((b) => selectedBranch.branchType === "remote" &&
|
|
341
|
-
b.name === selectedBranch.displayName);
|
|
342
|
-
setPreferredToolId(branchMatch?.lastToolUsage?.toolId ?? null);
|
|
343
|
-
}, [branches, selectedBranch]);
|
|
344
|
-
useEffect(() => () => {
|
|
345
|
-
if (completionTimerRef.current) {
|
|
346
|
-
clearTimeout(completionTimerRef.current);
|
|
347
|
-
completionTimerRef.current = null;
|
|
348
|
-
}
|
|
349
|
-
}, []);
|
|
350
|
-
const visibleBranches = useMemo(() => branches.filter((branch) => !hiddenBranches.includes(branch.name)), [branches, hiddenBranches]);
|
|
351
|
-
const selectedWorktreePath = useMemo(() => {
|
|
352
|
-
if (!selectedBranch)
|
|
353
|
-
return null;
|
|
354
|
-
const wt = worktrees.find((w) => w.branch === selectedBranch.name);
|
|
355
|
-
return wt?.path ?? null;
|
|
356
|
-
}, [selectedBranch, worktrees]);
|
|
357
|
-
// Helper function to create content-based hash for branches
|
|
358
|
-
const branchHash = useMemo(() => visibleBranches
|
|
359
|
-
.map((b) => `${b.name}-${b.type}-${b.isCurrent}`)
|
|
360
|
-
.join(","), [visibleBranches]);
|
|
361
|
-
// Helper function to create content-based hash for worktrees
|
|
362
|
-
const worktreeHash = useMemo(() => worktrees.map((w) => `${w.branch}-${w.path}`).join(","), [worktrees]);
|
|
363
|
-
// Format branches to BranchItems (memoized for performance with content-based dependencies)
|
|
364
|
-
const branchItems = useMemo(() => {
|
|
365
|
-
// Build worktreeMap for sorting
|
|
366
|
-
const worktreeMap = new Map();
|
|
367
|
-
for (const wt of worktrees) {
|
|
368
|
-
worktreeMap.set(wt.branch, {
|
|
369
|
-
path: wt.path,
|
|
370
|
-
locked: false,
|
|
371
|
-
prunable: wt.isAccessible === false,
|
|
372
|
-
isAccessible: wt.isAccessible ?? true,
|
|
373
|
-
...(wt.hasUncommittedChanges !== undefined
|
|
374
|
-
? { hasUncommittedChanges: wt.hasUncommittedChanges }
|
|
375
|
-
: {}),
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
const baseItems = formatBranchItems(visibleBranches, worktreeMap);
|
|
379
|
-
return baseItems.map((item) => {
|
|
380
|
-
const hasUncommitted = item.worktree?.hasUncommittedChanges ?? false;
|
|
381
|
-
const hasUnpushed = Boolean(item.hasUnpushedCommits);
|
|
382
|
-
const isMerged = Boolean(item.mergedPR);
|
|
383
|
-
const safeToCleanup = item.type === "local" && isMerged && !hasUncommitted && !hasUnpushed;
|
|
384
|
-
return { ...item, safeToCleanup };
|
|
385
|
-
});
|
|
386
|
-
}, [branchHash, worktreeHash, visibleBranches, worktrees]);
|
|
387
|
-
// Calculate statistics (memoized for performance)
|
|
388
|
-
const stats = useMemo(() => calculateStatistics(visibleBranches), [visibleBranches]);
|
|
389
|
-
const resolveBaseBranch = useCallback(() => {
|
|
390
|
-
const localMain = branches.find((branch) => branch.type === "local" &&
|
|
391
|
-
(branch.name === "main" || branch.name === "master"));
|
|
392
|
-
if (localMain) {
|
|
393
|
-
return localMain.name;
|
|
394
|
-
}
|
|
395
|
-
const develop = branches.find((branch) => branch.type === "local" &&
|
|
396
|
-
(branch.name === "develop" || branch.name === "dev"));
|
|
397
|
-
if (develop) {
|
|
398
|
-
return develop.name;
|
|
399
|
-
}
|
|
400
|
-
return "main";
|
|
401
|
-
}, [branches]);
|
|
402
|
-
const baseBranchLabel = useMemo(() => resolveBaseBranchLabel(creationSourceBranch, selectedBranch, resolveBaseBranch), [creationSourceBranch, resolveBaseBranch, selectedBranch]);
|
|
403
|
-
// Handle branch selection
|
|
404
|
-
const toLocalBranchName = useCallback((remoteName) => {
|
|
405
|
-
const segments = remoteName.split("/");
|
|
406
|
-
if (segments.length <= 1) {
|
|
407
|
-
return remoteName;
|
|
408
|
-
}
|
|
409
|
-
return segments.slice(1).join("/");
|
|
410
|
-
}, []);
|
|
411
|
-
const inferBranchCategory = useCallback((branchName) => {
|
|
412
|
-
const matched = branches.find((branch) => branch.name === branchName);
|
|
413
|
-
if (matched) {
|
|
414
|
-
return matched.branchType;
|
|
415
|
-
}
|
|
416
|
-
if (branchName === "main" || branchName === "master") {
|
|
417
|
-
return "main";
|
|
418
|
-
}
|
|
419
|
-
if (branchName === "develop" || branchName === "dev") {
|
|
420
|
-
return "develop";
|
|
421
|
-
}
|
|
422
|
-
if (branchName.startsWith("feature/")) {
|
|
423
|
-
return "feature";
|
|
424
|
-
}
|
|
425
|
-
if (branchName.startsWith("hotfix/")) {
|
|
426
|
-
return "hotfix";
|
|
427
|
-
}
|
|
428
|
-
if (branchName.startsWith("release/")) {
|
|
429
|
-
return "release";
|
|
430
|
-
}
|
|
431
|
-
return "other";
|
|
432
|
-
}, [branches]);
|
|
433
|
-
const isProtectedSelection = useCallback((branch) => {
|
|
434
|
-
if (!branch) {
|
|
435
|
-
return false;
|
|
436
|
-
}
|
|
437
|
-
return (isProtectedBranchName(branch.name) ||
|
|
438
|
-
isProtectedBranchName(branch.displayName) ||
|
|
439
|
-
(branch.remoteBranch
|
|
440
|
-
? isProtectedBranchName(branch.remoteBranch)
|
|
441
|
-
: false) ||
|
|
442
|
-
branch.branchCategory === "main" ||
|
|
443
|
-
branch.branchCategory === "develop");
|
|
444
|
-
}, [isProtectedBranchName]);
|
|
445
|
-
const toggleBranchSelection = useCallback((branchName) => {
|
|
446
|
-
const branch = branches.find((b) => b.name === branchName);
|
|
447
|
-
if (!branch || branch.type === "remote") {
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
if (isProtectedBranchName(branch.name) ||
|
|
451
|
-
branch.branchType === "main" ||
|
|
452
|
-
branch.branchType === "develop") {
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
setSelectedBranches((prev) => {
|
|
456
|
-
const set = new Set(prev);
|
|
457
|
-
if (set.has(branchName)) {
|
|
458
|
-
set.delete(branchName);
|
|
459
|
-
}
|
|
460
|
-
else {
|
|
461
|
-
set.add(branchName);
|
|
462
|
-
}
|
|
463
|
-
return Array.from(set);
|
|
464
|
-
});
|
|
465
|
-
}, [branches, isProtectedBranchName]);
|
|
466
|
-
const protectedBranchInfo = useMemo(() => {
|
|
467
|
-
if (!selectedBranch) {
|
|
468
|
-
return null;
|
|
469
|
-
}
|
|
470
|
-
if (!isProtectedSelection(selectedBranch)) {
|
|
471
|
-
return null;
|
|
472
|
-
}
|
|
473
|
-
const label = selectedBranch.displayName ?? selectedBranch.name;
|
|
474
|
-
return {
|
|
475
|
-
label,
|
|
476
|
-
message: `${label} is a root branch. Switch within the repository root instead of creating a worktree.`,
|
|
477
|
-
};
|
|
478
|
-
}, [selectedBranch, isProtectedSelection]);
|
|
479
|
-
const handleSelect = useCallback((item) => {
|
|
480
|
-
const selection = item.type === "remote"
|
|
481
|
-
? {
|
|
482
|
-
name: toLocalBranchName(item.name),
|
|
483
|
-
displayName: item.name,
|
|
484
|
-
branchType: "remote",
|
|
485
|
-
branchCategory: item.branchType,
|
|
486
|
-
remoteBranch: item.name,
|
|
487
|
-
}
|
|
488
|
-
: {
|
|
489
|
-
name: item.name,
|
|
490
|
-
displayName: item.name,
|
|
491
|
-
branchType: "local",
|
|
492
|
-
branchCategory: item.branchType,
|
|
493
|
-
};
|
|
494
|
-
const protectedSelected = isProtectedSelection(selection);
|
|
495
|
-
setSelectedBranch(selection);
|
|
496
|
-
setSelectedTool(null);
|
|
497
|
-
setSelectedModel(null);
|
|
498
|
-
setCreationSourceBranch(null);
|
|
499
|
-
setPreferredToolId(item.lastToolUsage?.toolId ?? null);
|
|
500
|
-
if (protectedSelected) {
|
|
501
|
-
setCleanupFooterMessage({
|
|
502
|
-
text: PROTECTED_BRANCH_WARNING,
|
|
503
|
-
color: "yellow",
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
else {
|
|
507
|
-
setCleanupFooterMessage(null);
|
|
508
|
-
}
|
|
509
|
-
navigateTo("branch-action-selector");
|
|
510
|
-
}, [
|
|
511
|
-
isProtectedSelection,
|
|
512
|
-
navigateTo,
|
|
513
|
-
setCleanupFooterMessage,
|
|
514
|
-
setCreationSourceBranch,
|
|
515
|
-
setSelectedTool,
|
|
516
|
-
toLocalBranchName,
|
|
517
|
-
]);
|
|
518
|
-
// Handle branch action selection
|
|
519
|
-
const handleProtectedBranchSwitch = useCallback(async () => {
|
|
520
|
-
if (!selectedBranch) {
|
|
521
|
-
return;
|
|
522
|
-
}
|
|
523
|
-
try {
|
|
524
|
-
setCleanupFooterMessage({
|
|
525
|
-
text: `Preparing root branch '${selectedBranch.displayName ?? selectedBranch.name}'...`,
|
|
526
|
-
color: "cyan",
|
|
527
|
-
});
|
|
528
|
-
const repoRoot = await getRepositoryRoot();
|
|
529
|
-
const remoteRef = selectedBranch.remoteBranch ??
|
|
530
|
-
(selectedBranch.branchType === "remote"
|
|
531
|
-
? (selectedBranch.displayName ?? selectedBranch.name)
|
|
532
|
-
: null);
|
|
533
|
-
const result = await switchToProtectedBranch({
|
|
534
|
-
branchName: selectedBranch.name,
|
|
535
|
-
repoRoot,
|
|
536
|
-
remoteRef: remoteRef ?? null,
|
|
537
|
-
});
|
|
538
|
-
let successMessage = `'${selectedBranch.displayName ?? selectedBranch.name}' will use the repository root.`;
|
|
539
|
-
if (result === "remote") {
|
|
540
|
-
successMessage = `Created a local tracking branch for '${selectedBranch.displayName ?? selectedBranch.name}' and switched to the protected branch.`;
|
|
541
|
-
}
|
|
542
|
-
else if (result === "local") {
|
|
543
|
-
successMessage = `Checked out '${selectedBranch.displayName ?? selectedBranch.name}' in the repository root.`;
|
|
544
|
-
}
|
|
545
|
-
setCleanupFooterMessage({
|
|
546
|
-
text: successMessage,
|
|
547
|
-
color: "green",
|
|
548
|
-
});
|
|
549
|
-
refresh();
|
|
550
|
-
const nextScreen = branchQuickStart.length || branchQuickStartLoading
|
|
551
|
-
? "branch-quick-start"
|
|
552
|
-
: "coding-agent-selector";
|
|
553
|
-
navigateTo(nextScreen);
|
|
554
|
-
}
|
|
555
|
-
catch (error) {
|
|
556
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
557
|
-
setCleanupFooterMessage({
|
|
558
|
-
text: `Failed to switch root branch: ${message}`,
|
|
559
|
-
color: "red",
|
|
560
|
-
});
|
|
561
|
-
console.error("Failed to switch protected branch:", error);
|
|
562
|
-
}
|
|
563
|
-
}, [
|
|
564
|
-
branchQuickStart,
|
|
565
|
-
branchQuickStartLoading,
|
|
566
|
-
navigateTo,
|
|
567
|
-
refresh,
|
|
568
|
-
selectedBranch,
|
|
569
|
-
setCleanupFooterMessage,
|
|
570
|
-
]);
|
|
571
|
-
const handleUseExistingBranch = useCallback(() => {
|
|
572
|
-
if (selectedBranch && isProtectedSelection(selectedBranch)) {
|
|
573
|
-
void handleProtectedBranchSwitch();
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
if (branchQuickStart.length) {
|
|
577
|
-
navigateTo("branch-quick-start");
|
|
578
|
-
}
|
|
579
|
-
else {
|
|
580
|
-
navigateTo("coding-agent-selector");
|
|
581
|
-
}
|
|
582
|
-
}, [
|
|
583
|
-
handleProtectedBranchSwitch,
|
|
584
|
-
isProtectedSelection,
|
|
585
|
-
navigateTo,
|
|
586
|
-
branchQuickStart.length,
|
|
587
|
-
selectedBranch,
|
|
588
|
-
]);
|
|
589
|
-
const handleCreateNewBranch = useCallback(() => {
|
|
590
|
-
setCreationSourceBranch(selectedBranch);
|
|
591
|
-
navigateTo("branch-creator");
|
|
592
|
-
}, [navigateTo, selectedBranch]);
|
|
593
|
-
// Handle quit
|
|
594
|
-
const handleQuit = useCallback(() => {
|
|
595
|
-
onExit();
|
|
596
|
-
exit();
|
|
597
|
-
}, [onExit, exit]);
|
|
598
|
-
const handleOpenLogs = useCallback(() => {
|
|
599
|
-
setLogSelectedDate(getTodayLogDate());
|
|
600
|
-
setLogSelectedEntry(null);
|
|
601
|
-
navigateTo("log-list");
|
|
602
|
-
}, [navigateTo]);
|
|
603
|
-
const handleSelectLogEntry = useCallback((entry) => {
|
|
604
|
-
setLogSelectedEntry(entry);
|
|
605
|
-
navigateTo("log-detail");
|
|
606
|
-
}, [navigateTo]);
|
|
607
|
-
const handleCopyLogEntry = useCallback(async (entry) => {
|
|
608
|
-
try {
|
|
609
|
-
await copyToClipboard(entry.json);
|
|
610
|
-
showLogNotification("Copied to clipboard.", "success");
|
|
611
|
-
}
|
|
612
|
-
catch {
|
|
613
|
-
showLogNotification("Failed to copy to clipboard.", "error");
|
|
614
|
-
}
|
|
615
|
-
}, [showLogNotification]);
|
|
616
|
-
const handleOpenLogDates = useCallback(() => {
|
|
617
|
-
navigateTo("log-date-picker");
|
|
618
|
-
}, [navigateTo]);
|
|
619
|
-
const handleSelectLogDate = useCallback((date) => {
|
|
620
|
-
setLogSelectedDate(date);
|
|
621
|
-
setLogSelectedEntry(null);
|
|
622
|
-
navigateTo("log-list");
|
|
623
|
-
}, [navigateTo]);
|
|
624
|
-
// Handle branch creation
|
|
625
|
-
const handleCreate = useCallback(async (branchName) => {
|
|
626
|
-
try {
|
|
627
|
-
const repoRoot = await getRepositoryRoot();
|
|
628
|
-
const worktreePath = await generateWorktreePath(repoRoot, branchName);
|
|
629
|
-
// Use selectedBranch as base if available, otherwise resolve from repo
|
|
630
|
-
const baseBranch = resolveBaseBranchRef(creationSourceBranch, selectedBranch, resolveBaseBranch);
|
|
631
|
-
await createWorktree({
|
|
632
|
-
branchName,
|
|
633
|
-
worktreePath,
|
|
634
|
-
repoRoot,
|
|
635
|
-
isNewBranch: true,
|
|
636
|
-
baseBranch,
|
|
637
|
-
});
|
|
638
|
-
refresh();
|
|
639
|
-
setCreationSourceBranch(null);
|
|
640
|
-
setSelectedBranch({
|
|
641
|
-
name: branchName,
|
|
642
|
-
displayName: branchName,
|
|
643
|
-
branchType: "local",
|
|
644
|
-
branchCategory: inferBranchCategory(branchName),
|
|
645
|
-
});
|
|
646
|
-
setSelectedTool(null);
|
|
647
|
-
setSelectedModel(null);
|
|
648
|
-
setPreferredToolId(null);
|
|
649
|
-
setCleanupFooterMessage(null);
|
|
650
|
-
navigateTo("coding-agent-selector");
|
|
651
|
-
}
|
|
652
|
-
catch (error) {
|
|
653
|
-
// On error, go back to branch list
|
|
654
|
-
console.error("Failed to create branch:", error);
|
|
655
|
-
goBack();
|
|
656
|
-
refresh();
|
|
657
|
-
}
|
|
658
|
-
}, [
|
|
659
|
-
navigateTo,
|
|
660
|
-
goBack,
|
|
661
|
-
refresh,
|
|
662
|
-
resolveBaseBranch,
|
|
663
|
-
selectedBranch,
|
|
664
|
-
creationSourceBranch,
|
|
665
|
-
inferBranchCategory,
|
|
666
|
-
setCleanupFooterMessage,
|
|
667
|
-
]);
|
|
668
|
-
const handleCleanupCommand = useCallback(async () => {
|
|
669
|
-
if (cleanupInputLocked) {
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
if (completionTimerRef.current) {
|
|
673
|
-
clearTimeout(completionTimerRef.current);
|
|
674
|
-
completionTimerRef.current = null;
|
|
675
|
-
}
|
|
676
|
-
if (selectedBranches.length === 0) {
|
|
677
|
-
setCleanupIndicators({});
|
|
678
|
-
setCleanupFooterMessage({
|
|
679
|
-
text: "No cleanup targets selected.",
|
|
680
|
-
color: "yellow",
|
|
681
|
-
});
|
|
682
|
-
setCleanupInputLocked(false);
|
|
683
|
-
completionTimerRef.current = setTimeout(() => {
|
|
684
|
-
setCleanupFooterMessage(null);
|
|
685
|
-
completionTimerRef.current = null;
|
|
686
|
-
}, COMPLETION_HOLD_DURATION_MS);
|
|
687
|
-
return;
|
|
688
|
-
}
|
|
689
|
-
const succeededBranches = [];
|
|
690
|
-
const resetAfterWait = () => {
|
|
691
|
-
setCleanupIndicators({});
|
|
692
|
-
setCleanupInputLocked(false);
|
|
693
|
-
setCleanupFooterMessage(null);
|
|
694
|
-
if (succeededBranches.length > 0) {
|
|
695
|
-
setHiddenBranches((prev) => {
|
|
696
|
-
const merged = new Set(prev);
|
|
697
|
-
succeededBranches.forEach((branch) => merged.add(branch));
|
|
698
|
-
return Array.from(merged);
|
|
699
|
-
});
|
|
700
|
-
setSelectedBranches((prev) => prev.filter((name) => !succeededBranches.includes(name)));
|
|
701
|
-
}
|
|
702
|
-
refresh();
|
|
703
|
-
completionTimerRef.current = null;
|
|
704
|
-
};
|
|
705
|
-
// Provide immediate feedback before fetching targets
|
|
706
|
-
setCleanupInputLocked(true);
|
|
707
|
-
setCleanupIndicators({});
|
|
708
|
-
setCleanupFooterMessage({
|
|
709
|
-
text: "Processing...",
|
|
710
|
-
isSpinning: true,
|
|
711
|
-
color: "cyan",
|
|
712
|
-
});
|
|
713
|
-
setCleanupProcessingBranch(null);
|
|
714
|
-
const branchMap = new Map(branches.map((branch) => [branch.name, branch]));
|
|
715
|
-
const worktreeMap = new Map(worktrees.map((worktree) => [worktree.branch, worktree]));
|
|
716
|
-
const targets = selectedBranches.reduce((acc, name) => {
|
|
717
|
-
const branch = branchMap.get(name);
|
|
718
|
-
if (!branch || branch.type === "remote") {
|
|
719
|
-
return acc;
|
|
720
|
-
}
|
|
721
|
-
if (isProtectedBranchName(branch.name) ||
|
|
722
|
-
branch.branchType === "main" ||
|
|
723
|
-
branch.branchType === "develop") {
|
|
724
|
-
return acc;
|
|
725
|
-
}
|
|
726
|
-
const worktree = worktreeMap.get(branch.name);
|
|
727
|
-
const hasRemoteBranch = typeof branch.hasRemoteCounterpart === "boolean"
|
|
728
|
-
? branch.hasRemoteCounterpart
|
|
729
|
-
: undefined;
|
|
730
|
-
const isAccessible = typeof worktree?.isAccessible === "boolean"
|
|
731
|
-
? worktree.isAccessible
|
|
732
|
-
: undefined;
|
|
733
|
-
acc.push({
|
|
734
|
-
branch: branch.name,
|
|
735
|
-
pullRequest: null,
|
|
736
|
-
worktreePath: worktree?.path ?? null,
|
|
737
|
-
cleanupType: worktree ? "worktree-and-branch" : "branch-only",
|
|
738
|
-
hasUncommittedChanges: worktree?.hasUncommittedChanges ?? false,
|
|
739
|
-
hasUnpushedCommits: Boolean(branch.hasUnpushedCommits),
|
|
740
|
-
...(hasRemoteBranch !== undefined ? { hasRemoteBranch } : {}),
|
|
741
|
-
...(isAccessible !== undefined ? { isAccessible } : {}),
|
|
742
|
-
});
|
|
743
|
-
return acc;
|
|
744
|
-
}, []);
|
|
745
|
-
if (targets.length === 0) {
|
|
746
|
-
setCleanupIndicators({});
|
|
747
|
-
setCleanupFooterMessage({
|
|
748
|
-
text: "⚠️ No cleanup candidates among selected branches.",
|
|
749
|
-
color: "yellow",
|
|
750
|
-
});
|
|
751
|
-
setCleanupInputLocked(false);
|
|
752
|
-
completionTimerRef.current = setTimeout(() => {
|
|
753
|
-
setCleanupFooterMessage(null);
|
|
754
|
-
completionTimerRef.current = null;
|
|
755
|
-
}, COMPLETION_HOLD_DURATION_MS);
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
// Reset hidden branches that may already be gone
|
|
759
|
-
setHiddenBranches((prev) => prev.filter((name) => targets.find((t) => t.branch === name) === undefined));
|
|
760
|
-
const initialIndicators = targets.reduce((acc, target, index) => {
|
|
761
|
-
if (index === 0) {
|
|
762
|
-
acc[target.branch] = { icon: "", isSpinning: true, color: "cyan" };
|
|
763
|
-
}
|
|
764
|
-
else {
|
|
765
|
-
acc[target.branch] = { icon: "⏳", color: "yellow" };
|
|
766
|
-
}
|
|
767
|
-
return acc;
|
|
768
|
-
}, {});
|
|
769
|
-
setCleanupIndicators(initialIndicators);
|
|
770
|
-
const firstTarget = targets.length > 0 ? targets[0] : undefined;
|
|
771
|
-
setCleanupProcessingBranch(firstTarget ? firstTarget.branch : null);
|
|
772
|
-
setCleanupFooterMessage({
|
|
773
|
-
text: "Processing...",
|
|
774
|
-
isSpinning: true,
|
|
775
|
-
color: "cyan",
|
|
776
|
-
});
|
|
777
|
-
for (let index = 0; index < targets.length; index += 1) {
|
|
778
|
-
const currentTarget = targets[index];
|
|
779
|
-
if (!currentTarget) {
|
|
780
|
-
continue;
|
|
781
|
-
}
|
|
782
|
-
const target = currentTarget;
|
|
783
|
-
setCleanupProcessingBranch(target.branch);
|
|
784
|
-
setCleanupIndicators((prev) => {
|
|
785
|
-
const updated = { ...prev };
|
|
786
|
-
updated[target.branch] = { icon: "", isSpinning: true, color: "cyan" };
|
|
787
|
-
for (const pending of targets.slice(index + 1)) {
|
|
788
|
-
const current = updated[pending.branch];
|
|
789
|
-
if (!current || current.icon !== "⏳") {
|
|
790
|
-
updated[pending.branch] = { icon: "⏳", color: "yellow" };
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return updated;
|
|
794
|
-
});
|
|
795
|
-
const shouldSkip = target.hasUncommittedChanges ||
|
|
796
|
-
target.hasUnpushedCommits ||
|
|
797
|
-
(target.cleanupType === "worktree-and-branch" &&
|
|
798
|
-
(!target.worktreePath || target.isAccessible === false));
|
|
799
|
-
if (shouldSkip) {
|
|
800
|
-
setCleanupIndicators((prev) => ({
|
|
801
|
-
...prev,
|
|
802
|
-
[target.branch]: { icon: "⏭️", color: "yellow" },
|
|
803
|
-
}));
|
|
804
|
-
setCleanupProcessingBranch(null);
|
|
805
|
-
continue;
|
|
806
|
-
}
|
|
807
|
-
try {
|
|
808
|
-
if (target.cleanupType === "worktree-and-branch" &&
|
|
809
|
-
target.worktreePath) {
|
|
810
|
-
await removeWorktree(target.worktreePath, true);
|
|
811
|
-
}
|
|
812
|
-
await deleteBranch(target.branch, true);
|
|
813
|
-
// 自動クリーンアップではリモートブランチは削除しない
|
|
814
|
-
// リモートブランチはユーザーが明示的に削除する必要がある
|
|
815
|
-
succeededBranches.push(target.branch);
|
|
816
|
-
setCleanupIndicators((prev) => ({
|
|
817
|
-
...prev,
|
|
818
|
-
[target.branch]: { icon: "✅", color: "green" },
|
|
819
|
-
}));
|
|
820
|
-
}
|
|
821
|
-
catch {
|
|
822
|
-
const icon = "❌";
|
|
823
|
-
setCleanupIndicators((prev) => ({
|
|
824
|
-
...prev,
|
|
825
|
-
[target.branch]: { icon, color: "red" },
|
|
826
|
-
}));
|
|
827
|
-
}
|
|
828
|
-
setCleanupProcessingBranch(null);
|
|
829
|
-
}
|
|
830
|
-
setCleanupProcessingBranch(null);
|
|
831
|
-
setCleanupInputLocked(false);
|
|
832
|
-
setCleanupFooterMessage({
|
|
833
|
-
text: "Cleanup completed. Finalizing...",
|
|
834
|
-
color: "green",
|
|
835
|
-
});
|
|
836
|
-
const holdDuration = typeof process !== "undefined" && process.env?.NODE_ENV === "test"
|
|
837
|
-
? 0
|
|
838
|
-
: COMPLETION_HOLD_DURATION_MS;
|
|
839
|
-
completionTimerRef.current = setTimeout(resetAfterWait, holdDuration);
|
|
840
|
-
}, [
|
|
841
|
-
cleanupInputLocked,
|
|
842
|
-
branches,
|
|
843
|
-
deleteBranch,
|
|
844
|
-
refresh,
|
|
845
|
-
removeWorktree,
|
|
846
|
-
selectedBranches,
|
|
847
|
-
worktrees,
|
|
848
|
-
]);
|
|
849
|
-
// Handle AI tool selection
|
|
850
|
-
const handleToolSelect = useCallback((tool) => {
|
|
851
|
-
setSelectedTool(tool);
|
|
852
|
-
setSelectedModel(lastModelByTool[tool] ?? null);
|
|
853
|
-
navigateTo("model-selector");
|
|
854
|
-
}, [lastModelByTool, navigateTo]);
|
|
855
|
-
const handleModelSelect = useCallback((selection) => {
|
|
856
|
-
setSelectedModel(selection);
|
|
857
|
-
setLastModelByTool((prev) => ({
|
|
858
|
-
...prev,
|
|
859
|
-
...(selectedTool ? { [selectedTool]: selection } : {}),
|
|
860
|
-
}));
|
|
861
|
-
navigateTo("execution-mode-selector");
|
|
862
|
-
}, [navigateTo, selectedTool]);
|
|
863
|
-
const completeSelection = useCallback((executionMode, skip, sessionId) => {
|
|
864
|
-
if (selectedBranch && selectedTool) {
|
|
865
|
-
const defaultModel = getDefaultModelOption(selectedTool);
|
|
866
|
-
const resolvedModel = selectedModel?.model ?? defaultModel?.id ?? null;
|
|
867
|
-
const normalizedModel = normalizeModelId(selectedTool, resolvedModel);
|
|
868
|
-
const resolvedInference = selectedModel?.inferenceLevel ??
|
|
869
|
-
getDefaultInferenceForModel(defaultModel ?? undefined);
|
|
870
|
-
const payload = {
|
|
871
|
-
branch: selectedBranch.name,
|
|
872
|
-
displayName: selectedBranch.displayName,
|
|
873
|
-
branchType: selectedBranch.branchType,
|
|
874
|
-
tool: selectedTool,
|
|
875
|
-
mode: executionMode,
|
|
876
|
-
skipPermissions: skip,
|
|
877
|
-
...(normalizedModel !== undefined ? { model: normalizedModel } : {}),
|
|
878
|
-
...(resolvedInference !== undefined
|
|
879
|
-
? { inferenceLevel: resolvedInference }
|
|
880
|
-
: {}),
|
|
881
|
-
...(selectedBranch.remoteBranch
|
|
882
|
-
? { remoteBranch: selectedBranch.remoteBranch }
|
|
883
|
-
: {}),
|
|
884
|
-
...(sessionId ? { sessionId } : {}),
|
|
885
|
-
};
|
|
886
|
-
onExit(payload);
|
|
887
|
-
exit();
|
|
888
|
-
}
|
|
889
|
-
}, [
|
|
890
|
-
selectedBranch,
|
|
891
|
-
selectedTool,
|
|
892
|
-
selectedModel,
|
|
893
|
-
onExit,
|
|
894
|
-
exit,
|
|
895
|
-
getDefaultModelOption,
|
|
896
|
-
getDefaultInferenceForModel,
|
|
897
|
-
]);
|
|
898
|
-
const handleQuickStartSelect = useCallback((action, toolId) => {
|
|
899
|
-
if (action === "manual" || !branchQuickStart.length) {
|
|
900
|
-
navigateTo("coding-agent-selector");
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
const selected = branchQuickStart.find((opt) => opt.toolId === toolId) ??
|
|
904
|
-
branchQuickStart[0];
|
|
905
|
-
if (!selected) {
|
|
906
|
-
navigateTo("coding-agent-selector");
|
|
907
|
-
return;
|
|
908
|
-
}
|
|
909
|
-
setSelectedTool(selected.toolId);
|
|
910
|
-
setPreferredToolId(selected.toolId);
|
|
911
|
-
const normalizedQuickStartModel = normalizeModelId(selected.toolId, selected.model ?? null);
|
|
912
|
-
setSelectedModel(normalizedQuickStartModel
|
|
913
|
-
? {
|
|
914
|
-
model: normalizedQuickStartModel,
|
|
915
|
-
inferenceLevel: selected.inferenceLevel ?? undefined,
|
|
916
|
-
}
|
|
917
|
-
: null);
|
|
918
|
-
const skip = selected.skipPermissions ?? false;
|
|
919
|
-
if (action === "reuse-continue") {
|
|
920
|
-
const hasSession = Boolean(selected.sessionId);
|
|
921
|
-
const mode = hasSession ? "resume" : "continue";
|
|
922
|
-
completeSelection(mode, skip, selected.sessionId ?? null);
|
|
923
|
-
return;
|
|
924
|
-
}
|
|
925
|
-
// "Start new with previous settings" skips the execution mode screen and launches immediately
|
|
926
|
-
completeSelection("normal", skip, null);
|
|
927
|
-
}, [
|
|
928
|
-
branchQuickStart,
|
|
929
|
-
navigateTo,
|
|
930
|
-
setPreferredToolId,
|
|
931
|
-
setSelectedModel,
|
|
932
|
-
setSelectedTool,
|
|
933
|
-
completeSelection,
|
|
934
|
-
]);
|
|
935
|
-
// Handle execution mode and skipPermissions selection
|
|
936
|
-
const handleModeSelect = useCallback((result) => {
|
|
937
|
-
completeSelection(result.mode, result.skipPermissions, null);
|
|
938
|
-
}, [completeSelection]);
|
|
939
|
-
// Render screen based on currentScreen
|
|
940
|
-
const renderScreen = () => {
|
|
941
|
-
const renderBranchListScreen = (additionalProps) => (React.createElement(BranchListScreen, { branches: branchItems, stats: stats, onSelect: handleSelect, onQuit: handleQuit, onRefresh: refresh, loading: loading, error: error, lastUpdated: lastUpdated, loadingIndicatorDelay: loadingIndicatorDelay, version: version, workingDirectory: workingDirectory, activeProfile: activeProfileName, onOpenProfiles: () => navigateTo("environment-profile"), onOpenLogs: handleOpenLogs, toolStatuses: toolStatuses, ...additionalProps }));
|
|
942
|
-
switch (currentScreen) {
|
|
943
|
-
case "branch-list":
|
|
944
|
-
return renderBranchListScreen({
|
|
945
|
-
onCleanupCommand: handleCleanupCommand,
|
|
946
|
-
cleanupUI: {
|
|
947
|
-
indicators: cleanupIndicators,
|
|
948
|
-
footerMessage: cleanupFooterMessage,
|
|
949
|
-
inputLocked: cleanupInputLocked,
|
|
950
|
-
},
|
|
951
|
-
selectedBranches,
|
|
952
|
-
onToggleSelect: toggleBranchSelection,
|
|
953
|
-
});
|
|
954
|
-
case "log-list":
|
|
955
|
-
return (React.createElement(LogListScreen, { entries: logEntries, loading: logLoading, error: logError, onBack: goBack, onSelect: handleSelectLogEntry, onCopy: handleCopyLogEntry, onPickDate: handleOpenLogDates, notification: logNotification, version: version, selectedDate: logSelectedDate }));
|
|
956
|
-
case "log-detail":
|
|
957
|
-
return (React.createElement(LogDetailScreen, { entry: logSelectedEntry, onBack: goBack, onCopy: handleCopyLogEntry, notification: logNotification, version: version }));
|
|
958
|
-
case "log-date-picker":
|
|
959
|
-
return (React.createElement(LogDatePickerScreen, { dates: logDates, onBack: goBack, onSelect: handleSelectLogDate, version: version }));
|
|
960
|
-
case "branch-creator":
|
|
961
|
-
return (React.createElement(BranchCreatorScreen, { onBack: goBack, onCreate: handleCreate, baseBranch: baseBranchLabel, version: version }));
|
|
962
|
-
case "branch-action-selector": {
|
|
963
|
-
const isProtected = Boolean(protectedBranchInfo);
|
|
964
|
-
const baseProps = {
|
|
965
|
-
selectedBranch: selectedBranch?.displayName ?? "",
|
|
966
|
-
onUseExisting: handleUseExistingBranch,
|
|
967
|
-
onCreateNew: handleCreateNewBranch,
|
|
968
|
-
onBack: goBack,
|
|
969
|
-
canCreateNew: Boolean(selectedBranch),
|
|
970
|
-
};
|
|
971
|
-
if (isProtected) {
|
|
972
|
-
return (React.createElement(BranchActionSelectorScreen, { ...baseProps, mode: "protected", infoMessage: protectedBranchInfo?.message ?? null, primaryLabel: "Use root branch (no worktree)", secondaryLabel: "Create new branch from this branch" }));
|
|
973
|
-
}
|
|
974
|
-
return React.createElement(BranchActionSelectorScreen, { ...baseProps });
|
|
975
|
-
}
|
|
976
|
-
case "branch-quick-start":
|
|
977
|
-
return (React.createElement(BranchQuickStartScreen, { branchName: selectedBranch?.displayName ?? "", previousOptions: branchQuickStart.map((opt) => ({
|
|
978
|
-
toolId: opt.toolId,
|
|
979
|
-
toolLabel: opt.toolLabel,
|
|
980
|
-
model: opt.model ?? null,
|
|
981
|
-
inferenceLevel: opt.inferenceLevel ?? null,
|
|
982
|
-
skipPermissions: opt.skipPermissions ?? null,
|
|
983
|
-
sessionId: opt.sessionId ?? null,
|
|
984
|
-
})), loading: branchQuickStartLoading, onBack: goBack, onSelect: handleQuickStartSelect, version: version }));
|
|
985
|
-
case "coding-agent-selector":
|
|
986
|
-
return (React.createElement(CodingAgentSelectorScreen, { onBack: goBack, onSelect: handleToolSelect, version: version, initialAgentId: selectedTool ?? preferredToolId ?? null }));
|
|
987
|
-
case "model-selector":
|
|
988
|
-
if (!selectedTool) {
|
|
989
|
-
goBack();
|
|
990
|
-
return null;
|
|
991
|
-
}
|
|
992
|
-
return (React.createElement(ModelSelectorScreen, { tool: selectedTool, onBack: goBack, onSelect: handleModelSelect, version: version, initialSelection: selectedModel }));
|
|
993
|
-
case "execution-mode-selector":
|
|
994
|
-
return (React.createElement(ExecutionModeSelectorScreen, { onBack: goBack, onSelect: handleModeSelect, version: version, continueSessionId: continueSessionId }));
|
|
995
|
-
case "environment-profile":
|
|
996
|
-
return (React.createElement(EnvironmentProfileScreen, { onBack: () => {
|
|
997
|
-
void refreshProfiles();
|
|
998
|
-
goBack();
|
|
999
|
-
}, version: version }));
|
|
1000
|
-
default:
|
|
1001
|
-
return renderBranchListScreen();
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
return React.createElement(ErrorBoundary, null, renderScreen());
|
|
1005
|
-
}
|
|
1006
|
-
//# sourceMappingURL=App.js.map
|