@szc-ft/mcp-szcd-client 0.13.1 → 0.13.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/package.json +1 -1
- package/qwen-extension/qwen-extension.json +1 -1
- package/qwen-extension/skills/szcd-component-helper/SKILL.md +231 -563
- package/scripts/lib/claude-code.js +15 -11
- package/scripts/lib/common.js +29 -5
- package/scripts/lib/qoder.js +15 -11
- package/scripts/lib/trae-cli.js +15 -11
- package/scripts/lib/trae-ide.js +15 -11
- package/scripts/postinstall.js +6 -4
- package/standard-skill/szcd-component-helper/SKILL.md +439 -0
- package/skill/SKILL.md +0 -827
- package/standard-skill/SKILL.md +0 -1509
|
@@ -131,7 +131,6 @@ function createClaudeCodeProjectConfig(deps) {
|
|
|
131
131
|
// ==================== Skill 复制 ====================
|
|
132
132
|
|
|
133
133
|
function copySkillToClaudeCode(deps, isProjectLevel = false) {
|
|
134
|
-
const skillName = deps.getMcpServerName();
|
|
135
134
|
let claudeSkillsDir;
|
|
136
135
|
|
|
137
136
|
if (isProjectLevel) {
|
|
@@ -140,18 +139,23 @@ function copySkillToClaudeCode(deps, isProjectLevel = false) {
|
|
|
140
139
|
claudeSkillsDir = getClaudeCodeSkillsDirectory();
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
const
|
|
142
|
+
const skills = deps.discoverSkills();
|
|
143
|
+
let allOk = true;
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
for (const skill of skills) {
|
|
146
|
+
const skillDir = path.join(claudeSkillsDir, skill.name);
|
|
147
|
+
try {
|
|
148
|
+
deps.ensureDirectory(skillDir);
|
|
149
|
+
const skillDest = path.join(skillDir, "SKILL.md");
|
|
150
|
+
deps.copyFile(skill.sourcePath, skillDest);
|
|
151
|
+
console.log(`✓ Copied skill "${skill.name}" to Claude Code ${isProjectLevel ? 'project' : 'user'} directory: ${skillDir}`);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.log(`⚠️ Failed to copy skill "${skill.name}" to Claude Code ${isProjectLevel ? 'project' : 'user'} directory: ${error.message}`);
|
|
154
|
+
allOk = false;
|
|
155
|
+
}
|
|
154
156
|
}
|
|
157
|
+
|
|
158
|
+
return allOk;
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
// ==================== Agent 安装 ====================
|
package/scripts/lib/common.js
CHANGED
|
@@ -14,8 +14,36 @@ import { execSync } from "node:child_process";
|
|
|
14
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
15
|
const __dirname = path.dirname(__filename);
|
|
16
16
|
|
|
17
|
+
// 默认值(需在 SKILL_SOURCE 之前定义)
|
|
18
|
+
export const DEFAULT_MCP_SERVER_URL = "http://localhost:3456";
|
|
19
|
+
export const DEFAULT_MCP_SERVER_NAME = "szcd-component-helper";
|
|
20
|
+
|
|
17
21
|
export const PACKAGE_ROOT = path.resolve(__dirname, "..", "..");
|
|
18
|
-
export const
|
|
22
|
+
export const SKILLS_DIR = path.join(PACKAGE_ROOT, "standard-skill");
|
|
23
|
+
|
|
24
|
+
// 向后兼容:保留 SKILL_SOURCE 指向主技能包
|
|
25
|
+
export const SKILL_SOURCE = path.join(SKILLS_DIR, DEFAULT_MCP_SERVER_NAME, "SKILL.md");
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 扫描 standard-skill/ 目录下所有子目录,发现可安装的技能包。
|
|
29
|
+
* 目录结构约定:standard-skill/<skill-name>/SKILL.md
|
|
30
|
+
* 返回 [{ name, sourcePath }] 数组
|
|
31
|
+
*/
|
|
32
|
+
export function discoverSkills() {
|
|
33
|
+
const skills = [];
|
|
34
|
+
if (!fs.existsSync(SKILLS_DIR)) {
|
|
35
|
+
console.warn(`⚠️ Skills directory not found: ${SKILLS_DIR}`);
|
|
36
|
+
return skills;
|
|
37
|
+
}
|
|
38
|
+
for (const entry of fs.readdirSync(SKILLS_DIR, { withFileTypes: true })) {
|
|
39
|
+
if (!entry.isDirectory()) continue;
|
|
40
|
+
const skillFile = path.join(SKILLS_DIR, entry.name, "SKILL.md");
|
|
41
|
+
if (fs.existsSync(skillFile)) {
|
|
42
|
+
skills.push({ name: entry.name, sourcePath: skillFile });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return skills;
|
|
46
|
+
}
|
|
19
47
|
|
|
20
48
|
// 项目根目录:从 PACKAGE_ROOT 向上推导
|
|
21
49
|
export function findProjectRoot() {
|
|
@@ -32,10 +60,6 @@ export function findProjectRoot() {
|
|
|
32
60
|
}
|
|
33
61
|
export const PROJECT_ROOT = findProjectRoot();
|
|
34
62
|
|
|
35
|
-
// 默认值
|
|
36
|
-
export const DEFAULT_MCP_SERVER_URL = "http://localhost:3456";
|
|
37
|
-
export const DEFAULT_MCP_SERVER_NAME = "szcd-component-helper";
|
|
38
|
-
|
|
39
63
|
// ==================== 安全保护 ====================
|
|
40
64
|
|
|
41
65
|
export const RECURSION_GUARD_ENV = "SZCD_POSTINSTALL_RUNNING";
|
package/scripts/lib/qoder.js
CHANGED
|
@@ -171,7 +171,6 @@ function syncQoderSettings(deps) {
|
|
|
171
171
|
// ==================== Skill 复制 ====================
|
|
172
172
|
|
|
173
173
|
function copySkillToQoder(deps, isProjectLevel = false) {
|
|
174
|
-
const skillName = deps.getMcpServerName();
|
|
175
174
|
let qoderSkillsDir;
|
|
176
175
|
|
|
177
176
|
if (isProjectLevel) {
|
|
@@ -180,18 +179,23 @@ function copySkillToQoder(deps, isProjectLevel = false) {
|
|
|
180
179
|
qoderSkillsDir = getQoderSkillsDirectory();
|
|
181
180
|
}
|
|
182
181
|
|
|
183
|
-
const
|
|
182
|
+
const skills = deps.discoverSkills();
|
|
183
|
+
let allOk = true;
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
185
|
+
for (const skill of skills) {
|
|
186
|
+
const skillDir = path.join(qoderSkillsDir, skill.name);
|
|
187
|
+
try {
|
|
188
|
+
deps.ensureDirectory(skillDir);
|
|
189
|
+
const skillDest = path.join(skillDir, "SKILL.md");
|
|
190
|
+
deps.copyFile(skill.sourcePath, skillDest);
|
|
191
|
+
console.log(`✓ Copied skill "${skill.name}" to Qoder ${isProjectLevel ? "project" : "user"} directory: ${skillDir}`);
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.log(`⚠️ Failed to copy skill "${skill.name}" to Qoder ${isProjectLevel ? "project" : "user"} directory: ${error.message}`);
|
|
194
|
+
allOk = false;
|
|
195
|
+
}
|
|
194
196
|
}
|
|
197
|
+
|
|
198
|
+
return allOk;
|
|
195
199
|
}
|
|
196
200
|
|
|
197
201
|
// ==================== Agent 安装 ====================
|
package/scripts/lib/trae-cli.js
CHANGED
|
@@ -169,7 +169,6 @@ export function getTraeCliSkillsDirectory() {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
export function copySkillToTraeCli(deps, isProjectLevel = false) {
|
|
172
|
-
const skillName = deps.getMcpServerName();
|
|
173
172
|
let traeCliSkillsDir;
|
|
174
173
|
|
|
175
174
|
if (isProjectLevel) {
|
|
@@ -178,18 +177,23 @@ export function copySkillToTraeCli(deps, isProjectLevel = false) {
|
|
|
178
177
|
traeCliSkillsDir = getTraeCliSkillsDirectory();
|
|
179
178
|
}
|
|
180
179
|
|
|
181
|
-
const
|
|
180
|
+
const skills = deps.discoverSkills();
|
|
181
|
+
let allOk = true;
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
183
|
+
for (const skill of skills) {
|
|
184
|
+
const skillDir = path.join(traeCliSkillsDir, skill.name);
|
|
185
|
+
try {
|
|
186
|
+
deps.ensureDirectory(skillDir);
|
|
187
|
+
const skillDest = path.join(skillDir, "SKILL.md");
|
|
188
|
+
deps.copyFile(skill.sourcePath, skillDest);
|
|
189
|
+
console.log(`✓ Copied skill "${skill.name}" to Trae CLI ${isProjectLevel ? 'project' : 'user'} directory: ${skillDir}`);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.log(`⚠️ Failed to copy skill "${skill.name}" to Trae CLI ${isProjectLevel ? 'project' : 'user'} directory: ${error.message}`);
|
|
192
|
+
allOk = false;
|
|
193
|
+
}
|
|
192
194
|
}
|
|
195
|
+
|
|
196
|
+
return allOk;
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
// ==================== Slash Command 安装(Trae CLI) ====================
|
package/scripts/lib/trae-ide.js
CHANGED
|
@@ -146,7 +146,6 @@ export function syncMcpUrl(targetUrl, serverName) {
|
|
|
146
146
|
// ==================== Skill 复制 ====================
|
|
147
147
|
|
|
148
148
|
export function copySkillToTrae(deps, isProjectLevel = false) {
|
|
149
|
-
const skillName = deps.getMcpServerName();
|
|
150
149
|
let traeSkillsDir;
|
|
151
150
|
|
|
152
151
|
if (isProjectLevel) {
|
|
@@ -155,18 +154,23 @@ export function copySkillToTrae(deps, isProjectLevel = false) {
|
|
|
155
154
|
traeSkillsDir = getTraeSkillsDirectory();
|
|
156
155
|
}
|
|
157
156
|
|
|
158
|
-
const
|
|
157
|
+
const skills = deps.discoverSkills();
|
|
158
|
+
let allOk = true;
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
for (const skill of skills) {
|
|
161
|
+
const skillDir = path.join(traeSkillsDir, skill.name);
|
|
162
|
+
try {
|
|
163
|
+
deps.ensureDirectory(skillDir);
|
|
164
|
+
const skillDest = path.join(skillDir, "SKILL.md");
|
|
165
|
+
deps.copyFile(skill.sourcePath, skillDest);
|
|
166
|
+
console.log(`✓ Copied skill "${skill.name}" to Trae ${isProjectLevel ? 'project' : 'user'} directory: ${skillDir}`);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.log(`⚠️ Failed to copy skill "${skill.name}" to Trae ${isProjectLevel ? 'project' : 'user'} directory: ${error.message}`);
|
|
169
|
+
allOk = false;
|
|
170
|
+
}
|
|
169
171
|
}
|
|
172
|
+
|
|
173
|
+
return allOk;
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
// ==================== Agent 复制(Trae IDE) ====================
|
package/scripts/postinstall.js
CHANGED
|
@@ -39,6 +39,7 @@ const deps = {
|
|
|
39
39
|
ensureDirectory: common.ensureDirectory,
|
|
40
40
|
copyFile: common.copyFile,
|
|
41
41
|
writeFile: common.writeFile,
|
|
42
|
+
discoverSkills: common.discoverSkills,
|
|
42
43
|
SKILL_SOURCE: common.SKILL_SOURCE,
|
|
43
44
|
PROJECT_ROOT: common.PROJECT_ROOT,
|
|
44
45
|
PACKAGE_ROOT: common.PACKAGE_ROOT,
|
|
@@ -158,11 +159,12 @@ function main() {
|
|
|
158
159
|
console.log("\n🔧 Setting up szcd-component-helper client...\n");
|
|
159
160
|
|
|
160
161
|
console.log(`📁 Package root: ${common.PACKAGE_ROOT}`);
|
|
161
|
-
console.log(`📄 Skill source: ${common.SKILL_SOURCE}`);
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
const discoveredSkills = common.discoverSkills();
|
|
164
|
+
if (discoveredSkills.length === 0) {
|
|
165
|
+
throw new Error(`No skills found in ${common.SKILLS_DIR}. Expected subdirectories with SKILL.md files.`);
|
|
165
166
|
}
|
|
167
|
+
console.log(`📄 Found ${discoveredSkills.length} skill(s): ${discoveredSkills.map(s => s.name).join(", ")}`);
|
|
166
168
|
|
|
167
169
|
// ---- 配置文件 ----
|
|
168
170
|
createConfigTemplate();
|
|
@@ -196,7 +198,7 @@ function main() {
|
|
|
196
198
|
console.error(`- Node version: ${process.version}`);
|
|
197
199
|
console.error(`- Platform: ${process.platform}`);
|
|
198
200
|
console.error(`- Package root: ${common.PACKAGE_ROOT}`);
|
|
199
|
-
console.error(`-
|
|
201
|
+
console.error(`- Skills directory: ${common.SKILLS_DIR}`);
|
|
200
202
|
process.exit(1);
|
|
201
203
|
}
|
|
202
204
|
}
|