centaurus-cli 2.0.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/AUTH_FLOW.md +138 -0
- package/CONFIG_GUIDE.md +255 -0
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/ai/provider-factory.d.ts +6 -0
- package/dist/ai/provider-factory.d.ts.map +1 -0
- package/dist/ai/provider-factory.js +27 -0
- package/dist/ai/provider-factory.js.map +1 -0
- package/dist/ai/providers/base.d.ts +25 -0
- package/dist/ai/providers/base.d.ts.map +1 -0
- package/dist/ai/providers/base.js +9 -0
- package/dist/ai/providers/base.js.map +1 -0
- package/dist/ai/providers/gemini.d.ts +34 -0
- package/dist/ai/providers/gemini.d.ts.map +1 -0
- package/dist/ai/providers/gemini.js +146 -0
- package/dist/ai/providers/gemini.js.map +1 -0
- package/dist/ai/types.d.ts +20 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/cli-adapter.d.ts +78 -0
- package/dist/cli-adapter.d.ts.map +1 -0
- package/dist/cli-adapter.js +605 -0
- package/dist/cli-adapter.js.map +1 -0
- package/dist/commands/CommandParser.d.ts +27 -0
- package/dist/commands/CommandParser.d.ts.map +1 -0
- package/dist/commands/CommandParser.js +238 -0
- package/dist/commands/CommandParser.js.map +1 -0
- package/dist/config/ConfigManager.d.ts +59 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/config/ConfigManager.js +332 -0
- package/dist/config/ConfigManager.js.map +1 -0
- package/dist/config/defaultConfig.d.ts +82 -0
- package/dist/config/defaultConfig.d.ts.map +1 -0
- package/dist/config/defaultConfig.js +88 -0
- package/dist/config/defaultConfig.js.map +1 -0
- package/dist/config/manager.d.ts +60 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +162 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/types.d.ts +9 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +6 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index-custom.d.ts +3 -0
- package/dist/index-custom.d.ts.map +1 -0
- package/dist/index-custom.js +65 -0
- package/dist/index-custom.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/system-prompt.d.ts +47 -0
- package/dist/prompts/system-prompt.d.ts.map +1 -0
- package/dist/prompts/system-prompt.js +378 -0
- package/dist/prompts/system-prompt.js.map +1 -0
- package/dist/providers/GoogleProvider.d.ts +26 -0
- package/dist/providers/GoogleProvider.d.ts.map +1 -0
- package/dist/providers/GoogleProvider.js +313 -0
- package/dist/providers/GoogleProvider.js.map +1 -0
- package/dist/providers/Provider.d.ts +114 -0
- package/dist/providers/Provider.d.ts.map +1 -0
- package/dist/providers/Provider.js +44 -0
- package/dist/providers/Provider.js.map +1 -0
- package/dist/services/api-client.d.ts +282 -0
- package/dist/services/api-client.d.ts.map +1 -0
- package/dist/services/api-client.js +339 -0
- package/dist/services/api-client.js.map +1 -0
- package/dist/services/auth-handler.d.ts +30 -0
- package/dist/services/auth-handler.d.ts.map +1 -0
- package/dist/services/auth-handler.js +210 -0
- package/dist/services/auth-handler.js.map +1 -0
- package/dist/services/conversation-manager.d.ts +73 -0
- package/dist/services/conversation-manager.d.ts.map +1 -0
- package/dist/services/conversation-manager.js +128 -0
- package/dist/services/conversation-manager.js.map +1 -0
- package/dist/tests/automated-verification.d.ts +27 -0
- package/dist/tests/automated-verification.d.ts.map +1 -0
- package/dist/tests/automated-verification.js +359 -0
- package/dist/tests/automated-verification.js.map +1 -0
- package/dist/tests/integration-tests.d.ts +50 -0
- package/dist/tests/integration-tests.d.ts.map +1 -0
- package/dist/tests/integration-tests.js +648 -0
- package/dist/tests/integration-tests.js.map +1 -0
- package/dist/tools/ToolRegistry.d.ts +44 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -0
- package/dist/tools/ToolRegistry.js +494 -0
- package/dist/tools/ToolRegistry.js.map +1 -0
- package/dist/tools/command.d.ts +4 -0
- package/dist/tools/command.d.ts.map +1 -0
- package/dist/tools/command.js +117 -0
- package/dist/tools/command.js.map +1 -0
- package/dist/tools/file-ops-test.d.ts +6 -0
- package/dist/tools/file-ops-test.d.ts.map +1 -0
- package/dist/tools/file-ops-test.js +197 -0
- package/dist/tools/file-ops-test.js.map +1 -0
- package/dist/tools/file-ops.d.ts +6 -0
- package/dist/tools/file-ops.d.ts.map +1 -0
- package/dist/tools/file-ops.js +189 -0
- package/dist/tools/file-ops.js.map +1 -0
- package/dist/tools/plan-mode.d.ts +53 -0
- package/dist/tools/plan-mode.d.ts.map +1 -0
- package/dist/tools/plan-mode.js +202 -0
- package/dist/tools/plan-mode.js.map +1 -0
- package/dist/tools/registry.d.ts +30 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +67 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +34 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-search.d.ts +24 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +194 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/DisplayHistory.d.ts +53 -0
- package/dist/ui/DisplayHistory.d.ts.map +1 -0
- package/dist/ui/DisplayHistory.js +82 -0
- package/dist/ui/DisplayHistory.js.map +1 -0
- package/dist/ui/clack-ui.d.ts +83 -0
- package/dist/ui/clack-ui.d.ts.map +1 -0
- package/dist/ui/clack-ui.js +304 -0
- package/dist/ui/clack-ui.js.map +1 -0
- package/dist/ui/components/App.d.ts +47 -0
- package/dist/ui/components/App.d.ts.map +1 -0
- package/dist/ui/components/App.js +389 -0
- package/dist/ui/components/App.js.map +1 -0
- package/dist/ui/components/AuthScreen.d.ts +8 -0
- package/dist/ui/components/AuthScreen.d.ts.map +1 -0
- package/dist/ui/components/AuthScreen.js +37 -0
- package/dist/ui/components/AuthScreen.js.map +1 -0
- package/dist/ui/components/AuthWelcomeScreen.d.ts +8 -0
- package/dist/ui/components/AuthWelcomeScreen.d.ts.map +1 -0
- package/dist/ui/components/AuthWelcomeScreen.js +34 -0
- package/dist/ui/components/AuthWelcomeScreen.js.map +1 -0
- package/dist/ui/components/CodeBlock.d.ts +9 -0
- package/dist/ui/components/CodeBlock.d.ts.map +1 -0
- package/dist/ui/components/CodeBlock.js +22 -0
- package/dist/ui/components/CodeBlock.js.map +1 -0
- package/dist/ui/components/ConfigViewer.d.ts +11 -0
- package/dist/ui/components/ConfigViewer.d.ts.map +1 -0
- package/dist/ui/components/ConfigViewer.js +27 -0
- package/dist/ui/components/ConfigViewer.js.map +1 -0
- package/dist/ui/components/ConfirmPrompt.d.ts +11 -0
- package/dist/ui/components/ConfirmPrompt.d.ts.map +1 -0
- package/dist/ui/components/ConfirmPrompt.js +55 -0
- package/dist/ui/components/ConfirmPrompt.js.map +1 -0
- package/dist/ui/components/DiffViewer.d.ts +8 -0
- package/dist/ui/components/DiffViewer.d.ts.map +1 -0
- package/dist/ui/components/DiffViewer.js +63 -0
- package/dist/ui/components/DiffViewer.js.map +1 -0
- package/dist/ui/components/DisplayItemRenderer.d.ts +18 -0
- package/dist/ui/components/DisplayItemRenderer.d.ts.map +1 -0
- package/dist/ui/components/DisplayItemRenderer.js +53 -0
- package/dist/ui/components/DisplayItemRenderer.js.map +1 -0
- package/dist/ui/components/DynamicMessage.d.ts +13 -0
- package/dist/ui/components/DynamicMessage.d.ts.map +1 -0
- package/dist/ui/components/DynamicMessage.js +27 -0
- package/dist/ui/components/DynamicMessage.js.map +1 -0
- package/dist/ui/components/ErrorBoundary.d.ts +16 -0
- package/dist/ui/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/ui/components/ErrorBoundary.js +25 -0
- package/dist/ui/components/ErrorBoundary.js.map +1 -0
- package/dist/ui/components/FileOperation.d.ts +10 -0
- package/dist/ui/components/FileOperation.d.ts.map +1 -0
- package/dist/ui/components/FileOperation.js +31 -0
- package/dist/ui/components/FileOperation.js.map +1 -0
- package/dist/ui/components/InputBox.d.ts +12 -0
- package/dist/ui/components/InputBox.d.ts.map +1 -0
- package/dist/ui/components/InputBox.js +50 -0
- package/dist/ui/components/InputBox.js.map +1 -0
- package/dist/ui/components/KeyboardHelp.d.ts +7 -0
- package/dist/ui/components/KeyboardHelp.d.ts.map +1 -0
- package/dist/ui/components/KeyboardHelp.js +25 -0
- package/dist/ui/components/KeyboardHelp.js.map +1 -0
- package/dist/ui/components/LoadingIndicator.d.ts +3 -0
- package/dist/ui/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/ui/components/LoadingIndicator.js +25 -0
- package/dist/ui/components/LoadingIndicator.js.map +1 -0
- package/dist/ui/components/MarkdownRenderer.d.ts +8 -0
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/ui/components/MarkdownRenderer.js +96 -0
- package/dist/ui/components/MarkdownRenderer.js.map +1 -0
- package/dist/ui/components/MessageBox.d.ts +10 -0
- package/dist/ui/components/MessageBox.d.ts.map +1 -0
- package/dist/ui/components/MessageBox.js +50 -0
- package/dist/ui/components/MessageBox.js.map +1 -0
- package/dist/ui/components/MessageDisplay.d.ts +8 -0
- package/dist/ui/components/MessageDisplay.d.ts.map +1 -0
- package/dist/ui/components/MessageDisplay.js +43 -0
- package/dist/ui/components/MessageDisplay.js.map +1 -0
- package/dist/ui/components/ScrollableContent.d.ts +7 -0
- package/dist/ui/components/ScrollableContent.d.ts.map +1 -0
- package/dist/ui/components/ScrollableContent.js +6 -0
- package/dist/ui/components/ScrollableContent.js.map +1 -0
- package/dist/ui/components/ScrollableMessageList.d.ts +10 -0
- package/dist/ui/components/ScrollableMessageList.d.ts.map +1 -0
- package/dist/ui/components/ScrollableMessageList.js +133 -0
- package/dist/ui/components/ScrollableMessageList.js.map +1 -0
- package/dist/ui/components/ScrollableScreen.d.ts +9 -0
- package/dist/ui/components/ScrollableScreen.d.ts.map +1 -0
- package/dist/ui/components/ScrollableScreen.js +22 -0
- package/dist/ui/components/ScrollableScreen.js.map +1 -0
- package/dist/ui/components/SelectPrompt.d.ts +12 -0
- package/dist/ui/components/SelectPrompt.d.ts.map +1 -0
- package/dist/ui/components/SelectPrompt.js +10 -0
- package/dist/ui/components/SelectPrompt.js.map +1 -0
- package/dist/ui/components/StaticMessageHistory.d.ts +14 -0
- package/dist/ui/components/StaticMessageHistory.d.ts.map +1 -0
- package/dist/ui/components/StaticMessageHistory.js +19 -0
- package/dist/ui/components/StaticMessageHistory.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +10 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -0
- package/dist/ui/components/StatusBar.js +20 -0
- package/dist/ui/components/StatusBar.js.map +1 -0
- package/dist/ui/components/StreamingMessageDisplay.d.ts +13 -0
- package/dist/ui/components/StreamingMessageDisplay.d.ts.map +1 -0
- package/dist/ui/components/StreamingMessageDisplay.js +26 -0
- package/dist/ui/components/StreamingMessageDisplay.js.map +1 -0
- package/dist/ui/components/ToolExecutionMessage.d.ts +8 -0
- package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -0
- package/dist/ui/components/ToolExecutionMessage.js +189 -0
- package/dist/ui/components/ToolExecutionMessage.js.map +1 -0
- package/dist/ui/components/ToolExecutionStatus.d.ts +10 -0
- package/dist/ui/components/ToolExecutionStatus.d.ts.map +1 -0
- package/dist/ui/components/ToolExecutionStatus.js +65 -0
- package/dist/ui/components/ToolExecutionStatus.js.map +1 -0
- package/dist/ui/components/ToolResult.d.ts +10 -0
- package/dist/ui/components/ToolResult.d.ts.map +1 -0
- package/dist/ui/components/ToolResult.js +17 -0
- package/dist/ui/components/ToolResult.js.map +1 -0
- package/dist/ui/components/WelcomeBanner.d.ts +3 -0
- package/dist/ui/components/WelcomeBanner.d.ts.map +1 -0
- package/dist/ui/components/WelcomeBanner.js +28 -0
- package/dist/ui/components/WelcomeBanner.js.map +1 -0
- package/dist/ui/components/code-block.d.ts +10 -0
- package/dist/ui/components/code-block.d.ts.map +1 -0
- package/dist/ui/components/code-block.js +74 -0
- package/dist/ui/components/code-block.js.map +1 -0
- package/dist/ui/components/confirm-prompt.d.ts +12 -0
- package/dist/ui/components/confirm-prompt.d.ts.map +1 -0
- package/dist/ui/components/confirm-prompt.js +104 -0
- package/dist/ui/components/confirm-prompt.js.map +1 -0
- package/dist/ui/components/diff-viewer.d.ts +9 -0
- package/dist/ui/components/diff-viewer.d.ts.map +1 -0
- package/dist/ui/components/diff-viewer.js +57 -0
- package/dist/ui/components/diff-viewer.js.map +1 -0
- package/dist/ui/components/input-box.d.ts +18 -0
- package/dist/ui/components/input-box.d.ts.map +1 -0
- package/dist/ui/components/input-box.js +157 -0
- package/dist/ui/components/input-box.js.map +1 -0
- package/dist/ui/components/keyboard-help.d.ts +7 -0
- package/dist/ui/components/keyboard-help.d.ts.map +1 -0
- package/dist/ui/components/keyboard-help.js +43 -0
- package/dist/ui/components/keyboard-help.js.map +1 -0
- package/dist/ui/components/loading-indicator.d.ts +3 -0
- package/dist/ui/components/loading-indicator.d.ts.map +1 -0
- package/dist/ui/components/loading-indicator.js +42 -0
- package/dist/ui/components/loading-indicator.js.map +1 -0
- package/dist/ui/components/message-display.d.ts +7 -0
- package/dist/ui/components/message-display.d.ts.map +1 -0
- package/dist/ui/components/message-display.js +104 -0
- package/dist/ui/components/message-display.js.map +1 -0
- package/dist/ui/components/misc.d.ts +28 -0
- package/dist/ui/components/misc.d.ts.map +1 -0
- package/dist/ui/components/misc.js +128 -0
- package/dist/ui/components/misc.js.map +1 -0
- package/dist/ui/components/select-prompt.d.ts +13 -0
- package/dist/ui/components/select-prompt.d.ts.map +1 -0
- package/dist/ui/components/select-prompt.js +42 -0
- package/dist/ui/components/select-prompt.js.map +1 -0
- package/dist/ui/components/status-bar.d.ts +11 -0
- package/dist/ui/components/status-bar.d.ts.map +1 -0
- package/dist/ui/components/status-bar.js +47 -0
- package/dist/ui/components/status-bar.js.map +1 -0
- package/dist/ui/components/tool-execution.d.ts +3 -0
- package/dist/ui/components/tool-execution.d.ts.map +1 -0
- package/dist/ui/components/tool-execution.js +374 -0
- package/dist/ui/components/tool-execution.js.map +1 -0
- package/dist/ui/components/tool-result.d.ts +11 -0
- package/dist/ui/components/tool-result.d.ts.map +1 -0
- package/dist/ui/components/tool-result.js +58 -0
- package/dist/ui/components/tool-result.js.map +1 -0
- package/dist/ui/components/welcome-banner.d.ts +3 -0
- package/dist/ui/components/welcome-banner.d.ts.map +1 -0
- package/dist/ui/components/welcome-banner.js +46 -0
- package/dist/ui/components/welcome-banner.js.map +1 -0
- package/dist/ui/hooks/useDisplayHistory.d.ts +13 -0
- package/dist/ui/hooks/useDisplayHistory.d.ts.map +1 -0
- package/dist/ui/hooks/useDisplayHistory.js +45 -0
- package/dist/ui/hooks/useDisplayHistory.js.map +1 -0
- package/dist/ui/render-engine.d.ts +69 -0
- package/dist/ui/render-engine.d.ts.map +1 -0
- package/dist/ui/render-engine.js +197 -0
- package/dist/ui/render-engine.js.map +1 -0
- package/dist/ui/terminal/TerminalRenderer.d.ts +84 -0
- package/dist/ui/terminal/TerminalRenderer.d.ts.map +1 -0
- package/dist/ui/terminal/TerminalRenderer.js +154 -0
- package/dist/ui/terminal/TerminalRenderer.js.map +1 -0
- package/dist/ui/terminal/TerminalUI.d.ts +139 -0
- package/dist/ui/terminal/TerminalUI.d.ts.map +1 -0
- package/dist/ui/terminal/TerminalUI.js +430 -0
- package/dist/ui/terminal/TerminalUI.js.map +1 -0
- package/dist/ui/terminal/VirtualChatBuffer.d.ts +32 -0
- package/dist/ui/terminal/VirtualChatBuffer.d.ts.map +1 -0
- package/dist/ui/terminal/VirtualChatBuffer.js +37 -0
- package/dist/ui/terminal/VirtualChatBuffer.js.map +1 -0
- package/dist/ui/terminal-kit-base.d.ts +117 -0
- package/dist/ui/terminal-kit-base.d.ts.map +1 -0
- package/dist/ui/terminal-kit-base.js +188 -0
- package/dist/ui/terminal-kit-base.js.map +1 -0
- package/dist/utils/file.d.ts +21 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +68 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/logger.d.ts +17 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +57 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/markdown-parser.d.ts +56 -0
- package/dist/utils/markdown-parser.d.ts.map +1 -0
- package/dist/utils/markdown-parser.js +307 -0
- package/dist/utils/markdown-parser.js.map +1 -0
- package/dist/utils/shell.d.ts +7 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +62 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/state.d.ts +13 -0
- package/dist/utils/state.d.ts.map +1 -0
- package/dist/utils/state.js +25 -0
- package/dist/utils/state.js.map +1 -0
- package/package.json +81 -0
- package/postinstall.js +46 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
export class MarkdownParser {
|
|
2
|
+
/**
|
|
3
|
+
* Main parse function that processes markdown text into structured elements
|
|
4
|
+
*/
|
|
5
|
+
parse(markdown) {
|
|
6
|
+
const lines = markdown.split('\n');
|
|
7
|
+
const elements = [];
|
|
8
|
+
let i = 0;
|
|
9
|
+
while (i < lines.length) {
|
|
10
|
+
const line = lines[i];
|
|
11
|
+
// Code blocks
|
|
12
|
+
if (line.trim().startsWith('```')) {
|
|
13
|
+
const codeBlock = this.parseCodeBlock(lines, i);
|
|
14
|
+
if (codeBlock) {
|
|
15
|
+
elements.push(codeBlock.element);
|
|
16
|
+
i = codeBlock.endIndex;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Headings
|
|
21
|
+
const heading = this.parseHeading(line);
|
|
22
|
+
if (heading) {
|
|
23
|
+
elements.push(heading);
|
|
24
|
+
i++;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
// Horizontal rule
|
|
28
|
+
if (this.isHorizontalRule(line)) {
|
|
29
|
+
elements.push({ type: 'horizontal-rule', content: '' });
|
|
30
|
+
i++;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
// Blockquote
|
|
34
|
+
if (line.trim().startsWith('>')) {
|
|
35
|
+
elements.push(this.parseBlockquote(line));
|
|
36
|
+
i++;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
// Ordered list
|
|
40
|
+
const orderedList = this.parseOrderedListItem(line);
|
|
41
|
+
if (orderedList) {
|
|
42
|
+
elements.push(orderedList);
|
|
43
|
+
i++;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
// Unordered list
|
|
47
|
+
const unorderedList = this.parseUnorderedListItem(line);
|
|
48
|
+
if (unorderedList) {
|
|
49
|
+
elements.push(unorderedList);
|
|
50
|
+
i++;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
// Empty line
|
|
54
|
+
if (line.trim() === '') {
|
|
55
|
+
elements.push({ type: 'line-break', content: '' });
|
|
56
|
+
i++;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
// Regular text with inline formatting
|
|
60
|
+
const textElement = this.parseInlineFormatting(line);
|
|
61
|
+
elements.push(textElement);
|
|
62
|
+
i++;
|
|
63
|
+
}
|
|
64
|
+
return this.mergeAdjacentText(elements);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Parse code block (```)
|
|
68
|
+
*/
|
|
69
|
+
parseCodeBlock(lines, startIndex) {
|
|
70
|
+
const firstLine = lines[startIndex].trim();
|
|
71
|
+
if (!firstLine.startsWith('```'))
|
|
72
|
+
return null;
|
|
73
|
+
const language = firstLine.slice(3).trim() || 'text';
|
|
74
|
+
let code = '';
|
|
75
|
+
let endIndex = startIndex + 1;
|
|
76
|
+
while (endIndex < lines.length) {
|
|
77
|
+
if (lines[endIndex].trim().startsWith('```')) {
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
code += lines[endIndex] + '\n';
|
|
81
|
+
endIndex++;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
element: {
|
|
85
|
+
type: 'code-block',
|
|
86
|
+
content: code.trimEnd(),
|
|
87
|
+
language,
|
|
88
|
+
},
|
|
89
|
+
endIndex: endIndex + 1,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parse heading (# ## ### etc.)
|
|
94
|
+
*/
|
|
95
|
+
parseHeading(line) {
|
|
96
|
+
const match = line.match(/^(#{1,6})\s+(.+)$/);
|
|
97
|
+
if (!match)
|
|
98
|
+
return null;
|
|
99
|
+
return {
|
|
100
|
+
type: 'heading',
|
|
101
|
+
content: match[2].trim(),
|
|
102
|
+
level: match[1].length,
|
|
103
|
+
children: this.parseInlineElements(match[2].trim()),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Check if line is horizontal rule
|
|
108
|
+
*/
|
|
109
|
+
isHorizontalRule(line) {
|
|
110
|
+
const trimmed = line.trim();
|
|
111
|
+
return /^(-{3,}|_{3,}|\*{3,})$/.test(trimmed);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Parse blockquote
|
|
115
|
+
*/
|
|
116
|
+
parseBlockquote(line) {
|
|
117
|
+
const content = line.replace(/^\s*>\s?/, '');
|
|
118
|
+
return {
|
|
119
|
+
type: 'blockquote',
|
|
120
|
+
content,
|
|
121
|
+
children: this.parseInlineElements(content),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Parse ordered list item
|
|
126
|
+
*/
|
|
127
|
+
parseOrderedListItem(line) {
|
|
128
|
+
const match = line.match(/^(\s*)(\d+)\.\s+(.+)$/);
|
|
129
|
+
if (!match)
|
|
130
|
+
return null;
|
|
131
|
+
const indent = match[1].length;
|
|
132
|
+
const index = parseInt(match[2], 10);
|
|
133
|
+
const content = match[3];
|
|
134
|
+
return {
|
|
135
|
+
type: 'list-item',
|
|
136
|
+
content,
|
|
137
|
+
ordered: true,
|
|
138
|
+
index,
|
|
139
|
+
level: Math.floor(indent / 2),
|
|
140
|
+
children: this.parseInlineElements(content),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Parse unordered list item
|
|
145
|
+
*/
|
|
146
|
+
parseUnorderedListItem(line) {
|
|
147
|
+
const match = line.match(/^(\s*)[-*+]\s+(.+)$/);
|
|
148
|
+
if (!match)
|
|
149
|
+
return null;
|
|
150
|
+
const indent = match[1].length;
|
|
151
|
+
const content = match[2];
|
|
152
|
+
return {
|
|
153
|
+
type: 'list-item',
|
|
154
|
+
content,
|
|
155
|
+
ordered: false,
|
|
156
|
+
level: Math.floor(indent / 2),
|
|
157
|
+
children: this.parseInlineElements(content),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Parse inline formatting (bold, italic, code, links)
|
|
162
|
+
*/
|
|
163
|
+
parseInlineFormatting(text) {
|
|
164
|
+
return {
|
|
165
|
+
type: 'text',
|
|
166
|
+
content: text,
|
|
167
|
+
children: this.parseInlineElements(text),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Parse inline elements within text
|
|
172
|
+
*/
|
|
173
|
+
parseInlineElements(text) {
|
|
174
|
+
const elements = [];
|
|
175
|
+
let currentPos = 0;
|
|
176
|
+
// Patterns for inline formatting
|
|
177
|
+
const patterns = [
|
|
178
|
+
{ regex: /\*\*(.+?)\*\*/g, type: 'bold' },
|
|
179
|
+
{ regex: /__(.+?)__/g, type: 'bold' },
|
|
180
|
+
{ regex: /\*(.+?)\*/g, type: 'italic' },
|
|
181
|
+
{ regex: /_(.+?)_/g, type: 'italic' },
|
|
182
|
+
{ regex: /`(.+?)`/g, type: 'code-inline' },
|
|
183
|
+
{ regex: /\[(.+?)\]\((.+?)\)/g, type: 'link' },
|
|
184
|
+
];
|
|
185
|
+
// Find all matches
|
|
186
|
+
const matches = [];
|
|
187
|
+
for (const pattern of patterns) {
|
|
188
|
+
pattern.regex.lastIndex = 0;
|
|
189
|
+
let match;
|
|
190
|
+
while ((match = pattern.regex.exec(text)) !== null) {
|
|
191
|
+
if (pattern.type === 'link') {
|
|
192
|
+
matches.push({
|
|
193
|
+
start: match.index,
|
|
194
|
+
end: match.index + match[0].length,
|
|
195
|
+
type: pattern.type,
|
|
196
|
+
content: match[1],
|
|
197
|
+
url: match[2],
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
matches.push({
|
|
202
|
+
start: match.index,
|
|
203
|
+
end: match.index + match[0].length,
|
|
204
|
+
type: pattern.type,
|
|
205
|
+
content: match[1],
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Sort by position
|
|
211
|
+
matches.sort((a, b) => a.start - b.start);
|
|
212
|
+
// Remove overlapping matches (keep first one)
|
|
213
|
+
const filteredMatches = [];
|
|
214
|
+
let lastEnd = 0;
|
|
215
|
+
for (const match of matches) {
|
|
216
|
+
if (match.start >= lastEnd) {
|
|
217
|
+
filteredMatches.push(match);
|
|
218
|
+
lastEnd = match.end;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// Build elements
|
|
222
|
+
currentPos = 0;
|
|
223
|
+
for (const match of filteredMatches) {
|
|
224
|
+
// Add plain text before match
|
|
225
|
+
if (match.start > currentPos) {
|
|
226
|
+
const plainText = text.slice(currentPos, match.start);
|
|
227
|
+
if (plainText) {
|
|
228
|
+
elements.push({ type: 'text', content: plainText });
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Add formatted element
|
|
232
|
+
if (match.type === 'link') {
|
|
233
|
+
elements.push({
|
|
234
|
+
type: 'link',
|
|
235
|
+
content: `${match.content} (${match.url})`,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
elements.push({
|
|
240
|
+
type: match.type,
|
|
241
|
+
content: match.content,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
currentPos = match.end;
|
|
245
|
+
}
|
|
246
|
+
// Add remaining text
|
|
247
|
+
if (currentPos < text.length) {
|
|
248
|
+
const remaining = text.slice(currentPos);
|
|
249
|
+
if (remaining) {
|
|
250
|
+
elements.push({ type: 'text', content: remaining });
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return elements.length > 0 ? elements : [{ type: 'text', content: text }];
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Merge adjacent text elements
|
|
257
|
+
*/
|
|
258
|
+
mergeAdjacentText(elements) {
|
|
259
|
+
const merged = [];
|
|
260
|
+
for (let i = 0; i < elements.length; i++) {
|
|
261
|
+
const current = elements[i];
|
|
262
|
+
if (merged.length === 0) {
|
|
263
|
+
merged.push(current);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const last = merged[merged.length - 1];
|
|
267
|
+
// Merge consecutive text elements without formatting
|
|
268
|
+
if (last.type === 'text' &&
|
|
269
|
+
current.type === 'text' &&
|
|
270
|
+
(!last.children || last.children.length === 0) &&
|
|
271
|
+
(!current.children || current.children.length === 0)) {
|
|
272
|
+
last.content += ' ' + current.content;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
merged.push(current);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return merged;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Utility to wrap text to a specific width
|
|
283
|
+
*/
|
|
284
|
+
export function wrapText(text, maxWidth, indent = 0) {
|
|
285
|
+
const words = text.split(/\s+/);
|
|
286
|
+
const lines = [];
|
|
287
|
+
let currentLine = '';
|
|
288
|
+
const indentStr = ' '.repeat(indent);
|
|
289
|
+
const effectiveWidth = maxWidth - indent;
|
|
290
|
+
for (const word of words) {
|
|
291
|
+
const testLine = currentLine ? `${currentLine} ${word}` : word;
|
|
292
|
+
if (testLine.length <= effectiveWidth) {
|
|
293
|
+
currentLine = testLine;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
if (currentLine) {
|
|
297
|
+
lines.push(indentStr + currentLine);
|
|
298
|
+
}
|
|
299
|
+
currentLine = word;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (currentLine) {
|
|
303
|
+
lines.push(indentStr + currentLine);
|
|
304
|
+
}
|
|
305
|
+
return lines.length > 0 ? lines : [indentStr];
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=markdown-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-parser.js","sourceRoot":"","sources":["../../src/utils/markdown-parser.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,KAAK,CAAC,QAAgB;QACpB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAoB,EAAE,CAAC;QACrC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEV,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEtB,cAAc;YACd,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClC,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAChD,IAAI,SAAS,EAAE,CAAC;oBACd,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;oBACjC,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC;oBACvB,SAAS;gBACX,CAAC;YACH,CAAC;YAED,W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MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,QAAgB,EAAE,SAAiB,CAAC;IACzE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IAEzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAE/D,IAAI,QAAQ,CAAC,MAAM,IAAI,cAAc,EAAE,CAAC;YACtC,WAAW,GAAG,QAAQ,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,WAAW,EAAE,CAAC;gBAChB,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,CAAC;YACtC,CAAC;YACD,WAAW,GAAG,IAAI,CAAC;QACrB,CAAC;IACH,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getShellCommand(): string;
|
|
2
|
+
export declare function executeCommand(command: string, cwd: string, onData?: (chunk: string, type: 'stdout' | 'stderr') => void): Promise<{
|
|
3
|
+
stdout: string;
|
|
4
|
+
stderr: string;
|
|
5
|
+
exitCode: number;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,IAAI,MAAM,CAQxC;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,KAAK,IAAI,GAC1D,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA0D/D"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as os from 'os';
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
export function getShellCommand() {
|
|
4
|
+
const platform = os.platform();
|
|
5
|
+
if (platform === 'win32') {
|
|
6
|
+
return 'powershell.exe';
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return process.env.SHELL || '/bin/bash';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function executeCommand(command, cwd, onData) {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
const platform = os.platform();
|
|
15
|
+
const isWindows = platform === 'win32';
|
|
16
|
+
// Determine shell and command format
|
|
17
|
+
const shell = isWindows ? 'powershell.exe' : (process.env.SHELL || '/bin/bash');
|
|
18
|
+
const shellArgs = isWindows ? ['-Command', command] : ['-c', command];
|
|
19
|
+
// Spawn the process
|
|
20
|
+
const childProcess = spawn(shell, shellArgs, {
|
|
21
|
+
cwd,
|
|
22
|
+
windowsHide: true,
|
|
23
|
+
});
|
|
24
|
+
let stdout = '';
|
|
25
|
+
let stderr = '';
|
|
26
|
+
// Capture stdout with streaming
|
|
27
|
+
childProcess.stdout?.on('data', (data) => {
|
|
28
|
+
const chunk = data.toString();
|
|
29
|
+
stdout += chunk;
|
|
30
|
+
// Stream to callback if provided
|
|
31
|
+
if (onData) {
|
|
32
|
+
onData(chunk, 'stdout');
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
// Capture stderr with streaming
|
|
36
|
+
childProcess.stderr?.on('data', (data) => {
|
|
37
|
+
const chunk = data.toString();
|
|
38
|
+
stderr += chunk;
|
|
39
|
+
// Stream to callback if provided
|
|
40
|
+
if (onData) {
|
|
41
|
+
onData(chunk, 'stderr');
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
// Handle process completion
|
|
45
|
+
childProcess.on('close', (exitCode) => {
|
|
46
|
+
resolve({
|
|
47
|
+
stdout,
|
|
48
|
+
stderr,
|
|
49
|
+
exitCode: exitCode ?? 0,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
// Handle process errors
|
|
53
|
+
childProcess.on('error', (error) => {
|
|
54
|
+
resolve({
|
|
55
|
+
stdout,
|
|
56
|
+
stderr: stderr || error.message,
|
|
57
|
+
exitCode: 1,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,UAAU,eAAe;IAC7B,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,WAAW,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,GAAW,EACX,MAA2D;IAE3D,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C1B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,4BAA4B;QAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,QAAuB,EAAE,EAAE;YACnD,OAAO,CAAC;gBACN,MAAM;gBACN,MAAM;gBACN,QAAQ,EAAE,QAAQ,IAAI,CAAC;aACxB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,wBAAwB;QACxB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;YACxC,OAAO,CAAC;gBACN,MAAM;gBACN,MAAM,EAAE,MAAM,IAAI,KAAK,CAAC,OAAO;gBAC/B,QAAQ,EAAE,CAAC;aACZ,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global state manager for CLI modes and settings
|
|
3
|
+
*/
|
|
4
|
+
export declare class StateManager {
|
|
5
|
+
private static instance;
|
|
6
|
+
private autoAcceptMode;
|
|
7
|
+
private constructor();
|
|
8
|
+
static getInstance(): StateManager;
|
|
9
|
+
isAutoAcceptMode(): boolean;
|
|
10
|
+
setAutoAcceptMode(enabled: boolean): void;
|
|
11
|
+
toggleAutoAcceptMode(): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/utils/state.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IACtC,OAAO,CAAC,cAAc,CAAkB;IAExC,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC,gBAAgB,IAAI,OAAO;IAI3B,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIzC,oBAAoB,IAAI,OAAO;CAIhC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global state manager for CLI modes and settings
|
|
3
|
+
*/
|
|
4
|
+
export class StateManager {
|
|
5
|
+
static instance;
|
|
6
|
+
autoAcceptMode = false;
|
|
7
|
+
constructor() { }
|
|
8
|
+
static getInstance() {
|
|
9
|
+
if (!StateManager.instance) {
|
|
10
|
+
StateManager.instance = new StateManager();
|
|
11
|
+
}
|
|
12
|
+
return StateManager.instance;
|
|
13
|
+
}
|
|
14
|
+
isAutoAcceptMode() {
|
|
15
|
+
return this.autoAcceptMode;
|
|
16
|
+
}
|
|
17
|
+
setAutoAcceptMode(enabled) {
|
|
18
|
+
this.autoAcceptMode = enabled;
|
|
19
|
+
}
|
|
20
|
+
toggleAutoAcceptMode() {
|
|
21
|
+
this.autoAcceptMode = !this.autoAcceptMode;
|
|
22
|
+
return this.autoAcceptMode;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/utils/state.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,YAAY;IACf,MAAM,CAAC,QAAQ,CAAe;IAC9B,cAAc,GAAY,KAAK,CAAC;IAExC,gBAAuB,CAAC;IAExB,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC3B,YAAY,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC7C,CAAC;QACD,OAAO,YAAY,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,iBAAiB,CAAC,OAAgB;QAChC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAChC,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC;QAC3C,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "centaurus-cli",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "A powerful command-line AI coding assistant with Google Gemini and OpenRouter support",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"centaurus": "./dist/index.js",
|
|
9
|
+
"centaurus-cli": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"start": "node dist/index.js",
|
|
15
|
+
"prepublishOnly": "npm run build",
|
|
16
|
+
"postinstall": "node postinstall.js || true",
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"ai",
|
|
21
|
+
"cli",
|
|
22
|
+
"coding-assistant",
|
|
23
|
+
"gemini",
|
|
24
|
+
"openrouter",
|
|
25
|
+
"agentic",
|
|
26
|
+
"code-editor",
|
|
27
|
+
"ai-assistant",
|
|
28
|
+
"terminal",
|
|
29
|
+
"developer-tools",
|
|
30
|
+
"chatgpt",
|
|
31
|
+
"llm",
|
|
32
|
+
"artificial-intelligence"
|
|
33
|
+
],
|
|
34
|
+
"author": "Rohan Abhilash S",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/Rohan-Abhilash/centaurus-cli.git"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/Rohan-Abhilash/centaurus-cli/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/Rohan-Abhilash/centaurus-cli#readme",
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"postinstall.js",
|
|
50
|
+
"README.md",
|
|
51
|
+
"LICENSE",
|
|
52
|
+
"CONFIG_GUIDE.md",
|
|
53
|
+
"AUTH_FLOW.md"
|
|
54
|
+
],
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@google/generative-ai": "^0.24.1",
|
|
57
|
+
"@types/node": "^24.7.2",
|
|
58
|
+
"@types/react": "^18.3.26",
|
|
59
|
+
"axios": "^1.12.2",
|
|
60
|
+
"boxen": "^8.0.1",
|
|
61
|
+
"chalk": "^5.6.2",
|
|
62
|
+
"cheerio": "^1.1.2",
|
|
63
|
+
"cli-highlight": "^2.1.11",
|
|
64
|
+
"commander": "^14.0.1",
|
|
65
|
+
"diff": "^8.0.2",
|
|
66
|
+
"dotenv": "^17.2.3",
|
|
67
|
+
"ink": "^4.4.1",
|
|
68
|
+
"ink-select-input": "^5.0.0",
|
|
69
|
+
"ink-spinner": "^5.0.0",
|
|
70
|
+
"ink-text-input": "^5.0.1",
|
|
71
|
+
"open": "^10.1.0",
|
|
72
|
+
"react": "^18.3.1",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"wrap-ansi": "^9.0.2"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@types/inquirer": "^9.0.9",
|
|
78
|
+
"prettier": "^3.6.2",
|
|
79
|
+
"ts-node": "^10.9.2"
|
|
80
|
+
}
|
|
81
|
+
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post-install script for Centaurus CLI
|
|
5
|
+
* Shows helpful information after installation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import boxen from 'boxen';
|
|
10
|
+
|
|
11
|
+
const message = `
|
|
12
|
+
${chalk.bold.cyan('🎉 Centaurus CLI installed successfully!')}
|
|
13
|
+
|
|
14
|
+
${chalk.bold('Quick Start:')}
|
|
15
|
+
|
|
16
|
+
1. Run Centaurus in any directory:
|
|
17
|
+
${chalk.cyan('$ centaurus')}
|
|
18
|
+
|
|
19
|
+
2. Configure your API keys:
|
|
20
|
+
${chalk.cyan('/config set googleApiKey YOUR_KEY')}
|
|
21
|
+
|
|
22
|
+
3. Start chatting with AI!
|
|
23
|
+
|
|
24
|
+
${chalk.bold('Get API Keys:')}
|
|
25
|
+
• Google AI: ${chalk.blue('https://makersuite.google.com/app/apikey')}
|
|
26
|
+
• OpenRouter: ${chalk.blue('https://openrouter.ai/keys')}
|
|
27
|
+
|
|
28
|
+
${chalk.bold('Documentation:')}
|
|
29
|
+
• README: ${chalk.blue('https://github.com/yourusername/centaurus-cli')}
|
|
30
|
+
• Config Guide: Run ${chalk.cyan('centaurus')} and type ${chalk.cyan('/help')}
|
|
31
|
+
|
|
32
|
+
${chalk.bold('Need Help?')}
|
|
33
|
+
• Type ${chalk.cyan('/help')} in the CLI
|
|
34
|
+
• Visit: ${chalk.blue('https://github.com/yourusername/centaurus-cli/issues')}
|
|
35
|
+
|
|
36
|
+
${chalk.dim('Made with ❤️ by developers, for developers')}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
console.log(
|
|
40
|
+
boxen(message, {
|
|
41
|
+
padding: 1,
|
|
42
|
+
margin: 1,
|
|
43
|
+
borderStyle: 'round',
|
|
44
|
+
borderColor: 'cyan',
|
|
45
|
+
})
|
|
46
|
+
);
|