mta-mcp 2.4.1 → 2.5.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/dist/index.js CHANGED
@@ -1941,9 +1941,6 @@ async function autoSetup(args) {
1941
1941
  }
1942
1942
  }
1943
1943
 
1944
- // src/tools/getSmartStandards.ts
1945
- import * as fs8 from "fs";
1946
-
1947
1944
  // src/core/standardsManager.ts
1948
1945
  import * as fs6 from "fs";
1949
1946
  import * as path6 from "path";
@@ -2432,310 +2429,6 @@ ${content}
2432
2429
  }
2433
2430
  };
2434
2431
 
2435
- // src/core/autoInitializer.ts
2436
- import * as fs7 from "fs";
2437
- import * as path7 from "path";
2438
- var AutoInitializer = class {
2439
- constructor(logger3) {
2440
- this.logger = logger3;
2441
- this.initialized = /* @__PURE__ */ new Map();
2442
- }
2443
- /**
2444
- * 检查并初始化项目配置
2445
- * @param workspacePath 工作区路径
2446
- * @returns 是否需要初始化(返回 true 表示已执行初始化)
2447
- */
2448
- async ensureProjectConfig(workspacePath) {
2449
- var _a, _b, _c, _d;
2450
- const projectPath = workspacePath || this.detectWorkspacePath();
2451
- if (!projectPath) {
2452
- return {
2453
- needsInit: false,
2454
- initialized: false,
2455
- message: "\u672A\u68C0\u6D4B\u5230\u5DE5\u4F5C\u533A\u8DEF\u5F84"
2456
- };
2457
- }
2458
- if (this.initialized.get(projectPath)) {
2459
- return {
2460
- needsInit: false,
2461
- initialized: true,
2462
- message: `\u9879\u76EE\u5DF2\u914D\u7F6E: ${path7.basename(projectPath)}`
2463
- };
2464
- }
2465
- const configPath = path7.join(projectPath, ".github", "copilot-instructions.md");
2466
- const hasConfig = fs7.existsSync(configPath);
2467
- if (hasConfig) {
2468
- this.initialized.set(projectPath, true);
2469
- return {
2470
- needsInit: false,
2471
- initialized: true,
2472
- message: `\u9879\u76EE\u5DF2\u6709\u914D\u7F6E: ${path7.basename(projectPath)}`
2473
- };
2474
- }
2475
- this.log(`\u{1F50D} \u68C0\u6D4B\u5230\u9879\u76EE\u672A\u914D\u7F6E\uFF0C\u5F00\u59CB\u81EA\u52A8\u5206\u6790\u548C\u751F\u6210\u914D\u7F6E...`);
2476
- this.log(`\u{1F4C1} \u9879\u76EE\u8DEF\u5F84: ${projectPath}`);
2477
- try {
2478
- this.log("1\uFE0F\u20E3 \u5206\u6790\u9879\u76EE\u6280\u672F\u6808...");
2479
- const analysisResult = await analyzeProject({ projectPath });
2480
- if ((_b = (_a = analysisResult.content) == null ? void 0 : _a[0]) == null ? void 0 : _b.text) {
2481
- const analysis = JSON.parse(analysisResult.content[0].text);
2482
- this.log(`\u2705 \u68C0\u6D4B\u5230: ${((_c = analysis.frameworks) == null ? void 0 : _c.join(", ")) || "\u672A\u77E5\u6280\u672F\u6808"}`);
2483
- this.log("2\uFE0F\u20E3 \u751F\u6210\u9879\u76EE\u914D\u7F6E\u6587\u4EF6...");
2484
- await generateConfig({
2485
- projectPath,
2486
- autoMatch: true
2487
- });
2488
- this.initialized.set(projectPath, true);
2489
- return {
2490
- needsInit: true,
2491
- initialized: true,
2492
- message: `\u2705 \u9879\u76EE\u914D\u7F6E\u5DF2\u81EA\u52A8\u751F\u6210
2493
- \u{1F4C1} \u8DEF\u5F84: ${configPath}
2494
- \u{1F3AF} \u6280\u672F\u6808: ${(_d = analysis.frameworks) == null ? void 0 : _d.join(", ")}`
2495
- };
2496
- }
2497
- } catch (error) {
2498
- this.log(`\u274C \u81EA\u52A8\u521D\u59CB\u5316\u5931\u8D25: ${error}`);
2499
- return {
2500
- needsInit: true,
2501
- initialized: false,
2502
- message: `\u26A0\uFE0F \u81EA\u52A8\u521D\u59CB\u5316\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`
2503
- };
2504
- }
2505
- return {
2506
- needsInit: true,
2507
- initialized: false,
2508
- message: "\u26A0\uFE0F \u65E0\u6CD5\u5B8C\u6210\u81EA\u52A8\u521D\u59CB\u5316"
2509
- };
2510
- }
2511
- /**
2512
- * 检测工作区路径
2513
- */
2514
- detectWorkspacePath() {
2515
- if (process.env.WORKSPACE_PATH) {
2516
- return process.env.WORKSPACE_PATH;
2517
- }
2518
- const cwd = process.cwd();
2519
- if (this.isValidProject(cwd)) {
2520
- return cwd;
2521
- }
2522
- const possiblePaths = [
2523
- path7.join(cwd, ".."),
2524
- path7.join(cwd, "../..")
2525
- ];
2526
- for (const possiblePath of possiblePaths) {
2527
- if (this.isValidProject(possiblePath)) {
2528
- return possiblePath;
2529
- }
2530
- }
2531
- return null;
2532
- }
2533
- /**
2534
- * 判断是否是有效的项目目录
2535
- */
2536
- isValidProject(dirPath) {
2537
- if (!fs7.existsSync(dirPath)) {
2538
- return false;
2539
- }
2540
- const markers = [
2541
- "package.json",
2542
- "pubspec.yaml",
2543
- "pom.xml",
2544
- "go.mod",
2545
- "Cargo.toml",
2546
- ".git"
2547
- ];
2548
- return markers.some(
2549
- (marker) => fs7.existsSync(path7.join(dirPath, marker))
2550
- );
2551
- }
2552
- /**
2553
- * 重置初始化状态(用于测试)
2554
- */
2555
- reset() {
2556
- this.initialized.clear();
2557
- }
2558
- log(message) {
2559
- if (this.logger) {
2560
- this.logger.log(message);
2561
- } else {
2562
- console.error(`[AutoInit] ${message}`);
2563
- }
2564
- }
2565
- };
2566
-
2567
- // src/tools/getSmartStandards.ts
2568
- async function getSmartStandards(args) {
2569
- var _a;
2570
- const logger3 = new ConsoleLogger();
2571
- const manager = new StandardsManager();
2572
- const autoInit = new AutoInitializer(logger3);
2573
- try {
2574
- const initResult = await autoInit.ensureProjectConfig();
2575
- if (initResult.needsInit) {
2576
- logger3.log("\u{1F4CB} " + initResult.message);
2577
- if (initResult.initialized) {
2578
- return {
2579
- content: [{
2580
- type: "text",
2581
- text: `\u{1F389} **\u9996\u6B21\u4F7F\u7528\u81EA\u52A8\u914D\u7F6E\u5B8C\u6210**
2582
-
2583
- ${initResult.message}
2584
-
2585
- \u73B0\u5728\u53EF\u4EE5\u7EE7\u7EED\u4F7F\u7528 @mta \u8FDB\u884C\u5F00\u53D1\u4E86\uFF01
2586
-
2587
- \u{1F4A1} \u63D0\u793A\uFF1A\u9879\u76EE\u914D\u7F6E\u6587\u4EF6\u5DF2\u751F\u6210\u5728 .github/copilot-instructions.md`
2588
- }]
2589
- };
2590
- }
2591
- }
2592
- let detectedFileType = "unknown";
2593
- let detectedImports = [];
2594
- let detectedScenario = "";
2595
- let analysisSource = "none";
2596
- if (args.currentFile && fs8.existsSync(args.currentFile)) {
2597
- analysisSource = "file-path";
2598
- const ext = ((_a = args.currentFile.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "";
2599
- const extMap = {
2600
- "vue": "vue",
2601
- "ts": "ts",
2602
- "tsx": "tsx",
2603
- "js": "js",
2604
- "jsx": "jsx"
2605
- };
2606
- detectedFileType = extMap[ext] || "unknown";
2607
- try {
2608
- const content = fs8.readFileSync(args.currentFile, "utf-8");
2609
- const imports = extractImports(content);
2610
- detectedImports = imports;
2611
- detectedScenario = inferScenario(content, detectedFileType);
2612
- } catch {
2613
- logger3.log("\u65E0\u6CD5\u8BFB\u53D6\u6587\u4EF6\u5185\u5BB9\uFF0C\u4EC5\u4F7F\u7528\u6587\u4EF6\u7C7B\u578B");
2614
- }
2615
- }
2616
- if (args.fileContent) {
2617
- analysisSource = "file-content";
2618
- const imports = extractImports(args.fileContent);
2619
- detectedImports = [...detectedImports, ...imports];
2620
- if (detectedFileType === "unknown") {
2621
- if (args.fileContent.includes("<template>")) {
2622
- detectedFileType = "vue";
2623
- } else if (args.fileContent.includes("interface ") || args.fileContent.includes("type ")) {
2624
- detectedFileType = "ts";
2625
- }
2626
- }
2627
- const scenario = inferScenario(args.fileContent, detectedFileType);
2628
- if (scenario) detectedScenario = scenario;
2629
- }
2630
- if (detectedFileType === "unknown") {
2631
- analysisSource = "environment";
2632
- const cwd = process.cwd();
2633
- const packageJsonPath = `${cwd}/package.json`;
2634
- if (fs8.existsSync(packageJsonPath)) {
2635
- try {
2636
- const pkg = JSON.parse(fs8.readFileSync(packageJsonPath, "utf-8"));
2637
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
2638
- if (deps["vue"]) {
2639
- detectedFileType = "vue";
2640
- detectedImports.push("vue");
2641
- }
2642
- if (deps["react"]) {
2643
- detectedFileType = "tsx";
2644
- detectedImports.push("react");
2645
- }
2646
- if (deps["element-plus"]) detectedImports.push("element-plus");
2647
- if (deps["pinia"]) detectedImports.push("pinia");
2648
- if (deps["vue-i18n"]) detectedImports.push("vue-i18n");
2649
- } catch {
2650
- logger3.log("\u65E0\u6CD5\u89E3\u6790 package.json");
2651
- }
2652
- }
2653
- }
2654
- detectedImports = [...new Set(detectedImports)];
2655
- logger3.log(`\u{1F50D} \u667A\u80FD\u68C0\u6D4B\u7ED3\u679C: fileType=${detectedFileType}, imports=${detectedImports.join(",")}, scenario=${detectedScenario}`);
2656
- const standards = manager.getRelevantStandards({
2657
- fileType: detectedFileType !== "unknown" ? detectedFileType : void 0,
2658
- imports: detectedImports.length > 0 ? detectedImports : void 0,
2659
- scenario: detectedScenario || void 0
2660
- });
2661
- const combinedContent = manager.combineStandards(standards);
2662
- return {
2663
- content: [{
2664
- type: "text",
2665
- text: JSON.stringify({
2666
- success: true,
2667
- analysis: {
2668
- source: analysisSource,
2669
- fileType: detectedFileType,
2670
- imports: detectedImports,
2671
- scenario: detectedScenario
2672
- },
2673
- standards,
2674
- content: combinedContent,
2675
- stats: {
2676
- standardsCount: standards.length,
2677
- contentLength: combinedContent.length,
2678
- estimatedTokens: Math.ceil(combinedContent.length / 4)
2679
- }
2680
- }, null, 2)
2681
- }]
2682
- };
2683
- } catch (error) {
2684
- logger3.error(`\u667A\u80FD\u89C4\u8303\u63A8\u8350\u5931\u8D25: ${error}`);
2685
- return {
2686
- content: [{
2687
- type: "text",
2688
- text: JSON.stringify({
2689
- error: error instanceof Error ? error.message : String(error)
2690
- }, null, 2)
2691
- }]
2692
- };
2693
- }
2694
- }
2695
- function extractImports(content) {
2696
- const imports = [];
2697
- const es6Regex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
2698
- let match;
2699
- while ((match = es6Regex.exec(content)) !== null) {
2700
- const pkg = match[1];
2701
- if (!pkg.startsWith(".") && !pkg.startsWith("/")) {
2702
- imports.push(pkg.split("/")[0]);
2703
- }
2704
- }
2705
- const requireRegex = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
2706
- while ((match = requireRegex.exec(content)) !== null) {
2707
- const pkg = match[1];
2708
- if (!pkg.startsWith(".") && !pkg.startsWith("/")) {
2709
- imports.push(pkg.split("/")[0]);
2710
- }
2711
- }
2712
- return [...new Set(imports)];
2713
- }
2714
- function inferScenario(content, fileType) {
2715
- const scenarios = [];
2716
- if (fileType === "vue") {
2717
- if (content.includes("ElForm") || content.includes("<el-form")) {
2718
- scenarios.push("\u8868\u5355\u7EC4\u4EF6");
2719
- }
2720
- if (content.includes("ElTable") || content.includes("<el-table")) {
2721
- scenarios.push("\u8868\u683C\u7EC4\u4EF6");
2722
- }
2723
- if (content.includes("defineStore")) {
2724
- scenarios.push("\u72B6\u6001\u7BA1\u7406");
2725
- }
2726
- if (content.includes("useI18n") || content.includes("$t(")) {
2727
- scenarios.push("\u56FD\u9645\u5316");
2728
- }
2729
- }
2730
- if (content.includes("fetch(") || content.includes("axios.")) {
2731
- scenarios.push("API \u8C03\u7528");
2732
- }
2733
- if (content.includes("interface ") || content.includes("type ")) {
2734
- scenarios.push("\u7C7B\u578B\u5B9A\u4E49");
2735
- }
2736
- return scenarios.join("\u3001");
2737
- }
2738
-
2739
2432
  // src/tools/usePreset.ts
2740
2433
  var PRESETS = {
2741
2434
  "vue3-component": {
@@ -2883,11 +2576,11 @@ async function listPresets() {
2883
2576
  }
2884
2577
 
2885
2578
  // src/tools/healthCheck.ts
2886
- import * as fs9 from "fs";
2887
- import * as path8 from "path";
2579
+ import * as fs7 from "fs";
2580
+ import * as path7 from "path";
2888
2581
  import { fileURLToPath as fileURLToPath3 } from "url";
2889
2582
  var __filename3 = fileURLToPath3(import.meta.url);
2890
- var __dirname4 = path8.dirname(__filename3);
2583
+ var __dirname4 = path7.dirname(__filename3);
2891
2584
  async function healthCheck(args) {
2892
2585
  var _a, _b, _c, _d;
2893
2586
  const logger3 = new ConsoleLogger();
@@ -2912,14 +2605,14 @@ async function healthCheck(args) {
2912
2605
  }
2913
2606
  logger3.log("\u{1F50D} \u68C0\u67E5\u914D\u7F6E\u6587\u4EF6...");
2914
2607
  const workspacePath = args.workspacePath || process.cwd();
2915
- const vscodeDir = path8.join(workspacePath, ".vscode");
2916
- if (fs9.existsSync(vscodeDir)) {
2608
+ const vscodeDir = path7.join(workspacePath, ".vscode");
2609
+ if (fs7.existsSync(vscodeDir)) {
2917
2610
  checks.workspace.status = "healthy";
2918
2611
  checks.workspace.details.push(`\u2705 \u5DE5\u4F5C\u533A\u8DEF\u5F84: ${workspacePath}`);
2919
- const mcpJsonPath = path8.join(vscodeDir, "mcp.json");
2920
- if (fs9.existsSync(mcpJsonPath)) {
2612
+ const mcpJsonPath = path7.join(vscodeDir, "mcp.json");
2613
+ if (fs7.existsSync(mcpJsonPath)) {
2921
2614
  try {
2922
- const config = JSON.parse(fs9.readFileSync(mcpJsonPath, "utf-8"));
2615
+ const config = JSON.parse(fs7.readFileSync(mcpJsonPath, "utf-8"));
2923
2616
  const hasNewFormat = (_a = config.servers) == null ? void 0 : _a["copilot-prompts"];
2924
2617
  const hasOldFormat = (_b = config.mcpServers) == null ? void 0 : _b["copilot-prompts"];
2925
2618
  if (hasNewFormat) {
@@ -2962,10 +2655,10 @@ async function healthCheck(args) {
2962
2655
  checks.configuration.details.push("\u26A0\uFE0F mcp.json \u4E0D\u5B58\u5728");
2963
2656
  checks.configuration.details.push("\u{1F4A1} \u5EFA\u8BAE: \u8FD0\u884C auto_setup \u5DE5\u5177\u81EA\u52A8\u914D\u7F6E");
2964
2657
  }
2965
- const settingsPath = path8.join(vscodeDir, "settings.json");
2966
- if (fs9.existsSync(settingsPath)) {
2658
+ const settingsPath = path7.join(vscodeDir, "settings.json");
2659
+ if (fs7.existsSync(settingsPath)) {
2967
2660
  try {
2968
- const settings = JSON.parse(fs9.readFileSync(settingsPath, "utf-8"));
2661
+ const settings = JSON.parse(fs7.readFileSync(settingsPath, "utf-8"));
2969
2662
  if (settings["github.copilot.chat.mcp.enabled"] === true) {
2970
2663
  checks.configuration.details.push("\u2705 VS Code MCP \u5DF2\u542F\u7528");
2971
2664
  } else {
@@ -2980,11 +2673,11 @@ async function healthCheck(args) {
2980
2673
  checks.workspace.details.push("\u274C .vscode \u76EE\u5F55\u4E0D\u5B58\u5728");
2981
2674
  }
2982
2675
  logger3.log("\u{1F50D} \u68C0\u67E5\u4F9D\u8D56...");
2983
- const serverRoot = path8.resolve(__dirname4, "../..");
2984
- const packageJsonPath = path8.join(serverRoot, "package.json");
2985
- if (fs9.existsSync(packageJsonPath)) {
2676
+ const serverRoot = path7.resolve(__dirname4, "../..");
2677
+ const packageJsonPath = path7.join(serverRoot, "package.json");
2678
+ if (fs7.existsSync(packageJsonPath)) {
2986
2679
  try {
2987
- const pkg = JSON.parse(fs9.readFileSync(packageJsonPath, "utf-8"));
2680
+ const pkg = JSON.parse(fs7.readFileSync(packageJsonPath, "utf-8"));
2988
2681
  checks.dependencies.status = "healthy";
2989
2682
  checks.dependencies.details.push(`\u2705 \u670D\u52A1\u5668\u7248\u672C: ${pkg.version}`);
2990
2683
  if (verbose && pkg.dependencies) {
@@ -3008,14 +2701,14 @@ async function healthCheck(args) {
3008
2701
  }
3009
2702
  }
3010
2703
  logger3.log("\u{1F50D} \u68C0\u67E5\u89C4\u8303\u6587\u4EF6...");
3011
- const standardsDir = path8.join(serverRoot, "standards");
3012
- if (fs9.existsSync(standardsDir)) {
2704
+ const standardsDir = path7.join(serverRoot, "standards");
2705
+ if (fs7.existsSync(standardsDir)) {
3013
2706
  const categories = ["core", "frameworks", "libraries", "patterns"];
3014
2707
  const foundStandards = [];
3015
2708
  for (const category of categories) {
3016
- const categoryPath = path8.join(standardsDir, category);
3017
- if (fs9.existsSync(categoryPath)) {
3018
- const files = fs9.readdirSync(categoryPath).filter((f) => f.endsWith(".md"));
2709
+ const categoryPath = path7.join(standardsDir, category);
2710
+ if (fs7.existsSync(categoryPath)) {
2711
+ const files = fs7.readdirSync(categoryPath).filter((f) => f.endsWith(".md"));
3019
2712
  foundStandards.push(...files.map((f) => `${category}/${f}`));
3020
2713
  }
3021
2714
  }
@@ -3092,7 +2785,7 @@ function generateRecommendations(checks) {
3092
2785
  }
3093
2786
 
3094
2787
  // src/tools/getCompactStandards.ts
3095
- import * as fs10 from "fs";
2788
+ import * as fs8 from "fs";
3096
2789
  async function getCompactStandards(args) {
3097
2790
  const logger3 = new ConsoleLogger();
3098
2791
  const manager = new StandardsManager();
@@ -3139,7 +2832,7 @@ function detectContext(args, logger3) {
3139
2832
  let fileType = "unknown";
3140
2833
  let imports = [];
3141
2834
  let scenario = "";
3142
- if (args.currentFile && fs10.existsSync(args.currentFile)) {
2835
+ if (args.currentFile && fs8.existsSync(args.currentFile)) {
3143
2836
  const ext = ((_a = args.currentFile.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "";
3144
2837
  const extMap = {
3145
2838
  "vue": "vue",
@@ -3151,19 +2844,19 @@ function detectContext(args, logger3) {
3151
2844
  };
3152
2845
  fileType = extMap[ext] || "unknown";
3153
2846
  try {
3154
- const content = fs10.readFileSync(args.currentFile, "utf-8");
3155
- imports = extractImports2(content);
3156
- scenario = inferScenario2(content, fileType);
2847
+ const content = fs8.readFileSync(args.currentFile, "utf-8");
2848
+ imports = extractImports(content);
2849
+ scenario = inferScenario(content, fileType);
3157
2850
  } catch {
3158
2851
  }
3159
2852
  }
3160
2853
  if (args.fileContent) {
3161
- imports = [...imports, ...extractImports2(args.fileContent)];
2854
+ imports = [...imports, ...extractImports(args.fileContent)];
3162
2855
  if (fileType === "unknown") {
3163
2856
  if (args.fileContent.includes("<template>")) fileType = "vue";
3164
2857
  else if (args.fileContent.includes("interface ")) fileType = "ts";
3165
2858
  }
3166
- scenario = scenario || inferScenario2(args.fileContent, fileType);
2859
+ scenario = scenario || inferScenario(args.fileContent, fileType);
3167
2860
  }
3168
2861
  return { fileType, imports: [...new Set(imports)], scenario };
3169
2862
  }
@@ -3393,7 +3086,7 @@ function getFlutterKeyRules() {
3393
3086
  - \u274C \`Colors.blue\` Material \u989C\u8272\u5E38\u91CF`
3394
3087
  ];
3395
3088
  }
3396
- function extractImports2(content) {
3089
+ function extractImports(content) {
3397
3090
  const imports = [];
3398
3091
  const esImportRegex = /import\s+(?:(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)\s+from\s+)?['"]([^'"]+)['"]/g;
3399
3092
  let match;
@@ -3406,7 +3099,7 @@ function extractImports2(content) {
3406
3099
  }
3407
3100
  return imports;
3408
3101
  }
3409
- function inferScenario2(content, fileType) {
3102
+ function inferScenario(content, fileType) {
3410
3103
  const scenarios = [];
3411
3104
  const lower = content.toLowerCase();
3412
3105
  if (lower.includes("el-table") || lower.includes("el-form")) {
@@ -3422,8 +3115,8 @@ function inferScenario2(content, fileType) {
3422
3115
  }
3423
3116
 
3424
3117
  // src/tools/getStandardById.ts
3425
- import * as fs11 from "fs";
3426
- import * as path9 from "path";
3118
+ import * as fs9 from "fs";
3119
+ import * as path8 from "path";
3427
3120
  var STANDARD_DIRS = [
3428
3121
  "standards/core",
3429
3122
  "standards/frameworks",
@@ -3461,7 +3154,7 @@ async function getStandardById(args) {
3461
3154
  continue;
3462
3155
  }
3463
3156
  try {
3464
- const fullContent = fs11.readFileSync(filePath, "utf-8");
3157
+ const fullContent = fs9.readFileSync(filePath, "utf-8");
3465
3158
  const content = formatContent(fullContent, mode);
3466
3159
  results.push({
3467
3160
  id,
@@ -3518,33 +3211,33 @@ function ensureCache() {
3518
3211
  standardsCache = /* @__PURE__ */ new Map();
3519
3212
  const baseDir = findBaseDir();
3520
3213
  for (const dir of STANDARD_DIRS) {
3521
- const fullDir = path9.join(baseDir, dir);
3522
- if (!fs11.existsSync(fullDir)) continue;
3214
+ const fullDir = path8.join(baseDir, dir);
3215
+ if (!fs9.existsSync(fullDir)) continue;
3523
3216
  scanDirectory(fullDir, standardsCache);
3524
3217
  }
3525
3218
  }
3526
3219
  function findBaseDir() {
3527
3220
  const possiblePaths = [
3528
3221
  process.cwd(),
3529
- path9.join(process.cwd(), ".."),
3530
- path9.join(__dirname, "..", "..", "..")
3222
+ path8.join(process.cwd(), ".."),
3223
+ path8.join(__dirname, "..", "..", "..")
3531
3224
  ];
3532
3225
  for (const p of possiblePaths) {
3533
- if (fs11.existsSync(path9.join(p, "standards"))) {
3226
+ if (fs9.existsSync(path8.join(p, "standards"))) {
3534
3227
  return p;
3535
3228
  }
3536
3229
  }
3537
3230
  return process.cwd();
3538
3231
  }
3539
3232
  function scanDirectory(dir, cache) {
3540
- const items = fs11.readdirSync(dir);
3233
+ const items = fs9.readdirSync(dir);
3541
3234
  for (const item of items) {
3542
- const fullPath = path9.join(dir, item);
3543
- const stat = fs11.statSync(fullPath);
3235
+ const fullPath = path8.join(dir, item);
3236
+ const stat = fs9.statSync(fullPath);
3544
3237
  if (stat.isDirectory()) {
3545
3238
  scanDirectory(fullPath, cache);
3546
3239
  } else if (item.endsWith(".md")) {
3547
- const id = path9.basename(item, ".md");
3240
+ const id = path8.basename(item, ".md");
3548
3241
  cache.set(id, fullPath);
3549
3242
  }
3550
3243
  }
@@ -3787,10 +3480,10 @@ async function listScenarios() {
3787
3480
  }
3788
3481
 
3789
3482
  // src/core/templates/discovery.ts
3790
- import * as fs12 from "fs";
3791
- import * as path10 from "path";
3792
- var TEMPLATES_DIR = path10.resolve(
3793
- path10.dirname(new URL(import.meta.url).pathname),
3483
+ import * as fs10 from "fs";
3484
+ import * as path9 from "path";
3485
+ var TEMPLATES_DIR = path9.resolve(
3486
+ path9.dirname(new URL(import.meta.url).pathname),
3794
3487
  "../../../../templates"
3795
3488
  );
3796
3489
  var templatesCache = null;
@@ -3800,15 +3493,15 @@ function ensureCache2() {
3800
3493
  scanTemplates(TEMPLATES_DIR, "");
3801
3494
  }
3802
3495
  function scanTemplates(dir, prefix) {
3803
- if (!fs12.existsSync(dir)) return;
3804
- const entries = fs12.readdirSync(dir, { withFileTypes: true });
3496
+ if (!fs10.existsSync(dir)) return;
3497
+ const entries = fs10.readdirSync(dir, { withFileTypes: true });
3805
3498
  for (const entry of entries) {
3806
3499
  if (!entry.isDirectory()) continue;
3807
3500
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
3808
- const fullPath = path10.join(dir, entry.name);
3501
+ const fullPath = path9.join(dir, entry.name);
3809
3502
  const templateId = prefix ? `${prefix}/${entry.name}` : entry.name;
3810
- const configPath = path10.join(fullPath, "_CONFIG.md");
3811
- if (fs12.existsSync(configPath)) {
3503
+ const configPath = path9.join(fullPath, "_CONFIG.md");
3504
+ if (fs10.existsSync(configPath)) {
3812
3505
  const metadata = parseConfigMd(configPath, templateId, fullPath);
3813
3506
  if (metadata) {
3814
3507
  templatesCache.set(templateId, metadata);
@@ -3819,7 +3512,7 @@ function scanTemplates(dir, prefix) {
3819
3512
  }
3820
3513
  function parseConfigMd(configPath, templateId, templateDir) {
3821
3514
  try {
3822
- const content = fs12.readFileSync(configPath, "utf-8");
3515
+ const content = fs10.readFileSync(configPath, "utf-8");
3823
3516
  const titleMatch = content.match(/^#\s+(.+)$/m);
3824
3517
  const name = titleMatch ? titleMatch[1].trim() : templateId;
3825
3518
  const descMatch = content.match(/^>\s*(.+)$/m);
@@ -3862,14 +3555,14 @@ function inferTemplateType(templateId, name) {
3862
3555
  }
3863
3556
  function getTemplateFiles(dir, prefix = "") {
3864
3557
  const files = [];
3865
- const entries = fs12.readdirSync(dir, { withFileTypes: true });
3558
+ const entries = fs10.readdirSync(dir, { withFileTypes: true });
3866
3559
  for (const entry of entries) {
3867
3560
  const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
3868
3561
  if (entry.name === "_CONFIG.md" || entry.name === "_template.json") {
3869
3562
  continue;
3870
3563
  }
3871
3564
  if (entry.isDirectory()) {
3872
- files.push(...getTemplateFiles(path10.join(dir, entry.name), relativePath));
3565
+ files.push(...getTemplateFiles(path9.join(dir, entry.name), relativePath));
3873
3566
  } else {
3874
3567
  files.push(relativePath);
3875
3568
  }
@@ -3924,9 +3617,9 @@ function getTemplateById(templateId, includeFiles = false) {
3924
3617
  ensureCache2();
3925
3618
  const metadata = templatesCache.get(templateId);
3926
3619
  if (!metadata) return null;
3927
- const templateDir = path10.join(TEMPLATES_DIR, templateId);
3928
- const configPath = path10.join(templateDir, "_CONFIG.md");
3929
- const configGuide = fs12.existsSync(configPath) ? fs12.readFileSync(configPath, "utf-8") : "";
3620
+ const templateDir = path9.join(TEMPLATES_DIR, templateId);
3621
+ const configPath = path9.join(templateDir, "_CONFIG.md");
3622
+ const configGuide = fs10.existsSync(configPath) ? fs10.readFileSync(configPath, "utf-8") : "";
3930
3623
  const result = {
3931
3624
  metadata,
3932
3625
  configGuide
@@ -3934,11 +3627,11 @@ function getTemplateById(templateId, includeFiles = false) {
3934
3627
  if (includeFiles) {
3935
3628
  result.files = [];
3936
3629
  for (const filePath of metadata.files) {
3937
- const fullPath = path10.join(templateDir, filePath);
3938
- if (fs12.existsSync(fullPath)) {
3630
+ const fullPath = path9.join(templateDir, filePath);
3631
+ if (fs10.existsSync(fullPath)) {
3939
3632
  result.files.push({
3940
3633
  path: filePath,
3941
- content: fs12.readFileSync(fullPath, "utf-8"),
3634
+ content: fs10.readFileSync(fullPath, "utf-8"),
3942
3635
  isConfig: filePath.startsWith("_")
3943
3636
  });
3944
3637
  }
@@ -3949,7 +3642,7 @@ function getTemplateById(templateId, includeFiles = false) {
3949
3642
  function getTemplateDir(templateId) {
3950
3643
  ensureCache2();
3951
3644
  if (!templatesCache.has(templateId)) return null;
3952
- return path10.join(TEMPLATES_DIR, templateId);
3645
+ return path9.join(TEMPLATES_DIR, templateId);
3953
3646
  }
3954
3647
  function searchTemplates(query) {
3955
3648
  const lower = query.toLowerCase();
@@ -4235,7 +3928,7 @@ function createLogger(name) {
4235
3928
  }
4236
3929
 
4237
3930
  // src/index.ts
4238
- var SERVER_VERSION = "2.4.0";
3931
+ var SERVER_VERSION = "2.5.0";
4239
3932
  var logger2 = createLogger("Server");
4240
3933
  var CopilotPromptsMCPServer = class {
4241
3934
  constructor() {
@@ -4288,30 +3981,30 @@ var CopilotPromptsMCPServer = class {
4288
3981
  tools: [
4289
3982
  {
4290
3983
  name: "analyze_project",
4291
- description: "\u5206\u6790\u9879\u76EE\u7684\u6280\u672F\u6808\u3001\u6846\u67B6\u3001\u5DE5\u5177\u548C\u7279\u5F81\u3002\u81EA\u52A8\u68C0\u6D4B Vue\u3001React\u3001TypeScript \u7B49\u6280\u672F\u3002\u8DEF\u5F84\u53EF\u9009\uFF0C\u4E0D\u586B\u5219\u81EA\u52A8\u68C0\u6D4B\u5F53\u524D\u5DE5\u4F5C\u533A\u3002",
3984
+ description: "\u5206\u6790\u9879\u76EE\u6280\u672F\u6808\u3001\u6846\u67B6\u3001\u5DE5\u5177\u548C\u7279\u5F81",
4292
3985
  inputSchema: {
4293
3986
  type: "object",
4294
3987
  properties: {
4295
3988
  projectPath: {
4296
3989
  type: "string",
4297
- description: "\u9879\u76EE\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF08\u53EF\u9009\uFF0C\u4E0D\u586B\u5219\u4F7F\u7528\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\uFF09\uFF0C\u4F8B\u5982: /Users/username/projects/my-app"
3990
+ description: "\u9879\u76EE\u7EDD\u5BF9\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09"
4298
3991
  }
4299
3992
  }
4300
3993
  }
4301
3994
  },
4302
3995
  {
4303
3996
  name: "auto_setup",
4304
- description: "\u{1F3AF} \u4E00\u952E\u81EA\u52A8\u914D\u7F6E MCP \u670D\u52A1\u5668\u548C\u9879\u76EE\u89C4\u8303\u3002\u81EA\u52A8\u521B\u5EFA .vscode/mcp.json\u3001settings.json\u3001extensions.json\uFF0C\u5E76\u5206\u6790\u9879\u76EE\u751F\u6210 .github/copilot-instructions.md \u914D\u7F6E\u6587\u4EF6\u3002",
3997
+ description: "\u4E00\u952E\u914D\u7F6E MCP \u548C\u9879\u76EE\u89C4\u8303\uFF0C\u751F\u6210 .vscode/mcp.json \u548C copilot-instructions.md",
4305
3998
  inputSchema: {
4306
3999
  type: "object",
4307
4000
  properties: {
4308
4001
  workspacePath: {
4309
4002
  type: "string",
4310
- description: "\u5DE5\u4F5C\u533A\u8DEF\u5F84\uFF08\u53EF\u9009\uFF0C\u4E0D\u586B\u5219\u4F7F\u7528\u5F53\u524D\u76EE\u5F55\uFF09"
4003
+ description: "\u5DE5\u4F5C\u533A\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09"
4311
4004
  },
4312
4005
  generateInstructions: {
4313
4006
  type: "boolean",
4314
- description: "\u662F\u5426\u81EA\u52A8\u751F\u6210 copilot-instructions.md\uFF08\u9ED8\u8BA4 true\uFF09",
4007
+ description: "\u662F\u5426\u751F\u6210 copilot-instructions.md",
4315
4008
  default: true
4316
4009
  }
4317
4010
  }
@@ -4319,7 +4012,7 @@ var CopilotPromptsMCPServer = class {
4319
4012
  },
4320
4013
  {
4321
4014
  name: "health_check",
4322
- description: "\u{1F3E5} \u68C0\u67E5 MCP \u670D\u52A1\u5668\u5065\u5EB7\u72B6\u6001\uFF0C\u8BCA\u65AD\u914D\u7F6E\u95EE\u9898\u3002\u8FD4\u56DE\u8BE6\u7EC6\u7684\u5065\u5EB7\u62A5\u544A\u548C\u4FEE\u590D\u5EFA\u8BAE\u3002",
4015
+ description: "\u68C0\u67E5 MCP \u670D\u52A1\u5668\u72B6\u6001\uFF0C\u8BCA\u65AD\u914D\u7F6E\u95EE\u9898",
4323
4016
  inputSchema: {
4324
4017
  type: "object",
4325
4018
  properties: {
@@ -4329,31 +4022,14 @@ var CopilotPromptsMCPServer = class {
4329
4022
  },
4330
4023
  verbose: {
4331
4024
  type: "boolean",
4332
- description: "\u662F\u5426\u663E\u793A\u8BE6\u7EC6\u4FE1\u606F\uFF08\u9ED8\u8BA4 false\uFF09"
4333
- }
4334
- }
4335
- }
4336
- },
4337
- {
4338
- name: "get_smart_standards",
4339
- description: "\u{1F9E0} \u96F6\u53C2\u6570\u667A\u80FD\u89C4\u8303\u63A8\u8350\u3002\u81EA\u52A8\u68C0\u6D4B\u5F53\u524D\u6587\u4EF6\u7C7B\u578B\u3001\u5BFC\u5165\u3001\u573A\u666F\uFF0C\u63A8\u8350\u6700\u76F8\u5173\u7684\u7F16\u7801\u89C4\u8303\u3002\u6BD4\u624B\u52A8\u6307\u5B9A\u53C2\u6570\u66F4\u7B80\u5355\u3002",
4340
- inputSchema: {
4341
- type: "object",
4342
- properties: {
4343
- currentFile: {
4344
- type: "string",
4345
- description: "\u5F53\u524D\u7F16\u8F91\u7684\u6587\u4EF6\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09"
4346
- },
4347
- fileContent: {
4348
- type: "string",
4349
- description: "\u6587\u4EF6\u5185\u5BB9\uFF08\u53EF\u9009\uFF0C\u7528\u4E8E\u5206\u6790\u5BFC\u5165\u548C\u573A\u666F\uFF09"
4025
+ description: "\u663E\u793A\u8BE6\u7EC6\u4FE1\u606F"
4350
4026
  }
4351
4027
  }
4352
4028
  }
4353
4029
  },
4354
4030
  {
4355
4031
  name: "use_preset",
4356
- description: "\u26A1 \u4F7F\u7528\u9884\u8BBE\u573A\u666F\u5FEB\u6377\u83B7\u53D6\u89C4\u8303\u3002\u652F\u6301 vue3-component\u3001vue3-form\u3001pinia-store\u3001api-call \u7B49\u5E38\u89C1\u573A\u666F\uFF0C\u4E00\u952E\u83B7\u53D6\u3002",
4032
+ description: "\u6309\u9884\u8BBE\u573A\u666F\u83B7\u53D6\u89C4\u8303\uFF08vue3-component\u3001api-call\u3001pinia-store \u7B49\uFF09",
4357
4033
  inputSchema: {
4358
4034
  type: "object",
4359
4035
  properties: {
@@ -4365,7 +4041,7 @@ var CopilotPromptsMCPServer = class {
4365
4041
  customImports: {
4366
4042
  type: "array",
4367
4043
  items: { type: "string" },
4368
- description: "\u989D\u5916\u7684\u5BFC\u5165\uFF08\u53EF\u9009\uFF09"
4044
+ description: "\u989D\u5916\u5BFC\u5165\uFF08\u53EF\u9009\uFF09"
4369
4045
  }
4370
4046
  },
4371
4047
  required: ["preset"]
@@ -4373,7 +4049,7 @@ var CopilotPromptsMCPServer = class {
4373
4049
  },
4374
4050
  {
4375
4051
  name: "list_presets",
4376
- description: "\u{1F4CB} \u5217\u51FA\u6240\u6709\u53EF\u7528\u7684\u9884\u8BBE\u573A\u666F\u53CA\u5176\u8BF4\u660E\u3002",
4052
+ description: "\u5217\u51FA\u6240\u6709\u9884\u8BBE\u573A\u666F",
4377
4053
  inputSchema: {
4378
4054
  type: "object",
4379
4055
  properties: {}
@@ -4381,13 +4057,13 @@ var CopilotPromptsMCPServer = class {
4381
4057
  },
4382
4058
  {
4383
4059
  name: "match_agents",
4384
- description: "\u6839\u636E\u9879\u76EE\u7279\u5F81\u667A\u80FD\u5339\u914D\u6700\u5408\u9002\u7684 Copilot Agents\u3002\u4F7F\u7528\u52A0\u6743\u8BC4\u5206\u7B97\u6CD5\u3002",
4060
+ description: "\u6839\u636E\u9879\u76EE\u7279\u5F81\u5339\u914D Copilot Agents",
4385
4061
  inputSchema: {
4386
4062
  type: "object",
4387
4063
  properties: {
4388
4064
  projectFeatures: {
4389
4065
  type: "object",
4390
- description: "\u9879\u76EE\u7279\u5F81\u5BF9\u8C61\uFF08\u4ECE analyze_project \u83B7\u53D6\uFF09",
4066
+ description: "\u9879\u76EE\u7279\u5F81\uFF08\u4ECE analyze_project \u83B7\u53D6\uFF09",
4391
4067
  properties: {
4392
4068
  frameworks: { type: "array", items: { type: "string" } },
4393
4069
  languages: { type: "array", items: { type: "string" } },
@@ -4399,7 +4075,7 @@ var CopilotPromptsMCPServer = class {
4399
4075
  },
4400
4076
  limit: {
4401
4077
  type: "number",
4402
- description: "\u8FD4\u56DE\u7684\u6700\u5927 Agent \u6570\u91CF\uFF08\u9ED8\u8BA4 10\uFF09",
4078
+ description: "\u6700\u5927\u8FD4\u56DE\u6570\u91CF",
4403
4079
  default: 10
4404
4080
  }
4405
4081
  },
@@ -4408,7 +4084,7 @@ var CopilotPromptsMCPServer = class {
4408
4084
  },
4409
4085
  {
4410
4086
  name: "list_available_agents",
4411
- description: "\u83B7\u53D6\u6240\u6709\u53EF\u7528\u7684 Copilot Agents \u5217\u8868\uFF0C\u5305\u62EC\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u8DEF\u5F84\u7B49\u4FE1\u606F\u3002",
4087
+ description: "\u5217\u51FA\u6240\u6709\u53EF\u7528\u7684 Copilot Agents",
4412
4088
  inputSchema: {
4413
4089
  type: "object",
4414
4090
  properties: {}
@@ -4416,33 +4092,33 @@ var CopilotPromptsMCPServer = class {
4416
4092
  },
4417
4093
  {
4418
4094
  name: "generate_config",
4419
- description: "\u4E3A\u9879\u76EE\u751F\u6210 Copilot \u914D\u7F6E\u6587\u4EF6\uFF08.github/copilot-instructions.md\uFF09\u3002\u53EF\u4EE5\u81EA\u52A8\u5339\u914D\u6216\u624B\u52A8\u6307\u5B9A Agents\u3002",
4095
+ description: "\u4E3A\u9879\u76EE\u751F\u6210 copilot-instructions.md \u914D\u7F6E\u6587\u4EF6",
4420
4096
  inputSchema: {
4421
4097
  type: "object",
4422
4098
  properties: {
4423
4099
  projectPath: {
4424
4100
  type: "string",
4425
- description: "\u9879\u76EE\u7684\u7EDD\u5BF9\u8DEF\u5F84"
4101
+ description: "\u9879\u76EE\u7EDD\u5BF9\u8DEF\u5F84"
4426
4102
  },
4427
4103
  agentIds: {
4428
4104
  type: "array",
4429
4105
  items: { type: "string" },
4430
- description: "\u8981\u5E94\u7528\u7684 Agent ID \u5217\u8868\uFF08\u53EF\u9009\uFF0C\u5982\u4E0D\u63D0\u4F9B\u5219\u81EA\u52A8\u5339\u914D\uFF09"
4106
+ description: "\u6307\u5B9A Agent ID \u5217\u8868\uFF08\u53EF\u9009\uFF09"
4431
4107
  },
4432
4108
  autoMatch: {
4433
4109
  type: "boolean",
4434
- description: "\u662F\u5426\u81EA\u52A8\u5339\u914D Agents\uFF08\u9ED8\u8BA4 true\uFF09",
4110
+ description: "\u81EA\u52A8\u5339\u914D Agents",
4435
4111
  default: true
4436
4112
  },
4437
4113
  updateMode: {
4438
4114
  type: "string",
4439
4115
  enum: ["merge", "overwrite"],
4440
- description: "\u66F4\u65B0\u6A21\u5F0F\uFF1Amerge-\u4FDD\u7559\u81EA\u5B9A\u4E49\u5185\u5BB9\uFF08\u9ED8\u8BA4\uFF09\uFF0Coverwrite-\u5B8C\u5168\u8986\u76D6",
4116
+ description: "merge \u4FDD\u7559\u81EA\u5B9A\u4E49\u5185\u5BB9\uFF0Coverwrite \u8986\u76D6",
4441
4117
  default: "merge"
4442
4118
  },
4443
4119
  configId: {
4444
4120
  type: "string",
4445
- description: "\u914D\u7F6E\u65B9\u6848ID\uFF08\u5982 strict\uFF09\uFF0C\u4F1A\u52A0\u8F7D\u5BF9\u5E94\u7684\u8BE6\u7EC6\u89C4\u5219"
4121
+ description: "\u914D\u7F6E\u65B9\u6848 ID"
4446
4122
  }
4447
4123
  },
4448
4124
  required: ["projectPath"]
@@ -4450,7 +4126,7 @@ var CopilotPromptsMCPServer = class {
4450
4126
  },
4451
4127
  {
4452
4128
  name: "get_compact_standards",
4453
- description: "\u{1F680} Token \u4F18\u5316\u7248\u89C4\u8303\u83B7\u53D6\u3002\u652F\u6301\u4E09\u79CD\u6A21\u5F0F\uFF1Asummary(~500 tokens)\u4EC5\u8FD4\u56DE\u89C4\u8303\u5217\u8868\u3001key-rules(~2000 tokens)\u8FD4\u56DE\u5173\u952E\u89C4\u5219\u6458\u8981\u3001full(\u5B8C\u6574\u5185\u5BB9)\u3002\u9ED8\u8BA4 key-rules \u6A21\u5F0F\uFF0C\u6BD4\u5B8C\u6574\u52A0\u8F7D\u8282\u7701 80%+ token\u3002",
4129
+ description: "\u83B7\u53D6\u89C4\u8303\uFF08\u652F\u6301 summary/key-rules/full \u4E09\u79CD\u6A21\u5F0F\uFF0C\u9ED8\u8BA4 key-rules\uFF09",
4454
4130
  inputSchema: {
4455
4131
  type: "object",
4456
4132
  properties: {
@@ -4460,7 +4136,7 @@ var CopilotPromptsMCPServer = class {
4460
4136
  },
4461
4137
  fileContent: {
4462
4138
  type: "string",
4463
- description: "\u6587\u4EF6\u5185\u5BB9\uFF08\u53EF\u9009\uFF0C\u7528\u4E8E\u5206\u6790\uFF09"
4139
+ description: "\u6587\u4EF6\u5185\u5BB9\uFF08\u53EF\u9009\uFF09"
4464
4140
  },
4465
4141
  scenario: {
4466
4142
  type: "string",
@@ -4469,70 +4145,31 @@ var CopilotPromptsMCPServer = class {
4469
4145
  mode: {
4470
4146
  type: "string",
4471
4147
  enum: ["summary", "key-rules", "full"],
4472
- description: "\u8FD4\u56DE\u6A21\u5F0F\uFF1Asummary(~500 tokens)\u3001key-rules(~2000 tokens\uFF0C\u9ED8\u8BA4)\u3001full(\u5B8C\u6574\u5185\u5BB9)",
4148
+ description: "\u8FD4\u56DE\u6A21\u5F0F",
4473
4149
  default: "key-rules"
4474
4150
  }
4475
4151
  }
4476
4152
  }
4477
4153
  },
4478
- {
4479
- name: "get_relevant_standards",
4480
- description: "\u6839\u636E\u5F53\u524D\u5F00\u53D1\u4E0A\u4E0B\u6587\uFF0C\u83B7\u53D6\u76F8\u5173\u7684\u7F16\u7801\u89C4\u8303\uFF08\u5B8C\u6574\u5185\u5BB9\uFF09\u3002\u5982\u9700\u8282\u7701 token\uFF0C\u8BF7\u4F7F\u7528 get_compact_standards\u3002",
4481
- inputSchema: {
4482
- type: "object",
4483
- properties: {
4484
- fileType: {
4485
- type: "string",
4486
- description: "\u6587\u4EF6\u7C7B\u578B\uFF08\u5982 vue, ts, tsx, js\uFF09"
4487
- },
4488
- imports: {
4489
- type: "array",
4490
- items: { type: "string" },
4491
- description: '\u6587\u4EF6\u4E2D\u7684 import \u8BED\u53E5\uFF08\u5982 ["vue", "pinia", "element-plus"]\uFF09\u3002\u5982\u679C\u672A\u63D0\u4F9B\u4E14\u63D0\u4F9B\u4E86 fileContent\uFF0C\u5C06\u81EA\u52A8\u68C0\u6D4B\u3002'
4492
- },
4493
- scenario: {
4494
- type: "string",
4495
- description: '\u5F00\u53D1\u573A\u666F\u63CF\u8FF0\uFF08\u5982 "\u521B\u5EFA\u8868\u5355\u7EC4\u4EF6", "API \u8C03\u7528", "\u72B6\u6001\u7BA1\u7406"\uFF09'
4496
- },
4497
- fileContent: {
4498
- type: "string",
4499
- description: "\u6587\u4EF6\u5185\u5BB9\uFF08\u53EF\u9009\uFF09\u3002\u63D0\u4F9B\u540E\u53EF\u81EA\u52A8\u68C0\u6D4B imports \u5E76\u6839\u636E\u5173\u952E\u8BCD\u667A\u80FD\u5339\u914D\u89C4\u8303\u3002"
4500
- }
4501
- }
4502
- }
4503
- },
4504
- {
4505
- name: "get_standards_stats",
4506
- description: "\u83B7\u53D6\u89C4\u8303\u7CFB\u7EDF\u7684\u4F7F\u7528\u7EDF\u8BA1\u548C\u6027\u80FD\u6307\u6807\u3002\u7528\u4E8E\u4E86\u89E3\u6700\u5E38\u7528\u7684\u89C4\u8303\u7EC4\u5408\u3001\u7F13\u5B58\u547D\u4E2D\u7387\u3001Token \u8282\u7701\u60C5\u51B5\u7B49\u3002",
4507
- inputSchema: {
4508
- type: "object",
4509
- properties: {
4510
- includeCache: {
4511
- type: "boolean",
4512
- description: "\u662F\u5426\u5305\u542B\u7F13\u5B58\u8BE6\u7EC6\u4FE1\u606F\uFF08\u9ED8\u8BA4 false\uFF09"
4513
- }
4514
- }
4515
- }
4516
- },
4517
4154
  {
4518
4155
  name: "get_standard_by_id",
4519
- description: "\u{1F4D6} \u6309 ID \u76F4\u63A5\u83B7\u53D6\u89C4\u8303\u3002AI \u77E5\u9053\u9700\u8981\u4EC0\u4E48\u89C4\u8303\u65F6\uFF0C\u76F4\u63A5\u6309 ID \u83B7\u53D6\uFF0C\u6700\u7B80\u6D01\u9AD8\u6548\u3002\u652F\u6301\u4E09\u79CD\u6A21\u5F0F\uFF1Asummary(\u6458\u8981)\u3001key-rules(\u5173\u952E\u89C4\u5219\uFF0C\u9ED8\u8BA4)\u3001full(\u5B8C\u6574\u5185\u5BB9)\u3002",
4156
+ description: "\u6309 ID \u76F4\u63A5\u83B7\u53D6\u89C4\u8303",
4520
4157
  inputSchema: {
4521
4158
  type: "object",
4522
4159
  properties: {
4523
4160
  id: {
4524
4161
  type: "string",
4525
- description: "\u89C4\u8303 ID\uFF08\u5982 vue3-composition, element-plus, pinia\uFF09"
4162
+ description: "\u89C4\u8303 ID\uFF08\u5982 vue3-composition, element-plus\uFF09"
4526
4163
  },
4527
4164
  ids: {
4528
4165
  type: "array",
4529
4166
  items: { type: "string" },
4530
- description: "\u591A\u4E2A\u89C4\u8303 ID\uFF0C\u6279\u91CF\u83B7\u53D6"
4167
+ description: "\u6279\u91CF\u83B7\u53D6\u591A\u4E2A\u89C4\u8303 ID"
4531
4168
  },
4532
4169
  mode: {
4533
4170
  type: "string",
4534
4171
  enum: ["summary", "key-rules", "full"],
4535
- description: "\u52A0\u8F7D\u6A21\u5F0F\uFF1Asummary(\u6458\u8981)\u3001key-rules(\u5173\u952E\u89C4\u5219\uFF0C\u9ED8\u8BA4)\u3001full(\u5B8C\u6574\u5185\u5BB9)",
4172
+ description: "\u8FD4\u56DE\u6A21\u5F0F",
4536
4173
  default: "key-rules"
4537
4174
  }
4538
4175
  }
@@ -4540,33 +4177,33 @@ var CopilotPromptsMCPServer = class {
4540
4177
  },
4541
4178
  {
4542
4179
  name: "query_mappings",
4543
- description: '\u{1F5FA}\uFE0F \u67E5\u8BE2\u573A\u666F-\u89C4\u8303\u6620\u5C04\u5173\u7CFB\u3002\u63D0\u4F9B\u6620\u5C04\u4FE1\u606F\u7ED9 AI \u53C2\u8003\uFF0CAI \u81EA\u5DF1\u51B3\u5B9A\u4F7F\u7528\u54EA\u4E9B\u89C4\u8303\u3002\u4E0D\u505A"\u667A\u80FD\u63A8\u8350"\uFF0C\u53EA\u63D0\u4F9B\u6570\u636E\u67E5\u8BE2\u3002',
4180
+ description: "\u67E5\u8BE2\u573A\u666F-\u89C4\u8303\u6620\u5C04\u5173\u7CFB",
4544
4181
  inputSchema: {
4545
4182
  type: "object",
4546
4183
  properties: {
4547
4184
  scenario: {
4548
4185
  type: "string",
4549
- description: "\u573A\u666F\u540D\u79F0\uFF08\u5982 vue3-form, api-call, pinia-store\uFF09"
4186
+ description: "\u573A\u666F\u540D\u79F0"
4550
4187
  },
4551
4188
  fileType: {
4552
4189
  type: "string",
4553
- description: "\u6587\u4EF6\u7C7B\u578B\uFF08\u5982 vue, ts, tsx\uFF09"
4190
+ description: "\u6587\u4EF6\u7C7B\u578B"
4554
4191
  },
4555
4192
  imports: {
4556
4193
  type: "array",
4557
4194
  items: { type: "string" },
4558
- description: "\u5BFC\u5165\u7684\u5305\uFF08\u5982 element-plus, pinia\uFF09"
4195
+ description: "\u5BFC\u5165\u7684\u5305"
4559
4196
  },
4560
4197
  listAll: {
4561
4198
  type: "boolean",
4562
- description: "\u5217\u51FA\u6240\u6709\u6620\u5C04\u5173\u7CFB"
4199
+ description: "\u5217\u51FA\u6240\u6709\u6620\u5C04"
4563
4200
  }
4564
4201
  }
4565
4202
  }
4566
4203
  },
4567
4204
  {
4568
4205
  name: "list_scenarios",
4569
- description: "\u{1F4CB} \u5217\u51FA\u6240\u6709\u53EF\u7528\u7684\u573A\u666F\u540D\u79F0\u3002AI \u53EF\u4F7F\u7528\u8FD9\u4E9B\u573A\u666F\u540D\u79F0\u8C03\u7528 use_preset \u6216 query_mappings\u3002",
4206
+ description: "\u5217\u51FA\u6240\u6709\u53EF\u7528\u573A\u666F",
4570
4207
  inputSchema: {
4571
4208
  type: "object",
4572
4209
  properties: {}
@@ -4574,7 +4211,7 @@ var CopilotPromptsMCPServer = class {
4574
4211
  },
4575
4212
  {
4576
4213
  name: "list_templates",
4577
- description: "\u{1F4E6} \u5217\u51FA\u53EF\u7528\u7684\u4EE3\u7801\u6A21\u677F\u3002\u6A21\u677F\u662F\u53EF\u590D\u7528\u7684\u4EE3\u7801\u7247\u6BB5\uFF0CAI \u53EF\u6839\u636E\u9700\u8981\u9009\u62E9\u5E76\u5E94\u7528\u5230\u76EE\u6807\u9879\u76EE\u3002",
4214
+ description: "\u5217\u51FA\u53EF\u7528\u4EE3\u7801\u6A21\u677F",
4578
4215
  inputSchema: {
4579
4216
  type: "object",
4580
4217
  properties: {
@@ -4585,7 +4222,7 @@ var CopilotPromptsMCPServer = class {
4585
4222
  },
4586
4223
  framework: {
4587
4224
  type: "string",
4588
- description: "\u6309\u6846\u67B6\u7B5B\u9009\uFF08\u5982 vue, react\uFF09"
4225
+ description: "\u6309\u6846\u67B6\u7B5B\u9009"
4589
4226
  },
4590
4227
  search: {
4591
4228
  type: "string",
@@ -4596,23 +4233,23 @@ var CopilotPromptsMCPServer = class {
4596
4233
  },
4597
4234
  {
4598
4235
  name: "get_template",
4599
- description: "\u{1F4C4} \u83B7\u53D6\u6A21\u677F\u8BE6\u60C5\u548C\u6587\u4EF6\u5185\u5BB9\u3002AI \u53EF\u6839\u636E\u914D\u7F6E\u8BF4\u660E\u81EA\u884C\u4FEE\u6539\u5E76\u5E94\u7528\u6A21\u677F\u3002",
4236
+ description: "\u83B7\u53D6\u6A21\u677F\u8BE6\u60C5\u548C\u6587\u4EF6\u5185\u5BB9",
4600
4237
  inputSchema: {
4601
4238
  type: "object",
4602
4239
  properties: {
4603
4240
  id: {
4604
4241
  type: "string",
4605
- description: "\u6A21\u677F ID\uFF08\u5982 vue/api-layer\uFF09"
4242
+ description: "\u6A21\u677F ID"
4606
4243
  },
4607
4244
  includeFiles: {
4608
4245
  type: "boolean",
4609
- description: "\u662F\u5426\u5305\u542B\u6587\u4EF6\u5185\u5BB9\uFF08\u9ED8\u8BA4 false\uFF0C\u53EA\u8FD4\u56DE\u914D\u7F6E\u8BF4\u660E\uFF09",
4246
+ description: "\u5305\u542B\u6587\u4EF6\u5185\u5BB9",
4610
4247
  default: false
4611
4248
  },
4612
4249
  files: {
4613
4250
  type: "array",
4614
4251
  items: { type: "string" },
4615
- description: "\u6307\u5B9A\u8981\u83B7\u53D6\u7684\u6587\u4EF6\u5217\u8868\uFF08\u53EF\u9009\uFF09"
4252
+ description: "\u6307\u5B9A\u6587\u4EF6\u5217\u8868"
4616
4253
  }
4617
4254
  },
4618
4255
  required: ["id"]
@@ -4632,8 +4269,6 @@ var CopilotPromptsMCPServer = class {
4632
4269
  return await autoSetup(args);
4633
4270
  case "health_check":
4634
4271
  return await healthCheck(args);
4635
- case "get_smart_standards":
4636
- return await getSmartStandards(args);
4637
4272
  case "use_preset":
4638
4273
  return await usePreset(args);
4639
4274
  case "list_presets":
@@ -4646,10 +4281,6 @@ var CopilotPromptsMCPServer = class {
4646
4281
  return await generateConfig(args);
4647
4282
  case "get_compact_standards":
4648
4283
  return await getCompactStandards(args);
4649
- case "get_relevant_standards":
4650
- return this.getRelevantStandards(args);
4651
- case "get_standards_stats":
4652
- return this.getStandardsStats(args);
4653
4284
  case "get_standard_by_id":
4654
4285
  return await getStandardById(args);
4655
4286
  case "query_mappings":
@@ -4700,53 +4331,6 @@ var CopilotPromptsMCPServer = class {
4700
4331
  }
4701
4332
  });
4702
4333
  }
4703
- /**
4704
- * 获取相关编码规范
4705
- */
4706
- getRelevantStandards(args) {
4707
- const standardUris = this.standardsManager.getRelevantStandards(args);
4708
- const content = this.standardsManager.combineStandards(standardUris);
4709
- return {
4710
- content: [{
4711
- type: "text",
4712
- text: JSON.stringify({
4713
- success: true,
4714
- standards: standardUris,
4715
- content,
4716
- tokenEstimate: Math.ceil(content.length / 4),
4717
- // 粗略估算 token 数
4718
- message: `\u5DF2\u52A0\u8F7D ${standardUris.length} \u4E2A\u76F8\u5173\u89C4\u8303`
4719
- }, null, 2)
4720
- }]
4721
- };
4722
- }
4723
- /**
4724
- * 获取规范系统统计信息(Phase 3)
4725
- */
4726
- getStandardsStats(args) {
4727
- const usageStats = this.standardsManager.getUsageStats();
4728
- const performanceMetrics = this.standardsManager.getPerformanceMetrics();
4729
- const result = {
4730
- success: true,
4731
- usage: usageStats,
4732
- performance: performanceMetrics,
4733
- summary: {
4734
- totalCalls: usageStats.totalCalls,
4735
- cacheHitRate: performanceMetrics.cacheHitRate,
4736
- totalTokensSaved: performanceMetrics.totalTokensSaved,
4737
- averageResponseTime: `${performanceMetrics.averageResponseTime.toFixed(2)}ms`
4738
- }
4739
- };
4740
- if (args.includeCache) {
4741
- result.cache = this.standardsManager.getCacheStats();
4742
- }
4743
- return {
4744
- content: [{
4745
- type: "text",
4746
- text: JSON.stringify(result, null, 2)
4747
- }]
4748
- };
4749
- }
4750
4334
  async run() {
4751
4335
  const transport = new StdioServerTransport();
4752
4336
  await this.server.connect(transport);