autosnippet 3.2.18 → 3.2.21

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.
Files changed (189) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +73 -104
  3. package/config/default.json +1 -1
  4. package/dashboard/dist/assets/{index-CKMy5LY6.js → index-DdvZE4Yd.js} +1 -1
  5. package/dashboard/dist/index.html +1 -1
  6. package/dist/bin/cli.js +45 -10
  7. package/dist/lib/agent/AgentEventBus.js +3 -3
  8. package/dist/lib/agent/AgentFactory.d.ts +3 -3
  9. package/dist/lib/agent/AgentFactory.js +4 -4
  10. package/dist/lib/agent/AgentMessage.d.ts +8 -8
  11. package/dist/lib/agent/AgentMessage.js +8 -8
  12. package/dist/lib/agent/AgentRuntime.js +2 -2
  13. package/dist/lib/agent/AgentState.js +4 -4
  14. package/dist/lib/agent/ConversationStore.d.ts +1 -1
  15. package/dist/lib/agent/ConversationStore.js +1 -1
  16. package/dist/lib/agent/PipelineStrategy.js +1 -1
  17. package/dist/lib/agent/context/ContextWindow.d.ts +2 -2
  18. package/dist/lib/agent/context/ContextWindow.js +7 -7
  19. package/dist/lib/agent/context/ExplorationTracker.js +9 -9
  20. package/dist/lib/agent/context/exploration/PlanTracker.js +2 -2
  21. package/dist/lib/agent/context/exploration/SignalDetector.d.ts +1 -1
  22. package/dist/lib/agent/context/exploration/SignalDetector.js +1 -1
  23. package/dist/lib/agent/core/LoopContext.d.ts +21 -21
  24. package/dist/lib/agent/core/LoopContext.js +21 -21
  25. package/dist/lib/agent/core/SystemPromptBuilder.js +4 -4
  26. package/dist/lib/agent/domain/EvidenceCollector.js +5 -5
  27. package/dist/lib/agent/memory/ActiveContext.js +1 -1
  28. package/dist/lib/agent/memory/MemoryRetriever.js +1 -1
  29. package/dist/lib/agent/memory/MemoryStore.js +2 -2
  30. package/dist/lib/agent/memory/SessionStore.js +3 -3
  31. package/dist/lib/agent/policies.d.ts +1 -1
  32. package/dist/lib/agent/policies.js +1 -1
  33. package/dist/lib/agent/strategies.d.ts +1 -1
  34. package/dist/lib/agent/strategies.js +4 -4
  35. package/dist/lib/agent/tools/_shared.d.ts +1 -1
  36. package/dist/lib/agent/tools/_shared.js +1 -1
  37. package/dist/lib/agent/tools/infrastructure.js +2 -2
  38. package/dist/lib/cli/SetupService.d.ts +25 -25
  39. package/dist/lib/cli/SetupService.js +28 -15
  40. package/dist/lib/cli/deploy/FileDeployer.d.ts +9 -2
  41. package/dist/lib/cli/deploy/FileDeployer.js +139 -46
  42. package/dist/lib/cli/deploy/FileManifest.d.ts +23 -39
  43. package/dist/lib/cli/deploy/FileManifest.js +22 -33
  44. package/dist/lib/core/AstAnalyzer.d.ts +2 -2
  45. package/dist/lib/core/AstAnalyzer.js +2 -2
  46. package/dist/lib/core/analysis/CallEdgeResolver.d.ts +7 -7
  47. package/dist/lib/core/analysis/CallEdgeResolver.js +9 -9
  48. package/dist/lib/core/analysis/CallGraphAnalyzer.d.ts +4 -4
  49. package/dist/lib/core/analysis/CallGraphAnalyzer.js +2 -2
  50. package/dist/lib/core/analysis/ImportPathResolver.d.ts +0 -2
  51. package/dist/lib/core/analysis/ImportPathResolver.js +2 -4
  52. package/dist/lib/core/ast/ProjectGraph.js +7 -7
  53. package/dist/lib/core/capability/CapabilityProbe.js +6 -14
  54. package/dist/lib/domain/knowledge/UnifiedValidator.js +2 -2
  55. package/dist/lib/domain/knowledge/values/Constraints.js +4 -4
  56. package/dist/lib/domain/knowledge/values/Content.js +6 -6
  57. package/dist/lib/domain/knowledge/values/Quality.js +5 -5
  58. package/dist/lib/domain/knowledge/values/Reasoning.js +5 -5
  59. package/dist/lib/domain/knowledge/values/Relations.js +1 -1
  60. package/dist/lib/domain/knowledge/values/Stats.js +6 -6
  61. package/dist/lib/domain/task/TaskIdGenerator.d.ts +4 -4
  62. package/dist/lib/domain/task/TaskIdGenerator.js +2 -2
  63. package/dist/lib/external/lark/LarkTransport.js +4 -4
  64. package/dist/lib/external/mcp/McpServer.d.ts +3 -7
  65. package/dist/lib/external/mcp/McpServer.js +9 -13
  66. package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +5 -5
  67. package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +4 -3
  68. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.d.ts +3 -3
  69. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.js +3 -3
  70. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.d.ts +1 -1
  71. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.js +1 -1
  72. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +3 -3
  73. package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +27 -14
  74. package/dist/lib/external/mcp/handlers/bootstrap-external.js +6 -0
  75. package/dist/lib/external/mcp/handlers/dimension-complete-external.js +55 -1
  76. package/dist/lib/external/mcp/handlers/skill.js +9 -31
  77. package/dist/lib/external/mcp/handlers/system.js +6 -4
  78. package/dist/lib/external/mcp/handlers/task.js +16 -1
  79. package/dist/lib/external/mcp/tools.d.ts +12 -10
  80. package/dist/lib/external/mcp/tools.js +97 -69
  81. package/dist/lib/http/utils/routeHelpers.d.ts +1 -1
  82. package/dist/lib/http/utils/routeHelpers.js +1 -1
  83. package/dist/lib/http/utils/sse-sessions.d.ts +1 -1
  84. package/dist/lib/http/utils/sse-sessions.js +1 -1
  85. package/dist/lib/infrastructure/cache/CacheService.js +1 -1
  86. package/dist/lib/infrastructure/logging/Logger.js +1 -1
  87. package/dist/lib/infrastructure/monitoring/ErrorTracker.js +1 -1
  88. package/dist/lib/infrastructure/vector/AsyncPersistence.js +8 -8
  89. package/dist/lib/infrastructure/vector/BatchEmbedder.d.ts +1 -1
  90. package/dist/lib/infrastructure/vector/BatchEmbedder.js +2 -2
  91. package/dist/lib/infrastructure/vector/HnswIndex.d.ts +4 -4
  92. package/dist/lib/infrastructure/vector/HnswIndex.js +5 -5
  93. package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +8 -8
  94. package/dist/lib/infrastructure/vector/ScalarQuantizer.d.ts +1 -1
  95. package/dist/lib/infrastructure/vector/ScalarQuantizer.js +4 -4
  96. package/dist/lib/infrastructure/vector/VectorStore.d.ts +1 -1
  97. package/dist/lib/infrastructure/vector/VectorStore.js +1 -1
  98. package/dist/lib/injection/ServiceContainer.d.ts +1 -1
  99. package/dist/lib/injection/ServiceContainer.js +1 -1
  100. package/dist/lib/injection/modules/KnowledgeModule.js +4 -5
  101. package/dist/lib/platform/NativeUi.d.ts +1 -1
  102. package/dist/lib/platform/NativeUi.js +1 -1
  103. package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +1 -1
  104. package/dist/lib/platform/ios/spm/DependencyGraph.js +1 -1
  105. package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +1 -1
  106. package/dist/lib/platform/ios/spm/PolicyEngine.js +1 -1
  107. package/dist/lib/platform/ios/spm/SpmDiscoverer.js +1 -1
  108. package/dist/lib/platform/ios/spm/SpmHelper.js +3 -3
  109. package/dist/lib/platform/ios/xcode/SaveEventFilter.js +2 -2
  110. package/dist/lib/platform/ios/xcode/XcodeIntegration.js +1 -1
  111. package/dist/lib/repository/base/BaseRepository.js +1 -1
  112. package/dist/lib/repository/task/TaskRepository.impl.d.ts +2 -2
  113. package/dist/lib/repository/task/TaskRepository.impl.js +1 -1
  114. package/dist/lib/repository/token/TokenUsageStore.js +1 -1
  115. package/dist/lib/service/automation/ActionPipeline.d.ts +1 -1
  116. package/dist/lib/service/automation/ActionPipeline.js +1 -1
  117. package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +2 -2
  118. package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +1 -1
  119. package/dist/lib/service/bootstrap/BootstrapTaskManager.js +2 -2
  120. package/dist/lib/service/bootstrap/DimensionCopyRegistry.d.ts +2 -2
  121. package/dist/lib/service/bootstrap/DimensionCopyRegistry.js +2 -2
  122. package/dist/lib/service/delivery/AgentInstructionsGenerator.d.ts +6 -15
  123. package/dist/lib/service/delivery/AgentInstructionsGenerator.js +53 -189
  124. package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +6 -16
  125. package/dist/lib/service/delivery/CursorDeliveryPipeline.js +14 -19
  126. package/dist/lib/service/delivery/KnowledgeCompressor.d.ts +1 -1
  127. package/dist/lib/service/delivery/KnowledgeCompressor.js +1 -1
  128. package/dist/lib/service/delivery/RulesGenerator.d.ts +10 -3
  129. package/dist/lib/service/delivery/RulesGenerator.js +43 -3
  130. package/dist/lib/service/delivery/SkillsSyncer.d.ts +21 -7
  131. package/dist/lib/service/delivery/SkillsSyncer.js +46 -10
  132. package/dist/lib/service/delivery/TopicClassifier.d.ts +3 -6
  133. package/dist/lib/service/delivery/TopicClassifier.js +0 -3
  134. package/dist/lib/service/guard/ExclusionManager.d.ts +1 -1
  135. package/dist/lib/service/guard/ExclusionManager.js +1 -1
  136. package/dist/lib/service/guard/GuardCheckEngine.d.ts +3 -3
  137. package/dist/lib/service/guard/GuardCheckEngine.js +5 -5
  138. package/dist/lib/service/guard/GuardCrossFileChecks.d.ts +1 -1
  139. package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -3
  140. package/dist/lib/service/guard/GuardFeedbackLoop.js +3 -3
  141. package/dist/lib/service/guard/GuardPatternUtils.js +1 -1
  142. package/dist/lib/service/guard/GuardService.d.ts +1 -15
  143. package/dist/lib/service/guard/GuardService.js +0 -1
  144. package/dist/lib/service/guard/RuleLearner.d.ts +1 -1
  145. package/dist/lib/service/guard/RuleLearner.js +1 -1
  146. package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +3 -3
  147. package/dist/lib/service/knowledge/CodeEntityGraph.js +3 -3
  148. package/dist/lib/service/knowledge/KnowledgeService.d.ts +0 -1
  149. package/dist/lib/service/knowledge/KnowledgeService.js +0 -1
  150. package/dist/lib/service/module/ModuleService.d.ts +1 -1
  151. package/dist/lib/service/module/ModuleService.js +2 -2
  152. package/dist/lib/service/search/HybridRetriever.d.ts +2 -2
  153. package/dist/lib/service/search/HybridRetriever.js +2 -2
  154. package/dist/lib/service/search/SearchEngine.d.ts +1 -3
  155. package/dist/lib/service/search/SearchEngine.js +1 -3
  156. package/dist/lib/service/search/contextBoost.d.ts +1 -1
  157. package/dist/lib/service/skills/EventAggregator.js +2 -2
  158. package/dist/lib/service/skills/SignalCollector.js +1 -1
  159. package/dist/lib/service/snippet/codecs/VSCodeCodec.js +1 -1
  160. package/dist/lib/service/task/TaskGraphService.d.ts +0 -3
  161. package/dist/lib/service/task/TaskGraphService.js +0 -3
  162. package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +8 -27
  163. package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -8
  164. package/dist/lib/service/task/TaskReadyEngine.d.ts +1 -2
  165. package/dist/lib/service/task/TaskReadyEngine.js +0 -1
  166. package/dist/lib/service/wiki/WikiRenderers.js +0 -1
  167. package/dist/lib/service/wiki/WikiUtils.js +2 -7
  168. package/dist/lib/shared/PathGuard.js +6 -6
  169. package/dist/lib/shared/schemas/config.js +1 -1
  170. package/dist/lib/shared/schemas/mcp-tools.js +84 -43
  171. package/dist/scripts/install-vscode-copilot.js +14 -4
  172. package/package.json +1 -1
  173. package/skills/autosnippet-create/SKILL.md +131 -131
  174. package/skills/autosnippet-devdocs/SKILL.md +1 -2
  175. package/skills/autosnippet-guard/SKILL.md +20 -89
  176. package/skills/autosnippet-recipes/SKILL.md +35 -117
  177. package/skills/autosnippet-structure/SKILL.md +23 -55
  178. package/templates/cursor-rules/autosnippet-skills.mdc +17 -33
  179. package/templates/instructions/agent-static.md +24 -0
  180. package/templates/instructions/conventions.md +42 -0
  181. package/skills/autosnippet-analysis/SKILL.md +0 -169
  182. package/skills/autosnippet-candidates/SKILL.md +0 -367
  183. package/skills/autosnippet-coldstart/SKILL.md +0 -988
  184. package/skills/autosnippet-concepts/SKILL.md +0 -630
  185. package/skills/autosnippet-intent/SKILL.md +0 -55
  186. package/skills/autosnippet-lifecycle/SKILL.md +0 -100
  187. package/templates/copilot-instructions.md +0 -66
  188. package/templates/cursor-rules/autosnippet-conventions.mdc +0 -172
  189. package/templates/cursor-rules/autosnippet-workflow.mdc +0 -76
@@ -42,11 +42,18 @@ export declare class RulesGenerator {
42
42
  * 保留静态模板文件(autosnippet-conventions.mdc, autosnippet-skills.mdc)
43
43
  */
44
44
  cleanDynamicFiles(): void;
45
- /** @private */
46
45
  _renderChannelA(ruleLines: string[]): string;
47
- /** @private */
48
46
  _renderChannelB(topic: string, body: string, description: string): string;
49
- /** @private */
47
+ /**
48
+ * Baseline Rules — 零知识库时写入基础引导文件
49
+ * 告知 Agent 可用的 MCP 工具和推荐工作流
50
+ */
51
+ writeBaselineRules(): {
52
+ filePath: string;
53
+ tokensUsed: number;
54
+ rulesCount: number;
55
+ };
56
+ _renderBaseline(): string;
50
57
  _ensureDir(): void;
51
58
  }
52
59
  export default RulesGenerator;
@@ -108,7 +108,6 @@ export class RulesGenerator {
108
108
  }
109
109
  }
110
110
  // ─── 渲染方法 ───────────────────────────────────────
111
- /** @private */
112
111
  _renderChannelA(ruleLines) {
113
112
  const desc = `${this.projectName} mandatory rules — coding constraints that must never be violated. Auto-generated by AutoSnippet.`;
114
113
  const lines = [
@@ -127,7 +126,6 @@ export class RulesGenerator {
127
126
  ];
128
127
  return `${lines.join('\n')}\n`;
129
128
  }
130
- /** @private */
131
129
  _renderChannelB(topic, body, description) {
132
130
  const topicLabel = topic.charAt(0).toUpperCase() + topic.slice(1);
133
131
  const lines = [
@@ -144,7 +142,49 @@ export class RulesGenerator {
144
142
  ];
145
143
  return `${lines.join('\n')}\n`;
146
144
  }
147
- /** @private */
145
+ /**
146
+ * Baseline Rules — 零知识库时写入基础引导文件
147
+ * 告知 Agent 可用的 MCP 工具和推荐工作流
148
+ */
149
+ writeBaselineRules() {
150
+ this._ensureDir();
151
+ const content = this._renderBaseline();
152
+ const filePath = path.join(this.rulesDir, 'autosnippet-project-rules.mdc');
153
+ fs.writeFileSync(filePath, content, 'utf8');
154
+ return {
155
+ filePath,
156
+ tokensUsed: estimateTokens(content),
157
+ rulesCount: 0,
158
+ };
159
+ }
160
+ _renderBaseline() {
161
+ const lines = [
162
+ '---',
163
+ `description: "${this.projectName} — AutoSnippet baseline guidance. Available MCP tools and recommended workflows."`,
164
+ 'alwaysApply: true',
165
+ '---',
166
+ '',
167
+ `# ${this.projectName} — AutoSnippet Baseline`,
168
+ '',
169
+ 'This project has AutoSnippet enabled but no knowledge entries yet.',
170
+ 'Use the following MCP tools to build and query the knowledge base:',
171
+ '',
172
+ '## Available MCP Tools',
173
+ '',
174
+ '- `autosnippet_bootstrap` — Cold-start: analyze the project and generate initial knowledge entries',
175
+ '- `autosnippet_search({ query })` — Search knowledge base (BM25 + semantic)',
176
+ '- `autosnippet_create_recipe` — Create a new coding recipe from current context',
177
+ '- `autosnippet_guard` — Run compliance review on current changes',
178
+ '- `autosnippet_task_start` / `autosnippet_task_close` — Track coding tasks with automatic knowledge capture',
179
+ '',
180
+ '## Recommended First Steps',
181
+ '',
182
+ '1. Run `autosnippet_bootstrap` to analyze the codebase and generate initial recipes',
183
+ '2. Use `autosnippet_search` to query knowledge while coding',
184
+ '3. Run `autosnippet_guard` before committing to check compliance',
185
+ ];
186
+ return `${lines.join('\n')}\n`;
187
+ }
148
188
  _ensureDir() {
149
189
  if (!fs.existsSync(this.rulesDir)) {
150
190
  fs.mkdirSync(this.rulesDir, { recursive: true });
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * SkillsSyncer — AutoSnippet Skills to .cursor/skills/ 同步器
3
3
  *
4
- * Channel C: AutoSnippet/skills/ 下的项目级 SKILL.md 同步到
5
- * .cursor/skills/autosnippet-{name}/ 目录,适配 Cursor Agent Skills 标准格式。
4
+ * Channel C: 将内置 Skills 和项目级 Skills 统一同步到
5
+ * .cursor/skills/ 目录,适配 Cursor Agent Skills 标准格式。
6
6
  *
7
- * 同时为每个 Skill 生成 references/RECIPES.md(相关 Recipe 摘要)。
7
+ * - 内置 Skills:从 AutoSnippet 包 skills/ 目录直接复制(autosnippet-create 等)
8
+ * - 项目级 Skills:从 AutoSnippet/skills/ 转换格式后写入(project-* → autosnippet-*)
9
+ * - 同时为项目级 Skill 生成 references/RECIPES.md(相关 Recipe 摘要)
8
10
  */
9
11
  export declare class SkillsSyncer {
10
12
  knowledgeService: {
@@ -36,23 +38,35 @@ export declare class SkillsSyncer {
36
38
  synced: string[];
37
39
  skipped: string[];
38
40
  errors: string[];
41
+ builtinSynced: string[];
39
42
  }>;
43
+ /**
44
+ * 同步内置 Skills:从 AutoSnippet 包 skills/ 目录直接复制到 .cursor/skills/
45
+ */
46
+ _syncBuiltinSkills(result: {
47
+ builtinSynced: string[];
48
+ errors: string[];
49
+ }): void;
50
+ /**
51
+ * 同步项目级 Skills:从 AutoSnippet/skills/ 转换格式后写入 .cursor/skills/
52
+ */
53
+ _syncProjectSkills(result: {
54
+ synced: string[];
55
+ skipped: string[];
56
+ errors: string[];
57
+ }): Promise<void>;
40
58
  /**
41
59
  * 转换 SKILL.md 格式 — 从 AutoSnippet 格式到 Cursor Agent Skills 标准
42
- * @private
43
60
  */
44
61
  _convertSkillMd(source: string, targetName: string, sourceDirName: string): string;
45
62
  /**
46
63
  * 生成 references/RECIPES.md
47
- * @private
48
64
  */
49
65
  _generateRecipes(targetSkillDir: string, sourceDirName: string): Promise<void>;
50
66
  /**
51
67
  * 生成使用场景列表
52
- * @private
53
68
  */
54
69
  _generateUseCases(sourceDirName: string): string[];
55
- /** @private */
56
70
  _capitalizeWords(str: string): string;
57
71
  }
58
72
  export default SkillsSyncer;
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * SkillsSyncer — AutoSnippet Skills to .cursor/skills/ 同步器
3
3
  *
4
- * Channel C: AutoSnippet/skills/ 下的项目级 SKILL.md 同步到
5
- * .cursor/skills/autosnippet-{name}/ 目录,适配 Cursor Agent Skills 标准格式。
4
+ * Channel C: 将内置 Skills 和项目级 Skills 统一同步到
5
+ * .cursor/skills/ 目录,适配 Cursor Agent Skills 标准格式。
6
6
  *
7
- * 同时为每个 Skill 生成 references/RECIPES.md(相关 Recipe 摘要)。
7
+ * - 内置 Skills:从 AutoSnippet 包 skills/ 目录直接复制(autosnippet-create 等)
8
+ * - 项目级 Skills:从 AutoSnippet/skills/ 转换格式后写入(project-* → autosnippet-*)
9
+ * - 同时为项目级 Skill 生成 references/RECIPES.md(相关 Recipe 摘要)
8
10
  */
9
11
  import fs from 'node:fs';
10
12
  import path from 'node:path';
11
13
  import { DEFAULT_KNOWLEDGE_BASE_DIR } from '../../shared/ProjectMarkers.js';
14
+ import { SKILLS_DIR as BUILTIN_SKILLS_DIR } from '../../shared/package-root.js';
12
15
  /**
13
16
  * 技能名称映射:AutoSnippet/skills/ → .cursor/skills/
14
17
  * AutoSnippet/skills/ 下面是 bootstrap 动态生成的项目级 skills,
@@ -70,10 +73,48 @@ export class SkillsSyncer {
70
73
  * @returns >}
71
74
  */
72
75
  async sync() {
73
- const result = { synced: [], skipped: [], errors: [] };
76
+ const result = {
77
+ synced: [],
78
+ skipped: [],
79
+ errors: [],
80
+ builtinSynced: [],
81
+ };
82
+ // ── Phase 1: 同步内置 Skills ──
83
+ this._syncBuiltinSkills(result);
84
+ // ── Phase 2: 同步项目级 Skills ──
85
+ await this._syncProjectSkills(result);
86
+ return result;
87
+ }
88
+ /**
89
+ * 同步内置 Skills:从 AutoSnippet 包 skills/ 目录直接复制到 .cursor/skills/
90
+ */
91
+ _syncBuiltinSkills(result) {
92
+ if (!fs.existsSync(BUILTIN_SKILLS_DIR)) {
93
+ return;
94
+ }
95
+ const builtinDirs = fs
96
+ .readdirSync(BUILTIN_SKILLS_DIR, { withFileTypes: true })
97
+ .filter((d) => d.isDirectory())
98
+ .map((d) => d.name);
99
+ for (const name of builtinDirs) {
100
+ try {
101
+ const src = path.join(BUILTIN_SKILLS_DIR, name);
102
+ const dest = path.join(this.targetDir, name);
103
+ fs.cpSync(src, dest, { recursive: true, force: true });
104
+ result.builtinSynced.push(name);
105
+ }
106
+ catch (err) {
107
+ result.errors.push(`builtin/${name}: ${err.message}`);
108
+ }
109
+ }
110
+ }
111
+ /**
112
+ * 同步项目级 Skills:从 AutoSnippet/skills/ 转换格式后写入 .cursor/skills/
113
+ */
114
+ async _syncProjectSkills(result) {
74
115
  // 检查源目录是否存在
75
116
  if (!fs.existsSync(this.sourceDir)) {
76
- return result;
117
+ return;
77
118
  }
78
119
  // 扫描源目录
79
120
  const skillDirs = fs
@@ -106,11 +147,9 @@ export class SkillsSyncer {
106
147
  result.errors.push(`${dirName}: ${err.message}`);
107
148
  }
108
149
  }
109
- return result;
110
150
  }
111
151
  /**
112
152
  * 转换 SKILL.md 格式 — 从 AutoSnippet 格式到 Cursor Agent Skills 标准
113
- * @private
114
153
  */
115
154
  _convertSkillMd(source, targetName, sourceDirName) {
116
155
  // 提取原始内容(去掉 frontmatter)
@@ -150,7 +189,6 @@ export class SkillsSyncer {
150
189
  }
151
190
  /**
152
191
  * 生成 references/RECIPES.md
153
- * @private
154
192
  */
155
193
  async _generateRecipes(targetSkillDir, sourceDirName) {
156
194
  const refsDir = path.join(targetSkillDir, 'references');
@@ -201,7 +239,6 @@ export class SkillsSyncer {
201
239
  }
202
240
  /**
203
241
  * 生成使用场景列表
204
- * @private
205
242
  */
206
243
  _generateUseCases(sourceDirName) {
207
244
  const casesMap = {
@@ -275,7 +312,6 @@ export class SkillsSyncer {
275
312
  '- Need guidance on project-specific patterns',
276
313
  ]);
277
314
  }
278
- /** @private */
279
315
  _capitalizeWords(str) {
280
316
  return str.replace(/\b\w/g, (c) => c.toUpperCase());
281
317
  }
@@ -25,15 +25,12 @@ export declare class TopicClassifier {
25
25
  buildDescription(topic: string, entries: KnowledgeEntryProps[]): string;
26
26
  /**
27
27
  * 分类单个 entry 到主题 — 直读 AI 预计算的 topicHint
28
- * @private
29
28
  */
30
- _classifyEntry(entry: KnowledgeEntryProps): string | null;
29
+ private _classifyEntry;
31
30
  /**
32
31
  * 从 entry 提取关键词
33
- * @private
34
32
  */
35
- _extractKeywords(entry: KnowledgeEntryProps): string[];
36
- /** @private */
37
- _topicLabel(topic: string): string;
33
+ private _extractKeywords;
34
+ private _topicLabel;
38
35
  }
39
36
  export default TopicClassifier;
@@ -99,14 +99,12 @@ export class TopicClassifier {
99
99
  }
100
100
  /**
101
101
  * 分类单个 entry 到主题 — 直读 AI 预计算的 topicHint
102
- * @private
103
102
  */
104
103
  _classifyEntry(entry) {
105
104
  return entry.topicHint || null; // AI 没给 → null → 归入 general
106
105
  }
107
106
  /**
108
107
  * 从 entry 提取关键词
109
- * @private
110
108
  */
111
109
  _extractKeywords(entry) {
112
110
  const text = `${entry.title || ''} ${entry.description || ''}`;
@@ -115,7 +113,6 @@ export class TopicClassifier {
115
113
  const filtered = words.map((w) => w.toLowerCase()).filter((w) => !STOP_WORDS.has(w));
116
114
  return [...new Set(filtered)].slice(0, 5);
117
115
  }
118
- /** @private */
119
116
  _topicLabel(topic) {
120
117
  const labels = {
121
118
  networking: 'Networking',
@@ -47,7 +47,7 @@ export declare class ExclusionManager {
47
47
  });
48
48
  /**
49
49
  * 添加路径排除 (glob 或精确路径)
50
- * @param {{ reason?: string }} meta
50
+ * @param meta
51
51
  */
52
52
  addPathExclusion(pattern: string, meta?: ExclusionMeta): void;
53
53
  /** 检查文件路径是否被排除 */
@@ -22,7 +22,7 @@ export class ExclusionManager {
22
22
  // ─── Path 排除 ───────────────────────────────────────
23
23
  /**
24
24
  * 添加路径排除 (glob 或精确路径)
25
- * @param {{ reason?: string }} meta
25
+ * @param meta
26
26
  */
27
27
  addPathExclusion(pattern, meta = {}) {
28
28
  if (!pattern) {
@@ -113,7 +113,7 @@ export declare class GuardCheckEngine {
113
113
  /**
114
114
  * 注入 Enhancement Pack 外部规则(支持 RegExp 和 string pattern)
115
115
  * 与 BUILT_IN_RULES 合并检查,自动跳过 ruleId 重复的规则
116
- * @param {Array<{ruleId: string, pattern: RegExp|string, severity: string, message: string, category?: string, dimension?: string, languages?: string[], fixSuggestion?: string}>} rules
116
+ * @param rules
117
117
  */
118
118
  injectExternalRules(rules: ExternalRuleInput[]): void;
119
119
  /** EP 注入幂等标记 — 调用者可用此判断是否已完成注入,避免重复加载 EnhancementRegistry */
@@ -159,7 +159,7 @@ export declare class GuardCheckEngine {
159
159
  _getAstAnalyzer(): typeof AstAnalyzerModule;
160
160
  /**
161
161
  * 将 Guard 命中计数回写到对应 Recipe 的 guard_hit_count
162
- * @param {Array<{ruleId: string}>} violations
162
+ * @param violations
163
163
  */
164
164
  trackGuardHits(violations: GuardViolation[]): void;
165
165
  /**
@@ -173,7 +173,7 @@ export declare class GuardCheckEngine {
173
173
  }): AuditFileResult;
174
174
  /**
175
175
  * 批量文件审计
176
- * @param {Array<{path: string, content: string}>} files
176
+ * @param files
177
177
  * @param options {scope: 'file'|'target'|'project'}
178
178
  * @returns }
179
179
  */
@@ -460,9 +460,9 @@ export class GuardCheckEngine {
460
460
  this._astRulesCache = null;
461
461
  this._cacheTime = 0;
462
462
  this._cacheTTL = options.cacheTTL || 60_000; // 1min
463
- /** @type {Map<string, object>} Enhancement Pack 注入的外部规则 */
463
+ /** Enhancement Pack 注入的外部规则 */
464
464
  this._externalRules = new Map();
465
- /** @type {boolean} EP 规则是否已注入(幂等标记,避免每次请求重复注入) */
465
+ /** EP 规则是否已注入(幂等标记,避免每次请求重复注入) */
466
466
  this._epInjected = false;
467
467
  /** Guard 配置 — 允许禁用特定规则或调整 Code-Level 检查阈值 */
468
468
  this._guardConfig = options.guardConfig || {};
@@ -470,7 +470,7 @@ export class GuardCheckEngine {
470
470
  /**
471
471
  * 注入 Enhancement Pack 外部规则(支持 RegExp 和 string pattern)
472
472
  * 与 BUILT_IN_RULES 合并检查,自动跳过 ruleId 重复的规则
473
- * @param {Array<{ruleId: string, pattern: RegExp|string, severity: string, message: string, category?: string, dimension?: string, languages?: string[], fixSuggestion?: string}>} rules
473
+ * @param rules
474
474
  */
475
475
  injectExternalRules(rules) {
476
476
  if (!Array.isArray(rules)) {
@@ -855,7 +855,7 @@ export class GuardCheckEngine {
855
855
  }
856
856
  /**
857
857
  * 将 Guard 命中计数回写到对应 Recipe 的 guard_hit_count
858
- * @param {Array<{ruleId: string}>} violations
858
+ * @param violations
859
859
  */
860
860
  trackGuardHits(violations) {
861
861
  if (!violations?.length || !this.db) {
@@ -915,7 +915,7 @@ export class GuardCheckEngine {
915
915
  }
916
916
  /**
917
917
  * 批量文件审计
918
- * @param {Array<{path: string, content: string}>} files
918
+ * @param files
919
919
  * @param options {scope: 'file'|'target'|'project'}
920
920
  * @returns }
921
921
  */
@@ -14,7 +14,7 @@ export declare function resolveImportPath(fromDir: string, importPath: string):
14
14
  export declare function normalizeFilePath(filePath: string): string;
15
15
  /**
16
16
  * 跨文件检查 — 需要多文件上下文才能发现的问题
17
- * @param {Array<{path: string, content: string}>} files
17
+ * @param files
18
18
  * @param [options.disabledRules] 禁用的规则 ID 列表
19
19
  * @returns >}
20
20
  */
@@ -46,20 +46,20 @@ export declare class GuardFeedbackLoop {
46
46
  });
47
47
  /**
48
48
  * 对比当前和历史 violations,检测已修复的违规
49
- * @param {{ violations: Array<{ruleId: string}> }} currentResult 本次检查结果
49
+ * @param currentResult 本次检查结果
50
50
  * @param filePath 文件路径
51
51
  * @returns >} 已修复且有 Recipe 关联的列表
52
52
  */
53
53
  detectFixedViolations(currentResult: CheckResult, filePath: string): FixedViolation[];
54
54
  /**
55
55
  * 对已修复的违规自动确认使用
56
- * @param {Array<{ ruleId: string, filePath: string, fixRecipeId: string }>} fixedList
56
+ * @param fixedList
57
57
  */
58
58
  autoConfirmUsage(fixedList: FixedViolation[]): void;
59
59
  /**
60
60
  * 一站式处理:检测修复 + 自动确认
61
61
  * 供 MCP handler、GuardHandler、HTTP guard/file 端点集成调用
62
- * @param {{ violations: Array }} currentResult
62
+ * @param currentResult
63
63
  */
64
64
  processFixDetection(currentResult: CheckResult, filePath: string): FixedViolation[];
65
65
  /**
@@ -21,7 +21,7 @@ export class GuardFeedbackLoop {
21
21
  }
22
22
  /**
23
23
  * 对比当前和历史 violations,检测已修复的违规
24
- * @param {{ violations: Array<{ruleId: string}> }} currentResult 本次检查结果
24
+ * @param currentResult 本次检查结果
25
25
  * @param filePath 文件路径
26
26
  * @returns >} 已修复且有 Recipe 关联的列表
27
27
  */
@@ -57,7 +57,7 @@ export class GuardFeedbackLoop {
57
57
  }
58
58
  /**
59
59
  * 对已修复的违规自动确认使用
60
- * @param {Array<{ ruleId: string, filePath: string, fixRecipeId: string }>} fixedList
60
+ * @param fixedList
61
61
  */
62
62
  autoConfirmUsage(fixedList) {
63
63
  if (!this.feedbackCollector || !fixedList?.length) {
@@ -81,7 +81,7 @@ export class GuardFeedbackLoop {
81
81
  /**
82
82
  * 一站式处理:检测修复 + 自动确认
83
83
  * 供 MCP handler、GuardHandler、HTTP guard/file 端点集成调用
84
- * @param {{ violations: Array }} currentResult
84
+ * @param currentResult
85
85
  */
86
86
  processFixDetection(currentResult, filePath) {
87
87
  const fixed = this.detectFixedViolations(currentResult, filePath);
@@ -9,7 +9,7 @@
9
9
  * - detectLanguage: 文件扩展名推断语言
10
10
  */
11
11
  import { LanguageService } from '../../shared/LanguageService.js';
12
- /** @type {Map<string, RegExp>} 已编译的正则缓存 (pattern string → RegExp) */
12
+ /** 已编译的正则缓存 (pattern string → RegExp) */
13
13
  const _regexCache = new Map();
14
14
  /** 编译正则模式(支持 RegExp 对象和 string,带缓存) */
15
15
  export function compilePattern(pattern) {
@@ -158,22 +158,8 @@ export declare class GuardService {
158
158
  }[]>;
159
159
  /**
160
160
  * 仅 DB 规则的简化检查(降级路径)
161
- * @private
162
161
  */
163
- _checkCodeDbOnly(code: string, options?: {
164
- language?: string | null;
165
- }): Promise<{
166
- ruleId: string;
167
- ruleName: string;
168
- severity: string;
169
- message: string;
170
- matches: {
171
- match: string;
172
- index: number | undefined;
173
- line: number;
174
- }[];
175
- matchCount: number;
176
- }[]>;
162
+ private _checkCodeDbOnly;
177
163
  /** 查询规则列表 (kind='rule' + knowledgeType='boundary-constraint') */
178
164
  listRules(filters?: Record<string, unknown>, pagination?: {
179
165
  page?: number;
@@ -184,7 +184,6 @@ export class GuardService {
184
184
  }
185
185
  /**
186
186
  * 仅 DB 规则的简化检查(降级路径)
187
- * @private
188
187
  */
189
188
  async _checkCodeDbOnly(code, options = {}) {
190
189
  const { language = null } = options;
@@ -20,7 +20,7 @@ export declare class RuleLearner {
20
20
  });
21
21
  /**
22
22
  * 记录规则触发
23
- * @param {{ filePath?: string, message?: string }} context
23
+ * @param context
24
24
  */
25
25
  recordTrigger(ruleId: string, _context?: Record<string, unknown>): void;
26
26
  /** 记录用户反馈 */
@@ -25,7 +25,7 @@ export class RuleLearner {
25
25
  }
26
26
  /**
27
27
  * 记录规则触发
28
- * @param {{ filePath?: string, message?: string }} context
28
+ * @param context
29
29
  */
30
30
  recordTrigger(ruleId, _context = {}) {
31
31
  const stat = this.#ensureStat(ruleId);
@@ -186,7 +186,7 @@ export declare class CodeEntityGraph {
186
186
  /**
187
187
  * 从候选的 Relations 字段提取边写入图谱 (Phase 5/6)
188
188
  *
189
- * @param {Array<{title: string, relations: object}>} candidates 扁平关系数组或 Relations 对象
189
+ * @param candidates 扁平关系数组或 Relations 对象
190
190
  */
191
191
  populateFromCandidateRelations(candidates: CandidateWithRelations[] | null): GraphPopulateResult;
192
192
  /** 获取单个实体信息 */
@@ -273,8 +273,8 @@ export declare class CodeEntityGraph {
273
273
  /**
274
274
  * 从解析后的调用边填充图谱 (Phase 5)
275
275
  *
276
- * @param {Array<{ caller: string, callee: string, callType: string, resolveMethod: string, line: number, file: string, isAwait: boolean }>} callEdges
277
- * @param {Array<{ from: string, to: string, flowType: string, direction: string }>} dataFlowEdges
276
+ * @param callEdges
277
+ * @param dataFlowEdges
278
278
  */
279
279
  populateCallGraph(callEdges: CallEdge[], dataFlowEdges: DataFlowEdge[]): GraphPopulateResult;
280
280
  /**
@@ -182,7 +182,7 @@ export class CodeEntityGraph {
182
182
  /**
183
183
  * 从候选的 Relations 字段提取边写入图谱 (Phase 5/6)
184
184
  *
185
- * @param {Array<{title: string, relations: object}>} candidates 扁平关系数组或 Relations 对象
185
+ * @param candidates 扁平关系数组或 Relations 对象
186
186
  */
187
187
  populateFromCandidateRelations(candidates) {
188
188
  if (!candidates?.length) {
@@ -588,8 +588,8 @@ export class CodeEntityGraph {
588
588
  /**
589
589
  * 从解析后的调用边填充图谱 (Phase 5)
590
590
  *
591
- * @param {Array<{ caller: string, callee: string, callType: string, resolveMethod: string, line: number, file: string, isAwait: boolean }>} callEdges
592
- * @param {Array<{ from: string, to: string, flowType: string, direction: string }>} dataFlowEdges
591
+ * @param callEdges
592
+ * @param dataFlowEdges
593
593
  */
594
594
  populateCallGraph(callEdges, dataFlowEdges) {
595
595
  const t0 = Date.now();
@@ -101,7 +101,6 @@ export declare class KnowledgeService {
101
101
  publish(id: string, context: ServiceContext): Promise<KnowledgeEntry>;
102
102
  /**
103
103
  * 触发 Cursor Delivery Pipeline(非阻塞、容错)
104
- * @private
105
104
  */
106
105
  _triggerCursorDeliveryAsync(): void;
107
106
  /** 弃用 (pending|active → deprecated) */
@@ -307,7 +307,6 @@ export class KnowledgeService {
307
307
  }
308
308
  /**
309
309
  * 触发 Cursor Delivery Pipeline(非阻塞、容错)
310
- * @private
311
310
  */
312
311
  _triggerCursorDeliveryAsync() {
313
312
  import('../../injection/ServiceContainer.js')
@@ -30,7 +30,7 @@ export declare class ModuleService {
30
30
  }[]>;
31
31
  /**
32
32
  * 获取依赖关系图
33
- * @param {{ level?: 'package'|'target' }} [options]
33
+ * @param [options]
34
34
  * @returns [] }>}
35
35
  */
36
36
  getDependencyGraph(options?: {
@@ -65,7 +65,7 @@ const SOURCE_CODE_EXTS = new Set([
65
65
  export class ModuleService {
66
66
  #projectRoot;
67
67
  #registry;
68
- /** @type {Array<{ discoverer: import('../../core/discovery/ProjectDiscoverer.js').ProjectDiscoverer, confidence: number }>} */
68
+ /** >} */
69
69
  #activeDiscoverers = [];
70
70
  #loaded = false;
71
71
  #logger;
@@ -233,7 +233,7 @@ export class ModuleService {
233
233
  }
234
234
  /**
235
235
  * 获取依赖关系图
236
- * @param {{ level?: 'package'|'target' }} [options]
236
+ * @param [options]
237
237
  * @returns [] }>}
238
238
  */
239
239
  async getDependencyGraph(options = {}) {
@@ -42,8 +42,8 @@ export declare class HybridRetriever {
42
42
  * Dense: vectorStore 向量搜索 (HNSW or brute-force)
43
43
  * Sparse: BM25 关键词搜索 (由外部传入结果)
44
44
  *
45
- * @param {Array<{ id: string, score: number, [key: string]: unknown }>} params.denseResults - 向量搜索结果
46
- * @param {Array<{ id: string, score: number, [key: string]: unknown }>} params.sparseResults - 关键词搜索结果
45
+ * @param params.denseResults - 向量搜索结果
46
+ * @param params.sparseResults - 关键词搜索结果
47
47
  * @param [params.alpha=0.5] Dense 权重
48
48
  * @returns >}
49
49
  */
@@ -31,8 +31,8 @@ export class HybridRetriever {
31
31
  * Dense: vectorStore 向量搜索 (HNSW or brute-force)
32
32
  * Sparse: BM25 关键词搜索 (由外部传入结果)
33
33
  *
34
- * @param {Array<{ id: string, score: number, [key: string]: unknown }>} params.denseResults - 向量搜索结果
35
- * @param {Array<{ id: string, score: number, [key: string]: unknown }>} params.sparseResults - 关键词搜索结果
34
+ * @param params.denseResults - 向量搜索结果
35
+ * @param params.sparseResults - 关键词搜索结果
36
36
  * @param [params.alpha=0.5] Dense 权重
37
37
  * @returns >}
38
38
  */
@@ -130,7 +130,7 @@ export declare class SearchEngine {
130
130
  * - 已删除 → scorer.removeDocument()
131
131
  * 3. 清空缓存以确保搜索结果刷新
132
132
  *
133
- * @param {{ force?: boolean }} [opts] - force=true 强制全量重建
133
+ * @param [opts] - force=true 强制全量重建
134
134
  */
135
135
  refreshIndex(opts?: {
136
136
  force?: boolean;
@@ -141,12 +141,10 @@ export declare class SearchEngine {
141
141
  * 使用 BM25F 思想:高价值字段(title, trigger)重复出现以提升 TF 权重
142
142
  * — title ×3, trigger ×2, description ×1.5(通过重复 token 实现)
143
143
  * 这确保标题匹配的文档获得显著更高的 BM25 分数
144
- * @private
145
144
  */
146
145
  _buildDocText(r: DbRow): string;
147
146
  /**
148
147
  * 从 DB 行构建文档 meta
149
- * @private
150
148
  */
151
149
  _buildDocMeta(r: DbRow): {
152
150
  type: string;