dsh-llm-codebuddy 1.2.1 → 1.3.2
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 +69 -105
- package/cli.js +177 -0
- package/package.json +9 -4
- package/install.ps1 +0 -13
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# DSH CodeBuddy Provider
|
|
2
2
|
|
|
3
|
-
为 DeepSeek Harness(DSH)增加
|
|
4
|
-
|
|
5
|
-
调整模型参数并使用 CodeBuddy 模型。
|
|
3
|
+
为 DeepSeek Harness(DSH)增加 `CodeBuddy 中国区` Provider。安装后可直接在
|
|
4
|
+
DSH WebUI 中填写 API Key、获取模型、调整模型参数并使用 CodeBuddy 模型。
|
|
6
5
|
|
|
7
6
|
> [!IMPORTANT]
|
|
8
7
|
> API Key 由 **WorkBuddy** 提供,本插件使用该 Key 调用供 CodeBuddy 使用的模型服务。
|
|
@@ -11,62 +10,46 @@
|
|
|
11
10
|
|
|
12
11
|
## 功能
|
|
13
12
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- 支持编辑模型 ID
|
|
13
|
+
- WebUI 中直接添加 `CodeBuddy 中国区`;
|
|
14
|
+
- 只需填写从 WorkBuddy 获取的 API Key;
|
|
15
|
+
- 自动获取 CodeBuddy 当前可用模型;
|
|
16
|
+
- 支持编辑模型 ID、名称、上下文窗口和最大输出 Token;
|
|
18
17
|
- 支持添加、删除模型以及重新同步模型目录;
|
|
19
18
|
- 支持 `minimal / low / medium / high / xhigh / max` 思考程度;
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- 插件独立安装,不修改 DSH 全局安装目录。
|
|
19
|
+
- 输入新 API Key 可替换旧值,留空保存则保留原值;
|
|
20
|
+
- 模型接口暂时不可用时使用内置目录兜底;
|
|
21
|
+
- 独立安装,不修改 DSH 全局安装目录。
|
|
24
22
|
|
|
25
|
-
##
|
|
23
|
+
## 环境要求
|
|
26
24
|
|
|
27
|
-
- Windows、Linux
|
|
25
|
+
- Windows、Linux 或 macOS;
|
|
28
26
|
- Node.js `>= 22.19.0`;
|
|
29
|
-
-
|
|
30
|
-
-
|
|
27
|
+
- 已安装 DSH;
|
|
28
|
+
- 已验证 DSH `0.1.0-rc.6`。
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
> 但 DSH 普通更新不会覆盖插件源码。
|
|
30
|
+
安装器已自带 DSH 所需的 `pnpm`,无需全局安装。
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
> DSH 仍处于预发布阶段。未来版本如果调整插件接口,本插件可能需要同步升级;
|
|
33
|
+
> DSH 普通更新不会覆盖本插件。
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
## 安装
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
推荐使用一键安装命令:
|
|
40
38
|
|
|
41
39
|
```powershell
|
|
42
|
-
|
|
43
|
-
dsh plugin --profile headless add dsh-llm-codebuddy
|
|
40
|
+
npx --yes dsh-llm-codebuddy@latest install
|
|
44
41
|
```
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
### 从 GitHub 安装
|
|
49
|
-
|
|
50
|
-
```powershell
|
|
51
|
-
dsh plugin --profile web add github:Axiaohungry/dsh-llm-codebuddy
|
|
52
|
-
dsh plugin --profile headless add github:Axiaohungry/dsh-llm-codebuddy
|
|
53
|
-
```
|
|
43
|
+
该命令会为 DSH 的 `web` 和 `headless` Profile 安装插件。完成后重启 DSH。
|
|
54
44
|
|
|
55
|
-
|
|
45
|
+
也可以分别安装:
|
|
56
46
|
|
|
57
47
|
```powershell
|
|
58
|
-
dsh plugin --profile web add
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### 从源码安装
|
|
62
|
-
|
|
63
|
-
```powershell
|
|
64
|
-
git clone https://github.com/Axiaohungry/dsh-llm-codebuddy.git
|
|
65
|
-
cd dsh-llm-codebuddy
|
|
66
|
-
.\install.ps1
|
|
48
|
+
dsh plugin --profile web add dsh-llm-codebuddy@latest
|
|
49
|
+
dsh plugin --profile headless add dsh-llm-codebuddy@latest
|
|
67
50
|
```
|
|
68
51
|
|
|
69
|
-
|
|
52
|
+
只使用 WebUI 时,仅执行第一条即可。
|
|
70
53
|
|
|
71
54
|
## WebUI 配置
|
|
72
55
|
|
|
@@ -75,110 +58,91 @@ cd dsh-llm-codebuddy
|
|
|
75
58
|
3. 选择 `CodeBuddy 中国区`。
|
|
76
59
|
4. 输入从 WorkBuddy 获取的 API Key 并保存。
|
|
77
60
|
5. 点击该 Provider 的“编辑”,展开“自定义设置”。
|
|
78
|
-
6.
|
|
61
|
+
6. 点击“获取可用模型”,选择需要的模型并导入。
|
|
79
62
|
7. 按需修改模型参数,然后保存。
|
|
80
63
|
|
|
81
|
-
|
|
64
|
+
再次编辑已配置的 Provider 时,会直接显示上次保存的模型目录。
|
|
82
65
|
|
|
83
|
-
##
|
|
66
|
+
## API Key 替换
|
|
84
67
|
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
- 新模型缺少容量时:上下文窗口默认为 `262144`,最大输出默认为 `32768`;
|
|
89
|
-
- 点击“恢复默认模型”:删除自定义目录,恢复适配器目录。
|
|
68
|
+
- 输入新的 API Key 并保存:替换原 Key;
|
|
69
|
+
- API Key 输入框留空并保存:保留原 Key;
|
|
70
|
+
- 更换 Key 后建议重新点击“获取可用模型”,同步新账号的模型权限。
|
|
90
71
|
|
|
91
|
-
|
|
92
|
-
CodeBuddy 仍可能拒绝请求。
|
|
72
|
+
API Key 由 DSH 凭据服务保存,不会写入模型目录或插件源码。
|
|
93
73
|
|
|
94
|
-
##
|
|
74
|
+
## 模型配置
|
|
75
|
+
|
|
76
|
+
- 没有自定义目录:使用 CodeBuddy 在线目录,失败时使用内置目录;
|
|
77
|
+
- 保存自定义目录:仅向 DSH 提供目录中保留的模型;
|
|
78
|
+
- 已知模型字段留空:继承在线目录或内置目录中的值;
|
|
79
|
+
- 新模型缺少容量:上下文窗口默认 `262144`,最大输出默认 `32768`;
|
|
80
|
+
- 点击“恢复默认模型”:删除自定义目录并恢复适配器目录。
|
|
81
|
+
|
|
82
|
+
配置值超过服务端真实限制时,CodeBuddy 仍可能拒绝请求。
|
|
95
83
|
|
|
96
|
-
|
|
97
|
-
`reasoning_effort` 并发送给 CodeBuddy。模型推理由 CodeBuddy 云端执行。
|
|
84
|
+
## 思考程度
|
|
98
85
|
|
|
99
|
-
|
|
86
|
+
DSH 显示思考程度选项,插件把选中的档位转换为 `reasoning_effort` 并发送给
|
|
87
|
+
CodeBuddy。模型推理由 CodeBuddy 云端执行。
|
|
100
88
|
|
|
101
89
|
```text
|
|
102
90
|
minimal / low / medium / high / xhigh / max
|
|
103
91
|
```
|
|
104
92
|
|
|
105
|
-
|
|
93
|
+
当前不提供 `off`,因为 CodeBuddy 模型目录中的模型属于推理模型。未选择档位时,
|
|
94
|
+
使用 CodeBuddy 对应模型的默认值。
|
|
106
95
|
|
|
107
96
|
## 更新
|
|
108
97
|
|
|
109
|
-
|
|
98
|
+
重新运行安装命令即可更新到最新版:
|
|
110
99
|
|
|
111
100
|
```powershell
|
|
112
|
-
|
|
113
|
-
dsh plugin --profile headless add dsh-llm-codebuddy@latest
|
|
101
|
+
npx --yes dsh-llm-codebuddy@latest install
|
|
114
102
|
```
|
|
115
103
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
```powershell
|
|
119
|
-
dsh plugin --profile web add github:Axiaohungry/dsh-llm-codebuddy#v1.2.1
|
|
120
|
-
dsh plugin --profile headless add github:Axiaohungry/dsh-llm-codebuddy#v1.2.1
|
|
121
|
-
```
|
|
104
|
+
更新完成后重启 DSH。模型配置和 API Key 不会被覆盖。
|
|
122
105
|
|
|
123
106
|
## 卸载
|
|
124
107
|
|
|
125
108
|
```powershell
|
|
126
|
-
|
|
127
|
-
dsh plugin --profile headless remove dsh-llm-codebuddy
|
|
109
|
+
npx --yes dsh-llm-codebuddy@latest uninstall
|
|
128
110
|
```
|
|
129
111
|
|
|
130
|
-
|
|
112
|
+
卸载命令会:
|
|
131
113
|
|
|
132
|
-
|
|
114
|
+
1. 备份 `~/.dsh/settings.yaml`;
|
|
115
|
+
2. 只删除 `llm-pi-ai.providers.codebuddy-cn` 配置;
|
|
116
|
+
3. 保留其他 Provider 和 DSH 设置;
|
|
117
|
+
4. 从 `web`、`headless` Profile 移除插件;
|
|
118
|
+
5. 保留 API Key 凭据,方便以后重新安装。
|
|
133
119
|
|
|
134
|
-
|
|
120
|
+
完成后重启 DSH。备份文件名类似:
|
|
135
121
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
```powershell
|
|
139
|
-
git init
|
|
140
|
-
git add .
|
|
141
|
-
git commit -m "发布 dsh-llm-codebuddy v1.2.1"
|
|
142
|
-
git branch -M main
|
|
143
|
-
git remote add origin git@github.com:Axiaohungry/dsh-llm-codebuddy.git
|
|
144
|
-
git push -u origin main
|
|
145
|
-
git tag v1.2.1
|
|
146
|
-
git push origin v1.2.1
|
|
122
|
+
```text
|
|
123
|
+
settings.yaml.codebuddy-backup-2026-08-14T12-00-00-000Z
|
|
147
124
|
```
|
|
148
125
|
|
|
149
|
-
|
|
126
|
+
源码仓库、本地安装包和 API Key 不会被删除。
|
|
150
127
|
|
|
151
|
-
|
|
128
|
+
## 常见问题
|
|
152
129
|
|
|
153
|
-
|
|
154
|
-
npm ci --ignore-scripts
|
|
155
|
-
npm run check
|
|
156
|
-
npm pack
|
|
157
|
-
```
|
|
130
|
+
### 安装后看不到 CodeBuddy
|
|
158
131
|
|
|
159
|
-
|
|
132
|
+
确认已经重启 DSH,并检查 Web Profile:
|
|
160
133
|
|
|
161
134
|
```powershell
|
|
162
|
-
dsh plugin --profile web
|
|
135
|
+
dsh plugin --profile web list --depth 0
|
|
163
136
|
```
|
|
164
137
|
|
|
165
|
-
###
|
|
166
|
-
|
|
167
|
-
首次发布:
|
|
168
|
-
|
|
169
|
-
```powershell
|
|
170
|
-
npm login
|
|
171
|
-
npm publish
|
|
172
|
-
```
|
|
138
|
+
### 获取模型失败
|
|
173
139
|
|
|
174
|
-
|
|
140
|
+
确认 API Key 来自 WorkBuddy 且仍然有效,然后重新输入 Key 并点击“获取可用模型”。
|
|
141
|
+
接口临时不可用时,插件仍会提供内置模型目录。
|
|
175
142
|
|
|
176
|
-
|
|
143
|
+
### 卸载后仍显示旧页面
|
|
177
144
|
|
|
178
|
-
|
|
179
|
-
- API Key 由 DSH 凭据服务保存,插件不把密钥写入模型目录;
|
|
180
|
-
- npm 包只包含 `package.json` 中 `files` 指定的运行文件和文档;
|
|
181
|
-
- 发布前务必使用 `npm pack --dry-run` 检查包内容。
|
|
145
|
+
关闭正在运行的 DSH,再重新启动。已经运行的进程不会自动卸载内存中的插件。
|
|
182
146
|
|
|
183
147
|
## 工作原理
|
|
184
148
|
|
|
@@ -190,7 +154,7 @@ DSH Agent → 本插件 → CodeBuddy /v2/chat/completions
|
|
|
190
154
|
```
|
|
191
155
|
|
|
192
156
|
- DSH:负责 Agent 循环、上下文、工具调用和权限;
|
|
193
|
-
- WorkBuddy
|
|
157
|
+
- WorkBuddy:提供 API Key;
|
|
194
158
|
- 插件:负责 Provider 注册、模型目录转换和请求兼容;
|
|
195
159
|
- CodeBuddy:负责模型推理并返回结果。
|
|
196
160
|
|
package/cli.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { copyFileSync, existsSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { homedir, tmpdir } from "node:os";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import { delimiter, dirname, join, resolve } from "node:path";
|
|
7
|
+
import { spawnSync } from "node:child_process";
|
|
8
|
+
import { parseDocument } from "yaml";
|
|
9
|
+
|
|
10
|
+
const PACKAGE = "dsh-llm-codebuddy";
|
|
11
|
+
const PROVIDER_PATH = ["llm-pi-ai", "providers", "codebuddy-cn"];
|
|
12
|
+
const IGNORED_BUILDS = ["@google/genai", "protobufjs"];
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
|
|
15
|
+
function dshHome() {
|
|
16
|
+
return resolve(process.env.DSH_HOME || join(homedir(), ".dsh"));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function profileHasPlugin(home, profile) {
|
|
20
|
+
const file = join(home, "profiles", profile, "package.json");
|
|
21
|
+
if (!existsSync(file)) return false;
|
|
22
|
+
const json = JSON.parse(readFileSync(file, "utf8"));
|
|
23
|
+
return Boolean(json.dependencies?.[PACKAGE] || json.devDependencies?.[PACKAGE]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function dshEnv() {
|
|
27
|
+
const pnpmPackageDir = dirname(require.resolve("pnpm"));
|
|
28
|
+
const pnpmBinDir = join(dirname(pnpmPackageDir), ".bin");
|
|
29
|
+
const pathKey = Object.keys(process.env).find((key) => key.toLowerCase() === "path") || "PATH";
|
|
30
|
+
return {
|
|
31
|
+
...process.env,
|
|
32
|
+
[pathKey]: `${pnpmBinDir}${delimiter}${process.env[pathKey] || ""}`,
|
|
33
|
+
npm_config_ignore_workspace_root_check: "true",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function runDsh(args) {
|
|
38
|
+
const result = spawnSync(process.platform === "win32" ? "dsh.cmd" : "dsh", args, {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
shell: process.platform === "win32",
|
|
41
|
+
env: dshEnv(),
|
|
42
|
+
});
|
|
43
|
+
if (result.error) throw result.error;
|
|
44
|
+
if (result.status !== 0) throw new Error(`dsh ${args.join(" ")} 执行失败(退出码 ${result.status})`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function writeYamlDocument(file, document) {
|
|
48
|
+
const temporary = join(dirname(file), `.codebuddy-${process.pid}.tmp`);
|
|
49
|
+
writeFileSync(temporary, String(document), "utf8");
|
|
50
|
+
renameSync(temporary, file);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function withPnpmBuildPolicy(file, action) {
|
|
54
|
+
const document = parseDocument(readFileSync(file, "utf8"));
|
|
55
|
+
if (document.errors.length) throw new Error(`无法解析 ${file}:${document.errors[0].message}`);
|
|
56
|
+
const changes = [];
|
|
57
|
+
for (const packageName of IGNORED_BUILDS) {
|
|
58
|
+
const path = ["allowBuilds", packageName];
|
|
59
|
+
if (typeof document.getIn(path) !== "boolean") {
|
|
60
|
+
changes.push({ packageName, existed: document.hasIn(path), value: document.getIn(path) });
|
|
61
|
+
document.setIn(path, false);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (changes.length) writeYamlDocument(file, document);
|
|
65
|
+
try {
|
|
66
|
+
return action();
|
|
67
|
+
} finally {
|
|
68
|
+
if (changes.length) {
|
|
69
|
+
const current = parseDocument(readFileSync(file, "utf8"));
|
|
70
|
+
for (const change of changes) {
|
|
71
|
+
const path = ["allowBuilds", change.packageName];
|
|
72
|
+
if (change.existed) current.setIn(path, change.value);
|
|
73
|
+
else current.deleteIn(path);
|
|
74
|
+
}
|
|
75
|
+
if (current.getIn(["allowBuilds"])?.items?.length === 0) current.deleteIn(["allowBuilds"]);
|
|
76
|
+
writeYamlDocument(file, current);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function cleanPnpmWorkspace(file) {
|
|
82
|
+
if (!existsSync(file)) return;
|
|
83
|
+
const document = parseDocument(readFileSync(file, "utf8"));
|
|
84
|
+
if (document.errors.length) throw new Error(`无法解析 ${file}:${document.errors[0].message}`);
|
|
85
|
+
const entries = document.getIn(["minimumReleaseAgeExclude"])?.items;
|
|
86
|
+
if (!entries) return;
|
|
87
|
+
const remaining = entries.map((entry) => entry.value).filter((entry) => !String(entry).startsWith(`${PACKAGE}@`));
|
|
88
|
+
if (remaining.length === entries.length) return;
|
|
89
|
+
if (remaining.length) document.setIn(["minimumReleaseAgeExclude"], remaining);
|
|
90
|
+
else document.deleteIn(["minimumReleaseAgeExclude"]);
|
|
91
|
+
writeYamlDocument(file, document);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function cleanSettings(file) {
|
|
95
|
+
if (!existsSync(file)) return undefined;
|
|
96
|
+
const source = readFileSync(file, "utf8");
|
|
97
|
+
const document = parseDocument(source);
|
|
98
|
+
if (document.errors.length) throw new Error(`无法解析 ${file}:${document.errors[0].message}`);
|
|
99
|
+
if (!document.hasIn(PROVIDER_PATH)) return undefined;
|
|
100
|
+
|
|
101
|
+
document.deleteIn(PROVIDER_PATH);
|
|
102
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
103
|
+
const backup = `${file}.codebuddy-backup-${stamp}`;
|
|
104
|
+
const temporary = join(dirname(file), `.settings-codebuddy-${process.pid}.tmp`);
|
|
105
|
+
copyFileSync(file, backup);
|
|
106
|
+
writeFileSync(temporary, String(document), "utf8");
|
|
107
|
+
renameSync(temporary, file);
|
|
108
|
+
return backup;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function install() {
|
|
112
|
+
for (const profile of ["web", "headless"]) {
|
|
113
|
+
runDsh(["plugin", "--profile", profile, "list", "--depth", "0"]);
|
|
114
|
+
const workspace = join(dshHome(), "profiles", profile, "pnpm-workspace.yaml");
|
|
115
|
+
withPnpmBuildPolicy(workspace, () => runDsh(["plugin", "--profile", profile, "add", `${PACKAGE}@latest`]));
|
|
116
|
+
}
|
|
117
|
+
console.log("CodeBuddy Provider 已安装。请重启 DSH 后进行配置。");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function uninstall(home = dshHome()) {
|
|
121
|
+
const backup = cleanSettings(join(home, "settings.yaml"));
|
|
122
|
+
for (const profile of ["web", "headless"]) {
|
|
123
|
+
const workspace = join(home, "profiles", profile, "pnpm-workspace.yaml");
|
|
124
|
+
if (profileHasPlugin(home, profile)) {
|
|
125
|
+
withPnpmBuildPolicy(workspace, () => runDsh(["plugin", "--profile", profile, "remove", PACKAGE]));
|
|
126
|
+
}
|
|
127
|
+
cleanPnpmWorkspace(workspace);
|
|
128
|
+
}
|
|
129
|
+
console.log(backup ? `CodeBuddy 配置已清理,备份:${backup}` : "未发现 CodeBuddy Provider 配置。");
|
|
130
|
+
console.log("插件已卸载,API Key 凭据保持不变。请重启 DSH。");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function selfTest() {
|
|
134
|
+
const root = mkdtempSync(join(tmpdir(), "dsh-codebuddy-cli-"));
|
|
135
|
+
try {
|
|
136
|
+
const file = join(root, "settings.yaml");
|
|
137
|
+
writeFileSync(file, "llm-pi-ai:\n providers:\n opencode-go:\n apiKeyEnv: OPENCODE_GO_API_KEY\n codebuddy-cn:\n apiKeyEnv: CODEBUDDY_CN_API_KEY\n", "utf8");
|
|
138
|
+
const backup = cleanSettings(file);
|
|
139
|
+
const result = parseDocument(readFileSync(file, "utf8"));
|
|
140
|
+
if (!backup || !existsSync(backup) || result.hasIn(PROVIDER_PATH) || !result.hasIn(["llm-pi-ai", "providers", "opencode-go"])) {
|
|
141
|
+
throw new Error("uninstall settings cleanup self-test failed");
|
|
142
|
+
}
|
|
143
|
+
const workspace = join(root, "pnpm-workspace.yaml");
|
|
144
|
+
writeFileSync(workspace, "packages:\n - .\nallowBuilds:\n '@google/genai': true\n protobufjs: pending\n", "utf8");
|
|
145
|
+
withPnpmBuildPolicy(workspace, () => {
|
|
146
|
+
const active = parseDocument(readFileSync(workspace, "utf8"));
|
|
147
|
+
if (active.getIn(["allowBuilds", "@google/genai"]) !== true || active.getIn(["allowBuilds", "protobufjs"]) !== false) {
|
|
148
|
+
throw new Error("pnpm build policy activation self-test failed");
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const restored = parseDocument(readFileSync(workspace, "utf8"));
|
|
152
|
+
if (restored.getIn(["allowBuilds", "@google/genai"]) !== true || restored.getIn(["allowBuilds", "protobufjs"]) !== "pending") {
|
|
153
|
+
throw new Error("pnpm build policy self-test failed");
|
|
154
|
+
}
|
|
155
|
+
restored.setIn(["minimumReleaseAgeExclude"], ["other@1.0.0", `${PACKAGE}@1.3.1`]);
|
|
156
|
+
writeYamlDocument(workspace, restored);
|
|
157
|
+
cleanPnpmWorkspace(workspace);
|
|
158
|
+
const cleaned = parseDocument(readFileSync(workspace, "utf8")).getIn(["minimumReleaseAgeExclude"])?.items?.map((entry) => entry.value);
|
|
159
|
+
if (cleaned?.join(",") !== "other@1.0.0") throw new Error("pnpm workspace cleanup self-test failed");
|
|
160
|
+
const pathKey = Object.keys(process.env).find((key) => key.toLowerCase() === "path") || "PATH";
|
|
161
|
+
if (!dshEnv()[pathKey].split(delimiter)[0].endsWith(join("node_modules", ".bin"))) {
|
|
162
|
+
throw new Error("bundled pnpm PATH self-test failed");
|
|
163
|
+
}
|
|
164
|
+
console.log("CLI-SELF-TEST-OK");
|
|
165
|
+
} finally {
|
|
166
|
+
rmSync(root, { recursive: true, force: true });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const command = process.argv[2];
|
|
171
|
+
if (command === "install") install();
|
|
172
|
+
else if (command === "uninstall") uninstall();
|
|
173
|
+
else if (command === "--self-test") selfTest();
|
|
174
|
+
else {
|
|
175
|
+
console.log("用法:dsh-llm-codebuddy <install|uninstall>");
|
|
176
|
+
process.exitCode = 1;
|
|
177
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-llm-codebuddy",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "使用 WorkBuddy API Key 为 DeepSeek Harness 接入 CodeBuddy 模型",
|
|
5
5
|
"author": "Axiaohungry",
|
|
6
6
|
"keywords": [
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./index.js"
|
|
18
18
|
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"dsh-llm-codebuddy": "cli.js"
|
|
21
|
+
},
|
|
19
22
|
"repository": {
|
|
20
23
|
"type": "git",
|
|
21
24
|
"url": "git+https://github.com/Axiaohungry/dsh-llm-codebuddy.git"
|
|
@@ -26,13 +29,13 @@
|
|
|
26
29
|
},
|
|
27
30
|
"files": [
|
|
28
31
|
"index.js",
|
|
32
|
+
"cli.js",
|
|
29
33
|
"cordis.patch.yml",
|
|
30
|
-
"install.ps1",
|
|
31
34
|
"README.md",
|
|
32
35
|
"LICENSE"
|
|
33
36
|
],
|
|
34
37
|
"scripts": {
|
|
35
|
-
"check": "node --check index.js"
|
|
38
|
+
"check": "node --check index.js && node --check cli.js && node cli.js --self-test"
|
|
36
39
|
},
|
|
37
40
|
"dsh": {
|
|
38
41
|
"bundle": {
|
|
@@ -45,7 +48,9 @@
|
|
|
45
48
|
"@deepseek-ai/dsh-llm": "0.1.0-rc.6",
|
|
46
49
|
"@deepseek-ai/dsh-llm-pi-ai": "0.1.0-rc.6",
|
|
47
50
|
"@deepseek-ai/dsh-settings": "0.1.0-rc.6",
|
|
48
|
-
"@earendil-works/pi-ai": "0.82.1"
|
|
51
|
+
"@earendil-works/pi-ai": "0.82.1",
|
|
52
|
+
"pnpm": "11.19.0",
|
|
53
|
+
"yaml": "2.9.0"
|
|
49
54
|
},
|
|
50
55
|
"engines": {
|
|
51
56
|
"node": ">=22.19.0"
|
package/install.ps1
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
$ErrorActionPreference = 'Stop'
|
|
2
|
-
|
|
3
|
-
Push-Location $PSScriptRoot
|
|
4
|
-
try {
|
|
5
|
-
npm install --ignore-scripts --no-audit --no-fund
|
|
6
|
-
dsh plugin --profile web add $PSScriptRoot
|
|
7
|
-
dsh plugin --profile headless add $PSScriptRoot
|
|
8
|
-
}
|
|
9
|
-
finally {
|
|
10
|
-
Pop-Location
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
Write-Host 'CodeBuddy Provider 已安装。请重启 DSH,然后在“设置 → 模型 → 添加提供方”中选择 CodeBuddy 中国区。'
|