@mycodemap/mycodemap 0.1.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.
Files changed (329) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +559 -0
  4. package/dist/ai/claude.d.ts +38 -0
  5. package/dist/ai/claude.d.ts.map +1 -0
  6. package/dist/ai/claude.js +169 -0
  7. package/dist/ai/claude.js.map +1 -0
  8. package/dist/ai/codex.d.ts +38 -0
  9. package/dist/ai/codex.d.ts.map +1 -0
  10. package/dist/ai/codex.js +169 -0
  11. package/dist/ai/codex.js.map +1 -0
  12. package/dist/ai/factory.d.ts +48 -0
  13. package/dist/ai/factory.d.ts.map +1 -0
  14. package/dist/ai/factory.js +95 -0
  15. package/dist/ai/factory.js.map +1 -0
  16. package/dist/ai/index.d.ts +12 -0
  17. package/dist/ai/index.d.ts.map +1 -0
  18. package/dist/ai/index.js +29 -0
  19. package/dist/ai/index.js.map +1 -0
  20. package/dist/ai/provider.d.ts +70 -0
  21. package/dist/ai/provider.d.ts.map +1 -0
  22. package/dist/ai/provider.js +31 -0
  23. package/dist/ai/provider.js.map +1 -0
  24. package/dist/ai/subagent-caller.d.ts +90 -0
  25. package/dist/ai/subagent-caller.d.ts.map +1 -0
  26. package/dist/ai/subagent-caller.js +280 -0
  27. package/dist/ai/subagent-caller.js.map +1 -0
  28. package/dist/ai/types.d.ts +70 -0
  29. package/dist/ai/types.d.ts.map +1 -0
  30. package/dist/ai/types.js +5 -0
  31. package/dist/ai/types.js.map +1 -0
  32. package/dist/cache/file-hash-cache.d.ts +76 -0
  33. package/dist/cache/file-hash-cache.d.ts.map +1 -0
  34. package/dist/cache/file-hash-cache.js +159 -0
  35. package/dist/cache/file-hash-cache.js.map +1 -0
  36. package/dist/cache/index.d.ts +151 -0
  37. package/dist/cache/index.d.ts.map +1 -0
  38. package/dist/cache/index.js +303 -0
  39. package/dist/cache/index.js.map +1 -0
  40. package/dist/cache/lru-cache.d.ts +93 -0
  41. package/dist/cache/lru-cache.d.ts.map +1 -0
  42. package/dist/cache/lru-cache.js +194 -0
  43. package/dist/cache/lru-cache.js.map +1 -0
  44. package/dist/cache/parse-cache.d.ts +68 -0
  45. package/dist/cache/parse-cache.d.ts.map +1 -0
  46. package/dist/cache/parse-cache.js +173 -0
  47. package/dist/cache/parse-cache.js.map +1 -0
  48. package/dist/cli/commands/analyze.d.ts +96 -0
  49. package/dist/cli/commands/analyze.d.ts.map +1 -0
  50. package/dist/cli/commands/analyze.js +567 -0
  51. package/dist/cli/commands/analyze.js.map +1 -0
  52. package/dist/cli/commands/ci.d.ts +25 -0
  53. package/dist/cli/commands/ci.d.ts.map +1 -0
  54. package/dist/cli/commands/ci.js +481 -0
  55. package/dist/cli/commands/ci.js.map +1 -0
  56. package/dist/cli/commands/complexity.d.ts +70 -0
  57. package/dist/cli/commands/complexity.d.ts.map +1 -0
  58. package/dist/cli/commands/complexity.js +479 -0
  59. package/dist/cli/commands/complexity.js.map +1 -0
  60. package/dist/cli/commands/cycles.d.ts +10 -0
  61. package/dist/cli/commands/cycles.d.ts.map +1 -0
  62. package/dist/cli/commands/cycles.js +202 -0
  63. package/dist/cli/commands/cycles.js.map +1 -0
  64. package/dist/cli/commands/deps.d.ts +61 -0
  65. package/dist/cli/commands/deps.d.ts.map +1 -0
  66. package/dist/cli/commands/deps.js +340 -0
  67. package/dist/cli/commands/deps.js.map +1 -0
  68. package/dist/cli/commands/generate.d.ts +8 -0
  69. package/dist/cli/commands/generate.d.ts.map +1 -0
  70. package/dist/cli/commands/generate.js +61 -0
  71. package/dist/cli/commands/generate.js.map +1 -0
  72. package/dist/cli/commands/impact.d.ts +55 -0
  73. package/dist/cli/commands/impact.d.ts.map +1 -0
  74. package/dist/cli/commands/impact.js +455 -0
  75. package/dist/cli/commands/impact.js.map +1 -0
  76. package/dist/cli/commands/init.d.ts +4 -0
  77. package/dist/cli/commands/init.d.ts.map +1 -0
  78. package/dist/cli/commands/init.js +50 -0
  79. package/dist/cli/commands/init.js.map +1 -0
  80. package/dist/cli/commands/query.d.ts +22 -0
  81. package/dist/cli/commands/query.d.ts.map +1 -0
  82. package/dist/cli/commands/query.js +718 -0
  83. package/dist/cli/commands/query.js.map +1 -0
  84. package/dist/cli/commands/watch-foreground.d.ts +9 -0
  85. package/dist/cli/commands/watch-foreground.d.ts.map +1 -0
  86. package/dist/cli/commands/watch-foreground.js +67 -0
  87. package/dist/cli/commands/watch-foreground.js.map +1 -0
  88. package/dist/cli/commands/watch.d.ts +12 -0
  89. package/dist/cli/commands/watch.d.ts.map +1 -0
  90. package/dist/cli/commands/watch.js +114 -0
  91. package/dist/cli/commands/watch.js.map +1 -0
  92. package/dist/cli/commands/workflow.d.ts +25 -0
  93. package/dist/cli/commands/workflow.d.ts.map +1 -0
  94. package/dist/cli/commands/workflow.js +488 -0
  95. package/dist/cli/commands/workflow.js.map +1 -0
  96. package/dist/cli/index.d.ts +3 -0
  97. package/dist/cli/index.d.ts.map +1 -0
  98. package/dist/cli/index.js +115 -0
  99. package/dist/cli/index.js.map +1 -0
  100. package/dist/cli/paths.d.ts +90 -0
  101. package/dist/cli/paths.d.ts.map +1 -0
  102. package/dist/cli/paths.js +136 -0
  103. package/dist/cli/paths.js.map +1 -0
  104. package/dist/cli/runtime-logger.d.ts +13 -0
  105. package/dist/cli/runtime-logger.d.ts.map +1 -0
  106. package/dist/cli/runtime-logger.js +213 -0
  107. package/dist/cli/runtime-logger.js.map +1 -0
  108. package/dist/core/analyzer.d.ts +3 -0
  109. package/dist/core/analyzer.d.ts.map +1 -0
  110. package/dist/core/analyzer.js +359 -0
  111. package/dist/core/analyzer.js.map +1 -0
  112. package/dist/core/ast-complexity-analyzer.d.ts +40 -0
  113. package/dist/core/ast-complexity-analyzer.d.ts.map +1 -0
  114. package/dist/core/ast-complexity-analyzer.js +279 -0
  115. package/dist/core/ast-complexity-analyzer.js.map +1 -0
  116. package/dist/core/global-index.d.ts +69 -0
  117. package/dist/core/global-index.d.ts.map +1 -0
  118. package/dist/core/global-index.js +388 -0
  119. package/dist/core/global-index.js.map +1 -0
  120. package/dist/generator/ai-overview.d.ts +51 -0
  121. package/dist/generator/ai-overview.d.ts.map +1 -0
  122. package/dist/generator/ai-overview.js +160 -0
  123. package/dist/generator/ai-overview.js.map +1 -0
  124. package/dist/generator/context.d.ts +5 -0
  125. package/dist/generator/context.d.ts.map +1 -0
  126. package/dist/generator/context.js +514 -0
  127. package/dist/generator/context.js.map +1 -0
  128. package/dist/generator/file-describer.d.ts +93 -0
  129. package/dist/generator/file-describer.d.ts.map +1 -0
  130. package/dist/generator/file-describer.js +375 -0
  131. package/dist/generator/file-describer.js.map +1 -0
  132. package/dist/generator/index.d.ts +8 -0
  133. package/dist/generator/index.d.ts.map +1 -0
  134. package/dist/generator/index.js +259 -0
  135. package/dist/generator/index.js.map +1 -0
  136. package/dist/index.d.ts +5 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +6 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/orchestrator/adapters/ast-grep-adapter.d.ts +75 -0
  141. package/dist/orchestrator/adapters/ast-grep-adapter.d.ts.map +1 -0
  142. package/dist/orchestrator/adapters/ast-grep-adapter.js +242 -0
  143. package/dist/orchestrator/adapters/ast-grep-adapter.js.map +1 -0
  144. package/dist/orchestrator/adapters/base-adapter.d.ts +24 -0
  145. package/dist/orchestrator/adapters/base-adapter.d.ts.map +1 -0
  146. package/dist/orchestrator/adapters/base-adapter.js +2 -0
  147. package/dist/orchestrator/adapters/base-adapter.js.map +1 -0
  148. package/dist/orchestrator/adapters/codemap-adapter.d.ts +56 -0
  149. package/dist/orchestrator/adapters/codemap-adapter.d.ts.map +1 -0
  150. package/dist/orchestrator/adapters/codemap-adapter.js +163 -0
  151. package/dist/orchestrator/adapters/codemap-adapter.js.map +1 -0
  152. package/dist/orchestrator/adapters/index.d.ts +10 -0
  153. package/dist/orchestrator/adapters/index.d.ts.map +1 -0
  154. package/dist/orchestrator/adapters/index.js +3 -0
  155. package/dist/orchestrator/adapters/index.js.map +1 -0
  156. package/dist/orchestrator/ai-feed-generator.d.ts +210 -0
  157. package/dist/orchestrator/ai-feed-generator.d.ts.map +1 -0
  158. package/dist/orchestrator/ai-feed-generator.js +377 -0
  159. package/dist/orchestrator/ai-feed-generator.js.map +1 -0
  160. package/dist/orchestrator/commit-validator.d.ts +30 -0
  161. package/dist/orchestrator/commit-validator.d.ts.map +1 -0
  162. package/dist/orchestrator/commit-validator.js +87 -0
  163. package/dist/orchestrator/commit-validator.js.map +1 -0
  164. package/dist/orchestrator/confidence.d.ts +25 -0
  165. package/dist/orchestrator/confidence.d.ts.map +1 -0
  166. package/dist/orchestrator/confidence.js +138 -0
  167. package/dist/orchestrator/confidence.js.map +1 -0
  168. package/dist/orchestrator/file-header-scanner.d.ts +48 -0
  169. package/dist/orchestrator/file-header-scanner.d.ts.map +1 -0
  170. package/dist/orchestrator/file-header-scanner.js +158 -0
  171. package/dist/orchestrator/file-header-scanner.js.map +1 -0
  172. package/dist/orchestrator/git-analyzer.d.ts +192 -0
  173. package/dist/orchestrator/git-analyzer.d.ts.map +1 -0
  174. package/dist/orchestrator/git-analyzer.js +539 -0
  175. package/dist/orchestrator/git-analyzer.js.map +1 -0
  176. package/dist/orchestrator/index.d.ts +20 -0
  177. package/dist/orchestrator/index.d.ts.map +1 -0
  178. package/dist/orchestrator/index.js +16 -0
  179. package/dist/orchestrator/index.js.map +1 -0
  180. package/dist/orchestrator/intent-router.d.ts +41 -0
  181. package/dist/orchestrator/intent-router.d.ts.map +1 -0
  182. package/dist/orchestrator/intent-router.js +98 -0
  183. package/dist/orchestrator/intent-router.js.map +1 -0
  184. package/dist/orchestrator/result-fusion.d.ts +114 -0
  185. package/dist/orchestrator/result-fusion.d.ts.map +1 -0
  186. package/dist/orchestrator/result-fusion.js +332 -0
  187. package/dist/orchestrator/result-fusion.js.map +1 -0
  188. package/dist/orchestrator/test-linker.d.ts +166 -0
  189. package/dist/orchestrator/test-linker.d.ts.map +1 -0
  190. package/dist/orchestrator/test-linker.js +570 -0
  191. package/dist/orchestrator/test-linker.js.map +1 -0
  192. package/dist/orchestrator/tool-orchestrator.d.ts +108 -0
  193. package/dist/orchestrator/tool-orchestrator.d.ts.map +1 -0
  194. package/dist/orchestrator/tool-orchestrator.js +247 -0
  195. package/dist/orchestrator/tool-orchestrator.js.map +1 -0
  196. package/dist/orchestrator/types.d.ts +162 -0
  197. package/dist/orchestrator/types.d.ts.map +1 -0
  198. package/dist/orchestrator/types.js +39 -0
  199. package/dist/orchestrator/types.js.map +1 -0
  200. package/dist/orchestrator/workflow/ci-executor.d.ts +157 -0
  201. package/dist/orchestrator/workflow/ci-executor.d.ts.map +1 -0
  202. package/dist/orchestrator/workflow/ci-executor.js +423 -0
  203. package/dist/orchestrator/workflow/ci-executor.js.map +1 -0
  204. package/dist/orchestrator/workflow/config.d.ts +97 -0
  205. package/dist/orchestrator/workflow/config.d.ts.map +1 -0
  206. package/dist/orchestrator/workflow/config.js +115 -0
  207. package/dist/orchestrator/workflow/config.js.map +1 -0
  208. package/dist/orchestrator/workflow/git-analyzer.d.ts +173 -0
  209. package/dist/orchestrator/workflow/git-analyzer.d.ts.map +1 -0
  210. package/dist/orchestrator/workflow/git-analyzer.js +473 -0
  211. package/dist/orchestrator/workflow/git-analyzer.js.map +1 -0
  212. package/dist/orchestrator/workflow/index.d.ts +21 -0
  213. package/dist/orchestrator/workflow/index.d.ts.map +1 -0
  214. package/dist/orchestrator/workflow/index.js +21 -0
  215. package/dist/orchestrator/workflow/index.js.map +1 -0
  216. package/dist/orchestrator/workflow/phase-checkpoint.d.ts +38 -0
  217. package/dist/orchestrator/workflow/phase-checkpoint.d.ts.map +1 -0
  218. package/dist/orchestrator/workflow/phase-checkpoint.js +75 -0
  219. package/dist/orchestrator/workflow/phase-checkpoint.js.map +1 -0
  220. package/dist/orchestrator/workflow/phase-inheritance.d.ts +128 -0
  221. package/dist/orchestrator/workflow/phase-inheritance.d.ts.map +1 -0
  222. package/dist/orchestrator/workflow/phase-inheritance.js +266 -0
  223. package/dist/orchestrator/workflow/phase-inheritance.js.map +1 -0
  224. package/dist/orchestrator/workflow/result-fusion.d.ts +117 -0
  225. package/dist/orchestrator/workflow/result-fusion.d.ts.map +1 -0
  226. package/dist/orchestrator/workflow/result-fusion.js +246 -0
  227. package/dist/orchestrator/workflow/result-fusion.js.map +1 -0
  228. package/dist/orchestrator/workflow/templates.d.ts +116 -0
  229. package/dist/orchestrator/workflow/templates.d.ts.map +1 -0
  230. package/dist/orchestrator/workflow/templates.js +546 -0
  231. package/dist/orchestrator/workflow/templates.js.map +1 -0
  232. package/dist/orchestrator/workflow/test-linker.d.ts +152 -0
  233. package/dist/orchestrator/workflow/test-linker.d.ts.map +1 -0
  234. package/dist/orchestrator/workflow/test-linker.js +342 -0
  235. package/dist/orchestrator/workflow/test-linker.js.map +1 -0
  236. package/dist/orchestrator/workflow/types.d.ts +202 -0
  237. package/dist/orchestrator/workflow/types.d.ts.map +1 -0
  238. package/dist/orchestrator/workflow/types.js +4 -0
  239. package/dist/orchestrator/workflow/types.js.map +1 -0
  240. package/dist/orchestrator/workflow/visualizer.d.ts +56 -0
  241. package/dist/orchestrator/workflow/visualizer.d.ts.map +1 -0
  242. package/dist/orchestrator/workflow/visualizer.js +300 -0
  243. package/dist/orchestrator/workflow/visualizer.js.map +1 -0
  244. package/dist/orchestrator/workflow/workflow-context.d.ts +50 -0
  245. package/dist/orchestrator/workflow/workflow-context.d.ts.map +1 -0
  246. package/dist/orchestrator/workflow/workflow-context.js +105 -0
  247. package/dist/orchestrator/workflow/workflow-context.js.map +1 -0
  248. package/dist/orchestrator/workflow/workflow-orchestrator.d.ts +126 -0
  249. package/dist/orchestrator/workflow/workflow-orchestrator.d.ts.map +1 -0
  250. package/dist/orchestrator/workflow/workflow-orchestrator.js +489 -0
  251. package/dist/orchestrator/workflow/workflow-orchestrator.js.map +1 -0
  252. package/dist/orchestrator/workflow/workflow-persistence.d.ts +38 -0
  253. package/dist/orchestrator/workflow/workflow-persistence.d.ts.map +1 -0
  254. package/dist/orchestrator/workflow/workflow-persistence.js +166 -0
  255. package/dist/orchestrator/workflow/workflow-persistence.js.map +1 -0
  256. package/dist/parser/implementations/fast-parser.d.ts +65 -0
  257. package/dist/parser/implementations/fast-parser.d.ts.map +1 -0
  258. package/dist/parser/implementations/fast-parser.js +299 -0
  259. package/dist/parser/implementations/fast-parser.js.map +1 -0
  260. package/dist/parser/implementations/smart-parser.d.ts +220 -0
  261. package/dist/parser/implementations/smart-parser.d.ts.map +1 -0
  262. package/dist/parser/implementations/smart-parser.js +1536 -0
  263. package/dist/parser/implementations/smart-parser.js.map +1 -0
  264. package/dist/parser/implementations/tree-sitter-parser.d.ts +57 -0
  265. package/dist/parser/implementations/tree-sitter-parser.d.ts.map +1 -0
  266. package/dist/parser/implementations/tree-sitter-parser.js +375 -0
  267. package/dist/parser/implementations/tree-sitter-parser.js.map +1 -0
  268. package/dist/parser/index.d.ts +19 -0
  269. package/dist/parser/index.d.ts.map +1 -0
  270. package/dist/parser/index.js +449 -0
  271. package/dist/parser/index.js.map +1 -0
  272. package/dist/parser/interfaces/IParser.d.ts +218 -0
  273. package/dist/parser/interfaces/IParser.d.ts.map +1 -0
  274. package/dist/parser/interfaces/IParser.js +22 -0
  275. package/dist/parser/interfaces/IParser.js.map +1 -0
  276. package/dist/plugins/built-in/call-graph.d.ts +38 -0
  277. package/dist/plugins/built-in/call-graph.d.ts.map +1 -0
  278. package/dist/plugins/built-in/call-graph.js +135 -0
  279. package/dist/plugins/built-in/call-graph.js.map +1 -0
  280. package/dist/plugins/built-in/complexity-analyzer.d.ts +45 -0
  281. package/dist/plugins/built-in/complexity-analyzer.d.ts.map +1 -0
  282. package/dist/plugins/built-in/complexity-analyzer.js +155 -0
  283. package/dist/plugins/built-in/complexity-analyzer.js.map +1 -0
  284. package/dist/plugins/index.d.ts +34 -0
  285. package/dist/plugins/index.d.ts.map +1 -0
  286. package/dist/plugins/index.js +103 -0
  287. package/dist/plugins/index.js.map +1 -0
  288. package/dist/plugins/plugin-loader.d.ts +22 -0
  289. package/dist/plugins/plugin-loader.d.ts.map +1 -0
  290. package/dist/plugins/plugin-loader.js +200 -0
  291. package/dist/plugins/plugin-loader.js.map +1 -0
  292. package/dist/plugins/plugin-registry.d.ts +20 -0
  293. package/dist/plugins/plugin-registry.d.ts.map +1 -0
  294. package/dist/plugins/plugin-registry.js +143 -0
  295. package/dist/plugins/plugin-registry.js.map +1 -0
  296. package/dist/plugins/types.d.ts +72 -0
  297. package/dist/plugins/types.d.ts.map +1 -0
  298. package/dist/plugins/types.js +5 -0
  299. package/dist/plugins/types.js.map +1 -0
  300. package/dist/types/index.d.ts +373 -0
  301. package/dist/types/index.d.ts.map +1 -0
  302. package/dist/types/index.js +7 -0
  303. package/dist/types/index.js.map +1 -0
  304. package/dist/watcher/daemon.d.ts +64 -0
  305. package/dist/watcher/daemon.d.ts.map +1 -0
  306. package/dist/watcher/daemon.js +189 -0
  307. package/dist/watcher/daemon.js.map +1 -0
  308. package/dist/watcher/file-watcher.d.ts +70 -0
  309. package/dist/watcher/file-watcher.d.ts.map +1 -0
  310. package/dist/watcher/file-watcher.js +127 -0
  311. package/dist/watcher/file-watcher.js.map +1 -0
  312. package/dist/watcher/index.d.ts +5 -0
  313. package/dist/watcher/index.d.ts.map +1 -0
  314. package/dist/watcher/index.js +6 -0
  315. package/dist/watcher/index.js.map +1 -0
  316. package/dist/watcher/watch-worker.d.ts +2 -0
  317. package/dist/watcher/watch-worker.d.ts.map +1 -0
  318. package/dist/watcher/watch-worker.js +57 -0
  319. package/dist/watcher/watch-worker.js.map +1 -0
  320. package/dist/worker/index.d.ts +76 -0
  321. package/dist/worker/index.d.ts.map +1 -0
  322. package/dist/worker/index.js +155 -0
  323. package/dist/worker/index.js.map +1 -0
  324. package/dist/worker/parse-worker.d.ts +2 -0
  325. package/dist/worker/parse-worker.d.ts.map +1 -0
  326. package/dist/worker/parse-worker.js +202 -0
  327. package/dist/worker/parse-worker.js.map +1 -0
  328. package/mycodemap.config.schema.json +42 -0
  329. package/package.json +69 -0
@@ -0,0 +1,128 @@
1
+ /**
2
+ * [META] since:2026-03 | owner:codemap-team | stable:false
3
+ * [WHY] @version 2.5
4
+ */
5
+ /**
6
+ * 阶段结果继承器
7
+ * 管理工作流阶段间的结果继承逻辑
8
+ *
9
+ * @module PhaseInheritance
10
+ * @version 2.5
11
+ *
12
+ * 设计参考: REFACTOR_RESULT_FUSION_DESIGN.md §8.2
13
+ */
14
+ import type { UnifiedResult } from '../types.js';
15
+ import type { WorkflowPhase } from './types.js';
16
+ import type { WorkflowFusionContext } from './result-fusion.js';
17
+ /**
18
+ * 继承策略
19
+ */
20
+ export type InheritanceStrategy = 'all' | 'code-analysis' | 'risk-analysis' | 'none';
21
+ /**
22
+ * 阶段继承配置
23
+ */
24
+ export interface PhaseInheritanceConfig {
25
+ /** 阶段名称 */
26
+ phase: WorkflowPhase;
27
+ /** 继承策略 */
28
+ strategy: InheritanceStrategy;
29
+ /** 过滤特定来源(可选) */
30
+ filterSources?: string[];
31
+ /** 排除特定来源(可选) */
32
+ excludeSources?: string[];
33
+ /** 最小相关度阈值(可选) */
34
+ minRelevance?: number;
35
+ }
36
+ export declare class PhaseInheritance {
37
+ private config;
38
+ constructor(customConfig?: Partial<Record<WorkflowPhase, Partial<PhaseInheritanceConfig>>>);
39
+ /**
40
+ * 获取下一阶段应该继承的结果
41
+ *
42
+ * 根据当前阶段的配置,从历史结果中筛选出应该继承的结果
43
+ *
44
+ * @param currentPhase - 当前阶段
45
+ * @param context - 工作流融合上下文(包含所有历史结果)
46
+ * @returns 应该继承的结果列表
47
+ */
48
+ getInheritedResults(currentPhase: WorkflowPhase, context: WorkflowFusionContext): UnifiedResult[];
49
+ /**
50
+ * 收集所有历史结果(当前阶段之前的结果)
51
+ */
52
+ private collectAllHistoricalResults;
53
+ /**
54
+ * 应用继承策略过滤
55
+ */
56
+ private applyStrategyFilter;
57
+ /**
58
+ * 按来源过滤结果
59
+ */
60
+ private filterBySources;
61
+ /**
62
+ * 排除特定来源的结果
63
+ */
64
+ private excludeSources;
65
+ /**
66
+ * 按相关度阈值过滤
67
+ */
68
+ private filterByRelevance;
69
+ /**
70
+ * 去重结果
71
+ */
72
+ private deduplicateResults;
73
+ /**
74
+ * 按相关度排序
75
+ */
76
+ private sortByRelevance;
77
+ /**
78
+ * 获取结果的唯一键
79
+ */
80
+ private getResultKey;
81
+ /**
82
+ * 获取阶段的继承配置
83
+ */
84
+ getConfig(phase: WorkflowPhase): PhaseInheritanceConfig | undefined;
85
+ /**
86
+ * 更新阶段继承配置
87
+ */
88
+ updateConfig(phase: WorkflowPhase, config: Partial<PhaseInheritanceConfig>): void;
89
+ /**
90
+ * 设置自定义继承配置
91
+ */
92
+ setConfig(phase: WorkflowPhase, config: PhaseInheritanceConfig): void;
93
+ /**
94
+ * 获取所有阶段的继承配置
95
+ */
96
+ getAllConfigs(): Map<WorkflowPhase, PhaseInheritanceConfig>;
97
+ /**
98
+ * 重置为默认配置
99
+ */
100
+ resetToDefaults(): void;
101
+ /**
102
+ * 检查阶段是否有继承结果
103
+ */
104
+ hasInheritedResults(phase: WorkflowPhase, context: WorkflowFusionContext): boolean;
105
+ /**
106
+ * 获取继承结果的统计信息
107
+ */
108
+ getInheritanceStats(phase: WorkflowPhase, context: WorkflowFusionContext): {
109
+ total: number;
110
+ bySource: Record<string, number>;
111
+ byType: Record<string, number>;
112
+ avgRelevance: number;
113
+ };
114
+ }
115
+ /**
116
+ * 创建阶段继承器实例
117
+ */
118
+ export declare function createPhaseInheritance(customConfig?: Partial<Record<WorkflowPhase, Partial<PhaseInheritanceConfig>>>): PhaseInheritance;
119
+ /**
120
+ * 快速获取继承结果(便捷函数)
121
+ */
122
+ export declare function getInheritedResults(phase: WorkflowPhase, context: WorkflowFusionContext, customConfig?: Partial<Record<WorkflowPhase, Partial<PhaseInheritanceConfig>>>): UnifiedResult[];
123
+ /**
124
+ * 获取默认继承配置
125
+ */
126
+ export declare function getDefaultInheritanceConfig(): Record<WorkflowPhase, PhaseInheritanceConfig>;
127
+ export default PhaseInheritance;
128
+ //# sourceMappingURL=phase-inheritance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-inheritance.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/workflow/phase-inheritance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAMhE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,eAAe,GACf,eAAe,GACf,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW;IACX,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW;IACX,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,iBAAiB;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA4CD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAA6C;gBAE/C,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAa1F;;;;;;;;OAQG;IACH,mBAAmB,CACjB,YAAY,EAAE,aAAa,EAC3B,OAAO,EAAE,qBAAqB,GAC7B,aAAa,EAAE;IAmClB;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAoBnC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA4B3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;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O,CAAC,sBAAsB,CAAC,CAAC,CAAC,GAC7E,aAAa,EAAE,CAGjB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAE3F;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,266 @@
1
+ /**
2
+ * [META] since:2026-03 | owner:codemap-team | stable:false
3
+ * [WHY] @version 2.5
4
+ */
5
+ // ============================================
6
+ // 阶段继承配置表
7
+ // ============================================
8
+ /**
9
+ * 默认阶段继承配置
10
+ * 定义每个阶段应该继承哪些前一阶段的结果
11
+ */
12
+ const DEFAULT_INHERITANCE_CONFIG = {
13
+ 'reference': {
14
+ phase: 'reference',
15
+ strategy: 'none', // reference 是第一阶段,无继承
16
+ },
17
+ 'impact': {
18
+ phase: 'impact',
19
+ strategy: 'code-analysis', // 继承代码分析结果
20
+ filterSources: ['ast-grep', 'codemap'],
21
+ },
22
+ 'risk': {
23
+ phase: 'risk',
24
+ strategy: 'all', // 继承所有分析结果
25
+ },
26
+ 'implementation': {
27
+ phase: 'implementation',
28
+ strategy: 'all', // 继承所有分析结果用于实现参考
29
+ minRelevance: 0.5, // 只继承高相关度的结果
30
+ },
31
+ 'commit': {
32
+ phase: 'commit',
33
+ strategy: 'code-analysis',
34
+ filterSources: ['ast-grep', 'codemap'],
35
+ },
36
+ 'ci': {
37
+ phase: 'ci',
38
+ strategy: 'all', // CI 阶段继承所有结果进行验证
39
+ }
40
+ };
41
+ // ============================================
42
+ // PhaseInheritance 类
43
+ // ============================================
44
+ export class PhaseInheritance {
45
+ config;
46
+ constructor(customConfig) {
47
+ // 初始化配置,合并默认配置和自定义配置
48
+ this.config = new Map();
49
+ for (const [phase, defaultConfig] of Object.entries(DEFAULT_INHERITANCE_CONFIG)) {
50
+ const customPhaseConfig = customConfig?.[phase];
51
+ this.config.set(phase, {
52
+ ...defaultConfig,
53
+ ...customPhaseConfig,
54
+ });
55
+ }
56
+ }
57
+ /**
58
+ * 获取下一阶段应该继承的结果
59
+ *
60
+ * 根据当前阶段的配置,从历史结果中筛选出应该继承的结果
61
+ *
62
+ * @param currentPhase - 当前阶段
63
+ * @param context - 工作流融合上下文(包含所有历史结果)
64
+ * @returns 应该继承的结果列表
65
+ */
66
+ getInheritedResults(currentPhase, context) {
67
+ const config = this.config.get(currentPhase);
68
+ if (!config || config.strategy === 'none') {
69
+ return [];
70
+ }
71
+ // 收集所有历史结果
72
+ let allResults = this.collectAllHistoricalResults(context, currentPhase);
73
+ // 应用继承策略过滤
74
+ allResults = this.applyStrategyFilter(allResults, config);
75
+ // 应用来源过滤
76
+ if (config.filterSources && config.filterSources.length > 0) {
77
+ allResults = this.filterBySources(allResults, config.filterSources);
78
+ }
79
+ // 应用来源排除
80
+ if (config.excludeSources && config.excludeSources.length > 0) {
81
+ allResults = this.excludeSources(allResults, config.excludeSources);
82
+ }
83
+ // 应用相关度阈值
84
+ if (config.minRelevance !== undefined) {
85
+ allResults = this.filterByRelevance(allResults, config.minRelevance);
86
+ }
87
+ // 去重
88
+ allResults = this.deduplicateResults(allResults);
89
+ // 按相关度排序
90
+ return this.sortByRelevance(allResults);
91
+ }
92
+ /**
93
+ * 收集所有历史结果(当前阶段之前的结果)
94
+ */
95
+ collectAllHistoricalResults(context, currentPhase) {
96
+ const results = [];
97
+ const phaseOrder = ['reference', 'impact', 'risk', 'implementation', 'commit', 'ci'];
98
+ const currentIndex = phaseOrder.indexOf(currentPhase);
99
+ // 只收集当前阶段之前的结果
100
+ for (let i = 0; i < currentIndex; i++) {
101
+ const phase = phaseOrder[i];
102
+ const phaseResults = context.phaseResults.get(phase);
103
+ if (phaseResults) {
104
+ results.push(...phaseResults);
105
+ }
106
+ }
107
+ return results;
108
+ }
109
+ /**
110
+ * 应用继承策略过滤
111
+ */
112
+ applyStrategyFilter(results, config) {
113
+ switch (config.strategy) {
114
+ case 'all':
115
+ return results;
116
+ case 'code-analysis':
117
+ return results.filter(r => r.source === 'ast-grep' ||
118
+ r.source === 'codemap' ||
119
+ r.type === 'code' ||
120
+ r.type === 'symbol');
121
+ case 'risk-analysis':
122
+ return results.filter(r => r.source === 'ai-feed' ||
123
+ r.type === 'risk-assessment');
124
+ case 'none':
125
+ default:
126
+ return [];
127
+ }
128
+ }
129
+ /**
130
+ * 按来源过滤结果
131
+ */
132
+ filterBySources(results, sources) {
133
+ return results.filter(r => sources.includes(r.source));
134
+ }
135
+ /**
136
+ * 排除特定来源的结果
137
+ */
138
+ excludeSources(results, sources) {
139
+ return results.filter(r => !sources.includes(r.source));
140
+ }
141
+ /**
142
+ * 按相关度阈值过滤
143
+ */
144
+ filterByRelevance(results, minRelevance) {
145
+ return results.filter(r => r.relevance >= minRelevance);
146
+ }
147
+ /**
148
+ * 去重结果
149
+ */
150
+ deduplicateResults(results) {
151
+ const seen = new Map();
152
+ for (const result of results) {
153
+ const key = this.getResultKey(result);
154
+ if (!seen.has(key)) {
155
+ seen.set(key, result);
156
+ }
157
+ else {
158
+ // 保留分数更高的
159
+ const existing = seen.get(key);
160
+ if (result.relevance > existing.relevance) {
161
+ seen.set(key, result);
162
+ }
163
+ }
164
+ }
165
+ return Array.from(seen.values());
166
+ }
167
+ /**
168
+ * 按相关度排序
169
+ */
170
+ sortByRelevance(results) {
171
+ return results.sort((a, b) => b.relevance - a.relevance);
172
+ }
173
+ /**
174
+ * 获取结果的唯一键
175
+ */
176
+ getResultKey(result) {
177
+ return `${result.file}:${result.line || ''}`;
178
+ }
179
+ /**
180
+ * 获取阶段的继承配置
181
+ */
182
+ getConfig(phase) {
183
+ return this.config.get(phase);
184
+ }
185
+ /**
186
+ * 更新阶段继承配置
187
+ */
188
+ updateConfig(phase, config) {
189
+ const existing = this.config.get(phase);
190
+ if (existing) {
191
+ this.config.set(phase, { ...existing, ...config });
192
+ }
193
+ }
194
+ /**
195
+ * 设置自定义继承配置
196
+ */
197
+ setConfig(phase, config) {
198
+ this.config.set(phase, config);
199
+ }
200
+ /**
201
+ * 获取所有阶段的继承配置
202
+ */
203
+ getAllConfigs() {
204
+ return new Map(this.config);
205
+ }
206
+ /**
207
+ * 重置为默认配置
208
+ */
209
+ resetToDefaults() {
210
+ this.config.clear();
211
+ for (const [phase, defaultConfig] of Object.entries(DEFAULT_INHERITANCE_CONFIG)) {
212
+ this.config.set(phase, { ...defaultConfig });
213
+ }
214
+ }
215
+ /**
216
+ * 检查阶段是否有继承结果
217
+ */
218
+ hasInheritedResults(phase, context) {
219
+ const inherited = this.getInheritedResults(phase, context);
220
+ return inherited.length > 0;
221
+ }
222
+ /**
223
+ * 获取继承结果的统计信息
224
+ */
225
+ getInheritanceStats(phase, context) {
226
+ const inherited = this.getInheritedResults(phase, context);
227
+ const bySource = {};
228
+ const byType = {};
229
+ let totalRelevance = 0;
230
+ for (const result of inherited) {
231
+ bySource[result.source] = (bySource[result.source] || 0) + 1;
232
+ byType[result.type] = (byType[result.type] || 0) + 1;
233
+ totalRelevance += result.relevance;
234
+ }
235
+ return {
236
+ total: inherited.length,
237
+ bySource,
238
+ byType,
239
+ avgRelevance: inherited.length > 0 ? totalRelevance / inherited.length : 0
240
+ };
241
+ }
242
+ }
243
+ // ============================================
244
+ // 便捷函数
245
+ // ============================================
246
+ /**
247
+ * 创建阶段继承器实例
248
+ */
249
+ export function createPhaseInheritance(customConfig) {
250
+ return new PhaseInheritance(customConfig);
251
+ }
252
+ /**
253
+ * 快速获取继承结果(便捷函数)
254
+ */
255
+ export function getInheritedResults(phase, context, customConfig) {
256
+ const inheritance = createPhaseInheritance(customConfig);
257
+ return inheritance.getInheritedResults(phase, context);
258
+ }
259
+ /**
260
+ * 获取默认继承配置
261
+ */
262
+ export function getDefaultInheritanceConfig() {
263
+ return { ...DEFAULT_INHERITANCE_CONFIG };
264
+ }
265
+ export default PhaseInheritance;
266
+ //# sourceMappingURL=phase-inheritance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-inheritance.js","sourceRoot":"","sources":["../../../src/orchestrator/workflow/phase-inheritance.ts"],"names":[],"mappings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GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;IACzD,OAAO,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,EAAE,GAAG,0BAA0B,EAAE,CAAC;AAC3C,CAAC;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * [META] since:2026-03 | owner:codemap-team | stable:false
3
+ * [WHY] @version 2.5
4
+ */
5
+ /**
6
+ * 工作流结果融合器
7
+ * 实现跨阶段结果传递和融合
8
+ *
9
+ * @module WorkflowResultFusion
10
+ * @version 2.5
11
+ *
12
+ * 设计参考: REFACTOR_RESULT_FUSION_DESIGN.md §8.1
13
+ */
14
+ import type { UnifiedResult } from '../types.js';
15
+ import type { WorkflowPhase, PhaseArtifacts } from './types.js';
16
+ /**
17
+ * 工作流融合上下文
18
+ * 存储跨阶段的结果数据
19
+ */
20
+ export interface WorkflowFusionContext {
21
+ /** 各阶段的结果映射 */
22
+ phaseResults: Map<WorkflowPhase, UnifiedResult[]>;
23
+ /** 累积的上下文(去重后的结果) */
24
+ accumulatedContext: Map<string, UnifiedResult>;
25
+ }
26
+ /**
27
+ * 融合选项
28
+ */
29
+ export interface FusionOptions {
30
+ /** 限制返回结果数量 */
31
+ topK?: number;
32
+ /** 是否应用阶段权重 */
33
+ applyPhaseWeights?: boolean;
34
+ /** 关键词权重 */
35
+ keywordWeights?: Record<string, number>;
36
+ }
37
+ export declare class WorkflowResultFusion {
38
+ /**
39
+ * 创建空的融合上下文
40
+ */
41
+ static createEmptyContext(): WorkflowFusionContext;
42
+ /**
43
+ * 从阶段产物构建融合上下文
44
+ */
45
+ static buildContextFromArtifacts(artifacts: Map<WorkflowPhase, PhaseArtifacts>): WorkflowFusionContext;
46
+ /**
47
+ * 将新阶段结果与已有上下文合并
48
+ *
49
+ * @param newResults - 新阶段的结果
50
+ * @param context - 当前融合上下文
51
+ * @param currentPhase - 当前阶段
52
+ * @param options - 融合选项
53
+ * @returns 融合后的结果列表
54
+ */
55
+ mergeWithContext(newResults: UnifiedResult[], context: WorkflowFusionContext, currentPhase: WorkflowPhase, options?: FusionOptions): UnifiedResult[];
56
+ /**
57
+ * 收集所有历史结果
58
+ */
59
+ private collectAllResults;
60
+ /**
61
+ * 去重结果(基于文件+行号)
62
+ * 保留相关度更高的结果
63
+ */
64
+ private deduplicateResults;
65
+ /**
66
+ * 应用工作流阶段权重
67
+ * 根据结果来源的阶段调整相关度
68
+ */
69
+ applyWorkflowWeights(results: UnifiedResult[], context: WorkflowFusionContext): UnifiedResult[];
70
+ /**
71
+ * 应用关键词加权
72
+ */
73
+ private applyKeywordBoost;
74
+ /**
75
+ * 按相关度排序
76
+ */
77
+ private sortByRelevance;
78
+ /**
79
+ * 按工作流阶段优先级排序
80
+ * 用于特定场景下的排序需求
81
+ */
82
+ sortByWorkflowPriority(results: UnifiedResult[]): UnifiedResult[];
83
+ /**
84
+ * 推断结果来源的阶段
85
+ */
86
+ private inferPhase;
87
+ /**
88
+ * 更新累积上下文
89
+ */
90
+ private updateAccumulatedContext;
91
+ /**
92
+ * 获取结果的唯一键
93
+ */
94
+ private static getResultKey;
95
+ /**
96
+ * 获取特定阶段的结果
97
+ */
98
+ getPhaseResults(context: WorkflowFusionContext, phase: WorkflowPhase): UnifiedResult[];
99
+ /**
100
+ * 获取累积上下文中的所有结果
101
+ */
102
+ getAccumulatedResults(context: WorkflowFusionContext): UnifiedResult[];
103
+ /**
104
+ * 清除特定阶段的结果
105
+ */
106
+ clearPhaseResults(context: WorkflowFusionContext, phase: WorkflowPhase): void;
107
+ }
108
+ /**
109
+ * 创建结果融合器实例
110
+ */
111
+ export declare function createResultFusion(): WorkflowResultFusion;
112
+ /**
113
+ * 快速融合结果(便捷函数)
114
+ */
115
+ export declare function fuseResults(newResults: UnifiedResult[], context: WorkflowFusionContext, currentPhase: WorkflowPhase, options?: FusionOptions): UnifiedResult[];
116
+ export default WorkflowResultFusion;
117
+ //# sourceMappingURL=result-fusion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-fusion.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/workflow/result-fusion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMhE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe;IACf,YAAY,EAAE,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,CAAC,CAAC;IAClD,qBAAqB;IACrB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAkCD,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,kBAAkB,IAAI,qBAAqB;IAOlD;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAC9B,SAAS,EAAE,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,GAC5C,qBAAqB;IAkBxB;;;;;;;;OAQG;IACH,gBAAgB,CACd,UAAU,EAAE,aAAa,EAAE,EAC3B,OAAO,EAAE,qBAAqB,EAC9B,YAAY,EAAE,aAAa,EAC3B,OAAO,GAAE,aAAkB,GAC1B,aAAa,EAAE;IAiClB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiBzB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;OAGG;IACH,oBAAoB,CAClB,OAAO,EAAE,aAAa,EAAE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