@deepseek-harness-tui/dsh-tui 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/LICENSE +21 -0
- package/README.md +235 -0
- package/bin/dsh-tui.js +95 -0
- package/cordis.patch.yml +218 -0
- package/cordis.yml +185 -0
- package/lib/invariant.js +28 -0
- package/lib/types/activityPrefs.d.ts +29 -0
- package/lib/types/activityPrefs.d.ts.map +1 -0
- package/lib/types/activityPrefs.js +60 -0
- package/lib/types/bootstrap/state.d.ts +13 -0
- package/lib/types/bootstrap/state.d.ts.map +1 -0
- package/lib/types/bootstrap/state.js +12 -0
- package/lib/types/cc/cliHighlight.d.ts +20 -0
- package/lib/types/cc/cliHighlight.d.ts.map +1 -0
- package/lib/types/cc/cliHighlight.js +53 -0
- package/lib/types/cc/figures.d.ts +59 -0
- package/lib/types/cc/figures.d.ts.map +1 -0
- package/lib/types/cc/figures.js +69 -0
- package/lib/types/cc/format.d.ts +26 -0
- package/lib/types/cc/format.d.ts.map +1 -0
- package/lib/types/cc/format.js +55 -0
- package/lib/types/cc/hash.d.ts +25 -0
- package/lib/types/cc/hash.d.ts.map +1 -0
- package/lib/types/cc/hash.js +41 -0
- package/lib/types/cc/hyperlink.d.ts +21 -0
- package/lib/types/cc/hyperlink.d.ts.map +1 -0
- package/lib/types/cc/hyperlink.js +31 -0
- package/lib/types/cc/markdown.d.ts +43 -0
- package/lib/types/cc/markdown.d.ts.map +1 -0
- package/lib/types/cc/markdown.js +345 -0
- package/lib/types/cc/spinnerVerbs.d.ts +3 -0
- package/lib/types/cc/spinnerVerbs.d.ts.map +1 -0
- package/lib/types/cc/spinnerVerbs.js +190 -0
- package/lib/types/cc/terminal.d.ts +15 -0
- package/lib/types/cc/terminal.d.ts.map +1 -0
- package/lib/types/cc/terminal.js +84 -0
- package/lib/types/channel.d.ts +672 -0
- package/lib/types/channel.d.ts.map +1 -0
- package/lib/types/channel.js +2427 -0
- package/lib/types/childStderr.d.ts +63 -0
- package/lib/types/childStderr.d.ts.map +1 -0
- package/lib/types/childStderr.js +161 -0
- package/lib/types/commands.d.ts +55 -0
- package/lib/types/commands.d.ts.map +1 -0
- package/lib/types/commands.js +101 -0
- package/lib/types/components/ActivityLine.d.ts +29 -0
- package/lib/types/components/ActivityLine.d.ts.map +1 -0
- package/lib/types/components/ActivityLine.js +47 -0
- package/lib/types/components/ActivityPicker.d.ts +13 -0
- package/lib/types/components/ActivityPicker.d.ts.map +1 -0
- package/lib/types/components/ActivityPicker.js +24 -0
- package/lib/types/components/CommandSuggestions.d.ts +14 -0
- package/lib/types/components/CommandSuggestions.d.ts.map +1 -0
- package/lib/types/components/CommandSuggestions.js +33 -0
- package/lib/types/components/FileSuggestions.d.ts +12 -0
- package/lib/types/components/FileSuggestions.d.ts.map +1 -0
- package/lib/types/components/FileSuggestions.js +26 -0
- package/lib/types/components/GoalTodoPanel.d.ts +13 -0
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -0
- package/lib/types/components/GoalTodoPanel.js +57 -0
- package/lib/types/components/HelpMenu.d.ts +12 -0
- package/lib/types/components/HelpMenu.d.ts.map +1 -0
- package/lib/types/components/HelpMenu.js +12 -0
- package/lib/types/components/HistorySearchDialog.d.ts +16 -0
- package/lib/types/components/HistorySearchDialog.d.ts.map +1 -0
- package/lib/types/components/HistorySearchDialog.js +31 -0
- package/lib/types/components/InterruptedByUser.d.ts +7 -0
- package/lib/types/components/InterruptedByUser.d.ts.map +1 -0
- package/lib/types/components/InterruptedByUser.js +9 -0
- package/lib/types/components/LoadedContextPanel.d.ts +20 -0
- package/lib/types/components/LoadedContextPanel.d.ts.map +1 -0
- package/lib/types/components/LoadedContextPanel.js +30 -0
- package/lib/types/components/LogoV2.d.ts +23 -0
- package/lib/types/components/LogoV2.d.ts.map +1 -0
- package/lib/types/components/LogoV2.js +95 -0
- package/lib/types/components/Markdown.d.ts +24 -0
- package/lib/types/components/Markdown.d.ts.map +1 -0
- package/lib/types/components/Markdown.js +106 -0
- package/lib/types/components/MarkdownTable.d.ts +17 -0
- package/lib/types/components/MarkdownTable.d.ts.map +1 -0
- package/lib/types/components/MarkdownTable.js +272 -0
- package/lib/types/components/MessageList.d.ts +41 -0
- package/lib/types/components/MessageList.d.ts.map +1 -0
- package/lib/types/components/MessageList.js +303 -0
- package/lib/types/components/ModelPicker.d.ts +14 -0
- package/lib/types/components/ModelPicker.d.ts.map +1 -0
- package/lib/types/components/ModelPicker.js +15 -0
- package/lib/types/components/PresetPicker.d.ts +17 -0
- package/lib/types/components/PresetPicker.d.ts.map +1 -0
- package/lib/types/components/PresetPicker.js +25 -0
- package/lib/types/components/PromptInput.d.ts +67 -0
- package/lib/types/components/PromptInput.d.ts.map +1 -0
- package/lib/types/components/PromptInput.js +778 -0
- package/lib/types/components/ResumePicker.d.ts +15 -0
- package/lib/types/components/ResumePicker.d.ts.map +1 -0
- package/lib/types/components/ResumePicker.js +34 -0
- package/lib/types/components/RewindPicker.d.ts +14 -0
- package/lib/types/components/RewindPicker.d.ts.map +1 -0
- package/lib/types/components/RewindPicker.js +23 -0
- package/lib/types/components/SearchBox.d.ts +20 -0
- package/lib/types/components/SearchBox.d.ts.map +1 -0
- package/lib/types/components/SearchBox.js +33 -0
- package/lib/types/components/Select.d.ts +22 -0
- package/lib/types/components/Select.d.ts.map +1 -0
- package/lib/types/components/Select.js +19 -0
- package/lib/types/components/Spinner/GlimmerMessage.d.ts +19 -0
- package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -0
- package/lib/types/components/Spinner/GlimmerMessage.js +78 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +31 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts.map +1 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.js +162 -0
- package/lib/types/components/Spinner/SpinnerGlyph.d.ts +16 -0
- package/lib/types/components/Spinner/SpinnerGlyph.d.ts.map +1 -0
- package/lib/types/components/Spinner/SpinnerGlyph.js +36 -0
- package/lib/types/components/Spinner/spinnerMode.d.ts +6 -0
- package/lib/types/components/Spinner/spinnerMode.d.ts.map +1 -0
- package/lib/types/components/Spinner/spinnerMode.js +1 -0
- package/lib/types/components/Spinner/spinnerUtils.d.ts +41 -0
- package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -0
- package/lib/types/components/Spinner/spinnerUtils.js +104 -0
- package/lib/types/components/Spinner/useStalledAnimation.d.ts +16 -0
- package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -0
- package/lib/types/components/Spinner/useStalledAnimation.js +71 -0
- package/lib/types/components/StreamingMarkdown.d.ts +12 -0
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -0
- package/lib/types/components/StreamingMarkdown.js +39 -0
- package/lib/types/components/ThemePicker.d.ts +22 -0
- package/lib/types/components/ThemePicker.d.ts.map +1 -0
- package/lib/types/components/ThemePicker.js +51 -0
- package/lib/types/components/ThinkingToggle.d.ts +17 -0
- package/lib/types/components/ThinkingToggle.d.ts.map +1 -0
- package/lib/types/components/ThinkingToggle.js +30 -0
- package/lib/types/components/ToolUseLoader.d.ts +13 -0
- package/lib/types/components/ToolUseLoader.d.ts.map +1 -0
- package/lib/types/components/ToolUseLoader.js +17 -0
- package/lib/types/components/Whale.d.ts +22 -0
- package/lib/types/components/Whale.d.ts.map +1 -0
- package/lib/types/components/Whale.js +78 -0
- package/lib/types/components/WorkingSpinner.d.ts +26 -0
- package/lib/types/components/WorkingSpinner.d.ts.map +1 -0
- package/lib/types/components/WorkingSpinner.js +68 -0
- package/lib/types/components/activityFrames.d.ts +31 -0
- package/lib/types/components/activityFrames.d.ts.map +1 -0
- package/lib/types/components/activityFrames.js +83 -0
- package/lib/types/components/bigfont.d.ts +28 -0
- package/lib/types/components/bigfont.d.ts.map +1 -0
- package/lib/types/components/bigfont.js +91 -0
- package/lib/types/components/design-system/Byline.d.ts +14 -0
- package/lib/types/components/design-system/Byline.d.ts.map +1 -0
- package/lib/types/components/design-system/Byline.js +17 -0
- package/lib/types/components/design-system/Divider.d.ts +40 -0
- package/lib/types/components/design-system/Divider.d.ts.map +1 -0
- package/lib/types/components/design-system/Divider.js +24 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +19 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +1 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.js +14 -0
- package/lib/types/components/design-system/ListItem.d.ts +36 -0
- package/lib/types/components/design-system/ListItem.d.ts.map +1 -0
- package/lib/types/components/design-system/ListItem.js +48 -0
- package/lib/types/components/design-system/LoadingState.d.ts +19 -0
- package/lib/types/components/design-system/LoadingState.d.ts.map +1 -0
- package/lib/types/components/design-system/LoadingState.js +22 -0
- package/lib/types/components/design-system/Pane.d.ts +17 -0
- package/lib/types/components/design-system/Pane.d.ts.map +1 -0
- package/lib/types/components/design-system/Pane.js +15 -0
- package/lib/types/components/design-system/ProgressBar.d.ts +22 -0
- package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -0
- package/lib/types/components/design-system/ProgressBar.js +27 -0
- package/lib/types/components/design-system/StatusIcon.d.ts +15 -0
- package/lib/types/components/design-system/StatusIcon.d.ts.map +1 -0
- package/lib/types/components/design-system/StatusIcon.js +20 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts +11 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemeProvider.js +135 -0
- package/lib/types/components/design-system/ThemedBox.d.ts +37 -0
- package/lib/types/components/design-system/ThemedBox.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemedBox.js +26 -0
- package/lib/types/components/design-system/ThemedText.d.ts +56 -0
- package/lib/types/components/design-system/ThemedText.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemedText.js +45 -0
- package/lib/types/components/messages/AssistantTextMessage.d.ts +18 -0
- package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantTextMessage.js +15 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +23 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantThinkingMessage.js +23 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +23 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantToolUseMessage.js +220 -0
- package/lib/types/components/messages/MessageMetadata.d.ts +15 -0
- package/lib/types/components/messages/MessageMetadata.d.ts.map +1 -0
- package/lib/types/components/messages/MessageMetadata.js +20 -0
- package/lib/types/components/messages/UserPromptMessage.d.ts +19 -0
- package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -0
- package/lib/types/components/messages/UserPromptMessage.js +15 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +39 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -0
- package/lib/types/components/questions/AskUserQuestionPanel.js +228 -0
- package/lib/types/components/shimmer.d.ts +35 -0
- package/lib/types/components/shimmer.d.ts.map +1 -0
- package/lib/types/components/shimmer.js +43 -0
- package/lib/types/components/whaleFrames.d.ts +25 -0
- package/lib/types/components/whaleFrames.d.ts.map +1 -0
- package/lib/types/components/whaleFrames.js +419 -0
- package/lib/types/customTheme.d.ts +104 -0
- package/lib/types/customTheme.d.ts.map +1 -0
- package/lib/types/customTheme.js +268 -0
- package/lib/types/effortPrefs.d.ts +22 -0
- package/lib/types/effortPrefs.d.ts.map +1 -0
- package/lib/types/effortPrefs.js +45 -0
- package/lib/types/history.d.ts +24 -0
- package/lib/types/history.d.ts.map +1 -0
- package/lib/types/history.js +75 -0
- package/lib/types/hooks/useBlink.d.ts +11 -0
- package/lib/types/hooks/useBlink.d.ts.map +1 -0
- package/lib/types/hooks/useBlink.js +20 -0
- package/lib/types/i18n.d.ts +926 -0
- package/lib/types/i18n.d.ts.map +1 -0
- package/lib/types/i18n.js +356 -0
- package/lib/types/index.d.ts +70 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +31 -0
- package/lib/types/ink/Ansi.d.ts +11 -0
- package/lib/types/ink/Ansi.d.ts.map +1 -0
- package/lib/types/ink/Ansi.js +269 -0
- package/lib/types/ink/bidi.d.ts +18 -0
- package/lib/types/ink/bidi.d.ts.map +1 -0
- package/lib/types/ink/bidi.js +119 -0
- package/lib/types/ink/clearTerminal.d.ts +22 -0
- package/lib/types/ink/clearTerminal.d.ts.map +1 -0
- package/lib/types/ink/clearTerminal.js +72 -0
- package/lib/types/ink/colorize.d.ts +33 -0
- package/lib/types/ink/colorize.d.ts.map +1 -0
- package/lib/types/ink/colorize.js +213 -0
- package/lib/types/ink/components/AlternateScreen.d.ts +22 -0
- package/lib/types/ink/components/AlternateScreen.d.ts.map +1 -0
- package/lib/types/ink/components/AlternateScreen.js +74 -0
- package/lib/types/ink/components/App.d.ts +73 -0
- package/lib/types/ink/components/App.d.ts.map +1 -0
- package/lib/types/ink/components/App.js +597 -0
- package/lib/types/ink/components/AppContext.d.ts +15 -0
- package/lib/types/ink/components/AppContext.d.ts.map +1 -0
- package/lib/types/ink/components/AppContext.js +11 -0
- package/lib/types/ink/components/Box.d.ts +49 -0
- package/lib/types/ink/components/Box.d.ts.map +1 -0
- package/lib/types/ink/components/Box.js +153 -0
- package/lib/types/ink/components/Button.d.ts +37 -0
- package/lib/types/ink/components/Button.d.ts.map +1 -0
- package/lib/types/ink/components/Button.js +166 -0
- package/lib/types/ink/components/ClockContext.d.ts +10 -0
- package/lib/types/ink/components/ClockContext.d.ts.map +1 -0
- package/lib/types/ink/components/ClockContext.js +108 -0
- package/lib/types/ink/components/CursorDeclarationContext.d.ts +30 -0
- package/lib/types/ink/components/CursorDeclarationContext.d.ts.map +1 -0
- package/lib/types/ink/components/CursorDeclarationContext.js +6 -0
- package/lib/types/ink/components/ErrorOverview.d.ts +7 -0
- package/lib/types/ink/components/ErrorOverview.d.ts.map +1 -0
- package/lib/types/ink/components/ErrorOverview.js +49 -0
- package/lib/types/ink/components/Link.d.ts +8 -0
- package/lib/types/ink/components/Link.d.ts.map +1 -0
- package/lib/types/ink/components/Link.js +33 -0
- package/lib/types/ink/components/Newline.d.ts +13 -0
- package/lib/types/ink/components/Newline.d.ts.map +1 -0
- package/lib/types/ink/components/Newline.js +29 -0
- package/lib/types/ink/components/NoSelect.d.ts +20 -0
- package/lib/types/ink/components/NoSelect.d.ts.map +1 -0
- package/lib/types/ink/components/NoSelect.js +56 -0
- package/lib/types/ink/components/RawAnsi.d.ts +17 -0
- package/lib/types/ink/components/RawAnsi.d.ts.map +1 -0
- package/lib/types/ink/components/RawAnsi.js +45 -0
- package/lib/types/ink/components/ScrollBox.d.ts +78 -0
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -0
- package/lib/types/ink/components/ScrollBox.js +174 -0
- package/lib/types/ink/components/Spacer.d.ts +6 -0
- package/lib/types/ink/components/Spacer.d.ts.map +1 -0
- package/lib/types/ink/components/Spacer.js +19 -0
- package/lib/types/ink/components/StdinContext.d.ts +32 -0
- package/lib/types/ink/components/StdinContext.d.ts.map +1 -0
- package/lib/types/ink/components/StdinContext.js +16 -0
- package/lib/types/ink/components/TerminalFocusContext.d.ts +11 -0
- package/lib/types/ink/components/TerminalFocusContext.d.ts.map +1 -0
- package/lib/types/ink/components/TerminalFocusContext.js +45 -0
- package/lib/types/ink/components/TerminalSizeContext.d.ts +6 -0
- package/lib/types/ink/components/TerminalSizeContext.d.ts.map +1 -0
- package/lib/types/ink/components/TerminalSizeContext.js +3 -0
- package/lib/types/ink/components/Text.d.ts +56 -0
- package/lib/types/ink/components/Text.d.ts.map +1 -0
- package/lib/types/ink/components/Text.js +194 -0
- package/lib/types/ink/constants.d.ts +3 -0
- package/lib/types/ink/constants.d.ts.map +1 -0
- package/lib/types/ink/constants.js +2 -0
- package/lib/types/ink/cursor.d.ts +11 -0
- package/lib/types/ink/cursor.d.ts.map +1 -0
- package/lib/types/ink/cursor.js +1 -0
- package/lib/types/ink/devtools.d.ts +7 -0
- package/lib/types/ink/devtools.d.ts.map +1 -0
- package/lib/types/ink/devtools.js +1 -0
- package/lib/types/ink/dom.d.ts +178 -0
- package/lib/types/ink/dom.d.ts.map +1 -0
- package/lib/types/ink/dom.js +424 -0
- package/lib/types/ink/events/click-event.d.ts +32 -0
- package/lib/types/ink/events/click-event.d.ts.map +1 -0
- package/lib/types/ink/events/click-event.js +36 -0
- package/lib/types/ink/events/dispatcher.d.ts +63 -0
- package/lib/types/ink/events/dispatcher.d.ts.map +1 -0
- package/lib/types/ink/events/dispatcher.js +194 -0
- package/lib/types/ink/events/emitter.d.ts +20 -0
- package/lib/types/ink/events/emitter.d.ts.map +1 -0
- package/lib/types/ink/events/emitter.js +43 -0
- package/lib/types/ink/events/event-handlers.d.ts +47 -0
- package/lib/types/ink/events/event-handlers.d.ts.map +1 -0
- package/lib/types/ink/events/event-handlers.js +30 -0
- package/lib/types/ink/events/event.d.ts +19 -0
- package/lib/types/ink/events/event.d.ts.map +1 -0
- package/lib/types/ink/events/event.js +22 -0
- package/lib/types/ink/events/focus-event.d.ts +19 -0
- package/lib/types/ink/events/focus-event.d.ts.map +1 -0
- package/lib/types/ink/events/focus-event.js +21 -0
- package/lib/types/ink/events/input-event.d.ts +53 -0
- package/lib/types/ink/events/input-event.d.ts.map +1 -0
- package/lib/types/ink/events/input-event.js +180 -0
- package/lib/types/ink/events/keyboard-event.d.ts +40 -0
- package/lib/types/ink/events/keyboard-event.d.ts.map +1 -0
- package/lib/types/ink/events/keyboard-event.js +65 -0
- package/lib/types/ink/events/paste-event.d.ts +11 -0
- package/lib/types/ink/events/paste-event.d.ts.map +1 -0
- package/lib/types/ink/events/paste-event.js +13 -0
- package/lib/types/ink/events/resize-event.d.ts +13 -0
- package/lib/types/ink/events/resize-event.d.ts.map +1 -0
- package/lib/types/ink/events/resize-event.js +16 -0
- package/lib/types/ink/events/terminal-event.d.ts +112 -0
- package/lib/types/ink/events/terminal-event.d.ts.map +1 -0
- package/lib/types/ink/events/terminal-event.js +131 -0
- package/lib/types/ink/events/terminal-focus-event.d.ts +21 -0
- package/lib/types/ink/events/terminal-focus-event.d.ts.map +1 -0
- package/lib/types/ink/events/terminal-focus-event.js +18 -0
- package/lib/types/ink/focus.d.ts +74 -0
- package/lib/types/ink/focus.d.ts.map +1 -0
- package/lib/types/ink/focus.js +188 -0
- package/lib/types/ink/frame.d.ts +119 -0
- package/lib/types/ink/frame.d.ts.map +1 -0
- package/lib/types/ink/frame.js +43 -0
- package/lib/types/ink/get-max-width.d.ts +20 -0
- package/lib/types/ink/get-max-width.d.ts.map +1 -0
- package/lib/types/ink/get-max-width.js +25 -0
- package/lib/types/ink/hit-test.d.ts +47 -0
- package/lib/types/ink/hit-test.d.ts.map +1 -0
- package/lib/types/ink/hit-test.js +126 -0
- package/lib/types/ink/hooks/use-animation-frame.d.ts +27 -0
- package/lib/types/ink/hooks/use-animation-frame.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-animation-frame.js +48 -0
- package/lib/types/ink/hooks/use-app.d.ts +8 -0
- package/lib/types/ink/hooks/use-app.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-app.js +8 -0
- package/lib/types/ink/hooks/use-copy-on-select.d.ts +22 -0
- package/lib/types/ink/hooks/use-copy-on-select.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-copy-on-select.js +40 -0
- package/lib/types/ink/hooks/use-declared-cursor.d.ts +31 -0
- package/lib/types/ink/hooks/use-declared-cursor.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-declared-cursor.js +65 -0
- package/lib/types/ink/hooks/use-input.d.ts +41 -0
- package/lib/types/ink/hooks/use-input.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-input.js +73 -0
- package/lib/types/ink/hooks/use-interval.d.ts +23 -0
- package/lib/types/ink/hooks/use-interval.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-interval.js +58 -0
- package/lib/types/ink/hooks/use-search-highlight.d.ts +34 -0
- package/lib/types/ink/hooks/use-search-highlight.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-search-highlight.js +35 -0
- package/lib/types/ink/hooks/use-selection.d.ts +44 -0
- package/lib/types/ink/hooks/use-selection.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-selection.js +64 -0
- package/lib/types/ink/hooks/use-stdin.d.ts +8 -0
- package/lib/types/ink/hooks/use-stdin.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-stdin.js +8 -0
- package/lib/types/ink/hooks/use-tab-status.d.ts +18 -0
- package/lib/types/ink/hooks/use-tab-status.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-tab-status.js +58 -0
- package/lib/types/ink/hooks/use-terminal-focus.d.ts +11 -0
- package/lib/types/ink/hooks/use-terminal-focus.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-focus.js +15 -0
- package/lib/types/ink/hooks/use-terminal-size.d.ts +6 -0
- package/lib/types/ink/hooks/use-terminal-size.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-size.js +12 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts +14 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-title.js +30 -0
- package/lib/types/ink/hooks/use-terminal-viewport.d.ts +32 -0
- package/lib/types/ink/hooks/use-terminal-viewport.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-viewport.js +79 -0
- package/lib/types/ink/ink.d.ts +370 -0
- package/lib/types/ink/ink.d.ts.map +1 -0
- package/lib/types/ink/ink.js +1665 -0
- package/lib/types/ink/instances.d.ts +10 -0
- package/lib/types/ink/instances.d.ts.map +1 -0
- package/lib/types/ink/instances.js +13 -0
- package/lib/types/ink/layout/engine.d.ts +7 -0
- package/lib/types/ink/layout/engine.d.ts.map +1 -0
- package/lib/types/ink/layout/engine.js +8 -0
- package/lib/types/ink/layout/geometry.d.ts +86 -0
- package/lib/types/ink/layout/geometry.d.ts.map +1 -0
- package/lib/types/ink/layout/geometry.js +95 -0
- package/lib/types/ink/layout/node.d.ts +151 -0
- package/lib/types/ink/layout/node.d.ts.map +1 -0
- package/lib/types/ink/layout/node.js +72 -0
- package/lib/types/ink/layout/yoga.d.ts +69 -0
- package/lib/types/ink/layout/yoga.d.ts.map +1 -0
- package/lib/types/ink/layout/yoga.js +249 -0
- package/lib/types/ink/line-width-cache.d.ts +9 -0
- package/lib/types/ink/line-width-cache.d.ts.map +1 -0
- package/lib/types/ink/line-width-cache.js +45 -0
- package/lib/types/ink/log-update.d.ts +57 -0
- package/lib/types/ink/log-update.d.ts.map +1 -0
- package/lib/types/ink/log-update.js +710 -0
- package/lib/types/ink/measure-element.d.ts +19 -0
- package/lib/types/ink/measure-element.d.ts.map +1 -0
- package/lib/types/ink/measure-element.js +10 -0
- package/lib/types/ink/measure-text.d.ts +13 -0
- package/lib/types/ink/measure-text.d.ts.map +1 -0
- package/lib/types/ink/measure-text.js +38 -0
- package/lib/types/ink/node-cache.d.ts +33 -0
- package/lib/types/ink/node-cache.d.ts.map +1 -0
- package/lib/types/ink/node-cache.js +42 -0
- package/lib/types/ink/optimizer.d.ts +18 -0
- package/lib/types/ink/optimizer.d.ts.map +1 -0
- package/lib/types/ink/optimizer.js +83 -0
- package/lib/types/ink/output.d.ts +200 -0
- package/lib/types/ink/output.d.ts.map +1 -0
- package/lib/types/ink/output.js +663 -0
- package/lib/types/ink/parse-keypress.d.ts +132 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -0
- package/lib/types/ink/parse-keypress.js +707 -0
- package/lib/types/ink/reconciler.d.ts +43 -0
- package/lib/types/ink/reconciler.d.ts.map +1 -0
- package/lib/types/ink/reconciler.js +413 -0
- package/lib/types/ink/render-border.d.ts +36 -0
- package/lib/types/ink/render-border.d.ts.map +1 -0
- package/lib/types/ink/render-border.js +143 -0
- package/lib/types/ink/render-node-to-output.d.ts +93 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -0
- package/lib/types/ink/render-node-to-output.js +1290 -0
- package/lib/types/ink/render-to-screen.d.ts +65 -0
- package/lib/types/ink/render-to-screen.d.ts.map +1 -0
- package/lib/types/ink/render-to-screen.js +189 -0
- package/lib/types/ink/renderer.d.ts +24 -0
- package/lib/types/ink/renderer.d.ts.map +1 -0
- package/lib/types/ink/renderer.js +136 -0
- package/lib/types/ink/root.d.ts +91 -0
- package/lib/types/ink/root.d.ts.map +1 -0
- package/lib/types/ink/root.js +93 -0
- package/lib/types/ink/screen.d.ts +443 -0
- package/lib/types/ink/screen.d.ts.map +1 -0
- package/lib/types/ink/screen.js +1295 -0
- package/lib/types/ink/searchHighlight.d.ts +25 -0
- package/lib/types/ink/searchHighlight.d.ts.map +1 -0
- package/lib/types/ink/searchHighlight.js +82 -0
- package/lib/types/ink/selection.d.ts +323 -0
- package/lib/types/ink/selection.d.ts.map +1 -0
- package/lib/types/ink/selection.js +881 -0
- package/lib/types/ink/squash-text-nodes.d.ts +30 -0
- package/lib/types/ink/squash-text-nodes.d.ts.map +1 -0
- package/lib/types/ink/squash-text-nodes.js +63 -0
- package/lib/types/ink/stringWidth.d.ts +11 -0
- package/lib/types/ink/stringWidth.d.ts.map +1 -0
- package/lib/types/ink/stringWidth.js +209 -0
- package/lib/types/ink/styles.d.ts +324 -0
- package/lib/types/ink/styles.d.ts.map +1 -0
- package/lib/types/ink/styles.js +307 -0
- package/lib/types/ink/supports-hyperlinks.d.ts +20 -0
- package/lib/types/ink/supports-hyperlinks.d.ts.map +1 -0
- package/lib/types/ink/supports-hyperlinks.js +44 -0
- package/lib/types/ink/tabstops.d.ts +9 -0
- package/lib/types/ink/tabstops.d.ts.map +1 -0
- package/lib/types/ink/tabstops.js +46 -0
- package/lib/types/ink/terminal-focus-state.d.ts +35 -0
- package/lib/types/ink/terminal-focus-state.d.ts.map +1 -0
- package/lib/types/ink/terminal-focus-state.js +57 -0
- package/lib/types/ink/terminal-querier.d.ts +161 -0
- package/lib/types/ink/terminal-querier.d.ts.map +1 -0
- package/lib/types/ink/terminal-querier.js +204 -0
- package/lib/types/ink/terminal.d.ts +80 -0
- package/lib/types/ink/terminal.d.ts.map +1 -0
- package/lib/types/ink/terminal.js +268 -0
- package/lib/types/ink/termio/ansi.d.ts +75 -0
- package/lib/types/ink/termio/ansi.d.ts.map +1 -0
- package/lib/types/ink/termio/ansi.js +79 -0
- package/lib/types/ink/termio/csi.d.ts +253 -0
- package/lib/types/ink/termio/csi.d.ts.map +1 -0
- package/lib/types/ink/termio/csi.js +347 -0
- package/lib/types/ink/termio/dec.d.ts +61 -0
- package/lib/types/ink/termio/dec.d.ts.map +1 -0
- package/lib/types/ink/termio/dec.js +76 -0
- package/lib/types/ink/termio/esc.d.ts +15 -0
- package/lib/types/ink/termio/esc.d.ts.map +1 -0
- package/lib/types/ink/termio/esc.js +57 -0
- package/lib/types/ink/termio/osc.d.ts +208 -0
- package/lib/types/ink/termio/osc.d.ts.map +1 -0
- package/lib/types/ink/termio/osc.js +466 -0
- package/lib/types/ink/termio/parser.d.ts +46 -0
- package/lib/types/ink/termio/parser.d.ts.map +1 -0
- package/lib/types/ink/termio/parser.js +366 -0
- package/lib/types/ink/termio/sgr.d.ts +17 -0
- package/lib/types/ink/termio/sgr.d.ts.map +1 -0
- package/lib/types/ink/termio/sgr.js +300 -0
- package/lib/types/ink/termio/tokenize.d.ts +50 -0
- package/lib/types/ink/termio/tokenize.d.ts.map +1 -0
- package/lib/types/ink/termio/tokenize.js +266 -0
- package/lib/types/ink/termio/types.d.ts +211 -0
- package/lib/types/ink/termio/types.d.ts.map +1 -0
- package/lib/types/ink/termio/types.js +68 -0
- package/lib/types/ink/termio.d.ts +25 -0
- package/lib/types/ink/termio.d.ts.map +1 -0
- package/lib/types/ink/termio.js +24 -0
- package/lib/types/ink/truncateToWidth.d.ts +7 -0
- package/lib/types/ink/truncateToWidth.d.ts.map +1 -0
- package/lib/types/ink/truncateToWidth.js +18 -0
- package/lib/types/ink/useTerminalNotification.d.ts +45 -0
- package/lib/types/ink/useTerminalNotification.d.ts.map +1 -0
- package/lib/types/ink/useTerminalNotification.js +70 -0
- package/lib/types/ink/warn.d.ts +7 -0
- package/lib/types/ink/warn.d.ts.map +1 -0
- package/lib/types/ink/warn.js +15 -0
- package/lib/types/ink/widest-line.d.ts +7 -0
- package/lib/types/ink/widest-line.d.ts.map +1 -0
- package/lib/types/ink/widest-line.js +19 -0
- package/lib/types/ink/wrap-text.d.ts +10 -0
- package/lib/types/ink/wrap-text.d.ts.map +1 -0
- package/lib/types/ink/wrap-text.js +61 -0
- package/lib/types/ink/wrapAnsi.d.ts +18 -0
- package/lib/types/ink/wrapAnsi.d.ts.map +1 -0
- package/lib/types/ink/wrapAnsi.js +16 -0
- package/lib/types/invariant.d.ts +20 -0
- package/lib/types/invariant.d.ts.map +1 -0
- package/lib/types/invariant.js +26 -0
- package/lib/types/modelPrefs.d.ts +37 -0
- package/lib/types/modelPrefs.d.ts.map +1 -0
- package/lib/types/modelPrefs.js +66 -0
- package/lib/types/modelRoute.d.ts +79 -0
- package/lib/types/modelRoute.d.ts.map +1 -0
- package/lib/types/modelRoute.js +96 -0
- package/lib/types/native-ts/yoga-layout/enums.d.ts +183 -0
- package/lib/types/native-ts/yoga-layout/enums.d.ts.map +1 -0
- package/lib/types/native-ts/yoga-layout/enums.js +150 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts +788 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -0
- package/lib/types/native-ts/yoga-layout/index.js +2571 -0
- package/lib/types/packaged-skills.d.ts +10 -0
- package/lib/types/packaged-skills.d.ts.map +1 -0
- package/lib/types/packaged-skills.js +63 -0
- package/lib/types/plugin.d.ts +33 -0
- package/lib/types/plugin.d.ts.map +1 -0
- package/lib/types/plugin.js +454 -0
- package/lib/types/presetPrefs.d.ts +29 -0
- package/lib/types/presetPrefs.d.ts.map +1 -0
- package/lib/types/presetPrefs.js +61 -0
- package/lib/types/presets.d.ts +110 -0
- package/lib/types/presets.d.ts.map +1 -0
- package/lib/types/presets.js +114 -0
- package/lib/types/questions.d.ts +97 -0
- package/lib/types/questions.d.ts.map +1 -0
- package/lib/types/questions.js +201 -0
- package/lib/types/screens/Chat.d.ts +23 -0
- package/lib/types/screens/Chat.d.ts.map +1 -0
- package/lib/types/screens/Chat.js +1263 -0
- package/lib/types/screens/StatusLine.d.ts +16 -0
- package/lib/types/screens/StatusLine.d.ts.map +1 -0
- package/lib/types/screens/StatusLine.js +105 -0
- package/lib/types/screens/StatusMetrics.d.ts +87 -0
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -0
- package/lib/types/screens/StatusMetrics.js +252 -0
- package/lib/types/sessionHistory.d.ts +32 -0
- package/lib/types/sessionHistory.d.ts.map +1 -0
- package/lib/types/sessionHistory.js +87 -0
- package/lib/types/theme.d.ts +115 -0
- package/lib/types/theme.d.ts.map +1 -0
- package/lib/types/theme.js +300 -0
- package/lib/types/themePrefs.d.ts +28 -0
- package/lib/types/themePrefs.d.ts.map +1 -0
- package/lib/types/themePrefs.js +59 -0
- package/lib/types/ui.d.ts +28 -0
- package/lib/types/ui.d.ts.map +1 -0
- package/lib/types/ui.js +25 -0
- package/lib/types/update.d.ts +76 -0
- package/lib/types/update.d.ts.map +1 -0
- package/lib/types/update.js +203 -0
- package/lib/types/utils/clipboard.d.ts +43 -0
- package/lib/types/utils/clipboard.d.ts.map +1 -0
- package/lib/types/utils/clipboard.js +82 -0
- package/lib/types/utils/debug.d.ts +8 -0
- package/lib/types/utils/debug.d.ts.map +1 -0
- package/lib/types/utils/debug.js +12 -0
- package/lib/types/utils/earlyInput.d.ts +7 -0
- package/lib/types/utils/earlyInput.d.ts.map +1 -0
- package/lib/types/utils/earlyInput.js +6 -0
- package/lib/types/utils/env.d.ts +10 -0
- package/lib/types/utils/env.d.ts.map +1 -0
- package/lib/types/utils/env.js +9 -0
- package/lib/types/utils/envUtils.d.ts +8 -0
- package/lib/types/utils/envUtils.d.ts.map +1 -0
- package/lib/types/utils/envUtils.js +13 -0
- package/lib/types/utils/execFileNoThrow.d.ts +34 -0
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -0
- package/lib/types/utils/execFileNoThrow.js +31 -0
- package/lib/types/utils/fullscreen.d.ts +8 -0
- package/lib/types/utils/fullscreen.d.ts.map +1 -0
- package/lib/types/utils/fullscreen.js +10 -0
- package/lib/types/utils/intl.d.ts +7 -0
- package/lib/types/utils/intl.d.ts.map +1 -0
- package/lib/types/utils/intl.js +9 -0
- package/lib/types/utils/loaded-context.d.ts +20 -0
- package/lib/types/utils/loaded-context.d.ts.map +1 -0
- package/lib/types/utils/loaded-context.js +36 -0
- package/lib/types/utils/log.d.ts +7 -0
- package/lib/types/utils/log.d.ts.map +1 -0
- package/lib/types/utils/log.js +9 -0
- package/lib/types/utils/mentions.d.ts +30 -0
- package/lib/types/utils/mentions.d.ts.map +1 -0
- package/lib/types/utils/mentions.js +72 -0
- package/lib/types/utils/narration.d.ts +11 -0
- package/lib/types/utils/narration.d.ts.map +1 -0
- package/lib/types/utils/narration.js +16 -0
- package/lib/types/utils/semver.d.ts +9 -0
- package/lib/types/utils/semver.d.ts.map +1 -0
- package/lib/types/utils/semver.js +24 -0
- package/lib/types/utils/sliceAnsi.d.ts +12 -0
- package/lib/types/utils/sliceAnsi.d.ts.map +1 -0
- package/lib/types/utils/sliceAnsi.js +79 -0
- package/lib/types/working-activity.d.ts +19 -0
- package/lib/types/working-activity.d.ts.map +1 -0
- package/lib/types/working-activity.js +18 -0
- package/package.json +141 -0
- package/skills/audit/SKILL.md +24 -0
- package/skills/bug/SKILL.md +27 -0
- package/skills/pr-comments/SKILL.md +20 -0
- package/skills/practice/SKILL.md +22 -0
- package/skills/release-notes/SKILL.md +25 -0
- package/skills/review/SKILL.md +25 -0
- package/skills/vuln-check/SKILL.md +25 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the djb2 hash of a string: a fast non-cryptographic signed 32-bit hash.
|
|
3
|
+
* Deterministic across runtimes, unlike runtime-specific hashes.
|
|
4
|
+
* @param str - The string to hash.
|
|
5
|
+
* @returns The signed 32-bit hash value.
|
|
6
|
+
*/
|
|
7
|
+
export declare function djb2Hash(str: string): number;
|
|
8
|
+
/**
|
|
9
|
+
* Hash arbitrary content for change detection. Bun.hash is ~100x faster than
|
|
10
|
+
* sha256 and collision-resistant enough for diff detection (not crypto-safe).
|
|
11
|
+
* The original used `require('crypto')`; dsh-tui runs ESM so node:crypto is
|
|
12
|
+
* imported statically and Bun.hash is skipped entirely.
|
|
13
|
+
* @param content - The content to hash.
|
|
14
|
+
* @returns The lowercase hex SHA-256 digest of `content`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function hashContent(content: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Hash two strings without allocating a concatenated temp string. Seed-chains
|
|
19
|
+
* naturally disambiguate ("ts","code") vs ("tsc","ode") via the NUL separator.
|
|
20
|
+
* @param a - The first string.
|
|
21
|
+
* @param b - The second string.
|
|
22
|
+
* @returns The lowercase hex SHA-256 digest of the NUL-separated pair.
|
|
23
|
+
*/
|
|
24
|
+
export declare function hashPair(a: string, b: string): string;
|
|
25
|
+
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/cc/hash.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM5C;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* djb2 string hash — fast non-cryptographic hash returning a signed 32-bit int.
|
|
3
|
+
* Deterministic across runtimes (unlike Bun.hash which uses wyhash). Use as a
|
|
4
|
+
* fallback when Bun.hash isn't available, or when you need on-disk-stable
|
|
5
|
+
* output (e.g. cache directory names that must survive runtime upgrades).
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from 'node:crypto';
|
|
8
|
+
/**
|
|
9
|
+
* Compute the djb2 hash of a string: a fast non-cryptographic signed 32-bit hash.
|
|
10
|
+
* Deterministic across runtimes, unlike runtime-specific hashes.
|
|
11
|
+
* @param str - The string to hash.
|
|
12
|
+
* @returns The signed 32-bit hash value.
|
|
13
|
+
*/
|
|
14
|
+
export function djb2Hash(str) {
|
|
15
|
+
let hash = 0;
|
|
16
|
+
for (let i = 0; i < str.length; i++) {
|
|
17
|
+
hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;
|
|
18
|
+
}
|
|
19
|
+
return hash;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Hash arbitrary content for change detection. Bun.hash is ~100x faster than
|
|
23
|
+
* sha256 and collision-resistant enough for diff detection (not crypto-safe).
|
|
24
|
+
* The original used `require('crypto')`; dsh-tui runs ESM so node:crypto is
|
|
25
|
+
* imported statically and Bun.hash is skipped entirely.
|
|
26
|
+
* @param content - The content to hash.
|
|
27
|
+
* @returns The lowercase hex SHA-256 digest of `content`.
|
|
28
|
+
*/
|
|
29
|
+
export function hashContent(content) {
|
|
30
|
+
return createHash('sha256').update(content).digest('hex');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Hash two strings without allocating a concatenated temp string. Seed-chains
|
|
34
|
+
* naturally disambiguate ("ts","code") vs ("tsc","ode") via the NUL separator.
|
|
35
|
+
* @param a - The first string.
|
|
36
|
+
* @param b - The second string.
|
|
37
|
+
* @returns The lowercase hex SHA-256 digest of the NUL-separated pair.
|
|
38
|
+
*/
|
|
39
|
+
export function hashPair(a, b) {
|
|
40
|
+
return createHash('sha256').update(a).update('\0').update(b).digest('hex');
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** OSC 8 hyperlink start sequence: `ESC ] 8 ; ;`, followed by the URL. */
|
|
2
|
+
export declare const OSC8_START = "\u001B]8;;";
|
|
3
|
+
/** OSC 8 hyperlink terminator: BEL (`\x07`), more widely supported than the ST variant. */
|
|
4
|
+
export declare const OSC8_END = "\u0007";
|
|
5
|
+
type HyperlinkOptions = {
|
|
6
|
+
supportsHyperlinks?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Create a clickable hyperlink using OSC 8 escape sequences.
|
|
10
|
+
* Falls back to plain text if the terminal doesn't support hyperlinks.
|
|
11
|
+
*
|
|
12
|
+
* @param url - The URL to link to
|
|
13
|
+
* @param content - Optional content to display as the link text (only when hyperlinks are supported).
|
|
14
|
+
* If provided and hyperlinks are supported, this text is shown as a clickable link.
|
|
15
|
+
* If hyperlinks are not supported, content is ignored and only the URL is shown.
|
|
16
|
+
* @param options - Optional overrides for testing (supportsHyperlinks)
|
|
17
|
+
* @returns The OSC 8-wrapped blue link text, or the plain URL when the terminal lacks hyperlink support.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createHyperlink(url: string, content?: string, options?: HyperlinkOptions): string;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=hyperlink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlink.d.ts","sourceRoot":"","sources":["../../../src/cc/hyperlink.ts"],"names":[],"mappings":"AAMA,0EAA0E;AAC1E,eAAO,MAAM,UAAU,eAAa,CAAA;AACpC,2FAA2F;AAC3F,eAAO,MAAM,QAAQ,WAAS,CAAA;AAE9B,KAAK,gBAAgB,GAAG;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,CAWR"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { supportsHyperlinks } from '../ink/supports-hyperlinks.js';
|
|
3
|
+
// OSC 8 hyperlink escape sequences
|
|
4
|
+
// Format: \e]8;;URL\e\\TEXT\e]8;;\e\\
|
|
5
|
+
// Using \x07 (BEL) as terminator which is more widely supported
|
|
6
|
+
/** OSC 8 hyperlink start sequence: `ESC ] 8 ; ;`, followed by the URL. */
|
|
7
|
+
export const OSC8_START = '\x1b]8;;';
|
|
8
|
+
/** OSC 8 hyperlink terminator: BEL (`\x07`), more widely supported than the ST variant. */
|
|
9
|
+
export const OSC8_END = '\x07';
|
|
10
|
+
/**
|
|
11
|
+
* Create a clickable hyperlink using OSC 8 escape sequences.
|
|
12
|
+
* Falls back to plain text if the terminal doesn't support hyperlinks.
|
|
13
|
+
*
|
|
14
|
+
* @param url - The URL to link to
|
|
15
|
+
* @param content - Optional content to display as the link text (only when hyperlinks are supported).
|
|
16
|
+
* If provided and hyperlinks are supported, this text is shown as a clickable link.
|
|
17
|
+
* If hyperlinks are not supported, content is ignored and only the URL is shown.
|
|
18
|
+
* @param options - Optional overrides for testing (supportsHyperlinks)
|
|
19
|
+
* @returns The OSC 8-wrapped blue link text, or the plain URL when the terminal lacks hyperlink support.
|
|
20
|
+
*/
|
|
21
|
+
export function createHyperlink(url, content, options) {
|
|
22
|
+
const hasSupport = options?.supportsHyperlinks ?? supportsHyperlinks();
|
|
23
|
+
if (!hasSupport) {
|
|
24
|
+
return url;
|
|
25
|
+
}
|
|
26
|
+
// Apply basic ANSI blue color - wrap-ansi preserves this across line breaks
|
|
27
|
+
// RGB colors (like theme colors) are NOT preserved by wrap-ansi with OSC 8
|
|
28
|
+
const displayText = content ?? url;
|
|
29
|
+
const coloredText = chalk.blue(displayText);
|
|
30
|
+
return `${OSC8_START}${url}${OSC8_END}${coloredText}${OSC8_START}${OSC8_END}`;
|
|
31
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Token } from 'marked';
|
|
2
|
+
import type { CliHighlight } from './cliHighlight.js';
|
|
3
|
+
/**
|
|
4
|
+
* Strip tool-analysis XML tags (`<commit_analysis>`, `<context>`, `<function_analysis>`,
|
|
5
|
+
* `<pr_analysis>`) and their contents, then trim the result.
|
|
6
|
+
* @param content - Markdown text that may contain the wrapped tool-analysis tag blocks.
|
|
7
|
+
* @returns The content with those blocks removed and surrounding whitespace trimmed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stripPromptXMLTags(content: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Configure the shared `marked` instance once: disable strikethrough parsing so
|
|
12
|
+
* `~100` renders literally instead of as deleted text.
|
|
13
|
+
*/
|
|
14
|
+
export declare function configureMarked(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Render markdown content to ANSI-styled text via the shared `marked` instance.
|
|
17
|
+
* @param content - Markdown source to render.
|
|
18
|
+
* @param highlight - Optional cli-highlight surface for code blocks; null disables syntax highlighting.
|
|
19
|
+
* @returns The rendered ANSI string, trimmed.
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyMarkdown(content: string, highlight?: CliHighlight | null): string;
|
|
22
|
+
/**
|
|
23
|
+
* Render one marked token to ANSI text, recursing into child tokens.
|
|
24
|
+
* @param token - The marked token to render.
|
|
25
|
+
* @param listDepth - Nesting depth of the enclosing list; drives indentation and numbering style.
|
|
26
|
+
* @param orderedListNumber - Current ordinal of the enclosing ordered list item, or null for unordered lists.
|
|
27
|
+
* @param parent - The parent token; linkification is skipped inside links and prefixes are added inside list items.
|
|
28
|
+
* @param highlight - Optional cli-highlight surface for code blocks; null disables syntax highlighting.
|
|
29
|
+
* @returns The rendered ANSI string for the token, or '' for unrendered token types.
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatToken(token: Token, listDepth?: number, orderedListNumber?: number | null, parent?: Token | null, highlight?: CliHighlight | null): string;
|
|
32
|
+
/**
|
|
33
|
+
* Pad `content` to `targetWidth` according to alignment. `displayWidth` is the
|
|
34
|
+
* visible width of `content` (caller computes this, e.g. via stringWidth on
|
|
35
|
+
* stripAnsi'd text, so ANSI codes in `content` don't affect padding).
|
|
36
|
+
* @param content - The text to pad, which may carry ANSI codes.
|
|
37
|
+
* @param displayWidth - Visible width of `content` without ANSI codes.
|
|
38
|
+
* @param targetWidth - Column width to pad `content` to.
|
|
39
|
+
* @param align - Alignment: 'left', 'center', 'right', or null/undefined for left.
|
|
40
|
+
* @returns `content` padded with spaces to `targetWidth`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function padAligned(content: string, displayWidth: number, targetWidth: number, align: 'left' | 'center' | 'right' | null | undefined): string;
|
|
43
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/cc/markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EAAU,KAAK,KAAK,EAAe,MAAM,QAAQ,CAAA;AAMxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAcrD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AASD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAatC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EAEf,SAAS,GAAE,YAAY,GAAG,IAAW,GACpC,MAAM,CAOR;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EAEZ,SAAS,SAAI,EACb,iBAAiB,GAAE,MAAM,GAAG,IAAW,EACvC,MAAM,GAAE,KAAK,GAAG,IAAW,EAC3B,SAAS,GAAE,YAAY,GAAG,IAAW,GACpC,MAAM,CA+NR;AAiFD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GACpD,MAAM,CAUR"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/* oxlint-disable typescript/no-unsafe-argument, typescript/no-unsafe-assignment,
|
|
2
|
+
typescript/no-unsafe-call, typescript/no-unsafe-member-access, typescript/no-unsafe-return,
|
|
3
|
+
typescript/restrict-plus-operands, typescript/no-unnecessary-condition,
|
|
4
|
+
typescript/no-non-null-assertion, typescript/no-unnecessary-type-assertion,
|
|
5
|
+
sonarjs/no-duplicated-branches
|
|
6
|
+
-- ported Claude Code renderer (upstream src/utils/markdown.ts); historical lint debt kept with upstream idioms, like vendor/ */
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { marked } from 'marked';
|
|
9
|
+
import stripAnsi from 'strip-ansi';
|
|
10
|
+
import { stringWidth } from '../ink/stringWidth.js';
|
|
11
|
+
import { supportsHyperlinks } from '../ink/supports-hyperlinks.js';
|
|
12
|
+
import { colorize } from '../ink/colorize.js';
|
|
13
|
+
import { getActiveTheme } from '../theme.js';
|
|
14
|
+
import { logForDebugging } from '../utils/debug.js';
|
|
15
|
+
import { createHyperlink } from './hyperlink.js';
|
|
16
|
+
// Ported from the leaked Claude Code source (src/utils/markdown.ts), with the
|
|
17
|
+
// app-level theme/color plumbing replaced by fixed ANSI styling and
|
|
18
|
+
// stripPromptXMLTags inlined. Renders marked tokens to ANSI strings.
|
|
19
|
+
const BLOCKQUOTE_BAR = '\u258e'; // ▎ - left one-quarter block
|
|
20
|
+
const STRIPPED_TAGS_RE = /<(commit_analysis|context|function_analysis|pr_analysis)>.*?<\/\1>\n?/gs;
|
|
21
|
+
/** Inline code color: the active theme's permission accent (Gentle Mist Blue). */
|
|
22
|
+
const permissionColor = (text) => colorize(text, getActiveTheme().permission, 'foreground');
|
|
23
|
+
/**
|
|
24
|
+
* Strip tool-analysis XML tags (`<commit_analysis>`, `<context>`, `<function_analysis>`,
|
|
25
|
+
* `<pr_analysis>`) and their contents, then trim the result.
|
|
26
|
+
* @param content - Markdown text that may contain the wrapped tool-analysis tag blocks.
|
|
27
|
+
* @returns The content with those blocks removed and surrounding whitespace trimmed.
|
|
28
|
+
*/
|
|
29
|
+
export function stripPromptXMLTags(content) {
|
|
30
|
+
return content.replace(STRIPPED_TAGS_RE, '').trim();
|
|
31
|
+
}
|
|
32
|
+
// Use \n unconditionally — os.EOL is \r\n on Windows, and the extra \r
|
|
33
|
+
// breaks the character-to-segment mapping in applyStylesToWrappedText,
|
|
34
|
+
// causing styled text to shift right.
|
|
35
|
+
const EOL = '\n';
|
|
36
|
+
let markedConfigured = false;
|
|
37
|
+
/**
|
|
38
|
+
* Configure the shared `marked` instance once: disable strikethrough parsing so
|
|
39
|
+
* `~100` renders literally instead of as deleted text.
|
|
40
|
+
*/
|
|
41
|
+
export function configureMarked() {
|
|
42
|
+
if (markedConfigured)
|
|
43
|
+
return;
|
|
44
|
+
markedConfigured = true;
|
|
45
|
+
// Disable strikethrough parsing - the model often uses ~ for "approximate"
|
|
46
|
+
// (e.g., ~100) and rarely intends actual strikethrough formatting
|
|
47
|
+
marked.use({
|
|
48
|
+
tokenizer: {
|
|
49
|
+
del() {
|
|
50
|
+
return undefined;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Render markdown content to ANSI-styled text via the shared `marked` instance.
|
|
57
|
+
* @param content - Markdown source to render.
|
|
58
|
+
* @param highlight - Optional cli-highlight surface for code blocks; null disables syntax highlighting.
|
|
59
|
+
* @returns The rendered ANSI string, trimmed.
|
|
60
|
+
*/
|
|
61
|
+
export function applyMarkdown(content, highlight = null) {
|
|
62
|
+
configureMarked();
|
|
63
|
+
return marked
|
|
64
|
+
.lexer(stripPromptXMLTags(content))
|
|
65
|
+
.map(_ => formatToken(_, 0, null, null, highlight))
|
|
66
|
+
.join('')
|
|
67
|
+
.trim();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Render one marked token to ANSI text, recursing into child tokens.
|
|
71
|
+
* @param token - The marked token to render.
|
|
72
|
+
* @param listDepth - Nesting depth of the enclosing list; drives indentation and numbering style.
|
|
73
|
+
* @param orderedListNumber - Current ordinal of the enclosing ordered list item, or null for unordered lists.
|
|
74
|
+
* @param parent - The parent token; linkification is skipped inside links and prefixes are added inside list items.
|
|
75
|
+
* @param highlight - Optional cli-highlight surface for code blocks; null disables syntax highlighting.
|
|
76
|
+
* @returns The rendered ANSI string for the token, or '' for unrendered token types.
|
|
77
|
+
*/
|
|
78
|
+
export function formatToken(token, listDepth = 0, orderedListNumber = null, parent = null, highlight = null) {
|
|
79
|
+
switch (token.type) {
|
|
80
|
+
case 'blockquote': {
|
|
81
|
+
const inner = (token.tokens ?? [])
|
|
82
|
+
.map(_ => formatToken(_, 0, null, null, highlight))
|
|
83
|
+
.join('');
|
|
84
|
+
// Prefix each line with a dim vertical bar. Keep text italic but at
|
|
85
|
+
// normal brightness — chalk.dim is nearly invisible on dark themes.
|
|
86
|
+
const bar = chalk.dim(BLOCKQUOTE_BAR);
|
|
87
|
+
return inner
|
|
88
|
+
.split(EOL)
|
|
89
|
+
.map(line => stripAnsi(line).trim() ? `${bar} ${chalk.italic(line)}` : line)
|
|
90
|
+
.join(EOL);
|
|
91
|
+
}
|
|
92
|
+
case 'code': {
|
|
93
|
+
if (!highlight) {
|
|
94
|
+
return token.text + EOL;
|
|
95
|
+
}
|
|
96
|
+
let language = 'plaintext';
|
|
97
|
+
if (token.lang) {
|
|
98
|
+
if (highlight.supportsLanguage(token.lang)) {
|
|
99
|
+
language = token.lang;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
logForDebugging(`Language not supported while highlighting code, falling back to plaintext: ${token.lang}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return highlight.highlight(token.text, { language }) + EOL;
|
|
106
|
+
}
|
|
107
|
+
case 'codespan': {
|
|
108
|
+
// inline code
|
|
109
|
+
return permissionColor(token.text);
|
|
110
|
+
}
|
|
111
|
+
case 'em':
|
|
112
|
+
return chalk.italic((token.tokens ?? [])
|
|
113
|
+
.map(_ => formatToken(_, 0, null, parent, highlight))
|
|
114
|
+
.join(''));
|
|
115
|
+
case 'strong':
|
|
116
|
+
return chalk.bold((token.tokens ?? [])
|
|
117
|
+
.map(_ => formatToken(_, 0, null, parent, highlight))
|
|
118
|
+
.join(''));
|
|
119
|
+
case 'heading':
|
|
120
|
+
switch (token.depth) {
|
|
121
|
+
case 1: // h1
|
|
122
|
+
return (chalk.bold.italic.underline((token.tokens ?? [])
|
|
123
|
+
.map(_ => formatToken(_, 0, null, null, highlight))
|
|
124
|
+
.join('')) +
|
|
125
|
+
EOL +
|
|
126
|
+
EOL);
|
|
127
|
+
case 2: // h2
|
|
128
|
+
return (chalk.bold((token.tokens ?? [])
|
|
129
|
+
.map(_ => formatToken(_, 0, null, null, highlight))
|
|
130
|
+
.join('')) +
|
|
131
|
+
EOL +
|
|
132
|
+
EOL);
|
|
133
|
+
default: // h3+
|
|
134
|
+
return (chalk.bold((token.tokens ?? [])
|
|
135
|
+
.map(_ => formatToken(_, 0, null, null, highlight))
|
|
136
|
+
.join('')) +
|
|
137
|
+
EOL +
|
|
138
|
+
EOL);
|
|
139
|
+
}
|
|
140
|
+
case 'hr':
|
|
141
|
+
return '---';
|
|
142
|
+
case 'image':
|
|
143
|
+
return token.href;
|
|
144
|
+
case 'link': {
|
|
145
|
+
// Prevent mailto links from being displayed as clickable links
|
|
146
|
+
if (token.href.startsWith('mailto:')) {
|
|
147
|
+
// Extract email from mailto: link and display as plain text
|
|
148
|
+
const email = token.href.replace(/^mailto:/, '');
|
|
149
|
+
return email;
|
|
150
|
+
}
|
|
151
|
+
// Extract display text from the link's child tokens
|
|
152
|
+
const linkText = (token.tokens ?? [])
|
|
153
|
+
.map(_ => formatToken(_, 0, null, token, highlight))
|
|
154
|
+
.join('');
|
|
155
|
+
const plainLinkText = stripAnsi(linkText);
|
|
156
|
+
// If the link has meaningful display text (different from the URL),
|
|
157
|
+
// show it as a clickable hyperlink. In terminals that support OSC 8,
|
|
158
|
+
// users see the text and can hover/click to see the URL.
|
|
159
|
+
if (plainLinkText && plainLinkText !== token.href) {
|
|
160
|
+
return createHyperlink(token.href, linkText);
|
|
161
|
+
}
|
|
162
|
+
// When the display text matches the URL (or is empty), just show the URL
|
|
163
|
+
return createHyperlink(token.href);
|
|
164
|
+
}
|
|
165
|
+
case 'list': {
|
|
166
|
+
return token.items
|
|
167
|
+
.map((_, index) => formatToken(_, listDepth, token.ordered ? token.start + index : null, token, highlight))
|
|
168
|
+
.join('');
|
|
169
|
+
}
|
|
170
|
+
case 'list_item':
|
|
171
|
+
return (token.tokens ?? [])
|
|
172
|
+
.map(_ => `${' '.repeat(listDepth)}${formatToken(_, listDepth + 1, orderedListNumber, token, highlight)}`)
|
|
173
|
+
.join('');
|
|
174
|
+
case 'paragraph':
|
|
175
|
+
return ((token.tokens ?? [])
|
|
176
|
+
.map(_ => formatToken(_, 0, null, null, highlight))
|
|
177
|
+
.join('') + EOL);
|
|
178
|
+
case 'space':
|
|
179
|
+
return EOL;
|
|
180
|
+
case 'br':
|
|
181
|
+
return EOL;
|
|
182
|
+
case 'text':
|
|
183
|
+
if (parent?.type === 'link') {
|
|
184
|
+
// Already inside a markdown link — the link handler will wrap this
|
|
185
|
+
// in an OSC 8 hyperlink. Linkifying here would nest a second OSC 8
|
|
186
|
+
// sequence, and terminals honor the innermost one, overriding the
|
|
187
|
+
// link's actual href.
|
|
188
|
+
return token.text;
|
|
189
|
+
}
|
|
190
|
+
if (parent?.type === 'list_item') {
|
|
191
|
+
return `${orderedListNumber === null ? '-' : getListNumber(listDepth, orderedListNumber) + '.'} ${token.tokens ? token.tokens.map(_ => formatToken(_, listDepth, orderedListNumber, token, highlight)).join('') : linkifyIssueReferences(token.text)}${EOL}`;
|
|
192
|
+
}
|
|
193
|
+
return linkifyIssueReferences(token.text);
|
|
194
|
+
case 'table': {
|
|
195
|
+
const tableToken = token;
|
|
196
|
+
// Helper function to get the text content that will be displayed (after stripAnsi)
|
|
197
|
+
function getDisplayText(tokens) {
|
|
198
|
+
return stripAnsi(tokens
|
|
199
|
+
?.map(_ => formatToken(_, 0, null, null, highlight))
|
|
200
|
+
.join('') ?? '');
|
|
201
|
+
}
|
|
202
|
+
// Determine column widths based on displayed content (without formatting)
|
|
203
|
+
const columnWidths = tableToken.header.map((header, index) => {
|
|
204
|
+
let maxWidth = stringWidth(getDisplayText(header.tokens));
|
|
205
|
+
for (const row of tableToken.rows) {
|
|
206
|
+
const cellLength = stringWidth(getDisplayText(row[index]?.tokens));
|
|
207
|
+
maxWidth = Math.max(maxWidth, cellLength);
|
|
208
|
+
}
|
|
209
|
+
return Math.max(maxWidth, 3); // Minimum width of 3
|
|
210
|
+
});
|
|
211
|
+
// Format header row
|
|
212
|
+
let tableOutput = '| ';
|
|
213
|
+
tableToken.header.forEach((header, index) => {
|
|
214
|
+
const content = header.tokens
|
|
215
|
+
?.map(_ => formatToken(_, 0, null, null, highlight))
|
|
216
|
+
.join('') ?? '';
|
|
217
|
+
const displayText = getDisplayText(header.tokens);
|
|
218
|
+
const width = columnWidths[index];
|
|
219
|
+
const align = tableToken.align?.[index];
|
|
220
|
+
tableOutput +=
|
|
221
|
+
padAligned(content, stringWidth(displayText), width, align) + ' | ';
|
|
222
|
+
});
|
|
223
|
+
tableOutput = tableOutput.trimEnd() + EOL;
|
|
224
|
+
// Add separator row
|
|
225
|
+
tableOutput += '|';
|
|
226
|
+
columnWidths.forEach((width) => {
|
|
227
|
+
// Always use dashes, don't show alignment colons in the output
|
|
228
|
+
const separator = '-'.repeat(width + 2); // +2 for spaces on each side
|
|
229
|
+
tableOutput += separator + '|';
|
|
230
|
+
});
|
|
231
|
+
tableOutput += EOL;
|
|
232
|
+
// Format data rows
|
|
233
|
+
tableToken.rows.forEach((row) => {
|
|
234
|
+
tableOutput += '| ';
|
|
235
|
+
row.forEach((cell, index) => {
|
|
236
|
+
const content = cell.tokens
|
|
237
|
+
?.map(_ => formatToken(_, 0, null, null, highlight))
|
|
238
|
+
.join('') ?? '';
|
|
239
|
+
const displayText = getDisplayText(cell.tokens);
|
|
240
|
+
const width = columnWidths[index];
|
|
241
|
+
const align = tableToken.align?.[index];
|
|
242
|
+
tableOutput +=
|
|
243
|
+
padAligned(content, stringWidth(displayText), width, align) + ' | ';
|
|
244
|
+
});
|
|
245
|
+
tableOutput = tableOutput.trimEnd() + EOL;
|
|
246
|
+
});
|
|
247
|
+
return tableOutput + EOL;
|
|
248
|
+
}
|
|
249
|
+
case 'escape':
|
|
250
|
+
// Markdown escape: \) → ), \\ → \, etc.
|
|
251
|
+
return token.text;
|
|
252
|
+
case 'def':
|
|
253
|
+
case 'del':
|
|
254
|
+
case 'html':
|
|
255
|
+
// These token types are not rendered
|
|
256
|
+
return '';
|
|
257
|
+
}
|
|
258
|
+
return '';
|
|
259
|
+
}
|
|
260
|
+
// Matches owner/repo#NNN style GitHub issue/PR references. The qualified form
|
|
261
|
+
// is unambiguous — bare #NNN was removed because it guessed the current repo
|
|
262
|
+
// and was wrong whenever the assistant discussed a different one.
|
|
263
|
+
// Owner segment disallows dots (GitHub usernames are alphanumerics + hyphens
|
|
264
|
+
// only) so hostnames like docs.github.io/guide#42 don't false-positive. Repo
|
|
265
|
+
// segment allows dots (e.g. cc.kurs.web). Lookbehind is avoided — it defeats
|
|
266
|
+
// YARR JIT in JSC.
|
|
267
|
+
const ISSUE_REF_PATTERN = /(^|[^\w./-])([A-Za-z0-9][\w-]*\/[A-Za-z0-9][\w.-]*)#(\d+)\b/g;
|
|
268
|
+
/**
|
|
269
|
+
* Replaces owner/repo#123 references with clickable hyperlinks to GitHub.
|
|
270
|
+
*/
|
|
271
|
+
function linkifyIssueReferences(text) {
|
|
272
|
+
if (!supportsHyperlinks()) {
|
|
273
|
+
return text;
|
|
274
|
+
}
|
|
275
|
+
return text.replace(ISSUE_REF_PATTERN, (_match, prefix, repo, num) => prefix +
|
|
276
|
+
createHyperlink(`https://github.com/${repo}/issues/${num}`, `${repo}#${num}`));
|
|
277
|
+
}
|
|
278
|
+
function numberToLetter(n) {
|
|
279
|
+
let result = '';
|
|
280
|
+
while (n > 0) {
|
|
281
|
+
n--;
|
|
282
|
+
result = String.fromCharCode(97 + (n % 26)) + result;
|
|
283
|
+
n = Math.floor(n / 26);
|
|
284
|
+
}
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
const ROMAN_VALUES = [
|
|
288
|
+
[1000, 'm'],
|
|
289
|
+
[900, 'cm'],
|
|
290
|
+
[500, 'd'],
|
|
291
|
+
[400, 'cd'],
|
|
292
|
+
[100, 'c'],
|
|
293
|
+
[90, 'xc'],
|
|
294
|
+
[50, 'l'],
|
|
295
|
+
[40, 'xl'],
|
|
296
|
+
[10, 'x'],
|
|
297
|
+
[9, 'ix'],
|
|
298
|
+
[5, 'v'],
|
|
299
|
+
[4, 'iv'],
|
|
300
|
+
[1, 'i'],
|
|
301
|
+
];
|
|
302
|
+
function numberToRoman(n) {
|
|
303
|
+
let result = '';
|
|
304
|
+
for (const [value, numeral] of ROMAN_VALUES) {
|
|
305
|
+
while (n >= value) {
|
|
306
|
+
result += numeral;
|
|
307
|
+
n -= value;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
function getListNumber(listDepth, orderedListNumber) {
|
|
313
|
+
switch (listDepth) {
|
|
314
|
+
case 0:
|
|
315
|
+
case 1:
|
|
316
|
+
return orderedListNumber.toString();
|
|
317
|
+
case 2:
|
|
318
|
+
return numberToLetter(orderedListNumber);
|
|
319
|
+
case 3:
|
|
320
|
+
return numberToRoman(orderedListNumber);
|
|
321
|
+
default:
|
|
322
|
+
return orderedListNumber.toString();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Pad `content` to `targetWidth` according to alignment. `displayWidth` is the
|
|
327
|
+
* visible width of `content` (caller computes this, e.g. via stringWidth on
|
|
328
|
+
* stripAnsi'd text, so ANSI codes in `content` don't affect padding).
|
|
329
|
+
* @param content - The text to pad, which may carry ANSI codes.
|
|
330
|
+
* @param displayWidth - Visible width of `content` without ANSI codes.
|
|
331
|
+
* @param targetWidth - Column width to pad `content` to.
|
|
332
|
+
* @param align - Alignment: 'left', 'center', 'right', or null/undefined for left.
|
|
333
|
+
* @returns `content` padded with spaces to `targetWidth`.
|
|
334
|
+
*/
|
|
335
|
+
export function padAligned(content, displayWidth, targetWidth, align) {
|
|
336
|
+
const padding = Math.max(0, targetWidth - displayWidth);
|
|
337
|
+
if (align === 'center') {
|
|
338
|
+
const leftPad = Math.floor(padding / 2);
|
|
339
|
+
return ' '.repeat(leftPad) + content + ' '.repeat(padding - leftPad);
|
|
340
|
+
}
|
|
341
|
+
if (align === 'right') {
|
|
342
|
+
return ' '.repeat(padding) + content;
|
|
343
|
+
}
|
|
344
|
+
return content + ' '.repeat(padding);
|
|
345
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinnerVerbs.d.ts","sourceRoot":"","sources":["../../../src/cc/spinnerVerbs.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,eAAO,MAAM,aAAa,UA4LzB,CAAA"}
|