@travisennis/acai 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -19
- package/bin/acai-wrapper.js +26 -0
- package/dist/agent/index.d.ts +132 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +434 -0
- package/dist/api/exa/index.js +1 -1
- package/dist/cli.d.ts +4 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +67 -40
- package/dist/commands/add-directory-command.d.ts +3 -0
- package/dist/commands/add-directory-command.d.ts.map +1 -0
- package/dist/commands/add-directory-command.js +54 -0
- package/dist/commands/application-log-command.d.ts +1 -1
- package/dist/commands/application-log-command.d.ts.map +1 -1
- package/dist/commands/application-log-command.js +18 -20
- package/dist/commands/clear-command.d.ts +1 -1
- package/dist/commands/clear-command.d.ts.map +1 -1
- package/dist/commands/clear-command.js +7 -3
- package/dist/commands/compact-command.d.ts.map +1 -1
- package/dist/commands/compact-command.js +9 -5
- package/dist/commands/context-command.d.ts +3 -0
- package/dist/commands/context-command.d.ts.map +1 -0
- package/dist/commands/context-command.js +124 -0
- package/dist/commands/copy-command.d.ts.map +1 -1
- package/dist/commands/copy-command.js +14 -5
- package/dist/commands/edit-command.d.ts +1 -1
- package/dist/commands/edit-command.d.ts.map +1 -1
- package/dist/commands/edit-command.js +21 -34
- package/dist/commands/edit-prompt-command.d.ts +1 -1
- package/dist/commands/edit-prompt-command.d.ts.map +1 -1
- package/dist/commands/edit-prompt-command.js +18 -15
- package/dist/commands/exit-command.d.ts +1 -4
- package/dist/commands/exit-command.d.ts.map +1 -1
- package/dist/commands/exit-command.js +9 -5
- package/dist/commands/files-command.d.ts +1 -1
- package/dist/commands/files-command.d.ts.map +1 -1
- package/dist/commands/files-command.js +20 -16
- package/dist/commands/generate-rules-command.d.ts +1 -1
- package/dist/commands/generate-rules-command.d.ts.map +1 -1
- package/dist/commands/generate-rules-command.js +307 -39
- package/dist/commands/handoff-command.d.ts +3 -0
- package/dist/commands/handoff-command.d.ts.map +1 -0
- package/dist/commands/handoff-command.js +191 -0
- package/dist/commands/health-command.d.ts +1 -1
- package/dist/commands/health-command.d.ts.map +1 -1
- package/dist/commands/health-command.js +49 -27
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +25 -5
- package/dist/commands/history-command.d.ts +3 -0
- package/dist/commands/history-command.d.ts.map +1 -0
- package/dist/commands/history-command.js +458 -0
- package/dist/commands/init-command.d.ts +1 -1
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/init-command.js +40 -22
- package/dist/commands/last-log-command.d.ts +1 -1
- package/dist/commands/last-log-command.d.ts.map +1 -1
- package/dist/commands/last-log-command.js +15 -15
- package/dist/commands/list-directories-command.d.ts +3 -0
- package/dist/commands/list-directories-command.d.ts.map +1 -0
- package/dist/commands/list-directories-command.js +35 -0
- package/dist/commands/list-tools-command.d.ts.map +1 -1
- package/dist/commands/list-tools-command.js +61 -21
- package/dist/commands/manager.d.ts +9 -4
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +64 -39
- package/dist/commands/model-command.d.ts.map +1 -1
- package/dist/commands/model-command.js +201 -66
- package/dist/commands/paste-command.d.ts +1 -1
- package/dist/commands/paste-command.d.ts.map +1 -1
- package/dist/commands/paste-command.js +23 -9
- package/dist/commands/pickup-command.d.ts +3 -0
- package/dist/commands/pickup-command.d.ts.map +1 -0
- package/dist/commands/pickup-command.js +109 -0
- package/dist/commands/prompt-command.d.ts +19 -1
- package/dist/commands/prompt-command.d.ts.map +1 -1
- package/dist/commands/prompt-command.js +191 -98
- package/dist/commands/remove-directory-command.d.ts +3 -0
- package/dist/commands/remove-directory-command.d.ts.map +1 -0
- package/dist/commands/remove-directory-command.js +55 -0
- package/dist/commands/reset-command.d.ts +1 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/reset-command.js +8 -5
- package/dist/commands/rules-command.d.ts +1 -1
- package/dist/commands/rules-command.d.ts.map +1 -1
- package/dist/commands/rules-command.js +25 -22
- package/dist/commands/save-command.d.ts +1 -1
- package/dist/commands/save-command.d.ts.map +1 -1
- package/dist/commands/save-command.js +8 -3
- package/dist/commands/shell-command.d.ts.map +1 -1
- package/dist/commands/shell-command.js +45 -24
- package/dist/commands/types.d.ts +9 -7
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/usage-command.d.ts +1 -1
- package/dist/commands/usage-command.d.ts.map +1 -1
- package/dist/commands/usage-command.js +18 -7
- package/dist/config.d.ts +21 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +90 -63
- package/dist/execution/index.d.ts +17 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +62 -20
- package/dist/formatting.d.ts +127 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +201 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +263 -102
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +47 -18
- package/dist/mentions.d.ts +2 -1
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +16 -1
- package/dist/messages.d.ts +11 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +122 -21
- package/dist/middleware/cache.d.ts +3 -0
- package/dist/middleware/cache.d.ts.map +1 -0
- package/dist/middleware/cache.js +53 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -0
- package/dist/models/ai-config.d.ts +4 -2
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +12 -2
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +3 -67
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -3
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/manager.d.ts +2 -1
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +26 -2
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/openrouter-provider.d.ts +16 -22
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +175 -236
- package/dist/models/providers.d.ts +4 -14
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +1 -57
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts.d.ts +10 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +447 -70
- package/dist/repl/project-status-line.d.ts +3 -0
- package/dist/repl/project-status-line.d.ts.map +1 -0
- package/dist/repl/project-status-line.js +61 -0
- package/dist/repl/tool-call-repair.d.ts.map +1 -1
- package/dist/repl/tool-call-repair.js +8 -4
- package/dist/repl-new.d.ts +51 -0
- package/dist/repl-new.d.ts.map +1 -0
- package/dist/repl-new.js +354 -0
- package/dist/skills.d.ts +20 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +192 -0
- package/dist/terminal/control.d.ts +55 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +109 -0
- package/dist/terminal/default-theme.d.ts +1 -1
- package/dist/terminal/default-theme.d.ts.map +1 -1
- package/dist/terminal/default-theme.js +24 -28
- package/dist/terminal/formatting.d.ts +23 -25
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -52
- package/dist/terminal/highlight/index.d.ts.map +1 -1
- package/dist/terminal/highlight/index.js +3 -6
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +2 -6
- package/dist/terminal/index.d.ts +2 -94
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -370
- package/dist/terminal/markdown.js +10 -5
- package/dist/terminal/select-prompt.d.ts +2 -2
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +47 -39
- package/dist/terminal/strip-ansi.js +4 -4
- package/dist/terminal/table/cell.d.ts +114 -0
- package/dist/terminal/table/cell.d.ts.map +1 -0
- package/dist/terminal/table/cell.js +407 -0
- package/dist/terminal/table/debug.d.ts +15 -0
- package/dist/terminal/table/debug.d.ts.map +1 -0
- package/dist/terminal/table/debug.js +32 -0
- package/dist/terminal/table/index.d.ts +3 -0
- package/dist/terminal/table/index.d.ts.map +1 -0
- package/dist/terminal/table/index.js +2 -0
- package/dist/terminal/table/layout-manager.d.ts +27 -0
- package/dist/terminal/table/layout-manager.d.ts.map +1 -0
- package/dist/terminal/table/layout-manager.js +257 -0
- package/dist/terminal/table/table.d.ts +9 -0
- package/dist/terminal/table/table.d.ts.map +1 -0
- package/dist/terminal/table/table.js +97 -0
- package/dist/terminal/table/utils.d.ts +63 -0
- package/dist/terminal/table/utils.d.ts.map +1 -0
- package/dist/terminal/table/utils.js +326 -0
- package/dist/tokens/threshold.d.ts +20 -0
- package/dist/tokens/threshold.d.ts.map +1 -0
- package/dist/tokens/threshold.js +67 -0
- package/dist/tools/advanced-edit-file.d.ts +69 -0
- package/dist/tools/advanced-edit-file.d.ts.map +1 -0
- package/dist/tools/advanced-edit-file.js +285 -0
- package/dist/tools/agent.d.ts +16 -5
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +86 -59
- package/dist/tools/bash.d.ts +23 -12
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +243 -128
- package/dist/tools/batch.d.ts +34 -0
- package/dist/tools/batch.d.ts.map +1 -0
- package/dist/tools/batch.js +174 -0
- package/dist/tools/code-interpreter.d.ts +21 -9
- package/dist/tools/code-interpreter.d.ts.map +1 -1
- package/dist/tools/code-interpreter.js +151 -134
- package/dist/tools/delete-file.d.ts +17 -10
- package/dist/tools/delete-file.d.ts.map +1 -1
- package/dist/tools/delete-file.js +60 -97
- package/dist/tools/directory-tree.d.ts +17 -12
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +57 -48
- package/dist/tools/dynamic-tool-loader.d.ts +16 -10
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +122 -130
- package/dist/tools/dynamic-tool-parser.d.ts +1 -0
- package/dist/tools/dynamic-tool-parser.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-parser.js +1 -0
- package/dist/tools/edit-file.d.ts +35 -15
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +127 -114
- package/dist/tools/glob.d.ts +36 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/glob.js +154 -0
- package/dist/tools/grep.d.ts +73 -12
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +425 -165
- package/dist/tools/index.d.ts +220 -126
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +284 -135
- package/dist/tools/llm-edit-fixer.d.ts +24 -0
- package/dist/tools/llm-edit-fixer.d.ts.map +1 -0
- package/dist/tools/llm-edit-fixer.js +136 -0
- package/dist/tools/move-file.d.ts +19 -7
- package/dist/tools/move-file.d.ts.map +1 -1
- package/dist/tools/move-file.js +48 -34
- package/dist/tools/read-file.d.ts +47 -9
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +84 -70
- package/dist/tools/read-multiple-files.d.ts +17 -6
- package/dist/tools/read-multiple-files.d.ts.map +1 -1
- package/dist/tools/read-multiple-files.js +132 -72
- package/dist/tools/save-file.d.ts +45 -12
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +76 -101
- package/dist/tools/think.d.ts +15 -7
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +34 -20
- package/dist/tools/types.d.ts +8 -10
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +9 -0
- package/dist/tools/utils.d.ts +14 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +16 -0
- package/dist/tools/web-fetch.d.ts +11 -4
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +39 -38
- package/dist/tools/web-search.d.ts +15 -6
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +64 -31
- package/dist/tui/autocomplete.d.ts +44 -0
- package/dist/tui/autocomplete.d.ts.map +1 -0
- package/dist/tui/autocomplete.js +466 -0
- package/dist/tui/components/assistant-message.d.ts +18 -0
- package/dist/tui/components/assistant-message.d.ts.map +1 -0
- package/dist/tui/components/assistant-message.js +29 -0
- package/dist/tui/components/box.d.ts +20 -0
- package/dist/tui/components/box.d.ts.map +1 -0
- package/dist/tui/components/box.js +81 -0
- package/dist/tui/components/editor.d.ts +106 -0
- package/dist/tui/components/editor.d.ts.map +1 -0
- package/dist/tui/components/editor.js +1220 -0
- package/dist/tui/components/footer.d.ts +12 -0
- package/dist/tui/components/footer.d.ts.map +1 -0
- package/dist/tui/components/footer.js +209 -0
- package/dist/tui/components/header.d.ts +21 -0
- package/dist/tui/components/header.d.ts.map +1 -0
- package/dist/tui/components/header.js +63 -0
- package/dist/tui/components/input.d.ts +14 -0
- package/dist/tui/components/input.d.ts.map +1 -0
- package/dist/tui/components/input.js +122 -0
- package/dist/tui/components/loader.d.ts +23 -0
- package/dist/tui/components/loader.d.ts.map +1 -0
- package/dist/tui/components/loader.js +45 -0
- package/dist/tui/components/markdown.d.ts +106 -0
- package/dist/tui/components/markdown.d.ts.map +1 -0
- package/dist/tui/components/markdown.js +586 -0
- package/dist/tui/components/modal.d.ts +29 -0
- package/dist/tui/components/modal.d.ts.map +1 -0
- package/dist/tui/components/modal.js +263 -0
- package/dist/tui/components/progress-bar.d.ts +19 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/tui/components/progress-bar.js +78 -0
- package/dist/tui/components/prompt-status.d.ts +17 -0
- package/dist/tui/components/prompt-status.d.ts.map +1 -0
- package/dist/tui/components/prompt-status.js +26 -0
- package/dist/tui/components/select-list.d.ts +48 -0
- package/dist/tui/components/select-list.d.ts.map +1 -0
- package/dist/tui/components/select-list.js +207 -0
- package/dist/tui/components/spacer.d.ts +16 -0
- package/dist/tui/components/spacer.d.ts.map +1 -0
- package/dist/tui/components/spacer.js +27 -0
- package/dist/tui/components/table.d.ts +27 -0
- package/dist/tui/components/table.d.ts.map +1 -0
- package/dist/tui/components/table.js +125 -0
- package/dist/tui/components/text.d.ts +26 -0
- package/dist/tui/components/text.d.ts.map +1 -0
- package/dist/tui/components/text.js +143 -0
- package/dist/tui/components/thinking-block.d.ts +14 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -0
- package/dist/tui/components/thinking-block.js +33 -0
- package/dist/tui/components/tool-execution.d.ts +21 -0
- package/dist/tui/components/tool-execution.d.ts.map +1 -0
- package/dist/tui/components/tool-execution.js +161 -0
- package/dist/tui/components/user-message.d.ts +9 -0
- package/dist/tui/components/user-message.d.ts.map +1 -0
- package/dist/tui/components/user-message.js +23 -0
- package/dist/tui/components/welcome.d.ts +6 -0
- package/dist/tui/components/welcome.d.ts.map +1 -0
- package/dist/tui/components/welcome.js +30 -0
- package/dist/tui/index.d.ts +18 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +22 -0
- package/dist/tui/terminal.d.ts +38 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +94 -0
- package/dist/tui/tui.d.ts +69 -0
- package/dist/tui/tui.d.ts.map +1 -0
- package/dist/tui/tui.js +204 -0
- package/dist/tui/utils.d.ts +24 -0
- package/dist/tui/utils.d.ts.map +1 -0
- package/dist/tui/utils.js +111 -0
- package/dist/utils/bash.d.ts +7 -0
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +31 -12
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/utils/filesystem/security.d.ts +9 -0
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +93 -21
- package/dist/utils/funcs.d.ts +6 -0
- package/dist/utils/funcs.d.ts.map +1 -0
- package/dist/utils/funcs.js +6 -0
- package/dist/utils/generators.d.ts +3 -0
- package/dist/utils/generators.d.ts.map +1 -0
- package/dist/utils/generators.js +25 -0
- package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{tools/git-utils.js → utils/git.js} +0 -6
- package/dist/utils/glob.js +1 -1
- package/dist/utils/iterables.d.ts +2 -0
- package/dist/utils/iterables.d.ts.map +1 -0
- package/dist/utils/iterables.js +6 -0
- package/dist/utils/{zod-utils.d.ts → zod.d.ts} +1 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/package.json +21 -21
- package/dist/conversation-analyzer.d.ts +0 -11
- package/dist/conversation-analyzer.d.ts.map +0 -1
- package/dist/conversation-analyzer.js +0 -88
- package/dist/repl/display-tool-messages.d.ts +0 -4
- package/dist/repl/display-tool-messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.js +0 -55
- package/dist/repl/display-tool-use.d.ts +0 -14
- package/dist/repl/display-tool-use.d.ts.map +0 -1
- package/dist/repl/display-tool-use.js +0 -63
- package/dist/repl/get-prompt-header.d.ts +0 -8
- package/dist/repl/get-prompt-header.d.ts.map +0 -1
- package/dist/repl/get-prompt-header.js +0 -38
- package/dist/repl-prompt.d.ts +0 -15
- package/dist/repl-prompt.d.ts.map +0 -1
- package/dist/repl-prompt.js +0 -147
- package/dist/repl.d.ts +0 -31
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -310
- package/dist/terminal/checkbox-prompt.d.ts +0 -36
- package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
- package/dist/terminal/checkbox-prompt.js +0 -362
- package/dist/terminal/editor-prompt.d.ts +0 -10
- package/dist/terminal/editor-prompt.d.ts.map +0 -1
- package/dist/terminal/editor-prompt.js +0 -61
- package/dist/terminal/errors.d.ts +0 -19
- package/dist/terminal/errors.d.ts.map +0 -1
- package/dist/terminal/errors.js +0 -37
- package/dist/terminal/input-prompt.d.ts +0 -16
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/search-prompt.d.ts +0 -20
- package/dist/terminal/search-prompt.d.ts.map +0 -1
- package/dist/terminal/search-prompt.js +0 -279
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/terminal/types.js +0 -1
- package/dist/tokens/manage-output.d.ts +0 -34
- package/dist/tokens/manage-output.d.ts.map +0 -1
- package/dist/tokens/manage-output.js +0 -44
- package/dist/tool-executor.d.ts +0 -28
- package/dist/tool-executor.d.ts.map +0 -1
- package/dist/tool-executor.js +0 -74
- package/dist/tools/bash-utils.d.ts +0 -7
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/file-editing-utils.d.ts +0 -2
- package/dist/tools/file-editing-utils.d.ts.map +0 -1
- package/dist/tools/file-editing-utils.js +0 -135
- package/dist/tools/filesystem-utils.d.ts +0 -7
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
- /package/dist/utils/{zod-utils.js → zod.js} +0 -0
|
@@ -67,10 +67,14 @@ function findLastEnabledIndex(choices) {
|
|
|
67
67
|
}
|
|
68
68
|
return choices.length - 1;
|
|
69
69
|
}
|
|
70
|
-
function render(choices, pointerIndex, pageStart, pageSize, prompt, typed) {
|
|
70
|
+
function render(choices, pointerIndex, pageStart, pageSize, prompt, typed, totalChoices) {
|
|
71
71
|
const visible = choices.slice(pageStart, pageStart + pageSize);
|
|
72
72
|
const lines = [];
|
|
73
|
-
|
|
73
|
+
const searchInfo = typed ? ` (search: ${typed})` : "";
|
|
74
|
+
const filterInfo = typed && choices.length !== totalChoices
|
|
75
|
+
? ` [${choices.length}/${totalChoices}]`
|
|
76
|
+
: "";
|
|
77
|
+
lines.push(`${prompt}${searchInfo}${filterInfo}`);
|
|
74
78
|
for (let i = 0; i < visible.length; i++) {
|
|
75
79
|
const actualIndex = pageStart + i;
|
|
76
80
|
const ch = visible[i];
|
|
@@ -110,13 +114,20 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
110
114
|
if (!stdin.isTTY)
|
|
111
115
|
throw new Error("TTY required");
|
|
112
116
|
let searchBuffer = "";
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
const searchTimer = null;
|
|
118
|
+
let filteredChoices = [...normalized];
|
|
119
|
+
const clearSearchBuffer = () => {
|
|
120
|
+
searchBuffer = "";
|
|
121
|
+
filteredChoices = [...normalized];
|
|
122
|
+
// Reset pointer to first enabled choice when clearing search
|
|
123
|
+
pointer = findFirstEnabledIndex(filteredChoices);
|
|
124
|
+
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
125
|
+
renderToScreen();
|
|
126
|
+
};
|
|
127
|
+
const resetSearchTimer = () => {
|
|
115
128
|
if (searchTimer)
|
|
116
129
|
clearTimeout(searchTimer);
|
|
117
|
-
|
|
118
|
-
searchBuffer = "";
|
|
119
|
-
}, 800);
|
|
130
|
+
// Don't auto-clear the search buffer - let user clear it explicitly
|
|
120
131
|
};
|
|
121
132
|
let previousOutputLines = 0;
|
|
122
133
|
function clearPreviousOutput(lineCount) {
|
|
@@ -129,30 +140,26 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
129
140
|
stdout.write(ANSI.moveToStart);
|
|
130
141
|
stdout.write(ANSI.clearFromCursor);
|
|
131
142
|
clearPreviousOutput(previousOutputLines);
|
|
132
|
-
const out = render(
|
|
143
|
+
const out = render(filteredChoices, pointer, pageStart, pageSize, message, searchBuffer, normalized.length);
|
|
133
144
|
previousOutputLines = out.split("\n").length;
|
|
134
145
|
stdout.write(`${out}\n`);
|
|
135
146
|
}
|
|
136
147
|
function move(delta) {
|
|
137
|
-
pointer = findNextEnabledIndex(
|
|
138
|
-
pageStart = updatePageStart(pointer, pageSize,
|
|
148
|
+
pointer = findNextEnabledIndex(filteredChoices, pointer, delta);
|
|
149
|
+
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
139
150
|
renderToScreen();
|
|
140
151
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
for (let i = 0; i < normalized.length; i++) {
|
|
145
|
-
const idx = (start + i) % normalized.length;
|
|
146
|
-
if (normalized[idx].disabled)
|
|
147
|
-
continue;
|
|
148
|
-
if (normalized[idx].name.toLowerCase().startsWith(lowerPref)) {
|
|
149
|
-
pointer = idx;
|
|
150
|
-
pageStart = updatePageStart(pointer, pageSize, normalized.length);
|
|
151
|
-
renderToScreen();
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
152
|
+
function filterChoices(search) {
|
|
153
|
+
if (!search) {
|
|
154
|
+
filteredChoices = [...normalized];
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
+
else {
|
|
157
|
+
const lowerSearch = search.toLowerCase();
|
|
158
|
+
filteredChoices = normalized.filter((choice) => choice.name.toLowerCase().includes(lowerSearch));
|
|
159
|
+
}
|
|
160
|
+
// Reset pointer to first enabled choice
|
|
161
|
+
pointer = findFirstEnabledIndex(filteredChoices);
|
|
162
|
+
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
156
163
|
}
|
|
157
164
|
return new Promise((resolve, reject) => {
|
|
158
165
|
let resolved = false;
|
|
@@ -192,7 +199,7 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
192
199
|
}
|
|
193
200
|
if (key === Keys.enter || key === Keys.newline) {
|
|
194
201
|
cleanup();
|
|
195
|
-
const chosen =
|
|
202
|
+
const chosen = filteredChoices[pointer];
|
|
196
203
|
stdout.write("\n");
|
|
197
204
|
resolve(chosen.value);
|
|
198
205
|
return;
|
|
@@ -206,35 +213,34 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
206
213
|
return;
|
|
207
214
|
}
|
|
208
215
|
if (key === Keys.home || key === Keys.homeAlt) {
|
|
209
|
-
pointer = findFirstEnabledIndex(
|
|
210
|
-
pageStart = updatePageStart(pointer, pageSize,
|
|
216
|
+
pointer = findFirstEnabledIndex(filteredChoices);
|
|
217
|
+
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
211
218
|
renderToScreen();
|
|
212
219
|
return;
|
|
213
220
|
}
|
|
214
221
|
if (key === Keys.end || key === Keys.endAlt) {
|
|
215
|
-
pointer = findLastEnabledIndex(
|
|
216
|
-
pageStart = updatePageStart(pointer, pageSize,
|
|
222
|
+
pointer = findLastEnabledIndex(filteredChoices);
|
|
223
|
+
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
217
224
|
renderToScreen();
|
|
218
225
|
return;
|
|
219
226
|
}
|
|
220
227
|
if (key === Keys.backspace || key === Keys.backspaceAlt) {
|
|
221
228
|
if (searchBuffer.length > 0) {
|
|
222
229
|
searchBuffer = searchBuffer.slice(0, -1);
|
|
223
|
-
if (searchBuffer.length === 0)
|
|
224
|
-
|
|
225
|
-
|
|
230
|
+
if (searchBuffer.length === 0) {
|
|
231
|
+
clearSearchBuffer();
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
filterChoices(searchBuffer);
|
|
235
|
+
renderToScreen();
|
|
236
|
+
}
|
|
226
237
|
}
|
|
227
238
|
return;
|
|
228
239
|
}
|
|
229
240
|
if (key && key >= " " && key <= "~") {
|
|
230
241
|
searchBuffer += key;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (!found) {
|
|
234
|
-
searchBuffer = key;
|
|
235
|
-
resetSearchBuffer();
|
|
236
|
-
jumpToIndexStartingWith(searchBuffer);
|
|
237
|
-
}
|
|
242
|
+
resetSearchTimer();
|
|
243
|
+
filterChoices(searchBuffer);
|
|
238
244
|
renderToScreen();
|
|
239
245
|
return;
|
|
240
246
|
}
|
|
@@ -244,6 +250,8 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
244
250
|
stdin.resume();
|
|
245
251
|
stdin.setEncoding("utf8");
|
|
246
252
|
stdout.write(ANSI.hideCursor);
|
|
253
|
+
// Reset previous output lines counter to ensure clean start
|
|
254
|
+
previousOutputLines = 0;
|
|
247
255
|
renderToScreen();
|
|
248
256
|
stdin.on("data", onData);
|
|
249
257
|
const exitHandler = () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Inline from sindresorhus/strip-ansi v7.1.0
|
|
2
2
|
const ansiRegex = ({ onlyFirst = false } = {}) => {
|
|
3
|
-
// Valid string terminator sequences are BEL, ESC
|
|
4
|
-
const St = "(
|
|
3
|
+
// Valid string terminator sequences are BEL, ESC\\, and 0x9c
|
|
4
|
+
const St = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
5
5
|
// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)
|
|
6
|
-
const osc = `(
|
|
6
|
+
const osc = `(?:\\u001B\\][\\s\\S]*?${St})`;
|
|
7
7
|
// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
|
|
8
|
-
const csi = "[
|
|
8
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
9
9
|
const pattern = `${osc}|${csi}`;
|
|
10
10
|
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
11
11
|
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type CellOptions, type CharName, type HorizontalAlignment, type TableInstanceOptions, type VerticalAlignment } from "./utils.ts";
|
|
2
|
+
export declare class Cell {
|
|
3
|
+
options: CellOptions;
|
|
4
|
+
content: string;
|
|
5
|
+
colSpan: number;
|
|
6
|
+
rowSpan: number;
|
|
7
|
+
x: number | null;
|
|
8
|
+
y: number | null;
|
|
9
|
+
chars: Record<CharName, string>;
|
|
10
|
+
truncate: string;
|
|
11
|
+
paddingLeft: number;
|
|
12
|
+
paddingRight: number;
|
|
13
|
+
head: string[];
|
|
14
|
+
border: string[];
|
|
15
|
+
fixedWidth: number | null;
|
|
16
|
+
lines: string[];
|
|
17
|
+
desiredWidth: number;
|
|
18
|
+
desiredHeight: number;
|
|
19
|
+
widths: number[];
|
|
20
|
+
heights: number[];
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
hAlign: HorizontalAlignment;
|
|
24
|
+
vAlign: VerticalAlignment;
|
|
25
|
+
drawRight: boolean;
|
|
26
|
+
cells: Cell[][] | null;
|
|
27
|
+
/**
|
|
28
|
+
* A representation of a cell within the table.
|
|
29
|
+
* Implementations must have `init` and `draw` methods,
|
|
30
|
+
* as well as `colSpan`, `rowSpan`, `desiredHeight` and `desiredWidth` properties.
|
|
31
|
+
*/
|
|
32
|
+
constructor(options: CellOptions | string | number | boolean | bigint);
|
|
33
|
+
setOptions(options: CellOptions | string | number | boolean | bigint): void;
|
|
34
|
+
mergeTableOptions(tableOptions: TableInstanceOptions, cells: Cell[][]): void;
|
|
35
|
+
computeLines(tableOptions: TableInstanceOptions): string[];
|
|
36
|
+
wrapLines(computedLines: string[]): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Initializes the Cells data structure.
|
|
39
|
+
*
|
|
40
|
+
* @param tableOptions - A fully populated set of tableOptions.
|
|
41
|
+
* In addition to the standard default values, tableOptions must have fully populated the
|
|
42
|
+
* `colWidths` and `rowWidths` arrays. Those arrays must have lengths equal to the number
|
|
43
|
+
* of columns or rows (respectively) in this table, and each array item must be a Number.
|
|
44
|
+
*/
|
|
45
|
+
init(tableOptions: TableInstanceOptions): void;
|
|
46
|
+
/**
|
|
47
|
+
* Draws the given line of the cell.
|
|
48
|
+
* This default implementation defers to methods `drawTop`, `drawBottom`, `drawLine` and `drawEmpty`.
|
|
49
|
+
* @param lineNum - can be `top`, `bottom` or a numerical line number.
|
|
50
|
+
* @param spanningCell - will be a number if being called from a RowSpanCell, and will represent how
|
|
51
|
+
* many rows below it's being called from. Otherwise it's undefined.
|
|
52
|
+
* @returns {String} The representation of this line.
|
|
53
|
+
*/
|
|
54
|
+
draw(lineNum: "top" | "bottom" | number, spanningCell?: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* Renders the top line of the cell.
|
|
57
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
58
|
+
* @returns {String}
|
|
59
|
+
*/
|
|
60
|
+
drawTop(drawRight: boolean): string;
|
|
61
|
+
_topLeftChar(offset: number): string;
|
|
62
|
+
wrapWithStyleColors(styleProperty: "head" | "border", content: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Renders a line of text.
|
|
65
|
+
* @param lineNum - Which line of text to render. This is not necessarily the line within the cell.
|
|
66
|
+
* There may be top-padding above the first line of text.
|
|
67
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
68
|
+
* @param forceTruncationSymbol - `true` if the rendered text should end with the truncation symbol even
|
|
69
|
+
* if the text fits. This is used when the cell is vertically truncated. If `false` the text should
|
|
70
|
+
* only include the truncation symbol if the text will not fit horizontally within the cell width.
|
|
71
|
+
* @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
|
|
72
|
+
* @returns {String}
|
|
73
|
+
*/
|
|
74
|
+
drawLine(lineNum: number, drawRight: boolean, forceTruncationSymbol: boolean, spanningCell?: number): string;
|
|
75
|
+
stylizeLine(left: string, content: string, right: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Renders the bottom line of the cell.
|
|
78
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
79
|
+
* @returns {String}
|
|
80
|
+
*/
|
|
81
|
+
drawBottom(drawRight: boolean): string;
|
|
82
|
+
/**
|
|
83
|
+
* Renders a blank line of text within the cell. Used for top and/or bottom padding.
|
|
84
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
85
|
+
* @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
|
|
86
|
+
* @returns {String}
|
|
87
|
+
*/
|
|
88
|
+
drawEmpty(drawRight: boolean, spanningCell?: number): string;
|
|
89
|
+
}
|
|
90
|
+
export declare class ColSpanCell {
|
|
91
|
+
x: number | null;
|
|
92
|
+
y: number | null;
|
|
93
|
+
colSpan: number;
|
|
94
|
+
draw(lineNum: "top" | "bottom" | number): string;
|
|
95
|
+
init(): void;
|
|
96
|
+
mergeTableOptions(): void;
|
|
97
|
+
}
|
|
98
|
+
export declare class RowSpanCell {
|
|
99
|
+
originalCell: Cell;
|
|
100
|
+
x: number | null;
|
|
101
|
+
y: number | null;
|
|
102
|
+
colSpan: number;
|
|
103
|
+
cellOffset: number;
|
|
104
|
+
offset: number;
|
|
105
|
+
/**
|
|
106
|
+
* A placeholder Cell for a Cell that spans multiple rows.
|
|
107
|
+
* It delegates rendering to the original cell, but adds the appropriate offset.
|
|
108
|
+
*/
|
|
109
|
+
constructor(originalCell: Cell);
|
|
110
|
+
init(tableOptions: TableInstanceOptions): void;
|
|
111
|
+
draw(lineNum: "top" | "bottom" | number): string;
|
|
112
|
+
mergeTableOptions(): void;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=cell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../../../source/terminal/table/cell.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEb,KAAK,mBAAmB,EAMxB,KAAK,oBAAoB,EAEzB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAoBpB,qBAAa,IAAI;IACf,OAAO,EAAG,WAAW,CA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