@travisennis/acai 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -19
- package/bin/acai-wrapper.js +26 -0
- package/dist/agent/index.d.ts +132 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +434 -0
- package/dist/api/exa/index.js +1 -1
- package/dist/cli.d.ts +4 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +67 -40
- package/dist/commands/add-directory-command.d.ts +3 -0
- package/dist/commands/add-directory-command.d.ts.map +1 -0
- package/dist/commands/add-directory-command.js +54 -0
- package/dist/commands/application-log-command.d.ts +1 -1
- package/dist/commands/application-log-command.d.ts.map +1 -1
- package/dist/commands/application-log-command.js +18 -20
- package/dist/commands/clear-command.d.ts +1 -1
- package/dist/commands/clear-command.d.ts.map +1 -1
- package/dist/commands/clear-command.js +7 -3
- package/dist/commands/compact-command.d.ts.map +1 -1
- package/dist/commands/compact-command.js +9 -5
- package/dist/commands/context-command.d.ts +3 -0
- package/dist/commands/context-command.d.ts.map +1 -0
- package/dist/commands/context-command.js +124 -0
- package/dist/commands/copy-command.d.ts.map +1 -1
- package/dist/commands/copy-command.js +14 -5
- package/dist/commands/edit-command.d.ts +1 -1
- package/dist/commands/edit-command.d.ts.map +1 -1
- package/dist/commands/edit-command.js +21 -34
- package/dist/commands/edit-prompt-command.d.ts +1 -1
- package/dist/commands/edit-prompt-command.d.ts.map +1 -1
- package/dist/commands/edit-prompt-command.js +18 -15
- package/dist/commands/exit-command.d.ts +1 -4
- package/dist/commands/exit-command.d.ts.map +1 -1
- package/dist/commands/exit-command.js +9 -5
- package/dist/commands/files-command.d.ts +1 -1
- package/dist/commands/files-command.d.ts.map +1 -1
- package/dist/commands/files-command.js +20 -16
- package/dist/commands/generate-rules-command.d.ts +1 -1
- package/dist/commands/generate-rules-command.d.ts.map +1 -1
- package/dist/commands/generate-rules-command.js +307 -39
- package/dist/commands/handoff-command.d.ts +3 -0
- package/dist/commands/handoff-command.d.ts.map +1 -0
- package/dist/commands/handoff-command.js +191 -0
- package/dist/commands/health-command.d.ts +1 -1
- package/dist/commands/health-command.d.ts.map +1 -1
- package/dist/commands/health-command.js +49 -27
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +25 -5
- package/dist/commands/history-command.d.ts +3 -0
- package/dist/commands/history-command.d.ts.map +1 -0
- package/dist/commands/history-command.js +458 -0
- package/dist/commands/init-command.d.ts +1 -1
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/init-command.js +40 -22
- package/dist/commands/last-log-command.d.ts +1 -1
- package/dist/commands/last-log-command.d.ts.map +1 -1
- package/dist/commands/last-log-command.js +15 -15
- package/dist/commands/list-directories-command.d.ts +3 -0
- package/dist/commands/list-directories-command.d.ts.map +1 -0
- package/dist/commands/list-directories-command.js +35 -0
- package/dist/commands/list-tools-command.d.ts.map +1 -1
- package/dist/commands/list-tools-command.js +61 -21
- package/dist/commands/manager.d.ts +9 -4
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +64 -39
- package/dist/commands/model-command.d.ts.map +1 -1
- package/dist/commands/model-command.js +201 -66
- package/dist/commands/paste-command.d.ts +1 -1
- package/dist/commands/paste-command.d.ts.map +1 -1
- package/dist/commands/paste-command.js +23 -9
- package/dist/commands/pickup-command.d.ts +3 -0
- package/dist/commands/pickup-command.d.ts.map +1 -0
- package/dist/commands/pickup-command.js +109 -0
- package/dist/commands/prompt-command.d.ts +19 -1
- package/dist/commands/prompt-command.d.ts.map +1 -1
- package/dist/commands/prompt-command.js +191 -98
- package/dist/commands/remove-directory-command.d.ts +3 -0
- package/dist/commands/remove-directory-command.d.ts.map +1 -0
- package/dist/commands/remove-directory-command.js +55 -0
- package/dist/commands/reset-command.d.ts +1 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/reset-command.js +8 -5
- package/dist/commands/rules-command.d.ts +1 -1
- package/dist/commands/rules-command.d.ts.map +1 -1
- package/dist/commands/rules-command.js +25 -22
- package/dist/commands/save-command.d.ts +1 -1
- package/dist/commands/save-command.d.ts.map +1 -1
- package/dist/commands/save-command.js +8 -3
- package/dist/commands/shell-command.d.ts.map +1 -1
- package/dist/commands/shell-command.js +45 -24
- package/dist/commands/types.d.ts +9 -7
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/usage-command.d.ts +1 -1
- package/dist/commands/usage-command.d.ts.map +1 -1
- package/dist/commands/usage-command.js +18 -7
- package/dist/config.d.ts +21 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +90 -63
- package/dist/execution/index.d.ts +17 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +62 -20
- package/dist/formatting.d.ts +127 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +201 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +263 -102
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +47 -18
- package/dist/mentions.d.ts +2 -1
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +16 -1
- package/dist/messages.d.ts +11 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +122 -21
- package/dist/middleware/cache.d.ts +3 -0
- package/dist/middleware/cache.d.ts.map +1 -0
- package/dist/middleware/cache.js +53 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -0
- package/dist/models/ai-config.d.ts +4 -2
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +12 -2
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +3 -67
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -3
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/manager.d.ts +2 -1
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +26 -2
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/openrouter-provider.d.ts +16 -22
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +175 -236
- package/dist/models/providers.d.ts +4 -14
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +1 -57
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts.d.ts +10 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +447 -70
- package/dist/repl/project-status-line.d.ts +3 -0
- package/dist/repl/project-status-line.d.ts.map +1 -0
- package/dist/repl/project-status-line.js +61 -0
- package/dist/repl/tool-call-repair.d.ts.map +1 -1
- package/dist/repl/tool-call-repair.js +8 -4
- package/dist/repl-new.d.ts +51 -0
- package/dist/repl-new.d.ts.map +1 -0
- package/dist/repl-new.js +354 -0
- package/dist/skills.d.ts +20 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +192 -0
- package/dist/terminal/control.d.ts +55 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +109 -0
- package/dist/terminal/default-theme.d.ts +1 -1
- package/dist/terminal/default-theme.d.ts.map +1 -1
- package/dist/terminal/default-theme.js +24 -28
- package/dist/terminal/formatting.d.ts +23 -25
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -52
- package/dist/terminal/highlight/index.d.ts.map +1 -1
- package/dist/terminal/highlight/index.js +3 -6
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +2 -6
- package/dist/terminal/index.d.ts +2 -94
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -370
- package/dist/terminal/markdown.js +10 -5
- package/dist/terminal/select-prompt.d.ts +2 -2
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +47 -39
- package/dist/terminal/strip-ansi.js +4 -4
- package/dist/terminal/table/cell.d.ts +114 -0
- package/dist/terminal/table/cell.d.ts.map +1 -0
- package/dist/terminal/table/cell.js +407 -0
- package/dist/terminal/table/debug.d.ts +15 -0
- package/dist/terminal/table/debug.d.ts.map +1 -0
- package/dist/terminal/table/debug.js +32 -0
- package/dist/terminal/table/index.d.ts +3 -0
- package/dist/terminal/table/index.d.ts.map +1 -0
- package/dist/terminal/table/index.js +2 -0
- package/dist/terminal/table/layout-manager.d.ts +27 -0
- package/dist/terminal/table/layout-manager.d.ts.map +1 -0
- package/dist/terminal/table/layout-manager.js +257 -0
- package/dist/terminal/table/table.d.ts +9 -0
- package/dist/terminal/table/table.d.ts.map +1 -0
- package/dist/terminal/table/table.js +97 -0
- package/dist/terminal/table/utils.d.ts +63 -0
- package/dist/terminal/table/utils.d.ts.map +1 -0
- package/dist/terminal/table/utils.js +326 -0
- package/dist/tokens/threshold.d.ts +20 -0
- package/dist/tokens/threshold.d.ts.map +1 -0
- package/dist/tokens/threshold.js +67 -0
- package/dist/tools/advanced-edit-file.d.ts +69 -0
- package/dist/tools/advanced-edit-file.d.ts.map +1 -0
- package/dist/tools/advanced-edit-file.js +285 -0
- package/dist/tools/agent.d.ts +16 -5
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +86 -59
- package/dist/tools/bash.d.ts +23 -12
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +243 -128
- package/dist/tools/batch.d.ts +34 -0
- package/dist/tools/batch.d.ts.map +1 -0
- package/dist/tools/batch.js +174 -0
- package/dist/tools/code-interpreter.d.ts +21 -9
- package/dist/tools/code-interpreter.d.ts.map +1 -1
- package/dist/tools/code-interpreter.js +151 -134
- package/dist/tools/delete-file.d.ts +17 -10
- package/dist/tools/delete-file.d.ts.map +1 -1
- package/dist/tools/delete-file.js +60 -97
- package/dist/tools/directory-tree.d.ts +17 -12
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +57 -48
- package/dist/tools/dynamic-tool-loader.d.ts +16 -10
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +122 -130
- package/dist/tools/dynamic-tool-parser.d.ts +1 -0
- package/dist/tools/dynamic-tool-parser.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-parser.js +1 -0
- package/dist/tools/edit-file.d.ts +35 -15
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +127 -114
- package/dist/tools/glob.d.ts +36 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/glob.js +154 -0
- package/dist/tools/grep.d.ts +73 -12
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +425 -165
- package/dist/tools/index.d.ts +220 -126
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +284 -135
- package/dist/tools/llm-edit-fixer.d.ts +24 -0
- package/dist/tools/llm-edit-fixer.d.ts.map +1 -0
- package/dist/tools/llm-edit-fixer.js +136 -0
- package/dist/tools/move-file.d.ts +19 -7
- package/dist/tools/move-file.d.ts.map +1 -1
- package/dist/tools/move-file.js +48 -34
- package/dist/tools/read-file.d.ts +47 -9
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +84 -70
- package/dist/tools/read-multiple-files.d.ts +17 -6
- package/dist/tools/read-multiple-files.d.ts.map +1 -1
- package/dist/tools/read-multiple-files.js +132 -72
- package/dist/tools/save-file.d.ts +45 -12
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +76 -101
- package/dist/tools/think.d.ts +15 -7
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +34 -20
- package/dist/tools/types.d.ts +8 -10
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +9 -0
- package/dist/tools/utils.d.ts +14 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +16 -0
- package/dist/tools/web-fetch.d.ts +11 -4
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +39 -38
- package/dist/tools/web-search.d.ts +15 -6
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +64 -31
- package/dist/tui/autocomplete.d.ts +44 -0
- package/dist/tui/autocomplete.d.ts.map +1 -0
- package/dist/tui/autocomplete.js +466 -0
- package/dist/tui/components/assistant-message.d.ts +18 -0
- package/dist/tui/components/assistant-message.d.ts.map +1 -0
- package/dist/tui/components/assistant-message.js +29 -0
- package/dist/tui/components/box.d.ts +20 -0
- package/dist/tui/components/box.d.ts.map +1 -0
- package/dist/tui/components/box.js +81 -0
- package/dist/tui/components/editor.d.ts +106 -0
- package/dist/tui/components/editor.d.ts.map +1 -0
- package/dist/tui/components/editor.js +1220 -0
- package/dist/tui/components/footer.d.ts +12 -0
- package/dist/tui/components/footer.d.ts.map +1 -0
- package/dist/tui/components/footer.js +209 -0
- package/dist/tui/components/header.d.ts +21 -0
- package/dist/tui/components/header.d.ts.map +1 -0
- package/dist/tui/components/header.js +63 -0
- package/dist/tui/components/input.d.ts +14 -0
- package/dist/tui/components/input.d.ts.map +1 -0
- package/dist/tui/components/input.js +122 -0
- package/dist/tui/components/loader.d.ts +23 -0
- package/dist/tui/components/loader.d.ts.map +1 -0
- package/dist/tui/components/loader.js +45 -0
- package/dist/tui/components/markdown.d.ts +106 -0
- package/dist/tui/components/markdown.d.ts.map +1 -0
- package/dist/tui/components/markdown.js +586 -0
- package/dist/tui/components/modal.d.ts +29 -0
- package/dist/tui/components/modal.d.ts.map +1 -0
- package/dist/tui/components/modal.js +263 -0
- package/dist/tui/components/progress-bar.d.ts +19 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/tui/components/progress-bar.js +78 -0
- package/dist/tui/components/prompt-status.d.ts +17 -0
- package/dist/tui/components/prompt-status.d.ts.map +1 -0
- package/dist/tui/components/prompt-status.js +26 -0
- package/dist/tui/components/select-list.d.ts +48 -0
- package/dist/tui/components/select-list.d.ts.map +1 -0
- package/dist/tui/components/select-list.js +207 -0
- package/dist/tui/components/spacer.d.ts +16 -0
- package/dist/tui/components/spacer.d.ts.map +1 -0
- package/dist/tui/components/spacer.js +27 -0
- package/dist/tui/components/table.d.ts +27 -0
- package/dist/tui/components/table.d.ts.map +1 -0
- package/dist/tui/components/table.js +125 -0
- package/dist/tui/components/text.d.ts +26 -0
- package/dist/tui/components/text.d.ts.map +1 -0
- package/dist/tui/components/text.js +143 -0
- package/dist/tui/components/thinking-block.d.ts +14 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -0
- package/dist/tui/components/thinking-block.js +33 -0
- package/dist/tui/components/tool-execution.d.ts +21 -0
- package/dist/tui/components/tool-execution.d.ts.map +1 -0
- package/dist/tui/components/tool-execution.js +161 -0
- package/dist/tui/components/user-message.d.ts +9 -0
- package/dist/tui/components/user-message.d.ts.map +1 -0
- package/dist/tui/components/user-message.js +23 -0
- package/dist/tui/components/welcome.d.ts +6 -0
- package/dist/tui/components/welcome.d.ts.map +1 -0
- package/dist/tui/components/welcome.js +30 -0
- package/dist/tui/index.d.ts +18 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +22 -0
- package/dist/tui/terminal.d.ts +38 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +94 -0
- package/dist/tui/tui.d.ts +69 -0
- package/dist/tui/tui.d.ts.map +1 -0
- package/dist/tui/tui.js +204 -0
- package/dist/tui/utils.d.ts +24 -0
- package/dist/tui/utils.d.ts.map +1 -0
- package/dist/tui/utils.js +111 -0
- package/dist/utils/bash.d.ts +7 -0
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +31 -12
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/utils/filesystem/security.d.ts +9 -0
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +93 -21
- package/dist/utils/funcs.d.ts +6 -0
- package/dist/utils/funcs.d.ts.map +1 -0
- package/dist/utils/funcs.js +6 -0
- package/dist/utils/generators.d.ts +3 -0
- package/dist/utils/generators.d.ts.map +1 -0
- package/dist/utils/generators.js +25 -0
- package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{tools/git-utils.js → utils/git.js} +0 -6
- package/dist/utils/glob.js +1 -1
- package/dist/utils/iterables.d.ts +2 -0
- package/dist/utils/iterables.d.ts.map +1 -0
- package/dist/utils/iterables.js +6 -0
- package/dist/utils/{zod-utils.d.ts → zod.d.ts} +1 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/package.json +21 -21
- package/dist/conversation-analyzer.d.ts +0 -11
- package/dist/conversation-analyzer.d.ts.map +0 -1
- package/dist/conversation-analyzer.js +0 -88
- package/dist/repl/display-tool-messages.d.ts +0 -4
- package/dist/repl/display-tool-messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.js +0 -55
- package/dist/repl/display-tool-use.d.ts +0 -14
- package/dist/repl/display-tool-use.d.ts.map +0 -1
- package/dist/repl/display-tool-use.js +0 -63
- package/dist/repl/get-prompt-header.d.ts +0 -8
- package/dist/repl/get-prompt-header.d.ts.map +0 -1
- package/dist/repl/get-prompt-header.js +0 -38
- package/dist/repl-prompt.d.ts +0 -15
- package/dist/repl-prompt.d.ts.map +0 -1
- package/dist/repl-prompt.js +0 -147
- package/dist/repl.d.ts +0 -31
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -310
- package/dist/terminal/checkbox-prompt.d.ts +0 -36
- package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
- package/dist/terminal/checkbox-prompt.js +0 -362
- package/dist/terminal/editor-prompt.d.ts +0 -10
- package/dist/terminal/editor-prompt.d.ts.map +0 -1
- package/dist/terminal/editor-prompt.js +0 -61
- package/dist/terminal/errors.d.ts +0 -19
- package/dist/terminal/errors.d.ts.map +0 -1
- package/dist/terminal/errors.js +0 -37
- package/dist/terminal/input-prompt.d.ts +0 -16
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/search-prompt.d.ts +0 -20
- package/dist/terminal/search-prompt.d.ts.map +0 -1
- package/dist/terminal/search-prompt.js +0 -279
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/terminal/types.js +0 -1
- package/dist/tokens/manage-output.d.ts +0 -34
- package/dist/tokens/manage-output.d.ts.map +0 -1
- package/dist/tokens/manage-output.js +0 -44
- package/dist/tool-executor.d.ts +0 -28
- package/dist/tool-executor.d.ts.map +0 -1
- package/dist/tool-executor.js +0 -74
- package/dist/tools/bash-utils.d.ts +0 -7
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/file-editing-utils.d.ts +0 -2
- package/dist/tools/file-editing-utils.d.ts.map +0 -1
- package/dist/tools/file-editing-utils.js +0 -135
- package/dist/tools/filesystem-utils.d.ts +0 -7
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
- /package/dist/utils/{zod-utils.js → zod.js} +0 -0
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Standalone checkbox prompt (inquirer-like)
|
|
4
|
-
* - TypeScript version
|
|
5
|
-
*/
|
|
6
|
-
import { isAbortError, isCancelError, PromptAbortError, PromptCancelError, } from "./errors.js";
|
|
7
|
-
const Keys = {
|
|
8
|
-
up: "\x1b[A",
|
|
9
|
-
down: "\x1b[B",
|
|
10
|
-
home: "\x1b[H",
|
|
11
|
-
homeAlt: "\x1b[1~",
|
|
12
|
-
end: "\x1b[F",
|
|
13
|
-
endAlt: "\x1b[4~",
|
|
14
|
-
ctrlC: "\u0003",
|
|
15
|
-
enter: "\r",
|
|
16
|
-
newline: "\n",
|
|
17
|
-
backspace: "\x7f",
|
|
18
|
-
backspaceAlt: "\b",
|
|
19
|
-
};
|
|
20
|
-
const ANSI = {
|
|
21
|
-
hideCursor: "\x1b[?25l",
|
|
22
|
-
showCursor: "\x1b[?25h",
|
|
23
|
-
clearLine: "\x1b[2K",
|
|
24
|
-
carriageReturn: "\r",
|
|
25
|
-
moveToStart: "\x1b[0G",
|
|
26
|
-
clearFromCursor: "\x1b[0J",
|
|
27
|
-
moveUp: "\x1b[1A",
|
|
28
|
-
cyan: "\x1b[36m",
|
|
29
|
-
dim: "\x1b[2m",
|
|
30
|
-
reset: "\x1b[0m",
|
|
31
|
-
};
|
|
32
|
-
function normalizeChoice(choice) {
|
|
33
|
-
if (typeof choice === "string") {
|
|
34
|
-
return {
|
|
35
|
-
name: choice,
|
|
36
|
-
value: choice,
|
|
37
|
-
disabled: false,
|
|
38
|
-
checked: false,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const { name, value, disabled = false, checked = false } = choice;
|
|
42
|
-
return { name, value, disabled, checked };
|
|
43
|
-
}
|
|
44
|
-
function updatePageStart(pointerIndex, pageSize, totalItems) {
|
|
45
|
-
const currentPage = Math.floor(pointerIndex / pageSize);
|
|
46
|
-
const pageStart = currentPage * pageSize;
|
|
47
|
-
return Math.max(0, Math.min(pageStart, Math.max(0, totalItems - pageSize)));
|
|
48
|
-
}
|
|
49
|
-
function findNextEnabledIndex(choices, startIndex, direction) {
|
|
50
|
-
const len = choices.length;
|
|
51
|
-
let index = startIndex;
|
|
52
|
-
for (let i = 0; i < len; i++) {
|
|
53
|
-
index = (index + direction + len) % len;
|
|
54
|
-
if (!choices[index].disabled) {
|
|
55
|
-
return index;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return startIndex;
|
|
59
|
-
}
|
|
60
|
-
function findFirstEnabledIndex(choices) {
|
|
61
|
-
for (let i = 0; i < choices.length; i++) {
|
|
62
|
-
if (!choices[i].disabled) {
|
|
63
|
-
return i;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return 0;
|
|
67
|
-
}
|
|
68
|
-
function findLastEnabledIndex(choices) {
|
|
69
|
-
for (let i = choices.length - 1; i >= 0; i--) {
|
|
70
|
-
if (!choices[i].disabled) {
|
|
71
|
-
return i;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return choices.length - 1;
|
|
75
|
-
}
|
|
76
|
-
function render(choices, pointerIndex, pageStart, pageSize, prompt, typed, requiredError = false) {
|
|
77
|
-
const visible = choices.slice(pageStart, pageStart + pageSize);
|
|
78
|
-
const lines = [];
|
|
79
|
-
lines.push(`${prompt}${typed ? ` (search: ${typed})` : ""}`);
|
|
80
|
-
if (requiredError) {
|
|
81
|
-
lines.push(`${ANSI.dim}At least one option must be selected${ANSI.reset}`);
|
|
82
|
-
}
|
|
83
|
-
for (let i = 0; i < visible.length; i++) {
|
|
84
|
-
const actualIndex = pageStart + i;
|
|
85
|
-
const ch = visible[i];
|
|
86
|
-
const prefix = actualIndex === pointerIndex ? "›" : " ";
|
|
87
|
-
const checkbox = ch.checked ? "[x]" : "[ ]";
|
|
88
|
-
if (ch.disabled) {
|
|
89
|
-
lines.push(` ${prefix} ${checkbox} ${ch.name} (disabled)`);
|
|
90
|
-
}
|
|
91
|
-
else if (actualIndex === pointerIndex) {
|
|
92
|
-
lines.push(`${ANSI.cyan} ${prefix} ${checkbox} ${ch.name}${ANSI.reset}`);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
lines.push(` ${prefix} ${checkbox} ${ch.name}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (choices.length > pageSize) {
|
|
99
|
-
const pageCount = Math.ceil(choices.length / pageSize);
|
|
100
|
-
const currentPage = Math.ceil(pageStart / pageSize) + 1;
|
|
101
|
-
lines.push(`${ANSI.dim}Page ${currentPage}/${pageCount}${ANSI.reset}`);
|
|
102
|
-
}
|
|
103
|
-
// Add keyboard shortcuts help
|
|
104
|
-
lines.push("");
|
|
105
|
-
lines.push(`${ANSI.dim}Controls: ↑↓ move, space toggle, a select all, i invert, enter confirm, ctrl+c cancel${ANSI.reset}`);
|
|
106
|
-
return lines.join("\n");
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Interactive checkbox prompt for selecting multiple options
|
|
110
|
-
* @param options Configuration options for the checkbox prompt
|
|
111
|
-
* @returns Promise resolving to array of selected values
|
|
112
|
-
* @throws {PromptCancelError} When user cancels with Ctrl+C
|
|
113
|
-
* @throws {PromptAbortError} When signal is aborted
|
|
114
|
-
*/
|
|
115
|
-
export async function checkbox({ message = "Select", choices, initial = 0, pageSize = 7, required = false, signal, terminal = { stdin: process.stdin, stdout: process.stdout }, }) {
|
|
116
|
-
if (!Array.isArray(choices) || choices.length === 0) {
|
|
117
|
-
throw new Error("choices must be a non-empty array");
|
|
118
|
-
}
|
|
119
|
-
const normalized = choices.map(normalizeChoice);
|
|
120
|
-
const hasEnabledChoice = normalized.some((ch) => !ch.disabled);
|
|
121
|
-
if (!hasEnabledChoice) {
|
|
122
|
-
throw new Error("At least one choice must be enabled");
|
|
123
|
-
}
|
|
124
|
-
let pointer = Math.max(0, Math.min(Math.floor(initial ?? 0), normalized.length - 1));
|
|
125
|
-
if (normalized[pointer].disabled) {
|
|
126
|
-
pointer = findNextEnabledIndex(normalized, pointer, 1);
|
|
127
|
-
}
|
|
128
|
-
let pageStart = updatePageStart(pointer, pageSize, normalized.length);
|
|
129
|
-
const { stdin, stdout } = terminal;
|
|
130
|
-
if (!stdin.isTTY) {
|
|
131
|
-
throw new Error("TTY required");
|
|
132
|
-
}
|
|
133
|
-
stdin.setRawMode(true);
|
|
134
|
-
stdin.resume();
|
|
135
|
-
stdin.setEncoding("utf8");
|
|
136
|
-
let searchBuffer = "";
|
|
137
|
-
let searchTimer = null;
|
|
138
|
-
let requiredError = false;
|
|
139
|
-
const resetSearchBuffer = () => {
|
|
140
|
-
if (searchTimer)
|
|
141
|
-
clearTimeout(searchTimer);
|
|
142
|
-
searchTimer = setTimeout(() => {
|
|
143
|
-
searchBuffer = "";
|
|
144
|
-
}, 800);
|
|
145
|
-
};
|
|
146
|
-
let previousOutputLines = 0;
|
|
147
|
-
function renderToScreen() {
|
|
148
|
-
stdout.write(ANSI.clearLine);
|
|
149
|
-
stdout.write(ANSI.moveToStart);
|
|
150
|
-
stdout.write(ANSI.clearFromCursor);
|
|
151
|
-
// Clear previous output by moving up and clearing lines
|
|
152
|
-
for (let i = 0; i < previousOutputLines; i++) {
|
|
153
|
-
stdout.write(ANSI.moveUp);
|
|
154
|
-
stdout.write(ANSI.clearLine);
|
|
155
|
-
}
|
|
156
|
-
const out = render(normalized, pointer, pageStart, pageSize, message, searchBuffer, requiredError);
|
|
157
|
-
// Count lines in current output
|
|
158
|
-
previousOutputLines = out.split("\n").length;
|
|
159
|
-
stdout.write(`${out}\n`);
|
|
160
|
-
}
|
|
161
|
-
function move(delta) {
|
|
162
|
-
pointer = findNextEnabledIndex(normalized, pointer, delta);
|
|
163
|
-
pageStart = updatePageStart(pointer, pageSize, normalized.length);
|
|
164
|
-
renderToScreen();
|
|
165
|
-
}
|
|
166
|
-
function jumpToIndexStartingWith(prefix) {
|
|
167
|
-
const start = (pointer + 1) % normalized.length;
|
|
168
|
-
const lowerPref = prefix.toLowerCase();
|
|
169
|
-
for (let i = 0; i < normalized.length; i++) {
|
|
170
|
-
const idx = (start + i) % normalized.length;
|
|
171
|
-
if (normalized[idx].disabled)
|
|
172
|
-
continue;
|
|
173
|
-
if (normalized[idx].name.toLowerCase().startsWith(lowerPref)) {
|
|
174
|
-
pointer = idx;
|
|
175
|
-
pageStart = updatePageStart(pointer, pageSize, normalized.length);
|
|
176
|
-
renderToScreen();
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
function toggleCurrent() {
|
|
183
|
-
if (!normalized[pointer].disabled) {
|
|
184
|
-
normalized[pointer].checked = !normalized[pointer].checked;
|
|
185
|
-
renderToScreen();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function toggleAll() {
|
|
189
|
-
const allChecked = normalized.every((ch) => ch.disabled || ch.checked);
|
|
190
|
-
normalized.forEach((ch) => {
|
|
191
|
-
if (!ch.disabled) {
|
|
192
|
-
ch.checked = !allChecked;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
renderToScreen();
|
|
196
|
-
}
|
|
197
|
-
function invertSelection() {
|
|
198
|
-
normalized.forEach((ch) => {
|
|
199
|
-
if (!ch.disabled) {
|
|
200
|
-
ch.checked = !ch.checked;
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
renderToScreen();
|
|
204
|
-
}
|
|
205
|
-
return new Promise((resolve, reject) => {
|
|
206
|
-
let resolved = false;
|
|
207
|
-
let cleanupCalled = false;
|
|
208
|
-
function cleanup() {
|
|
209
|
-
if (cleanupCalled)
|
|
210
|
-
return;
|
|
211
|
-
cleanupCalled = true;
|
|
212
|
-
stdin.setRawMode(false);
|
|
213
|
-
stdin.pause();
|
|
214
|
-
stdin.removeListener("data", onData);
|
|
215
|
-
if (searchTimer)
|
|
216
|
-
clearTimeout(searchTimer);
|
|
217
|
-
if (signal && abortHandler) {
|
|
218
|
-
signal.removeEventListener("abort", abortHandler);
|
|
219
|
-
}
|
|
220
|
-
stdout.write(ANSI.showCursor);
|
|
221
|
-
}
|
|
222
|
-
const abortHandler = signal
|
|
223
|
-
? () => {
|
|
224
|
-
cleanup();
|
|
225
|
-
reject(new PromptAbortError());
|
|
226
|
-
}
|
|
227
|
-
: null;
|
|
228
|
-
if (signal && abortHandler) {
|
|
229
|
-
signal.addEventListener("abort", abortHandler);
|
|
230
|
-
}
|
|
231
|
-
function onData(key) {
|
|
232
|
-
if (key === Keys.ctrlC) {
|
|
233
|
-
cleanup();
|
|
234
|
-
stdout.write("\n");
|
|
235
|
-
reject(new PromptCancelError());
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
if (key === Keys.enter || key === Keys.newline) {
|
|
239
|
-
const selected = normalized.filter((ch) => ch.checked && !ch.disabled);
|
|
240
|
-
if (required && selected.length === 0) {
|
|
241
|
-
// Show error but don't exit
|
|
242
|
-
requiredError = true;
|
|
243
|
-
renderToScreen();
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
requiredError = false;
|
|
247
|
-
resolved = true;
|
|
248
|
-
cleanup();
|
|
249
|
-
stdout.write("\n");
|
|
250
|
-
resolve(selected.map((ch) => ch.value));
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
if (key === Keys.up) {
|
|
254
|
-
move(-1);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (key === Keys.down) {
|
|
258
|
-
move(1);
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
if (key === Keys.home || key === Keys.homeAlt) {
|
|
262
|
-
pointer = findFirstEnabledIndex(normalized);
|
|
263
|
-
pageStart = updatePageStart(pointer, pageSize, normalized.length);
|
|
264
|
-
renderToScreen();
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
if (key === Keys.end || key === Keys.endAlt) {
|
|
268
|
-
pointer = findLastEnabledIndex(normalized);
|
|
269
|
-
pageStart = updatePageStart(pointer, pageSize, normalized.length);
|
|
270
|
-
renderToScreen();
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (key === Keys.backspace || key === Keys.backspaceAlt) {
|
|
274
|
-
if (searchBuffer.length > 0) {
|
|
275
|
-
searchBuffer = searchBuffer.slice(0, -1);
|
|
276
|
-
if (searchBuffer.length === 0)
|
|
277
|
-
resetSearchBuffer();
|
|
278
|
-
renderToScreen();
|
|
279
|
-
}
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
if (key === " ") {
|
|
283
|
-
toggleCurrent();
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
if (key === "a") {
|
|
287
|
-
toggleAll();
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
if (key === "i") {
|
|
291
|
-
invertSelection();
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
if (key && key >= " " && key <= "~") {
|
|
295
|
-
searchBuffer += key;
|
|
296
|
-
resetSearchBuffer();
|
|
297
|
-
const found = jumpToIndexStartingWith(searchBuffer);
|
|
298
|
-
if (!found) {
|
|
299
|
-
searchBuffer = key;
|
|
300
|
-
resetSearchBuffer();
|
|
301
|
-
jumpToIndexStartingWith(searchBuffer);
|
|
302
|
-
}
|
|
303
|
-
renderToScreen();
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
try {
|
|
308
|
-
stdout.write(ANSI.hideCursor);
|
|
309
|
-
renderToScreen();
|
|
310
|
-
stdin.on("data", onData);
|
|
311
|
-
const exitHandler = () => {
|
|
312
|
-
if (!resolved) {
|
|
313
|
-
cleanup();
|
|
314
|
-
stdout.write("\n");
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
process.on("exit", exitHandler);
|
|
318
|
-
}
|
|
319
|
-
catch (error) {
|
|
320
|
-
cleanup();
|
|
321
|
-
throw error;
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
// Quick test when run directly
|
|
326
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
327
|
-
(async () => {
|
|
328
|
-
try {
|
|
329
|
-
const res = await checkbox({
|
|
330
|
-
message: "Pick fruits",
|
|
331
|
-
choices: [
|
|
332
|
-
"Apple",
|
|
333
|
-
"Banana",
|
|
334
|
-
{ name: "Date", value: "date", checked: true },
|
|
335
|
-
"Elderberry",
|
|
336
|
-
{ name: "Fig", value: "fig", disabled: true },
|
|
337
|
-
"Grapes",
|
|
338
|
-
"Honeydew",
|
|
339
|
-
"Orange",
|
|
340
|
-
],
|
|
341
|
-
pageSize: 3,
|
|
342
|
-
initial: 0,
|
|
343
|
-
});
|
|
344
|
-
console.info("You picked:", res);
|
|
345
|
-
process.exit(0);
|
|
346
|
-
}
|
|
347
|
-
catch (err) {
|
|
348
|
-
if (isCancelError(err)) {
|
|
349
|
-
console.error("Cancelled");
|
|
350
|
-
process.exit(2);
|
|
351
|
-
}
|
|
352
|
-
else if (isAbortError(err)) {
|
|
353
|
-
console.error("Aborted");
|
|
354
|
-
process.exit(3);
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
console.error(err);
|
|
358
|
-
process.exit(1);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
})();
|
|
362
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface EditorPromptOptions {
|
|
2
|
-
message: string;
|
|
3
|
-
default?: string;
|
|
4
|
-
postfix?: string;
|
|
5
|
-
editor?: string;
|
|
6
|
-
skipPrompt?: boolean;
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
}
|
|
9
|
-
export declare function editor(options: EditorPromptOptions): Promise<string>;
|
|
10
|
-
//# sourceMappingURL=editor-prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/editor-prompt.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgF1E"}
|
|
@@ -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,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Standalone input prompt (inquirer-like)
|
|
4
|
-
* - TypeScript version
|
|
5
|
-
*/
|
|
6
|
-
export 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
|
-
//# 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,MAAM,WAAW,YAAY;IAC3B,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"}
|