blade-code 0.0.12 → 0.0.14

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.en.md CHANGED
@@ -21,7 +21,7 @@ English | [简体中文](README.md)
21
21
  <tr>
22
22
  <td width="50%" valign="top">
23
23
  <h3>🤖 Intelligent Conversations</h3>
24
- <p>Natural language interactions powered by LLMs with context understanding and multi-turn dialogues. Simply run <code>blade "task"</code> to launch the UI and auto-send your first message.</p>
24
+ <p>Natural language interactions powered by LLMs with context understanding and multi-turn dialogues. Simply run <code>blade</code> to launch the interactive UI.</p>
25
25
  </td>
26
26
  <td width="50%" valign="top">
27
27
  <h3>🛠️ Rich Toolset</h3>
@@ -100,16 +100,27 @@ blade --print "Hello, introduce yourself"
100
100
 
101
101
  Blade Code supports multiple LLM providers. You need to configure the appropriate API key:
102
102
 
103
- ### Method 1: Environment Variables (Recommended)
103
+ ### Method 1: Configuration File (Recommended)
104
104
 
105
105
  ```bash
106
- # Qwen (Alibaba Cloud)
107
- export QWEN_API_KEY="your-qwen-api-key"
108
- export BLADE_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
109
-
110
- # VolcEngine
111
- export VOLCENGINE_API_KEY="your-volcengine-api-key"
112
- export BLADE_BASE_URL="https://ark.cn-beijing.volces.com/api/v3"
106
+ # Create user-level configuration file
107
+ mkdir -p ~/.blade
108
+ cat > ~/.blade/config.json << 'EOF'
109
+ {
110
+ "provider": "openai-compatible",
111
+ "apiKey": "your-api-key",
112
+ "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
113
+ "model": "qwen-max"
114
+ }
115
+ EOF
116
+
117
+ # Or use environment variable interpolation in config file
118
+ cat > ~/.blade/config.json << 'EOF'
119
+ {
120
+ "apiKey": "${BLADE_API_KEY}",
121
+ "baseUrl": "${BLADE_BASE_URL:-https://apis.iflow.cn/v1}"
122
+ }
123
+ EOF
113
124
  ```
114
125
 
115
126
  ### Method 2: First-Run Setup Wizard (Recommended Experience)
@@ -119,23 +130,13 @@ blade
119
130
  # If no API key is configured, an interactive wizard will guide you through Provider, Base URL, API Key, and model setup.
120
131
  ```
121
132
 
122
- ### Method 3: Command Line Arguments
133
+ ### Method 3: Config Command
123
134
 
124
135
  ```bash
125
- blade --api-key your-api-key --base-url https://api.example.com "Hello"
136
+ # Use config command to manage configuration
137
+ blade config
126
138
  ```
127
139
 
128
- ### Method 4: Configuration File
129
-
130
- ```bash
131
- # User-level configuration
132
- mkdir -p ~/.blade
133
- nano ~/.blade/config.json
134
-
135
- # Project-level configuration
136
- mkdir -p .blade
137
- nano .blade/config.json
138
- ```
139
140
 
140
141
  ### Get API Keys
141
142
 
@@ -152,38 +153,33 @@ nano .blade/config.json
152
153
  # Interactive mode (default)
153
154
  blade
154
155
 
155
- # Direct message (automatically sent once the UI is ready)
156
- blade "What is artificial intelligence?"
157
-
158
- # Code generation
159
- blade "Write a debounce function in JavaScript"
156
+ # Non-interactive quick answer (print mode)
157
+ blade --print "What is artificial intelligence?"
160
158
 
161
- # Non-interactive quick answer
162
- blade --print "Summarize the repo in one sentence"
159
+ # Code generation (print mode)
160
+ blade --print "Write a debounce function in JavaScript"
163
161
  ```
164
162
 
165
- > Any message passed as `blade "..."` is automatically injected and executed once the interactive UI finishes initializing—no extra keystrokes required.
166
-
167
163
  ### Smart Tool Invocation
168
164
 
169
165
  Blade Code automatically selects appropriate tools based on your needs:
170
166
 
171
167
  ```bash
172
- # File operations
173
- blade "List all TypeScript files in the current directory"
168
+ # File operations (print mode)
169
+ blade --print "List all TypeScript files in the current directory"
174
170
 
175
- # Git operations
176
- blade "Show the last 5 commit logs"
171
+ # Git operations (print mode)
172
+ blade --print "Show the last 5 commit logs"
177
173
 
178
- # Code review (non-interactive example)
174
+ # Code review (print mode)
179
175
  blade --print "Review code quality in src/utils directory"
180
176
  ```
181
177
 
182
178
  ### Session Management
183
179
 
184
180
  ```bash
185
- # Create or use named session
186
- blade --session-id "project-alpha" "Start new project"
181
+ # Create or use named session (print mode)
182
+ blade --session-id "project-alpha" --print "Start new project"
187
183
 
188
184
  # Continue recent session
189
185
  blade --continue
@@ -253,9 +249,6 @@ blade doctor
253
249
 
254
250
  # Check for updates
255
251
  blade update
256
-
257
- # Set up authentication token
258
- blade setup-token
259
252
  ```
260
253
 
261
254
  ### AI Model Options
@@ -322,21 +315,18 @@ blade --setting-sources "global,user,local"
322
315
 
323
316
  | Command | Description | Example |
324
317
  |---------|-------------|---------|
325
- | `blade [message..]` | Send message or launch interactive mode (default) | `blade "Hello"` |
318
+ | `blade` | Start interactive AI assistant (default) | `blade` |
326
319
  | `blade config` | Configuration management | `blade config` |
327
320
  | `blade mcp` | Configure and manage MCP servers | `blade mcp` |
328
321
  | `blade doctor` | System health check | `blade doctor` |
329
322
  | `blade update` | Check and install updates | `blade update` |
330
323
  | `blade install [target]` | Install specific version (stable/latest/version) | `blade install latest` |
331
- | `blade setup-token` | Set up authentication token | `blade setup-token` |
332
- | `blade completion` | Generate shell completion script | `blade completion` |
333
324
 
334
325
  ### Debug Options
335
326
 
336
327
  | Option | Short | Description |
337
328
  |--------|-------|-------------|
338
329
  | `--debug [category]` | `-d` | Enable debug mode with optional category filtering |
339
- | `--verbose` | | Enable verbose output mode |
340
330
 
341
331
  ### Output Options
342
332
 
package/README.md CHANGED
@@ -109,16 +109,27 @@ blade --print "你好,介绍一下自己"
109
109
 
110
110
  Blade Code 支持多种 LLM 提供商,您需要配置相应的 API 密钥:
111
111
 
112
- ### 方式一:环境变量(推荐)
112
+ ### 方式一:配置文件(推荐)
113
113
 
114
114
  ```bash
115
- # 千问(阿里云)
116
- export QWEN_API_KEY="your-qwen-api-key"
117
- export BLADE_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
115
+ # 创建用户级配置文件
116
+ mkdir -p ~/.blade
117
+ cat > ~/.blade/config.json << 'EOF'
118
+ {
119
+ "provider": "openai-compatible",
120
+ "apiKey": "your-api-key",
121
+ "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
122
+ "model": "qwen-max"
123
+ }
124
+ EOF
118
125
 
119
- # 火山引擎
120
- export VOLCENGINE_API_KEY="your-volcengine-api-key"
121
- export BLADE_BASE_URL="https://ark.cn-beijing.volces.com/api/v3"
126
+ # 或在配置文件中使用环境变量插值
127
+ cat > ~/.blade/config.json << 'EOF'
128
+ {
129
+ "apiKey": "${BLADE_API_KEY}",
130
+ "baseUrl": "${BLADE_BASE_URL:-https://apis.iflow.cn/v1}"
131
+ }
132
+ EOF
122
133
  ```
123
134
 
124
135
  ### 方式二:首启设置向导(推荐体验)
@@ -128,24 +139,11 @@ blade
128
139
  # 若未配置 API Key,将自动引导完成 Provider、Base URL、API Key、模型的填写
129
140
  ```
130
141
 
131
- ### 方式三:命令行参数
142
+ ### 方式三:配置命令
132
143
 
133
144
  ```bash
134
- blade --api-key your-api-key --base-url https://api.example.com "你好"
135
- ```
136
-
137
- ### 方式四:配置文件
138
-
139
- ```bash
140
- # 用户级配置
141
- mkdir -p ~/.blade
142
- nano ~/.blade/config.json
143
-
144
- # 项目级配置(提交到仓库)
145
- mkdir -p .blade
146
- nano .blade/config.json
147
- # 或者为当前机器准备不提交的设置
148
- nano .blade/settings.local.json
145
+ # 使用 config 命令管理配置
146
+ blade config
149
147
  ```
150
148
 
151
149
  ### 获取 API 密钥
@@ -259,9 +257,6 @@ blade doctor
259
257
 
260
258
  # 检查更新
261
259
  blade update
262
-
263
- # 设置认证令牌
264
- blade setup-token
265
260
  ```
266
261
 
267
262
  ### AI 模型选项
@@ -352,21 +347,18 @@ blade --setting-sources "global,user,local"
352
347
 
353
348
  | 命令 | 说明 | 示例 |
354
349
  |------|------|------|
355
- | `blade [message..]` | 发送消息或启动交互式界面(默认) | `blade "你好"` |
350
+ | `blade` | 启动交互式 AI 助手(默认) | `blade` |
356
351
  | `blade config` | 配置管理 | `blade config` |
357
352
  | `blade mcp` | 配置和管理 MCP 服务器 | `blade mcp` |
358
353
  | `blade doctor` | 系统健康检查 | `blade doctor` |
359
354
  | `blade update` | 检查更新并安装 | `blade update` |
360
355
  | `blade install [target]` | 安装指定版本(stable/latest/版本号) | `blade install latest` |
361
- | `blade setup-token` | 设置认证令牌 | `blade setup-token` |
362
- | `blade completion` | 生成 shell 补全脚本 | `blade completion` |
363
356
 
364
357
  ### 调试选项
365
358
 
366
359
  | 选项 | 简写 | 说明 |
367
360
  |------|------|------|
368
361
  | `--debug [category]` | `-d` | 启用调试模式,可选分类过滤 |
369
- | `--verbose` | | 启用详细输出模式 |
370
362
 
371
363
  ### 输出选项
372
364