@jiyr0119/dsh-service-console 0.2.2 → 0.3.1

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.
@@ -0,0 +1,158 @@
1
+ # DSH 插件本地调试指南
2
+
3
+ ## 启动本地 DSH 开发环境(端口 3090)
4
+
5
+ ```bash
6
+ # 方式一:使用 dev profile 启动
7
+ dsh --profile dev --port 3090
8
+
9
+ # 方式二:在 DSH 目录下启动 web 开发模式
10
+ cd ~/.dsh/profiles/dev
11
+ pnpm run dev:web
12
+ ```
13
+
14
+ 启动后访问 http://127.0.0.1:3090
15
+
16
+ ---
17
+
18
+ ## 将本地插件链接到 3090 环境
19
+
20
+ ### 1. 编辑 dev profile 的 package.json
21
+
22
+ ```bash
23
+ vim ~/.dsh/profiles/dev/package.json
24
+ ```
25
+
26
+ 添加插件依赖和 bundles 配置:
27
+
28
+ ```json
29
+ {
30
+ "name": "dsh-profile-dev",
31
+ "private": true,
32
+ "dependencies": {
33
+ "@jiyr0119/dsh-service-console": "^0.2.2",
34
+ "dshmarket": "^1.15.0"
35
+ },
36
+ "dsh": {
37
+ "profile": {
38
+ "bundles": [
39
+ "@deepseek-ai/dsh-base",
40
+ "@deepseek-ai/dsh-web-app",
41
+ "dshmarket",
42
+ "@jiyr0119/dsh-service-console"
43
+ ]
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ ### 2. 安装依赖
50
+
51
+ ```bash
52
+ cd ~/.dsh/profiles/dev
53
+ pnpm install
54
+ ```
55
+
56
+ ### 3. 用 symlink 替换 npm 版本(关键步骤)
57
+
58
+ ```bash
59
+ # 删除 npm 安装的版本
60
+ rm -rf ~/.dsh/profiles/dev/node_modules/@jiyr0119/dsh-service-console
61
+
62
+ # 创建 symlink 指向本地项目
63
+ ln -s /Users/jonathan/workspaceforme/dsh-service-console ~/.dsh/profiles/dev/node_modules/@jiyr0119/dsh-service-console
64
+ ```
65
+
66
+ ### 4. 验证链接
67
+
68
+ ```bash
69
+ ls -la ~/.dsh/profiles/dev/node_modules/@jiyr0119/dsh-service-console
70
+ # 应该显示 → /Users/jonathan/workspaceforme/dsh-service-console
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 开发工作流
76
+
77
+ ```
78
+ 修改代码 → npm run build → 刷新浏览器(不需要重启 DSH)
79
+ ```
80
+
81
+ 1. 在本地项目目录修改代码
82
+ 2. 执行 `npm run build` 构建
83
+ 3. 刷新 http://127.0.0.1:3090 即可看到变化
84
+
85
+ **注意:** symlink 方式下,DSH 直接读取 `lib/` 目录的构建产物,所以只需要 build,不需要重启服务。
86
+
87
+ ---
88
+
89
+ ## 发布新版本
90
+
91
+ ```bash
92
+ # 1. 升级版本号
93
+ # package.json 和 dsh.plugin.json 中的 version 同步修改
94
+
95
+ # 2. 运行测试
96
+ npm test
97
+
98
+ # 3. 登录 npm(如果未登录)
99
+ npm login
100
+
101
+ # 4. 发布
102
+ npm publish
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 常见问题
108
+
109
+ ### Q: 刷新后插件没有加载?
110
+
111
+ 检查 symlink 是否存在:
112
+ ```bash
113
+ ls -la ~/.dsh/profiles/dev/node_modules/@jiyr0119/dsh-service-console
114
+ ```
115
+
116
+ 如果不存在,重新执行步骤 3 创建 symlink。
117
+
118
+ ### Q: 修改代码后刷新没有变化?
119
+
120
+ 确保已执行 `npm run build`。symlink 只是链接目录,不会自动构建。
121
+
122
+ ### Q: 3090 端口被占用?
123
+
124
+ ```bash
125
+ # 查找占用端口的进程
126
+ lsof -nP -iTCP:3090 -sTCP:LISTEN
127
+
128
+ # 终止进程
129
+ kill <PID>
130
+ ```
131
+
132
+ ### Q: 想用 npm 注册的正式版本测试?
133
+
134
+ ```bash
135
+ # 删除 symlink,重新安装 npm 版本
136
+ rm ~/.dsh/profiles/dev/node_modules/@jiyr0119/dsh-service-console
137
+ cd ~/.dsh/profiles/dev
138
+ pnpm install
139
+ ```
140
+
141
+ ---
142
+
143
+ ## 目录结构
144
+
145
+ ```
146
+ ~/.dsh/profiles/dev/
147
+ ├── package.json # profile 配置(dependencies + bundles)
148
+ ├── node_modules/
149
+ │ └── @jiyr0119/
150
+ │ └── dsh-service-console → /path/to/local/project (symlink)
151
+ └── ...
152
+
153
+ /path/to/local/project/
154
+ ├── src/ # 源码
155
+ ├── lib/ # 构建产物(DSH 实际加载的)
156
+ ├── dynamic/ # 动态版 Host/Client
157
+ └── package.json
158
+ ```
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-service-console",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "main": "./lib/index.js",
5
5
  "description": "本地开发服务控制台:发现监听端口,识别服务归属,安全查看/停止/重启。Local development service console for DSH.",
6
6
  "engines": {
package/dynamic/host.js CHANGED
@@ -265,7 +265,6 @@ return {
265
265
  const svc = s.services.find((x) => x.id === serviceId)
266
266
  if (!svc) return err('TARGET_GONE', '该服务已结束,列表已刷新')
267
267
  if (svc.protected) return err('PROTECTED_PROCESS', '该进程受保护,不能通过 Service Console 操作')
268
- if (svc.ownership === 'unknown') return err('UNKNOWN_OWNERSHIP', '无法确认服务来源,默认不允许控制')
269
268
  const target = svc.processGroupId ? '-' + svc.processGroupId : String(svc.pid)
270
269
  await runCommand('kill -TERM ' + target, 3000)
271
270
  const deadline = Date.now() + (config.gracefulTimeout || 3000)