dsh-ops-kit 0.0.0-stage → 0.3.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 +125 -2
- package/client.js +2094 -0
- package/cordis.patch.yml +4 -0
- package/docs/DETAIL.md +42 -0
- package/docs/ROADMAP.md +134 -0
- package/icon.svg +9 -0
- package/index.js +3524 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +61 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shenlongze
|
|
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,126 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-ops-kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Server operations from a DeepSeek Harness chat, with no SDK and no credentials
|
|
4
|
+
stored by the plugin.
|
|
5
|
+
|
|
6
|
+
## What it adds
|
|
7
|
+
|
|
8
|
+
| Tool | What it does | Changes state |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| `ops_hosts` | list / add / remove SSH hosts (`~/.dsh/ops-kit/hosts.json`) | only that file |
|
|
11
|
+
| `ops_status` | uptime + load, memory, root disk, failed systemd units, Docker containers | no |
|
|
12
|
+
| `ops_check_all` | all hosts in parallel, one summary row each, appends to history | no |
|
|
13
|
+
| `ops_batch` | one command on several hosts in parallel, bounded row per host | yes (destructive commands need `confirm`) |
|
|
14
|
+
| `ops_run` | one shell command over SSH, returns stdout/stderr/exit code | yes (destructive commands need `confirm`) |
|
|
15
|
+
| `ops_service` | `systemctl status/logs/start/stop/restart` on a unit | start/stop/restart need `confirm` |
|
|
16
|
+
| `ops_docker` | `docker ps/logs/inspect/restart` | restart needs `confirm` |
|
|
17
|
+
| `ops_backup` | MySQL dump / directory archive, list, restore, delete (retention N) | yes, `confirm` in the panel |
|
|
18
|
+
| `ops_health` | 0–100 score plus the issues worth fixing first | no |
|
|
19
|
+
| `ops_channels` | alert delivery to Feishu / DingTalk / WeCom / any webhook | no (test send only) |
|
|
20
|
+
| `ops_cert` | certificate days left, certbot dry run or real renewal | renewal changes state |
|
|
21
|
+
| `ops_cron` | list / add / remove crontab entries | yes |
|
|
22
|
+
| `ops_file_history` | `.bak` versions of a config file, diff, rollback | rollback changes state |
|
|
23
|
+
| `ops_deploy` | git pull → build → restart → health check, auto rollback | yes |
|
|
24
|
+
| `ops_ask` | natural-language question; the model runs read-only commands itself | read-only |
|
|
25
|
+
| `ops_monitors` | http / port / process / service / script heartbeat checks | yes |
|
|
26
|
+
| `ops_ssh_test` | connectivity + latency + auth kind | no |
|
|
27
|
+
| `ops_ai_models` | providers and models the ops AI can use | no |
|
|
28
|
+
|
|
29
|
+
## Design
|
|
30
|
+
|
|
31
|
+
- **Zero dependencies.** It uses the system `ssh` client in `BatchMode`, so key
|
|
32
|
+
or ssh-agent authentication must already work. No passwords, no private keys
|
|
33
|
+
are stored.
|
|
34
|
+
- **Password or key.** A host can be added with only IP + user + password; the
|
|
35
|
+
plugin connects through its own `ssh2` client, so no key setup is needed. A
|
|
36
|
+
host without a stored password uses the system `ssh` client and your keys.
|
|
37
|
+
Passwords live in `$DSH_HOME/ops-kit/secrets.json` with mode 0600; they are
|
|
38
|
+
base64-encoded, not encrypted, so treat that file as a secret.
|
|
39
|
+
- **Inventory outside the profile.** Hosts live in
|
|
40
|
+
`$DSH_HOME/ops-kit/hosts.json` (default `~/.dsh/ops-kit/hosts.json`), so
|
|
41
|
+
upgrading or removing the plugin does not lose them.
|
|
42
|
+
- **Read/write separation.** Health checks are always read-only. Anything that
|
|
43
|
+
changes a service or container requires `confirm: true`, and `ops_run`
|
|
44
|
+
refuses a short list of destructive commands without it.
|
|
45
|
+
- **Bounded output.** Tool results are clipped at 8 KB with an explicit
|
|
46
|
+
truncation marker, so a runaway log line cannot flood the model context.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
dsh plugin --profile desktop add dsh-ops-kit
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Local development install (directory):
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Plugins → Add plugin → select this directory
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Panel
|
|
61
|
+
|
|
62
|
+
The bundle also ships a sidebar page (**Ops**) that lists hosts, adds or removes
|
|
63
|
+
them, runs one host's health check, or checks every host at once. Runs are
|
|
64
|
+
recorded in `$DSH_HOME/ops-kit/history.json` and shown at the bottom of the page.
|
|
65
|
+
The panel talks to the host half through `/ops-kit/api/*`.
|
|
66
|
+
|
|
67
|
+
It also carries a batch-command box (pick hosts or leave all), and a per-host
|
|
68
|
+
**Actions** panel that lists running systemd services and containers with
|
|
69
|
+
Logs / Restart / Stop buttons. Restart and stop ask for confirmation first.
|
|
70
|
+
|
|
71
|
+
## First run
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
ops_hosts action=add name=web-1 host=10.0.0.11 user=deploy key=~/.ssh/id_ed25519 defaultHost=true
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then just ask:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
看一下 web-1 的状态
|
|
81
|
+
nginx 最近 50 行日志
|
|
82
|
+
把 web-1 上的 my-api 重启一下(我确认)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Limits (deliberately not implemented yet)
|
|
86
|
+
|
|
87
|
+
- No interactive PTY: long interactive sessions need the terminal panel plugins.
|
|
88
|
+
- No cloud APIs (Aliyun/Tencent/AWS). This kit only speaks SSH.
|
|
89
|
+
- No metric history or alerting: `ops_status` is a point-in-time snapshot.
|
|
90
|
+
- No Windows remoting: SSH to Windows works only if the host runs an SSH server
|
|
91
|
+
with a POSIX-like shell.
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 0.3.0 — backups, health score, certificates, cron, config history, deploy
|
|
99
|
+
|
|
100
|
+
- **Backups & restore.** `mysqldump` for a database or `tar.gz` for a directory,
|
|
101
|
+
stored under `/home/backup` by default, keep N copies, restore in one click.
|
|
102
|
+
- **Health score.** 0–100 per host with the two or three issues that matter,
|
|
103
|
+
shown on the server detail page.
|
|
104
|
+
- **Certificates.** Every nginx `server_name` is probed for its expiry date;
|
|
105
|
+
`certbot renew --dry-run` before a real renewal; alerts at 14 / 7 / 3 days.
|
|
106
|
+
- **Scheduled tasks.** The server crontab, readable and editable from the panel.
|
|
107
|
+
- **Config history.** Every `.bak.<ts>` version of a file can be diffed and
|
|
108
|
+
rolled back.
|
|
109
|
+
- **One-click deploy.** git pull → build → restart → health check, with an
|
|
110
|
+
automatic rollback to the previous commit when the health check fails.
|
|
111
|
+
|
|
112
|
+
Panel navigation: overview → server detail with ten sub-pages
|
|
113
|
+
(summary, monitor, config, apps, logs, files, terminal, backups, tasks, deploy).
|
|
114
|
+
|
|
115
|
+
## Alert delivery
|
|
116
|
+
|
|
117
|
+
Alerts produced by the scheduler (host down, disk pressure, failed units, monitor
|
|
118
|
+
failures, certificate expiry) are pushed to the configured channels:
|
|
119
|
+
|
|
120
|
+
- `feishu` → `{"msg_type":"text","content":{"text":...}}`
|
|
121
|
+
- `dingtalk` / `wecom` → `{"msgtype":"text","text":{"content":...}}`
|
|
122
|
+
- `webhook` → `{"text":...,"alerts":[...]}` for anything else
|
|
123
|
+
|
|
124
|
+
Each channel chooses which levels it receives (critical / warning / info). The
|
|
125
|
+
same alert is not resent within 10 minutes. Channels live in
|
|
126
|
+
`~/.dsh/ops-kit/channels.json` with mode 0600, because the URL itself is a secret.
|