@compilr-dev/cli 0.4.0 → 0.5.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 +30 -12
- package/dist/agent.d.ts +74 -1
- package/dist/agent.js +259 -76
- package/dist/anchors/index.d.ts +9 -0
- package/dist/anchors/index.js +9 -0
- package/dist/anchors/project-anchors.d.ts +79 -0
- package/dist/anchors/project-anchors.js +202 -0
- package/dist/commands/handler-types.d.ts +68 -0
- package/dist/commands/handler-types.js +8 -0
- package/dist/commands/handlers/agent-commands.d.ts +13 -0
- package/dist/commands/handlers/agent-commands.js +305 -0
- package/dist/commands/handlers/design-commands.d.ts +15 -0
- package/dist/commands/handlers/design-commands.js +334 -0
- package/dist/commands/handlers/index.d.ts +20 -0
- package/dist/commands/handlers/index.js +43 -0
- package/dist/commands/handlers/overlay-commands.d.ts +21 -0
- package/dist/commands/handlers/overlay-commands.js +287 -0
- package/dist/commands/handlers/project-commands.d.ts +11 -0
- package/dist/commands/handlers/project-commands.js +167 -0
- package/dist/commands/handlers/simple-commands.d.ts +19 -0
- package/dist/commands/handlers/simple-commands.js +144 -0
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/registry.d.ts +50 -0
- package/dist/commands/registry.js +75 -0
- package/dist/commands-v2/handlers/context.d.ts +13 -0
- package/dist/commands-v2/handlers/context.js +348 -0
- package/dist/commands-v2/handlers/core.d.ts +13 -0
- package/dist/commands-v2/handlers/core.js +165 -0
- package/dist/commands-v2/handlers/debug.d.ts +11 -0
- package/dist/commands-v2/handlers/debug.js +159 -0
- package/dist/commands-v2/handlers/index.d.ts +12 -0
- package/dist/commands-v2/handlers/index.js +24 -0
- package/dist/commands-v2/handlers/project.d.ts +22 -0
- package/dist/commands-v2/handlers/project.js +814 -0
- package/dist/commands-v2/handlers/settings.d.ts +15 -0
- package/dist/commands-v2/handlers/settings.js +235 -0
- package/dist/commands-v2/index.d.ts +13 -0
- package/dist/commands-v2/index.js +15 -0
- package/dist/commands-v2/registry.d.ts +37 -0
- package/dist/commands-v2/registry.js +80 -0
- package/dist/commands-v2/types.d.ts +75 -0
- package/dist/commands-v2/types.js +7 -0
- package/dist/commands.js +110 -7
- package/dist/index.js +288 -29
- package/dist/input-handlers/index.d.ts +7 -0
- package/dist/input-handlers/index.js +7 -0
- package/dist/input-handlers/memory-handler.d.ts +26 -0
- package/dist/input-handlers/memory-handler.js +68 -0
- package/dist/repl-helpers.d.ts +63 -0
- package/dist/repl-helpers.js +318 -0
- package/dist/repl-v2.d.ts +155 -0
- package/dist/repl-v2.js +774 -0
- package/dist/repl.d.ts +32 -4
- package/dist/repl.js +250 -977
- package/dist/settings/index.d.ts +23 -0
- package/dist/settings/index.js +48 -0
- package/dist/settings/paths.d.ts +110 -0
- package/dist/settings/paths.js +264 -0
- package/dist/templates/compilr-md.js +7 -4
- package/dist/templates/index.js +3 -4
- package/dist/themes/colors.js +3 -1
- package/dist/themes/registry.d.ts +5 -36
- package/dist/themes/registry.js +11 -95
- package/dist/themes/types.d.ts +3 -38
- package/dist/themes/types.js +2 -2
- package/dist/tools/anchor-tools.d.ts +31 -0
- package/dist/tools/anchor-tools.js +255 -0
- package/dist/tools/backlog-wrappers.d.ts +54 -0
- package/dist/tools/backlog-wrappers.js +338 -0
- package/dist/tools/backlog.js +1 -1
- package/dist/tools/db-tools.d.ts +65 -0
- package/dist/tools/db-tools.js +19 -0
- package/dist/tools/document-db.d.ts +43 -0
- package/dist/tools/document-db.js +220 -0
- package/dist/tools/project-db.d.ts +102 -0
- package/dist/tools/project-db.js +370 -0
- package/dist/tools/workitem-db.d.ts +103 -0
- package/dist/tools/workitem-db.js +549 -0
- package/dist/tools.js +13 -3
- package/dist/ui/agents-overlay-v2.d.ts +43 -0
- package/dist/ui/agents-overlay-v2.js +809 -0
- package/dist/ui/agents-overlay.d.ts +5 -5
- package/dist/ui/agents-overlay.js +782 -420
- package/dist/ui/anchors-overlay.d.ts +12 -0
- package/dist/ui/anchors-overlay.js +775 -0
- package/dist/ui/arch-type-overlay.d.ts +1 -6
- package/dist/ui/arch-type-overlay.js +175 -203
- package/dist/ui/ask-user-overlay-v2.d.ts +26 -0
- package/dist/ui/ask-user-overlay-v2.js +555 -0
- package/dist/ui/ask-user-overlay.d.ts +2 -2
- package/dist/ui/ask-user-overlay.js +443 -535
- package/dist/ui/ask-user-simple-overlay-v2.d.ts +25 -0
- package/dist/ui/ask-user-simple-overlay-v2.js +215 -0
- package/dist/ui/ask-user-simple-overlay.d.ts +2 -2
- package/dist/ui/ask-user-simple-overlay.js +182 -209
- package/dist/ui/backlog-overlay.d.ts +16 -1
- package/dist/ui/backlog-overlay.js +525 -659
- package/dist/ui/base/index.d.ts +26 -0
- package/dist/ui/base/index.js +33 -0
- package/dist/ui/base/inline-overlay-utils.d.ts +217 -0
- package/dist/ui/base/inline-overlay-utils.js +320 -0
- package/dist/ui/base/inline-overlay.d.ts +159 -0
- package/dist/ui/base/inline-overlay.js +257 -0
- package/dist/ui/base/key-utils.d.ts +15 -0
- package/dist/ui/base/key-utils.js +30 -0
- package/dist/ui/base/overlay-base-v2.d.ts +193 -0
- package/dist/ui/base/overlay-base-v2.js +246 -0
- package/dist/ui/base/overlay-base.d.ts +156 -0
- package/dist/ui/base/overlay-base.js +238 -0
- package/dist/ui/base/overlay-lifecycle.d.ts +65 -0
- package/dist/ui/base/overlay-lifecycle.js +159 -0
- package/dist/ui/base/overlay-types.d.ts +185 -0
- package/dist/ui/base/overlay-types.js +7 -0
- package/dist/ui/base/render-utils.d.ts +8 -0
- package/dist/ui/base/render-utils.js +11 -0
- package/dist/ui/base/screen-stack.d.ts +148 -0
- package/dist/ui/base/screen-stack.js +184 -0
- package/dist/ui/base/tabbed-list-overlay-v2.d.ts +103 -0
- package/dist/ui/base/tabbed-list-overlay-v2.js +317 -0
- package/dist/ui/base/tabbed-list-overlay.d.ts +153 -0
- package/dist/ui/base/tabbed-list-overlay.js +369 -0
- package/dist/ui/commands-overlay-v2.d.ts +33 -0
- package/dist/ui/commands-overlay-v2.js +441 -0
- package/dist/ui/commands-overlay.d.ts +7 -2
- package/dist/ui/commands-overlay.js +384 -355
- package/dist/ui/config-overlay.d.ts +5 -4
- package/dist/ui/config-overlay.js +243 -513
- package/dist/ui/conversation.d.ts +75 -4
- package/dist/ui/conversation.js +374 -161
- package/dist/ui/docs-overlay.d.ts +17 -0
- package/dist/ui/docs-overlay.js +303 -0
- package/dist/ui/ephemeral.d.ts +1 -1
- package/dist/ui/ephemeral.js +1 -1
- package/dist/ui/features/index.d.ts +34 -0
- package/dist/ui/features/index.js +34 -0
- package/dist/ui/features/input-feature.d.ts +85 -0
- package/dist/ui/features/input-feature.js +238 -0
- package/dist/ui/features/list-feature.d.ts +155 -0
- package/dist/ui/features/list-feature.js +244 -0
- package/dist/ui/features/pagination-feature.d.ts +154 -0
- package/dist/ui/features/pagination-feature.js +238 -0
- package/dist/ui/features/search-feature.d.ts +148 -0
- package/dist/ui/features/search-feature.js +185 -0
- package/dist/ui/features/tab-feature.d.ts +194 -0
- package/dist/ui/features/tab-feature.js +307 -0
- package/dist/ui/footer-v2.d.ts +222 -0
- package/dist/ui/footer-v2.js +1349 -0
- package/dist/ui/footer.d.ts +107 -0
- package/dist/ui/footer.js +359 -67
- package/dist/ui/guardrail-overlay.d.ts +29 -0
- package/dist/ui/guardrail-overlay.js +145 -0
- package/dist/ui/help-overlay-v2.d.ts +34 -0
- package/dist/ui/help-overlay-v2.js +309 -0
- package/dist/ui/help-overlay.d.ts +16 -0
- package/dist/ui/help-overlay.js +316 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -3
- package/dist/ui/init-overlay-v2.d.ts +34 -0
- package/dist/ui/init-overlay-v2.js +600 -0
- package/dist/ui/init-overlay.d.ts +12 -2
- package/dist/ui/init-overlay.js +349 -270
- package/dist/ui/input-prompt-v2.d.ts +1 -0
- package/dist/ui/input-prompt-v2.js +14 -6
- package/dist/ui/input-prompt.d.ts +116 -33
- package/dist/ui/input-prompt.js +536 -337
- package/dist/ui/iteration-limit-overlay-v2.d.ts +21 -0
- package/dist/ui/iteration-limit-overlay-v2.js +114 -0
- package/dist/ui/iteration-limit-overlay.d.ts +2 -2
- package/dist/ui/iteration-limit-overlay.js +92 -128
- package/dist/ui/keys-overlay-v2.d.ts +41 -0
- package/dist/ui/keys-overlay-v2.js +248 -0
- package/dist/ui/keys-overlay.d.ts +1 -0
- package/dist/ui/keys-overlay.js +203 -141
- package/dist/ui/line-utils.d.ts +88 -0
- package/dist/ui/line-utils.js +150 -0
- package/dist/ui/live-region.d.ts +161 -0
- package/dist/ui/live-region.js +387 -0
- package/dist/ui/mascot/expressions.d.ts +32 -0
- package/dist/ui/mascot/expressions.js +213 -0
- package/dist/ui/mascot/index.d.ts +8 -0
- package/dist/ui/mascot/index.js +8 -0
- package/dist/ui/mascot/renderer.d.ts +19 -0
- package/dist/ui/mascot/renderer.js +97 -0
- package/dist/ui/mascot-overlay-v2.d.ts +41 -0
- package/dist/ui/mascot-overlay-v2.js +138 -0
- package/dist/ui/mascot-overlay.d.ts +21 -0
- package/dist/ui/mascot-overlay.js +146 -0
- package/dist/ui/model-overlay-v2.d.ts +49 -0
- package/dist/ui/model-overlay-v2.js +118 -0
- package/dist/ui/model-overlay.d.ts +27 -0
- package/dist/ui/model-overlay.js +221 -0
- package/dist/ui/model-warning-overlay.js +3 -5
- package/dist/ui/new-overlay.d.ts +34 -0
- package/dist/ui/new-overlay.js +604 -0
- package/dist/ui/overlay/impl/agents-overlay-v2.d.ts +45 -0
- package/dist/ui/overlay/impl/agents-overlay-v2.js +825 -0
- package/dist/ui/overlay/impl/anchors-overlay-v2.d.ts +47 -0
- package/dist/ui/overlay/impl/anchors-overlay-v2.js +783 -0
- package/dist/ui/overlay/impl/arch-type-overlay-v2.d.ts +37 -0
- package/dist/ui/overlay/impl/arch-type-overlay-v2.js +240 -0
- package/dist/ui/overlay/impl/ask-user-overlay-v2.d.ts +72 -0
- package/dist/ui/overlay/impl/ask-user-overlay-v2.js +584 -0
- package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.d.ts +46 -0
- package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.js +204 -0
- package/dist/ui/overlay/impl/backlog-overlay-v2.d.ts +49 -0
- package/dist/ui/overlay/impl/backlog-overlay-v2.js +642 -0
- package/dist/ui/overlay/impl/commands-overlay-v2.d.ts +33 -0
- package/dist/ui/overlay/impl/commands-overlay-v2.js +441 -0
- package/dist/ui/overlay/impl/config-overlay-v2.d.ts +100 -0
- package/dist/ui/overlay/impl/config-overlay-v2.js +654 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.d.ts +55 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.js +359 -0
- package/dist/ui/overlay/impl/docs-overlay-v2.d.ts +45 -0
- package/dist/ui/overlay/impl/docs-overlay-v2.js +114 -0
- package/dist/ui/overlay/impl/document-detail-overlay-v2.d.ts +77 -0
- package/dist/ui/overlay/impl/document-detail-overlay-v2.js +1071 -0
- package/dist/ui/overlay/impl/guardrail-overlay-v2.d.ts +43 -0
- package/dist/ui/overlay/impl/guardrail-overlay-v2.js +114 -0
- package/dist/ui/overlay/impl/help-overlay-v2.d.ts +34 -0
- package/dist/ui/overlay/impl/help-overlay-v2.js +309 -0
- package/dist/ui/overlay/impl/init-overlay-v2.d.ts +77 -0
- package/dist/ui/overlay/impl/init-overlay-v2.js +593 -0
- package/dist/ui/overlay/impl/init-setup-overlay-v2.d.ts +25 -0
- package/dist/ui/overlay/impl/init-setup-overlay-v2.js +97 -0
- package/dist/ui/overlay/impl/iteration-limit-overlay-v2.d.ts +35 -0
- package/dist/ui/overlay/impl/iteration-limit-overlay-v2.js +105 -0
- package/dist/ui/overlay/impl/keys-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/keys-overlay-v2.js +248 -0
- package/dist/ui/overlay/impl/mascot-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/mascot-overlay-v2.js +138 -0
- package/dist/ui/overlay/impl/model-overlay-v2.d.ts +49 -0
- package/dist/ui/overlay/impl/model-overlay-v2.js +118 -0
- package/dist/ui/overlay/impl/model-warning-overlay-v2.d.ts +46 -0
- package/dist/ui/overlay/impl/model-warning-overlay-v2.js +132 -0
- package/dist/ui/overlay/impl/new-overlay-v2.d.ts +77 -0
- package/dist/ui/overlay/impl/new-overlay-v2.js +593 -0
- package/dist/ui/overlay/impl/permission-overlay-v2.d.ts +36 -0
- package/dist/ui/overlay/impl/permission-overlay-v2.js +380 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.d.ts +36 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.js +499 -0
- package/dist/ui/overlay/impl/theme-overlay-v2.d.ts +42 -0
- package/dist/ui/overlay/impl/theme-overlay-v2.js +135 -0
- package/dist/ui/overlay/impl/tools-overlay-v2.d.ts +47 -0
- package/dist/ui/overlay/impl/tools-overlay-v2.js +218 -0
- package/dist/ui/overlay/impl/tutorial-overlay-v2.d.ts +31 -0
- package/dist/ui/overlay/impl/tutorial-overlay-v2.js +1035 -0
- package/dist/ui/overlay/impl/workflow-overlay-v2.d.ts +80 -0
- package/dist/ui/overlay/impl/workflow-overlay-v2.js +637 -0
- package/dist/ui/overlay/index.d.ts +33 -0
- package/dist/ui/overlay/index.js +35 -0
- package/dist/ui/overlay/key-utils.d.ts +6 -0
- package/dist/ui/overlay/key-utils.js +6 -0
- package/dist/ui/overlay/overlay-types.d.ts +128 -0
- package/dist/ui/overlay/overlay-types.js +22 -0
- package/dist/ui/overlay/types.d.ts +135 -0
- package/dist/ui/overlay/types.js +22 -0
- package/dist/ui/overlays/help-overlay-v2.d.ts +28 -0
- package/dist/ui/overlays/help-overlay-v2.js +198 -0
- package/dist/ui/overlays/index.d.ts +11 -0
- package/dist/ui/overlays/index.js +11 -0
- package/dist/ui/overlays.d.ts +0 -4
- package/dist/ui/overlays.js +0 -444
- package/dist/ui/permission-overlay-v2.d.ts +36 -0
- package/dist/ui/permission-overlay-v2.js +380 -0
- package/dist/ui/permission-overlay.d.ts +1 -1
- package/dist/ui/permission-overlay.js +186 -298
- package/dist/ui/projects-overlay.d.ts +19 -0
- package/dist/ui/projects-overlay.js +484 -0
- package/dist/ui/providers/types.d.ts +178 -0
- package/dist/ui/providers/types.js +9 -0
- package/dist/ui/render-modes.d.ts +36 -0
- package/dist/ui/render-modes.js +44 -0
- package/dist/ui/startup-menu.d.ts +36 -0
- package/dist/ui/startup-menu.js +236 -0
- package/dist/ui/subagent-renderer.d.ts +117 -0
- package/dist/ui/subagent-renderer.js +334 -0
- package/dist/ui/terminal-codes.d.ts +94 -0
- package/dist/ui/terminal-codes.js +124 -0
- package/dist/ui/terminal-renderer.d.ts +221 -0
- package/dist/ui/terminal-renderer.js +751 -0
- package/dist/ui/terminal-ui.d.ts +463 -0
- package/dist/ui/terminal-ui.js +2296 -0
- package/dist/ui/terminal.d.ts +20 -0
- package/dist/ui/terminal.js +72 -0
- package/dist/ui/theme-overlay-v2.d.ts +42 -0
- package/dist/ui/theme-overlay-v2.js +135 -0
- package/dist/ui/theme-overlay.d.ts +24 -0
- package/dist/ui/theme-overlay.js +127 -0
- package/dist/ui/todo-zone.js +53 -25
- package/dist/ui/tool-formatters.d.ts +16 -0
- package/dist/ui/tool-formatters.js +516 -0
- package/dist/ui/tools-overlay-v2.d.ts +47 -0
- package/dist/ui/tools-overlay-v2.js +218 -0
- package/dist/ui/tools-overlay.d.ts +10 -2
- package/dist/ui/tools-overlay.js +172 -220
- package/dist/ui/tutorial-overlay-v2.d.ts +31 -0
- package/dist/ui/tutorial-overlay-v2.js +1035 -0
- package/dist/ui/tutorial-overlay.d.ts +1 -0
- package/dist/ui/tutorial-overlay.js +400 -302
- package/dist/ui/workflow-overlay.d.ts +22 -0
- package/dist/ui/workflow-overlay.js +636 -0
- package/dist/utils/debug-log.d.ts +28 -0
- package/dist/utils/debug-log.js +57 -0
- package/dist/utils/model-tiers.js +1 -1
- package/dist/utils/path-safety.d.ts +56 -0
- package/dist/utils/path-safety.js +239 -0
- package/dist/workflow/guided-mode-injector.d.ts +42 -0
- package/dist/workflow/guided-mode-injector.js +191 -0
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.js +8 -0
- package/dist/workflow/step-criteria.d.ts +62 -0
- package/dist/workflow/step-criteria.js +150 -0
- package/dist/workflow/step-tracker.d.ts +92 -0
- package/dist/workflow/step-tracker.js +141 -0
- package/package.json +12 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay System
|
|
3
|
+
*
|
|
4
|
+
* Exports all overlay-related types, utilities, and V2 implementations.
|
|
5
|
+
*/
|
|
6
|
+
export { isCloseWithResult, isCloseCancelled } from './types.js';
|
|
7
|
+
export { parseKeyEvent, matchesKey } from './key-utils.js';
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// V2 Overlay Implementations
|
|
10
|
+
// =============================================================================
|
|
11
|
+
export { HelpOverlayV2 } from './impl/help-overlay-v2.js';
|
|
12
|
+
export { ThemeOverlayV2 } from './impl/theme-overlay-v2.js';
|
|
13
|
+
export { ModelOverlayV2 } from './impl/model-overlay-v2.js';
|
|
14
|
+
export { ToolsOverlayV2 } from './impl/tools-overlay-v2.js';
|
|
15
|
+
export { KeysOverlayV2 } from './impl/keys-overlay-v2.js';
|
|
16
|
+
export { MascotOverlayV2 } from './impl/mascot-overlay-v2.js';
|
|
17
|
+
export { TutorialOverlayV2 } from './impl/tutorial-overlay-v2.js';
|
|
18
|
+
export { CommandsOverlayV2 } from './impl/commands-overlay-v2.js';
|
|
19
|
+
export { AgentsOverlayV2 } from './impl/agents-overlay-v2.js';
|
|
20
|
+
export { BacklogOverlayV2 } from './impl/backlog-overlay-v2.js';
|
|
21
|
+
export { WorkflowOverlayV2 } from './impl/workflow-overlay-v2.js';
|
|
22
|
+
export { DocsOverlayV2 } from './impl/docs-overlay-v2.js';
|
|
23
|
+
export { DocumentDetailOverlayV2 } from './impl/document-detail-overlay-v2.js';
|
|
24
|
+
export { AnchorsOverlayV2 } from './impl/anchors-overlay-v2.js';
|
|
25
|
+
export { ProjectsOverlayV2 } from './impl/projects-overlay-v2.js';
|
|
26
|
+
export { ConfigOverlayV2 } from './impl/config-overlay-v2.js';
|
|
27
|
+
export { AskUserSimpleOverlayV2 } from './impl/ask-user-simple-overlay-v2.js';
|
|
28
|
+
export { GuardrailOverlayV2 } from './impl/guardrail-overlay-v2.js';
|
|
29
|
+
export { AskUserOverlayV2 } from './impl/ask-user-overlay-v2.js';
|
|
30
|
+
export { IterationLimitOverlayV2 } from './impl/iteration-limit-overlay-v2.js';
|
|
31
|
+
export { ModelWarningOverlayV2 } from './impl/model-warning-overlay-v2.js';
|
|
32
|
+
export { NewProjectOverlayV2 } from './impl/new-overlay-v2.js';
|
|
33
|
+
export { InitSetupOverlayV2 } from './impl/init-setup-overlay-v2.js';
|
|
34
|
+
export { ArchTypeOverlayV2 } from './impl/arch-type-overlay-v2.js';
|
|
35
|
+
export { DashboardOverlayV2 } from './impl/dashboard-overlay-v2.js';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay System Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the interface for overlays that can be shown by TerminalUI.
|
|
5
|
+
* Overlays define WHAT to show and WHAT to do.
|
|
6
|
+
* TerminalUI handles HOW to render.
|
|
7
|
+
*/
|
|
8
|
+
import type { ThemeStyleFunctions } from '../../themes/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Base interface for all overlays.
|
|
11
|
+
* Overlays define WHAT to show and WHAT to do.
|
|
12
|
+
* TerminalUI handles HOW to render.
|
|
13
|
+
*/
|
|
14
|
+
export interface Overlay<TState = unknown, TResult = unknown> {
|
|
15
|
+
/** Overlay type determines rendering mode */
|
|
16
|
+
readonly type: 'fullscreen' | 'inline';
|
|
17
|
+
/** Unique identifier for the overlay */
|
|
18
|
+
readonly id: string;
|
|
19
|
+
/** Called when overlay is mounted. Setup state, fetch data. */
|
|
20
|
+
onMount?(): void | Promise<void>;
|
|
21
|
+
/** Called when overlay is unmounted. Cleanup. */
|
|
22
|
+
onUnmount?(): void;
|
|
23
|
+
/** Get current state (for TerminalUI to access if needed) */
|
|
24
|
+
getState(): TState;
|
|
25
|
+
/**
|
|
26
|
+
* Render overlay content.
|
|
27
|
+
* Returns logical lines - TerminalUI handles physical line calculation.
|
|
28
|
+
*/
|
|
29
|
+
render(context: RenderContext): OverlayContent;
|
|
30
|
+
/**
|
|
31
|
+
* Optional: Summary to show after overlay closes.
|
|
32
|
+
* Rendered by TerminalUI in conversation zone.
|
|
33
|
+
*/
|
|
34
|
+
getCloseSummary?(result: TResult): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Handle keypress. Return action for TerminalUI.
|
|
37
|
+
* TerminalUI routes all input here when overlay is active.
|
|
38
|
+
*/
|
|
39
|
+
handleKey(key: KeyEvent): OverlayAction<TResult>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Context provided to render().
|
|
43
|
+
*/
|
|
44
|
+
export interface RenderContext {
|
|
45
|
+
/** Terminal width in columns */
|
|
46
|
+
width: number;
|
|
47
|
+
/** Terminal height in rows (for fullscreen) */
|
|
48
|
+
height: number;
|
|
49
|
+
/** Current theme styles */
|
|
50
|
+
styles: ThemeStyleFunctions;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Content returned by render().
|
|
54
|
+
*/
|
|
55
|
+
export interface OverlayContent {
|
|
56
|
+
/** Lines to render (logical lines, TerminalUI handles wrapping) */
|
|
57
|
+
lines: string[];
|
|
58
|
+
/** Cursor position hint (for text input overlays) */
|
|
59
|
+
cursorPosition?: {
|
|
60
|
+
line: number;
|
|
61
|
+
column: number;
|
|
62
|
+
};
|
|
63
|
+
/** Minimum height (for stable rendering) */
|
|
64
|
+
minHeight?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Action returned by handleKey().
|
|
68
|
+
*/
|
|
69
|
+
export type OverlayAction<TResult> = {
|
|
70
|
+
type: 'none';
|
|
71
|
+
} | {
|
|
72
|
+
type: 'render';
|
|
73
|
+
} | {
|
|
74
|
+
type: 'close';
|
|
75
|
+
result: TResult;
|
|
76
|
+
} | {
|
|
77
|
+
type: 'close';
|
|
78
|
+
cancelled: true;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'push';
|
|
81
|
+
overlay: Overlay;
|
|
82
|
+
} | {
|
|
83
|
+
type: 'pop';
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Normalized key event (parsed from raw Buffer).
|
|
87
|
+
*/
|
|
88
|
+
export interface KeyEvent {
|
|
89
|
+
/** Raw buffer data */
|
|
90
|
+
raw: Buffer;
|
|
91
|
+
/** Key name: 'enter', 'escape', 'up', 'down', 'tab', 'a', 'b', etc. */
|
|
92
|
+
name: string;
|
|
93
|
+
/** Printable character if applicable */
|
|
94
|
+
char?: string;
|
|
95
|
+
/** Modifier keys */
|
|
96
|
+
ctrl: boolean;
|
|
97
|
+
shift: boolean;
|
|
98
|
+
meta: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Type guard to check if an action is a close action with a result.
|
|
102
|
+
*/
|
|
103
|
+
export declare function isCloseWithResult<TResult = unknown>(action: OverlayAction<TResult>): action is {
|
|
104
|
+
type: 'close';
|
|
105
|
+
result: TResult;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Type guard to check if an action is a cancelled close action.
|
|
109
|
+
*/
|
|
110
|
+
export declare function isCloseCancelled<TResult = unknown>(action: OverlayAction<TResult>): action is {
|
|
111
|
+
type: 'close';
|
|
112
|
+
cancelled: true;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Resolver function for overlay promises.
|
|
116
|
+
* Called when overlay closes with result or cancellation.
|
|
117
|
+
*/
|
|
118
|
+
export type OverlayResolver<TResult> = (result: TResult | null) => void;
|
|
119
|
+
/**
|
|
120
|
+
* State for tracking rendered lines to prevent visual artifacts.
|
|
121
|
+
*/
|
|
122
|
+
export interface OverlayRenderState {
|
|
123
|
+
/** Physical lines rendered in the last render */
|
|
124
|
+
lineCount: number;
|
|
125
|
+
/** Maximum physical lines ever rendered during this overlay session.
|
|
126
|
+
* Used for clearing to prevent ghost lines when content shrinks between renders. */
|
|
127
|
+
maxLineCount: number;
|
|
128
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay System Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the interface for overlays that can be shown by TerminalUI.
|
|
5
|
+
* Overlays define WHAT to show and WHAT to do.
|
|
6
|
+
* TerminalUI handles HOW to render.
|
|
7
|
+
*/
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Helper Types
|
|
10
|
+
// =============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Type guard to check if an action is a close action with a result.
|
|
13
|
+
*/
|
|
14
|
+
export function isCloseWithResult(action) {
|
|
15
|
+
return action.type === 'close' && 'result' in action;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Type guard to check if an action is a cancelled close action.
|
|
19
|
+
*/
|
|
20
|
+
export function isCloseCancelled(action) {
|
|
21
|
+
return action.type === 'close' && 'cancelled' in action;
|
|
22
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay System Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the interface for overlays that can be shown by TerminalUI.
|
|
5
|
+
* Overlays define WHAT to show and WHAT to do.
|
|
6
|
+
* TerminalUI handles HOW to render.
|
|
7
|
+
*/
|
|
8
|
+
import type { ThemeStyleFunctions } from '../../themes/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Base interface for all overlays.
|
|
11
|
+
* Overlays define WHAT to show and WHAT to do.
|
|
12
|
+
* TerminalUI handles HOW to render.
|
|
13
|
+
*/
|
|
14
|
+
export interface Overlay<TState = unknown, TResult = unknown> {
|
|
15
|
+
/** Overlay type determines rendering mode */
|
|
16
|
+
readonly type: 'fullscreen' | 'inline';
|
|
17
|
+
/** Unique identifier for the overlay */
|
|
18
|
+
readonly id: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether this overlay uses alternate screen buffer.
|
|
21
|
+
* When true, TerminalUI skips screen clearing on close since
|
|
22
|
+
* exiting alternate screen automatically restores the main screen.
|
|
23
|
+
*/
|
|
24
|
+
readonly usesAlternateScreen?: boolean;
|
|
25
|
+
/** Called when overlay is mounted. Setup state, fetch data. */
|
|
26
|
+
onMount?(): void | Promise<void>;
|
|
27
|
+
/** Called when overlay is unmounted. Cleanup. */
|
|
28
|
+
onUnmount?(): void;
|
|
29
|
+
/** Get current state (for TerminalUI to access if needed) */
|
|
30
|
+
getState(): TState;
|
|
31
|
+
/**
|
|
32
|
+
* Render overlay content.
|
|
33
|
+
* Returns logical lines - TerminalUI handles physical line calculation.
|
|
34
|
+
*/
|
|
35
|
+
render(context: RenderContext): OverlayContent;
|
|
36
|
+
/**
|
|
37
|
+
* Optional: Summary to show after overlay closes.
|
|
38
|
+
* Rendered by TerminalUI in conversation zone.
|
|
39
|
+
*/
|
|
40
|
+
getCloseSummary?(result: TResult): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Handle keypress. Return action for TerminalUI.
|
|
43
|
+
* TerminalUI routes all input here when overlay is active.
|
|
44
|
+
* Can be sync or async (for overlays that need to do async work like file I/O).
|
|
45
|
+
*/
|
|
46
|
+
handleKey(key: KeyEvent): OverlayAction<TResult> | Promise<OverlayAction<TResult>>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Context provided to render().
|
|
50
|
+
*/
|
|
51
|
+
export interface RenderContext {
|
|
52
|
+
/** Terminal width in columns */
|
|
53
|
+
width: number;
|
|
54
|
+
/** Terminal height in rows (for fullscreen) */
|
|
55
|
+
height: number;
|
|
56
|
+
/** Current theme styles */
|
|
57
|
+
styles: ThemeStyleFunctions;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Content returned by render().
|
|
61
|
+
*/
|
|
62
|
+
export interface OverlayContent {
|
|
63
|
+
/** Lines to render (logical lines, TerminalUI handles wrapping) */
|
|
64
|
+
lines: string[];
|
|
65
|
+
/** Cursor position hint (for text input overlays) */
|
|
66
|
+
cursorPosition?: {
|
|
67
|
+
line: number;
|
|
68
|
+
column: number;
|
|
69
|
+
};
|
|
70
|
+
/** Minimum height (for stable rendering) */
|
|
71
|
+
minHeight?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Action returned by handleKey().
|
|
75
|
+
*/
|
|
76
|
+
export type OverlayAction<TResult> = {
|
|
77
|
+
type: 'none';
|
|
78
|
+
} | {
|
|
79
|
+
type: 'render';
|
|
80
|
+
} | {
|
|
81
|
+
type: 'close';
|
|
82
|
+
result: TResult;
|
|
83
|
+
} | {
|
|
84
|
+
type: 'close';
|
|
85
|
+
cancelled: true;
|
|
86
|
+
} | {
|
|
87
|
+
type: 'push';
|
|
88
|
+
overlay: Overlay;
|
|
89
|
+
} | {
|
|
90
|
+
type: 'pop';
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Normalized key event (parsed from raw Buffer).
|
|
94
|
+
*/
|
|
95
|
+
export interface KeyEvent {
|
|
96
|
+
/** Raw buffer data */
|
|
97
|
+
raw: Buffer;
|
|
98
|
+
/** Key name: 'enter', 'escape', 'up', 'down', 'tab', 'a', 'b', etc. */
|
|
99
|
+
name: string;
|
|
100
|
+
/** Printable character if applicable */
|
|
101
|
+
char?: string;
|
|
102
|
+
/** Modifier keys */
|
|
103
|
+
ctrl: boolean;
|
|
104
|
+
shift: boolean;
|
|
105
|
+
meta: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Type guard to check if an action is a close action with a result.
|
|
109
|
+
*/
|
|
110
|
+
export declare function isCloseWithResult<TResult = unknown>(action: OverlayAction<TResult>): action is {
|
|
111
|
+
type: 'close';
|
|
112
|
+
result: TResult;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Type guard to check if an action is a cancelled close action.
|
|
116
|
+
*/
|
|
117
|
+
export declare function isCloseCancelled<TResult = unknown>(action: OverlayAction<TResult>): action is {
|
|
118
|
+
type: 'close';
|
|
119
|
+
cancelled: true;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Resolver function for overlay promises.
|
|
123
|
+
* Called when overlay closes with result or cancellation.
|
|
124
|
+
*/
|
|
125
|
+
export type OverlayResolver<TResult> = (result: TResult | null) => void;
|
|
126
|
+
/**
|
|
127
|
+
* State for tracking rendered lines to prevent visual artifacts.
|
|
128
|
+
*/
|
|
129
|
+
export interface OverlayRenderState {
|
|
130
|
+
/** Physical lines rendered in the last render */
|
|
131
|
+
lineCount: number;
|
|
132
|
+
/** Maximum physical lines ever rendered during this overlay session.
|
|
133
|
+
* Used for clearing to prevent ghost lines when content shrinks between renders. */
|
|
134
|
+
maxLineCount: number;
|
|
135
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay System Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the interface for overlays that can be shown by TerminalUI.
|
|
5
|
+
* Overlays define WHAT to show and WHAT to do.
|
|
6
|
+
* TerminalUI handles HOW to render.
|
|
7
|
+
*/
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Helper Types
|
|
10
|
+
// =============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Type guard to check if an action is a close action with a result.
|
|
13
|
+
*/
|
|
14
|
+
export function isCloseWithResult(action) {
|
|
15
|
+
return action.type === 'close' && 'result' in action;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Type guard to check if an action is a cancelled close action.
|
|
19
|
+
*/
|
|
20
|
+
export function isCloseCancelled(action) {
|
|
21
|
+
return action.type === 'close' && 'cancelled' in action;
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help Overlay V2
|
|
3
|
+
*
|
|
4
|
+
* A simple help overlay using the new Overlay interface.
|
|
5
|
+
* Displays available commands with navigation and detail view.
|
|
6
|
+
*/
|
|
7
|
+
import type { Overlay, RenderContext, OverlayContent, OverlayAction, KeyEvent } from '../overlay/index.js';
|
|
8
|
+
interface HelpCommand {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
details?: string;
|
|
12
|
+
}
|
|
13
|
+
interface HelpOverlayState {
|
|
14
|
+
selectedIndex: number;
|
|
15
|
+
scrollOffset: number;
|
|
16
|
+
pageSize: number;
|
|
17
|
+
}
|
|
18
|
+
export declare class HelpOverlayV2 implements Overlay<HelpOverlayState, void> {
|
|
19
|
+
readonly type: "inline";
|
|
20
|
+
readonly id = "help-overlay-v2";
|
|
21
|
+
private readonly state;
|
|
22
|
+
private readonly commands;
|
|
23
|
+
constructor(commands?: HelpCommand[]);
|
|
24
|
+
getState(): HelpOverlayState;
|
|
25
|
+
render(context: RenderContext): OverlayContent;
|
|
26
|
+
handleKey(key: KeyEvent): OverlayAction<void>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help Overlay V2
|
|
3
|
+
*
|
|
4
|
+
* A simple help overlay using the new Overlay interface.
|
|
5
|
+
* Displays available commands with navigation and detail view.
|
|
6
|
+
*/
|
|
7
|
+
import { getVisibleLength } from '../line-utils.js';
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Sample Commands (for testing)
|
|
10
|
+
// =============================================================================
|
|
11
|
+
const SAMPLE_COMMANDS = [
|
|
12
|
+
{ name: '/help', description: 'Show this help overlay', details: 'Displays all available commands with descriptions.' },
|
|
13
|
+
{ name: '/exit', description: 'Exit the application', details: 'Closes the CLI gracefully.' },
|
|
14
|
+
{ name: '/clear', description: 'Clear the screen', details: 'Clears conversation history and resets the display.' },
|
|
15
|
+
{ name: '/verbose', description: 'Toggle verbose mode', details: 'When enabled, shows thinking blocks and full tool output.' },
|
|
16
|
+
{ name: '/compact', description: 'Compact conversation history', details: 'Summarizes older messages to save context space.' },
|
|
17
|
+
{ name: '/config', description: 'Open configuration', details: 'Adjust settings like theme, model, and preferences.' },
|
|
18
|
+
{ name: '/model', description: 'Select LLM model', details: 'Choose between Claude, OpenAI, Gemini, or Ollama models.' },
|
|
19
|
+
{ name: '/theme', description: 'Change color theme', details: 'Pick from 418 terminal themes.' },
|
|
20
|
+
{ name: '/tools', description: 'List available tools', details: 'Shows all tools the agent can use.' },
|
|
21
|
+
{ name: '/tokens', description: 'Show token usage', details: 'Displays current context token count.' },
|
|
22
|
+
{ name: '/init', description: 'Initialize project', details: 'Run the project initialization wizard.' },
|
|
23
|
+
{ name: '/design', description: 'Design workflow', details: 'Start the requirements gathering workflow.' },
|
|
24
|
+
];
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// Help Overlay
|
|
27
|
+
// =============================================================================
|
|
28
|
+
export class HelpOverlayV2 {
|
|
29
|
+
type = 'inline';
|
|
30
|
+
id = 'help-overlay-v2';
|
|
31
|
+
state = {
|
|
32
|
+
selectedIndex: 0,
|
|
33
|
+
scrollOffset: 0,
|
|
34
|
+
pageSize: 10,
|
|
35
|
+
};
|
|
36
|
+
commands;
|
|
37
|
+
constructor(commands) {
|
|
38
|
+
this.commands = commands ?? SAMPLE_COMMANDS;
|
|
39
|
+
}
|
|
40
|
+
getState() {
|
|
41
|
+
return this.state;
|
|
42
|
+
}
|
|
43
|
+
render(context) {
|
|
44
|
+
const { width, styles: s } = context;
|
|
45
|
+
const lines = [];
|
|
46
|
+
// Fixed height for inline overlay (not full screen)
|
|
47
|
+
const maxVisibleItems = 10;
|
|
48
|
+
this.state.pageSize = maxVisibleItems;
|
|
49
|
+
// Header
|
|
50
|
+
const border = '─'.repeat(width);
|
|
51
|
+
lines.push(border);
|
|
52
|
+
lines.push(s.primaryBold(' Help - Available Commands'));
|
|
53
|
+
lines.push('');
|
|
54
|
+
// Adjust scroll offset to keep selection visible
|
|
55
|
+
if (this.state.selectedIndex < this.state.scrollOffset) {
|
|
56
|
+
this.state.scrollOffset = this.state.selectedIndex;
|
|
57
|
+
}
|
|
58
|
+
else if (this.state.selectedIndex >= this.state.scrollOffset + this.state.pageSize) {
|
|
59
|
+
this.state.scrollOffset = this.state.selectedIndex - this.state.pageSize + 1;
|
|
60
|
+
}
|
|
61
|
+
// Visible commands
|
|
62
|
+
const visibleCommands = this.commands.slice(this.state.scrollOffset, this.state.scrollOffset + this.state.pageSize);
|
|
63
|
+
// Scroll indicator (top)
|
|
64
|
+
if (this.state.scrollOffset > 0) {
|
|
65
|
+
lines.push(s.muted(` ↑ ${String(this.state.scrollOffset)} more above`));
|
|
66
|
+
}
|
|
67
|
+
// Command list
|
|
68
|
+
for (let i = 0; i < visibleCommands.length; i++) {
|
|
69
|
+
const cmd = visibleCommands[i];
|
|
70
|
+
const actualIndex = this.state.scrollOffset + i;
|
|
71
|
+
const isSelected = actualIndex === this.state.selectedIndex;
|
|
72
|
+
const prefix = isSelected ? s.primary(' ❯ ') : ' ';
|
|
73
|
+
const name = isSelected
|
|
74
|
+
? s.primaryBold(cmd.name.padEnd(15))
|
|
75
|
+
: s.muted(cmd.name.padEnd(15));
|
|
76
|
+
// Truncate description if needed
|
|
77
|
+
const prefixLen = 3 + 15 + 3; // prefix + name + spacing
|
|
78
|
+
const maxDescLen = width - prefixLen - 2;
|
|
79
|
+
let desc = cmd.description;
|
|
80
|
+
if (desc.length > maxDescLen) {
|
|
81
|
+
desc = desc.slice(0, maxDescLen - 1) + '…';
|
|
82
|
+
}
|
|
83
|
+
lines.push(prefix + name + ' ' + s.muted(desc));
|
|
84
|
+
}
|
|
85
|
+
// Scroll indicator (bottom)
|
|
86
|
+
const belowCount = this.commands.length - this.state.scrollOffset - visibleCommands.length;
|
|
87
|
+
if (belowCount > 0) {
|
|
88
|
+
lines.push(s.muted(` ↓ ${String(belowCount)} more below`));
|
|
89
|
+
}
|
|
90
|
+
// Footer
|
|
91
|
+
lines.push(border);
|
|
92
|
+
lines.push(s.muted(' ↑↓ Navigate Enter Details q/Esc Close'));
|
|
93
|
+
lines.push(border);
|
|
94
|
+
return { lines };
|
|
95
|
+
}
|
|
96
|
+
handleKey(key) {
|
|
97
|
+
// Close on Escape or 'q'
|
|
98
|
+
if (key.name === 'escape' || key.name === 'q') {
|
|
99
|
+
return { type: 'close', cancelled: true };
|
|
100
|
+
}
|
|
101
|
+
// Navigate up
|
|
102
|
+
if (key.name === 'up' || key.name === 'k') {
|
|
103
|
+
if (this.state.selectedIndex > 0) {
|
|
104
|
+
this.state.selectedIndex--;
|
|
105
|
+
return { type: 'render' };
|
|
106
|
+
}
|
|
107
|
+
return { type: 'none' };
|
|
108
|
+
}
|
|
109
|
+
// Navigate down
|
|
110
|
+
if (key.name === 'down' || key.name === 'j') {
|
|
111
|
+
if (this.state.selectedIndex < this.commands.length - 1) {
|
|
112
|
+
this.state.selectedIndex++;
|
|
113
|
+
return { type: 'render' };
|
|
114
|
+
}
|
|
115
|
+
return { type: 'none' };
|
|
116
|
+
}
|
|
117
|
+
// Page up
|
|
118
|
+
if (key.name === 'pageup') {
|
|
119
|
+
this.state.selectedIndex = Math.max(0, this.state.selectedIndex - this.state.pageSize);
|
|
120
|
+
return { type: 'render' };
|
|
121
|
+
}
|
|
122
|
+
// Page down
|
|
123
|
+
if (key.name === 'pagedown') {
|
|
124
|
+
this.state.selectedIndex = Math.min(this.commands.length - 1, this.state.selectedIndex + this.state.pageSize);
|
|
125
|
+
return { type: 'render' };
|
|
126
|
+
}
|
|
127
|
+
// Enter - show details (push detail overlay)
|
|
128
|
+
if (key.name === 'return') {
|
|
129
|
+
const selectedCommand = this.commands[this.state.selectedIndex];
|
|
130
|
+
return {
|
|
131
|
+
type: 'push',
|
|
132
|
+
overlay: new HelpDetailOverlay(selectedCommand),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return { type: 'none' };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
class HelpDetailOverlay {
|
|
139
|
+
type = 'inline';
|
|
140
|
+
id;
|
|
141
|
+
command;
|
|
142
|
+
constructor(command) {
|
|
143
|
+
this.command = command;
|
|
144
|
+
this.id = `help-detail-${command.name}`;
|
|
145
|
+
}
|
|
146
|
+
getState() {
|
|
147
|
+
return { command: this.command };
|
|
148
|
+
}
|
|
149
|
+
render(context) {
|
|
150
|
+
const { width, styles: s } = context;
|
|
151
|
+
const lines = [];
|
|
152
|
+
const border = '─'.repeat(width);
|
|
153
|
+
// Header
|
|
154
|
+
lines.push(border);
|
|
155
|
+
lines.push(s.primaryBold(' Command Details'));
|
|
156
|
+
lines.push('');
|
|
157
|
+
// Command name
|
|
158
|
+
lines.push(s.primary(' ' + this.command.name));
|
|
159
|
+
lines.push('');
|
|
160
|
+
// Description
|
|
161
|
+
lines.push(s.muted(' DESCRIPTION'));
|
|
162
|
+
lines.push(' ' + this.command.description);
|
|
163
|
+
lines.push('');
|
|
164
|
+
// Details (if available)
|
|
165
|
+
if (this.command.details) {
|
|
166
|
+
lines.push(s.muted(' ABOUT'));
|
|
167
|
+
// Wrap long text
|
|
168
|
+
const maxWidth = width - 6;
|
|
169
|
+
const words = this.command.details.split(' ');
|
|
170
|
+
let currentLine = ' ';
|
|
171
|
+
for (const word of words) {
|
|
172
|
+
if (getVisibleLength(currentLine) + word.length + 1 > maxWidth) {
|
|
173
|
+
lines.push(currentLine);
|
|
174
|
+
currentLine = ' ' + word;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
currentLine += (currentLine.length > 3 ? ' ' : '') + word;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (currentLine.length > 3) {
|
|
181
|
+
lines.push(currentLine);
|
|
182
|
+
}
|
|
183
|
+
lines.push('');
|
|
184
|
+
}
|
|
185
|
+
// Footer
|
|
186
|
+
lines.push(border);
|
|
187
|
+
lines.push(s.muted(' q/Esc Back'));
|
|
188
|
+
lines.push(border);
|
|
189
|
+
return { lines };
|
|
190
|
+
}
|
|
191
|
+
handleKey(key) {
|
|
192
|
+
// Go back on Escape or 'q'
|
|
193
|
+
if (key.name === 'escape' || key.name === 'q') {
|
|
194
|
+
return { type: 'pop' };
|
|
195
|
+
}
|
|
196
|
+
return { type: 'none' };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlays using the new Overlay interface
|
|
3
|
+
*/
|
|
4
|
+
export { HelpOverlayV2 } from '../help-overlay-v2.js';
|
|
5
|
+
export { ThemeOverlayV2, type ThemeOverlayOptions, type ThemeOverlayResult } from '../theme-overlay-v2.js';
|
|
6
|
+
export { ModelOverlayV2, type ModelOverlayV2Options, type ModelOverlayV2Result } from '../model-overlay-v2.js';
|
|
7
|
+
export { ToolsOverlayV2, type ToolsOverlayV2Options, type ToolsOverlayV2Result, type ToolInfo, type ToolParameter, type ToolPermissionInfo } from '../tools-overlay-v2.js';
|
|
8
|
+
export { KeysOverlayV2, type KeysOverlayV2Result } from '../keys-overlay-v2.js';
|
|
9
|
+
export { MascotOverlayV2, type MascotOverlayV2Options, type MascotOverlayV2Result } from '../mascot-overlay-v2.js';
|
|
10
|
+
export { TutorialOverlayV2, type TutorialOverlayV2Result } from '../tutorial-overlay-v2.js';
|
|
11
|
+
export { CommandsOverlayV2, type CommandsOverlayV2Result } from '../commands-overlay-v2.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlays using the new Overlay interface
|
|
3
|
+
*/
|
|
4
|
+
export { HelpOverlayV2 } from '../help-overlay-v2.js';
|
|
5
|
+
export { ThemeOverlayV2 } from '../theme-overlay-v2.js';
|
|
6
|
+
export { ModelOverlayV2 } from '../model-overlay-v2.js';
|
|
7
|
+
export { ToolsOverlayV2 } from '../tools-overlay-v2.js';
|
|
8
|
+
export { KeysOverlayV2 } from '../keys-overlay-v2.js';
|
|
9
|
+
export { MascotOverlayV2 } from '../mascot-overlay-v2.js';
|
|
10
|
+
export { TutorialOverlayV2 } from '../tutorial-overlay-v2.js';
|
|
11
|
+
export { CommandsOverlayV2 } from '../commands-overlay-v2.js';
|
package/dist/ui/overlays.d.ts
CHANGED
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
* - Context stats
|
|
9
9
|
*/
|
|
10
10
|
import type { ContextStats, PermissionResult } from './types.js';
|
|
11
|
-
/**
|
|
12
|
-
* Show the tabbed help menu
|
|
13
|
-
*/
|
|
14
|
-
export declare function showHelp(): Promise<void>;
|
|
15
11
|
export interface ConfirmationOptions {
|
|
16
12
|
confirmText?: string;
|
|
17
13
|
cancelText?: string;
|