@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,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Structure Scanner - US-081
|
|
3
|
+
* Support non-standard SFDX project structures
|
|
4
|
+
*
|
|
5
|
+
* @ac US-081-AC-1: Detect custom package directories
|
|
6
|
+
* @ac US-081-AC-2: Support custom naming conventions
|
|
7
|
+
* @ac US-081-AC-3: Handle nested structures
|
|
8
|
+
* @ac US-081-AC-4: Support legacy structures
|
|
9
|
+
* @ac US-081-AC-5: Validate custom paths
|
|
10
|
+
* @ac US-081-AC-6: Generate structure report
|
|
11
|
+
* @issue #81
|
|
12
|
+
*/
|
|
13
|
+
import { promises as fs } from 'node:fs';
|
|
14
|
+
import * as path from 'node:path';
|
|
15
|
+
import { getLogger } from '../utils/logger.js';
|
|
16
|
+
const logger = getLogger('CustomStructureScanner');
|
|
17
|
+
/**
|
|
18
|
+
* @ac US-081-AC-1: Detect custom package directories
|
|
19
|
+
*/
|
|
20
|
+
export class CustomStructureScanner {
|
|
21
|
+
/**
|
|
22
|
+
* @ac US-081-AC-1: Detect custom package directories
|
|
23
|
+
* Scan for custom package directories
|
|
24
|
+
*/
|
|
25
|
+
async detectCustomPackageDirs(projectRoot) {
|
|
26
|
+
logger.info('Detecting custom package directories', { projectRoot });
|
|
27
|
+
const customDirs = [];
|
|
28
|
+
try {
|
|
29
|
+
// Check sfdx-project.json
|
|
30
|
+
const sfdxProjectPath = path.join(projectRoot, 'sfdx-project.json');
|
|
31
|
+
const content = await fs.readFile(sfdxProjectPath, 'utf-8');
|
|
32
|
+
const config = JSON.parse(content);
|
|
33
|
+
if (config.packageDirectories) {
|
|
34
|
+
for (const pkg of config.packageDirectories) {
|
|
35
|
+
if (pkg.path) {
|
|
36
|
+
customDirs.push(pkg.path);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Also scan for common patterns
|
|
41
|
+
const commonDirs = ['force-app', 'src', 'main', 'apps', 'packages'];
|
|
42
|
+
const existingCommonDirs = await Promise.all(commonDirs.map(async (dir) => {
|
|
43
|
+
const fullPath = path.join(projectRoot, dir);
|
|
44
|
+
try {
|
|
45
|
+
await fs.access(fullPath);
|
|
46
|
+
return dir;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
for (const dir of existingCommonDirs) {
|
|
53
|
+
if (dir && !customDirs.includes(dir)) {
|
|
54
|
+
customDirs.push(dir);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger.warn('Error detecting custom package dirs', {
|
|
60
|
+
error: error instanceof Error ? error.message : String(error),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
logger.info('Custom package directories detected', { count: customDirs.length });
|
|
64
|
+
return customDirs;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @ac US-081-AC-2: Support custom naming conventions
|
|
68
|
+
* Detect naming convention
|
|
69
|
+
*/
|
|
70
|
+
detectNamingConvention(directories) {
|
|
71
|
+
const standardPatterns = ['force-app', 'main/default', 'src'];
|
|
72
|
+
const hasStandard = directories.some((dir) => standardPatterns.some((pattern) => dir.includes(pattern)));
|
|
73
|
+
return hasStandard ? 'standard' : 'custom';
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @ac US-081-AC-3: Handle nested structures
|
|
77
|
+
* Check if structure is nested
|
|
78
|
+
*/
|
|
79
|
+
async isNestedStructure(projectRoot, packageDirs) {
|
|
80
|
+
const nestedResults = await Promise.all(packageDirs.map(async (dir) => {
|
|
81
|
+
const fullPath = path.join(projectRoot, dir);
|
|
82
|
+
try {
|
|
83
|
+
const entries = await fs.readdir(fullPath, { withFileTypes: true });
|
|
84
|
+
const subDirs = entries.filter((e) => e.isDirectory());
|
|
85
|
+
const hasMetadataSubdirs = subDirs.some((d) => ['classes', 'triggers', 'objects', 'lwc', 'aura'].includes(d.name));
|
|
86
|
+
if (hasMetadataSubdirs) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const nestedMatches = await Promise.all(subDirs.map(async (subDir) => {
|
|
90
|
+
const subPath = path.join(fullPath, subDir.name);
|
|
91
|
+
const subEntries = await fs.readdir(subPath, { withFileTypes: true });
|
|
92
|
+
return subEntries.some((e) => ['classes', 'triggers', 'objects'].includes(e.name));
|
|
93
|
+
}));
|
|
94
|
+
return nestedMatches.some(Boolean);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
return nestedResults.some(Boolean);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @ac US-081-AC-4: Support legacy structures
|
|
104
|
+
* Detect legacy structure (Metadata API format)
|
|
105
|
+
*/
|
|
106
|
+
async isLegacyStructure(projectRoot) {
|
|
107
|
+
try {
|
|
108
|
+
// Check for package.xml
|
|
109
|
+
await fs.access(path.join(projectRoot, 'package.xml'));
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Check for src/ directory (old format)
|
|
114
|
+
try {
|
|
115
|
+
await fs.access(path.join(projectRoot, 'src'));
|
|
116
|
+
// Check if it's really legacy or just a custom dir name
|
|
117
|
+
const packageXml = path.join(projectRoot, 'src', 'package.xml');
|
|
118
|
+
await fs.access(packageXml);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @ac US-081-AC-5: Validate custom paths
|
|
128
|
+
* Validate custom paths exist and are accessible
|
|
129
|
+
*/
|
|
130
|
+
async validateCustomPaths(projectRoot, customPaths) {
|
|
131
|
+
const errors = [];
|
|
132
|
+
const validationResults = await Promise.all(Object.entries(customPaths).map(async ([key, customPath]) => {
|
|
133
|
+
const fullPath = path.join(projectRoot, customPath);
|
|
134
|
+
try {
|
|
135
|
+
await fs.access(fullPath);
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return `Custom path not found: ${key} -> ${customPath}`;
|
|
140
|
+
}
|
|
141
|
+
}));
|
|
142
|
+
errors.push(...validationResults.filter((result) => result !== undefined));
|
|
143
|
+
return {
|
|
144
|
+
valid: errors.length === 0,
|
|
145
|
+
errors,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @ac US-081-AC-6: Generate structure report
|
|
150
|
+
* Scan and generate comprehensive structure report
|
|
151
|
+
*/
|
|
152
|
+
async scanStructure(projectRoot) {
|
|
153
|
+
logger.info('Scanning custom structure', { projectRoot });
|
|
154
|
+
const packageDirs = await this.detectCustomPackageDirs(projectRoot);
|
|
155
|
+
const namingConvention = this.detectNamingConvention(packageDirs);
|
|
156
|
+
const isNested = await this.isNestedStructure(projectRoot, packageDirs);
|
|
157
|
+
const isLegacy = await this.isLegacyStructure(projectRoot);
|
|
158
|
+
const warnings = [];
|
|
159
|
+
const recommendations = [];
|
|
160
|
+
// Generate warnings
|
|
161
|
+
if (namingConvention === 'custom') {
|
|
162
|
+
warnings.push('Custom naming convention detected - may affect deployment');
|
|
163
|
+
}
|
|
164
|
+
if (isNested) {
|
|
165
|
+
warnings.push('Nested structure detected - ensure proper scanning depth');
|
|
166
|
+
}
|
|
167
|
+
if (isLegacy) {
|
|
168
|
+
warnings.push('Legacy Metadata API format detected');
|
|
169
|
+
recommendations.push('Consider migrating to SFDX source format');
|
|
170
|
+
}
|
|
171
|
+
// Generate recommendations
|
|
172
|
+
if (packageDirs.length === 0) {
|
|
173
|
+
recommendations.push('No package directories found - check sfdx-project.json');
|
|
174
|
+
}
|
|
175
|
+
if (packageDirs.length > 5) {
|
|
176
|
+
recommendations.push('Many package directories - consider consolidating');
|
|
177
|
+
}
|
|
178
|
+
const structure = {
|
|
179
|
+
packageDirs,
|
|
180
|
+
namingConvention,
|
|
181
|
+
isNested,
|
|
182
|
+
isLegacy,
|
|
183
|
+
customPaths: {},
|
|
184
|
+
};
|
|
185
|
+
logger.info('Structure scan complete', {
|
|
186
|
+
packageDirs: packageDirs.length,
|
|
187
|
+
namingConvention,
|
|
188
|
+
isNested,
|
|
189
|
+
isLegacy,
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
structure,
|
|
193
|
+
warnings,
|
|
194
|
+
recommendations,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Format structure report
|
|
199
|
+
*/
|
|
200
|
+
formatReport(report) {
|
|
201
|
+
const lines = [];
|
|
202
|
+
lines.push('📂 Project Structure Report');
|
|
203
|
+
lines.push('═══════════════════════════════════════');
|
|
204
|
+
lines.push(`Package Directories: ${report.structure.packageDirs.length}`);
|
|
205
|
+
for (const dir of report.structure.packageDirs) {
|
|
206
|
+
lines.push(` • ${dir}`);
|
|
207
|
+
}
|
|
208
|
+
lines.push('');
|
|
209
|
+
lines.push(`Naming Convention: ${report.structure.namingConvention}`);
|
|
210
|
+
lines.push(`Nested Structure: ${report.structure.isNested ? 'Yes' : 'No'}`);
|
|
211
|
+
lines.push(`Legacy Format: ${report.structure.isLegacy ? 'Yes' : 'No'}`);
|
|
212
|
+
lines.push('');
|
|
213
|
+
if (report.warnings.length > 0) {
|
|
214
|
+
lines.push('⚠️ Warnings:');
|
|
215
|
+
for (const warning of report.warnings) {
|
|
216
|
+
lines.push(` • ${warning}`);
|
|
217
|
+
}
|
|
218
|
+
lines.push('');
|
|
219
|
+
}
|
|
220
|
+
if (report.recommendations.length > 0) {
|
|
221
|
+
lines.push('💡 Recommendations:');
|
|
222
|
+
for (const rec of report.recommendations) {
|
|
223
|
+
lines.push(` • ${rec}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return lines.join('\n');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=custom-structure-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-structure-scanner.js","sourceRoot":"","sources":["../../src/scanner/custom-structure-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,MAAM,MAAM,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAgBnD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACjC;;;OAGG;IACI,KAAK,CAAC,uBAAuB,CAAC,WAAmB;QACtD,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE,EAAE,WAAW,EAAE,CAA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;YAC5B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACtC,KAAK,CAAC,IAAI,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC;YAC/B,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAClC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;gBACzC,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .forceignore Parser - US-083
|
|
3
|
+
* Parses and applies .forceignore rules to filter metadata
|
|
4
|
+
*
|
|
5
|
+
* @ac US-083-AC-1: Parse .forceignore syntax
|
|
6
|
+
* @ac US-083-AC-2: Support glob patterns
|
|
7
|
+
* @ac US-083-AC-3: Support negation (!)
|
|
8
|
+
* @ac US-083-AC-4: Support comments (#)
|
|
9
|
+
* @ac US-083-AC-5: Respect .gitignore format
|
|
10
|
+
* @ac US-083-AC-6: Test against file paths
|
|
11
|
+
* @issue #83
|
|
12
|
+
*/
|
|
13
|
+
export type ForceIgnoreRule = {
|
|
14
|
+
pattern: string;
|
|
15
|
+
isNegation: boolean;
|
|
16
|
+
lineNumber: number;
|
|
17
|
+
};
|
|
18
|
+
export type ForceIgnoreResult = {
|
|
19
|
+
found: boolean;
|
|
20
|
+
filePath: string;
|
|
21
|
+
rules: ForceIgnoreRule[];
|
|
22
|
+
totalRules: number;
|
|
23
|
+
commentLines: number;
|
|
24
|
+
emptyLines: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @ac US-083-AC-1: Parse .forceignore syntax
|
|
28
|
+
* @ac US-083-AC-2: Support glob patterns
|
|
29
|
+
*/
|
|
30
|
+
export declare class ForceIgnoreParser {
|
|
31
|
+
private static readonly FORCEIGNORE_FILE;
|
|
32
|
+
private rules;
|
|
33
|
+
private projectRoot;
|
|
34
|
+
/**
|
|
35
|
+
* Load and parse .forceignore file
|
|
36
|
+
*/
|
|
37
|
+
load(projectRoot: string): Promise<ForceIgnoreResult>;
|
|
38
|
+
/**
|
|
39
|
+
* @ac US-083-AC-1: Parse .forceignore syntax
|
|
40
|
+
* @ac US-083-AC-3: Support negation (!)
|
|
41
|
+
* @ac US-083-AC-4: Support comments (#)
|
|
42
|
+
*/
|
|
43
|
+
private parseContent;
|
|
44
|
+
/**
|
|
45
|
+
* @ac US-083-AC-6: Test against file paths
|
|
46
|
+
* Check if a file path is ignored using minimatch
|
|
47
|
+
*/
|
|
48
|
+
isIgnored(filePath: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Filter an array of file paths based on .forceignore rules
|
|
51
|
+
*/
|
|
52
|
+
filterPaths(paths: string[]): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Get relative path from project root
|
|
55
|
+
*/
|
|
56
|
+
private getRelativePath;
|
|
57
|
+
/**
|
|
58
|
+
* Get all loaded rules
|
|
59
|
+
*/
|
|
60
|
+
getRules(): ForceIgnoreRule[];
|
|
61
|
+
/**
|
|
62
|
+
* Check if .forceignore is loaded
|
|
63
|
+
*/
|
|
64
|
+
isLoaded(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Generate report of loaded rules
|
|
67
|
+
*/
|
|
68
|
+
formatReport(result: ForceIgnoreResult): string;
|
|
69
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .forceignore Parser - US-083
|
|
3
|
+
* Parses and applies .forceignore rules to filter metadata
|
|
4
|
+
*
|
|
5
|
+
* @ac US-083-AC-1: Parse .forceignore syntax
|
|
6
|
+
* @ac US-083-AC-2: Support glob patterns
|
|
7
|
+
* @ac US-083-AC-3: Support negation (!)
|
|
8
|
+
* @ac US-083-AC-4: Support comments (#)
|
|
9
|
+
* @ac US-083-AC-5: Respect .gitignore format
|
|
10
|
+
* @ac US-083-AC-6: Test against file paths
|
|
11
|
+
* @issue #83
|
|
12
|
+
*/
|
|
13
|
+
import { readFile, access } from 'node:fs/promises';
|
|
14
|
+
import { resolve, relative, sep } from 'node:path';
|
|
15
|
+
import { minimatch } from 'minimatch';
|
|
16
|
+
import { getLogger } from '../utils/logger.js';
|
|
17
|
+
const logger = getLogger('ForceIgnoreParser');
|
|
18
|
+
/**
|
|
19
|
+
* @ac US-083-AC-1: Parse .forceignore syntax
|
|
20
|
+
* @ac US-083-AC-2: Support glob patterns
|
|
21
|
+
*/
|
|
22
|
+
export class ForceIgnoreParser {
|
|
23
|
+
static FORCEIGNORE_FILE = '.forceignore';
|
|
24
|
+
rules = [];
|
|
25
|
+
projectRoot = '';
|
|
26
|
+
/**
|
|
27
|
+
* Load and parse .forceignore file
|
|
28
|
+
*/
|
|
29
|
+
async load(projectRoot) {
|
|
30
|
+
this.projectRoot = projectRoot;
|
|
31
|
+
const filePath = resolve(projectRoot, ForceIgnoreParser.FORCEIGNORE_FILE);
|
|
32
|
+
const result = {
|
|
33
|
+
found: false,
|
|
34
|
+
filePath,
|
|
35
|
+
rules: [],
|
|
36
|
+
totalRules: 0,
|
|
37
|
+
commentLines: 0,
|
|
38
|
+
emptyLines: 0,
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
await access(filePath);
|
|
42
|
+
result.found = true;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
logger.debug('.forceignore not found', { projectRoot });
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const content = await readFile(filePath, 'utf-8');
|
|
50
|
+
const parseResult = this.parseContent(content);
|
|
51
|
+
this.rules = parseResult.rules;
|
|
52
|
+
result.rules = parseResult.rules;
|
|
53
|
+
result.totalRules = parseResult.totalRules;
|
|
54
|
+
result.commentLines = parseResult.commentLines;
|
|
55
|
+
result.emptyLines = parseResult.emptyLines;
|
|
56
|
+
logger.info('.forceignore loaded', {
|
|
57
|
+
rules: result.totalRules,
|
|
58
|
+
comments: result.commentLines,
|
|
59
|
+
});
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
logger.error('Failed to parse .forceignore', { error });
|
|
64
|
+
throw new Error(`Failed to parse .forceignore: ${error instanceof Error ? error.message : String(error)}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @ac US-083-AC-1: Parse .forceignore syntax
|
|
69
|
+
* @ac US-083-AC-3: Support negation (!)
|
|
70
|
+
* @ac US-083-AC-4: Support comments (#)
|
|
71
|
+
*/
|
|
72
|
+
parseContent(content) {
|
|
73
|
+
const lines = content.split('\n');
|
|
74
|
+
const rules = [];
|
|
75
|
+
let commentLines = 0;
|
|
76
|
+
let emptyLines = 0;
|
|
77
|
+
for (let i = 0; i < lines.length; i++) {
|
|
78
|
+
const line = lines[i].trim();
|
|
79
|
+
const lineNumber = i + 1;
|
|
80
|
+
// Skip empty lines
|
|
81
|
+
if (line.length === 0) {
|
|
82
|
+
emptyLines++;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
// Skip comments
|
|
86
|
+
if (line.startsWith('#')) {
|
|
87
|
+
commentLines++;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
// Handle negation
|
|
91
|
+
const isNegation = line.startsWith('!');
|
|
92
|
+
const pattern = isNegation ? line.slice(1) : line;
|
|
93
|
+
rules.push({
|
|
94
|
+
pattern,
|
|
95
|
+
isNegation,
|
|
96
|
+
lineNumber,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
rules,
|
|
101
|
+
totalRules: rules.length,
|
|
102
|
+
commentLines,
|
|
103
|
+
emptyLines,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @ac US-083-AC-6: Test against file paths
|
|
108
|
+
* Check if a file path is ignored using minimatch
|
|
109
|
+
*/
|
|
110
|
+
isIgnored(filePath) {
|
|
111
|
+
if (this.rules.length === 0) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
// Get relative path from project root
|
|
115
|
+
const relativePath = this.getRelativePath(filePath);
|
|
116
|
+
let ignored = false;
|
|
117
|
+
// Apply rules in order (later rules override earlier ones)
|
|
118
|
+
for (const rule of this.rules) {
|
|
119
|
+
// Use minimatch for glob matching (industry standard)
|
|
120
|
+
const matches = minimatch(relativePath, rule.pattern, {
|
|
121
|
+
dot: true, // Match dotfiles
|
|
122
|
+
matchBase: true, // Match basename
|
|
123
|
+
});
|
|
124
|
+
if (matches) {
|
|
125
|
+
ignored = !rule.isNegation;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return ignored;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Filter an array of file paths based on .forceignore rules
|
|
132
|
+
*/
|
|
133
|
+
filterPaths(paths) {
|
|
134
|
+
if (this.rules.length === 0) {
|
|
135
|
+
return paths;
|
|
136
|
+
}
|
|
137
|
+
return paths.filter((path) => !this.isIgnored(path));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get relative path from project root
|
|
141
|
+
*/
|
|
142
|
+
getRelativePath(filePath) {
|
|
143
|
+
const absolutePath = resolve(filePath);
|
|
144
|
+
const projectRoot = resolve(this.projectRoot);
|
|
145
|
+
let relativePath = relative(projectRoot, absolutePath);
|
|
146
|
+
// Normalize path separators to forward slashes
|
|
147
|
+
relativePath = relativePath.split(sep).join('/');
|
|
148
|
+
return relativePath;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get all loaded rules
|
|
152
|
+
*/
|
|
153
|
+
getRules() {
|
|
154
|
+
return [...this.rules];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Check if .forceignore is loaded
|
|
158
|
+
*/
|
|
159
|
+
isLoaded() {
|
|
160
|
+
return this.rules.length > 0 || this.projectRoot.length > 0;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Generate report of loaded rules
|
|
164
|
+
*/
|
|
165
|
+
formatReport(result) {
|
|
166
|
+
const lines = [];
|
|
167
|
+
lines.push('🚫 .forceignore Report');
|
|
168
|
+
lines.push('═══════════════════════════════════════');
|
|
169
|
+
if (!result.found) {
|
|
170
|
+
lines.push('⚠️ .forceignore not found');
|
|
171
|
+
lines.push('💡 All files will be included in deployment');
|
|
172
|
+
return lines.join('\n');
|
|
173
|
+
}
|
|
174
|
+
lines.push(`✅ .forceignore loaded: ${result.filePath}`);
|
|
175
|
+
lines.push('');
|
|
176
|
+
lines.push('📊 Statistics:');
|
|
177
|
+
lines.push(` Active Rules: ${result.totalRules}`);
|
|
178
|
+
lines.push(` Comment Lines: ${result.commentLines}`);
|
|
179
|
+
lines.push(` Empty Lines: ${result.emptyLines}`);
|
|
180
|
+
lines.push('');
|
|
181
|
+
if (result.rules.length > 0) {
|
|
182
|
+
lines.push('📋 Rules:');
|
|
183
|
+
for (const rule of result.rules.slice(0, 20)) {
|
|
184
|
+
// Show first 20
|
|
185
|
+
const prefix = rule.isNegation ? '!' : ' ';
|
|
186
|
+
lines.push(` ${prefix} ${rule.pattern}`);
|
|
187
|
+
}
|
|
188
|
+
if (result.rules.length > 20) {
|
|
189
|
+
lines.push(` ... and ${result.rules.length - 20} more`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return lines.join('\n');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=forceignore-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forceignore-parser.js","sourceRoot":"","sources":["../../src/scanner/forceignore-parser.ts"],"names":[],"mappings":"AAAA;;;;;;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API format (package.xml + src/)
|
|
4
|
+
*
|
|
5
|
+
* @ac US-080-AC-1: Detect package.xml
|
|
6
|
+
* @ac US-080-AC-2: Scan src/ directory
|
|
7
|
+
* @ac US-080-AC-3: Parse metadata format files
|
|
8
|
+
* @ac US-080-AC-4: Convert to source format internally
|
|
9
|
+
* @ac US-080-AC-5: Handle Documents folder structure
|
|
10
|
+
* @ac US-080-AC-6: Handle DigitalExperience bundles
|
|
11
|
+
* @issue #80
|
|
12
|
+
*/
|
|
13
|
+
import type { MetadataComponent } from '../types/metadata.js';
|
|
14
|
+
export type MetadataFormatScanResult = {
|
|
15
|
+
format: 'metadata-api' | 'source-format' | 'mixed';
|
|
16
|
+
packageXmlPath?: string;
|
|
17
|
+
srcDirectory?: string;
|
|
18
|
+
components: MetadataComponent[];
|
|
19
|
+
warnings: string[];
|
|
20
|
+
executionTime: number;
|
|
21
|
+
};
|
|
22
|
+
export type PackageXmlEntry = {
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @ac US-080-AC-1: Detect package.xml
|
|
28
|
+
* @ac US-080-AC-2: Scan src/ directory
|
|
29
|
+
*/
|
|
30
|
+
export declare class MetadataFormatScanner {
|
|
31
|
+
private readonly errorAggregator;
|
|
32
|
+
/**
|
|
33
|
+
* @ac US-080-AC-1: Detect package.xml
|
|
34
|
+
* Check if project uses Metadata API format
|
|
35
|
+
*/
|
|
36
|
+
detectFormat(projectRoot: string): 'metadata-api' | 'source-format' | 'mixed';
|
|
37
|
+
/**
|
|
38
|
+
* @ac US-080-AC-2: Scan src/ directory
|
|
39
|
+
* Scan Metadata API format project
|
|
40
|
+
*/
|
|
41
|
+
scan(projectRoot: string): Promise<MetadataFormatScanResult>;
|
|
42
|
+
/**
|
|
43
|
+
* @ac US-080-AC-3: Parse metadata format files
|
|
44
|
+
* Parse package.xml
|
|
45
|
+
*/
|
|
46
|
+
private parsePackageXml;
|
|
47
|
+
/**
|
|
48
|
+
* @ac US-080-AC-2: Scan src/ directory
|
|
49
|
+
* @ac US-080-AC-4: Convert to source format internally
|
|
50
|
+
* Scan Metadata API src/ directory
|
|
51
|
+
*/
|
|
52
|
+
private scanSrcDirectory;
|
|
53
|
+
/**
|
|
54
|
+
* @ac US-080-AC-3: Parse metadata format files
|
|
55
|
+
* Scan specific metadata type directory
|
|
56
|
+
*/
|
|
57
|
+
private scanTypeDirectory;
|
|
58
|
+
/**
|
|
59
|
+
* @ac US-080-AC-5: Handle Documents folder structure
|
|
60
|
+
* @ac US-080-AC-6: Handle DigitalExperience bundles
|
|
61
|
+
* Scan bundle directory (for Documents, DigitalExperience, etc.)
|
|
62
|
+
*/
|
|
63
|
+
private scanBundleDirectory;
|
|
64
|
+
/**
|
|
65
|
+
* @ac US-080-AC-4: Convert to source format internally
|
|
66
|
+
* Map Metadata API directory name to MetadataType
|
|
67
|
+
*/
|
|
68
|
+
private mapDirectoryToType;
|
|
69
|
+
/**
|
|
70
|
+
* Extract component name from filename
|
|
71
|
+
*/
|
|
72
|
+
private extractComponentName;
|
|
73
|
+
/**
|
|
74
|
+
* Get error report
|
|
75
|
+
*/
|
|
76
|
+
getErrorReport(): string;
|
|
77
|
+
}
|