@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
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Smart Deployment
|
|
2
|
+
|
|
3
|
+
[](https://github.com/jterrats/smart-deployment/actions/workflows/test.yml)
|
|
4
|
+
[](https://github.com/jterrats/smart-deployment/blob/main/LICENSE)
|
|
5
|
+
[](https://github.com/jterrats/smart-deployment/releases)
|
|
6
|
+
[](https://www.npmjs.com/package/@jterrats/smart-deployment)
|
|
7
|
+
[](https://www.npmjs.com/package/@jterrats/smart-deployment)
|
|
8
|
+
|
|
9
|
+
Smart Deployment is a Salesforce CLI plugin that analyzes metadata, builds deployment waves, validates project state, and executes staged deployments with optional AI assistance.
|
|
10
|
+
|
|
11
|
+
The current codebase supports:
|
|
12
|
+
|
|
13
|
+
- metadata scanning and dependency graph generation
|
|
14
|
+
- wave generation with circular dependency detection
|
|
15
|
+
- conservative circular dependency remediation for supported `ApexClass` cycles
|
|
16
|
+
- real CLI flows for `start`, `analyze`, `validate`, `status`, `resume`, and `config`
|
|
17
|
+
- AI-assisted dependency inference, priority weighting, and validation
|
|
18
|
+
- multiple LLM providers through a shared provider abstraction
|
|
19
|
+
|
|
20
|
+
## Current Status
|
|
21
|
+
|
|
22
|
+
This repository is in active development, but the command surface is now usable as a first working version.
|
|
23
|
+
|
|
24
|
+
What is working today:
|
|
25
|
+
|
|
26
|
+
- `sf smart-deployment analyze`
|
|
27
|
+
- `sf smart-deployment start`
|
|
28
|
+
- `sf smart-deployment validate`
|
|
29
|
+
- `sf smart-deployment status`
|
|
30
|
+
- `sf smart-deployment resume`
|
|
31
|
+
- `sf smart-deployment config`
|
|
32
|
+
- JSON and HTML analysis reports
|
|
33
|
+
- repo-level AI configuration via `.smart-deployment.json`
|
|
34
|
+
|
|
35
|
+
What is still partial:
|
|
36
|
+
|
|
37
|
+
- full live deployment validation against real Salesforce orgs across all flows
|
|
38
|
+
- broader automatic circular dependency remediation beyond simple supported cases
|
|
39
|
+
- richer deployment resume/polling semantics against remote deployment backends
|
|
40
|
+
- broader provider ecosystem beyond the currently implemented adapters
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
sf plugins install @jterrats/smart-deployment
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For local development:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
yarn install
|
|
52
|
+
yarn build
|
|
53
|
+
sf plugins link .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
Analyze a project:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
sf smart-deployment analyze --source-path force-app
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Generate a saved plan and JSON report:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
sf smart-deployment analyze \
|
|
68
|
+
--source-path force-app \
|
|
69
|
+
--use-ai \
|
|
70
|
+
--save-plan \
|
|
71
|
+
--output analysis.json \
|
|
72
|
+
--format json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Run a dry deployment:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
sf smart-deployment start \
|
|
79
|
+
--source-path force-app \
|
|
80
|
+
--dry-run
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Run with AI and allow conservative cycle remediation:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
sf smart-deployment start \
|
|
87
|
+
--source-path force-app \
|
|
88
|
+
--target-org myorg \
|
|
89
|
+
--use-ai \
|
|
90
|
+
--allow-cycle-remediation
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Validate without executing deployment:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
sf smart-deployment validate \
|
|
97
|
+
--source-path force-app \
|
|
98
|
+
--use-ai
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Show persisted deployment state:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
sf smart-deployment status --source-path force-app
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Resume a failed deployment from local state:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
sf smart-deployment resume \
|
|
111
|
+
--source-path force-app \
|
|
112
|
+
--retry-strategy standard
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Configure the default AI provider for a repo:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
sf smart-deployment config \
|
|
119
|
+
--source-path . \
|
|
120
|
+
--set-llm-provider openai \
|
|
121
|
+
--set-llm-model gpt-4o-mini
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Commands
|
|
125
|
+
|
|
126
|
+
See:
|
|
127
|
+
|
|
128
|
+
- [CLI reference](docs/cli-reference.md)
|
|
129
|
+
- [AI configuration](docs/ai-configuration.md)
|
|
130
|
+
- [Known limitations](docs/known-limitations.md)
|
|
131
|
+
- [Documentation index](docs/README.md)
|
|
132
|
+
|
|
133
|
+
## AI Providers
|
|
134
|
+
|
|
135
|
+
The AI layer is no longer Agentforce-only.
|
|
136
|
+
|
|
137
|
+
Current provider model:
|
|
138
|
+
|
|
139
|
+
- shared provider abstraction in `src/ai/llm-provider.ts`
|
|
140
|
+
- provider factory in `src/ai/llm-provider-factory.ts`
|
|
141
|
+
- concrete adapters currently implemented for:
|
|
142
|
+
- `agentforce`
|
|
143
|
+
- `openai`
|
|
144
|
+
|
|
145
|
+
AI is optional. When unavailable, supported flows fall back to deterministic heuristics where possible.
|
|
146
|
+
|
|
147
|
+
## Repo Configuration
|
|
148
|
+
|
|
149
|
+
Repo-scoped configuration is stored in:
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
.smart-deployment.json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Example:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"llm": {
|
|
160
|
+
"provider": "openai",
|
|
161
|
+
"model": "gpt-4o-mini",
|
|
162
|
+
"endpoint": "https://api.openai.com/v1/chat/completions",
|
|
163
|
+
"timeout": 30000
|
|
164
|
+
},
|
|
165
|
+
"priorities": {
|
|
166
|
+
"ApexClass:CriticalService": 100
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Deployment runtime state is stored separately under `.smart-deployment/` and should not be committed.
|
|
172
|
+
|
|
173
|
+
## Testing
|
|
174
|
+
|
|
175
|
+
Main commands:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
yarn test
|
|
179
|
+
yarn test:compile
|
|
180
|
+
yarn test:only
|
|
181
|
+
yarn lint
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The suite currently includes unit, integration-style, and NUT coverage for the main CLI flows.
|
|
185
|
+
|
|
186
|
+
## Documentation Policy
|
|
187
|
+
|
|
188
|
+
The repository contains both active documentation and historical design/planning material.
|
|
189
|
+
|
|
190
|
+
- active docs live in `docs/`
|
|
191
|
+
- archived historical docs live in `docs/archive/`
|
|
192
|
+
|
|
193
|
+
If a document describes flags or workflows that do not exist in the current command layer, treat the archived version as historical only.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentforce Error Handler - US-073
|
|
3
|
+
* Graceful AI failure handling with fallback
|
|
4
|
+
*
|
|
5
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
6
|
+
* @ac US-073-AC-2: Fallback to static analysis
|
|
7
|
+
* @ac US-073-AC-3: Log AI errors
|
|
8
|
+
* @ac US-073-AC-4: Warn user about fallback
|
|
9
|
+
* @ac US-073-AC-5: Continue deployment
|
|
10
|
+
* @ac US-073-AC-6: Report AI usage statistics
|
|
11
|
+
* @issue #73
|
|
12
|
+
*/
|
|
13
|
+
export type AIUsageStats = {
|
|
14
|
+
totalCalls: number;
|
|
15
|
+
successfulCalls: number;
|
|
16
|
+
failedCalls: number;
|
|
17
|
+
fallbackCount: number;
|
|
18
|
+
averageResponseTime: number;
|
|
19
|
+
errorsByType: Record<string, number>;
|
|
20
|
+
lastFailure?: Date;
|
|
21
|
+
lastSuccess?: Date;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
25
|
+
* @ac US-073-AC-2: Fallback to static analysis
|
|
26
|
+
*/
|
|
27
|
+
export declare class AgentforceErrorHandler {
|
|
28
|
+
private readonly stats;
|
|
29
|
+
private consecutiveFailures;
|
|
30
|
+
private readonly failureThreshold;
|
|
31
|
+
constructor();
|
|
32
|
+
/**
|
|
33
|
+
* @ac US-073-AC-2: Fallback to static analysis
|
|
34
|
+
* @ac US-073-AC-3: Log AI errors
|
|
35
|
+
* @ac US-073-AC-4: Warn user about fallback
|
|
36
|
+
* @ac US-073-AC-5: Continue deployment
|
|
37
|
+
* Execute AI call with error handling and fallback
|
|
38
|
+
*/
|
|
39
|
+
executeWithFallback<T>(aiCall: () => Promise<T>, fallback: () => T | Promise<T>, context: string): Promise<{
|
|
40
|
+
result: T;
|
|
41
|
+
usedFallback: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
45
|
+
* Record successful AI call
|
|
46
|
+
*/
|
|
47
|
+
private recordSuccess;
|
|
48
|
+
/**
|
|
49
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
50
|
+
* @ac US-073-AC-3: Log AI errors
|
|
51
|
+
* Record failed AI call
|
|
52
|
+
*/
|
|
53
|
+
private recordFailure;
|
|
54
|
+
/**
|
|
55
|
+
* Categorize AI error
|
|
56
|
+
*/
|
|
57
|
+
private categorizeError;
|
|
58
|
+
/**
|
|
59
|
+
* @ac US-073-AC-4: Warn user about fallback
|
|
60
|
+
* Warn user that AI is unavailable
|
|
61
|
+
*/
|
|
62
|
+
private warnUserAboutFallback;
|
|
63
|
+
/**
|
|
64
|
+
* @ac US-073-AC-6: Report AI usage statistics
|
|
65
|
+
* Get usage statistics
|
|
66
|
+
*/
|
|
67
|
+
getStats(): AIUsageStats;
|
|
68
|
+
/**
|
|
69
|
+
* Get failure rate
|
|
70
|
+
*/
|
|
71
|
+
private getFailureRate;
|
|
72
|
+
/**
|
|
73
|
+
* @ac US-073-AC-6: Report AI usage statistics
|
|
74
|
+
* Format usage report
|
|
75
|
+
*/
|
|
76
|
+
formatReport(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Reset statistics
|
|
79
|
+
*/
|
|
80
|
+
resetStats(): void;
|
|
81
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentforce Error Handler - US-073
|
|
3
|
+
* Graceful AI failure handling with fallback
|
|
4
|
+
*
|
|
5
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
6
|
+
* @ac US-073-AC-2: Fallback to static analysis
|
|
7
|
+
* @ac US-073-AC-3: Log AI errors
|
|
8
|
+
* @ac US-073-AC-4: Warn user about fallback
|
|
9
|
+
* @ac US-073-AC-5: Continue deployment
|
|
10
|
+
* @ac US-073-AC-6: Report AI usage statistics
|
|
11
|
+
* @issue #73
|
|
12
|
+
*/
|
|
13
|
+
import { getLogger } from '../utils/logger.js';
|
|
14
|
+
const logger = getLogger('AgentforceErrorHandler');
|
|
15
|
+
/**
|
|
16
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
17
|
+
* @ac US-073-AC-2: Fallback to static analysis
|
|
18
|
+
*/
|
|
19
|
+
export class AgentforceErrorHandler {
|
|
20
|
+
stats;
|
|
21
|
+
consecutiveFailures = 0;
|
|
22
|
+
failureThreshold = 5;
|
|
23
|
+
constructor() {
|
|
24
|
+
this.stats = {
|
|
25
|
+
totalCalls: 0,
|
|
26
|
+
successfulCalls: 0,
|
|
27
|
+
failedCalls: 0,
|
|
28
|
+
fallbackCount: 0,
|
|
29
|
+
averageResponseTime: 0,
|
|
30
|
+
errorsByType: {},
|
|
31
|
+
};
|
|
32
|
+
logger.info('Agentforce error handler initialized');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @ac US-073-AC-2: Fallback to static analysis
|
|
36
|
+
* @ac US-073-AC-3: Log AI errors
|
|
37
|
+
* @ac US-073-AC-4: Warn user about fallback
|
|
38
|
+
* @ac US-073-AC-5: Continue deployment
|
|
39
|
+
* Execute AI call with error handling and fallback
|
|
40
|
+
*/
|
|
41
|
+
async executeWithFallback(aiCall, fallback, context) {
|
|
42
|
+
const startTime = Date.now();
|
|
43
|
+
this.stats.totalCalls++;
|
|
44
|
+
try {
|
|
45
|
+
const result = await aiCall();
|
|
46
|
+
this.recordSuccess(Date.now() - startTime);
|
|
47
|
+
return {
|
|
48
|
+
result,
|
|
49
|
+
usedFallback: false,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.recordFailure(error, context);
|
|
54
|
+
// Use fallback
|
|
55
|
+
logger.warn('AI call failed, using fallback', {
|
|
56
|
+
context,
|
|
57
|
+
error: error instanceof Error ? error.message : String(error),
|
|
58
|
+
});
|
|
59
|
+
this.stats.fallbackCount++;
|
|
60
|
+
this.warnUserAboutFallback(context);
|
|
61
|
+
const fallbackResult = await fallback();
|
|
62
|
+
return {
|
|
63
|
+
result: fallbackResult,
|
|
64
|
+
usedFallback: true,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
70
|
+
* Record successful AI call
|
|
71
|
+
*/
|
|
72
|
+
recordSuccess(responseTime) {
|
|
73
|
+
this.stats.successfulCalls++;
|
|
74
|
+
this.stats.lastSuccess = new Date();
|
|
75
|
+
this.consecutiveFailures = 0; // Reset on success
|
|
76
|
+
// Update average response time
|
|
77
|
+
const total = this.stats.successfulCalls;
|
|
78
|
+
this.stats.averageResponseTime = (this.stats.averageResponseTime * (total - 1) + responseTime) / total;
|
|
79
|
+
logger.debug('AI call successful', {
|
|
80
|
+
responseTime,
|
|
81
|
+
averageResponseTime: this.stats.averageResponseTime,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @ac US-073-AC-1: Detect AI failures
|
|
86
|
+
* @ac US-073-AC-3: Log AI errors
|
|
87
|
+
* Record failed AI call
|
|
88
|
+
*/
|
|
89
|
+
recordFailure(error, context) {
|
|
90
|
+
this.stats.failedCalls++;
|
|
91
|
+
this.stats.lastFailure = new Date();
|
|
92
|
+
this.consecutiveFailures++;
|
|
93
|
+
// Categorize error
|
|
94
|
+
const errorType = this.categorizeError(error);
|
|
95
|
+
this.stats.errorsByType[errorType] = (this.stats.errorsByType[errorType] ?? 0) + 1;
|
|
96
|
+
logger.error('AI call failed', {
|
|
97
|
+
context,
|
|
98
|
+
errorType,
|
|
99
|
+
error: error instanceof Error ? error.message : String(error),
|
|
100
|
+
totalFailures: this.stats.failedCalls,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Categorize AI error
|
|
105
|
+
*/
|
|
106
|
+
categorizeError(error) {
|
|
107
|
+
if (error instanceof Error) {
|
|
108
|
+
if (error.message.includes('timeout'))
|
|
109
|
+
return 'timeout';
|
|
110
|
+
if (error.message.includes('rate limit'))
|
|
111
|
+
return 'rate-limit';
|
|
112
|
+
if (error.message.includes('unauthorized'))
|
|
113
|
+
return 'auth';
|
|
114
|
+
if (error.message.includes('network'))
|
|
115
|
+
return 'network';
|
|
116
|
+
if (error.message.includes('model'))
|
|
117
|
+
return 'model-error';
|
|
118
|
+
}
|
|
119
|
+
return 'unknown';
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @ac US-073-AC-4: Warn user about fallback
|
|
123
|
+
* Warn user that AI is unavailable
|
|
124
|
+
*/
|
|
125
|
+
warnUserAboutFallback(context) {
|
|
126
|
+
logger.warn('⚠️ AI service unavailable - using static analysis fallback', {
|
|
127
|
+
context,
|
|
128
|
+
consecutiveFailures: this.consecutiveFailures,
|
|
129
|
+
failureRate: this.getFailureRate(),
|
|
130
|
+
});
|
|
131
|
+
// Log warning (console.warn would be used in CLI context)
|
|
132
|
+
logger.warn(`AI unavailable for ${context} - using static analysis`);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @ac US-073-AC-6: Report AI usage statistics
|
|
136
|
+
* Get usage statistics
|
|
137
|
+
*/
|
|
138
|
+
getStats() {
|
|
139
|
+
return { ...this.stats };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get failure rate
|
|
143
|
+
*/
|
|
144
|
+
getFailureRate() {
|
|
145
|
+
if (this.stats.totalCalls === 0)
|
|
146
|
+
return 0;
|
|
147
|
+
return this.stats.failedCalls / this.stats.totalCalls;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @ac US-073-AC-6: Report AI usage statistics
|
|
151
|
+
* Format usage report
|
|
152
|
+
*/
|
|
153
|
+
formatReport() {
|
|
154
|
+
const lines = [];
|
|
155
|
+
const failureRate = (this.getFailureRate() * 100).toFixed(1);
|
|
156
|
+
const fallbackRate = this.stats.totalCalls > 0 ? ((this.stats.fallbackCount / this.stats.totalCalls) * 100).toFixed(1) : '0.0';
|
|
157
|
+
lines.push('🤖 AI Usage Statistics');
|
|
158
|
+
lines.push('═══════════════════════════════════════');
|
|
159
|
+
lines.push(`Total AI Calls: ${this.stats.totalCalls}`);
|
|
160
|
+
lines.push(`Successful: ${this.stats.successfulCalls}`);
|
|
161
|
+
lines.push(`Failed: ${this.stats.failedCalls}`);
|
|
162
|
+
lines.push(`Fallback Used: ${this.stats.fallbackCount} (${fallbackRate}%)`);
|
|
163
|
+
lines.push(`Failure Rate: ${failureRate}%`);
|
|
164
|
+
lines.push(`Avg Response Time: ${Math.round(this.stats.averageResponseTime)}ms`);
|
|
165
|
+
lines.push('');
|
|
166
|
+
if (Object.keys(this.stats.errorsByType).length > 0) {
|
|
167
|
+
lines.push('Errors by Type:');
|
|
168
|
+
for (const [type, count] of Object.entries(this.stats.errorsByType)) {
|
|
169
|
+
lines.push(` ${type}: ${count}`);
|
|
170
|
+
}
|
|
171
|
+
lines.push('');
|
|
172
|
+
}
|
|
173
|
+
if (this.stats.lastFailure) {
|
|
174
|
+
const timeSince = Date.now() - this.stats.lastFailure.getTime();
|
|
175
|
+
lines.push(`Last Failure: ${Math.floor(timeSince / 1000)}s ago`);
|
|
176
|
+
}
|
|
177
|
+
lines.push('');
|
|
178
|
+
lines.push(`Consecutive Failures: ${this.consecutiveFailures}/${this.failureThreshold}`);
|
|
179
|
+
return lines.join('\n');
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Reset statistics
|
|
183
|
+
*/
|
|
184
|
+
resetStats() {
|
|
185
|
+
this.stats.totalCalls = 0;
|
|
186
|
+
this.stats.successfulCalls = 0;
|
|
187
|
+
this.stats.failedCalls = 0;
|
|
188
|
+
this.stats.fallbackCount = 0;
|
|
189
|
+
this.stats.averageResponseTime = 0;
|
|
190
|
+
this.stats.errorsByType = {};
|
|
191
|
+
this.stats.lastFailure = undefined;
|
|
192
|
+
this.stats.lastSuccess = undefined;
|
|
193
|
+
logger.info('AI usage stats reset');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=agentforce-error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentforce-error-handler.js","sourceRoot":"","sources":["../../src/ai/agentforce-error-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,MAAM,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAanD;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAChB,KAAK,CAAe;IAC7B,mBAAmB,GAAG,CAAC,CAAC;IACf,gBAAgB,GAAG,CAAC,CAAC;IAEtC;QACE,IAAI,CAAC,KAAK,GAAG;YACX,UAAU,EAAE,CAAC;YACb,eAAe,EAAE,CAAC;YAClB,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;YAChB,mBAAmB,EAAE,CAAC;YACtB,YAAY,EAAE,EAAE;SACjB,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,mBAAmB,CAC9B,MAAwB,EACxB,QAA8B,EAC9B,OAAe;QAEf,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QAExB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;YAE3C,OAAO;gBACL,MAAM;gBACN,YAAY,EAAE,KAA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BAAgB,EAAE,CAAC,CAAC;QAEzF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;QAEnC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentforce Priority Service - US-057
|
|
3
|
+
* Uses Salesforce AI to suggest component deployment priorities
|
|
4
|
+
*
|
|
5
|
+
* @ac US-057-AC-1: Send component list to Agentforce
|
|
6
|
+
* @ac US-057-AC-2: Receive priority recommendations
|
|
7
|
+
* @ac US-057-AC-3: Consider business criticality
|
|
8
|
+
* @ac US-057-AC-4: Consider failure impact
|
|
9
|
+
* @ac US-057-AC-5: Merge with static priorities
|
|
10
|
+
* @ac US-057-AC-6: Report AI decisions
|
|
11
|
+
* @issue #57
|
|
12
|
+
*/
|
|
13
|
+
import type { MetadataComponent } from '../types/metadata.js';
|
|
14
|
+
import type { AgentforceFetch } from './agentforce-service.js';
|
|
15
|
+
import type { LLMProvider, LLMProviderName } from './llm-provider.js';
|
|
16
|
+
export type PriorityRecommendation = {
|
|
17
|
+
componentName: string;
|
|
18
|
+
priority: number;
|
|
19
|
+
reason: string;
|
|
20
|
+
confidence: number;
|
|
21
|
+
businessCriticality: 'low' | 'medium' | 'high' | 'critical';
|
|
22
|
+
failureImpact: 'low' | 'medium' | 'high' | 'critical';
|
|
23
|
+
};
|
|
24
|
+
export type AgentforceConfig = {
|
|
25
|
+
baseDir?: string;
|
|
26
|
+
provider?: LLMProviderName;
|
|
27
|
+
endpoint?: string;
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
model?: string;
|
|
30
|
+
timeout?: number;
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
maxRetries?: number;
|
|
33
|
+
rateLimit?: number;
|
|
34
|
+
fetchFn?: AgentforceFetch;
|
|
35
|
+
llmProvider?: LLMProvider;
|
|
36
|
+
};
|
|
37
|
+
export type PriorityAnalysisResult = {
|
|
38
|
+
recommendations: PriorityRecommendation[];
|
|
39
|
+
totalComponents: number;
|
|
40
|
+
aiAdjustments: number;
|
|
41
|
+
executionTime: number;
|
|
42
|
+
tokensUsed?: number;
|
|
43
|
+
usedFallback: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @ac US-057-AC-1: Send component list to Agentforce
|
|
47
|
+
* @ac US-057-AC-2: Receive priority recommendations
|
|
48
|
+
*/
|
|
49
|
+
export declare class AgentforcePriorityService {
|
|
50
|
+
private readonly llmProvider;
|
|
51
|
+
private readonly enabled;
|
|
52
|
+
constructor(config?: AgentforceConfig);
|
|
53
|
+
/**
|
|
54
|
+
* @ac US-057-AC-1: Send component list to Agentforce
|
|
55
|
+
* @ac US-057-AC-2: Receive priority recommendations
|
|
56
|
+
* @ac US-057-AC-3: Consider business criticality
|
|
57
|
+
* @ac US-057-AC-4: Consider failure impact
|
|
58
|
+
*/
|
|
59
|
+
analyzePriorities(components: MetadataComponent[], context?: {
|
|
60
|
+
orgType?: string;
|
|
61
|
+
industry?: string;
|
|
62
|
+
}): Promise<PriorityAnalysisResult>;
|
|
63
|
+
/**
|
|
64
|
+
* @ac US-057-AC-3: Consider business criticality
|
|
65
|
+
* @ac US-057-AC-4: Consider failure impact
|
|
66
|
+
*/
|
|
67
|
+
private buildPriorityPrompt;
|
|
68
|
+
/**
|
|
69
|
+
* @ac US-057-AC-1: Send component list to Agentforce
|
|
70
|
+
*/
|
|
71
|
+
private parseResponse;
|
|
72
|
+
/**
|
|
73
|
+
* Mock response for testing and fallback
|
|
74
|
+
*/
|
|
75
|
+
private getMockResponse;
|
|
76
|
+
private createFallbackResult;
|
|
77
|
+
/**
|
|
78
|
+
* @ac US-057-AC-6: Report AI decisions
|
|
79
|
+
*/
|
|
80
|
+
formatDecisionReport(result: PriorityAnalysisResult): string;
|
|
81
|
+
getProviderConfig(): Readonly<ReturnType<LLMProvider['getConfig']>>;
|
|
82
|
+
}
|