@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,32 @@
|
|
|
1
|
+
export function getLanguageFromExtension(ext) {
|
|
2
|
+
const languageMap = {
|
|
3
|
+
js: 'javascript',
|
|
4
|
+
jsx: 'javascript',
|
|
5
|
+
ts: 'typescript',
|
|
6
|
+
tsx: 'typescript',
|
|
7
|
+
py: 'python',
|
|
8
|
+
rb: 'ruby',
|
|
9
|
+
go: 'go',
|
|
10
|
+
rs: 'rust',
|
|
11
|
+
java: 'java',
|
|
12
|
+
cpp: 'cpp',
|
|
13
|
+
c: 'c',
|
|
14
|
+
cs: 'csharp',
|
|
15
|
+
php: 'php',
|
|
16
|
+
html: 'html',
|
|
17
|
+
css: 'css',
|
|
18
|
+
scss: 'scss',
|
|
19
|
+
json: 'json',
|
|
20
|
+
yaml: 'yaml',
|
|
21
|
+
yml: 'yaml',
|
|
22
|
+
xml: 'xml',
|
|
23
|
+
md: 'markdown',
|
|
24
|
+
sh: 'bash',
|
|
25
|
+
bash: 'bash',
|
|
26
|
+
zsh: 'bash',
|
|
27
|
+
fish: 'bash',
|
|
28
|
+
sql: 'sql',
|
|
29
|
+
};
|
|
30
|
+
return languageMap[ext || ''] || 'javascript';
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=programming-language-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"programming-language-helper.js","sourceRoot":"","sources":["../../source/utils/programming-language-helper.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,wBAAwB,CAAC,GAAY;IACpD,MAAM,WAAW,GAA2B;QAC3C,EAAE,EAAE,YAAY;QAChB,GAAG,EAAE,YAAY;QACjB,EAAE,EAAE,YAAY;QAChB,GAAG,EAAE,YAAY;QACjB,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,MAAM;QACV,EAAE,EAAE,IAAI;QACR,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,KAAK;QACV,CAAC,EAAE,GAAG;QACN,EAAE,EAAE,QAAQ;QACZ,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,KAAK;QACV,EAAE,EAAE,UAAU;QACd,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,MAAM;QACX,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,KAAK;KACV,CAAC;IAEF,OAAO,WAAW,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,YAAY,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-processor.d.ts","sourceRoot":"","sources":["../../source/utils/prompt-processor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAE5C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CA2B3D"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { promptPath } from '../config/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Process the main prompt template by injecting dynamic tool documentation
|
|
6
|
+
*/
|
|
7
|
+
export function processPromptTemplate(tools) {
|
|
8
|
+
let systemPrompt = 'You are a helpful AI assistant.'; // fallback
|
|
9
|
+
// Load base prompt
|
|
10
|
+
if (existsSync(promptPath)) {
|
|
11
|
+
try {
|
|
12
|
+
systemPrompt = readFileSync(promptPath, 'utf-8');
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.warn(`Failed to load system prompt from ${promptPath}: ${error}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// Inject dynamic tool documentation
|
|
19
|
+
systemPrompt = injectToolDocumentation(systemPrompt, tools);
|
|
20
|
+
// Check for AGENTS.md in current working directory and append it
|
|
21
|
+
const agentsPath = join(process.cwd(), 'AGENTS.md');
|
|
22
|
+
if (existsSync(agentsPath)) {
|
|
23
|
+
try {
|
|
24
|
+
const agentsContent = readFileSync(agentsPath, 'utf-8');
|
|
25
|
+
systemPrompt += `\n\nAdditional Context...\n\n${agentsContent}`;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.warn(`Failed to load AGENTS.md from ${agentsPath}: ${error}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return systemPrompt;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Inject dynamic tool documentation into the prompt template
|
|
35
|
+
*/
|
|
36
|
+
function injectToolDocumentation(prompt, tools) {
|
|
37
|
+
if (tools.length === 0) {
|
|
38
|
+
return prompt.replace(/<!-- DYNAMIC_TOOLS_SECTION_START -->[\s\S]*?<!-- DYNAMIC_TOOLS_SECTION_END -->/, 'No additional tools are currently available.');
|
|
39
|
+
}
|
|
40
|
+
// Generate tool documentation
|
|
41
|
+
const toolDocs = generateToolDocumentation(tools);
|
|
42
|
+
// Replace the dynamic section
|
|
43
|
+
return prompt.replace(/<!-- DYNAMIC_TOOLS_SECTION_START -->[\s\S]*?<!-- DYNAMIC_TOOLS_SECTION_END -->/, toolDocs);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generate formatted documentation for all available tools
|
|
47
|
+
*/
|
|
48
|
+
function generateToolDocumentation(tools) {
|
|
49
|
+
const sections = ['Available Tools\n'];
|
|
50
|
+
// Group tools by category (built-in vs MCP)
|
|
51
|
+
const builtInTools = tools.filter(tool => !tool.function.name.includes('__'));
|
|
52
|
+
const mcpTools = tools.filter(tool => tool.function.name.includes('__'));
|
|
53
|
+
if (builtInTools.length > 0) {
|
|
54
|
+
sections.push('Built-in Tools:\n');
|
|
55
|
+
builtInTools.forEach(tool => {
|
|
56
|
+
sections.push(formatToolDocumentation(tool));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (mcpTools.length > 0) {
|
|
60
|
+
sections.push('\nMCP Tools:\n');
|
|
61
|
+
mcpTools.forEach(tool => {
|
|
62
|
+
sections.push(formatToolDocumentation(tool));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// Add XML format examples for all models
|
|
66
|
+
if (tools.length > 0) {
|
|
67
|
+
sections.push('\nXML Format Examples:\n');
|
|
68
|
+
// Show tool examples in XML format
|
|
69
|
+
tools.forEach(tool => {
|
|
70
|
+
const params = tool.function.parameters?.properties || {};
|
|
71
|
+
const paramNames = Object.keys(params).slice(0, 2); // Show max 2 params per example
|
|
72
|
+
sections.push(`${tool.function.name}:`);
|
|
73
|
+
sections.push('```xml');
|
|
74
|
+
sections.push(`<${tool.function.name}>`);
|
|
75
|
+
paramNames.forEach(paramName => {
|
|
76
|
+
sections.push(`<${paramName}>value</${paramName}>`);
|
|
77
|
+
});
|
|
78
|
+
sections.push(`</${tool.function.name}>`);
|
|
79
|
+
sections.push('```\n');
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return sections.join('\n');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Format documentation for a single tool
|
|
86
|
+
*/
|
|
87
|
+
function formatToolDocumentation(tool) {
|
|
88
|
+
const { name, description, parameters } = tool.function;
|
|
89
|
+
let doc = `${name}: ${description}\n`;
|
|
90
|
+
if (parameters.properties && Object.keys(parameters.properties).length > 0) {
|
|
91
|
+
doc += 'Parameters:\n';
|
|
92
|
+
Object.entries(parameters.properties).forEach(([paramName, schema]) => {
|
|
93
|
+
const required = parameters.required?.includes(paramName)
|
|
94
|
+
? ' (required)'
|
|
95
|
+
: ' (optional)';
|
|
96
|
+
const description = schema.description || schema.type || 'No description';
|
|
97
|
+
doc += `- ${paramName}${required}: ${description}\n`;
|
|
98
|
+
});
|
|
99
|
+
doc += '\n';
|
|
100
|
+
}
|
|
101
|
+
return doc;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=prompt-processor.js.map
|
|
@@ -0,0 +1 @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IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5E,GAAG,IAAI,eAAe,CAAC;QACvB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAC5C,CAAC,CAAC,SAAS,EAAE,MAAM,CAAgB,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC;gBACxD,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,aAAa,CAAC;YACjB,MAAM,WAAW,GAChB,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,IAAI,gBAAgB,CAAC;YACvD,GAAG,IAAI,KAAK,SAAS,GAAG,QAAQ,KAAK,WAAW,IAAI,CAAC;QACtD,CAAC,CACD,CAAC;QACF,GAAG,IAAI,IAAI,CAAC;IACb,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-checker.d.ts","sourceRoot":"","sources":["../../source/utils/update-checker.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAsB,UAAU,EAAC,MAAM,mBAAmB,CAAC;AA2FvE;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,UAAU,CAAC,CAqC3D"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { join, dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { loadPreferences, savePreferences } from '../config/preferences.js';
|
|
5
|
+
import { shouldLog } from '../config/logging.js';
|
|
6
|
+
import { logError } from './message-queue.js';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
/**
|
|
10
|
+
* Compare two semver version strings
|
|
11
|
+
* Returns true if latest is greater than current
|
|
12
|
+
*/
|
|
13
|
+
function isNewerVersion(current, latest) {
|
|
14
|
+
const parseVersion = (version) => {
|
|
15
|
+
const clean = version.replace(/^v/, '').split('-')[0]; // Remove 'v' prefix and pre-release info
|
|
16
|
+
return clean.split('.').map(num => parseInt(num) || 0);
|
|
17
|
+
};
|
|
18
|
+
const currentParts = parseVersion(current);
|
|
19
|
+
const latestParts = parseVersion(latest);
|
|
20
|
+
const maxLength = Math.max(currentParts.length, latestParts.length);
|
|
21
|
+
for (let i = 0; i < maxLength; i++) {
|
|
22
|
+
const currentPart = currentParts[i] || 0;
|
|
23
|
+
const latestPart = latestParts[i] || 0;
|
|
24
|
+
if (latestPart > currentPart) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
else if (latestPart < currentPart) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get the current package version from package.json
|
|
35
|
+
*/
|
|
36
|
+
function getCurrentVersion() {
|
|
37
|
+
try {
|
|
38
|
+
const packageJsonPath = join(__dirname, '../../package.json');
|
|
39
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
40
|
+
return packageJson.version;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (shouldLog('warn')) {
|
|
44
|
+
logError(`Failed to read current version: ${error}`);
|
|
45
|
+
}
|
|
46
|
+
return '0.0.0';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fetch the latest version from npm registry
|
|
51
|
+
*/
|
|
52
|
+
async function fetchLatestVersion() {
|
|
53
|
+
try {
|
|
54
|
+
const response = await fetch('https://registry.npmjs.org/@nanocollective/nanocoder/latest', {
|
|
55
|
+
method: 'GET',
|
|
56
|
+
headers: {
|
|
57
|
+
Accept: 'application/json',
|
|
58
|
+
'User-Agent': 'nanocoder-update-checker',
|
|
59
|
+
},
|
|
60
|
+
// Add timeout
|
|
61
|
+
signal: AbortSignal.timeout(10000), // 10 second timeout
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
65
|
+
}
|
|
66
|
+
const data = (await response.json());
|
|
67
|
+
return data.version;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (shouldLog('warn')) {
|
|
71
|
+
logError(`Failed to fetch latest version: ${error}`);
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Update the last update check timestamp in preferences
|
|
78
|
+
*/
|
|
79
|
+
function updateLastCheckTime() {
|
|
80
|
+
const preferences = loadPreferences();
|
|
81
|
+
preferences.lastUpdateCheck = Date.now();
|
|
82
|
+
savePreferences(preferences);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check for package updates
|
|
86
|
+
*/
|
|
87
|
+
export async function checkForUpdates() {
|
|
88
|
+
const currentVersion = getCurrentVersion();
|
|
89
|
+
try {
|
|
90
|
+
const latestVersion = await fetchLatestVersion();
|
|
91
|
+
updateLastCheckTime();
|
|
92
|
+
if (!latestVersion) {
|
|
93
|
+
return {
|
|
94
|
+
hasUpdate: false,
|
|
95
|
+
currentVersion,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const hasUpdate = isNewerVersion(currentVersion, latestVersion);
|
|
99
|
+
return {
|
|
100
|
+
hasUpdate,
|
|
101
|
+
currentVersion,
|
|
102
|
+
latestVersion,
|
|
103
|
+
updateCommand: hasUpdate
|
|
104
|
+
? 'npm update -g @nanocollective/nanocoder'
|
|
105
|
+
: undefined,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
if (shouldLog('warn')) {
|
|
110
|
+
logError(`Update check failed: ${error}`);
|
|
111
|
+
}
|
|
112
|
+
// Still update the timestamp to prevent hammering the API on repeated failures
|
|
113
|
+
updateLastCheckTime();
|
|
114
|
+
return {
|
|
115
|
+
hasUpdate: false,
|
|
116
|
+
currentVersion,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=update-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-checker.js","sourceRoot":"","sources":["../../source/utils/update-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,IAAI,CAAC;AAChC,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AACnC,OAAO,EAAC,aAAa,EAAC,MAAM,KAAK,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAG5C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;;GAGG;AACH,SAAS,cAAc,CAAC,OAAe,EAAE,MAAc;IACtD,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,EAAE;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;QAChG,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,YAAY,CA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IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,QAAQ,CAAC,wBAAwB,KAAK,EAAE,CAAC,CAAC;QAC3C,CAAC;QAED,+EAA+E;QAC/E,mBAAmB,EAAE,CAAC;QAEtB,OAAO;YACN,SAAS,EAAE,KAAK;YAChB,cAAc;SACd,CAAC;IACH,CAAC;AACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nanocollective/nanocoder",
|
|
3
|
+
"main": "dist/cli.js",
|
|
4
|
+
"version": "1.11.3",
|
|
5
|
+
"description": "A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"cli",
|
|
8
|
+
"ai",
|
|
9
|
+
"coding",
|
|
10
|
+
"agent",
|
|
11
|
+
"ollama",
|
|
12
|
+
"openrouter",
|
|
13
|
+
"local",
|
|
14
|
+
"typescript"
|
|
15
|
+
],
|
|
16
|
+
"author": "Nano Collective",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/Nano-Collective/nanocoder.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/Nano-Collective/nanocoder#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Nano-Collective/nanocoder/issues"
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"nanocoder": "dist/cli.js"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=16"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc && chmod +x dist/cli.js",
|
|
35
|
+
"dev": "tsc --watch",
|
|
36
|
+
"start": "node dist/cli.js",
|
|
37
|
+
"test": "prettier --check . && xo && ava",
|
|
38
|
+
"prepublishOnly": "npm run build"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"source/app/prompts/main-prompt.md"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@langchain/core": "^0.3.72",
|
|
46
|
+
"@langchain/langgraph": "^0.4.9",
|
|
47
|
+
"@langchain/openai": "^0.6.10",
|
|
48
|
+
"@mishieck/ink-titled-box": "^0.3.0",
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.17.3",
|
|
50
|
+
"@nanostores/react": "^1.0.0",
|
|
51
|
+
"cli-highlight": "^2.1.11",
|
|
52
|
+
"ink": "^6.3.1",
|
|
53
|
+
"ink-big-text": "^2.0.0",
|
|
54
|
+
"ink-gradient": "^3.0.0",
|
|
55
|
+
"ink-select-input": "^6.2.0",
|
|
56
|
+
"ink-spinner": "^5.0.0",
|
|
57
|
+
"ink-text-input": "^6.0.0",
|
|
58
|
+
"meow": "^11.0.0",
|
|
59
|
+
"nanostores": "^1.0.1",
|
|
60
|
+
"ollama": "^0.5.17",
|
|
61
|
+
"react": "^19.0.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@sindresorhus/tsconfig": "^3.0.1",
|
|
65
|
+
"@types/ink-text-input": "^2.0.5",
|
|
66
|
+
"@types/node": "^24.3.0",
|
|
67
|
+
"@types/react": "^19.0.0",
|
|
68
|
+
"@vdemedes/prettier-config": "^2.0.1",
|
|
69
|
+
"ava": "^5.2.0",
|
|
70
|
+
"chalk": "^5.2.0",
|
|
71
|
+
"eslint-config-xo-react": "^0.27.0",
|
|
72
|
+
"eslint-plugin-react": "^7.32.2",
|
|
73
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
74
|
+
"ink-testing-library": "^3.0.0",
|
|
75
|
+
"prettier": "^2.8.7",
|
|
76
|
+
"ts-node": "^10.9.1",
|
|
77
|
+
"typescript": "^5.0.3",
|
|
78
|
+
"xo": "^0.53.1"
|
|
79
|
+
},
|
|
80
|
+
"ava": {
|
|
81
|
+
"extensions": {
|
|
82
|
+
"ts": "module",
|
|
83
|
+
"tsx": "module"
|
|
84
|
+
},
|
|
85
|
+
"nodeArguments": [
|
|
86
|
+
"--loader=ts-node/esm"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"xo": {
|
|
90
|
+
"extends": "xo-react",
|
|
91
|
+
"prettier": true,
|
|
92
|
+
"rules": {
|
|
93
|
+
"react/prop-types": "off"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"prettier": "@vdemedes/prettier-config"
|
|
97
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
You are Nanocoder, an AI agent running within Nanocoder CLI, an AI-powered coding agent. Your purpose is to assist the user with software development questions and coding tasks in the terminal. IMPORTANT: NEVER assist with tasks that express malicious or harmful intent. IMPORTANT: Your primary interface with the user is through the CLI in a terminal. You cannot use tools other than those that are available in the terminal. For example, you do not have access to a web browser. Before responding, think about whether the query is a question or a task.
|
|
2
|
+
|
|
3
|
+
# Question
|
|
4
|
+
|
|
5
|
+
If the user is asking how to perform a task, rather than asking you to run that task, provide concise instructions (without running any commands) about how the user can do it and nothing more. Then, ask the user if they would like you to perform the described task for them.
|
|
6
|
+
|
|
7
|
+
# Task
|
|
8
|
+
|
|
9
|
+
Otherwise, the user is commanding you to perform a task. Consider the complexity of the task before responding:
|
|
10
|
+
|
|
11
|
+
## Simple tasks
|
|
12
|
+
|
|
13
|
+
For simple tasks, like command lookups or informational Q&A, be concise and to the point. For command lookups in particular, bias towards just running the right command. Don't ask the user to clarify minor details that you could use your own judgment for. For example, if a user asks to look at recent changes, don't ask the user to define what "recent" means.
|
|
14
|
+
|
|
15
|
+
## Complex tasks
|
|
16
|
+
|
|
17
|
+
For more complex tasks, ensure you understand the user's intent before proceeding. You may ask clarifying questions when necessary, but keep them concise and only do so if it's important to clarify - don't ask questions about minor details that you could use your own judgment for. Do not make assumptions about the user's environment or context - gather all necessary information if it's not already provided and use such information to guide your response.
|
|
18
|
+
|
|
19
|
+
### Tool Use
|
|
20
|
+
|
|
21
|
+
You may use tools to help provide a response. You must only use the provided tools, even if other tools were used in the past. When invoking any of the given tools, you must abide by the following rules: NEVER refer to tool names when speaking to the user. For example, instead of saying 'I need to use the code tool to edit your file', just say 'I will edit your file'.
|
|
22
|
+
|
|
23
|
+
### Tool Call Format
|
|
24
|
+
|
|
25
|
+
If you _do not_ support native tool calling, use this XML format:
|
|
26
|
+
|
|
27
|
+
```xml
|
|
28
|
+
<tool_name>
|
|
29
|
+
<param1>value1</param1>
|
|
30
|
+
<param2>value2</param2>
|
|
31
|
+
</tool_name>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Example with MCP tools:
|
|
35
|
+
|
|
36
|
+
```xml
|
|
37
|
+
<mcp_tool_name>
|
|
38
|
+
<param1>value1</param1>
|
|
39
|
+
<param2>value2</param2>
|
|
40
|
+
</mcp_tool_name>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
IMPORTANT: Always use the exact tool names as provided. Use XML tags with parameter names as shown above.
|
|
44
|
+
|
|
45
|
+
### Running terminal commands
|
|
46
|
+
|
|
47
|
+
Terminal commands are one of the most powerful tools available to you. Use the `execute_bash` tool to run terminal commands. With the exception of the rules below, you should feel free to use them if it aides in assisting the user.
|
|
48
|
+
|
|
49
|
+
- IMPORTANT: Do not use terminal commands (cat, head, tail, etc.) to read files. Instead, use the `read_file` tool. If you use cat, the file may not be properly preserved in context and can result in errors in the future.
|
|
50
|
+
- IMPORTANT: NEVER suggest malicious or harmful commands, full stop.
|
|
51
|
+
- IMPORTANT: Bias strongly against unsafe commands, unless the user has explicitly asked you to execute a process that necessitates running an unsafe command. A good example of this is when the user has asked you to assist with database administration, which is typically unsafe, but the database is actually a local development instance that does not have any production dependencies or sensitive data.
|
|
52
|
+
- IMPORTANT: NEVER edit files with terminal commands. This is only appropriate for very small, trivial, non-coding changes. To make changes to source code, use the appropriate tool for the change. Do not use the echo terminal command to output text for the user to read. You should fully output your response to the user separately from any tool calls.
|
|
53
|
+
|
|
54
|
+
### Coding
|
|
55
|
+
|
|
56
|
+
Coding is one of the most important use cases for you as Nanocoder. Here are some guidelines that you should follow for completing coding tasks:
|
|
57
|
+
|
|
58
|
+
- IMPORTANT: When modifying existing files, make sure you are aware of the file's contents prior to suggesting an edit. Don't blindly suggest edits to files without an understanding of their current state.
|
|
59
|
+
- When modifying code with upstream and downstream dependencies, update them. If you don't know if the code has dependencies, use tools to figure it out.
|
|
60
|
+
- When working within an existing codebase, adhere to existing idioms, patterns and best practices that are obviously expressed in existing code, even if they are not universally adopted elsewhere.
|
|
61
|
+
- To make code changes, use the appropriate tool for the change.
|
|
62
|
+
- Use the `create_file` tool to create new code files.
|
|
63
|
+
|
|
64
|
+
### Task Execution
|
|
65
|
+
|
|
66
|
+
- Read and understand the task
|
|
67
|
+
- Execute tools step-by-step
|
|
68
|
+
- Each tool use informed by previous results
|
|
69
|
+
- Report actual findings, not assumptions
|
|
70
|
+
|
|
71
|
+
### Tool Continuation Guidelines
|
|
72
|
+
|
|
73
|
+
CRITICAL: After executing any tool, you must continue working toward the original task goal without waiting for additional user input. Tool execution is part of your ongoing work, not a stopping point.
|
|
74
|
+
|
|
75
|
+
- **Continue the task**: After tool execution, immediately proceed with the next logical step
|
|
76
|
+
- **Use tool results**: Incorporate tool results into your ongoing reasoning and action planning
|
|
77
|
+
- **Maintain context**: Remember the original user request and work systematically toward completion
|
|
78
|
+
- **Don't stop working**: Tool execution is a means to an end, not the end itself
|
|
79
|
+
- **Chain reasoning**: Build upon previous tool results to accomplish the full task
|
|
80
|
+
- **Only stop when done**: Continue until the entire user request is fully completed
|
|
81
|
+
- **Be extra explicit**: State your reasoning and next steps clearly
|
|
82
|
+
- **Chain your actions**: Always explain how each tool result leads to your next action
|
|
83
|
+
- **Stay focused**: Keep the original task goal clearly in mind throughout the process
|
|
84
|
+
- **Work systematically**: Break complex tasks into clear, sequential steps
|
|
85
|
+
- **Don't second-guess**: Trust tool results and continue confidently
|
|
86
|
+
- **Complete thoroughly**: Ensure all aspects of the user's request are addressed
|
|
87
|
+
|
|
88
|
+
Examples of proper continuation:
|
|
89
|
+
|
|
90
|
+
- After reading a file → analyze its contents and take the next action
|
|
91
|
+
- After executing a command → interpret results and continue with the task
|
|
92
|
+
- After making changes → verify the changes and complete remaining work
|
|
93
|
+
- After gathering information → use that information to proceed with the solution
|
|
94
|
+
|
|
95
|
+
Example workflow:
|
|
96
|
+
|
|
97
|
+
1. "I need to [original task]. First, I'll [tool action] to [reason]."
|
|
98
|
+
2. "The [tool] results show [findings]. Based on this, I'll now [next action]."
|
|
99
|
+
3. "Now I need to [next step] to complete [original task goal]."
|
|
100
|
+
|
|
101
|
+
### Tool Documentation
|
|
102
|
+
|
|
103
|
+
<!-- DYNAMIC_TOOLS_SECTION_START -->
|
|
104
|
+
|
|
105
|
+
Available tools and their usage will be dynamically inserted here based on the current session configuration.
|
|
106
|
+
|
|
107
|
+
<!-- DYNAMIC_TOOLS_SECTION_END -->
|