@yeshwanthyk/coding-agent 0.3.0 → 0.3.2
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 +8 -6
- package/dist/adapters/acp/index.d.ts +10 -0
- package/dist/adapters/acp/index.d.ts.map +1 -0
- package/dist/adapters/acp/index.js +250 -0
- package/dist/adapters/acp/index.js.map +1 -0
- package/dist/adapters/acp/protocol.d.ts +171 -0
- package/dist/adapters/acp/protocol.d.ts.map +1 -0
- package/dist/adapters/acp/protocol.js +25 -0
- package/dist/adapters/acp/protocol.js.map +1 -0
- package/dist/adapters/acp/session.d.ts +33 -0
- package/dist/adapters/acp/session.d.ts.map +1 -0
- package/dist/adapters/acp/session.js +216 -0
- package/dist/adapters/acp/session.js.map +1 -0
- package/dist/adapters/acp/updates.d.ts +17 -0
- package/dist/adapters/acp/updates.d.ts.map +1 -0
- package/dist/adapters/acp/updates.js +62 -0
- package/dist/adapters/acp/updates.js.map +1 -0
- package/dist/adapters/cli/headless.d.ts +7 -0
- package/dist/adapters/cli/headless.d.ts.map +1 -0
- package/dist/adapters/cli/headless.js +93 -0
- package/dist/adapters/cli/headless.js.map +1 -0
- package/dist/adapters/cli/validate.d.ts +3 -0
- package/dist/adapters/cli/validate.d.ts.map +1 -0
- package/dist/adapters/cli/validate.js +40 -0
- package/dist/adapters/cli/validate.js.map +1 -0
- package/dist/adapters/tui/app.d.ts +8 -0
- package/dist/adapters/tui/app.d.ts.map +1 -0
- package/dist/adapters/tui/app.jsx +25 -0
- package/dist/adapters/tui/app.jsx.map +1 -0
- package/dist/agent-events.d.ts +63 -0
- package/dist/agent-events.d.ts.map +1 -0
- package/dist/agent-events.js +510 -0
- package/dist/agent-events.js.map +1 -0
- package/dist/args.d.ts +18 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +87 -0
- package/dist/args.js.map +1 -0
- package/dist/autocomplete-commands.d.ts +26 -0
- package/dist/autocomplete-commands.d.ts.map +1 -0
- package/dist/autocomplete-commands.js +82 -0
- package/dist/autocomplete-commands.js.map +1 -0
- package/dist/commands.d.ts +10 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +17 -0
- package/dist/commands.js.map +1 -0
- package/dist/compact-handler.d.ts +42 -0
- package/dist/compact-handler.d.ts.map +1 -0
- package/dist/compact-handler.js +211 -0
- package/dist/compact-handler.js.map +1 -0
- package/dist/components/Footer.d.ts +9 -0
- package/dist/components/Footer.d.ts.map +1 -0
- package/dist/components/Footer.jsx +36 -0
- package/dist/components/Footer.jsx.map +1 -0
- package/dist/components/Header.d.ts +23 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.jsx +174 -0
- package/dist/components/Header.jsx.map +1 -0
- package/dist/components/MessageList.d.ts +19 -0
- package/dist/components/MessageList.d.ts.map +1 -0
- package/dist/components/MessageList.jsx +237 -0
- package/dist/components/MessageList.jsx.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/domain/commands/builtin/clear.d.ts +3 -0
- package/dist/domain/commands/builtin/clear.d.ts.map +1 -0
- package/dist/domain/commands/builtin/clear.js +13 -0
- package/dist/domain/commands/builtin/clear.js.map +1 -0
- package/dist/domain/commands/builtin/compact.d.ts +3 -0
- package/dist/domain/commands/builtin/compact.d.ts.map +1 -0
- package/dist/domain/commands/builtin/compact.js +84 -0
- package/dist/domain/commands/builtin/compact.js.map +1 -0
- package/dist/domain/commands/builtin/conceal.d.ts +3 -0
- package/dist/domain/commands/builtin/conceal.d.ts.map +1 -0
- package/dist/domain/commands/builtin/conceal.js +8 -0
- package/dist/domain/commands/builtin/conceal.js.map +1 -0
- package/dist/domain/commands/builtin/diffwrap.d.ts +3 -0
- package/dist/domain/commands/builtin/diffwrap.d.ts.map +1 -0
- package/dist/domain/commands/builtin/diffwrap.js +8 -0
- package/dist/domain/commands/builtin/diffwrap.js.map +1 -0
- package/dist/domain/commands/builtin/editor.d.ts +3 -0
- package/dist/domain/commands/builtin/editor.d.ts.map +1 -0
- package/dist/domain/commands/builtin/editor.js +22 -0
- package/dist/domain/commands/builtin/editor.js.map +1 -0
- package/dist/domain/commands/builtin/exit.d.ts +3 -0
- package/dist/domain/commands/builtin/exit.d.ts.map +1 -0
- package/dist/domain/commands/builtin/exit.js +14 -0
- package/dist/domain/commands/builtin/exit.js.map +1 -0
- package/dist/domain/commands/builtin/followup.d.ts +3 -0
- package/dist/domain/commands/builtin/followup.d.ts.map +1 -0
- package/dist/domain/commands/builtin/followup.js +20 -0
- package/dist/domain/commands/builtin/followup.js.map +1 -0
- package/dist/domain/commands/builtin/index.d.ts +2 -0
- package/dist/domain/commands/builtin/index.d.ts.map +1 -0
- package/dist/domain/commands/builtin/index.js +29 -0
- package/dist/domain/commands/builtin/index.js.map +1 -0
- package/dist/domain/commands/builtin/login.d.ts +3 -0
- package/dist/domain/commands/builtin/login.d.ts.map +1 -0
- package/dist/domain/commands/builtin/login.js +92 -0
- package/dist/domain/commands/builtin/login.js.map +1 -0
- package/dist/domain/commands/builtin/model.d.ts +3 -0
- package/dist/domain/commands/builtin/model.d.ts.map +1 -0
- package/dist/domain/commands/builtin/model.js +53 -0
- package/dist/domain/commands/builtin/model.js.map +1 -0
- package/dist/domain/commands/builtin/status.d.ts +3 -0
- package/dist/domain/commands/builtin/status.d.ts.map +1 -0
- package/dist/domain/commands/builtin/status.js +30 -0
- package/dist/domain/commands/builtin/status.js.map +1 -0
- package/dist/domain/commands/builtin/steer.d.ts +3 -0
- package/dist/domain/commands/builtin/steer.d.ts.map +1 -0
- package/dist/domain/commands/builtin/steer.js +20 -0
- package/dist/domain/commands/builtin/steer.js.map +1 -0
- package/dist/domain/commands/builtin/theme.d.ts +3 -0
- package/dist/domain/commands/builtin/theme.d.ts.map +1 -0
- package/dist/domain/commands/builtin/theme.js +19 -0
- package/dist/domain/commands/builtin/theme.js.map +1 -0
- package/dist/domain/commands/builtin/thinking.d.ts +3 -0
- package/dist/domain/commands/builtin/thinking.d.ts.map +1 -0
- package/dist/domain/commands/builtin/thinking.js +16 -0
- package/dist/domain/commands/builtin/thinking.js.map +1 -0
- package/dist/domain/commands/helpers.d.ts +7 -0
- package/dist/domain/commands/helpers.d.ts.map +1 -0
- package/dist/domain/commands/helpers.js +34 -0
- package/dist/domain/commands/helpers.js.map +1 -0
- package/dist/domain/commands/registry.d.ts +10 -0
- package/dist/domain/commands/registry.d.ts.map +1 -0
- package/dist/domain/commands/registry.js +36 -0
- package/dist/domain/commands/registry.js.map +1 -0
- package/dist/domain/commands/types.d.ts +62 -0
- package/dist/domain/commands/types.d.ts.map +1 -0
- package/dist/domain/commands/types.js +2 -0
- package/dist/domain/commands/types.js.map +1 -0
- package/dist/domain/messaging/content.d.ts +37 -0
- package/dist/domain/messaging/content.d.ts.map +1 -0
- package/dist/domain/messaging/content.js +103 -0
- package/dist/domain/messaging/content.js.map +1 -0
- package/dist/editor.d.ts +26 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +81 -0
- package/dist/editor.js.map +1 -0
- package/dist/extensibility/schema.d.ts +2 -0
- package/dist/extensibility/schema.d.ts.map +1 -0
- package/{src/extensibility/schema.ts → dist/extensibility/schema.js} +2 -1
- package/dist/extensibility/schema.js.map +1 -0
- package/dist/extensibility/validation.d.ts +2 -0
- package/dist/extensibility/validation.d.ts.map +1 -0
- package/{src/extensibility/validation.ts → dist/extensibility/validation.js} +2 -1
- package/dist/extensibility/validation.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAgentEvents.d.ts +8 -0
- package/dist/hooks/useAgentEvents.d.ts.map +1 -0
- package/dist/hooks/useAgentEvents.js +22 -0
- package/dist/hooks/useAgentEvents.js.map +1 -0
- package/dist/hooks/useEditorBridge.d.ts +20 -0
- package/dist/hooks/useEditorBridge.d.ts.map +1 -0
- package/dist/hooks/useEditorBridge.js +80 -0
- package/dist/hooks/useEditorBridge.js.map +1 -0
- package/dist/hooks/useGitStatus.d.ts +2 -0
- package/dist/hooks/useGitStatus.d.ts.map +1 -0
- package/dist/hooks/useGitStatus.js +26 -0
- package/dist/hooks/useGitStatus.js.map +1 -0
- package/dist/hooks/usePromptQueue.d.ts +2 -0
- package/dist/hooks/usePromptQueue.d.ts.map +1 -0
- package/dist/hooks/usePromptQueue.js +2 -0
- package/dist/hooks/usePromptQueue.js.map +1 -0
- package/dist/hooks/useSessionController.d.ts +2 -0
- package/dist/hooks/useSessionController.d.ts.map +1 -0
- package/dist/hooks/useSessionController.js +2 -0
- package/dist/hooks/useSessionController.js.map +1 -0
- package/dist/hooks/useSpinner.d.ts +4 -0
- package/dist/hooks/useSpinner.d.ts.map +1 -0
- package/dist/hooks/useSpinner.js +25 -0
- package/dist/hooks/useSpinner.js.map +1 -0
- package/dist/hooks/useToastManager.d.ts +6 -0
- package/dist/hooks/useToastManager.d.ts.map +1 -0
- package/dist/hooks/useToastManager.js +22 -0
- package/dist/hooks/useToastManager.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -0
- package/dist/keyboard-handler.d.ts +30 -0
- package/dist/keyboard-handler.d.ts.map +1 -0
- package/dist/keyboard-handler.js +96 -0
- package/dist/keyboard-handler.js.map +1 -0
- package/dist/profiler.d.ts +2 -0
- package/dist/profiler.d.ts.map +1 -0
- package/dist/profiler.js +41 -0
- package/dist/profiler.js.map +1 -0
- package/dist/runtime/context.d.ts +8 -0
- package/dist/runtime/context.d.ts.map +1 -0
- package/dist/runtime/context.jsx +11 -0
- package/dist/runtime/context.jsx.map +1 -0
- package/dist/runtime/factory.d.ts +12 -0
- package/dist/runtime/factory.d.ts.map +1 -0
- package/dist/runtime/factory.js +37 -0
- package/dist/runtime/factory.js.map +1 -0
- package/dist/runtime/git/git-info.d.ts +3 -0
- package/dist/runtime/git/git-info.d.ts.map +1 -0
- package/dist/runtime/git/git-info.js +29 -0
- package/dist/runtime/git/git-info.js.map +1 -0
- package/dist/runtime/session/session-controller.d.ts +48 -0
- package/dist/runtime/session/session-controller.d.ts.map +1 -0
- package/dist/runtime/session/session-controller.js +159 -0
- package/dist/runtime/session/session-controller.js.map +1 -0
- package/dist/session-manager.d.ts +2 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +2 -0
- package/dist/session-manager.js.map +1 -0
- package/dist/session-picker.d.ts +6 -0
- package/dist/session-picker.d.ts.map +1 -0
- package/dist/session-picker.jsx +96 -0
- package/dist/session-picker.jsx.map +1 -0
- package/dist/shell-runner.d.ts +21 -0
- package/dist/shell-runner.d.ts.map +1 -0
- package/dist/shell-runner.js +106 -0
- package/dist/shell-runner.js.map +1 -0
- package/dist/syntax-highlighting.d.ts +4 -0
- package/dist/syntax-highlighting.d.ts.map +1 -0
- package/dist/syntax-highlighting.js +108 -0
- package/dist/syntax-highlighting.js.map +1 -0
- package/dist/theme-names.d.ts +7 -0
- package/dist/theme-names.d.ts.map +1 -0
- package/dist/theme-names.js +38 -0
- package/dist/theme-names.js.map +1 -0
- package/dist/tool-ui-contracts.d.ts +30 -0
- package/dist/tool-ui-contracts.d.ts.map +1 -0
- package/dist/tool-ui-contracts.js +53 -0
- package/dist/tool-ui-contracts.js.map +1 -0
- package/dist/tui-open-rendering.d.ts +37 -0
- package/dist/tui-open-rendering.d.ts.map +1 -0
- package/dist/tui-open-rendering.jsx +462 -0
- package/dist/tui-open-rendering.jsx.map +1 -0
- package/dist/types.d.ts +117 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/app-shell/TuiApp.d.ts +6 -0
- package/dist/ui/app-shell/TuiApp.d.ts.map +1 -0
- package/dist/ui/app-shell/TuiApp.jsx +480 -0
- package/dist/ui/app-shell/TuiApp.jsx.map +1 -0
- package/dist/ui/clipboard/osc52.d.ts +2 -0
- package/dist/ui/clipboard/osc52.d.ts.map +1 -0
- package/dist/ui/clipboard/osc52.js +19 -0
- package/dist/ui/clipboard/osc52.js.map +1 -0
- package/dist/ui/components/modals/ConfirmModal.d.ts +8 -0
- package/dist/ui/components/modals/ConfirmModal.d.ts.map +1 -0
- package/dist/ui/components/modals/ConfirmModal.jsx +39 -0
- package/dist/ui/components/modals/ConfirmModal.jsx.map +1 -0
- package/dist/ui/components/modals/EditorModal.d.ts +8 -0
- package/dist/ui/components/modals/EditorModal.d.ts.map +1 -0
- package/dist/ui/components/modals/EditorModal.jsx +23 -0
- package/dist/ui/components/modals/EditorModal.jsx.map +1 -0
- package/dist/ui/components/modals/InputModal.d.ts +8 -0
- package/dist/ui/components/modals/InputModal.d.ts.map +1 -0
- package/dist/ui/components/modals/InputModal.jsx +15 -0
- package/dist/ui/components/modals/InputModal.jsx.map +1 -0
- package/dist/ui/components/modals/ModalContainer.d.ts +8 -0
- package/dist/ui/components/modals/ModalContainer.d.ts.map +1 -0
- package/dist/ui/components/modals/ModalContainer.jsx +34 -0
- package/dist/ui/components/modals/ModalContainer.jsx.map +1 -0
- package/dist/ui/components/modals/SelectModal.d.ts +8 -0
- package/dist/ui/components/modals/SelectModal.d.ts.map +1 -0
- package/dist/ui/components/modals/SelectModal.jsx +32 -0
- package/dist/ui/components/modals/SelectModal.jsx.map +1 -0
- package/{src/ui/components/modals/index.ts → dist/ui/components/modals/index.d.ts} +5 -4
- package/dist/ui/components/modals/index.d.ts.map +1 -0
- package/dist/ui/components/modals/index.js +5 -0
- package/dist/ui/components/modals/index.js.map +1 -0
- package/dist/ui/features/composer/Composer.d.ts +16 -0
- package/dist/ui/features/composer/Composer.d.ts.map +1 -0
- package/dist/ui/features/composer/Composer.jsx +39 -0
- package/dist/ui/features/composer/Composer.jsx.map +1 -0
- package/dist/ui/features/composer/SlashCommandHandler.d.ts +14 -0
- package/dist/ui/features/composer/SlashCommandHandler.d.ts.map +1 -0
- package/dist/ui/features/composer/SlashCommandHandler.js +43 -0
- package/dist/ui/features/composer/SlashCommandHandler.js.map +1 -0
- package/dist/ui/features/composer/keyboard.d.ts +3 -0
- package/dist/ui/features/composer/keyboard.d.ts.map +1 -0
- package/dist/ui/features/composer/keyboard.js +3 -0
- package/dist/ui/features/composer/keyboard.js.map +1 -0
- package/dist/ui/features/main-view/MainView.d.ts +52 -0
- package/dist/ui/features/main-view/MainView.d.ts.map +1 -0
- package/dist/ui/features/main-view/MainView.jsx +269 -0
- package/dist/ui/features/main-view/MainView.jsx.map +1 -0
- package/dist/ui/features/message-pane/MessagePane.d.ts +15 -0
- package/dist/ui/features/message-pane/MessagePane.d.ts.map +1 -0
- package/dist/ui/features/message-pane/MessagePane.jsx +7 -0
- package/dist/ui/features/message-pane/MessagePane.jsx.map +1 -0
- package/dist/ui/hooks/useModals.d.ts +35 -0
- package/dist/ui/hooks/useModals.d.ts.map +1 -0
- package/dist/ui/hooks/useModals.js +36 -0
- package/dist/ui/hooks/useModals.js.map +1 -0
- package/dist/ui/state/app-store.d.ts +42 -0
- package/dist/ui/state/app-store.d.ts.map +1 -0
- package/dist/ui/state/app-store.js +28 -0
- package/dist/ui/state/app-store.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +3 -0
- package/dist/utils.js.map +1 -0
- package/package.json +19 -6
- package/src/adapters/acp/index.ts +0 -305
- package/src/adapters/acp/protocol.ts +0 -191
- package/src/adapters/acp/session.ts +0 -289
- package/src/adapters/acp/updates.ts +0 -96
- package/src/adapters/cli/headless.ts +0 -112
- package/src/adapters/cli/validate.ts +0 -50
- package/src/adapters/tui/app.tsx +0 -39
- package/src/agent-events.ts +0 -671
- package/src/args.ts +0 -102
- package/src/autocomplete-commands.ts +0 -102
- package/src/commands.ts +0 -23
- package/src/compact-handler.ts +0 -272
- package/src/components/Footer.tsx +0 -49
- package/src/components/Header.tsx +0 -218
- package/src/components/MessageList.tsx +0 -380
- package/src/config.ts +0 -1
- package/src/domain/commands/builtin/clear.ts +0 -14
- package/src/domain/commands/builtin/compact.ts +0 -96
- package/src/domain/commands/builtin/conceal.ts +0 -9
- package/src/domain/commands/builtin/diffwrap.ts +0 -9
- package/src/domain/commands/builtin/editor.ts +0 -24
- package/src/domain/commands/builtin/exit.ts +0 -14
- package/src/domain/commands/builtin/followup.ts +0 -24
- package/src/domain/commands/builtin/index.ts +0 -29
- package/src/domain/commands/builtin/login.ts +0 -118
- package/src/domain/commands/builtin/model.ts +0 -66
- package/src/domain/commands/builtin/status.ts +0 -32
- package/src/domain/commands/builtin/steer.ts +0 -24
- package/src/domain/commands/builtin/theme.ts +0 -23
- package/src/domain/commands/builtin/thinking.ts +0 -16
- package/src/domain/commands/helpers.ts +0 -41
- package/src/domain/commands/registry.ts +0 -42
- package/src/domain/commands/types.ts +0 -69
- package/src/domain/messaging/content.ts +0 -117
- package/src/editor.ts +0 -103
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useAgentEvents.ts +0 -28
- package/src/hooks/useEditorBridge.ts +0 -101
- package/src/hooks/useGitStatus.ts +0 -28
- package/src/hooks/usePromptQueue.ts +0 -7
- package/src/hooks/useSessionController.ts +0 -5
- package/src/hooks/useSpinner.ts +0 -28
- package/src/hooks/useToastManager.ts +0 -26
- package/src/index.ts +0 -188
- package/src/keyboard-handler.ts +0 -134
- package/src/profiler.ts +0 -40
- package/src/runtime/context.tsx +0 -16
- package/src/runtime/factory.ts +0 -63
- package/src/runtime/git/git-info.ts +0 -25
- package/src/runtime/session/session-controller.ts +0 -208
- package/src/session-manager.ts +0 -1
- package/src/session-picker.tsx +0 -134
- package/src/shell-runner.ts +0 -134
- package/src/syntax-highlighting.ts +0 -114
- package/src/theme-names.ts +0 -37
- package/src/tool-ui-contracts.ts +0 -77
- package/src/tui-open-rendering.tsx +0 -565
- package/src/types.ts +0 -89
- package/src/ui/app-shell/TuiApp.tsx +0 -586
- package/src/ui/clipboard/osc52.ts +0 -18
- package/src/ui/components/modals/ConfirmModal.tsx +0 -52
- package/src/ui/components/modals/EditorModal.tsx +0 -39
- package/src/ui/components/modals/InputModal.tsx +0 -30
- package/src/ui/components/modals/ModalContainer.tsx +0 -67
- package/src/ui/components/modals/SelectModal.tsx +0 -48
- package/src/ui/features/composer/Composer.tsx +0 -73
- package/src/ui/features/composer/SlashCommandHandler.ts +0 -58
- package/src/ui/features/composer/keyboard.ts +0 -3
- package/src/ui/features/main-view/MainView.tsx +0 -367
- package/src/ui/features/message-pane/MessagePane.tsx +0 -34
- package/src/ui/hooks/useModals.ts +0 -74
- package/src/ui/state/app-store.ts +0 -67
- package/src/utils.ts +0 -14
package/src/args.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
export interface ParsedArgs {
|
|
2
|
-
headless: boolean;
|
|
3
|
-
acp: boolean;
|
|
4
|
-
command?: 'validate';
|
|
5
|
-
prompt?: string;
|
|
6
|
-
configDir?: string;
|
|
7
|
-
configPath?: string;
|
|
8
|
-
provider?: string;
|
|
9
|
-
/** Single model or comma-separated list for Ctrl+P cycling */
|
|
10
|
-
model?: string;
|
|
11
|
-
thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
12
|
-
continue: boolean;
|
|
13
|
-
resume: boolean;
|
|
14
|
-
help: boolean;
|
|
15
|
-
version: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const parseArgs = (argv: string[]): ParsedArgs => {
|
|
19
|
-
const args: ParsedArgs = {
|
|
20
|
-
headless: false,
|
|
21
|
-
acp: false,
|
|
22
|
-
prompt: undefined,
|
|
23
|
-
configDir: undefined,
|
|
24
|
-
configPath: undefined,
|
|
25
|
-
provider: undefined,
|
|
26
|
-
model: undefined,
|
|
27
|
-
thinking: undefined,
|
|
28
|
-
continue: false,
|
|
29
|
-
resume: false,
|
|
30
|
-
help: false,
|
|
31
|
-
version: false,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const rest: string[] = [];
|
|
35
|
-
for (let i = 0; i < argv.length; i++) {
|
|
36
|
-
const a = argv[i]!;
|
|
37
|
-
if (!a.startsWith('-') && !args.command && rest.length === 0 && a === 'validate') {
|
|
38
|
-
args.command = 'validate';
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if (a === '--help' || a === '-h') {
|
|
42
|
-
args.help = true;
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (a === '--version' || a === '-v') {
|
|
46
|
-
args.version = true;
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (a === '--continue' || a === '-c') {
|
|
50
|
-
args.continue = true;
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (a === '--resume' || a === '-r') {
|
|
54
|
-
args.resume = true;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (a === "--headless") {
|
|
58
|
-
args.headless = true;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (a === "--acp") {
|
|
62
|
-
args.acp = true;
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (a === "--config-dir") {
|
|
66
|
-
args.configDir = argv[i + 1];
|
|
67
|
-
i += 1;
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (a === "--config") {
|
|
71
|
-
args.configPath = argv[i + 1];
|
|
72
|
-
i += 1;
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
if (a === '--provider') {
|
|
76
|
-
args.provider = argv[i + 1];
|
|
77
|
-
i += 1;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (a === '--model') {
|
|
81
|
-
args.model = argv[i + 1];
|
|
82
|
-
i += 1;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (a === '--thinking') {
|
|
86
|
-
const level = argv[i + 1];
|
|
87
|
-
if (level === 'off' || level === 'minimal' || level === 'low' || level === 'medium' || level === 'high' || level === 'xhigh') {
|
|
88
|
-
args.thinking = level;
|
|
89
|
-
} else if (level !== undefined) {
|
|
90
|
-
rest.push(a, level);
|
|
91
|
-
} else {
|
|
92
|
-
rest.push(a);
|
|
93
|
-
}
|
|
94
|
-
i += 1;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
rest.push(a);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (rest.length) args.prompt = rest.join(" ");
|
|
101
|
-
return args;
|
|
102
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { getModels, getProviders } from '@yeshwanthyk/ai';
|
|
2
|
-
import type { ThinkingLevel } from '@yeshwanthyk/agent-core';
|
|
3
|
-
import { THEME_NAMES } from "./theme-names.js";
|
|
4
|
-
|
|
5
|
-
type KnownProvider = ReturnType<typeof getProviders>[number];
|
|
6
|
-
|
|
7
|
-
export interface AutocompleteContext {
|
|
8
|
-
currentProvider: KnownProvider;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface SlashCommand {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
getArgumentCompletions?: (argumentText: string, ctx: AutocompleteContext) => Array<{ value: string; label: string; description?: string }>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const resolveProvider = (raw: string): KnownProvider | undefined => {
|
|
18
|
-
const trimmed = raw.trim();
|
|
19
|
-
if (!trimmed) return undefined;
|
|
20
|
-
const providers = getProviders();
|
|
21
|
-
return providers.includes(trimmed as KnownProvider) ? (trimmed as KnownProvider) : undefined;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const slashCommands: SlashCommand[] = [
|
|
25
|
-
{ name: 'clear', description: 'Clear chat + reset agent' },
|
|
26
|
-
{ name: 'compact', description: 'Compact context into summary + start fresh' },
|
|
27
|
-
{ name: 'conceal', description: 'Toggle markdown conceal mode (hide syntax chars)' },
|
|
28
|
-
{ name: 'diffwrap', description: 'Toggle diff word wrap mode' },
|
|
29
|
-
{ name: 'abort', description: 'Abort in-flight request' },
|
|
30
|
-
{ name: 'exit', description: 'Exit' },
|
|
31
|
-
{ name: 'status', description: 'Show session status (model, context, turns)' },
|
|
32
|
-
{ name: 'steer', description: 'Interrupt current run: /steer <text>' },
|
|
33
|
-
{ name: 'followup', description: 'Queue follow-up text: /followup <text>' },
|
|
34
|
-
{
|
|
35
|
-
name: 'theme',
|
|
36
|
-
description: 'Set theme: /theme <name> (or /theme to list)',
|
|
37
|
-
getArgumentCompletions: (argumentText: string) => {
|
|
38
|
-
const prefix = argumentText.trim().toLowerCase();
|
|
39
|
-
return THEME_NAMES
|
|
40
|
-
.filter((t) => t.startsWith(prefix))
|
|
41
|
-
.map((t) => ({ value: t, label: t }));
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
{ name: 'editor', description: 'Open configured editor' },
|
|
45
|
-
{
|
|
46
|
-
name: 'model',
|
|
47
|
-
description: 'Set model: /model <provider> <modelId> (or /model <modelId>)',
|
|
48
|
-
getArgumentCompletions: (argumentText: string, ctx: AutocompleteContext) => {
|
|
49
|
-
const text = argumentText.trimStart();
|
|
50
|
-
const providers = getProviders();
|
|
51
|
-
|
|
52
|
-
const providerItems = (prefix: string) =>
|
|
53
|
-
providers
|
|
54
|
-
.filter((p) => p.toLowerCase().startsWith(prefix.toLowerCase()))
|
|
55
|
-
.map((p) => ({ value: `${p} `, label: p, description: 'provider' }));
|
|
56
|
-
|
|
57
|
-
const spaceIdx = text.search(/\s/);
|
|
58
|
-
if (!text || spaceIdx === -1) {
|
|
59
|
-
const prefix = text;
|
|
60
|
-
const models = getModels(ctx.currentProvider)
|
|
61
|
-
.filter((m) => m.id.toLowerCase().startsWith(prefix.toLowerCase()))
|
|
62
|
-
.slice(0, 50)
|
|
63
|
-
.map((m) => ({ value: m.id, label: m.id, description: m.name }));
|
|
64
|
-
|
|
65
|
-
return [...providerItems(prefix), ...models];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const providerToken = text.slice(0, spaceIdx);
|
|
69
|
-
const provider = resolveProvider(providerToken);
|
|
70
|
-
if (!provider) {
|
|
71
|
-
return providerItems(providerToken);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const modelPrefix = text.slice(spaceIdx + 1).trimStart();
|
|
75
|
-
return getModels(provider)
|
|
76
|
-
.filter((m) => m.id.toLowerCase().startsWith(modelPrefix.toLowerCase()))
|
|
77
|
-
.slice(0, 50)
|
|
78
|
-
.map((m) => ({ value: `${provider} ${m.id}`, label: m.id, description: m.name }));
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: 'thinking',
|
|
83
|
-
description: 'Set thinking: /thinking off|minimal|low|medium|high|xhigh',
|
|
84
|
-
getArgumentCompletions: (argumentPrefix: string) => {
|
|
85
|
-
const levels: ThinkingLevel[] = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh'];
|
|
86
|
-
const prefix = argumentPrefix.trim().toLowerCase();
|
|
87
|
-
return levels
|
|
88
|
-
.filter((level) => level.startsWith(prefix))
|
|
89
|
-
.map((level) => ({ value: level, label: level }));
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
|
|
94
|
-
export function createAutocompleteCommands(getContext: () => AutocompleteContext) {
|
|
95
|
-
return slashCommands.map((cmd) => ({
|
|
96
|
-
name: cmd.name,
|
|
97
|
-
description: cmd.description,
|
|
98
|
-
getArgumentCompletions: cmd.getArgumentCompletions
|
|
99
|
-
? (text: string) => cmd.getArgumentCompletions!(text, getContext())
|
|
100
|
-
: undefined,
|
|
101
|
-
}));
|
|
102
|
-
}
|
package/src/commands.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { builtinCommands } from "@domain/commands/builtin/index.js"
|
|
2
|
-
import { CommandRegistry } from "@domain/commands/registry.js"
|
|
3
|
-
import { resolveModel, resolveProvider } from "@domain/commands/helpers.js"
|
|
4
|
-
import { THINKING_LEVELS, type CommandContext } from "@domain/commands/types.js"
|
|
5
|
-
import type { CommandDefinition } from "@domain/commands/types.js"
|
|
6
|
-
|
|
7
|
-
const registry = new CommandRegistry()
|
|
8
|
-
for (const command of builtinCommands) {
|
|
9
|
-
registry.register(command)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const commandRegistry = registry
|
|
13
|
-
|
|
14
|
-
export const registerCommand = (definition: CommandDefinition): void => {
|
|
15
|
-
registry.register(definition)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const handleSlashCommand = (line: string, ctx: CommandContext) => {
|
|
19
|
-
return registry.execute(line, ctx)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { THINKING_LEVELS, resolveProvider, resolveModel, CommandRegistry }
|
|
23
|
-
export type { CommandContext, CommandDefinition }
|
package/src/compact-handler.ts
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import type { Agent, AppMessage } from '@yeshwanthyk/agent-core';
|
|
2
|
-
import { completeSimple, type Message, type TextContent } from '@yeshwanthyk/ai';
|
|
3
|
-
import type { CodexTransport } from '@yeshwanthyk/agent-core';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Tracks file operations across messages for deterministic file list generation.
|
|
7
|
-
*/
|
|
8
|
-
export interface FileOperations {
|
|
9
|
-
read: Set<string>;
|
|
10
|
-
written: Set<string>;
|
|
11
|
-
edited: Set<string>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Extract file operations from a single message's tool calls.
|
|
16
|
-
*/
|
|
17
|
-
function extractFileOpsFromMessage(message: Message, fileOps: FileOperations): void {
|
|
18
|
-
if (message.role !== 'assistant') return;
|
|
19
|
-
|
|
20
|
-
for (const block of message.content) {
|
|
21
|
-
if (block.type !== 'toolCall') continue;
|
|
22
|
-
|
|
23
|
-
const path = block.arguments?.path;
|
|
24
|
-
if (typeof path !== 'string') continue;
|
|
25
|
-
|
|
26
|
-
switch (block.name) {
|
|
27
|
-
case 'read':
|
|
28
|
-
fileOps.read.add(path);
|
|
29
|
-
break;
|
|
30
|
-
case 'write':
|
|
31
|
-
fileOps.written.add(path);
|
|
32
|
-
break;
|
|
33
|
-
case 'edit':
|
|
34
|
-
fileOps.edited.add(path);
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Extract file operations from all messages.
|
|
42
|
-
*/
|
|
43
|
-
export function extractAllFileOps(messages: Message[]): FileOperations {
|
|
44
|
-
const fileOps: FileOperations = {
|
|
45
|
-
read: new Set(),
|
|
46
|
-
written: new Set(),
|
|
47
|
-
edited: new Set(),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
for (const msg of messages) {
|
|
51
|
-
extractFileOpsFromMessage(msg, fileOps);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return fileOps;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Format file operations as XML tags for appending to summary.
|
|
59
|
-
* Modified files = edited ∪ written
|
|
60
|
-
* Read files = read - modified (files only read, not modified)
|
|
61
|
-
*/
|
|
62
|
-
export function formatFileOperations(fileOps: FileOperations): string {
|
|
63
|
-
const modified = new Set([...fileOps.edited, ...fileOps.written]);
|
|
64
|
-
const readOnly = [...fileOps.read].filter(f => !modified.has(f)).sort();
|
|
65
|
-
const modifiedList = [...modified].sort();
|
|
66
|
-
|
|
67
|
-
let result = '';
|
|
68
|
-
|
|
69
|
-
if (readOnly.length > 0) {
|
|
70
|
-
result += `\n\n<read-files>\n${readOnly.join('\n')}\n</read-files>`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (modifiedList.length > 0) {
|
|
74
|
-
result += `\n\n<modified-files>\n${modifiedList.join('\n')}\n</modified-files>`;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary:
|
|
81
|
-
|
|
82
|
-
<summary>
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
export const SUMMARY_SUFFIX = `
|
|
86
|
-
</summary>`;
|
|
87
|
-
|
|
88
|
-
const SUMMARIZATION_PROMPT = `You are performing a CONTEXT CHECKPOINT COMPACTION. Create a handoff summary for another LLM.
|
|
89
|
-
|
|
90
|
-
Use this EXACT format:
|
|
91
|
-
|
|
92
|
-
## Goal
|
|
93
|
-
[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
|
|
94
|
-
|
|
95
|
-
## Constraints & Preferences
|
|
96
|
-
- [Any constraints, preferences, or requirements mentioned by user]
|
|
97
|
-
- [Or "(none)" if none were mentioned]
|
|
98
|
-
|
|
99
|
-
## Progress
|
|
100
|
-
### Done
|
|
101
|
-
- [x] [Completed task with relevant file paths]
|
|
102
|
-
|
|
103
|
-
### In Progress
|
|
104
|
-
- [ ] [Current work being done]
|
|
105
|
-
|
|
106
|
-
### Blocked
|
|
107
|
-
- [Issues preventing progress, if any, or "(none)"]
|
|
108
|
-
|
|
109
|
-
## Key Decisions
|
|
110
|
-
- **[Decision]**: [Brief rationale]
|
|
111
|
-
- [Or "(none)" if no significant decisions]
|
|
112
|
-
|
|
113
|
-
## Next Steps
|
|
114
|
-
1. [Immediate next action]
|
|
115
|
-
2. [Following actions in order]
|
|
116
|
-
|
|
117
|
-
## Critical Context
|
|
118
|
-
- [Data, examples, error messages, or references needed to continue]
|
|
119
|
-
- [Or "(none)" if not applicable]
|
|
120
|
-
|
|
121
|
-
IMPORTANT:
|
|
122
|
-
- Be concise but preserve ALL important details
|
|
123
|
-
- Include exact file paths, function names, error messages
|
|
124
|
-
- Preserve any code snippets or data the next LLM will need`;
|
|
125
|
-
|
|
126
|
-
const UPDATE_SUMMARIZATION_PROMPT = `You are performing a CONTEXT CHECKPOINT COMPACTION. The previous summary is provided in <previous-summary> tags. Update it with information from the NEW messages above.
|
|
127
|
-
|
|
128
|
-
RULES:
|
|
129
|
-
- PRESERVE all existing information from the previous summary
|
|
130
|
-
- ADD new progress, decisions, and context from the new messages
|
|
131
|
-
- UPDATE the Progress section: move items from "In Progress" to "Done" when completed
|
|
132
|
-
- UPDATE "Next Steps" based on what was accomplished
|
|
133
|
-
- PRESERVE exact file paths, function names, and error messages
|
|
134
|
-
- If something is no longer relevant, you may remove it
|
|
135
|
-
- Keep the same structured format
|
|
136
|
-
|
|
137
|
-
Use this EXACT format:
|
|
138
|
-
|
|
139
|
-
## Goal
|
|
140
|
-
[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
|
|
141
|
-
|
|
142
|
-
## Constraints & Preferences
|
|
143
|
-
- [Any constraints, preferences, or requirements mentioned by user]
|
|
144
|
-
- [Or "(none)" if none were mentioned]
|
|
145
|
-
|
|
146
|
-
## Progress
|
|
147
|
-
### Done
|
|
148
|
-
- [x] [Completed task with relevant file paths]
|
|
149
|
-
|
|
150
|
-
### In Progress
|
|
151
|
-
- [ ] [Current work being done]
|
|
152
|
-
|
|
153
|
-
### Blocked
|
|
154
|
-
- [Issues preventing progress, if any, or "(none)"]
|
|
155
|
-
|
|
156
|
-
## Key Decisions
|
|
157
|
-
- **[Decision]**: [Brief rationale]
|
|
158
|
-
- [Or "(none)" if no significant decisions]
|
|
159
|
-
|
|
160
|
-
## Next Steps
|
|
161
|
-
1. [Immediate next action]
|
|
162
|
-
2. [Following actions in order]
|
|
163
|
-
|
|
164
|
-
## Critical Context
|
|
165
|
-
- [Data, examples, error messages, or references needed to continue]
|
|
166
|
-
- [Or "(none)" if not applicable]`;
|
|
167
|
-
|
|
168
|
-
export interface CompactResult {
|
|
169
|
-
summary: string;
|
|
170
|
-
summaryMessage: AppMessage;
|
|
171
|
-
fileOps: FileOperations;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export interface CompactOptions {
|
|
175
|
-
agent: Agent;
|
|
176
|
-
currentProvider: string;
|
|
177
|
-
getApiKey: (provider: string) => string | undefined;
|
|
178
|
-
codexTransport: CodexTransport;
|
|
179
|
-
customInstructions?: string;
|
|
180
|
-
previousSummary?: string;
|
|
181
|
-
previousFileOps?: { readFiles: string[]; modifiedFiles: string[] };
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export async function handleCompact(opts: CompactOptions): Promise<CompactResult> {
|
|
185
|
-
const { agent, currentProvider, getApiKey, codexTransport, customInstructions, previousSummary, previousFileOps } = opts;
|
|
186
|
-
const model = agent.state.model;
|
|
187
|
-
|
|
188
|
-
if (!model) {
|
|
189
|
-
throw new Error('No model configured');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Build messages for summarization (filter to LLM-compatible roles)
|
|
193
|
-
const messages = agent.state.messages.filter(
|
|
194
|
-
(m) => m.role === 'user' || m.role === 'assistant' || m.role === 'toolResult'
|
|
195
|
-
) as Message[];
|
|
196
|
-
|
|
197
|
-
// Choose prompt based on whether we have a previous summary
|
|
198
|
-
let basePrompt: string;
|
|
199
|
-
if (previousSummary) {
|
|
200
|
-
basePrompt = `${UPDATE_SUMMARIZATION_PROMPT}\n\n<previous-summary>\n${previousSummary}\n</previous-summary>`;
|
|
201
|
-
} else {
|
|
202
|
-
basePrompt = SUMMARIZATION_PROMPT;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const prompt = customInstructions
|
|
206
|
-
? `${basePrompt}\n\nAdditional focus: ${customInstructions}`
|
|
207
|
-
: basePrompt;
|
|
208
|
-
|
|
209
|
-
const summarizationMessages: Message[] = [
|
|
210
|
-
...messages,
|
|
211
|
-
{
|
|
212
|
-
role: 'user',
|
|
213
|
-
content: [{ type: 'text', text: prompt }],
|
|
214
|
-
timestamp: Date.now(),
|
|
215
|
-
},
|
|
216
|
-
];
|
|
217
|
-
|
|
218
|
-
// Generate summary - Codex needs model overrides + instructions (like normal agent turns)
|
|
219
|
-
const isCodex = currentProvider === 'codex' || model.provider === 'codex';
|
|
220
|
-
|
|
221
|
-
const direct = isCodex ? await codexTransport.getDirectCallConfig(model) : null;
|
|
222
|
-
const callModel = direct?.model ?? model;
|
|
223
|
-
|
|
224
|
-
const response = await completeSimple(
|
|
225
|
-
callModel,
|
|
226
|
-
{ messages: summarizationMessages },
|
|
227
|
-
{
|
|
228
|
-
maxTokens: 8192,
|
|
229
|
-
apiKey: direct?.apiKey ?? getApiKey(callModel.provider),
|
|
230
|
-
fetch: direct?.fetch,
|
|
231
|
-
instructions: direct?.instructions,
|
|
232
|
-
},
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
if (response.errorMessage) {
|
|
236
|
-
throw new Error(response.errorMessage);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
let summary = response.content
|
|
240
|
-
.filter((c): c is TextContent => c.type === 'text')
|
|
241
|
-
.map((c) => c.text)
|
|
242
|
-
.join('\n');
|
|
243
|
-
|
|
244
|
-
if (!summary.trim()) {
|
|
245
|
-
const contentTypes = response.content.map(c => c.type).join(', ');
|
|
246
|
-
throw new Error(`No text in response (got: ${contentTypes || 'empty'})`);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// Extract file operations from current messages
|
|
250
|
-
const fileOps = extractAllFileOps(messages);
|
|
251
|
-
|
|
252
|
-
// Merge with previous file operations (union)
|
|
253
|
-
if (previousFileOps) {
|
|
254
|
-
for (const path of previousFileOps.readFiles) {
|
|
255
|
-
fileOps.read.add(path);
|
|
256
|
-
}
|
|
257
|
-
for (const path of previousFileOps.modifiedFiles) {
|
|
258
|
-
// Previous modified files go into written (they were modified at some point)
|
|
259
|
-
fileOps.written.add(path);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
summary += formatFileOperations(fileOps);
|
|
264
|
-
|
|
265
|
-
const summaryMessage: AppMessage = {
|
|
266
|
-
role: 'user',
|
|
267
|
-
content: [{ type: 'text', text: SUMMARY_PREFIX + summary + SUMMARY_SUFFIX }],
|
|
268
|
-
timestamp: Date.now(),
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
return { summary, summaryMessage, fileOps };
|
|
272
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Footer - Subtle dashed line with dir · branch on right.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createMemo } from "solid-js"
|
|
6
|
-
import { useTerminalDimensions } from "@opentui/solid"
|
|
7
|
-
import { useTheme } from "@yeshwanthyk/open-tui"
|
|
8
|
-
|
|
9
|
-
export interface FooterProps {
|
|
10
|
-
branch: string | null
|
|
11
|
-
bashMode?: boolean
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function Footer(props: FooterProps) {
|
|
15
|
-
const { theme } = useTheme()
|
|
16
|
-
const dims = useTerminalDimensions()
|
|
17
|
-
|
|
18
|
-
const dirName = createMemo(() => process.cwd().split("/").pop() || "")
|
|
19
|
-
|
|
20
|
-
const shortBranch = createMemo(() => {
|
|
21
|
-
const branch = props.branch
|
|
22
|
-
if (!branch) return null
|
|
23
|
-
const parts = branch.split(/[/-]/).filter(p => p.length > 0)
|
|
24
|
-
return parts.length > 2 ? parts.slice(-2).join("-") : branch
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const rightText = createMemo(() => {
|
|
28
|
-
const dir = dirName()
|
|
29
|
-
const branch = shortBranch()
|
|
30
|
-
return branch ? `${dir} · ${branch}` : dir
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const dashedLine = createMemo(() => {
|
|
34
|
-
const textLen = rightText().length + 2
|
|
35
|
-
const lineLen = Math.max(0, dims().width - textLen - 1)
|
|
36
|
-
return "┄".repeat(lineLen)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const lineColor = () => props.bashMode ? theme.warning : theme.border
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<box flexShrink={0} height={1} marginTop={0} paddingTop={0}>
|
|
43
|
-
<text>
|
|
44
|
-
<span style={{ fg: lineColor() }}>{dashedLine()}</span>
|
|
45
|
-
<span style={{ fg: theme.textMuted }}> {rightText()}</span>
|
|
46
|
-
</text>
|
|
47
|
-
</box>
|
|
48
|
-
)
|
|
49
|
-
}
|