@jterrats/smart-deployment 1.0.3
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/README.md +193 -0
- package/lib/ai/agentforce-error-handler.d.ts +81 -0
- package/lib/ai/agentforce-error-handler.js +196 -0
- package/lib/ai/agentforce-error-handler.js.map +1 -0
- package/lib/ai/agentforce-priority-service.d.ts +82 -0
- package/lib/ai/agentforce-priority-service.js +257 -0
- package/lib/ai/agentforce-priority-service.js.map +1 -0
- package/lib/ai/agentforce-service.d.ts +99 -0
- package/lib/ai/agentforce-service.js +300 -0
- package/lib/ai/agentforce-service.js.map +1 -0
- package/lib/ai/circuit-breaker.d.ts +115 -0
- package/lib/ai/circuit-breaker.js +277 -0
- package/lib/ai/circuit-breaker.js.map +1 -0
- package/lib/ai/dependency-inference-service.d.ts +76 -0
- package/lib/ai/dependency-inference-service.js +220 -0
- package/lib/ai/dependency-inference-service.js.map +1 -0
- package/lib/ai/llm-provider-factory.d.ts +15 -0
- package/lib/ai/llm-provider-factory.js +36 -0
- package/lib/ai/llm-provider-factory.js.map +1 -0
- package/lib/ai/llm-provider.d.ts +27 -0
- package/lib/ai/llm-provider.js +2 -0
- package/lib/ai/llm-provider.js.map +1 -0
- package/lib/ai/openai-service.d.ts +20 -0
- package/lib/ai/openai-service.js +89 -0
- package/lib/ai/openai-service.js.map +1 -0
- package/lib/ai/prompt-builder.d.ts +79 -0
- package/lib/ai/prompt-builder.js +180 -0
- package/lib/ai/prompt-builder.js.map +1 -0
- package/lib/ai/response-parser.d.ts +67 -0
- package/lib/ai/response-parser.js +234 -0
- package/lib/ai/response-parser.js.map +1 -0
- package/lib/ai/wave-validation-service.d.ts +111 -0
- package/lib/ai/wave-validation-service.js +381 -0
- package/lib/ai/wave-validation-service.js.map +1 -0
- package/lib/analysis/analysis-reporter.d.ts +56 -0
- package/lib/analysis/analysis-reporter.js +170 -0
- package/lib/analysis/analysis-reporter.js.map +1 -0
- package/lib/analytics/error-analytics.d.ts +80 -0
- package/lib/analytics/error-analytics.js +162 -0
- package/lib/analytics/error-analytics.js.map +1 -0
- package/lib/commands/analyze.d.ts +49 -0
- package/lib/commands/analyze.js +232 -0
- package/lib/commands/analyze.js.map +1 -0
- package/lib/commands/config.d.ts +42 -0
- package/lib/commands/config.js +219 -0
- package/lib/commands/config.js.map +1 -0
- package/lib/commands/resume.d.ts +26 -0
- package/lib/commands/resume.js +69 -0
- package/lib/commands/resume.js.map +1 -0
- package/lib/commands/start.d.ts +70 -0
- package/lib/commands/start.js +659 -0
- package/lib/commands/start.js.map +1 -0
- package/lib/commands/status.d.ts +37 -0
- package/lib/commands/status.js +69 -0
- package/lib/commands/status.js.map +1 -0
- package/lib/commands/validate.d.ts +33 -0
- package/lib/commands/validate.js +66 -0
- package/lib/commands/validate.js.map +1 -0
- package/lib/config/repo-config.d.ts +22 -0
- package/lib/config/repo-config.js +31 -0
- package/lib/config/repo-config.js.map +1 -0
- package/lib/constants/agentforce-limits.d.ts +174 -0
- package/lib/constants/agentforce-limits.js +262 -0
- package/lib/constants/agentforce-limits.js.map +1 -0
- package/lib/constants/api-version.d.ts +70 -0
- package/lib/constants/api-version.js +122 -0
- package/lib/constants/api-version.js.map +1 -0
- package/lib/constants/deployment-order.d.ts +68 -0
- package/lib/constants/deployment-order.js +162 -0
- package/lib/constants/deployment-order.js.map +1 -0
- package/lib/constants/salesforce-limits.d.ts +107 -0
- package/lib/constants/salesforce-limits.js +104 -0
- package/lib/constants/salesforce-limits.js.map +1 -0
- package/lib/dependencies/circular-dependency-detector.d.ts +137 -0
- package/lib/dependencies/circular-dependency-detector.js +329 -0
- package/lib/dependencies/circular-dependency-detector.js.map +1 -0
- package/lib/dependencies/cycle-remediation-planner.d.ts +50 -0
- package/lib/dependencies/cycle-remediation-planner.js +192 -0
- package/lib/dependencies/cycle-remediation-planner.js.map +1 -0
- package/lib/dependencies/dependency-cache.d.ts +134 -0
- package/lib/dependencies/dependency-cache.js +303 -0
- package/lib/dependencies/dependency-cache.js.map +1 -0
- package/lib/dependencies/dependency-depth-calculator.d.ts +145 -0
- package/lib/dependencies/dependency-depth-calculator.js +368 -0
- package/lib/dependencies/dependency-depth-calculator.js.map +1 -0
- package/lib/dependencies/dependency-graph-builder.d.ts +151 -0
- package/lib/dependencies/dependency-graph-builder.js +411 -0
- package/lib/dependencies/dependency-graph-builder.js.map +1 -0
- package/lib/dependencies/dependency-impact-analyzer.d.ts +145 -0
- package/lib/dependencies/dependency-impact-analyzer.js +330 -0
- package/lib/dependencies/dependency-impact-analyzer.js.map +1 -0
- package/lib/dependencies/dependency-merger.d.ts +122 -0
- package/lib/dependencies/dependency-merger.js +245 -0
- package/lib/dependencies/dependency-merger.js.map +1 -0
- package/lib/dependencies/dependency-resolver.d.ts +157 -0
- package/lib/dependencies/dependency-resolver.js +298 -0
- package/lib/dependencies/dependency-resolver.js.map +1 -0
- package/lib/dependencies/dependency-validator.d.ts +123 -0
- package/lib/dependencies/dependency-validator.js +291 -0
- package/lib/dependencies/dependency-validator.js.map +1 -0
- package/lib/dependencies/graph-visualizer.d.ts +110 -0
- package/lib/dependencies/graph-visualizer.js +262 -0
- package/lib/dependencies/graph-visualizer.js.map +1 -0
- package/lib/dependencies/heuristic-inference.d.ts +136 -0
- package/lib/dependencies/heuristic-inference.js +430 -0
- package/lib/dependencies/heuristic-inference.js.map +1 -0
- package/lib/deployment/cycle-source-editor.d.ts +34 -0
- package/lib/deployment/cycle-source-editor.js +121 -0
- package/lib/deployment/cycle-source-editor.js.map +1 -0
- package/lib/deployment/deployment-error-handler.d.ts +38 -0
- package/lib/deployment/deployment-error-handler.js +79 -0
- package/lib/deployment/deployment-error-handler.js.map +1 -0
- package/lib/deployment/deployment-reporter.d.ts +63 -0
- package/lib/deployment/deployment-reporter.js +150 -0
- package/lib/deployment/deployment-reporter.js.map +1 -0
- package/lib/deployment/deployment-state-summary.d.ts +38 -0
- package/lib/deployment/deployment-state-summary.js +209 -0
- package/lib/deployment/deployment-state-summary.js.map +1 -0
- package/lib/deployment/deployment-status-service.d.ts +36 -0
- package/lib/deployment/deployment-status-service.js +128 -0
- package/lib/deployment/deployment-status-service.js.map +1 -0
- package/lib/deployment/deployment-tracker.d.ts +42 -0
- package/lib/deployment/deployment-tracker.js +79 -0
- package/lib/deployment/deployment-tracker.js.map +1 -0
- package/lib/deployment/deployment-validation-service.d.ts +28 -0
- package/lib/deployment/deployment-validation-service.js +161 -0
- package/lib/deployment/deployment-validation-service.js.map +1 -0
- package/lib/deployment/retry-handler.d.ts +37 -0
- package/lib/deployment/retry-handler.js +86 -0
- package/lib/deployment/retry-handler.js.map +1 -0
- package/lib/deployment/sf-cli-integration.d.ts +42 -0
- package/lib/deployment/sf-cli-integration.js +105 -0
- package/lib/deployment/sf-cli-integration.js.map +1 -0
- package/lib/deployment/state-manager.d.ts +61 -0
- package/lib/deployment/state-manager.js +83 -0
- package/lib/deployment/state-manager.js.map +1 -0
- package/lib/deployment/test-executor.d.ts +41 -0
- package/lib/deployment/test-executor.js +87 -0
- package/lib/deployment/test-executor.js.map +1 -0
- package/lib/errors/base-error.d.ts +24 -0
- package/lib/errors/base-error.js +66 -0
- package/lib/errors/base-error.js.map +1 -0
- package/lib/errors/dependency-error.d.ts +37 -0
- package/lib/errors/dependency-error.js +76 -0
- package/lib/errors/dependency-error.js.map +1 -0
- package/lib/errors/deployment-error.d.ts +55 -0
- package/lib/errors/deployment-error.js +132 -0
- package/lib/errors/deployment-error.js.map +1 -0
- package/lib/errors/index.d.ts +45 -0
- package/lib/errors/index.js +71 -0
- package/lib/errors/index.js.map +1 -0
- package/lib/errors/network-error.d.ts +53 -0
- package/lib/errors/network-error.js +111 -0
- package/lib/errors/network-error.js.map +1 -0
- package/lib/errors/parsing-error.d.ts +41 -0
- package/lib/errors/parsing-error.js +69 -0
- package/lib/errors/parsing-error.js.map +1 -0
- package/lib/errors/validation-error-reporter.d.ts +34 -0
- package/lib/errors/validation-error-reporter.js +99 -0
- package/lib/errors/validation-error-reporter.js.map +1 -0
- package/lib/errors/validation-error.d.ts +58 -0
- package/lib/errors/validation-error.js +131 -0
- package/lib/errors/validation-error.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/monitoring/performance-monitor.d.ts +98 -0
- package/lib/monitoring/performance-monitor.js +260 -0
- package/lib/monitoring/performance-monitor.js.map +1 -0
- package/lib/parsers/apex-class-parser.d.ts +47 -0
- package/lib/parsers/apex-class-parser.js +368 -0
- package/lib/parsers/apex-class-parser.js.map +1 -0
- package/lib/parsers/apex-trigger-parser.d.ts +48 -0
- package/lib/parsers/apex-trigger-parser.js +229 -0
- package/lib/parsers/apex-trigger-parser.js.map +1 -0
- package/lib/parsers/aura-parser.d.ts +55 -0
- package/lib/parsers/aura-parser.js +229 -0
- package/lib/parsers/aura-parser.js.map +1 -0
- package/lib/parsers/bot-parser.d.ts +65 -0
- package/lib/parsers/bot-parser.js +225 -0
- package/lib/parsers/bot-parser.js.map +1 -0
- package/lib/parsers/custom-metadata-parser.d.ts +94 -0
- package/lib/parsers/custom-metadata-parser.js +199 -0
- package/lib/parsers/custom-metadata-parser.js.map +1 -0
- package/lib/parsers/custom-object-parser.d.ts +62 -0
- package/lib/parsers/custom-object-parser.js +297 -0
- package/lib/parsers/custom-object-parser.js.map +1 -0
- package/lib/parsers/email-template-parser.d.ts +64 -0
- package/lib/parsers/email-template-parser.js +238 -0
- package/lib/parsers/email-template-parser.js.map +1 -0
- package/lib/parsers/error-resilient-parser.d.ts +110 -0
- package/lib/parsers/error-resilient-parser.js +277 -0
- package/lib/parsers/error-resilient-parser.js.map +1 -0
- package/lib/parsers/flexipage-parser.d.ts +64 -0
- package/lib/parsers/flexipage-parser.js +196 -0
- package/lib/parsers/flexipage-parser.js.map +1 -0
- package/lib/parsers/flow-parser.d.ts +54 -0
- package/lib/parsers/flow-parser.js +287 -0
- package/lib/parsers/flow-parser.js.map +1 -0
- package/lib/parsers/genai-prompt-parser.d.ts +67 -0
- package/lib/parsers/genai-prompt-parser.js +160 -0
- package/lib/parsers/genai-prompt-parser.js.map +1 -0
- package/lib/parsers/layout-parser.d.ts +64 -0
- package/lib/parsers/layout-parser.js +267 -0
- package/lib/parsers/layout-parser.js.map +1 -0
- package/lib/parsers/lwc-parser.d.ts +60 -0
- package/lib/parsers/lwc-parser.js +264 -0
- package/lib/parsers/lwc-parser.js.map +1 -0
- package/lib/parsers/permission-set-parser.d.ts +86 -0
- package/lib/parsers/permission-set-parser.js +152 -0
- package/lib/parsers/permission-set-parser.js.map +1 -0
- package/lib/parsers/profile-parser.d.ts +81 -0
- package/lib/parsers/profile-parser.js +141 -0
- package/lib/parsers/profile-parser.js.map +1 -0
- package/lib/parsers/visualforce-parser.d.ts +47 -0
- package/lib/parsers/visualforce-parser.js +180 -0
- package/lib/parsers/visualforce-parser.js.map +1 -0
- package/lib/provisioning/data-provisioner.d.ts +88 -0
- package/lib/provisioning/data-provisioner.js +257 -0
- package/lib/provisioning/data-provisioner.js.map +1 -0
- package/lib/scanner/custom-structure-scanner.d.ts +66 -0
- package/lib/scanner/custom-structure-scanner.js +229 -0
- package/lib/scanner/custom-structure-scanner.js.map +1 -0
- package/lib/scanner/forceignore-parser.d.ts +69 -0
- package/lib/scanner/forceignore-parser.js +195 -0
- package/lib/scanner/forceignore-parser.js.map +1 -0
- package/lib/scanner/metadata-format-scanner.d.ts +77 -0
- package/lib/scanner/metadata-format-scanner.js +282 -0
- package/lib/scanner/metadata-format-scanner.js.map +1 -0
- package/lib/scanner/monorepo-scanner.d.ts +71 -0
- package/lib/scanner/monorepo-scanner.js +225 -0
- package/lib/scanner/monorepo-scanner.js.map +1 -0
- package/lib/scanner/project-validator.d.ts +55 -0
- package/lib/scanner/project-validator.js +235 -0
- package/lib/scanner/project-validator.js.map +1 -0
- package/lib/scanner/sfdx-project-detector.d.ts +86 -0
- package/lib/scanner/sfdx-project-detector.js +240 -0
- package/lib/scanner/sfdx-project-detector.js.map +1 -0
- package/lib/scanner/structure-validator.d.ts +64 -0
- package/lib/scanner/structure-validator.js +296 -0
- package/lib/scanner/structure-validator.js.map +1 -0
- package/lib/services/metadata-scanner-service.d.ts +64 -0
- package/lib/services/metadata-scanner-service.js +651 -0
- package/lib/services/metadata-scanner-service.js.map +1 -0
- package/lib/types/agentforce.d.ts +157 -0
- package/lib/types/agentforce.js +2 -0
- package/lib/types/agentforce.js.map +1 -0
- package/lib/types/dependency.d.ts +98 -0
- package/lib/types/dependency.js +5 -0
- package/lib/types/dependency.js.map +1 -0
- package/lib/types/deployment-plan.d.ts +81 -0
- package/lib/types/deployment-plan.js +6 -0
- package/lib/types/deployment-plan.js.map +1 -0
- package/lib/types/deployment.d.ts +88 -0
- package/lib/types/deployment.js +5 -0
- package/lib/types/deployment.js.map +1 -0
- package/lib/types/graph.d.ts +35 -0
- package/lib/types/graph.js +5 -0
- package/lib/types/graph.js.map +1 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +17 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/metadata.d.ts +101 -0
- package/lib/types/metadata.js +13 -0
- package/lib/types/metadata.js.map +1 -0
- package/lib/types/project.d.ts +156 -0
- package/lib/types/project.js +56 -0
- package/lib/types/project.js.map +1 -0
- package/lib/types/salesforce/apex.d.ts +94 -0
- package/lib/types/salesforce/apex.js +6 -0
- package/lib/types/salesforce/apex.js.map +1 -0
- package/lib/types/salesforce/aura.d.ts +150 -0
- package/lib/types/salesforce/aura.js +6 -0
- package/lib/types/salesforce/aura.js.map +1 -0
- package/lib/types/salesforce/bot.d.ts +293 -0
- package/lib/types/salesforce/bot.js +6 -0
- package/lib/types/salesforce/bot.js.map +1 -0
- package/lib/types/salesforce/common.d.ts +15 -0
- package/lib/types/salesforce/common.js +5 -0
- package/lib/types/salesforce/common.js.map +1 -0
- package/lib/types/salesforce/custom-metadata.d.ts +92 -0
- package/lib/types/salesforce/custom-metadata.js +6 -0
- package/lib/types/salesforce/custom-metadata.js.map +1 -0
- package/lib/types/salesforce/email.d.ts +56 -0
- package/lib/types/salesforce/email.js +6 -0
- package/lib/types/salesforce/email.js.map +1 -0
- package/lib/types/salesforce/flexipage.d.ts +149 -0
- package/lib/types/salesforce/flexipage.js +6 -0
- package/lib/types/salesforce/flexipage.js.map +1 -0
- package/lib/types/salesforce/flow.d.ts +516 -0
- package/lib/types/salesforce/flow.js +6 -0
- package/lib/types/salesforce/flow.js.map +1 -0
- package/lib/types/salesforce/genai.d.ts +67 -0
- package/lib/types/salesforce/genai.js +6 -0
- package/lib/types/salesforce/genai.js.map +1 -0
- package/lib/types/salesforce/index.d.ts +27 -0
- package/lib/types/salesforce/index.js +43 -0
- package/lib/types/salesforce/index.js.map +1 -0
- package/lib/types/salesforce/layout.d.ts +236 -0
- package/lib/types/salesforce/layout.js +6 -0
- package/lib/types/salesforce/layout.js.map +1 -0
- package/lib/types/salesforce/lwc.d.ts +123 -0
- package/lib/types/salesforce/lwc.js +6 -0
- package/lib/types/salesforce/lwc.js.map +1 -0
- package/lib/types/salesforce/object.d.ts +427 -0
- package/lib/types/salesforce/object.js +6 -0
- package/lib/types/salesforce/object.js.map +1 -0
- package/lib/types/salesforce/parser-types.d.ts +79 -0
- package/lib/types/salesforce/parser-types.js +80 -0
- package/lib/types/salesforce/parser-types.js.map +1 -0
- package/lib/types/salesforce/permission.d.ts +289 -0
- package/lib/types/salesforce/permission.js +6 -0
- package/lib/types/salesforce/permission.js.map +1 -0
- package/lib/types/salesforce/resource.d.ts +93 -0
- package/lib/types/salesforce/resource.js +6 -0
- package/lib/types/salesforce/resource.js.map +1 -0
- package/lib/types/salesforce/visualforce.d.ts +70 -0
- package/lib/types/salesforce/visualforce.js +6 -0
- package/lib/types/salesforce/visualforce.js.map +1 -0
- package/lib/utils/cache-manager.d.ts +158 -0
- package/lib/utils/cache-manager.js +429 -0
- package/lib/utils/cache-manager.js.map +1 -0
- package/lib/utils/deployment-plan-manager.d.ts +40 -0
- package/lib/utils/deployment-plan-manager.js +183 -0
- package/lib/utils/deployment-plan-manager.js.map +1 -0
- package/lib/utils/error-aggregator.d.ts +117 -0
- package/lib/utils/error-aggregator.js +268 -0
- package/lib/utils/error-aggregator.js.map +1 -0
- package/lib/utils/file-system.d.ts +62 -0
- package/lib/utils/file-system.js +167 -0
- package/lib/utils/file-system.js.map +1 -0
- package/lib/utils/functional.d.ts +52 -0
- package/lib/utils/functional.js +61 -0
- package/lib/utils/functional.js.map +1 -0
- package/lib/utils/graph-algorithms.d.ts +53 -0
- package/lib/utils/graph-algorithms.js +177 -0
- package/lib/utils/graph-algorithms.js.map +1 -0
- package/lib/utils/logger.d.ts +154 -0
- package/lib/utils/logger.js +327 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/network-handler.d.ts +64 -0
- package/lib/utils/network-handler.js +147 -0
- package/lib/utils/network-handler.js.map +1 -0
- package/lib/utils/performance.d.ts +148 -0
- package/lib/utils/performance.js +294 -0
- package/lib/utils/performance.js.map +1 -0
- package/lib/utils/string.d.ts +197 -0
- package/lib/utils/string.js +331 -0
- package/lib/utils/string.js.map +1 -0
- package/lib/utils/xml.d.ts +97 -0
- package/lib/utils/xml.js +227 -0
- package/lib/utils/xml.js.map +1 -0
- package/lib/validators/xml-metadata-validator.d.ts +106 -0
- package/lib/validators/xml-metadata-validator.js +509 -0
- package/lib/validators/xml-metadata-validator.js.map +1 -0
- package/lib/waves/priority-wave-generator-ai.d.ts +85 -0
- package/lib/waves/priority-wave-generator-ai.js +191 -0
- package/lib/waves/priority-wave-generator-ai.js.map +1 -0
- package/lib/waves/priority-wave-generator.d.ts +47 -0
- package/lib/waves/priority-wave-generator.js +88 -0
- package/lib/waves/priority-wave-generator.js.map +1 -0
- package/lib/waves/test-optimizer.d.ts +155 -0
- package/lib/waves/test-optimizer.js +290 -0
- package/lib/waves/test-optimizer.js.map +1 -0
- package/lib/waves/wave-builder.d.ts +147 -0
- package/lib/waves/wave-builder.js +286 -0
- package/lib/waves/wave-builder.js.map +1 -0
- package/lib/waves/wave-diff-generator.d.ts +17 -0
- package/lib/waves/wave-diff-generator.js +6 -0
- package/lib/waves/wave-diff-generator.js.map +1 -0
- package/lib/waves/wave-executor.d.ts +33 -0
- package/lib/waves/wave-executor.js +50 -0
- package/lib/waves/wave-executor.js.map +1 -0
- package/lib/waves/wave-merger.d.ts +96 -0
- package/lib/waves/wave-merger.js +181 -0
- package/lib/waves/wave-merger.js.map +1 -0
- package/lib/waves/wave-metadata-generator.d.ts +13 -0
- package/lib/waves/wave-metadata-generator.js +12 -0
- package/lib/waves/wave-metadata-generator.js.map +1 -0
- package/lib/waves/wave-splitter.d.ts +154 -0
- package/lib/waves/wave-splitter.js +307 -0
- package/lib/waves/wave-splitter.js.map +1 -0
- package/lib/waves/wave-validator.d.ts +17 -0
- package/lib/waves/wave-validator.js +15 -0
- package/lib/waves/wave-validator.js.map +1 -0
- package/messages/analyze.json +18 -0
- package/messages/config.json +29 -0
- package/messages/resume.json +9 -0
- package/messages/start.json +24 -0
- package/messages/status.json +8 -0
- package/messages/validate.json +9 -0
- package/npm-shrinkwrap.json +25676 -0
- package/oclif.lock +11988 -0
- package/oclif.manifest.json +589 -0
- package/package.json +224 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Merger
|
|
3
|
+
* Merges static parser dependencies with AI-inferred dependencies
|
|
4
|
+
*
|
|
5
|
+
* @ac US-037-AC-1: Merge static parser dependencies
|
|
6
|
+
* @ac US-037-AC-2: Merge AI-inferred dependencies
|
|
7
|
+
* @ac US-037-AC-3: Resolve conflicts (prefer static)
|
|
8
|
+
* @ac US-037-AC-4: Track dependency source
|
|
9
|
+
* @ac US-037-AC-5: Report merged dependencies
|
|
10
|
+
* @ac US-037-AC-6: Confidence scoring
|
|
11
|
+
*
|
|
12
|
+
* @issue #37
|
|
13
|
+
*/
|
|
14
|
+
import { getLogger } from '../utils/logger.js';
|
|
15
|
+
const logger = getLogger('DependencyMerger');
|
|
16
|
+
/**
|
|
17
|
+
* Dependency Merger
|
|
18
|
+
*
|
|
19
|
+
* Merges dependencies from multiple sources:
|
|
20
|
+
* 1. Static parser dependencies (from metadata files)
|
|
21
|
+
* 2. AI-inferred dependencies (from heuristics/patterns)
|
|
22
|
+
*
|
|
23
|
+
* Conflict Resolution:
|
|
24
|
+
* - Static dependencies always take precedence
|
|
25
|
+
* - Inferred dependencies are added if not in static
|
|
26
|
+
* - Confidence scores help prioritize inferences
|
|
27
|
+
*
|
|
28
|
+
* Performance: O(V + E)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const merger = new DependencyMerger({
|
|
32
|
+
* minConfidence: 0.7,
|
|
33
|
+
* preferStatic: true
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const result = merger.merge(components, inferences);
|
|
37
|
+
* console.log(`Merged ${result.stats.totalDependencies} dependencies`);
|
|
38
|
+
*/
|
|
39
|
+
export class DependencyMerger {
|
|
40
|
+
options;
|
|
41
|
+
constructor(options = {}) {
|
|
42
|
+
this.options = {
|
|
43
|
+
minConfidence: options.minConfidence ?? 0.5,
|
|
44
|
+
preferStatic: options.preferStatic ?? true,
|
|
45
|
+
includeLowConfidence: options.includeLowConfidence ?? false,
|
|
46
|
+
};
|
|
47
|
+
logger.debug('Initialized DependencyMerger', {
|
|
48
|
+
minConfidence: this.options.minConfidence,
|
|
49
|
+
preferStatic: this.options.preferStatic,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @ac US-037-AC-1: Merge static parser dependencies
|
|
54
|
+
* @ac US-037-AC-2: Merge AI-inferred dependencies
|
|
55
|
+
* @ac US-037-AC-3: Resolve conflicts (prefer static)
|
|
56
|
+
* @ac US-037-AC-4: Track dependency source
|
|
57
|
+
* @ac US-037-AC-5: Report merged dependencies
|
|
58
|
+
*/
|
|
59
|
+
merge(components, inferences) {
|
|
60
|
+
const startTime = Date.now();
|
|
61
|
+
// Build graph from static dependencies
|
|
62
|
+
const graph = new Map();
|
|
63
|
+
const dependencies = [];
|
|
64
|
+
const staticEdges = new Set();
|
|
65
|
+
// Add static dependencies first
|
|
66
|
+
for (const [nodeId, component] of components.entries()) {
|
|
67
|
+
if (!graph.has(nodeId)) {
|
|
68
|
+
graph.set(nodeId, new Set());
|
|
69
|
+
}
|
|
70
|
+
for (const dep of component.dependencies) {
|
|
71
|
+
graph.get(nodeId).add(dep);
|
|
72
|
+
staticEdges.add(`${nodeId}→${dep}`);
|
|
73
|
+
dependencies.push({
|
|
74
|
+
from: nodeId,
|
|
75
|
+
to: dep,
|
|
76
|
+
source: 'static',
|
|
77
|
+
confidence: 1.0,
|
|
78
|
+
reasons: ['Explicit reference in metadata'],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
let conflicts = 0;
|
|
83
|
+
let inferredCount = 0;
|
|
84
|
+
let totalConfidence = 0;
|
|
85
|
+
// Add inferred dependencies
|
|
86
|
+
for (const inference of inferences) {
|
|
87
|
+
const edgeKey = `${inference.from}→${inference.to}`;
|
|
88
|
+
// Check confidence threshold
|
|
89
|
+
if (inference.confidence < this.options.minConfidence && !this.options.includeLowConfidence) {
|
|
90
|
+
logger.debug('Skipping low confidence inference', {
|
|
91
|
+
from: inference.from,
|
|
92
|
+
to: inference.to,
|
|
93
|
+
confidence: inference.confidence,
|
|
94
|
+
});
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
// Check if static dependency exists
|
|
98
|
+
if (staticEdges.has(edgeKey)) {
|
|
99
|
+
conflicts++;
|
|
100
|
+
logger.debug('Conflict: static dependency exists', {
|
|
101
|
+
from: inference.from,
|
|
102
|
+
to: inference.to,
|
|
103
|
+
});
|
|
104
|
+
if (!this.options.preferStatic) {
|
|
105
|
+
// Update source to merged
|
|
106
|
+
const existing = dependencies.find((d) => d.from === inference.from && d.to === inference.to);
|
|
107
|
+
if (existing) {
|
|
108
|
+
existing.source = 'merged';
|
|
109
|
+
existing.reasons.push(inference.reason);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
// Add inferred dependency
|
|
115
|
+
if (!graph.has(inference.from)) {
|
|
116
|
+
graph.set(inference.from, new Set());
|
|
117
|
+
}
|
|
118
|
+
graph.get(inference.from).add(inference.to);
|
|
119
|
+
inferredCount++;
|
|
120
|
+
totalConfidence += inference.confidence;
|
|
121
|
+
dependencies.push({
|
|
122
|
+
from: inference.from,
|
|
123
|
+
to: inference.to,
|
|
124
|
+
source: 'inferred',
|
|
125
|
+
confidence: inference.confidence,
|
|
126
|
+
reasons: [inference.reason],
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Calculate statistics
|
|
130
|
+
const stats = {
|
|
131
|
+
totalDependencies: dependencies.length,
|
|
132
|
+
staticDependencies: staticEdges.size,
|
|
133
|
+
inferredDependencies: inferredCount,
|
|
134
|
+
mergedDependencies: dependencies.filter((d) => d.source === 'merged').length,
|
|
135
|
+
conflicts,
|
|
136
|
+
avgConfidence: inferredCount > 0 ? totalConfidence / inferredCount : 1.0,
|
|
137
|
+
};
|
|
138
|
+
const duration = Date.now() - startTime;
|
|
139
|
+
logger.info('Dependency merge completed', {
|
|
140
|
+
total: stats.totalDependencies,
|
|
141
|
+
static: stats.staticDependencies,
|
|
142
|
+
inferred: stats.inferredDependencies,
|
|
143
|
+
conflicts: stats.conflicts,
|
|
144
|
+
durationMs: duration,
|
|
145
|
+
});
|
|
146
|
+
return { graph, dependencies, stats };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Filter dependencies by confidence
|
|
150
|
+
*/
|
|
151
|
+
filterByConfidence(dependencies, minConfidence) {
|
|
152
|
+
return dependencies.filter((dep) => dep.confidence >= minConfidence);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get dependencies by source
|
|
156
|
+
*/
|
|
157
|
+
getDependenciesBySource(dependencies, source) {
|
|
158
|
+
return dependencies.filter((dep) => dep.source === source);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get low confidence dependencies (potential false positives)
|
|
162
|
+
*/
|
|
163
|
+
getLowConfidenceDependencies(dependencies, threshold = 0.7) {
|
|
164
|
+
return dependencies.filter((dep) => dep.source === 'inferred' && dep.confidence < threshold);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @ac US-037-AC-6: Confidence scoring
|
|
168
|
+
*/
|
|
169
|
+
calculateOverallConfidence(dependencies) {
|
|
170
|
+
if (dependencies.length === 0) {
|
|
171
|
+
return 1.0;
|
|
172
|
+
}
|
|
173
|
+
const total = dependencies.reduce((sum, dep) => sum + dep.confidence, 0);
|
|
174
|
+
return total / dependencies.length;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get conflicts (dependencies that exist in both static and inferred)
|
|
178
|
+
*/
|
|
179
|
+
getConflicts(staticDeps, inferences) {
|
|
180
|
+
const conflicts = [];
|
|
181
|
+
for (const inference of inferences) {
|
|
182
|
+
const edgeKey = `${inference.from}→${inference.to}`;
|
|
183
|
+
if (staticDeps.has(edgeKey)) {
|
|
184
|
+
conflicts.push({
|
|
185
|
+
from: inference.from,
|
|
186
|
+
to: inference.to,
|
|
187
|
+
confidence: inference.confidence,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return conflicts;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Generate merge report
|
|
195
|
+
*/
|
|
196
|
+
generateReport(result) {
|
|
197
|
+
const lines = [];
|
|
198
|
+
lines.push('# Dependency Merge Report');
|
|
199
|
+
lines.push('');
|
|
200
|
+
lines.push('## Statistics');
|
|
201
|
+
lines.push(`- Total Dependencies: ${result.stats.totalDependencies}`);
|
|
202
|
+
lines.push(`- Static Dependencies: ${result.stats.staticDependencies}`);
|
|
203
|
+
lines.push(`- Inferred Dependencies: ${result.stats.inferredDependencies}`);
|
|
204
|
+
lines.push(`- Merged Dependencies: ${result.stats.mergedDependencies}`);
|
|
205
|
+
lines.push(`- Conflicts Resolved: ${result.stats.conflicts}`);
|
|
206
|
+
lines.push(`- Average Confidence: ${(result.stats.avgConfidence * 100).toFixed(1)}%`);
|
|
207
|
+
lines.push('');
|
|
208
|
+
// Group by source
|
|
209
|
+
const bySource = {
|
|
210
|
+
static: this.getDependenciesBySource(result.dependencies, 'static'),
|
|
211
|
+
inferred: this.getDependenciesBySource(result.dependencies, 'inferred'),
|
|
212
|
+
merged: this.getDependenciesBySource(result.dependencies, 'merged'),
|
|
213
|
+
};
|
|
214
|
+
lines.push('## Dependencies by Source');
|
|
215
|
+
lines.push('');
|
|
216
|
+
lines.push(`### Static (${bySource.static.length})`);
|
|
217
|
+
lines.push('Direct references from metadata files');
|
|
218
|
+
lines.push('');
|
|
219
|
+
lines.push(`### Inferred (${bySource.inferred.length})`);
|
|
220
|
+
if (bySource.inferred.length > 0) {
|
|
221
|
+
lines.push('AI/Heuristic inferred dependencies:');
|
|
222
|
+
for (const dep of bySource.inferred.slice(0, 10)) {
|
|
223
|
+
lines.push(`- ${dep.from} → ${dep.to} (${(dep.confidence * 100).toFixed(0)}%)`);
|
|
224
|
+
lines.push(` Reason: ${dep.reasons.join(', ')}`);
|
|
225
|
+
}
|
|
226
|
+
if (bySource.inferred.length > 10) {
|
|
227
|
+
lines.push(`... and ${bySource.inferred.length - 10} more`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
lines.push('');
|
|
231
|
+
lines.push(`### Merged (${bySource.merged.length})`);
|
|
232
|
+
lines.push('Dependencies confirmed by both static and inferred sources');
|
|
233
|
+
lines.push('');
|
|
234
|
+
// Low confidence warnings
|
|
235
|
+
const lowConf = this.getLowConfidenceDependencies(result.dependencies, 0.7);
|
|
236
|
+
if (lowConf.length > 0) {
|
|
237
|
+
lines.push('## ⚠️ Low Confidence Dependencies');
|
|
238
|
+
lines.push(`Found ${lowConf.length} dependencies with confidence < 70%`);
|
|
239
|
+
lines.push('Consider manual review of these inferences.');
|
|
240
|
+
lines.push('');
|
|
241
|
+
}
|
|
242
|
+
return lines.join('\n');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=dependency-merger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-merger.js","sourceRoot":"","sources":["../../src/dependencies/dependency-merger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,MAAM,MAAM,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC;AAmD7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,gBAAgB;IACnB,OAAO,CAA0B;IAEzC,YAAmB,UAAyB,EAAE;QAC5C,IAAI,CAAC,OAAO,GAAG;YACb,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,GAAG;YAC3C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,IAAI;YAC1C,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,KAAK;SAC5D,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE;YAC3C,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa;YACzC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;SACxC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CACV,UAA0C,EAC1C,UAAgC;QAEhC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,uCAAuC;QACvC,MAAM,KAAK,GAAoB,IAAI,GAAG,EAAE,CAAC;QACzC,MAAM,YAAY,GAAuB,EAAE,CAAC;QAC5C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;QAEtC,gCAAgC;QAChC,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YACvD,IAAI,CAAC,KA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IAAI,CAAC,6CAA6C,CAAC,CAAC;YAC1D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Resolver
|
|
3
|
+
* Resolves component dependencies and generates deployment order
|
|
4
|
+
*
|
|
5
|
+
* @ac US-033-AC-1: Resolve direct dependencies
|
|
6
|
+
* @ac US-033-AC-2: Resolve transitive dependencies
|
|
7
|
+
* @ac US-033-AC-3: Handle optional dependencies
|
|
8
|
+
* @ac US-033-AC-4: Skip managed package dependencies
|
|
9
|
+
* @ac US-033-AC-5: Report unresolved dependencies
|
|
10
|
+
* @ac US-033-AC-6: Generate dependency report
|
|
11
|
+
*
|
|
12
|
+
* @issue #33
|
|
13
|
+
*/
|
|
14
|
+
import type { NodeId, DependencyGraph, CircularDependency } from '../types/dependency.js';
|
|
15
|
+
import type { MetadataComponent } from '../types/metadata.js';
|
|
16
|
+
/**
|
|
17
|
+
* Dependency resolution status
|
|
18
|
+
*/
|
|
19
|
+
export type ResolutionStatus = 'resolved' | 'unresolved' | 'optional' | 'managed' | 'circular';
|
|
20
|
+
/**
|
|
21
|
+
* Resolved dependency information
|
|
22
|
+
*/
|
|
23
|
+
export type ResolvedDependency = {
|
|
24
|
+
nodeId: NodeId;
|
|
25
|
+
dependencies: NodeId[];
|
|
26
|
+
status: ResolutionStatus;
|
|
27
|
+
order: number;
|
|
28
|
+
reason?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Dependency resolution result
|
|
32
|
+
*/
|
|
33
|
+
export type ResolutionResult = {
|
|
34
|
+
resolved: Map<NodeId, ResolvedDependency>;
|
|
35
|
+
deploymentOrder: NodeId[];
|
|
36
|
+
unresolved: Array<{
|
|
37
|
+
nodeId: NodeId;
|
|
38
|
+
missingDependencies: NodeId[];
|
|
39
|
+
}>;
|
|
40
|
+
optional: NodeId[];
|
|
41
|
+
managed: NodeId[];
|
|
42
|
+
circular: CircularDependency[];
|
|
43
|
+
report: DependencyReport;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Dependency report
|
|
47
|
+
*/
|
|
48
|
+
export type DependencyReport = {
|
|
49
|
+
totalComponents: number;
|
|
50
|
+
resolvedCount: number;
|
|
51
|
+
unresolvedCount: number;
|
|
52
|
+
optionalCount: number;
|
|
53
|
+
managedCount: number;
|
|
54
|
+
circularCount: number;
|
|
55
|
+
deploymentLevels: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolver options
|
|
59
|
+
*/
|
|
60
|
+
export type ResolverOptions = {
|
|
61
|
+
/** Include optional dependencies in resolution */
|
|
62
|
+
includeOptional?: boolean;
|
|
63
|
+
/** Skip managed package components */
|
|
64
|
+
skipManaged?: boolean;
|
|
65
|
+
/** Circular dependencies to handle */
|
|
66
|
+
circularDependencies?: CircularDependency[];
|
|
67
|
+
/** Manual ordering constraints: [before, after] */
|
|
68
|
+
orderingConstraints?: Array<{
|
|
69
|
+
before: NodeId;
|
|
70
|
+
after: NodeId;
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Dependency Resolver
|
|
75
|
+
*
|
|
76
|
+
* Resolves dependencies and generates deployment order using topological sort.
|
|
77
|
+
* Handles circular dependencies, optional dependencies, and managed packages.
|
|
78
|
+
*
|
|
79
|
+
* Performance: O(V + E) using Kahn's algorithm
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const resolver = new DependencyResolver(graph, components);
|
|
83
|
+
* const result = resolver.resolve();
|
|
84
|
+
* console.log(`Deployment order: ${result.deploymentOrder.join(' → ')}`);
|
|
85
|
+
* console.log(`Unresolved: ${result.unresolved.length}`);
|
|
86
|
+
*/
|
|
87
|
+
export declare class DependencyResolver {
|
|
88
|
+
private graph;
|
|
89
|
+
private components;
|
|
90
|
+
private options;
|
|
91
|
+
constructor(graph: DependencyGraph, components: Map<NodeId, MetadataComponent>, options?: ResolverOptions);
|
|
92
|
+
/**
|
|
93
|
+
* Resolve all dependencies and generate deployment order
|
|
94
|
+
*
|
|
95
|
+
* @ac US-033-AC-1: Resolve direct dependencies
|
|
96
|
+
* @ac US-033-AC-2: Resolve transitive dependencies
|
|
97
|
+
* @ac US-033-AC-6: Generate dependency report
|
|
98
|
+
*/
|
|
99
|
+
resolve(): ResolutionResult;
|
|
100
|
+
/**
|
|
101
|
+
* Build filtered graph based on options
|
|
102
|
+
*/
|
|
103
|
+
private buildFilteredGraph;
|
|
104
|
+
/**
|
|
105
|
+
* Apply manual ordering constraints to the graph
|
|
106
|
+
*
|
|
107
|
+
* @ac US-033-AC-5: Support manual ordering constraints
|
|
108
|
+
*/
|
|
109
|
+
private applyOrderingConstraints;
|
|
110
|
+
/**
|
|
111
|
+
* Perform topological sort using Kahn's algorithm
|
|
112
|
+
*/
|
|
113
|
+
private topologicalSort;
|
|
114
|
+
/**
|
|
115
|
+
* Find missing dependencies for a node
|
|
116
|
+
*/
|
|
117
|
+
private findMissingDependencies;
|
|
118
|
+
/**
|
|
119
|
+
* Build resolved dependencies map with deployment order
|
|
120
|
+
*/
|
|
121
|
+
private buildResolvedMap;
|
|
122
|
+
/**
|
|
123
|
+
* @ac US-033-AC-3: Handle optional dependencies
|
|
124
|
+
* Note: Current MetadataComponent doesn't track dependency types
|
|
125
|
+
*/
|
|
126
|
+
private findOptionalDependencies;
|
|
127
|
+
/**
|
|
128
|
+
* @ac US-033-AC-4: Skip managed package dependencies
|
|
129
|
+
*/
|
|
130
|
+
private findManagedPackages;
|
|
131
|
+
/**
|
|
132
|
+
* Check if a component is from a managed package
|
|
133
|
+
*/
|
|
134
|
+
private isManagedPackage;
|
|
135
|
+
/**
|
|
136
|
+
* Check if a dependency is optional (soft dependency)
|
|
137
|
+
* Note: Current MetadataComponent uses Set<string> for dependencies
|
|
138
|
+
* For now, we'll return false as type info is not available
|
|
139
|
+
*/
|
|
140
|
+
private isOptionalDependency;
|
|
141
|
+
/**
|
|
142
|
+
* @ac US-033-AC-6: Generate dependency report
|
|
143
|
+
*/
|
|
144
|
+
private generateReport;
|
|
145
|
+
/**
|
|
146
|
+
* Get resolution status for a specific component
|
|
147
|
+
*/
|
|
148
|
+
getResolution(nodeId: NodeId): ResolvedDependency | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Check if a component can be resolved
|
|
151
|
+
*/
|
|
152
|
+
canResolve(nodeId: NodeId): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Get deployment order for specific components
|
|
155
|
+
*/
|
|
156
|
+
getDeploymentOrder(nodeIds: NodeId[]): NodeId[];
|
|
157
|
+
}
|