@travisennis/acai 0.0.7 → 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 +42 -25
- package/dist/agent/index.d.ts +21 -25
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +115 -104
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +21 -16
- 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-command.js → add-directory/index.js} +6 -10
- 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/types.js +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} +0 -2
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/{copy-command.js → copy/index.js} +4 -26
- 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-command.d.ts → exit/index.d.ts} +4 -4
- 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} +55 -95
- 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-command.js → handoff/utils.js} +24 -92
- 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-command.d.ts → help/index.d.ts} +2 -2
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +1 -1
- 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} +16 -100
- 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} +16 -7
- 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} +1 -1
- 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-command.js → list-tools/index.js} +4 -16
- package/dist/commands/manager.d.ts +2 -2
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +33 -43
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/{model-command.js → model/index.js} +15 -52
- 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-command.d.ts → paste/index.d.ts} +2 -2
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/{paste-command.js → paste/index.js} +6 -111
- 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} +2 -2
- 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} +7 -2
- 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 -3
- 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} +3 -3
- package/dist/commands/types.d.ts +2 -2
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +25 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +45 -20
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +60 -64
- package/dist/formatting.d.ts +27 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +40 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +138 -75
- 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/deepseek-provider.d.ts +9 -8
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/google-provider.d.ts +10 -9
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.d.ts +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -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/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 -29
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +95 -80
- package/dist/models/providers.d.ts +4 -4
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +7 -1
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- 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 +0 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +56 -406
- 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 -4
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +245 -42
- package/dist/{messages.d.ts → sessions/manager.d.ts} +10 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +60 -14
- package/dist/skills.d.ts +0 -4
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +100 -59
- package/dist/terminal/control.d.ts +1 -0
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +2 -0
- package/dist/terminal/formatting.d.ts +1 -2
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +1 -2
- 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/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +9 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +69 -123
- package/dist/tools/directory-tree.d.ts +9 -7
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +89 -70
- package/dist/tools/dynamic-tool-loader.d.ts +22 -4
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +39 -44
- 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 +19 -76
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +77 -119
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -108
- package/dist/tools/index.d.ts +200 -179
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -315
- 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 +49 -82
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +37 -66
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -38
- package/dist/tools/types.d.ts +5 -25
- 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/box.d.ts.map +1 -1
- package/dist/tui/components/box.js +16 -10
- package/dist/tui/components/editor.d.ts +1 -2
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +148 -107
- package/dist/tui/components/footer.d.ts +20 -7
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +89 -196
- 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 +2 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +7 -2
- package/dist/tui/components/markdown.d.ts +5 -4
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +51 -40
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -8
- 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.map +1 -1
- package/dist/tui/components/progress-bar.js +3 -15
- package/dist/tui/components/select-list.d.ts +0 -15
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +5 -28
- package/dist/tui/components/tool-execution.d.ts +3 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +26 -38
- 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 +4 -2
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/tui/terminal.d.ts +2 -2
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +23 -19
- package/dist/tui/tui.d.ts +1 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +24 -29
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +2 -3
- 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.d.ts +1 -0
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +17 -0
- package/package.json +31 -29
- package/bin/acai-wrapper.js +0 -26
- 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/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 -43
- 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 -55
- 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 -124
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- 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 -42
- 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 -36
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -30
- 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 -68
- 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/health-command.d.ts +0 -4
- package/dist/commands/health-command.d.ts.map +0 -1
- package/dist/commands/health-command.js +0 -118
- 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 -71
- 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/model-command.d.ts +0 -3
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/paste-command.d.ts.map +0 -1
- 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 -109
- package/dist/commands/prompt-command.d.ts +0 -21
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -258
- 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 -73
- 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 -31
- package/dist/messages.d.ts.map +0 -1
- package/dist/repl/project-status-line.d.ts +0 -3
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -61
- 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/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -120
- package/dist/tokens/threshold.d.ts +0 -20
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -67
- 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 -285
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -117
- package/dist/tools/batch.d.ts +0 -34
- package/dist/tools/batch.d.ts.map +0 -1
- package/dist/tools/batch.js +0 -174
- 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 -183
- 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 -77
- 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/llm-edit-fixer.d.ts +0 -24
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -136
- 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 -65
- 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 -196
- 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 -148
- package/dist/tui/components/prompt-status.d.ts +0 -17
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -26
|
@@ -1 +0,0 @@
|
|
|
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,71 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { config } from "../config.js";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { Text } from "../tui/index.js";
|
|
6
|
-
import { glob } from "../utils/glob.js";
|
|
7
|
-
const isoDateRegex = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)/;
|
|
8
|
-
// Function to find the most recent log file
|
|
9
|
-
async function findMostRecentLog(logDir) {
|
|
10
|
-
const logPattern = join(logDir, "*-repl-message.json");
|
|
11
|
-
const files = await glob(logPattern);
|
|
12
|
-
if (files.length === 0) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const datedFiles = files
|
|
16
|
-
.map((file) => {
|
|
17
|
-
const filename = file.split("/").pop();
|
|
18
|
-
if (!filename) {
|
|
19
|
-
return null; // Skip if filename is somehow undefined
|
|
20
|
-
}
|
|
21
|
-
// Match the ISO date string at the beginning of the filename
|
|
22
|
-
const match = filename.match(isoDateRegex);
|
|
23
|
-
if (match?.[1]) {
|
|
24
|
-
const date = new Date(match[1]);
|
|
25
|
-
if (!Number.isNaN(date.getTime())) {
|
|
26
|
-
return { file, date };
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return null; // Exclude files that don't match the pattern or have invalid dates
|
|
30
|
-
})
|
|
31
|
-
.filter((item) => item !== null);
|
|
32
|
-
if (datedFiles.length === 0) {
|
|
33
|
-
return null; // No valid log files found
|
|
34
|
-
}
|
|
35
|
-
// Sort files by date (descending)
|
|
36
|
-
datedFiles.sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
37
|
-
return datedFiles[0]?.file ?? null; // The first file is the most recent
|
|
38
|
-
}
|
|
39
|
-
export const lastLogCommand = (_options) => {
|
|
40
|
-
return {
|
|
41
|
-
command: "/last-log",
|
|
42
|
-
description: "Opens the most recent REPL audit log in the editor.",
|
|
43
|
-
getSubCommands: () => Promise.resolve([]),
|
|
44
|
-
async handle(_args, { tui, container, editor, }) {
|
|
45
|
-
const logDir = config.app.ensurePathSync("audit");
|
|
46
|
-
const mostRecentLog = await findMostRecentLog(logDir);
|
|
47
|
-
if (!mostRecentLog) {
|
|
48
|
-
container.addChild(new Text(style.red(`No REPL audit logs found in '${logDir}'.`), 0, 1));
|
|
49
|
-
tui.requestRender();
|
|
50
|
-
editor.setText("");
|
|
51
|
-
return "continue";
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
const content = await readFile(mostRecentLog, { encoding: "utf8" });
|
|
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("");
|
|
61
|
-
return "continue";
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
container.addChild(new Text(style.red(`Error reading log file ${mostRecentLog}: ${error}`), 1, 0));
|
|
65
|
-
tui.requestRender();
|
|
66
|
-
editor.setText("");
|
|
67
|
-
return "continue";
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-command.d.ts","sourceRoot":"","sources":["../../source/commands/paste-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAsH9D,eAAO,MAAM,YAAY,GAAI,gDAI1B,cAAc,KAAG,WAwKnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickup-command.d.ts","sourceRoot":"","sources":["../../source/commands/pickup-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,KAAG,WAuIvD,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
-
import { basename } from "node:path";
|
|
3
|
-
import { logger } from "../logger.js";
|
|
4
|
-
import { createUserMessage } from "../messages.js";
|
|
5
|
-
import style from "../terminal/style.js";
|
|
6
|
-
import { Text } from "../tui/index.js";
|
|
7
|
-
export const pickupCommand = (options) => {
|
|
8
|
-
return {
|
|
9
|
-
command: "/pickup",
|
|
10
|
-
description: "Loads a handoff file into a new session to continue previous work. Usage: /pickup <filename>",
|
|
11
|
-
getSubCommands: async () => {
|
|
12
|
-
const getHandoffFileNames = async () => {
|
|
13
|
-
try {
|
|
14
|
-
const dirents = await readdir(options.workspace.primaryDir, {
|
|
15
|
-
withFileTypes: true,
|
|
16
|
-
});
|
|
17
|
-
return dirents
|
|
18
|
-
.filter((dirent) => dirent.isFile() && dirent.name.match(/^handoff-.*\.md$/))
|
|
19
|
-
.map((dirent) => basename(dirent.name, ".md"));
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
if (error.code === "ENOENT") {
|
|
23
|
-
return []; // Directory doesn't exist, return empty array
|
|
24
|
-
}
|
|
25
|
-
logger.error(`Error reading handoff files: ${error}`);
|
|
26
|
-
return []; // Return empty on other errors too, but log them
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
return await getHandoffFileNames();
|
|
30
|
-
},
|
|
31
|
-
async handle(args, { tui, container, editor, }) {
|
|
32
|
-
const { messageHistory, modelManager } = options;
|
|
33
|
-
// Validate that filename is provided
|
|
34
|
-
const filename = args.join(" ").trim();
|
|
35
|
-
if (!filename) {
|
|
36
|
-
const availableFiles = await getAvailableHandoffFiles(options);
|
|
37
|
-
if (availableFiles.length === 0) {
|
|
38
|
-
container.addChild(new Text(style.red("No handoff files found. Create a handoff file first using /handoff <purpose>"), 1, 0));
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
container.addChild(new Text(style.red("Please specify a handoff file to load."), 0, 1));
|
|
42
|
-
container.addChild(new Text("Available handoff files:", 2, 0));
|
|
43
|
-
availableFiles.forEach((file, index) => {
|
|
44
|
-
container.addChild(new Text(` • ${file}.md`, 3 + index, 0));
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
tui.requestRender();
|
|
48
|
-
editor.setText("");
|
|
49
|
-
return "continue";
|
|
50
|
-
}
|
|
51
|
-
// Ensure filename has .md extension for file operations
|
|
52
|
-
const filenameWithExt = filename.endsWith(".md")
|
|
53
|
-
? filename
|
|
54
|
-
: `${filename}.md`;
|
|
55
|
-
const filepath = `${options.workspace.primaryDir}/${filenameWithExt}`;
|
|
56
|
-
try {
|
|
57
|
-
// Read the handoff file
|
|
58
|
-
const handoffContent = await readFile(filepath, "utf8");
|
|
59
|
-
container.addChild(new Text(`Loading handoff file: ${style.blue(filenameWithExt)}`, 1, 0));
|
|
60
|
-
// Create new session (like compact-command does)
|
|
61
|
-
messageHistory.create(modelManager.getModel("repl").modelId);
|
|
62
|
-
// Append handoff content as user message
|
|
63
|
-
messageHistory.appendUserMessage(createUserMessage([], handoffContent));
|
|
64
|
-
container.addChild(new Text(style.green("Handoff file loaded successfully into new session."), 2, 0));
|
|
65
|
-
container.addChild(new Text("You can now continue with your previous work.", 3, 0));
|
|
66
|
-
tui.requestRender();
|
|
67
|
-
editor.setText("");
|
|
68
|
-
return "use";
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
if (error.code === "ENOENT") {
|
|
72
|
-
container.addChild(new Text(style.red(`Handoff file not found: ${filenameWithExt}`), 1, 0));
|
|
73
|
-
// Show available files as helpful suggestion
|
|
74
|
-
const availableFiles = await getAvailableHandoffFiles(options);
|
|
75
|
-
if (availableFiles.length > 0) {
|
|
76
|
-
container.addChild(new Text("Available handoff files:", 2, 0));
|
|
77
|
-
availableFiles.forEach((file, index) => {
|
|
78
|
-
container.addChild(new Text(` • ${file}.md`, 3 + index, 0));
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
container.addChild(new Text(style.red(`Error reading handoff file: ${error}`), 0, 1));
|
|
84
|
-
}
|
|
85
|
-
tui.requestRender();
|
|
86
|
-
editor.setText("");
|
|
87
|
-
return "continue";
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
async function getAvailableHandoffFiles(options) {
|
|
93
|
-
try {
|
|
94
|
-
const dirents = await readdir(options.workspace.primaryDir, {
|
|
95
|
-
withFileTypes: true,
|
|
96
|
-
});
|
|
97
|
-
return dirents
|
|
98
|
-
.filter((dirent) => dirent.isFile() && dirent.name.match(/^handoff-.*\.md$/))
|
|
99
|
-
.map((dirent) => basename(dirent.name, ".md"))
|
|
100
|
-
.sort();
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
if (error.code === "ENOENT") {
|
|
104
|
-
return [];
|
|
105
|
-
}
|
|
106
|
-
logger.error(`Error reading handoff files: ${error}`);
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ConfigManager } from "../config.ts";
|
|
2
|
-
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
3
|
-
interface PromptMetadata {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
path: string;
|
|
8
|
-
type: "project" | "user";
|
|
9
|
-
}
|
|
10
|
-
interface ParsedPrompt {
|
|
11
|
-
content: string;
|
|
12
|
-
metadata: {
|
|
13
|
-
description: string;
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export declare function parsePromptFile(content: string): ParsedPrompt;
|
|
18
|
-
export declare function loadPrompts(config: ConfigManager): Promise<Map<string, PromptMetadata>>;
|
|
19
|
-
export declare const promptCommand: ({ modelManager, promptManager, config, promptHistory, workspace, }: CommandOptions) => ReplCommand;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=prompt-command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-command.d.ts","sourceRoot":"","sources":["../../source/commands/prompt-command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAMlD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA+C9D,UAAU,cAAc;IACtB,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,UAAU,YAAY;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAmD7D;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,wCA8DtD;AAED,eAAO,MAAM,aAAa,GAAI,oEAM3B,cAAc,KAAG,WA0HnB,CAAC"}
|
|
@@ -1,258 +0,0 @@
|
|
|
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
|
-
/**
|
|
8
|
-
* Replaces argument placeholders in prompt content.
|
|
9
|
-
* Supports:
|
|
10
|
-
* - $ARGUMENTS: All arguments joined by space
|
|
11
|
-
* - $1, $2, $3, etc.: Individual positional arguments
|
|
12
|
-
* - {{INPUT}}: Backward compatibility with existing syntax
|
|
13
|
-
* If no placeholders are found, appends arguments at the end.
|
|
14
|
-
*/
|
|
15
|
-
function replaceArgumentPlaceholders(content, args) {
|
|
16
|
-
const allArguments = args.join(" ");
|
|
17
|
-
// Track if any replacements were made
|
|
18
|
-
let replacementsMade = false;
|
|
19
|
-
let result = content;
|
|
20
|
-
// Replace positional arguments ($1, $2, $3, etc.)
|
|
21
|
-
// Use string replacement since $ has special meaning in regex
|
|
22
|
-
for (let i = 0; i < args.length; i++) {
|
|
23
|
-
const placeholder = `$${i + 1}`;
|
|
24
|
-
if (result.includes(placeholder)) {
|
|
25
|
-
result = result.replaceAll(placeholder, args[i]);
|
|
26
|
-
replacementsMade = true;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// Replace $ARGUMENTS placeholder
|
|
30
|
-
if (result.includes("$ARGUMENTS")) {
|
|
31
|
-
result = result.replaceAll("$ARGUMENTS", allArguments);
|
|
32
|
-
replacementsMade = true;
|
|
33
|
-
}
|
|
34
|
-
// Replace {{INPUT}} placeholder (backward compatibility)
|
|
35
|
-
if (result.includes("{{INPUT}}")) {
|
|
36
|
-
result = result.replaceAll("{{INPUT}}", allArguments);
|
|
37
|
-
replacementsMade = true;
|
|
38
|
-
}
|
|
39
|
-
// If no replacements were made and we have arguments, append them
|
|
40
|
-
if (!replacementsMade && allArguments.trim().length > 0) {
|
|
41
|
-
result += `\n\n${allArguments}`;
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
export function parsePromptFile(content) {
|
|
46
|
-
// Check for YAML front matter
|
|
47
|
-
const frontMatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*(?:\n([\s\S]*))?$/);
|
|
48
|
-
if (!frontMatterMatch) {
|
|
49
|
-
// No YAML front matter - use first 50 chars of entire content as description
|
|
50
|
-
return {
|
|
51
|
-
content,
|
|
52
|
-
metadata: {
|
|
53
|
-
description:
|
|
54
|
-
// Get first line, then first 50 characters of that line
|
|
55
|
-
content.split("\n")[0].trim().slice(0, 50) +
|
|
56
|
-
(content.split("\n")[0].trim().length > 50 ? "..." : ""),
|
|
57
|
-
enabled: true,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const yamlContent = frontMatterMatch[1];
|
|
62
|
-
const promptContent = frontMatterMatch[2] || "";
|
|
63
|
-
// Default metadata for YAML front matter case
|
|
64
|
-
const defaultDescription = promptContent.split("\n")[0].trim().slice(0, 50) +
|
|
65
|
-
(promptContent.split("\n")[0].trim().length > 50 ? "..." : "");
|
|
66
|
-
// Parse simple YAML fields
|
|
67
|
-
let description = defaultDescription;
|
|
68
|
-
let enabled = true;
|
|
69
|
-
// Extract description field
|
|
70
|
-
const descriptionMatch = yamlContent.match(/^description:\s*(.+)$/m);
|
|
71
|
-
if (descriptionMatch) {
|
|
72
|
-
description = descriptionMatch[1].trim();
|
|
73
|
-
}
|
|
74
|
-
// Extract enabled field
|
|
75
|
-
const enabledMatch = yamlContent.match(/^enabled:\s*(true|false)$/im);
|
|
76
|
-
if (enabledMatch) {
|
|
77
|
-
enabled = enabledMatch[1].toLowerCase() === "true";
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
content: promptContent,
|
|
81
|
-
metadata: {
|
|
82
|
-
description,
|
|
83
|
-
enabled,
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
export async function loadPrompts(config) {
|
|
88
|
-
const getPromptsFromDir = async (dirPath, type) => {
|
|
89
|
-
try {
|
|
90
|
-
const dirents = await readdir(dirPath, { withFileTypes: true });
|
|
91
|
-
const mdFiles = dirents.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".md"));
|
|
92
|
-
const prompts = [];
|
|
93
|
-
for (const dirent of mdFiles) {
|
|
94
|
-
const filePath = path.join(dirPath, dirent.name);
|
|
95
|
-
try {
|
|
96
|
-
const content = await readFile(filePath, "utf8");
|
|
97
|
-
const parsed = parsePromptFile(content);
|
|
98
|
-
if (parsed.metadata.enabled) {
|
|
99
|
-
prompts.push({
|
|
100
|
-
name: basename(dirent.name, ".md"),
|
|
101
|
-
description: parsed.metadata.description,
|
|
102
|
-
enabled: parsed.metadata.enabled,
|
|
103
|
-
path: filePath,
|
|
104
|
-
type,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
logger.error(`Error reading prompt file ${filePath}: ${error}`);
|
|
110
|
-
// Skip this file but continue with others
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return prompts;
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
if (error.code === "ENOENT") {
|
|
117
|
-
return []; // Directory doesn't exist, return empty array
|
|
118
|
-
}
|
|
119
|
-
logger.error(`Error reading prompts from ${dirPath}: ${error}`);
|
|
120
|
-
return []; // Return empty on other errors too, but log them
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const userPromptDir = config.app.ensurePathSync("prompts"); // User prompts are global (~/.acai/prompts)
|
|
124
|
-
const projectPromptDir = config.project.ensurePathSync("prompts"); // Project prompts are local (./.acai/prompts)
|
|
125
|
-
const userPrompts = await getPromptsFromDir(userPromptDir, "user");
|
|
126
|
-
const projectPrompts = await getPromptsFromDir(projectPromptDir, "project");
|
|
127
|
-
// Combine and deduplicate, with project prompts taking precedence
|
|
128
|
-
const promptMap = new Map();
|
|
129
|
-
// Add user prompts first
|
|
130
|
-
for (const prompt of userPrompts) {
|
|
131
|
-
promptMap.set(prompt.name, prompt);
|
|
132
|
-
}
|
|
133
|
-
// Override with project prompts (project prompts take precedence)
|
|
134
|
-
for (const prompt of projectPrompts) {
|
|
135
|
-
promptMap.set(prompt.name, prompt);
|
|
136
|
-
}
|
|
137
|
-
return promptMap;
|
|
138
|
-
}
|
|
139
|
-
export const promptCommand = ({ modelManager, promptManager, config, promptHistory, workspace, }) => {
|
|
140
|
-
return {
|
|
141
|
-
command: "/prompt",
|
|
142
|
-
description: "Loads and executes prompts. Project prompts override user prompts with the same name.",
|
|
143
|
-
getSubCommands: async () => {
|
|
144
|
-
const promptMap = await loadPrompts(config);
|
|
145
|
-
const promptList = Array.from(promptMap.values())
|
|
146
|
-
.map((p) => p.name)
|
|
147
|
-
.sort();
|
|
148
|
-
return promptList;
|
|
149
|
-
},
|
|
150
|
-
async handle(args, { tui, container, editor, }) {
|
|
151
|
-
const promptName = args?.[0];
|
|
152
|
-
// Handle no subcommand
|
|
153
|
-
if (!promptName) {
|
|
154
|
-
container.addChild(new Text(style.red("No prompt given."), 1, 0));
|
|
155
|
-
tui.requestRender();
|
|
156
|
-
editor.setText("");
|
|
157
|
-
return "continue";
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
const promptResult = await findPrompt(promptName, config);
|
|
161
|
-
if (!promptResult) {
|
|
162
|
-
container.addChild(new Text(style.red(`Prompt not found: ${promptName}. Available prompts can be seen with tab completion.`), 1, 0));
|
|
163
|
-
tui.requestRender();
|
|
164
|
-
editor.setText("");
|
|
165
|
-
return "continue";
|
|
166
|
-
}
|
|
167
|
-
let promptContent;
|
|
168
|
-
try {
|
|
169
|
-
const fileContent = await readFile(promptResult.path, "utf8");
|
|
170
|
-
const parsed = parsePromptFile(fileContent);
|
|
171
|
-
promptContent = parsed.content;
|
|
172
|
-
}
|
|
173
|
-
catch (error) {
|
|
174
|
-
if (error.code === "ENOENT") {
|
|
175
|
-
container.addChild(new Text(style.red(`Prompt file not found: ${promptName} at ${promptResult.path}`), 1, 0));
|
|
176
|
-
tui.requestRender();
|
|
177
|
-
editor.setText("");
|
|
178
|
-
return "continue";
|
|
179
|
-
}
|
|
180
|
-
throw error;
|
|
181
|
-
}
|
|
182
|
-
// Get arguments for the prompt (everything after the prompt name)
|
|
183
|
-
const inputArgs = args.slice(1);
|
|
184
|
-
// Replace argument placeholders
|
|
185
|
-
promptContent = replaceArgumentPlaceholders(promptContent, inputArgs);
|
|
186
|
-
container.addChild(new Spacer(1));
|
|
187
|
-
container.addChild(new Text(`Loaded ${promptResult.type} prompt: ${style.blue(promptName)}`, 1, 0));
|
|
188
|
-
if (inputArgs.length > 0) {
|
|
189
|
-
container.addChild(new Text(`Input: "${inputArgs.join(" ")}"`, 2, 0));
|
|
190
|
-
}
|
|
191
|
-
const processedPrompt = await processPrompt(promptContent.trim(), {
|
|
192
|
-
baseDir: workspace.primaryDir,
|
|
193
|
-
model: modelManager.getModelMetadata("repl"),
|
|
194
|
-
});
|
|
195
|
-
for (const context of processedPrompt.context) {
|
|
196
|
-
promptManager.addContext(context);
|
|
197
|
-
}
|
|
198
|
-
promptManager.set(processedPrompt.message);
|
|
199
|
-
// Add the loaded prompt to history
|
|
200
|
-
promptHistory.push(processedPrompt.message);
|
|
201
|
-
tui.requestRender();
|
|
202
|
-
editor.setText("");
|
|
203
|
-
return "use";
|
|
204
|
-
}
|
|
205
|
-
catch (error) {
|
|
206
|
-
container.addChild(new Text(style.red(`Error loading prompt: ${error.message}`), 1, 0));
|
|
207
|
-
tui.requestRender();
|
|
208
|
-
editor.setText("");
|
|
209
|
-
return "continue";
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
async function findPrompt(promptName, config) {
|
|
215
|
-
// Check project prompts first (they take precedence)
|
|
216
|
-
const projectPath = path.join(config.project.ensurePathSync("prompts"), `${promptName}.md`);
|
|
217
|
-
try {
|
|
218
|
-
const content = await readFile(projectPath, "utf8");
|
|
219
|
-
const parsed = parsePromptFile(content);
|
|
220
|
-
if (!parsed.metadata.enabled) {
|
|
221
|
-
return null; // Prompt is disabled
|
|
222
|
-
}
|
|
223
|
-
return {
|
|
224
|
-
name: promptName,
|
|
225
|
-
description: parsed.metadata.description,
|
|
226
|
-
enabled: parsed.metadata.enabled,
|
|
227
|
-
path: projectPath,
|
|
228
|
-
type: "project",
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
if (error.code !== "ENOENT") {
|
|
233
|
-
throw error; // Re-throw non-file-not-found errors
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
// Check user prompts if not found in project
|
|
237
|
-
const userPath = path.join(config.app.ensurePathSync("prompts"), `${promptName}.md`);
|
|
238
|
-
try {
|
|
239
|
-
const content = await readFile(userPath, "utf8");
|
|
240
|
-
const parsed = parsePromptFile(content);
|
|
241
|
-
if (!parsed.metadata.enabled) {
|
|
242
|
-
return null; // Prompt is disabled
|
|
243
|
-
}
|
|
244
|
-
return {
|
|
245
|
-
name: promptName,
|
|
246
|
-
description: parsed.metadata.description,
|
|
247
|
-
enabled: parsed.metadata.enabled,
|
|
248
|
-
path: userPath,
|
|
249
|
-
type: "user",
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
catch (error) {
|
|
253
|
-
if (error.code !== "ENOENT") {
|
|
254
|
-
throw error; // Re-throw non-file-not-found errors
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return null; // Prompt not found in either location
|
|
258
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-directory-command.d.ts","sourceRoot":"","sources":["../../source/commands/remove-directory-command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,sBAAsB,GAAI,gBAEpC,cAAc,KAAG,WAkGnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reset-command.d.ts","sourceRoot":"","sources":["../../source/commands/reset-command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,YAAY,GAAI,mCAG1B,cAAc,KAAG,WA4BnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rules-command.d.ts","sourceRoot":"","sources":["../../source/commands/rules-command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,YAAY,GAAI,UAAU,cAAc,KAAG,WA2HvD,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { config } from "../config.js";
|
|
2
|
-
import style from "../terminal/style.js";
|
|
3
|
-
import { Text } from "../tui/index.js";
|
|
4
|
-
export const rulesCommand = (_options) => {
|
|
5
|
-
return {
|
|
6
|
-
command: "/rules",
|
|
7
|
-
description: "View, add, or edit rules. Usage: /rules [view|add <text>|edit]",
|
|
8
|
-
getSubCommands: () => Promise.resolve(["view", "add", "edit"]),
|
|
9
|
-
async handle(args, { tui, container, editor, }) {
|
|
10
|
-
const subCommand = args[0] ?? "view"; // Default to 'view'
|
|
11
|
-
const commandArgs = args.slice(1).join(" ");
|
|
12
|
-
try {
|
|
13
|
-
switch (subCommand) {
|
|
14
|
-
case "view": {
|
|
15
|
-
const currentContent = await config.readAgentsFile();
|
|
16
|
-
if (currentContent) {
|
|
17
|
-
container.addChild(new Text("--- Current Rules ---", 0, 1));
|
|
18
|
-
container.addChild(new Text(currentContent, 2, 0));
|
|
19
|
-
container.addChild(new Text("---------------------", 3, 0));
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
container.addChild(new Text(style.yellow("No rules defined yet. Use '/rules add' or '/rules edit'."), 1, 0));
|
|
23
|
-
}
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case "add": {
|
|
27
|
-
const newMemory = commandArgs.trim();
|
|
28
|
-
if (!newMemory) {
|
|
29
|
-
container.addChild(new Text(style.red("Error: Memory text cannot be empty for 'add'."), 1, 0));
|
|
30
|
-
container.addChild(new Text("Usage: /memory add <new memory text>", 2, 0));
|
|
31
|
-
tui.requestRender();
|
|
32
|
-
editor.setText("");
|
|
33
|
-
return "continue";
|
|
34
|
-
}
|
|
35
|
-
const currentContent = await config.readAgentsFile();
|
|
36
|
-
const updatedContent = currentContent
|
|
37
|
-
? `${currentContent.trim()}\n- ${newMemory}` // Ensure space after dash
|
|
38
|
-
: `- ${newMemory}`; // Start with dash if new file
|
|
39
|
-
await config.writeAgentsFile(updatedContent);
|
|
40
|
-
container.addChild(new Text(style.green("Rule added successfully"), 0, 1));
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case "edit": {
|
|
44
|
-
const currentContent = await config.readAgentsFile();
|
|
45
|
-
// For TUI mode, we can't use the editor prompt, so we'll just show current content
|
|
46
|
-
if (currentContent) {
|
|
47
|
-
container.addChild(new Text("Current rules:", 0, 1));
|
|
48
|
-
container.addChild(new Text(currentContent, 2, 0));
|
|
49
|
-
container.addChild(new Text(style.dim("Note: Rule editing not available in TUI mode"), 3, 0));
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
container.addChild(new Text(style.yellow("No rules defined yet. Use '/rules add' or '/rules edit'."), 1, 0));
|
|
53
|
-
}
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
default:
|
|
57
|
-
container.addChild(new Text(style.red("Invalid subcommand. Usage: /rules [view|add <text>|edit]"), 1, 0));
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
tui.requestRender();
|
|
61
|
-
editor.setText("");
|
|
62
|
-
return "continue";
|
|
63
|
-
}
|
|
64
|
-
catch (_error) {
|
|
65
|
-
// Errors from read/write helpers are already logged
|
|
66
|
-
container.addChild(new Text(style.red("Failed to execute memory command."), 0, 1));
|
|
67
|
-
tui.requestRender();
|
|
68
|
-
editor.setText("");
|
|
69
|
-
return "continue";
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"save-command.d.ts","sourceRoot":"","sources":["../../source/commands/save-command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,WAAW,GAAI,qBAEzB,cAAc,KAAG,WAyBnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell-command.d.ts","sourceRoot":"","sources":["../../source/commands/shell-command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAK9D,eAAO,MAAM,YAAY,GAAI,SAAS,cAAc,KAAG,WAqHtD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage-command.d.ts","sourceRoot":"","sources":["../../source/commands/usage-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,YAAY,CAAC,EAAE,YAAY,EAAE,EAAE,cAAc,GAAG,WAAW,CAsC1E"}
|