scc-universal 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +44 -0
- package/.cursor/agents/deep-researcher.md +142 -0
- package/.cursor/agents/doc-updater.md +219 -0
- package/.cursor/agents/eval-runner.md +335 -0
- package/.cursor/agents/learning-engine.md +210 -0
- package/.cursor/agents/loop-operator.md +245 -0
- package/.cursor/agents/refactor-cleaner.md +119 -0
- package/.cursor/agents/sf-admin-agent.md +127 -0
- package/.cursor/agents/sf-agentforce-agent.md +126 -0
- package/.cursor/agents/sf-apex-agent.md +117 -0
- package/.cursor/agents/sf-architect.md +426 -0
- package/.cursor/agents/sf-aura-reviewer.md +369 -0
- package/.cursor/agents/sf-bugfix-agent.md +101 -0
- package/.cursor/agents/sf-flow-agent.md +155 -0
- package/.cursor/agents/sf-integration-agent.md +141 -0
- package/.cursor/agents/sf-lwc-agent.md +123 -0
- package/.cursor/agents/sf-review-agent.md +357 -0
- package/.cursor/agents/sf-visualforce-reviewer.md +465 -0
- package/.cursor/hooks/adapter.js +81 -0
- package/.cursor/hooks/after-file-edit.js +26 -0
- package/.cursor/hooks/after-mcp-execution.js +12 -0
- package/.cursor/hooks/after-shell-execution.js +30 -0
- package/.cursor/hooks/after-tab-file-edit.js +12 -0
- package/.cursor/hooks/before-mcp-execution.js +11 -0
- package/.cursor/hooks/before-read-file.js +13 -0
- package/.cursor/hooks/before-shell-execution.js +29 -0
- package/.cursor/hooks/before-submit-prompt.js +23 -0
- package/.cursor/hooks/pre-compact.js +7 -0
- package/.cursor/hooks/session-end.js +10 -0
- package/.cursor/hooks/session-start.js +10 -0
- package/.cursor/hooks/stop.js +18 -0
- package/.cursor/hooks/subagent-start.js +10 -0
- package/.cursor/hooks/subagent-stop.js +10 -0
- package/.cursor/hooks.json +107 -0
- package/.cursor/skills/aside/SKILL.md +115 -0
- package/.cursor/skills/checkpoint/SKILL.md +50 -0
- package/.cursor/skills/configure-scc/SKILL.md +160 -0
- package/.cursor/skills/continuous-agent-loop/SKILL.md +260 -0
- package/.cursor/skills/mcp-server-patterns/SKILL.md +142 -0
- package/.cursor/skills/model-route/SKILL.md +81 -0
- package/.cursor/skills/prompt-optimizer/SKILL.md +366 -0
- package/.cursor/skills/refactor-clean/SKILL.md +133 -0
- package/.cursor/skills/resume-session/SKILL.md +111 -0
- package/.cursor/skills/save-session/SKILL.md +183 -0
- package/.cursor/skills/search-first/SKILL.md +140 -0
- package/.cursor/skills/security-scan/SKILL.md +142 -0
- package/.cursor/skills/sessions/SKILL.md +124 -0
- package/.cursor/skills/sf-agentforce-development/SKILL.md +449 -0
- package/.cursor/skills/sf-apex-async-patterns/SKILL.md +324 -0
- package/.cursor/skills/sf-apex-best-practices/SKILL.md +421 -0
- package/.cursor/skills/sf-apex-constraints/SKILL.md +79 -0
- package/.cursor/skills/sf-apex-cursor/SKILL.md +336 -0
- package/.cursor/skills/sf-apex-enterprise-patterns/SKILL.md +344 -0
- package/.cursor/skills/sf-apex-testing/SKILL.md +407 -0
- package/.cursor/skills/sf-api-design/SKILL.md +237 -0
- package/.cursor/skills/sf-approval-processes/SKILL.md +312 -0
- package/.cursor/skills/sf-aura-development/SKILL.md +260 -0
- package/.cursor/skills/sf-build-fix/SKILL.md +120 -0
- package/.cursor/skills/sf-data-modeling/SKILL.md +274 -0
- package/.cursor/skills/sf-debugging/SKILL.md +362 -0
- package/.cursor/skills/sf-deployment/SKILL.md +291 -0
- package/.cursor/skills/sf-deployment-constraints/SKILL.md +153 -0
- package/.cursor/skills/sf-devops-ci-cd/SKILL.md +322 -0
- package/.cursor/skills/sf-docs-lookup/SKILL.md +100 -0
- package/.cursor/skills/sf-e2e-testing/SKILL.md +321 -0
- package/.cursor/skills/sf-experience-cloud/SKILL.md +248 -0
- package/.cursor/skills/sf-flow-development/SKILL.md +376 -0
- package/.cursor/skills/sf-governor-limits/SKILL.md +319 -0
- package/.cursor/skills/sf-harness-audit/SKILL.md +139 -0
- package/.cursor/skills/sf-help/SKILL.md +156 -0
- package/.cursor/skills/sf-integration/SKILL.md +479 -0
- package/.cursor/skills/sf-lwc-constraints/SKILL.md +128 -0
- package/.cursor/skills/sf-lwc-development/SKILL.md +302 -0
- package/.cursor/skills/sf-lwc-testing/SKILL.md +387 -0
- package/.cursor/skills/sf-metadata-management/SKILL.md +285 -0
- package/.cursor/skills/sf-platform-events-cdc/SKILL.md +372 -0
- package/.cursor/skills/sf-quickstart/SKILL.md +170 -0
- package/.cursor/skills/sf-security/SKILL.md +330 -0
- package/.cursor/skills/sf-security-constraints/SKILL.md +125 -0
- package/.cursor/skills/sf-soql-constraints/SKILL.md +129 -0
- package/.cursor/skills/sf-soql-optimization/SKILL.md +353 -0
- package/.cursor/skills/sf-tdd-workflow/SKILL.md +332 -0
- package/.cursor/skills/sf-testing-constraints/SKILL.md +198 -0
- package/.cursor/skills/sf-trigger-constraints/SKILL.md +88 -0
- package/.cursor/skills/sf-trigger-frameworks/SKILL.md +343 -0
- package/.cursor/skills/sf-visualforce-development/SKILL.md +259 -0
- package/.cursor/skills/strategic-compact/SKILL.md +205 -0
- package/.cursor/skills/update-docs/SKILL.md +162 -0
- package/.cursor/skills/update-platform-docs/SKILL.md +86 -0
- package/.cursor-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +522 -0
- package/agents/deep-researcher.md +145 -0
- package/agents/doc-updater.md +222 -0
- package/agents/eval-runner.md +340 -0
- package/agents/learning-engine.md +211 -0
- package/agents/loop-operator.md +247 -0
- package/agents/refactor-cleaner.md +122 -0
- package/agents/sf-admin-agent.md +131 -0
- package/agents/sf-agentforce-agent.md +132 -0
- package/agents/sf-apex-agent.md +124 -0
- package/agents/sf-architect.md +435 -0
- package/agents/sf-aura-reviewer.md +372 -0
- package/agents/sf-bugfix-agent.md +105 -0
- package/agents/sf-flow-agent.md +159 -0
- package/agents/sf-integration-agent.md +146 -0
- package/agents/sf-lwc-agent.md +127 -0
- package/agents/sf-review-agent.md +366 -0
- package/agents/sf-visualforce-reviewer.md +468 -0
- package/assets/logo.svg +18 -0
- package/docs/ARCHITECTURE.md +133 -0
- package/docs/authoring-guide.md +373 -0
- package/docs/hook-development.md +578 -0
- package/docs/token-optimization.md +139 -0
- package/docs/workflow-examples.md +645 -0
- package/examples/agentforce-action/README.md +227 -0
- package/examples/apex-trigger-handler/README.md +114 -0
- package/examples/devops-pipeline/README.md +325 -0
- package/examples/flow-automation/README.md +188 -0
- package/examples/integration-pattern/README.md +416 -0
- package/examples/lwc-component/README.md +180 -0
- package/examples/platform-events/README.md +492 -0
- package/examples/scratch-org-setup/README.md +138 -0
- package/examples/security-audit/README.md +244 -0
- package/examples/visualforce-migration/README.md +314 -0
- package/hooks/hooks.json +338 -0
- package/hooks/memory-persistence/README.md +73 -0
- package/manifests/install-modules.json +217 -0
- package/manifests/install-profiles.json +17 -0
- package/mcp-configs/mcp-servers.json +19 -0
- package/package.json +89 -0
- package/schemas/hooks.schema.json +123 -0
- package/schemas/install-modules.schema.json +76 -0
- package/schemas/install-profiles.schema.json +28 -0
- package/schemas/install-state.schema.json +73 -0
- package/schemas/package-manager.schema.json +18 -0
- package/schemas/plugin.schema.json +112 -0
- package/schemas/scc-install-config.schema.json +29 -0
- package/schemas/state-store.schema.json +111 -0
- package/scripts/cli/install-apply.js +170 -0
- package/scripts/cli/uninstall.js +193 -0
- package/scripts/hooks/check-console-log.js +101 -0
- package/scripts/hooks/check-hook-enabled.js +17 -0
- package/scripts/hooks/check-platform-docs-age.js +48 -0
- package/scripts/hooks/cost-tracker.js +78 -0
- package/scripts/hooks/doc-file-warning.js +63 -0
- package/scripts/hooks/evaluate-session.js +98 -0
- package/scripts/hooks/governor-check.js +220 -0
- package/scripts/hooks/learning-observe.sh +206 -0
- package/scripts/hooks/mcp-health-check.js +588 -0
- package/scripts/hooks/post-bash-build-complete.js +34 -0
- package/scripts/hooks/post-bash-pr-created.js +43 -0
- package/scripts/hooks/post-edit-console-warn.js +61 -0
- package/scripts/hooks/post-edit-format.js +79 -0
- package/scripts/hooks/post-edit-typecheck.js +98 -0
- package/scripts/hooks/post-write.js +168 -0
- package/scripts/hooks/pre-bash-git-push-reminder.js +35 -0
- package/scripts/hooks/pre-bash-tmux-reminder.js +47 -0
- package/scripts/hooks/pre-compact.js +51 -0
- package/scripts/hooks/pre-tool-use.js +163 -0
- package/scripts/hooks/pre-write-doc-warn.js +9 -0
- package/scripts/hooks/quality-gate.js +251 -0
- package/scripts/hooks/run-with-flags-shell.sh +32 -0
- package/scripts/hooks/run-with-flags.js +135 -0
- package/scripts/hooks/session-end-marker.js +29 -0
- package/scripts/hooks/session-end.js +311 -0
- package/scripts/hooks/session-start.js +202 -0
- package/scripts/hooks/sfdx-scanner-check.js +142 -0
- package/scripts/hooks/sfdx-validate.js +119 -0
- package/scripts/hooks/stop-hook.js +170 -0
- package/scripts/hooks/suggest-compact.js +67 -0
- package/scripts/lib/agent-adapter.js +82 -0
- package/scripts/lib/apex-analysis.js +194 -0
- package/scripts/lib/hook-flags.js +74 -0
- package/scripts/lib/install-config.js +73 -0
- package/scripts/lib/install-executor.js +363 -0
- package/scripts/lib/install-state.js +121 -0
- package/scripts/lib/orchestration-session.js +299 -0
- package/scripts/lib/package-manager.js +124 -0
- package/scripts/lib/project-detect.js +228 -0
- package/scripts/lib/schema-validator.js +190 -0
- package/scripts/lib/skill-adapter.js +100 -0
- package/scripts/lib/state-store.js +376 -0
- package/scripts/lib/tmux-worktree-orchestrator.js +598 -0
- package/scripts/lib/utils.js +313 -0
- package/scripts/scc.js +164 -0
- package/skills/_reference/AGENTFORCE_PATTERNS.md +112 -0
- package/skills/_reference/APEX_CURSOR.md +159 -0
- package/skills/_reference/API_VERSIONS.md +78 -0
- package/skills/_reference/APPROVAL_PROCESSES.md +105 -0
- package/skills/_reference/ASYNC_PATTERNS.md +163 -0
- package/skills/_reference/AURA_COMPONENTS.md +146 -0
- package/skills/_reference/DATA_MIGRATION_PATTERNS.md +151 -0
- package/skills/_reference/DATA_MODELING.md +124 -0
- package/skills/_reference/DEBUGGING_TOOLS.md +140 -0
- package/skills/_reference/DEPLOYMENT_CHECKLIST.md +87 -0
- package/skills/_reference/DEPRECATIONS.md +79 -0
- package/skills/_reference/DOCKER_CI_PATTERNS.md +138 -0
- package/skills/_reference/ENTERPRISE_PATTERNS.md +122 -0
- package/skills/_reference/EXPERIENCE_CLOUD.md +143 -0
- package/skills/_reference/FLOW_PATTERNS.md +113 -0
- package/skills/_reference/GOVERNOR_LIMITS.md +77 -0
- package/skills/_reference/INTEGRATION_PATTERNS.md +105 -0
- package/skills/_reference/LWC_PATTERNS.md +79 -0
- package/skills/_reference/METADATA_TYPES.md +115 -0
- package/skills/_reference/NAMING_CONVENTIONS.md +84 -0
- package/skills/_reference/PACKAGE_DEVELOPMENT.md +150 -0
- package/skills/_reference/PLATFORM_EVENTS.md +121 -0
- package/skills/_reference/REPORTING_API.md +143 -0
- package/skills/_reference/SCRATCH_ORG_PATTERNS.md +126 -0
- package/skills/_reference/SECURITY_PATTERNS.md +127 -0
- package/skills/_reference/SHARING_MODEL.md +120 -0
- package/skills/_reference/SOQL_PATTERNS.md +119 -0
- package/skills/_reference/TESTING_STANDARDS.md +96 -0
- package/skills/_reference/TRIGGER_PATTERNS.md +114 -0
- package/skills/_reference/VISUALFORCE_PATTERNS.md +121 -0
- package/skills/aside/SKILL.md +118 -0
- package/skills/checkpoint/SKILL.md +53 -0
- package/skills/configure-scc/SKILL.md +163 -0
- package/skills/continuous-agent-loop/SKILL.md +264 -0
- package/skills/mcp-server-patterns/SKILL.md +146 -0
- package/skills/model-route/SKILL.md +84 -0
- package/skills/prompt-optimizer/SKILL.md +369 -0
- package/skills/refactor-clean/SKILL.md +136 -0
- package/skills/resume-session/SKILL.md +114 -0
- package/skills/save-session/SKILL.md +186 -0
- package/skills/search-first/SKILL.md +144 -0
- package/skills/security-scan/SKILL.md +146 -0
- package/skills/sessions/SKILL.md +127 -0
- package/skills/sf-agentforce-development/SKILL.md +450 -0
- package/skills/sf-apex-async-patterns/SKILL.md +326 -0
- package/skills/sf-apex-best-practices/SKILL.md +425 -0
- package/skills/sf-apex-constraints/SKILL.md +81 -0
- package/skills/sf-apex-cursor/SKILL.md +338 -0
- package/skills/sf-apex-enterprise-patterns/SKILL.md +348 -0
- package/skills/sf-apex-testing/SKILL.md +409 -0
- package/skills/sf-api-design/SKILL.md +238 -0
- package/skills/sf-approval-processes/SKILL.md +315 -0
- package/skills/sf-aura-development/SKILL.md +263 -0
- package/skills/sf-build-fix/SKILL.md +121 -0
- package/skills/sf-data-modeling/SKILL.md +278 -0
- package/skills/sf-debugging/SKILL.md +363 -0
- package/skills/sf-deployment/SKILL.md +295 -0
- package/skills/sf-deployment-constraints/SKILL.md +155 -0
- package/skills/sf-devops-ci-cd/SKILL.md +325 -0
- package/skills/sf-docs-lookup/SKILL.md +103 -0
- package/skills/sf-e2e-testing/SKILL.md +324 -0
- package/skills/sf-experience-cloud/SKILL.md +249 -0
- package/skills/sf-flow-development/SKILL.md +377 -0
- package/skills/sf-governor-limits/SKILL.md +323 -0
- package/skills/sf-harness-audit/SKILL.md +142 -0
- package/skills/sf-help/SKILL.md +159 -0
- package/skills/sf-integration/SKILL.md +483 -0
- package/skills/sf-lwc-constraints/SKILL.md +130 -0
- package/skills/sf-lwc-development/SKILL.md +303 -0
- package/skills/sf-lwc-testing/SKILL.md +388 -0
- package/skills/sf-metadata-management/SKILL.md +288 -0
- package/skills/sf-platform-events-cdc/SKILL.md +375 -0
- package/skills/sf-quickstart/SKILL.md +173 -0
- package/skills/sf-security/SKILL.md +334 -0
- package/skills/sf-security-constraints/SKILL.md +127 -0
- package/skills/sf-soql-constraints/SKILL.md +131 -0
- package/skills/sf-soql-optimization/SKILL.md +354 -0
- package/skills/sf-tdd-workflow/SKILL.md +336 -0
- package/skills/sf-testing-constraints/SKILL.md +200 -0
- package/skills/sf-trigger-constraints/SKILL.md +90 -0
- package/skills/sf-trigger-frameworks/SKILL.md +347 -0
- package/skills/sf-visualforce-development/SKILL.md +260 -0
- package/skills/strategic-compact/SKILL.md +208 -0
- package/skills/update-docs/SKILL.md +165 -0
- package/skills/update-platform-docs/SKILL.md +90 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sf-deployment
|
|
3
|
+
description: >-
|
|
4
|
+
Use when deploying to a Salesforce org. SF CLI source deploy, metadata API, package deployment, validation-then-quick-deploy, rollback planning, and production deployment best practices.
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Salesforce Deployment Strategies
|
|
9
|
+
|
|
10
|
+
Reference: @../_reference/DEPLOYMENT_CHECKLIST.md
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Deploying Apex, LWC, or metadata changes to a sandbox or production org
|
|
15
|
+
- Planning deployment order for metadata with dependencies
|
|
16
|
+
- Setting up validation-then-quick-deploy workflows for zero-downtime production releases
|
|
17
|
+
- Troubleshooting deployment errors, coverage failures, or metadata conflicts
|
|
18
|
+
- Choosing between Change Sets, SF CLI source deploy, or Unlocked Packages
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Deployment Method Comparison
|
|
23
|
+
|
|
24
|
+
| Method | Speed | Rollback | Best For | Tracking |
|
|
25
|
+
|-------------------|--------|----------|---------------------------------------|-----------|
|
|
26
|
+
| Change Sets | Slow | Manual | Admin-managed, simple orgs | None |
|
|
27
|
+
| SF CLI (Source) | Fast | Manual | Developer workflow, CI/CD | Git |
|
|
28
|
+
| Metadata API | Medium | Manual | Automated scripts, complex manifests | External |
|
|
29
|
+
| Unlocked Package | Fast | Version | Modular orgs, ISV, internal products | Version |
|
|
30
|
+
| Managed Package | Slow | Version | AppExchange ISV, protected IP | Version |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## SF CLI Deploy Commands
|
|
35
|
+
|
|
36
|
+
### Basic Deployments
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Deploy entire source directory
|
|
40
|
+
sf project deploy start \
|
|
41
|
+
--source-dir force-app \
|
|
42
|
+
--target-org myOrg \
|
|
43
|
+
--wait 30
|
|
44
|
+
|
|
45
|
+
# Deploy specific metadata types
|
|
46
|
+
sf project deploy start \
|
|
47
|
+
--metadata ApexClass \
|
|
48
|
+
--target-org myOrg
|
|
49
|
+
|
|
50
|
+
# Deploy specific components
|
|
51
|
+
sf project deploy start \
|
|
52
|
+
--metadata "ApexClass:AccountService,ApexClass:AccountServiceTest" \
|
|
53
|
+
--target-org myOrg
|
|
54
|
+
|
|
55
|
+
# Deploy using package.xml manifest
|
|
56
|
+
sf project deploy start \
|
|
57
|
+
--manifest manifest/package.xml \
|
|
58
|
+
--target-org myOrg \
|
|
59
|
+
--wait 60
|
|
60
|
+
|
|
61
|
+
# Deploy with test execution
|
|
62
|
+
sf project deploy start \
|
|
63
|
+
--source-dir force-app \
|
|
64
|
+
--test-level RunLocalTests \
|
|
65
|
+
--target-org myOrg \
|
|
66
|
+
--wait 60
|
|
67
|
+
|
|
68
|
+
# Deploy specific tests
|
|
69
|
+
sf project deploy start \
|
|
70
|
+
--source-dir force-app \
|
|
71
|
+
--test-level RunSpecifiedTests \
|
|
72
|
+
--tests AccountServiceTest,OpportunityServiceTest \
|
|
73
|
+
--target-org myOrg
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Deploy Flags Reference
|
|
77
|
+
|
|
78
|
+
| Flag | Description |
|
|
79
|
+
|------------------------|-------------------------------------------------------|
|
|
80
|
+
| `--source-dir` | Local source directory to deploy |
|
|
81
|
+
| `--manifest` | package.xml manifest file path |
|
|
82
|
+
| `--metadata` | Specific metadata types or components |
|
|
83
|
+
| `--test-level` | Test level: NoTestRun/RunSpecifiedTests/RunLocalTests/RunAllTestsInOrg |
|
|
84
|
+
| `--tests` | Comma-separated test class names (with RunSpecifiedTests) |
|
|
85
|
+
| `--wait` | Minutes to wait for async deploy (default: 33) |
|
|
86
|
+
| `--ignore-errors` | Ignore deploy errors (use with caution) |
|
|
87
|
+
| `--ignore-conflicts` | Ignore source tracking conflicts |
|
|
88
|
+
| `--async` | Run deploy asynchronously, return job ID |
|
|
89
|
+
| `--verbose` | Show detailed output |
|
|
90
|
+
|
|
91
|
+
> **Note:** There is no `--dry-run` on `deploy start`. Use `sf project deploy validate` instead.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Test Level Guide
|
|
96
|
+
|
|
97
|
+
### NoTestRun
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
sf project deploy start --test-level NoTestRun --source-dir force-app --target-org sandbox
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Use for sandbox deployments of non-Apex metadata. Allowed for production only when the deployment contains no Apex code.
|
|
104
|
+
|
|
105
|
+
### RunSpecifiedTests
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
sf project deploy start \
|
|
109
|
+
--test-level RunSpecifiedTests \
|
|
110
|
+
--tests AccountServiceTest,ContactTriggerTest \
|
|
111
|
+
--source-dir force-app \
|
|
112
|
+
--target-org myOrg
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Runs only the named test classes. Sufficient for production if coverage >= 75% for deployed classes.
|
|
116
|
+
|
|
117
|
+
### RunLocalTests (Recommended for most deployments)
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
sf project deploy start \
|
|
121
|
+
--test-level RunLocalTests \
|
|
122
|
+
--source-dir force-app \
|
|
123
|
+
--target-org myOrg
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Runs all tests in the org except managed package tests. Required standard for production deployments.
|
|
127
|
+
|
|
128
|
+
### RunAllTestsInOrg
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
sf project deploy start \
|
|
132
|
+
--test-level RunAllTestsInOrg \
|
|
133
|
+
--source-dir force-app \
|
|
134
|
+
--target-org myOrg
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Runs every test including managed package tests. Use for major releases or full org validation.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## package.xml (Manifest) Format
|
|
142
|
+
|
|
143
|
+
### Targeted Component Deployment
|
|
144
|
+
|
|
145
|
+
```xml
|
|
146
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
147
|
+
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
148
|
+
<types>
|
|
149
|
+
<members>AccountService</members>
|
|
150
|
+
<members>AccountServiceTest</members>
|
|
151
|
+
<name>ApexClass</name>
|
|
152
|
+
</types>
|
|
153
|
+
<types>
|
|
154
|
+
<members>AccountTrigger</members>
|
|
155
|
+
<name>ApexTrigger</name>
|
|
156
|
+
</types>
|
|
157
|
+
<types>
|
|
158
|
+
<members>accountCard</members>
|
|
159
|
+
<name>LightningComponentBundle</name>
|
|
160
|
+
</types>
|
|
161
|
+
<types>
|
|
162
|
+
<members>Account.Status__c</members>
|
|
163
|
+
<name>CustomField</name>
|
|
164
|
+
</types>
|
|
165
|
+
<version>66.0</version>
|
|
166
|
+
</Package>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> `<members>*</members>` deploys ALL components of that type, including test classes. For production, prefer listing specific members when you need to exclude certain components.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Validation-Then-Quick-Deploy Workflow
|
|
174
|
+
|
|
175
|
+
Validation separates test execution from the actual deployment. Use this for production to minimise downtime.
|
|
176
|
+
|
|
177
|
+
### Step 1: Validate (runs tests, does not deploy)
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
sf project deploy validate \
|
|
181
|
+
--source-dir force-app \
|
|
182
|
+
--test-level RunLocalTests \
|
|
183
|
+
--target-org prod \
|
|
184
|
+
--wait 60
|
|
185
|
+
|
|
186
|
+
# Capture the Job ID from output
|
|
187
|
+
JOB_ID=0Af5e00000BnXXX
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Step 2: Wait for Tests to Pass
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
sf project deploy report --job-id $JOB_ID --target-org prod
|
|
194
|
+
sf project deploy resume --job-id $JOB_ID --target-org prod --wait 60
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Step 3: Quick Deploy (no tests re-run)
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
sf project deploy quick \
|
|
201
|
+
--job-id $JOB_ID \
|
|
202
|
+
--target-org prod \
|
|
203
|
+
--wait 10
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Quick deploy window: 10 days after successful validation, but only if no Apex code modifications have been made to the org since the validation.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Destructive Changes (Removing Metadata)
|
|
211
|
+
|
|
212
|
+
Deploy a `destructiveChanges.xml` alongside an empty `package.xml`.
|
|
213
|
+
|
|
214
|
+
```xml
|
|
215
|
+
<!-- destructiveChanges.xml -->
|
|
216
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
217
|
+
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
218
|
+
<types>
|
|
219
|
+
<members>OldAccountService</members>
|
|
220
|
+
<name>ApexClass</name>
|
|
221
|
+
</types>
|
|
222
|
+
<types>
|
|
223
|
+
<members>Account.LegacyField__c</members>
|
|
224
|
+
<name>CustomField</name>
|
|
225
|
+
</types>
|
|
226
|
+
<version>66.0</version>
|
|
227
|
+
</Package>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
sf project deploy start \
|
|
232
|
+
--manifest deploy-package/package.xml \
|
|
233
|
+
--post-destructive-changes deploy-package/destructiveChanges.xml \
|
|
234
|
+
--test-level RunLocalTests \
|
|
235
|
+
--target-org myOrg
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
`--pre-destructive-changes` runs before deployment; `--post-destructive-changes` after. Use post for removing replaced components.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Rollback Strategies
|
|
243
|
+
|
|
244
|
+
Salesforce does not have native one-click rollback. Plan ahead.
|
|
245
|
+
|
|
246
|
+
### Full Commit Revert (Preferred)
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
git revert HEAD
|
|
250
|
+
sf project deploy start --source-dir force-app --test-level RunLocalTests --target-org prod
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
> Single-file rollback is only safe for isolated, dependency-free components. For coupled changes, revert the full git commit and deploy the complete set of changed files.
|
|
254
|
+
|
|
255
|
+
### Pre-Deployment Snapshot
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
sf project retrieve start \
|
|
259
|
+
--manifest manifest/package.xml \
|
|
260
|
+
--target-org prod \
|
|
261
|
+
--output-dir backup/pre-deploy-$(date +%Y%m%d)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Package Version Rollback (Unlocked Packages)
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
sf package install \
|
|
268
|
+
--package "04t5e000000XXXXX" \
|
|
269
|
+
--target-org prod \
|
|
270
|
+
--wait 30
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Common Deployment Errors and Fixes
|
|
276
|
+
|
|
277
|
+
| Error | Cause | Fix |
|
|
278
|
+
|---|---|---|
|
|
279
|
+
| "Test coverage of selected Apex Trigger is 0%" | Trigger has no test class | Write and include a test class |
|
|
280
|
+
| "Average test coverage below 75%" | Org-wide coverage insufficient | Add tests for uncovered classes |
|
|
281
|
+
| "Entity of type X not found" | Component missing in target org | Deploy dependency first or check name |
|
|
282
|
+
| "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" | Trigger or validation rule blocking deploy | Check error details for the specific rule |
|
|
283
|
+
| "duplicate value found" | Unique field constraint violation | Check for existing records or duplicate picklist values |
|
|
284
|
+
| "Object X not available in this org" | Feature not enabled in target org | Enable the feature flag or include org setting |
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Related
|
|
289
|
+
|
|
290
|
+
- **Constraints**: `sf-deployment-constraints` -- deployment safety rules
|
|
291
|
+
- **Agent**: `sf-architect` -- interactive, in-depth guidance
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sf-deployment-constraints
|
|
3
|
+
description: >-
|
|
4
|
+
Enforce deployment safety — validation-only first, test coverage gates, metadata ordering, rollback readiness. Use when deploying or packaging ANY Salesforce metadata. Do NOT use for local dev or scratch org pushes.
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Salesforce Deployment Constraints
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
This skill auto-activates when deploying, promoting, or packaging Salesforce metadata. It enforces validation-only-first, test coverage gates, dependency ordering, and rollback readiness for all deployment artifacts.
|
|
13
|
+
|
|
14
|
+
Hard rules that MUST be followed when deploying, promoting, or packaging
|
|
15
|
+
Salesforce metadata to any sandbox or production org. Violations are blocking.
|
|
16
|
+
|
|
17
|
+
Reference: @../_reference/DEPLOYMENT_CHECKLIST.md
|
|
18
|
+
@../_reference/DEPRECATIONS.md
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
|
|
24
|
+
1. **Never deploy without validation-only first.**
|
|
25
|
+
Run `sf project deploy validate` before every real deployment to production.
|
|
26
|
+
Quick-deploy (`sf project deploy quick --job-id <ID>`) is only valid within
|
|
27
|
+
10 days and only if no Apex has been deployed to the org since validation.
|
|
28
|
+
|
|
29
|
+
2. **Never skip the test level flag.**
|
|
30
|
+
Every `sf project deploy start` to a shared org MUST include `--test-level`.
|
|
31
|
+
Omitting it lets the platform pick a default that may be `NoTestRun`,
|
|
32
|
+
which silently passes with zero coverage.
|
|
33
|
+
|
|
34
|
+
3. **Never deploy Profiles alongside other metadata.**
|
|
35
|
+
Profiles depend on every other metadata type (objects, fields, record types,
|
|
36
|
+
Apex, permission sets). Deploy Profiles in a separate, final deployment step
|
|
37
|
+
after all dependencies are confirmed in the target org.
|
|
38
|
+
|
|
39
|
+
4. **Never force-push to production.**
|
|
40
|
+
Do not use `--ignore-errors` or `--ignore-conflicts` against a production
|
|
41
|
+
org. If the deployment fails, fix the root cause rather than suppressing
|
|
42
|
+
errors. Force flags are acceptable only in developer sandboxes during
|
|
43
|
+
active prototyping.
|
|
44
|
+
|
|
45
|
+
5. **Never deploy destructive changes without a pre-deploy snapshot.**
|
|
46
|
+
Before any `--post-destructive-changes` or `--pre-destructive-changes`
|
|
47
|
+
deployment, retrieve the current state of affected components:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
sf project retrieve start \
|
|
51
|
+
--manifest manifest/package.xml \
|
|
52
|
+
--target-org prod \
|
|
53
|
+
--output-dir backup/pre-deploy-$(date +%Y%m%d)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
6. **Never use `--use-most-recent` for quick deploy in multi-team orgs.**
|
|
57
|
+
Another team's deployment between your validate and quick-deploy
|
|
58
|
+
invalidates the job. Always pass `--job-id` explicitly.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Always
|
|
63
|
+
|
|
64
|
+
1. **Always validate before deploy.**
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
sf project deploy validate \
|
|
68
|
+
--source-dir force-app \
|
|
69
|
+
--test-level RunLocalTests \
|
|
70
|
+
--target-org <org> \
|
|
71
|
+
--wait 60
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then quick-deploy using the returned job ID.
|
|
75
|
+
|
|
76
|
+
2. **Always specify an appropriate test level.**
|
|
77
|
+
|
|
78
|
+
| Target Environment | Required Test Level |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Developer sandbox (no Apex) | `NoTestRun` acceptable |
|
|
81
|
+
| Developer sandbox (with Apex) | `RunLocalTests` |
|
|
82
|
+
| Staging / UAT sandbox | `RunLocalTests` |
|
|
83
|
+
| Production | `RunLocalTests` (minimum) |
|
|
84
|
+
| Major release / full regression | `RunAllTestsInOrg` |
|
|
85
|
+
| CI/CD PR validation (v66.0+) | `RunRelevantTests` with `@testFor` |
|
|
86
|
+
|
|
87
|
+
3. **Always check metadata dependency order.**
|
|
88
|
+
Deploy in this sequence; never deploy a later type before its dependency:
|
|
89
|
+
1. CustomObject
|
|
90
|
+
2. CustomField
|
|
91
|
+
3. RecordType
|
|
92
|
+
4. ValidationRule
|
|
93
|
+
5. Layout
|
|
94
|
+
6. ApexClass
|
|
95
|
+
7. ApexTrigger
|
|
96
|
+
8. LightningComponentBundle
|
|
97
|
+
9. FlexiPage / App Page
|
|
98
|
+
10. PermissionSet
|
|
99
|
+
11. Profile (always last)
|
|
100
|
+
|
|
101
|
+
4. **Always have a rollback plan before production deploy.**
|
|
102
|
+
|
|
103
|
+
| Strategy | When |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `git revert` + full redeploy | Coupled multi-file changes |
|
|
106
|
+
| Single-file restore from git | Isolated, dependency-free component |
|
|
107
|
+
| Pre-deploy snapshot retrieve | Any production deployment |
|
|
108
|
+
| Package version rollback | Unlocked/managed package orgs |
|
|
109
|
+
|
|
110
|
+
5. **Always confirm 75%+ org-wide code coverage before production.**
|
|
111
|
+
Run `sf apex run test --test-level RunLocalTests --code-coverage` locally
|
|
112
|
+
and verify aggregate coverage meets the threshold. Individual deployed
|
|
113
|
+
triggers must have > 0% coverage.
|
|
114
|
+
|
|
115
|
+
6. **Always include test classes in the deployment package.**
|
|
116
|
+
If deploying Apex classes or triggers, include their corresponding test
|
|
117
|
+
classes in the same `package.xml` or `--source-dir`. Deploying production
|
|
118
|
+
code without its tests causes coverage drift.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Anti-Pattern Table
|
|
123
|
+
|
|
124
|
+
| Anti-Pattern | Why It Fails | Correct Approach |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| Deploy directly to production without validation | Test failures discovered mid-deploy; partial state | Validate first, then quick-deploy |
|
|
127
|
+
| Use `NoTestRun` for production Apex deployments | Salesforce rejects or silently drops coverage | Use `RunLocalTests` or `RunRelevantTests` |
|
|
128
|
+
| Deploy Profiles in the same package as objects/fields | Profile references fail if dependencies missing | Deploy Profiles separately after all dependencies |
|
|
129
|
+
| Use `--ignore-errors` on production | Partial metadata deployed; org left in broken state | Fix errors, re-validate, re-deploy |
|
|
130
|
+
| Skip pre-deploy snapshot for destructive changes | No way to restore deleted metadata | Always `sf project retrieve start` first |
|
|
131
|
+
| Rely on `--use-most-recent` for quick deploy | Another team's deploy invalidates your validation | Use explicit `--job-id` |
|
|
132
|
+
| Deploy test classes separately from production code | Coverage numbers drift; tests may reference stale code | Co-deploy test and production classes together |
|
|
133
|
+
| Omit `--test-level` flag entirely | Platform default may be `NoTestRun` | Always specify `--test-level` explicitly |
|
|
134
|
+
| Deploy dependent metadata out of order | "Entity not found" errors | Follow the 11-step dependency order above |
|
|
135
|
+
| Single-file rollback for coupled changes | Breaks dependencies between related classes | `git revert` the full commit and redeploy all affected files |
|
|
136
|
+
| Deploy Custom Labels after referencing Apex/LWC | Components fail to compile if label not yet in target org | Include Custom Labels in same package or deploy them first |
|
|
137
|
+
| Deploy Report Types without underlying objects | Report Type references fail on missing custom objects/fields | Deploy objects and fields before Report Types |
|
|
138
|
+
| Deploy Connected App with hardcoded consumer secret | Secrets exposed in source control; revoked secrets break auth | Use Named Credentials or environment-specific Connected App config |
|
|
139
|
+
| Deploy Flow without testing in sandbox first | Flows fire on existing data immediately; no rollback for record changes | Always test Record-Triggered Flows in sandbox with representative data |
|
|
140
|
+
| Use `sf project deploy start` without `--wait` | Detached deploy with no feedback; failures discovered late | Always use `--wait` to monitor deployment progress inline |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Quick Reference: Production Deploy Sequence
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
1. Pre-deploy snapshot sf project retrieve start --manifest ... --output-dir backup/
|
|
148
|
+
2. Validate sf project deploy validate --test-level RunLocalTests --wait 60
|
|
149
|
+
3. Confirm tests pass sf project deploy report --job-id <ID>
|
|
150
|
+
4. Quick deploy sf project deploy quick --job-id <ID> --wait 10
|
|
151
|
+
5. Smoke test Execute post-deploy verification plan
|
|
152
|
+
6. Confirm or rollback If issues found: git revert + redeploy from backup
|
|
153
|
+
```
|