@travisennis/acai 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -19
- package/bin/acai-wrapper.js +26 -0
- package/dist/agent/index.d.ts +132 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +434 -0
- package/dist/api/exa/index.js +1 -1
- package/dist/cli.d.ts +4 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +67 -40
- package/dist/commands/add-directory-command.d.ts +3 -0
- package/dist/commands/add-directory-command.d.ts.map +1 -0
- package/dist/commands/add-directory-command.js +54 -0
- package/dist/commands/application-log-command.d.ts +1 -1
- package/dist/commands/application-log-command.d.ts.map +1 -1
- package/dist/commands/application-log-command.js +18 -20
- package/dist/commands/clear-command.d.ts +1 -1
- package/dist/commands/clear-command.d.ts.map +1 -1
- package/dist/commands/clear-command.js +7 -3
- package/dist/commands/compact-command.d.ts.map +1 -1
- package/dist/commands/compact-command.js +9 -5
- package/dist/commands/context-command.d.ts +3 -0
- package/dist/commands/context-command.d.ts.map +1 -0
- package/dist/commands/context-command.js +124 -0
- package/dist/commands/copy-command.d.ts.map +1 -1
- package/dist/commands/copy-command.js +14 -5
- package/dist/commands/edit-command.d.ts +1 -1
- package/dist/commands/edit-command.d.ts.map +1 -1
- package/dist/commands/edit-command.js +21 -34
- package/dist/commands/edit-prompt-command.d.ts +1 -1
- package/dist/commands/edit-prompt-command.d.ts.map +1 -1
- package/dist/commands/edit-prompt-command.js +18 -15
- package/dist/commands/exit-command.d.ts +1 -4
- package/dist/commands/exit-command.d.ts.map +1 -1
- package/dist/commands/exit-command.js +9 -5
- package/dist/commands/files-command.d.ts +1 -1
- package/dist/commands/files-command.d.ts.map +1 -1
- package/dist/commands/files-command.js +20 -16
- package/dist/commands/generate-rules-command.d.ts +1 -1
- package/dist/commands/generate-rules-command.d.ts.map +1 -1
- package/dist/commands/generate-rules-command.js +307 -39
- package/dist/commands/handoff-command.d.ts +3 -0
- package/dist/commands/handoff-command.d.ts.map +1 -0
- package/dist/commands/handoff-command.js +191 -0
- package/dist/commands/health-command.d.ts +1 -1
- package/dist/commands/health-command.d.ts.map +1 -1
- package/dist/commands/health-command.js +49 -27
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +25 -5
- package/dist/commands/history-command.d.ts +3 -0
- package/dist/commands/history-command.d.ts.map +1 -0
- package/dist/commands/history-command.js +458 -0
- package/dist/commands/init-command.d.ts +1 -1
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/init-command.js +40 -22
- package/dist/commands/last-log-command.d.ts +1 -1
- package/dist/commands/last-log-command.d.ts.map +1 -1
- package/dist/commands/last-log-command.js +15 -15
- package/dist/commands/list-directories-command.d.ts +3 -0
- package/dist/commands/list-directories-command.d.ts.map +1 -0
- package/dist/commands/list-directories-command.js +35 -0
- package/dist/commands/list-tools-command.d.ts.map +1 -1
- package/dist/commands/list-tools-command.js +61 -21
- package/dist/commands/manager.d.ts +9 -4
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +64 -39
- package/dist/commands/model-command.d.ts.map +1 -1
- package/dist/commands/model-command.js +201 -66
- package/dist/commands/paste-command.d.ts +1 -1
- package/dist/commands/paste-command.d.ts.map +1 -1
- package/dist/commands/paste-command.js +23 -9
- package/dist/commands/pickup-command.d.ts +3 -0
- package/dist/commands/pickup-command.d.ts.map +1 -0
- package/dist/commands/pickup-command.js +109 -0
- package/dist/commands/prompt-command.d.ts +19 -1
- package/dist/commands/prompt-command.d.ts.map +1 -1
- package/dist/commands/prompt-command.js +191 -98
- package/dist/commands/remove-directory-command.d.ts +3 -0
- package/dist/commands/remove-directory-command.d.ts.map +1 -0
- package/dist/commands/remove-directory-command.js +55 -0
- package/dist/commands/reset-command.d.ts +1 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/reset-command.js +8 -5
- package/dist/commands/rules-command.d.ts +1 -1
- package/dist/commands/rules-command.d.ts.map +1 -1
- package/dist/commands/rules-command.js +25 -22
- package/dist/commands/save-command.d.ts +1 -1
- package/dist/commands/save-command.d.ts.map +1 -1
- package/dist/commands/save-command.js +8 -3
- package/dist/commands/shell-command.d.ts.map +1 -1
- package/dist/commands/shell-command.js +45 -24
- package/dist/commands/types.d.ts +9 -7
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/usage-command.d.ts +1 -1
- package/dist/commands/usage-command.d.ts.map +1 -1
- package/dist/commands/usage-command.js +18 -7
- package/dist/config.d.ts +21 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +90 -63
- package/dist/execution/index.d.ts +17 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +62 -20
- package/dist/formatting.d.ts +127 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +201 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +263 -102
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +47 -18
- package/dist/mentions.d.ts +2 -1
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +16 -1
- package/dist/messages.d.ts +11 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +122 -21
- package/dist/middleware/cache.d.ts +3 -0
- package/dist/middleware/cache.d.ts.map +1 -0
- package/dist/middleware/cache.js +53 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -0
- package/dist/models/ai-config.d.ts +4 -2
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +12 -2
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +3 -67
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -3
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/manager.d.ts +2 -1
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +26 -2
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/openrouter-provider.d.ts +16 -22
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +175 -236
- package/dist/models/providers.d.ts +4 -14
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +1 -57
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts.d.ts +10 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +447 -70
- package/dist/repl/project-status-line.d.ts +3 -0
- package/dist/repl/project-status-line.d.ts.map +1 -0
- package/dist/repl/project-status-line.js +61 -0
- package/dist/repl/tool-call-repair.d.ts.map +1 -1
- package/dist/repl/tool-call-repair.js +8 -4
- package/dist/repl-new.d.ts +51 -0
- package/dist/repl-new.d.ts.map +1 -0
- package/dist/repl-new.js +354 -0
- package/dist/skills.d.ts +20 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +192 -0
- package/dist/terminal/control.d.ts +55 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +109 -0
- package/dist/terminal/default-theme.d.ts +1 -1
- package/dist/terminal/default-theme.d.ts.map +1 -1
- package/dist/terminal/default-theme.js +24 -28
- package/dist/terminal/formatting.d.ts +23 -25
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -52
- package/dist/terminal/highlight/index.d.ts.map +1 -1
- package/dist/terminal/highlight/index.js +3 -6
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +2 -6
- package/dist/terminal/index.d.ts +2 -94
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -370
- package/dist/terminal/markdown.js +10 -5
- package/dist/terminal/select-prompt.d.ts +2 -2
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +47 -39
- package/dist/terminal/strip-ansi.js +4 -4
- package/dist/terminal/table/cell.d.ts +114 -0
- package/dist/terminal/table/cell.d.ts.map +1 -0
- package/dist/terminal/table/cell.js +407 -0
- package/dist/terminal/table/debug.d.ts +15 -0
- package/dist/terminal/table/debug.d.ts.map +1 -0
- package/dist/terminal/table/debug.js +32 -0
- package/dist/terminal/table/index.d.ts +3 -0
- package/dist/terminal/table/index.d.ts.map +1 -0
- package/dist/terminal/table/index.js +2 -0
- package/dist/terminal/table/layout-manager.d.ts +27 -0
- package/dist/terminal/table/layout-manager.d.ts.map +1 -0
- package/dist/terminal/table/layout-manager.js +257 -0
- package/dist/terminal/table/table.d.ts +9 -0
- package/dist/terminal/table/table.d.ts.map +1 -0
- package/dist/terminal/table/table.js +97 -0
- package/dist/terminal/table/utils.d.ts +63 -0
- package/dist/terminal/table/utils.d.ts.map +1 -0
- package/dist/terminal/table/utils.js +326 -0
- package/dist/tokens/threshold.d.ts +20 -0
- package/dist/tokens/threshold.d.ts.map +1 -0
- package/dist/tokens/threshold.js +67 -0
- package/dist/tools/advanced-edit-file.d.ts +69 -0
- package/dist/tools/advanced-edit-file.d.ts.map +1 -0
- package/dist/tools/advanced-edit-file.js +285 -0
- package/dist/tools/agent.d.ts +16 -5
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +86 -59
- package/dist/tools/bash.d.ts +23 -12
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +243 -128
- package/dist/tools/batch.d.ts +34 -0
- package/dist/tools/batch.d.ts.map +1 -0
- package/dist/tools/batch.js +174 -0
- package/dist/tools/code-interpreter.d.ts +21 -9
- package/dist/tools/code-interpreter.d.ts.map +1 -1
- package/dist/tools/code-interpreter.js +151 -134
- package/dist/tools/delete-file.d.ts +17 -10
- package/dist/tools/delete-file.d.ts.map +1 -1
- package/dist/tools/delete-file.js +60 -97
- package/dist/tools/directory-tree.d.ts +17 -12
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +57 -48
- package/dist/tools/dynamic-tool-loader.d.ts +16 -10
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +122 -130
- package/dist/tools/dynamic-tool-parser.d.ts +1 -0
- package/dist/tools/dynamic-tool-parser.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-parser.js +1 -0
- package/dist/tools/edit-file.d.ts +35 -15
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +127 -114
- package/dist/tools/glob.d.ts +36 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/glob.js +154 -0
- package/dist/tools/grep.d.ts +73 -12
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +425 -165
- package/dist/tools/index.d.ts +220 -126
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +284 -135
- package/dist/tools/llm-edit-fixer.d.ts +24 -0
- package/dist/tools/llm-edit-fixer.d.ts.map +1 -0
- package/dist/tools/llm-edit-fixer.js +136 -0
- package/dist/tools/move-file.d.ts +19 -7
- package/dist/tools/move-file.d.ts.map +1 -1
- package/dist/tools/move-file.js +48 -34
- package/dist/tools/read-file.d.ts +47 -9
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +84 -70
- package/dist/tools/read-multiple-files.d.ts +17 -6
- package/dist/tools/read-multiple-files.d.ts.map +1 -1
- package/dist/tools/read-multiple-files.js +132 -72
- package/dist/tools/save-file.d.ts +45 -12
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +76 -101
- package/dist/tools/think.d.ts +15 -7
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +34 -20
- package/dist/tools/types.d.ts +8 -10
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +9 -0
- package/dist/tools/utils.d.ts +14 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +16 -0
- package/dist/tools/web-fetch.d.ts +11 -4
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +39 -38
- package/dist/tools/web-search.d.ts +15 -6
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +64 -31
- package/dist/tui/autocomplete.d.ts +44 -0
- package/dist/tui/autocomplete.d.ts.map +1 -0
- package/dist/tui/autocomplete.js +466 -0
- package/dist/tui/components/assistant-message.d.ts +18 -0
- package/dist/tui/components/assistant-message.d.ts.map +1 -0
- package/dist/tui/components/assistant-message.js +29 -0
- package/dist/tui/components/box.d.ts +20 -0
- package/dist/tui/components/box.d.ts.map +1 -0
- package/dist/tui/components/box.js +81 -0
- package/dist/tui/components/editor.d.ts +106 -0
- package/dist/tui/components/editor.d.ts.map +1 -0
- package/dist/tui/components/editor.js +1220 -0
- package/dist/tui/components/footer.d.ts +12 -0
- package/dist/tui/components/footer.d.ts.map +1 -0
- package/dist/tui/components/footer.js +209 -0
- package/dist/tui/components/header.d.ts +21 -0
- package/dist/tui/components/header.d.ts.map +1 -0
- package/dist/tui/components/header.js +63 -0
- package/dist/tui/components/input.d.ts +14 -0
- package/dist/tui/components/input.d.ts.map +1 -0
- package/dist/tui/components/input.js +122 -0
- package/dist/tui/components/loader.d.ts +23 -0
- package/dist/tui/components/loader.d.ts.map +1 -0
- package/dist/tui/components/loader.js +45 -0
- package/dist/tui/components/markdown.d.ts +106 -0
- package/dist/tui/components/markdown.d.ts.map +1 -0
- package/dist/tui/components/markdown.js +586 -0
- package/dist/tui/components/modal.d.ts +29 -0
- package/dist/tui/components/modal.d.ts.map +1 -0
- package/dist/tui/components/modal.js +263 -0
- package/dist/tui/components/progress-bar.d.ts +19 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/tui/components/progress-bar.js +78 -0
- package/dist/tui/components/prompt-status.d.ts +17 -0
- package/dist/tui/components/prompt-status.d.ts.map +1 -0
- package/dist/tui/components/prompt-status.js +26 -0
- package/dist/tui/components/select-list.d.ts +48 -0
- package/dist/tui/components/select-list.d.ts.map +1 -0
- package/dist/tui/components/select-list.js +207 -0
- package/dist/tui/components/spacer.d.ts +16 -0
- package/dist/tui/components/spacer.d.ts.map +1 -0
- package/dist/tui/components/spacer.js +27 -0
- package/dist/tui/components/table.d.ts +27 -0
- package/dist/tui/components/table.d.ts.map +1 -0
- package/dist/tui/components/table.js +125 -0
- package/dist/tui/components/text.d.ts +26 -0
- package/dist/tui/components/text.d.ts.map +1 -0
- package/dist/tui/components/text.js +143 -0
- package/dist/tui/components/thinking-block.d.ts +14 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -0
- package/dist/tui/components/thinking-block.js +33 -0
- package/dist/tui/components/tool-execution.d.ts +21 -0
- package/dist/tui/components/tool-execution.d.ts.map +1 -0
- package/dist/tui/components/tool-execution.js +161 -0
- package/dist/tui/components/user-message.d.ts +9 -0
- package/dist/tui/components/user-message.d.ts.map +1 -0
- package/dist/tui/components/user-message.js +23 -0
- package/dist/tui/components/welcome.d.ts +6 -0
- package/dist/tui/components/welcome.d.ts.map +1 -0
- package/dist/tui/components/welcome.js +30 -0
- package/dist/tui/index.d.ts +18 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +22 -0
- package/dist/tui/terminal.d.ts +38 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +94 -0
- package/dist/tui/tui.d.ts +69 -0
- package/dist/tui/tui.d.ts.map +1 -0
- package/dist/tui/tui.js +204 -0
- package/dist/tui/utils.d.ts +24 -0
- package/dist/tui/utils.d.ts.map +1 -0
- package/dist/tui/utils.js +111 -0
- package/dist/utils/bash.d.ts +7 -0
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +31 -12
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/utils/filesystem/security.d.ts +9 -0
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +93 -21
- package/dist/utils/funcs.d.ts +6 -0
- package/dist/utils/funcs.d.ts.map +1 -0
- package/dist/utils/funcs.js +6 -0
- package/dist/utils/generators.d.ts +3 -0
- package/dist/utils/generators.d.ts.map +1 -0
- package/dist/utils/generators.js +25 -0
- package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{tools/git-utils.js → utils/git.js} +0 -6
- package/dist/utils/glob.js +1 -1
- package/dist/utils/iterables.d.ts +2 -0
- package/dist/utils/iterables.d.ts.map +1 -0
- package/dist/utils/iterables.js +6 -0
- package/dist/utils/{zod-utils.d.ts → zod.d.ts} +1 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/package.json +21 -21
- package/dist/conversation-analyzer.d.ts +0 -11
- package/dist/conversation-analyzer.d.ts.map +0 -1
- package/dist/conversation-analyzer.js +0 -88
- package/dist/repl/display-tool-messages.d.ts +0 -4
- package/dist/repl/display-tool-messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.js +0 -55
- package/dist/repl/display-tool-use.d.ts +0 -14
- package/dist/repl/display-tool-use.d.ts.map +0 -1
- package/dist/repl/display-tool-use.js +0 -63
- package/dist/repl/get-prompt-header.d.ts +0 -8
- package/dist/repl/get-prompt-header.d.ts.map +0 -1
- package/dist/repl/get-prompt-header.js +0 -38
- package/dist/repl-prompt.d.ts +0 -15
- package/dist/repl-prompt.d.ts.map +0 -1
- package/dist/repl-prompt.js +0 -147
- package/dist/repl.d.ts +0 -31
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -310
- package/dist/terminal/checkbox-prompt.d.ts +0 -36
- package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
- package/dist/terminal/checkbox-prompt.js +0 -362
- package/dist/terminal/editor-prompt.d.ts +0 -10
- package/dist/terminal/editor-prompt.d.ts.map +0 -1
- package/dist/terminal/editor-prompt.js +0 -61
- package/dist/terminal/errors.d.ts +0 -19
- package/dist/terminal/errors.d.ts.map +0 -1
- package/dist/terminal/errors.js +0 -37
- package/dist/terminal/input-prompt.d.ts +0 -16
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/search-prompt.d.ts +0 -20
- package/dist/terminal/search-prompt.d.ts.map +0 -1
- package/dist/terminal/search-prompt.js +0 -279
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/terminal/types.js +0 -1
- package/dist/tokens/manage-output.d.ts +0 -34
- package/dist/tokens/manage-output.d.ts.map +0 -1
- package/dist/tokens/manage-output.js +0 -44
- package/dist/tool-executor.d.ts +0 -28
- package/dist/tool-executor.d.ts.map +0 -1
- package/dist/tool-executor.js +0 -74
- package/dist/tools/bash-utils.d.ts +0 -7
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/file-editing-utils.d.ts +0 -2
- package/dist/tools/file-editing-utils.d.ts.map +0 -1
- package/dist/tools/file-editing-utils.js +0 -135
- package/dist/tools/filesystem-utils.d.ts +0 -7
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
- /package/dist/utils/{zod-utils.js → zod.js} +0 -0
|
@@ -1,38 +1,56 @@
|
|
|
1
1
|
import { platform } from "node:os";
|
|
2
2
|
import { stepCountIs, streamText } from "ai";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import style from "../terminal/style.js";
|
|
4
|
+
import { initCliTools } from "../tools/index.js";
|
|
5
|
+
import { Markdown, Spacer, Text } from "../tui/index.js";
|
|
6
|
+
import { inGitDirectory } from "../utils/git.js";
|
|
7
|
+
const initPrompt = `Please analyze this codebase and create a AGENTS.md file containing:
|
|
8
|
+
1. An overview of the project including how the project is structured and the tech stack used.
|
|
9
|
+
2. Build/lint/test commands - especially for running a single test
|
|
10
|
+
3. Directions on how to run the app
|
|
11
|
+
4. Custom tools defined in ./.acai/tools
|
|
12
|
+
3. Code style guidelines including imports, formatting, types, naming conventions, error handling, etc.
|
|
13
|
+
4. Commit format (does the repository use Conventional Commits?)
|
|
14
|
+
5. Branch strategy
|
|
15
|
+
6. PR requirements
|
|
16
|
+
|
|
17
|
+
The file you create will be given to agentic coding agents (such as yourself) that operate in this repository. Make it about 50 lines long.
|
|
18
|
+
|
|
19
|
+
If there's already a AGENTS.md, improve it.
|
|
20
|
+
If there are Cursor rules (in .cursor/rules/ or .cursorrules), Copilot rules (in .github/copilot-instructions.md or .github/instructions/), or Windsurf rules (in .windsurf/rules), make sure to include them.
|
|
21
|
+
|
|
22
|
+
Your current working directory is ${process.cwd()}
|
|
23
|
+
Is directory a git repo: ${(await inGitDirectory()) ? "Yes" : "No"}
|
|
24
|
+
Platform: ${platform()}`;
|
|
25
|
+
export const initCommand = ({ modelManager, tokenCounter, workspace, }) => {
|
|
6
26
|
return {
|
|
7
27
|
command: "/init",
|
|
8
28
|
description: "Creates the AGENTS.md file.",
|
|
9
29
|
getSubCommands: () => Promise.resolve([]),
|
|
10
|
-
|
|
30
|
+
async handle(_args, { tui, container, editor, }) {
|
|
31
|
+
container.addChild(new Text("Initializing project and creating AGENTS.md...", 1, 1));
|
|
32
|
+
tui.requestRender();
|
|
11
33
|
const result = streamText({
|
|
12
34
|
model: modelManager.getModel("init-project"),
|
|
13
35
|
temperature: 0.5,
|
|
14
|
-
prompt:
|
|
15
|
-
1. Build/lint/test commands - especially for running a single test
|
|
16
|
-
2. Code style guidelines including imports, formatting, types, naming conventions, error handling, etc.
|
|
17
|
-
|
|
18
|
-
The file you create will be given to agentic coding agents (such as yourself) that operate in this repository. Make it about 20 lines long.
|
|
19
|
-
|
|
20
|
-
If there's already a AGENTS.md, improve it.
|
|
21
|
-
If there are Cursor rules (in .cursor/rules/ or .cursorrules), Copilot rules (in .github/copilot-instructions.md), or Windsurf rules (in .windsurf/rules), make sure to include them.
|
|
22
|
-
|
|
23
|
-
Your current working directory is ${process.cwd()}
|
|
24
|
-
Is directory a git repo: ${(await inGitDirectory()) ? "Yes" : "No"}
|
|
25
|
-
Platform: ${platform()}`,
|
|
36
|
+
prompt: initPrompt,
|
|
26
37
|
stopWhen: stepCountIs(40),
|
|
27
|
-
tools: await
|
|
28
|
-
terminal,
|
|
29
|
-
tokenCounter,
|
|
30
|
-
events: toolEvents,
|
|
31
|
-
}),
|
|
38
|
+
tools: (await initCliTools({ tokenCounter, workspace })).toolDefs,
|
|
32
39
|
});
|
|
40
|
+
container.addChild(new Spacer(1));
|
|
41
|
+
let output = "";
|
|
42
|
+
const t = new Markdown(output, { paddingX: 1, paddingY: 0 });
|
|
43
|
+
container.addChild(t);
|
|
33
44
|
for await (const text of result.textStream) {
|
|
34
|
-
|
|
45
|
+
output += text;
|
|
46
|
+
// Update the display with the latest output
|
|
47
|
+
t.setText(output);
|
|
48
|
+
tui.requestRender();
|
|
35
49
|
}
|
|
50
|
+
container.addChild(new Spacer(1));
|
|
51
|
+
container.addChild(new Text(style.green("AGENTS.md file created successfully"), 1, 0));
|
|
52
|
+
tui.requestRender();
|
|
53
|
+
editor.setText("");
|
|
36
54
|
return "continue";
|
|
37
55
|
},
|
|
38
56
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
2
|
-
export declare const lastLogCommand: (
|
|
2
|
+
export declare const lastLogCommand: (_options: CommandOptions) => ReplCommand;
|
|
3
3
|
//# sourceMappingURL=last-log-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last-log-command.d.ts","sourceRoot":"","sources":["../../source/commands/last-log-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"last-log-command.d.ts","sourceRoot":"","sources":["../../source/commands/last-log-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyC9D,eAAO,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,WAiEzD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { config } from "../config.js";
|
|
4
|
-
import { editor } from "../terminal/editor-prompt.js";
|
|
5
4
|
import style from "../terminal/style.js";
|
|
5
|
+
import { Text } from "../tui/index.js";
|
|
6
6
|
import { glob } from "../utils/glob.js";
|
|
7
7
|
const isoDateRegex = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)/;
|
|
8
8
|
// Function to find the most recent log file
|
|
@@ -36,34 +36,34 @@ async function findMostRecentLog(logDir) {
|
|
|
36
36
|
datedFiles.sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
37
37
|
return datedFiles[0]?.file ?? null; // The first file is the most recent
|
|
38
38
|
}
|
|
39
|
-
export const lastLogCommand = (
|
|
39
|
+
export const lastLogCommand = (_options) => {
|
|
40
40
|
return {
|
|
41
41
|
command: "/last-log",
|
|
42
42
|
description: "Opens the most recent REPL audit log in the editor.",
|
|
43
43
|
getSubCommands: () => Promise.resolve([]),
|
|
44
|
-
|
|
44
|
+
async handle(_args, { tui, container, editor, }) {
|
|
45
45
|
const logDir = config.app.ensurePathSync("audit");
|
|
46
46
|
const mostRecentLog = await findMostRecentLog(logDir);
|
|
47
47
|
if (!mostRecentLog) {
|
|
48
|
-
|
|
48
|
+
container.addChild(new Text(style.red(`No REPL audit logs found in '${logDir}'.`), 0, 1));
|
|
49
|
+
tui.requestRender();
|
|
50
|
+
editor.setText("");
|
|
49
51
|
return "continue";
|
|
50
52
|
}
|
|
51
53
|
try {
|
|
52
54
|
const content = await readFile(mostRecentLog, { encoding: "utf8" });
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// and not calling writeFileSync after, this effectively becomes read-only.
|
|
60
|
-
skipPrompt: true,
|
|
61
|
-
});
|
|
62
|
-
terminal.info("Closed log view");
|
|
55
|
+
// For TUI mode, we'll just display a message since we can't use the editor prompt
|
|
56
|
+
container.addChild(new Text(`Viewing most recent log: ${style.blue(mostRecentLog)}`, 1, 0));
|
|
57
|
+
container.addChild(new Text(`Content length: ${content.length} characters`, 2, 0));
|
|
58
|
+
container.addChild(new Text(style.dim("Note: Full log viewing not available in TUI mode"), 3, 0));
|
|
59
|
+
tui.requestRender();
|
|
60
|
+
editor.setText("");
|
|
63
61
|
return "continue";
|
|
64
62
|
}
|
|
65
63
|
catch (error) {
|
|
66
|
-
|
|
64
|
+
container.addChild(new Text(style.red(`Error reading log file ${mostRecentLog}: ${error}`), 1, 0));
|
|
65
|
+
tui.requestRender();
|
|
66
|
+
editor.setText("");
|
|
67
67
|
return "continue";
|
|
68
68
|
}
|
|
69
69
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-directories-command.d.ts","sourceRoot":"","sources":["../../source/commands/list-directories-command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,sBAAsB,GAAI,gBAEpC,cAAc,KAAG,WAkDnB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Modal, Container as ModalContainer, ModalText } from "../tui/index.js";
|
|
2
|
+
export const listDirectoriesCommand = ({ workspace, }) => {
|
|
3
|
+
return {
|
|
4
|
+
command: "/list-directories",
|
|
5
|
+
description: "List all allowed working directories",
|
|
6
|
+
getSubCommands: async () => {
|
|
7
|
+
return [];
|
|
8
|
+
},
|
|
9
|
+
async handle(_args, { tui, editor }) {
|
|
10
|
+
// Build modal content
|
|
11
|
+
const modalContent = new ModalContainer();
|
|
12
|
+
modalContent.addChild(new ModalText("Current working directories:", 0, 1));
|
|
13
|
+
if (workspace.allowedDirs.length === 0) {
|
|
14
|
+
modalContent.addChild(new ModalText("No directories configured. Using current directory only.", 0, 1));
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
// Add each directory as a separate line
|
|
18
|
+
workspace.allowedDirs.forEach((dir) => {
|
|
19
|
+
const isPrimary = dir === workspace.primaryDir;
|
|
20
|
+
const prefix = isPrimary ? "● " : " ";
|
|
21
|
+
const indicator = isPrimary ? " (primary)" : "";
|
|
22
|
+
modalContent.addChild(new ModalText(`${prefix}${dir}${indicator}`, 0, 0));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
// Create and show modal
|
|
26
|
+
const modal = new Modal("Working Directories", modalContent, true, () => {
|
|
27
|
+
// Modal closed callback
|
|
28
|
+
editor.setText("");
|
|
29
|
+
tui.requestRender();
|
|
30
|
+
});
|
|
31
|
+
tui.showModal(modal);
|
|
32
|
+
return "continue";
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-tools-command.d.ts","sourceRoot":"","sources":["../../source/commands/list-tools-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-tools-command.d.ts","sourceRoot":"","sources":["../../source/commands/list-tools-command.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAgIrE"}
|
|
@@ -1,28 +1,33 @@
|
|
|
1
|
+
import style from "../terminal/style.js";
|
|
1
2
|
import { initAgents, initTools } from "../tools/index.js";
|
|
3
|
+
import { Modal, Container as ModalContainer, ModalText, TableComponent, } from "../tui/index.js";
|
|
2
4
|
export function listToolsCommand(options) {
|
|
3
5
|
return {
|
|
4
6
|
command: "/list-tools",
|
|
5
7
|
description: "List all available static and dynamic tools.",
|
|
6
8
|
aliases: ["/lt"],
|
|
7
9
|
getSubCommands: async () => [],
|
|
8
|
-
async
|
|
9
|
-
const { terminal } = options;
|
|
10
|
+
async handle(_args, { tui, editor }) {
|
|
10
11
|
try {
|
|
12
|
+
// Get active tools from config
|
|
13
|
+
const projectConfig = await options.config.getConfig();
|
|
14
|
+
const activeTools = projectConfig.tools.activeTools;
|
|
11
15
|
const tools = await initTools({
|
|
12
|
-
terminal: options.terminal,
|
|
13
16
|
tokenCounter: options.tokenCounter,
|
|
14
|
-
|
|
17
|
+
workspace: options.workspace,
|
|
18
|
+
modelManager: options.modelManager,
|
|
19
|
+
tokenTracker: options.tokenTracker,
|
|
15
20
|
});
|
|
16
21
|
const agentTools = await initAgents({
|
|
17
|
-
terminal: options.terminal,
|
|
18
22
|
modelManager: options.modelManager,
|
|
19
23
|
tokenTracker: options.tokenTracker,
|
|
20
24
|
tokenCounter: options.tokenCounter,
|
|
21
|
-
|
|
25
|
+
workspace: options.workspace,
|
|
22
26
|
});
|
|
23
|
-
const toolNames = Object.keys({
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const toolNames = Object.keys({
|
|
28
|
+
...tools.toolDefs,
|
|
29
|
+
...agentTools.toolDefs,
|
|
30
|
+
}).sort();
|
|
26
31
|
// Separate static and dynamic tools
|
|
27
32
|
const staticTools = [];
|
|
28
33
|
const dynamicTools = [];
|
|
@@ -34,26 +39,61 @@ export function listToolsCommand(options) {
|
|
|
34
39
|
staticTools.push(toolName);
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
// Build modal content
|
|
43
|
+
const modalContent = new ModalContainer();
|
|
44
|
+
if (toolNames.length === 0) {
|
|
45
|
+
modalContent.addChild(new ModalText("No tools available.", 0, 1));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Create table data
|
|
49
|
+
const tableData = [];
|
|
50
|
+
// Add static tools
|
|
40
51
|
for (const toolName of staticTools) {
|
|
41
|
-
|
|
52
|
+
const isActive = activeTools === undefined || activeTools.includes(toolName);
|
|
53
|
+
tableData.push([
|
|
54
|
+
toolName,
|
|
55
|
+
"Static",
|
|
56
|
+
isActive ? "Active" : "Inactive",
|
|
57
|
+
]);
|
|
42
58
|
}
|
|
43
|
-
|
|
44
|
-
// Display dynamic tools
|
|
45
|
-
if (dynamicTools.length > 0) {
|
|
46
|
-
terminal.writeln(" Dynamic tools:");
|
|
59
|
+
// Add dynamic tools
|
|
47
60
|
for (const toolName of dynamicTools) {
|
|
48
|
-
|
|
61
|
+
const isActive = activeTools === undefined || activeTools.includes(toolName);
|
|
62
|
+
tableData.push([
|
|
63
|
+
toolName,
|
|
64
|
+
"Dynamic",
|
|
65
|
+
isActive ? "Active" : "Inactive",
|
|
66
|
+
]);
|
|
49
67
|
}
|
|
68
|
+
modalContent.addChild(new TableComponent(tableData, {
|
|
69
|
+
headers: ["Tool Name", "Type", "Status"],
|
|
70
|
+
colWidths: [60, 20, 20],
|
|
71
|
+
}));
|
|
72
|
+
// Add summary
|
|
73
|
+
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
74
|
+
const activeCount = activeTools === undefined
|
|
75
|
+
? toolNames.length
|
|
76
|
+
: toolNames.filter((tool) => activeTools.includes(tool)).length;
|
|
77
|
+
modalContent.addChild(new ModalText(`Total: ${staticTools.length} static, ${dynamicTools.length} dynamic, ${activeCount} active`, 0, 1));
|
|
50
78
|
}
|
|
51
|
-
//
|
|
52
|
-
|
|
79
|
+
// Create and show modal
|
|
80
|
+
const modal = new Modal("Available Tools", modalContent, true, () => {
|
|
81
|
+
// Modal closed callback
|
|
82
|
+
editor.setText("");
|
|
83
|
+
tui.requestRender();
|
|
84
|
+
});
|
|
85
|
+
tui.showModal(modal);
|
|
53
86
|
return "continue";
|
|
54
87
|
}
|
|
55
88
|
catch (error) {
|
|
56
|
-
|
|
89
|
+
// Show error in modal
|
|
90
|
+
const errorContent = new ModalContainer();
|
|
91
|
+
errorContent.addChild(new ModalText(style.red(`Error listing tools: ${error.message}`), 0, 1));
|
|
92
|
+
const errorModal = new Modal("Error", errorContent, true, () => {
|
|
93
|
+
editor.setText("");
|
|
94
|
+
tui.requestRender();
|
|
95
|
+
});
|
|
96
|
+
tui.showModal(errorModal);
|
|
57
97
|
return "continue";
|
|
58
98
|
}
|
|
59
99
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Container, Editor, SlashCommand, TUI } from "../tui/index.ts";
|
|
1
2
|
import type { CommandOptions } from "./types.ts";
|
|
2
3
|
export declare class CommandManager {
|
|
3
4
|
private commands;
|
|
@@ -5,20 +6,24 @@ export declare class CommandManager {
|
|
|
5
6
|
private modelManager;
|
|
6
7
|
private messageHistory;
|
|
7
8
|
private tokenTracker;
|
|
8
|
-
private terminal;
|
|
9
9
|
private config;
|
|
10
10
|
private tokenCounter;
|
|
11
|
-
private toolEvents;
|
|
12
|
-
private toolExecutor?;
|
|
13
11
|
private promptHistory;
|
|
12
|
+
private workspace;
|
|
14
13
|
private initialized;
|
|
15
|
-
constructor({ promptManager, modelManager,
|
|
14
|
+
constructor({ promptManager, modelManager, messageHistory, tokenTracker, config, tokenCounter, promptHistory, workspace, }: CommandOptions);
|
|
16
15
|
initializeCommmands(): Promise<void>;
|
|
17
16
|
private ensureInitialized;
|
|
17
|
+
getCompletions(): Promise<SlashCommand[]>;
|
|
18
18
|
getCommands(): string[];
|
|
19
19
|
getSubCommands(command: string): Promise<string[]>;
|
|
20
20
|
handle({ userInput }: {
|
|
21
21
|
userInput: string;
|
|
22
|
+
}, options: {
|
|
23
|
+
tui: TUI;
|
|
24
|
+
container: Container;
|
|
25
|
+
inputContainer: Container;
|
|
26
|
+
editor: Editor;
|
|
22
27
|
}): Promise<{
|
|
23
28
|
continue: boolean;
|
|
24
29
|
break: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,GAAG,EACJ,MAAM,iBAAiB,CAAC;AA6BzB,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAG9D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,WAAW,CAAU;gBAEjB,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,SAAS,GACV,EAAE,cAAc;IAaX,mBAAmB;IA0FzB,OAAO,CAAC,iBAAiB;IAQnB,cAAc,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAuB/C,WAAW;IAKL,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAKlD,MAAM,CACV,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,EACpC,OAAO,EAAE;QACP,GAAG,EAAE,GAAG,CAAC;QACT,SAAS,EAAE,SAAS,CAAC;QACrB,cAAc,EAAE,SAAS,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB;;;;CA8BJ"}
|
package/dist/commands/manager.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addDirectoryCommand } from "./add-directory-command.js";
|
|
2
|
+
// import { applicationLogCommand } from "./application-log-command.ts";
|
|
2
3
|
import { clearCommand } from "./clear-command.js";
|
|
3
|
-
import { compactCommand } from "./compact-command.
|
|
4
|
+
// import { compactCommand } from "./compact-command.ts";
|
|
5
|
+
import { contextCommand } from "./context-command.js";
|
|
4
6
|
import { copyCommand } from "./copy-command.js";
|
|
5
|
-
import { editCommand } from "./edit-command.
|
|
6
|
-
import { editPromptCommand } from "./edit-prompt-command.
|
|
7
|
+
// import { editCommand } from "./edit-command.ts";
|
|
8
|
+
// import { editPromptCommand } from "./edit-prompt-command.ts";
|
|
7
9
|
import { exitCommand } from "./exit-command.js";
|
|
8
|
-
import { filesCommand } from "./files-command.
|
|
10
|
+
// import { filesCommand } from "./files-command.ts";
|
|
9
11
|
import { generateRulesCommand } from "./generate-rules-command.js";
|
|
12
|
+
import { handoffCommand } from "./handoff-command.js";
|
|
10
13
|
import { healthCommand } from "./health-command.js";
|
|
11
14
|
import { helpCommand } from "./help-command.js";
|
|
15
|
+
import { historyCommand } from "./history-command.js";
|
|
12
16
|
import { initCommand } from "./init-command.js";
|
|
13
|
-
import { lastLogCommand } from "./last-log-command.
|
|
17
|
+
// import { lastLogCommand } from "./last-log-command.ts";
|
|
18
|
+
import { listDirectoriesCommand } from "./list-directories-command.js";
|
|
14
19
|
import { listToolsCommand } from "./list-tools-command.js";
|
|
15
20
|
import { modelCommand } from "./model-command.js";
|
|
16
21
|
import { pasteCommand } from "./paste-command.js";
|
|
17
|
-
import {
|
|
22
|
+
import { pickupCommand } from "./pickup-command.js";
|
|
23
|
+
import { loadPrompts, promptCommand } from "./prompt-command.js";
|
|
24
|
+
import { removeDirectoryCommand } from "./remove-directory-command.js";
|
|
18
25
|
import { resetCommand } from "./reset-command.js";
|
|
19
|
-
import { rulesCommand } from "./rules-command.
|
|
26
|
+
// import { rulesCommand } from "./rules-command.ts";
|
|
20
27
|
import { saveCommand } from "./save-command.js";
|
|
21
28
|
import { shellCommand } from "./shell-command.js";
|
|
22
29
|
import { usageCommand } from "./usage-command.js";
|
|
@@ -26,25 +33,21 @@ export class CommandManager {
|
|
|
26
33
|
modelManager;
|
|
27
34
|
messageHistory;
|
|
28
35
|
tokenTracker;
|
|
29
|
-
terminal;
|
|
30
36
|
config;
|
|
31
37
|
tokenCounter;
|
|
32
|
-
toolEvents;
|
|
33
|
-
toolExecutor;
|
|
34
38
|
promptHistory;
|
|
39
|
+
workspace;
|
|
35
40
|
initialized;
|
|
36
|
-
constructor({ promptManager, modelManager,
|
|
41
|
+
constructor({ promptManager, modelManager, messageHistory, tokenTracker, config, tokenCounter, promptHistory, workspace, }) {
|
|
37
42
|
this.commands = new Map();
|
|
38
43
|
this.promptManager = promptManager;
|
|
39
44
|
this.modelManager = modelManager;
|
|
40
|
-
this.terminal = terminal;
|
|
41
45
|
this.messageHistory = messageHistory;
|
|
42
46
|
this.tokenTracker = tokenTracker;
|
|
43
47
|
this.config = config;
|
|
44
48
|
this.tokenCounter = tokenCounter;
|
|
45
|
-
this.toolEvents = toolEvents;
|
|
46
|
-
this.toolExecutor = toolExecutor;
|
|
47
49
|
this.promptHistory = promptHistory;
|
|
50
|
+
this.workspace = workspace;
|
|
48
51
|
this.initialized = false;
|
|
49
52
|
}
|
|
50
53
|
async initializeCommmands() {
|
|
@@ -55,64 +58,68 @@ export class CommandManager {
|
|
|
55
58
|
const options = {
|
|
56
59
|
promptManager: this.promptManager,
|
|
57
60
|
modelManager: this.modelManager,
|
|
58
|
-
terminal: this.terminal,
|
|
59
61
|
messageHistory: this.messageHistory,
|
|
60
62
|
tokenTracker: this.tokenTracker,
|
|
61
63
|
config: this.config,
|
|
62
64
|
tokenCounter: this.tokenCounter,
|
|
63
|
-
toolEvents: this.toolEvents,
|
|
64
|
-
toolExecutor: this.toolExecutor,
|
|
65
65
|
promptHistory: this.promptHistory,
|
|
66
|
+
workspace: this.workspace,
|
|
66
67
|
};
|
|
67
68
|
// Register all commands
|
|
68
69
|
const cmds = [
|
|
70
|
+
addDirectoryCommand(options),
|
|
69
71
|
clearCommand(options),
|
|
70
|
-
compactCommand(options),
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
// compactCommand(options),
|
|
73
|
+
contextCommand(options),
|
|
74
|
+
// editCommand(options),
|
|
75
|
+
// editPromptCommand(options),
|
|
73
76
|
exitCommand(options),
|
|
74
|
-
filesCommand(options),
|
|
77
|
+
// filesCommand(options),
|
|
75
78
|
healthCommand(options),
|
|
79
|
+
historyCommand(options),
|
|
76
80
|
initCommand(options),
|
|
81
|
+
listDirectoriesCommand(options),
|
|
77
82
|
pasteCommand(options),
|
|
83
|
+
pickupCommand(options),
|
|
78
84
|
promptCommand(options),
|
|
85
|
+
removeDirectoryCommand(options),
|
|
79
86
|
resetCommand(options),
|
|
80
87
|
saveCommand(options),
|
|
81
|
-
rulesCommand(options),
|
|
88
|
+
// rulesCommand(options),
|
|
82
89
|
modelCommand(options),
|
|
83
90
|
usageCommand(options),
|
|
84
|
-
lastLogCommand(options),
|
|
91
|
+
// lastLogCommand(options),
|
|
85
92
|
generateRulesCommand(options),
|
|
86
|
-
|
|
93
|
+
handoffCommand(options),
|
|
94
|
+
// applicationLogCommand(options),
|
|
87
95
|
copyCommand(options),
|
|
88
96
|
listToolsCommand(options),
|
|
89
97
|
shellCommand(options),
|
|
90
98
|
];
|
|
91
99
|
// Add help command with access to all commands
|
|
92
100
|
const helpCmd = helpCommand(options, this.commands);
|
|
93
|
-
cmds.push(
|
|
94
|
-
...helpCmd,
|
|
95
|
-
execute: () => helpCmd.execute([]),
|
|
96
|
-
});
|
|
101
|
+
cmds.push(helpCmd);
|
|
97
102
|
// Register all commands
|
|
98
103
|
for (const cmd of cmds) {
|
|
99
104
|
this.commands.set(cmd.command, cmd);
|
|
100
|
-
const aliases = cmd.aliases ?? [];
|
|
101
|
-
for (const alias of aliases) {
|
|
102
|
-
|
|
103
|
-
}
|
|
105
|
+
// const aliases: string[] = cmd.aliases ?? [];
|
|
106
|
+
// for (const alias of aliases) {
|
|
107
|
+
// this.commands.set(alias, cmd);
|
|
108
|
+
// }
|
|
104
109
|
}
|
|
105
110
|
const promptCmd = this.commands.get("/prompt");
|
|
106
111
|
if (promptCmd) {
|
|
107
112
|
const promptSubmCommands = await promptCmd.getSubCommands();
|
|
113
|
+
const prompts = await loadPrompts(options.config);
|
|
108
114
|
for (const cmd of promptSubmCommands) {
|
|
115
|
+
const prompt = prompts.get(cmd);
|
|
109
116
|
this.commands.set(`/${cmd}`, {
|
|
110
117
|
command: `/${cmd}`,
|
|
111
|
-
description: "",
|
|
112
|
-
execute: (args) => {
|
|
113
|
-
return promptCmd.execute([cmd, ...args]);
|
|
114
|
-
},
|
|
118
|
+
description: prompt?.description ?? "",
|
|
115
119
|
getSubCommands: () => Promise.resolve([]),
|
|
120
|
+
async handle(args, options) {
|
|
121
|
+
return promptCmd.handle([cmd, ...args], options);
|
|
122
|
+
},
|
|
116
123
|
});
|
|
117
124
|
}
|
|
118
125
|
}
|
|
@@ -123,6 +130,24 @@ export class CommandManager {
|
|
|
123
130
|
throw new Error("Commands have not been initialized. Call initializeCommmands() first.");
|
|
124
131
|
}
|
|
125
132
|
}
|
|
133
|
+
async getCompletions() {
|
|
134
|
+
this.ensureInitialized();
|
|
135
|
+
return Promise.all(Array.from(this.commands.entries()).map(async (entry) => {
|
|
136
|
+
const subs = await entry[1].getSubCommands();
|
|
137
|
+
return {
|
|
138
|
+
name: entry[0].slice(1),
|
|
139
|
+
// value: entry[0].slice(1),
|
|
140
|
+
// label: entry[0].slice(1),
|
|
141
|
+
description: entry[1].description,
|
|
142
|
+
getArgumentCompletions(_argumentPrefix) {
|
|
143
|
+
return subs.map((sub) => ({
|
|
144
|
+
value: sub,
|
|
145
|
+
label: sub,
|
|
146
|
+
}));
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
126
151
|
getCommands() {
|
|
127
152
|
this.ensureInitialized();
|
|
128
153
|
return Array.from(this.commands.keys()).sort();
|
|
@@ -131,7 +156,7 @@ export class CommandManager {
|
|
|
131
156
|
this.ensureInitialized();
|
|
132
157
|
return (await this.commands.get(command)?.getSubCommands()) ?? [];
|
|
133
158
|
}
|
|
134
|
-
async handle({ userInput }) {
|
|
159
|
+
async handle({ userInput }, options) {
|
|
135
160
|
this.ensureInitialized();
|
|
136
161
|
const commandArgs = userInput.split(" ");
|
|
137
162
|
const command = commandArgs.at(0);
|
|
@@ -139,7 +164,7 @@ export class CommandManager {
|
|
|
139
164
|
if (command) {
|
|
140
165
|
const replCommand = this.commands.get(command);
|
|
141
166
|
if (replCommand) {
|
|
142
|
-
const result = await replCommand.
|
|
167
|
+
const result = await replCommand.handle(args, options);
|
|
143
168
|
if (result === "continue") {
|
|
144
169
|
return {
|
|
145
170
|
continue: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-command.d.ts","sourceRoot":"","sources":["../../source/commands/model-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model-command.d.ts","sourceRoot":"","sources":["../../source/commands/model-command.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAoIjE"}
|