@nanocollective/nanocoder 1.11.3
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/LICENSE.md +23 -0
- package/README.md +366 -0
- package/dist/app/hooks/useAppInitialization.d.ts +26 -0
- package/dist/app/hooks/useAppInitialization.d.ts.map +1 -0
- package/dist/app/hooks/useAppInitialization.js +151 -0
- package/dist/app/hooks/useAppInitialization.js.map +1 -0
- package/dist/app/hooks/useAppState.d.ts +84 -0
- package/dist/app/hooks/useAppState.d.ts.map +1 -0
- package/dist/app/hooks/useAppState.js +162 -0
- package/dist/app/hooks/useAppState.js.map +1 -0
- package/dist/app/hooks/useChatHandler.d.ts +26 -0
- package/dist/app/hooks/useChatHandler.d.ts.map +1 -0
- package/dist/app/hooks/useChatHandler.js +532 -0
- package/dist/app/hooks/useChatHandler.js.map +1 -0
- package/dist/app/hooks/useDirectoryTrust.d.ts +15 -0
- package/dist/app/hooks/useDirectoryTrust.d.ts.map +1 -0
- package/dist/app/hooks/useDirectoryTrust.js +77 -0
- package/dist/app/hooks/useDirectoryTrust.js.map +1 -0
- package/dist/app/hooks/useModeHandlers.d.ts +31 -0
- package/dist/app/hooks/useModeHandlers.d.ts.map +1 -0
- package/dist/app/hooks/useModeHandlers.js +98 -0
- package/dist/app/hooks/useModeHandlers.js.map +1 -0
- package/dist/app/hooks/useToolHandler.d.ts +32 -0
- package/dist/app/hooks/useToolHandler.d.ts.map +1 -0
- package/dist/app/hooks/useToolHandler.js +154 -0
- package/dist/app/hooks/useToolHandler.js.map +1 -0
- package/dist/app/utils/appUtils.d.ts +4 -0
- package/dist/app/utils/appUtils.d.ts.map +1 -0
- package/dist/app/utils/appUtils.js +147 -0
- package/dist/app/utils/appUtils.js.map +1 -0
- package/dist/app/utils/conversationState.d.ts +68 -0
- package/dist/app/utils/conversationState.d.ts.map +1 -0
- package/dist/app/utils/conversationState.js +199 -0
- package/dist/app/utils/conversationState.js.map +1 -0
- package/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +193 -0
- package/dist/app.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -0
- package/dist/client-factory.d.ts +6 -0
- package/dist/client-factory.d.ts.map +1 -0
- package/dist/client-factory.js +111 -0
- package/dist/client-factory.js.map +1 -0
- package/dist/command-parser.d.ts +5 -0
- package/dist/command-parser.d.ts.map +1 -0
- package/dist/command-parser.js +36 -0
- package/dist/command-parser.js.map +1 -0
- package/dist/commands/clear.d.ts +3 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +17 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/custom-commands.d.ts +3 -0
- package/dist/commands/custom-commands.d.ts.map +1 -0
- package/dist/commands/custom-commands.js +41 -0
- package/dist/commands/custom-commands.js.map +1 -0
- package/dist/commands/debug.d.ts +3 -0
- package/dist/commands/debug.d.ts.map +1 -0
- package/dist/commands/debug.js +86 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/exit.d.ts +3 -0
- package/dist/commands/exit.d.ts.map +1 -0
- package/dist/commands/exit.js +17 -0
- package/dist/commands/exit.js.map +1 -0
- package/dist/commands/export.d.ts +3 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +63 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/help.d.ts +3 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +31 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/index.d.ts +13 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +13 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +214 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +9 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +41 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/model.d.ts +3 -0
- package/dist/commands/model.d.ts.map +1 -0
- package/dist/commands/model.js +11 -0
- package/dist/commands/model.js.map +1 -0
- package/dist/commands/provider.d.ts +3 -0
- package/dist/commands/provider.d.ts.map +1 -0
- package/dist/commands/provider.js +11 -0
- package/dist/commands/provider.js.map +1 -0
- package/dist/commands/theme.d.ts +3 -0
- package/dist/commands/theme.d.ts.map +1 -0
- package/dist/commands/theme.js +11 -0
- package/dist/commands/theme.js.map +1 -0
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +10 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands.d.ts +16 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +46 -0
- package/dist/commands.js.map +1 -0
- package/dist/components/assistant-message.d.ts +4 -0
- package/dist/components/assistant-message.d.ts.map +1 -0
- package/dist/components/assistant-message.js +43 -0
- package/dist/components/assistant-message.js.map +1 -0
- package/dist/components/bash-execution-indicator.d.ts +4 -0
- package/dist/components/bash-execution-indicator.d.ts.map +1 -0
- package/dist/components/bash-execution-indicator.js +9 -0
- package/dist/components/bash-execution-indicator.js.map +1 -0
- package/dist/components/cancelling-indicator.d.ts +3 -0
- package/dist/components/cancelling-indicator.d.ts.map +1 -0
- package/dist/components/cancelling-indicator.js +10 -0
- package/dist/components/cancelling-indicator.js.map +1 -0
- package/dist/components/chat-queue.d.ts +4 -0
- package/dist/components/chat-queue.d.ts.map +1 -0
- package/dist/components/chat-queue.js +23 -0
- package/dist/components/chat-queue.js.map +1 -0
- package/dist/components/custom-commands.d.ts +7 -0
- package/dist/components/custom-commands.d.ts.map +1 -0
- package/dist/components/custom-commands.js +27 -0
- package/dist/components/custom-commands.js.map +1 -0
- package/dist/components/error-message.d.ts +7 -0
- package/dist/components/error-message.d.ts.map +1 -0
- package/dist/components/error-message.js +12 -0
- package/dist/components/error-message.js.map +1 -0
- package/dist/components/info-message.d.ts +6 -0
- package/dist/components/info-message.d.ts.map +1 -0
- package/dist/components/info-message.js +11 -0
- package/dist/components/info-message.js.map +1 -0
- package/dist/components/model-selector.d.ts +10 -0
- package/dist/components/model-selector.d.ts.map +1 -0
- package/dist/components/model-selector.js +59 -0
- package/dist/components/model-selector.js.map +1 -0
- package/dist/components/provider-selector.d.ts +9 -0
- package/dist/components/provider-selector.d.ts.map +1 -0
- package/dist/components/provider-selector.js +36 -0
- package/dist/components/provider-selector.js.map +1 -0
- package/dist/components/security-disclaimer.d.ts +7 -0
- package/dist/components/security-disclaimer.d.ts.map +1 -0
- package/dist/components/security-disclaimer.js +36 -0
- package/dist/components/security-disclaimer.js.map +1 -0
- package/dist/components/status.d.ts +6 -0
- package/dist/components/status.d.ts.map +1 -0
- package/dist/components/status.js +35 -0
- package/dist/components/status.js.map +1 -0
- package/dist/components/success-message.d.ts +6 -0
- package/dist/components/success-message.d.ts.map +1 -0
- package/dist/components/success-message.js +11 -0
- package/dist/components/success-message.js.map +1 -0
- package/dist/components/theme-selector.d.ts +8 -0
- package/dist/components/theme-selector.d.ts.map +1 -0
- package/dist/components/theme-selector.js +40 -0
- package/dist/components/theme-selector.js.map +1 -0
- package/dist/components/thinking-indicator.d.ts +4 -0
- package/dist/components/thinking-indicator.d.ts.map +1 -0
- package/dist/components/thinking-indicator.js +32 -0
- package/dist/components/thinking-indicator.js.map +1 -0
- package/dist/components/tool-confirmation.d.ts +9 -0
- package/dist/components/tool-confirmation.d.ts.map +1 -0
- package/dist/components/tool-confirmation.js +72 -0
- package/dist/components/tool-confirmation.js.map +1 -0
- package/dist/components/tool-execution-indicator.d.ts +3 -0
- package/dist/components/tool-execution-indicator.d.ts.map +1 -0
- package/dist/components/tool-execution-indicator.js +9 -0
- package/dist/components/tool-execution-indicator.js.map +1 -0
- package/dist/components/tool-message.d.ts +10 -0
- package/dist/components/tool-message.d.ts.map +1 -0
- package/dist/components/tool-message.js +16 -0
- package/dist/components/tool-message.js.map +1 -0
- package/dist/components/update-message.d.ts +7 -0
- package/dist/components/update-message.d.ts.map +1 -0
- package/dist/components/update-message.js +93 -0
- package/dist/components/update-message.js.map +1 -0
- package/dist/components/user-input.d.ts +10 -0
- package/dist/components/user-input.d.ts.map +1 -0
- package/dist/components/user-input.js +188 -0
- package/dist/components/user-input.js.map +1 -0
- package/dist/components/user-message.d.ts +4 -0
- package/dist/components/user-message.d.ts.map +1 -0
- package/dist/components/user-message.js +15 -0
- package/dist/components/user-message.js.map +1 -0
- package/dist/components/welcome-message.d.ts +3 -0
- package/dist/components/welcome-message.d.ts.map +1 -0
- package/dist/components/welcome-message.js +21 -0
- package/dist/components/welcome-message.js.map +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +44 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/logging.d.ts +14 -0
- package/dist/config/logging.d.ts.map +1 -0
- package/dist/config/logging.js +58 -0
- package/dist/config/logging.js.map +1 -0
- package/dist/config/preferences.d.ts +7 -0
- package/dist/config/preferences.d.ts.map +1 -0
- package/dist/config/preferences.js +46 -0
- package/dist/config/preferences.js.map +1 -0
- package/dist/config/themes.d.ts +6 -0
- package/dist/config/themes.d.ts.map +1 -0
- package/dist/config/themes.js +295 -0
- package/dist/config/themes.js.map +1 -0
- package/dist/custom-commands/executor.d.ts +12 -0
- package/dist/custom-commands/executor.d.ts.map +1 -0
- package/dist/custom-commands/executor.js +45 -0
- package/dist/custom-commands/executor.js.map +1 -0
- package/dist/custom-commands/index.d.ts +4 -0
- package/dist/custom-commands/index.d.ts.map +1 -0
- package/dist/custom-commands/index.js +4 -0
- package/dist/custom-commands/index.js.map +1 -0
- package/dist/custom-commands/loader.d.ts +41 -0
- package/dist/custom-commands/loader.d.ts.map +1 -0
- package/dist/custom-commands/loader.js +129 -0
- package/dist/custom-commands/loader.js.map +1 -0
- package/dist/custom-commands/parser.d.ts +10 -0
- package/dist/custom-commands/parser.d.ts.map +1 -0
- package/dist/custom-commands/parser.js +181 -0
- package/dist/custom-commands/parser.js.map +1 -0
- package/dist/hooks/useInputState.d.ts +14 -0
- package/dist/hooks/useInputState.d.ts.map +1 -0
- package/dist/hooks/useInputState.js +66 -0
- package/dist/hooks/useInputState.js.map +1 -0
- package/dist/hooks/useTerminalWidth.d.ts +2 -0
- package/dist/hooks/useTerminalWidth.d.ts.map +1 -0
- package/dist/hooks/useTerminalWidth.js +20 -0
- package/dist/hooks/useTerminalWidth.js.map +1 -0
- package/dist/hooks/useTheme.d.ts +9 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useTheme.js +10 -0
- package/dist/hooks/useTheme.js.map +1 -0
- package/dist/hooks/useUIState.d.ts +19 -0
- package/dist/hooks/useUIState.d.ts.map +1 -0
- package/dist/hooks/useUIState.js +46 -0
- package/dist/hooks/useUIState.js.map +1 -0
- package/dist/init/agents-template-generator.d.ts +29 -0
- package/dist/init/agents-template-generator.d.ts.map +1 -0
- package/dist/init/agents-template-generator.js +340 -0
- package/dist/init/agents-template-generator.js.map +1 -0
- package/dist/init/existing-rules-extractor.d.ts +43 -0
- package/dist/init/existing-rules-extractor.d.ts.map +1 -0
- package/dist/init/existing-rules-extractor.js +226 -0
- package/dist/init/existing-rules-extractor.js.map +1 -0
- package/dist/init/file-scanner.d.ts +40 -0
- package/dist/init/file-scanner.d.ts.map +1 -0
- package/dist/init/file-scanner.js +153 -0
- package/dist/init/file-scanner.js.map +1 -0
- package/dist/init/framework-detector.d.ts +57 -0
- package/dist/init/framework-detector.d.ts.map +1 -0
- package/dist/init/framework-detector.js +277 -0
- package/dist/init/framework-detector.js.map +1 -0
- package/dist/init/language-detector.d.ts +31 -0
- package/dist/init/language-detector.d.ts.map +1 -0
- package/dist/init/language-detector.js +205 -0
- package/dist/init/language-detector.js.map +1 -0
- package/dist/init/project-analyzer.d.ts +62 -0
- package/dist/init/project-analyzer.d.ts.map +1 -0
- package/dist/init/project-analyzer.js +294 -0
- package/dist/init/project-analyzer.js.map +1 -0
- package/dist/langgraph-client.d.ts +20 -0
- package/dist/langgraph-client.d.ts.map +1 -0
- package/dist/langgraph-client.js +245 -0
- package/dist/langgraph-client.js.map +1 -0
- package/dist/mcp/mcp-client.d.ts +23 -0
- package/dist/mcp/mcp-client.d.ts.map +1 -0
- package/dist/mcp/mcp-client.js +194 -0
- package/dist/mcp/mcp-client.js.map +1 -0
- package/dist/mcp/mcp-tool-adapter.d.ts +22 -0
- package/dist/mcp/mcp-tool-adapter.d.ts.map +1 -0
- package/dist/mcp/mcp-tool-adapter.js +49 -0
- package/dist/mcp/mcp-tool-adapter.js.map +1 -0
- package/dist/message-handler.d.ts +7 -0
- package/dist/message-handler.d.ts.map +1 -0
- package/dist/message-handler.js +53 -0
- package/dist/message-handler.js.map +1 -0
- package/dist/prompt-history.d.ts +14 -0
- package/dist/prompt-history.d.ts.map +1 -0
- package/dist/prompt-history.js +88 -0
- package/dist/prompt-history.js.map +1 -0
- package/dist/tool-calling/index.d.ts +6 -0
- package/dist/tool-calling/index.d.ts.map +1 -0
- package/dist/tool-calling/index.js +5 -0
- package/dist/tool-calling/index.js.map +1 -0
- package/dist/tool-calling/json-parser.d.ts +7 -0
- package/dist/tool-calling/json-parser.d.ts.map +1 -0
- package/dist/tool-calling/json-parser.js +168 -0
- package/dist/tool-calling/json-parser.js.map +1 -0
- package/dist/tool-calling/xml-parser.d.ts +34 -0
- package/dist/tool-calling/xml-parser.d.ts.map +1 -0
- package/dist/tool-calling/xml-parser.js +113 -0
- package/dist/tool-calling/xml-parser.js.map +1 -0
- package/dist/tools/create-file.d.ts +3 -0
- package/dist/tools/create-file.d.ts.map +1 -0
- package/dist/tools/create-file.js +66 -0
- package/dist/tools/create-file.js.map +1 -0
- package/dist/tools/delete-lines.d.ts +3 -0
- package/dist/tools/delete-lines.d.ts.map +1 -0
- package/dist/tools/delete-lines.js +218 -0
- package/dist/tools/delete-lines.js.map +1 -0
- package/dist/tools/execute-bash.d.ts +3 -0
- package/dist/tools/execute-bash.d.ts.map +1 -0
- package/dist/tools/execute-bash.js +107 -0
- package/dist/tools/execute-bash.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +23 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/insert-lines.d.ts +3 -0
- package/dist/tools/insert-lines.d.ts.map +1 -0
- package/dist/tools/insert-lines.js +185 -0
- package/dist/tools/insert-lines.js.map +1 -0
- package/dist/tools/read-file.d.ts +3 -0
- package/dist/tools/read-file.d.ts.map +1 -0
- package/dist/tools/read-file.js +81 -0
- package/dist/tools/read-file.js.map +1 -0
- package/dist/tools/read-many-files.d.ts +3 -0
- package/dist/tools/read-many-files.d.ts.map +1 -0
- package/dist/tools/read-many-files.js +109 -0
- package/dist/tools/read-many-files.js.map +1 -0
- package/dist/tools/replace-lines.d.ts +3 -0
- package/dist/tools/replace-lines.d.ts.map +1 -0
- package/dist/tools/replace-lines.js +220 -0
- package/dist/tools/replace-lines.js.map +1 -0
- package/dist/tools/tool-manager.d.ts +54 -0
- package/dist/tools/tool-manager.d.ts.map +1 -0
- package/dist/tools/tool-manager.js +108 -0
- package/dist/tools/tool-manager.js.map +1 -0
- package/dist/types/app.d.ts +46 -0
- package/dist/types/app.d.ts.map +1 -0
- package/dist/types/app.js +2 -0
- package/dist/types/app.js.map +1 -0
- package/dist/types/commands.d.ts +36 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +2 -0
- package/dist/types/commands.js.map +1 -0
- package/dist/types/components.d.ts +87 -0
- package/dist/types/components.d.ts.map +1 -0
- package/dist/types/components.js +2 -0
- package/dist/types/components.js.map +1 -0
- package/dist/types/config.d.ts +35 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/core.d.ts +57 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +2 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/hooks.d.ts +26 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/hooks.js +2 -0
- package/dist/types/hooks.js.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mcp.d.ts +19 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +2 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/tools.d.ts +31 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +2 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/ui.d.ts +22 -0
- package/dist/types/ui.d.ts.map +1 -0
- package/dist/types/ui.js +2 -0
- package/dist/types/ui.js.map +1 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +2 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/utils/message-queue.d.ts +8 -0
- package/dist/utils/message-queue.d.ts.map +1 -0
- package/dist/utils/message-queue.js +50 -0
- package/dist/utils/message-queue.js.map +1 -0
- package/dist/utils/programming-language-helper.d.ts +2 -0
- package/dist/utils/programming-language-helper.d.ts.map +1 -0
- package/dist/utils/programming-language-helper.js +32 -0
- package/dist/utils/programming-language-helper.js.map +1 -0
- package/dist/utils/prompt-processor.d.ts +6 -0
- package/dist/utils/prompt-processor.d.ts.map +1 -0
- package/dist/utils/prompt-processor.js +103 -0
- package/dist/utils/prompt-processor.js.map +1 -0
- package/dist/utils/update-checker.d.ts +6 -0
- package/dist/utils/update-checker.d.ts.map +1 -0
- package/dist/utils/update-checker.js +120 -0
- package/dist/utils/update-checker.js.map +1 -0
- package/package.json +97 -0
- package/source/app/prompts/main-prompt.md +107 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CustomCommand } from '../types/index.js';
|
|
2
|
+
interface CustomCommandsProps {
|
|
3
|
+
commands: CustomCommand[];
|
|
4
|
+
}
|
|
5
|
+
export default function CustomCommands({ commands }: CustomCommandsProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=custom-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-commands.d.ts","sourceRoot":"","sources":["../../source/components/custom-commands.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGrD,UAAU,mBAAmB;IAC5B,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC1B;AAuBD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAC,QAAQ,EAAC,EAAE,mBAAmB,2CA0ErE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
6
|
+
function formatCommand(cmd) {
|
|
7
|
+
const parts = [`/${cmd.fullName}`];
|
|
8
|
+
if (cmd.metadata.parameters && cmd.metadata.parameters.length > 0) {
|
|
9
|
+
parts.push(cmd.metadata.parameters.map((p) => `<${p}>`).join(' '));
|
|
10
|
+
}
|
|
11
|
+
if (cmd.metadata.description) {
|
|
12
|
+
parts.push(`- ${cmd.metadata.description}`);
|
|
13
|
+
}
|
|
14
|
+
if (cmd.metadata.aliases && cmd.metadata.aliases.length > 0) {
|
|
15
|
+
const aliasNames = cmd.metadata.aliases.map((a) => cmd.namespace ? `${cmd.namespace}:${a}` : a);
|
|
16
|
+
parts.push(`(aliases: ${aliasNames.join(', ')})`);
|
|
17
|
+
}
|
|
18
|
+
return parts.join(' ');
|
|
19
|
+
}
|
|
20
|
+
export default function CustomCommands({ commands }) {
|
|
21
|
+
const boxWidth = useTerminalWidth();
|
|
22
|
+
const { colors } = useTheme();
|
|
23
|
+
// Sort commands alphabetically by full name
|
|
24
|
+
const sortedCommands = [...commands].sort((a, b) => a.fullName.localeCompare(b.fullName));
|
|
25
|
+
return (_jsx(TitledBox, { borderStyle: "round", titles: ['/custom-commands'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.primary, paddingX: 2, paddingY: 1, flexDirection: "column", marginBottom: 1, children: commands.length === 0 ? (_jsxs(_Fragment, { children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: colors.white, bold: true, children: "No custom commands found" }) }), _jsx(Text, { color: colors.white, children: "To create custom commands:" }), _jsxs(Text, { color: colors.secondary, children: ["1. Create a ", _jsx(Text, { color: colors.primary, children: ".nanocoder/commands" }), ' ', "directory in your project"] }), _jsxs(Text, { color: colors.secondary, children: ["2. Add ", _jsx(Text, { color: colors.primary, children: ".md" }), " files with command prompts"] }), _jsx(Text, { color: colors.secondary, children: "3. Optionally add frontmatter for metadata:" }), _jsx(Box, { marginTop: 1, marginBottom: 1, children: _jsxs(Text, { color: colors.secondary, children: [`---\n`, `description: Generate unit tests\n`, `aliases: [test, unittest]\n`, `parameters: [filename]\n`, `---\n`, `Generate comprehensive unit tests for {{filename}}...`] }) })] })) : (_jsxs(_Fragment, { children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: colors.white, children: ["Found ", commands.length, " custom command", commands.length !== 1 ? 's' : '', ":"] }) }), sortedCommands.map((cmd, index) => (_jsxs(Text, { color: colors.white, children: ["\u2022 ", formatCommand(cmd)] }, index)))] })) }, colors.primary));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=custom-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-commands.js","sourceRoot":"","sources":["../../source/components/custom-commands.tsx"],"names":[],"mappings":";AAAA,OAAO,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AAC,KAAK,EAAE,MAAM,CAAC,SAAS,4DAEtB,EAEP,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,YACjC,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,aAC3B,OAAO,EACP,oCAAoC,EACpC,6BAA6B,EAC7B,0BAA0B,EAC1B,OAAO,EACP,uDAAuD,IAClD,GACF,IACJ,CACH,CAAC,CAAC,CAAC,CACH,8BACC,KAAC,GAAG,IAAC,YAAY,EAAE,CAAC,YACnB,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,uBACjB,QAAQ,CAAC,MAAM,qBACrB,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAC3B,GACF,EAEL,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CACnC,MAAC,IAAI,IAAa,KAAK,EAAE,MAAM,CAAC,KAAK,wBACjC,aAAa,CAAC,GAAG,CAAC,KADX,KAAK,CAET,CACP,CAAC,IACA,CACH,IA7DI,MAAM,CAAC,OAAO,CA8DR,CACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../../source/components/error-message.tsx"],"names":[],"mappings":";aAYU,MAAM;gBACH,OAAO;cACT,OAAO;;AAPlB,wBA6CG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
7
|
+
export default memo(function ErrorMessage({ message, hideTitle = false, hideBox = false, }) {
|
|
8
|
+
const boxWidth = useTerminalWidth();
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
return (_jsx(_Fragment, { children: hideBox ? (_jsx(Box, { width: boxWidth, flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: colors.error, children: message }) })) : hideTitle ? (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.error, paddingX: 2, paddingY: 0, flexDirection: "column", children: _jsx(Text, { color: colors.error, children: message }) })) : (_jsx(TitledBox, { borderStyle: "round", titles: ['Error'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.error, paddingX: 2, paddingY: 1, flexDirection: "column", children: _jsx(Text, { color: colors.error, children: message }) }, colors.primary)) }));
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=error-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-message.js","sourceRoot":"","sources":["../../source/components/error-message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,eAAe,IAAI,CAAC,SAAS,YAAY,CAAC,EACzC,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,KAAK,GAKf;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC5B,OAAO,CACN,4BACE,OAAO,CAAC,CAAC,CAAC,CACV,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,YAC3D,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,GACtC,CACN,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CACf,KAAC,GAAG,IACH,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,GACtC,CACN,CAAC,CAAC,CAAC,CACH,KAAC,SAAS,IAET,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,OAAO,CAAC,EACjB,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,IAVtC,MAAM,CAAC,OAAO,CAWR,CACZ,GACC,CACH,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-message.d.ts","sourceRoot":"","sources":["../../source/components/info-message.tsx"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EACnC,OAAO,EACP,SAAiB,EACjB,OAAe,GACf,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,2CAqCA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
6
|
+
export default function InfoMessage({ message, hideTitle = false, hideBox = false, }) {
|
|
7
|
+
const boxWidth = useTerminalWidth();
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
return (_jsx(_Fragment, { children: hideBox ? (_jsx(Box, { width: boxWidth, flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: colors.info, children: message }) })) : hideTitle ? (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.info, paddingX: 2, paddingY: 0, flexDirection: "column", children: _jsx(Text, { color: colors.info, children: message }) })) : (_jsx(TitledBox, { borderStyle: "round", titles: ['Info'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.info, paddingX: 2, paddingY: 1, flexDirection: "column", children: _jsx(Text, { color: colors.info, children: message }) }, colors.primary)) }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=info-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-message.js","sourceRoot":"","sources":["../../source/components/info-message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAE9B,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EACnC,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,KAAK,GAKf;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC5B,OAAO,CACN,4BACE,OAAO,CAAC,CAAC,CAAC,CACV,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,YAC3D,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,YAAG,OAAO,GAAQ,GACrC,CACN,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CACf,KAAC,GAAG,IACH,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,IAAI,EACxB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,YAAG,OAAO,GAAQ,GACrC,CACN,CAAC,CAAC,CAAC,CACH,KAAC,SAAS,IAET,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,MAAM,CAAC,EAChB,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,IAAI,EACxB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,YAAG,OAAO,GAAQ,IAVrC,MAAM,CAAC,OAAO,CAWR,CACZ,GACC,CACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LLMClient } from '../types/core.js';
|
|
2
|
+
interface ModelSelectorProps {
|
|
3
|
+
client: LLMClient | null;
|
|
4
|
+
currentModel: string;
|
|
5
|
+
onModelSelect: (model: string) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
}
|
|
8
|
+
export default function ModelSelector({ client, currentModel, onModelSelect, onCancel, }: ModelSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=model-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-selector.d.ts","sourceRoot":"","sources":["../../source/components/model-selector.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAG3C,UAAU,kBAAkB;IAC3B,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAOD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACrC,MAAM,EACN,YAAY,EACZ,aAAa,EACb,QAAQ,GACR,EAAE,kBAAkB,2CAiHpB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
import SelectInput from 'ink-select-input';
|
|
5
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
6
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
7
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
8
|
+
export default function ModelSelector({ client, currentModel, onModelSelect, onCancel, }) {
|
|
9
|
+
const boxWidth = useTerminalWidth();
|
|
10
|
+
const { colors } = useTheme();
|
|
11
|
+
const [models, setModels] = useState([]);
|
|
12
|
+
const [loading, setLoading] = useState(true);
|
|
13
|
+
const [error, setError] = useState(null);
|
|
14
|
+
// Handle escape key to cancel
|
|
15
|
+
useInput((_, key) => {
|
|
16
|
+
if (key.escape) {
|
|
17
|
+
onCancel();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const loadModels = async () => {
|
|
22
|
+
if (!client) {
|
|
23
|
+
setError('No active client found');
|
|
24
|
+
setLoading(false);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const availableModels = await client.getAvailableModels();
|
|
29
|
+
if (availableModels.length === 0) {
|
|
30
|
+
setError('No models available. Please check your configuration.');
|
|
31
|
+
setLoading(false);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const modelOptions = availableModels.map(model => ({
|
|
35
|
+
label: `${model}${model === currentModel ? ' (current)' : ''}`,
|
|
36
|
+
value: model,
|
|
37
|
+
}));
|
|
38
|
+
setModels(modelOptions);
|
|
39
|
+
setLoading(false);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
setError(`Error accessing models: ${err}`);
|
|
43
|
+
setLoading(false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
loadModels();
|
|
47
|
+
}, [client, currentModel]);
|
|
48
|
+
const handleSelect = (item) => {
|
|
49
|
+
onModelSelect(item.value);
|
|
50
|
+
};
|
|
51
|
+
if (loading) {
|
|
52
|
+
return (_jsx(TitledBox, { borderStyle: "round", titles: ['Model Selection'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.primary, paddingX: 2, paddingY: 1, marginBottom: 1, children: _jsx(Text, { color: colors.secondary, children: "Loading available models..." }) }, colors.primary));
|
|
53
|
+
}
|
|
54
|
+
if (error) {
|
|
55
|
+
return (_jsx(TitledBox, { borderStyle: "round", titles: ['Model Selection - Error'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.error, paddingX: 2, paddingY: 1, marginBottom: 1, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: colors.error, children: error }), _jsx(Text, { color: colors.secondary, children: "Make sure your provider is properly configured." }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.secondary, children: "Press Escape to cancel" }) })] }) }));
|
|
56
|
+
}
|
|
57
|
+
return (_jsx(TitledBox, { borderStyle: "round", titles: ['Select a Model'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.primary, paddingX: 2, paddingY: 1, marginBottom: 1, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(SelectInput, { items: models, onSelect: handleSelect }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.secondary, children: "Press Escape to cancel" }) })] }) }));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=model-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-selector.js","sourceRoot":"","sources":["../../source/components/model-selector.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAC;AACxC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAc9D,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACrC,MAAM,EACN,YAAY,EACZ,aAAa,EACb,QAAQ,GACY;IACpB,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC5B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,EAAE,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,8BAA8B;IAC9B,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;QACnB,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YAChB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YAEf,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aAC1B,KAAC,WAAW,IAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAI,EACtD,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YAChB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,uCAA+B,GACvD,IACD,GACK,CACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProviderType } from '../types/core.js';
|
|
2
|
+
interface ProviderSelectorProps {
|
|
3
|
+
currentProvider: ProviderType;
|
|
4
|
+
onProviderSelect: (provider: ProviderType) => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
export default function ProviderSelector({ currentProvider, onProviderSelect, onCancel, }: ProviderSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=provider-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-selector.d.ts","sourceRoot":"","sources":["../../source/components/provider-selector.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAG9C,UAAU,qBAAqB;IAC9B,eAAe,EAAE,YAAY,CAAC;IAC9B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAOD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACxC,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACR,EAAE,qBAAqB,2CAsDvB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
import SelectInput from 'ink-select-input';
|
|
5
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
6
|
+
import { appConfig } from '../config/index.js';
|
|
7
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
8
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
9
|
+
export default function ProviderSelector({ currentProvider, onProviderSelect, onCancel, }) {
|
|
10
|
+
const boxWidth = useTerminalWidth();
|
|
11
|
+
const { colors } = useTheme();
|
|
12
|
+
const getProviderOptions = () => {
|
|
13
|
+
const options = [];
|
|
14
|
+
if (appConfig.providers) {
|
|
15
|
+
for (const provider of appConfig.providers) {
|
|
16
|
+
options.push({
|
|
17
|
+
label: `${provider.name}${currentProvider === provider.name ? ' (current)' : ''}`,
|
|
18
|
+
value: provider.name,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return options;
|
|
23
|
+
};
|
|
24
|
+
const [providers] = useState(getProviderOptions());
|
|
25
|
+
// Handle escape key to cancel
|
|
26
|
+
useInput((_, key) => {
|
|
27
|
+
if (key.escape) {
|
|
28
|
+
onCancel();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const handleSelect = (item) => {
|
|
32
|
+
onProviderSelect(item.value);
|
|
33
|
+
};
|
|
34
|
+
return (_jsx(TitledBox, { borderStyle: "round", titles: ['Select a Provider'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.primary, paddingX: 2, paddingY: 1, marginBottom: 1, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(SelectInput, { items: providers, onSelect: handleSelect }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.secondary, children: "Press Escape to cancel" }) })] }) }, colors.primary));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=provider-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-selector.js","sourceRoot":"","sources":["../../source/components/provider-selector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO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ACF,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,CAAC,IAAoB,EAAE,EAAE;QAC7C,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAO,CACN,KAAC,SAAS,IAET,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,mBAAmB,CAAC,EAC7B,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,CAAC,YAEf,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aAC1B,KAAC,WAAW,IAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAI,EACzD,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YAChB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,uCAA+B,GACvD,IACD,IAfD,MAAM,CAAC,OAAO,CAgBR,CACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface SecurityDisclaimerProps {
|
|
2
|
+
onConfirm: () => void;
|
|
3
|
+
onExit: () => void;
|
|
4
|
+
}
|
|
5
|
+
export default function SecurityDisclaimer({ onConfirm, onExit }: SecurityDisclaimerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=security-disclaimer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-disclaimer.d.ts","sourceRoot":"","sources":["../../source/components/security-disclaimer.tsx"],"names":[],"mappings":"AAMA,UAAU,uBAAuB;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAOD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,uBAAuB,2CAiDxF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import SelectInput from 'ink-select-input';
|
|
4
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
5
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
6
|
+
import { getThemeColors, defaultTheme } from '../config/themes.js';
|
|
7
|
+
var SecurityDisclaimerOption;
|
|
8
|
+
(function (SecurityDisclaimerOption) {
|
|
9
|
+
SecurityDisclaimerOption["Yes"] = "yes";
|
|
10
|
+
SecurityDisclaimerOption["No"] = "no";
|
|
11
|
+
})(SecurityDisclaimerOption || (SecurityDisclaimerOption = {}));
|
|
12
|
+
export default function SecurityDisclaimer({ onConfirm, onExit }) {
|
|
13
|
+
const boxWidth = useTerminalWidth();
|
|
14
|
+
const colors = getThemeColors(defaultTheme);
|
|
15
|
+
// Inline item type kept close to usage to limit scope and improve readability
|
|
16
|
+
const items = [
|
|
17
|
+
{
|
|
18
|
+
label: 'Yes, proceed',
|
|
19
|
+
value: SecurityDisclaimerOption.Yes,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 'No, exit',
|
|
23
|
+
value: SecurityDisclaimerOption.No,
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
const handleSelect = (item) => {
|
|
27
|
+
if (item.value === SecurityDisclaimerOption.Yes) {
|
|
28
|
+
onConfirm();
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
onExit();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (_jsx(Box, { flexDirection: "column", padding: 1, children: _jsxs(TitledBox, { borderStyle: "round", titles: ['Security Warning'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.error, paddingX: 2, paddingY: 1, flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { bold: true, color: colors.warning, children: "Do you trust the files in this folder?" }), _jsx(Text, { children: process.cwd() }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: "Nanocoder may read, write, or execute files contained in this directory. This can pose security risks, so only use files from trusted sources." }) }), _jsx(SelectInput, { items: items, onSelect: handleSelect })] }, colors.primary) }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=security-disclaimer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-disclaimer.js","sourceRoot":"","sources":["../../source/components/security-disclaimer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOnE,IAAK,wBAGJ;AAHD,WAAK,wBAAwB;IACzB,uCAAW,CAAA;IACX,qCAAS,CAAA;AACb,CAAC,EAHI,wBAAwB,KAAxB,wBAAwB,QAG5B;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,SAAS,EAAE,MAAM,EAA2B;IACrF,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IAE5C,8EAA8E;IAC9E,MAAM,KAAK,GAAyD;QAChE;YACI,KAAK,EAAE,cAAc;YACrB,KAAK,EAAE,wBAAwB,CAAC,GAAG;SACtC;QACD;YACI,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE,wBAAwB,CAAC,EAAE;SACrC;KACJ,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,IAAwD,EAAE,EAAE;QAC9E,IAAI,IAAI,CAAC,KAAK,KAAK,wBAAwB,CAAC,GAAG,EAAE,CAAC;YAC9C,SAAS,EAAE,CAAC;QAChB,CAAC;aAAM,CAAC;YACJ,MAAM,EAAE,CAAC;QACb,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,YAClC,MAAC,SAAS,IAEN,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,kBAAkB,CAAC,EAC5B,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,EACtB,YAAY,EAAE,CAAC,aAEf,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,MAAM,CAAC,OAAO,uDAA+C,EAC/E,KAAC,IAAI,cAAE,OAAO,CAAC,GAAG,EAAE,GAAQ,EAC5B,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACb,KAAC,IAAI,iKAEE,GACL,EACN,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,GAAI,KAlBhD,MAAM,CAAC,OAAO,CAmBX,GACV,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../source/components/status.tsx"],"names":[],"mappings":";cAwBW,MAAM;WACT,MAAM;;AALd,wBA+EG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import { memo, useEffect, useState } from 'react';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
7
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
8
|
+
import { checkForUpdates } from '../utils/update-checker.js';
|
|
9
|
+
import { themes } from '../config/themes.js';
|
|
10
|
+
// Get CWD once at module load time
|
|
11
|
+
const cwd = process.cwd();
|
|
12
|
+
export default memo(function Status({ provider, model, }) {
|
|
13
|
+
const boxWidth = useTerminalWidth();
|
|
14
|
+
const { colors, currentTheme } = useTheme();
|
|
15
|
+
const [updateInfo, setUpdateInfo] = useState(null);
|
|
16
|
+
const [agentsMdLoaded, setAgentsMdLoaded] = useState(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const performUpdateCheck = async () => {
|
|
19
|
+
try {
|
|
20
|
+
const info = await checkForUpdates();
|
|
21
|
+
setUpdateInfo(info);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
// Silent failure - don't show errors for update checks
|
|
25
|
+
setUpdateInfo(null);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
performUpdateCheck();
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setAgentsMdLoaded(existsSync(`${cwd}/AGENTS.md`));
|
|
32
|
+
}, []);
|
|
33
|
+
return (_jsxs(TitledBox, { borderStyle: "round", titles: ['Status'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.info, paddingX: 2, paddingY: 1, flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { color: colors.info, children: [_jsx(Text, { bold: true, children: "CWD: " }), cwd] }), _jsxs(Text, { color: colors.success, children: [_jsx(Text, { bold: true, children: "Provider: " }), provider, ", ", _jsx(Text, { bold: true, children: "Model: " }), model] }), _jsxs(Text, { color: colors.primary, children: [_jsx(Text, { bold: true, children: "Theme: " }), themes[currentTheme].displayName] }), agentsMdLoaded ? (_jsx(Text, { color: colors.secondary, italic: true, children: _jsx(Text, { children: "\u21B3 Using AGENTS.md. Project initialized" }) })) : (_jsx(Text, { color: colors.secondary, italic: true, children: "\u21B3 No AGENTS.md file found, run `/init` to initialize this directory" })), updateInfo?.hasUpdate && (_jsxs(_Fragment, { children: [_jsxs(Text, { color: colors.warning, children: [_jsx(Text, { bold: true, children: "Update Available: " }), "v", updateInfo.currentVersion, " \u2192 v", updateInfo.latestVersion] }), updateInfo.updateCommand && (_jsxs(Text, { color: colors.secondary, children: ["\u21B3 Run: /update or ", updateInfo.updateCommand] }))] }))] }, colors.primary));
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../source/components/status.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,CAAC;AAE9B,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAE3C,mCAAmC;AACnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAS1B,eAAe,IAAI,CAAC,SAAS,MAAM,CAAC,EACnC,QAAQ,EACR,KAAK,GAIL;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAC,MAAM,EAAE,YAAY,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC1C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,cAAc,EAAE,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IAAI,wBAAgB,EAC/B,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,IAC3B,EACN,cAAc,CAAC,CAAC,CAAC,CACjB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,kBACpC,KAAC,IAAI,8DAA8C,GAC7C,CACP,CAAC,CAAC,CAAC,CACH,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,+FAE9B,CACP,EACA,UAAU,EAAE,SAAS,IAAI,CACzB,8BACC,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,aAC1B,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,mCAA2B,OAC1C,UAAU,CAAC,cAAc,eAAM,UAAU,CAAC,aAAa,IAClD,EACN,UAAU,CAAC,aAAa,IAAI,CAC5B,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,wCACT,UAAU,CAAC,aAAa,IACrC,CACP,IACC,CACH,KA7CI,MAAM,CAAC,OAAO,CA8CR,CACZ,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"success-message.d.ts","sourceRoot":"","sources":["../../source/components/success-message.tsx"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACtC,OAAO,EACP,SAAiB,EACjB,OAAe,GACf,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,2CAqCA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
6
|
+
export default function SuccessMessage({ message, hideTitle = false, hideBox = false, }) {
|
|
7
|
+
const boxWidth = useTerminalWidth();
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
return (_jsx(_Fragment, { children: hideBox ? (_jsx(Box, { width: boxWidth, flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: colors.success, children: message }) })) : hideTitle ? (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.success, paddingX: 2, paddingY: 0, flexDirection: "column", children: _jsx(Text, { color: colors.success, children: message }) })) : (_jsx(TitledBox, { borderStyle: "round", titles: ['Success'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.success, paddingX: 2, paddingY: 1, flexDirection: "column", children: _jsx(Text, { color: colors.success, children: message }) }, colors.primary)) }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=success-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"success-message.js","sourceRoot":"","sources":["../../source/components/success-message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAE9B,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACtC,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,KAAK,GAKf;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC5B,OAAO,CACN,4BACE,OAAO,CAAC,CAAC,CAAC,CACV,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,YAC3D,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAQ,GACxC,CACN,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CACf,KAAC,GAAG,IACH,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAQ,GACxC,CACN,CAAC,CAAC,CAAC,CACH,KAAC,SAAS,IAET,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,SAAS,CAAC,EACnB,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAQ,IAVxC,MAAM,CAAC,OAAO,CAWR,CACZ,GACC,CACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ThemePreset } from '../types/ui.js';
|
|
2
|
+
interface ThemeSelectorProps {
|
|
3
|
+
onThemeSelect: (theme: ThemePreset) => void;
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
}
|
|
6
|
+
export default function ThemeSelector({ onThemeSelect, onCancel, }: ThemeSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=theme-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-selector.d.ts","sourceRoot":"","sources":["../../source/components/theme-selector.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAEhD,UAAU,kBAAkB;IAC3B,aAAa,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAOD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACrC,aAAa,EACb,QAAQ,GACR,EAAE,kBAAkB,2CA2EpB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
import SelectInput from 'ink-select-input';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
7
|
+
import { themes } from '../config/themes.js';
|
|
8
|
+
export default function ThemeSelector({ onThemeSelect, onCancel, }) {
|
|
9
|
+
const boxWidth = useTerminalWidth();
|
|
10
|
+
const { colors, currentTheme, setCurrentTheme } = useTheme();
|
|
11
|
+
const [originalTheme] = useState(currentTheme); // Store original theme for restore on cancel
|
|
12
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
13
|
+
// Handle escape key to cancel
|
|
14
|
+
useInput((_, key) => {
|
|
15
|
+
if (key.escape) {
|
|
16
|
+
// Restore original theme on cancel
|
|
17
|
+
setCurrentTheme(originalTheme);
|
|
18
|
+
onCancel();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
// Create theme options from available themes
|
|
22
|
+
const themeOptions = Object.values(themes).map(theme => ({
|
|
23
|
+
label: theme.displayName + (theme.name === originalTheme ? ' (current)' : ''),
|
|
24
|
+
value: theme.name,
|
|
25
|
+
}));
|
|
26
|
+
// Find index of current theme for initial selection
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const index = themeOptions.findIndex(option => option.value === originalTheme);
|
|
29
|
+
setCurrentIndex(index >= 0 ? index : 0);
|
|
30
|
+
}, []);
|
|
31
|
+
const handleSelect = (item) => {
|
|
32
|
+
onThemeSelect(item.value);
|
|
33
|
+
};
|
|
34
|
+
// Handle theme preview during navigation
|
|
35
|
+
const handleHighlight = (item) => {
|
|
36
|
+
setCurrentTheme(item.value);
|
|
37
|
+
};
|
|
38
|
+
return (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.primary, paddingX: 2, paddingY: 1, marginBottom: 1, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: colors.secondary, children: ["Select a theme (current: ", themes[currentTheme].displayName, ")"] }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: colors.secondary, children: "\u2191/\u2193 Navigate \u2022 Enter Select \u2022 Esc Cancel" }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: colors.info, children: "The entire CLI will change as you navigate. Try it out!" }) }), _jsx(SelectInput, { items: themeOptions, onSelect: handleSelect, onHighlight: handleHighlight })] }) }));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=theme-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-selector.js","sourceRoot":"","sources":["../../source/components/theme-selector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAC;AACxC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAa3C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACrC,aAAa,EACb,QAAQ,GACY;IACpB,MAAM,QAAQ,G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yC;IACzC,MAAM,eAAe,GAAG,CAAC,IAAiB,EAAE,EAAE;QAC7C,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO,CACN,KAAC,GAAG,IACH,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,CAAC,YAEf,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aAC1B,KAAC,GAAG,IAAC,YAAY,EAAE,CAAC,YACnB,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,0CACF,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,SACpD,GACF,EAEN,KAAC,GAAG,IAAC,YAAY,EAAE,CAAC,YACnB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,6EAEtB,GACF,EAEN,KAAC,GAAG,IAAC,YAAY,EAAE,CAAC,YACnB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,wEAEjB,GACF,EAEN,KAAC,WAAW,IACX,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,eAAe,GAC3B,IACG,GACD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking-indicator.d.ts","sourceRoot":"","sources":["../../source/components/thinking-indicator.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;;AAE9D,wBAqDG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { Box, Text } from 'ink';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
export default memo(function ThinkingIndicator({ contextSize, totalTokensUsed, tokensPerSecond, }) {
|
|
6
|
+
const { colors } = useTheme();
|
|
7
|
+
const [elapsedSeconds, setElapsedSeconds] = useState(0);
|
|
8
|
+
const startTimeRef = useRef(Date.now());
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
startTimeRef.current = Date.now();
|
|
11
|
+
setElapsedSeconds(0);
|
|
12
|
+
}, []);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const timer = setInterval(() => {
|
|
15
|
+
const currentTime = Date.now();
|
|
16
|
+
const elapsed = Math.floor((currentTime - startTimeRef.current) / 1000);
|
|
17
|
+
setElapsedSeconds(elapsed);
|
|
18
|
+
}, 1000);
|
|
19
|
+
return () => {
|
|
20
|
+
clearInterval(timer);
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
const percentage = contextSize > 0 ? Math.round((totalTokensUsed / contextSize) * 100) : 0;
|
|
24
|
+
// Clamp percentage to prevent display jitter from values over 100%
|
|
25
|
+
const displayPercentage = Math.min(percentage, 100);
|
|
26
|
+
// Format tokens per second display
|
|
27
|
+
const tokensPerSecondDisplay = tokensPerSecond !== undefined && tokensPerSecond > 0
|
|
28
|
+
? ` • ${tokensPerSecond} tok/s`
|
|
29
|
+
: '';
|
|
30
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { flexWrap: "wrap", children: [_jsx(Text, { children: "\uD83D\uDD04" }), _jsx(Text, { color: colors.secondary, children: " Thinking... " }), _jsxs(Text, { color: colors.white, children: [elapsedSeconds, "s", tokensPerSecondDisplay, contextSize > 0 ? ` • ${displayPercentage}% context used` : ''] })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.secondary, children: "Press Escape to cancel" }) })] }));
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=thinking-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking-indicator.js","sourceR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Ae,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzE,mEAAmE;IACnE,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAEpD,mCAAmC;IACnC,MAAM,sBAAsB,GAC3B,eAAe,KAAK,SAAS,IAAI,eAAe,GAAG,CAAC;QACnD,CAAC,CAAC,MAAM,eAAe,QAAQ;QAC/B,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,CACN,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,aAC1C,MAAC,GAAG,IAAC,QAAQ,EAAC,MAAM,aACnB,KAAC,IAAI,+BAAU,EACf,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,8BAAsB,EACnD,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,aACvB,cAAc,OAAG,sBAAsB,EACvC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,iBAAiB,gBAAgB,CAAC,CAAC,CAAC,EAAE,IACzD,IACF,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YAChB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,uCAA+B,GACvD,IACD,CACN,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolCall } from '../types/core.js';
|
|
2
|
+
interface ToolConfirmationProps {
|
|
3
|
+
toolCall: ToolCall;
|
|
4
|
+
onConfirm: (confirmed: boolean) => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
export default function ToolConfirmation({ toolCall, onConfirm, onCancel, }: ToolConfirmationProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=tool-confirmation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-confirmation.d.ts","sourceRoot":"","sources":["../../source/components/tool-confirmation.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAK/C,UAAU,qBAAqB;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAOD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACxC,QAAQ,EACR,SAAS,EACT,QAAQ,GACR,EAAE,qBAAqB,2CAyHvB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
import SelectInput from 'ink-select-input';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import { toolFormatters } from '../tools/index.js';
|
|
7
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
8
|
+
import { getToolManager } from '../message-handler.js';
|
|
9
|
+
export default function ToolConfirmation({ toolCall, onConfirm, onCancel, }) {
|
|
10
|
+
const boxWidth = useTerminalWidth();
|
|
11
|
+
const { colors } = useTheme();
|
|
12
|
+
const [formatterPreview, setFormatterPreview] = React.useState(null);
|
|
13
|
+
const [isLoadingPreview, setIsLoadingPreview] = React.useState(false);
|
|
14
|
+
const [hasFormatterError, setHasFormatterError] = React.useState(false);
|
|
15
|
+
// Get MCP tool info for display
|
|
16
|
+
const toolManager = getToolManager();
|
|
17
|
+
const mcpInfo = toolManager?.getMCPToolInfo(toolCall.function.name) || { isMCPTool: false };
|
|
18
|
+
// Load formatter preview
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const loadPreview = async () => {
|
|
21
|
+
const formatter = toolFormatters[toolCall.function.name];
|
|
22
|
+
if (formatter) {
|
|
23
|
+
setIsLoadingPreview(true);
|
|
24
|
+
try {
|
|
25
|
+
// Parse arguments if they're a JSON string
|
|
26
|
+
let parsedArgs = toolCall.function.arguments;
|
|
27
|
+
if (typeof parsedArgs === 'string') {
|
|
28
|
+
try {
|
|
29
|
+
parsedArgs = JSON.parse(parsedArgs);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
// If parsing fails, use as-is
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const preview = await formatter(parsedArgs);
|
|
36
|
+
setFormatterPreview(preview);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Error loading formatter preview:', error);
|
|
40
|
+
setHasFormatterError(true);
|
|
41
|
+
setFormatterPreview(_jsxs(Text, { color: colors.error, children: ["Error: ", String(error)] }));
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
setIsLoadingPreview(false);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
loadPreview();
|
|
49
|
+
}, [toolCall]);
|
|
50
|
+
// Handle escape key to cancel
|
|
51
|
+
useInput((inputChar, key) => {
|
|
52
|
+
if (key.escape) {
|
|
53
|
+
onCancel();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
// Auto-cancel if there's a formatter error
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
if (hasFormatterError) {
|
|
59
|
+
// Automatically cancel the tool execution
|
|
60
|
+
onConfirm(false);
|
|
61
|
+
}
|
|
62
|
+
}, [hasFormatterError, onConfirm]);
|
|
63
|
+
const options = [
|
|
64
|
+
{ label: '✓ Yes, execute this tool', value: true },
|
|
65
|
+
{ label: '✗ No, cancel execution', value: false },
|
|
66
|
+
];
|
|
67
|
+
const handleSelect = (item) => {
|
|
68
|
+
onConfirm(item.value);
|
|
69
|
+
};
|
|
70
|
+
return (_jsx(Box, { width: boxWidth, marginBottom: 1, children: _jsxs(Box, { flexDirection: "column", children: [isLoadingPreview && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: colors.secondary, children: "Loading preview..." }) })), formatterPreview && !isLoadingPreview && (_jsx(Box, { marginBottom: 1, flexDirection: "column", children: _jsx(Box, { children: React.isValidElement(formatterPreview) ? (formatterPreview) : (_jsx(Text, { color: colors.white, children: String(formatterPreview) })) }) })), !hasFormatterError && (_jsxs(_Fragment, { children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: colors.tool, children: ["Do you want to execute ", mcpInfo.isMCPTool ? `MCP tool "${toolCall.function.name}" from server "${mcpInfo.serverName}"` : `tool "${toolCall.function.name}"`, "?"] }) }), _jsx(SelectInput, { items: options, onSelect: handleSelect }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.secondary, children: "Press Escape to cancel" }) })] })), hasFormatterError && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: colors.error, children: "Tool execution cancelled due to validation error." }), _jsx(Text, { color: colors.secondary, children: "Press Escape to continue" })] }))] }) }));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=tool-confirmation.js.map
|