@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
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import * as readline from "node:readline";
|
|
6
|
-
export async function editor(options) {
|
|
7
|
-
const { message, default: defaultValue = "", postfix = ".txt", editor, skipPrompt = false, signal, } = options;
|
|
8
|
-
const openEditor = () => {
|
|
9
|
-
// pick editor: $EDITOR env or fallback to vi
|
|
10
|
-
const editorCmd = editor ||
|
|
11
|
-
process.env["VISUAL"] ||
|
|
12
|
-
process.env["EDITOR"] ||
|
|
13
|
-
(process.platform === "win32" ? "notepad" : "vi");
|
|
14
|
-
// create temp file with postfix for syntax highlighting
|
|
15
|
-
const tempFile = join(tmpdir(), `editor-prompt-${process.pid}-${Date.now()}${postfix}`);
|
|
16
|
-
writeFileSync(tempFile, defaultValue);
|
|
17
|
-
// open editor
|
|
18
|
-
spawnSync(editorCmd, [tempFile], { stdio: "inherit" });
|
|
19
|
-
// read result and clean up
|
|
20
|
-
const result = readFileSync(tempFile, "utf-8");
|
|
21
|
-
unlinkSync(tempFile);
|
|
22
|
-
return result.trim();
|
|
23
|
-
};
|
|
24
|
-
if (skipPrompt) {
|
|
25
|
-
// Immediately launch editor without prompt
|
|
26
|
-
return openEditor();
|
|
27
|
-
}
|
|
28
|
-
// Show prompt and wait for user confirmation
|
|
29
|
-
const rl = readline.createInterface({
|
|
30
|
-
input: process.stdin,
|
|
31
|
-
output: process.stdout,
|
|
32
|
-
});
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
let resolved = false;
|
|
35
|
-
function cleanup() {
|
|
36
|
-
if (resolved)
|
|
37
|
-
return;
|
|
38
|
-
resolved = true;
|
|
39
|
-
rl.close();
|
|
40
|
-
}
|
|
41
|
-
// Handle abort signal
|
|
42
|
-
if (signal) {
|
|
43
|
-
signal.addEventListener("abort", () => {
|
|
44
|
-
cleanup();
|
|
45
|
-
const err = new Error("AbortError");
|
|
46
|
-
err.name = "AbortError";
|
|
47
|
-
reject(err);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
rl.question(`${message} (opens in editor)\nPress Enter to continue...`, () => {
|
|
51
|
-
cleanup();
|
|
52
|
-
resolve(openEditor());
|
|
53
|
-
});
|
|
54
|
-
rl.on("SIGINT", () => {
|
|
55
|
-
cleanup();
|
|
56
|
-
const err = new Error("Cancelled");
|
|
57
|
-
err.isCanceled = true;
|
|
58
|
-
reject(err);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom error classes for terminal prompts
|
|
3
|
-
*/
|
|
4
|
-
export declare class PromptError extends Error {
|
|
5
|
-
constructor(message: string, options?: ErrorOptions);
|
|
6
|
-
}
|
|
7
|
-
export declare class PromptAbortError extends PromptError {
|
|
8
|
-
constructor(message?: string);
|
|
9
|
-
}
|
|
10
|
-
export declare class PromptCancelError extends PromptError {
|
|
11
|
-
constructor(message?: string);
|
|
12
|
-
}
|
|
13
|
-
export declare class PromptValidationError extends PromptError {
|
|
14
|
-
constructor(message: string);
|
|
15
|
-
}
|
|
16
|
-
export declare function isAbortError(error: unknown): error is PromptAbortError;
|
|
17
|
-
export declare function isCancelError(error: unknown): error is PromptCancelError;
|
|
18
|
-
export declare function isPromptError(error: unknown): error is PromptError;
|
|
19
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../source/terminal/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,qBAAa,gBAAiB,SAAQ,WAAW;gBACnC,OAAO,SAAmB;CAIvC;AAED,qBAAa,iBAAkB,SAAQ,WAAW;gBACpC,OAAO,SAA6B;CAIjD;AAED,qBAAa,qBAAsB,SAAQ,WAAW;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAEtE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAExE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
|
package/dist/terminal/errors.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom error classes for terminal prompts
|
|
3
|
-
*/
|
|
4
|
-
export class PromptError extends Error {
|
|
5
|
-
constructor(message, options) {
|
|
6
|
-
super(message, options);
|
|
7
|
-
this.name = "PromptError";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export class PromptAbortError extends PromptError {
|
|
11
|
-
constructor(message = "Prompt aborted") {
|
|
12
|
-
super(message);
|
|
13
|
-
this.name = "PromptAbortError";
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export class PromptCancelError extends PromptError {
|
|
17
|
-
constructor(message = "Prompt cancelled by user") {
|
|
18
|
-
super(message);
|
|
19
|
-
this.name = "PromptCancelError";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export class PromptValidationError extends PromptError {
|
|
23
|
-
constructor(message) {
|
|
24
|
-
super(message);
|
|
25
|
-
this.name = "PromptValidationError";
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// Type guards for error handling
|
|
29
|
-
export function isAbortError(error) {
|
|
30
|
-
return error instanceof Error && error.name === "PromptAbortError";
|
|
31
|
-
}
|
|
32
|
-
export function isCancelError(error) {
|
|
33
|
-
return error instanceof Error && error.name === "PromptCancelError";
|
|
34
|
-
}
|
|
35
|
-
export function isPromptError(error) {
|
|
36
|
-
return error instanceof PromptError;
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Standalone input prompt (inquirer-like)
|
|
4
|
-
* - TypeScript version
|
|
5
|
-
*/
|
|
6
|
-
interface InputOptions {
|
|
7
|
-
message?: string;
|
|
8
|
-
default?: string;
|
|
9
|
-
validate?: (input: string) => true | string;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
minLength?: number;
|
|
12
|
-
maxLength?: number;
|
|
13
|
-
signal?: AbortSignal;
|
|
14
|
-
}
|
|
15
|
-
export declare function input({ message, default: defaultValue, validate, required, minLength, maxLength, signal, }?: InputOptions): Promise<string>;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=input-prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/input-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;AAWH,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AA4HD,wBAAsB,KAAK,CAAC,EAC1B,OAAuB,EACvB,OAAO,EAAE,YAAY,EACrB,QAAQ,EACR,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,MAAM,GACP,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0DrC"}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Standalone input prompt (inquirer-like)
|
|
4
|
-
* - TypeScript version
|
|
5
|
-
*/
|
|
6
|
-
import * as readline from "node:readline";
|
|
7
|
-
import { isAbortError, isCancelError, PromptAbortError, PromptCancelError, } from "./errors.js";
|
|
8
|
-
import style from "./style.js";
|
|
9
|
-
/**
|
|
10
|
-
* Enhanced input validation with built-in and custom validation
|
|
11
|
-
*/
|
|
12
|
-
function validateInput(input, options) {
|
|
13
|
-
const { validate, required, minLength, maxLength, default: defaultValue, } = options;
|
|
14
|
-
// Handle empty input
|
|
15
|
-
const trimmedInput = input.trim();
|
|
16
|
-
if (!trimmedInput && !defaultValue) {
|
|
17
|
-
if (required) {
|
|
18
|
-
return "Input is required";
|
|
19
|
-
}
|
|
20
|
-
return true; // Allow empty if not required
|
|
21
|
-
}
|
|
22
|
-
// Use default value if input is empty
|
|
23
|
-
const finalInput = trimmedInput || defaultValue || "";
|
|
24
|
-
// Length validations
|
|
25
|
-
if (minLength && finalInput.length < minLength) {
|
|
26
|
-
return `Input must be at least ${minLength} characters`;
|
|
27
|
-
}
|
|
28
|
-
if (maxLength && finalInput.length > maxLength) {
|
|
29
|
-
return `Input must be at most ${maxLength} characters`;
|
|
30
|
-
}
|
|
31
|
-
// Custom validation
|
|
32
|
-
if (validate) {
|
|
33
|
-
return validate(finalInput);
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Create a managed readline interface with proper cleanup
|
|
39
|
-
*/
|
|
40
|
-
function createReadlineInterface() {
|
|
41
|
-
const rl = readline.createInterface({
|
|
42
|
-
input: process.stdin,
|
|
43
|
-
output: process.stdout,
|
|
44
|
-
terminal: true,
|
|
45
|
-
});
|
|
46
|
-
let cleanedUp = false;
|
|
47
|
-
const cleanup = () => {
|
|
48
|
-
if (cleanedUp)
|
|
49
|
-
return;
|
|
50
|
-
cleanedUp = true;
|
|
51
|
-
rl.close();
|
|
52
|
-
};
|
|
53
|
-
return { rl, cleanup };
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Non-blocking question wrapper using Promise
|
|
57
|
-
*/
|
|
58
|
-
function askQuestion(rl, prompt) {
|
|
59
|
-
return new Promise((resolve) => {
|
|
60
|
-
rl.question(prompt, resolve);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Main prompt function with retry logic for validation
|
|
65
|
-
*/
|
|
66
|
-
async function promptWithRetry(rl, prompt, options) {
|
|
67
|
-
const { validate, required, minLength, maxLength, default: defaultValue, } = options;
|
|
68
|
-
while (true) {
|
|
69
|
-
try {
|
|
70
|
-
const answer = await askQuestion(rl, prompt);
|
|
71
|
-
const validationResult = validateInput(answer, {
|
|
72
|
-
validate,
|
|
73
|
-
required,
|
|
74
|
-
minLength,
|
|
75
|
-
maxLength,
|
|
76
|
-
default: defaultValue,
|
|
77
|
-
});
|
|
78
|
-
if (validationResult === true) {
|
|
79
|
-
// Determine final answer
|
|
80
|
-
let finalAnswer = answer.trim();
|
|
81
|
-
if (!finalAnswer && defaultValue !== undefined) {
|
|
82
|
-
finalAnswer = defaultValue;
|
|
83
|
-
}
|
|
84
|
-
return finalAnswer;
|
|
85
|
-
}
|
|
86
|
-
// Show validation error and retry
|
|
87
|
-
console.log(style.red(validationResult));
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
if (isAbortError(error) || isCancelError(error)) {
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
// Handle other errors appropriately
|
|
94
|
-
throw new Error("Failed to read input", { cause: error });
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export async function input({ message = "Enter value", default: defaultValue, validate, required = false, minLength, maxLength, signal, } = {}) {
|
|
99
|
-
if (!process.stdin.isTTY) {
|
|
100
|
-
throw new Error("TTY required");
|
|
101
|
-
}
|
|
102
|
-
const { rl, cleanup } = createReadlineInterface();
|
|
103
|
-
let cleanupCalled = false;
|
|
104
|
-
const ensureCleanup = () => {
|
|
105
|
-
if (!cleanupCalled) {
|
|
106
|
-
cleanupCalled = true;
|
|
107
|
-
cleanup();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
try {
|
|
111
|
-
return await new Promise((resolve, reject) => {
|
|
112
|
-
const prompt = defaultValue
|
|
113
|
-
? `${message} (${defaultValue}): `
|
|
114
|
-
: `${message}: `;
|
|
115
|
-
// Handle abort signal
|
|
116
|
-
if (signal) {
|
|
117
|
-
signal.addEventListener("abort", () => {
|
|
118
|
-
ensureCleanup();
|
|
119
|
-
reject(new PromptAbortError());
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
// Handle SIGINT (Ctrl+C)
|
|
123
|
-
rl.on("SIGINT", () => {
|
|
124
|
-
ensureCleanup();
|
|
125
|
-
reject(new PromptCancelError());
|
|
126
|
-
});
|
|
127
|
-
// Start the prompt process
|
|
128
|
-
promptWithRetry(rl, prompt, {
|
|
129
|
-
message,
|
|
130
|
-
default: defaultValue,
|
|
131
|
-
validate,
|
|
132
|
-
required,
|
|
133
|
-
minLength,
|
|
134
|
-
maxLength,
|
|
135
|
-
signal,
|
|
136
|
-
})
|
|
137
|
-
.then((result) => {
|
|
138
|
-
ensureCleanup();
|
|
139
|
-
resolve(result);
|
|
140
|
-
})
|
|
141
|
-
.catch((error) => {
|
|
142
|
-
ensureCleanup();
|
|
143
|
-
reject(error);
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
ensureCleanup();
|
|
149
|
-
throw error;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
// Quick test when run directly
|
|
153
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
154
|
-
(async () => {
|
|
155
|
-
try {
|
|
156
|
-
const name = await input({
|
|
157
|
-
message: "What is your name",
|
|
158
|
-
default: "Anonymous",
|
|
159
|
-
validate: (txt) => (txt.length < 2 ? "Name too short" : true),
|
|
160
|
-
required: true,
|
|
161
|
-
minLength: 2,
|
|
162
|
-
});
|
|
163
|
-
console.log("Hello,", name);
|
|
164
|
-
process.exit(0);
|
|
165
|
-
}
|
|
166
|
-
catch (err) {
|
|
167
|
-
if (isCancelError(err)) {
|
|
168
|
-
console.error("Cancelled");
|
|
169
|
-
process.exit(2);
|
|
170
|
-
}
|
|
171
|
-
else if (isAbortError(err)) {
|
|
172
|
-
console.error("Aborted");
|
|
173
|
-
process.exit(3);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
console.error(err);
|
|
177
|
-
process.exit(1);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
})();
|
|
181
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../source/terminal/markdown.ts"],"names":[],"mappings":"AAcA,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMrD"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { EOL } from "node:os";
|
|
2
|
-
import Table from "cli-table3";
|
|
3
|
-
import { marked } from "marked";
|
|
4
|
-
import { logger } from "../logger.js";
|
|
5
|
-
import { DEFAULT_THEME } from "./default-theme.js";
|
|
6
|
-
import { link as terminalLink } from "./formatting.js";
|
|
7
|
-
import { highlight, supportsLanguage } from "./highlight/index.js";
|
|
8
|
-
import { getListNumber } from "./markdown-utils.js";
|
|
9
|
-
import style from "./style.js";
|
|
10
|
-
function logError(msg) {
|
|
11
|
-
logger.error(msg);
|
|
12
|
-
}
|
|
13
|
-
export function applyMarkdown(content) {
|
|
14
|
-
return marked
|
|
15
|
-
.lexer(content)
|
|
16
|
-
.map((token) => format(token))
|
|
17
|
-
.join("")
|
|
18
|
-
.trim();
|
|
19
|
-
}
|
|
20
|
-
function format(token, listDepth = 0, orderedListNumber = null, parent = null) {
|
|
21
|
-
switch (token.type) {
|
|
22
|
-
case "blockquote":
|
|
23
|
-
return style.dim.italic((token.tokens ?? [])
|
|
24
|
-
.map((_) => format(_))
|
|
25
|
-
.map((l) => ` ${l}`)
|
|
26
|
-
.join(""));
|
|
27
|
-
case "code": {
|
|
28
|
-
if (token.lang && supportsLanguage(token.lang)) {
|
|
29
|
-
return (highlight(token.text, {
|
|
30
|
-
language: token.lang,
|
|
31
|
-
theme: DEFAULT_THEME,
|
|
32
|
-
}) + EOL);
|
|
33
|
-
}
|
|
34
|
-
logError(`Language not supported while highlighting code, falling back to markdown: ${token.lang}`);
|
|
35
|
-
return (highlight(token.text, { language: "markdown", theme: DEFAULT_THEME }) +
|
|
36
|
-
EOL);
|
|
37
|
-
}
|
|
38
|
-
case "codespan":
|
|
39
|
-
// inline code
|
|
40
|
-
return style.blue(token.text);
|
|
41
|
-
case "em":
|
|
42
|
-
return style.italic((token.tokens ?? []).map((_) => format(_)).join(""));
|
|
43
|
-
case "strong":
|
|
44
|
-
return style.bold((token.tokens ?? []).map((_) => format(_)).join(""));
|
|
45
|
-
case "heading":
|
|
46
|
-
switch (token.depth) {
|
|
47
|
-
case 1: // h1
|
|
48
|
-
return (style.bold.italic.underline((token.tokens ?? []).map((_) => format(_)).join("")) +
|
|
49
|
-
EOL +
|
|
50
|
-
EOL);
|
|
51
|
-
case 2: // h2
|
|
52
|
-
return (style.bold((token.tokens ?? []).map((_) => format(_)).join("")) +
|
|
53
|
-
EOL +
|
|
54
|
-
EOL);
|
|
55
|
-
default: // h3+
|
|
56
|
-
return (style.bold.dim((token.tokens ?? []).map((_) => format(_)).join("")) +
|
|
57
|
-
EOL +
|
|
58
|
-
EOL);
|
|
59
|
-
}
|
|
60
|
-
case "hr":
|
|
61
|
-
return "---";
|
|
62
|
-
case "image": {
|
|
63
|
-
const alt = (token.title ?? token.text ?? "").toString().trim();
|
|
64
|
-
if (alt.length > 0) {
|
|
65
|
-
return `[Image: ${alt} (${token.href})]`;
|
|
66
|
-
}
|
|
67
|
-
return `[Image: ${token.href}]`;
|
|
68
|
-
}
|
|
69
|
-
case "link":
|
|
70
|
-
return terminalLink(token.text, token.href);
|
|
71
|
-
case "list": {
|
|
72
|
-
return token.items
|
|
73
|
-
.map((_, index) => format(_, listDepth, token.ordered ? token.start + index : null, token))
|
|
74
|
-
.join("");
|
|
75
|
-
}
|
|
76
|
-
case "list_item":
|
|
77
|
-
return (token.tokens ?? [])
|
|
78
|
-
.map((_) => `${" ".repeat(listDepth)}${format(_, listDepth + 1, orderedListNumber, token)}`)
|
|
79
|
-
.join("");
|
|
80
|
-
case "paragraph":
|
|
81
|
-
return (token.tokens ?? []).map((_) => format(_)).join("") + EOL;
|
|
82
|
-
case "space":
|
|
83
|
-
return EOL;
|
|
84
|
-
case "text": {
|
|
85
|
-
if (parent?.type === "list_item") {
|
|
86
|
-
return `${orderedListNumber === null ? "-" : `${getListNumber(listDepth, orderedListNumber)}.`} ${token.tokens ? token.tokens.map((_) => format(_, listDepth, orderedListNumber, token)).join("") : token.text}${EOL}`;
|
|
87
|
-
}
|
|
88
|
-
return token.text;
|
|
89
|
-
}
|
|
90
|
-
case "table": {
|
|
91
|
-
const header = Array.isArray(token.header)
|
|
92
|
-
? token.header
|
|
93
|
-
: [token.header];
|
|
94
|
-
const rows = Array.isArray(token.rows) ? token.rows : [token.rows];
|
|
95
|
-
// Calculate column widths based on terminal width
|
|
96
|
-
const padding = 5; // Account for table borders and padding
|
|
97
|
-
const availableWidth = Math.max(10, (process.stdout.columns || 80) - padding);
|
|
98
|
-
const colCount = header?.length ?? 1;
|
|
99
|
-
const width = Math.max(10, Math.floor(availableWidth / Math.max(1, colCount)));
|
|
100
|
-
const computedColWidths = new Array(colCount).fill(width);
|
|
101
|
-
const table = new Table({
|
|
102
|
-
head: header.map((h) => h.text),
|
|
103
|
-
colWidths: computedColWidths,
|
|
104
|
-
wordWrap: true, // Enable word wrapping for the description column
|
|
105
|
-
});
|
|
106
|
-
table.push(...rows.map((row) => row.map((c) => c.text)));
|
|
107
|
-
return `${table.toString()}\n`;
|
|
108
|
-
}
|
|
109
|
-
case "del": {
|
|
110
|
-
return style.strikethrough(token.text);
|
|
111
|
-
}
|
|
112
|
-
case "html":
|
|
113
|
-
// Render HTML tags with dim styling and content as normal text
|
|
114
|
-
return style.dim(token.text);
|
|
115
|
-
default:
|
|
116
|
-
return "";
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Standalone search prompt (inquirer-like)
|
|
4
|
-
* - TypeScript version
|
|
5
|
-
*/
|
|
6
|
-
interface ChoiceObject<T = unknown> {
|
|
7
|
-
name: string;
|
|
8
|
-
value: T;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export type Choice<T = unknown> = string | ChoiceObject<T>;
|
|
12
|
-
export interface SearchOptions<T = unknown> {
|
|
13
|
-
message?: string;
|
|
14
|
-
source: (input: string) => Promise<Choice<T>[]>;
|
|
15
|
-
pageSize?: number;
|
|
16
|
-
signal?: AbortSignal;
|
|
17
|
-
}
|
|
18
|
-
export declare function search<T = unknown>({ message, source, pageSize, signal, }: SearchOptions<T>): Promise<T>;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=search-prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/search-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;AAQH,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAQ3D,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AA8CD,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,EACxC,OAAkB,EAClB,MAAM,EACN,QAAY,EACZ,MAAM,GACP,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAyO/B"}
|