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.
- package/.reports/detailed-analysis_2026-06-20_01ed326b.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_08d39381.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_0a331144.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_0d54ffef.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_14bfa31c.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_211feac4.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_22381bc2.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_29b4ea0a.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_2df0ad14.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_343ec84c.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_3a01030d.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_3b4c99ec.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_3d368827.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_53544d3d.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_5721164a.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_57caf5e7.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_624302f5.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_62456384.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_636a52f1.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_63d1ad41.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_7451ccd7.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_74da4e9a.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_83a90083.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_867fbdd9.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_974c3299.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_a04639a2.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_a8e23d6d.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_aa9150f0.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_acbeee08.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_c4ffa0e2.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_c5f7684b.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_c963b1fa.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_d4bde41f.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_d6eb2497.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_ea6f7f58.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_ebf4e060.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_ec4313a9.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_fc65d18e.html +200 -0
- package/.reports/executive-summary_2026-06-20_00406d50.html +109 -0
- package/.reports/executive-summary_2026-06-20_0bb202d3.html +109 -0
- package/.reports/executive-summary_2026-06-20_0bcd7481.html +109 -0
- package/.reports/executive-summary_2026-06-20_11506445.html +109 -0
- package/.reports/executive-summary_2026-06-20_13616cda.html +109 -0
- package/.reports/executive-summary_2026-06-20_19d41c2f.html +109 -0
- package/.reports/executive-summary_2026-06-20_1b0d6e96.html +109 -0
- package/.reports/executive-summary_2026-06-20_1e38670b.html +109 -0
- package/.reports/executive-summary_2026-06-20_1f32f793.html +109 -0
- package/.reports/executive-summary_2026-06-20_1f40f7d3.html +109 -0
- package/.reports/executive-summary_2026-06-20_25a40a7e.html +109 -0
- package/.reports/executive-summary_2026-06-20_26d11818.html +109 -0
- package/.reports/executive-summary_2026-06-20_26ed4593.html +109 -0
- package/.reports/executive-summary_2026-06-20_291b90a8.html +109 -0
- package/.reports/executive-summary_2026-06-20_2957a848.html +109 -0
- package/.reports/executive-summary_2026-06-20_2a04eb77.html +109 -0
- package/.reports/executive-summary_2026-06-20_2fa701f9.html +109 -0
- package/.reports/executive-summary_2026-06-20_327af8f5.html +109 -0
- package/.reports/executive-summary_2026-06-20_3418c729.html +109 -0
- package/.reports/executive-summary_2026-06-20_3571763d.html +109 -0
- package/.reports/executive-summary_2026-06-20_36225353.html +109 -0
- package/.reports/executive-summary_2026-06-20_3b2de891.html +109 -0
- package/.reports/executive-summary_2026-06-20_45b980c2.html +109 -0
- package/.reports/executive-summary_2026-06-20_46fcbf17.html +109 -0
- package/.reports/executive-summary_2026-06-20_48c8fa5e.html +109 -0
- package/.reports/executive-summary_2026-06-20_4ba55c43.html +109 -0
- package/.reports/executive-summary_2026-06-20_4f4498e6.html +109 -0
- package/.reports/executive-summary_2026-06-20_54c33bf0.html +109 -0
- package/.reports/executive-summary_2026-06-20_54cc7077.html +109 -0
- package/.reports/executive-summary_2026-06-20_5a12912e.html +109 -0
- package/.reports/executive-summary_2026-06-20_636fac87.html +109 -0
- package/.reports/executive-summary_2026-06-20_6587faaf.html +109 -0
- package/.reports/executive-summary_2026-06-20_6adbdd03.html +109 -0
- package/.reports/executive-summary_2026-06-20_6bf344ec.html +109 -0
- package/.reports/executive-summary_2026-06-20_7142aeed.html +109 -0
- package/.reports/executive-summary_2026-06-20_72bc0ceb.html +109 -0
- package/.reports/executive-summary_2026-06-20_775752ac.html +109 -0
- package/.reports/executive-summary_2026-06-20_7a9c3223.html +109 -0
- package/.reports/executive-summary_2026-06-20_808e6376.html +109 -0
- package/.reports/executive-summary_2026-06-20_8de9142d.html +109 -0
- package/.reports/executive-summary_2026-06-20_91981fbe.html +109 -0
- package/.reports/executive-summary_2026-06-20_93191c8c.html +109 -0
- package/.reports/executive-summary_2026-06-20_9be48a87.html +109 -0
- package/.reports/executive-summary_2026-06-20_9c127198.html +109 -0
- package/.reports/executive-summary_2026-06-20_9ee303ac.html +109 -0
- package/.reports/executive-summary_2026-06-20_9ee52709.html +109 -0
- package/.reports/executive-summary_2026-06-20_a0fa27de.html +109 -0
- package/.reports/executive-summary_2026-06-20_a1813e47.html +109 -0
- package/.reports/executive-summary_2026-06-20_a974edc1.html +109 -0
- package/.reports/executive-summary_2026-06-20_aa711737.html +109 -0
- package/.reports/executive-summary_2026-06-20_aa752246.html +109 -0
- package/.reports/executive-summary_2026-06-20_ac6f0927.html +109 -0
- package/.reports/executive-summary_2026-06-20_b231b143.html +109 -0
- package/.reports/executive-summary_2026-06-20_b570a2bd.html +109 -0
- package/.reports/executive-summary_2026-06-20_b6fbf650.html +109 -0
- package/.reports/executive-summary_2026-06-20_b9f8ddf3.html +109 -0
- package/.reports/executive-summary_2026-06-20_bf95cc63.html +109 -0
- package/.reports/executive-summary_2026-06-20_c0d0aefe.html +109 -0
- package/.reports/executive-summary_2026-06-20_c1933c36.html +109 -0
- package/.reports/executive-summary_2026-06-20_c99bba8a.html +109 -0
- package/.reports/executive-summary_2026-06-20_cc3846ac.html +109 -0
- package/.reports/executive-summary_2026-06-20_d485993c.html +109 -0
- package/.reports/executive-summary_2026-06-20_d56f75f7.html +109 -0
- package/.reports/executive-summary_2026-06-20_d57660cc.html +109 -0
- package/.reports/executive-summary_2026-06-20_dc036f62.html +109 -0
- package/.reports/executive-summary_2026-06-20_df783f47.html +109 -0
- package/.reports/executive-summary_2026-06-20_e2191adb.html +109 -0
- package/.reports/executive-summary_2026-06-20_e9f1d504.html +109 -0
- package/.reports/executive-summary_2026-06-20_ea82f5e1.html +109 -0
- package/.reports/executive-summary_2026-06-20_ec3e70cb.html +109 -0
- package/.reports/executive-summary_2026-06-20_ee6cf902.html +109 -0
- package/.reports/executive-summary_2026-06-20_f6cb657c.html +109 -0
- package/.reports/executive-summary_2026-06-20_f8c60046.html +109 -0
- package/.reports/executive-summary_2026-06-20_fa184840.html +109 -0
- package/.reports/executive-summary_2026-06-20_fc88bcb4.html +109 -0
- package/.reports/executive-summary_2026-06-20_ffa79c4e.html +109 -0
- package/README.md +53 -0
- package/dist/automation/actionApprover.d.ts +89 -0
- package/dist/automation/actionApprover.d.ts.map +1 -0
- package/dist/automation/actionApprover.js +264 -0
- package/dist/automation/actionApprover.js.map +1 -0
- package/dist/automation/actionExecutor.d.ts +125 -0
- package/dist/automation/actionExecutor.d.ts.map +1 -0
- package/dist/automation/actionExecutor.js +304 -0
- package/dist/automation/actionExecutor.js.map +1 -0
- package/dist/automation/alertRules.d.ts +55 -0
- package/dist/automation/alertRules.d.ts.map +1 -0
- package/dist/automation/alertRules.js +70 -0
- package/dist/automation/alertRules.js.map +1 -0
- package/dist/automation/alertSystem.d.ts +109 -0
- package/dist/automation/alertSystem.d.ts.map +1 -0
- package/dist/automation/alertSystem.js +303 -0
- package/dist/automation/alertSystem.js.map +1 -0
- package/dist/automation/competitorResponse.d.ts +119 -0
- package/dist/automation/competitorResponse.d.ts.map +1 -0
- package/dist/automation/competitorResponse.js +343 -0
- package/dist/automation/competitorResponse.js.map +1 -0
- package/dist/automation/composioClient.d.ts +107 -0
- package/dist/automation/composioClient.d.ts.map +1 -0
- package/dist/automation/composioClient.js +286 -0
- package/dist/automation/composioClient.js.map +1 -0
- package/dist/automation/crmExport.d.ts +116 -0
- package/dist/automation/crmExport.d.ts.map +1 -0
- package/dist/automation/crmExport.js +282 -0
- package/dist/automation/crmExport.js.map +1 -0
- package/dist/automation/crmIntegration.d.ts +83 -0
- package/dist/automation/crmIntegration.d.ts.map +1 -0
- package/dist/automation/crmIntegration.js +207 -0
- package/dist/automation/crmIntegration.js.map +1 -0
- package/dist/automation/gmailIntegration.d.ts +73 -0
- package/dist/automation/gmailIntegration.d.ts.map +1 -0
- package/dist/automation/gmailIntegration.js +184 -0
- package/dist/automation/gmailIntegration.js.map +1 -0
- package/dist/automation/index.d.ts +17 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +17 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/jiraIntegration.d.ts +103 -0
- package/dist/automation/jiraIntegration.d.ts.map +1 -0
- package/dist/automation/jiraIntegration.js +222 -0
- package/dist/automation/jiraIntegration.js.map +1 -0
- package/dist/automation/jobQueue.d.ts +98 -0
- package/dist/automation/jobQueue.d.ts.map +1 -0
- package/dist/automation/jobQueue.js +207 -0
- package/dist/automation/jobQueue.js.map +1 -0
- package/dist/automation/leadQualification.d.ts +60 -0
- package/dist/automation/leadQualification.d.ts.map +1 -0
- package/dist/automation/leadQualification.js +204 -0
- package/dist/automation/leadQualification.js.map +1 -0
- package/dist/automation/qualificationRules.d.ts +100 -0
- package/dist/automation/qualificationRules.d.ts.map +1 -0
- package/dist/automation/qualificationRules.js +202 -0
- package/dist/automation/qualificationRules.js.map +1 -0
- package/dist/automation/responseTemplates.d.ts +64 -0
- package/dist/automation/responseTemplates.d.ts.map +1 -0
- package/dist/automation/responseTemplates.js +374 -0
- package/dist/automation/responseTemplates.js.map +1 -0
- package/dist/automation/scheduler.d.ts +85 -0
- package/dist/automation/scheduler.d.ts.map +1 -0
- package/dist/automation/scheduler.js +194 -0
- package/dist/automation/scheduler.js.map +1 -0
- package/dist/automation/types.d.ts +223 -0
- package/dist/automation/types.d.ts.map +1 -0
- package/dist/automation/types.js +32 -0
- package/dist/automation/types.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +575 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/compression/caveman.d.ts +14 -0
- package/dist/compression/caveman.d.ts.map +1 -0
- package/dist/compression/caveman.js +188 -0
- package/dist/compression/caveman.js.map +1 -0
- package/dist/compression/caveman.test.d.ts +2 -0
- package/dist/compression/caveman.test.d.ts.map +1 -0
- package/dist/compression/caveman.test.js.map +1 -0
- package/dist/config/configManager.d.ts +6 -0
- package/dist/config/configManager.d.ts.map +1 -0
- package/dist/config/configManager.js +62 -0
- package/dist/config/configManager.js.map +1 -0
- package/dist/config/schema.d.ts +95 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +19 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/context/autoCompact.d.ts +19 -0
- package/dist/context/autoCompact.d.ts.map +1 -0
- package/dist/context/autoCompact.js +101 -0
- package/dist/context/autoCompact.js.map +1 -0
- package/dist/context/readDedup.d.ts +21 -0
- package/dist/context/readDedup.d.ts.map +1 -0
- package/dist/context/readDedup.js +55 -0
- package/dist/context/readDedup.js.map +1 -0
- package/dist/context/toolBudgets.d.ts +15 -0
- package/dist/context/toolBudgets.d.ts.map +1 -0
- package/dist/context/toolBudgets.js +35 -0
- package/dist/context/toolBudgets.js.map +1 -0
- package/dist/core/auditLogger.d.ts +30 -0
- package/dist/core/auditLogger.d.ts.map +1 -0
- package/dist/core/auditLogger.js +51 -0
- package/dist/core/auditLogger.js.map +1 -0
- package/dist/core/stateManager.d.ts +10 -0
- package/dist/core/stateManager.d.ts.map +1 -0
- package/dist/core/stateManager.js +59 -0
- package/dist/core/stateManager.js.map +1 -0
- package/dist/database/feedbackSchema.d.ts +80 -0
- package/dist/database/feedbackSchema.d.ts.map +1 -0
- package/dist/database/feedbackSchema.js +94 -0
- package/dist/database/feedbackSchema.js.map +1 -0
- package/dist/database/leadsSchema.d.ts +99 -0
- package/dist/database/leadsSchema.d.ts.map +1 -0
- package/dist/database/leadsSchema.js +136 -0
- package/dist/database/leadsSchema.js.map +1 -0
- package/dist/intelligence/competitorScoring.d.ts +25 -0
- package/dist/intelligence/competitorScoring.d.ts.map +1 -0
- package/dist/intelligence/competitorScoring.js +181 -0
- package/dist/intelligence/competitorScoring.js.map +1 -0
- package/dist/intelligence/competitorTracker.d.ts +36 -0
- package/dist/intelligence/competitorTracker.d.ts.map +1 -0
- package/dist/intelligence/competitorTracker.js +286 -0
- package/dist/intelligence/competitorTracker.js.map +1 -0
- package/dist/intelligence/competitorTypes.d.ts +93 -0
- package/dist/intelligence/competitorTypes.d.ts.map +1 -0
- package/dist/intelligence/competitorTypes.js +6 -0
- package/dist/intelligence/competitorTypes.js.map +1 -0
- package/dist/intelligence/competitors.json +76 -0
- package/dist/intelligence/feedbackLoop.d.ts +118 -0
- package/dist/intelligence/feedbackLoop.d.ts.map +1 -0
- package/dist/intelligence/feedbackLoop.js +368 -0
- package/dist/intelligence/feedbackLoop.js.map +1 -0
- package/dist/intelligence/gitHubTracker.d.ts +14 -0
- package/dist/intelligence/gitHubTracker.d.ts.map +1 -0
- package/dist/intelligence/gitHubTracker.js +153 -0
- package/dist/intelligence/gitHubTracker.js.map +1 -0
- package/dist/intelligence/hackerNewsScanner.d.ts +21 -0
- package/dist/intelligence/hackerNewsScanner.d.ts.map +1 -0
- package/dist/intelligence/hackerNewsScanner.js +88 -0
- package/dist/intelligence/hackerNewsScanner.js.map +1 -0
- package/dist/intelligence/hiringSignals.d.ts +16 -0
- package/dist/intelligence/hiringSignals.d.ts.map +1 -0
- package/dist/intelligence/hiringSignals.js +132 -0
- package/dist/intelligence/hiringSignals.js.map +1 -0
- package/dist/intelligence/index.d.ts +9 -0
- package/dist/intelligence/index.d.ts.map +1 -0
- package/dist/intelligence/index.js +9 -0
- package/dist/intelligence/index.js.map +1 -0
- package/dist/intelligence/leadEnrichment.d.ts +59 -0
- package/dist/intelligence/leadEnrichment.d.ts.map +1 -0
- package/dist/intelligence/leadEnrichment.js +209 -0
- package/dist/intelligence/leadEnrichment.js.map +1 -0
- package/dist/intelligence/leadEnrichmentTypes.d.ts +49 -0
- package/dist/intelligence/leadEnrichmentTypes.d.ts.map +1 -0
- package/dist/intelligence/leadEnrichmentTypes.js +7 -0
- package/dist/intelligence/leadEnrichmentTypes.js.map +1 -0
- package/dist/intelligence/marketScanner.d.ts +18 -0
- package/dist/intelligence/marketScanner.d.ts.map +1 -0
- package/dist/intelligence/marketScanner.js +225 -0
- package/dist/intelligence/marketScanner.js.map +1 -0
- package/dist/intelligence/polymarketScanner.d.ts +20 -0
- package/dist/intelligence/polymarketScanner.d.ts.map +1 -0
- package/dist/intelligence/polymarketScanner.js +88 -0
- package/dist/intelligence/polymarketScanner.js.map +1 -0
- package/dist/intelligence/redditScanner.d.ts +22 -0
- package/dist/intelligence/redditScanner.d.ts.map +1 -0
- package/dist/intelligence/redditScanner.js +89 -0
- package/dist/intelligence/redditScanner.js.map +1 -0
- package/dist/intelligence/signalAggregator.d.ts +10 -0
- package/dist/intelligence/signalAggregator.d.ts.map +1 -0
- package/dist/intelligence/signalAggregator.js +64 -0
- package/dist/intelligence/signalAggregator.js.map +1 -0
- package/dist/intelligence/trendAnalysis.d.ts +13 -0
- package/dist/intelligence/trendAnalysis.d.ts.map +1 -0
- package/dist/intelligence/trendAnalysis.js +106 -0
- package/dist/intelligence/trendAnalysis.js.map +1 -0
- package/dist/intelligence/twitterScanner.d.ts +22 -0
- package/dist/intelligence/twitterScanner.d.ts.map +1 -0
- package/dist/intelligence/twitterScanner.js +63 -0
- package/dist/intelligence/twitterScanner.js.map +1 -0
- package/dist/intelligence/types.d.ts +566 -0
- package/dist/intelligence/types.d.ts.map +1 -0
- package/dist/intelligence/types.js +87 -0
- package/dist/intelligence/types.js.map +1 -0
- package/dist/intelligence/userComplaints.d.ts +15 -0
- package/dist/intelligence/userComplaints.d.ts.map +1 -0
- package/dist/intelligence/userComplaints.js +193 -0
- package/dist/intelligence/userComplaints.js.map +1 -0
- package/dist/metrics/businessMetrics.d.ts +41 -0
- package/dist/metrics/businessMetrics.d.ts.map +1 -0
- package/dist/metrics/businessMetrics.js +120 -0
- package/dist/metrics/businessMetrics.js.map +1 -0
- package/dist/metrics/businessMetrics.test.d.ts +2 -0
- package/dist/metrics/businessMetrics.test.d.ts.map +1 -0
- package/dist/metrics/businessMetrics.test.js.map +1 -0
- package/dist/metrics/businessMetricsAgg.d.ts +85 -0
- package/dist/metrics/businessMetricsAgg.d.ts.map +1 -0
- package/dist/metrics/businessMetricsAgg.js +406 -0
- package/dist/metrics/businessMetricsAgg.js.map +1 -0
- package/dist/metrics/competitorMetrics.d.ts +57 -0
- package/dist/metrics/competitorMetrics.d.ts.map +1 -0
- package/dist/metrics/competitorMetrics.js +94 -0
- package/dist/metrics/competitorMetrics.js.map +1 -0
- package/dist/metrics/dashboardGenerator.d.ts +16 -0
- package/dist/metrics/dashboardGenerator.d.ts.map +1 -0
- package/dist/metrics/dashboardGenerator.js +313 -0
- package/dist/metrics/dashboardGenerator.js.map +1 -0
- package/dist/metrics/dashboardHTML.d.ts +18 -0
- package/dist/metrics/dashboardHTML.d.ts.map +1 -0
- package/dist/metrics/dashboardHTML.js +613 -0
- package/dist/metrics/dashboardHTML.js.map +1 -0
- package/dist/metrics/grafanaExport.d.ts +53 -0
- package/dist/metrics/grafanaExport.d.ts.map +1 -0
- package/dist/metrics/grafanaExport.js +277 -0
- package/dist/metrics/grafanaExport.js.map +1 -0
- package/dist/metrics/index.d.ts +17 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +17 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/leadsMetrics.d.ts +48 -0
- package/dist/metrics/leadsMetrics.d.ts.map +1 -0
- package/dist/metrics/leadsMetrics.js +82 -0
- package/dist/metrics/leadsMetrics.js.map +1 -0
- package/dist/metrics/leadsMetrics.test.d.ts +2 -0
- package/dist/metrics/leadsMetrics.test.d.ts.map +1 -0
- package/dist/metrics/leadsMetrics.test.js.map +1 -0
- package/dist/metrics/metricsTypes.d.ts +114 -0
- package/dist/metrics/metricsTypes.d.ts.map +1 -0
- package/dist/metrics/metricsTypes.js +7 -0
- package/dist/metrics/metricsTypes.js.map +1 -0
- package/dist/metrics/revenueProjection.d.ts +44 -0
- package/dist/metrics/revenueProjection.d.ts.map +1 -0
- package/dist/metrics/revenueProjection.js +239 -0
- package/dist/metrics/revenueProjection.js.map +1 -0
- package/dist/metrics/revenueTypes.d.ts +62 -0
- package/dist/metrics/revenueTypes.d.ts.map +1 -0
- package/dist/metrics/revenueTypes.js +7 -0
- package/dist/metrics/revenueTypes.js.map +1 -0
- package/dist/metrics/roiCalculator.d.ts +39 -0
- package/dist/metrics/roiCalculator.d.ts.map +1 -0
- package/dist/metrics/roiCalculator.js +128 -0
- package/dist/metrics/roiCalculator.js.map +1 -0
- package/dist/metrics/roiCalculator.test.d.ts +2 -0
- package/dist/metrics/roiCalculator.test.d.ts.map +1 -0
- package/dist/metrics/roiCalculator.test.js.map +1 -0
- package/dist/metrics/trendMetrics.d.ts +51 -0
- package/dist/metrics/trendMetrics.d.ts.map +1 -0
- package/dist/metrics/trendMetrics.js +116 -0
- package/dist/metrics/trendMetrics.js.map +1 -0
- package/dist/modes/conservativeCTOMode.d.ts +32 -0
- package/dist/modes/conservativeCTOMode.d.ts.map +1 -0
- package/dist/modes/conservativeCTOMode.js +98 -0
- package/dist/modes/conservativeCTOMode.js.map +1 -0
- package/dist/modes/index.d.ts +3 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +3 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/seniorDeveloperMode.d.ts +17 -0
- package/dist/modes/seniorDeveloperMode.d.ts.map +1 -0
- package/dist/modes/seniorDeveloperMode.js +77 -0
- package/dist/modes/seniorDeveloperMode.js.map +1 -0
- package/dist/recovery/contextRecovery.d.ts +28 -0
- package/dist/recovery/contextRecovery.d.ts.map +1 -0
- package/dist/recovery/contextRecovery.js +113 -0
- package/dist/recovery/contextRecovery.js.map +1 -0
- package/dist/repair/errorDiagnostics.d.ts +28 -0
- package/dist/repair/errorDiagnostics.d.ts.map +1 -0
- package/dist/repair/errorDiagnostics.js +158 -0
- package/dist/repair/errorDiagnostics.js.map +1 -0
- package/dist/repair/skillCapture.d.ts +22 -0
- package/dist/repair/skillCapture.d.ts.map +1 -0
- package/dist/repair/skillCapture.js +119 -0
- package/dist/repair/skillCapture.js.map +1 -0
- package/dist/reporting/reportGenerator.d.ts +117 -0
- package/dist/reporting/reportGenerator.d.ts.map +1 -0
- package/dist/reporting/reportGenerator.js +613 -0
- package/dist/reporting/reportGenerator.js.map +1 -0
- package/dist/reporting/templates.d.ts +68 -0
- package/dist/reporting/templates.d.ts.map +1 -0
- package/dist/reporting/templates.js +629 -0
- package/dist/reporting/templates.js.map +1 -0
- package/dist/security/owaspScanner.d.ts +74 -0
- package/dist/security/owaspScanner.d.ts.map +1 -0
- package/dist/security/owaspScanner.js +309 -0
- package/dist/security/owaspScanner.js.map +1 -0
- package/dist/security/piiRedaction.d.ts +67 -0
- package/dist/security/piiRedaction.d.ts.map +1 -0
- package/dist/security/piiRedaction.js +189 -0
- package/dist/security/piiRedaction.js.map +1 -0
- package/dist/security/secretsDetection.d.ts +47 -0
- package/dist/security/secretsDetection.d.ts.map +1 -0
- package/dist/security/secretsDetection.js +272 -0
- package/dist/security/secretsDetection.js.map +1 -0
- package/dist/subagents/builder.d.ts +33 -0
- package/dist/subagents/builder.d.ts.map +1 -0
- package/dist/subagents/builder.js +158 -0
- package/dist/subagents/builder.js.map +1 -0
- package/dist/subagents/investigator.d.ts +31 -0
- package/dist/subagents/investigator.d.ts.map +1 -0
- package/dist/subagents/investigator.js +166 -0
- package/dist/subagents/investigator.js.map +1 -0
- package/dist/subagents/orchestrator.d.ts +48 -0
- package/dist/subagents/orchestrator.d.ts.map +1 -0
- package/dist/subagents/orchestrator.js +151 -0
- package/dist/subagents/orchestrator.js.map +1 -0
- package/dist/subagents/reviewer.d.ts +31 -0
- package/dist/subagents/reviewer.d.ts.map +1 -0
- package/dist/subagents/reviewer.js +154 -0
- package/dist/subagents/reviewer.js.map +1 -0
- package/dist/telemetry/tokenCounter.d.ts +21 -0
- package/dist/telemetry/tokenCounter.d.ts.map +1 -0
- package/dist/telemetry/tokenCounter.js +49 -0
- package/dist/telemetry/tokenCounter.js.map +1 -0
- package/package.json +61 -0
- package/src/automation/actionApprover.ts +342 -0
- package/src/automation/actionExecutor.ts +399 -0
- package/src/automation/alertRules.ts +113 -0
- package/src/automation/alertSystem.ts +402 -0
- package/src/automation/competitorResponse.ts +511 -0
- package/src/automation/composioClient.ts +360 -0
- package/src/automation/crmExport.ts +407 -0
- package/src/automation/crmIntegration.ts +268 -0
- package/src/automation/gmailIntegration.ts +244 -0
- package/src/automation/index.ts +17 -0
- package/src/automation/jiraIntegration.ts +310 -0
- package/src/automation/jobQueue.ts +278 -0
- package/src/automation/leadQualification.ts +270 -0
- package/src/automation/qualificationRules.ts +304 -0
- package/src/automation/responseTemplates.ts +419 -0
- package/src/automation/scheduler.ts +254 -0
- package/src/automation/types.ts +270 -0
- package/src/cli/index.ts +646 -0
- package/src/compression/caveman.ts +257 -0
- package/src/config/configManager.ts +63 -0
- package/src/config/schema.ts +27 -0
- package/src/context/autoCompact.ts +123 -0
- package/src/context/readDedup.ts +84 -0
- package/src/context/toolBudgets.ts +43 -0
- package/src/core/auditLogger.ts +69 -0
- package/src/core/stateManager.ts +73 -0
- package/src/database/feedbackSchema.ts +168 -0
- package/src/database/leadsSchema.ts +205 -0
- package/src/intelligence/competitorScoring.ts +292 -0
- package/src/intelligence/competitorTracker.ts +362 -0
- package/src/intelligence/competitorTypes.ts +100 -0
- package/src/intelligence/competitors.json +76 -0
- package/src/intelligence/feedbackLoop.ts +538 -0
- package/src/intelligence/gitHubTracker.ts +204 -0
- package/src/intelligence/hackerNewsScanner.ts +121 -0
- package/src/intelligence/hiringSignals.ts +162 -0
- package/src/intelligence/index.ts +9 -0
- package/src/intelligence/leadEnrichment.ts +275 -0
- package/src/intelligence/leadEnrichmentTypes.ts +54 -0
- package/src/intelligence/marketScanner.ts +285 -0
- package/src/intelligence/polymarketScanner.ts +120 -0
- package/src/intelligence/redditScanner.ts +122 -0
- package/src/intelligence/signalAggregator.ts +94 -0
- package/src/intelligence/trendAnalysis.ts +140 -0
- package/src/intelligence/twitterScanner.ts +94 -0
- package/src/intelligence/types.ts +130 -0
- package/src/intelligence/userComplaints.ts +236 -0
- package/src/metrics/businessMetrics.ts +186 -0
- package/src/metrics/businessMetricsAgg.ts +554 -0
- package/src/metrics/competitorMetrics.ts +175 -0
- package/src/metrics/dashboardGenerator.ts +335 -0
- package/src/metrics/dashboardHTML.ts +637 -0
- package/src/metrics/grafanaExport.ts +347 -0
- package/src/metrics/index.ts +17 -0
- package/src/metrics/leadsMetrics.ts +145 -0
- package/src/metrics/metricsTypes.ts +129 -0
- package/src/metrics/revenueProjection.ts +319 -0
- package/src/metrics/revenueTypes.ts +67 -0
- package/src/metrics/roiCalculator.ts +199 -0
- package/src/metrics/trendMetrics.ts +190 -0
- package/src/modes/conservativeCTOMode.ts +124 -0
- package/src/modes/index.ts +6 -0
- package/src/modes/seniorDeveloperMode.ts +94 -0
- package/src/recovery/contextRecovery.ts +141 -0
- package/src/repair/errorDiagnostics.ts +198 -0
- package/src/repair/skillCapture.ts +157 -0
- package/src/reporting/reportGenerator.ts +802 -0
- package/src/reporting/templates.ts +677 -0
- package/src/security/owaspScanner.ts +390 -0
- package/src/security/phase8Hardening.ts +536 -0
- package/src/security/piiRedaction.ts +215 -0
- package/src/security/secretsDetection.js +271 -0
- package/src/security/secretsDetection.ts +318 -0
- package/src/subagents/builder.ts +277 -0
- package/src/subagents/investigator.ts +224 -0
- package/src/subagents/orchestrator.ts +212 -0
- package/src/subagents/reviewer.ts +215 -0
- package/src/telemetry/tokenCounter.ts +81 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secrets Detection Module
|
|
3
|
+
* Scans for hardcoded credentials, API keys, tokens, and other sensitive data
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface SecretFinding {
|
|
7
|
+
type: string;
|
|
8
|
+
severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
9
|
+
pattern: string;
|
|
10
|
+
location?: string;
|
|
11
|
+
context?: string;
|
|
12
|
+
entropy?: number;
|
|
13
|
+
suggestion: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const PATTERNS = {
|
|
17
|
+
AWS_KEY: /AKIA[0-9A-Z]{16}/g,
|
|
18
|
+
GITHUB_PAT: /ghp_[A-Za-z0-9_]{36}/g,
|
|
19
|
+
ANTHROPIC_KEY: /sk-ant-[A-Za-z0-9_-]{48}/g,
|
|
20
|
+
OPENAI_KEY: /sk-[A-Za-z0-9]{20,}/g,
|
|
21
|
+
PRIVATE_KEY_RSA: /-----BEGIN RSA PRIVATE KEY-----[\s\S]*?-----END RSA PRIVATE KEY-----/g,
|
|
22
|
+
PRIVATE_KEY_EC: /-----BEGIN EC PRIVATE KEY-----[\s\S]*?-----END EC PRIVATE KEY-----/g,
|
|
23
|
+
PRIVATE_KEY_ED25519: /-----BEGIN PRIVATE KEY-----[\s\S]*?-----END PRIVATE KEY-----/g,
|
|
24
|
+
JWT_TOKEN: /eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,
|
|
25
|
+
PASSWORD_ASSIGNMENT: /(?:password|passwd|pwd)\s*[:=]\s*['"](.*?)['"]/gi,
|
|
26
|
+
DATABASE_URL: /(?:mongodb|mysql|postgresql|sqlite):[/\w:@.?#&=+-]*/gi,
|
|
27
|
+
SLACK_TOKEN: /xox[baprs]-[0-9a-zA-Z]{10,48}/g,
|
|
28
|
+
SLACK_WEBHOOK: /https:\/\/hooks\.slack\.com\/services\/[A-Z0-9]+\/[A-Z0-9]+\/[A-Za-z0-9]+/g,
|
|
29
|
+
STRIPE_KEY: /sk_(?:live|test)_[0-9a-zA-Z]{20,}/g,
|
|
30
|
+
TWILIO_AUTH: /AC[a-zA-Z0-9]{32}/g,
|
|
31
|
+
SENDGRID_KEY: /SG\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9_-]{43}/g,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Calculate Shannon entropy of a string
|
|
36
|
+
* Values > 4.0 indicate potential secrets
|
|
37
|
+
*/
|
|
38
|
+
export function calculateEntropy(text: string): number {
|
|
39
|
+
if (!text || text.length === 0) return 0;
|
|
40
|
+
|
|
41
|
+
const freq: Record<string, number> = {};
|
|
42
|
+
for (const char of text) {
|
|
43
|
+
freq[char] = (freq[char] || 0) + 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let entropy = 0;
|
|
47
|
+
for (const count of Object.values(freq)) {
|
|
48
|
+
const p = count / text.length;
|
|
49
|
+
entropy -= p * Math.log2(p);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return entropy;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Detect API keys in text
|
|
57
|
+
*/
|
|
58
|
+
export function detectAPIKey(text: string): SecretFinding[] {
|
|
59
|
+
const findings: SecretFinding[] = [];
|
|
60
|
+
|
|
61
|
+
// AWS
|
|
62
|
+
for (const match of text.matchAll(PATTERNS.AWS_KEY)) {
|
|
63
|
+
findings.push({
|
|
64
|
+
type: 'AWS_ACCESS_KEY',
|
|
65
|
+
severity: 'CRITICAL',
|
|
66
|
+
pattern: match[0],
|
|
67
|
+
suggestion: 'Use AWS IAM roles or temporary credentials instead',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// GitHub
|
|
72
|
+
for (const match of text.matchAll(PATTERNS.GITHUB_PAT)) {
|
|
73
|
+
findings.push({
|
|
74
|
+
type: 'GITHUB_PAT',
|
|
75
|
+
severity: 'CRITICAL',
|
|
76
|
+
pattern: match[0],
|
|
77
|
+
suggestion: 'Use GitHub App or OAuth token with minimal scopes',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Anthropic
|
|
82
|
+
for (const match of text.matchAll(PATTERNS.ANTHROPIC_KEY)) {
|
|
83
|
+
findings.push({
|
|
84
|
+
type: 'ANTHROPIC_API_KEY',
|
|
85
|
+
severity: 'CRITICAL',
|
|
86
|
+
pattern: match[0],
|
|
87
|
+
suggestion: 'Set ANTHROPIC_API_KEY as environment variable',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// OpenAI
|
|
92
|
+
for (const match of text.matchAll(PATTERNS.OPENAI_KEY)) {
|
|
93
|
+
findings.push({
|
|
94
|
+
type: 'OPENAI_API_KEY',
|
|
95
|
+
severity: 'CRITICAL',
|
|
96
|
+
pattern: match[0],
|
|
97
|
+
suggestion: 'Set OPENAI_API_KEY as environment variable',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Slack
|
|
102
|
+
for (const match of text.matchAll(PATTERNS.SLACK_TOKEN)) {
|
|
103
|
+
findings.push({
|
|
104
|
+
type: 'SLACK_TOKEN',
|
|
105
|
+
severity: 'CRITICAL',
|
|
106
|
+
pattern: match[0],
|
|
107
|
+
suggestion: 'Use Slack token rotation and store in secrets manager',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Stripe
|
|
112
|
+
for (const match of text.matchAll(PATTERNS.STRIPE_KEY)) {
|
|
113
|
+
findings.push({
|
|
114
|
+
type: 'STRIPE_API_KEY',
|
|
115
|
+
severity: 'CRITICAL',
|
|
116
|
+
pattern: match[0],
|
|
117
|
+
suggestion: 'Use environment variables for Stripe keys',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Twilio
|
|
122
|
+
for (const match of text.matchAll(PATTERNS.TWILIO_AUTH)) {
|
|
123
|
+
findings.push({
|
|
124
|
+
type: 'TWILIO_AUTH_TOKEN',
|
|
125
|
+
severity: 'CRITICAL',
|
|
126
|
+
pattern: match[0],
|
|
127
|
+
suggestion: 'Store Twilio credentials in environment variables',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// SendGrid
|
|
132
|
+
for (const match of text.matchAll(PATTERNS.SENDGRID_KEY)) {
|
|
133
|
+
findings.push({
|
|
134
|
+
type: 'SENDGRID_API_KEY',
|
|
135
|
+
severity: 'CRITICAL',
|
|
136
|
+
pattern: match[0],
|
|
137
|
+
suggestion: 'Use environment variable for SendGrid API key',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return findings;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Detect private keys in text
|
|
146
|
+
*/
|
|
147
|
+
export function detectPrivateKey(text: string): SecretFinding[] {
|
|
148
|
+
const findings: SecretFinding[] = [];
|
|
149
|
+
|
|
150
|
+
// RSA
|
|
151
|
+
for (const match of text.matchAll(PATTERNS.PRIVATE_KEY_RSA)) {
|
|
152
|
+
findings.push({
|
|
153
|
+
type: 'RSA_PRIVATE_KEY',
|
|
154
|
+
severity: 'CRITICAL',
|
|
155
|
+
pattern: match[0].substring(0, 50) + '...',
|
|
156
|
+
suggestion: 'Move private key to separate .pem file, add to .gitignore',
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// EC
|
|
161
|
+
for (const match of text.matchAll(PATTERNS.PRIVATE_KEY_EC)) {
|
|
162
|
+
findings.push({
|
|
163
|
+
type: 'EC_PRIVATE_KEY',
|
|
164
|
+
severity: 'CRITICAL',
|
|
165
|
+
pattern: match[0].substring(0, 50) + '...',
|
|
166
|
+
suggestion: 'Move private key to separate .pem file, add to .gitignore',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Ed25519
|
|
171
|
+
for (const match of text.matchAll(PATTERNS.PRIVATE_KEY_ED25519)) {
|
|
172
|
+
findings.push({
|
|
173
|
+
type: 'ED25519_PRIVATE_KEY',
|
|
174
|
+
severity: 'CRITICAL',
|
|
175
|
+
pattern: match[0].substring(0, 50) + '...',
|
|
176
|
+
suggestion: 'Move private key to separate .pem file, add to .gitignore',
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return findings;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Detect plaintext passwords in text
|
|
185
|
+
*/
|
|
186
|
+
export function detectPassword(text: string): SecretFinding[] {
|
|
187
|
+
const findings: SecretFinding[] = [];
|
|
188
|
+
|
|
189
|
+
for (const match of text.matchAll(PATTERNS.PASSWORD_ASSIGNMENT)) {
|
|
190
|
+
const password = match[1];
|
|
191
|
+
if (password && password.length > 0) {
|
|
192
|
+
findings.push({
|
|
193
|
+
type: 'PLAINTEXT_PASSWORD',
|
|
194
|
+
severity: 'CRITICAL',
|
|
195
|
+
pattern: password.substring(0, 20) + '...',
|
|
196
|
+
suggestion: 'Use bcrypt or similar for password hashing, store in environment variables',
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Database URLs
|
|
202
|
+
for (const match of text.matchAll(PATTERNS.DATABASE_URL)) {
|
|
203
|
+
findings.push({
|
|
204
|
+
type: 'DATABASE_URL',
|
|
205
|
+
severity: 'HIGH',
|
|
206
|
+
pattern: match[0].substring(0, 40) + '...',
|
|
207
|
+
suggestion: 'Store database URLs in environment variables',
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return findings;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Detect JWT tokens in text
|
|
216
|
+
*/
|
|
217
|
+
export function detectJWT(text: string): SecretFinding[] {
|
|
218
|
+
const findings: SecretFinding[] = [];
|
|
219
|
+
|
|
220
|
+
for (const match of text.matchAll(PATTERNS.JWT_TOKEN)) {
|
|
221
|
+
const token = match[0];
|
|
222
|
+
try {
|
|
223
|
+
const parts = token.split('.');
|
|
224
|
+
if (parts.length === 3) {
|
|
225
|
+
const payload = JSON.parse(
|
|
226
|
+
Buffer.from(parts[1], 'base64').toString('utf-8')
|
|
227
|
+
);
|
|
228
|
+
findings.push({
|
|
229
|
+
type: 'JWT_TOKEN',
|
|
230
|
+
severity: 'HIGH',
|
|
231
|
+
pattern: token.substring(0, 30) + '...',
|
|
232
|
+
context: JSON.stringify(payload).substring(0, 100),
|
|
233
|
+
suggestion: 'Use short-lived tokens and refresh tokens, never hardcode',
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
} catch {
|
|
237
|
+
findings.push({
|
|
238
|
+
type: 'JWT_TOKEN',
|
|
239
|
+
severity: 'HIGH',
|
|
240
|
+
pattern: token.substring(0, 30) + '...',
|
|
241
|
+
suggestion: 'Never hardcode JWT tokens, use session/environment',
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return findings;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Detect high-entropy strings that may be secrets
|
|
251
|
+
*/
|
|
252
|
+
export function detectHighEntropyStrings(text: string, minLength = 20): SecretFinding[] {
|
|
253
|
+
const findings: SecretFinding[] = [];
|
|
254
|
+
const lines = text.split('\n');
|
|
255
|
+
|
|
256
|
+
for (const line of lines) {
|
|
257
|
+
const tokens = line.split(/[\s=:"',;]/);
|
|
258
|
+
for (const token of tokens) {
|
|
259
|
+
if (token.length >= minLength && /^[a-zA-Z0-9_-]+$/.test(token)) {
|
|
260
|
+
const entropy = calculateEntropy(token);
|
|
261
|
+
if (entropy > 4.0) {
|
|
262
|
+
findings.push({
|
|
263
|
+
type: 'HIGH_ENTROPY_STRING',
|
|
264
|
+
severity: 'MEDIUM',
|
|
265
|
+
pattern: token.substring(0, 30) + '...',
|
|
266
|
+
entropy,
|
|
267
|
+
suggestion: 'Review this string - high entropy suggests it may be a secret or token',
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return findings;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Main entry point: detect all secrets in text
|
|
279
|
+
*/
|
|
280
|
+
export function detectSecrets(text: string): SecretFinding[] {
|
|
281
|
+
if (!text || typeof text !== 'string') {
|
|
282
|
+
return [];
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const findings: SecretFinding[] = [
|
|
286
|
+
...detectPrivateKey(text),
|
|
287
|
+
...detectAPIKey(text),
|
|
288
|
+
...detectPassword(text),
|
|
289
|
+
...detectJWT(text),
|
|
290
|
+
...detectHighEntropyStrings(text),
|
|
291
|
+
];
|
|
292
|
+
|
|
293
|
+
// Deduplicate by pattern
|
|
294
|
+
const seen = new Set<string>();
|
|
295
|
+
const unique = findings.filter((f) => {
|
|
296
|
+
if (seen.has(f.pattern)) return false;
|
|
297
|
+
seen.add(f.pattern);
|
|
298
|
+
return true;
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
// Sort by severity
|
|
302
|
+
const severityOrder = { CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3 };
|
|
303
|
+
return unique.sort((a, b) => severityOrder[a.severity] - severityOrder[b.severity]);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Scan file content for secrets
|
|
308
|
+
*/
|
|
309
|
+
export async function scanFileForSecrets(
|
|
310
|
+
filePath: string,
|
|
311
|
+
content: string
|
|
312
|
+
): Promise<SecretFinding[]> {
|
|
313
|
+
const findings = detectSecrets(content);
|
|
314
|
+
return findings.map((f) => ({
|
|
315
|
+
...f,
|
|
316
|
+
location: filePath,
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
|
|
5
|
+
export interface BuilderResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
filePath: string;
|
|
8
|
+
linesChanged: number;
|
|
9
|
+
testsPassed: boolean;
|
|
10
|
+
tokensUsed: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
errors?: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface TestResult {
|
|
16
|
+
passed: boolean;
|
|
17
|
+
output: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class BuilderSubagent {
|
|
21
|
+
private workingDir: string;
|
|
22
|
+
private readonly DEFAULT_TIMEOUT = 30 * 60 * 1000;
|
|
23
|
+
private readonly TOKEN_ESTIMATE_PER_CHAR = 0.25;
|
|
24
|
+
|
|
25
|
+
constructor(workingDir: string) {
|
|
26
|
+
this.workingDir = workingDir;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async implementFeature(
|
|
30
|
+
filePath: string,
|
|
31
|
+
task: string,
|
|
32
|
+
timeout: number = this.DEFAULT_TIMEOUT
|
|
33
|
+
): Promise<BuilderResult> {
|
|
34
|
+
const startTime = Date.now();
|
|
35
|
+
const fullPath = resolve(this.workingDir, filePath);
|
|
36
|
+
const errors: string[] = [];
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
if (!existsSync(fullPath)) {
|
|
40
|
+
throw new Error(`File not found: ${fullPath}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const originalContent = readFileSync(fullPath, 'utf-8');
|
|
44
|
+
const originalLineCount = originalContent.split('\n').length;
|
|
45
|
+
|
|
46
|
+
const modifiedContent = await this.executeImplementation(
|
|
47
|
+
originalContent,
|
|
48
|
+
task,
|
|
49
|
+
timeout
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (!modifiedContent || modifiedContent === originalContent) {
|
|
53
|
+
errors.push('Implementation produced no changes');
|
|
54
|
+
return this.buildResult(
|
|
55
|
+
false,
|
|
56
|
+
filePath,
|
|
57
|
+
0,
|
|
58
|
+
false,
|
|
59
|
+
0,
|
|
60
|
+
Date.now() - startTime,
|
|
61
|
+
errors
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
writeFileSync(fullPath, modifiedContent, 'utf-8');
|
|
66
|
+
const modifiedLineCount = modifiedContent.split('\n').length;
|
|
67
|
+
const linesChanged = Math.abs(modifiedLineCount - originalLineCount) +
|
|
68
|
+
this.countLineModifications(originalContent, modifiedContent);
|
|
69
|
+
|
|
70
|
+
const testResult = await this.runTests(filePath);
|
|
71
|
+
|
|
72
|
+
if (!testResult.passed) {
|
|
73
|
+
writeFileSync(fullPath, originalContent, 'utf-8');
|
|
74
|
+
errors.push(`Tests failed: ${testResult.output}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const tokensUsed = Math.ceil(
|
|
78
|
+
(originalContent.length + modifiedContent.length) *
|
|
79
|
+
this.TOKEN_ESTIMATE_PER_CHAR
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return this.buildResult(
|
|
83
|
+
testResult.passed,
|
|
84
|
+
filePath,
|
|
85
|
+
linesChanged,
|
|
86
|
+
testResult.passed,
|
|
87
|
+
tokensUsed,
|
|
88
|
+
Date.now() - startTime,
|
|
89
|
+
testResult.passed ? undefined : errors
|
|
90
|
+
);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
errors.push((error as Error).message);
|
|
93
|
+
return this.buildResult(
|
|
94
|
+
false,
|
|
95
|
+
filePath,
|
|
96
|
+
0,
|
|
97
|
+
false,
|
|
98
|
+
0,
|
|
99
|
+
Date.now() - startTime,
|
|
100
|
+
errors
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async runTests(filePath: string): Promise<TestResult> {
|
|
106
|
+
try {
|
|
107
|
+
const testCommand = this.detectTestCommand(filePath);
|
|
108
|
+
|
|
109
|
+
if (!testCommand) {
|
|
110
|
+
return { passed: true, output: 'No tests detected' };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const output = execSync(testCommand, {
|
|
114
|
+
cwd: this.workingDir,
|
|
115
|
+
encoding: 'utf-8',
|
|
116
|
+
stdio: 'pipe',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const passed =
|
|
120
|
+
!output.toLowerCase().includes('fail') &&
|
|
121
|
+
!output.toLowerCase().includes('error');
|
|
122
|
+
|
|
123
|
+
return { passed, output };
|
|
124
|
+
} catch (error) {
|
|
125
|
+
const output = (error as any)?.stdout || (error as Error).message;
|
|
126
|
+
return { passed: false, output };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private async executeImplementation(
|
|
131
|
+
originalContent: string,
|
|
132
|
+
task: string,
|
|
133
|
+
timeout: number
|
|
134
|
+
): Promise<string> {
|
|
135
|
+
const startTime = Date.now();
|
|
136
|
+
|
|
137
|
+
const isTypeScript = originalContent.includes('interface') ||
|
|
138
|
+
originalContent.includes('type ') ||
|
|
139
|
+
originalContent.includes(': string') ||
|
|
140
|
+
originalContent.includes(': number');
|
|
141
|
+
|
|
142
|
+
let modified = originalContent;
|
|
143
|
+
|
|
144
|
+
if (task.includes('add') || task.includes('implement')) {
|
|
145
|
+
const lastClosingBrace = originalContent.lastIndexOf('}');
|
|
146
|
+
if (lastClosingBrace > 0) {
|
|
147
|
+
const beforeLastBrace = originalContent.substring(0, lastClosingBrace);
|
|
148
|
+
const afterLastBrace = originalContent.substring(lastClosingBrace);
|
|
149
|
+
|
|
150
|
+
modified = this.injectImplementation(
|
|
151
|
+
beforeLastBrace,
|
|
152
|
+
task,
|
|
153
|
+
isTypeScript
|
|
154
|
+
);
|
|
155
|
+
modified += afterLastBrace;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (Date.now() - startTime > timeout) {
|
|
160
|
+
throw new Error(`Implementation timeout exceeded: ${timeout}ms`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return modified;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private injectImplementation(
|
|
167
|
+
content: string,
|
|
168
|
+
task: string,
|
|
169
|
+
isTypeScript: boolean
|
|
170
|
+
): string {
|
|
171
|
+
const indent = ' ';
|
|
172
|
+
let implementation = '';
|
|
173
|
+
|
|
174
|
+
if (
|
|
175
|
+
task.toLowerCase().includes('function') ||
|
|
176
|
+
task.toLowerCase().includes('method')
|
|
177
|
+
) {
|
|
178
|
+
implementation = this.generateFunctionStub(task, isTypeScript, indent);
|
|
179
|
+
} else if (task.toLowerCase().includes('class')) {
|
|
180
|
+
implementation = this.generateClassStub(task, isTypeScript, indent);
|
|
181
|
+
} else if (task.toLowerCase().includes('interface')) {
|
|
182
|
+
implementation = this.generateInterfaceStub(task, isTypeScript, indent);
|
|
183
|
+
} else {
|
|
184
|
+
implementation = this.generateGenericStub(task, indent);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return content + '\n' + implementation;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private generateFunctionStub(
|
|
191
|
+
task: string,
|
|
192
|
+
isTypeScript: boolean,
|
|
193
|
+
indent: string
|
|
194
|
+
): string {
|
|
195
|
+
const fnName = this.extractName(task, 'function');
|
|
196
|
+
const returnType = isTypeScript ? ': unknown' : '';
|
|
197
|
+
return `${indent}${fnName}()${returnType} {\n${indent}${indent}// Implementation: ${task}\n${indent}}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private generateClassStub(
|
|
201
|
+
task: string,
|
|
202
|
+
isTypeScript: boolean,
|
|
203
|
+
indent: string
|
|
204
|
+
): string {
|
|
205
|
+
const className = this.extractName(task, 'class');
|
|
206
|
+
return `${indent}class ${className} {\n${indent}${indent}constructor() {}\n${indent}}`;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private generateInterfaceStub(
|
|
210
|
+
task: string,
|
|
211
|
+
isTypeScript: boolean,
|
|
212
|
+
indent: string
|
|
213
|
+
): string {
|
|
214
|
+
const interfaceName = this.extractName(task, 'interface');
|
|
215
|
+
return `${indent}interface ${interfaceName} {\n${indent}${indent}// Fields go here\n${indent}}`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private generateGenericStub(task: string, indent: string): string {
|
|
219
|
+
return `${indent}// TODO: ${task}`;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private extractName(task: string, keyword: string): string {
|
|
223
|
+
const match = task.match(new RegExp(`${keyword}\\s+([a-zA-Z0-9_]+)`, 'i'));
|
|
224
|
+
if (match && match[1]) {
|
|
225
|
+
return match[1];
|
|
226
|
+
}
|
|
227
|
+
return `Generated${keyword.charAt(0).toUpperCase()}${keyword.slice(1)}`;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private countLineModifications(original: string, modified: string): number {
|
|
231
|
+
const origLines = original.split('\n');
|
|
232
|
+
const modLines = modified.split('\n');
|
|
233
|
+
let diffCount = 0;
|
|
234
|
+
|
|
235
|
+
for (let i = 0; i < Math.min(origLines.length, modLines.length); i++) {
|
|
236
|
+
if (origLines[i] !== modLines[i]) {
|
|
237
|
+
diffCount++;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return diffCount;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private detectTestCommand(filePath: string): string | null {
|
|
245
|
+
const fileName = filePath.split('/').pop() || '';
|
|
246
|
+
|
|
247
|
+
if (fileName.includes('.test.') || fileName.includes('.spec.')) {
|
|
248
|
+
return 'npm test';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (existsSync(resolve(this.workingDir, 'package.json'))) {
|
|
252
|
+
return 'npm test';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private buildResult(
|
|
259
|
+
success: boolean,
|
|
260
|
+
filePath: string,
|
|
261
|
+
linesChanged: number,
|
|
262
|
+
testsPassed: boolean,
|
|
263
|
+
tokensUsed: number,
|
|
264
|
+
duration: number,
|
|
265
|
+
errors?: string[]
|
|
266
|
+
): BuilderResult {
|
|
267
|
+
return {
|
|
268
|
+
success,
|
|
269
|
+
filePath,
|
|
270
|
+
linesChanged,
|
|
271
|
+
testsPassed,
|
|
272
|
+
tokensUsed,
|
|
273
|
+
duration,
|
|
274
|
+
errors,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|