lean-claudient-core 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 (507) hide show
  1. package/.reports/detailed-analysis_2026-06-20_01ed326b.html +200 -0
  2. package/.reports/detailed-analysis_2026-06-20_08d39381.html +200 -0
  3. package/.reports/detailed-analysis_2026-06-20_0a331144.html +200 -0
  4. package/.reports/detailed-analysis_2026-06-20_0d54ffef.html +200 -0
  5. package/.reports/detailed-analysis_2026-06-20_14bfa31c.html +200 -0
  6. package/.reports/detailed-analysis_2026-06-20_211feac4.html +200 -0
  7. package/.reports/detailed-analysis_2026-06-20_22381bc2.html +200 -0
  8. package/.reports/detailed-analysis_2026-06-20_29b4ea0a.html +200 -0
  9. package/.reports/detailed-analysis_2026-06-20_2df0ad14.html +200 -0
  10. package/.reports/detailed-analysis_2026-06-20_343ec84c.html +200 -0
  11. package/.reports/detailed-analysis_2026-06-20_3a01030d.html +200 -0
  12. package/.reports/detailed-analysis_2026-06-20_3b4c99ec.html +200 -0
  13. package/.reports/detailed-analysis_2026-06-20_3d368827.html +200 -0
  14. package/.reports/detailed-analysis_2026-06-20_53544d3d.html +200 -0
  15. package/.reports/detailed-analysis_2026-06-20_5721164a.html +200 -0
  16. package/.reports/detailed-analysis_2026-06-20_57caf5e7.html +200 -0
  17. package/.reports/detailed-analysis_2026-06-20_624302f5.html +200 -0
  18. package/.reports/detailed-analysis_2026-06-20_62456384.html +200 -0
  19. package/.reports/detailed-analysis_2026-06-20_636a52f1.html +200 -0
  20. package/.reports/detailed-analysis_2026-06-20_63d1ad41.html +200 -0
  21. package/.reports/detailed-analysis_2026-06-20_7451ccd7.html +200 -0
  22. package/.reports/detailed-analysis_2026-06-20_74da4e9a.html +200 -0
  23. package/.reports/detailed-analysis_2026-06-20_83a90083.html +200 -0
  24. package/.reports/detailed-analysis_2026-06-20_867fbdd9.html +200 -0
  25. package/.reports/detailed-analysis_2026-06-20_974c3299.html +200 -0
  26. package/.reports/detailed-analysis_2026-06-20_a04639a2.html +200 -0
  27. package/.reports/detailed-analysis_2026-06-20_a8e23d6d.html +200 -0
  28. package/.reports/detailed-analysis_2026-06-20_aa9150f0.html +200 -0
  29. package/.reports/detailed-analysis_2026-06-20_acbeee08.html +200 -0
  30. package/.reports/detailed-analysis_2026-06-20_c4ffa0e2.html +200 -0
  31. package/.reports/detailed-analysis_2026-06-20_c5f7684b.html +200 -0
  32. package/.reports/detailed-analysis_2026-06-20_c963b1fa.html +200 -0
  33. package/.reports/detailed-analysis_2026-06-20_d4bde41f.html +200 -0
  34. package/.reports/detailed-analysis_2026-06-20_d6eb2497.html +200 -0
  35. package/.reports/detailed-analysis_2026-06-20_ea6f7f58.html +200 -0
  36. package/.reports/detailed-analysis_2026-06-20_ebf4e060.html +200 -0
  37. package/.reports/detailed-analysis_2026-06-20_ec4313a9.html +200 -0
  38. package/.reports/detailed-analysis_2026-06-20_fc65d18e.html +200 -0
  39. package/.reports/executive-summary_2026-06-20_00406d50.html +109 -0
  40. package/.reports/executive-summary_2026-06-20_0bb202d3.html +109 -0
  41. package/.reports/executive-summary_2026-06-20_0bcd7481.html +109 -0
  42. package/.reports/executive-summary_2026-06-20_11506445.html +109 -0
  43. package/.reports/executive-summary_2026-06-20_13616cda.html +109 -0
  44. package/.reports/executive-summary_2026-06-20_19d41c2f.html +109 -0
  45. package/.reports/executive-summary_2026-06-20_1b0d6e96.html +109 -0
  46. package/.reports/executive-summary_2026-06-20_1e38670b.html +109 -0
  47. package/.reports/executive-summary_2026-06-20_1f32f793.html +109 -0
  48. package/.reports/executive-summary_2026-06-20_1f40f7d3.html +109 -0
  49. package/.reports/executive-summary_2026-06-20_25a40a7e.html +109 -0
  50. package/.reports/executive-summary_2026-06-20_26d11818.html +109 -0
  51. package/.reports/executive-summary_2026-06-20_26ed4593.html +109 -0
  52. package/.reports/executive-summary_2026-06-20_291b90a8.html +109 -0
  53. package/.reports/executive-summary_2026-06-20_2957a848.html +109 -0
  54. package/.reports/executive-summary_2026-06-20_2a04eb77.html +109 -0
  55. package/.reports/executive-summary_2026-06-20_2fa701f9.html +109 -0
  56. package/.reports/executive-summary_2026-06-20_327af8f5.html +109 -0
  57. package/.reports/executive-summary_2026-06-20_3418c729.html +109 -0
  58. package/.reports/executive-summary_2026-06-20_3571763d.html +109 -0
  59. package/.reports/executive-summary_2026-06-20_36225353.html +109 -0
  60. package/.reports/executive-summary_2026-06-20_3b2de891.html +109 -0
  61. package/.reports/executive-summary_2026-06-20_45b980c2.html +109 -0
  62. package/.reports/executive-summary_2026-06-20_46fcbf17.html +109 -0
  63. package/.reports/executive-summary_2026-06-20_48c8fa5e.html +109 -0
  64. package/.reports/executive-summary_2026-06-20_4ba55c43.html +109 -0
  65. package/.reports/executive-summary_2026-06-20_4f4498e6.html +109 -0
  66. package/.reports/executive-summary_2026-06-20_54c33bf0.html +109 -0
  67. package/.reports/executive-summary_2026-06-20_54cc7077.html +109 -0
  68. package/.reports/executive-summary_2026-06-20_5a12912e.html +109 -0
  69. package/.reports/executive-summary_2026-06-20_636fac87.html +109 -0
  70. package/.reports/executive-summary_2026-06-20_6587faaf.html +109 -0
  71. package/.reports/executive-summary_2026-06-20_6adbdd03.html +109 -0
  72. package/.reports/executive-summary_2026-06-20_6bf344ec.html +109 -0
  73. package/.reports/executive-summary_2026-06-20_7142aeed.html +109 -0
  74. package/.reports/executive-summary_2026-06-20_72bc0ceb.html +109 -0
  75. package/.reports/executive-summary_2026-06-20_775752ac.html +109 -0
  76. package/.reports/executive-summary_2026-06-20_7a9c3223.html +109 -0
  77. package/.reports/executive-summary_2026-06-20_808e6376.html +109 -0
  78. package/.reports/executive-summary_2026-06-20_8de9142d.html +109 -0
  79. package/.reports/executive-summary_2026-06-20_91981fbe.html +109 -0
  80. package/.reports/executive-summary_2026-06-20_93191c8c.html +109 -0
  81. package/.reports/executive-summary_2026-06-20_9be48a87.html +109 -0
  82. package/.reports/executive-summary_2026-06-20_9c127198.html +109 -0
  83. package/.reports/executive-summary_2026-06-20_9ee303ac.html +109 -0
  84. package/.reports/executive-summary_2026-06-20_9ee52709.html +109 -0
  85. package/.reports/executive-summary_2026-06-20_a0fa27de.html +109 -0
  86. package/.reports/executive-summary_2026-06-20_a1813e47.html +109 -0
  87. package/.reports/executive-summary_2026-06-20_a974edc1.html +109 -0
  88. package/.reports/executive-summary_2026-06-20_aa711737.html +109 -0
  89. package/.reports/executive-summary_2026-06-20_aa752246.html +109 -0
  90. package/.reports/executive-summary_2026-06-20_ac6f0927.html +109 -0
  91. package/.reports/executive-summary_2026-06-20_b231b143.html +109 -0
  92. package/.reports/executive-summary_2026-06-20_b570a2bd.html +109 -0
  93. package/.reports/executive-summary_2026-06-20_b6fbf650.html +109 -0
  94. package/.reports/executive-summary_2026-06-20_b9f8ddf3.html +109 -0
  95. package/.reports/executive-summary_2026-06-20_bf95cc63.html +109 -0
  96. package/.reports/executive-summary_2026-06-20_c0d0aefe.html +109 -0
  97. package/.reports/executive-summary_2026-06-20_c1933c36.html +109 -0
  98. package/.reports/executive-summary_2026-06-20_c99bba8a.html +109 -0
  99. package/.reports/executive-summary_2026-06-20_cc3846ac.html +109 -0
  100. package/.reports/executive-summary_2026-06-20_d485993c.html +109 -0
  101. package/.reports/executive-summary_2026-06-20_d56f75f7.html +109 -0
  102. package/.reports/executive-summary_2026-06-20_d57660cc.html +109 -0
  103. package/.reports/executive-summary_2026-06-20_dc036f62.html +109 -0
  104. package/.reports/executive-summary_2026-06-20_df783f47.html +109 -0
  105. package/.reports/executive-summary_2026-06-20_e2191adb.html +109 -0
  106. package/.reports/executive-summary_2026-06-20_e9f1d504.html +109 -0
  107. package/.reports/executive-summary_2026-06-20_ea82f5e1.html +109 -0
  108. package/.reports/executive-summary_2026-06-20_ec3e70cb.html +109 -0
  109. package/.reports/executive-summary_2026-06-20_ee6cf902.html +109 -0
  110. package/.reports/executive-summary_2026-06-20_f6cb657c.html +109 -0
  111. package/.reports/executive-summary_2026-06-20_f8c60046.html +109 -0
  112. package/.reports/executive-summary_2026-06-20_fa184840.html +109 -0
  113. package/.reports/executive-summary_2026-06-20_fc88bcb4.html +109 -0
  114. package/.reports/executive-summary_2026-06-20_ffa79c4e.html +109 -0
  115. package/README.md +53 -0
  116. package/dist/automation/actionApprover.d.ts +89 -0
  117. package/dist/automation/actionApprover.d.ts.map +1 -0
  118. package/dist/automation/actionApprover.js +264 -0
  119. package/dist/automation/actionApprover.js.map +1 -0
  120. package/dist/automation/actionExecutor.d.ts +125 -0
  121. package/dist/automation/actionExecutor.d.ts.map +1 -0
  122. package/dist/automation/actionExecutor.js +304 -0
  123. package/dist/automation/actionExecutor.js.map +1 -0
  124. package/dist/automation/alertRules.d.ts +55 -0
  125. package/dist/automation/alertRules.d.ts.map +1 -0
  126. package/dist/automation/alertRules.js +70 -0
  127. package/dist/automation/alertRules.js.map +1 -0
  128. package/dist/automation/alertSystem.d.ts +109 -0
  129. package/dist/automation/alertSystem.d.ts.map +1 -0
  130. package/dist/automation/alertSystem.js +303 -0
  131. package/dist/automation/alertSystem.js.map +1 -0
  132. package/dist/automation/competitorResponse.d.ts +119 -0
  133. package/dist/automation/competitorResponse.d.ts.map +1 -0
  134. package/dist/automation/competitorResponse.js +343 -0
  135. package/dist/automation/competitorResponse.js.map +1 -0
  136. package/dist/automation/composioClient.d.ts +107 -0
  137. package/dist/automation/composioClient.d.ts.map +1 -0
  138. package/dist/automation/composioClient.js +286 -0
  139. package/dist/automation/composioClient.js.map +1 -0
  140. package/dist/automation/crmExport.d.ts +116 -0
  141. package/dist/automation/crmExport.d.ts.map +1 -0
  142. package/dist/automation/crmExport.js +282 -0
  143. package/dist/automation/crmExport.js.map +1 -0
  144. package/dist/automation/crmIntegration.d.ts +83 -0
  145. package/dist/automation/crmIntegration.d.ts.map +1 -0
  146. package/dist/automation/crmIntegration.js +207 -0
  147. package/dist/automation/crmIntegration.js.map +1 -0
  148. package/dist/automation/gmailIntegration.d.ts +73 -0
  149. package/dist/automation/gmailIntegration.d.ts.map +1 -0
  150. package/dist/automation/gmailIntegration.js +184 -0
  151. package/dist/automation/gmailIntegration.js.map +1 -0
  152. package/dist/automation/index.d.ts +17 -0
  153. package/dist/automation/index.d.ts.map +1 -0
  154. package/dist/automation/index.js +17 -0
  155. package/dist/automation/index.js.map +1 -0
  156. package/dist/automation/jiraIntegration.d.ts +103 -0
  157. package/dist/automation/jiraIntegration.d.ts.map +1 -0
  158. package/dist/automation/jiraIntegration.js +222 -0
  159. package/dist/automation/jiraIntegration.js.map +1 -0
  160. package/dist/automation/jobQueue.d.ts +98 -0
  161. package/dist/automation/jobQueue.d.ts.map +1 -0
  162. package/dist/automation/jobQueue.js +207 -0
  163. package/dist/automation/jobQueue.js.map +1 -0
  164. package/dist/automation/leadQualification.d.ts +60 -0
  165. package/dist/automation/leadQualification.d.ts.map +1 -0
  166. package/dist/automation/leadQualification.js +204 -0
  167. package/dist/automation/leadQualification.js.map +1 -0
  168. package/dist/automation/qualificationRules.d.ts +100 -0
  169. package/dist/automation/qualificationRules.d.ts.map +1 -0
  170. package/dist/automation/qualificationRules.js +202 -0
  171. package/dist/automation/qualificationRules.js.map +1 -0
  172. package/dist/automation/responseTemplates.d.ts +64 -0
  173. package/dist/automation/responseTemplates.d.ts.map +1 -0
  174. package/dist/automation/responseTemplates.js +374 -0
  175. package/dist/automation/responseTemplates.js.map +1 -0
  176. package/dist/automation/scheduler.d.ts +85 -0
  177. package/dist/automation/scheduler.d.ts.map +1 -0
  178. package/dist/automation/scheduler.js +194 -0
  179. package/dist/automation/scheduler.js.map +1 -0
  180. package/dist/automation/types.d.ts +223 -0
  181. package/dist/automation/types.d.ts.map +1 -0
  182. package/dist/automation/types.js +32 -0
  183. package/dist/automation/types.js.map +1 -0
  184. package/dist/cli/index.d.ts +3 -0
  185. package/dist/cli/index.d.ts.map +1 -0
  186. package/dist/cli/index.js +575 -0
  187. package/dist/cli/index.js.map +1 -0
  188. package/dist/compression/caveman.d.ts +14 -0
  189. package/dist/compression/caveman.d.ts.map +1 -0
  190. package/dist/compression/caveman.js +188 -0
  191. package/dist/compression/caveman.js.map +1 -0
  192. package/dist/compression/caveman.test.d.ts +2 -0
  193. package/dist/compression/caveman.test.d.ts.map +1 -0
  194. package/dist/compression/caveman.test.js.map +1 -0
  195. package/dist/config/configManager.d.ts +6 -0
  196. package/dist/config/configManager.d.ts.map +1 -0
  197. package/dist/config/configManager.js +62 -0
  198. package/dist/config/configManager.js.map +1 -0
  199. package/dist/config/schema.d.ts +95 -0
  200. package/dist/config/schema.d.ts.map +1 -0
  201. package/dist/config/schema.js +19 -0
  202. package/dist/config/schema.js.map +1 -0
  203. package/dist/context/autoCompact.d.ts +19 -0
  204. package/dist/context/autoCompact.d.ts.map +1 -0
  205. package/dist/context/autoCompact.js +101 -0
  206. package/dist/context/autoCompact.js.map +1 -0
  207. package/dist/context/readDedup.d.ts +21 -0
  208. package/dist/context/readDedup.d.ts.map +1 -0
  209. package/dist/context/readDedup.js +55 -0
  210. package/dist/context/readDedup.js.map +1 -0
  211. package/dist/context/toolBudgets.d.ts +15 -0
  212. package/dist/context/toolBudgets.d.ts.map +1 -0
  213. package/dist/context/toolBudgets.js +35 -0
  214. package/dist/context/toolBudgets.js.map +1 -0
  215. package/dist/core/auditLogger.d.ts +30 -0
  216. package/dist/core/auditLogger.d.ts.map +1 -0
  217. package/dist/core/auditLogger.js +51 -0
  218. package/dist/core/auditLogger.js.map +1 -0
  219. package/dist/core/stateManager.d.ts +10 -0
  220. package/dist/core/stateManager.d.ts.map +1 -0
  221. package/dist/core/stateManager.js +59 -0
  222. package/dist/core/stateManager.js.map +1 -0
  223. package/dist/database/feedbackSchema.d.ts +80 -0
  224. package/dist/database/feedbackSchema.d.ts.map +1 -0
  225. package/dist/database/feedbackSchema.js +94 -0
  226. package/dist/database/feedbackSchema.js.map +1 -0
  227. package/dist/database/leadsSchema.d.ts +99 -0
  228. package/dist/database/leadsSchema.d.ts.map +1 -0
  229. package/dist/database/leadsSchema.js +136 -0
  230. package/dist/database/leadsSchema.js.map +1 -0
  231. package/dist/intelligence/competitorScoring.d.ts +25 -0
  232. package/dist/intelligence/competitorScoring.d.ts.map +1 -0
  233. package/dist/intelligence/competitorScoring.js +181 -0
  234. package/dist/intelligence/competitorScoring.js.map +1 -0
  235. package/dist/intelligence/competitorTracker.d.ts +36 -0
  236. package/dist/intelligence/competitorTracker.d.ts.map +1 -0
  237. package/dist/intelligence/competitorTracker.js +286 -0
  238. package/dist/intelligence/competitorTracker.js.map +1 -0
  239. package/dist/intelligence/competitorTypes.d.ts +93 -0
  240. package/dist/intelligence/competitorTypes.d.ts.map +1 -0
  241. package/dist/intelligence/competitorTypes.js +6 -0
  242. package/dist/intelligence/competitorTypes.js.map +1 -0
  243. package/dist/intelligence/competitors.json +76 -0
  244. package/dist/intelligence/feedbackLoop.d.ts +118 -0
  245. package/dist/intelligence/feedbackLoop.d.ts.map +1 -0
  246. package/dist/intelligence/feedbackLoop.js +368 -0
  247. package/dist/intelligence/feedbackLoop.js.map +1 -0
  248. package/dist/intelligence/gitHubTracker.d.ts +14 -0
  249. package/dist/intelligence/gitHubTracker.d.ts.map +1 -0
  250. package/dist/intelligence/gitHubTracker.js +153 -0
  251. package/dist/intelligence/gitHubTracker.js.map +1 -0
  252. package/dist/intelligence/hackerNewsScanner.d.ts +21 -0
  253. package/dist/intelligence/hackerNewsScanner.d.ts.map +1 -0
  254. package/dist/intelligence/hackerNewsScanner.js +88 -0
  255. package/dist/intelligence/hackerNewsScanner.js.map +1 -0
  256. package/dist/intelligence/hiringSignals.d.ts +16 -0
  257. package/dist/intelligence/hiringSignals.d.ts.map +1 -0
  258. package/dist/intelligence/hiringSignals.js +132 -0
  259. package/dist/intelligence/hiringSignals.js.map +1 -0
  260. package/dist/intelligence/index.d.ts +9 -0
  261. package/dist/intelligence/index.d.ts.map +1 -0
  262. package/dist/intelligence/index.js +9 -0
  263. package/dist/intelligence/index.js.map +1 -0
  264. package/dist/intelligence/leadEnrichment.d.ts +59 -0
  265. package/dist/intelligence/leadEnrichment.d.ts.map +1 -0
  266. package/dist/intelligence/leadEnrichment.js +209 -0
  267. package/dist/intelligence/leadEnrichment.js.map +1 -0
  268. package/dist/intelligence/leadEnrichmentTypes.d.ts +49 -0
  269. package/dist/intelligence/leadEnrichmentTypes.d.ts.map +1 -0
  270. package/dist/intelligence/leadEnrichmentTypes.js +7 -0
  271. package/dist/intelligence/leadEnrichmentTypes.js.map +1 -0
  272. package/dist/intelligence/marketScanner.d.ts +18 -0
  273. package/dist/intelligence/marketScanner.d.ts.map +1 -0
  274. package/dist/intelligence/marketScanner.js +225 -0
  275. package/dist/intelligence/marketScanner.js.map +1 -0
  276. package/dist/intelligence/polymarketScanner.d.ts +20 -0
  277. package/dist/intelligence/polymarketScanner.d.ts.map +1 -0
  278. package/dist/intelligence/polymarketScanner.js +88 -0
  279. package/dist/intelligence/polymarketScanner.js.map +1 -0
  280. package/dist/intelligence/redditScanner.d.ts +22 -0
  281. package/dist/intelligence/redditScanner.d.ts.map +1 -0
  282. package/dist/intelligence/redditScanner.js +89 -0
  283. package/dist/intelligence/redditScanner.js.map +1 -0
  284. package/dist/intelligence/signalAggregator.d.ts +10 -0
  285. package/dist/intelligence/signalAggregator.d.ts.map +1 -0
  286. package/dist/intelligence/signalAggregator.js +64 -0
  287. package/dist/intelligence/signalAggregator.js.map +1 -0
  288. package/dist/intelligence/trendAnalysis.d.ts +13 -0
  289. package/dist/intelligence/trendAnalysis.d.ts.map +1 -0
  290. package/dist/intelligence/trendAnalysis.js +106 -0
  291. package/dist/intelligence/trendAnalysis.js.map +1 -0
  292. package/dist/intelligence/twitterScanner.d.ts +22 -0
  293. package/dist/intelligence/twitterScanner.d.ts.map +1 -0
  294. package/dist/intelligence/twitterScanner.js +63 -0
  295. package/dist/intelligence/twitterScanner.js.map +1 -0
  296. package/dist/intelligence/types.d.ts +566 -0
  297. package/dist/intelligence/types.d.ts.map +1 -0
  298. package/dist/intelligence/types.js +87 -0
  299. package/dist/intelligence/types.js.map +1 -0
  300. package/dist/intelligence/userComplaints.d.ts +15 -0
  301. package/dist/intelligence/userComplaints.d.ts.map +1 -0
  302. package/dist/intelligence/userComplaints.js +193 -0
  303. package/dist/intelligence/userComplaints.js.map +1 -0
  304. package/dist/metrics/businessMetrics.d.ts +41 -0
  305. package/dist/metrics/businessMetrics.d.ts.map +1 -0
  306. package/dist/metrics/businessMetrics.js +120 -0
  307. package/dist/metrics/businessMetrics.js.map +1 -0
  308. package/dist/metrics/businessMetrics.test.d.ts +2 -0
  309. package/dist/metrics/businessMetrics.test.d.ts.map +1 -0
  310. package/dist/metrics/businessMetrics.test.js.map +1 -0
  311. package/dist/metrics/businessMetricsAgg.d.ts +85 -0
  312. package/dist/metrics/businessMetricsAgg.d.ts.map +1 -0
  313. package/dist/metrics/businessMetricsAgg.js +406 -0
  314. package/dist/metrics/businessMetricsAgg.js.map +1 -0
  315. package/dist/metrics/competitorMetrics.d.ts +57 -0
  316. package/dist/metrics/competitorMetrics.d.ts.map +1 -0
  317. package/dist/metrics/competitorMetrics.js +94 -0
  318. package/dist/metrics/competitorMetrics.js.map +1 -0
  319. package/dist/metrics/dashboardGenerator.d.ts +16 -0
  320. package/dist/metrics/dashboardGenerator.d.ts.map +1 -0
  321. package/dist/metrics/dashboardGenerator.js +313 -0
  322. package/dist/metrics/dashboardGenerator.js.map +1 -0
  323. package/dist/metrics/dashboardHTML.d.ts +18 -0
  324. package/dist/metrics/dashboardHTML.d.ts.map +1 -0
  325. package/dist/metrics/dashboardHTML.js +613 -0
  326. package/dist/metrics/dashboardHTML.js.map +1 -0
  327. package/dist/metrics/grafanaExport.d.ts +53 -0
  328. package/dist/metrics/grafanaExport.d.ts.map +1 -0
  329. package/dist/metrics/grafanaExport.js +277 -0
  330. package/dist/metrics/grafanaExport.js.map +1 -0
  331. package/dist/metrics/index.d.ts +17 -0
  332. package/dist/metrics/index.d.ts.map +1 -0
  333. package/dist/metrics/index.js +17 -0
  334. package/dist/metrics/index.js.map +1 -0
  335. package/dist/metrics/leadsMetrics.d.ts +48 -0
  336. package/dist/metrics/leadsMetrics.d.ts.map +1 -0
  337. package/dist/metrics/leadsMetrics.js +82 -0
  338. package/dist/metrics/leadsMetrics.js.map +1 -0
  339. package/dist/metrics/leadsMetrics.test.d.ts +2 -0
  340. package/dist/metrics/leadsMetrics.test.d.ts.map +1 -0
  341. package/dist/metrics/leadsMetrics.test.js.map +1 -0
  342. package/dist/metrics/metricsTypes.d.ts +114 -0
  343. package/dist/metrics/metricsTypes.d.ts.map +1 -0
  344. package/dist/metrics/metricsTypes.js +7 -0
  345. package/dist/metrics/metricsTypes.js.map +1 -0
  346. package/dist/metrics/revenueProjection.d.ts +44 -0
  347. package/dist/metrics/revenueProjection.d.ts.map +1 -0
  348. package/dist/metrics/revenueProjection.js +239 -0
  349. package/dist/metrics/revenueProjection.js.map +1 -0
  350. package/dist/metrics/revenueTypes.d.ts +62 -0
  351. package/dist/metrics/revenueTypes.d.ts.map +1 -0
  352. package/dist/metrics/revenueTypes.js +7 -0
  353. package/dist/metrics/revenueTypes.js.map +1 -0
  354. package/dist/metrics/roiCalculator.d.ts +39 -0
  355. package/dist/metrics/roiCalculator.d.ts.map +1 -0
  356. package/dist/metrics/roiCalculator.js +128 -0
  357. package/dist/metrics/roiCalculator.js.map +1 -0
  358. package/dist/metrics/roiCalculator.test.d.ts +2 -0
  359. package/dist/metrics/roiCalculator.test.d.ts.map +1 -0
  360. package/dist/metrics/roiCalculator.test.js.map +1 -0
  361. package/dist/metrics/trendMetrics.d.ts +51 -0
  362. package/dist/metrics/trendMetrics.d.ts.map +1 -0
  363. package/dist/metrics/trendMetrics.js +116 -0
  364. package/dist/metrics/trendMetrics.js.map +1 -0
  365. package/dist/modes/conservativeCTOMode.d.ts +32 -0
  366. package/dist/modes/conservativeCTOMode.d.ts.map +1 -0
  367. package/dist/modes/conservativeCTOMode.js +98 -0
  368. package/dist/modes/conservativeCTOMode.js.map +1 -0
  369. package/dist/modes/index.d.ts +3 -0
  370. package/dist/modes/index.d.ts.map +1 -0
  371. package/dist/modes/index.js +3 -0
  372. package/dist/modes/index.js.map +1 -0
  373. package/dist/modes/seniorDeveloperMode.d.ts +17 -0
  374. package/dist/modes/seniorDeveloperMode.d.ts.map +1 -0
  375. package/dist/modes/seniorDeveloperMode.js +77 -0
  376. package/dist/modes/seniorDeveloperMode.js.map +1 -0
  377. package/dist/recovery/contextRecovery.d.ts +28 -0
  378. package/dist/recovery/contextRecovery.d.ts.map +1 -0
  379. package/dist/recovery/contextRecovery.js +113 -0
  380. package/dist/recovery/contextRecovery.js.map +1 -0
  381. package/dist/repair/errorDiagnostics.d.ts +28 -0
  382. package/dist/repair/errorDiagnostics.d.ts.map +1 -0
  383. package/dist/repair/errorDiagnostics.js +158 -0
  384. package/dist/repair/errorDiagnostics.js.map +1 -0
  385. package/dist/repair/skillCapture.d.ts +22 -0
  386. package/dist/repair/skillCapture.d.ts.map +1 -0
  387. package/dist/repair/skillCapture.js +119 -0
  388. package/dist/repair/skillCapture.js.map +1 -0
  389. package/dist/reporting/reportGenerator.d.ts +117 -0
  390. package/dist/reporting/reportGenerator.d.ts.map +1 -0
  391. package/dist/reporting/reportGenerator.js +613 -0
  392. package/dist/reporting/reportGenerator.js.map +1 -0
  393. package/dist/reporting/templates.d.ts +68 -0
  394. package/dist/reporting/templates.d.ts.map +1 -0
  395. package/dist/reporting/templates.js +629 -0
  396. package/dist/reporting/templates.js.map +1 -0
  397. package/dist/security/owaspScanner.d.ts +74 -0
  398. package/dist/security/owaspScanner.d.ts.map +1 -0
  399. package/dist/security/owaspScanner.js +309 -0
  400. package/dist/security/owaspScanner.js.map +1 -0
  401. package/dist/security/piiRedaction.d.ts +67 -0
  402. package/dist/security/piiRedaction.d.ts.map +1 -0
  403. package/dist/security/piiRedaction.js +189 -0
  404. package/dist/security/piiRedaction.js.map +1 -0
  405. package/dist/security/secretsDetection.d.ts +47 -0
  406. package/dist/security/secretsDetection.d.ts.map +1 -0
  407. package/dist/security/secretsDetection.js +272 -0
  408. package/dist/security/secretsDetection.js.map +1 -0
  409. package/dist/subagents/builder.d.ts +33 -0
  410. package/dist/subagents/builder.d.ts.map +1 -0
  411. package/dist/subagents/builder.js +158 -0
  412. package/dist/subagents/builder.js.map +1 -0
  413. package/dist/subagents/investigator.d.ts +31 -0
  414. package/dist/subagents/investigator.d.ts.map +1 -0
  415. package/dist/subagents/investigator.js +166 -0
  416. package/dist/subagents/investigator.js.map +1 -0
  417. package/dist/subagents/orchestrator.d.ts +48 -0
  418. package/dist/subagents/orchestrator.d.ts.map +1 -0
  419. package/dist/subagents/orchestrator.js +151 -0
  420. package/dist/subagents/orchestrator.js.map +1 -0
  421. package/dist/subagents/reviewer.d.ts +31 -0
  422. package/dist/subagents/reviewer.d.ts.map +1 -0
  423. package/dist/subagents/reviewer.js +154 -0
  424. package/dist/subagents/reviewer.js.map +1 -0
  425. package/dist/telemetry/tokenCounter.d.ts +21 -0
  426. package/dist/telemetry/tokenCounter.d.ts.map +1 -0
  427. package/dist/telemetry/tokenCounter.js +49 -0
  428. package/dist/telemetry/tokenCounter.js.map +1 -0
  429. package/package.json +61 -0
  430. package/src/automation/actionApprover.ts +342 -0
  431. package/src/automation/actionExecutor.ts +399 -0
  432. package/src/automation/alertRules.ts +113 -0
  433. package/src/automation/alertSystem.ts +402 -0
  434. package/src/automation/competitorResponse.ts +511 -0
  435. package/src/automation/composioClient.ts +360 -0
  436. package/src/automation/crmExport.ts +407 -0
  437. package/src/automation/crmIntegration.ts +268 -0
  438. package/src/automation/gmailIntegration.ts +244 -0
  439. package/src/automation/index.ts +17 -0
  440. package/src/automation/jiraIntegration.ts +310 -0
  441. package/src/automation/jobQueue.ts +278 -0
  442. package/src/automation/leadQualification.ts +270 -0
  443. package/src/automation/qualificationRules.ts +304 -0
  444. package/src/automation/responseTemplates.ts +419 -0
  445. package/src/automation/scheduler.ts +254 -0
  446. package/src/automation/types.ts +270 -0
  447. package/src/cli/index.ts +646 -0
  448. package/src/compression/caveman.ts +257 -0
  449. package/src/config/configManager.ts +63 -0
  450. package/src/config/schema.ts +27 -0
  451. package/src/context/autoCompact.ts +123 -0
  452. package/src/context/readDedup.ts +84 -0
  453. package/src/context/toolBudgets.ts +43 -0
  454. package/src/core/auditLogger.ts +69 -0
  455. package/src/core/stateManager.ts +73 -0
  456. package/src/database/feedbackSchema.ts +168 -0
  457. package/src/database/leadsSchema.ts +205 -0
  458. package/src/intelligence/competitorScoring.ts +292 -0
  459. package/src/intelligence/competitorTracker.ts +362 -0
  460. package/src/intelligence/competitorTypes.ts +100 -0
  461. package/src/intelligence/competitors.json +76 -0
  462. package/src/intelligence/feedbackLoop.ts +538 -0
  463. package/src/intelligence/gitHubTracker.ts +204 -0
  464. package/src/intelligence/hackerNewsScanner.ts +121 -0
  465. package/src/intelligence/hiringSignals.ts +162 -0
  466. package/src/intelligence/index.ts +9 -0
  467. package/src/intelligence/leadEnrichment.ts +275 -0
  468. package/src/intelligence/leadEnrichmentTypes.ts +54 -0
  469. package/src/intelligence/marketScanner.ts +285 -0
  470. package/src/intelligence/polymarketScanner.ts +120 -0
  471. package/src/intelligence/redditScanner.ts +122 -0
  472. package/src/intelligence/signalAggregator.ts +94 -0
  473. package/src/intelligence/trendAnalysis.ts +140 -0
  474. package/src/intelligence/twitterScanner.ts +94 -0
  475. package/src/intelligence/types.ts +130 -0
  476. package/src/intelligence/userComplaints.ts +236 -0
  477. package/src/metrics/businessMetrics.ts +186 -0
  478. package/src/metrics/businessMetricsAgg.ts +554 -0
  479. package/src/metrics/competitorMetrics.ts +175 -0
  480. package/src/metrics/dashboardGenerator.ts +335 -0
  481. package/src/metrics/dashboardHTML.ts +637 -0
  482. package/src/metrics/grafanaExport.ts +347 -0
  483. package/src/metrics/index.ts +17 -0
  484. package/src/metrics/leadsMetrics.ts +145 -0
  485. package/src/metrics/metricsTypes.ts +129 -0
  486. package/src/metrics/revenueProjection.ts +319 -0
  487. package/src/metrics/revenueTypes.ts +67 -0
  488. package/src/metrics/roiCalculator.ts +199 -0
  489. package/src/metrics/trendMetrics.ts +190 -0
  490. package/src/modes/conservativeCTOMode.ts +124 -0
  491. package/src/modes/index.ts +6 -0
  492. package/src/modes/seniorDeveloperMode.ts +94 -0
  493. package/src/recovery/contextRecovery.ts +141 -0
  494. package/src/repair/errorDiagnostics.ts +198 -0
  495. package/src/repair/skillCapture.ts +157 -0
  496. package/src/reporting/reportGenerator.ts +802 -0
  497. package/src/reporting/templates.ts +677 -0
  498. package/src/security/owaspScanner.ts +390 -0
  499. package/src/security/phase8Hardening.ts +536 -0
  500. package/src/security/piiRedaction.ts +215 -0
  501. package/src/security/secretsDetection.js +271 -0
  502. package/src/security/secretsDetection.ts +318 -0
  503. package/src/subagents/builder.ts +277 -0
  504. package/src/subagents/investigator.ts +224 -0
  505. package/src/subagents/orchestrator.ts +212 -0
  506. package/src/subagents/reviewer.ts +215 -0
  507. package/src/telemetry/tokenCounter.ts +81 -0
@@ -0,0 +1,390 @@
1
+ /**
2
+ * OWASP Top 10 Security Scanner
3
+ * Scans code for common security vulnerabilities
4
+ */
5
+
6
+ export interface SecurityFinding {
7
+ category: string;
8
+ cweId: string;
9
+ cvssScore: number;
10
+ severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
11
+ title: string;
12
+ description: string;
13
+ location?: {
14
+ file?: string;
15
+ line?: number;
16
+ column?: number;
17
+ };
18
+ remediation: string;
19
+ evidence?: string;
20
+ }
21
+
22
+ const PATTERNS = {
23
+ // A01: SQL Injection - unparameterized queries
24
+ SQL_INJECTION: [
25
+ /\.query\s*\(\s*["'`]\s*SELECT\s+/gi,
26
+ /\.execute\s*\(\s*["'`]\s*SELECT\s+/gi,
27
+ /sql\s*=\s*["'`]\s*SELECT\s+.*\+\s*.*\s*["'`]/gi,
28
+ /db\.run\s*\(\s*["'`]\s*SELECT\s+/gi,
29
+ ],
30
+
31
+ // A02: Cryptographic Failures - hardcoded secrets
32
+ HARDCODED_SECRETS: [
33
+ /password\s*[=:]\s*["']([^"']+)["']/gi,
34
+ /secret\s*[=:]\s*["']([^"']+)["']/gi,
35
+ /token\s*[=:]\s*["']([^"']+)["']/gi,
36
+ ],
37
+
38
+ // A03: Injection - eval and Function constructor
39
+ DANGEROUS_EVAL: [
40
+ /\beval\s*\(/g,
41
+ /Function\s*\(\s*["'`]/g,
42
+ /setTimeout\s*\(\s*["'`]/g,
43
+ /setInterval\s*\(\s*["'`]/g,
44
+ ],
45
+
46
+ // A03: Injection - template injection
47
+ TEMPLATE_INJECTION: [
48
+ /render\s*\(\s*userInput\s*\)/gi,
49
+ /interpolate\s*\(\s*userInput\s*\)/gi,
50
+ /template\s*\(\s*["'`]\s*\$\{.*\}\s*["'`]/gi,
51
+ ],
52
+
53
+ // A04: Insecure Object Deserialization
54
+ INSECURE_DESERIALIZATION: [
55
+ /JSON\.parse\s*\(\s*userInput\s*\)/gi,
56
+ /pickle\.loads\s*\(/gi,
57
+ /unserialize\s*\(/gi,
58
+ ],
59
+
60
+ // A05: Security Misconfiguration - CORS
61
+ INSECURE_CORS: [
62
+ /Access-Control-Allow-Origin\s*[:=]\s*["']\*["']/gi,
63
+ /cors\s*\(\s*\{[^}]*origin[^}]*\*[^}]*\}/gi,
64
+ ],
65
+
66
+ // A06: Vulnerable Components - known patterns
67
+ VULNERABLE_DEPENDENCIES: [
68
+ /require\s*\(\s*["']lodash\.template["']\s*\)/gi,
69
+ /require\s*\(\s*["']express-unless["']\s*\)/gi,
70
+ ],
71
+
72
+ // A07: Missing Authentication
73
+ MISSING_AUTH: [
74
+ /router\.get\s*\(\s*["'](\/admin|\/api).*["']\s*,\s*\(req,\s*res\)\s*=>/gi,
75
+ /router\.post\s*\(\s*["'](\/admin|\/api).*["']\s*,\s*\(req,\s*res\)\s*=>/gi,
76
+ ],
77
+
78
+ // A09: Using Components with Known Vulnerabilities
79
+ OUTDATED_DEPENDENCIES: [
80
+ /"name":\s*"lodash"[^}]*"version":\s*"[0-3]\.[0-9]+\.[0-9]+"/gi,
81
+ /"name":\s*"express"[^}]*"version":\s*"[34]\.[0-9]+\.[0-9]+"/gi,
82
+ ],
83
+
84
+ // A10: SSRF - unvalidated redirects
85
+ UNVALIDATED_REDIRECT: [
86
+ /redirect\s*\(\s*userInput\s*\)/gi,
87
+ /window\.location\s*=\s*userInput/gi,
88
+ /res\.redirect\s*\(\s*req\.query\.url\s*\)/gi,
89
+ ],
90
+
91
+ // XSS - user input in HTML
92
+ XSS_VULNERABILITY: [
93
+ /innerHTML\s*=\s*userInput/gi,
94
+ /innerHTML\s*=\s*req\.query\./gi,
95
+ /innerHTML\s*=\s*req\.body\./gi,
96
+ /dangerouslySetInnerHTML/g,
97
+ ],
98
+ };
99
+
100
+ /**
101
+ * Scan code for SQL injection vulnerabilities
102
+ */
103
+ export function scanSQLInjection(code: string): SecurityFinding[] {
104
+ const findings: SecurityFinding[] = [];
105
+
106
+ for (const pattern of PATTERNS.SQL_INJECTION) {
107
+ const matches = code.matchAll(pattern);
108
+ for (const match of matches) {
109
+ findings.push({
110
+ category: 'A01: SQL Injection',
111
+ cweId: 'CWE-89',
112
+ cvssScore: 9.8,
113
+ severity: 'CRITICAL',
114
+ title: 'Potential SQL Injection Vulnerability',
115
+ description:
116
+ 'Unparameterized SQL query detected. This can be exploited to modify or retrieve database contents.',
117
+ remediation:
118
+ 'Use parameterized queries or prepared statements with bound parameters.',
119
+ evidence: match[0].substring(0, 60),
120
+ });
121
+ }
122
+ }
123
+
124
+ return findings;
125
+ }
126
+
127
+ /**
128
+ * Scan for hardcoded secrets
129
+ */
130
+ export function scanHardcodedSecrets(code: string): SecurityFinding[] {
131
+ const findings: SecurityFinding[] = [];
132
+
133
+ for (const pattern of PATTERNS.HARDCODED_SECRETS) {
134
+ const matches = code.matchAll(pattern);
135
+ for (const match of matches) {
136
+ findings.push({
137
+ category: 'A02: Cryptographic Failures',
138
+ cweId: 'CWE-798',
139
+ cvssScore: 9.8,
140
+ severity: 'CRITICAL',
141
+ title: 'Hardcoded Secret Detected',
142
+ description: 'Credentials or secrets hardcoded in source code. This enables credential theft.',
143
+ remediation:
144
+ 'Store credentials in environment variables, secure vaults (AWS Secrets Manager, HashiCorp Vault), or .env files (never committed).',
145
+ evidence: match[0].substring(0, 60),
146
+ });
147
+ }
148
+ }
149
+
150
+ return findings;
151
+ }
152
+
153
+ /**
154
+ * Scan for dangerous use of eval()
155
+ */
156
+ export function scanDangerousEval(code: string): SecurityFinding[] {
157
+ const findings: SecurityFinding[] = [];
158
+
159
+ for (const pattern of PATTERNS.DANGEROUS_EVAL) {
160
+ const matches = code.matchAll(pattern);
161
+ for (const match of matches) {
162
+ findings.push({
163
+ category: 'A03: Injection',
164
+ cweId: 'CWE-95',
165
+ cvssScore: 8.6,
166
+ severity: 'HIGH',
167
+ title: 'Use of eval() or similar Dangerous Function',
168
+ description:
169
+ 'eval() and similar functions can execute arbitrary code and should be avoided.',
170
+ remediation:
171
+ 'Replace eval() with safer alternatives: JSON.parse() for JSON, or template literals with proper escaping.',
172
+ evidence: match[0].substring(0, 60),
173
+ });
174
+ }
175
+ }
176
+
177
+ return findings;
178
+ }
179
+
180
+ /**
181
+ * Scan for XSS vulnerabilities
182
+ */
183
+ export function scanXSS(code: string): SecurityFinding[] {
184
+ const findings: SecurityFinding[] = [];
185
+
186
+ for (const pattern of PATTERNS.XSS_VULNERABILITY) {
187
+ const matches = code.matchAll(pattern);
188
+ for (const match of matches) {
189
+ findings.push({
190
+ category: 'A03: Injection - XSS',
191
+ cweId: 'CWE-79',
192
+ cvssScore: 6.1,
193
+ severity: 'MEDIUM',
194
+ title: 'Potential Cross-Site Scripting (XSS) Vulnerability',
195
+ description:
196
+ 'User input is directly inserted into HTML without sanitization. This allows attackers to inject malicious scripts.',
197
+ remediation:
198
+ 'Use context-aware output encoding, Content Security Policy (CSP), and templating engines that auto-escape by default.',
199
+ evidence: match[0].substring(0, 60),
200
+ });
201
+ }
202
+ }
203
+
204
+ return findings;
205
+ }
206
+
207
+ /**
208
+ * Scan for insecure deserialization
209
+ */
210
+ export function scanInsecureDeserialization(code: string): SecurityFinding[] {
211
+ const findings: SecurityFinding[] = [];
212
+
213
+ for (const pattern of PATTERNS.INSECURE_DESERIALIZATION) {
214
+ const matches = code.matchAll(pattern);
215
+ for (const match of matches) {
216
+ findings.push({
217
+ category: 'A08: Software and Data Integrity Failures',
218
+ cweId: 'CWE-502',
219
+ cvssScore: 8.1,
220
+ severity: 'HIGH',
221
+ title: 'Insecure Deserialization',
222
+ description:
223
+ 'Deserializing untrusted data can lead to remote code execution or object injection attacks.',
224
+ remediation:
225
+ 'Validate and sanitize all input before deserialization. Consider using safer formats like JSON instead of binary serialization.',
226
+ evidence: match[0].substring(0, 60),
227
+ });
228
+ }
229
+ }
230
+
231
+ return findings;
232
+ }
233
+
234
+ /**
235
+ * Scan for CORS misconfigurations
236
+ */
237
+ export function scanCORSMisconfiguration(code: string): SecurityFinding[] {
238
+ const findings: SecurityFinding[] = [];
239
+
240
+ for (const pattern of PATTERNS.INSECURE_CORS) {
241
+ const matches = code.matchAll(pattern);
242
+ for (const match of matches) {
243
+ findings.push({
244
+ category: 'A01: Broken Access Control',
245
+ cweId: 'CWE-942',
246
+ cvssScore: 5.3,
247
+ severity: 'MEDIUM',
248
+ title: 'Insecure CORS Configuration',
249
+ description:
250
+ 'CORS allows all origins (*). This enables any website to access resources, bypassing same-origin policy.',
251
+ remediation:
252
+ 'Explicitly specify allowed origins in CORS configuration. Never use wildcard (*) for sensitive APIs.',
253
+ evidence: match[0].substring(0, 60),
254
+ });
255
+ }
256
+ }
257
+
258
+ return findings;
259
+ }
260
+
261
+ /**
262
+ * Scan for unvalidated redirects
263
+ */
264
+ export function scanUnvalidatedRedirect(code: string): SecurityFinding[] {
265
+ const findings: SecurityFinding[] = [];
266
+
267
+ for (const pattern of PATTERNS.UNVALIDATED_REDIRECT) {
268
+ const matches = code.matchAll(pattern);
269
+ for (const match of matches) {
270
+ findings.push({
271
+ category: 'A01: Broken Access Control',
272
+ cweId: 'CWE-601',
273
+ cvssScore: 6.1,
274
+ severity: 'MEDIUM',
275
+ title: 'Unvalidated Redirect',
276
+ description:
277
+ 'Redirecting to user-supplied URL without validation enables phishing attacks.',
278
+ remediation:
279
+ 'Validate redirect URLs against a whitelist. Use relative URLs when possible.',
280
+ evidence: match[0].substring(0, 60),
281
+ });
282
+ }
283
+ }
284
+
285
+ return findings;
286
+ }
287
+
288
+ /**
289
+ * Scan for missing authentication on sensitive endpoints
290
+ */
291
+ export function scanMissingAuth(code: string): SecurityFinding[] {
292
+ const findings: SecurityFinding[] = [];
293
+
294
+ for (const pattern of PATTERNS.MISSING_AUTH) {
295
+ const matches = code.matchAll(pattern);
296
+ for (const match of matches) {
297
+ findings.push({
298
+ category: 'A01: Broken Authentication',
299
+ cweId: 'CWE-306',
300
+ cvssScore: 8.1,
301
+ severity: 'HIGH',
302
+ title: 'Missing Authentication on Sensitive Endpoint',
303
+ description: 'Admin or API endpoints without authentication checks are exposed to unauthorized access.',
304
+ remediation:
305
+ 'Add authentication and authorization checks to all sensitive endpoints. Use middleware to enforce authentication.',
306
+ evidence: match[0].substring(0, 60),
307
+ });
308
+ }
309
+ }
310
+
311
+ return findings;
312
+ }
313
+
314
+ /**
315
+ * Main scanner - run all checks
316
+ */
317
+ export function scanCode(code: string): SecurityFinding[] {
318
+ if (!code || typeof code !== 'string') {
319
+ return [];
320
+ }
321
+
322
+ const findings: SecurityFinding[] = [
323
+ ...scanSQLInjection(code),
324
+ ...scanHardcodedSecrets(code),
325
+ ...scanDangerousEval(code),
326
+ ...scanXSS(code),
327
+ ...scanInsecureDeserialization(code),
328
+ ...scanCORSMisconfiguration(code),
329
+ ...scanUnvalidatedRedirect(code),
330
+ ...scanMissingAuth(code),
331
+ ];
332
+
333
+ // Deduplicate and sort by severity
334
+ const unique = Array.from(new Map(findings.map((f) => [f.evidence, f])).values());
335
+ const severityOrder = { CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3 };
336
+
337
+ return unique.sort((a, b) => severityOrder[a.severity] - severityOrder[b.severity]);
338
+ }
339
+
340
+ /**
341
+ * Scan file with location information
342
+ */
343
+ export async function scanFileForVulnerabilities(
344
+ filePath: string,
345
+ content: string
346
+ ): Promise<SecurityFinding[]> {
347
+ const findings = scanCode(content);
348
+ return findings.map((f) => ({
349
+ ...f,
350
+ location: {
351
+ file: filePath,
352
+ ...f.location,
353
+ },
354
+ }));
355
+ }
356
+
357
+ /**
358
+ * Generate security report
359
+ */
360
+ export function generateSecurityReport(findings: SecurityFinding[]): {
361
+ summary: {
362
+ total: number;
363
+ critical: number;
364
+ high: number;
365
+ medium: number;
366
+ low: number;
367
+ };
368
+ findings: SecurityFinding[];
369
+ riskLevel: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'NONE';
370
+ } {
371
+ const summary = {
372
+ total: findings.length,
373
+ critical: findings.filter((f) => f.severity === 'CRITICAL').length,
374
+ high: findings.filter((f) => f.severity === 'HIGH').length,
375
+ medium: findings.filter((f) => f.severity === 'MEDIUM').length,
376
+ low: findings.filter((f) => f.severity === 'LOW').length,
377
+ };
378
+
379
+ let riskLevel: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'NONE' = 'NONE';
380
+ if (summary.critical > 0) riskLevel = 'CRITICAL';
381
+ else if (summary.high > 0) riskLevel = 'HIGH';
382
+ else if (summary.medium > 0) riskLevel = 'MEDIUM';
383
+ else if (summary.low > 0) riskLevel = 'LOW';
384
+
385
+ return {
386
+ summary,
387
+ findings,
388
+ riskLevel,
389
+ };
390
+ }