@szc-ft/mcp-szcd-client 0.12.1 → 0.12.4
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/agents/build.js +2 -2
- package/agents/platforms.json +1 -1
- package/package.json +2 -1
- package/qwen-extension/QWEN.md +40 -0
- package/qwen-extension/agents/szcd-component-expert.md +165 -0
- package/qwen-extension/commands/szcd-mcp-coding-config.md +42 -0
- package/qwen-extension/commands/szcd-mcp-url.md +37 -0
- package/qwen-extension/qwen-extension.json +24 -0
- package/qwen-extension/skills/szcd-component-helper/SKILL.md +827 -0
- package/scripts/lib/claude-code.js +25 -15
- package/scripts/lib/qwen-code.js +4 -2
- package/scripts/lib/trae-cli.js +19 -9
- package/scripts/update-mcp-url.js +3 -2
|
@@ -194,38 +194,48 @@ function copyAgentToClaudeCode(deps, isProjectLevel = false) {
|
|
|
194
194
|
// ==================== Slash Command 安装 ====================
|
|
195
195
|
|
|
196
196
|
function installClaudeCodeSlashCommand(deps) {
|
|
197
|
-
const
|
|
198
|
-
if (!fs.existsSync(
|
|
199
|
-
console.log("⚠️
|
|
197
|
+
const commandsSourceDir = path.join(deps.PACKAGE_ROOT, "commands");
|
|
198
|
+
if (!fs.existsSync(commandsSourceDir)) {
|
|
199
|
+
console.log("⚠️ Commands source directory not found, skipping Claude Code");
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const commandFiles = fs.readdirSync(commandsSourceDir).filter(f => f.endsWith(".md"));
|
|
204
|
+
if (commandFiles.length === 0) {
|
|
205
|
+
console.log("⚠️ No command files found, skipping Claude Code");
|
|
200
206
|
return;
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
// Claude Code:项目级 .claude/commands/
|
|
204
210
|
const claudeDir = path.join(deps.PROJECT_ROOT, ".claude");
|
|
205
211
|
const claudeCommandsDir = path.join(claudeDir, "commands");
|
|
206
|
-
const commandDest = path.join(claudeCommandsDir, "szcd-mcp-url.md");
|
|
207
212
|
|
|
208
213
|
if (fs.existsSync(claudeDir) && !fs.statSync(claudeDir).isDirectory()) {
|
|
209
|
-
console.log(`⚠️ Skipping Claude Code slash
|
|
214
|
+
console.log(`⚠️ Skipping Claude Code slash commands: ${claudeDir} exists but is not a directory`);
|
|
210
215
|
return;
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
try {
|
|
214
219
|
deps.ensureDirectory(claudeCommandsDir);
|
|
215
220
|
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
for (const file of commandFiles) {
|
|
222
|
+
const commandSource = path.join(commandsSourceDir, file);
|
|
223
|
+
const commandDest = path.join(claudeCommandsDir, file);
|
|
224
|
+
|
|
225
|
+
if (fs.existsSync(commandDest)) {
|
|
226
|
+
const existingContent = fs.readFileSync(commandDest, "utf8").trim();
|
|
227
|
+
const sourceContent = fs.readFileSync(commandSource, "utf8").trim();
|
|
228
|
+
if (existingContent !== sourceContent) {
|
|
229
|
+
console.log(`⏭️ Skipping Claude Code command ${file}: already exists (user modified)`);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
222
232
|
}
|
|
223
|
-
}
|
|
224
233
|
|
|
225
|
-
|
|
226
|
-
|
|
234
|
+
deps.copyFile(commandSource, commandDest);
|
|
235
|
+
console.log(`✓ Installed Claude Code slash command: /${file.replace(".md", "")}`);
|
|
236
|
+
}
|
|
227
237
|
} catch (error) {
|
|
228
|
-
console.log(`⚠️ Failed to install Claude Code slash
|
|
238
|
+
console.log(`⚠️ Failed to install Claude Code slash commands: ${error.message}`);
|
|
229
239
|
}
|
|
230
240
|
}
|
|
231
241
|
|
package/scripts/lib/qwen-code.js
CHANGED
|
@@ -319,13 +319,15 @@ function syncExtensionConfig(targetUrl, serverName) {
|
|
|
319
319
|
|
|
320
320
|
const mcpUrl = `${targetUrl}/mcp`;
|
|
321
321
|
const entry = manifest.mcpServers[serverName];
|
|
322
|
-
if (entry.type === "http" && entry.
|
|
322
|
+
if (entry.type === "http" && entry.httpUrl === mcpUrl) {
|
|
323
323
|
console.log(`⏭️ Extension qwen-extension.json already up-to-date: ${mcpUrl}`);
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
entry.type = "http";
|
|
328
|
-
entry.
|
|
328
|
+
entry.httpUrl = mcpUrl;
|
|
329
|
+
// 清理旧字段,避免冲突
|
|
330
|
+
delete entry.url;
|
|
329
331
|
writeJsonFile(manifestPath, manifest);
|
|
330
332
|
console.log(`✓ Updated extension qwen-extension.json: ${mcpUrl}`);
|
|
331
333
|
}
|
package/scripts/lib/trae-cli.js
CHANGED
|
@@ -93,7 +93,7 @@ export function syncTraeCliYaml(deps) {
|
|
|
93
93
|
const { servers } = parseYamlMcpServers(content);
|
|
94
94
|
|
|
95
95
|
const existing = servers.find(s => s.name === serverName);
|
|
96
|
-
if (existing && existing.url === mcpUrl) {
|
|
96
|
+
if (existing && existing.url === mcpUrl && existing.type === "http") {
|
|
97
97
|
console.log(`✓ Trae CLI YAML already up-to-date: ${mcpUrl}`);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
@@ -101,11 +101,12 @@ export function syncTraeCliYaml(deps) {
|
|
|
101
101
|
if (existing) {
|
|
102
102
|
const newRaw = existing.raw.map(l =>
|
|
103
103
|
l.replace(/^(\s+url\s*:\s*).*/, `$1${mcpUrl}`)
|
|
104
|
+
.replace(/^(\s+type\s*:\s*).*/, `$1http`)
|
|
104
105
|
);
|
|
105
106
|
const oldBlock = existing.raw.join("\n");
|
|
106
107
|
const newBlock = newRaw.join("\n");
|
|
107
108
|
content = content.replace(oldBlock, newBlock);
|
|
108
|
-
console.log(`✓ Updated Trae CLI YAML: ${existing.url} → ${mcpUrl}`);
|
|
109
|
+
console.log(`✓ Updated Trae CLI YAML: ${existing.url} → ${mcpUrl}, type → http`);
|
|
109
110
|
} else {
|
|
110
111
|
const entry = ` - name: ${serverName}\n url: ${mcpUrl}\n type: http\n`;
|
|
111
112
|
if (/^mcp_servers\s*:\s*\[\]\s*$/m.test(content)) {
|
|
@@ -176,17 +177,25 @@ export function getTraeCliCommandsDirectory() {
|
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
export function installTraeCliSlashCommand(deps) {
|
|
179
|
-
const
|
|
180
|
-
if (!fs.existsSync(
|
|
181
|
-
console.log("⚠️
|
|
180
|
+
const commandsSourceDir = path.join(deps.PACKAGE_ROOT, "commands");
|
|
181
|
+
if (!fs.existsSync(commandsSourceDir)) {
|
|
182
|
+
console.log("⚠️ Commands source directory not found, skipping");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const commandFiles = fs.readdirSync(commandsSourceDir).filter(f => f.endsWith(".md"));
|
|
187
|
+
if (commandFiles.length === 0) {
|
|
188
|
+
console.log("⚠️ No command files found, skipping");
|
|
182
189
|
return;
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
const traeCliCommandsDir = getTraeCliCommandsDirectory();
|
|
186
193
|
try {
|
|
187
194
|
deps.ensureDirectory(traeCliCommandsDir);
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
for (const file of commandFiles) {
|
|
196
|
+
deps.copyFile(path.join(commandsSourceDir, file), path.join(traeCliCommandsDir, file));
|
|
197
|
+
console.log(`✓ Installed Trae CLI slash command: /${file.replace(".md", "")}`);
|
|
198
|
+
}
|
|
190
199
|
} catch (error) {
|
|
191
200
|
console.log(`⚠️ Failed to install Trae CLI slash command: ${error.message}`);
|
|
192
201
|
}
|
|
@@ -266,7 +275,7 @@ function syncTraeCliYamlDirect(targetUrl, serverName) {
|
|
|
266
275
|
const { servers } = parseYamlMcpServers(content);
|
|
267
276
|
|
|
268
277
|
const existing = servers.find(s => s.name === serverName);
|
|
269
|
-
if (existing && existing.url === mcpUrl) {
|
|
278
|
+
if (existing && existing.url === mcpUrl && existing.type === "http") {
|
|
270
279
|
console.log(`⏭️ Trae CLI YAML already up-to-date: ${mcpUrl}`);
|
|
271
280
|
return;
|
|
272
281
|
}
|
|
@@ -274,11 +283,12 @@ function syncTraeCliYamlDirect(targetUrl, serverName) {
|
|
|
274
283
|
if (existing) {
|
|
275
284
|
const newRaw = existing.raw.map(l =>
|
|
276
285
|
l.replace(/^(\s+url\s*:\s*).*/, `$1${mcpUrl}`)
|
|
286
|
+
.replace(/^(\s+type\s*:\s*).*/, `$1http`)
|
|
277
287
|
);
|
|
278
288
|
const oldBlock = existing.raw.join("\n");
|
|
279
289
|
const newBlock = newRaw.join("\n");
|
|
280
290
|
content = content.replace(oldBlock, newBlock);
|
|
281
|
-
console.log(`✓ Updated Trae CLI YAML: ${existing.url} → ${mcpUrl}`);
|
|
291
|
+
console.log(`✓ Updated Trae CLI YAML: ${existing.url} → ${mcpUrl}, type → http`);
|
|
282
292
|
} else {
|
|
283
293
|
const entry = ` - name: ${serverName}\n url: ${mcpUrl}\n type: http\n`;
|
|
284
294
|
if (/^mcp_servers\s*:\s*\[\]\s*$/m.test(content)) {
|
|
@@ -96,12 +96,13 @@ function updatePlatformsJson(targetUrl) {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
if (platforms.platforms.qwen.mcp.
|
|
99
|
+
if (platforms.platforms.qwen.mcp.httpUrl === mcpUrl) {
|
|
100
100
|
console.log(`⏭️ platforms.json qwen.mcp already up-to-date: ${mcpUrl}`);
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
platforms.platforms.qwen.mcp.
|
|
104
|
+
platforms.platforms.qwen.mcp.httpUrl = mcpUrl;
|
|
105
|
+
delete platforms.platforms.qwen.mcp.url;
|
|
105
106
|
fs.writeFileSync(platformsPath, JSON.stringify(platforms, null, 4) + "\n");
|
|
106
107
|
console.log(`✓ Updated platforms.json: qwen.mcp.url → ${mcpUrl}`);
|
|
107
108
|
|