autosnippet 3.2.17 → 3.2.20

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 (184) hide show
  1. package/README.md +73 -104
  2. package/dashboard/dist/assets/{index-CKMy5LY6.js → index-DdvZE4Yd.js} +1 -1
  3. package/dashboard/dist/index.html +1 -1
  4. package/dist/bin/cli.js +88 -49
  5. package/dist/lib/agent/AgentEventBus.js +3 -3
  6. package/dist/lib/agent/AgentFactory.d.ts +3 -3
  7. package/dist/lib/agent/AgentFactory.js +4 -4
  8. package/dist/lib/agent/AgentMessage.d.ts +8 -8
  9. package/dist/lib/agent/AgentMessage.js +8 -8
  10. package/dist/lib/agent/AgentRuntime.js +2 -2
  11. package/dist/lib/agent/AgentState.js +4 -4
  12. package/dist/lib/agent/ConversationStore.d.ts +1 -1
  13. package/dist/lib/agent/ConversationStore.js +1 -1
  14. package/dist/lib/agent/PipelineStrategy.js +1 -1
  15. package/dist/lib/agent/context/ContextWindow.d.ts +2 -2
  16. package/dist/lib/agent/context/ContextWindow.js +7 -7
  17. package/dist/lib/agent/context/ExplorationTracker.js +9 -9
  18. package/dist/lib/agent/context/exploration/PlanTracker.js +2 -2
  19. package/dist/lib/agent/context/exploration/SignalDetector.d.ts +1 -1
  20. package/dist/lib/agent/context/exploration/SignalDetector.js +1 -1
  21. package/dist/lib/agent/core/LoopContext.d.ts +21 -21
  22. package/dist/lib/agent/core/LoopContext.js +21 -21
  23. package/dist/lib/agent/core/SystemPromptBuilder.js +4 -4
  24. package/dist/lib/agent/domain/EvidenceCollector.js +5 -5
  25. package/dist/lib/agent/memory/ActiveContext.js +1 -1
  26. package/dist/lib/agent/memory/MemoryRetriever.js +1 -1
  27. package/dist/lib/agent/memory/MemoryStore.js +2 -2
  28. package/dist/lib/agent/memory/SessionStore.js +3 -3
  29. package/dist/lib/agent/policies.d.ts +1 -1
  30. package/dist/lib/agent/policies.js +1 -1
  31. package/dist/lib/agent/strategies.d.ts +1 -1
  32. package/dist/lib/agent/strategies.js +4 -4
  33. package/dist/lib/agent/tools/_shared.d.ts +1 -1
  34. package/dist/lib/agent/tools/_shared.js +1 -1
  35. package/dist/lib/agent/tools/infrastructure.js +2 -2
  36. package/dist/lib/cli/SetupService.d.ts +25 -25
  37. package/dist/lib/cli/SetupService.js +28 -15
  38. package/dist/lib/cli/deploy/FileDeployer.d.ts +9 -2
  39. package/dist/lib/cli/deploy/FileDeployer.js +139 -46
  40. package/dist/lib/cli/deploy/FileManifest.d.ts +23 -39
  41. package/dist/lib/cli/deploy/FileManifest.js +22 -27
  42. package/dist/lib/core/AstAnalyzer.d.ts +2 -2
  43. package/dist/lib/core/AstAnalyzer.js +2 -2
  44. package/dist/lib/core/analysis/CallEdgeResolver.d.ts +7 -7
  45. package/dist/lib/core/analysis/CallEdgeResolver.js +9 -9
  46. package/dist/lib/core/analysis/CallGraphAnalyzer.d.ts +4 -4
  47. package/dist/lib/core/analysis/CallGraphAnalyzer.js +2 -2
  48. package/dist/lib/core/analysis/ImportPathResolver.d.ts +0 -2
  49. package/dist/lib/core/analysis/ImportPathResolver.js +2 -4
  50. package/dist/lib/core/ast/ProjectGraph.js +7 -7
  51. package/dist/lib/core/capability/CapabilityProbe.js +6 -14
  52. package/dist/lib/domain/knowledge/UnifiedValidator.js +2 -2
  53. package/dist/lib/domain/knowledge/values/Constraints.js +4 -4
  54. package/dist/lib/domain/knowledge/values/Content.js +6 -6
  55. package/dist/lib/domain/knowledge/values/Quality.js +5 -5
  56. package/dist/lib/domain/knowledge/values/Reasoning.js +5 -5
  57. package/dist/lib/domain/knowledge/values/Relations.js +1 -1
  58. package/dist/lib/domain/knowledge/values/Stats.js +6 -6
  59. package/dist/lib/domain/task/TaskIdGenerator.d.ts +4 -4
  60. package/dist/lib/domain/task/TaskIdGenerator.js +2 -2
  61. package/dist/lib/external/lark/LarkTransport.js +4 -4
  62. package/dist/lib/external/mcp/McpServer.d.ts +3 -7
  63. package/dist/lib/external/mcp/McpServer.js +9 -13
  64. package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +5 -5
  65. package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +4 -3
  66. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.d.ts +3 -3
  67. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.js +3 -3
  68. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.d.ts +1 -1
  69. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.js +1 -1
  70. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +3 -3
  71. package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +27 -14
  72. package/dist/lib/external/mcp/handlers/bootstrap-external.js +6 -0
  73. package/dist/lib/external/mcp/handlers/dimension-complete-external.js +55 -1
  74. package/dist/lib/external/mcp/handlers/skill.js +9 -31
  75. package/dist/lib/external/mcp/handlers/system.js +2 -2
  76. package/dist/lib/external/mcp/handlers/task.js +16 -1
  77. package/dist/lib/external/mcp/tools.d.ts +12 -10
  78. package/dist/lib/external/mcp/tools.js +97 -69
  79. package/dist/lib/http/HttpServer.js +15 -2
  80. package/dist/lib/http/utils/routeHelpers.d.ts +1 -1
  81. package/dist/lib/http/utils/routeHelpers.js +1 -1
  82. package/dist/lib/http/utils/sse-sessions.d.ts +1 -1
  83. package/dist/lib/http/utils/sse-sessions.js +1 -1
  84. package/dist/lib/infrastructure/cache/CacheService.js +1 -1
  85. package/dist/lib/infrastructure/vector/AsyncPersistence.js +8 -8
  86. package/dist/lib/infrastructure/vector/BatchEmbedder.d.ts +1 -1
  87. package/dist/lib/infrastructure/vector/BatchEmbedder.js +2 -2
  88. package/dist/lib/infrastructure/vector/HnswIndex.d.ts +4 -4
  89. package/dist/lib/infrastructure/vector/HnswIndex.js +5 -5
  90. package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +8 -8
  91. package/dist/lib/infrastructure/vector/ScalarQuantizer.d.ts +1 -1
  92. package/dist/lib/infrastructure/vector/ScalarQuantizer.js +4 -4
  93. package/dist/lib/infrastructure/vector/VectorStore.d.ts +1 -1
  94. package/dist/lib/infrastructure/vector/VectorStore.js +1 -1
  95. package/dist/lib/injection/ServiceContainer.d.ts +1 -1
  96. package/dist/lib/injection/ServiceContainer.js +1 -1
  97. package/dist/lib/platform/NativeUi.d.ts +1 -1
  98. package/dist/lib/platform/NativeUi.js +1 -1
  99. package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +1 -1
  100. package/dist/lib/platform/ios/spm/DependencyGraph.js +1 -1
  101. package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +1 -1
  102. package/dist/lib/platform/ios/spm/PolicyEngine.js +1 -1
  103. package/dist/lib/platform/ios/spm/SpmDiscoverer.js +1 -1
  104. package/dist/lib/platform/ios/spm/SpmHelper.js +3 -3
  105. package/dist/lib/platform/ios/xcode/SaveEventFilter.js +2 -2
  106. package/dist/lib/platform/ios/xcode/XcodeIntegration.js +1 -1
  107. package/dist/lib/repository/base/BaseRepository.js +1 -1
  108. package/dist/lib/repository/task/TaskRepository.impl.d.ts +2 -2
  109. package/dist/lib/repository/task/TaskRepository.impl.js +1 -1
  110. package/dist/lib/repository/token/TokenUsageStore.js +1 -1
  111. package/dist/lib/service/automation/ActionPipeline.d.ts +1 -1
  112. package/dist/lib/service/automation/ActionPipeline.js +1 -1
  113. package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +2 -2
  114. package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +1 -1
  115. package/dist/lib/service/bootstrap/BootstrapTaskManager.js +2 -2
  116. package/dist/lib/service/bootstrap/DimensionCopyRegistry.d.ts +2 -2
  117. package/dist/lib/service/bootstrap/DimensionCopyRegistry.js +2 -2
  118. package/dist/lib/service/delivery/AgentInstructionsGenerator.d.ts +6 -15
  119. package/dist/lib/service/delivery/AgentInstructionsGenerator.js +53 -189
  120. package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +6 -16
  121. package/dist/lib/service/delivery/CursorDeliveryPipeline.js +14 -19
  122. package/dist/lib/service/delivery/KnowledgeCompressor.d.ts +1 -1
  123. package/dist/lib/service/delivery/KnowledgeCompressor.js +1 -1
  124. package/dist/lib/service/delivery/RulesGenerator.d.ts +10 -3
  125. package/dist/lib/service/delivery/RulesGenerator.js +43 -3
  126. package/dist/lib/service/delivery/SkillsSyncer.d.ts +21 -7
  127. package/dist/lib/service/delivery/SkillsSyncer.js +46 -10
  128. package/dist/lib/service/delivery/TopicClassifier.d.ts +3 -6
  129. package/dist/lib/service/delivery/TopicClassifier.js +0 -3
  130. package/dist/lib/service/guard/ExclusionManager.d.ts +1 -1
  131. package/dist/lib/service/guard/ExclusionManager.js +1 -1
  132. package/dist/lib/service/guard/GuardCheckEngine.d.ts +3 -3
  133. package/dist/lib/service/guard/GuardCheckEngine.js +5 -5
  134. package/dist/lib/service/guard/GuardCrossFileChecks.d.ts +1 -1
  135. package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -3
  136. package/dist/lib/service/guard/GuardFeedbackLoop.js +3 -3
  137. package/dist/lib/service/guard/GuardPatternUtils.js +1 -1
  138. package/dist/lib/service/guard/GuardService.d.ts +1 -15
  139. package/dist/lib/service/guard/GuardService.js +0 -1
  140. package/dist/lib/service/guard/RuleLearner.d.ts +1 -1
  141. package/dist/lib/service/guard/RuleLearner.js +1 -1
  142. package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +3 -3
  143. package/dist/lib/service/knowledge/CodeEntityGraph.js +3 -3
  144. package/dist/lib/service/knowledge/KnowledgeService.d.ts +0 -1
  145. package/dist/lib/service/knowledge/KnowledgeService.js +0 -1
  146. package/dist/lib/service/module/ModuleService.d.ts +1 -1
  147. package/dist/lib/service/module/ModuleService.js +2 -2
  148. package/dist/lib/service/search/HybridRetriever.d.ts +2 -2
  149. package/dist/lib/service/search/HybridRetriever.js +2 -2
  150. package/dist/lib/service/search/SearchEngine.d.ts +1 -3
  151. package/dist/lib/service/search/SearchEngine.js +1 -3
  152. package/dist/lib/service/search/contextBoost.d.ts +1 -1
  153. package/dist/lib/service/skills/EventAggregator.js +2 -2
  154. package/dist/lib/service/skills/SignalCollector.js +1 -1
  155. package/dist/lib/service/snippet/codecs/VSCodeCodec.js +1 -1
  156. package/dist/lib/service/task/TaskGraphService.d.ts +0 -3
  157. package/dist/lib/service/task/TaskGraphService.js +0 -3
  158. package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +8 -27
  159. package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -8
  160. package/dist/lib/service/task/TaskReadyEngine.d.ts +1 -2
  161. package/dist/lib/service/task/TaskReadyEngine.js +0 -1
  162. package/dist/lib/service/wiki/WikiRenderers.js +0 -1
  163. package/dist/lib/service/wiki/WikiUtils.js +2 -7
  164. package/dist/lib/shared/PathGuard.js +6 -6
  165. package/dist/lib/shared/schemas/mcp-tools.js +84 -43
  166. package/dist/scripts/install-vscode-copilot.js +14 -4
  167. package/package.json +1 -1
  168. package/skills/autosnippet-create/SKILL.md +131 -131
  169. package/skills/autosnippet-devdocs/SKILL.md +1 -2
  170. package/skills/autosnippet-guard/SKILL.md +20 -89
  171. package/skills/autosnippet-recipes/SKILL.md +35 -117
  172. package/skills/autosnippet-structure/SKILL.md +23 -55
  173. package/templates/cursor-rules/autosnippet-skills.mdc +17 -33
  174. package/templates/instructions/agent-static.md +24 -0
  175. package/templates/instructions/conventions.md +42 -0
  176. package/skills/autosnippet-analysis/SKILL.md +0 -169
  177. package/skills/autosnippet-candidates/SKILL.md +0 -367
  178. package/skills/autosnippet-coldstart/SKILL.md +0 -988
  179. package/skills/autosnippet-concepts/SKILL.md +0 -630
  180. package/skills/autosnippet-intent/SKILL.md +0 -55
  181. package/skills/autosnippet-lifecycle/SKILL.md +0 -100
  182. package/templates/copilot-instructions.md +0 -66
  183. package/templates/cursor-rules/autosnippet-conventions.mdc +0 -172
  184. package/templates/cursor-rules/autosnippet-workflow.mdc +0 -76
@@ -47,9 +47,9 @@ export const MANIFEST = [
47
47
  // ═══ Cursor Rules(AutoSnippet 完全拥有) ═══════════
48
48
  {
49
49
  id: 'cursor-conventions',
50
- src: 'cursor-rules/autosnippet-conventions.mdc',
50
+ strategy: 'generate',
51
+ generate: 'generateConventionsMdc',
51
52
  dest: '.cursor/rules/autosnippet-conventions.mdc',
52
- strategy: 'overwrite',
53
53
  on: 'both',
54
54
  category: 'cursor-rules',
55
55
  },
@@ -61,14 +61,6 @@ export const MANIFEST = [
61
61
  on: 'both',
62
62
  category: 'cursor-rules',
63
63
  },
64
- {
65
- id: 'cursor-workflow',
66
- src: 'cursor-rules/autosnippet-workflow.mdc',
67
- dest: '.cursor/rules/autosnippet-workflow.mdc',
68
- strategy: 'overwrite',
69
- on: 'both',
70
- category: 'cursor-rules',
71
- },
72
64
  // ═══ Cursor Hooks ═════════════════════════════════════
73
65
  {
74
66
  id: 'cursor-hooks-json',
@@ -107,15 +99,14 @@ export const MANIFEST = [
107
99
  chmod: true,
108
100
  cleanup: ['.claude/hooks.yaml'], // 清理旧格式文件
109
101
  },
110
- // ═══ Agent Instructions(签名保护)════════════════════
102
+ // ═══ Agent Instructions(全部从模板生成)═══════════════
111
103
  {
112
104
  id: 'copilot-instructions',
113
- src: 'copilot-instructions.md',
105
+ strategy: 'generate',
106
+ generate: 'generateCopilotInstructions',
114
107
  dest: '.github/copilot-instructions.md',
115
- strategy: 'signature-safe',
116
108
  on: 'both',
117
109
  category: 'copilot-instructions',
118
- fallback: 'inject-marker', // 签名保护失败时,用标记注入
119
110
  },
120
111
  {
121
112
  id: 'agents-md',
@@ -210,21 +201,25 @@ export const MANIFEST = [
210
201
  * .gitignore 规则清单 — Setup 和 Upgrade 共用
211
202
  * 每条规则:{ pattern, comment, negation? }
212
203
  */
204
+ /**
205
+ * Section markers for the AutoSnippet block inside .gitignore.
206
+ * merge-gitignore uses these to insert/replace the entire block atomically.
207
+ */
208
+ export const GITIGNORE_SECTION_BEGIN = '# >>> AutoSnippet (managed block — do not edit) >>>';
209
+ export const GITIGNORE_SECTION_END = '# <<< AutoSnippet <<<';
210
+ /**
211
+ * AutoSnippet-specific .gitignore rules.
212
+ * Only patterns that are AutoSnippet runtime/build artifacts belong here.
213
+ * Generic OS/editor patterns (.DS_Store, *.swp, nohup.out) are NOT our business.
214
+ */
213
215
  export const GITIGNORE_RULES = [
214
- // 核心运行时
215
- { pattern: '.autosnippet/*', comment: 'AutoSnippet 运行时缓存(不入库)' },
216
+ // Runtime cache
217
+ { pattern: '.autosnippet/*', comment: '运行时缓存(不入库)' },
216
218
  { pattern: '!.autosnippet/config.json', negation: true },
217
- // 环境变量
218
- { pattern: '.env', comment: 'AutoSnippet 环境变量(含 API Key,不入库)' },
219
- // 日志
220
- { pattern: 'logs/', comment: 'AutoSnippet 运行日志' },
221
- // AI 草稿
222
- { pattern: '.autosnippet-drafts/', comment: 'AutoSnippet AI 草稿(临时)' },
223
- { pattern: '_draft_*.md', comment: 'AutoSnippet AI 草稿文件(项目根目录临时文件)' },
224
- // 系统 / 编辑器临时文件
225
- { pattern: '.DS_Store', comment: 'macOS 元数据' },
226
- { pattern: 'nohup.out' },
227
- { pattern: '*.sw[a-p]' },
219
+ // Environment (contains API keys created by `asd setup`)
220
+ { pattern: '.env', comment: '环境变量(含 API Key' },
221
+ // Logs
222
+ { pattern: 'logs/', comment: '运行日志' },
228
223
  ];
229
224
  /** .gitignore 迁移规则 — 升级时清理旧格式 */
230
225
  export const GITIGNORE_MIGRATIONS = [
@@ -197,7 +197,7 @@ export declare function registerLanguage(langId: string, plugin: LangPlugin): vo
197
197
  declare function analyzeFile(source: string, lang: string, options?: AnalyzeFileOptions): AstFileSummary | null;
198
198
  /**
199
199
  * 批量分析多文件,返回项目级汇总
200
- * @param {{ name: string, relativePath: string, content: string }[]} files
200
+ * @param files
201
201
  * @param | null }} [options]
202
202
  */
203
203
  declare function analyzeProject(files: FileInput[], lang: string, options: AnalyzeProjectOptions): ProjectAnalysisResult;
@@ -234,7 +234,7 @@ declare function findCallExpressions(source: string, lang: string, targetCallee:
234
234
  * @param source 源代码
235
235
  * @param lang 'objectivec' | 'swift'
236
236
  * @param pattern 要查找的文本模式(普通字符串匹配)
237
- * @param {{ forbiddenContext?: string, requiredContext?: string }} contextFilter
237
+ * @param contextFilter
238
238
  * forbiddenContext: 如果在此上下文中出现则报告 (如 'dealloc')
239
239
  * requiredContext: 如果不在此上下文中出现则报告
240
240
  * @returns >}
@@ -98,7 +98,7 @@ function analyzeFile(source, lang, options = {}) {
98
98
  }
99
99
  /**
100
100
  * 批量分析多文件,返回项目级汇总
101
- * @param {{ name: string, relativePath: string, content: string }[]} files
101
+ * @param files
102
102
  * @param | null }} [options]
103
103
  */
104
104
  function analyzeProject(files, lang, options) {
@@ -633,7 +633,7 @@ function findCallExpressions(source, lang, targetCallee) {
633
633
  * @param source 源代码
634
634
  * @param lang 'objectivec' | 'swift'
635
635
  * @param pattern 要查找的文本模式(普通字符串匹配)
636
- * @param {{ forbiddenContext?: string, requiredContext?: string }} contextFilter
636
+ * @param contextFilter
637
637
  * forbiddenContext: 如果在此上下文中出现则报告 (如 'dealloc')
638
638
  * requiredContext: 如果不在此上下文中出现则报告
639
639
  * @returns >}
@@ -71,7 +71,7 @@ export declare class CallEdgeResolver {
71
71
  propertyTypes: Map<string, Map<string, string>>;
72
72
  symbolTable: SymbolTable;
73
73
  /**
74
- * @param {Array<{from: string, to: string, type: string}>} [inheritanceGraph=[]] 继承图边
74
+ * @param [inheritanceGraph=[]] 继承图边
75
75
  */
76
76
  constructor(symbolTable: SymbolTable, importResolver: ImportPathResolver, inheritanceGraph?: InheritanceEdge[]);
77
77
  /**
@@ -81,7 +81,7 @@ export declare class CallEdgeResolver {
81
81
  * @param callerFile 调用者文件路径 (相对)
82
82
  */
83
83
  resolveFile(callSites: CallSite[], callerFile: string): ResolvedEdge[];
84
- /** @private 构建局部 import 映射 */
84
+ /** 构建局部 import 映射 */
85
85
  _buildImportMap(fileImports: Array<{
86
86
  path?: string;
87
87
  symbols?: string[];
@@ -91,13 +91,13 @@ export declare class CallEdgeResolver {
91
91
  file: string;
92
92
  namespace: boolean;
93
93
  }>;
94
- /** @private 解析单个调用点 */
94
+ /** 解析单个调用点 */
95
95
  _resolveCallSite(cs: CallSite, callerFile: string, importedSymbols: Map<string, {
96
96
  file: string;
97
97
  namespace: boolean;
98
98
  }>): ResolvedEdge | null;
99
99
  /**
100
- * @private CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
100
+ * CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
101
101
  *
102
102
  * 使用 BFS 遍历 inheritanceGraph,从 className 向上搜索直到找到
103
103
  * 定义了 methodName 的祖先类。只跟踪 'inherits' 类型的边。
@@ -108,7 +108,7 @@ export declare class CallEdgeResolver {
108
108
  */
109
109
  _resolveByCHA(methodName: string, className: string): string | null;
110
110
  /**
111
- * @private 从字段名推断类型(DI/IoC 命名约定推断)
111
+ * 从字段名推断类型(DI/IoC 命名约定推断)
112
112
  *
113
113
  * 常见模式:
114
114
  * - userRepo → UserRepo
@@ -120,12 +120,12 @@ export declare class CallEdgeResolver {
120
120
  */
121
121
  _inferFieldType(fieldName: string): string | null;
122
122
  /**
123
- * @private 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
123
+ * 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
124
124
  * @param name 符号名 (可以是 "ClassName.methodName" 或 "functionName")
125
125
  * @returns 匹配的 FQN 列表
126
126
  */
127
127
  _findInFile(name: string, file: string): string[];
128
- /** @private 构建 ResolvedEdge */
128
+ /** 构建 ResolvedEdge */
129
129
  _makeEdge(callerFqn: string, calleeFqn: string, resolveMethod: string, cs: CallSite, callerFile: string): ResolvedEdge;
130
130
  }
131
131
  export default CallEdgeResolver;
@@ -21,7 +21,7 @@ export class CallEdgeResolver {
21
21
  propertyTypes;
22
22
  symbolTable;
23
23
  /**
24
- * @param {Array<{from: string, to: string, type: string}>} [inheritanceGraph=[]] 继承图边
24
+ * @param [inheritanceGraph=[]] 继承图边
25
25
  */
26
26
  constructor(symbolTable, importResolver, inheritanceGraph = []) {
27
27
  this.symbolTable = symbolTable;
@@ -34,7 +34,7 @@ export class CallEdgeResolver {
34
34
  // 构建反向索引: symbolName → [fqn1, fqn2, ...]
35
35
  this.nameIndex = new Map();
36
36
  // 构建文件级索引: file → [{ name, qualifiedName, fqn }] (Issue #14 性能优化)
37
- /** @type {Map<string, Array<{name: string, qualifiedName: string, fqn: string}>>} */
37
+ /** >>} */
38
38
  this.fileIndex = new Map();
39
39
  // Phase 5.3: 类名集合索引 (用于 _inferFieldType 优化,避免全表扫描)
40
40
  this.classNames = new Set();
@@ -86,9 +86,9 @@ export class CallEdgeResolver {
86
86
  }
87
87
  return edges;
88
88
  }
89
- /** @private 构建局部 import 映射 */
89
+ /** 构建局部 import 映射 */
90
90
  _buildImportMap(fileImports, callerFile) {
91
- /** @type {Map<string, { file: string, namespace: boolean }>} */
91
+ /** >} */
92
92
  const importedSymbols = new Map();
93
93
  for (const imp of fileImports) {
94
94
  const targetFile = this.importResolver.resolve(imp.path || String(imp), callerFile);
@@ -117,7 +117,7 @@ export class CallEdgeResolver {
117
117
  }
118
118
  return importedSymbols;
119
119
  }
120
- /** @private 解析单个调用点 */
120
+ /** 解析单个调用点 */
121
121
  _resolveCallSite(cs, callerFile, importedSymbols) {
122
122
  const callerFqn = `${callerFile}::${cs.callerClass ? `${cs.callerClass}.` : ''}${cs.callerMethod}`;
123
123
  // Priority 0: super.xxx() — 父类方法调用 (CHA 解析,禁止 fallthrough 防止自引用边)
@@ -264,7 +264,7 @@ export class CallEdgeResolver {
264
264
  return null;
265
265
  }
266
266
  /**
267
- * @private CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
267
+ * CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
268
268
  *
269
269
  * 使用 BFS 遍历 inheritanceGraph,从 className 向上搜索直到找到
270
270
  * 定义了 methodName 的祖先类。只跟踪 'inherits' 类型的边。
@@ -306,7 +306,7 @@ export class CallEdgeResolver {
306
306
  return null;
307
307
  }
308
308
  /**
309
- * @private 从字段名推断类型(DI/IoC 命名约定推断)
309
+ * 从字段名推断类型(DI/IoC 命名约定推断)
310
310
  *
311
311
  * 常见模式:
312
312
  * - userRepo → UserRepo
@@ -328,7 +328,7 @@ export class CallEdgeResolver {
328
328
  return this.classNames.has(pascalCase) ? pascalCase : null;
329
329
  }
330
330
  /**
331
- * @private 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
331
+ * 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
332
332
  * @param name 符号名 (可以是 "ClassName.methodName" 或 "functionName")
333
333
  * @returns 匹配的 FQN 列表
334
334
  */
@@ -341,7 +341,7 @@ export class CallEdgeResolver {
341
341
  .filter((d) => d.name === name || d.qualifiedName === name)
342
342
  .map((d) => d.fqn);
343
343
  }
344
- /** @private 构建 ResolvedEdge */
344
+ /** 构建 ResolvedEdge */
345
345
  _makeEdge(callerFqn, calleeFqn, resolveMethod, cs, callerFile) {
346
346
  return {
347
347
  caller: callerFqn,
@@ -107,7 +107,7 @@ export declare class CallGraphAnalyzer {
107
107
  */
108
108
  analyzeIncremental(astProjectSummary: AstProjectSummary, changedFiles: string[], options?: AnalyzeOptions): Promise<CallGraphResult>;
109
109
  /**
110
- * @private 实际分析逻辑
110
+ * 实际分析逻辑
111
111
  *
112
112
  * 分级降级策略 (§5.2):
113
113
  * - <100 文件 → 完整分析 (含 CHA)
@@ -120,8 +120,8 @@ export declare class CallGraphAnalyzer {
120
120
  *
121
121
  * @param deadline Date.now() + timeout
122
122
  */
123
- _doAnalyze(astProjectSummary: AstProjectSummary, maxCallSitesPerFile: number, deadline: number): Promise<CallGraphResult>;
124
- /** @private 空结果 */
125
- _emptyResult(durationMs: number): CallGraphResult;
123
+ private _doAnalyze;
124
+ /** 空结果 */
125
+ private _emptyResult;
126
126
  }
127
127
  export default CallGraphAnalyzer;
@@ -144,7 +144,7 @@ export class CallGraphAnalyzer {
144
144
  };
145
145
  }
146
146
  /**
147
- * @private 实际分析逻辑
147
+ * 实际分析逻辑
148
148
  *
149
149
  * 分级降级策略 (§5.2):
150
150
  * - <100 文件 → 完整分析 (含 CHA)
@@ -246,7 +246,7 @@ export class CallGraphAnalyzer {
246
246
  };
247
247
  return { callEdges: allCallEdges, dataFlowEdges, stats };
248
248
  }
249
- /** @private 空结果 */
249
+ /** 空结果 */
250
250
  _emptyResult(durationMs) {
251
251
  return {
252
252
  callEdges: [],
@@ -27,7 +27,6 @@ export declare class ImportPathResolver {
27
27
  constructor(projectRoot: string, allFiles: string[]);
28
28
  /**
29
29
  * 从 tsconfig.json 加载 paths alias 配置
30
- * @private
31
30
  */
32
31
  _loadTsconfigPaths(projectRoot: string): void;
33
32
  /**
@@ -42,7 +41,6 @@ export declare class ImportPathResolver {
42
41
  }, importerFile: string): string | null | undefined;
43
42
  /**
44
43
  * 尝试通过 tsconfig paths alias 解析
45
- * @private
46
44
  */
47
45
  _resolveAlias(importPath: string): string | null;
48
46
  /** 判断是否为外部依赖 */
@@ -25,9 +25,9 @@ export class ImportPathResolver {
25
25
  */
26
26
  constructor(projectRoot, allFiles) {
27
27
  this.projectRoot = projectRoot;
28
- /** @type {Map<string, string>} normalizedPath → actualFilePath */
28
+ /** normalizedPath → actualFilePath */
29
29
  this.fileIndex = new Map();
30
- /** @type {Array<{prefix: string, targets: string[]}>} tsconfig paths 映射 */
30
+ /** >} tsconfig paths 映射 */
31
31
  this.pathAliases = [];
32
32
  // 构建文件索引
33
33
  for (const f of allFiles) {
@@ -58,7 +58,6 @@ export class ImportPathResolver {
58
58
  }
59
59
  /**
60
60
  * 从 tsconfig.json 加载 paths alias 配置
61
- * @private
62
61
  */
63
62
  _loadTsconfigPaths(projectRoot) {
64
63
  const candidates = ['tsconfig.json', 'tsconfig.app.json', 'jsconfig.json'];
@@ -140,7 +139,6 @@ export class ImportPathResolver {
140
139
  }
141
140
  /**
142
141
  * 尝试通过 tsconfig paths alias 解析
143
- * @private
144
142
  */
145
143
  _resolveAlias(importPath) {
146
144
  for (const { prefix, targets } of this.pathAliases) {
@@ -68,19 +68,19 @@ export default class ProjectGraph {
68
68
  #classes = new Map();
69
69
  #protocols = new Map();
70
70
  #categories = new Map();
71
- /** @type {Map<string, string>} 子类 → 父类 */
71
+ /** 子类 → 父类 */
72
72
  #inheritance = new Map();
73
- /** @type {Map<string, Set<string>>} 类 → 遵循的协议集合 */
73
+ /** 类 → 遵循的协议集合 */
74
74
  #conformance = new Map();
75
- /** @type {Map<string, FileSymbols>} 文件路径 → 文件级符号 */
75
+ /** 文件路径 → 文件级符号 */
76
76
  #files = new Map();
77
- /** @type {Map<string, MethodInfo[]>} className → 方法列表 (含 impl 中的方法) */
77
+ /** className → 方法列表 (含 impl 中的方法) */
78
78
  #methodsByClass = new Map();
79
- /** @type {ProjectOverview} 项目统计缓存 */
79
+ /** 项目统计缓存 */
80
80
  #overview = null;
81
- /** @type {string} 项目根目录 */
81
+ /** 项目根目录 */
82
82
  #projectRoot;
83
- /** @type {number} 构建耗时 ms */
83
+ /** 构建耗时 ms */
84
84
  #buildTimeMs = 0;
85
85
  // ── 静态工厂 ──────────────────────────────────────────────────
86
86
  /**
@@ -135,9 +135,9 @@ export class CapabilityProbe {
135
135
  // Case 2: 检查是否是 git 仓库
136
136
  const isGitRepo = this._isGitRepo(this.subRepoPath);
137
137
  if (!isGitRepo) {
138
- // 有目录但不是 git 仓库 → contributor(可本地编辑但不能 push)
139
- this.logger.debug('CapabilityProbe: directory exists but not a git repo');
140
- return 'contributor';
138
+ // 有目录但不是 git 仓库 → 本地个人项目(asd setup 创建),给全权限
139
+ this.logger.debug('CapabilityProbe: directory exists but not a git repo — local project, granting admin');
140
+ return 'admin';
141
141
  }
142
142
  // Case 3: 检查是否有 remote
143
143
  const hasRemote = this._hasRemote(this.subRepoPath);
@@ -158,17 +158,9 @@ export class CapabilityProbe {
158
158
  }
159
159
  }
160
160
  _isGitRepo(repoPath) {
161
- try {
162
- execSync('git rev-parse --git-dir', {
163
- cwd: repoPath,
164
- stdio: 'pipe',
165
- timeout: 5000,
166
- });
167
- return true;
168
- }
169
- catch {
170
- return false;
171
- }
161
+ // 检查是否是独立的 git 仓库(有自己的 .git 目录/文件),
162
+ // 而非仅仅位于父项目 git 仓库内
163
+ return fs.existsSync(`${repoPath}/.git`);
172
164
  }
173
165
  _hasRemote(repoPath) {
174
166
  // 快速路径:config 有 subRepoUrl 即认为有 remote
@@ -46,9 +46,9 @@ function detectMode(candidate) {
46
46
  }
47
47
  // ── UnifiedValidator ────────────────────────────────────────
48
48
  export class UnifiedValidator {
49
- /** @type {Set<string>} 已提交标题 (小写) */
49
+ /** 已提交标题 (小写) */
50
50
  #titles;
51
- /** @type {Set<string>} 已提交代码指纹 */
51
+ /** 已提交代码指纹 */
52
52
  #codeFingerprints;
53
53
  /**
54
54
  * @param [options.existingTitles] 预填充已有标题
@@ -4,13 +4,13 @@ export class Constraints {
4
4
  preconditions;
5
5
  sideEffects;
6
6
  constructor(props = {}) {
7
- /** @type {Array<Guard>} Guard 规则列表 */
7
+ /** Guard 规则列表 */
8
8
  this.guards = (props.guards || []).map(Constraints._normalizeGuard);
9
- /** @type {string[]} 边界约束 */
9
+ /** 边界约束 */
10
10
  this.boundaries = props.boundaries || [];
11
- /** @type {string[]} 前置条件 */
11
+ /** 前置条件 */
12
12
  this.preconditions = props.preconditions || [];
13
- /** @type {string[]} 副作用 */
13
+ /** 副作用 */
14
14
  this.sideEffects = props.sideEffects ?? [];
15
15
  }
16
16
  /** 从任意输入构造 Constraints */
@@ -6,17 +6,17 @@ export class Content {
6
6
  steps;
7
7
  verification;
8
8
  constructor(props = {}) {
9
- /** @type {string} 代码片段 */
9
+ /** 代码片段 */
10
10
  this.pattern = props.pattern ?? '';
11
- /** @type {string} Markdown 全文(与 pattern 二选一) */
11
+ /** Markdown 全文(与 pattern 二选一) */
12
12
  this.markdown = props.markdown ?? '';
13
- /** @type {string} 设计原理 */
13
+ /** 设计原理 */
14
14
  this.rationale = props.rationale ?? '';
15
- /** @type {Array<{title?:string, description?:string, code?:string}>} 实施步骤 */
15
+ /** >} 实施步骤 */
16
16
  this.steps = props.steps ?? [];
17
- /** @type {Array<{file:string, before:string, after:string, explanation:string}>} 代码变更 */
17
+ /** >} 代码变更 */
18
18
  this.codeChanges = props.codeChanges ?? [];
19
- /** @type {?{method?:string, expected_result?:string, test_code?:string}} 验证方式 */
19
+ /** } 验证方式 */
20
20
  this.verification = props.verification ?? null;
21
21
  }
22
22
  /** 从任意输入构造 Content */
@@ -5,15 +5,15 @@ export class Quality {
5
5
  grade;
6
6
  overall;
7
7
  constructor(props = {}) {
8
- /** @type {number} 内容完整度 (0-1) */
8
+ /** 内容完整度 (0-1) */
9
9
  this.completeness = props.completeness ?? 0;
10
- /** @type {number} 项目适配度 (0-1) */
10
+ /** 项目适配度 (0-1) */
11
11
  this.adaptation = props.adaptation ?? 0;
12
- /** @type {number} 文档清晰度 (0-1) */
12
+ /** 文档清晰度 (0-1) */
13
13
  this.documentation = props.documentation ?? 0;
14
- /** @type {number} 综合分 (0-1) */
14
+ /** 综合分 (0-1) */
15
15
  this.overall = props.overall ?? 0;
16
- /** @type {string} 等级 A-F */
16
+ /** 等级 A-F */
17
17
  this.grade = props.grade || Quality.calcGrade(this.overall);
18
18
  }
19
19
  /** 从任意输入构造 Quality */
@@ -5,15 +5,15 @@ export class Reasoning {
5
5
  sources;
6
6
  whyStandard;
7
7
  constructor(props = {}) {
8
- /** @type {string} 为什么遵循标准 */
8
+ /** 为什么遵循标准 */
9
9
  this.whyStandard = props.whyStandard ?? '';
10
- /** @type {string[]} 来源列表 */
10
+ /** 来源列表 */
11
11
  this.sources = props.sources || [];
12
- /** @type {number} 置信度 0-1 */
12
+ /** 置信度 0-1 */
13
13
  this.confidence = props.confidence ?? 0.7;
14
- /** @type {Object.<string, number>} 质量信号 */
14
+ /** 质量信号 */
15
15
  this.qualitySignals = props.qualitySignals ?? {};
16
- /** @type {string[]} 备选方案 */
16
+ /** 备选方案 */
17
17
  this.alternatives = props.alternatives || [];
18
18
  }
19
19
  /** 从任意输入构造 Reasoning */
@@ -24,7 +24,7 @@ export const RELATION_BUCKETS = [
24
24
  export class Relations {
25
25
  _b;
26
26
  constructor(buckets = {}) {
27
- /** @type {Object.<string, Array<{target:string, description:string}>>} */
27
+ /** >>} */
28
28
  this._b = {};
29
29
  for (const k of RELATION_BUCKETS) {
30
30
  const vals = buckets[k] || [];
@@ -6,17 +6,17 @@ export class Stats {
6
6
  searchHits;
7
7
  views;
8
8
  constructor(props = {}) {
9
- /** @type {number} 浏览次数 */
9
+ /** 浏览次数 */
10
10
  this.views = props.views ?? 0;
11
- /** @type {number} 采用次数 */
11
+ /** 采用次数 */
12
12
  this.adoptions = props.adoptions ?? 0;
13
- /** @type {number} 应用次数 */
13
+ /** 应用次数 */
14
14
  this.applications = props.applications ?? 0;
15
- /** @type {number} Guard 命中次数 */
15
+ /** Guard 命中次数 */
16
16
  this.guardHits = props.guardHits ?? 0;
17
- /** @type {number} 搜索命中次数 */
17
+ /** 搜索命中次数 */
18
18
  this.searchHits = props.searchHits ?? 0;
19
- /** @type {number} 权威分 0-5 */
19
+ /** 权威分 0-5 */
20
20
  this.authority = props.authority ?? 0;
21
21
  }
22
22
  /** 从任意输入构造 Stats */
@@ -32,9 +32,9 @@ export declare class TaskIdGenerator {
32
32
  * ★ Drizzle 类型安全 SELECT + UPDATE
33
33
  */
34
34
  generateChild(parentId: string): string;
35
- /** @private ★ Drizzle 类型安全 COUNT */
36
- _getTaskCount(): number;
37
- /** @private ★ Drizzle 类型安全 EXISTS */
38
- _exists(id: string): boolean;
35
+ /** ★ Drizzle 类型安全 COUNT */
36
+ private _getTaskCount;
37
+ /** ★ Drizzle 类型安全 EXISTS */
38
+ private _exists;
39
39
  }
40
40
  export default TaskIdGenerator;
@@ -57,12 +57,12 @@ export class TaskIdGenerator {
57
57
  this.#drizzle.update(tasks).set({ childSeq: nextSeq }).where(eq(tasks.id, parentId)).run();
58
58
  return `${parentId}.${nextSeq}`;
59
59
  }
60
- /** @private ★ Drizzle 类型安全 COUNT */
60
+ /** ★ Drizzle 类型安全 COUNT */
61
61
  _getTaskCount() {
62
62
  const row = this.#drizzle.select({ cnt: sql `COUNT(*)` }).from(tasks).get();
63
63
  return row?.cnt || 0;
64
64
  }
65
- /** @private ★ Drizzle 类型安全 EXISTS */
65
+ /** ★ Drizzle 类型安全 EXISTS */
66
66
  _exists(id) {
67
67
  const row = this.#drizzle
68
68
  .select({ x: sql `1` })
@@ -32,15 +32,15 @@ export class LarkTransport {
32
32
  #getStatusFn;
33
33
  #enqueueIdeFn;
34
34
  #isUserAllowed;
35
- /** @type {ConversationStore|null} 持久化对话存储 */
35
+ /** 持久化对话存储 */
36
36
  #conversationStore = null;
37
- /** @type {Map<string, string>} chatId → conversationId 映射缓存 */
37
+ /** chatId → conversationId 映射缓存 */
38
38
  #chatConversationMap = new Map();
39
- /** @type {Map<string, Array<{role: string, content: string}>>} chatId → 最近对话 (降级用) */
39
+ /** >>} chatId → 最近对话 (降级用) */
40
40
  #conversationHistory = new Map();
41
41
  /** 对话历史最大轮数 */
42
42
  static MAX_HISTORY = 20;
43
- /** @type {Map<string, number>} messageId → timestamp, 消息去重 */
43
+ /** messageId → timestamp, 消息去重 */
44
44
  #recentMsgIds = new Map();
45
45
  /** 去重 TTL (5 分钟) */
46
46
  static DEDUP_TTL = 5 * 60 * 1000;
@@ -18,7 +18,7 @@
18
18
  * Handler 实现 → handlers/*.js
19
19
  * 整合路由 → handlers/consolidated.js
20
20
  */
21
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
21
+ import { McpServer as SdkMcpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
22
22
  import { CapabilityProbe } from '#core/capability/CapabilityProbe.js';
23
23
  import Logger from '#infra/logging/Logger.js';
24
24
  import type { McpContext, McpServiceContainer } from './handlers/types.js';
@@ -65,7 +65,7 @@ export declare class McpServer {
65
65
  _session: McpSession;
66
66
  _startedAt: number;
67
67
  bootstrap: BootstrapLike | null;
68
- server: Server | null;
68
+ sdkServer: SdkMcpServer | null;
69
69
  constructor(options?: McpServerOptions);
70
70
  /** 共享上下文对象,传给所有 handler */
71
71
  get _ctx(): {
@@ -95,23 +95,19 @@ export declare class McpServer {
95
95
  _injectDecisions(toolName: string, result: unknown): Promise<unknown>;
96
96
  /**
97
97
  * 获取 decisions 摘要(带缓存 + 防并发)
98
- * @private
99
98
  * @returns >>}
100
99
  */
101
- _getDecisionsSummary(): Promise<DecisionEntry[]>;
100
+ private _getDecisionsSummary;
102
101
  /**
103
102
  * 从 DB 查询 decisions 摘要(仅 id + title)
104
- * @private
105
103
  */
106
104
  _fetchDecisionsSummary(): Promise<DecisionEntry[]>;
107
105
  /**
108
106
  * 从 ready 响应结果中刷新缓存(避免额外 DB 查询)
109
- * @private
110
107
  */
111
108
  _refreshCacheFromReady(readyResult: unknown): void;
112
109
  /**
113
110
  * 解析工具名到 handler 函数(V3 整合版)
114
- * @private
115
111
  */
116
112
  _resolveHandler(name: string): ToolHandlerFn | null;
117
113
  /**