centaurus-cli 3.0.0 → 3.1.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/dist/ai/types.js +0 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/cli-adapter.js +5047 -5037
- package/dist/cli-adapter.js.map +1 -1
- package/dist/commands/CommandParser.js +372 -315
- package/dist/commands/CommandParser.js.map +1 -1
- package/dist/config/build-config.js +11 -42
- package/dist/config/build-config.js.map +1 -1
- package/dist/config/defaultConfig.js +94 -82
- package/dist/config/defaultConfig.js.map +1 -1
- package/dist/config/manager.js +144 -160
- package/dist/config/manager.js.map +1 -1
- package/dist/config/mcp-config-manager.js +411 -364
- package/dist/config/mcp-config-manager.js.map +1 -1
- package/dist/config/models.js +118 -185
- package/dist/config/models.js.map +1 -1
- package/dist/config/slash-commands.js +186 -184
- package/dist/config/slash-commands.js.map +1 -1
- package/dist/config/types.js +33 -26
- package/dist/config/types.js.map +1 -1
- package/dist/context/command-detector.js +63 -67
- package/dist/context/command-detector.js.map +1 -1
- package/dist/context/context-manager.js +533 -518
- package/dist/context/context-manager.js.map +1 -1
- package/dist/context/handlers/docker-handler.js +518 -576
- package/dist/context/handlers/docker-handler.js.map +1 -1
- package/dist/context/handlers/ssh-handler.js +1050 -1109
- package/dist/context/handlers/ssh-handler.js.map +1 -1
- package/dist/context/handlers/wsl-handler.js +558 -630
- package/dist/context/handlers/wsl-handler.js.map +1 -1
- package/dist/context/index.js +42 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/subshell-handler.js +0 -4
- package/dist/context/subshell-handler.js.map +1 -1
- package/dist/context/types.js +20 -31
- package/dist/context/types.js.map +1 -1
- package/dist/hooks/useConnectivity.js +13 -10
- package/dist/hooks/useConnectivity.js.map +1 -1
- package/dist/hooks/useTerminalDimensions.js +67 -79
- package/dist/hooks/useTerminalDimensions.js.map +1 -1
- package/dist/index.js +228 -251
- package/dist/index.js.map +1 -1
- package/dist/mcp/mcp-command-handler.js +297 -260
- package/dist/mcp/mcp-command-handler.js.map +1 -1
- package/dist/mcp/mcp-server-manager.js +139 -155
- package/dist/mcp/mcp-server-manager.js.map +1 -1
- package/dist/mcp/mcp-tool-wrapper.js +74 -94
- package/dist/mcp/mcp-tool-wrapper.js.map +1 -1
- package/dist/services/ai-autocomplete-agent.js +169 -181
- package/dist/services/ai-autocomplete-agent.js.map +1 -1
- package/dist/services/ai-context-injector.js +180 -93
- package/dist/services/ai-context-injector.js.map +1 -1
- package/dist/services/ai-service-client.js +513 -456
- package/dist/services/ai-service-client.js.map +1 -1
- package/dist/services/api-client.js +443 -441
- package/dist/services/api-client.js.map +1 -1
- package/dist/services/auth-handler.js +162 -198
- package/dist/services/auth-handler.js.map +1 -1
- package/dist/services/background-task-manager.js +258 -282
- package/dist/services/background-task-manager.js.map +1 -1
- package/dist/services/checkpoint-manager.js +1513 -973
- package/dist/services/checkpoint-manager.js.map +1 -1
- package/dist/services/clipboard-service.js +151 -200
- package/dist/services/clipboard-service.js.map +1 -1
- package/dist/services/connectivity-manager.js +63 -65
- package/dist/services/connectivity-manager.js.map +1 -1
- package/dist/services/conversation-manager.js +118 -121
- package/dist/services/conversation-manager.js.map +1 -1
- package/dist/services/environment-context-injector.js +160 -187
- package/dist/services/environment-context-injector.js.map +1 -1
- package/dist/services/fast-context-agent.js +203 -243
- package/dist/services/fast-context-agent.js.map +1 -1
- package/dist/services/input-detection-agent.js +190 -202
- package/dist/services/input-detection-agent.js.map +1 -1
- package/dist/services/input-requirement-detector.js +155 -189
- package/dist/services/input-requirement-detector.js.map +1 -1
- package/dist/services/local-chat-storage.js +342 -365
- package/dist/services/local-chat-storage.js.map +1 -1
- package/dist/services/monitored-shell-manager.js +225 -233
- package/dist/services/monitored-shell-manager.js.map +1 -1
- package/dist/services/ollama-service.js +293 -310
- package/dist/services/ollama-service.js.map +1 -1
- package/dist/services/rules-storage.js +142 -0
- package/dist/services/rules-storage.js.map +1 -0
- package/dist/services/session-quota-manager.js +219 -235
- package/dist/services/session-quota-manager.js.map +1 -1
- package/dist/services/shell-input-agent.js +299 -334
- package/dist/services/shell-input-agent.js.map +1 -1
- package/dist/services/sub-agent-manager.js +459 -501
- package/dist/services/sub-agent-manager.js.map +1 -1
- package/dist/services/warpify-detector.js +133 -183
- package/dist/services/warpify-detector.js.map +1 -1
- package/dist/services/workflow-storage.js +202 -217
- package/dist/services/workflow-storage.js.map +1 -1
- package/dist/test-ssh-handler.js +148 -193
- package/dist/test-ssh-handler.js.map +1 -1
- package/dist/tools/add-mcp.js +161 -0
- package/dist/tools/add-mcp.js.map +1 -0
- package/dist/tools/background-command.js +240 -273
- package/dist/tools/background-command.js.map +1 -1
- package/dist/tools/command.js +447 -440
- package/dist/tools/command.js.map +1 -1
- package/dist/tools/create-image.js +172 -202
- package/dist/tools/create-image.js.map +1 -1
- package/dist/tools/enter-remote-session.js +169 -215
- package/dist/tools/enter-remote-session.js.map +1 -1
- package/dist/tools/fast-context.js +60 -67
- package/dist/tools/fast-context.js.map +1 -1
- package/dist/tools/file-ops.js +605 -537
- package/dist/tools/file-ops.js.map +1 -1
- package/dist/tools/find-files.js +262 -303
- package/dist/tools/find-files.js.map +1 -1
- package/dist/tools/get-diff.js +423 -400
- package/dist/tools/get-diff.js.map +1 -1
- package/dist/tools/grep-search.js +966 -948
- package/dist/tools/grep-search.js.map +1 -1
- package/dist/tools/inspect-symbol.js +308 -323
- package/dist/tools/inspect-symbol.js.map +1 -1
- package/dist/tools/plan-mode.js +459 -503
- package/dist/tools/plan-mode.js.map +1 -1
- package/dist/tools/read-binary-file.js +160 -190
- package/dist/tools/read-binary-file.js.map +1 -1
- package/dist/tools/registry.js +100 -84
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/reproduce_issue.js +170 -151
- package/dist/tools/reproduce_issue.js.map +1 -1
- package/dist/tools/sub-agent.js +223 -228
- package/dist/tools/sub-agent.js.map +1 -1
- package/dist/tools/task-complete.js +28 -27
- package/dist/tools/task-complete.js.map +1 -1
- package/dist/tools/types.js +0 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/tools/validation.js +96 -118
- package/dist/tools/validation.js.map +1 -1
- package/dist/tools/web-search.js +194 -194
- package/dist/tools/web-search.js.map +1 -1
- package/dist/tools/workflow-tool.js +77 -82
- package/dist/tools/workflow-tool.js.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/rule.js +1 -0
- package/dist/types/rule.js.map +1 -0
- package/dist/types/workflow.js +0 -7
- package/dist/types/workflow.js.map +1 -1
- package/dist/ui/components/AgentTimer.js +24 -25
- package/dist/ui/components/AgentTimer.js.map +1 -1
- package/dist/ui/components/App.js +3266 -3249
- package/dist/ui/components/App.js.map +1 -1
- package/dist/ui/components/AuthScreen.js +22 -34
- package/dist/ui/components/AuthScreen.js.map +1 -1
- package/dist/ui/components/AuthWelcomeScreen.js +30 -24
- package/dist/ui/components/AuthWelcomeScreen.js.map +1 -1
- package/dist/ui/components/Breadcrumbs.js +53 -82
- package/dist/ui/components/Breadcrumbs.js.map +1 -1
- package/dist/ui/components/CircularSelectInput.js +59 -67
- package/dist/ui/components/CircularSelectInput.js.map +1 -1
- package/dist/ui/components/ClipboardFileAutocomplete.js +78 -39
- package/dist/ui/components/ClipboardFileAutocomplete.js.map +1 -1
- package/dist/ui/components/CodeBlock.js +24 -42
- package/dist/ui/components/CodeBlock.js.map +1 -1
- package/dist/ui/components/ConfigViewer.js +18 -25
- package/dist/ui/components/ConfigViewer.js.map +1 -1
- package/dist/ui/components/ConfirmPrompt.js +49 -71
- package/dist/ui/components/ConfirmPrompt.js.map +1 -1
- package/dist/ui/components/ConnectionStatusMessage.js +32 -83
- package/dist/ui/components/ConnectionStatusMessage.js.map +1 -1
- package/dist/ui/components/ContextWindowIndicator.js +34 -49
- package/dist/ui/components/ContextWindowIndicator.js.map +1 -1
- package/dist/ui/components/DetailedPlanReviewScreen.js +104 -106
- package/dist/ui/components/DetailedPlanReviewScreen.js.map +1 -1
- package/dist/ui/components/DiffViewer.js +68 -121
- package/dist/ui/components/DiffViewer.js.map +1 -1
- package/dist/ui/components/ErrorBoundary.js +40 -48
- package/dist/ui/components/ErrorBoundary.js.map +1 -1
- package/dist/ui/components/FileCreationPreview.js +29 -60
- package/dist/ui/components/FileCreationPreview.js.map +1 -1
- package/dist/ui/components/FileOperation.js +34 -29
- package/dist/ui/components/FileOperation.js.map +1 -1
- package/dist/ui/components/FileTagAutocomplete.js +55 -25
- package/dist/ui/components/FileTagAutocomplete.js.map +1 -1
- package/dist/ui/components/FontRecommendation.js.map +1 -1
- package/dist/ui/components/GitDiffBreadcrumb.js +29 -0
- package/dist/ui/components/GitDiffBreadcrumb.js.map +1 -0
- package/dist/ui/components/InputBox.js +1620 -2150
- package/dist/ui/components/InputBox.js.map +1 -1
- package/dist/ui/components/InteractiveShell.js +234 -352
- package/dist/ui/components/InteractiveShell.js.map +1 -1
- package/dist/ui/components/KeyboardHelp.js +34 -35
- package/dist/ui/components/KeyboardHelp.js.map +1 -1
- package/dist/ui/components/LoadingIndicator.js +22 -25
- package/dist/ui/components/LoadingIndicator.js.map +1 -1
- package/dist/ui/components/MCPAddScreen.js +40 -51
- package/dist/ui/components/MCPAddScreen.js.map +1 -1
- package/dist/ui/components/MCPListScreen.js +40 -48
- package/dist/ui/components/MCPListScreen.js.map +1 -1
- package/dist/ui/components/MCPServerListScreen.js +49 -56
- package/dist/ui/components/MCPServerListScreen.js.map +1 -1
- package/dist/ui/components/MarkdownRenderer.js +69 -96
- package/dist/ui/components/MarkdownRenderer.js.map +1 -1
- package/dist/ui/components/MessageBox.js +66 -48
- package/dist/ui/components/MessageBox.js.map +1 -1
- package/dist/ui/components/MessageDisplay.js +150 -142
- package/dist/ui/components/MessageDisplay.js.map +1 -1
- package/dist/ui/components/MonitorModeAIPanel.js +46 -65
- package/dist/ui/components/MonitorModeAIPanel.js.map +1 -1
- package/dist/ui/components/MultiLineInput.js +243 -277
- package/dist/ui/components/MultiLineInput.js.map +1 -1
- package/dist/ui/components/PasswordPrompt.js +37 -18
- package/dist/ui/components/PasswordPrompt.js.map +1 -1
- package/dist/ui/components/PlanAcceptedMessage.js +27 -38
- package/dist/ui/components/PlanAcceptedMessage.js.map +1 -1
- package/dist/ui/components/PlanReviewScreen.js +46 -50
- package/dist/ui/components/PlanReviewScreen.js.map +1 -1
- package/dist/ui/components/RulesEditorScreen.js +81 -0
- package/dist/ui/components/RulesEditorScreen.js.map +1 -0
- package/dist/ui/components/SelectPrompt.js +19 -8
- package/dist/ui/components/SelectPrompt.js.map +1 -1
- package/dist/ui/components/ShimmerText.js +44 -0
- package/dist/ui/components/ShimmerText.js.map +1 -0
- package/dist/ui/components/SlashCommandAutocomplete.js +49 -22
- package/dist/ui/components/SlashCommandAutocomplete.js.map +1 -1
- package/dist/ui/components/StatusBar.js +56 -87
- package/dist/ui/components/StatusBar.js.map +1 -1
- package/dist/ui/components/StreamingMessageDisplay.js +116 -99
- package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
- package/dist/ui/components/TaskCompletedMessage.js +28 -23
- package/dist/ui/components/TaskCompletedMessage.js.map +1 -1
- package/dist/ui/components/TaskProgressIndicator.js +44 -70
- package/dist/ui/components/TaskProgressIndicator.js.map +1 -1
- package/dist/ui/components/ThinkingDisplay.js +44 -41
- package/dist/ui/components/ThinkingDisplay.js.map +1 -1
- package/dist/ui/components/ToolExecutionMessage.js +772 -1326
- package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
- package/dist/ui/components/ToolExecutionStatus.js +53 -84
- package/dist/ui/components/ToolExecutionStatus.js.map +1 -1
- package/dist/ui/components/ToolResult.js +22 -15
- package/dist/ui/components/ToolResult.js.map +1 -1
- package/dist/ui/components/VersionUpdatePrompt.js +88 -120
- package/dist/ui/components/VersionUpdatePrompt.js.map +1 -1
- package/dist/ui/components/WelcomeBanner.js +176 -26
- package/dist/ui/components/WelcomeBanner.js.map +1 -1
- package/dist/ui/components/WorkflowCreatorScreen.js +94 -161
- package/dist/ui/components/WorkflowCreatorScreen.js.map +1 -1
- package/dist/utils/ansi-encoder.js +30 -61
- package/dist/utils/ansi-encoder.js.map +1 -1
- package/dist/utils/chat-formatter.js +327 -305
- package/dist/utils/chat-formatter.js.map +1 -1
- package/dist/utils/command-history.js +152 -174
- package/dist/utils/command-history.js.map +1 -1
- package/dist/utils/context-sanitizer.js +49 -112
- package/dist/utils/context-sanitizer.js.map +1 -1
- package/dist/utils/conversation-logger.js +292 -324
- package/dist/utils/conversation-logger.js.map +1 -1
- package/dist/utils/custom-commands-manager.js +126 -131
- package/dist/utils/custom-commands-manager.js.map +1 -1
- package/dist/utils/editor-utils.js +732 -837
- package/dist/utils/editor-utils.js.map +1 -1
- package/dist/utils/file.js +174 -213
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/git-stats.js +169 -0
- package/dist/utils/git-stats.js.map +1 -0
- package/dist/utils/input-classifier.js +960 -482
- package/dist/utils/input-classifier.js.map +1 -1
- package/dist/utils/logger.js +48 -73
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/markdown-parser.js +277 -310
- package/dist/utils/markdown-parser.js.map +1 -1
- package/dist/utils/rule-reference-resolver.js +54 -0
- package/dist/utils/rule-reference-resolver.js.map +1 -0
- package/dist/utils/shell.js +144 -156
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/state.js +23 -22
- package/dist/utils/state.js.map +1 -1
- package/dist/utils/syntax-checker.js +279 -327
- package/dist/utils/syntax-checker.js.map +1 -1
- package/dist/utils/terminal-output.js +199 -302
- package/dist/utils/terminal-output.js.map +1 -1
- package/dist/utils/text-clipboard.js +47 -70
- package/dist/utils/text-clipboard.js.map +1 -1
- package/dist/utils/unicode-sanitizer.js +134 -197
- package/dist/utils/unicode-sanitizer.js.map +1 -1
- package/dist/utils/version-checker.js +46 -56
- package/dist/utils/version-checker.js.map +1 -1
- package/package.json +6 -4
- package/dist/ai/types.d.ts +0 -20
- package/dist/ai/types.d.ts.map +0 -1
- package/dist/cli-adapter.d.ts +0 -511
- package/dist/cli-adapter.d.ts.map +0 -1
- package/dist/commands/CommandParser.d.ts +0 -27
- package/dist/commands/CommandParser.d.ts.map +0 -1
- package/dist/config/build-config.d.ts +0 -42
- package/dist/config/build-config.d.ts.map +0 -1
- package/dist/config/defaultConfig.d.ts +0 -79
- package/dist/config/defaultConfig.d.ts.map +0 -1
- package/dist/config/manager.d.ts +0 -62
- package/dist/config/manager.d.ts.map +0 -1
- package/dist/config/mcp-config-manager.d.ts +0 -79
- package/dist/config/mcp-config-manager.d.ts.map +0 -1
- package/dist/config/models.d.ts +0 -83
- package/dist/config/models.d.ts.map +0 -1
- package/dist/config/slash-commands.d.ts +0 -23
- package/dist/config/slash-commands.d.ts.map +0 -1
- package/dist/config/types.d.ts +0 -35
- package/dist/config/types.d.ts.map +0 -1
- package/dist/context/command-detector.d.ts +0 -50
- package/dist/context/command-detector.d.ts.map +0 -1
- package/dist/context/context-manager.d.ts +0 -157
- package/dist/context/context-manager.d.ts.map +0 -1
- package/dist/context/handlers/docker-handler.d.ts +0 -130
- package/dist/context/handlers/docker-handler.d.ts.map +0 -1
- package/dist/context/handlers/ssh-handler.d.ts +0 -201
- package/dist/context/handlers/ssh-handler.d.ts.map +0 -1
- package/dist/context/handlers/wsl-handler.d.ts +0 -146
- package/dist/context/handlers/wsl-handler.d.ts.map +0 -1
- package/dist/context/index.d.ts +0 -8
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/subshell-handler.d.ts +0 -165
- package/dist/context/subshell-handler.d.ts.map +0 -1
- package/dist/context/types.d.ts +0 -70
- package/dist/context/types.d.ts.map +0 -1
- package/dist/hooks/useConnectivity.d.ts +0 -2
- package/dist/hooks/useConnectivity.d.ts.map +0 -1
- package/dist/hooks/useTerminalDimensions.d.ts +0 -41
- package/dist/hooks/useTerminalDimensions.d.ts.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/mcp-command-handler.d.ts +0 -47
- package/dist/mcp/mcp-command-handler.d.ts.map +0 -1
- package/dist/mcp/mcp-server-manager.d.ts +0 -30
- package/dist/mcp/mcp-server-manager.d.ts.map +0 -1
- package/dist/mcp/mcp-tool-wrapper.d.ts +0 -12
- package/dist/mcp/mcp-tool-wrapper.d.ts.map +0 -1
- package/dist/services/ai-autocomplete-agent.d.ts +0 -39
- package/dist/services/ai-autocomplete-agent.d.ts.map +0 -1
- package/dist/services/ai-context-injector.d.ts +0 -41
- package/dist/services/ai-context-injector.d.ts.map +0 -1
- package/dist/services/ai-service-client.d.ts +0 -128
- package/dist/services/ai-service-client.d.ts.map +0 -1
- package/dist/services/api-client.d.ts +0 -353
- package/dist/services/api-client.d.ts.map +0 -1
- package/dist/services/auth-handler.d.ts +0 -30
- package/dist/services/auth-handler.d.ts.map +0 -1
- package/dist/services/background-task-manager.d.ts +0 -114
- package/dist/services/background-task-manager.d.ts.map +0 -1
- package/dist/services/checkpoint-manager.d.ts +0 -167
- package/dist/services/checkpoint-manager.d.ts.map +0 -1
- package/dist/services/clipboard-service.d.ts +0 -37
- package/dist/services/clipboard-service.d.ts.map +0 -1
- package/dist/services/connectivity-manager.d.ts +0 -18
- package/dist/services/connectivity-manager.d.ts.map +0 -1
- package/dist/services/conversation-manager.d.ts +0 -73
- package/dist/services/conversation-manager.d.ts.map +0 -1
- package/dist/services/environment-context-injector.d.ts +0 -69
- package/dist/services/environment-context-injector.d.ts.map +0 -1
- package/dist/services/fast-context-agent.d.ts +0 -12
- package/dist/services/fast-context-agent.d.ts.map +0 -1
- package/dist/services/input-detection-agent.d.ts +0 -40
- package/dist/services/input-detection-agent.d.ts.map +0 -1
- package/dist/services/input-requirement-detector.d.ts +0 -28
- package/dist/services/input-requirement-detector.d.ts.map +0 -1
- package/dist/services/local-chat-storage.d.ts +0 -182
- package/dist/services/local-chat-storage.d.ts.map +0 -1
- package/dist/services/monitored-shell-manager.d.ts +0 -120
- package/dist/services/monitored-shell-manager.d.ts.map +0 -1
- package/dist/services/ollama-service.d.ts +0 -197
- package/dist/services/ollama-service.d.ts.map +0 -1
- package/dist/services/session-quota-manager.d.ts +0 -101
- package/dist/services/session-quota-manager.d.ts.map +0 -1
- package/dist/services/shell-input-agent.d.ts +0 -89
- package/dist/services/shell-input-agent.d.ts.map +0 -1
- package/dist/services/sub-agent-manager.d.ts +0 -140
- package/dist/services/sub-agent-manager.d.ts.map +0 -1
- package/dist/services/warpify-detector.d.ts +0 -43
- package/dist/services/warpify-detector.d.ts.map +0 -1
- package/dist/services/workflow-storage.d.ts +0 -72
- package/dist/services/workflow-storage.d.ts.map +0 -1
- package/dist/test-ssh-handler.d.ts +0 -8
- package/dist/test-ssh-handler.d.ts.map +0 -1
- package/dist/tools/background-command.d.ts +0 -11
- package/dist/tools/background-command.d.ts.map +0 -1
- package/dist/tools/command.d.ts +0 -3
- package/dist/tools/command.d.ts.map +0 -1
- package/dist/tools/create-image.d.ts +0 -10
- package/dist/tools/create-image.d.ts.map +0 -1
- package/dist/tools/enter-remote-session.d.ts +0 -48
- package/dist/tools/enter-remote-session.d.ts.map +0 -1
- package/dist/tools/fast-context.d.ts +0 -3
- package/dist/tools/fast-context.d.ts.map +0 -1
- package/dist/tools/file-ops.d.ts +0 -7
- package/dist/tools/file-ops.d.ts.map +0 -1
- package/dist/tools/find-files.d.ts +0 -49
- package/dist/tools/find-files.d.ts.map +0 -1
- package/dist/tools/get-diff.d.ts +0 -14
- package/dist/tools/get-diff.d.ts.map +0 -1
- package/dist/tools/grep-search.d.ts +0 -155
- package/dist/tools/grep-search.d.ts.map +0 -1
- package/dist/tools/inspect-symbol.d.ts +0 -32
- package/dist/tools/inspect-symbol.d.ts.map +0 -1
- package/dist/tools/plan-mode.d.ts +0 -140
- package/dist/tools/plan-mode.d.ts.map +0 -1
- package/dist/tools/read-binary-file.d.ts +0 -10
- package/dist/tools/read-binary-file.d.ts.map +0 -1
- package/dist/tools/registry.d.ts +0 -31
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/reproduce_issue.d.ts +0 -2
- package/dist/tools/reproduce_issue.d.ts.map +0 -1
- package/dist/tools/sub-agent.d.ts +0 -9
- package/dist/tools/sub-agent.d.ts.map +0 -1
- package/dist/tools/task-complete.d.ts +0 -3
- package/dist/tools/task-complete.d.ts.map +0 -1
- package/dist/tools/types.d.ts +0 -40
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/validation.d.ts +0 -47
- package/dist/tools/validation.d.ts.map +0 -1
- package/dist/tools/web-search.d.ts +0 -24
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/workflow-tool.d.ts +0 -11
- package/dist/tools/workflow-tool.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -123
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/workflow.d.ts +0 -110
- package/dist/types/workflow.d.ts.map +0 -1
- package/dist/ui/components/AgentTimer.d.ts +0 -7
- package/dist/ui/components/AgentTimer.d.ts.map +0 -1
- package/dist/ui/components/App.d.ts +0 -197
- package/dist/ui/components/App.d.ts.map +0 -1
- package/dist/ui/components/AuthScreen.d.ts +0 -8
- package/dist/ui/components/AuthScreen.d.ts.map +0 -1
- package/dist/ui/components/AuthWelcomeScreen.d.ts +0 -8
- package/dist/ui/components/AuthWelcomeScreen.d.ts.map +0 -1
- package/dist/ui/components/Breadcrumbs.d.ts +0 -13
- package/dist/ui/components/Breadcrumbs.d.ts.map +0 -1
- package/dist/ui/components/CircularSelectInput.d.ts +0 -24
- package/dist/ui/components/CircularSelectInput.d.ts.map +0 -1
- package/dist/ui/components/ClipboardFileAutocomplete.d.ts +0 -10
- package/dist/ui/components/ClipboardFileAutocomplete.d.ts.map +0 -1
- package/dist/ui/components/CodeBlock.d.ts +0 -9
- package/dist/ui/components/CodeBlock.d.ts.map +0 -1
- package/dist/ui/components/ConfigViewer.d.ts +0 -11
- package/dist/ui/components/ConfigViewer.d.ts.map +0 -1
- package/dist/ui/components/ConfirmPrompt.d.ts +0 -13
- package/dist/ui/components/ConfirmPrompt.d.ts.map +0 -1
- package/dist/ui/components/ConnectionStatusMessage.d.ts +0 -17
- package/dist/ui/components/ConnectionStatusMessage.d.ts.map +0 -1
- package/dist/ui/components/ContextWindowIndicator.d.ts +0 -8
- package/dist/ui/components/ContextWindowIndicator.d.ts.map +0 -1
- package/dist/ui/components/DetailedPlanReviewScreen.d.ts +0 -17
- package/dist/ui/components/DetailedPlanReviewScreen.d.ts.map +0 -1
- package/dist/ui/components/DiffViewer.d.ts +0 -9
- package/dist/ui/components/DiffViewer.d.ts.map +0 -1
- package/dist/ui/components/ErrorBoundary.d.ts +0 -17
- package/dist/ui/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/ui/components/FileCreationPreview.d.ts +0 -8
- package/dist/ui/components/FileCreationPreview.d.ts.map +0 -1
- package/dist/ui/components/FileOperation.d.ts +0 -10
- package/dist/ui/components/FileOperation.d.ts.map +0 -1
- package/dist/ui/components/FileTagAutocomplete.d.ts +0 -11
- package/dist/ui/components/FileTagAutocomplete.d.ts.map +0 -1
- package/dist/ui/components/FontRecommendation.d.ts +0 -1
- package/dist/ui/components/FontRecommendation.d.ts.map +0 -1
- package/dist/ui/components/InputBox.d.ts +0 -42
- package/dist/ui/components/InputBox.d.ts.map +0 -1
- package/dist/ui/components/InteractiveShell.d.ts +0 -30
- package/dist/ui/components/InteractiveShell.d.ts.map +0 -1
- package/dist/ui/components/KeyboardHelp.d.ts +0 -7
- package/dist/ui/components/KeyboardHelp.d.ts.map +0 -1
- package/dist/ui/components/LoadingIndicator.d.ts +0 -3
- package/dist/ui/components/LoadingIndicator.d.ts.map +0 -1
- package/dist/ui/components/MCPAddScreen.d.ts +0 -13
- package/dist/ui/components/MCPAddScreen.d.ts.map +0 -1
- package/dist/ui/components/MCPListScreen.d.ts +0 -17
- package/dist/ui/components/MCPListScreen.d.ts.map +0 -1
- package/dist/ui/components/MCPServerListScreen.d.ts +0 -16
- package/dist/ui/components/MCPServerListScreen.d.ts.map +0 -1
- package/dist/ui/components/MarkdownRenderer.d.ts +0 -8
- package/dist/ui/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/ui/components/MessageBox.d.ts +0 -10
- package/dist/ui/components/MessageBox.d.ts.map +0 -1
- package/dist/ui/components/MessageDisplay.d.ts +0 -14
- package/dist/ui/components/MessageDisplay.d.ts.map +0 -1
- package/dist/ui/components/MonitorModeAIPanel.d.ts +0 -23
- package/dist/ui/components/MonitorModeAIPanel.d.ts.map +0 -1
- package/dist/ui/components/MultiLineInput.d.ts +0 -13
- package/dist/ui/components/MultiLineInput.d.ts.map +0 -1
- package/dist/ui/components/PasswordPrompt.d.ts +0 -9
- package/dist/ui/components/PasswordPrompt.d.ts.map +0 -1
- package/dist/ui/components/PlanAcceptedMessage.d.ts +0 -20
- package/dist/ui/components/PlanAcceptedMessage.d.ts.map +0 -1
- package/dist/ui/components/PlanReviewScreen.d.ts +0 -14
- package/dist/ui/components/PlanReviewScreen.d.ts.map +0 -1
- package/dist/ui/components/SelectPrompt.d.ts +0 -12
- package/dist/ui/components/SelectPrompt.d.ts.map +0 -1
- package/dist/ui/components/SlashCommandAutocomplete.d.ts +0 -13
- package/dist/ui/components/SlashCommandAutocomplete.d.ts.map +0 -1
- package/dist/ui/components/StatusBar.d.ts +0 -14
- package/dist/ui/components/StatusBar.d.ts.map +0 -1
- package/dist/ui/components/StreamingMessageDisplay.d.ts +0 -15
- package/dist/ui/components/StreamingMessageDisplay.d.ts.map +0 -1
- package/dist/ui/components/TaskCompletedMessage.d.ts +0 -14
- package/dist/ui/components/TaskCompletedMessage.d.ts.map +0 -1
- package/dist/ui/components/TaskProgressIndicator.d.ts +0 -18
- package/dist/ui/components/TaskProgressIndicator.d.ts.map +0 -1
- package/dist/ui/components/ThinkingDisplay.d.ts +0 -15
- package/dist/ui/components/ThinkingDisplay.d.ts.map +0 -1
- package/dist/ui/components/ToolExecutionMessage.d.ts +0 -8
- package/dist/ui/components/ToolExecutionMessage.d.ts.map +0 -1
- package/dist/ui/components/ToolExecutionStatus.d.ts +0 -10
- package/dist/ui/components/ToolExecutionStatus.d.ts.map +0 -1
- package/dist/ui/components/ToolResult.d.ts +0 -10
- package/dist/ui/components/ToolResult.d.ts.map +0 -1
- package/dist/ui/components/VersionUpdatePrompt.d.ts +0 -9
- package/dist/ui/components/VersionUpdatePrompt.d.ts.map +0 -1
- package/dist/ui/components/WelcomeBanner.d.ts +0 -3
- package/dist/ui/components/WelcomeBanner.d.ts.map +0 -1
- package/dist/ui/components/WorkflowCreatorScreen.d.ts +0 -25
- package/dist/ui/components/WorkflowCreatorScreen.d.ts.map +0 -1
- package/dist/utils/ansi-encoder.d.ts +0 -7
- package/dist/utils/ansi-encoder.d.ts.map +0 -1
- package/dist/utils/chat-formatter.d.ts +0 -12
- package/dist/utils/chat-formatter.d.ts.map +0 -1
- package/dist/utils/command-history.d.ts +0 -24
- package/dist/utils/command-history.d.ts.map +0 -1
- package/dist/utils/context-sanitizer.d.ts +0 -50
- package/dist/utils/context-sanitizer.d.ts.map +0 -1
- package/dist/utils/conversation-logger.d.ts +0 -142
- package/dist/utils/conversation-logger.d.ts.map +0 -1
- package/dist/utils/custom-commands-manager.d.ts +0 -59
- package/dist/utils/custom-commands-manager.d.ts.map +0 -1
- package/dist/utils/editor-utils.d.ts +0 -101
- package/dist/utils/editor-utils.d.ts.map +0 -1
- package/dist/utils/file.d.ts +0 -61
- package/dist/utils/file.d.ts.map +0 -1
- package/dist/utils/input-classifier.d.ts +0 -25
- package/dist/utils/input-classifier.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -17
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/markdown-parser.d.ts +0 -60
- package/dist/utils/markdown-parser.d.ts.map +0 -1
- package/dist/utils/shell.d.ts +0 -47
- package/dist/utils/shell.d.ts.map +0 -1
- package/dist/utils/state.d.ts +0 -13
- package/dist/utils/state.d.ts.map +0 -1
- package/dist/utils/syntax-checker.d.ts +0 -24
- package/dist/utils/syntax-checker.d.ts.map +0 -1
- package/dist/utils/terminal-output.d.ts +0 -25
- package/dist/utils/terminal-output.d.ts.map +0 -1
- package/dist/utils/text-clipboard.d.ts +0 -12
- package/dist/utils/text-clipboard.d.ts.map +0 -1
- package/dist/utils/unicode-sanitizer.d.ts +0 -44
- package/dist/utils/unicode-sanitizer.d.ts.map +0 -1
- package/dist/utils/version-checker.d.ts +0 -14
- package/dist/utils/version-checker.d.ts.map +0 -1
|
@@ -1,125 +1,72 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { Box, Text, useInput } from
|
|
3
|
-
import { wrapText } from
|
|
4
|
-
// Maximum number of lines to show before truncating in diff view
|
|
5
|
-
// Using 10 lines to match FileCreationPreview
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { wrapText } from "../../utils/markdown-parser.js";
|
|
6
4
|
const MAX_PREVIEW_LINES = 10;
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const MAX_FULL_VIEW_LINES = 1e3;
|
|
6
|
+
const DiffViewer = ({ diff, filePath, fullDiff }) => {
|
|
7
|
+
const [showFull, setShowFull] = useState(false);
|
|
8
|
+
useInput((input, key) => {
|
|
9
|
+
if (input === "o" && key.ctrl) {
|
|
10
|
+
setShowFull((prev) => !prev);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const renderDiffContent = (content, maxLines) => {
|
|
14
|
+
const lines = content.split("\n");
|
|
15
|
+
const processedLines = [];
|
|
16
|
+
let currentLineNum = 1;
|
|
17
|
+
const terminalWidth = process.stdout.columns || 80;
|
|
18
|
+
const maxContentWidth = Math.max(40, terminalWidth - 11);
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
const trimmed = line.trim();
|
|
21
|
+
if (line.startsWith("@@")) {
|
|
22
|
+
const match = line.match(/@@ \-\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
|
|
23
|
+
if (match && match[1]) {
|
|
24
|
+
currentLineNum = parseInt(match[1], 10);
|
|
14
25
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let style = { color: 'white', backgroundColor: undefined };
|
|
61
|
-
if (type === 'added')
|
|
62
|
-
style = { backgroundColor: undefined, color: 'green' }; // Clean look: colored text
|
|
63
|
-
if (type === 'deleted')
|
|
64
|
-
style = { backgroundColor: undefined, color: 'red' };
|
|
65
|
-
// Format line number
|
|
66
|
-
const lineNumStr = lineNum ? lineNum.toString().padStart(4, ' ') : ' ';
|
|
67
|
-
const cleanText = (line.startsWith('+') || line.startsWith('-') || line.startsWith(' ')) ? line.slice(1) : line;
|
|
68
|
-
// Wrap text
|
|
69
|
-
const wrapped = wrapText(cleanText || ' ', maxContentWidth, 0);
|
|
70
|
-
wrapped.forEach((wLine, idx) => {
|
|
71
|
-
processedLines.push({
|
|
72
|
-
text: wLine,
|
|
73
|
-
...style,
|
|
74
|
-
lineNumStr: idx === 0 ? lineNumStr : ' '
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
// Determine truncation
|
|
79
|
-
const totalLines = processedLines.length;
|
|
80
|
-
const shouldTruncate = totalLines > maxLines;
|
|
81
|
-
const displayLines = shouldTruncate ? processedLines.slice(0, maxLines) : processedLines;
|
|
82
|
-
const hiddenLines = shouldTruncate ? totalLines - maxLines : 0;
|
|
83
|
-
// Stats for summary
|
|
84
|
-
const addedCount = (content.match(/^\+/gm) || []).length;
|
|
85
|
-
const deletedCount = (content.match(/^\-/gm) || []).length;
|
|
86
|
-
const addedText = addedCount === 1 ? '1 line added' : `${addedCount} lines added`;
|
|
87
|
-
const deletedText = deletedCount === 1 ? '1 line deleted' : `${deletedCount} lines deleted`;
|
|
88
|
-
return (React.createElement(React.Fragment, null,
|
|
89
|
-
displayLines.map((line, idx) => (React.createElement(Box, { key: idx, flexDirection: "row" },
|
|
90
|
-
React.createElement(Text, { color: "gray" },
|
|
91
|
-
line.lineNumStr,
|
|
92
|
-
" "),
|
|
93
|
-
React.createElement(Text, { color: line.color, backgroundColor: line.backgroundColor }, line.text)))),
|
|
94
|
-
shouldTruncate && (React.createElement(Box, { marginTop: 1 },
|
|
95
|
-
React.createElement(Text, { color: "#ffaa00", dimColor: true },
|
|
96
|
-
"... ",
|
|
97
|
-
hiddenLines,
|
|
98
|
-
" more ",
|
|
99
|
-
hiddenLines === 1 ? 'line' : 'lines',
|
|
100
|
-
" not shown ..."))),
|
|
101
|
-
React.createElement(Box, { marginTop: 1, marginBottom: 1 },
|
|
102
|
-
React.createElement(Text, { color: "#666666" }, '─'.repeat(terminalWidth - 4))),
|
|
103
|
-
React.createElement(Box, null,
|
|
104
|
-
React.createElement(Text, { color: "green" }, addedText),
|
|
105
|
-
React.createElement(Text, { color: "#666666" }, ", "),
|
|
106
|
-
React.createElement(Text, { color: "red" }, deletedText))));
|
|
107
|
-
};
|
|
108
|
-
// Determine which content to show
|
|
109
|
-
// If showFull is true AND fullDiff is available, show fullDiff
|
|
110
|
-
// If showFull is true but no fullDiff, show expanded regular diff
|
|
111
|
-
// Otherwise show limited regular diff
|
|
112
|
-
const contentToShow = (showFull && fullDiff) ? fullDiff : diff;
|
|
113
|
-
const limit = showFull ? MAX_FULL_VIEW_LINES : MAX_PREVIEW_LINES;
|
|
114
|
-
return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#ffaa00", paddingX: 1 },
|
|
115
|
-
React.createElement(Box, { justifyContent: "space-between" },
|
|
116
|
-
React.createElement(Text, { color: "#ffffff", bold: true },
|
|
117
|
-
"Diff Preview: ",
|
|
118
|
-
filePath || 'Untitled'),
|
|
119
|
-
React.createElement(Box, null,
|
|
120
|
-
React.createElement(Text, { color: "#666666", dimColor: true }, showFull ? 'Ctrl+O: Collapse' : 'Ctrl+O: Full File'))),
|
|
121
|
-
React.createElement(Box, { marginTop: 1, marginBottom: 1 },
|
|
122
|
-
React.createElement(Text, { color: "#666666" }, '─'.repeat((process.stdout.columns || 80) - 4))),
|
|
123
|
-
renderDiffContent(contentToShow, limit)));
|
|
26
|
+
}
|
|
27
|
+
if (line.startsWith("---") || line.startsWith("+++")) continue;
|
|
28
|
+
if (line.startsWith("Index:")) continue;
|
|
29
|
+
if (trimmed.startsWith("===")) continue;
|
|
30
|
+
let type = "context";
|
|
31
|
+
let lineNum = void 0;
|
|
32
|
+
if (line.startsWith("+")) {
|
|
33
|
+
type = "added";
|
|
34
|
+
lineNum = currentLineNum++;
|
|
35
|
+
} else if (line.startsWith("-")) {
|
|
36
|
+
type = "deleted";
|
|
37
|
+
} else {
|
|
38
|
+
type = "context";
|
|
39
|
+
lineNum = currentLineNum++;
|
|
40
|
+
}
|
|
41
|
+
let style = { color: "white", backgroundColor: void 0 };
|
|
42
|
+
if (type === "added") style = { backgroundColor: void 0, color: "green" };
|
|
43
|
+
if (type === "deleted") style = { backgroundColor: void 0, color: "red" };
|
|
44
|
+
const lineNumStr = lineNum ? lineNum.toString().padStart(4, " ") : " ";
|
|
45
|
+
const cleanText = line.startsWith("+") || line.startsWith("-") || line.startsWith(" ") ? line.slice(1) : line;
|
|
46
|
+
const wrapped = wrapText(cleanText || " ", maxContentWidth, 0);
|
|
47
|
+
wrapped.forEach((wLine, idx) => {
|
|
48
|
+
processedLines.push({
|
|
49
|
+
text: wLine,
|
|
50
|
+
...style,
|
|
51
|
+
lineNumStr: idx === 0 ? lineNumStr : " "
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const totalLines = processedLines.length;
|
|
56
|
+
const shouldTruncate = totalLines > maxLines;
|
|
57
|
+
const displayLines = shouldTruncate ? processedLines.slice(0, maxLines) : processedLines;
|
|
58
|
+
const hiddenLines = shouldTruncate ? totalLines - maxLines : 0;
|
|
59
|
+
const addedCount = (content.match(/^\+/gm) || []).length;
|
|
60
|
+
const deletedCount = (content.match(/^\-/gm) || []).length;
|
|
61
|
+
const addedText = addedCount === 1 ? "1 line added" : `${addedCount} lines added`;
|
|
62
|
+
const deletedText = deletedCount === 1 ? "1 line deleted" : `${deletedCount} lines deleted`;
|
|
63
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, displayLines.map((line, idx) => /* @__PURE__ */ React.createElement(Box, { key: idx, flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, { color: "gray" }, line.lineNumStr, " "), /* @__PURE__ */ React.createElement(Text, { color: line.color, backgroundColor: line.backgroundColor }, line.text))), shouldTruncate && /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#ffaa00", dimColor: true }, "... ", hiddenLines, " more ", hiddenLines === 1 ? "line" : "lines", " not shown ...")), /* @__PURE__ */ React.createElement(Box, { marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, "\u2500".repeat(terminalWidth - 4))), /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "green" }, addedText), /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, ", "), /* @__PURE__ */ React.createElement(Text, { color: "red" }, deletedText)));
|
|
64
|
+
};
|
|
65
|
+
const contentToShow = showFull && fullDiff ? fullDiff : diff;
|
|
66
|
+
const limit = showFull ? MAX_FULL_VIEW_LINES : MAX_PREVIEW_LINES;
|
|
67
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#ffaa00", paddingX: 1 }, /* @__PURE__ */ React.createElement(Box, { justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(Text, { color: "#ffffff", bold: true }, "Diff Preview: ", filePath || "Untitled"), /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "#666666", dimColor: true }, showFull ? "Ctrl+O: Collapse" : "Ctrl+O: Full File"))), /* @__PURE__ */ React.createElement(Box, { marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, "\u2500".repeat((process.stdout.columns || 80) - 4))), renderDiffContent(contentToShow, limit));
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
DiffViewer
|
|
124
71
|
};
|
|
125
72
|
//# sourceMappingURL=DiffViewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/components/DiffViewer.tsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport { Box, Text, useInput } from 'ink';\r\nimport { wrapText } from '../../utils/markdown-parser.js';\r\n\r\ninterface DiffViewerProps {\r\n diff: string;\r\n filePath: string;\r\n fullDiff?: string;\r\n}\r\n\r\n// Maximum number of lines to show before truncating in diff view\r\n// Using 10 lines to match FileCreationPreview\r\nconst MAX_PREVIEW_LINES = 10;\r\n// Maximum number of lines to show in full view before truncating\r\nconst MAX_FULL_VIEW_LINES = 1000;\r\n\r\nexport const DiffViewer: React.FC<DiffViewerProps> = ({ diff, filePath, fullDiff }) => {\r\n const [showFull, setShowFull] = useState(false);\r\n\r\n useInput((input, key) => {\r\n if (input === 'o' && key.ctrl) {\r\n setShowFull(prev => !prev);\r\n }\r\n });\r\n\r\n // Process content into displayable lines (wrapped and styled)\r\n const renderDiffContent = (content: string, maxLines: number) => {\r\n const lines = content.split('\\n');\r\n const processedLines: { text: string; color: string; backgroundColor?: string; lineNumStr: string }[] = [];\r\n\r\n // Parse diff logic\r\n let currentLineNum = 1;\r\n\r\n // Calculate max content width\r\n // Terminal width - borders (2) - padding (2) - line number (5 with space)\r\n const terminalWidth = process.stdout.columns || 80;\r\n const maxContentWidth = Math.max(40, terminalWidth - 11);\r\n\r\n for (const line of lines) {\r\n const trimmed = line.trim();\r\n\r\n // Handle diff headers and hunk headers\r\n if (line.startsWith('@@')) {\r\n const match = line.match(/@@ \\-\\d+(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/);\r\n if (match && match[1]) {\r\n currentLineNum = parseInt(match[1], 10);\r\n }\r\n // In full view or if this is relevant context, we generally want to show it\r\n // But for compactness in preview, sometimes hunks are skipped if we implemented smart slicing\r\n // Here we just render everything linearly\r\n }\r\n\r\n // Skip generic diff metadata if it's not useful code context\r\n if (line.startsWith('---') || line.startsWith('+++')) continue;\r\n if (line.startsWith('Index:')) continue;\r\n if (trimmed.startsWith('===')) continue;\r\n\r\n let type: 'added' | 'deleted' | 'context' = 'context';\r\n let lineNum: number | undefined = undefined;\r\n\r\n if (line.startsWith('+')) {\r\n type = 'added';\r\n lineNum = currentLineNum++;\r\n } else if (line.startsWith('-')) {\r\n type = 'deleted';\r\n // No line num increment for deleted lines in new file version\r\n } else {\r\n type = 'context';\r\n lineNum = currentLineNum++;\r\n }\r\n\r\n // Determine style\r\n let style = { color: 'white', backgroundColor: undefined as string | undefined };\r\n if (type === 'added') style = { backgroundColor: undefined, color: 'green' }; // Clean look: colored text\r\n if (type === 'deleted') style = { backgroundColor: undefined, color: 'red' };\r\n\r\n // Format line number\r\n const lineNumStr = lineNum ? lineNum.toString().padStart(4, ' ') : ' ';\r\n const cleanText = (line.startsWith('+') || line.startsWith('-') || line.startsWith(' ')) ? line.slice(1) : line;\r\n\r\n // Wrap text\r\n const wrapped = wrapText(cleanText || ' ', maxContentWidth, 0);\r\n\r\n wrapped.forEach((wLine, idx) => {\r\n processedLines.push({\r\n text: wLine,\r\n ...style,\r\n lineNumStr: idx === 0 ? lineNumStr : ' '\r\n });\r\n });\r\n }\r\n\r\n // Determine truncation\r\n const totalLines = processedLines.length;\r\n const shouldTruncate = totalLines > maxLines;\r\n const displayLines = shouldTruncate ? processedLines.slice(0, maxLines) : processedLines;\r\n const hiddenLines = shouldTruncate ? totalLines - maxLines : 0;\r\n\r\n // Stats for summary\r\n const addedCount = (content.match(/^\\+/gm) || []).length;\r\n const deletedCount = (content.match(/^\\-/gm) || []).length;\r\n const addedText = addedCount === 1 ? '1 line added' : `${addedCount} lines added`;\r\n const deletedText = deletedCount === 1 ? '1 line deleted' : `${deletedCount} lines deleted`;\r\n\r\n return (\r\n <>\r\n {/* Code changes */}\r\n {displayLines.map((line, idx) => (\r\n <Box key={idx} flexDirection=\"row\">\r\n <Text color=\"gray\">{line.lineNumStr} </Text>\r\n <Text color={line.color} backgroundColor={line.backgroundColor}>{line.text}</Text>\r\n </Box>\r\n ))}\r\n\r\n {/* Truncation notice */}\r\n {shouldTruncate && (\r\n <Box marginTop={1}>\r\n <Text color=\"#ffaa00\" dimColor>\r\n ... {hiddenLines} more {hiddenLines === 1 ? 'line' : 'lines'} not shown ...\r\n </Text>\r\n </Box>\r\n )}\r\n\r\n {/* Bottom separator line */}\r\n <Box marginTop={1} marginBottom={1}>\r\n <Text color=\"#666666\">{'─'.repeat(terminalWidth - 4)}</Text>\r\n </Box>\r\n\r\n {/* Summary */}\r\n <Box>\r\n <Text color=\"green\">{addedText}</Text>\r\n <Text color=\"#666666\">, </Text>\r\n <Text color=\"red\">{deletedText}</Text>\r\n </Box>\r\n </>\r\n );\r\n };\r\n\r\n // Determine which content to show\r\n // If showFull is true AND fullDiff is available, show fullDiff\r\n // If showFull is true but no fullDiff, show expanded regular diff\r\n // Otherwise show limited regular diff\r\n const contentToShow = (showFull && fullDiff) ? fullDiff : diff;\r\n const limit = showFull ? MAX_FULL_VIEW_LINES : MAX_PREVIEW_LINES;\r\n\r\n return (\r\n <Box flexDirection=\"column\" borderStyle=\"round\" borderColor=\"#ffaa00\" paddingX={1}>\r\n {/* File path header */}\r\n <Box justifyContent=\"space-between\">\r\n <Text color=\"#ffffff\" bold>Diff Preview: {filePath || 'Untitled'}</Text>\r\n <Box>\r\n <Text color=\"#666666\" dimColor>\r\n {showFull ? 'Ctrl+O: Collapse' : 'Ctrl+O: Full File'}\r\n </Text>\r\n </Box>\r\n </Box>\r\n\r\n {/* Separator line */}\r\n <Box marginTop={1} marginBottom={1}>\r\n <Text color=\"#666666\">{'─'.repeat((process.stdout.columns || 80) - 4)}</Text>\r\n </Box>\r\n\r\n {renderDiffContent(contentToShow, limit)}\r\n </Box>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAO,SAAS,gBAAgB;AAChC,SAAS,KAAK,MAAM,gBAAgB;AACpC,SAAS,gBAAgB;AAUzB,MAAM,oBAAoB;AAE1B,MAAM,sBAAsB;AAErB,MAAM,aAAwC,CAAC,EAAE,MAAM,UAAU,SAAS,MAAM;AACrF,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,WAAS,CAAC,OAAO,QAAQ;AACvB,QAAI,UAAU,OAAO,IAAI,MAAM;AAC7B,kBAAY,UAAQ,CAAC,IAAI;AAAA,IAC3B;AAAA,EACF,CAAC;AAGD,QAAM,oBAAoB,CAAC,SAAiB,aAAqB;AAC/D,UAAM,QAAQ,QAAQ,MAAM,IAAI;AAChC,UAAM,iBAAkG,CAAC;AAGzG,QAAI,iBAAiB;AAIrB,UAAM,gBAAgB,QAAQ,OAAO,WAAW;AAChD,UAAM,kBAAkB,KAAK,IAAI,IAAI,gBAAgB,EAAE;AAEvD,eAAW,QAAQ,OAAO;AACxB,YAAM,UAAU,KAAK,KAAK;AAG1B,UAAI,KAAK,WAAW,IAAI,GAAG;AACzB,cAAM,QAAQ,KAAK,MAAM,uCAAuC;AAChE,YAAI,SAAS,MAAM,CAAC,GAAG;AACrB,2BAAiB,SAAS,MAAM,CAAC,GAAG,EAAE;AAAA,QACxC;AAAA,MAIF;AAGA,UAAI,KAAK,WAAW,KAAK,KAAK,KAAK,WAAW,KAAK,EAAG;AACtD,UAAI,KAAK,WAAW,QAAQ,EAAG;AAC/B,UAAI,QAAQ,WAAW,KAAK,EAAG;AAE/B,UAAI,OAAwC;AAC5C,UAAI,UAA8B;AAElC,UAAI,KAAK,WAAW,GAAG,GAAG;AACxB,eAAO;AACP,kBAAU;AAAA,MACZ,WAAW,KAAK,WAAW,GAAG,GAAG;AAC/B,eAAO;AAAA,MAET,OAAO;AACL,eAAO;AACP,kBAAU;AAAA,MACZ;AAGA,UAAI,QAAQ,EAAE,OAAO,SAAS,iBAAiB,OAAgC;AAC/E,UAAI,SAAS,QAAS,SAAQ,EAAE,iBAAiB,QAAW,OAAO,QAAQ;AAC3E,UAAI,SAAS,UAAW,SAAQ,EAAE,iBAAiB,QAAW,OAAO,MAAM;AAG3E,YAAM,aAAa,UAAU,QAAQ,SAAS,EAAE,SAAS,GAAG,GAAG,IAAI;AACnE,YAAM,YAAa,KAAK,WAAW,GAAG,KAAK,KAAK,WAAW,GAAG,KAAK,KAAK,WAAW,GAAG,IAAK,KAAK,MAAM,CAAC,IAAI;AAG3G,YAAM,UAAU,SAAS,aAAa,KAAK,iBAAiB,CAAC;AAE7D,cAAQ,QAAQ,CAAC,OAAO,QAAQ;AAC9B,uBAAe,KAAK;AAAA,UAClB,MAAM;AAAA,UACN,GAAG;AAAA,UACH,YAAY,QAAQ,IAAI,aAAa;AAAA,QACvC,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAGA,UAAM,aAAa,eAAe;AAClC,UAAM,iBAAiB,aAAa;AACpC,UAAM,eAAe,iBAAiB,eAAe,MAAM,GAAG,QAAQ,IAAI;AAC1E,UAAM,cAAc,iBAAiB,aAAa,WAAW;AAG7D,UAAM,cAAc,QAAQ,MAAM,OAAO,KAAK,CAAC,GAAG;AAClD,UAAM,gBAAgB,QAAQ,MAAM,OAAO,KAAK,CAAC,GAAG;AACpD,UAAM,YAAY,eAAe,IAAI,iBAAiB,GAAG,UAAU;AACnE,UAAM,cAAc,iBAAiB,IAAI,mBAAmB,GAAG,YAAY;AAE3E,WACE,0DAEG,aAAa,IAAI,CAAC,MAAM,QACvB,oCAAC,OAAI,KAAK,KAAK,eAAc,SAC3B,oCAAC,QAAK,OAAM,UAAQ,KAAK,YAAW,GAAC,GACrC,oCAAC,QAAK,OAAO,KAAK,OAAO,iBAAiB,KAAK,mBAAkB,KAAK,IAAK,CAC7E,CACD,GAGA,kBACC,oCAAC,OAAI,WAAW,KACd,oCAAC,QAAK,OAAM,WAAU,UAAQ,QAAC,QACxB,aAAY,UAAO,gBAAgB,IAAI,SAAS,SAAQ,gBAC/D,CACF,GAIF,oCAAC,OAAI,WAAW,GAAG,cAAc,KAC/B,oCAAC,QAAK,OAAM,aAAW,SAAI,OAAO,gBAAgB,CAAC,CAAE,CACvD,GAGA,oCAAC,WACC,oCAAC,QAAK,OAAM,WAAS,SAAU,GAC/B,oCAAC,QAAK,OAAM,aAAU,IAAE,GACxB,oCAAC,QAAK,OAAM,SAAO,WAAY,CACjC,CACF;AAAA,EAEJ;AAMA,QAAM,gBAAiB,YAAY,WAAY,WAAW;AAC1D,QAAM,QAAQ,WAAW,sBAAsB;AAE/C,SACE,oCAAC,OAAI,eAAc,UAAS,aAAY,SAAQ,aAAY,WAAU,UAAU,KAE9E,oCAAC,OAAI,gBAAe,mBAClB,oCAAC,QAAK,OAAM,WAAU,MAAI,QAAC,kBAAe,YAAY,UAAW,GACjE,oCAAC,WACC,oCAAC,QAAK,OAAM,WAAU,UAAQ,QAC3B,WAAW,qBAAqB,mBACnC,CACF,CACF,GAGA,oCAAC,OAAI,WAAW,GAAG,cAAc,KAC/B,oCAAC,QAAK,OAAM,aAAW,SAAI,QAAQ,QAAQ,OAAO,WAAW,MAAM,CAAC,CAAE,CACxE,GAEC,kBAAkB,eAAe,KAAK,CACzC;AAEJ;","names":[]}
|
|
@@ -1,54 +1,46 @@
|
|
|
1
|
-
import React, { Component } from
|
|
2
|
-
import { Box, Text } from
|
|
3
|
-
import { logError } from
|
|
4
|
-
import { quickLog } from
|
|
5
|
-
// Maximum recovery attempts before showing error screen
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { logError } from "../../utils/logger.js";
|
|
4
|
+
import { quickLog } from "../../utils/conversation-logger.js";
|
|
6
5
|
const MAX_RECOVERY_ATTEMPTS = 3;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
class ErrorBoundary extends Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.state = { hasError: false, recoveryAttempts: 0 };
|
|
10
|
+
}
|
|
11
|
+
static getDerivedStateFromError(error) {
|
|
12
|
+
if (error.name === "RuntimeError" && error.message?.includes("memory access out of bounds")) {
|
|
13
|
+
return {};
|
|
11
14
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
return { hasError: true, error };
|
|
16
|
+
}
|
|
17
|
+
componentDidCatch(error, errorInfo) {
|
|
18
|
+
if (error.name === "RuntimeError" && error.message?.includes("memory access out of bounds")) {
|
|
19
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [WASM] ErrorBoundary recovering: ${error.message}
|
|
20
|
+
`);
|
|
21
|
+
const newAttempts = this.state.recoveryAttempts + 1;
|
|
22
|
+
if (newAttempts > MAX_RECOVERY_ATTEMPTS) {
|
|
23
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [WASM] Too many errors, showing error screen
|
|
24
|
+
`);
|
|
25
|
+
this.setState({ hasError: true, error, recoveryAttempts: 0 });
|
|
26
|
+
} else {
|
|
27
|
+
this.setState({ recoveryAttempts: newAttempts });
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
this.forceUpdate();
|
|
30
|
+
}, 100);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
19
33
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const newAttempts = this.state.recoveryAttempts + 1;
|
|
26
|
-
if (newAttempts > MAX_RECOVERY_ATTEMPTS) {
|
|
27
|
-
// Too many errors, show error screen
|
|
28
|
-
quickLog(`[${new Date().toISOString()}] [WASM] Too many errors, showing error screen\n`);
|
|
29
|
-
this.setState({ hasError: true, error, recoveryAttempts: 0 });
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// Try to recover by re-rendering after a brief delay
|
|
33
|
-
this.setState({ recoveryAttempts: newAttempts });
|
|
34
|
-
setTimeout(() => {
|
|
35
|
-
this.forceUpdate();
|
|
36
|
-
}, 100);
|
|
37
|
-
}
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// Log non-recoverable errors
|
|
41
|
-
logError('Centaurus CLI Error', error);
|
|
42
|
-
}
|
|
43
|
-
render() {
|
|
44
|
-
if (this.state.hasError) {
|
|
45
|
-
return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#ff3366", paddingX: 1, marginY: 1 },
|
|
46
|
-
React.createElement(Text, { color: "#ff3366", bold: true }, "\u26A0 An error occurred:"),
|
|
47
|
-
React.createElement(Text, { color: "#ffffff" }, this.state.error?.message),
|
|
48
|
-
React.createElement(Box, { marginTop: 1 },
|
|
49
|
-
React.createElement(Text, { color: "#666666" }, "Please restart the application or check the logs for details."))));
|
|
50
|
-
}
|
|
51
|
-
return this.props.children;
|
|
34
|
+
logError("Centaurus CLI Error", error);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
if (this.state.hasError) {
|
|
38
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#ff3366", paddingX: 1, marginY: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#ff3366", bold: true }, "\u26A0 An error occurred:"), /* @__PURE__ */ React.createElement(Text, { color: "#ffffff" }, this.state.error?.message), /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, "Please restart the application or check the logs for details.")));
|
|
52
39
|
}
|
|
40
|
+
return this.props.children;
|
|
41
|
+
}
|
|
53
42
|
}
|
|
43
|
+
export {
|
|
44
|
+
ErrorBoundary
|
|
45
|
+
};
|
|
54
46
|
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/components/ErrorBoundary.tsx"],"sourcesContent":["import React, { Component, ReactNode } from 'react';\r\nimport { Box, Text } from 'ink';\r\nimport { logError } from '../../utils/logger.js';\r\nimport { quickLog } from '../../utils/conversation-logger.js';\r\n\r\ninterface Props {\r\n children: ReactNode;\r\n}\r\n\r\ninterface State {\r\n hasError: boolean;\r\n error?: Error;\r\n recoveryAttempts: number;\r\n}\r\n\r\n// Maximum recovery attempts before showing error screen\r\nconst MAX_RECOVERY_ATTEMPTS = 3;\r\n\r\nexport class ErrorBoundary extends Component<Props, State> {\r\n constructor(props: Props) {\r\n super(props);\r\n this.state = { hasError: false, recoveryAttempts: 0 };\r\n }\r\n\r\n static getDerivedStateFromError(error: Error): Partial<State> {\r\n // Check if this is a recoverable WASM error\r\n if (error.name === 'RuntimeError' && error.message?.includes('memory access out of bounds')) {\r\n // Don't set hasError for WASM memory errors - they're recoverable\r\n return {};\r\n }\r\n return { hasError: true, error };\r\n }\r\n\r\n componentDidCatch(error: Error, errorInfo: any) {\r\n // Check if this is a WASM memory error - these are recoverable\r\n if (error.name === 'RuntimeError' && error.message?.includes('memory access out of bounds')) {\r\n quickLog(`[${new Date().toISOString()}] [WASM] ErrorBoundary recovering: ${error.message}\\n`);\r\n\r\n // Increment recovery attempts\r\n const newAttempts = this.state.recoveryAttempts + 1;\r\n\r\n if (newAttempts > MAX_RECOVERY_ATTEMPTS) {\r\n // Too many errors, show error screen\r\n quickLog(`[${new Date().toISOString()}] [WASM] Too many errors, showing error screen\\n`);\r\n this.setState({ hasError: true, error, recoveryAttempts: 0 });\r\n } else {\r\n // Try to recover by re-rendering after a brief delay\r\n this.setState({ recoveryAttempts: newAttempts });\r\n setTimeout(() => {\r\n this.forceUpdate();\r\n }, 100);\r\n }\r\n return;\r\n }\r\n\r\n // Log non-recoverable errors\r\n logError('Centaurus CLI Error', error);\r\n }\r\n\r\n render() {\r\n if (this.state.hasError) {\r\n return (\r\n <Box flexDirection=\"column\" borderStyle=\"round\" borderColor=\"#ff3366\" paddingX={1} marginY={1}>\r\n <Text color=\"#ff3366\" bold>⚠ An error occurred:</Text>\r\n <Text color=\"#ffffff\">{this.state.error?.message}</Text>\r\n <Box marginTop={1}>\r\n <Text color=\"#666666\">\r\n Please restart the application or check the logs for details.\r\n </Text>\r\n </Box>\r\n </Box>\r\n );\r\n }\r\n\r\n return this.props.children;\r\n }\r\n}\r\n"],"mappings":"AAAA,OAAO,SAAS,iBAA4B;AAC5C,SAAS,KAAK,YAAY;AAC1B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAazB,MAAM,wBAAwB;AAEvB,MAAM,sBAAsB,UAAwB;AAAA,EACzD,YAAY,OAAc;AACxB,UAAM,KAAK;AACX,SAAK,QAAQ,EAAE,UAAU,OAAO,kBAAkB,EAAE;AAAA,EACtD;AAAA,EAEA,OAAO,yBAAyB,OAA8B;AAE5D,QAAI,MAAM,SAAS,kBAAkB,MAAM,SAAS,SAAS,6BAA6B,GAAG;AAE3F,aAAO,CAAC;AAAA,IACV;AACA,WAAO,EAAE,UAAU,MAAM,MAAM;AAAA,EACjC;AAAA,EAEA,kBAAkB,OAAc,WAAgB;AAE9C,QAAI,MAAM,SAAS,kBAAkB,MAAM,SAAS,SAAS,6BAA6B,GAAG;AAC3F,eAAS,KAAI,oBAAI,KAAK,GAAE,YAAY,CAAC,sCAAsC,MAAM,OAAO;AAAA,CAAI;AAG5F,YAAM,cAAc,KAAK,MAAM,mBAAmB;AAElD,UAAI,cAAc,uBAAuB;AAEvC,iBAAS,KAAI,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,CAAkD;AACvF,aAAK,SAAS,EAAE,UAAU,MAAM,OAAO,kBAAkB,EAAE,CAAC;AAAA,MAC9D,OAAO;AAEL,aAAK,SAAS,EAAE,kBAAkB,YAAY,CAAC;AAC/C,mBAAW,MAAM;AACf,eAAK,YAAY;AAAA,QACnB,GAAG,GAAG;AAAA,MACR;AACA;AAAA,IACF;AAGA,aAAS,uBAAuB,KAAK;AAAA,EACvC;AAAA,EAEA,SAAS;AACP,QAAI,KAAK,MAAM,UAAU;AACvB,aACE,oCAAC,OAAI,eAAc,UAAS,aAAY,SAAQ,aAAY,WAAU,UAAU,GAAG,SAAS,KAC1F,oCAAC,QAAK,OAAM,WAAU,MAAI,QAAC,2BAAoB,GAC/C,oCAAC,QAAK,OAAM,aAAW,KAAK,MAAM,OAAO,OAAQ,GACjD,oCAAC,OAAI,WAAW,KACd,oCAAC,QAAK,OAAM,aAAU,+DAEtB,CACF,CACF;AAAA,IAEJ;AAEA,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
|
|
@@ -1,63 +1,32 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { Box, Text, useInput } from
|
|
3
|
-
import { wrapText } from
|
|
4
|
-
// Maximum number of lines to show before truncating in preview
|
|
5
|
-
// Using 10 lines as a reasonable default for preview
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { wrapText } from "../../utils/markdown-parser.js";
|
|
6
4
|
const MAX_PREVIEW_LINES = 10;
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
React.createElement(Box, { flexDirection: "row" },
|
|
34
|
-
React.createElement(Text, { color: "gray" },
|
|
35
|
-
lineIdx === 0 ? lineNumStr : ' ',
|
|
36
|
-
' '),
|
|
37
|
-
React.createElement(Text, { color: "white" }, wrappedLine)))));
|
|
38
|
-
}).flat(),
|
|
39
|
-
shouldTruncate && (React.createElement(Box, { marginTop: 1 },
|
|
40
|
-
React.createElement(Text, { color: "#00cc66", dimColor: true },
|
|
41
|
-
"... ",
|
|
42
|
-
hiddenLines,
|
|
43
|
-
" more ",
|
|
44
|
-
hiddenLines === 1 ? 'line' : 'lines',
|
|
45
|
-
" not shown ..."))),
|
|
46
|
-
React.createElement(Box, { marginTop: 1, marginBottom: 1 },
|
|
47
|
-
React.createElement(Text, { color: "#666666" }, '─'.repeat(80))),
|
|
48
|
-
React.createElement(Box, null,
|
|
49
|
-
React.createElement(Text, { color: "#00cc66" },
|
|
50
|
-
totalLines,
|
|
51
|
-
" lines to be created"))));
|
|
52
|
-
};
|
|
53
|
-
return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#00cc66", paddingX: 1 },
|
|
54
|
-
React.createElement(Box, { justifyContent: "space-between" },
|
|
55
|
-
React.createElement(Text, { color: "#ffffff", bold: true },
|
|
56
|
-
"New File Preview: ",
|
|
57
|
-
filePath || 'Untitled'),
|
|
58
|
-
React.createElement(Text, { color: "#666666", dimColor: true }, showFull ? 'Press Ctrl+O to collapse' : 'Press Ctrl+O for Full File')),
|
|
59
|
-
React.createElement(Box, { marginTop: 1, marginBottom: 1 },
|
|
60
|
-
React.createElement(Text, { color: "#666666" }, '─'.repeat(80))),
|
|
61
|
-
renderContent(content, showFull ? MAX_FULL_VIEW_LINES : MAX_PREVIEW_LINES)));
|
|
5
|
+
const MAX_FULL_VIEW_LINES = 1e3;
|
|
6
|
+
const FileCreationPreview = ({ content, filePath }) => {
|
|
7
|
+
const [showFull, setShowFull] = useState(false);
|
|
8
|
+
useInput((input, key) => {
|
|
9
|
+
if (input === "o" && key.ctrl) {
|
|
10
|
+
setShowFull((prev) => !prev);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const renderContent = (text, maxLines) => {
|
|
14
|
+
const lines = text.split("\n");
|
|
15
|
+
const totalLines = lines.length;
|
|
16
|
+
const shouldTruncate = totalLines > maxLines;
|
|
17
|
+
const displayLines = shouldTruncate ? lines.slice(0, maxLines) : lines;
|
|
18
|
+
const hiddenLines = shouldTruncate ? totalLines - maxLines : 0;
|
|
19
|
+
const terminalWidth = process.stdout.columns || 80;
|
|
20
|
+
const maxContentWidth = Math.max(40, terminalWidth - 11);
|
|
21
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, displayLines.map((line, idx) => {
|
|
22
|
+
const lineNumStr = (idx + 1).toString().padStart(4, " ");
|
|
23
|
+
const wrappedLines = wrapText(line || " ", maxContentWidth, 0);
|
|
24
|
+
return wrappedLines.map((wrappedLine, lineIdx) => /* @__PURE__ */ React.createElement(Box, { key: `${idx}-${lineIdx}`, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, { color: "gray" }, lineIdx === 0 ? lineNumStr : " ", " "), /* @__PURE__ */ React.createElement(Text, { color: "white" }, wrappedLine))));
|
|
25
|
+
}).flat(), shouldTruncate && /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#00cc66", dimColor: true }, "... ", hiddenLines, " more ", hiddenLines === 1 ? "line" : "lines", " not shown ...")), /* @__PURE__ */ React.createElement(Box, { marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, "\u2500".repeat(80))), /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "#00cc66" }, totalLines, " lines to be created")));
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#00cc66", paddingX: 1 }, /* @__PURE__ */ React.createElement(Box, { justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(Text, { color: "#ffffff", bold: true }, "New File Preview: ", filePath || "Untitled"), /* @__PURE__ */ React.createElement(Text, { color: "#666666", dimColor: true }, showFull ? "Press Ctrl+O to collapse" : "Press Ctrl+O for Full File")), /* @__PURE__ */ React.createElement(Box, { marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, "\u2500".repeat(80))), renderContent(content, showFull ? MAX_FULL_VIEW_LINES : MAX_PREVIEW_LINES));
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
FileCreationPreview
|
|
62
31
|
};
|
|
63
32
|
//# sourceMappingURL=FileCreationPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/components/FileCreationPreview.tsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport { Box, Text, useInput } from 'ink';\r\nimport { wrapText } from '../../utils/markdown-parser.js';\r\n\r\ninterface FileCreationPreviewProps {\r\n content: string;\r\n filePath?: string;\r\n}\r\n\r\n// Maximum number of lines to show before truncating in preview\r\n// Using 10 lines as a reasonable default for preview\r\nconst MAX_PREVIEW_LINES = 10;\r\n// Maximum number of lines to show in full view before truncating\r\nconst MAX_FULL_VIEW_LINES = 1000;\r\n\r\nexport const FileCreationPreview: React.FC<FileCreationPreviewProps> = ({ content, filePath }) => {\r\n const [showFull, setShowFull] = useState(false);\r\n\r\n useInput((input, key) => {\r\n if (input === 'o' && key.ctrl) {\r\n setShowFull(prev => !prev);\r\n }\r\n });\r\n\r\n const renderContent = (text: string, maxLines: number) => {\r\n const lines = text.split('\\n');\r\n const totalLines = lines.length;\r\n const shouldTruncate = totalLines > maxLines;\r\n const displayLines = shouldTruncate ? lines.slice(0, maxLines) : lines;\r\n const hiddenLines = shouldTruncate ? totalLines - maxLines : 0;\r\n\r\n // Calculate available width for content\r\n // Terminal width - borders (2) - padding (2) - line number (5 with space)\r\n const terminalWidth = process.stdout.columns || 80;\r\n const maxContentWidth = Math.max(40, terminalWidth - 11);\r\n\r\n return (\r\n <>\r\n {displayLines.map((line, idx) => {\r\n // Format line number: fixed width 4 chars\r\n const lineNumStr = (idx + 1).toString().padStart(4, ' ');\r\n\r\n // Use wrapText utility to wrap long lines properly\r\n const wrappedLines = wrapText(line || ' ', maxContentWidth, 0);\r\n\r\n return wrappedLines.map((wrappedLine, lineIdx) => (\r\n <Box key={`${idx}-${lineIdx}`} flexDirection=\"column\">\r\n <Box flexDirection=\"row\">\r\n <Text color=\"gray\">\r\n {lineIdx === 0 ? lineNumStr : ' '}\r\n {' '}\r\n </Text>\r\n <Text color=\"white\">{wrappedLine}</Text>\r\n </Box>\r\n </Box>\r\n ));\r\n }).flat()}\r\n\r\n {/* Truncation notice */}\r\n {shouldTruncate && (\r\n <Box marginTop={1}>\r\n <Text color=\"#00cc66\" dimColor>\r\n ... {hiddenLines} more {hiddenLines === 1 ? 'line' : 'lines'} not shown ...\r\n </Text>\r\n </Box>\r\n )}\r\n\r\n {/* Bottom separator line */}\r\n <Box marginTop={1} marginBottom={1}>\r\n <Text color=\"#666666\">{'─'.repeat(80)}</Text>\r\n </Box>\r\n\r\n {/* Summary */}\r\n <Box>\r\n <Text color=\"#00cc66\">{totalLines} lines to be created</Text>\r\n </Box>\r\n </>\r\n );\r\n };\r\n\r\n return (\r\n <Box flexDirection=\"column\" borderStyle=\"round\" borderColor=\"#00cc66\" paddingX={1}>\r\n {/* File path header */}\r\n <Box justifyContent=\"space-between\">\r\n <Text color=\"#ffffff\" bold>New File Preview: {filePath || 'Untitled'}</Text>\r\n <Text color=\"#666666\" dimColor>\r\n {showFull ? 'Press Ctrl+O to collapse' : 'Press Ctrl+O for Full File'}\r\n </Text>\r\n </Box>\r\n\r\n {/* Separator line */}\r\n <Box marginTop={1} marginBottom={1}>\r\n <Text color=\"#666666\">{'─'.repeat(80)}</Text>\r\n </Box>\r\n\r\n {renderContent(content, showFull ? MAX_FULL_VIEW_LINES : MAX_PREVIEW_LINES)}\r\n </Box>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAO,SAAS,gBAAgB;AAChC,SAAS,KAAK,MAAM,gBAAgB;AACpC,SAAS,gBAAgB;AASzB,MAAM,oBAAoB;AAE1B,MAAM,sBAAsB;AAErB,MAAM,sBAA0D,CAAC,EAAE,SAAS,SAAS,MAAM;AAC9F,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,WAAS,CAAC,OAAO,QAAQ;AACrB,QAAI,UAAU,OAAO,IAAI,MAAM;AAC3B,kBAAY,UAAQ,CAAC,IAAI;AAAA,IAC7B;AAAA,EACJ,CAAC;AAED,QAAM,gBAAgB,CAAC,MAAc,aAAqB;AACtD,UAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,UAAM,aAAa,MAAM;AACzB,UAAM,iBAAiB,aAAa;AACpC,UAAM,eAAe,iBAAiB,MAAM,MAAM,GAAG,QAAQ,IAAI;AACjE,UAAM,cAAc,iBAAiB,aAAa,WAAW;AAI7D,UAAM,gBAAgB,QAAQ,OAAO,WAAW;AAChD,UAAM,kBAAkB,KAAK,IAAI,IAAI,gBAAgB,EAAE;AAEvD,WACI,0DACK,aAAa,IAAI,CAAC,MAAM,QAAQ;AAE7B,YAAM,cAAc,MAAM,GAAG,SAAS,EAAE,SAAS,GAAG,GAAG;AAGvD,YAAM,eAAe,SAAS,QAAQ,KAAK,iBAAiB,CAAC;AAE7D,aAAO,aAAa,IAAI,CAAC,aAAa,YAClC,oCAAC,OAAI,KAAK,GAAG,GAAG,IAAI,OAAO,IAAI,eAAc,YACzC,oCAAC,OAAI,eAAc,SACf,oCAAC,QAAK,OAAM,UACP,YAAY,IAAI,aAAa,QAC7B,GACL,GACA,oCAAC,QAAK,OAAM,WAAS,WAAY,CACrC,CACJ,CACH;AAAA,IACL,CAAC,EAAE,KAAK,GAGP,kBACG,oCAAC,OAAI,WAAW,KACZ,oCAAC,QAAK,OAAM,WAAU,UAAQ,QAAC,QACtB,aAAY,UAAO,gBAAgB,IAAI,SAAS,SAAQ,gBACjE,CACJ,GAIJ,oCAAC,OAAI,WAAW,GAAG,cAAc,KAC7B,oCAAC,QAAK,OAAM,aAAW,SAAI,OAAO,EAAE,CAAE,CAC1C,GAGA,oCAAC,WACG,oCAAC,QAAK,OAAM,aAAW,YAAW,sBAAoB,CAC1D,CACJ;AAAA,EAER;AAEA,SACI,oCAAC,OAAI,eAAc,UAAS,aAAY,SAAQ,aAAY,WAAU,UAAU,KAE5E,oCAAC,OAAI,gBAAe,mBAChB,oCAAC,QAAK,OAAM,WAAU,MAAI,QAAC,sBAAmB,YAAY,UAAW,GACrE,oCAAC,QAAK,OAAM,WAAU,UAAQ,QACzB,WAAW,6BAA6B,4BAC7C,CACJ,GAGA,oCAAC,OAAI,WAAW,GAAG,cAAc,KAC7B,oCAAC,QAAK,OAAM,aAAW,SAAI,OAAO,EAAE,CAAE,CAC1C,GAEC,cAAc,SAAS,WAAW,sBAAsB,iBAAiB,CAC9E;AAER;","names":[]}
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Box, Text } from
|
|
3
|
-
import { DiffViewer } from
|
|
4
|
-
import { CodeBlock } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { DiffViewer } from "./DiffViewer.js";
|
|
4
|
+
import { CodeBlock } from "./CodeBlock.js";
|
|
5
|
+
const FileOperation = ({
|
|
6
|
+
operation,
|
|
7
|
+
filePath,
|
|
8
|
+
content,
|
|
9
|
+
diff
|
|
10
|
+
}) => {
|
|
11
|
+
const getOperationColor = () => {
|
|
12
|
+
switch (operation) {
|
|
13
|
+
case "create":
|
|
14
|
+
return "#00cc66";
|
|
15
|
+
case "edit":
|
|
16
|
+
return "#ffaa00";
|
|
17
|
+
case "delete":
|
|
18
|
+
return "#ff3366";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const getOperationIcon = () => {
|
|
22
|
+
switch (operation) {
|
|
23
|
+
case "create":
|
|
24
|
+
return "+";
|
|
25
|
+
case "edit":
|
|
26
|
+
return "~";
|
|
27
|
+
case "delete":
|
|
28
|
+
return "-";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: getOperationColor(), paddingX: 1, marginY: 1 }, /* @__PURE__ */ React.createElement(Box, { marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: getOperationColor(), bold: true }, getOperationIcon(), " ", operation.toUpperCase(), ": ", filePath)), diff && /* @__PURE__ */ React.createElement(DiffViewer, { diff, filePath }), content && !diff && /* @__PURE__ */ React.createElement(CodeBlock, { code: content }));
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
FileOperation
|
|
30
35
|
};
|
|
31
36
|
//# sourceMappingURL=FileOperation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/components/FileOperation.tsx"],"sourcesContent":["import React from 'react';\r\nimport { Box, Text } from 'ink';\r\nimport { DiffViewer } from './DiffViewer.js';\r\nimport { CodeBlock } from './CodeBlock.js';\r\n\r\ninterface FileOperationProps {\r\n operation: 'create' | 'edit' | 'delete';\r\n filePath: string;\r\n content?: string;\r\n diff?: string;\r\n}\r\n\r\nexport const FileOperation: React.FC<FileOperationProps> = ({\r\n operation,\r\n filePath,\r\n content,\r\n diff\r\n}) => {\r\n const getOperationColor = () => {\r\n switch (operation) {\r\n case 'create': return '#00cc66';\r\n case 'edit': return '#ffaa00';\r\n case 'delete': return '#ff3366';\r\n }\r\n };\r\n\r\n const getOperationIcon = () => {\r\n switch (operation) {\r\n case 'create': return '+';\r\n case 'edit': return '~';\r\n case 'delete': return '-';\r\n }\r\n };\r\n\r\n return (\r\n <Box flexDirection=\"column\" borderStyle=\"round\" borderColor={getOperationColor()} paddingX={1} marginY={1}>\r\n <Box marginBottom={1}>\r\n <Text color={getOperationColor()} bold>\r\n {getOperationIcon()} {operation.toUpperCase()}: {filePath}\r\n </Text>\r\n </Box>\r\n \r\n {diff && <DiffViewer diff={diff} filePath={filePath} />}\r\n {content && !diff && <CodeBlock code={content} />}\r\n </Box>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,KAAK,YAAY;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AASnB,MAAM,gBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,oBAAoB,MAAM;AAC9B,YAAQ,WAAW;AAAA,MACjB,KAAK;AAAU,eAAO;AAAA,MACtB,KAAK;AAAQ,eAAO;AAAA,MACpB,KAAK;AAAU,eAAO;AAAA,IACxB;AAAA,EACF;AAEA,QAAM,mBAAmB,MAAM;AAC7B,YAAQ,WAAW;AAAA,MACjB,KAAK;AAAU,eAAO;AAAA,MACtB,KAAK;AAAQ,eAAO;AAAA,MACpB,KAAK;AAAU,eAAO;AAAA,IACxB;AAAA,EACF;AAEA,SACE,oCAAC,OAAI,eAAc,UAAS,aAAY,SAAQ,aAAa,kBAAkB,GAAG,UAAU,GAAG,SAAS,KACtG,oCAAC,OAAI,cAAc,KACjB,oCAAC,QAAK,OAAO,kBAAkB,GAAG,MAAI,QACnC,iBAAiB,GAAE,KAAE,UAAU,YAAY,GAAE,MAAG,QACnD,CACF,GAEC,QAAQ,oCAAC,cAAW,MAAY,UAAoB,GACpD,WAAW,CAAC,QAAQ,oCAAC,aAAU,MAAM,SAAS,CACjD;AAEJ;","names":[]}
|