@shareai-lab/kode 1.0.69 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -72
- package/README.zh-CN.md +246 -0
- package/cli.js +62 -0
- package/package.json +45 -25
- package/scripts/postinstall.js +56 -0
- package/src/ProjectOnboarding.tsx +180 -0
- package/src/Tool.ts +53 -0
- package/src/commands/approvedTools.ts +53 -0
- package/src/commands/bug.tsx +20 -0
- package/src/commands/clear.ts +43 -0
- package/src/commands/compact.ts +120 -0
- package/src/commands/config.tsx +19 -0
- package/src/commands/cost.ts +18 -0
- package/src/commands/ctx_viz.ts +209 -0
- package/src/commands/doctor.ts +24 -0
- package/src/commands/help.tsx +19 -0
- package/src/commands/init.ts +37 -0
- package/src/commands/listen.ts +42 -0
- package/src/commands/login.tsx +51 -0
- package/src/commands/logout.tsx +40 -0
- package/src/commands/mcp.ts +41 -0
- package/src/commands/model.tsx +40 -0
- package/src/commands/modelstatus.tsx +20 -0
- package/src/commands/onboarding.tsx +34 -0
- package/src/commands/pr_comments.ts +59 -0
- package/src/commands/refreshCommands.ts +54 -0
- package/src/commands/release-notes.ts +34 -0
- package/src/commands/resume.tsx +30 -0
- package/src/commands/review.ts +49 -0
- package/src/commands/terminalSetup.ts +221 -0
- package/src/commands.ts +136 -0
- package/src/components/ApproveApiKey.tsx +93 -0
- package/src/components/AsciiLogo.tsx +13 -0
- package/src/components/AutoUpdater.tsx +148 -0
- package/src/components/Bug.tsx +367 -0
- package/src/components/Config.tsx +289 -0
- package/src/components/ConsoleOAuthFlow.tsx +326 -0
- package/src/components/Cost.tsx +23 -0
- package/src/components/CostThresholdDialog.tsx +46 -0
- package/src/components/CustomSelect/option-map.ts +42 -0
- package/src/components/CustomSelect/select-option.tsx +52 -0
- package/src/components/CustomSelect/select.tsx +143 -0
- package/src/components/CustomSelect/use-select-state.ts +414 -0
- package/src/components/CustomSelect/use-select.ts +35 -0
- package/src/components/FallbackToolUseRejectedMessage.tsx +15 -0
- package/src/components/FileEditToolUpdatedMessage.tsx +66 -0
- package/src/components/Help.tsx +215 -0
- package/src/components/HighlightedCode.tsx +33 -0
- package/src/components/InvalidConfigDialog.tsx +113 -0
- package/src/components/Link.tsx +32 -0
- package/src/components/LogSelector.tsx +86 -0
- package/src/components/Logo.tsx +145 -0
- package/src/components/MCPServerApprovalDialog.tsx +100 -0
- package/src/components/MCPServerDialogCopy.tsx +25 -0
- package/src/components/MCPServerMultiselectDialog.tsx +109 -0
- package/src/components/Message.tsx +219 -0
- package/src/components/MessageResponse.tsx +15 -0
- package/src/components/MessageSelector.tsx +211 -0
- package/src/components/ModeIndicator.tsx +88 -0
- package/src/components/ModelConfig.tsx +301 -0
- package/src/components/ModelListManager.tsx +223 -0
- package/src/components/ModelSelector.tsx +3208 -0
- package/src/components/ModelStatusDisplay.tsx +228 -0
- package/src/components/Onboarding.tsx +274 -0
- package/src/components/PressEnterToContinue.tsx +11 -0
- package/src/components/PromptInput.tsx +710 -0
- package/src/components/SentryErrorBoundary.ts +33 -0
- package/src/components/Spinner.tsx +129 -0
- package/src/components/StructuredDiff.tsx +184 -0
- package/src/components/TextInput.tsx +246 -0
- package/src/components/TokenWarning.tsx +31 -0
- package/src/components/ToolUseLoader.tsx +40 -0
- package/src/components/TrustDialog.tsx +106 -0
- package/src/components/binary-feedback/BinaryFeedback.tsx +63 -0
- package/src/components/binary-feedback/BinaryFeedbackOption.tsx +111 -0
- package/src/components/binary-feedback/BinaryFeedbackView.tsx +172 -0
- package/src/components/binary-feedback/utils.ts +220 -0
- package/src/components/messages/AssistantBashOutputMessage.tsx +22 -0
- package/src/components/messages/AssistantLocalCommandOutputMessage.tsx +45 -0
- package/src/components/messages/AssistantRedactedThinkingMessage.tsx +19 -0
- package/src/components/messages/AssistantTextMessage.tsx +144 -0
- package/src/components/messages/AssistantThinkingMessage.tsx +40 -0
- package/src/components/messages/AssistantToolUseMessage.tsx +123 -0
- package/src/components/messages/UserBashInputMessage.tsx +28 -0
- package/src/components/messages/UserCommandMessage.tsx +30 -0
- package/src/components/messages/UserKodingInputMessage.tsx +28 -0
- package/src/components/messages/UserPromptMessage.tsx +35 -0
- package/src/components/messages/UserTextMessage.tsx +39 -0
- package/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.tsx +12 -0
- package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.tsx +36 -0
- package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.tsx +31 -0
- package/src/components/messages/UserToolResultMessage/UserToolResultMessage.tsx +57 -0
- package/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.tsx +35 -0
- package/src/components/messages/UserToolResultMessage/utils.tsx +56 -0
- package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.tsx +121 -0
- package/src/components/permissions/FallbackPermissionRequest.tsx +155 -0
- package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx +182 -0
- package/src/components/permissions/FileEditPermissionRequest/FileEditToolDiff.tsx +75 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx +164 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.tsx +81 -0
- package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.tsx +242 -0
- package/src/components/permissions/PermissionRequest.tsx +103 -0
- package/src/components/permissions/PermissionRequestTitle.tsx +69 -0
- package/src/components/permissions/hooks.ts +44 -0
- package/src/components/permissions/toolUseOptions.ts +59 -0
- package/src/components/permissions/utils.ts +23 -0
- package/src/constants/betas.ts +5 -0
- package/src/constants/claude-asterisk-ascii-art.tsx +238 -0
- package/src/constants/figures.ts +4 -0
- package/src/constants/keys.ts +3 -0
- package/src/constants/macros.ts +6 -0
- package/src/constants/models.ts +935 -0
- package/src/constants/oauth.ts +18 -0
- package/src/constants/product.ts +17 -0
- package/src/constants/prompts.ts +177 -0
- package/src/constants/releaseNotes.ts +7 -0
- package/src/context/PermissionContext.tsx +149 -0
- package/src/context.ts +278 -0
- package/src/cost-tracker.ts +84 -0
- package/src/entrypoints/cli.tsx +1498 -0
- package/src/entrypoints/mcp.ts +176 -0
- package/src/history.ts +25 -0
- package/src/hooks/useApiKeyVerification.ts +59 -0
- package/src/hooks/useArrowKeyHistory.ts +55 -0
- package/src/hooks/useCanUseTool.ts +138 -0
- package/src/hooks/useCancelRequest.ts +39 -0
- package/src/hooks/useDoublePress.ts +42 -0
- package/src/hooks/useExitOnCtrlCD.ts +31 -0
- package/src/hooks/useInterval.ts +25 -0
- package/src/hooks/useLogMessages.ts +16 -0
- package/src/hooks/useLogStartupTime.ts +12 -0
- package/src/hooks/useNotifyAfterTimeout.ts +65 -0
- package/src/hooks/usePermissionRequestLogging.ts +44 -0
- package/src/hooks/useSlashCommandTypeahead.ts +137 -0
- package/src/hooks/useTerminalSize.ts +49 -0
- package/src/hooks/useTextInput.ts +315 -0
- package/src/messages.ts +37 -0
- package/src/permissions.ts +268 -0
- package/src/query.ts +704 -0
- package/src/screens/ConfigureNpmPrefix.tsx +197 -0
- package/src/screens/Doctor.tsx +219 -0
- package/src/screens/LogList.tsx +68 -0
- package/src/screens/REPL.tsx +792 -0
- package/src/screens/ResumeConversation.tsx +68 -0
- package/src/services/browserMocks.ts +66 -0
- package/src/services/claude.ts +1947 -0
- package/src/services/customCommands.ts +683 -0
- package/src/services/fileFreshness.ts +377 -0
- package/src/services/mcpClient.ts +564 -0
- package/src/services/mcpServerApproval.tsx +50 -0
- package/src/services/notifier.ts +40 -0
- package/src/services/oauth.ts +357 -0
- package/src/services/openai.ts +796 -0
- package/src/services/sentry.ts +3 -0
- package/src/services/statsig.ts +171 -0
- package/src/services/statsigStorage.ts +86 -0
- package/src/services/systemReminder.ts +406 -0
- package/src/services/vcr.ts +161 -0
- package/src/tools/ArchitectTool/ArchitectTool.tsx +122 -0
- package/src/tools/ArchitectTool/prompt.ts +15 -0
- package/src/tools/AskExpertModelTool/AskExpertModelTool.tsx +505 -0
- package/src/tools/BashTool/BashTool.tsx +270 -0
- package/src/tools/BashTool/BashToolResultMessage.tsx +38 -0
- package/src/tools/BashTool/OutputLine.tsx +48 -0
- package/src/tools/BashTool/prompt.ts +174 -0
- package/src/tools/BashTool/utils.ts +56 -0
- package/src/tools/FileEditTool/FileEditTool.tsx +316 -0
- package/src/tools/FileEditTool/prompt.ts +51 -0
- package/src/tools/FileEditTool/utils.ts +58 -0
- package/src/tools/FileReadTool/FileReadTool.tsx +371 -0
- package/src/tools/FileReadTool/prompt.ts +7 -0
- package/src/tools/FileWriteTool/FileWriteTool.tsx +297 -0
- package/src/tools/FileWriteTool/prompt.ts +10 -0
- package/src/tools/GlobTool/GlobTool.tsx +119 -0
- package/src/tools/GlobTool/prompt.ts +8 -0
- package/src/tools/GrepTool/GrepTool.tsx +147 -0
- package/src/tools/GrepTool/prompt.ts +11 -0
- package/src/tools/MCPTool/MCPTool.tsx +106 -0
- package/src/tools/MCPTool/prompt.ts +3 -0
- package/src/tools/MemoryReadTool/MemoryReadTool.tsx +127 -0
- package/src/tools/MemoryReadTool/prompt.ts +3 -0
- package/src/tools/MemoryWriteTool/MemoryWriteTool.tsx +89 -0
- package/src/tools/MemoryWriteTool/prompt.ts +3 -0
- package/src/tools/MultiEditTool/MultiEditTool.tsx +366 -0
- package/src/tools/MultiEditTool/prompt.ts +45 -0
- package/src/tools/NotebookEditTool/NotebookEditTool.tsx +298 -0
- package/src/tools/NotebookEditTool/prompt.ts +3 -0
- package/src/tools/NotebookReadTool/NotebookReadTool.tsx +266 -0
- package/src/tools/NotebookReadTool/prompt.ts +3 -0
- package/src/tools/StickerRequestTool/StickerRequestTool.tsx +93 -0
- package/src/tools/StickerRequestTool/prompt.ts +19 -0
- package/src/tools/TaskTool/TaskTool.tsx +382 -0
- package/src/tools/TaskTool/constants.ts +1 -0
- package/src/tools/TaskTool/prompt.ts +56 -0
- package/src/tools/ThinkTool/ThinkTool.tsx +56 -0
- package/src/tools/ThinkTool/prompt.ts +12 -0
- package/src/tools/TodoWriteTool/TodoWriteTool.tsx +289 -0
- package/src/tools/TodoWriteTool/prompt.ts +63 -0
- package/src/tools/lsTool/lsTool.tsx +269 -0
- package/src/tools/lsTool/prompt.ts +2 -0
- package/src/tools.ts +63 -0
- package/src/types/PermissionMode.ts +120 -0
- package/src/types/RequestContext.ts +72 -0
- package/src/utils/Cursor.ts +436 -0
- package/src/utils/PersistentShell.ts +373 -0
- package/src/utils/agentStorage.ts +97 -0
- package/src/utils/array.ts +3 -0
- package/src/utils/ask.tsx +98 -0
- package/src/utils/auth.ts +13 -0
- package/src/utils/autoCompactCore.ts +223 -0
- package/src/utils/autoUpdater.ts +318 -0
- package/src/utils/betas.ts +20 -0
- package/src/utils/browser.ts +14 -0
- package/src/utils/cleanup.ts +72 -0
- package/src/utils/commands.ts +261 -0
- package/src/utils/config.ts +771 -0
- package/src/utils/conversationRecovery.ts +54 -0
- package/src/utils/debugLogger.ts +1123 -0
- package/src/utils/diff.ts +42 -0
- package/src/utils/env.ts +57 -0
- package/src/utils/errors.ts +21 -0
- package/src/utils/exampleCommands.ts +108 -0
- package/src/utils/execFileNoThrow.ts +51 -0
- package/src/utils/expertChatStorage.ts +136 -0
- package/src/utils/file.ts +402 -0
- package/src/utils/fileRecoveryCore.ts +71 -0
- package/src/utils/format.tsx +44 -0
- package/src/utils/generators.ts +62 -0
- package/src/utils/git.ts +92 -0
- package/src/utils/globalLogger.ts +77 -0
- package/src/utils/http.ts +10 -0
- package/src/utils/imagePaste.ts +38 -0
- package/src/utils/json.ts +13 -0
- package/src/utils/log.ts +382 -0
- package/src/utils/markdown.ts +213 -0
- package/src/utils/messageContextManager.ts +289 -0
- package/src/utils/messages.tsx +938 -0
- package/src/utils/model.ts +836 -0
- package/src/utils/permissions/filesystem.ts +118 -0
- package/src/utils/ripgrep.ts +167 -0
- package/src/utils/sessionState.ts +49 -0
- package/src/utils/state.ts +25 -0
- package/src/utils/style.ts +29 -0
- package/src/utils/terminal.ts +49 -0
- package/src/utils/theme.ts +122 -0
- package/src/utils/thinking.ts +144 -0
- package/src/utils/todoStorage.ts +431 -0
- package/src/utils/tokens.ts +43 -0
- package/src/utils/toolExecutionController.ts +163 -0
- package/src/utils/unaryLogging.ts +26 -0
- package/src/utils/user.ts +37 -0
- package/src/utils/validate.ts +165 -0
- package/cli.mjs +0 -1803
package/README.md
CHANGED
|
@@ -1,113 +1,246 @@
|
|
|
1
|
-
# Kode
|
|
1
|
+
# Kode - AI Assistant for Your Terminal
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@shareai-lab/kode)
|
|
4
|
+
[](https://opensource.org/licenses/ISC)
|
|
5
|
+
|
|
6
|
+
[中文文档](README.zh-CN.md) | [Contributing](CONTRIBUTING.md) | [Documentation](docs/)
|
|
7
|
+
|
|
8
|
+
Kode is a powerful AI assistant that lives in your terminal. It can understand your codebase, edit files, run commands, and handle entire workflows for you.
|
|
4
9
|
|
|
5
10
|
## Features
|
|
6
11
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- 🤖 **AI-Powered Assistance** - Uses advanced AI models to understand and respond to your requests
|
|
13
|
+
- 🔄 **Multi-Model Collaboration** - Flexibly switch and combine multiple AI models to leverage their unique strengths
|
|
14
|
+
- 📝 **Code Editing** - Directly edit files with intelligent suggestions and improvements
|
|
15
|
+
- 🔍 **Codebase Understanding** - Analyzes your project structure and code relationships
|
|
16
|
+
- 🚀 **Command Execution** - Run shell commands and see results in real-time
|
|
17
|
+
- 🛠️ **Workflow Automation** - Handle complex development tasks with simple prompts
|
|
18
|
+
- 🎨 **Interactive UI** - Beautiful terminal interface with syntax highlighting
|
|
19
|
+
- 🔌 **Tool System** - Extensible architecture with specialized tools for different tasks
|
|
20
|
+
- 💾 **Context Management** - Smart context handling to maintain conversation continuity
|
|
15
21
|
|
|
16
22
|
## Installation
|
|
17
23
|
|
|
18
24
|
```bash
|
|
19
|
-
|
|
25
|
+
npm install -g @shareai-lab/kode
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
After installation, you can use any of these commands:
|
|
29
|
+
- `kode` - Primary command
|
|
30
|
+
- `kwa` - Kode With Agent (alternative)
|
|
31
|
+
- `kd` - Ultra-short alias
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Interactive Mode
|
|
36
|
+
Start an interactive session:
|
|
37
|
+
```bash
|
|
38
|
+
kode
|
|
39
|
+
# or
|
|
40
|
+
kwa
|
|
41
|
+
# or
|
|
42
|
+
kd
|
|
20
43
|
```
|
|
21
44
|
|
|
22
|
-
|
|
45
|
+
### Non-Interactive Mode
|
|
46
|
+
Get a quick response:
|
|
47
|
+
```bash
|
|
48
|
+
kode -p "explain this function" main.js
|
|
49
|
+
# or
|
|
50
|
+
kwa -p "explain this function" main.js
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Commands
|
|
54
|
+
|
|
55
|
+
- `/help` - Show available commands
|
|
56
|
+
- `/model` - Change AI model settings
|
|
57
|
+
- `/config` - Open configuration panel
|
|
58
|
+
- `/cost` - Show token usage and costs
|
|
59
|
+
- `/clear` - Clear conversation history
|
|
60
|
+
- `/init` - Initialize project context
|
|
61
|
+
|
|
62
|
+
## Multi-Model Intelligent Collaboration
|
|
63
|
+
|
|
64
|
+
Unlike official Claude which supports only a single model, Kode implements **true multi-model collaboration**, allowing you to fully leverage the unique strengths of different AI models.
|
|
65
|
+
|
|
66
|
+
### 🏗️ Core Technical Architecture
|
|
67
|
+
|
|
68
|
+
#### 1. **ModelManager Multi-Model Manager**
|
|
69
|
+
We designed a unified `ModelManager` system that supports:
|
|
70
|
+
- **Model Profiles**: Each model has an independent configuration file containing API endpoints, authentication, context window size, cost parameters, etc.
|
|
71
|
+
- **Model Pointers**: Users can configure default models for different purposes in the `/model` command:
|
|
72
|
+
- `main`: Default model for main Agent
|
|
73
|
+
- `task`: Default model for SubAgent
|
|
74
|
+
- `reasoning`: Reserved for future ThinkTool usage
|
|
75
|
+
- `quick`: Fast model for simple NLP tasks (security identification, title generation, etc.)
|
|
76
|
+
- **Dynamic Model Switching**: Support runtime model switching without restarting sessions, maintaining context continuity
|
|
77
|
+
|
|
78
|
+
#### 2. **TaskTool Intelligent Task Distribution**
|
|
79
|
+
Our specially designed `TaskTool` (Architect tool) implements:
|
|
80
|
+
- **Subagent Mechanism**: Can launch multiple sub-agents to process tasks in parallel
|
|
81
|
+
- **Model Parameter Passing**: Users can specify which model SubAgents should use in their requests
|
|
82
|
+
- **Default Model Configuration**: SubAgents use the model configured by the `task` pointer by default
|
|
83
|
+
|
|
84
|
+
#### 3. **AskExpertModel Expert Consultation Tool**
|
|
85
|
+
We specially designed the `AskExpertModel` tool:
|
|
86
|
+
- **Expert Model Invocation**: Allows temporarily calling specific expert models to solve difficult problems during conversations
|
|
87
|
+
- **Model Isolation Execution**: Expert model responses are processed independently without affecting the main conversation flow
|
|
88
|
+
- **Knowledge Integration**: Integrates expert model insights into the current task
|
|
89
|
+
|
|
90
|
+
#### 🎯 Flexible Model Switching
|
|
91
|
+
- **Tab Key Quick Switch**: Press Tab in the input box to quickly switch the model for the current conversation
|
|
92
|
+
- **`/model` Command**: Use `/model` command to configure and manage multiple model profiles, set default models for different purposes
|
|
93
|
+
- **User Control**: Users can specify specific models for task processing at any time
|
|
94
|
+
|
|
95
|
+
#### 🔄 Intelligent Work Allocation Strategy
|
|
96
|
+
|
|
97
|
+
**Architecture Design Phase**
|
|
98
|
+
- Use **o3 model** or **GPT-5 model** to explore system architecture and formulate sharp and clear technical solutions
|
|
99
|
+
- These models excel in abstract thinking and system design
|
|
100
|
+
|
|
101
|
+
**Solution Refinement Phase**
|
|
102
|
+
- Use **gemini model** to deeply explore production environment design details
|
|
103
|
+
- Leverage its deep accumulation in practical engineering and balanced reasoning capabilities
|
|
104
|
+
|
|
105
|
+
**Code Implementation Phase**
|
|
106
|
+
- Use **Qwen Coder model**, **Kimi k2 model**, **GLM-4.5 model**, or **Claude Sonnet 4 model** for specific code writing
|
|
107
|
+
- These models have strong performance in code generation, file editing, and engineering implementation
|
|
108
|
+
- Support parallel processing of multiple coding tasks through subagents
|
|
109
|
+
|
|
110
|
+
**Problem Solving**
|
|
111
|
+
- When encountering complex problems, consult expert models like **o3 model**, **Claude Opus 4.1 model**, or **Grok 4 model**
|
|
112
|
+
- Obtain deep technical insights and innovative solutions
|
|
113
|
+
|
|
114
|
+
#### 💡 Practical Application Scenarios
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Example 1: Architecture Design
|
|
118
|
+
"Use o3 model to help me design a high-concurrency message queue system architecture"
|
|
119
|
+
|
|
120
|
+
# Example 2: Multi-Model Collaboration
|
|
121
|
+
"First use GPT-5 model to analyze the root cause of this performance issue, then use Claude Sonnet 4 model to write optimization code"
|
|
23
122
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
3. **OpenAI-Compatible**: Works with any OpenAI-style endpoint (Ollama, OpenRouter, etc.)
|
|
123
|
+
# Example 3: Parallel Task Processing
|
|
124
|
+
"Use Qwen Coder model as subagent to refactor these three modules simultaneously"
|
|
27
125
|
|
|
28
|
-
|
|
126
|
+
# Example 4: Expert Consultation
|
|
127
|
+
"This memory leak issue is tricky, ask Claude Opus 4.1 model separately for solutions"
|
|
29
128
|
|
|
30
|
-
|
|
129
|
+
# Example 5: Code Review
|
|
130
|
+
"Have Kimi k2 model review the code quality of this PR"
|
|
31
131
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
132
|
+
# Example 6: Complex Reasoning
|
|
133
|
+
"Use Grok 4 model to help me derive the time complexity of this algorithm"
|
|
134
|
+
|
|
135
|
+
# Example 7: Solution Design
|
|
136
|
+
"Have GLM-4.5 model design a microservice decomposition plan"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 🛠️ Key Implementation Mechanisms
|
|
140
|
+
|
|
141
|
+
#### **Configuration System**
|
|
142
|
+
```typescript
|
|
143
|
+
// Example of multi-model configuration support
|
|
35
144
|
{
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
145
|
+
"modelProfiles": {
|
|
146
|
+
"o3": { "provider": "openai", "model": "o3", "apiKey": "..." },
|
|
147
|
+
"claude4": { "provider": "anthropic", "model": "claude-sonnet-4", "apiKey": "..." },
|
|
148
|
+
"qwen": { "provider": "alibaba", "model": "qwen-coder", "apiKey": "..." }
|
|
149
|
+
},
|
|
150
|
+
"modelPointers": {
|
|
151
|
+
"main": "claude4", // Main conversation model
|
|
152
|
+
"task": "qwen", // Task execution model
|
|
153
|
+
"reasoning": "o3", // Reasoning model
|
|
154
|
+
"quick": "glm-4.5" // Quick response model
|
|
41
155
|
}
|
|
42
156
|
}
|
|
43
157
|
```
|
|
44
158
|
|
|
45
|
-
|
|
159
|
+
#### **Cost Tracking System**
|
|
160
|
+
- **Usage Statistics**: Use `/cost` command to view token usage and costs for each model
|
|
161
|
+
- **Multi-Model Cost Comparison**: Track usage costs of different models in real-time
|
|
162
|
+
- **History Records**: Save cost data for each session
|
|
46
163
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
164
|
+
#### **Context Manager**
|
|
165
|
+
- **Context Inheritance**: Maintain conversation continuity when switching models
|
|
166
|
+
- **Context Window Adaptation**: Automatically adjust based on different models' context window sizes
|
|
167
|
+
- **Session State Preservation**: Ensure information consistency during multi-model collaboration
|
|
50
168
|
|
|
51
|
-
|
|
52
|
-
pnpm run dev
|
|
169
|
+
### 🚀 Advantages of Multi-Model Collaboration
|
|
53
170
|
|
|
54
|
-
|
|
55
|
-
|
|
171
|
+
1. **Maximized Efficiency**: Each task is handled by the most suitable model
|
|
172
|
+
2. **Cost Optimization**: Use lightweight models for simple tasks, powerful models for complex tasks
|
|
173
|
+
3. **Parallel Processing**: Multiple models can work on different subtasks simultaneously
|
|
174
|
+
4. **Flexible Switching**: Switch models based on task requirements without restarting sessions
|
|
175
|
+
5. **Leveraging Strengths**: Combine advantages of different models for optimal overall results
|
|
56
176
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
177
|
+
### 📊 Comparison with Official Implementation
|
|
178
|
+
|
|
179
|
+
| Feature | Kode | Official Claude |
|
|
180
|
+
|---------|------|-----------------|
|
|
181
|
+
| Number of Supported Models | Unlimited, configurable for any model | Only supports single Claude model |
|
|
182
|
+
| Model Switching | ✅ Tab key quick switch | ❌ Requires session restart |
|
|
183
|
+
| Parallel Processing | ✅ Multiple SubAgents work in parallel | ❌ Single-threaded processing |
|
|
184
|
+
| Cost Tracking | ✅ Separate statistics for multiple models | ❌ Single model cost |
|
|
185
|
+
| Task Model Configuration | ✅ Different default models for different purposes | ❌ Same model for all tasks |
|
|
186
|
+
| Expert Consultation | ✅ AskExpertModel tool | ❌ Not supported |
|
|
187
|
+
|
|
188
|
+
This multi-model collaboration capability makes Kode a true **AI Development Workbench**, not just a single AI assistant.
|
|
189
|
+
|
|
190
|
+
## Development
|
|
60
191
|
|
|
61
|
-
|
|
192
|
+
Kode is built with modern tools and requires [Bun](https://bun.sh) for development.
|
|
62
193
|
|
|
63
|
-
|
|
64
|
-
- **18 Core Tools** - File operations, shell execution, AI workflows, checkpoints
|
|
65
|
-
- **Multi-Provider** - Anthropic Claude, OpenAI, custom endpoints
|
|
66
|
-
- **TypeScript** - Full type safety throughout
|
|
67
|
-
- **MCP Compatible** - Model Context Protocol integration
|
|
68
|
-
- **Smart Workflows** - Checkpoint system and worktree management
|
|
194
|
+
### Install Bun
|
|
69
195
|
|
|
70
|
-
|
|
196
|
+
```bash
|
|
197
|
+
# macOS/Linux
|
|
198
|
+
curl -fsSL https://bun.sh/install | bash
|
|
71
199
|
|
|
72
|
-
|
|
200
|
+
# Windows
|
|
201
|
+
powershell -c "irm bun.sh/install.ps1 | iex"
|
|
202
|
+
```
|
|
73
203
|
|
|
74
|
-
###
|
|
75
|
-
Intelligent project state management with automatic analysis and recovery:
|
|
76
|
-
- **`/checkpoint-save`** - Smart analysis and state preservation
|
|
77
|
-
- **`/checkpoint-restore`** - Natural language version recovery
|
|
204
|
+
### Setup Development Environment
|
|
78
205
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- **`/worktree-merge`** - Safe integration with quality gates
|
|
206
|
+
```bash
|
|
207
|
+
# Clone the repository
|
|
208
|
+
git clone https://github.com/shareAI-lab/kode.git
|
|
209
|
+
cd kode
|
|
84
210
|
|
|
85
|
-
|
|
211
|
+
# Install dependencies
|
|
212
|
+
bun install
|
|
86
213
|
|
|
87
|
-
|
|
214
|
+
# Run in development mode
|
|
215
|
+
bun run dev
|
|
216
|
+
```
|
|
88
217
|
|
|
89
|
-
|
|
218
|
+
### Build
|
|
90
219
|
|
|
91
|
-
|
|
220
|
+
```bash
|
|
221
|
+
bun run build
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Testing
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Run tests
|
|
228
|
+
bun test
|
|
92
229
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
230
|
+
# Test the CLI
|
|
231
|
+
./cli.js --help
|
|
232
|
+
```
|
|
96
233
|
|
|
97
|
-
##
|
|
234
|
+
## Contributing
|
|
98
235
|
|
|
99
|
-
|
|
100
|
-
- **Issues**: [https://github.com/shareAI-lab/agent-kode/issues](https://github.com/shareAI-lab/agent-kode/issues)
|
|
236
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
101
237
|
|
|
102
238
|
## License
|
|
103
239
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
---
|
|
240
|
+
ISC License - see [LICENSE](LICENSE) for details.
|
|
107
241
|
|
|
108
|
-
|
|
242
|
+
## Support
|
|
109
243
|
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
- some system design learn from claude code
|
|
244
|
+
- 📚 [Documentation](docs/)
|
|
245
|
+
- 🐛 [Report Issues](https://github.com/shareAI-lab/kode/issues)
|
|
246
|
+
- 💬 [Discussions](https://github.com/shareAI-lab/kode/discussions)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Kode - 终端 AI 助手
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@shareai-lab/kode)
|
|
4
|
+
[](https://opensource.org/licenses/ISC)
|
|
5
|
+
|
|
6
|
+
[English](README.md) | [贡献指南](CONTRIBUTING.md) | [文档](docs/)
|
|
7
|
+
|
|
8
|
+
Kode 是一个强大的 AI 助手,运行在你的终端中。它能理解你的代码库、编辑文件、运行命令,并为你处理整个开发工作流。
|
|
9
|
+
|
|
10
|
+
## 功能特性
|
|
11
|
+
|
|
12
|
+
- 🤖 **AI 驱动的助手** - 使用先进的 AI 模型理解并响应你的请求
|
|
13
|
+
- 🔄 **多模型协同** - 灵活切换和组合使用多个 AI 模型,发挥各自优势
|
|
14
|
+
- 📝 **代码编辑** - 直接编辑文件,提供智能建议和改进
|
|
15
|
+
- 🔍 **代码库理解** - 分析项目结构和代码关系
|
|
16
|
+
- 🚀 **命令执行** - 实时运行 shell 命令并查看结果
|
|
17
|
+
- 🛠️ **工作流自动化** - 用简单的提示处理复杂的开发任务
|
|
18
|
+
- 🎨 **交互式界面** - 美观的终端界面,支持语法高亮
|
|
19
|
+
- 🔌 **工具系统** - 可扩展的架构,为不同任务提供专门的工具
|
|
20
|
+
- 💾 **上下文管理** - 智能的上下文处理,保持对话连续性
|
|
21
|
+
|
|
22
|
+
## 安装
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @shareai-lab/kode
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
安装后,你可以使用以下任一命令:
|
|
29
|
+
- `kode` - 主命令
|
|
30
|
+
- `kwa` - Kode With Agent(备选)
|
|
31
|
+
- `kd` - 超短别名
|
|
32
|
+
|
|
33
|
+
## 使用方法
|
|
34
|
+
|
|
35
|
+
### 交互模式
|
|
36
|
+
启动交互式会话:
|
|
37
|
+
```bash
|
|
38
|
+
kode
|
|
39
|
+
# 或
|
|
40
|
+
kwa
|
|
41
|
+
# 或
|
|
42
|
+
kd
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 非交互模式
|
|
46
|
+
获取快速响应:
|
|
47
|
+
```bash
|
|
48
|
+
kode -p "解释这个函数" main.js
|
|
49
|
+
# 或
|
|
50
|
+
kwa -p "解释这个函数" main.js
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 常用命令
|
|
54
|
+
|
|
55
|
+
- `/help` - 显示可用命令
|
|
56
|
+
- `/model` - 更改 AI 模型设置
|
|
57
|
+
- `/config` - 打开配置面板
|
|
58
|
+
- `/cost` - 显示 token 使用量和成本
|
|
59
|
+
- `/clear` - 清除对话历史
|
|
60
|
+
- `/init` - 初始化项目上下文
|
|
61
|
+
|
|
62
|
+
## 多模型智能协同
|
|
63
|
+
|
|
64
|
+
与 CC 仅支持单一模型不同,Kode 实现了**真正的多模型协同工作**,让你能够充分发挥不同 AI 模型的独特优势。
|
|
65
|
+
|
|
66
|
+
### 🏗️ 核心技术架构
|
|
67
|
+
|
|
68
|
+
#### 1. **ModelManager 多模型管理器**
|
|
69
|
+
我们设计了统一的 `ModelManager` 系统,支持:
|
|
70
|
+
- **模型配置文件(Model Profiles)**:每个模型都有独立的配置文件,包含 API 端点、认证信息、上下文窗口大小、成本等参数
|
|
71
|
+
- **模型指针(Model Pointers)**:用户可以在 `/model` 命令中配置不同用途的默认模型:
|
|
72
|
+
- `main`:主 Agent 的默认模型
|
|
73
|
+
- `task`:SubAgent 的默认模型
|
|
74
|
+
- `reasoning`:预留给未来 ThinkTool 使用
|
|
75
|
+
- `quick`:用于简单 NLP 任务(如安全性识别、生成标题描述等)的快速模型
|
|
76
|
+
- **动态模型切换**:支持运行时切换模型,无需重启会话,保持上下文连续性
|
|
77
|
+
|
|
78
|
+
#### 2. **TaskTool 智能任务分发工具**
|
|
79
|
+
专门设计的 `TaskTool`(Architect 工具)实现了:
|
|
80
|
+
- **Subagent 机制**:可以启动多个子代理并行处理任务
|
|
81
|
+
- **模型参数传递**:用户可以在请求中指定 SubAgent 使用的模型
|
|
82
|
+
- **默认模型配置**:SubAgent 默认使用 `task` 指针配置的模型
|
|
83
|
+
|
|
84
|
+
#### 3. **AskExpertModel 专家咨询工具**
|
|
85
|
+
我们专门设计了 `AskExpertModel` 工具:
|
|
86
|
+
- **专家模型调用**:允许在对话中临时调用特定的专家模型解决疑难问题
|
|
87
|
+
- **模型隔离执行**:专家模型的响应独立处理,不影响主对话流程
|
|
88
|
+
- **知识整合**:将专家模型的见解整合到当前任务中
|
|
89
|
+
|
|
90
|
+
#### 🎯 灵活的模型切换
|
|
91
|
+
- **Tab 键快速切换**:在输入框按 Tab 键即可快速切换当前对话使用的模型
|
|
92
|
+
- **`/model` 命令**:使用 `/model` 命令配置和管理多个模型配置文件,设置不同用途的默认模型
|
|
93
|
+
- **用户控制**:用户可以随时指定使用特定的模型进行任务处理
|
|
94
|
+
|
|
95
|
+
#### 🔄 智能的工作分配策略
|
|
96
|
+
|
|
97
|
+
**架构设计阶段**
|
|
98
|
+
- 使用 **o3 模型** 或 **GPT-5 模型** 探讨系统架构,制定犀利明确的技术方案
|
|
99
|
+
- 这些模型在抽象思维和系统设计方面表现卓越
|
|
100
|
+
|
|
101
|
+
**方案细化阶段**
|
|
102
|
+
- 使用 **gemini 模型** 深入探讨生产环境的设计细节
|
|
103
|
+
- 利用其在实际工程实践中的深厚积累和平衡的推理能力
|
|
104
|
+
|
|
105
|
+
**代码实现阶段**
|
|
106
|
+
- 使用 **Qwen Coder 模型**、**Kimi k2 模型** 、**GLM-4.5 模型** 或 **Claude Sonnet 4 模型** 进行具体的代码编写
|
|
107
|
+
- 这些模型在代码生成、文件编辑和工程实现方面性能强劲
|
|
108
|
+
- 支持通过 subagent 并行处理多个编码任务
|
|
109
|
+
|
|
110
|
+
**疑难问题解决**
|
|
111
|
+
- 遇到复杂问题时,可单独咨询 **o3 模型**、**Claude Opus 4.1 模型** 或 **Grok 4 模型** 等专家模型
|
|
112
|
+
- 获得深度的技术见解和创新的解决方案
|
|
113
|
+
|
|
114
|
+
#### 💡 实际应用场景
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# 示例 1:架构设计
|
|
118
|
+
"用 o3 模型帮我设计一个高并发的消息队列系统架构"
|
|
119
|
+
|
|
120
|
+
# 示例 2:多模型协作
|
|
121
|
+
"先用 GPT-5 模型分析这个性能问题的根本原因,然后用 Claude Sonnet 4 模型编写优化代码"
|
|
122
|
+
|
|
123
|
+
# 示例 3:并行任务处理
|
|
124
|
+
"用 Qwen Coder 模型作为 subagent 同时重构这三个模块"
|
|
125
|
+
|
|
126
|
+
# 示例 4:专家咨询
|
|
127
|
+
"这个内存泄漏问题很棘手,单独问问 Claude Opus 4.1 模型有什么解决方案"
|
|
128
|
+
|
|
129
|
+
# 示例 5:代码审查
|
|
130
|
+
"让 Kimi k2 模型审查这个 PR 的代码质量"
|
|
131
|
+
|
|
132
|
+
# 示例 6:复杂推理
|
|
133
|
+
"用 Grok 4 模型帮我推导这个算法的时间复杂度"
|
|
134
|
+
|
|
135
|
+
# 示例 7:方案设计
|
|
136
|
+
"让 GLM-4.5 模型设计微服务拆分方案"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 🛠️ 关键实现机制
|
|
140
|
+
|
|
141
|
+
#### **配置系统(Configuration System)**
|
|
142
|
+
```typescript
|
|
143
|
+
// 支持多模型配置的示例
|
|
144
|
+
{
|
|
145
|
+
"modelProfiles": {
|
|
146
|
+
"o3": { "provider": "openai", "model": "o3", "apiKey": "..." },
|
|
147
|
+
"claude4": { "provider": "anthropic", "model": "claude-sonnet-4", "apiKey": "..." },
|
|
148
|
+
"qwen": { "provider": "alibaba", "model": "qwen-coder", "apiKey": "..." }
|
|
149
|
+
},
|
|
150
|
+
"modelPointers": {
|
|
151
|
+
"main": "claude4", // 主对话模型
|
|
152
|
+
"task": "qwen", // 任务执行模型
|
|
153
|
+
"reasoning": "o3", // 推理模型
|
|
154
|
+
"quick": "glm-4.5" // 快速响应模型
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### **成本追踪系统(Cost Tracking)**
|
|
160
|
+
- **使用统计**:`/cost` 命令查看各模型的 token 使用量和花费
|
|
161
|
+
- **多模型成本对比**:实时追踪不同模型的使用成本
|
|
162
|
+
- **历史记录**:保存每个会话的成本数据
|
|
163
|
+
|
|
164
|
+
#### **上下文管理器(Context Manager)**
|
|
165
|
+
- **上下文继承**:切换模型时保持对话连续性
|
|
166
|
+
- **上下文窗口适配**:根据不同模型的上下文窗口大小自动调整
|
|
167
|
+
- **会话状态保持**:确保多模型协作时的信息一致性
|
|
168
|
+
|
|
169
|
+
### 🚀 多模型协同的优势
|
|
170
|
+
|
|
171
|
+
1. **效率最大化**:每个任务都由最适合的模型处理
|
|
172
|
+
2. **成本优化**:简单任务用轻量模型,复杂任务用强大模型
|
|
173
|
+
3. **并行处理**:多个模型可以同时处理不同的子任务
|
|
174
|
+
4. **灵活切换**:根据任务需求随时切换模型,无需重启会话
|
|
175
|
+
5. **取长补短**:结合不同模型的优势,获得最佳的整体效果
|
|
176
|
+
|
|
177
|
+
### 📊 与官方实现的对比
|
|
178
|
+
|
|
179
|
+
| 特性 | Kode | 官方 CC |
|
|
180
|
+
|------|------|---------|
|
|
181
|
+
| 支持模型数量 | 无限制,可配置任意模型 | 仅支持单一 Claude 模型 |
|
|
182
|
+
| 模型切换 | ✅ Tab 键快速切换 | ❌ 需要重启会话 |
|
|
183
|
+
| 并行处理 | ✅ 多个 SubAgent 并行工作 | ❌ 单线程处理 |
|
|
184
|
+
| 成本追踪 | ✅ 多模型成本分别统计 | ❌ 单一模型成本 |
|
|
185
|
+
| 任务模型配置 | ✅ 不同用途配置不同默认模型 | ❌ 所有任务用同一模型 |
|
|
186
|
+
| 专家咨询 | ✅ AskExpertModel 工具 | ❌ 不支持 |
|
|
187
|
+
|
|
188
|
+
这种多模型协同能力让 Kode 成为真正的 **AI 开发工作台**,而不仅仅是一个单一的 AI 助手。
|
|
189
|
+
|
|
190
|
+
## 开发
|
|
191
|
+
|
|
192
|
+
Kode 使用现代化工具构建,开发需要 [Bun](https://bun.sh)。
|
|
193
|
+
|
|
194
|
+
### 安装 Bun
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# macOS/Linux
|
|
198
|
+
curl -fsSL https://bun.sh/install | bash
|
|
199
|
+
|
|
200
|
+
# Windows
|
|
201
|
+
powershell -c "irm bun.sh/install.ps1 | iex"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 设置开发环境
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# 克隆仓库
|
|
208
|
+
git clone https://github.com/shareAI-lab/kode.git
|
|
209
|
+
cd kode
|
|
210
|
+
|
|
211
|
+
# 安装依赖
|
|
212
|
+
bun install
|
|
213
|
+
|
|
214
|
+
# 在开发模式下运行
|
|
215
|
+
bun run dev
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 构建
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
bun run build
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 测试
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# 运行测试
|
|
228
|
+
bun test
|
|
229
|
+
|
|
230
|
+
# 测试 CLI
|
|
231
|
+
./cli.js --help
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## 贡献
|
|
235
|
+
|
|
236
|
+
我们欢迎贡献!请查看我们的[贡献指南](CONTRIBUTING.md)了解详情。
|
|
237
|
+
|
|
238
|
+
## 许可证
|
|
239
|
+
|
|
240
|
+
ISC 许可证 - 详见 [LICENSE](LICENSE)。
|
|
241
|
+
|
|
242
|
+
## 支持
|
|
243
|
+
|
|
244
|
+
- 📚 [文档](docs/)
|
|
245
|
+
- 🐛 [报告问题](https://github.com/shareAI-lab/kode/issues)
|
|
246
|
+
- 💬 [讨论](https://github.com/shareAI-lab/kode/discussions)
|
package/cli.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Prefer bun if available, otherwise use node with loader
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const cliPath = path.join(__dirname, 'src', 'entrypoints', 'cli.tsx');
|
|
9
|
+
|
|
10
|
+
// Try bun first
|
|
11
|
+
try {
|
|
12
|
+
const { execSync } = require('child_process');
|
|
13
|
+
execSync('bun --version', { stdio: 'ignore' });
|
|
14
|
+
|
|
15
|
+
// Bun is available
|
|
16
|
+
const child = spawn('bun', ['run', cliPath, ...args], {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
env: {
|
|
19
|
+
...process.env,
|
|
20
|
+
YOGA_WASM_PATH: path.join(__dirname, 'yoga.wasm')
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
25
|
+
child.on('error', () => {
|
|
26
|
+
// Fallback to node if bun fails
|
|
27
|
+
runWithNode();
|
|
28
|
+
});
|
|
29
|
+
} catch {
|
|
30
|
+
// Bun not available, use node
|
|
31
|
+
runWithNode();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function runWithNode() {
|
|
35
|
+
// Use node with tsx loader
|
|
36
|
+
const child = spawn('node', [
|
|
37
|
+
'--loader', 'tsx',
|
|
38
|
+
'--no-warnings',
|
|
39
|
+
cliPath,
|
|
40
|
+
...args
|
|
41
|
+
], {
|
|
42
|
+
stdio: 'inherit',
|
|
43
|
+
env: {
|
|
44
|
+
...process.env,
|
|
45
|
+
NODE_OPTIONS: '--loader tsx --no-warnings',
|
|
46
|
+
YOGA_WASM_PATH: path.join(__dirname, 'yoga.wasm')
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
child.on('error', (err) => {
|
|
51
|
+
if (err.code === 'MODULE_NOT_FOUND' || err.message.includes('tsx')) {
|
|
52
|
+
console.error('\nError: tsx is required but not installed.');
|
|
53
|
+
console.error('Please run: npm install');
|
|
54
|
+
process.exit(1);
|
|
55
|
+
} else {
|
|
56
|
+
console.error('Failed to start Kode:', err.message);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
62
|
+
}
|