openmatrix 0.2.22 → 0.2.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/skills/deploy.md +108 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmatrix",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "description": "AI Agent task orchestration system with Claude Code Skills integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/skills/deploy.md CHANGED
@@ -91,6 +91,80 @@ cat requirements.txt pyproject.toml 2>/dev/null
91
91
 
92
92
  ---
93
93
 
94
+ ## Step 2.1: 检测并优化依赖源
95
+
96
+ 检测项目使用的包管理器和镜像源,如果是国外慢源则建议替换为国内镜像:
97
+
98
+ ```bash
99
+ # npm/yarn/pnpm 源
100
+ npm config get registry 2>/dev/null
101
+ cat .npmrc 2>/dev/null
102
+ cat .yarnrc 2>/dev/null
103
+ cat .yarnrc.yml 2>/dev/null
104
+
105
+ # pip 源
106
+ cat pip.conf 2>/dev/null
107
+ pip config get global.index-url 2>/dev/null
108
+
109
+ # Docker 镜像源
110
+ cat /etc/docker/daemon.json 2>/dev/null
111
+ cat ~/.docker/daemon.json 2>/dev/null
112
+
113
+ # Go 代理
114
+ go env GOPROXY 2>/dev/null
115
+
116
+ # Rust 源
117
+ cat ~/.cargo/config.toml 2>/dev/null
118
+
119
+ # Gradle/Maven 源
120
+ cat build.gradle 2>/dev/null | grep -i "repositories" -A 5
121
+ cat pom.xml 2>/dev/null | grep -i "mirror" -A 5
122
+ ```
123
+
124
+ **AI 分析源速度,如果检测到国外源,建议替换:**
125
+
126
+ | 包管理器 | 国外源 | 国内镜像 |
127
+ |---------|--------|---------|
128
+ | npm/yarn/pnpm | registry.npmjs.org | https://registry.npmmirror.com |
129
+ | pip | pypi.org | https://pypi.tuna.tsinghua.edu.cn/simple |
130
+ | Docker | docker.io | mirror.ccs.tencentyun.com |
131
+ | Go | proxy.golang.org | https://goproxy.cn,direct |
132
+ | Rust/Cargo | crates.io | https://rsproxy.cn/crates.io-index |
133
+ | Gradle/Maven | repo.maven.apache.org | https://maven.aliyun.com/repository/public |
134
+
135
+ **如果检测到慢源,输出建议并询问:**
136
+
137
+ ```
138
+ AskUserQuestion:
139
+ header: "镜像源"
140
+ question: "检测到 npm 使用官方源(registry.npmjs.org),国内访问较慢。是否切换到国内镜像?"
141
+
142
+ options:
143
+ - label: "切换到淘宝镜像 (推荐)"
144
+ description: "npmmirror.com,国内速度快,同步延迟 < 10 分钟"
145
+ - label: "保持不变"
146
+ description: "当前源可用,不需要切换"
147
+ - label: "使用其他镜像"
148
+ description: "指定自定义镜像地址"
149
+ ```
150
+
151
+ **用户确认后执行切换:**
152
+ ```bash
153
+ # npm
154
+ npm config set registry https://registry.npmmirror.com
155
+
156
+ # pip
157
+ pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
158
+
159
+ # Go
160
+ go env -w GOPROXY=https://goproxy.cn,direct
161
+
162
+ # Dockerfile 中的 apt 源(如果有)
163
+ # AI 读取 Dockerfile,将 archive.ubuntu.com 替换为 mirrors.aliyun.com
164
+ ```
165
+
166
+ ---
167
+
94
168
  ## Step 3: 检测系统环境
95
169
 
96
170
  ```bash
@@ -181,6 +255,40 @@ AskUserQuestion:
181
255
 
182
256
  ---
183
257
 
258
+ ## Step 6.1: 生成部署任务清单
259
+
260
+ 根据前面的分析和用户选择,将所有部署步骤写入 TodoWrite,逐条执行:
261
+
262
+ **示例(Docker 本地部署 + 源优化 + 脚本生成):**
263
+
264
+ ```typescript
265
+ TodoWrite({
266
+ todos: [
267
+ { content: "切换 npm 源到淘宝镜像", activeForm: "正在切换 npm 镜像源", status: "pending" },
268
+ { content: "构建 Docker 镜像", activeForm: "正在构建 Docker 镜像", status: "pending" },
269
+ { content: "启动容器", activeForm: "正在启动容器", status: "pending" },
270
+ { content: "验证部署:容器状态", activeForm: "正在检查容器状态", status: "pending" },
271
+ { content: "验证部署:端口监听", activeForm: "正在检查端口", status: "pending" },
272
+ { content: "验证部署:HTTP 连通", activeForm: "正在验证 HTTP 连通性", status: "pending" },
273
+ { content: "生成 Taskfile.yml 一键脚本", activeForm: "正在生成一键脚本", status: "pending" },
274
+ { content: "保存部署配置", activeForm: "正在保存部署配置", status: "pending" }
275
+ ]
276
+ })
277
+ ```
278
+
279
+ **任务清单根据实际情况动态生成:**
280
+ - 需要切换源 → 加入源切换任务
281
+ - 需要生成 Dockerfile → 加入生成任务
282
+ - 多服务 → 每个服务一条任务
283
+ - 选择生成脚本 → 加入脚本生成任务
284
+
285
+ **执行规则:**
286
+ - 每次只执行一条,完成后立即标记 completed
287
+ - 失败时停止,输出错误信息
288
+ - 用户可以看到整体进度
289
+
290
+ ---
291
+
184
292
  ## Step 7: 执行部署
185
293
 
186
294
  根据用户选择,AI 执行对应命令: