@worktool/dsh-config-sync 0.0.0-stage → 1.0.0
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/LICENSE +21 -0
- package/README.md +58 -2
- package/assets/icon.svg +14 -0
- package/cordis.patch.yml +4 -0
- package/docs/DETAIL.md +26 -0
- package/lib/client.js +235 -0
- package/lib/index.js +792 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +61 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SupremeIdol
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @worktool/dsh-config-sync
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@worktool/dsh-config-sync)
|
|
4
|
+
[](https://www.npmjs.com/package/@worktool/dsh-config-sync)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/SupremeIdol/dsh-config-sync)
|
|
7
|
+
|
|
8
|
+
DeepSeek Harness(DSH)配置同步插件:把你的 **全局配置、全局 Skills、已安装插件清单** 导出为一个可版本化的同步包,并支持通过 **Git(SSH)** 同步到自建仓库(如 Gitee),换机或重装后一键还原。
|
|
9
|
+
|
|
10
|
+
## 功能
|
|
11
|
+
|
|
12
|
+
- 导出(自动脱敏):
|
|
13
|
+
- `settings.yaml`:仅清空**密钥类字段**(apiKey / secret / token / password / bearer / privateKey / accessKey 等),并记录到 `redactions.json`;`maxTokens`、`contextWindow` 等普通参数会被保留
|
|
14
|
+
- `AGENTS.md`(全局记忆)
|
|
15
|
+
- `.agent-presets/`
|
|
16
|
+
- `profiles/<profile>/cordis.patch.yml`、`cordis.yml`
|
|
17
|
+
- 全局 `skills/`
|
|
18
|
+
- 已安装插件清单(`name@version`)
|
|
19
|
+
- 导入:
|
|
20
|
+
- 先自动备份当前状态到 `~/.dsh/config-sync/backups/<时间戳>/`
|
|
21
|
+
- 按 `name@version` 自动下载安装插件(优先官方 registry,失败回退镜像)
|
|
22
|
+
- 还原配置与 skills;本地/link 插件会跳过并提示
|
|
23
|
+
- 导入 `settings.yaml` 时,**本机已存在的密钥会被保留**(不会被导出包里的空值覆盖);换到全新机器首次导入后,仍需手动补填密钥
|
|
24
|
+
- 云同步:`git push / pull`(SSH),仓库地址由你自行配置
|
|
25
|
+
- 界面:设置 →「配置同步」;同时提供 Agent 工具:
|
|
26
|
+
`config_sync_status` / `config_sync_export` / `config_sync_import` / `config_sync_push` / `config_sync_pull`
|
|
27
|
+
|
|
28
|
+
## 永不导出
|
|
29
|
+
|
|
30
|
+
`.credentials.yaml`、`.env`、`mcp_connector_grants/`、`storages/`(运行时)、`sessions/`、`cache/`、`attachments/`、`node_modules/`、日志。
|
|
31
|
+
|
|
32
|
+
## 同步包结构
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
manifest.json # schema/时间/DSH 版本/工具版本/counts
|
|
36
|
+
plugins.json # [{name,version,builtin,local}] + local[]
|
|
37
|
+
config/settings.yaml
|
|
38
|
+
config/AGENTS.md
|
|
39
|
+
config/agent-presets/**
|
|
40
|
+
config/profile/{cordis.patch.yml,cordis.yml}
|
|
41
|
+
skills/<name>/**
|
|
42
|
+
redactions.json # 被脱敏字段
|
|
43
|
+
excluded.json # 被排除项
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 安装
|
|
47
|
+
|
|
48
|
+
- 在 DSH 的「插件市场」搜索并安装 `@worktool/dsh-config-sync`(或让插件管理器安装 npm 包 `@worktool/dsh-config-sync`)。
|
|
49
|
+
- 也可从本仓库源码本地安装:把插件管理器指向本目录即可(`dsh.bundle.patch` 会生效)。
|
|
50
|
+
|
|
51
|
+
安装后到「设置 → 配置同步」填写 Git(SSH)仓库地址即可。
|
|
52
|
+
|
|
53
|
+
## English
|
|
54
|
+
|
|
55
|
+
Export/import DSH global config, skills, and installed plugins (name@version); Git(SSH) cloud sync to your own repo. Secrets are never exported; settings containing secret keys are redacted. Configure the repo under Settings → Config Sync.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="cs" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#4a86e8"/>
|
|
5
|
+
<stop offset="1" stop-color="#3aa66f"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect x="10" y="10" width="44" height="44" rx="12" fill="#e8f0fe"/>
|
|
9
|
+
<rect x="10" y="10" width="44" height="44" rx="12" fill="none" stroke="url(#cs)" stroke-width="2"/>
|
|
10
|
+
<path d="M20 27h18a5 5 0 0 1 5 5v2" fill="none" stroke="url(#cs)" stroke-width="3" stroke-linecap="round"/>
|
|
11
|
+
<path d="M40 30l3 4 3-4" fill="none" stroke="#3aa66f" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
12
|
+
<path d="M44 40H26a5 5 0 0 1-5-5v-2" fill="none" stroke="url(#cs)" stroke-width="3" stroke-linecap="round"/>
|
|
13
|
+
<path d="M24 37l-3-4-3 4" fill="none" stroke="#4a86e8" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
14
|
+
</svg>
|
package/cordis.patch.yml
ADDED
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 配置同步 · 详情
|
|
2
|
+
|
|
3
|
+
## 数据流
|
|
4
|
+
|
|
5
|
+
1. 用户在「设置 → 配置同步」勾选要同步的内容。
|
|
6
|
+
2. Host 半扫描 `~/.dsh` 下白名单路径,`settings.yaml` 经过密钥脱敏,打包到 `~/.dsh/config-sync/repo`。
|
|
7
|
+
3. 点击「推送到仓库」:在该工作副本执行 `git add/commit/push`(SSH)。
|
|
8
|
+
4. 新机器点击「拉取并导入」:`git fetch/reset` → 备份当前 → 按 `plugins.json` 调 `pluginManager.installBundle(name@version)` 自动装插件 → 还原配置与 skills。
|
|
9
|
+
|
|
10
|
+
## Host 半能力(调用的 DSH 服务)
|
|
11
|
+
|
|
12
|
+
- `connection.fetch.register`:注册 `/api/worktool/dsh-config-sync/*` 路由
|
|
13
|
+
- `pluginManager.installBundle / updateBundle`:导入时安装/升级插件
|
|
14
|
+
- `tools.register`:注册 5 个 Agent 工具
|
|
15
|
+
|
|
16
|
+
## 安全
|
|
17
|
+
|
|
18
|
+
- 只读/白名单扫描,`.credentials.yaml`、`.env` 等永不读取。
|
|
19
|
+
- `settings.yaml` 只对**密钥类键名**(apikey/secret/token/password/bearer/privateKey/accessKey 等)的值清空(`apiKeyEnv` 等环境变量名保留,`maxTokens`/`contextWindow` 等普通参数保留);导入时若本机已有该密钥则保留本机值,避免被脱敏空值覆盖。
|
|
20
|
+
- Git 凭据走系统 SSH/凭据助手,不写入同步包。
|
|
21
|
+
|
|
22
|
+
## 注意
|
|
23
|
+
|
|
24
|
+
- 导入配置与插件后通常需要 **重启 DSH** 才能全部生效。
|
|
25
|
+
- 本地 `link:`/`file:` 插件无法在别的机器自动安装,会在结果里列出并跳过。
|
|
26
|
+
- 首次 `git push` 到 **空仓库** 会自动建立分支;请确保该 SSH key 已加入对应仓库(如 Gitee 的部署公钥/账户公钥)。
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@worktool/dsh-config-sync",
|
|
3
|
+
factory(require) {
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const h = React.createElement;
|
|
6
|
+
const API = "/api/worktool/dsh-config-sync";
|
|
7
|
+
const HDRS = { "content-type": "application/json", "x-dsh-config-sync": "1" };
|
|
8
|
+
|
|
9
|
+
async function api(pathname, body) {
|
|
10
|
+
const res = await fetch(API + pathname, {
|
|
11
|
+
method: body ? "POST" : "GET",
|
|
12
|
+
headers: HDRS,
|
|
13
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
14
|
+
});
|
|
15
|
+
let json;
|
|
16
|
+
try {
|
|
17
|
+
json = await res.json();
|
|
18
|
+
} catch {
|
|
19
|
+
throw new Error("HTTP " + res.status);
|
|
20
|
+
}
|
|
21
|
+
if (!json.ok) throw new Error(json.error || "HTTP " + res.status);
|
|
22
|
+
return json.data;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const styles = {
|
|
26
|
+
wrap: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "column",
|
|
29
|
+
gap: "14px",
|
|
30
|
+
padding: "4px 2px 40px",
|
|
31
|
+
color: "var(--dsw-alias-label-primary, #eee)",
|
|
32
|
+
fontFamily: "inherit",
|
|
33
|
+
maxWidth: "820px",
|
|
34
|
+
},
|
|
35
|
+
card: {
|
|
36
|
+
border: "0.5px solid var(--dsw-alias-border-l2, #494949)",
|
|
37
|
+
borderRadius: "16px",
|
|
38
|
+
background: "var(--dsw-alias-bg-layer-1, transparent)",
|
|
39
|
+
padding: "16px 18px",
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
gap: "12px",
|
|
43
|
+
},
|
|
44
|
+
title: { margin: 0, fontSize: "22px", lineHeight: "30px", fontWeight: 600 },
|
|
45
|
+
desc: { margin: 0, color: "var(--dsw-alias-label-tertiary, #a0a0a0)", fontSize: "13px", lineHeight: "20px" },
|
|
46
|
+
row: { display: "flex", alignItems: "center", gap: "10px", flexWrap: "wrap" },
|
|
47
|
+
label: { fontSize: "12px", color: "var(--dsw-alias-label-secondary, #b9b9b9)", minWidth: "84px" },
|
|
48
|
+
input: {
|
|
49
|
+
flex: "1 1 320px",
|
|
50
|
+
height: "34px",
|
|
51
|
+
padding: "0 12px",
|
|
52
|
+
borderRadius: "10px",
|
|
53
|
+
border: "0.5px solid var(--dsw-alias-border-l3, #555)",
|
|
54
|
+
background: "var(--dsw-alias-bg-layer-2, transparent)",
|
|
55
|
+
color: "var(--dsw-alias-label-primary, #eee)",
|
|
56
|
+
fontSize: "13px",
|
|
57
|
+
boxSizing: "border-box",
|
|
58
|
+
},
|
|
59
|
+
btn: {
|
|
60
|
+
height: "32px",
|
|
61
|
+
padding: "0 14px",
|
|
62
|
+
borderRadius: "9px",
|
|
63
|
+
border: "0.5px solid var(--dsw-alias-border-l3, #555)",
|
|
64
|
+
background: "var(--dsw-alias-bg-layer-2, transparent)",
|
|
65
|
+
color: "var(--dsw-alias-label-primary, #eee)",
|
|
66
|
+
fontSize: "13px",
|
|
67
|
+
cursor: "pointer",
|
|
68
|
+
},
|
|
69
|
+
btnPrimary: {
|
|
70
|
+
height: "32px",
|
|
71
|
+
padding: "0 16px",
|
|
72
|
+
borderRadius: "9px",
|
|
73
|
+
border: "0.5px solid var(--dsw-alias-brand-primary, #4a86e8)",
|
|
74
|
+
background: "var(--dsw-alias-brand-primary, #4a86e8)",
|
|
75
|
+
color: "#fff",
|
|
76
|
+
fontSize: "13px",
|
|
77
|
+
fontWeight: 600,
|
|
78
|
+
cursor: "pointer",
|
|
79
|
+
},
|
|
80
|
+
chk: { display: "inline-flex", alignItems: "center", gap: "6px", fontSize: "13px", color: "var(--dsw-alias-label-secondary, #b9b9b9)" },
|
|
81
|
+
log: {
|
|
82
|
+
margin: 0,
|
|
83
|
+
padding: "10px 12px",
|
|
84
|
+
borderRadius: "10px",
|
|
85
|
+
background: "var(--dsw-alias-bg-layer-2, rgba(128,128,128,.08))",
|
|
86
|
+
color: "var(--dsw-alias-label-secondary, #b9b9b9)",
|
|
87
|
+
fontSize: "12px",
|
|
88
|
+
lineHeight: "18px",
|
|
89
|
+
whiteSpace: "pre-wrap",
|
|
90
|
+
wordBreak: "break-word",
|
|
91
|
+
maxHeight: "240px",
|
|
92
|
+
overflow: "auto",
|
|
93
|
+
fontFamily: "ui-monospace, SFMono-Regular, Consolas, monospace",
|
|
94
|
+
},
|
|
95
|
+
hint: { fontSize: "11px", color: "var(--dsw-alias-label-tertiary, #a0a0a0)", lineHeight: "17px" },
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
function ConfigSyncSection() {
|
|
99
|
+
const [st, setSt] = React.useState(null);
|
|
100
|
+
const [repoUrl, setRepoUrl] = React.useState("");
|
|
101
|
+
const [branch, setBranch] = React.useState("main");
|
|
102
|
+
const [inc, setInc] = React.useState({ settings: true, agents: true, presets: true, skills: true, plugins: true, optional: false });
|
|
103
|
+
const [busy, setBusy] = React.useState("");
|
|
104
|
+
const [log, setLog] = React.useState("");
|
|
105
|
+
|
|
106
|
+
const push = (line) => setLog((prev) => (prev ? prev + "\n" : "") + line);
|
|
107
|
+
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
api("/state")
|
|
110
|
+
.then((s) => {
|
|
111
|
+
setSt(s);
|
|
112
|
+
setRepoUrl(s.repoUrl || "");
|
|
113
|
+
setBranch(s.branch || "main");
|
|
114
|
+
if (s.include) setInc({ ...inc, ...s.include });
|
|
115
|
+
})
|
|
116
|
+
.catch((e) => push("加载状态失败: " + e.message));
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
async function run(label, fn) {
|
|
120
|
+
setBusy(label);
|
|
121
|
+
push("▶ " + label + " …");
|
|
122
|
+
try {
|
|
123
|
+
const data = await fn();
|
|
124
|
+
push("✓ " + label + " 完成: " + JSON.stringify(data.counts || data, null, 0).slice(0, 800));
|
|
125
|
+
const s = await api("/state").catch(() => null);
|
|
126
|
+
if (s) setSt(s);
|
|
127
|
+
} catch (e) {
|
|
128
|
+
push("✗ " + label + " 失败: " + e.message);
|
|
129
|
+
} finally {
|
|
130
|
+
setBusy("");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const toggle = (k) => (ev) => setInc({ ...inc, [k]: ev.target.checked });
|
|
135
|
+
|
|
136
|
+
const chk = (k, labelText) =>
|
|
137
|
+
h("label", { style: styles.chk }, h("input", { type: "checkbox", checked: !!inc[k], onChange: toggle(k) }), labelText);
|
|
138
|
+
|
|
139
|
+
return h(
|
|
140
|
+
"section",
|
|
141
|
+
{ style: styles.wrap },
|
|
142
|
+
h(
|
|
143
|
+
"div",
|
|
144
|
+
{ style: styles.card },
|
|
145
|
+
h("h2", { style: styles.title }, "配置同步"),
|
|
146
|
+
h(
|
|
147
|
+
"p",
|
|
148
|
+
{ style: styles.desc },
|
|
149
|
+
"把 DSH 的全局配置(settings、AGENTS.md、agent-presets)、全局 Skills、已安装插件(name@version)导出为一个可同步的仓库;导入时自动下载安装插件。密钥与运行时会话数据永不导出。"
|
|
150
|
+
),
|
|
151
|
+
h(
|
|
152
|
+
"div",
|
|
153
|
+
{ style: styles.row },
|
|
154
|
+
h("span", { style: styles.label }, "仓库地址"),
|
|
155
|
+
h("input", {
|
|
156
|
+
style: styles.input,
|
|
157
|
+
placeholder: "git@gitee.com:you/dsh-config.git(SSH)",
|
|
158
|
+
value: repoUrl,
|
|
159
|
+
onChange: (e) => setRepoUrl(e.target.value),
|
|
160
|
+
})
|
|
161
|
+
),
|
|
162
|
+
h(
|
|
163
|
+
"div",
|
|
164
|
+
{ style: styles.row },
|
|
165
|
+
h("span", { style: styles.label }, "分支"),
|
|
166
|
+
h("input", { style: { ...styles.input, flex: "0 1 160px" }, value: branch, onChange: (e) => setBranch(e.target.value) })
|
|
167
|
+
),
|
|
168
|
+
h(
|
|
169
|
+
"div",
|
|
170
|
+
{ style: styles.row },
|
|
171
|
+
chk("settings", "settings.yaml"),
|
|
172
|
+
chk("agents", "AGENTS.md"),
|
|
173
|
+
chk("presets", "agent-presets"),
|
|
174
|
+
chk("skills", "Skills"),
|
|
175
|
+
chk("plugins", "插件"),
|
|
176
|
+
chk("optional", "主题/环境(可选)")
|
|
177
|
+
),
|
|
178
|
+
h(
|
|
179
|
+
"div",
|
|
180
|
+
{ style: styles.row },
|
|
181
|
+
h("button", { style: styles.btn, disabled: !!busy, onClick: () => run("导出到本地同步仓", () => api("/export", { include: inc })) }, "导出"),
|
|
182
|
+
h("button", { style: styles.btn, disabled: !!busy, onClick: () => run("从本地同步仓导入", () => api("/import", { include: inc })) }, "本地导入"),
|
|
183
|
+
h(
|
|
184
|
+
"button",
|
|
185
|
+
{ style: styles.btnPrimary, disabled: !!busy, onClick: () => run("推送到仓库", () => api("/push", { repoUrl, branch, include: inc })) },
|
|
186
|
+
"推送到仓库"
|
|
187
|
+
),
|
|
188
|
+
h(
|
|
189
|
+
"button",
|
|
190
|
+
{ style: styles.btn, disabled: !!busy, onClick: () => run("从仓库拉取并导入", () => api("/pull", { repoUrl, branch })) },
|
|
191
|
+
"拉取并导入"
|
|
192
|
+
)
|
|
193
|
+
),
|
|
194
|
+
h(
|
|
195
|
+
"p",
|
|
196
|
+
{ style: styles.hint },
|
|
197
|
+
st
|
|
198
|
+
? `同步仓:${st.repoDir} | 插件 ${st.pluginCount} | skills 文件 ${st.skillsCount} | 上次同步:${st.lastSync || "无"} | 上次备份:${st.lastBackup || "无"}`
|
|
199
|
+
: "加载中…"
|
|
200
|
+
),
|
|
201
|
+
h(
|
|
202
|
+
"p",
|
|
203
|
+
{ style: styles.hint },
|
|
204
|
+
"永不导出:.credentials.yaml、.env、mcp_connector_grants/、storages/、sessions/、cache/、node_modules/ 等。settings 中含密钥的字段会被自动脱敏。"
|
|
205
|
+
)
|
|
206
|
+
),
|
|
207
|
+
log ? h("pre", { style: styles.log }, log) : null,
|
|
208
|
+
busy ? h("p", { style: styles.hint }, "处理中:" + busy + " …(安装插件可能较慢)") : null
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
inject: ["slots"],
|
|
214
|
+
apply(ctx) {
|
|
215
|
+
ctx.slots.inject("settings.section", () => {
|
|
216
|
+
try {
|
|
217
|
+
return ctx.slots.register(
|
|
218
|
+
{
|
|
219
|
+
name: "settings.section",
|
|
220
|
+
id: "dsh-config-sync",
|
|
221
|
+
order: 60,
|
|
222
|
+
label: () => "配置同步",
|
|
223
|
+
icon: "settings",
|
|
224
|
+
},
|
|
225
|
+
ConfigSyncSection
|
|
226
|
+
);
|
|
227
|
+
} catch (e) {
|
|
228
|
+
console.warn("config-sync: register settings.section failed:", e);
|
|
229
|
+
return () => {};
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
});
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
import { readFile, writeFile, mkdir, readdir, rm, cp, copyFile, access, stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import { execFile } from "node:child_process";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const execFileP = promisify(execFile);
|
|
9
|
+
|
|
10
|
+
export const name = "config-sync";
|
|
11
|
+
export const inject = ["connection", "pluginManager", "tools"];
|
|
12
|
+
|
|
13
|
+
const TOOL_ID = "@worktool/dsh-config-sync";
|
|
14
|
+
const PKG_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
15
|
+
async function toolVersion() {
|
|
16
|
+
const j = await readJson(path.join(PKG_ROOT, "package.json"), null);
|
|
17
|
+
return j && typeof j.version === "string" ? j.version : "0.0.0";
|
|
18
|
+
}
|
|
19
|
+
const API_PREFIX = "/api/worktool/dsh-config-sync";
|
|
20
|
+
const MARKER_HEADER = "x-dsh-config-sync";
|
|
21
|
+
const OFFICIAL_REGISTRY = "https://registry.npmjs.org/";
|
|
22
|
+
|
|
23
|
+
const HOME = os.homedir();
|
|
24
|
+
const DSH_HOME = process.env.DSH_HOME || path.join(HOME, ".dsh");
|
|
25
|
+
const PROFILE = process.env.DSH_PROFILE || "desktop";
|
|
26
|
+
const PROFILE_DIR = path.join(DSH_HOME, "profiles", PROFILE);
|
|
27
|
+
const STATE_DIR = path.join(DSH_HOME, "config-sync");
|
|
28
|
+
const REPO_DIR = path.join(STATE_DIR, "repo");
|
|
29
|
+
const BACKUP_DIR = path.join(STATE_DIR, "backups");
|
|
30
|
+
const STATE_FILE = path.join(STATE_DIR, "state.json");
|
|
31
|
+
|
|
32
|
+
// 只把「密钥类」键名视为敏感。注意排除 maxTokens / contextWindow 这类普通参数:
|
|
33
|
+
// 用「整词等于/前缀/后缀」判断,maxTokens → "maxtokens" 不以 token 结尾、也不以之开头,故不会被误清空。
|
|
34
|
+
const SECRET_WORDS = ["apikey", "secret", "token", "password", "passwd", "authorization", "bearer", "privatekey", "accesskey", "credential"];
|
|
35
|
+
function isSecretKey(key) {
|
|
36
|
+
const k = String(key).toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
37
|
+
if (!k) return false;
|
|
38
|
+
return SECRET_WORDS.some((w) => k === w || k.startsWith(w) || k.endsWith(w));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const DEFAULT_INCLUDE = {
|
|
42
|
+
settings: true,
|
|
43
|
+
agents: true,
|
|
44
|
+
presets: true,
|
|
45
|
+
skills: true,
|
|
46
|
+
plugins: true,
|
|
47
|
+
optional: false,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const ALWAYS_EXCLUDED = [
|
|
51
|
+
".credentials.yaml",
|
|
52
|
+
".env",
|
|
53
|
+
"mcp_connector_grants/",
|
|
54
|
+
"storages/ (运行时状态)",
|
|
55
|
+
"sessions/",
|
|
56
|
+
"cache/",
|
|
57
|
+
"attachments/",
|
|
58
|
+
"node_modules/",
|
|
59
|
+
"pnpm-lock.yaml",
|
|
60
|
+
"*.log",
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/* ------------------------------------------------------------------ utils */
|
|
64
|
+
|
|
65
|
+
async function exists(p) {
|
|
66
|
+
try {
|
|
67
|
+
await access(p);
|
|
68
|
+
return true;
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function readJson(file, fallback) {
|
|
75
|
+
try {
|
|
76
|
+
return JSON.parse(await readFile(file, "utf8"));
|
|
77
|
+
} catch {
|
|
78
|
+
return fallback;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function writeJson(file, obj) {
|
|
83
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
84
|
+
await writeFile(file, JSON.stringify(obj, null, 2) + "\n", "utf8");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function loadState() {
|
|
88
|
+
const s = await readJson(STATE_FILE, {});
|
|
89
|
+
return {
|
|
90
|
+
repoUrl: s.repoUrl || "",
|
|
91
|
+
branch: s.branch || "main",
|
|
92
|
+
include: { ...DEFAULT_INCLUDE, ...(s.include || {}) },
|
|
93
|
+
lastSync: s.lastSync || null,
|
|
94
|
+
lastBackup: s.lastBackup || null,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function saveState(patch) {
|
|
99
|
+
const cur = await loadState();
|
|
100
|
+
const next = { ...cur, ...patch };
|
|
101
|
+
await writeJson(STATE_FILE, next);
|
|
102
|
+
return next;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function copyDir(src, dst, skip = ["node_modules", ".git"]) {
|
|
106
|
+
if (!(await exists(src))) return 0;
|
|
107
|
+
let count = 0;
|
|
108
|
+
await mkdir(dst, { recursive: true });
|
|
109
|
+
const entries = await readdir(src, { withFileTypes: true });
|
|
110
|
+
for (const e of entries) {
|
|
111
|
+
if (skip.includes(e.name)) continue;
|
|
112
|
+
const s = path.join(src, e.name);
|
|
113
|
+
const d = path.join(dst, e.name);
|
|
114
|
+
if (e.isDirectory()) {
|
|
115
|
+
count += await copyDir(s, d, skip);
|
|
116
|
+
} else if (e.isFile()) {
|
|
117
|
+
await mkdir(path.dirname(d), { recursive: true });
|
|
118
|
+
await copyFile(s, d);
|
|
119
|
+
count += 1;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return count;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function countFiles(dir) {
|
|
126
|
+
if (!(await exists(dir))) return 0;
|
|
127
|
+
let n = 0;
|
|
128
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
129
|
+
for (const e of entries) {
|
|
130
|
+
if (e.isDirectory()) n += await countFiles(path.join(dir, e.name));
|
|
131
|
+
else if (e.isFile()) n += 1;
|
|
132
|
+
}
|
|
133
|
+
return n;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function sanitizeYaml(text) {
|
|
137
|
+
let redactions = 0;
|
|
138
|
+
const out = text.split(/\r?\n/).map((line) => {
|
|
139
|
+
const m = line.match(/^(\s*)([A-Za-z0-9_.\-]+)\s*:\s*(.*)$/);
|
|
140
|
+
if (!m) return line;
|
|
141
|
+
const key = m[2];
|
|
142
|
+
if (/env$/i.test(key)) return line; // e.g. apiKeyEnv — 只是环境变量名
|
|
143
|
+
if (!isSecretKey(key)) return line;
|
|
144
|
+
const val = m[3].trim();
|
|
145
|
+
if (isBlankYamlValue(val)) return line;
|
|
146
|
+
redactions += 1;
|
|
147
|
+
return `${m[1]}${m[2]}: ""`;
|
|
148
|
+
}).join("\n");
|
|
149
|
+
return { text: out, redactions };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* 导入时:把导出包里被脱敏成空串的密钥字段,用本机已有值补回,避免覆盖丢密钥 */
|
|
153
|
+
function isBlankYamlValue(v) {
|
|
154
|
+
const t = String(v == null ? "" : v).trim();
|
|
155
|
+
return t === "" || t === '""' || t === "''" || t === "~" || t === "null";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function extractSecretValues(text) {
|
|
159
|
+
const map = new Map();
|
|
160
|
+
for (const line of text.split(/\r?\n/)) {
|
|
161
|
+
const m = line.match(/^(\s*)([A-Za-z0-9_.\-]+)\s*:\s*(.*)$/);
|
|
162
|
+
if (!m) continue;
|
|
163
|
+
if (/env$/i.test(m[2])) continue;
|
|
164
|
+
if (!isSecretKey(m[2])) continue;
|
|
165
|
+
const val = m[3].trim();
|
|
166
|
+
if (!isBlankYamlValue(val)) map.set(m[2], val);
|
|
167
|
+
}
|
|
168
|
+
return map;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function mergeSettingsPreservingSecrets(existingText, incomingText) {
|
|
172
|
+
if (!existingText) return { text: incomingText, preserved: 0 };
|
|
173
|
+
const existing = extractSecretValues(existingText);
|
|
174
|
+
let preserved = 0;
|
|
175
|
+
const out = incomingText.split(/\r?\n/).map((line) => {
|
|
176
|
+
const m = line.match(/^(\s*)([A-Za-z0-9_.\-]+)\s*:\s*(.*)$/);
|
|
177
|
+
if (!m) return line;
|
|
178
|
+
if (/env$/i.test(m[2])) return line;
|
|
179
|
+
if (!isSecretKey(m[2])) return line;
|
|
180
|
+
const val = m[3].trim();
|
|
181
|
+
if (!isBlankYamlValue(val)) return line; // 导出包带了真实值,保留它的
|
|
182
|
+
const prev = existing.get(m[2]);
|
|
183
|
+
if (!prev) return line;
|
|
184
|
+
preserved += 1;
|
|
185
|
+
return `${m[1]}${m[2]}: ${prev}`;
|
|
186
|
+
}).join("\n");
|
|
187
|
+
return { text: out, preserved };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function installedVersion(pkgName) {
|
|
191
|
+
const p = path.join(PROFILE_DIR, "node_modules", pkgName, "package.json");
|
|
192
|
+
const j = await readJson(p, null);
|
|
193
|
+
return j && typeof j.version === "string" ? j.version : null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async function profilePlugins() {
|
|
197
|
+
const pkg = await readJson(path.join(PROFILE_DIR, "package.json"), {});
|
|
198
|
+
const bundles = (pkg && pkg.dsh && pkg.dsh.profile && pkg.dsh.profile.bundles) || [];
|
|
199
|
+
const deps = pkg.dependencies || {};
|
|
200
|
+
const list = [];
|
|
201
|
+
for (const name of bundles) {
|
|
202
|
+
const spec = typeof deps[name] === "string" ? deps[name] : null;
|
|
203
|
+
const local = !!(spec && (spec.startsWith("link:") || spec.startsWith("file:")));
|
|
204
|
+
const version = (await installedVersion(name)) || (spec && !local ? spec.replace(/^[^\d]*/, "") : null) || "unknown";
|
|
205
|
+
list.push({
|
|
206
|
+
name,
|
|
207
|
+
version,
|
|
208
|
+
spec,
|
|
209
|
+
local,
|
|
210
|
+
builtin: name.startsWith("@deepseek-ai/") || name.startsWith("dsh-"),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return { pkg, deps, list };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async function dshVersion() {
|
|
217
|
+
const candidates = [
|
|
218
|
+
process.env.DSH_VERSION,
|
|
219
|
+
path.join(DSH_HOME, "..", "package.json"),
|
|
220
|
+
].filter(Boolean);
|
|
221
|
+
for (const c of candidates) {
|
|
222
|
+
const j = await readJson(c, null);
|
|
223
|
+
if (j && typeof j.version === "string" && j.name && j.name.includes("dsh")) return j.version;
|
|
224
|
+
}
|
|
225
|
+
return "unknown";
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* --------------------------------------------------------------- export */
|
|
229
|
+
|
|
230
|
+
async function buildExport(includeIn) {
|
|
231
|
+
const include = { ...DEFAULT_INCLUDE, ...(includeIn || {}) };
|
|
232
|
+
await mkdir(REPO_DIR, { recursive: true });
|
|
233
|
+
// 清掉上一次的包内容(保留 .git)
|
|
234
|
+
for (const p of ["manifest.json", "plugins.json", "redactions.json", "excluded.json", "config", "skills"]) {
|
|
235
|
+
await rm(path.join(REPO_DIR, p), { recursive: true, force: true });
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const counts = { files: 0, skills: 0, plugins: 0, redactions: 0 };
|
|
239
|
+
const redactionsList = [];
|
|
240
|
+
|
|
241
|
+
// settings.yaml(脱敏)
|
|
242
|
+
if (include.settings) {
|
|
243
|
+
const f = path.join(DSH_HOME, "settings.yaml");
|
|
244
|
+
if (await exists(f)) {
|
|
245
|
+
const raw = await readFile(f, "utf8");
|
|
246
|
+
const { text, redactions } = sanitizeYaml(raw);
|
|
247
|
+
await mkdir(path.join(REPO_DIR, "config"), { recursive: true });
|
|
248
|
+
await writeFile(path.join(REPO_DIR, "config", "settings.yaml"), text, "utf8");
|
|
249
|
+
counts.files += 1;
|
|
250
|
+
counts.redactions += redactions;
|
|
251
|
+
if (redactions) redactionsList.push({ file: "settings.yaml", fields: redactions });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// 全局 AGENTS.md
|
|
256
|
+
if (include.agents) {
|
|
257
|
+
const f = path.join(DSH_HOME, "AGENTS.md");
|
|
258
|
+
if (await exists(f)) {
|
|
259
|
+
await copyFile(f, path.join(REPO_DIR, "config", "AGENTS.md"));
|
|
260
|
+
counts.files += 1;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// agent-presets
|
|
265
|
+
if (include.presets) {
|
|
266
|
+
const n = await copyDir(path.join(DSH_HOME, ".agent-presets"), path.join(REPO_DIR, "config", "agent-presets"));
|
|
267
|
+
counts.files += n;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// profile cordis 配置
|
|
271
|
+
for (const rel of ["cordis.patch.yml", "cordis.yml"]) {
|
|
272
|
+
const f = path.join(PROFILE_DIR, rel);
|
|
273
|
+
if (await exists(f)) {
|
|
274
|
+
const dst = path.join(REPO_DIR, "config", "profile", rel);
|
|
275
|
+
await mkdir(path.dirname(dst), { recursive: true });
|
|
276
|
+
await copyFile(f, dst);
|
|
277
|
+
counts.files += 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// skills
|
|
282
|
+
if (include.skills) {
|
|
283
|
+
const n = await copyDir(path.join(DSH_HOME, "skills"), path.join(REPO_DIR, "skills"));
|
|
284
|
+
counts.skills = n;
|
|
285
|
+
counts.files += n;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 插件清单
|
|
289
|
+
if (include.plugins) {
|
|
290
|
+
const info = await profilePlugins();
|
|
291
|
+
const payload = {
|
|
292
|
+
generatedAt: new Date().toISOString(),
|
|
293
|
+
profile: PROFILE,
|
|
294
|
+
bundles: info.list,
|
|
295
|
+
local: info.list.filter((p) => p.local).map((p) => p.name),
|
|
296
|
+
};
|
|
297
|
+
await writeJson(path.join(REPO_DIR, "plugins.json"), payload);
|
|
298
|
+
counts.plugins = info.list.length;
|
|
299
|
+
counts.files += 1;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// 可选:环境/主题类
|
|
303
|
+
if (include.optional) {
|
|
304
|
+
const f = path.join(DSH_HOME, "dream-skin.json");
|
|
305
|
+
if (await exists(f)) {
|
|
306
|
+
await copyFile(f, path.join(REPO_DIR, "config", "dream-skin.json"));
|
|
307
|
+
counts.files += 1;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// 脱敏与被排除清单
|
|
312
|
+
await writeJson(path.join(REPO_DIR, "redactions.json"), { generatedAt: new Date().toISOString(), entries: redactionsList });
|
|
313
|
+
await writeJson(path.join(REPO_DIR, "excluded.json"), { note: "以下内容永不进入同步包", patterns: ALWAYS_EXCLUDED });
|
|
314
|
+
counts.files += 2;
|
|
315
|
+
|
|
316
|
+
// manifest
|
|
317
|
+
const manifest = {
|
|
318
|
+
schema: 1,
|
|
319
|
+
exportedAt: new Date().toISOString(),
|
|
320
|
+
dshVersion: await dshVersion(),
|
|
321
|
+
tool: TOOL_ID,
|
|
322
|
+
toolVersion: await toolVersion(),
|
|
323
|
+
profile: PROFILE,
|
|
324
|
+
include,
|
|
325
|
+
counts,
|
|
326
|
+
};
|
|
327
|
+
await writeJson(path.join(REPO_DIR, "manifest.json"), manifest);
|
|
328
|
+
counts.files += 1;
|
|
329
|
+
|
|
330
|
+
return { dir: REPO_DIR, manifest, counts };
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/* --------------------------------------------------------------- import */
|
|
334
|
+
|
|
335
|
+
async function backupCurrent() {
|
|
336
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
337
|
+
const dir = path.join(BACKUP_DIR, stamp);
|
|
338
|
+
await mkdir(dir, { recursive: true });
|
|
339
|
+
const files = ["settings.yaml", "AGENTS.md"];
|
|
340
|
+
for (const f of files) {
|
|
341
|
+
const src = path.join(DSH_HOME, f);
|
|
342
|
+
if (await exists(src)) await copyFile(src, path.join(dir, f));
|
|
343
|
+
}
|
|
344
|
+
await copyDir(path.join(DSH_HOME, ".agent-presets"), path.join(dir, ".agent-presets"));
|
|
345
|
+
await copyDir(path.join(DSH_HOME, "skills"), path.join(dir, "skills"));
|
|
346
|
+
for (const rel of ["cordis.patch.yml", "cordis.yml", "package.json"]) {
|
|
347
|
+
const src = path.join(PROFILE_DIR, rel);
|
|
348
|
+
if (await exists(src)) await copyFile(src, path.join(dir, "profile-" + rel));
|
|
349
|
+
}
|
|
350
|
+
return dir;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
async function importPackage(dirIn, opts, ctx) {
|
|
354
|
+
const srcDir = dirIn || REPO_DIR;
|
|
355
|
+
const manifest = await readJson(path.join(srcDir, "manifest.json"), null);
|
|
356
|
+
if (!manifest || manifest.schema !== 1) {
|
|
357
|
+
throw Object.assign(new Error("非法或缺失的 manifest.json(需要 schema:1)"), { statusCode: 400, code: "error.badManifest" });
|
|
358
|
+
}
|
|
359
|
+
const backup = await backupCurrent();
|
|
360
|
+
await saveState({ lastBackup: backup });
|
|
361
|
+
|
|
362
|
+
const report = {
|
|
363
|
+
backup,
|
|
364
|
+
plugins: { installed: [], updated: [], skipped: [], failed: [] },
|
|
365
|
+
config: [],
|
|
366
|
+
skills: [],
|
|
367
|
+
needsRestart: false,
|
|
368
|
+
conflicts: [],
|
|
369
|
+
secretsPreserved: 0,
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
// 1) 插件
|
|
373
|
+
if (manifest.include ? manifest.include.plugins !== false : true) {
|
|
374
|
+
const pj = await readJson(path.join(srcDir, "plugins.json"), { bundles: [] });
|
|
375
|
+
for (const p of pj.bundles || []) {
|
|
376
|
+
if (p.builtin) {
|
|
377
|
+
report.plugins.skipped.push({ name: p.name, reason: "builtin" });
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
if (p.local) {
|
|
381
|
+
report.plugins.skipped.push({ name: p.name, reason: "local/link 插件需手动安装" });
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
const want = p.version && p.version !== "unknown" ? p.version : null;
|
|
385
|
+
const have = await installedVersion(p.name);
|
|
386
|
+
if (want && have === want) {
|
|
387
|
+
report.plugins.skipped.push({ name: p.name, reason: "already " + want });
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
const spec = want ? `${p.name}@${want}` : p.name;
|
|
391
|
+
try {
|
|
392
|
+
if (have && want && ctx.pluginManager) {
|
|
393
|
+
await ctx.pluginManager.updateBundle(p.name, want, { registry: OFFICIAL_REGISTRY });
|
|
394
|
+
report.plugins.updated.push({ name: p.name, from: have, to: want });
|
|
395
|
+
} else if (ctx.pluginManager) {
|
|
396
|
+
await ctx.pluginManager.installBundle(spec, { registry: OFFICIAL_REGISTRY });
|
|
397
|
+
report.plugins.installed.push({ name: p.name, version: want || "latest" });
|
|
398
|
+
} else {
|
|
399
|
+
report.plugins.failed.push({ name: p.name, error: "pluginManager 服务不可用" });
|
|
400
|
+
}
|
|
401
|
+
report.needsRestart = true;
|
|
402
|
+
} catch (e1) {
|
|
403
|
+
try {
|
|
404
|
+
await ctx.pluginManager.installBundle(spec);
|
|
405
|
+
report.plugins.installed.push({ name: p.name, version: want || "latest", note: "fallback registry" });
|
|
406
|
+
report.needsRestart = true;
|
|
407
|
+
} catch (e2) {
|
|
408
|
+
report.plugins.failed.push({ name: p.name, error: String((e2 && e2.message) || e1) });
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// 2) 配置
|
|
415
|
+
const cfgDir = path.join(srcDir, "config");
|
|
416
|
+
if (await exists(path.join(cfgDir, "settings.yaml"))) {
|
|
417
|
+
const incoming = await readFile(path.join(cfgDir, "settings.yaml"), "utf8");
|
|
418
|
+
const target = path.join(DSH_HOME, "settings.yaml");
|
|
419
|
+
let text = incoming;
|
|
420
|
+
if (await exists(target)) {
|
|
421
|
+
const merged = mergeSettingsPreservingSecrets(await readFile(target, "utf8"), incoming);
|
|
422
|
+
text = merged.text;
|
|
423
|
+
report.secretsPreserved = merged.preserved;
|
|
424
|
+
}
|
|
425
|
+
await writeFile(target, text, "utf8");
|
|
426
|
+
report.config.push("settings.yaml" + (report.secretsPreserved ? `(保留本机密钥 ${report.secretsPreserved} 项)` : ""));
|
|
427
|
+
report.needsRestart = true;
|
|
428
|
+
}
|
|
429
|
+
if (await exists(path.join(cfgDir, "AGENTS.md"))) {
|
|
430
|
+
await copyFile(path.join(cfgDir, "AGENTS.md"), path.join(DSH_HOME, "AGENTS.md"));
|
|
431
|
+
report.config.push("AGENTS.md");
|
|
432
|
+
}
|
|
433
|
+
if (await exists(path.join(cfgDir, "agent-presets"))) {
|
|
434
|
+
const n = await copyDir(path.join(cfgDir, "agent-presets"), path.join(DSH_HOME, ".agent-presets"));
|
|
435
|
+
report.config.push(`agent-presets (${n} files)`);
|
|
436
|
+
}
|
|
437
|
+
const profSrc = path.join(cfgDir, "profile");
|
|
438
|
+
for (const rel of ["cordis.patch.yml", "cordis.yml"]) {
|
|
439
|
+
const s = path.join(profSrc, rel);
|
|
440
|
+
if (await exists(s)) {
|
|
441
|
+
await copyFile(s, path.join(PROFILE_DIR, rel));
|
|
442
|
+
report.config.push("profile/" + rel);
|
|
443
|
+
report.needsRestart = true;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (await exists(path.join(cfgDir, "dream-skin.json"))) {
|
|
447
|
+
await copyFile(path.join(cfgDir, "dream-skin.json"), path.join(DSH_HOME, "dream-skin.json"));
|
|
448
|
+
report.config.push("dream-skin.json");
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// 3) skills
|
|
452
|
+
const skillsSrc = path.join(srcDir, "skills");
|
|
453
|
+
if (await exists(skillsSrc)) {
|
|
454
|
+
const entries = await readdir(skillsSrc, { withFileTypes: true });
|
|
455
|
+
for (const e of entries) {
|
|
456
|
+
if (!e.isDirectory()) continue;
|
|
457
|
+
const dst = path.join(DSH_HOME, "skills", e.name);
|
|
458
|
+
if (await exists(dst)) report.conflicts.push({ skill: e.name, action: "overwritten" });
|
|
459
|
+
await copyDir(path.join(skillsSrc, e.name), dst);
|
|
460
|
+
report.skills.push(e.name);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
report.needsRestart = report.needsRestart || report.config.length > 0 || report.skills.length > 0;
|
|
465
|
+
return report;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/* ------------------------------------------------------------------ git */
|
|
469
|
+
|
|
470
|
+
function gitEnv() {
|
|
471
|
+
return {
|
|
472
|
+
...process.env,
|
|
473
|
+
GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || "ssh -o StrictHostKeyChecking=no -o BatchMode=yes",
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
async function runGit(args) {
|
|
478
|
+
return execFileP("git", args, { cwd: REPO_DIR, env: gitEnv(), maxBuffer: 1024 * 1024 * 32 });
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
async function ensureRepo(repoUrl, branch) {
|
|
482
|
+
await mkdir(REPO_DIR, { recursive: true });
|
|
483
|
+
if (!(await exists(path.join(REPO_DIR, ".git")))) {
|
|
484
|
+
try {
|
|
485
|
+
await runGit(["init", "-b", branch || "main"]);
|
|
486
|
+
} catch {
|
|
487
|
+
await runGit(["init"]);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
// 确保有提交身份(仅在本仓库缺省时补,不覆盖全局配置)
|
|
491
|
+
try {
|
|
492
|
+
await runGit(["config", "user.email"]);
|
|
493
|
+
} catch {
|
|
494
|
+
await runGit(["config", "user.email", "dsh-config-sync@localhost"]).catch(() => {});
|
|
495
|
+
await runGit(["config", "user.name", "dsh-config-sync"]).catch(() => {});
|
|
496
|
+
}
|
|
497
|
+
if (repoUrl) {
|
|
498
|
+
try {
|
|
499
|
+
await runGit(["remote", "remove", "origin"]);
|
|
500
|
+
} catch {
|
|
501
|
+
/* no remote */
|
|
502
|
+
}
|
|
503
|
+
try {
|
|
504
|
+
await runGit(["remote", "add", "origin", repoUrl]);
|
|
505
|
+
} catch (e) {
|
|
506
|
+
throw Object.assign(new Error("设置远端仓库失败: " + String((e && e.stderr) || e)), { statusCode: 400 });
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
async function pushRepo(repoUrl, branch, includeIn) {
|
|
512
|
+
const br = branch || "main";
|
|
513
|
+
await ensureRepo(repoUrl, br);
|
|
514
|
+
const exp = await buildExport(includeIn);
|
|
515
|
+
await runGit(["add", "-A"]);
|
|
516
|
+
let committed = true;
|
|
517
|
+
try {
|
|
518
|
+
await runGit(["commit", "-m", `config-sync: ${new Date().toISOString()}`]);
|
|
519
|
+
} catch (e) {
|
|
520
|
+
committed = false; // nothing to commit
|
|
521
|
+
}
|
|
522
|
+
try {
|
|
523
|
+
await runGit(["branch", "-M", br]);
|
|
524
|
+
} catch {
|
|
525
|
+
/* ignore */
|
|
526
|
+
}
|
|
527
|
+
try {
|
|
528
|
+
const out = await runGit(["push", "-u", "origin", br]);
|
|
529
|
+
const now = new Date().toISOString();
|
|
530
|
+
await saveState({ repoUrl: repoUrl || (await loadState()).repoUrl, branch: br, lastSync: now });
|
|
531
|
+
return { ok: true, counts: exp.counts, committed, push: (out.stderr || out.stdout || "").trim(), at: now };
|
|
532
|
+
} catch (e) {
|
|
533
|
+
throw Object.assign(new Error("git push 失败: " + String((e && e.stderr) || e)), { statusCode: 502, stage: "push" });
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
async function pullRepo(repoUrl, branch, ctx) {
|
|
538
|
+
const br = branch || "main";
|
|
539
|
+
await ensureRepo(repoUrl, br);
|
|
540
|
+
try {
|
|
541
|
+
await runGit(["fetch", "origin", br]);
|
|
542
|
+
await runGit(["reset", "--hard", `origin/${br}`]);
|
|
543
|
+
} catch (e) {
|
|
544
|
+
throw Object.assign(new Error("git 拉取失败: " + String((e && e.stderr) || e)), { statusCode: 502, stage: "pull" });
|
|
545
|
+
}
|
|
546
|
+
const imp = await importPackage(REPO_DIR, {}, ctx);
|
|
547
|
+
await saveState({ repoUrl: repoUrl || (await loadState()).repoUrl, branch: br, lastSync: new Date().toISOString() });
|
|
548
|
+
return { ok: true, import: imp };
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/* --------------------------------------------------------------- status */
|
|
552
|
+
|
|
553
|
+
async function getStatus() {
|
|
554
|
+
const st = await loadState();
|
|
555
|
+
const info = await profilePlugins().catch(() => ({ list: [] }));
|
|
556
|
+
return {
|
|
557
|
+
dshHome: DSH_HOME,
|
|
558
|
+
profile: PROFILE,
|
|
559
|
+
profileDir: PROFILE_DIR,
|
|
560
|
+
repoDir: REPO_DIR,
|
|
561
|
+
repoUrl: st.repoUrl,
|
|
562
|
+
branch: st.branch,
|
|
563
|
+
include: st.include,
|
|
564
|
+
lastSync: st.lastSync,
|
|
565
|
+
lastBackup: st.lastBackup,
|
|
566
|
+
pluginCount: info.list.length,
|
|
567
|
+
skillsCount: await countFiles(path.join(DSH_HOME, "skills")),
|
|
568
|
+
excluded: ALWAYS_EXCLUDED,
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/* -------------------------------------------------------------- http api */
|
|
573
|
+
|
|
574
|
+
function jsonResponse(code, payload) {
|
|
575
|
+
const body = JSON.stringify(payload);
|
|
576
|
+
return new Response(body, {
|
|
577
|
+
status: code,
|
|
578
|
+
headers: {
|
|
579
|
+
"content-type": "application/json; charset=utf-8",
|
|
580
|
+
"cache-control": "no-store",
|
|
581
|
+
"content-length": String(Buffer.byteLength(body)),
|
|
582
|
+
},
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
async function readBody(req) {
|
|
587
|
+
const t = await req.text();
|
|
588
|
+
if (!t.trim()) return {};
|
|
589
|
+
try {
|
|
590
|
+
return JSON.parse(t);
|
|
591
|
+
} catch {
|
|
592
|
+
return {};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function mutationGuard(req) {
|
|
597
|
+
if (req.headers.get(MARKER_HEADER) !== "1") {
|
|
598
|
+
return { statusCode: 403, error: "缺少 " + MARKER_HEADER + " 头" };
|
|
599
|
+
}
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function registerRoutes(ctx) {
|
|
604
|
+
if (!ctx.connection || !ctx.connection.fetch || typeof ctx.connection.fetch.register !== "function") {
|
|
605
|
+
ctx.logger?.warn?.("config-sync: 需要 connection.fetch 才能注册路由");
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const routes = [
|
|
609
|
+
{
|
|
610
|
+
path: `${API_PREFIX}/state`,
|
|
611
|
+
methods: ["GET"],
|
|
612
|
+
fetch: async () => {
|
|
613
|
+
try {
|
|
614
|
+
return jsonResponse(200, { ok: true, data: await getStatus() });
|
|
615
|
+
} catch (e) {
|
|
616
|
+
return jsonResponse(500, { ok: false, error: String(e && e.message) });
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
path: `${API_PREFIX}/export`,
|
|
622
|
+
methods: ["POST"],
|
|
623
|
+
fetch: async (req) => {
|
|
624
|
+
const g = mutationGuard(req);
|
|
625
|
+
if (g) return jsonResponse(g.statusCode, { ok: false, error: g.error });
|
|
626
|
+
try {
|
|
627
|
+
const body = await readBody(req);
|
|
628
|
+
const r = await buildExport(body.include);
|
|
629
|
+
return jsonResponse(200, { ok: true, data: r });
|
|
630
|
+
} catch (e) {
|
|
631
|
+
return jsonResponse(500, { ok: false, error: String(e && e.message) });
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
path: `${API_PREFIX}/import`,
|
|
637
|
+
methods: ["POST"],
|
|
638
|
+
fetch: async (req) => {
|
|
639
|
+
const g = mutationGuard(req);
|
|
640
|
+
if (g) return jsonResponse(g.statusCode, { ok: false, error: g.error });
|
|
641
|
+
try {
|
|
642
|
+
const body = await readBody(req);
|
|
643
|
+
const r = await importPackage(body.dir, body, ctx);
|
|
644
|
+
return jsonResponse(200, { ok: true, data: r });
|
|
645
|
+
} catch (e) {
|
|
646
|
+
return jsonResponse(e && e.statusCode ? e.statusCode : 500, { ok: false, error: String(e && e.message) });
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
path: `${API_PREFIX}/push`,
|
|
652
|
+
methods: ["POST"],
|
|
653
|
+
fetch: async (req) => {
|
|
654
|
+
const g = mutationGuard(req);
|
|
655
|
+
if (g) return jsonResponse(g.statusCode, { ok: false, error: g.error });
|
|
656
|
+
try {
|
|
657
|
+
const body = await readBody(req);
|
|
658
|
+
const r = await pushRepo(body.repoUrl, body.branch, body.include);
|
|
659
|
+
return jsonResponse(200, { ok: true, data: r });
|
|
660
|
+
} catch (e) {
|
|
661
|
+
return jsonResponse(e && e.statusCode ? e.statusCode : 500, { ok: false, error: String(e && e.message) });
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
path: `${API_PREFIX}/pull`,
|
|
667
|
+
methods: ["POST"],
|
|
668
|
+
fetch: async (req) => {
|
|
669
|
+
const g = mutationGuard(req);
|
|
670
|
+
if (g) return jsonResponse(g.statusCode, { ok: false, error: g.error });
|
|
671
|
+
try {
|
|
672
|
+
const body = await readBody(req);
|
|
673
|
+
const r = await pullRepo(body.repoUrl, body.branch, ctx);
|
|
674
|
+
return jsonResponse(200, { ok: true, data: r });
|
|
675
|
+
} catch (e) {
|
|
676
|
+
return jsonResponse(e && e.statusCode ? e.statusCode : 500, { ok: false, error: String(e && e.message) });
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
];
|
|
681
|
+
|
|
682
|
+
ctx.effect(() => {
|
|
683
|
+
const disposers = routes.map((r) =>
|
|
684
|
+
ctx.connection.fetch.register({
|
|
685
|
+
path: r.path,
|
|
686
|
+
methods: r.methods,
|
|
687
|
+
requestBody: "buffered",
|
|
688
|
+
fetch: r.fetch,
|
|
689
|
+
})
|
|
690
|
+
);
|
|
691
|
+
return () => {
|
|
692
|
+
for (const d of disposers) {
|
|
693
|
+
try {
|
|
694
|
+
d();
|
|
695
|
+
} catch {
|
|
696
|
+
/* ignore */
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
}, "config-sync: API routes");
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/* ---------------------------------------------------------------- tools */
|
|
704
|
+
|
|
705
|
+
function registerTools(ctx) {
|
|
706
|
+
if (!ctx.tools || typeof ctx.tools.register !== "function") return;
|
|
707
|
+
const reg = (def) => ctx.effect(() => ctx.tools.register(def), `config-sync: tool ${def.name}`);
|
|
708
|
+
|
|
709
|
+
reg({
|
|
710
|
+
name: "config_sync_status",
|
|
711
|
+
description: "查看 DSH 配置同步的当前状态(同步仓路径、仓库地址、脚本计数、上次同步时间)。",
|
|
712
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
713
|
+
output: { schema: { type: "object" }, render: (_a, v) => [{ type: "text", text: `配置同步:插件 ${v.pluginCount},skills 文件 ${v.skillsCount},仓库 ${v.repoUrl || "(未配置)"},上次同步 ${v.lastSync || "无"}` }] },
|
|
714
|
+
async execute() {
|
|
715
|
+
return getStatus();
|
|
716
|
+
},
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
reg({
|
|
720
|
+
name: "config_sync_export",
|
|
721
|
+
description: "把 DSH 全局配置(脱敏)、全局 skills、已安装插件清单导出到本地同步仓(~/.dsh/config-sync/repo)。",
|
|
722
|
+
parameters: {
|
|
723
|
+
type: "object",
|
|
724
|
+
properties: {
|
|
725
|
+
settings: { type: "boolean", description: "导出 settings.yaml(脱敏)" },
|
|
726
|
+
agents: { type: "boolean", description: "导出 AGENTS.md" },
|
|
727
|
+
presets: { type: "boolean", description: "导出 agent-presets" },
|
|
728
|
+
skills: { type: "boolean", description: "导出全局 skills" },
|
|
729
|
+
plugins: { type: "boolean", description: "导出插件清单" },
|
|
730
|
+
optional: { type: "boolean", description: "导出主题/环境类(可选)" },
|
|
731
|
+
},
|
|
732
|
+
additionalProperties: false,
|
|
733
|
+
},
|
|
734
|
+
output: { schema: { type: "object" }, render: (_a, v) => [{ type: "text", text: `已导出到 ${v.dir}:${JSON.stringify(v.counts)}` }] },
|
|
735
|
+
async execute(args) {
|
|
736
|
+
return buildExport(args);
|
|
737
|
+
},
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
reg({
|
|
741
|
+
name: "config_sync_import",
|
|
742
|
+
description: "从本地同步仓(或指定目录)导入配置、skills 与插件(自动安装 name@version,优先官方 registry)。导入前会自动备份当前配置。",
|
|
743
|
+
parameters: { type: "object", properties: { dir: { type: "string", description: "包目录,默认 ~/.dsh/config-sync/repo" } }, additionalProperties: false },
|
|
744
|
+
output: { schema: { type: "object" }, render: (_a, v) => [{ type: "text", text: `导入完成:插件装 ${v.plugins.installed.length}、更新 ${v.plugins.updated.length}、失败 ${v.plugins.failed.length};skills ${v.skills.length};备份 ${v.backup}${v.needsRestart ? "(需重启生效)" : ""}` }] },
|
|
745
|
+
async execute(args) {
|
|
746
|
+
return importPackage(args && args.dir, {}, ctx);
|
|
747
|
+
},
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
reg({
|
|
751
|
+
name: "config_sync_push",
|
|
752
|
+
description: "导出并把配置推送到已配置的 Git 仓库(SSH)。可传 repoUrl 覆盖。",
|
|
753
|
+
parameters: {
|
|
754
|
+
type: "object",
|
|
755
|
+
properties: {
|
|
756
|
+
repoUrl: { type: "string", description: "Git 仓库地址(SSH,例如 git@gitee.com:you/dsh-config.git)" },
|
|
757
|
+
branch: { type: "string", description: "分支,默认 main" },
|
|
758
|
+
},
|
|
759
|
+
additionalProperties: false,
|
|
760
|
+
},
|
|
761
|
+
output: { schema: { type: "object" }, render: (_a, v) => [{ type: "text", text: `推送完成:${v.committed ? "已提交" : "无变更"}${v.push ? ";" + v.push : ""}` }] },
|
|
762
|
+
async execute(args) {
|
|
763
|
+
const st = await loadState();
|
|
764
|
+
return pushRepo((args && args.repoUrl) || st.repoUrl, (args && args.branch) || st.branch, (args && args.include) || st.include);
|
|
765
|
+
},
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
reg({
|
|
769
|
+
name: "config_sync_pull",
|
|
770
|
+
description: "从 Git 仓库拉取最新配置并导入(自动装插件)。",
|
|
771
|
+
parameters: {
|
|
772
|
+
type: "object",
|
|
773
|
+
properties: {
|
|
774
|
+
repoUrl: { type: "string", description: "Git 仓库地址(SSH)" },
|
|
775
|
+
branch: { type: "string", description: "分支,默认 main" },
|
|
776
|
+
},
|
|
777
|
+
additionalProperties: false,
|
|
778
|
+
},
|
|
779
|
+
output: { schema: { type: "object" }, render: (_a, v) => [{ type: "text", text: `拉取导入完成:插件装 ${v.import.plugins.installed.length}、失败 ${v.import.plugins.failed.length};skills ${v.import.skills.length}${v.import.needsRestart ? "(需重启生效)" : ""}` }] },
|
|
780
|
+
async execute(args) {
|
|
781
|
+
const st = await loadState();
|
|
782
|
+
return pullRepo((args && args.repoUrl) || st.repoUrl, (args && args.branch) || st.branch, ctx);
|
|
783
|
+
},
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/* ---------------------------------------------------------------- apply */
|
|
788
|
+
|
|
789
|
+
export function apply(ctx) {
|
|
790
|
+
registerRoutes(ctx);
|
|
791
|
+
registerTools(ctx);
|
|
792
|
+
}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worktool/dsh-config-sync",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "DSH 配置同步 — 导出/导入 DSH 全局配置、全局 Skills 与已安装插件(按 name@version),并支持通过 Git(SSH) 同步到自建仓库(如 Gitee)。",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"author": "SupremeIdol",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+ssh://git@github.com/SupremeIdol/dsh-config-sync.git"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/SupremeIdol/dsh-config-sync#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/SupremeIdol/dsh-config-sync/issues"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "lib/index.js",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./lib/index.js",
|
|
22
|
+
"./client": "./lib/client.js",
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
"./icon": "./assets/icon.svg",
|
|
25
|
+
"./locale/*.json": "./locale/*.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib",
|
|
29
|
+
"locale",
|
|
30
|
+
"assets",
|
|
31
|
+
"docs",
|
|
32
|
+
"cordis.patch.yml",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"dsh": {
|
|
36
|
+
"manifestVersion": 1,
|
|
37
|
+
"bundle": {
|
|
38
|
+
"patch": "./cordis.patch.yml"
|
|
39
|
+
},
|
|
40
|
+
"client": {
|
|
41
|
+
"platform": "web",
|
|
42
|
+
"immediately": true,
|
|
43
|
+
"inject": [
|
|
44
|
+
"@deepseek-ai/dsh-client-ui-slots",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-chat"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": "^22.19.0 || >=24.0.0",
|
|
51
|
+
"dsh": ">=0.2.2-rc.1 <0.3.0-0"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"deepseek-harness",
|
|
55
|
+
"dsh",
|
|
56
|
+
"dsh-plugin",
|
|
57
|
+
"config",
|
|
58
|
+
"sync",
|
|
59
|
+
"backup",
|
|
60
|
+
"git"
|
|
61
|
+
],
|
|
62
|
+
"icon": "./assets/icon.svg"
|
|
63
|
+
}
|