SF Guard
SF Guard helps Salesforce developers avoid accidental source overwrites. Before deployment, it checks whether the component changed in the org after the last known sync, presents a visual comparison when a conflict is found, and can retain local backup versions for recovery. Highlights
Supported Workflows
SF Guard intentionally hides its context-menu actions for metadata types it does not yet support, such as Custom Object fields, layouts, FlexiPages, permission sets, and static resources. Installation
Requirements:
Complete Usage Guide1. Retrieve Source with Tracking
Right-click a supported source file or LWC/Aura component folder and select SF Guard: Retrieve from Org. SF Guard retrieves the component and stores its sync baseline for future Safe Deploy checks. 2. Safe Deploy with Conflict Detection
Right-click a supported source file or bundle folder and select SF Guard: Safe Deploy to Org. If SF Guard detects a possible org-side change, it opens a diff view so you can review the conflict before deciding how to proceed. A pending deployment can be cancelled from the progress notification. 3. Review the SF Guard Output ChannelSF Guard automatically activates its Output channel whenever an SF Guard command starts. It includes conflict decisions, deploy and retrieve summaries, the relevant component files, and detailed SDR errors when an operation fails. 4. Retrieve from a Package ManifestRight-click an XML file inside your project's You can also use Keep Backup for This File and Compare with Backup for manifest files when you want to retain different manifest versions. 5. Enable Automatic Backups
Right-click a supported source file and select SF Guard: Enable/Disable Backup for This File. When enabled, each successful Safe Deploy creates a backup of the component before deployment. SF Guard retains up to five backups for a component. If a sixth backup is created, the oldest unlocked backup is removed. Locked backups are never removed automatically. 6. Compare with a Backup
Select SF Guard: Compare with Backup to choose a saved version. The VS Code diff editor opens the backup beside the current file so you can review or copy back the changes you need. Backups can be renamed, locked, unlocked, or deleted from the backup picker. 7. View Sync Status
Run SF Guard: View Sync Status from the Command Palette to inspect tracked component sync times and remove entries that are no longer useful. Commands
How Conflict Detection Works
Conflict detection is designed to reduce accidental overwrites, not replace normal team communication, pull requests, or source control. Backup StorageBackups are stored locally in the workspace and grouped by org alias, metadata type, component name, and timestamp.
TroubleshootingNo active Salesforce orgConfirm that the Salesforce CLI can see an authenticated org:
Authenticate again if necessary:
A command is not visible in the right-click menuSF Guard only displays commands for supported metadata. Confirm that you selected a supported source file, LWC/Aura bundle folder, or manifest XML file in a A deploy or retrieve failsOpen the Privacy and Security
RoadmapPotential future improvements include batch deployment with conflict checks, richer deployment history, configurable backup retention, and support for additional Salesforce metadata types. Contributing and SupportLicense |




