@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/terminal/highlight/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/terminal/highlight/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAoDxC;;GAEG;AACH,UAAU,gBAAgB;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAWzE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import hljs from "highlight.js";
|
|
2
2
|
import * as parse5 from "parse5";
|
|
3
3
|
import { adapter as htmlparser2Adapter } from "parse5-htmlparser2-tree-adapter";
|
|
4
|
-
|
|
5
|
-
* Identity function for tokens that should not be styled (returns the input string as-is).
|
|
6
|
-
*/
|
|
7
|
-
const plain = (codePart) => codePart;
|
|
4
|
+
import { id } from "../../utils/funcs.js";
|
|
8
5
|
function colorizeNode(node, theme, context) {
|
|
9
6
|
switch (node.type) {
|
|
10
7
|
case "text": {
|
|
11
8
|
const text = node.data;
|
|
12
9
|
if (context === undefined) {
|
|
13
|
-
return (theme.default ||
|
|
10
|
+
return (theme.default || id)(text);
|
|
14
11
|
}
|
|
15
12
|
return text;
|
|
16
13
|
}
|
|
@@ -24,7 +21,7 @@ function colorizeNode(node, theme, context) {
|
|
|
24
21
|
?.map((childNode) => colorizeNode(childNode, theme, token))
|
|
25
22
|
.join("") || "";
|
|
26
23
|
const themeToken = theme[token];
|
|
27
|
-
const themeFn = themeToken ||
|
|
24
|
+
const themeFn = themeToken || id;
|
|
28
25
|
return themeFn(nodeData);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../source/terminal/highlight/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../source/terminal/highlight/theme.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
import { id } from "../../utils/funcs.js";
|
|
1
2
|
import style from "../style.js";
|
|
2
|
-
/**
|
|
3
|
-
* Identity function for tokens that should not be styled (returns the input string as-is).
|
|
4
|
-
* See [[Theme]] for an example.
|
|
5
|
-
*/
|
|
6
|
-
const plain = (codePart) => codePart;
|
|
7
3
|
/**
|
|
8
4
|
* Converts a [[JsonTheme]] with string values to a [[Theme]] with formatter functions. Used by [[parse]].
|
|
9
5
|
*/
|
|
@@ -16,7 +12,7 @@ function fromJson(json) {
|
|
|
16
12
|
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
17
13
|
theme[key] = styleValue.reduce((previous, current) =>
|
|
18
14
|
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
|
19
|
-
current === "plain" ?
|
|
15
|
+
current === "plain" ? id : previous[current], style);
|
|
20
16
|
}
|
|
21
17
|
else {
|
|
22
18
|
// biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
|
package/dist/terminal/index.d.ts
CHANGED
|
@@ -4,98 +4,6 @@
|
|
|
4
4
|
* Provides a user interface for interacting with Claude Code in the terminal.
|
|
5
5
|
* Handles input/output, formatting, and display.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare function getShell(): string;
|
|
10
|
-
/**
|
|
11
|
-
* Initialize the terminal interface
|
|
12
|
-
*/
|
|
13
|
-
export declare function initTerminal(config?: Partial<TerminalConfig>): Terminal;
|
|
14
|
-
/**
|
|
15
|
-
* Terminal class for handling user interaction
|
|
16
|
-
*/
|
|
17
|
-
export declare class Terminal {
|
|
18
|
-
private config;
|
|
19
|
-
private terminalWidth;
|
|
20
|
-
private terminalHeight;
|
|
21
|
-
private isInteractive;
|
|
22
|
-
constructor(config: TerminalConfig);
|
|
23
|
-
/**
|
|
24
|
-
* Detect terminal capabilities
|
|
25
|
-
*/
|
|
26
|
-
detectCapabilities(): void;
|
|
27
|
-
setTitle(title: string): void;
|
|
28
|
-
getLogo(): string;
|
|
29
|
-
/**
|
|
30
|
-
* Display the welcome message
|
|
31
|
-
*/
|
|
32
|
-
displayWelcome(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Clear the terminal screen
|
|
35
|
-
*/
|
|
36
|
-
clear(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Start progress indicator in terminal
|
|
39
|
-
* Sends terminal escape sequence to show progress animation
|
|
40
|
-
*/
|
|
41
|
-
startProgress(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Stop progress indicator in terminal
|
|
44
|
-
* Sends terminal escape sequence to hide progress animation
|
|
45
|
-
*/
|
|
46
|
-
stopProgress(): void;
|
|
47
|
-
/**
|
|
48
|
-
* Display formatted content
|
|
49
|
-
*/
|
|
50
|
-
display(content: string, wrap?: boolean): void;
|
|
51
|
-
/**
|
|
52
|
-
* Display a message with emphasis
|
|
53
|
-
*/
|
|
54
|
-
emphasize(message: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Display an informational message
|
|
57
|
-
*/
|
|
58
|
-
info(message: string): void;
|
|
59
|
-
/**
|
|
60
|
-
* Display a success message
|
|
61
|
-
*/
|
|
62
|
-
success(message: string): void;
|
|
63
|
-
/**
|
|
64
|
-
* Display a warning message
|
|
65
|
-
*/
|
|
66
|
-
warn(message: string): void;
|
|
67
|
-
/**
|
|
68
|
-
* Display an error message
|
|
69
|
-
*/
|
|
70
|
-
error(message: string): void;
|
|
71
|
-
/**
|
|
72
|
-
* Emits an alert.
|
|
73
|
-
*/
|
|
74
|
-
alert(): void;
|
|
75
|
-
write(input: string): void;
|
|
76
|
-
writeln(input: string): void;
|
|
77
|
-
lineBreak(): void;
|
|
78
|
-
header(header: string, styleFn?: StyleInstance): void;
|
|
79
|
-
box(header: string, content: string): Promise<void>;
|
|
80
|
-
hr(styleFn?: StyleInstance): void;
|
|
81
|
-
/**
|
|
82
|
-
* Create a clickable link in the terminal if supported
|
|
83
|
-
*/
|
|
84
|
-
link(text: string, url: string): string;
|
|
85
|
-
/**
|
|
86
|
-
* Display a table of data
|
|
87
|
-
*/
|
|
88
|
-
table(data: (string | number)[][], options?: {
|
|
89
|
-
header?: string[];
|
|
90
|
-
colWidths?: number[];
|
|
91
|
-
}): void;
|
|
92
|
-
/**
|
|
93
|
-
* Displays a horizontal progress bar in the console.
|
|
94
|
-
* @param current The current value.
|
|
95
|
-
* @param total The target value.
|
|
96
|
-
*/
|
|
97
|
-
displayProgressBar(current: number, total: number): void;
|
|
98
|
-
private formatMarkdown;
|
|
99
|
-
}
|
|
100
|
-
export * from "./types.ts";
|
|
7
|
+
export { alert, getShell, isInteractive } from "./control.ts";
|
|
8
|
+
export { emphasize, error, hr, info, success, warn } from "./formatting.ts";
|
|
101
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/terminal/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/terminal/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/terminal/index.js
CHANGED
|
@@ -4,373 +4,5 @@
|
|
|
4
4
|
* Provides a user interface for interacting with Claude Code in the terminal.
|
|
5
5
|
* Handles input/output, formatting, and display.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { getPackageVersion } from "../version.js";
|
|
10
|
-
import { clearTerminal, getTerminalSize, setTerminalTitle, link as terminalLink, } from "./formatting.js";
|
|
11
|
-
import { applyMarkdown } from "./markdown.js";
|
|
12
|
-
import stripAnsi from "./strip-ansi.js";
|
|
13
|
-
import style from "./style.js";
|
|
14
|
-
import wrapAnsi from "./wrap-ansi.js";
|
|
15
|
-
export function getShell() {
|
|
16
|
-
return process.env["ZSH_VERSION"] ? "zsh" : process.env["SHELL"] || "bash";
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Initialize the terminal interface
|
|
20
|
-
*/
|
|
21
|
-
export function initTerminal(config = {}) {
|
|
22
|
-
logger.debug("Initializing terminal interface");
|
|
23
|
-
const terminalConfig = {
|
|
24
|
-
theme: config.theme || "system",
|
|
25
|
-
useColors: config.useColors !== false,
|
|
26
|
-
showProgressIndicators: config.showProgressIndicators !== false,
|
|
27
|
-
codeHighlighting: config.codeHighlighting !== false,
|
|
28
|
-
maxHeight: config.maxHeight,
|
|
29
|
-
maxWidth: config.maxWidth,
|
|
30
|
-
};
|
|
31
|
-
const terminal = new Terminal(terminalConfig);
|
|
32
|
-
try {
|
|
33
|
-
// Detect terminal capabilities
|
|
34
|
-
terminal.detectCapabilities();
|
|
35
|
-
return terminal;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
logger.warn(error, "Error initializing terminal interface:");
|
|
39
|
-
// Return a basic terminal interface even if there was an error
|
|
40
|
-
return terminal;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Terminal class for handling user interaction
|
|
45
|
-
*/
|
|
46
|
-
export class Terminal {
|
|
47
|
-
config;
|
|
48
|
-
terminalWidth;
|
|
49
|
-
terminalHeight;
|
|
50
|
-
isInteractive;
|
|
51
|
-
constructor(config) {
|
|
52
|
-
this.config = config;
|
|
53
|
-
// Get initial terminal size
|
|
54
|
-
const { rows, columns } = getTerminalSize();
|
|
55
|
-
this.terminalHeight = config.maxHeight || rows;
|
|
56
|
-
this.terminalWidth = config.maxWidth || columns;
|
|
57
|
-
// Assume interactive by default
|
|
58
|
-
this.isInteractive = process.stdout.isTTY && process.stdin.isTTY;
|
|
59
|
-
// Listen for terminal resize events
|
|
60
|
-
process.stdout.on("resize", () => {
|
|
61
|
-
const { rows, columns } = getTerminalSize();
|
|
62
|
-
this.terminalHeight = config.maxHeight || rows;
|
|
63
|
-
this.terminalWidth = config.maxWidth || columns;
|
|
64
|
-
logger.debug(`Terminal resized to ${columns}x${rows}`);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Detect terminal capabilities
|
|
69
|
-
*/
|
|
70
|
-
detectCapabilities() {
|
|
71
|
-
// Check if the terminal is interactive
|
|
72
|
-
this.isInteractive = Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
73
|
-
logger.debug({
|
|
74
|
-
isInteractive: this.isInteractive,
|
|
75
|
-
colorSupport: this.config.useColors ? "yes" : "no",
|
|
76
|
-
size: `${this.terminalWidth}x${this.terminalHeight}`,
|
|
77
|
-
}, "Terminal capabilities detected");
|
|
78
|
-
}
|
|
79
|
-
setTitle(title) {
|
|
80
|
-
setTerminalTitle(title);
|
|
81
|
-
}
|
|
82
|
-
getLogo() {
|
|
83
|
-
return `
|
|
84
|
-
█████╗ ██████╗ █████╗ ██╗
|
|
85
|
-
██╔══██╗██╔════╝██╔══██╗██║
|
|
86
|
-
███████║██║ ███████║██║
|
|
87
|
-
██╔══██║██║ ██╔══██║██║
|
|
88
|
-
██║ ██║╚██████╗██║ ██║██║
|
|
89
|
-
╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝
|
|
90
|
-
`;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Display the welcome message
|
|
94
|
-
*/
|
|
95
|
-
displayWelcome() {
|
|
96
|
-
this.clear();
|
|
97
|
-
const version = getPackageVersion();
|
|
98
|
-
this.writeln(style.magenta(this.getLogo()));
|
|
99
|
-
this.lineBreak();
|
|
100
|
-
this.writeln(style.magenta("Greetings! I am acai."));
|
|
101
|
-
this.writeln(style.gray(` Version ${version}`));
|
|
102
|
-
this.lineBreak();
|
|
103
|
-
this.writeln(style.white(` Type ${style.cyan("/help")} to see available commands.`));
|
|
104
|
-
this.writeln(style.white(" You can ask acai to explain code, fix issues, or perform tasks."));
|
|
105
|
-
this.writeln(style.white(` Example: "${style.italic("Please analyze this codebase and explain its structure.")}"`));
|
|
106
|
-
this.writeln(style.dim(" Use Ctrl+C to interrupt acai and exit."));
|
|
107
|
-
this.lineBreak();
|
|
108
|
-
this.writeln(style.yellow(`The current working directory is ${process.cwd()}`));
|
|
109
|
-
this.lineBreak();
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Clear the terminal screen
|
|
113
|
-
*/
|
|
114
|
-
clear() {
|
|
115
|
-
if (this.isInteractive) {
|
|
116
|
-
clearTerminal();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Start progress indicator in terminal
|
|
121
|
-
* Sends terminal escape sequence to show progress animation
|
|
122
|
-
*/
|
|
123
|
-
startProgress() {
|
|
124
|
-
process.stdout.write("\u001b]9;4;3;0\u0007");
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Stop progress indicator in terminal
|
|
128
|
-
* Sends terminal escape sequence to hide progress animation
|
|
129
|
-
*/
|
|
130
|
-
stopProgress() {
|
|
131
|
-
process.stdout.write("\u001b]9;4;0;0\u0007");
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Display formatted content
|
|
135
|
-
*/
|
|
136
|
-
display(content, wrap = false) {
|
|
137
|
-
this.writeln(this.formatMarkdown(content, wrap));
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Display a message with emphasis
|
|
141
|
-
*/
|
|
142
|
-
emphasize(message) {
|
|
143
|
-
if (this.config.useColors) {
|
|
144
|
-
this.writeln(style.cyan.bold(message));
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
this.writeln(message.toUpperCase());
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Display an informational message
|
|
152
|
-
*/
|
|
153
|
-
info(message) {
|
|
154
|
-
if (this.config.useColors) {
|
|
155
|
-
this.writeln(style.blue(`ℹ ${message}`));
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this.writeln(`INFO: ${message}`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Display a success message
|
|
163
|
-
*/
|
|
164
|
-
success(message) {
|
|
165
|
-
if (this.config.useColors) {
|
|
166
|
-
this.writeln(style.green(`✓ ${message}`));
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
this.writeln(`SUCCESS: ${message}`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Display a warning message
|
|
174
|
-
*/
|
|
175
|
-
warn(message) {
|
|
176
|
-
if (this.config.useColors) {
|
|
177
|
-
this.writeln(style.yellow(`⚠ ${message}`));
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
this.writeln(`WARNING: ${message}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Display an error message
|
|
185
|
-
*/
|
|
186
|
-
error(message) {
|
|
187
|
-
if (this.config.useColors) {
|
|
188
|
-
this.writeln(style.red(`✗ ${message}`));
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
this.writeln(`ERROR: ${message}`);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Emits an alert.
|
|
196
|
-
*/
|
|
197
|
-
alert() {
|
|
198
|
-
if (!this.isInteractive) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
const t = "acai";
|
|
202
|
-
const b = "";
|
|
203
|
-
try {
|
|
204
|
-
process.stdout.write("\x07");
|
|
205
|
-
const esc = "\u001b";
|
|
206
|
-
const bel = "\u0007";
|
|
207
|
-
const safe = (s) => s.replaceAll("\u0007", "").replaceAll("\u001b", "");
|
|
208
|
-
const payload = `${esc}]777;notify;${safe(t)};${safe(b)}${bel}`;
|
|
209
|
-
process.stdout.write(payload);
|
|
210
|
-
}
|
|
211
|
-
catch (err) {
|
|
212
|
-
logger.warn({ err }, "Failed to emit alert");
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
write(input) {
|
|
216
|
-
process.stdout.write(input);
|
|
217
|
-
}
|
|
218
|
-
writeln(input) {
|
|
219
|
-
process.stdout.write(`${input}\n`);
|
|
220
|
-
}
|
|
221
|
-
lineBreak() {
|
|
222
|
-
this.writeln("");
|
|
223
|
-
}
|
|
224
|
-
header(header, styleFn = style.cyan) {
|
|
225
|
-
const cols = this.terminalWidth > 0 ? this.terminalWidth : 80;
|
|
226
|
-
const width = Math.max(0, cols - header.length - 4);
|
|
227
|
-
this.writeln(`${style.gray("\n── ")}${styleFn(header)} ${style.gray("─".repeat(width))}`);
|
|
228
|
-
}
|
|
229
|
-
async box(header, content) {
|
|
230
|
-
const cols = this.terminalWidth > 0 ? this.terminalWidth : 80;
|
|
231
|
-
const width = Math.max(4, cols - 4);
|
|
232
|
-
// Helper to strip ANSI sequences for accurate visible-width calculation
|
|
233
|
-
const paddedHeader = ` ${header} `;
|
|
234
|
-
const headerVisibleLen = stripAnsi(paddedHeader).length;
|
|
235
|
-
const headerStartPos = 1;
|
|
236
|
-
// Top border with header (use visible header length)
|
|
237
|
-
const leftDashes = headerStartPos;
|
|
238
|
-
const rightDashes = Math.max(0, width - leftDashes - headerVisibleLen);
|
|
239
|
-
const topBorder = `┌${"─".repeat(leftDashes)}${paddedHeader}${"─".repeat(rightDashes)}┐`;
|
|
240
|
-
// Prepare inner content: format markdown first, then wrap to inner width
|
|
241
|
-
const innerWidth = Math.max(1, width - 2);
|
|
242
|
-
const formatted = applyMarkdown(content);
|
|
243
|
-
const wrapped = wrapAnsi(formatted, innerWidth, { trim: false });
|
|
244
|
-
const contentLines = wrapped
|
|
245
|
-
.split("\n")
|
|
246
|
-
.map((line) => {
|
|
247
|
-
const visibleLen = stripAnsi(line).length;
|
|
248
|
-
const padCount = Math.max(0, innerWidth - visibleLen);
|
|
249
|
-
return `│ ${line}${" ".repeat(padCount)} │`;
|
|
250
|
-
})
|
|
251
|
-
.join("\n");
|
|
252
|
-
// Bottom border
|
|
253
|
-
const bottomBorder = `└${"─".repeat(width)}┘`;
|
|
254
|
-
// Write the box
|
|
255
|
-
this.writeln(`${topBorder}\n${contentLines}\n${bottomBorder}`);
|
|
256
|
-
}
|
|
257
|
-
hr(styleFn = style.gray) {
|
|
258
|
-
const cols = this.terminalWidth > 0 ? this.terminalWidth : 80;
|
|
259
|
-
this.writeln(styleFn(`${"─".repeat(Math.max(1, cols - 1))} `));
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Create a clickable link in the terminal if supported
|
|
263
|
-
*/
|
|
264
|
-
link(text, url) {
|
|
265
|
-
return style.underline.blue(terminalLink(text, url));
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Display a table of data
|
|
269
|
-
*/
|
|
270
|
-
table(data, options = {}) {
|
|
271
|
-
const { header, colWidths } = options;
|
|
272
|
-
// Determine number of columns from data or header
|
|
273
|
-
let colCount = header?.length;
|
|
274
|
-
if (colCount === undefined) {
|
|
275
|
-
colCount = data.length > 0 && data[0] ? data[0].length : 1;
|
|
276
|
-
}
|
|
277
|
-
// Calculate column widths based on terminal width
|
|
278
|
-
const padding = 5; // Account for table borders and padding
|
|
279
|
-
const availableWidth = Math.max(20, this.terminalWidth - padding);
|
|
280
|
-
let computedColWidths;
|
|
281
|
-
if (colWidths && colWidths.length === colCount) {
|
|
282
|
-
// Use provided percentages
|
|
283
|
-
computedColWidths = colWidths.map((percent) => Math.max(10, Math.floor((percent / 100) * availableWidth)));
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
// Distribute width evenly with minimum width per column
|
|
287
|
-
const minColWidth = 15;
|
|
288
|
-
const maxColsThatFit = Math.floor(availableWidth / minColWidth);
|
|
289
|
-
const actualColCount = Math.min(colCount, maxColsThatFit);
|
|
290
|
-
if (actualColCount === 1) {
|
|
291
|
-
computedColWidths = [availableWidth];
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
// Calculate base width and distribute remaining pixels
|
|
295
|
-
const baseWidth = Math.floor(availableWidth / actualColCount);
|
|
296
|
-
const remainder = availableWidth % actualColCount;
|
|
297
|
-
computedColWidths = Array(actualColCount).fill(baseWidth);
|
|
298
|
-
// Distribute remainder pixels to first few columns
|
|
299
|
-
for (let i = 0; i < remainder && i < actualColCount; i++) {
|
|
300
|
-
computedColWidths[i] = (computedColWidths[i] || 0) + 1;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
// If we have fewer computed widths than columns, extend the array
|
|
304
|
-
while (computedColWidths.length < colCount) {
|
|
305
|
-
computedColWidths.push(minColWidth);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
const table = new Table({
|
|
309
|
-
head: header,
|
|
310
|
-
colWidths: computedColWidths,
|
|
311
|
-
wordWrap: true,
|
|
312
|
-
wrapOnWordBoundary: true,
|
|
313
|
-
});
|
|
314
|
-
// Ensure all data rows have the same number of columns
|
|
315
|
-
const normalizedData = data.map((row) => {
|
|
316
|
-
if (row.length < colCount) {
|
|
317
|
-
// Pad with empty strings if row has fewer columns
|
|
318
|
-
return [...row, ...Array(colCount - row.length).fill("")];
|
|
319
|
-
}
|
|
320
|
-
if (row.length > colCount) {
|
|
321
|
-
// Truncate if row has more columns
|
|
322
|
-
return row.slice(0, colCount);
|
|
323
|
-
}
|
|
324
|
-
return row;
|
|
325
|
-
});
|
|
326
|
-
table.push(...normalizedData);
|
|
327
|
-
this.writeln(table.toString());
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Displays a horizontal progress bar in the console.
|
|
331
|
-
* @param current The current value.
|
|
332
|
-
* @param total The target value.
|
|
333
|
-
*/
|
|
334
|
-
displayProgressBar(current, total) {
|
|
335
|
-
const terminalWidth = this.terminalWidth > 0 ? this.terminalWidth : 80; // Default to 80 if columns not available
|
|
336
|
-
// Function to format numbers concisely (e.g., 1.2K, 5M)
|
|
337
|
-
const formatNumber = (num) => {
|
|
338
|
-
if (num < 1000) {
|
|
339
|
-
return num.toString();
|
|
340
|
-
}
|
|
341
|
-
if (num < 1_000_000) {
|
|
342
|
-
return `${(num / 1000).toFixed(1)}K`;
|
|
343
|
-
}
|
|
344
|
-
if (num < 1_000_000_000) {
|
|
345
|
-
return `${(num / 1_000_000).toFixed(1)}M`;
|
|
346
|
-
}
|
|
347
|
-
return `${(num / 1_000_000_000).toFixed(1)}G`;
|
|
348
|
-
};
|
|
349
|
-
const currentFormatted = formatNumber(current);
|
|
350
|
-
const totalFormatted = formatNumber(total);
|
|
351
|
-
const progressText = `${currentFormatted}/${totalFormatted}`;
|
|
352
|
-
const progressTextLength = progressText.length + 1; // Add 1 for space
|
|
353
|
-
const progressBarMaxWidth = Math.max(1, terminalWidth - progressTextLength - 1);
|
|
354
|
-
const percentage = total === 0 ? 1 : current / total;
|
|
355
|
-
const filledWidth = Math.max(0, Math.min(progressBarMaxWidth, Math.floor(percentage * progressBarMaxWidth)));
|
|
356
|
-
const emptyWidth = Math.max(0, progressBarMaxWidth - filledWidth);
|
|
357
|
-
const a = filledWidth / progressBarMaxWidth > 0.5
|
|
358
|
-
? style.red("─")
|
|
359
|
-
: style.yellow("─"); //"█"
|
|
360
|
-
const b = style.gray("─"); // "░"
|
|
361
|
-
const filledBar = a.repeat(filledWidth);
|
|
362
|
-
const emptyBar = b.repeat(emptyWidth);
|
|
363
|
-
// Use \r to move cursor to the beginning of the line for updates
|
|
364
|
-
this.writeln(`\r${filledBar}${emptyBar} ${progressText} `);
|
|
365
|
-
}
|
|
366
|
-
formatMarkdown(content, wrap = false) {
|
|
367
|
-
const columns = this.terminalWidth;
|
|
368
|
-
const formatted = applyMarkdown(content);
|
|
369
|
-
if (wrap) {
|
|
370
|
-
return wrapAnsi(formatted, columns - 6, { trim: false });
|
|
371
|
-
}
|
|
372
|
-
return formatted;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
// Re-export the types
|
|
376
|
-
export * from "./types.js";
|
|
7
|
+
export { alert, getShell, isInteractive } from "./control.js";
|
|
8
|
+
export { emphasize, error, hr, info, success, warn } from "./formatting.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EOL } from "node:os";
|
|
2
|
-
import Table from "cli-table3";
|
|
3
2
|
import { marked } from "marked";
|
|
4
3
|
import { logger } from "../logger.js";
|
|
5
|
-
import {
|
|
4
|
+
import { DEFAULT_HIGHLIGHT_THEME } from "./default-theme.js";
|
|
6
5
|
import { link as terminalLink } from "./formatting.js";
|
|
7
6
|
import { highlight, supportsLanguage } from "./highlight/index.js";
|
|
8
7
|
import { getListNumber } from "./markdown-utils.js";
|
|
9
8
|
import style from "./style.js";
|
|
9
|
+
import { Table } from "./table/index.js";
|
|
10
10
|
function logError(msg) {
|
|
11
11
|
logger.error(msg);
|
|
12
12
|
}
|
|
@@ -28,12 +28,14 @@ function format(token, listDepth = 0, orderedListNumber = null, parent = null) {
|
|
|
28
28
|
if (token.lang && supportsLanguage(token.lang)) {
|
|
29
29
|
return (highlight(token.text, {
|
|
30
30
|
language: token.lang,
|
|
31
|
-
theme:
|
|
31
|
+
theme: DEFAULT_HIGHLIGHT_THEME,
|
|
32
32
|
}) + EOL);
|
|
33
33
|
}
|
|
34
34
|
logError(`Language not supported while highlighting code, falling back to markdown: ${token.lang}`);
|
|
35
|
-
return (highlight(token.text, {
|
|
36
|
-
|
|
35
|
+
return (highlight(token.text, {
|
|
36
|
+
language: "markdown",
|
|
37
|
+
theme: DEFAULT_HIGHLIGHT_THEME,
|
|
38
|
+
}) + EOL);
|
|
37
39
|
}
|
|
38
40
|
case "codespan":
|
|
39
41
|
// inline code
|
|
@@ -109,6 +111,9 @@ function format(token, listDepth = 0, orderedListNumber = null, parent = null) {
|
|
|
109
111
|
case "del": {
|
|
110
112
|
return style.strikethrough(token.text);
|
|
111
113
|
}
|
|
114
|
+
case "html":
|
|
115
|
+
// Render HTML tags with dim styling and content as normal text
|
|
116
|
+
return style.dim(token.text);
|
|
112
117
|
default:
|
|
113
118
|
return "";
|
|
114
119
|
}
|
|
@@ -8,12 +8,12 @@ interface ChoiceObject<T = unknown> {
|
|
|
8
8
|
value: T;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
type Choice<T = unknown> = string | ChoiceObject<T>;
|
|
12
12
|
interface TerminalIo {
|
|
13
13
|
stdin: NodeJS.ReadStream;
|
|
14
14
|
stdout: NodeJS.WriteStream;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
interface SelectOptions<T = unknown> {
|
|
17
17
|
message?: string;
|
|
18
18
|
choices: Choice<T>[];
|
|
19
19
|
initial?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/select-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;AA6BH,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,
|
|
1
|
+
{"version":3,"file":"select-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/select-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;AA6BH,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,KAAK,MAAM,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAQpD,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;CAC5B;AAED,UAAU,aAAa,CAAC,CAAC,GAAG,OAAO;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AAgGD,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,EACxC,OAAkB,EAClB,OAAO,EACP,OAAW,EACX,QAAY,EACZ,MAAM,EACN,QAA2D,GAC5D,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAgN/B"}
|