@liangjiehappy/dsh-ops 0.1.2 → 0.1.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/lib/index.js +17 -32
- package/package.json +1 -4
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 按 DSH 官方插件标准编写:
|
|
5
5
|
* · ESM,export const name / inject / apply
|
|
6
|
-
* · ctx.tools.register(
|
|
6
|
+
* · ctx.tools.register(({...}))
|
|
7
7
|
* · ctx.skills.register({...})
|
|
8
8
|
*
|
|
9
9
|
* 工具(7 個):
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* 认证用 dshio API key(https://dshio.org/me/ 生成)
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
26
25
|
import { ALL_SKILLS } from "./skills.js";
|
|
27
26
|
|
|
28
27
|
const BASE = "https://deepseekbase.com/work/api";
|
|
@@ -88,14 +87,13 @@ async function api(path, opts = {}, cfg = {}, signal) {
|
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
export function apply(ctx
|
|
92
|
-
const cfg = config || {};
|
|
90
|
+
export function apply(ctx) {
|
|
91
|
+
const cfg = (ctx && ctx.config) || {};
|
|
93
92
|
|
|
94
93
|
// ═══════════════════════════════════════════════════════════════
|
|
95
94
|
// 1. ops_status —— 所有站点状态摘要
|
|
96
95
|
// ═══════════════════════════════════════════════════════════════
|
|
97
|
-
ctx.tools.register(
|
|
98
|
-
defineTool({
|
|
96
|
+
ctx.tools.register({
|
|
99
97
|
name: "ops_status",
|
|
100
98
|
description:
|
|
101
99
|
"查看运维工作台管理的所有站点的当前状态:总分、分类得分、最近部署时间、未解决问题数。" +
|
|
@@ -134,14 +132,12 @@ export function apply(ctx, config = {}) {
|
|
|
134
132
|
}
|
|
135
133
|
return { text: lines.join("\n") };
|
|
136
134
|
},
|
|
137
|
-
|
|
138
|
-
);
|
|
135
|
+
});
|
|
139
136
|
|
|
140
137
|
// ═══════════════════════════════════════════════════════════════
|
|
141
138
|
// 2. ops_check —— 跑检查器
|
|
142
139
|
// ═══════════════════════════════════════════════════════════════
|
|
143
|
-
ctx.tools.register(
|
|
144
|
-
defineTool({
|
|
140
|
+
ctx.tools.register({
|
|
145
141
|
name: "ops_check",
|
|
146
142
|
description:
|
|
147
143
|
"对某个站点跑检查器(15 个),返回通过/警告/失败的详细结果。" +
|
|
@@ -189,14 +185,12 @@ export function apply(ctx, config = {}) {
|
|
|
189
185
|
}
|
|
190
186
|
return { text: lines.join("\n") };
|
|
191
187
|
},
|
|
192
|
-
|
|
193
|
-
);
|
|
188
|
+
});
|
|
194
189
|
|
|
195
190
|
// ═══════════════════════════════════════════════════════════════
|
|
196
191
|
// 3. ops_issues —— 未解决问题
|
|
197
192
|
// ═══════════════════════════════════════════════════════════════
|
|
198
|
-
ctx.tools.register(
|
|
199
|
-
defineTool({
|
|
193
|
+
ctx.tools.register({
|
|
200
194
|
name: "ops_issues",
|
|
201
195
|
description:
|
|
202
196
|
"列出某个站点未解决的问题,按严重程度排序,含首次发现时间和出现次数。" +
|
|
@@ -230,14 +224,12 @@ export function apply(ctx, config = {}) {
|
|
|
230
224
|
}
|
|
231
225
|
return { text: lines.join("\n") };
|
|
232
226
|
},
|
|
233
|
-
|
|
234
|
-
);
|
|
227
|
+
});
|
|
235
228
|
|
|
236
229
|
// ═══════════════════════════════════════════════════════════════
|
|
237
230
|
// 4. ops_snapshot —— 打快照
|
|
238
231
|
// ═══════════════════════════════════════════════════════════════
|
|
239
|
-
ctx.tools.register(
|
|
240
|
-
defineTool({
|
|
232
|
+
ctx.tools.register({
|
|
241
233
|
name: "ops_snapshot",
|
|
242
234
|
description:
|
|
243
235
|
"给某个站点当前状态打一份增量快照(只存变化的文件,未变的硬链接)。" +
|
|
@@ -266,14 +258,12 @@ export function apply(ctx, config = {}) {
|
|
|
266
258
|
` 耗时: ${d.duration_sec} 秒`,
|
|
267
259
|
};
|
|
268
260
|
},
|
|
269
|
-
|
|
270
|
-
);
|
|
261
|
+
});
|
|
271
262
|
|
|
272
263
|
// ═══════════════════════════════════════════════════════════════
|
|
273
264
|
// 5. ops_deploy —— 部署(含影响分析)
|
|
274
265
|
// ═══════════════════════════════════════════════════════════════
|
|
275
|
-
ctx.tools.register(
|
|
276
|
-
defineTool({
|
|
266
|
+
ctx.tools.register({
|
|
277
267
|
name: "ops_deploy",
|
|
278
268
|
description:
|
|
279
269
|
"部署某个站点到生产。内置三层保护:部署前影响分析(会删除哪些文件)、" +
|
|
@@ -316,14 +306,12 @@ export function apply(ctx, config = {}) {
|
|
|
316
306
|
const d = r.data || {};
|
|
317
307
|
return { text: d.output || JSON.stringify(d, null, 2) };
|
|
318
308
|
},
|
|
319
|
-
|
|
320
|
-
);
|
|
309
|
+
});
|
|
321
310
|
|
|
322
311
|
// ═══════════════════════════════════════════════════════════════
|
|
323
312
|
// 6. ops_rollback —— 回滚
|
|
324
313
|
// ═══════════════════════════════════════════════════════════════
|
|
325
|
-
ctx.tools.register(
|
|
326
|
-
defineTool({
|
|
314
|
+
ctx.tools.register({
|
|
327
315
|
name: "ops_rollback",
|
|
328
316
|
description:
|
|
329
317
|
"把某个站点回滚到指定快照。不传 snapshot_id 就用最近一个快照。" +
|
|
@@ -359,14 +347,12 @@ export function apply(ctx, config = {}) {
|
|
|
359
347
|
const d = r.data || {};
|
|
360
348
|
return { text: d.output || JSON.stringify(d, null, 2) };
|
|
361
349
|
},
|
|
362
|
-
|
|
363
|
-
);
|
|
350
|
+
});
|
|
364
351
|
|
|
365
352
|
// ═══════════════════════════════════════════════════════════════
|
|
366
353
|
// 7. ops_restart —— 重启服务
|
|
367
354
|
// ═══════════════════════════════════════════════════════════════
|
|
368
|
-
ctx.tools.register(
|
|
369
|
-
defineTool({
|
|
355
|
+
ctx.tools.register({
|
|
370
356
|
name: "ops_restart",
|
|
371
357
|
description:
|
|
372
358
|
"重启某个站点的服务(如 Django CMS)。改了模板或配置要生效时用。" +
|
|
@@ -391,8 +377,7 @@ export function apply(ctx, config = {}) {
|
|
|
391
377
|
const d = r.data || {};
|
|
392
378
|
return { text: d.output || JSON.stringify(d, null, 2) };
|
|
393
379
|
},
|
|
394
|
-
|
|
395
|
-
);
|
|
380
|
+
});
|
|
396
381
|
|
|
397
382
|
// ═══════════════════════════════════════════════════════════════
|
|
398
383
|
// 技能注册
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liangjiehappy/dsh-ops",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "DSH 運維工作台:檢查 3 個站點的健康、SEO、GEO、代碼與安全,支援快照、部署與自動回滾。當使用者問「站現在怎麼樣」「部署安全嗎」「幫我檢查一下」時使用。",
|
|
5
5
|
"description_en": "DSH operations workbench: check health, SEO, GEO, code and security for DSH-managed sites, with snapshot, deploy and automatic rollback.",
|
|
6
6
|
"type": "module",
|
|
@@ -36,8 +36,5 @@
|
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"dsh": ">=0.2.0-rc.2"
|
|
39
|
-
},
|
|
40
|
-
"peerDependencies": {
|
|
41
|
-
"@deepseek-ai/dsh-tools": "*"
|
|
42
39
|
}
|
|
43
40
|
}
|