codemate-ai 1.0.3 → 1.0.4
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 +6 -7
- package/dist/cli.js +53 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,19 +69,18 @@ Base URL: https://api.deepseek.com
|
|
|
69
69
|
试试:codemate "创建一个 Hello World 程序"
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
###
|
|
72
|
+
### 基础使用
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
#
|
|
76
|
-
codemate "create a REST API with Express and TypeScript"
|
|
77
|
-
|
|
78
|
-
# Interactive mode
|
|
75
|
+
# 启动交互式模式
|
|
79
76
|
codemate
|
|
80
77
|
|
|
81
|
-
#
|
|
82
|
-
|
|
78
|
+
# 在交互界面中输入你的需求
|
|
79
|
+
> 创建一个 Express API 服务器
|
|
83
80
|
```
|
|
84
81
|
|
|
82
|
+
**注意**:当前版本仅支持交互式模式。一次性命令模式(如 `codemate "prompt"`)将在未来版本中支持。
|
|
83
|
+
|
|
85
84
|
## 📖 Usage Examples
|
|
86
85
|
|
|
87
86
|
### Create a New Project
|
package/dist/cli.js
CHANGED
|
@@ -5326,15 +5326,58 @@ function createDefaultConfig(apiKey, provider, model, baseURL) {
|
|
|
5326
5326
|
openrouter: "anthropic/claude-3.5-sonnet",
|
|
5327
5327
|
custom: "gpt-4"
|
|
5328
5328
|
};
|
|
5329
|
+
const defaultBaseURLs = {
|
|
5330
|
+
openai: void 0,
|
|
5331
|
+
anthropic: void 0,
|
|
5332
|
+
deepseek: "https://api.deepseek.com",
|
|
5333
|
+
openrouter: "https://openrouter.ai/api/v1",
|
|
5334
|
+
custom: void 0
|
|
5335
|
+
};
|
|
5329
5336
|
const config = {
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5337
|
+
app: {
|
|
5338
|
+
name: "codemate",
|
|
5339
|
+
version: "1.0.4",
|
|
5340
|
+
logLevel: "info",
|
|
5341
|
+
workDir: process.cwd()
|
|
5342
|
+
},
|
|
5343
|
+
model: {
|
|
5344
|
+
apiKey,
|
|
5345
|
+
baseURL: baseURL || defaultBaseURLs[provider] || "https://api.openai.com/v1",
|
|
5346
|
+
model: model || defaultModels[provider] || "gpt-4",
|
|
5347
|
+
temperature: 0.7
|
|
5348
|
+
},
|
|
5349
|
+
tools: {
|
|
5350
|
+
enabled: [
|
|
5351
|
+
"read_file",
|
|
5352
|
+
"write_file",
|
|
5353
|
+
"list_files",
|
|
5354
|
+
"edit_file",
|
|
5355
|
+
"delete_file",
|
|
5356
|
+
"grep",
|
|
5357
|
+
"glob",
|
|
5358
|
+
"bash"
|
|
5359
|
+
]
|
|
5360
|
+
},
|
|
5361
|
+
ui: {
|
|
5362
|
+
theme: "dark",
|
|
5363
|
+
showTimestamp: false
|
|
5364
|
+
},
|
|
5365
|
+
performance: {
|
|
5366
|
+
compression: {
|
|
5367
|
+
enabled: true,
|
|
5368
|
+
triggerRatio: 0.7,
|
|
5369
|
+
protectThreshold: 1e4,
|
|
5370
|
+
minimumPrune: 1e3,
|
|
5371
|
+
protectedTools: ["read_file", "list_files"],
|
|
5372
|
+
protectTurns: 2
|
|
5373
|
+
}
|
|
5374
|
+
},
|
|
5375
|
+
// 保存元数据用于参考
|
|
5376
|
+
_metadata: {
|
|
5377
|
+
provider,
|
|
5378
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5379
|
+
}
|
|
5334
5380
|
};
|
|
5335
|
-
if (baseURL) {
|
|
5336
|
-
config.baseURL = baseURL;
|
|
5337
|
-
}
|
|
5338
5381
|
const configPath = getConfigPath();
|
|
5339
5382
|
fs15__default.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
5340
5383
|
}
|
|
@@ -5428,16 +5471,15 @@ function question(rl, query) {
|
|
|
5428
5471
|
|
|
5429
5472
|
// src/cli.ts
|
|
5430
5473
|
var program = new Command();
|
|
5431
|
-
program.name("codemate").description("AI-powered CLI assistant").version("1.0.
|
|
5474
|
+
program.name("codemate").description("AI-powered CLI assistant").version("1.0.4");
|
|
5432
5475
|
program.command("chat", { isDefault: true }).description("Start interactive chat mode").action(async () => {
|
|
5433
5476
|
try {
|
|
5434
5477
|
if (isFirstRun()) {
|
|
5435
5478
|
console.log("\n\u6B22\u8FCE\u4F7F\u7528 CodeMate AI! \u{1F389}\n");
|
|
5436
5479
|
console.log("\u68C0\u6D4B\u5230\u8FD9\u662F\u9996\u6B21\u8FD0\u884C\uFF0C\u9700\u8981\u8FDB\u884C\u521D\u59CB\u914D\u7F6E\u3002\n");
|
|
5437
5480
|
await runFirstTimeSetup();
|
|
5438
|
-
console.log("\n\u914D\u7F6E\u5B8C\u6210\uFF01\
|
|
5439
|
-
console.log(
|
|
5440
|
-
return;
|
|
5481
|
+
console.log("\n\u2705 \u914D\u7F6E\u5B8C\u6210\uFF01\n");
|
|
5482
|
+
console.log("\u73B0\u5728\u542F\u52A8\u4EA4\u4E92\u5F0F\u754C\u9762...\n");
|
|
5441
5483
|
}
|
|
5442
5484
|
const configService = new ConfigService();
|
|
5443
5485
|
const configPath = getConfigPath();
|