@ease-ops/onboard 0.0.0-stage → 2.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/lib/mcp.mjs ADDED
@@ -0,0 +1,166 @@
1
+ // 最小 MCP Streamable HTTP 客户端:initialize → notifications/initialized → tools/call。
2
+ // 不引 SDK,npx 零依赖;协议版本过旧时服务端会降级协商。
3
+
4
+ import { createRequire } from 'node:module';
5
+
6
+ const PROTOCOL_VERSION = '2024-11-05';
7
+ // clientInfo.version 只进服务端 initialize 日志,不参与 skill 版本校验;
8
+ // 从 package.json 读,避开“必须手工同步的第四处版本号”。
9
+ const CLIENT_INFO = {
10
+ name: 'ease-ops-onboard',
11
+ version: createRequire(import.meta.url)('../package.json').version,
12
+ };
13
+
14
+ function buildHeaders(token, sessionId) {
15
+ return {
16
+ 'content-type': 'application/json',
17
+ accept: 'application/json, text/event-stream',
18
+ ...(token ? { authorization: `Bearer ${token}` } : {}),
19
+ ...(sessionId ? { 'mcp-session-id': sessionId } : {}),
20
+ };
21
+ }
22
+
23
+ // 服务端可能用 SSE 回包:逐行取 data:,挑 id 匹配的那条
24
+ function pickFromSse(text, id) {
25
+ const messages = [];
26
+ for (const line of text.split(/\r?\n/)) {
27
+ if (!line.startsWith('data:')) continue;
28
+ const raw = line.slice(5).trim();
29
+ if (!raw) continue;
30
+ try {
31
+ messages.push(JSON.parse(raw));
32
+ } catch {
33
+ // 心跳或分片,忽略
34
+ }
35
+ }
36
+ if (id === undefined) return messages[0] ?? null;
37
+ return messages.find((m) => m.id === id) ?? messages[0] ?? null;
38
+ }
39
+
40
+ async function post(url, token, body, sessionId, timeoutMs) {
41
+ const res = await fetch(url, {
42
+ method: 'POST',
43
+ headers: buildHeaders(token, sessionId),
44
+ body: JSON.stringify(body),
45
+ signal: AbortSignal.timeout(timeoutMs),
46
+ });
47
+ const contentType = res.headers.get('content-type') || '';
48
+ const text = await res.text();
49
+ let payload = null;
50
+ if (contentType.includes('text/event-stream')) {
51
+ payload = pickFromSse(text, body.id);
52
+ } else if (text.trim()) {
53
+ try {
54
+ payload = JSON.parse(text);
55
+ } catch {
56
+ payload = null;
57
+ }
58
+ }
59
+ return {
60
+ status: res.status,
61
+ payload,
62
+ text,
63
+ sessionId: res.headers.get('mcp-session-id') || sessionId,
64
+ };
65
+ }
66
+
67
+ function statusError(status) {
68
+ if (status === 401) {
69
+ return { code: 'unauthorized', message: 'MCP 拒绝认证(401):Key 无效或未携带 Authorization' };
70
+ }
71
+ if (status === 404) {
72
+ return { code: 'endpoint_not_found', message: 'MCP 端点不存在(404):检查 URL 是否以 /mcp 结尾、服务端是否启用 MCP' };
73
+ }
74
+ if (status === 406) {
75
+ return { code: 'not_acceptable', message: '服务端拒绝了 Accept 头(406):可能不是 Streamable HTTP 端点' };
76
+ }
77
+ return { code: 'http_error', message: `MCP 返回 HTTP ${status}` };
78
+ }
79
+
80
+ export async function callTool({ url, token, name, args = {}, timeoutMs = 15000 }) {
81
+ let sessionId = null;
82
+ try {
83
+ const init = await post(
84
+ url,
85
+ token,
86
+ {
87
+ jsonrpc: '2.0',
88
+ id: 1,
89
+ method: 'initialize',
90
+ params: { protocolVersion: PROTOCOL_VERSION, capabilities: {}, clientInfo: CLIENT_INFO },
91
+ },
92
+ null,
93
+ timeoutMs,
94
+ );
95
+
96
+ if (init.status >= 400) {
97
+ return { ok: false, error: { ...statusError(init.status), detail: init.text.slice(0, 300) } };
98
+ }
99
+ if (!init.payload || init.payload.error) {
100
+ return {
101
+ ok: false,
102
+ error: {
103
+ code: 'handshake_failed',
104
+ message: 'MCP 握手失败',
105
+ detail: JSON.stringify(init.payload?.error ?? init.text).slice(0, 300),
106
+ },
107
+ };
108
+ }
109
+ sessionId = init.sessionId;
110
+
111
+ await post(url, token, { jsonrpc: '2.0', method: 'notifications/initialized' }, sessionId, timeoutMs);
112
+
113
+ const call = await post(
114
+ url,
115
+ token,
116
+ { jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name, arguments: args } },
117
+ sessionId,
118
+ timeoutMs,
119
+ );
120
+
121
+ if (call.status >= 400) {
122
+ return { ok: false, error: statusError(call.status) };
123
+ }
124
+ if (call.payload?.error) {
125
+ return {
126
+ ok: false,
127
+ error: {
128
+ code: 'tool_error',
129
+ message: call.payload.error.message || '工具调用失败',
130
+ detail: JSON.stringify(call.payload.error).slice(0, 300),
131
+ },
132
+ };
133
+ }
134
+
135
+ const content = call.payload?.result?.content ?? [];
136
+ const textPart = content.find((c) => c.type === 'text');
137
+ const raw = textPart?.text ?? '';
138
+ let data = raw;
139
+ try {
140
+ data = JSON.parse(raw);
141
+ } catch {
142
+ // 保持纯文本
143
+ }
144
+ return { ok: true, data, isError: Boolean(call.payload?.result?.isError) };
145
+ } catch (err) {
146
+ if (err?.name === 'TimeoutError') {
147
+ return { ok: false, error: { code: 'timeout', message: `MCP 请求超过 ${timeoutMs}ms 未响应` } };
148
+ }
149
+ // fetch 的原始信息只有 "fetch failed",真正原因在 cause.code(如 ECONNREFUSED)
150
+ const cause = err?.cause?.code || err?.code;
151
+ return {
152
+ ok: false,
153
+ error: {
154
+ code: 'network_error',
155
+ message: `无法连接 MCP:${err?.message ?? err}${cause ? ` (${cause})` : ''}`,
156
+ },
157
+ };
158
+ }
159
+ }
160
+
161
+ export function normalizeUrl(input) {
162
+ const value = String(input || '').trim().replace(/\/+$/, '');
163
+ if (!value) return null;
164
+ if (!/^https?:\/\//i.test(value)) return null;
165
+ return value.endsWith('/mcp') ? value : `${value}/mcp`;
166
+ }
package/lib/skill.mjs ADDED
@@ -0,0 +1,71 @@
1
+ // skill 落位:把包内的 SKILL.md + references 复制到客户端约定目录。
2
+ // 版本只升不降;目标端版本更高时要求 --force。
3
+
4
+ import fs from 'node:fs';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ export const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
9
+ export const SKILL_NAME = 'ease-ops-onboard';
10
+
11
+ const PAYLOAD_FILES = [
12
+ 'SKILL.md',
13
+ 'references/payload.md',
14
+ 'references/errors.md',
15
+ 'references/clients.md',
16
+ 'references/verify.md',
17
+ ];
18
+
19
+ export function readVersion(skillDir) {
20
+ const file = path.join(skillDir, 'SKILL.md');
21
+ if (!fs.existsSync(file)) return null;
22
+ const m = /^version:\s*(\S+)/m.exec(fs.readFileSync(file, 'utf8'));
23
+ return m ? m[1] : null;
24
+ }
25
+
26
+ export function compareVersions(a, b) {
27
+ const pa = String(a || '0').split(/[.+-]/).map((n) => Number.parseInt(n, 10) || 0);
28
+ const pb = String(b || '0').split(/[.+-]/).map((n) => Number.parseInt(n, 10) || 0);
29
+ for (let i = 0; i < Math.max(pa.length, pb.length); i += 1) {
30
+ const d = (pa[i] || 0) - (pb[i] || 0);
31
+ if (d !== 0) return d > 0 ? 1 : -1;
32
+ }
33
+ return 0;
34
+ }
35
+
36
+ export function installSkill(destRoot, { force = false, dryRun = false, name = SKILL_NAME } = {}) {
37
+ const dest = path.join(destRoot, name);
38
+ const srcVersion = readVersion(PACKAGE_ROOT) || '0.0.0';
39
+ const destVersion = readVersion(dest);
40
+
41
+ if (destVersion && compareVersions(destVersion, srcVersion) > 0 && !force) {
42
+ return { action: 'skipped', dest, srcVersion, destVersion, reason: 'installed_version_newer' };
43
+ }
44
+
45
+ let action = 'installed';
46
+ if (destVersion) {
47
+ action = compareVersions(destVersion, srcVersion) === 0 ? 'unchanged' : 'upgraded';
48
+ }
49
+
50
+ if (!dryRun) {
51
+ fs.mkdirSync(path.join(dest, 'references'), { recursive: true });
52
+ for (const rel of PAYLOAD_FILES) {
53
+ const from = path.join(PACKAGE_ROOT, rel);
54
+ if (!fs.existsSync(from)) continue;
55
+ fs.copyFileSync(from, path.join(dest, rel));
56
+ }
57
+ }
58
+
59
+ return { action, dest, srcVersion, destVersion };
60
+ }
61
+
62
+ export function hasSkill(skillDir, name = SKILL_NAME) {
63
+ return fs.existsSync(path.join(skillDir, name, 'SKILL.md'));
64
+ }
65
+
66
+ export function removeSkill(skillDir, { dryRun = false, name = SKILL_NAME } = {}) {
67
+ const dest = path.join(skillDir, name);
68
+ if (!fs.existsSync(dest)) return { removed: false, dest };
69
+ if (!dryRun) fs.rmSync(dest, { recursive: true, force: true });
70
+ return { removed: true, dest };
71
+ }
package/package.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "@ease-ops/onboard",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.0",
4
+ "description": "把当前仓库接入 ease-ops:安装 ease-ops-onboard skill 并配置 AI 编码客户端的 MCP 连接",
5
+ "type": "module",
6
+ "bin": {
7
+ "ease-ops-onboard": "bin/onboard.mjs"
8
+ },
9
+ "files": [
10
+ "SKILL.md",
11
+ "references/",
12
+ "bin/",
13
+ "lib/"
14
+ ],
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "scripts": {
19
+ "doctor": "node bin/onboard.mjs doctor"
20
+ },
21
+ "license": "MIT",
22
+ "private": false
23
+ }
@@ -0,0 +1,232 @@
1
+ # 客户端接入
2
+
3
+ 同一份 skill,落到不同 AI 编码工具里的差别只有三件事:**skill 放哪、MCP 配置写哪、Key 怎么不出现在 git 里**。
4
+
5
+ ## 1. 连接参数(全客户端通用)
6
+
7
+ | 项 | 值 |
8
+ |---|---|
9
+ | endpoint | `{console_base_url}/mcp`(Streamable HTTP,不是 SSE) |
10
+ | 鉴权头 | `Authorization: Bearer eops_<prefix>_<secret>` |
11
+ | 传输 | HTTP;仅 `localhost` 允许明文 `http://`,其余必须 `https://` |
12
+ | 自检 | 连上后第一个调用必须是 `ease_ops_whoami` |
13
+
14
+ `console_base_url` 由 `whoami` 返回,**不要让用户手填**;安装器只在首次引导时问一次(例:`http://127.0.0.1:8010`)。
15
+
16
+ 本仓现成实例(可对照格式):
17
+
18
+ ```json
19
+ {
20
+ "mcpServers": {
21
+ "cicd-mcp": {
22
+ "url": "http://127.0.0.1:8010/mcp",
23
+ "headers": { "Authorization": "Bearer eops_xxx" }
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ ## 2. 能力矩阵
30
+
31
+ | 客户端 | skill 目录 | MCP 配置 | Key 插值 | 显式触发 |
32
+ |---|---|---|---|---|
33
+ | Cursor | `.cursor/skills/<name>/`(项目级)<br>`~/.cursor/skills/<name>/`(全局) | `.cursor/mcp.json`(项目级)<br>`~/.cursor/mcp.json`(全局) | `${env:NAME}` ✅ | `/ease-ops:onboard` |
34
+ | Claude Code | `.claude/skills/<name>/` | `.mcp.json`(项目级)<br>`~/.claude.json`(用户级) | `${NAME}` ✅ | `/ease-ops:onboard` |
35
+ | CodeBuddy | `.codebuddy/skills/<name>/`<br>`~/.codebuddy/skills/` | 见 §3.3(安装器探测) | ❌ | `/ease-ops:onboard` |
36
+ | VS Code(Copilot) | 不支持 skills | `.vscode/mcp.json` | `${input:xxx}` + `inputs` 密码框 ✅ | 自然语言 |
37
+ | Trae / Windsurf / 其他 | 不支持 skills | 客户端 UI / 约定 json | ❌ | 自然语言 |
38
+
39
+ 标注依据:Cursor 的目录与 `${env:NAME}` 插值、Claude Code 的 `.mcp.json` + `${VAR}`、CodeBuddy 的 `.codebuddy/skills/` 均来自各自官方文档;VS Code 的 `inputs` 密码框同理。**其余未验证项一律由安装器探测,探测不到就打印片段让用户手动粘,不猜路径。**
40
+
41
+ ## 3. 各客户端最小配置
42
+
43
+ ### 3.1 Cursor
44
+
45
+ 项目级 `.cursor/mcp.json`:
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "ease-ops": {
51
+ "url": "https://ops.example.com/mcp",
52
+ "headers": { "Authorization": "Bearer ${env:EASE_OPS_TOKEN}" }
53
+ }
54
+ }
55
+ }
56
+ ```
57
+
58
+ - Cursor **不需要** `type` 字段,按 URL 自动判断传输。
59
+ - `${env:EASE_OPS_TOKEN}` 在启动 Cursor 的 shell 里 `export` 才生效;GUI 启动时读的是系统环境变量,不是终端里的。装不出来就退回 §4 的 B 档。
60
+ - skill 放 `.cursor/skills/ease-ops-onboard/`,`references/` 必须是它的子目录。
61
+
62
+ ### 3.2 Claude Code
63
+
64
+ 项目级 `.mcp.json`(**必须写 `type: "http"`**):
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "ease-ops": {
70
+ "type": "http",
71
+ "url": "https://ops.example.com/mcp",
72
+ "headers": { "Authorization": "Bearer ${EASE_OPS_TOKEN}" }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ 等价 CLI:
79
+
80
+ ```bash
81
+ claude mcp add --transport http --scope project ease-ops https://ops.example.com/mcp \
82
+ --header "Authorization: Bearer $EASE_OPS_TOKEN"
83
+ ```
84
+
85
+ 注意:`--header` 的值若写成 `$EASE_OPS_TOKEN` 且外层是双引号,**shell 会当场展开**,token 就直接落进文件了。要保留引用语义,用单引号写 `${EASE_OPS_TOKEN}`。
86
+
87
+ ### 3.3 CodeBuddy
88
+
89
+ skill 目录(官方文档确认):`.codebuddy/skills/ease-ops-onboard/SKILL.md`,用户级 `~/.codebuddy/skills/`。CodeBuddy 同时兼容 `.claude/skills/`,所以**同一套文件复制两个目录即可**,不必维护两份。
90
+
91
+ MCP 配置安装器按顺序探测(⚠ 待实测,逐个 `read` + `JSON.parse` 成功才写):
92
+
93
+ 1. `codebuddy mcp add --transport http ease-ops <url> --header 'Authorization: Bearer ${EASE_OPS_TOKEN}'`
94
+ 2. `~/.codebuddy/.mcp.json` / `.codebuddy/mcp.json` 的 `mcpServers` 段
95
+ 3. `.mcp.json`(与 Claude Code 共用)
96
+ 4. 都不命中 → 打印 §1 的片段,让用户在客户端 UI 里贴
97
+
98
+ CodeBuddy 不做 `${env:}` 插值,因此**默认写 A 档不成立**,一律走 §4 的 B 档或 C 档。
99
+
100
+ ### 3.4 VS Code(Copilot Chat)
101
+
102
+ `.vscode/mcp.json` 的字段叫 `servers`(不是 `mcpServers`),且支持密码输入框:
103
+
104
+ ```json
105
+ {
106
+ "inputs": [
107
+ { "id": "ease-ops-token", "type": "promptString",
108
+ "description": "ease-ops MCP Key", "password": true }
109
+ ],
110
+ "servers": {
111
+ "ease-ops": {
112
+ "type": "http",
113
+ "url": "https://ops.example.com/mcp",
114
+ "headers": { "Authorization": "Bearer ${input:ease-ops-token}" }
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ 这是唯一把 Key 放在**编辑器密钥存储**而不是文件里的方式,有条件时优先推荐。
121
+
122
+ ### 3.5 Trae / Windsurf / 其他
123
+
124
+ 不支持 skills,只能靠 §6 的降级 rules + 客户端自己的 MCP 配置界面。安装器不做自动写入,输出两样东西:
125
+
126
+ 1. 一段可粘贴的 `mcpServers` JSON;
127
+ 2. 降级 rules 正文,让用户放进客户端的 rules 目录(Trae 是 `.trae/rules/`)。
128
+
129
+ ## 4. Key 的三个档次
130
+
131
+ 按安全性排序,安装器优先选 A,不可行退 B,再不可行退 C。
132
+
133
+ | 档 | 做法 | 适用 | 注意 |
134
+ |---|---|---|---|
135
+ | **A** | 配置里写变量引用(`${env:NAME}` / `${NAME}` / `${input:id}`) | Cursor、Claude Code、VS Code | 用户需自己 `export`;GUI 启动可能读不到 |
136
+ | **B** | 配置文件写明文,但**必须** `chmod 600` + 加进 `.gitignore` | CodeBuddy 等不支持插值的 | 一旦被 `git add` 就是泄露 |
137
+ | **C** | 用户自己在客户端 UI 里填 Key | 任何客户端 | 文件里根本不出现,最干净 |
138
+
139
+ ### 硬要求:含明文 Key 的配置必须被 git 忽略
140
+
141
+ A 档(变量引用)和 C 档(客户端输入框)写进文件里的都不是 secret,**可以提交**——团队共享同一份配置本来就是好做法。真正危险的是 B 档。
142
+
143
+ 本仓现状(已核实,workspace 根不是仓库,`ease-ops-api` / `ease-ops-web` 各自独立):
144
+
145
+ | 文件 | 状态 |
146
+ |---|---|
147
+ | `ease-ops-api/.cursor/mcp.json` | **已提交**(`0d3ffa8 feat: 增加项目、组件、仓库的mcp`),内含明文 `eops_` Key → 已进历史 |
148
+ | `ease-ops-web/.cursor/mcp.json` | 未跟踪、未被忽略,含明文 Key → 下次 `git add -A` 就进历史 |
149
+
150
+ 所以 B 档下安装器会在写完后:
151
+
152
+ ```bash
153
+ git check-ignore -v .cursor/mcp.json || echo ".cursor/mcp.json" >> .gitignore
154
+ ```
155
+
156
+ 并复查 `git check-ignore` 真的生效。非 git 仓库时只警告,不阻断。
157
+
158
+ 已进历史的那份不能靠 gitignore 补救,需要(1)**轮换 Key**(2)`git rm --cached` 取消跟踪(3)必要时清洗历史。这三步是人工动作,安装器不代劳。
159
+
160
+ ## 5. 安装器行为契约
161
+
162
+ > 实现在 `skills/ease-ops-onboard/{bin/onboard.mjs,lib/*.mjs}`,零依赖、`engines: node >=18`。
163
+
164
+ ```
165
+ npx @ease-ops/onboard init [--client cursor|claude|codebuddy|vscode|generic|all] [--url ...]
166
+ ```
167
+
168
+ | 步骤 | 行为 | 失败时 |
169
+ |---|---|---|
170
+ | 1 探测 | 找 `.git` 根、已有 `.cursor/` `.claude/` `.codebuddy/` `.vscode/`、已有 mcp 配置 | 多个客户端命中 → 全装(幂等),不要求选 |
171
+ | 2 写 skill | 复制 `SKILL.md` + `references/` 到该客户端目录,**已存在则比对版本** | 版本更高则提示 `--force`,不静默覆盖 |
172
+ | 3 合并 MCP | 只改 `mcpServers.ease-ops` 一项;**缩进宽度与顶层键顺序保留**;含注释/无法解析 → 放弃写入并打印片段 | 不破坏用户已有配置 |
173
+ | 4 收 Key | A 档提示 `export`;B 档提示粘贴(不回显)并 `chmod 600` + 写 gitignore;C 档走 `inputs` 交互框 | 用户跳过则停在"待配置" |
174
+ | 5 验证 | 依次握手 → `tools/call ease_ops_whoami`,打印身份、项目数、`min_skill_version` | 401/404/超时按 §7 报 |
175
+ | 6 收尾 | 打印 skill 版本落位、配置文件路径、gitignore 状态 | — |
176
+
177
+ 已知取舍:JSON 会被规范化(原文件里的行内对象展开成多行,如 `"headers": { "X": "y" }` → 多行)。**语义不变、其他 server 项不丢**,但会产生格式 diff;在意格式的仓应把该文件 gitignore(本来也应该)。
178
+
179
+ 幂等:重复 `init` 应等价于"升级 skill + 校正配置",不产生重复 server 项、不产生重复 skill 目录(实测第二次输出 `unchanged`)。
180
+
181
+ 另两个命令:`doctor` 汇总各客户端安装状态 + gitignore 校验 + 连通性;`remove` 删 skill 与 `ease-ops` 配置项,删空的 mcp 配置文件,保留 `.ease-ops/`;`remove` 带 `--client` 时只清那一家,不带则全量。`init` / `doctor` 未给 `--url` 时会从已写入的 mcp 配置里取回 endpoint,重跑不必再记地址;`doctor` 在客户端目录存在但 skill 未安装时给 `未安装` 警告。
182
+
183
+ ## 6. 降级 rules 正文
184
+
185
+ 给不支持 skills 的客户端(Trae / Windsurf / 裸模型)。三行路由,够用且不会漂:
186
+
187
+ ```markdown
188
+ # ease-ops 接入
189
+
190
+ 当用户说"接入 ease-ops""把这个项目接进平台""加个组件进流水线"时:
191
+ 1. 读 `.ease-ops/skill/SKILL.md`(安装器已落位),按其五阶段执行;
192
+ 2. payload 字段只允许 `.ease-ops/skill/references/payload.md` 里的定义,未知字段直接报错;
193
+ 3. 错误码与处置查 `.ease-ops/skill/references/errors.md`;不要把密钥写进任何文件或对话。
194
+ ```
195
+
196
+ 安装器为这类客户端把文件落到 `.ease-ops/skill/`(与 `.ease-ops/onboarding.yaml` 同级),路径固定,rules 才能引用到。
197
+
198
+ ## 7. 验证与排障
199
+
200
+ `init` 结束时自检,以及用户自己排查时都走这张表:
201
+
202
+ | 现象 | 最可能原因 | 处理 |
203
+ |---|---|---|
204
+ | `404` | endpoint 少了 `/mcp`,或服务端未开 MCP | 核对 `{console_base_url}/mcp` |
205
+ | `401` | 没带 `Authorization`,或 Key 失效 | 重跑 `init` 换 Key |
206
+ | `401` 且 header 看着对 | 变量没展开(`${env:X}` 原样发出去) | 改 B/C 档,或确认变量在启动进程的环境里 |
207
+ | 工具列表为空 | 客户端缓存了旧连接 | 重启客户端(Cursor 热加载常失效) |
208
+ | 调工具报 `method not found` | 客户端与服务端 MCP 版本不匹配 | 升级客户端;`whoami` 里看 `min_skill_version` |
209
+ | skill 没被触发 | 目录层级错了(`SKILL.md` 必须在 `<name>/` 下) | `ls .cursor/skills/ease-ops-onboard/SKILL.md` |
210
+ | 触发后行为像旧版 | 多个目录各有一份 skill | 只保留一处;`init --force` 覆盖 |
211
+
212
+ agent 侧的处置原则:401/404 只报原文 + 一句人话建议,**不要**自行改配置重试;`skill_version_too_old` 必须停。
213
+
214
+ ## 8. 升级与卸载
215
+
216
+ | 操作 | 命令 | 影响 |
217
+ |---|---|---|
218
+ | 升级 | `npx @ease-ops/onboard init --force` | 覆盖 skill 文件;MCP 配置只更新 server 项 |
219
+ | 检查 | `npx @ease-ops/onboard doctor` | 打印版本、连通性、gitignore 状态、payload 版本支持;endpoint 可省略,缺省从 mcp 配置读取 |
220
+ | 卸载 | `npx @ease-ops/onboard remove` | 删 skill 目录 + 删 `ease-ops` server 项(配置只剩空对象时连文件一起删);**不动** `.ease-ops/onboarding.*` |
221
+
222
+ 版本漂移由 `whoami.min_skill_version` 与 SKILL.md frontmatter 的 `version` 对比得出,不靠人记。
223
+
224
+ ## 9. 不能做的事
225
+
226
+ | 禁止 | 原因 |
227
+ |---|---|
228
+ | 把 Key 写进 `.ease-ops/onboarding.yaml` / `.json` | 这两个文件是要提交的 |
229
+ | 在 skill 或 rules 正文里硬编码 `console_base_url` | 每个团队部署地址不同,必须从 `whoami` 拿 |
230
+ | 自动修改用户的其它 MCP server 条目 | 破坏他人的工作环境 |
231
+ | 把 skill 装到 `/tmp` 或用户没打开的工作区 | 客户端不会加载,等于没装 |
232
+ | 用 `http://` 连非 localhost | Key 会明文过网 |