@travisennis/acai 0.0.1
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/.acai/acai.json +9 -0
- package/.acai/prompts/add-openrouter-model.md +13 -0
- package/.acai/prompts/project-status.md +4 -0
- package/.acai/prompts/update-architecture-document.md +9 -0
- package/.acai/rules/learned-rules.md +9 -0
- package/.ai/docs/available-tools.txt +3 -0
- package/.ai/docs/cognitive_complexity_refactoring_progress.md +65 -0
- package/.ai/docs/deleted_tools.md +168 -0
- package/.ai/docs/deleted_tools_88ced9ef.md +56 -0
- package/.ai/docs/image-pasting.md +46 -0
- package/.ai/docs/initialize-app.md +117 -0
- package/.ai/docs/issue-4-plan.md +44 -0
- package/.ai/docs/marked-renderer-debug.md +15 -0
- package/.ai/docs/marked-renderer-refactor-plan.md +64 -0
- package/.ai/docs/memory-use-cases.md +55 -0
- package/.ai/docs/prompt-consistency.md +31 -0
- package/.ai/docs/refactoring-tools.md +98 -0
- package/.ai/docs/system-prompt-update.md +174 -0
- package/.ai/docs/system_prompt.txt +210 -0
- package/.ai/docs/tasks.md +49 -0
- package/.ai/plan.md +131 -0
- package/.ai/prompt.md +1 -0
- package/.ai/scripts/fetch_models.js +27 -0
- package/.ai/scripts/generateSystemPrompt.ts +15 -0
- package/.ai/scripts/list-tools.mjs +4 -0
- package/.ai/scripts/p5_geometric_shapes.js +149 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +3 -0
- package/.husky/pre-push +1 -0
- package/.ignore +4 -0
- package/AGENTS.md +25 -0
- package/ARCHITECTURE.md +304 -0
- package/LICENSE +21 -0
- package/README.md +392 -0
- package/TODO.md +2 -0
- package/biome.json +61 -0
- package/commitlint.config.js +3 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.js +116 -0
- package/dist/commands/application-log-command.d.ts +2 -0
- package/dist/commands/application-log-command.js +43 -0
- package/dist/commands/clear-command.d.ts +2 -0
- package/dist/commands/clear-command.js +12 -0
- package/dist/commands/compact-command.d.ts +2 -0
- package/dist/commands/compact-command.js +51 -0
- package/dist/commands/copy-command.d.ts +2 -0
- package/dist/commands/copy-command.js +51 -0
- package/dist/commands/edit-command.d.ts +2 -0
- package/dist/commands/edit-command.js +53 -0
- package/dist/commands/edit-prompt-command.d.ts +2 -0
- package/dist/commands/edit-prompt-command.js +25 -0
- package/dist/commands/exit-command.d.ts +2 -0
- package/dist/commands/exit-command.js +14 -0
- package/dist/commands/files-command.d.ts +2 -0
- package/dist/commands/files-command.js +63 -0
- package/dist/commands/generate-rules-command.d.ts +2 -0
- package/dist/commands/generate-rules-command.js +61 -0
- package/dist/commands/help-command.d.ts +2 -0
- package/dist/commands/help-command.js +19 -0
- package/dist/commands/init-command.d.ts +2 -0
- package/dist/commands/init-command.js +40 -0
- package/dist/commands/last-log-command.d.ts +2 -0
- package/dist/commands/last-log-command.js +76 -0
- package/dist/commands/manager.d.ts +22 -0
- package/dist/commands/manager.js +123 -0
- package/dist/commands/model-command.d.ts +2 -0
- package/dist/commands/model-command.js +84 -0
- package/dist/commands/paste-command.d.ts +2 -0
- package/dist/commands/paste-command.js +40 -0
- package/dist/commands/prompt-command.d.ts +2 -0
- package/dist/commands/prompt-command.js +111 -0
- package/dist/commands/reset-command.d.ts +2 -0
- package/dist/commands/reset-command.js +16 -0
- package/dist/commands/rules-command.d.ts +2 -0
- package/dist/commands/rules-command.js +68 -0
- package/dist/commands/save-command.d.ts +2 -0
- package/dist/commands/save-command.js +14 -0
- package/dist/commands/types.d.ts +26 -0
- package/dist/commands/types.js +1 -0
- package/dist/commands/usage-command.d.ts +2 -0
- package/dist/commands/usage-command.js +21 -0
- package/dist/config.d.ts +60 -0
- package/dist/config.js +193 -0
- package/dist/conversation-analyzer.d.ts +10 -0
- package/dist/conversation-analyzer.js +88 -0
- package/dist/dedent.d.ts +3 -0
- package/dist/dedent.js +38 -0
- package/dist/formatting.d.ts +17 -0
- package/dist/formatting.js +103 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +213 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +24 -0
- package/dist/mentions.d.ts +9 -0
- package/dist/mentions.js +182 -0
- package/dist/messages.d.ts +69 -0
- package/dist/messages.js +261 -0
- package/dist/middleware/audit-message.d.ts +5 -0
- package/dist/middleware/audit-message.js +95 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/rate-limit.d.ts +4 -0
- package/dist/middleware/rate-limit.js +17 -0
- package/dist/models/ai-config.d.ts +12 -0
- package/dist/models/ai-config.js +87 -0
- package/dist/models/anthropic-provider.d.ts +25 -0
- package/dist/models/anthropic-provider.js +184 -0
- package/dist/models/deepseek-provider.d.ts +20 -0
- package/dist/models/deepseek-provider.js +42 -0
- package/dist/models/google-provider.d.ts +19 -0
- package/dist/models/google-provider.js +56 -0
- package/dist/models/manager.d.ts +15 -0
- package/dist/models/manager.js +48 -0
- package/dist/models/openai-provider.d.ts +22 -0
- package/dist/models/openai-provider.js +70 -0
- package/dist/models/openrouter-provider.d.ts +36 -0
- package/dist/models/openrouter-provider.js +276 -0
- package/dist/models/providers.d.ts +33 -0
- package/dist/models/providers.js +116 -0
- package/dist/models/xai-provider.d.ts +20 -0
- package/dist/models/xai-provider.js +47 -0
- package/dist/parsing.d.ts +2 -0
- package/dist/parsing.js +18 -0
- package/dist/prompts/manager.d.ts +19 -0
- package/dist/prompts/manager.js +71 -0
- package/dist/prompts.d.ts +4 -0
- package/dist/prompts.js +158 -0
- package/dist/repl-prompt.d.ts +14 -0
- package/dist/repl-prompt.js +147 -0
- package/dist/repl.d.ts +27 -0
- package/dist/repl.js +431 -0
- package/dist/source/cli.d.ts +19 -0
- package/dist/source/cli.js +116 -0
- package/dist/source/commands/application-log-command.d.ts +2 -0
- package/dist/source/commands/application-log-command.js +43 -0
- package/dist/source/commands/clear-command.d.ts +2 -0
- package/dist/source/commands/clear-command.js +12 -0
- package/dist/source/commands/compact-command.d.ts +2 -0
- package/dist/source/commands/compact-command.js +51 -0
- package/dist/source/commands/copy-command.d.ts +2 -0
- package/dist/source/commands/copy-command.js +51 -0
- package/dist/source/commands/edit-command.d.ts +2 -0
- package/dist/source/commands/edit-command.js +53 -0
- package/dist/source/commands/edit-prompt-command.d.ts +2 -0
- package/dist/source/commands/edit-prompt-command.js +25 -0
- package/dist/source/commands/exit-command.d.ts +2 -0
- package/dist/source/commands/exit-command.js +14 -0
- package/dist/source/commands/files-command.d.ts +2 -0
- package/dist/source/commands/files-command.js +63 -0
- package/dist/source/commands/generate-rules-command.d.ts +2 -0
- package/dist/source/commands/generate-rules-command.js +61 -0
- package/dist/source/commands/help-command.d.ts +2 -0
- package/dist/source/commands/help-command.js +19 -0
- package/dist/source/commands/init-command.d.ts +2 -0
- package/dist/source/commands/init-command.js +40 -0
- package/dist/source/commands/last-log-command.d.ts +2 -0
- package/dist/source/commands/last-log-command.js +76 -0
- package/dist/source/commands/manager.d.ts +22 -0
- package/dist/source/commands/manager.js +123 -0
- package/dist/source/commands/model-command.d.ts +2 -0
- package/dist/source/commands/model-command.js +84 -0
- package/dist/source/commands/paste-command.d.ts +2 -0
- package/dist/source/commands/paste-command.js +40 -0
- package/dist/source/commands/prompt-command.d.ts +2 -0
- package/dist/source/commands/prompt-command.js +111 -0
- package/dist/source/commands/reset-command.d.ts +2 -0
- package/dist/source/commands/reset-command.js +16 -0
- package/dist/source/commands/rules-command.d.ts +2 -0
- package/dist/source/commands/rules-command.js +68 -0
- package/dist/source/commands/save-command.d.ts +2 -0
- package/dist/source/commands/save-command.js +14 -0
- package/dist/source/commands/types.d.ts +26 -0
- package/dist/source/commands/types.js +1 -0
- package/dist/source/commands/usage-command.d.ts +2 -0
- package/dist/source/commands/usage-command.js +21 -0
- package/dist/source/config.d.ts +60 -0
- package/dist/source/config.js +193 -0
- package/dist/source/conversation-analyzer.d.ts +10 -0
- package/dist/source/conversation-analyzer.js +88 -0
- package/dist/source/dedent.d.ts +3 -0
- package/dist/source/dedent.js +38 -0
- package/dist/source/formatting.d.ts +17 -0
- package/dist/source/formatting.js +103 -0
- package/dist/source/index.d.ts +18 -0
- package/dist/source/index.js +213 -0
- package/dist/source/logger.d.ts +2 -0
- package/dist/source/logger.js +24 -0
- package/dist/source/mentions.d.ts +9 -0
- package/dist/source/mentions.js +182 -0
- package/dist/source/messages.d.ts +69 -0
- package/dist/source/messages.js +261 -0
- package/dist/source/middleware/audit-message.d.ts +5 -0
- package/dist/source/middleware/audit-message.js +95 -0
- package/dist/source/middleware/index.d.ts +2 -0
- package/dist/source/middleware/index.js +2 -0
- package/dist/source/middleware/rate-limit.d.ts +4 -0
- package/dist/source/middleware/rate-limit.js +17 -0
- package/dist/source/models/ai-config.d.ts +12 -0
- package/dist/source/models/ai-config.js +87 -0
- package/dist/source/models/anthropic-provider.d.ts +25 -0
- package/dist/source/models/anthropic-provider.js +184 -0
- package/dist/source/models/deepseek-provider.d.ts +20 -0
- package/dist/source/models/deepseek-provider.js +42 -0
- package/dist/source/models/google-provider.d.ts +19 -0
- package/dist/source/models/google-provider.js +56 -0
- package/dist/source/models/manager.d.ts +15 -0
- package/dist/source/models/manager.js +48 -0
- package/dist/source/models/openai-provider.d.ts +22 -0
- package/dist/source/models/openai-provider.js +70 -0
- package/dist/source/models/openrouter-provider.d.ts +36 -0
- package/dist/source/models/openrouter-provider.js +276 -0
- package/dist/source/models/providers.d.ts +33 -0
- package/dist/source/models/providers.js +116 -0
- package/dist/source/models/xai-provider.d.ts +20 -0
- package/dist/source/models/xai-provider.js +47 -0
- package/dist/source/parsing.d.ts +2 -0
- package/dist/source/parsing.js +18 -0
- package/dist/source/prompts/manager.d.ts +19 -0
- package/dist/source/prompts/manager.js +71 -0
- package/dist/source/prompts.d.ts +4 -0
- package/dist/source/prompts.js +158 -0
- package/dist/source/repl-prompt.d.ts +14 -0
- package/dist/source/repl-prompt.js +147 -0
- package/dist/source/repl.d.ts +27 -0
- package/dist/source/repl.js +431 -0
- package/dist/source/terminal/formatting.d.ts +37 -0
- package/dist/source/terminal/formatting.js +106 -0
- package/dist/source/terminal/index.d.ts +94 -0
- package/dist/source/terminal/index.js +420 -0
- package/dist/source/terminal/markdown-utils.d.ts +2 -0
- package/dist/source/terminal/markdown-utils.js +81 -0
- package/dist/source/terminal/markdown.d.ts +1 -0
- package/dist/source/terminal/markdown.js +111 -0
- package/dist/source/terminal/types.d.ts +71 -0
- package/dist/source/terminal/types.js +1 -0
- package/dist/source/terminal-output.d.ts +8 -0
- package/dist/source/terminal-output.js +213 -0
- package/dist/source/terminal-output.test.d.ts +8 -0
- package/dist/source/terminal-output.test.js +213 -0
- package/dist/source/token-tracker.d.ts +14 -0
- package/dist/source/token-tracker.js +53 -0
- package/dist/source/token-utils.d.ts +7 -0
- package/dist/source/token-utils.js +13 -0
- package/dist/source/tools/agent.d.ts +17 -0
- package/dist/source/tools/agent.js +87 -0
- package/dist/source/tools/bash.d.ts +19 -0
- package/dist/source/tools/bash.js +294 -0
- package/dist/source/tools/code-interpreter.d.ts +12 -0
- package/dist/source/tools/code-interpreter.js +131 -0
- package/dist/source/tools/command-validation.d.ts +8 -0
- package/dist/source/tools/command-validation.js +69 -0
- package/dist/source/tools/delete-file.d.ts +12 -0
- package/dist/source/tools/delete-file.js +56 -0
- package/dist/source/tools/directory-tree.d.ts +12 -0
- package/dist/source/tools/directory-tree.js +38 -0
- package/dist/source/tools/edit-file.d.ts +19 -0
- package/dist/source/tools/edit-file.js +107 -0
- package/dist/source/tools/filesystem-utils.d.ts +22 -0
- package/dist/source/tools/filesystem-utils.js +191 -0
- package/dist/source/tools/git-utils.d.ts +14 -0
- package/dist/source/tools/git-utils.js +64 -0
- package/dist/source/tools/grep.d.ts +17 -0
- package/dist/source/tools/grep.js +138 -0
- package/dist/source/tools/index.d.ts +161 -0
- package/dist/source/tools/index.js +209 -0
- package/dist/source/tools/memory-read.d.ts +13 -0
- package/dist/source/tools/memory-read.js +135 -0
- package/dist/source/tools/memory-write.d.ts +12 -0
- package/dist/source/tools/memory-write.js +83 -0
- package/dist/source/tools/move-file.d.ts +13 -0
- package/dist/source/tools/move-file.js +44 -0
- package/dist/source/tools/read-file.d.ts +17 -0
- package/dist/source/tools/read-file.js +86 -0
- package/dist/source/tools/read-multiple-files.d.ts +14 -0
- package/dist/source/tools/read-multiple-files.js +55 -0
- package/dist/source/tools/save-file.d.ts +17 -0
- package/dist/source/tools/save-file.js +98 -0
- package/dist/source/tools/think.d.ts +11 -0
- package/dist/source/tools/think.js +45 -0
- package/dist/source/tools/types.d.ts +29 -0
- package/dist/source/tools/types.js +14 -0
- package/dist/source/tools/web-fetch.d.ts +47 -0
- package/dist/source/tools/web-fetch.js +246 -0
- package/dist/source/tools/web-search.d.ts +13 -0
- package/dist/source/tools/web-search.js +80 -0
- package/dist/source/utils/process.d.ts +36 -0
- package/dist/source/utils/process.js +75 -0
- package/dist/source/version.d.ts +1 -0
- package/dist/source/version.js +21 -0
- package/dist/terminal/formatting.d.ts +37 -0
- package/dist/terminal/formatting.js +106 -0
- package/dist/terminal/index.d.ts +94 -0
- package/dist/terminal/index.js +420 -0
- package/dist/terminal/markdown-utils.d.ts +2 -0
- package/dist/terminal/markdown-utils.js +81 -0
- package/dist/terminal/markdown.d.ts +1 -0
- package/dist/terminal/markdown.js +111 -0
- package/dist/terminal/types.d.ts +71 -0
- package/dist/terminal/types.js +1 -0
- package/dist/terminal-output.d.ts +8 -0
- package/dist/terminal-output.js +213 -0
- package/dist/token-tracker.d.ts +14 -0
- package/dist/token-tracker.js +53 -0
- package/dist/token-utils.d.ts +7 -0
- package/dist/token-utils.js +13 -0
- package/dist/tools/agent.d.ts +17 -0
- package/dist/tools/agent.js +87 -0
- package/dist/tools/bash.d.ts +19 -0
- package/dist/tools/bash.js +294 -0
- package/dist/tools/code-interpreter.d.ts +12 -0
- package/dist/tools/code-interpreter.js +131 -0
- package/dist/tools/command-validation.d.ts +8 -0
- package/dist/tools/command-validation.js +69 -0
- package/dist/tools/delete-file.d.ts +12 -0
- package/dist/tools/delete-file.js +56 -0
- package/dist/tools/directory-tree.d.ts +12 -0
- package/dist/tools/directory-tree.js +38 -0
- package/dist/tools/edit-file.d.ts +19 -0
- package/dist/tools/edit-file.js +107 -0
- package/dist/tools/filesystem-utils.d.ts +22 -0
- package/dist/tools/filesystem-utils.js +191 -0
- package/dist/tools/git-utils.d.ts +14 -0
- package/dist/tools/git-utils.js +64 -0
- package/dist/tools/grep.d.ts +17 -0
- package/dist/tools/grep.js +138 -0
- package/dist/tools/index.d.ts +161 -0
- package/dist/tools/index.js +209 -0
- package/dist/tools/memory-read.d.ts +13 -0
- package/dist/tools/memory-read.js +135 -0
- package/dist/tools/memory-write.d.ts +12 -0
- package/dist/tools/memory-write.js +83 -0
- package/dist/tools/move-file.d.ts +13 -0
- package/dist/tools/move-file.js +44 -0
- package/dist/tools/read-file.d.ts +17 -0
- package/dist/tools/read-file.js +86 -0
- package/dist/tools/read-multiple-files.d.ts +14 -0
- package/dist/tools/read-multiple-files.js +55 -0
- package/dist/tools/save-file.d.ts +17 -0
- package/dist/tools/save-file.js +98 -0
- package/dist/tools/think.d.ts +11 -0
- package/dist/tools/think.js +45 -0
- package/dist/tools/types.d.ts +29 -0
- package/dist/tools/types.js +14 -0
- package/dist/tools/web-fetch.d.ts +47 -0
- package/dist/tools/web-fetch.js +246 -0
- package/dist/tools/web-search.d.ts +13 -0
- package/dist/tools/web-search.js +80 -0
- package/dist/utils/process.d.ts +36 -0
- package/dist/utils/process.js +75 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +21 -0
- package/knip.json +5 -0
- package/package.json +83 -0
- package/source/cli.ts +172 -0
- package/source/commands/application-log-command.ts +53 -0
- package/source/commands/clear-command.ts +14 -0
- package/source/commands/compact-command.ts +64 -0
- package/source/commands/copy-command.ts +55 -0
- package/source/commands/edit-command.ts +63 -0
- package/source/commands/edit-prompt-command.ts +31 -0
- package/source/commands/exit-command.ts +18 -0
- package/source/commands/files-command.ts +85 -0
- package/source/commands/generate-rules-command.ts +82 -0
- package/source/commands/help-command.ts +27 -0
- package/source/commands/init-command.ts +48 -0
- package/source/commands/last-log-command.ts +88 -0
- package/source/commands/manager.ts +151 -0
- package/source/commands/model-command.ts +123 -0
- package/source/commands/paste-command.ts +62 -0
- package/source/commands/prompt-command.ts +150 -0
- package/source/commands/reset-command.ts +22 -0
- package/source/commands/rules-command.ts +76 -0
- package/source/commands/save-command.ts +20 -0
- package/source/commands/types.ts +28 -0
- package/source/commands/usage-command.ts +26 -0
- package/source/config.ts +223 -0
- package/source/conversation-analyzer.ts +115 -0
- package/source/dedent.ts +53 -0
- package/source/formatting.ts +132 -0
- package/source/index.ts +240 -0
- package/source/logger.ts +29 -0
- package/source/mentions.ts +227 -0
- package/source/messages.ts +360 -0
- package/source/middleware/audit-message.ts +133 -0
- package/source/middleware/index.ts +2 -0
- package/source/middleware/rate-limit.ts +24 -0
- package/source/models/ai-config.ts +109 -0
- package/source/models/anthropic-provider.ts +199 -0
- package/source/models/deepseek-provider.ts +53 -0
- package/source/models/google-provider.ts +68 -0
- package/source/models/manager.ts +84 -0
- package/source/models/openai-provider.ts +81 -0
- package/source/models/openrouter-provider.ts +288 -0
- package/source/models/providers.ts +197 -0
- package/source/models/xai-provider.ts +59 -0
- package/source/parsing.ts +20 -0
- package/source/prompts/manager.ts +90 -0
- package/source/prompts.ts +172 -0
- package/source/repl-prompt.ts +196 -0
- package/source/repl.ts +572 -0
- package/source/terminal/formatting.ts +121 -0
- package/source/terminal/index.ts +518 -0
- package/source/terminal/markdown-utils.ts +89 -0
- package/source/terminal/markdown.ts +155 -0
- package/source/terminal/types.ts +84 -0
- package/source/terminal-output.test.ts +266 -0
- package/source/token-tracker.ts +78 -0
- package/source/token-utils.ts +17 -0
- package/source/tools/agent.ts +107 -0
- package/source/tools/bash.ts +367 -0
- package/source/tools/code-interpreter.ts +172 -0
- package/source/tools/command-validation.ts +81 -0
- package/source/tools/delete-file.ts +71 -0
- package/source/tools/directory-tree.ts +54 -0
- package/source/tools/edit-file.ts +155 -0
- package/source/tools/filesystem-utils.ts +265 -0
- package/source/tools/git-utils.ts +70 -0
- package/source/tools/grep.ts +184 -0
- package/source/tools/index.ts +278 -0
- package/source/tools/memory-read.ts +174 -0
- package/source/tools/memory-write.ts +105 -0
- package/source/tools/move-file.ts +59 -0
- package/source/tools/read-file.ts +129 -0
- package/source/tools/read-multiple-files.ts +80 -0
- package/source/tools/save-file.ts +147 -0
- package/source/tools/think.ts +51 -0
- package/source/tools/types.ts +58 -0
- package/source/tools/web-fetch.ts +327 -0
- package/source/tools/web-search.ts +101 -0
- package/source/utils/process.ts +121 -0
- package/source/version.ts +21 -0
- package/test/commands/copy-command.test.ts +69 -0
- package/test/config.test.ts +200 -0
- package/test/terminal/markdown-utils.test.ts +124 -0
- package/test/tools/bash-tool.test.ts +58 -0
- package/test/tools/code-interpreter.test.ts +91 -0
- package/test/tools/command-validation.test.ts +48 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +30 -0
package/.ai/plan.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Updated Plan: /mode Command with Project Config
|
|
2
|
+
|
|
3
|
+
Schema Updates
|
|
4
|
+
|
|
5
|
+
Extend the ProjectConfig schema to include mode as an enum with default 'build':
|
|
6
|
+
|
|
7
|
+
// Add to config.ts
|
|
8
|
+
const ModeSchema = z.enum(['build', 'explain', 'plan']);
|
|
9
|
+
type Mode = z.infer<typeof ModeSchema>;
|
|
10
|
+
|
|
11
|
+
const ProjectConfigSchema = z.object({
|
|
12
|
+
logs: z
|
|
13
|
+
.object({
|
|
14
|
+
path: z.string(),
|
|
15
|
+
})
|
|
16
|
+
.optional(),
|
|
17
|
+
tools: z
|
|
18
|
+
.object({
|
|
19
|
+
maxTokens: z.number().default(30000),
|
|
20
|
+
})
|
|
21
|
+
.optional()
|
|
22
|
+
.default({ maxTokens: 30000 }),
|
|
23
|
+
notify: z.boolean().optional().default(true),
|
|
24
|
+
mode: ModeSchema.default('build'), // Add this line
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
New Function in ConfigManager
|
|
28
|
+
|
|
29
|
+
Add writeProjectConfig method to ConfigManager:
|
|
30
|
+
|
|
31
|
+
async writeProjectConfig(config: Partial<ProjectConfig>): Promise<void> {
|
|
32
|
+
const projectConfigPath = path.join(this.project.getPath(), "acai.json");
|
|
33
|
+
|
|
34
|
+
// Read existing config
|
|
35
|
+
const existingConfig = await this.readProjectConfig();
|
|
36
|
+
|
|
37
|
+
// Merge with new config
|
|
38
|
+
const updatedConfig = {
|
|
39
|
+
...existingConfig,
|
|
40
|
+
...config,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Validate and write
|
|
44
|
+
const validatedConfig = ProjectConfigSchema.parse(updatedConfig);
|
|
45
|
+
await fs.writeFile(
|
|
46
|
+
projectConfigPath,
|
|
47
|
+
JSON.stringify(validatedConfig, null, 2)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Updated Implementation Steps
|
|
52
|
+
|
|
53
|
+
1. Update ProjectConfig Schema
|
|
54
|
+
|
|
55
|
+
File: source/config.ts
|
|
56
|
+
- Add ModeSchema enum
|
|
57
|
+
- Add mode field to ProjectConfigSchema with default 'build'
|
|
58
|
+
- Add writeProjectConfig method
|
|
59
|
+
|
|
60
|
+
2. Update systemPrompt function
|
|
61
|
+
|
|
62
|
+
File: source/prompts.ts
|
|
63
|
+
- Add mode parameter to options
|
|
64
|
+
- Load current mode from config
|
|
65
|
+
- Append mode-specific content
|
|
66
|
+
|
|
67
|
+
3. Create mode command
|
|
68
|
+
|
|
69
|
+
File: source/commands/mode-command.ts
|
|
70
|
+
- Use writeProjectConfig to save mode
|
|
71
|
+
- Read current mode from readProjectConfig
|
|
72
|
+
|
|
73
|
+
4. Update system prompt calls
|
|
74
|
+
|
|
75
|
+
Files:
|
|
76
|
+
- source/repl.ts
|
|
77
|
+
- source/conversation-analyzer.ts
|
|
78
|
+
|
|
79
|
+
Both need to:
|
|
80
|
+
- Import config
|
|
81
|
+
- Get current mode: const mode = (await config.readProjectConfig()).mode
|
|
82
|
+
- Pass mode to systemPrompt
|
|
83
|
+
|
|
84
|
+
5. Register mode command
|
|
85
|
+
|
|
86
|
+
File: source/commands/manager.ts
|
|
87
|
+
- Add modeCommand to commands array
|
|
88
|
+
|
|
89
|
+
Updated Mode Command Implementation
|
|
90
|
+
|
|
91
|
+
// source/commands/mode-command.ts
|
|
92
|
+
import { select } from "@inquirer/prompts";
|
|
93
|
+
import { config } from "../config.ts";
|
|
94
|
+
|
|
95
|
+
export function modeCommand(options: CommandOptions): ReplCommand {
|
|
96
|
+
return {
|
|
97
|
+
command: '/mode',
|
|
98
|
+
description: 'Switch between different assistant modes',
|
|
99
|
+
result: 'continue',
|
|
100
|
+
getSubCommands: async () => ['build', 'explain', 'plan'],
|
|
101
|
+
execute: async (args: string[]) => {
|
|
102
|
+
const modes = ['build', 'explain', 'plan'] as const;
|
|
103
|
+
const currentConfig = await config.readProjectConfig();
|
|
104
|
+
const currentMode = currentConfig.mode;
|
|
105
|
+
|
|
106
|
+
if (args.length === 0) {
|
|
107
|
+
// Interactive mode selection
|
|
108
|
+
const selected = await select({
|
|
109
|
+
message: 'Select mode:',
|
|
110
|
+
choices: modes.map(m => ({ name: m, value: m })),
|
|
111
|
+
default: currentMode
|
|
112
|
+
});
|
|
113
|
+
if (selected) {
|
|
114
|
+
await config.writeProjectConfig({ mode: selected });
|
|
115
|
+
options.terminal.log(`✓ Switched to ${selected} mode`);
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
const mode = args[0] as typeof modes[number];
|
|
119
|
+
if (modes.includes(mode)) {
|
|
120
|
+
await config.writeProjectConfig({ mode });
|
|
121
|
+
options.terminal.log(`✓ Switched to ${mode} mode`);
|
|
122
|
+
} else {
|
|
123
|
+
options.terminal.error(`Invalid mode: ${mode}. Available: ${modes.join(', ')}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
This approach uses the project-level config file (.acai/acai.json) to store the mode, making it
|
|
131
|
+
project-specific rather than global.
|
package/.ai/prompt.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I want to update the prompt-command. Currently when using it you have to do `/prompt user:promp-name` or `/prompt project:prompt-name`. I want the behavior to just be `/prompt prompt-name`. There will still be prompts stored at the project and user levels, but they will be combined into a single list. If there is a conflict in prompt names, then the prompt at the project level will override the prompt at the user level.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import https from 'node:https';
|
|
2
|
+
|
|
3
|
+
https.get('https://openrouter.ai/api/v1/models', (res) => {
|
|
4
|
+
let data = '';
|
|
5
|
+
res.on('data', (chunk) => {
|
|
6
|
+
data += chunk;
|
|
7
|
+
});
|
|
8
|
+
res.on('end', () => {
|
|
9
|
+
try {
|
|
10
|
+
const response = JSON.parse(data);
|
|
11
|
+
if (response.data && Array.isArray(response.data)) {
|
|
12
|
+
const model = response.data.find((item) => item.id === 'z-ai/glm-4.5');
|
|
13
|
+
if (model) {
|
|
14
|
+
console.info('Model name:', model.name);
|
|
15
|
+
} else {
|
|
16
|
+
console.info('Model not found.');
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
console.error('Invalid response format.');
|
|
20
|
+
}
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('Error parsing response:', error);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}).on('error', (error) => {
|
|
26
|
+
console.error('Error fetching models:', error);
|
|
27
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { systemPrompt } from "../../source/prompts.ts";
|
|
4
|
+
|
|
5
|
+
const promptContent = await systemPrompt();
|
|
6
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
7
|
+
const outputDir = path.resolve(__dirname, "../docs");
|
|
8
|
+
const outputFile = path.join(outputDir, "system_prompt.txt");
|
|
9
|
+
|
|
10
|
+
// Ensure the output directory exists
|
|
11
|
+
if (!fs.existsSync(outputDir)) {
|
|
12
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
fs.writeFileSync(outputFile, promptContent, "utf-8");
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
let R = 20; // Radius for shapes
|
|
2
|
+
let spacingX = 55;
|
|
3
|
+
let spacingY = 60;
|
|
4
|
+
let startX = 40;
|
|
5
|
+
let startY = 40;
|
|
6
|
+
|
|
7
|
+
function setup() {
|
|
8
|
+
createCanvas(700, 400);
|
|
9
|
+
background(255);
|
|
10
|
+
stroke(0);
|
|
11
|
+
strokeWeight(1.5);
|
|
12
|
+
noFill();
|
|
13
|
+
noLoop();
|
|
14
|
+
|
|
15
|
+
drawAllRows();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Draws a regular polygon
|
|
19
|
+
// Default angleOffset = -PI / 2 ensures triangles/pentagons point upwards,
|
|
20
|
+
// and squares are drawn as diamonds (vertices on axes).
|
|
21
|
+
function drawPolygon(x, y, radius, npoints, angleOffset = -PI / 2) {
|
|
22
|
+
let angle = TWO_PI / npoints;
|
|
23
|
+
beginShape();
|
|
24
|
+
for (let i = 0; i < npoints; i++) {
|
|
25
|
+
let sx = x + cos(i * angle + angleOffset) * radius;
|
|
26
|
+
let sy = y + sin(i * angle + angleOffset) * radius;
|
|
27
|
+
vertex(sx, sy);
|
|
28
|
+
}
|
|
29
|
+
endShape(CLOSE);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Draws a star with npoints, using an outer (radius1) and inner (radius2) radius
|
|
33
|
+
function drawStar(x, y, radius1, radius2, npoints, angleOffset = -PI / 2) {
|
|
34
|
+
let angle = TWO_PI / npoints;
|
|
35
|
+
let halfAngle = angle / 2.0;
|
|
36
|
+
beginShape();
|
|
37
|
+
for (let i = 0; i < npoints; i++) {
|
|
38
|
+
let outerX = x + cos(i * angle + angleOffset) * radius1;
|
|
39
|
+
let outerY = y + sin(i * angle + angleOffset) * radius1;
|
|
40
|
+
vertex(outerX, outerY);
|
|
41
|
+
let innerX = x + cos(i * angle + halfAngle + angleOffset) * radius2;
|
|
42
|
+
let innerY = y + sin(i * angle + halfAngle + angleOffset) * radius2;
|
|
43
|
+
vertex(innerX, innerY);
|
|
44
|
+
}
|
|
45
|
+
endShape(CLOSE);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Draws a hexagram (Star of David) by drawing two offset triangles
|
|
49
|
+
function drawHexagram(x, y, radius) {
|
|
50
|
+
drawPolygon(x, y, radius, 3, -PI / 2); // Triangle pointing up
|
|
51
|
+
drawPolygon(x, y, radius, 3, PI / 2); // Triangle pointing down
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Draws an octagram (8-pointed star) by drawing two offset squares
|
|
55
|
+
function drawOctagram(x, y, radius) {
|
|
56
|
+
// PI / 4 offset gives a square with horizontal/vertical sides
|
|
57
|
+
drawPolygon(x, y, radius, 4, PI / 4);
|
|
58
|
+
// 0 offset (or -PI/2, the default for drawPolygon) gives a diamond-oriented square
|
|
59
|
+
drawPolygon(x, y, radius, 4, 0);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function drawAllRows() {
|
|
63
|
+
let currentX, currentY;
|
|
64
|
+
|
|
65
|
+
// Row 1: Polygons (3 to 12 sides) - 10 shapes
|
|
66
|
+
// This row should be drawn first, starting from a triangle.
|
|
67
|
+
currentY = startY;
|
|
68
|
+
currentX = startX;
|
|
69
|
+
for (let n = 3; n <= 12; n++) {
|
|
70
|
+
// For n=4 (square), the default angleOffset (-PI/2) will make it a diamond.
|
|
71
|
+
drawPolygon(currentX, currentY, R, n);
|
|
72
|
+
currentX += spacingX;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Row 2: Stars (n=5 to 12 points) - 8 shapes
|
|
76
|
+
currentY = startY + spacingY;
|
|
77
|
+
currentX = startX + spacingX; // Indent this row
|
|
78
|
+
let row2_nPoints = [5, 6, 7, 8, 9, 10, 11, 12];
|
|
79
|
+
// rFactors define the ratio of inner_radius / outer_radius for drawStar
|
|
80
|
+
let rFactorsRow2 = {
|
|
81
|
+
5: 0.38, // Pentagram {5/2}
|
|
82
|
+
7: 0.55,
|
|
83
|
+
9: 0.5,
|
|
84
|
+
10: 0.6,
|
|
85
|
+
11: 0.55,
|
|
86
|
+
12: 0.65,
|
|
87
|
+
// Note: 6 and 8 are handled by drawHexagram and drawOctagram
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
for (let n of row2_nPoints) {
|
|
91
|
+
if (n === 6) {
|
|
92
|
+
drawHexagram(currentX, currentY, R);
|
|
93
|
+
} else if (n === 8) {
|
|
94
|
+
drawOctagram(currentX, currentY, R); // This should draw the 8-pointed star
|
|
95
|
+
} else {
|
|
96
|
+
drawStar(currentX, currentY, R, R * rFactorsRow2[n], n);
|
|
97
|
+
}
|
|
98
|
+
currentX += spacingX;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Row 3: Stars (n=7 to 12 points) - 6 shapes
|
|
102
|
+
currentY = startY + 2 * spacingY;
|
|
103
|
+
currentX = startX + 2 * spacingX; // Indent further
|
|
104
|
+
let row3_nPoints = [7, 8, 9, 10, 11, 12];
|
|
105
|
+
let rFactorsRow3 = {
|
|
106
|
+
7: 0.6,
|
|
107
|
+
8: 0.65,
|
|
108
|
+
9: 0.6,
|
|
109
|
+
10: 0.7,
|
|
110
|
+
11: 0.65,
|
|
111
|
+
12: 0.7,
|
|
112
|
+
// For n=8 in this row, it will be a star via drawStar, not an octagram like above
|
|
113
|
+
};
|
|
114
|
+
for (let n of row3_nPoints) {
|
|
115
|
+
// If you wanted the 8-pointed star here to also be an octagram, you'd add:
|
|
116
|
+
// if (n === 8) { drawOctagram(currentX, currentY, R); } else { ... }
|
|
117
|
+
// But based on the original image, these are general stars.
|
|
118
|
+
drawStar(currentX, currentY, R, R * rFactorsRow3[n], n);
|
|
119
|
+
currentX += spacingX;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Row 4: Stars (n=9 to 12 points) - 4 shapes
|
|
123
|
+
currentY = startY + 3 * spacingY;
|
|
124
|
+
currentX = startX + 3 * spacingX;
|
|
125
|
+
let row4_nPoints = [9, 10, 11, 12];
|
|
126
|
+
let rFactorsRow4 = {
|
|
127
|
+
9: 0.4,
|
|
128
|
+
10: 0.45,
|
|
129
|
+
11: 0.4,
|
|
130
|
+
12: 0.45,
|
|
131
|
+
};
|
|
132
|
+
for (let n of row4_nPoints) {
|
|
133
|
+
drawStar(currentX, currentY, R, R * rFactorsRow4[n], n);
|
|
134
|
+
currentX += spacingX;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Row 5: Stars (n=11 to 12 points) - 2 shapes
|
|
138
|
+
currentY = startY + 4 * spacingY;
|
|
139
|
+
currentX = startX + 4 * spacingX;
|
|
140
|
+
let row5_nPoints = [11, 12];
|
|
141
|
+
let rFactorsRow5 = {
|
|
142
|
+
11: 0.3,
|
|
143
|
+
12: 0.3,
|
|
144
|
+
};
|
|
145
|
+
for (let n of row5_nPoints) {
|
|
146
|
+
drawStar(currentX, currentY, R, R * rFactorsRow5[n], n);
|
|
147
|
+
currentX += spacingX;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no -- commitlint --edit "$1"
|
package/.husky/pre-push
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm test
|
package/.ignore
ADDED
package/AGENTS.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
### Commands
|
|
2
|
+
|
|
3
|
+
- **Build:** `npm run build`
|
|
4
|
+
- **Lint:** `npm run lint`
|
|
5
|
+
- **Lint Single File:** `npm run lint -- path/to/file.ts`
|
|
6
|
+
- **Format:** `npm run format`
|
|
7
|
+
- **Fix Lint/Format:** `npm run lint:fix`
|
|
8
|
+
- **Test:** `npm test`
|
|
9
|
+
- **Run Single Test File:** `node --no-warnings --test test/path/to/your.test.ts`
|
|
10
|
+
- **Find Unused Code/Deps:** `npm run knip`
|
|
11
|
+
|
|
12
|
+
### Code Style & Guidelines
|
|
13
|
+
|
|
14
|
+
- **Code Organization:** All source code for this project is stored in `./source`.
|
|
15
|
+
- **Language:** Strict TypeScript (ESNext target). Enable all strict checks.
|
|
16
|
+
- **Modules:** Use ES Modules (`import`/`export`). Add `.ts` extensions to relative imports. Use `node:` prefix for Node.js built-ins (e.g., `import fs from 'node:fs'`).
|
|
17
|
+
- **Formatting/Linting:** Adhere strictly to Biome rules (`npm run format`, `npm run lint`).
|
|
18
|
+
- **Types:** Provide explicit types. Avoid `any` unless absolutely necessary. Always check potentially `undefined`/`null` values. **Do not use non-null assertions (`!`)**.
|
|
19
|
+
- **Naming:** Use camelCase for variables/functions, PascalCase for classes/types/interfaces.
|
|
20
|
+
- **Error Handling:** Implement robust error handling (try/catch, result patterns, etc.).
|
|
21
|
+
- **Logging:** Avoid `console.log` for debugging; use a proper logger or remove before committing.
|
|
22
|
+
- **Commits:** Follow the Conventional Commits standard for commit messages.
|
|
23
|
+
- **Commit Message Length:** Keep commit message lines (header, body, and footer) under 100 characters.
|
|
24
|
+
- **Comments** Never add comments to the code explaining the edit you are making. Comments that help explain how code works are acceptable.
|
|
25
|
+
- **Testing** Use `node:test` and `node:assert/strict` to write unit tests in the `./test` directory. Test directory should follow the same folder structure as source.
|
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# Acai Architecture
|
|
2
|
+
|
|
3
|
+
This document outlines the architecture of the Acai CLI tool, a powerful AI-driven software development assistant. It details the project structure, provides descriptions for each file, and illustrates the primary application flows with Mermaid diagrams.
|
|
4
|
+
|
|
5
|
+
## Project Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
├── acai-ts
|
|
9
|
+
│ ├── .acai
|
|
10
|
+
│ │ ├── acai.json
|
|
11
|
+
│ │ ├── memory
|
|
12
|
+
│ │ ├── prompts
|
|
13
|
+
│ │ │ ├── project-status.md
|
|
14
|
+
│ │ │ └── update-architecture-document.md
|
|
15
|
+
│ │ ├── rules
|
|
16
|
+
│ │ │ └── learned-rules.md
|
|
17
|
+
│ ├── .gitignore
|
|
18
|
+
│ ├── .husky
|
|
19
|
+
│ │ ├── _
|
|
20
|
+
│ │ │ ├── .gitignore
|
|
21
|
+
│ │ │ ├── applypatch-msg
|
|
22
|
+
│ │ │ ├── commit-msg
|
|
23
|
+
│ │ │ ├── h
|
|
24
|
+
│ │ │ ├── husky.sh
|
|
25
|
+
│ │ │ ├── post-applypatch
|
|
26
|
+
│ │ │ ├── post-checkout
|
|
27
|
+
│ │ │ ├── post-commit
|
|
28
|
+
│ │ │ ├── post-merge
|
|
29
|
+
│ │ │ ├── post-rewrite
|
|
30
|
+
│ │ │ ├── pre-applypatch
|
|
31
|
+
│ │ │ ├── pre-auto-gc
|
|
32
|
+
│ │ │ ├── pre-commit
|
|
33
|
+
│ │ │ ├── pre-merge-commit
|
|
34
|
+
│ │ │ ├── pre-push
|
|
35
|
+
│ │ │ ├── pre-rebase
|
|
36
|
+
│ │ │ └── prepare-commit-msg
|
|
37
|
+
│ │ ├── commit-msg
|
|
38
|
+
│ │ └── pre-commit
|
|
39
|
+
│ ├── .ignore
|
|
40
|
+
│ ├── AGENTS.md
|
|
41
|
+
│ ├── ARCHITECTURE.md
|
|
42
|
+
│ ├── LICENSE
|
|
43
|
+
│ ├── README.md
|
|
44
|
+
│ ├── TODO.md
|
|
45
|
+
│ ├── biome.json
|
|
46
|
+
│ ├── commitlint.config.js
|
|
47
|
+
│ ├── docs
|
|
48
|
+
│ ├── knip.json
|
|
49
|
+
│ ├── package-lock.json
|
|
50
|
+
│ ├── package.json
|
|
51
|
+
│ ├── source
|
|
52
|
+
│ │ ├── cli.ts
|
|
53
|
+
│ │ ├── commands
|
|
54
|
+
│ │ │ ├── application-log-command.ts
|
|
55
|
+
│ │ │ ├── clear-command.ts
|
|
56
|
+
│ │ │ ├── compact-command.ts
|
|
57
|
+
│ │ │ ├── copy-command.ts
|
|
58
|
+
│ │ │ ├── edit-command.ts
|
|
59
|
+
│ │ │ ├── edit-prompt-command.ts
|
|
60
|
+
│ │ │ ├── exit-command.ts
|
|
61
|
+
│ │ │ ├── files-command.ts
|
|
62
|
+
│ │ │ ├── generate-rules-command.ts
|
|
63
|
+
│ │ │ ├── help-command.ts
|
|
64
|
+
│ │ │ ├── init-command.ts
|
|
65
|
+
│ │ │ ├── last-log-command.ts
|
|
66
|
+
│ │ │ ├── manager.ts
|
|
67
|
+
│ │ │ ├── model-command.ts
|
|
68
|
+
│ │ │ ├── paste-command.ts
|
|
69
|
+
│ │ │ ├── prompt-command.ts
|
|
70
|
+
│ │ │ ├── reset-command.ts
|
|
71
|
+
│ │ │ ├── rules-command.ts
|
|
72
|
+
│ │ │ ├── save-command.ts
|
|
73
|
+
│ │ │ ├── types.ts
|
|
74
|
+
│ │ │ ├── usage-command.ts
|
|
75
|
+
│ │ ├── config.ts
|
|
76
|
+
│ │ ├── conversation-analyzer.ts
|
|
77
|
+
│ │ ├── dedent.ts
|
|
78
|
+
│ │ ├── formatting.ts
|
|
79
|
+
│ │ ├── index.ts
|
|
80
|
+
│ │ ├── logger.ts
|
|
81
|
+
│ │ ├── mentions.ts
|
|
82
|
+
│ │ ├── messages.ts
|
|
83
|
+
│ │ ├── middleware
|
|
84
|
+
│ │ │ ├── audit-message.ts
|
|
85
|
+
│ │ │ ├── index.ts
|
|
86
|
+
│ │ │ ├── rate-limit.ts
|
|
87
|
+
│ │ ├── models
|
|
88
|
+
│ │ │ ├── ai-config.ts
|
|
89
|
+
│ │ │ ├── anthropic-provider.ts
|
|
90
|
+
│ │ │ ├── deepseek-provider.ts
|
|
91
|
+
│ │ │ ├── google-provider.ts
|
|
92
|
+
│ │ │ ├── manager.ts
|
|
93
|
+
│ │ │ ├── openai-provider.ts
|
|
94
|
+
│ │ │ ├── openrouter-provider.ts
|
|
95
|
+
│ │ │ ├── providers.ts
|
|
96
|
+
│ │ │ └── xai-provider.ts
|
|
97
|
+
│ │ ├── parsing.ts
|
|
98
|
+
│ │ ├── prompts
|
|
99
|
+
│ │ │ └── manager.ts
|
|
100
|
+
│ │ ├── prompts.ts
|
|
101
|
+
│ │ ├── repl-prompt.ts
|
|
102
|
+
│ │ ├── repl.ts
|
|
103
|
+
│ │ ├── saved-selections
|
|
104
|
+
│ │ ├── terminal
|
|
105
|
+
│ │ │ ├── formatting.ts
|
|
106
|
+
│ │ │ ├── index.ts
|
|
107
|
+
│ │ │ ├── markdown-utils.ts
|
|
108
|
+
│ │ │ ├── markdown.ts
|
|
109
|
+
│ │ │ └── types.ts
|
|
110
|
+
│ │ ├── token-tracker.ts
|
|
111
|
+
│ │ ├── token-utils.ts
|
|
112
|
+
│ │ ├── tools
|
|
113
|
+
│ │ │ ├── agent.ts
|
|
114
|
+
│ │ │ ├── bash.ts
|
|
115
|
+
│ │ │ ├── code-interpreter.ts
|
|
116
|
+
│ │ │ ├── command-validation.ts
|
|
117
|
+
│ │ │ ├── delete-file.ts
|
|
118
|
+
│ │ │ ├── directory-tree.ts
|
|
119
|
+
│ │ │ ├── edit-file.ts
|
|
120
|
+
│ │ │ ├── filesystem-utils.ts
|
|
121
|
+
│ │ │ ├── git-utils.ts
|
|
122
|
+
│ │ │ ├── grep.ts
|
|
123
|
+
│ │ │ ├── index.ts
|
|
124
|
+
│ │ │ ├── memory-read.ts
|
|
125
|
+
│ │ │ ├── memory-write.ts
|
|
126
|
+
│ │ │ ├── move-file.ts
|
|
127
|
+
│ │ │ ├── read-file.ts
|
|
128
|
+
│ │ │ ├── read-multiple-files.ts
|
|
129
|
+
│ │ │ ├── save-file.ts
|
|
130
|
+
│ │ │ ├── think.ts
|
|
131
|
+
│ │ │ ├── types.ts
|
|
132
|
+
│ │ │ ├── web-fetch.ts
|
|
133
|
+
│ │ │ ├── web-search.ts
|
|
134
|
+
│ │ ├── utils
|
|
135
|
+
│ │ │ └── process.ts
|
|
136
|
+
│ ├── test
|
|
137
|
+
│ │ ├── commands
|
|
138
|
+
│ │ │ └── copy-command.test.ts
|
|
139
|
+
│ │ ├── terminal
|
|
140
|
+
│ │ │ └── markdown-utils.test.ts
|
|
141
|
+
│ │ ├── tools
|
|
142
|
+
│ │ │ └── command-validation.test.ts
|
|
143
|
+
│ ├── tsconfig.json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## File Descriptions
|
|
147
|
+
|
|
148
|
+
| File Path | Description |
|
|
149
|
+
| :--- | :--- |
|
|
150
|
+
| **.acai** | This directory serves as the central location for Acai's internal state, configuration, and temporary files. |
|
|
151
|
+
| **acai.json** | This file contains project-specific configuration for the Acai CLI tool, including custom commands and tool settings. |
|
|
152
|
+
| **learned-rules.md** | This file stores rules learned by Acai based on user corrections and feedback, aiming to improve its future behavior. |
|
|
153
|
+
| **.gitignore** | This file specifies intentionally untracked files and directories that Git should ignore during version control. |
|
|
154
|
+
| **.husky** | Directory for Husky Git hooks configuration |
|
|
155
|
+
| **.ignore** | This file is used by file watching or search tools (like ripgrep) to specify files and directories to ignore beyond `.gitignore`. |
|
|
156
|
+
| **AGENTS.md** | This markdown file contains project-specific rules, guidelines, and commands for Acai to follow. |
|
|
157
|
+
| **ARCHITECTURE.md** | This document outlines the overall architecture and project structure of the Acai CLI tool. |
|
|
158
|
+
| **README.md** | This file provides a comprehensive overview of the Acai project, including its features, installation instructions, usage examples, and configuration details. |
|
|
159
|
+
| **TODO.md** | This markdown file lists tasks or features that are planned for future implementation within the project. |
|
|
160
|
+
| **biome.json** | This file is the configuration for the Biome tool, defining code formatting and linting rules for the project. |
|
|
161
|
+
| **commitlint.config.js** | Configuration file for commitlint to enforce Conventional Commits |
|
|
162
|
+
| **knip.json** | This file is the configuration for Knip, a tool used to detect unused files, dependencies, and exports in the project. |
|
|
163
|
+
| **package-lock.json** | This file records the exact versions of all installed Node.js dependencies, ensuring reproducible builds across different environments. |
|
|
164
|
+
| **package.json** | This file defines project metadata (name, version), dependencies, development scripts, and binary entry points for the Node.js project. |
|
|
165
|
+
| **source/cli.ts** | Command-line interface entry point and argument parsing |
|
|
166
|
+
| **source/commands/** | Directory containing all REPL command implementations |
|
|
167
|
+
| **application-log-command.ts** | Command for viewing application logs |
|
|
168
|
+
| **clear-command.ts** | Implements the `/clear` REPL command to clear the terminal screen |
|
|
169
|
+
| **compact-command.ts** | Implements the `/compact` REPL command to save, summarize, and reset chat history |
|
|
170
|
+
| **copy-command.ts** | Implements `/copy` to copy the last assistant response to the system clipboard |
|
|
171
|
+
| **edit-command.ts** | Command for editing files directly within the REPL |
|
|
172
|
+
| **edit-prompt-command.ts** | Command to modify the current prompt before sending to AI |
|
|
173
|
+
| **exit-command.ts** | Implements the `/exit` command to exit the application |
|
|
174
|
+
| **files-command.ts** | Command to interactively select files and add their content to the prompt |
|
|
175
|
+
| **generate-rules-command.ts** | Command to generate new rules based on conversation analysis |
|
|
176
|
+
| **help-command.ts** | Implements the `/help` command to display usage information |
|
|
177
|
+
| **init-command.ts** | Command to initialize or improve the AGENTS.md file |
|
|
178
|
+
| **last-log-command.ts** | Command to view the most recent application log entries |
|
|
179
|
+
| **manager.ts** | Defines the CommandManager class that registers and routes commands |
|
|
180
|
+
| Registers `/copy` alongside other commands |
|
|
181
|
+
| **model-command.ts** | Command to list available AI models or switch between them |
|
|
182
|
+
| **paste-command.ts** | Implements the `/paste` command to add clipboard contents to the next prompt |
|
|
183
|
+
| **prompt-command.ts** | Command to load previously saved prompts |
|
|
184
|
+
| **reset-command.ts** | Implements the `/reset` command to save and reset chat history |
|
|
185
|
+
| **rules-command.ts** | Command to view/edit persistent project rules and memories |
|
|
186
|
+
| **save-command.ts** | Implements the `/save` command to save current chat history |
|
|
187
|
+
| **types.ts** | Common TypeScript types and interfaces for commands |
|
|
188
|
+
| **usage-command.ts** | Command to display token usage breakdown |
|
|
189
|
+
| **source/config.ts** | Manages configuration files from project and user directories |
|
|
190
|
+
| **source/conversation-analyzer.ts** | Analyzes conversation history to identify user corrections and infer new rules |
|
|
191
|
+
| **source/dedent.ts** | Utility for removing common indentation from multi-line strings |
|
|
192
|
+
| **source/formatting.ts** | Utilities for formatting content consistently in prompts/output |
|
|
193
|
+
| **source/index.ts** | Main entry point for the acai CLI application |
|
|
194
|
+
| **source/logger.ts** | Configures application-wide logging with pino and file transport |
|
|
195
|
+
| **source/mentions.ts** | Handles @mentions in prompts to auto-fetch file/URL content |
|
|
196
|
+
| **source/messages.ts** | Manages conversation log, saving/loading history, and summarization |
|
|
197
|
+
| **source/middleware/** | Directory for middleware components |
|
|
198
|
+
| **audit-message.ts** | Middleware to log AI requests/responses for debugging |
|
|
199
|
+
| **index.ts** | Barrel file exporting middleware components |
|
|
200
|
+
| **rate-limit.ts** | Middleware to enforce rate limits on AI API calls |
|
|
201
|
+
| **source/models/** | Directory for AI model management |
|
|
202
|
+
| **ai-config.ts** | Determines dynamic AI parameters based on model capabilities |
|
|
203
|
+
| **anthropic-provider.ts** | Configuration for Anthropic AI provider |
|
|
204
|
+
| **deepseek-provider.ts** | Configuration for DeepSeek AI provider |
|
|
205
|
+
| **google-provider.ts** | Configuration for Google AI provider |
|
|
206
|
+
| **manager.ts** | ModelManager class for managing AI model registry |
|
|
207
|
+
| **openai-provider.ts** | Configuration for OpenAI provider |
|
|
208
|
+
| **openrouter-provider.ts** | Configuration for OpenRouter AI provider |
|
|
209
|
+
| **providers.ts** | Central registry of supported AI models and helpers |
|
|
210
|
+
| **xai-provider.ts** | Configuration for XAI provider |
|
|
211
|
+
| **source/parsing.ts** | Utilities for data parsing, especially JSON with Zod |
|
|
212
|
+
| **source/prompts/** | Directory for prompt management |
|
|
213
|
+
| **manager.ts** | PromptManager class for managing prompt state |
|
|
214
|
+
| **source/prompts.ts** | Dynamically generates the main system prompt for AI models |
|
|
215
|
+
| **source/repl-prompt.ts** | Implements user input prompt with history and tab completion |
|
|
216
|
+
| **source/repl.ts** | Repl class that orchestrates the main application loop |
|
|
217
|
+
| **source/saved-selections** | Directory for storing saved file selections |
|
|
218
|
+
| **source/terminal/** | Terminal output and formatting utilities |
|
|
219
|
+
| **formatting.ts** | Low-level terminal manipulation functions |
|
|
220
|
+
| **index.ts** | Main Terminal class for formatted console output |
|
|
221
|
+
| **markdown-utils.ts** | Utilities for processing Markdown content |
|
|
222
|
+
| **markdown.ts** | Core logic for Markdown processing |
|
|
223
|
+
| **types.ts** | Type definitions for terminal module |
|
|
224
|
+
| **source/token-tracker.ts** | Tracks and aggregates token usage across AI calls |
|
|
225
|
+
| **source/token-utils.ts** | Utilities for accurate token counting using tiktoken |
|
|
226
|
+
| **source/tools/** | Directory containing all tool implementations |
|
|
227
|
+
| **agent.ts** | Core AI agent logic |
|
|
228
|
+
| **bash.ts** | Executes whitelisted shell commands securely |
|
|
229
|
+
| **code-interpreter.ts** | Executes sandboxed JavaScript code |
|
|
230
|
+
| **command-validation.ts** | Validates CLI commands |
|
|
231
|
+
| **delete-file.ts** | Removes files from the file system |
|
|
232
|
+
| **directory-tree.ts** | Gets directory tree structure |
|
|
233
|
+
| **edit-file.ts** | Modifies file contents with path validation |
|
|
234
|
+
| **filesystem-utils.ts** | General utilities for file system operations |
|
|
235
|
+
| **git-utils.ts** | Utilities for Git operations |
|
|
236
|
+
| **grep.ts** | Searches file contents using ripgrep |
|
|
237
|
+
| **index.ts** | Initializes and exports all tools |
|
|
238
|
+
| **memory-read.ts** | Reads from agent's memory |
|
|
239
|
+
| **memory-write.ts** | Writes to agent's memory |
|
|
240
|
+
| **move-file.ts** | Moves or renames files |
|
|
241
|
+
| **read-file.ts** | Reads file contents |
|
|
242
|
+
| **read-multiple-files.ts** | Reads multiple files efficiently |
|
|
243
|
+
| **save-file.ts** | Writes content to files |
|
|
244
|
+
| **think.ts** | Tool to log AI thought process |
|
|
245
|
+
| **types.ts** | Common types for tool communication |
|
|
246
|
+
| **web-fetch.ts** | Retrieves content from URLs |
|
|
247
|
+
| **web-search.ts** | Performs web searches using Exa API |
|
|
248
|
+
| **source/utils/process.ts** | Robust promise-based wrapper for child_process.execFile |
|
|
249
|
+
| **test/commands/** | Tests for command implementations |
|
|
250
|
+
| **test/terminal/markdown-utils.test.ts** | Tests for markdown utilities |
|
|
251
|
+
| **test/tools/command-validation.test.ts** | Tests for command validation |
|
|
252
|
+
| **tsconfig.json** | TypeScript compiler configuration |
|
|
253
|
+
|
|
254
|
+
## Flow Diagram
|
|
255
|
+
|
|
256
|
+
The primary entry point for the Acai CLI is `source/index.ts`, which is compiled to `dist/index.js` and executed via the `acai` binary defined in `package.json`. The application initializes and enters a REPL (Read-Eval-Print Loop) to handle user input.
|
|
257
|
+
|
|
258
|
+
### Application Initialization and REPL
|
|
259
|
+
|
|
260
|
+
```mermaid
|
|
261
|
+
graph TD
|
|
262
|
+
A[Start acai] --> B{source/index.ts};
|
|
263
|
+
B --> C[Initialize ConfigManager];
|
|
264
|
+
C --> D[Initialize Logger];
|
|
265
|
+
D --> E[Initialize ModelManager];
|
|
266
|
+
E --> F[Initialize MessageHistory];
|
|
267
|
+
F --> G[Initialize CommandManager];
|
|
268
|
+
G --> H[Initialize REPL];
|
|
269
|
+
H --> I{Wait for user input};
|
|
270
|
+
I --> J{Input starts with "/"?};
|
|
271
|
+
J -- Yes --> K[Execute Command];
|
|
272
|
+
J -- No --> L[Process as AI Prompt];
|
|
273
|
+
K --> I;
|
|
274
|
+
L --> I;
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### AI Prompt Processing
|
|
278
|
+
|
|
279
|
+
```mermaid
|
|
280
|
+
graph TD
|
|
281
|
+
A[User enters prompt] --> B{Process Mentions};
|
|
282
|
+
B --> C[Build System Prompt];
|
|
283
|
+
C --> D{Select AI Model};
|
|
284
|
+
D --> E[Send to AI Provider];
|
|
285
|
+
E --> F{Receive AI Response};
|
|
286
|
+
F --> G{Response contains tool calls?};
|
|
287
|
+
G -- Yes --> H[Execute Tools];
|
|
288
|
+
H --> E;
|
|
289
|
+
G -- No --> I[Display response to user];
|
|
290
|
+
I --> A;
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Command Execution (`/` commands)
|
|
294
|
+
|
|
295
|
+
```mermaid
|
|
296
|
+
graph TD
|
|
297
|
+
A[User enters command] --> B{CommandManager};
|
|
298
|
+
B --> C{Find matching command handler};
|
|
299
|
+
C -- Found --> D[Execute command handler];
|
|
300
|
+
D --> E[Display output to user];
|
|
301
|
+
E --> A;
|
|
302
|
+
C -- Not Found --> F[Display error message];
|
|
303
|
+
F --> A;
|
|
304
|
+
```
|