@agile-team/wl-skills-kit 2.7.0 → 2.7.2

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/mcp/api/client.js CHANGED
@@ -49,10 +49,17 @@ function wlsFetch(urlPath, options, config) {
49
49
  if (json.code === 2000) {
50
50
  resolve({ ok: true, data: json.data, code: json.code })
51
51
  } else {
52
+ // 友好提示:401/4004 等典型错误附带排查指引
53
+ let hint = ''
54
+ if (json.code === 401 || /token|未登录|鉴权/i.test(json.message || '')) {
55
+ hint = '(Token 可能已过期,请重新登录后更新 env.local.json 的 token 字段,仅填纯 JWT 不含 bearer 前缀)'
56
+ } else if (json.code === 4004 || /url:|not\s*found/i.test(json.message || '')) {
57
+ hint = '(接口未找到。可能是 gatewayPath 配置缺失前缀或后端环境差异;请检查 env.local.json 的 gatewayPath。不要让 AI 绕开 MCP 自己拼 HTTP)'
58
+ }
52
59
  resolve({
53
60
  ok: false,
54
61
  data: null,
55
- error: json.message || `服务端返回 code=${json.code}`,
62
+ error: (json.message || `服务端返回 code=${json.code}`) + hint,
56
63
  code: json.code,
57
64
  })
58
65
  }
package/mcp/server.js CHANGED
@@ -122,7 +122,28 @@ function startServer() {
122
122
 
123
123
  // 仅在直接执行时启动监听;被 require(如测试)时不启动
124
124
  if (require.main === module) {
125
+ printBanner();
125
126
  startServer();
126
127
  }
127
128
 
129
+ /**
130
+ * 启动 banner — 写入 stderr,不污染 stdout 的 JSON-RPC 通道
131
+ * 让用户在编辑器 MCP 输出面板能直观看到:版本、工具数量、项目根
132
+ */
133
+ function printBanner() {
134
+ const projectRoot = process.env.WL_PROJECT_ROOT || process.cwd();
135
+ const lines = [
136
+ "",
137
+ "═══════════════════════════════════════════════════",
138
+ ` wl-skills MCP Server v${PKG.version}`,
139
+ "═══════════════════════════════════════════════════",
140
+ ` 项目根 (WL_PROJECT_ROOT): ${projectRoot}`,
141
+ ` 已注册工具 (${TOOLS.length}):`,
142
+ ...TOOLS.map((t) => ` • ${t.name}`),
143
+ "═══════════════════════════════════════════════════",
144
+ "",
145
+ ];
146
+ process.stderr.write(lines.join("\n") + "\n");
147
+ }
148
+
128
149
  module.exports = { TOOLS, HANDLERS, dispatchTool, startServer };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agile-team/wl-skills-kit",
3
- "version": "2.7.0",
4
- "description": "AI Skill 模板包 v2.7.0 — 13 条编码规范 + 10 个 AI Skill + 17 个 MCP Tool,一条命令导入 Vue 3 项目",
3
+ "version": "2.7.2",
4
+ "description": "AI Skill 模板包 v2.7.2 — 13 条编码规范 + 10 个 AI Skill + 17 个 MCP Tool,一条命令导入 Vue 3 项目",
5
5
  "main": "./bin/wl-skills.js",
6
6
  "bin": {
7
7
  "wl-skills": "bin/wl-skills.js"
@@ -43,9 +43,10 @@
43
43
  "prepare": "husky",
44
44
  "cz": "git-cz",
45
45
  "lint": "eslint .",
46
+ "lint:skills": "node scripts/lint-skills.js",
46
47
  "test": "vitest run",
47
48
  "version:verify": "node scripts/verify-version.js",
48
- "prepublishOnly": "node scripts/verify-version.js && vitest run"
49
+ "prepublishOnly": "node scripts/verify-version.js && node scripts/lint-skills.js && vitest run"
49
50
  },
50
51
  "dependencies": {
51
52
  "xlsx": "^0.18.5"
@@ -74,4 +75,4 @@
74
75
  "eslint --fix --no-cache"
75
76
  ]
76
77
  }
77
- }
78
+ }