@ghenya/clinn 0.7.8 → 0.7.10
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/Logos/StartLogo.txt +1 -1
- package/README.md +5 -0
- package/Src/index.js +16 -21
- package/config.json +1 -1
- package/package.json +1 -1
package/Logos/StartLogo.txt
CHANGED
package/README.md
CHANGED
|
@@ -185,6 +185,11 @@ Clinn/
|
|
|
185
185
|
|
|
186
186
|
## 更新日志 (Changelog)
|
|
187
187
|
|
|
188
|
+
### v0.7.9 — 版本查询
|
|
189
|
+
|
|
190
|
+
- **`--version` / `-v`**:终端直接 `clinn --version` 查看版本
|
|
191
|
+
- **`/version`**:对话内 `/version` 查看版本
|
|
192
|
+
|
|
188
193
|
### v0.7.8 — Windows 兼容 & 权限修复
|
|
189
194
|
|
|
190
195
|
- **bin 入口改为 `.js`**:`#!/usr/bin/env node` + `.js` 后缀,npm 自动生成跨平台 shim,解决 Windows 上 `不是内部或外部命令` 问题
|
package/Src/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const os = require("os");
|
|
4
3
|
const readline = require("readline");
|
|
5
4
|
const { spawn } = require("child_process");
|
|
6
5
|
const Agent = require("./agent");
|
|
@@ -34,29 +33,15 @@ function emoji(key) {
|
|
|
34
33
|
return config.ui?.emoji?.[key] || "";
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
const CLINN_DIR = path.join(os.homedir(), ".clinn");
|
|
38
|
-
const CLINN_CONFIG = path.join(CLINN_DIR, "config.json");
|
|
39
|
-
const PKG_CONFIG = path.join(__dirname, "..", "config.json");
|
|
40
|
-
|
|
41
|
-
function ensureClinnDir() {
|
|
42
|
-
if (!fs.existsSync(CLINN_DIR)) fs.mkdirSync(CLINN_DIR, { recursive: true });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
36
|
function loadConfig() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
config = JSON.parse(raw);
|
|
50
|
-
} else {
|
|
51
|
-
const raw = fs.readFileSync(PKG_CONFIG, "utf-8");
|
|
52
|
-
config = JSON.parse(raw);
|
|
53
|
-
fs.writeFileSync(CLINN_CONFIG, JSON.stringify(config, null, 2), "utf-8");
|
|
54
|
-
}
|
|
37
|
+
const configPath = path.join(__dirname, "..", "config.json");
|
|
38
|
+
const raw = fs.readFileSync(configPath, "utf-8");
|
|
39
|
+
config = JSON.parse(raw);
|
|
55
40
|
}
|
|
56
41
|
|
|
57
42
|
function saveConfig() {
|
|
58
|
-
|
|
59
|
-
fs.writeFileSync(
|
|
43
|
+
const configPath = path.join(__dirname, "..", "config.json");
|
|
44
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
60
45
|
}
|
|
61
46
|
|
|
62
47
|
function maxWidth() {
|
|
@@ -368,7 +353,7 @@ function showHelp() {
|
|
|
368
353
|
["/api", "查看/配置 API 设置"],
|
|
369
354
|
["/api key <KEY>", "设置 API Key"],
|
|
370
355
|
["/api url <URL>", "设置 API 地址"],
|
|
371
|
-
["/api model <MODEL>", "设置模型名称"],
|
|
356
|
+
["/api model <MODEL>", "设置模型名称"], ["/version", "显示版本号"],
|
|
372
357
|
];
|
|
373
358
|
for (const [cmd, desc] of cmds) {
|
|
374
359
|
console.log(` ${C.yellow + cmd.padEnd(22) + C.reset} ${desc}`);
|
|
@@ -526,6 +511,10 @@ async function handleSlashCommand(input) {
|
|
|
526
511
|
}
|
|
527
512
|
break;
|
|
528
513
|
}
|
|
514
|
+
case "version": {
|
|
515
|
+
console.log(`${C.bold + C.cyan}${config.agent.name}${C.reset} v${config.agent.version}`);
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
529
518
|
case "tool_search": {
|
|
530
519
|
if (!rest) { console.log(`用法: /tool_search <关键词>`); break; }
|
|
531
520
|
const results = Tools.searchToolRegistry(rest);
|
|
@@ -934,6 +923,12 @@ async function handleInput(line) {
|
|
|
934
923
|
}
|
|
935
924
|
|
|
936
925
|
async function main() {
|
|
926
|
+
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
927
|
+
loadConfig();
|
|
928
|
+
console.log(config.agent.version);
|
|
929
|
+
process.exit(0);
|
|
930
|
+
}
|
|
931
|
+
|
|
937
932
|
loadConfig();
|
|
938
933
|
showLogo();
|
|
939
934
|
buildAgent();
|
package/config.json
CHANGED