@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,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs Overlay
|
|
3
|
+
*
|
|
4
|
+
* Document browser for project documents (PRD, architecture, design, notes).
|
|
5
|
+
* Uses TabbedListOverlay for consistent list/tab/search behavior.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Tabbed filtering by document type
|
|
9
|
+
* - Search with / toggle
|
|
10
|
+
* - Paginated list
|
|
11
|
+
* - Full-screen document viewing with markdown rendering
|
|
12
|
+
* - Vim-style navigation in viewer (j/k, g/G, PgUp/PgDn)
|
|
13
|
+
*/
|
|
14
|
+
export interface DocsOverlayResult {
|
|
15
|
+
viewed: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function showDocsOverlay(): Promise<DocsOverlayResult>;
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs Overlay
|
|
3
|
+
*
|
|
4
|
+
* Document browser for project documents (PRD, architecture, design, notes).
|
|
5
|
+
* Uses TabbedListOverlay for consistent list/tab/search behavior.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Tabbed filtering by document type
|
|
9
|
+
* - Search with / toggle
|
|
10
|
+
* - Paginated list
|
|
11
|
+
* - Full-screen document viewing with markdown rendering
|
|
12
|
+
* - Vim-style navigation in viewer (j/k, g/G, PgUp/PgDn)
|
|
13
|
+
*/
|
|
14
|
+
import chalk from 'chalk';
|
|
15
|
+
import { marked } from 'marked';
|
|
16
|
+
import { markedTerminal } from 'marked-terminal';
|
|
17
|
+
import * as terminal from './terminal.js';
|
|
18
|
+
import { getCurrentTheme } from '../themes/index.js';
|
|
19
|
+
import { TabbedListOverlay, BaseScreen, stay, popScreen, closeOverlay, isEscape, isCtrlC, isNavigateUp, isNavigateDown, isSpace, isClose, renderBorder, } from './base/index.js';
|
|
20
|
+
import { documentRepository } from '../db/repositories/document-repository.js';
|
|
21
|
+
import { getActiveProject } from '../tools/project-db.js';
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// Constants
|
|
24
|
+
// =============================================================================
|
|
25
|
+
const PAGE_SIZE = 10;
|
|
26
|
+
const DOC_TYPE_LABELS = {
|
|
27
|
+
'prd': 'PRD',
|
|
28
|
+
'architecture': 'ARCH',
|
|
29
|
+
'design': 'DESIGN',
|
|
30
|
+
'notes': 'NOTES',
|
|
31
|
+
};
|
|
32
|
+
const TABS = [
|
|
33
|
+
{ id: 'all', label: 'All' },
|
|
34
|
+
{ id: 'prd', label: 'PRD' },
|
|
35
|
+
{ id: 'architecture', label: 'ARCH' },
|
|
36
|
+
{ id: 'design', label: 'DESIGN' },
|
|
37
|
+
{ id: 'notes', label: 'NOTES' },
|
|
38
|
+
];
|
|
39
|
+
// =============================================================================
|
|
40
|
+
// Markdown Rendering
|
|
41
|
+
// =============================================================================
|
|
42
|
+
function getThemedMarkedOptions() {
|
|
43
|
+
const theme = getCurrentTheme();
|
|
44
|
+
const primaryColor = chalk.hex(theme.colors.primary);
|
|
45
|
+
const secondaryColor = chalk.hex(theme.colors.secondary || theme.colors.primary);
|
|
46
|
+
const mutedColor = chalk.hex(theme.colors.muted);
|
|
47
|
+
const borderColor = chalk.hex(theme.colors.border);
|
|
48
|
+
const fgColor = chalk.hex(theme.colors.foreground);
|
|
49
|
+
return {
|
|
50
|
+
showSectionPrefix: false,
|
|
51
|
+
reflowText: false,
|
|
52
|
+
width: Math.min(100, terminal.getTerminalWidth() - 4),
|
|
53
|
+
unescape: true,
|
|
54
|
+
tab: 2,
|
|
55
|
+
heading: primaryColor.bold,
|
|
56
|
+
firstHeading: primaryColor.bold,
|
|
57
|
+
strong: fgColor.bold,
|
|
58
|
+
em: fgColor.italic,
|
|
59
|
+
link: secondaryColor,
|
|
60
|
+
href: secondaryColor.underline,
|
|
61
|
+
blockquote: mutedColor.italic,
|
|
62
|
+
del: mutedColor.strikethrough,
|
|
63
|
+
hr: borderColor,
|
|
64
|
+
codespan: secondaryColor,
|
|
65
|
+
code: secondaryColor,
|
|
66
|
+
html: mutedColor,
|
|
67
|
+
table: fgColor,
|
|
68
|
+
listitem: fgColor,
|
|
69
|
+
paragraph: fgColor,
|
|
70
|
+
tableOptions: {
|
|
71
|
+
style: { head: ['bold'], border: [] },
|
|
72
|
+
chars: {
|
|
73
|
+
'top': '─', 'top-mid': '─', 'top-left': '─', 'top-right': '─',
|
|
74
|
+
'bottom': '─', 'bottom-mid': '─', 'bottom-left': '─', 'bottom-right': '─',
|
|
75
|
+
'left': ' ', 'left-mid': ' ', 'mid': '─', 'mid-mid': '─',
|
|
76
|
+
'right': ' ', 'right-mid': ' ', 'middle': ' ',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function preprocessMarkdown(content) {
|
|
82
|
+
const lines = content.split('\n');
|
|
83
|
+
return lines.map(line => /^(\s*)\* /.test(line) ? line.replace(/^(\s*)\* /, '$1- ') : line).join('\n');
|
|
84
|
+
}
|
|
85
|
+
function postProcessInlineFormatting(text) {
|
|
86
|
+
return text.replace(/\*\*([^*]+)\*\*/g, (_match, content) => chalk.bold(content));
|
|
87
|
+
}
|
|
88
|
+
function renderMarkdownSync(content) {
|
|
89
|
+
const preprocessed = preprocessMarkdown(content);
|
|
90
|
+
const options = getThemedMarkedOptions();
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
92
|
+
marked.use(markedTerminal(options));
|
|
93
|
+
// Use synchronous parsing to avoid async rendering issues
|
|
94
|
+
const rendered = marked.parse(preprocessed, { async: false });
|
|
95
|
+
const postProcessed = postProcessInlineFormatting(rendered);
|
|
96
|
+
return postProcessed.split('\n');
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Full-screen document viewer with vim-style navigation.
|
|
100
|
+
*/
|
|
101
|
+
class DocumentViewScreen extends BaseScreen {
|
|
102
|
+
document;
|
|
103
|
+
styles;
|
|
104
|
+
viewState;
|
|
105
|
+
constructor(document, styles) {
|
|
106
|
+
super();
|
|
107
|
+
this.document = document;
|
|
108
|
+
this.styles = styles;
|
|
109
|
+
// Load content synchronously in constructor so it's ready for first render
|
|
110
|
+
this.viewState = {
|
|
111
|
+
contentLines: renderMarkdownSync(document.content),
|
|
112
|
+
scrollOffset: 0,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Called when entering this screen.
|
|
117
|
+
* Clear screen for full-screen view.
|
|
118
|
+
*/
|
|
119
|
+
onEnter() {
|
|
120
|
+
terminal.clearScreen();
|
|
121
|
+
}
|
|
122
|
+
render() {
|
|
123
|
+
const s = this.styles;
|
|
124
|
+
const cols = terminal.getTerminalWidth();
|
|
125
|
+
const rows = process.stdout.rows || 30;
|
|
126
|
+
const border = renderBorder(cols, s);
|
|
127
|
+
const lines = [];
|
|
128
|
+
// Header
|
|
129
|
+
const typeLabel = DOC_TYPE_LABELS[this.document.docType] || this.document.docType.toUpperCase();
|
|
130
|
+
lines.push(border);
|
|
131
|
+
lines.push(` ${s.primaryBold(typeLabel)}${s.muted(' │ ')}${chalk.bold(this.document.title)}`);
|
|
132
|
+
lines.push(border);
|
|
133
|
+
// Calculate content area
|
|
134
|
+
const headerLines = 3;
|
|
135
|
+
const footerLines = 3;
|
|
136
|
+
const contentHeight = rows - headerLines - footerLines;
|
|
137
|
+
// Get visible lines, accounting for wrapping
|
|
138
|
+
// We need to count physical lines (after wrapping) not logical lines
|
|
139
|
+
const totalLines = this.viewState.contentLines.length;
|
|
140
|
+
const visibleLines = [];
|
|
141
|
+
let physicalLinesUsed = 0;
|
|
142
|
+
for (let i = this.viewState.scrollOffset; i < totalLines && physicalLinesUsed < contentHeight; i++) {
|
|
143
|
+
const line = this.viewState.contentLines[i];
|
|
144
|
+
// Calculate how many physical lines this content line takes
|
|
145
|
+
// Strip ANSI codes for accurate width calculation
|
|
146
|
+
// eslint-disable-next-line no-control-regex
|
|
147
|
+
const visualLen = line.replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
148
|
+
const linePhysicalHeight = Math.max(1, Math.ceil(visualLen / cols));
|
|
149
|
+
if (physicalLinesUsed + linePhysicalHeight <= contentHeight) {
|
|
150
|
+
visibleLines.push(line);
|
|
151
|
+
physicalLinesUsed += linePhysicalHeight;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
break; // No room for this line
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Content
|
|
158
|
+
for (const line of visibleLines) {
|
|
159
|
+
lines.push(line);
|
|
160
|
+
}
|
|
161
|
+
// Pad remaining physical space
|
|
162
|
+
for (let i = physicalLinesUsed; i < contentHeight; i++) {
|
|
163
|
+
lines.push('');
|
|
164
|
+
}
|
|
165
|
+
// Footer with position info
|
|
166
|
+
const canScrollUp = this.viewState.scrollOffset > 0;
|
|
167
|
+
const canScrollDown = this.viewState.scrollOffset + contentHeight < totalLines;
|
|
168
|
+
const arrows = (canScrollUp ? '▲' : ' ') + (canScrollDown ? '▼' : ' ');
|
|
169
|
+
const position = totalLines > 0
|
|
170
|
+
? `Line ${String(this.viewState.scrollOffset + 1)}-${String(Math.min(this.viewState.scrollOffset + contentHeight, totalLines))} of ${String(totalLines)}`
|
|
171
|
+
: '';
|
|
172
|
+
const scrollPercent = totalLines > contentHeight
|
|
173
|
+
? Math.round(((this.viewState.scrollOffset + contentHeight) / totalLines) * 100)
|
|
174
|
+
: 100;
|
|
175
|
+
lines.push(border);
|
|
176
|
+
lines.push(s.muted(` ${arrows} ${position} (${String(scrollPercent)}%) ↑↓/jk Scroll · PgUp/PgDn Page · g/G Top/Bottom · q/Esc Back`));
|
|
177
|
+
lines.push(border);
|
|
178
|
+
return lines;
|
|
179
|
+
}
|
|
180
|
+
handleKey(data) {
|
|
181
|
+
const char = data.length === 1 && data[0] >= 0x20 && data[0] < 0x7f
|
|
182
|
+
? String.fromCharCode(data[0])
|
|
183
|
+
: null;
|
|
184
|
+
const keyStr = data.toString();
|
|
185
|
+
const rows = process.stdout.rows || 30;
|
|
186
|
+
const contentHeight = rows - 6;
|
|
187
|
+
const totalLines = this.viewState.contentLines.length;
|
|
188
|
+
const maxScroll = Math.max(0, totalLines - contentHeight);
|
|
189
|
+
// Ctrl+C closes everything
|
|
190
|
+
if (isCtrlC(data)) {
|
|
191
|
+
return closeOverlay({ viewed: true });
|
|
192
|
+
}
|
|
193
|
+
// Escape or q - back to list
|
|
194
|
+
if (isEscape(data) || isClose(data)) {
|
|
195
|
+
return popScreen();
|
|
196
|
+
}
|
|
197
|
+
// Up / k
|
|
198
|
+
if (isNavigateUp(data)) {
|
|
199
|
+
if (this.viewState.scrollOffset > 0) {
|
|
200
|
+
this.viewState.scrollOffset--;
|
|
201
|
+
return stay();
|
|
202
|
+
}
|
|
203
|
+
return stay(false);
|
|
204
|
+
}
|
|
205
|
+
// Down / j
|
|
206
|
+
if (isNavigateDown(data)) {
|
|
207
|
+
if (this.viewState.scrollOffset < maxScroll) {
|
|
208
|
+
this.viewState.scrollOffset++;
|
|
209
|
+
return stay();
|
|
210
|
+
}
|
|
211
|
+
return stay(false);
|
|
212
|
+
}
|
|
213
|
+
// Page Up
|
|
214
|
+
if (keyStr === '\x1b[5~') {
|
|
215
|
+
this.viewState.scrollOffset = Math.max(0, this.viewState.scrollOffset - contentHeight);
|
|
216
|
+
return stay();
|
|
217
|
+
}
|
|
218
|
+
// Page Down / Space
|
|
219
|
+
if (keyStr === '\x1b[6~' || isSpace(data)) {
|
|
220
|
+
this.viewState.scrollOffset = Math.min(maxScroll, this.viewState.scrollOffset + contentHeight);
|
|
221
|
+
return stay();
|
|
222
|
+
}
|
|
223
|
+
// g = top
|
|
224
|
+
if (char === 'g') {
|
|
225
|
+
this.viewState.scrollOffset = 0;
|
|
226
|
+
return stay();
|
|
227
|
+
}
|
|
228
|
+
// G = bottom
|
|
229
|
+
if (char === 'G') {
|
|
230
|
+
this.viewState.scrollOffset = maxScroll;
|
|
231
|
+
return stay();
|
|
232
|
+
}
|
|
233
|
+
// Home
|
|
234
|
+
if (keyStr === '\x1b[H') {
|
|
235
|
+
this.viewState.scrollOffset = 0;
|
|
236
|
+
return stay();
|
|
237
|
+
}
|
|
238
|
+
// End
|
|
239
|
+
if (keyStr === '\x1b[F') {
|
|
240
|
+
this.viewState.scrollOffset = maxScroll;
|
|
241
|
+
return stay();
|
|
242
|
+
}
|
|
243
|
+
return stay(false);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// =============================================================================
|
|
247
|
+
// Docs Overlay
|
|
248
|
+
// =============================================================================
|
|
249
|
+
class DocsOverlay extends TabbedListOverlay {
|
|
250
|
+
// Stored for potential future use (e.g., subtitle display)
|
|
251
|
+
_projectName;
|
|
252
|
+
constructor() {
|
|
253
|
+
const activeProject = getActiveProject();
|
|
254
|
+
const projectId = activeProject?.id ?? null;
|
|
255
|
+
const projectName = activeProject?.name ?? null;
|
|
256
|
+
// Load documents
|
|
257
|
+
const documents = projectId !== null
|
|
258
|
+
? documentRepository.listByProject(projectId)
|
|
259
|
+
: [];
|
|
260
|
+
const config = {
|
|
261
|
+
title: 'Documents',
|
|
262
|
+
tabs: TABS,
|
|
263
|
+
items: documents,
|
|
264
|
+
pageSize: PAGE_SIZE,
|
|
265
|
+
filterByTab: (doc, tabId) => {
|
|
266
|
+
if (tabId === 'all')
|
|
267
|
+
return true;
|
|
268
|
+
return doc.docType === tabId;
|
|
269
|
+
},
|
|
270
|
+
getSearchText: (doc) => `${doc.title} ${doc.docType}`,
|
|
271
|
+
renderItem: (doc, isSelected, styles) => {
|
|
272
|
+
const prefix = isSelected ? styles.primary('❯ ') : ' ';
|
|
273
|
+
const typeLabel = (DOC_TYPE_LABELS[doc.docType] || doc.docType).padEnd(8);
|
|
274
|
+
const title = doc.title.slice(0, 50);
|
|
275
|
+
if (isSelected) {
|
|
276
|
+
return `${prefix}${styles.primaryBold(typeLabel)} ${styles.primary(title)}`;
|
|
277
|
+
}
|
|
278
|
+
return `${prefix}${styles.muted(typeLabel)} ${styles.secondary(title)}`;
|
|
279
|
+
},
|
|
280
|
+
showCount: true,
|
|
281
|
+
emptyMessage: projectId === null
|
|
282
|
+
? 'No active project. Use /projects to select one.'
|
|
283
|
+
: 'No documents found. Use /design or /arch to create documents.',
|
|
284
|
+
noResultsMessage: 'No documents match the search.',
|
|
285
|
+
};
|
|
286
|
+
super(config);
|
|
287
|
+
this._projectName = projectName;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Override to add project name subtitle in header.
|
|
291
|
+
* For now, we work with the default rendering.
|
|
292
|
+
* The TabbedListOverlay handles everything else.
|
|
293
|
+
*/
|
|
294
|
+
createDetailScreen(doc) {
|
|
295
|
+
return new DocumentViewScreen(doc, this.styles);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// =============================================================================
|
|
299
|
+
// Export Function (Backward Compatible)
|
|
300
|
+
// =============================================================================
|
|
301
|
+
export async function showDocsOverlay() {
|
|
302
|
+
return new DocsOverlay().show();
|
|
303
|
+
}
|
package/dist/ui/ephemeral.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Ephemeral Zone
|
|
3
3
|
*
|
|
4
4
|
* @deprecated This module is superseded by the new Footer architecture.
|
|
5
|
-
* Use todo-zone.ts, input-prompt
|
|
5
|
+
* Use todo-zone.ts, input-prompt.ts, and footer.ts instead.
|
|
6
6
|
* This file is kept for reference and may be removed in a future cleanup.
|
|
7
7
|
*
|
|
8
8
|
* Manages the ephemeral area that is cleared and redrawn while agent works.
|
package/dist/ui/ephemeral.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Ephemeral Zone
|
|
3
3
|
*
|
|
4
4
|
* @deprecated This module is superseded by the new Footer architecture.
|
|
5
|
-
* Use todo-zone.ts, input-prompt
|
|
5
|
+
* Use todo-zone.ts, input-prompt.ts, and footer.ts instead.
|
|
6
6
|
* This file is kept for reference and may be removed in a future cleanup.
|
|
7
7
|
*
|
|
8
8
|
* Manages the ephemeral area that is cleared and redrawn while agent works.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay Features
|
|
3
|
+
*
|
|
4
|
+
* Composable features for building overlays.
|
|
5
|
+
* Each feature handles a specific aspect of overlay behavior.
|
|
6
|
+
*
|
|
7
|
+
* Available features:
|
|
8
|
+
* - ListFeature: List selection and navigation
|
|
9
|
+
* - TabFeature: Tab/filter navigation
|
|
10
|
+
* - InputFeature: Text input with cursor movement
|
|
11
|
+
* - PaginationFeature: Paginated list navigation with scroll tracking
|
|
12
|
+
* - SearchFeature: Search/filter text input with type-to-search
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { ListFeature, TabFeature, InputFeature, PaginationFeature, SearchFeature } from './features/index.js';
|
|
17
|
+
*
|
|
18
|
+
* const listFeature = new ListFeature(() => items);
|
|
19
|
+
* const tabFeature = new TabFeature(TABS);
|
|
20
|
+
* const inputFeature = new InputFeature({ placeholder: 'Enter text...' });
|
|
21
|
+
* const pagination = new PaginationFeature({ pageSize: 12 });
|
|
22
|
+
* const search = new SearchFeature({ onSearch: (q) => filter(q) });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export { ListFeature, createSimpleListRenderer, createLabelDescriptionRenderer, } from './list-feature.js';
|
|
26
|
+
export type { ListFeatureConfig } from './list-feature.js';
|
|
27
|
+
export { TabFeature, createTabsFromLabels, createFilterTabs, } from './tab-feature.js';
|
|
28
|
+
export type { TabFeatureConfig } from './tab-feature.js';
|
|
29
|
+
export { InputFeature } from './input-feature.js';
|
|
30
|
+
export type { InputFeatureOptions, InputKeyResult } from './input-feature.js';
|
|
31
|
+
export { PaginationFeature } from './pagination-feature.js';
|
|
32
|
+
export type { PaginationState, PaginationConfig, PaginationKeyResult, } from './pagination-feature.js';
|
|
33
|
+
export { SearchFeature } from './search-feature.js';
|
|
34
|
+
export type { SearchState, SearchConfig, SearchKeyResult, SearchBoxOptions, } from './search-feature.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay Features
|
|
3
|
+
*
|
|
4
|
+
* Composable features for building overlays.
|
|
5
|
+
* Each feature handles a specific aspect of overlay behavior.
|
|
6
|
+
*
|
|
7
|
+
* Available features:
|
|
8
|
+
* - ListFeature: List selection and navigation
|
|
9
|
+
* - TabFeature: Tab/filter navigation
|
|
10
|
+
* - InputFeature: Text input with cursor movement
|
|
11
|
+
* - PaginationFeature: Paginated list navigation with scroll tracking
|
|
12
|
+
* - SearchFeature: Search/filter text input with type-to-search
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { ListFeature, TabFeature, InputFeature, PaginationFeature, SearchFeature } from './features/index.js';
|
|
17
|
+
*
|
|
18
|
+
* const listFeature = new ListFeature(() => items);
|
|
19
|
+
* const tabFeature = new TabFeature(TABS);
|
|
20
|
+
* const inputFeature = new InputFeature({ placeholder: 'Enter text...' });
|
|
21
|
+
* const pagination = new PaginationFeature({ pageSize: 12 });
|
|
22
|
+
* const search = new SearchFeature({ onSearch: (q) => filter(q) });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
// List selection and navigation
|
|
26
|
+
export { ListFeature, createSimpleListRenderer, createLabelDescriptionRenderer, } from './list-feature.js';
|
|
27
|
+
// Tab/filter navigation
|
|
28
|
+
export { TabFeature, createTabsFromLabels, createFilterTabs, } from './tab-feature.js';
|
|
29
|
+
// Text input with cursor movement
|
|
30
|
+
export { InputFeature } from './input-feature.js';
|
|
31
|
+
// Paginated list navigation
|
|
32
|
+
export { PaginationFeature } from './pagination-feature.js';
|
|
33
|
+
// Search/filter text input
|
|
34
|
+
export { SearchFeature } from './search-feature.js';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Feature
|
|
3
|
+
*
|
|
4
|
+
* Composable text input handling for overlays.
|
|
5
|
+
* Provides cursor movement, text editing, and rendering.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* class MyScreen extends BaseScreen {
|
|
10
|
+
* private input = new InputFeature({ placeholder: 'Enter text...' });
|
|
11
|
+
*
|
|
12
|
+
* render(): string[] {
|
|
13
|
+
* return [
|
|
14
|
+
* ' ' + this.input.render(styles),
|
|
15
|
+
* ];
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* handleKey(data: Buffer): ScreenResult {
|
|
19
|
+
* const result = this.input.handleKey(data);
|
|
20
|
+
* if (result.handled) {
|
|
21
|
+
* return stay();
|
|
22
|
+
* }
|
|
23
|
+
* // Handle other keys (Enter, Escape, etc.)
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface InputFeatureOptions {
|
|
29
|
+
/** Initial value */
|
|
30
|
+
initialValue?: string;
|
|
31
|
+
/** Placeholder text when empty */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
/** Maximum length (0 = unlimited) */
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface InputKeyResult {
|
|
37
|
+
/** Whether the key was handled */
|
|
38
|
+
handled: boolean;
|
|
39
|
+
/** Whether to re-render */
|
|
40
|
+
render: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare class InputFeature {
|
|
43
|
+
/** Current text value */
|
|
44
|
+
private _value;
|
|
45
|
+
/** Cursor position (0 = before first char, value.length = after last char) */
|
|
46
|
+
private _cursor;
|
|
47
|
+
/** Placeholder text */
|
|
48
|
+
private readonly placeholder;
|
|
49
|
+
/** Maximum length */
|
|
50
|
+
private readonly maxLength;
|
|
51
|
+
constructor(options?: InputFeatureOptions);
|
|
52
|
+
/** Get current value */
|
|
53
|
+
get value(): string;
|
|
54
|
+
/** Set value (resets cursor to end) */
|
|
55
|
+
set value(v: string);
|
|
56
|
+
/** Get cursor position */
|
|
57
|
+
get cursor(): number;
|
|
58
|
+
/** Check if empty */
|
|
59
|
+
get isEmpty(): boolean;
|
|
60
|
+
/** Get trimmed value */
|
|
61
|
+
get trimmedValue(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Handle a key press.
|
|
64
|
+
* Returns whether the key was handled and whether to re-render.
|
|
65
|
+
*/
|
|
66
|
+
handleKey(data: Buffer): InputKeyResult;
|
|
67
|
+
/**
|
|
68
|
+
* Render the input field with cursor.
|
|
69
|
+
* Returns a string like: "> text with cursor_"
|
|
70
|
+
*
|
|
71
|
+
* @param styles - Theme styles for coloring
|
|
72
|
+
* @param prefix - Prefix before the input (default: "> ")
|
|
73
|
+
*/
|
|
74
|
+
render(styles: ReturnType<typeof import('../../themes/index.js').getStyles>, prefix?: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Render input field without cursor (for non-focused state).
|
|
77
|
+
*/
|
|
78
|
+
renderWithoutCursor(styles: ReturnType<typeof import('../../themes/index.js').getStyles>, prefix?: string): string;
|
|
79
|
+
/** Clear the input */
|
|
80
|
+
clear(): void;
|
|
81
|
+
/** Find word boundary to the left of cursor */
|
|
82
|
+
private findWordBoundaryLeft;
|
|
83
|
+
/** Find word boundary to the right of cursor */
|
|
84
|
+
private findWordBoundaryRight;
|
|
85
|
+
}
|