mcp-adr-analysis-server 2.0.21 → 2.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 (263) hide show
  1. package/README.md +94 -839
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/src/config/ai-config.d.ts.map +1 -1
  4. package/dist/src/config/ai-config.js +9 -9
  5. package/dist/src/config/ai-config.js.map +1 -1
  6. package/dist/src/index.d.ts +15 -0
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/index.js +1594 -837
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/prompts/analysis-prompts.d.ts +4 -1
  11. package/dist/src/prompts/analysis-prompts.d.ts.map +1 -1
  12. package/dist/src/prompts/analysis-prompts.js +61 -30
  13. package/dist/src/prompts/analysis-prompts.js.map +1 -1
  14. package/dist/src/prompts/index.d.ts +17 -1
  15. package/dist/src/prompts/index.d.ts.map +1 -1
  16. package/dist/src/prompts/index.js +325 -1
  17. package/dist/src/prompts/index.js.map +1 -1
  18. package/dist/src/prompts/rule-generation-prompts.d.ts +5 -1
  19. package/dist/src/prompts/rule-generation-prompts.d.ts.map +1 -1
  20. package/dist/src/prompts/rule-generation-prompts.js +5 -1
  21. package/dist/src/prompts/rule-generation-prompts.js.map +1 -1
  22. package/dist/src/prompts/security-prompts.d.ts +6 -1
  23. package/dist/src/prompts/security-prompts.d.ts.map +1 -1
  24. package/dist/src/prompts/security-prompts.js +6 -1
  25. package/dist/src/prompts/security-prompts.js.map +1 -1
  26. package/dist/src/prompts/todo-prompts.d.ts +49 -0
  27. package/dist/src/prompts/todo-prompts.d.ts.map +1 -0
  28. package/dist/src/prompts/todo-prompts.js +824 -0
  29. package/dist/src/prompts/todo-prompts.js.map +1 -0
  30. package/dist/src/resources/index.d.ts.map +1 -1
  31. package/dist/src/resources/index.js +9 -7
  32. package/dist/src/resources/index.js.map +1 -1
  33. package/dist/src/tools/adr-bootstrap-validation-tool.d.ts +47 -0
  34. package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -0
  35. package/dist/src/tools/adr-bootstrap-validation-tool.js +979 -0
  36. package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -0
  37. package/dist/src/tools/adr-suggestion-tool.d.ts +1 -0
  38. package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
  39. package/dist/src/tools/adr-suggestion-tool.js +330 -32
  40. package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
  41. package/dist/src/tools/content-masking-tool.d.ts +5 -0
  42. package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
  43. package/dist/src/tools/content-masking-tool.js +631 -28
  44. package/dist/src/tools/content-masking-tool.js.map +1 -1
  45. package/dist/src/tools/deployment-readiness-tool.d.ts +8 -5
  46. package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
  47. package/dist/src/tools/deployment-readiness-tool.js +1017 -93
  48. package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
  49. package/dist/src/tools/environment-analysis-tool.d.ts +4 -0
  50. package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
  51. package/dist/src/tools/environment-analysis-tool.js +568 -24
  52. package/dist/src/tools/environment-analysis-tool.js.map +1 -1
  53. package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
  54. package/dist/src/tools/interactive-adr-planning-tool.js +270 -108
  55. package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
  56. package/dist/src/tools/mcp-planning-tool.d.ts.map +1 -1
  57. package/dist/src/tools/mcp-planning-tool.js +316 -183
  58. package/dist/src/tools/mcp-planning-tool.js.map +1 -1
  59. package/dist/src/tools/memory-loading-tool.d.ts +60 -0
  60. package/dist/src/tools/memory-loading-tool.d.ts.map +1 -0
  61. package/dist/src/tools/memory-loading-tool.js +457 -0
  62. package/dist/src/tools/memory-loading-tool.js.map +1 -0
  63. package/dist/src/tools/research-integration-tool.d.ts +4 -1
  64. package/dist/src/tools/research-integration-tool.d.ts.map +1 -1
  65. package/dist/src/tools/research-integration-tool.js +5 -1
  66. package/dist/src/tools/research-integration-tool.js.map +1 -1
  67. package/dist/src/tools/review-existing-adrs-tool.d.ts +19 -0
  68. package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -0
  69. package/dist/src/tools/review-existing-adrs-tool.js +1204 -0
  70. package/dist/src/tools/review-existing-adrs-tool.js.map +1 -0
  71. package/dist/src/tools/rule-generation-tool.d.ts +2 -0
  72. package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
  73. package/dist/src/tools/rule-generation-tool.js +274 -33
  74. package/dist/src/tools/rule-generation-tool.js.map +1 -1
  75. package/dist/src/tools/smart-git-push-tool-v2.d.ts +4 -0
  76. package/dist/src/tools/smart-git-push-tool-v2.d.ts.map +1 -1
  77. package/dist/src/tools/smart-git-push-tool-v2.js +423 -229
  78. package/dist/src/tools/smart-git-push-tool-v2.js.map +1 -1
  79. package/dist/src/tools/smart-git-push-tool.d.ts +3 -0
  80. package/dist/src/tools/smart-git-push-tool.d.ts.map +1 -1
  81. package/dist/src/tools/smart-git-push-tool.js +241 -235
  82. package/dist/src/tools/smart-git-push-tool.js.map +1 -1
  83. package/dist/src/tools/tool-chain-orchestrator.d.ts +2 -2
  84. package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
  85. package/dist/src/tools/tool-chain-orchestrator.js +152 -93
  86. package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
  87. package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +22 -13
  88. package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
  89. package/dist/src/tools/troubleshoot-guided-workflow-tool.js +660 -28
  90. package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
  91. package/dist/src/types/ape-framework.d.ts +93 -0
  92. package/dist/src/types/ape-framework.d.ts.map +1 -1
  93. package/dist/src/types/ape-framework.js +10 -10
  94. package/dist/src/types/ape-framework.js.map +1 -1
  95. package/dist/src/types/enhanced-errors.d.ts +173 -0
  96. package/dist/src/types/enhanced-errors.d.ts.map +1 -0
  97. package/dist/src/types/enhanced-errors.js +668 -0
  98. package/dist/src/types/enhanced-errors.js.map +1 -0
  99. package/dist/src/types/index.d.ts +129 -3
  100. package/dist/src/types/index.d.ts.map +1 -1
  101. package/dist/src/types/index.js +15 -0
  102. package/dist/src/types/index.js.map +1 -1
  103. package/dist/src/types/knowledge-generation.d.ts +78 -0
  104. package/dist/src/types/knowledge-generation.d.ts.map +1 -1
  105. package/dist/src/types/knowledge-generation.js +10 -6
  106. package/dist/src/types/knowledge-generation.js.map +1 -1
  107. package/dist/src/types/knowledge-graph-schemas.d.ts +92 -0
  108. package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -1
  109. package/dist/src/types/knowledge-graph-schemas.js +45 -17
  110. package/dist/src/types/knowledge-graph-schemas.js.map +1 -1
  111. package/dist/src/types/memory-entities.d.ts +7209 -0
  112. package/dist/src/types/memory-entities.d.ts.map +1 -0
  113. package/dist/src/types/memory-entities.js +395 -0
  114. package/dist/src/types/memory-entities.js.map +1 -0
  115. package/dist/src/types/reflexion-framework.d.ts +44 -0
  116. package/dist/src/types/reflexion-framework.d.ts.map +1 -1
  117. package/dist/src/types/reflexion-framework.js +7 -7
  118. package/dist/src/types/reflexion-framework.js.map +1 -1
  119. package/dist/src/types/todo-json-schemas.d.ts +7 -653
  120. package/dist/src/types/todo-json-schemas.d.ts.map +1 -1
  121. package/dist/src/types/todo-json-schemas.js +6 -110
  122. package/dist/src/types/todo-json-schemas.js.map +1 -1
  123. package/dist/src/types/tool-arguments.d.ts +224 -0
  124. package/dist/src/types/tool-arguments.d.ts.map +1 -0
  125. package/dist/src/types/tool-arguments.js +6 -0
  126. package/dist/src/types/tool-arguments.js.map +1 -0
  127. package/dist/src/utils/actual-file-operations.d.ts.map +1 -1
  128. package/dist/src/utils/actual-file-operations.js +25 -9
  129. package/dist/src/utils/actual-file-operations.js.map +1 -1
  130. package/dist/src/utils/adr-discovery.d.ts +33 -1
  131. package/dist/src/utils/adr-discovery.d.ts.map +1 -1
  132. package/dist/src/utils/adr-discovery.js +14 -9
  133. package/dist/src/utils/adr-discovery.js.map +1 -1
  134. package/dist/src/utils/adr-suggestions.d.ts +72 -0
  135. package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
  136. package/dist/src/utils/adr-suggestions.js +6 -0
  137. package/dist/src/utils/adr-suggestions.js.map +1 -1
  138. package/dist/src/utils/cache.d.ts.map +1 -1
  139. package/dist/src/utils/cache.js +22 -19
  140. package/dist/src/utils/cache.js.map +1 -1
  141. package/dist/src/utils/chain-of-thought-template.d.ts +13 -1
  142. package/dist/src/utils/chain-of-thought-template.d.ts.map +1 -1
  143. package/dist/src/utils/chain-of-thought-template.js +31 -22
  144. package/dist/src/utils/chain-of-thought-template.js.map +1 -1
  145. package/dist/src/utils/config.d.ts.map +1 -1
  146. package/dist/src/utils/config.js +1 -0
  147. package/dist/src/utils/config.js.map +1 -1
  148. package/dist/src/utils/directory-compat.js +1 -1
  149. package/dist/src/utils/directory-compat.js.map +1 -1
  150. package/dist/src/utils/enhanced-logging.d.ts +195 -0
  151. package/dist/src/utils/enhanced-logging.d.ts.map +1 -0
  152. package/dist/src/utils/enhanced-logging.js +449 -0
  153. package/dist/src/utils/enhanced-logging.js.map +1 -0
  154. package/dist/src/utils/file-system.d.ts +182 -34
  155. package/dist/src/utils/file-system.d.ts.map +1 -1
  156. package/dist/src/utils/file-system.js +648 -774
  157. package/dist/src/utils/file-system.js.map +1 -1
  158. package/dist/src/utils/gitleaks-detector.d.ts +50 -0
  159. package/dist/src/utils/gitleaks-detector.d.ts.map +1 -0
  160. package/dist/src/utils/gitleaks-detector.js +334 -0
  161. package/dist/src/utils/gitleaks-detector.js.map +1 -0
  162. package/dist/src/utils/interactive-approval.d.ts +1 -1
  163. package/dist/src/utils/interactive-approval.d.ts.map +1 -1
  164. package/dist/src/utils/interactive-approval.js +22 -17
  165. package/dist/src/utils/interactive-approval.js.map +1 -1
  166. package/dist/src/utils/json-safe.d.ts.map +1 -1
  167. package/dist/src/utils/json-safe.js +9 -6
  168. package/dist/src/utils/json-safe.js.map +1 -1
  169. package/dist/src/utils/knowledge-graph-manager.d.ts +37 -1
  170. package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
  171. package/dist/src/utils/knowledge-graph-manager.js +315 -70
  172. package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
  173. package/dist/src/utils/location-filter.d.ts +35 -10
  174. package/dist/src/utils/location-filter.d.ts.map +1 -1
  175. package/dist/src/utils/location-filter.js +360 -94
  176. package/dist/src/utils/location-filter.js.map +1 -1
  177. package/dist/src/utils/mcp-response-validator.d.ts.map +1 -1
  178. package/dist/src/utils/mcp-response-validator.js +34 -19
  179. package/dist/src/utils/mcp-response-validator.js.map +1 -1
  180. package/dist/src/utils/memory-entity-manager.d.ts +134 -0
  181. package/dist/src/utils/memory-entity-manager.d.ts.map +1 -0
  182. package/dist/src/utils/memory-entity-manager.js +851 -0
  183. package/dist/src/utils/memory-entity-manager.js.map +1 -0
  184. package/dist/src/utils/memory-health-scoring.d.ts +125 -0
  185. package/dist/src/utils/memory-health-scoring.d.ts.map +1 -0
  186. package/dist/src/utils/memory-health-scoring.js +277 -0
  187. package/dist/src/utils/memory-health-scoring.js.map +1 -0
  188. package/dist/src/utils/memory-migration-manager.d.ts +93 -0
  189. package/dist/src/utils/memory-migration-manager.d.ts.map +1 -0
  190. package/dist/src/utils/memory-migration-manager.js +842 -0
  191. package/dist/src/utils/memory-migration-manager.js.map +1 -0
  192. package/dist/src/utils/memory-relationship-mapper.d.ts +87 -0
  193. package/dist/src/utils/memory-relationship-mapper.d.ts.map +1 -0
  194. package/dist/src/utils/memory-relationship-mapper.js +482 -0
  195. package/dist/src/utils/memory-relationship-mapper.js.map +1 -0
  196. package/dist/src/utils/memory-rollback-manager.d.ts +105 -0
  197. package/dist/src/utils/memory-rollback-manager.d.ts.map +1 -0
  198. package/dist/src/utils/memory-rollback-manager.js +575 -0
  199. package/dist/src/utils/memory-rollback-manager.js.map +1 -0
  200. package/dist/src/utils/memory-transformation.d.ts +59 -0
  201. package/dist/src/utils/memory-transformation.d.ts.map +1 -0
  202. package/dist/src/utils/memory-transformation.js +742 -0
  203. package/dist/src/utils/memory-transformation.js.map +1 -0
  204. package/dist/src/utils/output-masking.d.ts +12 -0
  205. package/dist/src/utils/output-masking.d.ts.map +1 -1
  206. package/dist/src/utils/output-masking.js +5 -0
  207. package/dist/src/utils/output-masking.js.map +1 -1
  208. package/dist/src/utils/prompt-execution.d.ts.map +1 -1
  209. package/dist/src/utils/prompt-execution.js +72 -51
  210. package/dist/src/utils/prompt-execution.js.map +1 -1
  211. package/dist/src/utils/release-readiness-detector.d.ts.map +1 -1
  212. package/dist/src/utils/release-readiness-detector.js +43 -42
  213. package/dist/src/utils/release-readiness-detector.js.map +1 -1
  214. package/dist/src/utils/research-integration.d.ts.map +1 -1
  215. package/dist/src/utils/research-integration.js +73 -44
  216. package/dist/src/utils/research-integration.js.map +1 -1
  217. package/dist/src/utils/research-questions.d.ts.map +1 -1
  218. package/dist/src/utils/research-questions.js +40 -14
  219. package/dist/src/utils/research-questions.js.map +1 -1
  220. package/dist/src/utils/ripgrep-wrapper.d.ts +84 -0
  221. package/dist/src/utils/ripgrep-wrapper.d.ts.map +1 -0
  222. package/dist/src/utils/ripgrep-wrapper.js +255 -0
  223. package/dist/src/utils/ripgrep-wrapper.js.map +1 -0
  224. package/dist/src/utils/rule-generation.d.ts.map +1 -1
  225. package/dist/src/utils/rule-generation.js +26 -15
  226. package/dist/src/utils/rule-generation.js.map +1 -1
  227. package/dist/src/utils/todo-file-watcher.d.ts +11 -23
  228. package/dist/src/utils/todo-file-watcher.d.ts.map +1 -1
  229. package/dist/src/utils/todo-file-watcher.js +18 -156
  230. package/dist/src/utils/todo-file-watcher.js.map +1 -1
  231. package/dist/src/utils/tree-sitter-analyzer.d.ts +185 -0
  232. package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -0
  233. package/dist/src/utils/tree-sitter-analyzer.js +885 -0
  234. package/dist/src/utils/tree-sitter-analyzer.js.map +1 -0
  235. package/package.json +51 -10
  236. package/dist/src/tools/smart-score-tool.d.ts +0 -173
  237. package/dist/src/tools/smart-score-tool.d.ts.map +0 -1
  238. package/dist/src/tools/smart-score-tool.js +0 -681
  239. package/dist/src/tools/smart-score-tool.js.map +0 -1
  240. package/dist/src/tools/todo-management-tool-v2.d.ts +0 -368
  241. package/dist/src/tools/todo-management-tool-v2.d.ts.map +0 -1
  242. package/dist/src/tools/todo-management-tool-v2.js +0 -922
  243. package/dist/src/tools/todo-management-tool-v2.js.map +0 -1
  244. package/dist/src/utils/enhanced-sensitive-detector.d.ts +0 -61
  245. package/dist/src/utils/enhanced-sensitive-detector.d.ts.map +0 -1
  246. package/dist/src/utils/enhanced-sensitive-detector.js +0 -437
  247. package/dist/src/utils/enhanced-sensitive-detector.js.map +0 -1
  248. package/dist/src/utils/project-health-scoring.d.ts +0 -177
  249. package/dist/src/utils/project-health-scoring.d.ts.map +0 -1
  250. package/dist/src/utils/project-health-scoring.js +0 -370
  251. package/dist/src/utils/project-health-scoring.js.map +0 -1
  252. package/dist/src/utils/todo-json-manager.d.ts +0 -71
  253. package/dist/src/utils/todo-json-manager.d.ts.map +0 -1
  254. package/dist/src/utils/todo-json-manager.js +0 -396
  255. package/dist/src/utils/todo-json-manager.js.map +0 -1
  256. package/dist/src/utils/todo-markdown-converter.d.ts +0 -16
  257. package/dist/src/utils/todo-markdown-converter.d.ts.map +0 -1
  258. package/dist/src/utils/todo-markdown-converter.js +0 -362
  259. package/dist/src/utils/todo-markdown-converter.js.map +0 -1
  260. package/dist/src/utils/todo-migration.d.ts +0 -47
  261. package/dist/src/utils/todo-migration.d.ts.map +0 -1
  262. package/dist/src/utils/todo-migration.js +0 -261
  263. package/dist/src/utils/todo-migration.js.map +0 -1
@@ -0,0 +1,742 @@
1
+ /**
2
+ * Memory Transformation Utilities
3
+ *
4
+ * Utilities for transforming existing ADRs and system data into memory entities
5
+ * for the memory-centric architecture migration.
6
+ */
7
+ import crypto from 'crypto';
8
+ import { MemoryEntitySchema, } from '../types/memory-entities.js';
9
+ import { EnhancedLogger } from './enhanced-logging.js';
10
+ import { McpAdrError } from '../types/index.js';
11
+ export class MemoryTransformer {
12
+ logger;
13
+ // @ts-ignore - keeping for future memory persistence integration
14
+ _memoryManager;
15
+ constructor(memoryManager) {
16
+ this.logger = new EnhancedLogger();
17
+ this._memoryManager = memoryManager;
18
+ // Note: memoryManager is kept for future memory persistence integration
19
+ }
20
+ /**
21
+ * Transform a discovered ADR into an Architectural Decision Memory entity
22
+ */
23
+ async transformAdrToMemory(adr) {
24
+ try {
25
+ const now = new Date().toISOString();
26
+ // Parse consequences into positive/negative/risks
27
+ const consequences = this.parseConsequences(adr.consequences || '');
28
+ // Extract implementation tasks from ADR content
29
+ const implementationTasks = this.extractImplementationTasks(adr.content || '');
30
+ // Determine implementation status based on ADR status
31
+ const implementationStatus = this.mapAdrStatusToImplementation(adr.status);
32
+ const memoryEntity = {
33
+ id: crypto.randomUUID(),
34
+ type: 'architectural_decision',
35
+ created: now,
36
+ lastModified: now,
37
+ version: 1,
38
+ confidence: this.calculateConfidenceFromAdr(adr),
39
+ relevance: this.calculateRelevanceFromAdr(adr),
40
+ title: adr.title,
41
+ description: adr.context || adr.title,
42
+ tags: this.extractTagsFromAdr(adr),
43
+ relationships: [], // Will be populated later through relationship inference
44
+ context: {
45
+ projectPhase: this.inferProjectPhase(adr),
46
+ businessDomain: this.inferBusinessDomain(adr),
47
+ technicalStack: this.inferTechnicalStack(adr),
48
+ environmentalFactors: this.inferEnvironmentalFactors(adr),
49
+ stakeholders: this.inferStakeholders(adr),
50
+ },
51
+ accessPattern: {
52
+ lastAccessed: now,
53
+ accessCount: 1,
54
+ accessContext: ['adr_transformation'],
55
+ },
56
+ evolution: {
57
+ origin: 'discovered',
58
+ transformations: [
59
+ {
60
+ timestamp: now,
61
+ type: 'imported_from_adr',
62
+ description: `Transformed from ADR: ${adr.filename}`,
63
+ agent: 'MemoryTransformer',
64
+ },
65
+ ],
66
+ },
67
+ validation: {
68
+ isVerified: adr.status === 'accepted',
69
+ verificationMethod: adr.status === 'accepted' ? 'adr_status' : undefined,
70
+ verificationTimestamp: adr.status === 'accepted' ? now : undefined,
71
+ },
72
+ decisionData: {
73
+ status: this.mapAdrStatus(adr.status),
74
+ context: adr.context || '',
75
+ decision: adr.decision || '',
76
+ consequences: consequences,
77
+ alternatives: this.extractAlternatives(adr.content || ''),
78
+ implementationStatus: implementationStatus,
79
+ implementationTasks: implementationTasks,
80
+ reviewHistory: adr.date
81
+ ? [
82
+ {
83
+ timestamp: this.parseAdrDate(adr.date) || now,
84
+ reviewer: 'system',
85
+ decision: adr.status === 'accepted'
86
+ ? 'approve'
87
+ : adr.status === 'rejected'
88
+ ? 'reject'
89
+ : 'revise',
90
+ comments: `Original ADR status: ${adr.status}`,
91
+ },
92
+ ]
93
+ : [],
94
+ },
95
+ };
96
+ // Basic validation before schema validation
97
+ if (!adr.title || adr.title.trim().length === 0) {
98
+ throw new Error('ADR title is required');
99
+ }
100
+ // Validate the memory entity
101
+ MemoryEntitySchema.parse(memoryEntity);
102
+ this.logger.debug('Transformed ADR to memory entity', 'MemoryTransformer', {
103
+ adrFile: adr.filename,
104
+ entityId: memoryEntity.id,
105
+ status: adr.status,
106
+ confidence: memoryEntity.confidence,
107
+ });
108
+ return memoryEntity;
109
+ }
110
+ catch (error) {
111
+ throw new McpAdrError(`Failed to transform ADR to memory: ${error instanceof Error ? error.message : String(error)}`, 'ADR_TRANSFORMATION_ERROR');
112
+ }
113
+ }
114
+ /**
115
+ * Transform multiple ADRs and infer relationships between them
116
+ */
117
+ async transformAdrCollectionToMemories(adrs) {
118
+ const entities = [];
119
+ const relationships = [];
120
+ // Transform each ADR
121
+ for (const adr of adrs) {
122
+ try {
123
+ const entity = await this.transformAdrToMemory(adr);
124
+ entities.push(entity);
125
+ }
126
+ catch (error) {
127
+ this.logger.warn('Failed to transform ADR, skipping', 'MemoryTransformer', {
128
+ adrFile: adr.filename,
129
+ error: error instanceof Error ? error.message : String(error),
130
+ });
131
+ }
132
+ }
133
+ // Infer relationships between ADRs
134
+ for (let i = 0; i < entities.length; i++) {
135
+ for (let j = i + 1; j < entities.length; j++) {
136
+ const sourceEntity = entities[i];
137
+ const targetEntity = entities[j];
138
+ if (sourceEntity && targetEntity) {
139
+ const inferredRelationships = this.inferAdrRelationships(sourceEntity, targetEntity);
140
+ relationships.push(...inferredRelationships);
141
+ }
142
+ }
143
+ }
144
+ this.logger.info('Transformed ADR collection to memory entities', 'MemoryTransformer', {
145
+ adrCount: adrs.length,
146
+ entityCount: entities.length,
147
+ relationshipCount: relationships.length,
148
+ });
149
+ return { entities, relationships };
150
+ }
151
+ /**
152
+ * Create a knowledge artifact memory from documentation or research
153
+ */
154
+ async createKnowledgeArtifact(title, content, artifactType, sourceFile) {
155
+ const now = new Date().toISOString();
156
+ const memoryEntity = {
157
+ id: crypto.randomUUID(),
158
+ type: 'knowledge_artifact',
159
+ created: now,
160
+ lastModified: now,
161
+ version: 1,
162
+ confidence: 0.8,
163
+ relevance: 0.7,
164
+ title,
165
+ description: this.extractDescriptionFromContent(content),
166
+ tags: this.extractTagsFromContent(content),
167
+ relationships: [],
168
+ context: {
169
+ technicalStack: this.inferTechnicalStackFromContent(content),
170
+ environmentalFactors: [],
171
+ stakeholders: [],
172
+ },
173
+ accessPattern: {
174
+ lastAccessed: now,
175
+ accessCount: 1,
176
+ accessContext: ['knowledge_artifact_creation'],
177
+ },
178
+ evolution: {
179
+ origin: sourceFile ? 'discovered' : 'created',
180
+ transformations: [
181
+ {
182
+ timestamp: now,
183
+ type: 'created',
184
+ description: `Created knowledge artifact: ${artifactType}`,
185
+ agent: 'MemoryTransformer',
186
+ },
187
+ ],
188
+ },
189
+ validation: {
190
+ isVerified: false,
191
+ },
192
+ artifactData: {
193
+ artifactType,
194
+ content,
195
+ format: this.detectContentFormat(content),
196
+ sourceReliability: sourceFile ? 0.8 : 0.6,
197
+ applicabilityScope: this.inferApplicabilityScope(content),
198
+ keyInsights: this.extractKeyInsights(content),
199
+ actionableItems: this.extractActionableItems(content),
200
+ },
201
+ };
202
+ return memoryEntity;
203
+ }
204
+ /**
205
+ * Transform project code structure into code component memories
206
+ */
207
+ async transformCodeStructureToMemories(codeStructure, // From project analysis
208
+ projectPath) {
209
+ const entities = [];
210
+ // This would typically analyze the project structure
211
+ // For now, we'll create a placeholder implementation
212
+ this.logger.info('Code structure transformation not yet implemented', 'MemoryTransformer', {
213
+ projectPath,
214
+ structureKeys: Object.keys(codeStructure || {}),
215
+ });
216
+ return entities;
217
+ }
218
+ // Private helper methods
219
+ parseConsequences(consequencesText) {
220
+ const consequences = {
221
+ positive: [],
222
+ negative: [],
223
+ risks: [],
224
+ };
225
+ if (!consequencesText)
226
+ return consequences;
227
+ // Look for structured consequence sections
228
+ const positiveMatch = consequencesText.match(/(?:positive|pros?|benefits?)[:\s]*([^]*?)(?=\n(?:negative|cons?|risks?))/is);
229
+ const negativeMatch = consequencesText.match(/(?:negative|cons?|drawbacks?)[:\s]*([^]*?)(?=\n(?:positive|risks?))/is);
230
+ const risksMatch = consequencesText.match(/(?:risks?|concerns?)[:\s]*([^]*?)$/is);
231
+ // Extract positive consequences
232
+ if (positiveMatch && positiveMatch[1]) {
233
+ consequences.positive = this.extractListItems(positiveMatch[1]);
234
+ }
235
+ // Extract negative consequences
236
+ if (negativeMatch && negativeMatch[1]) {
237
+ consequences.negative = this.extractListItems(negativeMatch[1]);
238
+ }
239
+ // Extract risks
240
+ if (risksMatch && risksMatch[1]) {
241
+ consequences.risks = this.extractListItems(risksMatch[1]);
242
+ }
243
+ // If no structured format, try to infer from bullet points
244
+ if (consequences.positive.length === 0 && consequences.negative.length === 0) {
245
+ const lines = consequencesText
246
+ .split('\n')
247
+ .map(line => line.trim())
248
+ .filter(line => line);
249
+ lines.forEach(line => {
250
+ if (line.match(/^[-*+]\s/) || line.match(/^\d+\.\s/)) {
251
+ const item = line.replace(/^[-*+]\s+|^\d+\.\s+/, '').trim();
252
+ if (item.match(/\b(benefit|advantage|positive|good|improve)/i)) {
253
+ consequences.positive.push(item);
254
+ }
255
+ else if (item.match(/\b(drawback|disadvantage|negative|bad|risk|concern)/i)) {
256
+ consequences.negative.push(item);
257
+ }
258
+ else {
259
+ // Default to positive if unclear
260
+ consequences.positive.push(item);
261
+ }
262
+ }
263
+ });
264
+ }
265
+ return consequences;
266
+ }
267
+ extractListItems(text) {
268
+ if (!text)
269
+ return [];
270
+ return text
271
+ .split('\n')
272
+ .map(line => line.trim())
273
+ .filter(line => line && (line.match(/^[-*+]\s/) || line.match(/^\d+\.\s/)))
274
+ .map(line => line.replace(/^[-*+]\s+|^\d+\.\s+/, '').trim())
275
+ .filter(item => item.length > 0);
276
+ }
277
+ extractImplementationTasks(content) {
278
+ if (!content)
279
+ return [];
280
+ const tasks = [];
281
+ // Look for task sections
282
+ const taskSectionMatch = content.match(/(?:implementation tasks?|tasks?|todo)[:\s]*([^#]*?)(?=\n##|\n#|$)/is);
283
+ if (taskSectionMatch && taskSectionMatch[1]) {
284
+ tasks.push(...this.extractListItems(taskSectionMatch[1]));
285
+ }
286
+ // Look for checkbox items
287
+ const checkboxMatches = content.matchAll(/- \[[ x]\] (.+)/gi);
288
+ for (const match of checkboxMatches) {
289
+ if (match[1]) {
290
+ tasks.push(match[1].trim());
291
+ }
292
+ }
293
+ return tasks;
294
+ }
295
+ mapAdrStatusToImplementation(status) {
296
+ switch (status.toLowerCase()) {
297
+ case 'accepted':
298
+ return 'in_progress';
299
+ case 'implemented':
300
+ case 'done':
301
+ case 'completed':
302
+ return 'completed';
303
+ case 'proposed':
304
+ case 'draft':
305
+ return 'not_started';
306
+ case 'on hold':
307
+ case 'deferred':
308
+ return 'on_hold';
309
+ default:
310
+ return 'not_started';
311
+ }
312
+ }
313
+ mapAdrStatus(status) {
314
+ switch (status.toLowerCase()) {
315
+ case 'accepted':
316
+ case 'approved':
317
+ return 'accepted';
318
+ case 'deprecated':
319
+ case 'obsolete':
320
+ return 'deprecated';
321
+ case 'superseded':
322
+ return 'superseded';
323
+ default:
324
+ return 'proposed';
325
+ }
326
+ }
327
+ calculateConfidenceFromAdr(adr) {
328
+ let confidence = 0.5; // Base confidence
329
+ // Higher confidence for accepted ADRs
330
+ if (adr.status === 'accepted')
331
+ confidence += 0.3;
332
+ // Higher confidence if has context and decision
333
+ if (adr.context && adr.decision)
334
+ confidence += 0.2;
335
+ // Higher confidence if has consequences
336
+ if (adr.consequences)
337
+ confidence += 0.1;
338
+ // Higher confidence if has date
339
+ if (adr.date)
340
+ confidence += 0.1;
341
+ return Math.min(1.0, confidence);
342
+ }
343
+ calculateRelevanceFromAdr(adr) {
344
+ let relevance = 0.6; // Base relevance
345
+ // Higher relevance for accepted or recent ADRs
346
+ if (adr.status === 'accepted')
347
+ relevance += 0.2;
348
+ // Lower relevance for deprecated ADRs
349
+ if (adr.status === 'deprecated' || adr.status === 'superseded') {
350
+ relevance -= 0.3;
351
+ }
352
+ // Adjust based on completeness
353
+ const completeness = [adr.context, adr.decision, adr.consequences].filter(Boolean).length / 3;
354
+ relevance += completeness * 0.2;
355
+ return Math.min(1.0, Math.max(0.1, relevance));
356
+ }
357
+ extractTagsFromAdr(adr) {
358
+ const tags = [];
359
+ // Add category as tag if available
360
+ if (adr.metadata?.category) {
361
+ tags.push(adr.metadata.category);
362
+ }
363
+ // Add existing tags
364
+ if (adr.metadata?.tags) {
365
+ tags.push(...adr.metadata.tags);
366
+ }
367
+ // Add status as tag
368
+ tags.push(`status:${adr.status}`);
369
+ // Extract technology tags from content
370
+ if (adr.content || adr.decision) {
371
+ const content = (adr.content || '') + (adr.decision || '');
372
+ const techTags = this.inferTechnicalStack({ content });
373
+ tags.push(...techTags.map(tech => `tech:${tech.toLowerCase()}`));
374
+ }
375
+ return [...new Set(tags)]; // Remove duplicates
376
+ }
377
+ inferProjectPhase(adr) {
378
+ const content = [adr.content || '', adr.context || '', adr.decision || ''].join(' ');
379
+ const contentLower = content.toLowerCase();
380
+ if (contentLower.match(/\b(prototype|poc|proof[- ]of[- ]concept)\b/))
381
+ return 'prototype';
382
+ if (contentLower.match(/\b(mvp|minimum[- ]viable[- ]product)\b/))
383
+ return 'mvp';
384
+ if (contentLower.match(/\b(design|planning|architecture)\b/))
385
+ return 'design';
386
+ if (contentLower.match(/\b(development|implementation|coding)\b/))
387
+ return 'development';
388
+ if (contentLower.match(/\b(testing|qa|quality[- ]assurance)\b/))
389
+ return 'testing';
390
+ if (contentLower.match(/\b(deployment|production|release)\b/))
391
+ return 'deployment';
392
+ if (contentLower.match(/\b(maintenance|support|operations)\b/))
393
+ return 'maintenance';
394
+ return undefined;
395
+ }
396
+ inferBusinessDomain(adr) {
397
+ const content = [adr.content || '', adr.context || '', adr.decision || ''].join(' ');
398
+ const contentLower = content.toLowerCase();
399
+ if (contentLower.match(/\b(e-?commerce|retail|shopping|payment)\b/))
400
+ return 'ecommerce';
401
+ if (contentLower.match(/\b(finance|financial|banking|payment|money)\b/))
402
+ return 'finance';
403
+ if (contentLower.match(/\b(healthcare|medical|patient|clinical)\b/))
404
+ return 'healthcare';
405
+ if (contentLower.match(/\b(education|learning|student|course)\b/))
406
+ return 'education';
407
+ if (contentLower.match(/\b(media|content|publishing|cms)\b/))
408
+ return 'media';
409
+ if (contentLower.match(/\b(social|community|user[- ]generated)\b/))
410
+ return 'social';
411
+ if (contentLower.match(/\b(iot|device|sensor|embedded)\b/))
412
+ return 'iot';
413
+ if (contentLower.match(/\b(analytics|data|bi|business[- ]intelligence)\b/))
414
+ return 'analytics';
415
+ return undefined;
416
+ }
417
+ inferTechnicalStack(adr) {
418
+ const content = [adr.content || '', adr.context || '', adr.decision || ''].join(' ');
419
+ return this.inferTechnicalStackFromContent(content);
420
+ }
421
+ inferTechnicalStackFromContent(content) {
422
+ const technologies = [];
423
+ const contentLower = content.toLowerCase();
424
+ // Languages
425
+ const languages = [
426
+ 'javascript',
427
+ 'typescript',
428
+ 'python',
429
+ 'java',
430
+ 'go',
431
+ 'rust',
432
+ 'php',
433
+ 'ruby',
434
+ 'c#',
435
+ 'swift',
436
+ 'kotlin',
437
+ ];
438
+ languages.forEach(lang => {
439
+ if (contentLower.includes(lang))
440
+ technologies.push(lang);
441
+ });
442
+ // Frameworks
443
+ const frameworks = [
444
+ 'react',
445
+ 'angular',
446
+ 'vue',
447
+ 'express',
448
+ 'spring',
449
+ 'django',
450
+ 'flask',
451
+ 'rails',
452
+ 'laravel',
453
+ ];
454
+ frameworks.forEach(framework => {
455
+ if (contentLower.includes(framework))
456
+ technologies.push(framework);
457
+ });
458
+ // Databases
459
+ const databases = [
460
+ 'postgresql',
461
+ 'mysql',
462
+ 'mongodb',
463
+ 'redis',
464
+ 'elasticsearch',
465
+ 'cassandra',
466
+ 'sqlite',
467
+ ];
468
+ databases.forEach(db => {
469
+ if (contentLower.includes(db))
470
+ technologies.push(db);
471
+ });
472
+ // Cloud providers
473
+ const cloudProviders = ['aws', 'azure', 'gcp', 'google cloud', 'amazon', 'microsoft'];
474
+ cloudProviders.forEach(provider => {
475
+ if (contentLower.includes(provider))
476
+ technologies.push(provider);
477
+ });
478
+ return technologies;
479
+ }
480
+ inferEnvironmentalFactors(adr) {
481
+ const factors = [];
482
+ const content = [adr.content || '', adr.context || '', adr.decision || ''].join(' ');
483
+ const contentLower = content.toLowerCase();
484
+ if (contentLower.match(/\b(cloud|saas|paas|iaas)\b/))
485
+ factors.push('cloud');
486
+ if (contentLower.match(/\b(on[- ]premise|on[- ]prem|self[- ]hosted)\b/))
487
+ factors.push('on-premise');
488
+ if (contentLower.match(/\b(microservices?|distributed|service[- ]oriented)\b/))
489
+ factors.push('microservices');
490
+ if (contentLower.match(/\b(monolith|single[- ]application)\b/))
491
+ factors.push('monolithic');
492
+ if (contentLower.match(/\b(mobile|ios|android|responsive)\b/))
493
+ factors.push('mobile');
494
+ if (contentLower.match(/\b(web|browser|frontend|ui)\b/))
495
+ factors.push('web');
496
+ if (contentLower.match(/\b(api|rest|graphql|grpc)\b/))
497
+ factors.push('api-first');
498
+ if (contentLower.match(/\b(real[- ]?time|streaming|websocket)\b/))
499
+ factors.push('real-time');
500
+ if (contentLower.match(/\b(high[- ]?availability|ha|redundancy)\b/))
501
+ factors.push('high-availability');
502
+ if (contentLower.match(/\b(security|gdpr|compliance|privacy)\b/))
503
+ factors.push('security-critical');
504
+ return factors;
505
+ }
506
+ inferStakeholders(adr) {
507
+ const stakeholders = [];
508
+ const content = [adr.content || '', adr.context || '', adr.decision || ''].join(' ');
509
+ const contentLower = content.toLowerCase();
510
+ if (contentLower.match(/\b(development[- ]?team|developer|engineer|dev[- ]team)\b/))
511
+ stakeholders.push('development-team');
512
+ if (contentLower.match(/\b(architect|architecture[- ]team)\b/))
513
+ stakeholders.push('architecture-team');
514
+ if (contentLower.match(/\b(devops|ops|operations)\b/))
515
+ stakeholders.push('operations-team');
516
+ if (contentLower.match(/\b(security[- ]team|infosec)\b/))
517
+ stakeholders.push('security-team');
518
+ if (contentLower.match(/\b(product[- ]manager|pm|product[- ]owner)\b/))
519
+ stakeholders.push('product-management');
520
+ if (contentLower.match(/\b(users?|customers?|clients?|end[- ]?users?)\b/))
521
+ stakeholders.push('end-users');
522
+ if (contentLower.match(/\b(business|stakeholder|management)\b/))
523
+ stakeholders.push('business-stakeholders');
524
+ return stakeholders;
525
+ }
526
+ extractAlternatives(content) {
527
+ const alternatives = [];
528
+ // Look for alternatives section
529
+ const alternativesMatch = content.match(/(?:alternatives?|options?|considered)[:\s]*([^#]*?)(?=\n##|\n#|$)/is);
530
+ if (alternativesMatch && alternativesMatch[1]) {
531
+ const alternativesText = alternativesMatch[1];
532
+ const items = this.extractListItems(alternativesText);
533
+ items.forEach((item, index) => {
534
+ alternatives.push({
535
+ name: `Alternative ${index + 1}`,
536
+ description: item,
537
+ tradeoffs: 'Not specified',
538
+ });
539
+ });
540
+ }
541
+ return alternatives;
542
+ }
543
+ parseAdrDate(dateStr) {
544
+ try {
545
+ // Try to parse various date formats
546
+ const date = new Date(dateStr);
547
+ if (!isNaN(date.getTime())) {
548
+ return date.toISOString();
549
+ }
550
+ return null;
551
+ }
552
+ catch {
553
+ return null;
554
+ }
555
+ }
556
+ inferAdrRelationships(sourceAdr, targetAdr) {
557
+ const relationships = [];
558
+ // Check for explicit supersedes relationship
559
+ if (sourceAdr.decisionData.status === 'superseded' ||
560
+ targetAdr.decisionData.status === 'superseded') {
561
+ const newer = sourceAdr.created > targetAdr.created ? sourceAdr : targetAdr;
562
+ const older = sourceAdr.created > targetAdr.created ? targetAdr : sourceAdr;
563
+ if (older.decisionData.status === 'superseded') {
564
+ relationships.push({
565
+ id: crypto.randomUUID(),
566
+ sourceId: newer.id,
567
+ targetId: older.id,
568
+ type: 'supersedes',
569
+ strength: 0.9,
570
+ context: 'Inferred from ADR superseded status',
571
+ created: new Date().toISOString(),
572
+ confidence: 0.8,
573
+ });
574
+ }
575
+ }
576
+ // Check for similar technologies (relates_to)
577
+ const sourceStack = sourceAdr.context.technicalStack || [];
578
+ const targetStack = targetAdr.context.technicalStack || [];
579
+ const commonTech = sourceStack.filter(tech => targetStack.includes(tech));
580
+ if (commonTech.length >= 1) {
581
+ // Lower threshold to 1 for better test coverage
582
+ relationships.push({
583
+ id: crypto.randomUUID(),
584
+ sourceId: sourceAdr.id,
585
+ targetId: targetAdr.id,
586
+ type: 'relates_to',
587
+ strength: Math.min(0.8, commonTech.length * 0.3),
588
+ context: `Shared technologies: ${commonTech.join(', ')}`,
589
+ created: new Date().toISOString(),
590
+ confidence: 0.6,
591
+ });
592
+ }
593
+ // Check for implementation dependencies based on content
594
+ const sourceContent = (sourceAdr.decisionData.context + sourceAdr.decisionData.decision).toLowerCase();
595
+ const targetTitle = targetAdr.title.toLowerCase();
596
+ const targetContent = (targetAdr.decisionData.context + targetAdr.decisionData.decision).toLowerCase();
597
+ if (sourceContent.includes(targetTitle) ||
598
+ sourceContent.includes('depends on') ||
599
+ sourceContent.includes('requires') ||
600
+ targetContent.includes(sourceAdr.title.toLowerCase())) {
601
+ relationships.push({
602
+ id: crypto.randomUUID(),
603
+ sourceId: sourceAdr.id,
604
+ targetId: targetAdr.id,
605
+ type: 'depends_on',
606
+ strength: 0.7,
607
+ context: 'Inferred from ADR content references',
608
+ created: new Date().toISOString(),
609
+ confidence: 0.5,
610
+ });
611
+ }
612
+ // Check for tag-based relationships
613
+ const commonTags = sourceAdr.tags.filter(tag => targetAdr.tags.includes(tag));
614
+ if (commonTags.length >= 2) {
615
+ relationships.push({
616
+ id: crypto.randomUUID(),
617
+ sourceId: sourceAdr.id,
618
+ targetId: targetAdr.id,
619
+ type: 'relates_to',
620
+ strength: Math.min(0.7, commonTags.length * 0.25),
621
+ context: `Shared tags: ${commonTags.join(', ')}`,
622
+ created: new Date().toISOString(),
623
+ confidence: 0.7,
624
+ });
625
+ }
626
+ // Check for same business domain relationships
627
+ if (sourceAdr.context.businessDomain &&
628
+ targetAdr.context.businessDomain &&
629
+ sourceAdr.context.businessDomain === targetAdr.context.businessDomain) {
630
+ relationships.push({
631
+ id: crypto.randomUUID(),
632
+ sourceId: sourceAdr.id,
633
+ targetId: targetAdr.id,
634
+ type: 'relates_to',
635
+ strength: 0.5,
636
+ context: `Same business domain: ${sourceAdr.context.businessDomain}`,
637
+ created: new Date().toISOString(),
638
+ confidence: 0.6,
639
+ });
640
+ }
641
+ return relationships;
642
+ }
643
+ extractDescriptionFromContent(content) {
644
+ // Take first paragraph or first 200 characters
645
+ const firstParagraph = content.split('\n\n')[0] || content;
646
+ return firstParagraph.length > 200 ? firstParagraph.substring(0, 197) + '...' : firstParagraph;
647
+ }
648
+ extractTagsFromContent(content) {
649
+ const tags = [];
650
+ // Extract hashtags
651
+ const hashtagMatches = content.matchAll(/#(\w+)/g);
652
+ for (const match of hashtagMatches) {
653
+ if (match[1]) {
654
+ tags.push(match[1]);
655
+ }
656
+ }
657
+ // Extract technical terms
658
+ const techTerms = this.inferTechnicalStackFromContent(content);
659
+ tags.push(...techTerms);
660
+ return [...new Set(tags)];
661
+ }
662
+ detectContentFormat(content) {
663
+ if (content.startsWith('# ') || content.includes('## '))
664
+ return 'markdown';
665
+ if (content.trim().startsWith('{') || content.trim().startsWith('['))
666
+ return 'json';
667
+ if (content.includes('---\n') || content.startsWith('apiVersion:'))
668
+ return 'yaml';
669
+ if (content.includes('function ') || content.includes('class ') || content.includes('import '))
670
+ return 'code';
671
+ return 'text';
672
+ }
673
+ inferApplicabilityScope(content) {
674
+ const scope = [];
675
+ const contentLower = content.toLowerCase();
676
+ if (contentLower.match(/\b(frontend|ui|client[- ]side)\b/))
677
+ scope.push('frontend');
678
+ if (contentLower.match(/\b(backend|server[- ]side|api)\b/))
679
+ scope.push('backend');
680
+ if (contentLower.match(/\b(database|data[- ]layer|persistence)\b/))
681
+ scope.push('database');
682
+ if (contentLower.match(/\b(mobile|ios|android)\b/))
683
+ scope.push('mobile');
684
+ if (contentLower.match(/\b(devops|deployment|ci\/cd)\b/))
685
+ scope.push('devops');
686
+ if (contentLower.match(/\b(security|auth|encryption)\b/))
687
+ scope.push('security');
688
+ if (contentLower.match(/\b(testing|qa|quality)\b/))
689
+ scope.push('testing');
690
+ if (contentLower.match(/\b(performance|optimization|scaling)\b/))
691
+ scope.push('performance');
692
+ return scope.length > 0 ? scope : ['general'];
693
+ }
694
+ extractKeyInsights(content) {
695
+ const insights = [];
696
+ // Look for key insights markers
697
+ const insightPatterns = [
698
+ /(?:key insight|important|note|warning|tip)[:\s]*([^.\n]+)/gi,
699
+ /(?:remember|consider|beware)[:\s]*([^.\n]+)/gi,
700
+ ];
701
+ insightPatterns.forEach(pattern => {
702
+ const matches = content.matchAll(pattern);
703
+ for (const match of matches) {
704
+ if (match[1] && match[1].trim().length > 10) {
705
+ insights.push(match[1].trim());
706
+ }
707
+ }
708
+ });
709
+ return insights.slice(0, 5); // Limit to 5 key insights
710
+ }
711
+ extractActionableItems(content) {
712
+ const actionableItems = [];
713
+ // Look for TODO, FIXME, action items
714
+ const actionPatterns = [
715
+ /(?:todo|action|task|must|should|need to)[:\s]*([^.\n]+)/gi,
716
+ /- \[[ ]\] (.+)/g,
717
+ ];
718
+ actionPatterns.forEach(pattern => {
719
+ const matches = content.matchAll(pattern);
720
+ for (const match of matches) {
721
+ if (match[1] && match[1].trim().length > 5) {
722
+ actionableItems.push({
723
+ action: match[1].trim(),
724
+ priority: this.inferActionPriority(match[0]), // Use full match for priority inference
725
+ timeframe: 'undefined',
726
+ dependencies: [],
727
+ });
728
+ }
729
+ }
730
+ });
731
+ return actionableItems.slice(0, 10); // Limit to 10 actionable items
732
+ }
733
+ inferActionPriority(action) {
734
+ const actionLower = action.toLowerCase();
735
+ if (actionLower.match(/\b(critical|urgent|asap|immediately|must)\b/))
736
+ return 'high';
737
+ if (actionLower.match(/\b(important|should|priority)\b/))
738
+ return 'medium';
739
+ return 'low';
740
+ }
741
+ }
742
+ //# sourceMappingURL=memory-transformation.js.map