terminal-pilot 0.0.30 → 0.0.32
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/dist/cli.js +1599 -497
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +489 -6
- package/dist/commands/close-session.js.map +4 -4
- package/dist/commands/create-session.js +489 -6
- package/dist/commands/create-session.js.map +4 -4
- package/dist/commands/fill.js +489 -6
- package/dist/commands/fill.js.map +4 -4
- package/dist/commands/get-session.js +489 -6
- package/dist/commands/get-session.js.map +4 -4
- package/dist/commands/index.js +630 -44
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +626 -40
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +68 -17
- package/dist/commands/installer.js.map +4 -4
- package/dist/commands/list-sessions.js +489 -6
- package/dist/commands/list-sessions.js.map +4 -4
- package/dist/commands/press-key.js +489 -6
- package/dist/commands/press-key.js.map +4 -4
- package/dist/commands/read-history.js +489 -6
- package/dist/commands/read-history.js.map +4 -4
- package/dist/commands/read-screen.js +489 -6
- package/dist/commands/read-screen.js.map +4 -4
- package/dist/commands/resize.js +489 -6
- package/dist/commands/resize.js.map +4 -4
- package/dist/commands/runtime.js.map +1 -1
- package/dist/commands/screenshot.js +489 -6
- package/dist/commands/screenshot.js.map +4 -4
- package/dist/commands/send-signal.js +489 -6
- package/dist/commands/send-signal.js.map +4 -4
- package/dist/commands/type.js +489 -6
- package/dist/commands/type.js.map +4 -4
- package/dist/commands/uninstall.js +554 -20
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/commands/wait-for-exit.js +489 -6
- package/dist/commands/wait-for-exit.js.map +4 -4
- package/dist/commands/wait-for.js +489 -6
- package/dist/commands/wait-for.js.map +4 -4
- package/dist/testing/cli-repl.js +1599 -497
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +1609 -507
- package/dist/testing/qa-cli.js.map +4 -4
- package/node_modules/@poe-code/agent-defs/README.md +35 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +21 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +18 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +25 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +15 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.js +16 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +16 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +9 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.js +9 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +16 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +20 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +14 -0
- package/node_modules/@poe-code/agent-defs/dist/index.d.ts +5 -0
- package/node_modules/@poe-code/agent-defs/dist/index.js +3 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +3 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.js +45 -0
- package/node_modules/@poe-code/agent-defs/dist/specifier.d.ts +7 -0
- package/node_modules/@poe-code/agent-defs/dist/specifier.js +40 -0
- package/node_modules/@poe-code/agent-defs/dist/types.d.ts +28 -0
- package/node_modules/@poe-code/agent-defs/dist/types.js +1 -0
- package/node_modules/@poe-code/agent-defs/package.json +20 -0
- package/node_modules/@poe-code/agent-skill-config/dist/apply.js +2 -1
- package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.d.ts +1 -0
- package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +37 -18
- package/node_modules/@poe-code/agent-skill-config/dist/resolve-skill-reference.js +8 -4
- package/node_modules/@poe-code/agent-skill-config/package.json +1 -5
- package/node_modules/@poe-code/config-mutations/README.md +55 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.d.ts +1 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.js +6 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.d.ts +6 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +829 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.d.ts +17 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +64 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.d.ts +7 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.js +39 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/index.d.ts +13 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/index.js +49 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/json.d.ts +32 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/json.js +171 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.d.ts +2 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +75 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.d.ts +2 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +76 -0
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.d.ts +18 -0
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.js +43 -0
- package/node_modules/@poe-code/config-mutations/dist/index.d.ts +8 -0
- package/node_modules/@poe-code/config-mutations/dist/index.js +8 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.d.ts +47 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.js +34 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +62 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +55 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.d.ts +40 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.js +32 -0
- package/node_modules/@poe-code/config-mutations/dist/template/render.d.ts +6 -0
- package/node_modules/@poe-code/config-mutations/dist/template/render.js +8 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.d.ts +7 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.js +21 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/index.d.ts +3 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/index.js +2 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.d.ts +25 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +194 -0
- package/node_modules/@poe-code/config-mutations/dist/types.d.ts +168 -0
- package/node_modules/@poe-code/config-mutations/dist/types.js +6 -0
- package/node_modules/@poe-code/config-mutations/package.json +29 -0
- package/node_modules/@poe-code/frontmatter/README.md +35 -0
- package/node_modules/@poe-code/frontmatter/dist/fences.d.ts +25 -0
- package/node_modules/@poe-code/frontmatter/dist/fences.js +100 -0
- package/node_modules/@poe-code/frontmatter/dist/index.d.ts +3 -0
- package/node_modules/@poe-code/frontmatter/dist/index.js +3 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +20 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.js +209 -0
- package/node_modules/@poe-code/frontmatter/dist/stringify.d.ts +1 -0
- package/node_modules/@poe-code/frontmatter/dist/stringify.js +48 -0
- package/node_modules/@poe-code/frontmatter/package.json +25 -0
- package/node_modules/toolcraft-design/README.md +160 -0
- package/node_modules/toolcraft-design/dist/acp/components.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/acp/components.js +137 -0
- package/node_modules/toolcraft-design/dist/acp/index.d.ts +3 -0
- package/node_modules/toolcraft-design/dist/acp/index.js +2 -0
- package/node_modules/toolcraft-design/dist/acp/writer.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/acp/writer.js +21 -0
- package/node_modules/toolcraft-design/dist/components/browser.d.ts +15 -0
- package/node_modules/toolcraft-design/dist/components/browser.js +31 -0
- package/node_modules/toolcraft-design/dist/components/catalog.d.ts +26 -0
- package/node_modules/toolcraft-design/dist/components/catalog.js +95 -0
- package/node_modules/toolcraft-design/dist/components/color.d.ts +31 -0
- package/node_modules/toolcraft-design/dist/components/color.js +102 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.js +23 -0
- package/node_modules/toolcraft-design/dist/components/detail-card.d.ts +22 -0
- package/node_modules/toolcraft-design/dist/components/detail-card.js +45 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter-plain.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +132 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +33 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter.js +213 -0
- package/node_modules/toolcraft-design/dist/components/index.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/components/index.js +10 -0
- package/node_modules/toolcraft-design/dist/components/logger.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/components/logger.js +60 -0
- package/node_modules/toolcraft-design/dist/components/symbols.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/components/symbols.js +71 -0
- package/node_modules/toolcraft-design/dist/components/table.d.ts +15 -0
- package/node_modules/toolcraft-design/dist/components/table.js +302 -0
- package/node_modules/toolcraft-design/dist/components/template.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/components/template.js +437 -0
- package/node_modules/toolcraft-design/dist/components/text.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/components/text.js +145 -0
- package/node_modules/toolcraft-design/dist/dashboard/ansi.d.ts +18 -0
- package/node_modules/toolcraft-design/dist/dashboard/ansi.js +343 -0
- package/node_modules/toolcraft-design/dist/dashboard/buffer.d.ts +25 -0
- package/node_modules/toolcraft-design/dist/dashboard/buffer.js +219 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/border.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/border.js +123 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/footer.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/footer.js +56 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.js +268 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.js +107 -0
- package/node_modules/toolcraft-design/dist/dashboard/dashboard.d.ts +20 -0
- package/node_modules/toolcraft-design/dist/dashboard/dashboard.js +167 -0
- package/node_modules/toolcraft-design/dist/dashboard/demo.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/dashboard/demo.js +145 -0
- package/node_modules/toolcraft-design/dist/dashboard/index.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/index.js +4 -0
- package/node_modules/toolcraft-design/dist/dashboard/keymap.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/keymap.js +233 -0
- package/node_modules/toolcraft-design/dist/dashboard/layout.d.ts +25 -0
- package/node_modules/toolcraft-design/dist/dashboard/layout.js +79 -0
- package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.js +7 -0
- package/node_modules/toolcraft-design/dist/dashboard/snapshot.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/dashboard/snapshot.js +68 -0
- package/node_modules/toolcraft-design/dist/dashboard/store.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/store.js +51 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal-width.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal-width.js +71 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal.d.ts +37 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal.js +264 -0
- package/node_modules/toolcraft-design/dist/dashboard/types.d.ts +38 -0
- package/node_modules/toolcraft-design/dist/dashboard/types.js +1 -0
- package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/explorer/actions.js +39 -0
- package/node_modules/toolcraft-design/dist/explorer/demo.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/explorer/demo.js +297 -0
- package/node_modules/toolcraft-design/dist/explorer/events.d.ts +67 -0
- package/node_modules/toolcraft-design/dist/explorer/events.js +1 -0
- package/node_modules/toolcraft-design/dist/explorer/filter.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/explorer/filter.js +95 -0
- package/node_modules/toolcraft-design/dist/explorer/index.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/explorer/index.js +8 -0
- package/node_modules/toolcraft-design/dist/explorer/jobs.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/explorer/jobs.js +59 -0
- package/node_modules/toolcraft-design/dist/explorer/keymap.d.ts +21 -0
- package/node_modules/toolcraft-design/dist/explorer/keymap.js +376 -0
- package/node_modules/toolcraft-design/dist/explorer/layout.d.ts +20 -0
- package/node_modules/toolcraft-design/dist/explorer/layout.js +73 -0
- package/node_modules/toolcraft-design/dist/explorer/reducer.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/explorer/reducer.js +782 -0
- package/node_modules/toolcraft-design/dist/explorer/render/detail.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/detail.js +97 -0
- package/node_modules/toolcraft-design/dist/explorer/render/footer.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/footer.js +73 -0
- package/node_modules/toolcraft-design/dist/explorer/render/header.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/header.js +49 -0
- package/node_modules/toolcraft-design/dist/explorer/render/index.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/explorer/render/index.js +53 -0
- package/node_modules/toolcraft-design/dist/explorer/render/list.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/list.js +116 -0
- package/node_modules/toolcraft-design/dist/explorer/render/modal.d.ts +3 -0
- package/node_modules/toolcraft-design/dist/explorer/render/modal.js +87 -0
- package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.js +156 -0
- package/node_modules/toolcraft-design/dist/explorer/render/text.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/explorer/render/text.js +81 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.js +340 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.d.ts +50 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.js +101 -0
- package/node_modules/toolcraft-design/dist/explorer/state.d.ts +137 -0
- package/node_modules/toolcraft-design/dist/explorer/state.js +86 -0
- package/node_modules/toolcraft-design/dist/explorer/theme.d.ts +27 -0
- package/node_modules/toolcraft-design/dist/explorer/theme.js +29 -0
- package/node_modules/toolcraft-design/dist/index.d.ts +50 -0
- package/node_modules/toolcraft-design/dist/index.js +43 -0
- package/node_modules/toolcraft-design/dist/internal/color-support.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/internal/color-support.js +12 -0
- package/node_modules/toolcraft-design/dist/internal/output-format.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/internal/output-format.js +22 -0
- package/node_modules/toolcraft-design/dist/internal/strip-ansi.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/internal/strip-ansi.js +50 -0
- package/node_modules/toolcraft-design/dist/internal/theme-detect.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/internal/theme-detect.js +71 -0
- package/node_modules/toolcraft-design/dist/internal/theme-state.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/internal/theme-state.js +35 -0
- package/node_modules/toolcraft-design/dist/prompts/index.d.ts +91 -0
- package/node_modules/toolcraft-design/dist/prompts/index.js +137 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.js +4 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.js +47 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +55 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +274 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.d.ts +20 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.js +53 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/index.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/index.js +6 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/keys.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/keys.js +28 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.js +131 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.js +52 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/password.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/password.js +55 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/select.d.ts +18 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/select.js +89 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.d.ts +21 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.js +32 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/text.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/text.js +60 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.js +18 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.js +9 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/intro.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/intro.js +16 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/log.d.ts +18 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/log.js +104 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/note.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/note.js +39 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/outro.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/outro.js +16 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.js +74 -0
- package/node_modules/toolcraft-design/dist/prompts/theme.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/prompts/theme.js +15 -0
- package/node_modules/toolcraft-design/dist/static/index.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/static/index.js +2 -0
- package/node_modules/toolcraft-design/dist/static/menu.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/static/menu.js +42 -0
- package/node_modules/toolcraft-design/dist/static/spinner.d.ts +14 -0
- package/node_modules/toolcraft-design/dist/static/spinner.js +52 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/ast.d.ts +92 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/ast.js +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.js +139 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.js +8 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.js +1495 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.js +36 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.js +1190 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser.js +42 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.js +615 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.js +27 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.js +5 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.d.ts +37 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.js +85 -0
- package/node_modules/toolcraft-design/dist/tokens/index.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/tokens/index.js +5 -0
- package/node_modules/toolcraft-design/dist/tokens/spacing.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/tokens/spacing.js +6 -0
- package/node_modules/toolcraft-design/dist/tokens/typography.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/tokens/typography.js +8 -0
- package/node_modules/toolcraft-design/dist/tokens/widths.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/tokens/widths.js +5 -0
- package/node_modules/toolcraft-design/package.json +44 -0
- package/package.json +15 -5
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { widths } from "../tokens/widths.js";
|
|
2
|
+
import { resolveOutputFormat } from "../internal/output-format.js";
|
|
3
|
+
import { stripAnsi } from "../internal/strip-ansi.js";
|
|
4
|
+
const reset = "\x1b[0m";
|
|
5
|
+
const ellipsis = "…";
|
|
6
|
+
const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
7
|
+
function getCell(row, name) {
|
|
8
|
+
return Object.prototype.hasOwnProperty.call(row, name) ? row[name] ?? "" : "";
|
|
9
|
+
}
|
|
10
|
+
function renderMarkdownCell(value) {
|
|
11
|
+
return stripAnsi(value)
|
|
12
|
+
.replaceAll("\r\n", " ")
|
|
13
|
+
.replaceAll("\n", " ")
|
|
14
|
+
.replaceAll("\r", " ")
|
|
15
|
+
.replaceAll("|", "\\|");
|
|
16
|
+
}
|
|
17
|
+
function isAnsiSequence(value, index) {
|
|
18
|
+
return value[index] === "\u001b" && value[index + 1] === "[";
|
|
19
|
+
}
|
|
20
|
+
function readAnsiSequence(value, index) {
|
|
21
|
+
let nextIndex = index + 2;
|
|
22
|
+
while (nextIndex < value.length && value[nextIndex] !== "m") {
|
|
23
|
+
nextIndex += 1;
|
|
24
|
+
}
|
|
25
|
+
if (nextIndex < value.length) {
|
|
26
|
+
nextIndex += 1;
|
|
27
|
+
}
|
|
28
|
+
return { sequence: value.slice(index, nextIndex), nextIndex };
|
|
29
|
+
}
|
|
30
|
+
function isCombiningCodePoint(codePoint) {
|
|
31
|
+
return ((codePoint >= 0x0300 && codePoint <= 0x036f) ||
|
|
32
|
+
(codePoint >= 0x1ab0 && codePoint <= 0x1aff) ||
|
|
33
|
+
(codePoint >= 0x1dc0 && codePoint <= 0x1dff) ||
|
|
34
|
+
(codePoint >= 0x20d0 && codePoint <= 0x20ff) ||
|
|
35
|
+
(codePoint >= 0xfe20 && codePoint <= 0xfe2f));
|
|
36
|
+
}
|
|
37
|
+
function isWideCodePoint(codePoint) {
|
|
38
|
+
return ((codePoint >= 0x1100 && codePoint <= 0x115f) ||
|
|
39
|
+
codePoint === 0x2329 ||
|
|
40
|
+
codePoint === 0x232a ||
|
|
41
|
+
(codePoint >= 0x2e80 && codePoint <= 0xa4cf && codePoint !== 0x303f) ||
|
|
42
|
+
(codePoint >= 0xac00 && codePoint <= 0xd7a3) ||
|
|
43
|
+
(codePoint >= 0xf900 && codePoint <= 0xfaff) ||
|
|
44
|
+
(codePoint >= 0xfe10 && codePoint <= 0xfe19) ||
|
|
45
|
+
(codePoint >= 0xfe30 && codePoint <= 0xfe6f) ||
|
|
46
|
+
(codePoint >= 0xff00 && codePoint <= 0xff60) ||
|
|
47
|
+
(codePoint >= 0xffe0 && codePoint <= 0xffe6) ||
|
|
48
|
+
(codePoint >= 0x2600 && codePoint <= 0x27bf) ||
|
|
49
|
+
(codePoint >= 0x1f300 && codePoint <= 0x1faff) ||
|
|
50
|
+
(codePoint >= 0x20000 && codePoint <= 0x3fffd));
|
|
51
|
+
}
|
|
52
|
+
function isEmojiClusterCodePoint(codePoint) {
|
|
53
|
+
return ((codePoint >= 0x1f1e6 && codePoint <= 0x1f1ff) ||
|
|
54
|
+
(codePoint >= 0x1f300 && codePoint <= 0x1faff) ||
|
|
55
|
+
(codePoint >= 0x2600 && codePoint <= 0x27bf));
|
|
56
|
+
}
|
|
57
|
+
function codePointWidth(char) {
|
|
58
|
+
const codePoint = char.codePointAt(0) ?? 0;
|
|
59
|
+
if (codePoint === 0 || codePoint < 0x20 || (codePoint >= 0x7f && codePoint < 0xa0)) {
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
if (codePoint === 0x200d ||
|
|
63
|
+
(codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||
|
|
64
|
+
isCombiningCodePoint(codePoint)) {
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
return isWideCodePoint(codePoint) ? 2 : 1;
|
|
68
|
+
}
|
|
69
|
+
function readPrintableCluster(value, index) {
|
|
70
|
+
const nextAnsiIndex = value.indexOf("\u001b[", index);
|
|
71
|
+
const plainText = value.slice(index, nextAnsiIndex === -1 ? undefined : nextAnsiIndex);
|
|
72
|
+
const firstSegment = graphemeSegmenter.segment(plainText)[Symbol.iterator]().next().value;
|
|
73
|
+
return firstSegment?.segment ?? Array.from(plainText)[0] ?? "";
|
|
74
|
+
}
|
|
75
|
+
function clusterWidth(cluster) {
|
|
76
|
+
const codePoints = Array.from(cluster).map((char) => char.codePointAt(0) ?? 0);
|
|
77
|
+
const isEmojiCluster = codePoints.length > 1 &&
|
|
78
|
+
codePoints.some((codePoint) => codePoint === 0x200d ||
|
|
79
|
+
(codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||
|
|
80
|
+
isEmojiClusterCodePoint(codePoint));
|
|
81
|
+
if (isEmojiCluster) {
|
|
82
|
+
return 2;
|
|
83
|
+
}
|
|
84
|
+
return codePoints.reduce((width, codePoint) => width + codePointWidth(String.fromCodePoint(codePoint)), 0);
|
|
85
|
+
}
|
|
86
|
+
function displayWidth(value) {
|
|
87
|
+
let width = 0;
|
|
88
|
+
let index = 0;
|
|
89
|
+
while (index < value.length) {
|
|
90
|
+
if (isAnsiSequence(value, index)) {
|
|
91
|
+
index = readAnsiSequence(value, index).nextIndex;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const cluster = readPrintableCluster(value, index);
|
|
95
|
+
width += clusterWidth(cluster);
|
|
96
|
+
index += cluster.length;
|
|
97
|
+
}
|
|
98
|
+
return width;
|
|
99
|
+
}
|
|
100
|
+
function truncateToWidth(value, width) {
|
|
101
|
+
if (displayWidth(value) <= width) {
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
if (width <= 0) {
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
const targetWidth = width <= 1 ? 0 : width - displayWidth(ellipsis);
|
|
108
|
+
let output = "";
|
|
109
|
+
let currentWidth = 0;
|
|
110
|
+
let index = 0;
|
|
111
|
+
let sawAnsi = false;
|
|
112
|
+
while (index < value.length) {
|
|
113
|
+
if (isAnsiSequence(value, index)) {
|
|
114
|
+
const ansi = readAnsiSequence(value, index);
|
|
115
|
+
sawAnsi = true;
|
|
116
|
+
output += ansi.sequence;
|
|
117
|
+
index = ansi.nextIndex;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const cluster = readPrintableCluster(value, index);
|
|
121
|
+
const width = clusterWidth(cluster);
|
|
122
|
+
if (currentWidth + width > targetWidth) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
output += cluster;
|
|
126
|
+
currentWidth += width;
|
|
127
|
+
index += cluster.length;
|
|
128
|
+
}
|
|
129
|
+
return `${output}${ellipsis}${sawAnsi ? reset : ""}`;
|
|
130
|
+
}
|
|
131
|
+
function padCell(value, width, alignment) {
|
|
132
|
+
const visibleWidth = displayWidth(value);
|
|
133
|
+
const padding = Math.max(0, width - visibleWidth);
|
|
134
|
+
if (alignment === "right") {
|
|
135
|
+
return `${" ".repeat(padding)}${value}`;
|
|
136
|
+
}
|
|
137
|
+
if (alignment === "center") {
|
|
138
|
+
const left = Math.floor(padding / 2);
|
|
139
|
+
const right = padding - left;
|
|
140
|
+
return `${" ".repeat(left)}${value}${" ".repeat(right)}`;
|
|
141
|
+
}
|
|
142
|
+
return `${value}${" ".repeat(padding)}`;
|
|
143
|
+
}
|
|
144
|
+
function getAlignment(column) {
|
|
145
|
+
const alignment = column.alignment;
|
|
146
|
+
return alignment === "right" || alignment === "center" ? alignment : "left";
|
|
147
|
+
}
|
|
148
|
+
function getColumnWidth(column) {
|
|
149
|
+
if (!Number.isFinite(column.maxLen) || column.maxLen <= 0) {
|
|
150
|
+
throw new Error("maxLen must be a positive finite number.");
|
|
151
|
+
}
|
|
152
|
+
const configuredMin = column.minLen;
|
|
153
|
+
const minWidth = Math.max(1, configuredMin ?? 1);
|
|
154
|
+
return Math.max(minWidth, column.maxLen);
|
|
155
|
+
}
|
|
156
|
+
function computeColumns(columns) {
|
|
157
|
+
return columns.map((column) => ({
|
|
158
|
+
name: column.name,
|
|
159
|
+
title: column.title,
|
|
160
|
+
alignment: getAlignment(column),
|
|
161
|
+
width: getColumnWidth(column)
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
function renderBorder(columns, theme, parts) {
|
|
165
|
+
const horizontal = theme.muted("─");
|
|
166
|
+
const segments = columns.map((column) => horizontal.repeat(column.width + 2));
|
|
167
|
+
return [
|
|
168
|
+
theme.muted(parts.left),
|
|
169
|
+
segments.join(theme.muted(parts.mid)),
|
|
170
|
+
theme.muted(parts.right)
|
|
171
|
+
].join("");
|
|
172
|
+
}
|
|
173
|
+
function renderTerminalRow(values, columns, theme) {
|
|
174
|
+
const vertical = theme.muted("│");
|
|
175
|
+
const cells = values.map((value, index) => {
|
|
176
|
+
const column = columns[index];
|
|
177
|
+
const truncated = truncateToWidth(value, column.width);
|
|
178
|
+
return ` ${padCell(truncated, column.width, column.alignment)} `;
|
|
179
|
+
});
|
|
180
|
+
return `${vertical}${cells.join(vertical)}${vertical}`;
|
|
181
|
+
}
|
|
182
|
+
function wrapDetailValue(value, width) {
|
|
183
|
+
const lines = [];
|
|
184
|
+
for (const paragraph of value.split("\n")) {
|
|
185
|
+
let line = "";
|
|
186
|
+
for (const rawWord of paragraph.split(" ")) {
|
|
187
|
+
const words = [];
|
|
188
|
+
let word = rawWord;
|
|
189
|
+
while (displayWidth(word) > width) {
|
|
190
|
+
let chunk = "";
|
|
191
|
+
let index = 0;
|
|
192
|
+
while (index < word.length) {
|
|
193
|
+
const cluster = readPrintableCluster(word, index);
|
|
194
|
+
if (displayWidth(`${chunk}${cluster}`) > width) {
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
chunk += cluster;
|
|
198
|
+
index += cluster.length;
|
|
199
|
+
}
|
|
200
|
+
words.push(chunk);
|
|
201
|
+
word = word.slice(chunk.length);
|
|
202
|
+
}
|
|
203
|
+
words.push(word);
|
|
204
|
+
for (const word of words) {
|
|
205
|
+
if (line.length === 0) {
|
|
206
|
+
line = word;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (displayWidth(`${line} ${word}`) <= width) {
|
|
210
|
+
line = `${line} ${word}`;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
lines.push(line);
|
|
214
|
+
line = word;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
lines.push(line);
|
|
218
|
+
}
|
|
219
|
+
return lines.length > 0 ? lines : [""];
|
|
220
|
+
}
|
|
221
|
+
function renderTableTerminal(options) {
|
|
222
|
+
const { theme, columns, rows } = options;
|
|
223
|
+
const computedColumns = computeColumns(columns);
|
|
224
|
+
if (options.variant === "detail") {
|
|
225
|
+
const labelColumn = computedColumns[0];
|
|
226
|
+
const valueColumn = computedColumns[1];
|
|
227
|
+
if (!labelColumn || !valueColumn) {
|
|
228
|
+
return "";
|
|
229
|
+
}
|
|
230
|
+
const detailLabelWidth = widths.helpColumn + 12;
|
|
231
|
+
const labelWidth = Math.min(labelColumn.width, detailLabelWidth);
|
|
232
|
+
const valueWidth = Math.max(20, (options.maxWidth ?? widths.maxLine) - labelWidth - 2);
|
|
233
|
+
const continuation = " ".repeat(labelWidth + 2);
|
|
234
|
+
return rows
|
|
235
|
+
.flatMap((row) => {
|
|
236
|
+
const label = truncateToWidth(getCell(row, labelColumn.name), labelWidth);
|
|
237
|
+
const values = wrapDetailValue(getCell(row, valueColumn.name), valueWidth);
|
|
238
|
+
if (values.length === 1 && values[0] === "") {
|
|
239
|
+
return [theme.header(label)];
|
|
240
|
+
}
|
|
241
|
+
return [
|
|
242
|
+
`${theme.muted(padCell(label, labelWidth, "left"))} ${values[0] ?? ""}`,
|
|
243
|
+
...values.slice(1).map((value) => `${continuation}${value}`)
|
|
244
|
+
];
|
|
245
|
+
})
|
|
246
|
+
.join("\n");
|
|
247
|
+
}
|
|
248
|
+
const separatorOptions = options;
|
|
249
|
+
const includeRowSeparators = separatorOptions.rowSeparator === true || separatorOptions.rowSeparators === true;
|
|
250
|
+
const top = renderBorder(computedColumns, theme, { left: "┌", mid: "┬", right: "┐" });
|
|
251
|
+
const header = renderTerminalRow(computedColumns.map((column) => theme.header(column.title)), computedColumns, theme);
|
|
252
|
+
const headerBottom = renderBorder(computedColumns, theme, { left: "├", mid: "┼", right: "┤" });
|
|
253
|
+
const bottom = renderBorder(computedColumns, theme, { left: "└", mid: "┴", right: "┘" });
|
|
254
|
+
const renderedRows = [];
|
|
255
|
+
for (const [index, row] of rows.entries()) {
|
|
256
|
+
if (includeRowSeparators && index > 0) {
|
|
257
|
+
renderedRows.push(headerBottom);
|
|
258
|
+
}
|
|
259
|
+
renderedRows.push(renderTerminalRow(computedColumns.map((column) => getCell(row, column.name)), computedColumns, theme));
|
|
260
|
+
}
|
|
261
|
+
return [top, header, headerBottom, ...renderedRows, bottom].join("\n");
|
|
262
|
+
}
|
|
263
|
+
function renderTableMarkdown(options) {
|
|
264
|
+
const { columns, rows } = options;
|
|
265
|
+
const header = `| ${columns.map((c) => renderMarkdownCell(c.title)).join(" | ")} |`;
|
|
266
|
+
const separator = `| ${columns
|
|
267
|
+
.map((c) => {
|
|
268
|
+
const alignment = getAlignment(c);
|
|
269
|
+
if (alignment === "right") {
|
|
270
|
+
return "---:";
|
|
271
|
+
}
|
|
272
|
+
if (alignment === "center") {
|
|
273
|
+
return ":---:";
|
|
274
|
+
}
|
|
275
|
+
return ":---";
|
|
276
|
+
})
|
|
277
|
+
.join(" | ")} |`;
|
|
278
|
+
const dataRows = rows.map((row) => `| ${columns.map((c) => renderMarkdownCell(getCell(row, c.name))).join(" | ")} |`);
|
|
279
|
+
return [header, separator, ...dataRows].join("\n");
|
|
280
|
+
}
|
|
281
|
+
function renderTableJson(options) {
|
|
282
|
+
const { columns, rows } = options;
|
|
283
|
+
const cleaned = rows.map((row) => {
|
|
284
|
+
const obj = Object.create(null);
|
|
285
|
+
for (const col of columns) {
|
|
286
|
+
obj[col.name] = stripAnsi(getCell(row, col.name));
|
|
287
|
+
}
|
|
288
|
+
return obj;
|
|
289
|
+
});
|
|
290
|
+
return JSON.stringify(cleaned, null, 2);
|
|
291
|
+
}
|
|
292
|
+
export function renderTable(options) {
|
|
293
|
+
const format = resolveOutputFormat();
|
|
294
|
+
switch (format) {
|
|
295
|
+
case "markdown":
|
|
296
|
+
return renderTableMarkdown(options);
|
|
297
|
+
case "json":
|
|
298
|
+
return renderTableJson(options);
|
|
299
|
+
default:
|
|
300
|
+
return renderTableTerminal(options);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type TemplateEscape = "html" | "none";
|
|
2
|
+
export interface RenderTemplateOptions {
|
|
3
|
+
escape?: TemplateEscape;
|
|
4
|
+
partials?: Record<string, string>;
|
|
5
|
+
validate?: boolean;
|
|
6
|
+
yield?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function renderTemplate(template: string, view: Record<string, unknown>, options?: RenderTemplateOptions): string;
|
|
9
|
+
export declare function getTemplatePartialNames(template: string): string[];
|
|
10
|
+
export declare function resolveTemplatePartials(template: string, partials: Record<string, string>): string;
|