shortcutxl 0.2.0
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 +59 -0
- package/agent-docs/README.md +397 -0
- package/agent-docs/docs/compaction.md +390 -0
- package/agent-docs/docs/custom-provider.md +580 -0
- package/agent-docs/docs/development.md +69 -0
- package/agent-docs/docs/extensions.md +1971 -0
- package/agent-docs/docs/json.md +79 -0
- package/agent-docs/docs/keybindings.md +174 -0
- package/agent-docs/docs/models.md +293 -0
- package/agent-docs/docs/packages.md +209 -0
- package/agent-docs/docs/prompt-templates.md +67 -0
- package/agent-docs/docs/providers.md +186 -0
- package/agent-docs/docs/rpc.md +1317 -0
- package/agent-docs/docs/sdk.md +962 -0
- package/agent-docs/docs/session.md +412 -0
- package/agent-docs/docs/settings.md +223 -0
- package/agent-docs/docs/shell-aliases.md +13 -0
- package/agent-docs/docs/skills.md +231 -0
- package/agent-docs/docs/terminal-setup.md +70 -0
- package/agent-docs/docs/termux.md +127 -0
- package/agent-docs/docs/themes.md +295 -0
- package/agent-docs/docs/tree.md +219 -0
- package/agent-docs/docs/tui.md +887 -0
- package/agent-docs/docs/windows.md +17 -0
- package/agent-docs/examples/README.md +25 -0
- package/agent-docs/examples/extensions/README.md +205 -0
- package/agent-docs/examples/extensions/antigravity-image-gen.ts +447 -0
- package/agent-docs/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/agent-docs/examples/extensions/bash-spawn-hook.ts +30 -0
- package/agent-docs/examples/extensions/bookmark.ts +50 -0
- package/agent-docs/examples/extensions/built-in-tool-renderer.ts +256 -0
- package/agent-docs/examples/extensions/claude-rules.ts +86 -0
- package/agent-docs/examples/extensions/commands.ts +75 -0
- package/agent-docs/examples/extensions/confirm-destructive.ts +59 -0
- package/agent-docs/examples/extensions/custom-compaction.ts +126 -0
- package/agent-docs/examples/extensions/custom-footer.ts +63 -0
- package/agent-docs/examples/extensions/custom-header.ts +73 -0
- package/agent-docs/examples/extensions/custom-provider-anthropic/index.ts +660 -0
- package/agent-docs/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/agent-docs/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/agent-docs/examples/extensions/custom-provider-gitlab-duo/index.ts +362 -0
- package/agent-docs/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/agent-docs/examples/extensions/custom-provider-gitlab-duo/test.ts +88 -0
- package/agent-docs/examples/extensions/custom-provider-qwen-cli/index.ts +349 -0
- package/agent-docs/examples/extensions/custom-provider-qwen-cli/package.json +16 -0
- package/agent-docs/examples/extensions/dirty-repo-guard.ts +56 -0
- package/agent-docs/examples/extensions/doom-overlay/README.md +46 -0
- package/agent-docs/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/agent-docs/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/agent-docs/examples/extensions/doom-overlay/doom-component.ts +133 -0
- package/agent-docs/examples/extensions/doom-overlay/doom-engine.ts +186 -0
- package/agent-docs/examples/extensions/doom-overlay/doom-keys.ts +108 -0
- package/agent-docs/examples/extensions/doom-overlay/index.ts +74 -0
- package/agent-docs/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/agent-docs/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/agent-docs/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/agent-docs/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/agent-docs/examples/extensions/dynamic-resources/index.ts +15 -0
- package/agent-docs/examples/extensions/dynamic-tools.ts +77 -0
- package/agent-docs/examples/extensions/event-bus.ts +43 -0
- package/agent-docs/examples/extensions/file-trigger.ts +41 -0
- package/agent-docs/examples/extensions/git-checkpoint.ts +53 -0
- package/agent-docs/examples/extensions/handoff.ts +155 -0
- package/agent-docs/examples/extensions/hello.ts +25 -0
- package/agent-docs/examples/extensions/inline-bash.ts +94 -0
- package/agent-docs/examples/extensions/input-transform.ts +43 -0
- package/agent-docs/examples/extensions/interactive-shell.ts +209 -0
- package/agent-docs/examples/extensions/mac-system-theme.ts +47 -0
- package/agent-docs/examples/extensions/message-renderer.ts +59 -0
- package/agent-docs/examples/extensions/minimal-mode.ts +430 -0
- package/agent-docs/examples/extensions/modal-editor.ts +90 -0
- package/agent-docs/examples/extensions/model-status.ts +31 -0
- package/agent-docs/examples/extensions/notify.ts +55 -0
- package/agent-docs/examples/extensions/overlay-qa-tests.ts +936 -0
- package/agent-docs/examples/extensions/overlay-test.ts +159 -0
- package/agent-docs/examples/extensions/permission-gate.ts +37 -0
- package/agent-docs/examples/extensions/pirate.ts +47 -0
- package/agent-docs/examples/extensions/plan-mode/README.md +65 -0
- package/agent-docs/examples/extensions/plan-mode/index.ts +363 -0
- package/agent-docs/examples/extensions/plan-mode/utils.ts +173 -0
- package/agent-docs/examples/extensions/preset.ts +418 -0
- package/agent-docs/examples/extensions/protected-paths.ts +30 -0
- package/agent-docs/examples/extensions/qna.ts +122 -0
- package/agent-docs/examples/extensions/question.ts +278 -0
- package/agent-docs/examples/extensions/questionnaire.ts +440 -0
- package/agent-docs/examples/extensions/rainbow-editor.ts +90 -0
- package/agent-docs/examples/extensions/reload-runtime.ts +37 -0
- package/agent-docs/examples/extensions/rpc-demo.ts +124 -0
- package/agent-docs/examples/extensions/sandbox/index.ts +324 -0
- package/agent-docs/examples/extensions/sandbox/package-lock.json +92 -0
- package/agent-docs/examples/extensions/sandbox/package.json +19 -0
- package/agent-docs/examples/extensions/send-user-message.ts +97 -0
- package/agent-docs/examples/extensions/session-name.ts +27 -0
- package/agent-docs/examples/extensions/shutdown-command.ts +69 -0
- package/agent-docs/examples/extensions/snake.ts +343 -0
- package/agent-docs/examples/extensions/space-invaders.ts +566 -0
- package/agent-docs/examples/extensions/ssh.ts +233 -0
- package/agent-docs/examples/extensions/status-line.ts +40 -0
- package/agent-docs/examples/extensions/subagent/README.md +172 -0
- package/agent-docs/examples/extensions/subagent/agents/planner.md +37 -0
- package/agent-docs/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/agent-docs/examples/extensions/subagent/agents/scout.md +50 -0
- package/agent-docs/examples/extensions/subagent/agents/worker.md +24 -0
- package/agent-docs/examples/extensions/subagent/agents.ts +130 -0
- package/agent-docs/examples/extensions/subagent/index.ts +1068 -0
- package/agent-docs/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/agent-docs/examples/extensions/subagent/prompts/implement.md +10 -0
- package/agent-docs/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/agent-docs/examples/extensions/summarize.ts +206 -0
- package/agent-docs/examples/extensions/system-prompt-header.ts +17 -0
- package/agent-docs/examples/extensions/timed-confirm.ts +72 -0
- package/agent-docs/examples/extensions/titlebar-spinner.ts +58 -0
- package/agent-docs/examples/extensions/todo.ts +314 -0
- package/agent-docs/examples/extensions/tool-override.ts +146 -0
- package/agent-docs/examples/extensions/tools.ts +145 -0
- package/agent-docs/examples/extensions/trigger-compact.ts +40 -0
- package/agent-docs/examples/extensions/truncated-tool.ts +194 -0
- package/agent-docs/examples/extensions/widget-placement.ts +17 -0
- package/agent-docs/examples/extensions/with-deps/index.ts +37 -0
- package/agent-docs/examples/extensions/with-deps/package-lock.json +31 -0
- package/agent-docs/examples/extensions/with-deps/package.json +22 -0
- package/agent-docs/examples/rpc-extension-ui.ts +654 -0
- package/agent-docs/examples/sdk/01-minimal.ts +22 -0
- package/agent-docs/examples/sdk/02-custom-model.ts +48 -0
- package/agent-docs/examples/sdk/03-custom-prompt.ts +55 -0
- package/agent-docs/examples/sdk/04-skills.ts +53 -0
- package/agent-docs/examples/sdk/05-tools.ts +56 -0
- package/agent-docs/examples/sdk/06-extensions.ts +88 -0
- package/agent-docs/examples/sdk/07-context-files.ts +40 -0
- package/agent-docs/examples/sdk/08-prompt-templates.ts +47 -0
- package/agent-docs/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/agent-docs/examples/sdk/10-settings.ts +54 -0
- package/agent-docs/examples/sdk/11-sessions.ts +48 -0
- package/agent-docs/examples/sdk/12-full-control.ts +82 -0
- package/agent-docs/examples/sdk/README.md +144 -0
- package/agent-docs/xll-skill.md +61 -0
- package/agent-docs/xll-spec.md +110 -0
- package/dist/cli/args.js +290 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/file-processor.js +79 -0
- package/dist/cli/list-models.js +92 -0
- package/dist/cli/package-commands.js +210 -0
- package/dist/cli/report-settings-errors.js +11 -0
- package/dist/cli/session-picker.js +34 -0
- package/dist/cli.js +19 -0
- package/dist/config.js +288 -0
- package/dist/core/abort.js +15 -0
- package/dist/core/agent-loop.js +352 -0
- package/dist/core/agent-session.js +2019 -0
- package/dist/core/agent.js +410 -0
- package/dist/core/auth-storage.js +456 -0
- package/dist/core/bash-executor.js +222 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/compaction.js +610 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/utils.js +139 -0
- package/dist/core/defaults.js +6 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/exec.js +71 -0
- package/dist/core/export-html/ansi-to-html.js +256 -0
- package/dist/core/export-html/index.js +238 -0
- package/dist/core/export-html/session-view-model.js +342 -0
- package/dist/core/export-html/template.css +1110 -0
- package/dist/core/export-html/template.html +76 -0
- package/dist/core/export-html/template.js +1990 -0
- package/dist/core/export-html/tool-renderer.js +63 -0
- package/dist/core/export-html/vendor/highlight.min.js +7725 -0
- package/dist/core/export-html/vendor/marked.min.js +1803 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/loader.js +422 -0
- package/dist/core/extensions/runner.js +651 -0
- package/dist/core/extensions/types.js +35 -0
- package/dist/core/extensions/wrapper.js +102 -0
- package/dist/core/footer-data-provider.js +162 -0
- package/dist/core/index.js +9 -0
- package/dist/core/keybindings.js +153 -0
- package/dist/core/messages.js +133 -0
- package/dist/core/model-registry.js +539 -0
- package/dist/core/model-resolver.js +370 -0
- package/dist/core/package-manager.js +1485 -0
- package/dist/core/prompt-templates.js +253 -0
- package/dist/core/resolve-config-value.js +59 -0
- package/dist/core/resource-loader.js +700 -0
- package/dist/core/sdk.js +197 -0
- package/dist/core/session-bash.js +99 -0
- package/dist/core/session-compaction.js +165 -0
- package/dist/core/session-manager.js +1153 -0
- package/dist/core/session-models.js +99 -0
- package/dist/core/session-retry.js +155 -0
- package/dist/core/settings-manager.js +572 -0
- package/dist/core/skills.js +382 -0
- package/dist/core/slash-commands.js +31 -0
- package/dist/core/system-prompt.js +161 -0
- package/dist/core/theme.js +770 -0
- package/dist/core/timings.js +26 -0
- package/dist/core/tools/bash.js +258 -0
- package/dist/core/tools/edit-diff.js +245 -0
- package/dist/core/tools/edit.js +148 -0
- package/dist/core/tools/find.js +208 -0
- package/dist/core/tools/grep.js +246 -0
- package/dist/core/tools/index.js +67 -0
- package/dist/core/tools/ls.js +123 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/read.js +160 -0
- package/dist/core/tools/truncate.js +70 -0
- package/dist/core/tools/write.js +82 -0
- package/dist/custom/agents/action.js +13 -0
- package/dist/custom/agents/document-reader.js +70 -0
- package/dist/custom/agents/general.js +26 -0
- package/dist/custom/agents/index.js +49 -0
- package/dist/custom/agents/installation.js +13 -0
- package/dist/custom/agents/types.js +7 -0
- package/dist/custom/auth/refresh-timer.js +33 -0
- package/dist/custom/auth/shortcut-oauth.js +145 -0
- package/dist/custom/constants.js +21 -0
- package/dist/custom/context/workbook-summary.js +73 -0
- package/dist/custom/credits/shortcut-credits.js +29 -0
- package/dist/custom/cron/cron-daemon-entry.js +18 -0
- package/dist/custom/cron/daemon-ipc.js +131 -0
- package/dist/custom/cron/daemon.js +224 -0
- package/dist/custom/cron/jobs.js +226 -0
- package/dist/custom/cron/run-log.js +51 -0
- package/dist/custom/cron/schedule.js +72 -0
- package/dist/custom/cron/status-line.js +98 -0
- package/dist/custom/cron/store.js +87 -0
- package/dist/custom/cron/types.js +8 -0
- package/dist/custom/dev/index.js +59 -0
- package/dist/custom/dev/trace-export.js +58 -0
- package/dist/custom/ensure-excel.js +63 -0
- package/dist/custom/excel-config.js +36 -0
- package/dist/custom/preflight.js +422 -0
- package/dist/custom/prompts/action.js +100 -0
- package/dist/custom/prompts/api.js +66 -0
- package/dist/custom/prompts/installation.js +124 -0
- package/dist/custom/prompts/shared.js +138 -0
- package/dist/custom/providers/llm-usage.js +42 -0
- package/dist/custom/providers/message-converter.js +74 -0
- package/dist/custom/providers/provider-ids.js +9 -0
- package/dist/custom/providers/register-openai-codex-provider.js +27 -0
- package/dist/custom/providers/register-shortcut-provider.js +52 -0
- package/dist/custom/providers/shortcut-invoke.js +117 -0
- package/dist/custom/providers/shortcut-stream.js +252 -0
- package/dist/custom/providers/sse-protocol.js +38 -0
- package/dist/custom/sync-xll.js +130 -0
- package/dist/custom/tools/cron.js +413 -0
- package/dist/custom/tools/excel-exec.js +167 -0
- package/dist/custom/tools/excel-range.js +50 -0
- package/dist/custom/tools/llm-analysis.js +265 -0
- package/dist/custom/tools/render-helpers.js +38 -0
- package/dist/custom/tools/switch-mode.js +94 -0
- package/dist/custom/tools/task/agents.js +6 -0
- package/dist/custom/tools/task/index.js +8 -0
- package/dist/custom/tools/task/render.js +348 -0
- package/dist/custom/tools/task/subprocess.js +320 -0
- package/dist/custom/tools/task/task.js +205 -0
- package/dist/custom/tools/todo-list.js +195 -0
- package/dist/custom/tracing/session-upload.js +93 -0
- package/dist/index.js +45 -0
- package/dist/main.js +613 -0
- package/dist/migrations.js +265 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/interactive/components/armin.js +337 -0
- package/dist/modes/interactive/components/assistant-message.js +94 -0
- package/dist/modes/interactive/components/bash-execution.js +171 -0
- package/dist/modes/interactive/components/bordered-loader.js +51 -0
- package/dist/modes/interactive/components/branch-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +46 -0
- package/dist/modes/interactive/components/config-selector.js +488 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/custom-editor.js +93 -0
- package/dist/modes/interactive/components/custom-message.js +81 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/extension-editor.js +105 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-selector.js +78 -0
- package/dist/modes/interactive/components/footer.js +309 -0
- package/dist/modes/interactive/components/index.js +33 -0
- package/dist/modes/interactive/components/keybinding-hints.js +61 -0
- package/dist/modes/interactive/components/layout.js +64 -0
- package/dist/modes/interactive/components/login-dialog.js +148 -0
- package/dist/modes/interactive/components/model-selector.js +237 -0
- package/dist/modes/interactive/components/oauth-selector.js +111 -0
- package/dist/modes/interactive/components/session-selector-search.js +157 -0
- package/dist/modes/interactive/components/session-selector.js +860 -0
- package/dist/modes/interactive/components/settings-selector.js +123 -0
- package/dist/modes/interactive/components/show-images-selector.js +35 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +48 -0
- package/dist/modes/interactive/components/theme-selector.js +47 -0
- package/dist/modes/interactive/components/thinking-selector.js +47 -0
- package/dist/modes/interactive/components/tool-execution.js +789 -0
- package/dist/modes/interactive/components/tool-group.js +106 -0
- package/dist/modes/interactive/components/tree-selector.js +962 -0
- package/dist/modes/interactive/components/user-message-selector.js +115 -0
- package/dist/modes/interactive/components/user-message.js +48 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/file-attachments.js +135 -0
- package/dist/modes/interactive/interactive-mode.js +3775 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +85 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.js +177 -0
- package/dist/modes/print-mode.js +101 -0
- package/dist/modes/rpc/rpc-client.js +387 -0
- package/dist/modes/rpc/rpc-mode.js +509 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/subagent-entry.js +145 -0
- package/dist/tool-names.js +34 -0
- package/dist/tui/autocomplete.js +596 -0
- package/dist/tui/components/box.js +104 -0
- package/dist/tui/components/cancellable-loader.js +35 -0
- package/dist/tui/components/editor.js +1679 -0
- package/dist/tui/components/image.js +69 -0
- package/dist/tui/components/input.js +433 -0
- package/dist/tui/components/loader.js +49 -0
- package/dist/tui/components/markdown.js +629 -0
- package/dist/tui/components/select-list.js +152 -0
- package/dist/tui/components/settings-list.js +185 -0
- package/dist/tui/components/spacer.js +23 -0
- package/dist/tui/components/text.js +89 -0
- package/dist/tui/components/truncated-text.js +51 -0
- package/dist/tui/editor-component.js +2 -0
- package/dist/tui/fuzzy.js +107 -0
- package/dist/tui/get-east-asian-width/index.js +32 -0
- package/dist/tui/get-east-asian-width/lookup.js +404 -0
- package/dist/tui/index.js +32 -0
- package/dist/tui/keybindings.js +114 -0
- package/dist/tui/keys.js +959 -0
- package/dist/tui/kill-ring.js +44 -0
- package/dist/tui/stdin-buffer.js +317 -0
- package/dist/tui/terminal-image.js +288 -0
- package/dist/tui/terminal.js +249 -0
- package/dist/tui/tui/autocomplete.js +596 -0
- package/dist/tui/tui/components/box.js +106 -0
- package/dist/tui/tui/components/cancellable-loader.js +35 -0
- package/dist/tui/tui/components/editor.js +1679 -0
- package/dist/tui/tui/components/image.js +69 -0
- package/dist/tui/tui/components/input.js +433 -0
- package/dist/tui/tui/components/loader.js +49 -0
- package/dist/tui/tui/components/markdown.js +629 -0
- package/dist/tui/tui/components/select-list.js +152 -0
- package/dist/tui/tui/components/settings-list.js +185 -0
- package/dist/tui/tui/components/spacer.js +23 -0
- package/dist/tui/tui/components/text.js +91 -0
- package/dist/tui/tui/components/truncated-text.js +51 -0
- package/dist/tui/tui/editor-component.js +2 -0
- package/dist/tui/tui/fuzzy.js +107 -0
- package/dist/tui/tui/get-east-asian-width/index.js +32 -0
- package/dist/tui/tui/get-east-asian-width/lookup.js +404 -0
- package/dist/tui/tui/index.js +32 -0
- package/dist/tui/tui/keybindings.js +114 -0
- package/dist/tui/tui/keys.js +959 -0
- package/dist/tui/tui/kill-ring.js +44 -0
- package/dist/tui/tui/stdin-buffer.js +317 -0
- package/dist/tui/tui/terminal-image.js +288 -0
- package/dist/tui/tui/terminal.js +249 -0
- package/dist/tui/tui/tui.js +955 -0
- package/dist/tui/tui/undo-stack.js +25 -0
- package/dist/tui/tui/utils.js +800 -0
- package/dist/tui/tui.js +955 -0
- package/dist/tui/undo-stack.js +25 -0
- package/dist/tui/utils.js +800 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/clipboard-image.js +164 -0
- package/dist/utils/clipboard-native.js +14 -0
- package/dist/utils/clipboard.js +67 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/git.js +166 -0
- package/dist/utils/image-convert.js +35 -0
- package/dist/utils/image-resize.js +183 -0
- package/dist/utils/mime.js +26 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/shell.js +217 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/tools-manager.js +259 -0
- package/package.json +78 -0
- package/skills/excel-com-api/SKILL.md +74 -0
- package/skills/excel-com-api/excel-type-library.py +27767 -0
- package/skills/excel-com-api/office-type-library.py +10867 -0
- package/skills/integrations/SKILL.md +138 -0
- package/skills/integrations/alphasense.md +457 -0
- package/skills/integrations/bloomberg.md +803 -0
- package/skills/integrations/calcbench.md +315 -0
- package/skills/integrations/capiq.md +848 -0
- package/skills/integrations/dynamics-365-finance.md +354 -0
- package/skills/integrations/earnings_transcripts.md +387 -0
- package/skills/integrations/factset.md +758 -0
- package/skills/integrations/ice-fixed-income.md +344 -0
- package/skills/integrations/moodys-analytics.md +313 -0
- package/skills/integrations/morningstar.md +433 -0
- package/skills/integrations/nasdaq-data-link.md +249 -0
- package/skills/integrations/pitchbook.md +413 -0
- package/skills/integrations/preqin.md +422 -0
- package/skills/integrations/quickbooks.md +289 -0
- package/skills/integrations/quickfs.md +314 -0
- package/skills/integrations/refinitiv.md +473 -0
- package/skills/integrations/sage-intacct.md +401 -0
- package/skills/integrations/visible-alpha.md +320 -0
- package/skills/integrations/xero.md +393 -0
- package/skills/integrations/ycharts.md +306 -0
- package/skills/pdf-creation/SKILL.md +93 -0
- package/skills/pdf-extraction/SKILL.md +32 -0
- package/skills/powerpoint-creation/SKILL.md +110 -0
- package/skills/sec-edgar/SKILL.md +127 -0
- package/skills/sec-edgar/sec_to_pdf.py +109 -0
- package/xll/ShortcutXL.xll +0 -0
- package/xll/modules/debug_render.py +272 -0
- package/xll/modules/gameboy.py +241 -0
- package/xll/modules/pong.py +188 -0
- package/xll/modules/shortcut_xl/__init__.py +18 -0
- package/xll/modules/shortcut_xl/_categorize.py +200 -0
- package/xll/modules/shortcut_xl/_com.py +108 -0
- package/xll/modules/shortcut_xl/_format.py +252 -0
- package/xll/modules/shortcut_xl/_log.py +12 -0
- package/xll/modules/shortcut_xl/_managed.py +116 -0
- package/xll/modules/shortcut_xl/_registry.py +44 -0
- package/xll/modules/shortcut_xl/_threading.py +161 -0
- package/xll/modules/shortcut_xl/_tracking.py +283 -0
- package/xll/modules/stocks.py +100 -0
- package/xll/python3.dll +0 -0
- package/xll/python312.dll +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { getEditorKeybindings } from "../keybindings.js";
|
|
2
|
+
import { truncateToWidth } from "../utils.js";
|
|
3
|
+
const normalizeToSingleLine = (text) => text.replace(/[\r\n]+/g, " ").trim();
|
|
4
|
+
export class SelectList {
|
|
5
|
+
items = [];
|
|
6
|
+
filteredItems = [];
|
|
7
|
+
selectedIndex = 0;
|
|
8
|
+
maxVisible = 5;
|
|
9
|
+
theme;
|
|
10
|
+
onSelect;
|
|
11
|
+
onCancel;
|
|
12
|
+
onSelectionChange;
|
|
13
|
+
constructor(items, maxVisible, theme) {
|
|
14
|
+
this.items = items;
|
|
15
|
+
this.filteredItems = items;
|
|
16
|
+
this.maxVisible = maxVisible;
|
|
17
|
+
this.theme = theme;
|
|
18
|
+
}
|
|
19
|
+
setFilter(filter) {
|
|
20
|
+
this.filteredItems = this.items.filter((item) => item.value.toLowerCase().startsWith(filter.toLowerCase()));
|
|
21
|
+
// Reset selection when filter changes
|
|
22
|
+
this.selectedIndex = 0;
|
|
23
|
+
}
|
|
24
|
+
setSelectedIndex(index) {
|
|
25
|
+
this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
|
|
26
|
+
}
|
|
27
|
+
invalidate() {
|
|
28
|
+
// No cached state to invalidate currently
|
|
29
|
+
}
|
|
30
|
+
render(width) {
|
|
31
|
+
const lines = [];
|
|
32
|
+
// If no items match filter, show message
|
|
33
|
+
if (this.filteredItems.length === 0) {
|
|
34
|
+
lines.push(this.theme.noMatch(" No matching commands"));
|
|
35
|
+
return lines;
|
|
36
|
+
}
|
|
37
|
+
// Calculate visible range with scrolling
|
|
38
|
+
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
|
|
39
|
+
const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
|
|
40
|
+
// Render visible items
|
|
41
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
42
|
+
const item = this.filteredItems[i];
|
|
43
|
+
if (!item)
|
|
44
|
+
continue;
|
|
45
|
+
const isSelected = i === this.selectedIndex;
|
|
46
|
+
const descriptionSingleLine = item.description ? normalizeToSingleLine(item.description) : undefined;
|
|
47
|
+
let line = "";
|
|
48
|
+
if (isSelected) {
|
|
49
|
+
// Use arrow indicator for selection - entire line uses selectedText color
|
|
50
|
+
const prefixWidth = 2; // "→ " is 2 characters visually
|
|
51
|
+
const displayValue = item.label || item.value;
|
|
52
|
+
if (descriptionSingleLine && width > 40) {
|
|
53
|
+
// Calculate how much space we have for value + description
|
|
54
|
+
const maxValueWidth = Math.min(30, width - prefixWidth - 4);
|
|
55
|
+
const truncatedValue = truncateToWidth(displayValue, maxValueWidth, "");
|
|
56
|
+
const spacing = " ".repeat(Math.max(1, 32 - truncatedValue.length));
|
|
57
|
+
// Calculate remaining space for description using visible widths
|
|
58
|
+
const descriptionStart = prefixWidth + truncatedValue.length + spacing.length;
|
|
59
|
+
const remainingWidth = width - descriptionStart - 2; // -2 for safety
|
|
60
|
+
if (remainingWidth > 10) {
|
|
61
|
+
const truncatedDesc = truncateToWidth(descriptionSingleLine, remainingWidth, "");
|
|
62
|
+
// Apply selectedText to entire line content
|
|
63
|
+
line = this.theme.selectedText(`→ ${truncatedValue}${spacing}${truncatedDesc}`);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// Not enough space for description
|
|
67
|
+
const maxWidth = width - prefixWidth - 2;
|
|
68
|
+
line = this.theme.selectedText(`→ ${truncateToWidth(displayValue, maxWidth, "")}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// No description or not enough width
|
|
73
|
+
const maxWidth = width - prefixWidth - 2;
|
|
74
|
+
line = this.theme.selectedText(`→ ${truncateToWidth(displayValue, maxWidth, "")}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const displayValue = item.label || item.value;
|
|
79
|
+
const prefix = " ";
|
|
80
|
+
if (descriptionSingleLine && width > 40) {
|
|
81
|
+
// Calculate how much space we have for value + description
|
|
82
|
+
const maxValueWidth = Math.min(30, width - prefix.length - 4);
|
|
83
|
+
const truncatedValue = truncateToWidth(displayValue, maxValueWidth, "");
|
|
84
|
+
const spacing = " ".repeat(Math.max(1, 32 - truncatedValue.length));
|
|
85
|
+
// Calculate remaining space for description
|
|
86
|
+
const descriptionStart = prefix.length + truncatedValue.length + spacing.length;
|
|
87
|
+
const remainingWidth = width - descriptionStart - 2; // -2 for safety
|
|
88
|
+
if (remainingWidth > 10) {
|
|
89
|
+
const truncatedDesc = truncateToWidth(descriptionSingleLine, remainingWidth, "");
|
|
90
|
+
const descText = this.theme.description(spacing + truncatedDesc);
|
|
91
|
+
line = prefix + truncatedValue + descText;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// Not enough space for description
|
|
95
|
+
const maxWidth = width - prefix.length - 2;
|
|
96
|
+
line = prefix + truncateToWidth(displayValue, maxWidth, "");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// No description or not enough width
|
|
101
|
+
const maxWidth = width - prefix.length - 2;
|
|
102
|
+
line = prefix + truncateToWidth(displayValue, maxWidth, "");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
lines.push(line);
|
|
106
|
+
}
|
|
107
|
+
// Add scroll indicators if needed
|
|
108
|
+
if (startIndex > 0 || endIndex < this.filteredItems.length) {
|
|
109
|
+
const scrollText = ` (${this.selectedIndex + 1}/${this.filteredItems.length})`;
|
|
110
|
+
// Truncate if too long for terminal
|
|
111
|
+
lines.push(this.theme.scrollInfo(truncateToWidth(scrollText, width - 2, "")));
|
|
112
|
+
}
|
|
113
|
+
return lines;
|
|
114
|
+
}
|
|
115
|
+
handleInput(keyData) {
|
|
116
|
+
const kb = getEditorKeybindings();
|
|
117
|
+
// Up arrow - wrap to bottom when at top
|
|
118
|
+
if (kb.matches(keyData, "selectUp")) {
|
|
119
|
+
this.selectedIndex = this.selectedIndex === 0 ? this.filteredItems.length - 1 : this.selectedIndex - 1;
|
|
120
|
+
this.notifySelectionChange();
|
|
121
|
+
}
|
|
122
|
+
// Down arrow - wrap to top when at bottom
|
|
123
|
+
else if (kb.matches(keyData, "selectDown")) {
|
|
124
|
+
this.selectedIndex = this.selectedIndex === this.filteredItems.length - 1 ? 0 : this.selectedIndex + 1;
|
|
125
|
+
this.notifySelectionChange();
|
|
126
|
+
}
|
|
127
|
+
// Enter
|
|
128
|
+
else if (kb.matches(keyData, "selectConfirm")) {
|
|
129
|
+
const selectedItem = this.filteredItems[this.selectedIndex];
|
|
130
|
+
if (selectedItem && this.onSelect) {
|
|
131
|
+
this.onSelect(selectedItem);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Escape or Ctrl+C
|
|
135
|
+
else if (kb.matches(keyData, "selectCancel")) {
|
|
136
|
+
if (this.onCancel) {
|
|
137
|
+
this.onCancel();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
notifySelectionChange() {
|
|
142
|
+
const selectedItem = this.filteredItems[this.selectedIndex];
|
|
143
|
+
if (selectedItem && this.onSelectionChange) {
|
|
144
|
+
this.onSelectionChange(selectedItem);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
getSelectedItem() {
|
|
148
|
+
const item = this.filteredItems[this.selectedIndex];
|
|
149
|
+
return item || null;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=select-list.js.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { fuzzyFilter } from "../fuzzy.js";
|
|
2
|
+
import { getEditorKeybindings } from "../keybindings.js";
|
|
3
|
+
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "../utils.js";
|
|
4
|
+
import { Input } from "./input.js";
|
|
5
|
+
export class SettingsList {
|
|
6
|
+
items;
|
|
7
|
+
filteredItems;
|
|
8
|
+
theme;
|
|
9
|
+
selectedIndex = 0;
|
|
10
|
+
maxVisible;
|
|
11
|
+
onChange;
|
|
12
|
+
onCancel;
|
|
13
|
+
searchInput;
|
|
14
|
+
searchEnabled;
|
|
15
|
+
// Submenu state
|
|
16
|
+
submenuComponent = null;
|
|
17
|
+
submenuItemIndex = null;
|
|
18
|
+
constructor(items, maxVisible, theme, onChange, onCancel, options = {}) {
|
|
19
|
+
this.items = items;
|
|
20
|
+
this.filteredItems = items;
|
|
21
|
+
this.maxVisible = maxVisible;
|
|
22
|
+
this.theme = theme;
|
|
23
|
+
this.onChange = onChange;
|
|
24
|
+
this.onCancel = onCancel;
|
|
25
|
+
this.searchEnabled = options.enableSearch ?? false;
|
|
26
|
+
if (this.searchEnabled) {
|
|
27
|
+
this.searchInput = new Input();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Update an item's currentValue */
|
|
31
|
+
updateValue(id, newValue) {
|
|
32
|
+
const item = this.items.find((i) => i.id === id);
|
|
33
|
+
if (item) {
|
|
34
|
+
item.currentValue = newValue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
invalidate() {
|
|
38
|
+
this.submenuComponent?.invalidate?.();
|
|
39
|
+
}
|
|
40
|
+
render(width) {
|
|
41
|
+
// If submenu is active, render it instead
|
|
42
|
+
if (this.submenuComponent) {
|
|
43
|
+
return this.submenuComponent.render(width);
|
|
44
|
+
}
|
|
45
|
+
return this.renderMainList(width);
|
|
46
|
+
}
|
|
47
|
+
renderMainList(width) {
|
|
48
|
+
const lines = [];
|
|
49
|
+
if (this.searchEnabled && this.searchInput) {
|
|
50
|
+
lines.push(...this.searchInput.render(width));
|
|
51
|
+
lines.push("");
|
|
52
|
+
}
|
|
53
|
+
if (this.items.length === 0) {
|
|
54
|
+
lines.push(this.theme.hint(" No settings available"));
|
|
55
|
+
if (this.searchEnabled) {
|
|
56
|
+
this.addHintLine(lines, width);
|
|
57
|
+
}
|
|
58
|
+
return lines;
|
|
59
|
+
}
|
|
60
|
+
const displayItems = this.searchEnabled ? this.filteredItems : this.items;
|
|
61
|
+
if (displayItems.length === 0) {
|
|
62
|
+
lines.push(truncateToWidth(this.theme.hint(" No matching settings"), width));
|
|
63
|
+
this.addHintLine(lines, width);
|
|
64
|
+
return lines;
|
|
65
|
+
}
|
|
66
|
+
// Calculate visible range with scrolling
|
|
67
|
+
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), displayItems.length - this.maxVisible));
|
|
68
|
+
const endIndex = Math.min(startIndex + this.maxVisible, displayItems.length);
|
|
69
|
+
// Calculate max label width for alignment
|
|
70
|
+
const maxLabelWidth = Math.min(30, Math.max(...this.items.map((item) => visibleWidth(item.label))));
|
|
71
|
+
// Render visible items
|
|
72
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
73
|
+
const item = displayItems[i];
|
|
74
|
+
if (!item)
|
|
75
|
+
continue;
|
|
76
|
+
const isSelected = i === this.selectedIndex;
|
|
77
|
+
const prefix = isSelected ? this.theme.cursor : " ";
|
|
78
|
+
const prefixWidth = visibleWidth(prefix);
|
|
79
|
+
// Pad label to align values
|
|
80
|
+
const labelPadded = item.label + " ".repeat(Math.max(0, maxLabelWidth - visibleWidth(item.label)));
|
|
81
|
+
const labelText = this.theme.label(labelPadded, isSelected);
|
|
82
|
+
// Calculate space for value
|
|
83
|
+
const separator = " ";
|
|
84
|
+
const usedWidth = prefixWidth + maxLabelWidth + visibleWidth(separator);
|
|
85
|
+
const valueMaxWidth = width - usedWidth - 2;
|
|
86
|
+
const valueText = this.theme.value(truncateToWidth(item.currentValue, valueMaxWidth, ""), isSelected);
|
|
87
|
+
lines.push(truncateToWidth(prefix + labelText + separator + valueText, width));
|
|
88
|
+
}
|
|
89
|
+
// Add scroll indicator if needed
|
|
90
|
+
if (startIndex > 0 || endIndex < displayItems.length) {
|
|
91
|
+
const scrollText = ` (${this.selectedIndex + 1}/${displayItems.length})`;
|
|
92
|
+
lines.push(this.theme.hint(truncateToWidth(scrollText, width - 2, "")));
|
|
93
|
+
}
|
|
94
|
+
// Add description for selected item
|
|
95
|
+
const selectedItem = displayItems[this.selectedIndex];
|
|
96
|
+
if (selectedItem?.description) {
|
|
97
|
+
lines.push("");
|
|
98
|
+
const wrappedDesc = wrapTextWithAnsi(selectedItem.description, width - 4);
|
|
99
|
+
for (const line of wrappedDesc) {
|
|
100
|
+
lines.push(this.theme.description(` ${line}`));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Add hint
|
|
104
|
+
this.addHintLine(lines, width);
|
|
105
|
+
return lines;
|
|
106
|
+
}
|
|
107
|
+
handleInput(data) {
|
|
108
|
+
// If submenu is active, delegate all input to it
|
|
109
|
+
// The submenu's onCancel (triggered by escape) will call done() which closes it
|
|
110
|
+
if (this.submenuComponent) {
|
|
111
|
+
this.submenuComponent.handleInput?.(data);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Main list input handling
|
|
115
|
+
const kb = getEditorKeybindings();
|
|
116
|
+
const displayItems = this.searchEnabled ? this.filteredItems : this.items;
|
|
117
|
+
if (kb.matches(data, "selectUp")) {
|
|
118
|
+
if (displayItems.length === 0)
|
|
119
|
+
return;
|
|
120
|
+
this.selectedIndex = this.selectedIndex === 0 ? displayItems.length - 1 : this.selectedIndex - 1;
|
|
121
|
+
}
|
|
122
|
+
else if (kb.matches(data, "selectDown")) {
|
|
123
|
+
if (displayItems.length === 0)
|
|
124
|
+
return;
|
|
125
|
+
this.selectedIndex = this.selectedIndex === displayItems.length - 1 ? 0 : this.selectedIndex + 1;
|
|
126
|
+
}
|
|
127
|
+
else if (kb.matches(data, "selectConfirm") || data === " ") {
|
|
128
|
+
this.activateItem();
|
|
129
|
+
}
|
|
130
|
+
else if (kb.matches(data, "selectCancel")) {
|
|
131
|
+
this.onCancel();
|
|
132
|
+
}
|
|
133
|
+
else if (this.searchEnabled && this.searchInput) {
|
|
134
|
+
const sanitized = data.replace(/ /g, "");
|
|
135
|
+
if (!sanitized) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.searchInput.handleInput(sanitized);
|
|
139
|
+
this.applyFilter(this.searchInput.getValue());
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
activateItem() {
|
|
143
|
+
const item = this.searchEnabled ? this.filteredItems[this.selectedIndex] : this.items[this.selectedIndex];
|
|
144
|
+
if (!item)
|
|
145
|
+
return;
|
|
146
|
+
if (item.submenu) {
|
|
147
|
+
// Open submenu, passing current value so it can pre-select correctly
|
|
148
|
+
this.submenuItemIndex = this.selectedIndex;
|
|
149
|
+
this.submenuComponent = item.submenu(item.currentValue, (selectedValue) => {
|
|
150
|
+
if (selectedValue !== undefined) {
|
|
151
|
+
item.currentValue = selectedValue;
|
|
152
|
+
this.onChange(item.id, selectedValue);
|
|
153
|
+
}
|
|
154
|
+
this.closeSubmenu();
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
else if (item.values && item.values.length > 0) {
|
|
158
|
+
// Cycle through values
|
|
159
|
+
const currentIndex = item.values.indexOf(item.currentValue);
|
|
160
|
+
const nextIndex = (currentIndex + 1) % item.values.length;
|
|
161
|
+
const newValue = item.values[nextIndex];
|
|
162
|
+
item.currentValue = newValue;
|
|
163
|
+
this.onChange(item.id, newValue);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
closeSubmenu() {
|
|
167
|
+
this.submenuComponent = null;
|
|
168
|
+
// Restore selection to the item that opened the submenu
|
|
169
|
+
if (this.submenuItemIndex !== null) {
|
|
170
|
+
this.selectedIndex = this.submenuItemIndex;
|
|
171
|
+
this.submenuItemIndex = null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
applyFilter(query) {
|
|
175
|
+
this.filteredItems = fuzzyFilter(this.items, query, (item) => item.label);
|
|
176
|
+
this.selectedIndex = 0;
|
|
177
|
+
}
|
|
178
|
+
addHintLine(lines, width) {
|
|
179
|
+
lines.push("");
|
|
180
|
+
lines.push(truncateToWidth(this.theme.hint(this.searchEnabled
|
|
181
|
+
? " Type to search · Enter/Space to change · Esc to cancel"
|
|
182
|
+
: " Enter/Space to change · Esc to cancel"), width));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=settings-list.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spacer component that renders empty lines
|
|
3
|
+
*/
|
|
4
|
+
export class Spacer {
|
|
5
|
+
lines;
|
|
6
|
+
constructor(lines = 1) {
|
|
7
|
+
this.lines = lines;
|
|
8
|
+
}
|
|
9
|
+
setLines(lines) {
|
|
10
|
+
this.lines = lines;
|
|
11
|
+
}
|
|
12
|
+
invalidate() {
|
|
13
|
+
// No cached state to invalidate currently
|
|
14
|
+
}
|
|
15
|
+
render(_width) {
|
|
16
|
+
const result = [];
|
|
17
|
+
for (let i = 0; i < this.lines; i++) {
|
|
18
|
+
result.push("");
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=spacer.js.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "../utils.js";
|
|
2
|
+
const DEFAULT_PADDING_X = 1;
|
|
3
|
+
const DEFAULT_PADDING_Y = 0;
|
|
4
|
+
/**
|
|
5
|
+
* Text component - displays multi-line text with word wrapping
|
|
6
|
+
*/
|
|
7
|
+
export class Text {
|
|
8
|
+
text;
|
|
9
|
+
paddingX; // Left/right padding
|
|
10
|
+
paddingY; // Top/bottom padding
|
|
11
|
+
customBgFn;
|
|
12
|
+
// Cache for rendered output
|
|
13
|
+
cachedText;
|
|
14
|
+
cachedWidth;
|
|
15
|
+
cachedLines;
|
|
16
|
+
constructor(text = "", paddingX = DEFAULT_PADDING_X, paddingY = DEFAULT_PADDING_Y, customBgFn) {
|
|
17
|
+
this.text = text;
|
|
18
|
+
this.paddingX = paddingX;
|
|
19
|
+
this.paddingY = paddingY;
|
|
20
|
+
this.customBgFn = customBgFn;
|
|
21
|
+
}
|
|
22
|
+
setText(text) {
|
|
23
|
+
this.text = text;
|
|
24
|
+
this.cachedText = undefined;
|
|
25
|
+
this.cachedWidth = undefined;
|
|
26
|
+
this.cachedLines = undefined;
|
|
27
|
+
}
|
|
28
|
+
setCustomBgFn(customBgFn) {
|
|
29
|
+
this.customBgFn = customBgFn;
|
|
30
|
+
this.cachedText = undefined;
|
|
31
|
+
this.cachedWidth = undefined;
|
|
32
|
+
this.cachedLines = undefined;
|
|
33
|
+
}
|
|
34
|
+
invalidate() {
|
|
35
|
+
this.cachedText = undefined;
|
|
36
|
+
this.cachedWidth = undefined;
|
|
37
|
+
this.cachedLines = undefined;
|
|
38
|
+
}
|
|
39
|
+
render(width) {
|
|
40
|
+
// Check cache
|
|
41
|
+
if (this.cachedLines && this.cachedText === this.text && this.cachedWidth === width) {
|
|
42
|
+
return this.cachedLines;
|
|
43
|
+
}
|
|
44
|
+
// Don't render anything if there's no actual text
|
|
45
|
+
if (!this.text || this.text.trim() === "") {
|
|
46
|
+
const result = [];
|
|
47
|
+
this.cachedText = this.text;
|
|
48
|
+
this.cachedWidth = width;
|
|
49
|
+
this.cachedLines = result;
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
// Replace tabs with 3 spaces
|
|
53
|
+
const normalizedText = this.text.replace(/\t/g, " ");
|
|
54
|
+
// Calculate content width (subtract left/right margins)
|
|
55
|
+
const contentWidth = Math.max(1, width - this.paddingX * 2);
|
|
56
|
+
// Wrap text (this preserves ANSI codes but does NOT pad)
|
|
57
|
+
const wrappedLines = wrapTextWithAnsi(normalizedText, contentWidth);
|
|
58
|
+
// Add margins and background to each line
|
|
59
|
+
const leftMargin = " ".repeat(this.paddingX);
|
|
60
|
+
const rightMargin = " ".repeat(this.paddingX);
|
|
61
|
+
const contentLines = [];
|
|
62
|
+
for (const line of wrappedLines) {
|
|
63
|
+
// Add margins
|
|
64
|
+
const lineWithMargins = leftMargin + line + rightMargin;
|
|
65
|
+
// Apply background if specified (this also pads to full width)
|
|
66
|
+
if (this.customBgFn) {
|
|
67
|
+
contentLines.push(applyBackgroundToLine(lineWithMargins, width, this.customBgFn));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// No background - just pad to width with spaces
|
|
71
|
+
const visibleLen = visibleWidth(lineWithMargins);
|
|
72
|
+
const paddingNeeded = Math.max(0, width - visibleLen);
|
|
73
|
+
contentLines.push(lineWithMargins + " ".repeat(paddingNeeded));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Add top/bottom padding (empty lines)
|
|
77
|
+
const emptyLine = " ".repeat(width);
|
|
78
|
+
const emptyLines = [];
|
|
79
|
+
for (let i = 0; i < this.paddingY; i++) {
|
|
80
|
+
const line = this.customBgFn ? applyBackgroundToLine(emptyLine, width, this.customBgFn) : emptyLine;
|
|
81
|
+
emptyLines.push(line);
|
|
82
|
+
}
|
|
83
|
+
const result = [...emptyLines, ...contentLines, ...emptyLines];
|
|
84
|
+
// Update cache
|
|
85
|
+
this.cachedText = this.text;
|
|
86
|
+
this.cachedWidth = width;
|
|
87
|
+
this.cachedLines = result;
|
|
88
|
+
return result.length > 0 ? result : [""];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { truncateToWidth, visibleWidth } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Text component that truncates to fit viewport width
|
|
4
|
+
*/
|
|
5
|
+
export class TruncatedText {
|
|
6
|
+
text;
|
|
7
|
+
paddingX;
|
|
8
|
+
paddingY;
|
|
9
|
+
constructor(text, paddingX = 0, paddingY = 0) {
|
|
10
|
+
this.text = text;
|
|
11
|
+
this.paddingX = paddingX;
|
|
12
|
+
this.paddingY = paddingY;
|
|
13
|
+
}
|
|
14
|
+
invalidate() {
|
|
15
|
+
// No cached state to invalidate currently
|
|
16
|
+
}
|
|
17
|
+
render(width) {
|
|
18
|
+
const result = [];
|
|
19
|
+
// Empty line padded to width
|
|
20
|
+
const emptyLine = " ".repeat(width);
|
|
21
|
+
// Add vertical padding above
|
|
22
|
+
for (let i = 0; i < this.paddingY; i++) {
|
|
23
|
+
result.push(emptyLine);
|
|
24
|
+
}
|
|
25
|
+
// Calculate available width after horizontal padding
|
|
26
|
+
const availableWidth = Math.max(1, width - this.paddingX * 2);
|
|
27
|
+
// Take only the first line (stop at newline)
|
|
28
|
+
let singleLineText = this.text;
|
|
29
|
+
const newlineIndex = this.text.indexOf("\n");
|
|
30
|
+
if (newlineIndex !== -1) {
|
|
31
|
+
singleLineText = this.text.substring(0, newlineIndex);
|
|
32
|
+
}
|
|
33
|
+
// Truncate text if needed (accounting for ANSI codes)
|
|
34
|
+
const displayText = truncateToWidth(singleLineText, availableWidth);
|
|
35
|
+
// Add horizontal padding
|
|
36
|
+
const leftPadding = " ".repeat(this.paddingX);
|
|
37
|
+
const rightPadding = " ".repeat(this.paddingX);
|
|
38
|
+
const lineWithPadding = leftPadding + displayText + rightPadding;
|
|
39
|
+
// Pad line to exactly width characters
|
|
40
|
+
const lineVisibleWidth = visibleWidth(lineWithPadding);
|
|
41
|
+
const paddingNeeded = Math.max(0, width - lineVisibleWidth);
|
|
42
|
+
const finalLine = lineWithPadding + " ".repeat(paddingNeeded);
|
|
43
|
+
result.push(finalLine);
|
|
44
|
+
// Add vertical padding below
|
|
45
|
+
for (let i = 0; i < this.paddingY; i++) {
|
|
46
|
+
result.push(emptyLine);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=truncated-text.js.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fuzzy matching utilities.
|
|
3
|
+
* Matches if all query characters appear in order (not necessarily consecutive).
|
|
4
|
+
* Lower score = better match.
|
|
5
|
+
*/
|
|
6
|
+
export function fuzzyMatch(query, text) {
|
|
7
|
+
const queryLower = query.toLowerCase();
|
|
8
|
+
const textLower = text.toLowerCase();
|
|
9
|
+
const matchQuery = (normalizedQuery) => {
|
|
10
|
+
if (normalizedQuery.length === 0) {
|
|
11
|
+
return { matches: true, score: 0 };
|
|
12
|
+
}
|
|
13
|
+
if (normalizedQuery.length > textLower.length) {
|
|
14
|
+
return { matches: false, score: 0 };
|
|
15
|
+
}
|
|
16
|
+
let queryIndex = 0;
|
|
17
|
+
let score = 0;
|
|
18
|
+
let lastMatchIndex = -1;
|
|
19
|
+
let consecutiveMatches = 0;
|
|
20
|
+
for (let i = 0; i < textLower.length && queryIndex < normalizedQuery.length; i++) {
|
|
21
|
+
if (textLower[i] === normalizedQuery[queryIndex]) {
|
|
22
|
+
const isWordBoundary = i === 0 || /[\s\-_./:]/.test(textLower[i - 1]);
|
|
23
|
+
// Reward consecutive matches
|
|
24
|
+
if (lastMatchIndex === i - 1) {
|
|
25
|
+
consecutiveMatches++;
|
|
26
|
+
score -= consecutiveMatches * 5;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
consecutiveMatches = 0;
|
|
30
|
+
// Penalize gaps
|
|
31
|
+
if (lastMatchIndex >= 0) {
|
|
32
|
+
score += (i - lastMatchIndex - 1) * 2;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Reward word boundary matches
|
|
36
|
+
if (isWordBoundary) {
|
|
37
|
+
score -= 10;
|
|
38
|
+
}
|
|
39
|
+
// Slight penalty for later matches
|
|
40
|
+
score += i * 0.1;
|
|
41
|
+
lastMatchIndex = i;
|
|
42
|
+
queryIndex++;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (queryIndex < normalizedQuery.length) {
|
|
46
|
+
return { matches: false, score: 0 };
|
|
47
|
+
}
|
|
48
|
+
return { matches: true, score };
|
|
49
|
+
};
|
|
50
|
+
const primaryMatch = matchQuery(queryLower);
|
|
51
|
+
if (primaryMatch.matches) {
|
|
52
|
+
return primaryMatch;
|
|
53
|
+
}
|
|
54
|
+
const alphaNumericMatch = queryLower.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/);
|
|
55
|
+
const numericAlphaMatch = queryLower.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/);
|
|
56
|
+
const swappedQuery = alphaNumericMatch
|
|
57
|
+
? `${alphaNumericMatch.groups?.digits ?? ""}${alphaNumericMatch.groups?.letters ?? ""}`
|
|
58
|
+
: numericAlphaMatch
|
|
59
|
+
? `${numericAlphaMatch.groups?.letters ?? ""}${numericAlphaMatch.groups?.digits ?? ""}`
|
|
60
|
+
: "";
|
|
61
|
+
if (!swappedQuery) {
|
|
62
|
+
return primaryMatch;
|
|
63
|
+
}
|
|
64
|
+
const swappedMatch = matchQuery(swappedQuery);
|
|
65
|
+
if (!swappedMatch.matches) {
|
|
66
|
+
return primaryMatch;
|
|
67
|
+
}
|
|
68
|
+
return { matches: true, score: swappedMatch.score + 5 };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Filter and sort items by fuzzy match quality (best matches first).
|
|
72
|
+
* Supports space-separated tokens: all tokens must match.
|
|
73
|
+
*/
|
|
74
|
+
export function fuzzyFilter(items, query, getText) {
|
|
75
|
+
if (!query.trim()) {
|
|
76
|
+
return items;
|
|
77
|
+
}
|
|
78
|
+
const tokens = query
|
|
79
|
+
.trim()
|
|
80
|
+
.split(/\s+/)
|
|
81
|
+
.filter((t) => t.length > 0);
|
|
82
|
+
if (tokens.length === 0) {
|
|
83
|
+
return items;
|
|
84
|
+
}
|
|
85
|
+
const results = [];
|
|
86
|
+
for (const item of items) {
|
|
87
|
+
const text = getText(item);
|
|
88
|
+
let totalScore = 0;
|
|
89
|
+
let allMatch = true;
|
|
90
|
+
for (const token of tokens) {
|
|
91
|
+
const match = fuzzyMatch(token, text);
|
|
92
|
+
if (match.matches) {
|
|
93
|
+
totalScore += match.score;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
allMatch = false;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (allMatch) {
|
|
101
|
+
results.push({ item, totalScore });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
results.sort((a, b) => a.totalScore - b.totalScore);
|
|
105
|
+
return results.map((r) => r.item);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=fuzzy.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Vendored from get-east-asian-width@1.3.0
|
|
2
|
+
import {getCategory, isAmbiguous, isFullWidth, isWide} from './lookup.js';
|
|
3
|
+
|
|
4
|
+
function validate(codePoint) {
|
|
5
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
6
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function eastAsianWidthType(codePoint) {
|
|
11
|
+
validate(codePoint);
|
|
12
|
+
|
|
13
|
+
return getCategory(codePoint);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
17
|
+
validate(codePoint);
|
|
18
|
+
|
|
19
|
+
if (
|
|
20
|
+
isFullWidth(codePoint)
|
|
21
|
+
|| isWide(codePoint)
|
|
22
|
+
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
23
|
+
) {
|
|
24
|
+
return 2;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// For Prettier. This doesn't count "ambiguous" characters or check for valid input.
|
|
31
|
+
// https://github.com/sindresorhus/get-east-asian-width/pull/6
|
|
32
|
+
export const _isNarrowWidth = codePoint => !(isFullWidth(codePoint) || isWide(codePoint));
|