@travisennis/acai 0.0.6 → 0.0.8
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 +225 -39
- package/dist/agent/index.d.ts +30 -21
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +237 -198
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -18
- package/dist/commands/add-directory/index.d.ts +3 -0
- package/dist/commands/add-directory/index.d.ts.map +1 -0
- package/dist/commands/add-directory/index.js +50 -0
- package/dist/commands/add-directory/types.d.ts +6 -0
- package/dist/commands/add-directory/types.d.ts.map +1 -0
- package/dist/commands/add-directory/utils.d.ts +3 -0
- package/dist/commands/add-directory/utils.d.ts.map +1 -0
- package/dist/commands/add-directory/utils.js +15 -0
- package/dist/commands/clear/index.d.ts +3 -0
- package/dist/commands/clear/index.d.ts.map +1 -0
- package/dist/commands/{clear-command.js → clear/index.js} +1 -7
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/copy/index.js +39 -0
- package/dist/commands/copy/types.d.ts +3 -0
- package/dist/commands/copy/types.d.ts.map +1 -0
- package/dist/commands/copy/types.js +1 -0
- package/dist/commands/copy/utils.d.ts +3 -0
- package/dist/commands/copy/utils.d.ts.map +1 -0
- package/dist/commands/copy/utils.js +22 -0
- package/dist/commands/exit/index.d.ts +10 -0
- package/dist/commands/exit/index.d.ts.map +1 -0
- package/dist/commands/exit/index.js +21 -0
- package/dist/commands/exit/types.d.ts +8 -0
- package/dist/commands/exit/types.d.ts.map +1 -0
- package/dist/commands/exit/types.js +1 -0
- package/dist/commands/exit/utils.d.ts +2 -0
- package/dist/commands/exit/utils.d.ts.map +1 -0
- package/dist/commands/exit/utils.js +13 -0
- package/dist/commands/generate-rules/index.d.ts +3 -0
- package/dist/commands/generate-rules/index.d.ts.map +1 -0
- package/dist/commands/{generate-rules-command.js → generate-rules/index.js} +65 -147
- package/dist/commands/generate-rules/utils.d.ts +5 -0
- package/dist/commands/generate-rules/utils.d.ts.map +1 -0
- package/dist/commands/generate-rules/utils.js +25 -0
- package/dist/commands/handoff/index.d.ts +3 -0
- package/dist/commands/handoff/index.d.ts.map +1 -0
- package/dist/commands/handoff/index.js +97 -0
- package/dist/commands/handoff/utils.d.ts +4 -0
- package/dist/commands/handoff/utils.d.ts.map +1 -0
- package/dist/commands/handoff/utils.js +123 -0
- package/dist/commands/health/index.d.ts +3 -0
- package/dist/commands/health/index.d.ts.map +1 -0
- package/dist/commands/health/index.js +56 -0
- package/dist/commands/health/utils.d.ts +15 -0
- package/dist/commands/health/utils.d.ts.map +1 -0
- package/dist/commands/health/utils.js +52 -0
- package/dist/commands/help/index.d.ts +3 -0
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +6 -14
- package/dist/commands/history/index.d.ts +3 -0
- package/dist/commands/history/index.d.ts.map +1 -0
- package/dist/commands/{history-command.js → history/index.js} +40 -200
- package/dist/commands/history/types.d.ts +11 -0
- package/dist/commands/history/types.d.ts.map +1 -0
- package/dist/commands/history/types.js +1 -0
- package/dist/commands/history/utils.d.ts +4 -0
- package/dist/commands/history/utils.d.ts.map +1 -0
- package/dist/commands/history/utils.js +86 -0
- package/dist/commands/init/index.d.ts +3 -0
- package/dist/commands/init/index.d.ts.map +1 -0
- package/dist/commands/{init-command.js → init/index.js} +17 -27
- package/dist/commands/init-project/index.d.ts +3 -0
- package/dist/commands/init-project/index.d.ts.map +1 -0
- package/dist/commands/init-project/index.js +51 -0
- package/dist/commands/init-project/utils.d.ts +9 -0
- package/dist/commands/init-project/utils.d.ts.map +1 -0
- package/dist/commands/init-project/utils.js +43 -0
- package/dist/commands/list-directories/index.d.ts +3 -0
- package/dist/commands/list-directories/index.d.ts.map +1 -0
- package/dist/commands/{list-directories-command.js → list-directories/index.js} +2 -15
- package/dist/commands/list-tools/index.d.ts +3 -0
- package/dist/commands/list-tools/index.d.ts.map +1 -0
- package/dist/commands/list-tools/index.js +89 -0
- package/dist/commands/manager.d.ts +2 -9
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +38 -83
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/model/index.js +182 -0
- package/dist/commands/model/utils.d.ts +3 -0
- package/dist/commands/model/utils.d.ts.map +1 -0
- package/dist/commands/model/utils.js +5 -0
- package/dist/commands/paste/index.d.ts +3 -0
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/paste/index.js +94 -0
- package/dist/commands/paste/utils.d.ts +5 -0
- package/dist/commands/paste/utils.d.ts.map +1 -0
- package/dist/commands/paste/utils.js +86 -0
- package/dist/commands/pickup/index.d.ts +3 -0
- package/dist/commands/pickup/index.d.ts.map +1 -0
- package/dist/commands/pickup/index.js +138 -0
- package/dist/commands/pickup/types.d.ts +6 -0
- package/dist/commands/pickup/types.d.ts.map +1 -0
- package/dist/commands/pickup/types.js +1 -0
- package/dist/commands/pickup/utils.d.ts +7 -0
- package/dist/commands/pickup/utils.d.ts.map +1 -0
- package/dist/commands/pickup/utils.js +56 -0
- package/dist/commands/prompt/index.d.ts +5 -0
- package/dist/commands/prompt/index.d.ts.map +1 -0
- package/dist/commands/prompt/index.js +126 -0
- package/dist/commands/prompt/types.d.ts +15 -0
- package/dist/commands/prompt/types.d.ts.map +1 -0
- package/dist/commands/prompt/types.js +1 -0
- package/dist/commands/prompt/utils.d.ts +12 -0
- package/dist/commands/prompt/utils.d.ts.map +1 -0
- package/dist/commands/prompt/utils.js +107 -0
- package/dist/commands/remove-directory/index.d.ts +3 -0
- package/dist/commands/remove-directory/index.d.ts.map +1 -0
- package/dist/commands/{remove-directory-command.js → remove-directory/index.js} +3 -35
- package/dist/commands/reset/index.d.ts +3 -0
- package/dist/commands/reset/index.d.ts.map +1 -0
- package/dist/commands/{reset-command.js → reset/index.js} +8 -11
- package/dist/commands/reset/types.d.ts +1 -0
- package/dist/commands/reset/types.d.ts.map +1 -0
- package/dist/commands/reset/types.js +3 -0
- package/dist/commands/resources/index.d.ts +3 -0
- package/dist/commands/resources/index.d.ts.map +1 -0
- package/dist/commands/resources/index.js +84 -0
- package/dist/commands/review/index.d.ts +3 -0
- package/dist/commands/review/index.d.ts.map +1 -0
- package/dist/commands/review/index.js +126 -0
- package/dist/commands/review/types.d.ts +12 -0
- package/dist/commands/review/types.d.ts.map +1 -0
- package/dist/commands/review/types.js +1 -0
- package/dist/commands/review/utils.d.ts +4 -0
- package/dist/commands/review/utils.d.ts.map +1 -0
- package/dist/commands/review/utils.js +87 -0
- package/dist/commands/save/index.d.ts +3 -0
- package/dist/commands/save/index.d.ts.map +1 -0
- package/dist/commands/{save-command.js → save/index.js} +3 -10
- package/dist/commands/session/index.d.ts +3 -0
- package/dist/commands/session/index.d.ts.map +1 -0
- package/dist/commands/session/index.js +197 -0
- package/dist/commands/session/types.d.ts +13 -0
- package/dist/commands/session/types.d.ts.map +1 -0
- package/dist/commands/session/types.js +7 -0
- package/dist/commands/shell/index.d.ts +3 -0
- package/dist/commands/shell/index.d.ts.map +1 -0
- package/dist/commands/{shell-command.js → shell/index.js} +4 -51
- package/dist/commands/types.d.ts +2 -5
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +36 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +118 -60
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +18 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +119 -81
- package/dist/formatting.d.ts +46 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +94 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +299 -177
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +4 -11
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +3 -53
- package/dist/middleware/audit-message.d.ts +2 -2
- package/dist/middleware/audit-message.d.ts.map +1 -1
- package/dist/middleware/audit-message.js +40 -2
- package/dist/middleware/cache.d.ts +2 -2
- package/dist/middleware/cache.d.ts.map +1 -1
- package/dist/middleware/cache.js +111 -27
- package/dist/middleware/rate-limit.d.ts +2 -2
- package/dist/middleware/rate-limit.d.ts.map +1 -1
- package/dist/middleware/rate-limit.js +1 -0
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +46 -29
- package/dist/models/anthropic-provider.d.ts +14 -13
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +0 -7
- package/dist/models/deepseek-provider.d.ts +9 -8
- 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 +10 -9
- 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 +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/manager.d.ts +7 -4
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +5 -25
- package/dist/models/openai-provider.d.ts +11 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/opencode-zen-provider.d.ts +23 -0
- package/dist/models/opencode-zen-provider.d.ts.map +1 -0
- package/dist/models/opencode-zen-provider.js +76 -0
- package/dist/models/openrouter-provider.d.ts +34 -28
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +148 -139
- package/dist/models/providers.d.ts +6 -16
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +8 -58
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts/manager.d.ts +1 -1
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +1 -1
- package/dist/prompts.d.ts +8 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +155 -177
- package/dist/repl/project-status.d.ts +19 -0
- package/dist/repl/project-status.d.ts.map +1 -0
- package/dist/repl/project-status.js +78 -0
- package/dist/repl-new.d.ts +15 -6
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +266 -83
- package/dist/{messages.d.ts → sessions/manager.d.ts} +13 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +126 -16
- package/dist/skills.d.ts +16 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +233 -0
- package/dist/terminal/control.d.ts +56 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +111 -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 -26
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -53
- 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 -101
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -464
- package/dist/terminal/keys.d.ts +211 -0
- package/dist/terminal/keys.d.ts.map +1 -0
- package/dist/terminal/keys.js +546 -0
- package/dist/terminal/segmenter.d.ts +6 -0
- package/dist/terminal/segmenter.d.ts.map +1 -0
- package/dist/terminal/segmenter.js +11 -0
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +9 -21
- package/dist/terminal/string-width.d.ts.map +1 -1
- package/dist/terminal/string-width.js +40 -21
- package/dist/terminal/strip-ansi.d.ts.map +1 -1
- package/dist/terminal/strip-ansi.js +9 -15
- 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/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +11 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +189 -81
- package/dist/tools/directory-tree.d.ts +9 -13
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +90 -60
- package/dist/tools/dynamic-tool-loader.d.ts +22 -8
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +41 -46
- package/dist/tools/edit-file.d.ts +6 -16
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +22 -66
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +78 -109
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -93
- package/dist/tools/index.d.ts +202 -167
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -273
- package/dist/tools/ls.d.ts +26 -0
- package/dist/tools/ls.d.ts.map +1 -0
- package/dist/tools/ls.js +80 -0
- package/dist/tools/read-file.d.ts +15 -15
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +52 -76
- package/dist/tools/save-file.d.ts +8 -8
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +42 -53
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -32
- package/dist/tools/types.d.ts +5 -21
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +0 -9
- package/dist/tui/autocomplete/attachment-provider.d.ts +18 -0
- package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/attachment-provider.js +159 -0
- package/dist/tui/autocomplete/base-provider.d.ts +17 -0
- package/dist/tui/autocomplete/base-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/base-provider.js +1 -0
- package/dist/tui/autocomplete/combined-provider.d.ts +20 -0
- package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/combined-provider.js +61 -0
- package/dist/tui/autocomplete/command-provider.d.ts +20 -0
- package/dist/tui/autocomplete/command-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/command-provider.js +90 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts +16 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/file-search-provider.js +123 -0
- package/dist/tui/autocomplete/path-provider.d.ts +21 -0
- package/dist/tui/autocomplete/path-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/path-provider.js +164 -0
- package/dist/tui/autocomplete/utils.d.ts +16 -0
- package/dist/tui/autocomplete/utils.d.ts.map +1 -0
- package/dist/tui/autocomplete/utils.js +137 -0
- package/dist/tui/autocomplete.d.ts +12 -43
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +20 -465
- package/dist/tui/components/assistant-message.js +1 -1
- 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 +87 -0
- package/dist/tui/components/editor.d.ts +61 -7
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +630 -127
- package/dist/tui/components/footer.d.ts +19 -18
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +90 -185
- 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.map +1 -1
- package/dist/tui/components/input.js +8 -7
- package/dist/tui/components/loader.d.ts +6 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +8 -3
- package/dist/tui/components/markdown.d.ts +31 -27
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +131 -67
- package/dist/tui/components/modal.d.ts +0 -11
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -37
- package/dist/tui/components/notification.d.ts +28 -0
- package/dist/tui/components/notification.d.ts.map +1 -0
- package/dist/tui/components/notification.js +63 -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 +66 -0
- package/dist/tui/components/select-list.d.ts +12 -1
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +73 -32
- package/dist/tui/components/spacer.d.ts +1 -1
- package/dist/tui/components/spacer.d.ts.map +1 -1
- package/dist/tui/components/spacer.js +2 -2
- 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/thinking-block.d.ts.map +1 -1
- package/dist/tui/components/thinking-block.js +4 -1
- package/dist/tui/components/tool-execution.d.ts +7 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +81 -85
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/user-message.js +6 -4
- package/dist/tui/components/welcome.d.ts +8 -1
- package/dist/tui/components/welcome.d.ts.map +1 -1
- package/dist/tui/components/welcome.js +45 -6
- package/dist/tui/index.d.ts +12 -6
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +7 -3
- package/dist/tui/terminal.d.ts +4 -3
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +43 -49
- package/dist/tui/tui.d.ts +3 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +58 -43
- package/dist/tui/utils.d.ts +5 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +80 -1
- package/dist/{tools/bash-utils.d.ts → utils/bash.d.ts} +3 -3
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +22 -11
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.d.ts → utils/filesystem/security.d.ts} +3 -2
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +62 -4
- 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/{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/yaml.d.ts +11 -0
- package/dist/utils/yaml.d.ts.map +1 -0
- package/dist/utils/yaml.js +207 -0
- package/dist/utils/{zod-utils.d.ts → zod.d.ts} +2 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/dist/utils/zod.js +24 -0
- package/package.json +31 -29
- package/dist/agent/manual-loop.d.ts +0 -41
- package/dist/agent/manual-loop.d.ts.map +0 -1
- package/dist/agent/manual-loop.js +0 -278
- package/dist/api/exa/index.d.ts +0 -177
- package/dist/api/exa/index.d.ts.map +0 -1
- package/dist/api/exa/index.js +0 -439
- package/dist/commands/add-directory-command.d.ts +0 -3
- package/dist/commands/add-directory-command.d.ts.map +0 -1
- package/dist/commands/add-directory-command.js +0 -85
- package/dist/commands/application-log-command.d.ts +0 -3
- package/dist/commands/application-log-command.d.ts.map +0 -1
- package/dist/commands/application-log-command.js +0 -79
- package/dist/commands/clear-command.d.ts +0 -3
- package/dist/commands/clear-command.d.ts.map +0 -1
- package/dist/commands/compact-command.d.ts +0 -3
- package/dist/commands/compact-command.d.ts.map +0 -1
- package/dist/commands/compact-command.js +0 -64
- package/dist/commands/context-command.d.ts +0 -3
- package/dist/commands/context-command.d.ts.map +0 -1
- package/dist/commands/context-command.js +0 -183
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- package/dist/commands/copy-command.js +0 -80
- package/dist/commands/edit-command.d.ts +0 -3
- package/dist/commands/edit-command.d.ts.map +0 -1
- package/dist/commands/edit-command.js +0 -88
- package/dist/commands/edit-prompt-command.d.ts +0 -3
- package/dist/commands/edit-prompt-command.d.ts.map +0 -1
- package/dist/commands/edit-prompt-command.js +0 -61
- package/dist/commands/exit-command.d.ts +0 -13
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -46
- package/dist/commands/files-command.d.ts +0 -3
- package/dist/commands/files-command.d.ts.map +0 -1
- package/dist/commands/files-command.js +0 -121
- package/dist/commands/generate-rules-command.d.ts +0 -3
- package/dist/commands/generate-rules-command.d.ts.map +0 -1
- package/dist/commands/handoff-command.d.ts +0 -3
- package/dist/commands/handoff-command.d.ts.map +0 -1
- package/dist/commands/handoff-command.js +0 -202
- package/dist/commands/health-command.d.ts +0 -4
- package/dist/commands/health-command.d.ts.map +0 -1
- package/dist/commands/health-command.js +0 -213
- package/dist/commands/help-command.d.ts +0 -3
- package/dist/commands/help-command.d.ts.map +0 -1
- package/dist/commands/history-command.d.ts +0 -3
- package/dist/commands/history-command.d.ts.map +0 -1
- package/dist/commands/init-command.d.ts +0 -3
- package/dist/commands/init-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.d.ts +0 -3
- package/dist/commands/last-log-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.js +0 -98
- package/dist/commands/list-directories-command.d.ts +0 -3
- package/dist/commands/list-directories-command.d.ts.map +0 -1
- package/dist/commands/list-tools-command.d.ts +0 -3
- package/dist/commands/list-tools-command.d.ts.map +0 -1
- package/dist/commands/list-tools-command.js +0 -124
- package/dist/commands/model-command.d.ts +0 -25
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/model-command.js +0 -340
- package/dist/commands/paste-command.d.ts +0 -3
- package/dist/commands/paste-command.d.ts.map +0 -1
- package/dist/commands/paste-command.js +0 -277
- package/dist/commands/pickup-command.d.ts +0 -3
- package/dist/commands/pickup-command.d.ts.map +0 -1
- package/dist/commands/pickup-command.js +0 -161
- package/dist/commands/prompt-command.d.ts +0 -3
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -280
- package/dist/commands/remove-directory-command.d.ts +0 -3
- package/dist/commands/remove-directory-command.d.ts.map +0 -1
- package/dist/commands/reset-command.d.ts +0 -3
- package/dist/commands/reset-command.d.ts.map +0 -1
- package/dist/commands/rules-command.d.ts +0 -3
- package/dist/commands/rules-command.d.ts.map +0 -1
- package/dist/commands/rules-command.js +0 -135
- package/dist/commands/save-command.d.ts +0 -3
- package/dist/commands/save-command.d.ts.map +0 -1
- package/dist/commands/shell-command.d.ts +0 -3
- package/dist/commands/shell-command.d.ts.map +0 -1
- package/dist/commands/usage-command.d.ts +0 -3
- package/dist/commands/usage-command.d.ts.map +0 -1
- package/dist/commands/usage-command.js +0 -42
- package/dist/messages.d.ts.map +0 -1
- 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 -58
- 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 -9
- package/dist/repl/project-status-line.d.ts +0 -2
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -31
- package/dist/repl/prompt.d.ts +0 -21
- package/dist/repl/prompt.d.ts.map +0 -1
- package/dist/repl/prompt.js +0 -244
- package/dist/repl/tool-call-repair.d.ts +0 -4
- package/dist/repl/tool-call-repair.d.ts.map +0 -1
- package/dist/repl/tool-call-repair.js +0 -54
- package/dist/repl.d.ts +0 -29
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -218
- 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 -368
- 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 -17
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -118
- 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 -280
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/tokens/threshold.d.ts +0 -35
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -85
- package/dist/tools/advanced-edit-file.d.ts +0 -69
- package/dist/tools/advanced-edit-file.d.ts.map +0 -1
- package/dist/tools/advanced-edit-file.js +0 -281
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -103
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/code-interpreter.d.ts +0 -25
- package/dist/tools/code-interpreter.d.ts.map +0 -1
- package/dist/tools/code-interpreter.js +0 -167
- package/dist/tools/delete-file.d.ts +0 -24
- package/dist/tools/delete-file.d.ts.map +0 -1
- package/dist/tools/delete-file.js +0 -70
- package/dist/tools/dynamic-tool-parser.d.ts +0 -21
- package/dist/tools/dynamic-tool-parser.d.ts.map +0 -1
- package/dist/tools/dynamic-tool-parser.js +0 -22
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.d.ts +0 -25
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -150
- package/dist/tools/move-file.d.ts +0 -26
- package/dist/tools/move-file.d.ts.map +0 -1
- package/dist/tools/move-file.js +0 -58
- package/dist/tools/read-multiple-files.d.ts +0 -26
- package/dist/tools/read-multiple-files.d.ts.map +0 -1
- package/dist/tools/read-multiple-files.js +0 -139
- package/dist/tools/web-fetch.d.ts +0 -56
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -247
- package/dist/tools/web-search.d.ts +0 -23
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -133
- package/dist/tui/components/prompt-status.d.ts +0 -16
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -21
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- package/dist/utils/zod-utils.js +0 -7
- /package/dist/{terminal → commands/add-directory}/types.js +0 -0
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path, { basename } from "node:path";
|
|
3
|
+
import { logger } from "../../logger.js";
|
|
4
|
+
import { processPrompt } from "../../mentions.js";
|
|
5
|
+
import style from "../../terminal/style.js";
|
|
6
|
+
import { Spacer, Text } from "../../tui/index.js";
|
|
7
|
+
import { findPrompt, parsePromptFile, replaceArgumentPlaceholders, } from "./utils.js";
|
|
8
|
+
export async function loadPrompts(config) {
|
|
9
|
+
const getPromptsFromDir = async (dirPath, type) => {
|
|
10
|
+
try {
|
|
11
|
+
const dirents = await readdir(dirPath, { withFileTypes: true });
|
|
12
|
+
const mdFiles = dirents.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".md"));
|
|
13
|
+
const prompts = [];
|
|
14
|
+
for (const dirent of mdFiles) {
|
|
15
|
+
const filePath = path.join(dirPath, dirent.name);
|
|
16
|
+
try {
|
|
17
|
+
const content = await readFile(filePath, "utf8");
|
|
18
|
+
const parsed = parsePromptFile(content);
|
|
19
|
+
if (parsed.metadata.enabled) {
|
|
20
|
+
prompts.push({
|
|
21
|
+
name: basename(dirent.name, ".md"),
|
|
22
|
+
description: parsed.metadata.description,
|
|
23
|
+
enabled: parsed.metadata.enabled,
|
|
24
|
+
path: filePath,
|
|
25
|
+
type,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
logger.error(`Error reading prompt file ${filePath}: ${error}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return prompts;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error.code === "ENOENT") {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
logger.error(`Error reading prompts from ${dirPath}: ${error}`);
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const userPromptDir = config.app.getPath("prompts");
|
|
44
|
+
const projectPromptDir = config.project.getPath("prompts");
|
|
45
|
+
const userPrompts = await getPromptsFromDir(userPromptDir, "user");
|
|
46
|
+
const projectPrompts = await getPromptsFromDir(projectPromptDir, "project");
|
|
47
|
+
const promptMap = new Map();
|
|
48
|
+
for (const prompt of userPrompts) {
|
|
49
|
+
promptMap.set(prompt.name, prompt);
|
|
50
|
+
}
|
|
51
|
+
for (const prompt of projectPrompts) {
|
|
52
|
+
promptMap.set(prompt.name, prompt);
|
|
53
|
+
}
|
|
54
|
+
return promptMap;
|
|
55
|
+
}
|
|
56
|
+
export const promptCommand = ({ modelManager, promptManager, config, promptHistory, workspace, }) => {
|
|
57
|
+
return {
|
|
58
|
+
command: "/prompt",
|
|
59
|
+
description: "Loads and executes prompts. Project prompts override user prompts with the same name.",
|
|
60
|
+
getSubCommands: async () => {
|
|
61
|
+
const promptMap = await loadPrompts(config);
|
|
62
|
+
const promptList = Array.from(promptMap.values())
|
|
63
|
+
.map((p) => p.name)
|
|
64
|
+
.sort();
|
|
65
|
+
return promptList;
|
|
66
|
+
},
|
|
67
|
+
async handle(args, { tui, container, editor, }) {
|
|
68
|
+
const promptName = args?.[0];
|
|
69
|
+
if (!promptName) {
|
|
70
|
+
container.addChild(new Text(style.red("No prompt given."), 1, 0));
|
|
71
|
+
tui.requestRender();
|
|
72
|
+
editor.setText("");
|
|
73
|
+
return "continue";
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const promptResult = await findPrompt(promptName, config);
|
|
77
|
+
if (!promptResult) {
|
|
78
|
+
container.addChild(new Text(style.red(`Prompt not found: ${promptName}. Available prompts can be seen with tab completion.`), 1, 0));
|
|
79
|
+
tui.requestRender();
|
|
80
|
+
editor.setText("");
|
|
81
|
+
return "continue";
|
|
82
|
+
}
|
|
83
|
+
let promptContent;
|
|
84
|
+
try {
|
|
85
|
+
const fileContent = await readFile(promptResult.path, "utf8");
|
|
86
|
+
const parsed = parsePromptFile(fileContent);
|
|
87
|
+
promptContent = parsed.content;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (error.code === "ENOENT") {
|
|
91
|
+
container.addChild(new Text(style.red(`Prompt file not found: ${promptName} at ${promptResult.path}`), 1, 0));
|
|
92
|
+
tui.requestRender();
|
|
93
|
+
editor.setText("");
|
|
94
|
+
return "continue";
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
const inputArgs = args.slice(1);
|
|
99
|
+
promptContent = replaceArgumentPlaceholders(promptContent, inputArgs);
|
|
100
|
+
container.addChild(new Spacer(1));
|
|
101
|
+
container.addChild(new Text(`Loaded ${promptResult.type} prompt: ${style.blue(promptName)}`, 1, 0));
|
|
102
|
+
if (inputArgs.length > 0) {
|
|
103
|
+
container.addChild(new Text(`Input: "${inputArgs.join(" ")}"`, 2, 0));
|
|
104
|
+
}
|
|
105
|
+
const processedPrompt = await processPrompt(promptContent.trim(), {
|
|
106
|
+
baseDir: workspace.primaryDir,
|
|
107
|
+
model: modelManager.getModelMetadata("repl"),
|
|
108
|
+
});
|
|
109
|
+
for (const context of processedPrompt.context) {
|
|
110
|
+
promptManager.addContext(context);
|
|
111
|
+
}
|
|
112
|
+
promptManager.set(processedPrompt.message);
|
|
113
|
+
promptHistory.push(processedPrompt.message);
|
|
114
|
+
tui.requestRender();
|
|
115
|
+
editor.setText("");
|
|
116
|
+
return "use";
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
container.addChild(new Text(style.red(`Error loading prompt: ${error.message}`), 1, 0));
|
|
120
|
+
tui.requestRender();
|
|
121
|
+
editor.setText("");
|
|
122
|
+
return "continue";
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PromptMetadata {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
path: string;
|
|
6
|
+
type: "project" | "user";
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedPrompt {
|
|
9
|
+
content: string;
|
|
10
|
+
metadata: {
|
|
11
|
+
description: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/prompt/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ConfigManager } from "../../config.ts";
|
|
2
|
+
import type { PromptMetadata } from "./types.ts";
|
|
3
|
+
export declare function replaceArgumentPlaceholders(content: string, args: string[]): string;
|
|
4
|
+
export declare function parsePromptFile(content: string): {
|
|
5
|
+
content: string;
|
|
6
|
+
metadata: {
|
|
7
|
+
description: string;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function findPrompt(promptName: string, config: ConfigManager): Promise<PromptMetadata | null>;
|
|
12
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/prompt/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,GACb,MAAM,CA6BR;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH,CA4CA;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAoDhC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export function replaceArgumentPlaceholders(content, args) {
|
|
4
|
+
const allArguments = args.join(" ");
|
|
5
|
+
let replacementsMade = false;
|
|
6
|
+
let result = content;
|
|
7
|
+
for (let i = 0; i < args.length; i++) {
|
|
8
|
+
const placeholder = `$${i + 1}`;
|
|
9
|
+
if (result.includes(placeholder)) {
|
|
10
|
+
result = result.replaceAll(placeholder, args[i]);
|
|
11
|
+
replacementsMade = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (result.includes("$ARGUMENTS")) {
|
|
15
|
+
result = result.replaceAll("$ARGUMENTS", allArguments);
|
|
16
|
+
replacementsMade = true;
|
|
17
|
+
}
|
|
18
|
+
if (result.includes("{{INPUT}}")) {
|
|
19
|
+
result = result.replaceAll("{{INPUT}}", allArguments);
|
|
20
|
+
replacementsMade = true;
|
|
21
|
+
}
|
|
22
|
+
if (!replacementsMade && allArguments.trim().length > 0) {
|
|
23
|
+
result += `\n\n${allArguments}`;
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
export function parsePromptFile(content) {
|
|
28
|
+
const frontMatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*(?:\n([\s\S]*))?$/);
|
|
29
|
+
if (!frontMatterMatch) {
|
|
30
|
+
return {
|
|
31
|
+
content,
|
|
32
|
+
metadata: {
|
|
33
|
+
description: content.split("\n")[0].trim().slice(0, 50) +
|
|
34
|
+
(content.split("\n")[0].trim().length > 50 ? "..." : ""),
|
|
35
|
+
enabled: true,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const yamlContent = frontMatterMatch[1];
|
|
40
|
+
const promptContent = frontMatterMatch[2] || "";
|
|
41
|
+
const defaultDescription = promptContent.split("\n")[0].trim().slice(0, 50) +
|
|
42
|
+
(promptContent.split("\n")[0].trim().length > 50 ? "..." : "");
|
|
43
|
+
let description = defaultDescription;
|
|
44
|
+
let enabled = true;
|
|
45
|
+
const descriptionMatch = yamlContent.match(/^description:\s*(.+)$/m);
|
|
46
|
+
if (descriptionMatch) {
|
|
47
|
+
description = descriptionMatch[1].trim();
|
|
48
|
+
}
|
|
49
|
+
const enabledMatch = yamlContent.match(/^enabled:\s*(true|false)$/im);
|
|
50
|
+
if (enabledMatch) {
|
|
51
|
+
enabled = enabledMatch[1].toLowerCase() === "true";
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
content: promptContent,
|
|
55
|
+
metadata: {
|
|
56
|
+
description,
|
|
57
|
+
enabled,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export async function findPrompt(promptName, config) {
|
|
62
|
+
const projectPromptDir = config.project.getPath("prompts");
|
|
63
|
+
const projectPath = path.join(projectPromptDir, `${promptName}.md`);
|
|
64
|
+
if (config.project.existsSync("prompts")) {
|
|
65
|
+
try {
|
|
66
|
+
const content = await readFile(projectPath, "utf8");
|
|
67
|
+
const parsed = parsePromptFile(content);
|
|
68
|
+
if (!parsed.metadata.enabled) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
name: promptName,
|
|
73
|
+
description: parsed.metadata.description,
|
|
74
|
+
enabled: parsed.metadata.enabled,
|
|
75
|
+
path: projectPath,
|
|
76
|
+
type: "project",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error.code !== "ENOENT") {
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const userPromptDir = config.app.getPath("prompts");
|
|
86
|
+
const userPath = path.join(userPromptDir, `${promptName}.md`);
|
|
87
|
+
try {
|
|
88
|
+
const content = await readFile(userPath, "utf8");
|
|
89
|
+
const parsed = parsePromptFile(content);
|
|
90
|
+
if (!parsed.metadata.enabled) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
name: promptName,
|
|
95
|
+
description: parsed.metadata.description,
|
|
96
|
+
enabled: parsed.metadata.enabled,
|
|
97
|
+
path: userPath,
|
|
98
|
+
type: "user",
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (error.code !== "ENOENT") {
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/remove-directory/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,sBAAsB,GAAI,gBAEpC,cAAc,KAAG,WAkGnB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import style from "
|
|
3
|
-
import { Text } from "
|
|
4
|
-
export const removeDirectoryCommand = ({
|
|
2
|
+
import style from "../../terminal/style.js";
|
|
3
|
+
import { Text } from "../../tui/index.js";
|
|
4
|
+
export const removeDirectoryCommand = ({ workspace, }) => {
|
|
5
5
|
return {
|
|
6
6
|
command: "/remove-directory",
|
|
7
7
|
description: "Remove a directory from the list of allowed working directories",
|
|
@@ -9,38 +9,6 @@ export const removeDirectoryCommand = ({ terminal, workspace, }) => {
|
|
|
9
9
|
// Return only non-primary directories for tab completion
|
|
10
10
|
return workspace.allowedDirs.filter((dir) => dir !== workspace.primaryDir);
|
|
11
11
|
},
|
|
12
|
-
execute: async (args) => {
|
|
13
|
-
const directoryPath = args?.[0];
|
|
14
|
-
if (!directoryPath) {
|
|
15
|
-
terminal.error("Usage: /remove-directory <path>");
|
|
16
|
-
return "continue";
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
// Resolve the directory path
|
|
20
|
-
const resolvedPath = path.resolve(directoryPath);
|
|
21
|
-
// Check if it's the primary directory
|
|
22
|
-
if (resolvedPath === workspace.primaryDir) {
|
|
23
|
-
terminal.error("Cannot remove the primary working directory");
|
|
24
|
-
return "continue";
|
|
25
|
-
}
|
|
26
|
-
// Find the directory in the list
|
|
27
|
-
const index = workspace.allowedDirs.indexOf(resolvedPath);
|
|
28
|
-
if (index === -1) {
|
|
29
|
-
terminal.error(`Directory not found in allowed list: ${resolvedPath}`);
|
|
30
|
-
return "continue";
|
|
31
|
-
}
|
|
32
|
-
// Remove the directory
|
|
33
|
-
workspace.allowedDirs.splice(index, 1);
|
|
34
|
-
terminal.writeln(`Removed directory from allowed list: ${style.blue(resolvedPath)}`);
|
|
35
|
-
terminal.writeln(`Current allowed directories: ${style.blue(workspace.allowedDirs.join(", "))}`);
|
|
36
|
-
return "continue";
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
40
|
-
terminal.error(`Failed to remove directory: ${errorMessage}`);
|
|
41
|
-
return "continue";
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
12
|
async handle(args, { tui, container, editor, }) {
|
|
45
13
|
const directoryPath = args?.[0];
|
|
46
14
|
if (!directoryPath) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/reset/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,YAAY,GAAI,mDAG1B,cAAc,KAAG,WAsCnB,CAAC"}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { setTerminalTitle } from "../../terminal/control.js";
|
|
2
|
+
export const resetCommand = ({ modelManager, sessionManager: messageHistory, }) => {
|
|
2
3
|
return {
|
|
3
4
|
command: "/reset",
|
|
4
5
|
aliases: ["/new"],
|
|
5
6
|
description: "Saves the chat history and then resets it.",
|
|
6
7
|
getSubCommands: () => Promise.resolve([]),
|
|
7
|
-
execute: async () => {
|
|
8
|
-
if (!messageHistory.isEmpty()) {
|
|
9
|
-
await messageHistory.save();
|
|
10
|
-
messageHistory.create(modelManager.getModel("repl").modelId);
|
|
11
|
-
}
|
|
12
|
-
terminal.setTitle(`acai: ${process.cwd()}`);
|
|
13
|
-
terminal.clear();
|
|
14
|
-
return "continue";
|
|
15
|
-
},
|
|
16
8
|
async handle(_args, { tui, container, editor, }) {
|
|
17
9
|
if (!messageHistory.isEmpty()) {
|
|
18
10
|
await messageHistory.save();
|
|
19
11
|
messageHistory.create(modelManager.getModel("repl").modelId);
|
|
20
12
|
}
|
|
21
|
-
|
|
13
|
+
setTerminalTitle(`acai: ${process.cwd()}`);
|
|
22
14
|
container.clear();
|
|
23
15
|
editor.setText("");
|
|
16
|
+
// Reset footer state to clear usage/cost/steps/tools/time
|
|
17
|
+
const footer = tui.children.find((child) => child.constructor.name === "FooterComponent");
|
|
18
|
+
if (footer) {
|
|
19
|
+
footer.resetState();
|
|
20
|
+
}
|
|
24
21
|
tui.requestRender();
|
|
25
22
|
return "continue";
|
|
26
23
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/reset/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/resources/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CA6GrE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { loadSkills } from "../../skills.js";
|
|
2
|
+
import style from "../../terminal/style.js";
|
|
3
|
+
import { Modal, Container as ModalContainer, ModalText, } from "../../tui/index.js";
|
|
4
|
+
export function resourcesCommand(options) {
|
|
5
|
+
return {
|
|
6
|
+
command: "/resources",
|
|
7
|
+
description: "List all active skills and AGENTS.md",
|
|
8
|
+
aliases: ["/res"],
|
|
9
|
+
getSubCommands: async () => [],
|
|
10
|
+
async handle(_args, { tui, editor }) {
|
|
11
|
+
try {
|
|
12
|
+
const skills = await loadSkills();
|
|
13
|
+
const agentsFiles = await options.config.readAgentsFiles();
|
|
14
|
+
const projectSkills = skills.filter((s) => s.source === "project");
|
|
15
|
+
const userSkills = skills.filter((s) => s.source === "user");
|
|
16
|
+
const otherSkills = skills.filter((s) => s.source !== "project" && s.source !== "user");
|
|
17
|
+
const lines = [];
|
|
18
|
+
if (projectSkills.length > 0) {
|
|
19
|
+
lines.push(style.gray(`Project Skills (${projectSkills.length}):`));
|
|
20
|
+
for (const skill of projectSkills) {
|
|
21
|
+
lines.push(`${style.yellow.bold(skill.name)}
|
|
22
|
+
${skill.description}
|
|
23
|
+
${style.dim(skill.filePath)}
|
|
24
|
+
`);
|
|
25
|
+
}
|
|
26
|
+
lines.push("");
|
|
27
|
+
}
|
|
28
|
+
if (userSkills.length > 0) {
|
|
29
|
+
lines.push(style.gray(`User Skills (${userSkills.length}):`));
|
|
30
|
+
for (const skill of userSkills) {
|
|
31
|
+
lines.push(`${style.yellow.bold(skill.name)}
|
|
32
|
+
${skill.description}
|
|
33
|
+
${style.dim(skill.filePath)}
|
|
34
|
+
`);
|
|
35
|
+
}
|
|
36
|
+
lines.push("");
|
|
37
|
+
}
|
|
38
|
+
if (otherSkills.length > 0) {
|
|
39
|
+
lines.push(style.gray(`Other Skills (${otherSkills.length}):`));
|
|
40
|
+
for (const skill of otherSkills) {
|
|
41
|
+
lines.push(`${style.yellow.bold(skill.name)}
|
|
42
|
+
${skill.description}
|
|
43
|
+
${style.dim(skill.filePath)} ${style.dim(`[${skill.source}]`)}
|
|
44
|
+
`);
|
|
45
|
+
}
|
|
46
|
+
lines.push("");
|
|
47
|
+
}
|
|
48
|
+
lines.push(style.gray("AGENTS.md:"));
|
|
49
|
+
for (const agentsFile of agentsFiles) {
|
|
50
|
+
if (agentsFile.content.length > 0) {
|
|
51
|
+
lines.push(` • ${agentsFile.path} ${style.green("(Exists)")}`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
lines.push(` • ${agentsFile.path} ${style.dim("(Not found)")}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const modalContent = new ModalContainer();
|
|
58
|
+
const formattedText = lines.join("\n");
|
|
59
|
+
if (formattedText.trim()) {
|
|
60
|
+
modalContent.addChild(new ModalText(formattedText, 0, 1));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
modalContent.addChild(new ModalText("No resources found.", 0, 1));
|
|
64
|
+
}
|
|
65
|
+
const modal = new Modal("Active Resources", modalContent, true, () => {
|
|
66
|
+
editor.setText("");
|
|
67
|
+
tui.requestRender();
|
|
68
|
+
});
|
|
69
|
+
tui.showModal(modal);
|
|
70
|
+
return "continue";
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
const errorContent = new ModalContainer();
|
|
74
|
+
errorContent.addChild(new ModalText(style.red(`Error loading resources: ${error.message}`), 0, 1));
|
|
75
|
+
const errorModal = new Modal("Error", errorContent, true, () => {
|
|
76
|
+
editor.setText("");
|
|
77
|
+
tui.requestRender();
|
|
78
|
+
});
|
|
79
|
+
tui.showModal(errorModal);
|
|
80
|
+
return "continue";
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/review/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/D,eAAO,MAAM,aAAa,GAAI,UAAU,cAAc,KAAG,WA+KxD,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { initExecutionEnvironment } from "../../execution/index.js";
|
|
2
|
+
import { getTerminalSize } from "../../terminal/control.js";
|
|
3
|
+
import style from "../../terminal/style.js";
|
|
4
|
+
import { Markdown } from "../../tui/components/markdown.js";
|
|
5
|
+
import { Spacer } from "../../tui/components/spacer.js";
|
|
6
|
+
import { Container, SelectList, Text, } from "../../tui/index.js";
|
|
7
|
+
import { formatFileDiffForDisplay, parseGitDiffFiles } from "./utils.js";
|
|
8
|
+
export const reviewCommand = (_options) => {
|
|
9
|
+
return {
|
|
10
|
+
command: "/review",
|
|
11
|
+
description: "Shows a diff of all changes in the current directory.",
|
|
12
|
+
getSubCommands: () => Promise.resolve([]),
|
|
13
|
+
async handle(_args, { tui, container, editor, inputContainer, }) {
|
|
14
|
+
try {
|
|
15
|
+
const execEnv = await initExecutionEnvironment();
|
|
16
|
+
const stagedResult = await execEnv.executeCommand("git diff --cached", {
|
|
17
|
+
cwd: process.cwd(),
|
|
18
|
+
timeout: 5000,
|
|
19
|
+
preserveOutputOnError: true,
|
|
20
|
+
captureStderr: true,
|
|
21
|
+
throwOnError: false,
|
|
22
|
+
});
|
|
23
|
+
const unstagedResult = await execEnv.executeCommand("git diff", {
|
|
24
|
+
cwd: process.cwd(),
|
|
25
|
+
timeout: 5000,
|
|
26
|
+
preserveOutputOnError: true,
|
|
27
|
+
captureStderr: true,
|
|
28
|
+
throwOnError: false,
|
|
29
|
+
});
|
|
30
|
+
const stagedOutput = stagedResult.exitCode === 0 ? stagedResult.output : "";
|
|
31
|
+
const unstagedOutput = unstagedResult.exitCode === 0 ? unstagedResult.output : "";
|
|
32
|
+
const combinedOutput = stagedOutput +
|
|
33
|
+
(stagedOutput && unstagedOutput ? "\n" : "") +
|
|
34
|
+
unstagedOutput;
|
|
35
|
+
if (!combinedOutput.trim()) {
|
|
36
|
+
container.addChild(new Spacer(1));
|
|
37
|
+
container.addChild(new Markdown("No changes detected in the current directory.", {
|
|
38
|
+
customBgRgb: {
|
|
39
|
+
r: 52,
|
|
40
|
+
g: 53,
|
|
41
|
+
b: 65,
|
|
42
|
+
},
|
|
43
|
+
paddingX: 1,
|
|
44
|
+
paddingY: 1,
|
|
45
|
+
}));
|
|
46
|
+
tui.requestRender();
|
|
47
|
+
return "continue";
|
|
48
|
+
}
|
|
49
|
+
const fileChanges = parseGitDiffFiles(combinedOutput);
|
|
50
|
+
if (fileChanges.length === 0) {
|
|
51
|
+
container.addChild(new Spacer(1));
|
|
52
|
+
container.addChild(new Markdown("No file changes could be parsed.", {
|
|
53
|
+
customBgRgb: {
|
|
54
|
+
r: 52,
|
|
55
|
+
g: 53,
|
|
56
|
+
b: 65,
|
|
57
|
+
},
|
|
58
|
+
paddingX: 1,
|
|
59
|
+
paddingY: 1,
|
|
60
|
+
}));
|
|
61
|
+
tui.requestRender();
|
|
62
|
+
return "continue";
|
|
63
|
+
}
|
|
64
|
+
const selectItems = fileChanges.map((file) => ({
|
|
65
|
+
value: file.fileName,
|
|
66
|
+
label: file.fileName,
|
|
67
|
+
description: file.stats,
|
|
68
|
+
}));
|
|
69
|
+
const selectList = new SelectList(selectItems, 10);
|
|
70
|
+
const selectContainer = new Container();
|
|
71
|
+
const { columns } = getTerminalSize();
|
|
72
|
+
selectContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
73
|
+
selectContainer.addChild(new Spacer(1));
|
|
74
|
+
selectContainer.addChild(selectList);
|
|
75
|
+
selectContainer.addChild(new Spacer(1));
|
|
76
|
+
selectContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
77
|
+
const originalEditor = editor;
|
|
78
|
+
inputContainer.clear();
|
|
79
|
+
inputContainer.addChild(selectContainer);
|
|
80
|
+
tui.setFocus(selectList);
|
|
81
|
+
selectList.onSelect = (selectedItem) => {
|
|
82
|
+
const selectedFile = fileChanges.find((file) => file.fileName === selectedItem.value);
|
|
83
|
+
if (selectedFile) {
|
|
84
|
+
container.addChild(new Spacer(1));
|
|
85
|
+
container.addChild(new Markdown(formatFileDiffForDisplay(selectedFile.fileName, selectedFile.diff), {
|
|
86
|
+
customBgRgb: {
|
|
87
|
+
r: 52,
|
|
88
|
+
g: 53,
|
|
89
|
+
b: 65,
|
|
90
|
+
},
|
|
91
|
+
paddingX: 1,
|
|
92
|
+
paddingY: 1,
|
|
93
|
+
}));
|
|
94
|
+
inputContainer.clear();
|
|
95
|
+
inputContainer.addChild(originalEditor);
|
|
96
|
+
tui.setFocus(originalEditor);
|
|
97
|
+
tui.requestRender();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
selectList.onCancel = () => {
|
|
101
|
+
inputContainer.clear();
|
|
102
|
+
inputContainer.addChild(originalEditor);
|
|
103
|
+
tui.setFocus(originalEditor);
|
|
104
|
+
tui.requestRender();
|
|
105
|
+
};
|
|
106
|
+
tui.requestRender();
|
|
107
|
+
return "continue";
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.error("Error executing git diff:", error);
|
|
111
|
+
container.addChild(new Spacer(1));
|
|
112
|
+
container.addChild(new Markdown("Failed to retrieve git changes. Ensure git is installed and initialized.", {
|
|
113
|
+
customBgRgb: {
|
|
114
|
+
r: 52,
|
|
115
|
+
g: 53,
|
|
116
|
+
b: 65,
|
|
117
|
+
},
|
|
118
|
+
paddingX: 1,
|
|
119
|
+
paddingY: 1,
|
|
120
|
+
}));
|
|
121
|
+
tui.requestRender();
|
|
122
|
+
return "continue";
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface FileChange {
|
|
2
|
+
fileName: string;
|
|
3
|
+
diff: string;
|
|
4
|
+
stats: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ReviewCommandOptions {
|
|
7
|
+
tui: unknown;
|
|
8
|
+
container: unknown;
|
|
9
|
+
editor: unknown;
|
|
10
|
+
inputContainer: unknown;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/review/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/review/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAuDlE;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,CAgCR"}
|