sf-raven-cli
v1.12.0
Published
A custom sf plugin built by @tomcarman
Maintainers
Readme
Overview
Features
Full details, usage, examples etc are further down, or can be accessed via --help on the commands.
sf raven object display fields - Show field information for a given sObject.
sf raven object display recordtypes - Show RecordType information for a given sObject.
sf raven object display validationrules - Show Validation Rule information for a given sObject.
sf raven object display fieldusage - Show how many records actually populate each field on an sObject.
sf raven object display picklists - Show picklist values for the fields on an sObject, as a record type availability matrix.
sf raven inspect automations - Show all automation that fires on a given sObject.
sf raven inspect dependencies - Show what a metadata component depends on and what depends on it.
sf raven inspect field - Find everywhere a field is referenced across the org's metadata.
sf raven inspect jobs - Show async and scheduled jobs running in an org.
sf raven audit display - Show recent entries in the Setup Audit Trail.
sf raven event subscribe - Subscribe to Platform Events, streamed to your terminal.
sf raven event publish - Publish Platform Events from an inline payload or a JSON file.
sf raven deploy cancel - Query an org for pending or in progress Salesforce deployments, and cancel them.
sf raven soql - Run SOQL queries in an interactive REPL - tab completion, syntax highlighting, history search - or one-shot from the shell.
sf raven query ids - Run a SOQL query against a large list of Salesforce IDs.
sf raven query record - Fetch any record by id with full-field output, and its field history.
sf raven query recent - Show the most recently created, or modified, records for an sObject.
sf raven apex log - Tail Apex debug logs in real time, streamed to your terminal - a wrapper around the native
sf apex tail logthat makes it better.sf raven apex run - Execute an anonymous Apex file and print clean debug output, re-running on every save if you want.
sf raven open - Open a record, object, or Setup page in the browser, already logged in.
sf raven org info - Show a summary card for an org - identity, storage and API limits, users and licenses, release.
sf raven pull - Update Salesforce metadata into the local project via a fuzzy finder.
sf raven pull list - List metadata types and components available to pull, as JSON for machine consumption.
sf raven pull remote - Retrieve Salesforce metadata that exists in the org but not locally, by selecting a configured metadata type and then one or more remote components.
sf raven pull remote type add - Add metadata types to the remote pull configuration.
sf raven pull remote type list - List metadata types supported by remote pull.
sf raven pull remote type remove - Remove metadata types from the remote pull configuration.
sf raven profile sync - Sync full Profile metadata from an org into local source files - byte-identical to a full-project retrieve, in a fraction of the time.
sf raven profile sync select - Interactively pick org profiles to sync into local source via a fuzzy finder, including adopting profiles not yet tracked.
sf raven profile sync exclusion add - Add top-level profile sections (e.g. flowAccesses) to the project's sync exclusions, persisted in sfdx-project.json.
sf raven profile sync exclusion list - List the profile sections excluded from profile sync.
sf raven profile sync exclusion remove - Remove profile sections from the project's sync exclusions.
Install
Dependencies
- fzf is required for the sf raven pull commands and sf raven profile sync select, and should be available on your path. (IMO they are probably the most useful commands in this plugin, so its worth setting up fzf if you don't have it.)
Quick Install
Assuming you already have the sf cli installed, the plugin can be installed by running:
sf plugins install sf-raven-cli
Note: You'll be prompted that this is not officially code-signed by Salesforce - like any custom plugin. You can just accept this when prompted, or alternatively you can whitelist it
[!WARNING] If you previously installed the package as
sf-raven, migrate to the renamed package with:
sf plugins uninstall sf-raven
sf plugins install sf-raven-cliUpdating the plugin
The plugin can be updated to the latest version using
sf plugins update
Tab completion
The sf cli ships with autocomplete built in, and it covers this plugin's commands and flags too - there's nothing extra to install. If you've not set it up before, run sf autocomplete and follow the instructions for your shell. For zsh that's:
printf "$(sf autocomplete script zsh)" >> ~/.zshrc; source ~/.zshrcThen sf raven <TAB> completes topics and commands, and sf raven inspect dependencies --<TAB> completes flags. On zsh, flags with a fixed set of values complete those values too, e.g. sf raven query recent --format <TAB> offers table json csv toon. Bash completes command and flag names only.
[!IMPORTANT] Completions are generated from a cache, so newly added commands won't show up after installing or updating the plugin until you refresh it:
sf autocomplete --refresh-cache
Install from source
- Install the sf cli
- Clone the repository:
git clone [email protected]:tomcarman/sf-raven-cli.git - Install npm modules:
npm install - Link the plugin:
sf plugins link .
Compatibility
- Linux
- macOS
- Possibly Windows - but untested
Command Reference
sf raven object display fields
Show field information for a given sObject.
FieldDefinition metadata is queried for the given sObject. The field Labels, API names, and Type are displayed.
USAGE
$ sf raven object display fields -o <value> -s <value> [--json] [-c <value>]
FLAGS
-c, --csv=<value> Path to write field information as CSV. When supplied, table output is suppressed.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) The API name of the sObject that you want to view fields for. Use a comma-delimited list to query multiple objects.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show field information for a given sObject.
FieldDefinition metadata is queried for the given sObject. The field Labels, API names, and Type are displayed.
EXAMPLES
$ sf raven object display fields --target-org dev --sobject Account
$ sf raven object display fields --target-org dev --sobject My_Custom_Object__c
$ sf raven object display fields --target-org dev --sobject Account,Contact
$ sf raven object display fields --target-org dev --sobject Account --csv account-fields.csv
OUTPUT
Name Developer Name Type
────────────────── ─────────────── ─────────────────
Account Number AccountNumber Text(40)
Account Source AccountSource Picklist
Annual Revenue AnnualRevenue Currency(18, 0)
...sf raven object display recordtypes
Show RecordType information for a given sObject.
RecordType metadata is queried for the given sObject. The RecordType Name, DeveloperName, and Id are displayed.
USAGE
$ sf raven object display recordtypes -o <value> -s <value> [--json] [-c <value>]
FLAGS
-c, --csv=<value> Path to write Record Type information as CSV. When supplied, table output is suppressed.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) The API name of the sObject that you want to view Record Types for. Use a comma-delimited list to query multiple objects.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show RecordType information for a given sObject.
RecordType metadata is queried for the given sObject. The RecordType Name, DeveloperName, and Id are displayed.
EXAMPLES
$ sf raven object display recordtypes --target-org dev --sobject Account
$ sf raven object display recordtypes --target-org dev --sobject My_Custom_Object__c
$ sf raven object display recordtypes --target-org dev --sobject Account,Opportunity
$ sf raven object display recordtypes --target-org dev --sobject Account --csv account-record-types.csv
OUTPUT
Name Developer Name Id
─────────────────── ─────────────────────── ──────────────────
Business Account Business_Account 0124J000000XXXXABC
Person Account PersonAccount 0124J000000YYYYDEF
...sf raven object display validationrules
Show Validation Rule information for a given sObject.
Validation Rules are queried for the given sObject. The rule Name, Active status, Description, and Error Message are displayed.
USAGE
$ sf raven object display validationrules -o <value> -s <value> [--json] [-c <value>] [-a]
FLAGS
-a, --active Only show active validation rules.
-c, --csv=<value> Path to write Validation Rule information as CSV. When supplied, table output is suppressed.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) The API name of the sObject to view Validation Rules for. Use a comma-delimited list to query multiple objects.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show Validation Rule information for a given sObject.
Validation Rules are queried for the given sObject. The rule Name, Active status, Description, and Error Message are displayed.
EXAMPLES
$ sf raven object display validationrules --target-org dev --sobject Account
$ sf raven object display validationrules --target-org dev --sobject My_Custom_Object__c
$ sf raven object display validationrules --target-org dev --sobject Account,Contact
$ sf raven object display validationrules --target-org dev --sobject Account --csv account-validation-rules.csv
OUTPUT
Name Active Description Error Message
──────────────────────── ─────── ───────────────────────────────── ─────────────────────────────
Require_Account_Number true Account Number required to close Account Number is required
Valid_Billing_Country false Billing country must be ISO code Enter a valid billing country
...sf raven object display fieldusage
Samples the newest records on an sObject and reports what percentage of them have a value in each field, dead fields first - the list you want in front of you before a field cleanup.
By default the newest 1000 records are sampled; use --sample-size to change that, or --deep to count every record in the org with one COUNT query per field. When the object has fewer records than the sample size, the numbers are exact either way.
USAGE
$ sf raven object display fieldusage -o <value> -s <value> [--json] [--field <value>] [--custom-only]
[--sample-size <value>] [--deep] [-c <value>]
FLAGS
-c, --csv=<value> Write the results to this file as CSV instead of printing a table.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) API name of the sObject. Accepts a comma-separated list.
--custom-only Only report on custom (__c) fields.
--deep Count every record in the org instead of sampling, with one COUNT query per field. Slower,
but exact. Fields that cannot be filtered on keep their sampled figure and are marked.
--field=<value> Only report on these fields, as a comma-separated list of API names.
--sample-size=<value> [default: 1000] How many of the newest records to sample.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show how many records populate each field on an sObject.
Samples the newest records on the object and reports what percentage of them have a value in each field, dead fields
first. Use it to find candidates for deletion before a cleanup.
By default the newest 1000 records are sampled; raise or lower that with --sample-size. When the object has fewer
records than the sample size, the numbers are exact.
Compound parent fields (Address, Geolocation) are skipped and their components counted instead. Formula fields are
included.
EXAMPLES
Show field usage for Account:
$ sf raven object display fieldusage --sobject Account
Sample more records across several objects:
$ sf raven object display fieldusage --sobject Account,Contact --sample-size 5000
Get exact org-wide numbers instead of a sample:
$ sf raven object display fieldusage --sobject Account --deep
Only look at custom fields:
$ sf raven object display fieldusage --sobject Account --custom-only
Check specific fields and write the result to a file:
$ sf raven object display fieldusage --sobject Account --field Industry,Rating --csv usage.csvsf raven object display picklists
Lists the active values of every picklist field on an sObject, with the label and API name of each value.
On objects that use record types the values are shown as a matrix - one column per record type, including Master, with a check mark where the value is available and a star where it is that record type's default. Objects without record types get a flat list.
USAGE
$ sf raven object display picklists -o <value> -s <value> [--json] [--field <value>] [-c <value>]
FLAGS
-c, --csv=<value> Write the values to this file as CSV instead of printing them.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) API name of the sObject. Accepts a comma-separated list.
--field=<value> Only show these picklist fields, as a comma-separated list of API names.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show picklist values for the fields on an sObject.
Lists the active values of every picklist field on the object, with the label and API name of each value. The global
default value is marked with an asterisk, and dependent picklists note the field that controls them.
On objects that use record types, values are shown as a matrix: one column per record type, including Master, with a
check mark where the value is available and a star where it is that record type's default. Record types you cannot
access are shown as unavailable rather than failing the command. Objects without record types get the flat list.
Multi-select picklists are included.
EXAMPLES
Show every picklist on Account:
$ sf raven object display picklists --sobject Account
Show picklists across several objects:
$ sf raven object display picklists --sobject Account,Contact
Narrow to specific fields:
$ sf raven object display picklists --sobject Account --field Industry,Rating
Write the values to a file:
$ sf raven object display picklists --sobject Account --csv picklists.csvsf raven inspect automations
Displays Apex Triggers, record-triggered Flows, Workflow Rules, and Process Builder processes that are configured on the given sObject, grouped by execution phase.
By default only active automation is shown. Use --all to include inactive items.
USAGE
$ sf raven inspect automations -o <value> -s <value> [--json] [-a]
FLAGS
-a, --all Include inactive automation. Active items display normally, inactive items are dimmed with an Active indicator.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) The API name of the sObject to inspect.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Displays Apex Triggers, record-triggered Flows, Workflow Rules, and Process Builder processes that are configured on the given sObject, grouped by execution phase.
By default only active automation is shown. Use --all to include inactive items.
EXAMPLES
$ sf raven inspect automations --target-org dev --sobject Account
$ sf raven inspect automations --target-org dev --sobject Account --all
$ sf raven inspect automations --target-org dev --sobject Opportunity
OUTPUT
Automation on Account (3)
Phase Type Name Events Order
─────────────── ───────────── ─────────────────────────── ─────────────── ─────
Before Save Flow Account Before Save Insert, Update 1
After Trigger Apex Trigger AccountTrigger Insert, Update
Post-Save Workflow Rule Notify Account Owner Insert, Updatesf raven inspect dependencies
Queries the MetadataComponentDependency API to show outbound dependencies (what this component uses) and inbound references (what uses this component).
Supported types: ApexClass, ApexTrigger, Flow, CustomObject, CustomField, LightningComponentBundle, AuraDefinitionBundle.
For CustomField, provide the name as ObjectApiName.FieldApiName (e.g. Account.MyField__c).
USAGE
$ sf raven inspect dependencies -o <value> -t ApexClass|ApexTrigger|Flow|CustomObject|CustomField|LightningComponentBundle|AuraDefinitionBundle -n <value> [--json]
FLAGS
-n, --name=<value> (required) The API name of the component. For CustomField use ObjectName.FieldName format.
-o, --target-org=<value> (required) Login username or alias for the target org.
-t, --type=<option> (required) The metadata type of the component.
<options: ApexClass|ApexTrigger|Flow|CustomObject|CustomField|LightningComponentBundle|AuraDefinitionBundle>
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Queries the MetadataComponentDependency API to show outbound dependencies (what this component uses) and inbound references (what uses this component).
Supported types: ApexClass, ApexTrigger, Flow, CustomObject, CustomField, LightningComponentBundle, AuraDefinitionBundle.
For CustomField, provide the name as ObjectApiName.FieldApiName (e.g. Account.MyField__c).
EXAMPLES
$ sf raven inspect dependencies --target-org dev --type ApexClass --name AccountService
$ sf raven inspect dependencies --target-org dev --type Flow --name Sync_Account_to_ERP
$ sf raven inspect dependencies --target-org dev --type CustomObject --name Account
$ sf raven inspect dependencies --target-org dev --type CustomField --name Account.MyField__c
OUTPUT
Dependencies for ApexClass: ServicesService
Depends on (3)
Type Name
───────────── ─────────────────────────────────
CustomField Service__c.Status__c
CustomObject Service
ApexClass DmlOps
Referenced by (2)
Type Name
───────── ─────────────────────────────────────────
ApexClass ServicesServiceTest
Flow Opportunity_Update_Create_Service_Recordssf raven inspect field
Queries the MetadataComponentDependency API to find Apex classes, triggers, Flows, and other metadata that references the given custom field.
For full coverage, use --deep. This retrieves FlexiPages, Layouts, and Flows via the Metadata API and text-searches their source, catching declarative references the dependency API does not track (including references to standard fields). The --deep retrieve is slower (typically 15-60s, longer on large orgs).
Standard fields (e.g. Name, CreatedDate) can only be inspected with --deep, as the dependency API does not track them.
USAGE
$ sf raven inspect field -o <value> -s <value> -f <value> [--json] [--deep]
FLAGS
--deep Retrieve FlexiPages, Layouts, and Flows and text-search them for references. Slower, but catches declarative references the dependency API misses, and works for standard fields.
-f, --field=<value> (required) The API name of the field to inspect.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) The API name of the sObject the field belongs to.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Queries the MetadataComponentDependency API to find Apex classes, triggers, Flows, and other metadata that references the given custom field.
For full coverage, use --deep. This retrieves FlexiPages, Layouts, and Flows via the Metadata API and text-searches their source, catching declarative references the dependency API does not track (including references to standard fields). The --deep retrieve is slower (typically 15-60s, longer on large orgs).
Standard fields (e.g. Name, CreatedDate) can only be inspected with --deep, as the dependency API does not track them.
EXAMPLES
$ sf raven inspect field --target-org dev --sobject Account --field MyCustomField__c
$ sf raven inspect field --target-org dev --sobject Account --field MyCustomField__c --deep
$ sf raven inspect field --target-org dev --sobject Account --field AnnualRevenue --deep
OUTPUT
References to Account.MyCustomField__c (3 found)
Type Name Source
───────── ─────────────────── ──────────
ApexClass AccountService dependency
Flow Sync_Account_to_ERP dependency
Layout Account Layout deepsf raven inspect jobs
Prints two sections.
Async jobs covers the org's asynchronous Apex - everything currently in flight (Holding, Queued, Preparing, Processing) plus anything that finished in the last 24 hours, newest first. Failed jobs print their extended status beneath the row.
Scheduled jobs lists every CronTrigger, soonest next run first, with the cron expression rendered to English.
USAGE
$ sf raven inspect jobs -o <value> [--json] [--since <value>] [--limit <value>]
FLAGS
-o, --target-org=<value> (required) Login username or alias for the target org.
--limit=<value> [default: 50] Maximum number of rows to return.
--since=<value> [default: 24h] How far back to include finished jobs, as a number followed by m, h, or d
(for example 90m, 2h, 3d).
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show async and scheduled jobs running in an org.
Prints two sections. Async jobs covers the org's asynchronous Apex: everything currently in flight (Holding, Queued,
Preparing, Processing) plus anything that finished in the last 24 hours, newest first. Widen the finished-job window
with --since and raise the 50-row cap with --limit. Failed jobs print their extended status beneath the row.
Scheduled jobs lists every CronTrigger, soonest next run first, with the cron expression rendered to English. Jobs
that will never fire again sink to the bottom, and any job not in the WAITING state is marked on its row.
EXAMPLES
Show jobs for the default org:
$ sf raven inspect jobs
Show jobs for a specific org:
$ sf raven inspect jobs --target-org dev
Include everything that finished in the last three days:
$ sf raven inspect jobs --since 3d --limit 200sf raven pull
Refresh local Salesforce metadata from an authenticated org. Without --all, local metadata paths are loaded into fzf so you can choose one or more files or directories to retrieve. Press Tab to select multiple paths, then Enter to retrieve them together. With --all, each package directory from sfdx-project.json is retrieved.
USAGE
$ sf raven pull [--json] [-o <value>] [-a]
FLAGS
-a, --all Retrieve all local package directories instead of selecting a path with fzf.
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Refresh local Salesforce metadata from an authenticated org. Without --all, local metadata paths are loaded into fzf so you can choose one or more files or directories to retrieve. Press Tab to select multiple paths, then Enter to retrieve them together. With --all, each package directory from sfdx-project.json is retrieved.
EXAMPLES
$ sf raven pull
$ sf raven pull --target-org dev
$ sf raven pull --all
$ sf raven pull --target-org dev --allsf raven pull list
Report the metadata inventory used by the interactive pull commands, without any prompts. By default, lists the effective metadata types (the configured pullRemote.metadataTypes plugin config, or the types present in the local project when no config exists) with a count of local components per type. Use --all-types to list every metadata type the org supports, or --metadata-type to list the merged local/remote component list for a single type. Designed for machine consumption via --json.
USAGE
$ sf raven pull list [--json] [-o <value>] [--all-types | -m <value>]
FLAGS
-m, --metadata-type=<value> List the merged local/remote components for this metadata type.
-o, --target-org=<value> Username or alias of the target org.
--all-types List every metadata type the org supports, instead of the effective type list.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Report the metadata inventory used by the interactive pull commands, without any prompts. By default, lists the effective metadata types (the configured `pullRemote.metadataTypes` plugin config, or the types present in the local project when no config exists) with a count of local components per type. Use `--all-types` to list every metadata type the org supports, or `--metadata-type` to list the merged local/remote component list for a single type. Designed for machine consumption via `--json`.
EXAMPLES
$ sf raven pull list --json
$ sf raven pull list --all-types --json
$ sf raven pull list --metadata-type ApexClass --jsonsf raven pull remote
Select a configured metadata type, then list components of that type that exist in the target org but are not present in the local project. Org-only components are prefixed with a cloud marker in fzf. Press Tab to select multiple components, then Enter to retrieve them.
USAGE
$ sf raven pull remote [--json] [-o <value>]
FLAGS
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Select a configured metadata type, then list components of that type that exist in the target org but are not present in the local project. Org-only components are prefixed with a cloud marker in fzf. Press Tab to select multiple components, then Enter to retrieve them.
EXAMPLES
$ sf raven pull remote
$ sf raven pull remote --target-org devsf raven pull remote type add
List metadata types available in the target org and select one or more to add to this project's sf raven pull remote configuration. Press Tab to select multiple types in fzf, then Enter to save them.
USAGE
$ sf raven pull remote type add [--json] [-o <value>]
FLAGS
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List metadata types available in the target org and select one or more to add to this project's `sf raven pull remote` configuration. Press Tab to select multiple types in fzf, then Enter to save them.
EXAMPLES
$ sf raven pull remote type add
$ sf raven pull remote type add --target-org devsf raven pull remote type list
Display the metadata types that sf raven pull remote can inspect. If no project configuration has been saved yet, the list is derived from metadata types already present in the local project.
USAGE
$ sf raven pull remote type list [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Display the metadata types that `sf raven pull remote` can inspect. If no project configuration has been saved yet, the list is derived from metadata types already present in the local project.
EXAMPLES
$ sf raven pull remote type listsf raven pull remote type remove
Select one or more metadata types to remove from this project's sf raven pull remote configuration. Press Tab to select multiple types in fzf, then Enter to save the updated list.
USAGE
$ sf raven pull remote type remove [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Select one or more metadata types to remove from this project's `sf raven pull remote` configuration. Press Tab to select multiple types in fzf, then Enter to save the updated list.
EXAMPLES
$ sf raven pull remote type removesf raven profile sync
Reads the complete content of each Profile directly from the org via the CRUD Metadata API, which is not package-context-scoped, filters it down to the components tracked in local source, and overwrites the tracked profile files in place, wherever they live across package directories. The output is byte-identical to what a full-project sf project retrieve would produce for the profiles, in a fraction of the time. With no arguments, every profile tracked in local source is synced; profiles are fetched in parallel batches, and profiles that exist locally but not in the org are skipped with a warning. Entries that reference metadata not present in the local project are filtered out; user permissions, login IP ranges, the custom flag, and the user license are always kept in full. The org read uses the project's sourceApiVersion.
Each synced profile is reported with a per-section summary of entries added, removed, and modified. With --dry-run, no files are written: the command prints the changes a sync would make and exits non-zero if any profile differs from the org (or could not be read from it), so CI can detect profiles changed directly in the org.
Top-level profile sections (e.g. flowAccesses) can be excluded from syncing entirely - persisted per project with sf raven profile sync exclusion add, or per run with --exclude. Excluded sections are stripped before profiles are written.
USAGE
$ sf raven profile sync -o <value> [--json] [-p <value>...] [--dry-run] [--exclude <value>...]
FLAGS
-o, --target-org=<value> (required) Username or alias of the target org.
-p, --profile=<value>... Comma-separated names of the profiles to sync. Defaults to every profile tracked in local source.
--dry-run Report what a sync would change without writing any files, and exit non-zero if any profile differs from the org or could not be checked.
--exclude=<value>... Comma-separated top-level profile section tags (e.g. flowAccesses) to exclude for this run, in addition to the project's configured exclusions. Excluded sections are never written, so a section already present in a local profile file is removed on the next sync.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Reads the complete content of each Profile directly from the org via the CRUD Metadata API, which is not package-context-scoped, filters it down to the components tracked in local source, and overwrites the tracked profile files in place, wherever they live across package directories. The output is byte-identical to what a full-project `sf project retrieve` would produce for the profiles, in a fraction of the time. With no arguments, every profile tracked in local source is synced; profiles are fetched in parallel batches, and profiles that exist locally but not in the org are skipped with a warning. Entries that reference metadata not present in the local project are filtered out; user permissions, login IP ranges, the custom flag, and the user license are always kept in full. The org read uses the project's sourceApiVersion.
Each synced profile is reported with a per-section summary of entries added, removed, and modified. With --dry-run, no files are written: the command prints the changes a sync would make and exits non-zero if any profile differs from the org (or could not be read from it), so CI can detect profiles changed directly in the org.
Top-level profile sections (e.g. flowAccesses) can be excluded from syncing entirely - persisted per project with "sf raven profile sync exclusion add", or per run with --exclude. Excluded sections are stripped before profiles are written.
EXAMPLES
$ sf raven profile sync
$ sf raven profile sync --profile "Admin,Standard User"
$ sf raven profile sync --profile Admin --target-org my-org
$ sf raven profile sync --dry-run
$ sf raven profile sync --exclude flowAccesses,layoutAssignments
OUTPUT
Synced Admin -> force-app/main/default/profiles/Admin.profile-meta.xml
fieldPermissions: 2 added, 1 modified
userPermissions: 1 modified
Standard User is already up to date.sf raven profile sync select
Lists every profile in the target org, alongside every profile tracked in local source, in a multi-select fuzzy picker (requires fzf). Each profile is annotated with its status: "both" (tracked locally and in the org), "remote" (org only), or "local" (local source only). Selected profiles that are tracked locally are refreshed in place through the same pipeline as sf raven profile sync. Selected profiles that exist only in the org are adopted: a new profile file is created in the default package directory's profiles folder, filtered to the components tracked in local source and serialized identically to synced profiles. Selected local-only profiles are skipped with a warning, and cancelling the picker makes no changes.
USAGE
$ sf raven profile sync select -o <value> [--json] [--exclude <value>...]
FLAGS
-o, --target-org=<value> (required) Username or alias of the target org.
--exclude=<value>... Comma-separated top-level profile section tags (e.g. flowAccesses) to exclude for this run, in addition to the project's configured exclusions. Excluded sections are never written, so a section already present in a local profile file is removed on the next sync.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Lists every profile in the target org, alongside every profile tracked in local source, in a multi-select fuzzy picker (requires fzf). Each profile is annotated with its status: "both" (tracked locally and in the org), "remote" (org only), or "local" (local source only). Selected profiles that are tracked locally are refreshed in place through the same pipeline as "sf raven profile sync". Selected profiles that exist only in the org are adopted: a new profile file is created in the default package directory's profiles folder, filtered to the components tracked in local source and serialized identically to synced profiles. Selected local-only profiles are skipped with a warning, and cancelling the picker makes no changes.
EXAMPLES
$ sf raven profile sync select
$ sf raven profile sync select --target-org my-org
OUTPUT
Synced Admin -> force-app/main/default/profiles/Admin.profile-meta.xml
classAccesses: 1 added
Created Read Only -> force-app/main/default/profiles/Read Only.profile-meta.xml
fieldPermissions: 42 added
userPermissions: 18 addedsf raven profile sync exclusion add
Adds one or more top-level profile section tags (e.g. flowAccesses) to the project's persisted exclusion list, stored in sfdx-project.json and shared with the team via source control. Excluded sections are stripped from every profile written by sf raven profile sync and sf raven profile sync select, so a section already present in a local profile file is removed on the next sync.
Section names are accepted as-is - they are matched exactly (case-sensitive) against top-level tags in the Profile XML and are not validated against known metadata, so new Salesforce section types work without a plugin update. Nested tags (e.g. the flow or enabled tags inside flowAccesses) never match.
USAGE
$ sf raven profile sync exclusion add SECTIONS... [--json]
ARGUMENTS
SECTIONS... Top-level profile section tags to exclude. Separate multiple values with spaces or commas.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Adds one or more top-level profile section tags (e.g. flowAccesses) to the project's persisted exclusion list, stored in sfdx-project.json and shared with the team via source control. Excluded sections are stripped from every profile written by "sf raven profile sync" and "sf raven profile sync select", so a section already present in a local profile file is removed on the next sync. Section names are accepted as-is - they are matched exactly (case-sensitive) against top-level tags in the Profile XML and are not validated against known metadata, so new Salesforce section types work without a plugin update. Nested tags (e.g. the flow or enabled tags inside flowAccesses) never match.
EXAMPLES
$ sf raven profile sync exclusion add flowAccesses
$ sf raven profile sync exclusion add flowAccesses layoutAssignments
OUTPUT
Added sections: flowAccesses, layoutAssignments
Excluded sections are now: flowAccesses, layoutAssignmentssf raven profile sync exclusion list
Prints the top-level profile section tags persisted in sfdx-project.json that sf raven profile sync and sf raven profile sync select strip from every synced profile. Runtime-only exclusions passed via --exclude are not part of the persisted list.
USAGE
$ sf raven profile sync exclusion list [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Prints the top-level profile section tags persisted in sfdx-project.json that "sf raven profile sync" and "sf raven profile sync select" strip from every synced profile. Runtime-only exclusions passed via --exclude are not part of the persisted list.
EXAMPLES
$ sf raven profile sync exclusion list
OUTPUT
flowAccesses
layoutAssignmentssf raven profile sync exclusion remove
Removes one or more section tags from the project's persisted exclusion list in sfdx-project.json. Removed sections are synced again from the next sf raven profile sync run onwards. Values that are not currently excluded produce a warning and are otherwise ignored.
USAGE
$ sf raven profile sync exclusion remove SECTIONS... [--json]
ARGUMENTS
SECTIONS... Section tags to stop excluding. Separate multiple values with spaces or commas.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Removes one or more section tags from the project's persisted exclusion list in sfdx-project.json. Removed sections are synced again from the next "sf raven profile sync" run onwards. Values that are not currently excluded produce a warning and are otherwise ignored.
EXAMPLES
$ sf raven profile sync exclusion remove flowAccesses
OUTPUT
Removed sections: flowAccesses
Excluded sections are now: layoutAssignmentssf raven deploy cancel
Query the target org for pending or in-progress deploy requests, select one from an interactive list, confirm the cancellation, and submit an asynchronous deploy cancel request.
USAGE
$ sf raven deploy cancel [--json] [-o <value>]
FLAGS
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Query the target org for pending or in-progress deploy requests, select one from an interactive list, confirm the cancellation, and submit an asynchronous deploy cancel request.
EXAMPLES
$ sf raven deploy cancel
$ sf raven deploy cancel --target-org devsf raven soql
Without a query argument, starts an interactive SOQL REPL: tab completion for objects and fields backed by cached describes, live syntax highlighting, multi-line input, per-org arrow-key history with Ctrl+R reverse search, an automatic LIMIT on unbounded queries, and automatic Tooling API fallback for setup entities. Results render as a table with a row number column, and meta-commands (type \help) act on the last result - open a row in the browser, expand it to a full record view, export to CSV, and more. Output taller than the terminal is paged automatically.
With a query argument, runs the query once through the same pipeline and prints it in the chosen format.
USAGE
$ sf raven soql [QUERY] [--json] [--flags-dir <value>] [-o <value>] [-F table|json|csv|toon]
ARGUMENTS
[QUERY] SOQL query to run once; omit to start the interactive REPL.
FLAGS
-F, --format=<option> [default: table] Output format for one-shot mode: table, json (raw records array), csv, or toon (TOON-encoded records array). <options: table|json|csv|toon>
-o, --target-org=<value> Login username or alias for the target org; defaults to the default org.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Run SOQL queries in an interactive REPL, or one-shot from the shell.
Without a query argument, starts an interactive REPL with multi-line input, per-org arrow-key history with Ctrl+R reverse search, an automatic LIMIT on unbounded queries, and automatic Tooling API fallback for setup entities. Results render as a table with a row number column; meta-commands (type \help) act on the last result - open a row in the browser, expand it to a full record view, export to CSV, and more. With a query argument, runs the query once through the same pipeline and prints it in the chosen format.
EXAMPLES
Start the REPL against the default org:
$ sf raven soql
Start the REPL against a specific org:
$ sf raven soql --target-org my-sandbox
Run a one-shot query:
$ sf raven soql "SELECT Id, Name FROM Account WHERE CreatedDate = TODAY"
Run a one-shot query as CSV for a spreadsheet:
$ sf raven soql "SELECT Id, Name FROM Account" --format csv
Run a one-shot query as JSON:
$ sf raven soql "SELECT Id, Name FROM Account" --jsonsf raven query ids
Read Salesforce IDs from a file, deduplicate and validate them, split them into safe query batches, and run a SOQL query with the IDs inserted at the {ids} placeholder.
USAGE
$ sf raven query ids -f <value> -q <value> [--json] [-o <value>] [-b <value>] [-c <value>] [-l <value>]
FLAGS
-b, --batch-size=<value> Number of IDs to include in each query batch. By default, batches are sized to fit Salesforce URI limits.
-c, --csv=<value> Path to write query results as CSV. When supplied, table output is suppressed.
-f, --file=<value> (required) Path to a file containing one Salesforce ID per row.
-l, --limit=<value> Process only the first N unique valid IDs from the file.
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
-q, --query=<value> (required) SOQL query to run. Must include the {ids} placeholder where the ID list should be inserted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Read Salesforce IDs from a file, deduplicate and validate them, split them into safe query batches, and run a SOQL query with the IDs inserted at the {ids} placeholder.
EXAMPLES
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}"
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Opportunity WHERE AccountId IN {ids}"
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --limit 25
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --csv results.csvsf raven query record
Detect the object from the record id's key prefix, describe the object to build the full field list, query every field, and render the record transposed for the terminal: fields as rows, one column per record. If the key prefix is unknown to the regular API, detection falls back to the Tooling API, so setup entities (e.g. ApexClass) work the same way. Long values are truncated with an ellipsis; null values render as blank cells.
Add --history to print what changed on the record beneath it, for objects with field history tracking enabled.
USAGE
$ sf raven query record -o <value> -i <value> [--json] [-f <value> | -e <value>] [-F table|json|csv|toon] [-t <value>] [--omit-null] [--history]
FLAGS
-F, --format=<option> [default: table] Output format: table (transposed, for the terminal), json (raw records array), csv (one row per record), or toon (TOON-encoded records array). Non-table formats never truncate values. <options: table|json|csv|toon>
-e, --extra-fields=<value> Comma-delimited list of fields (typically relationship paths) to add on top of the full field list.
-f, --fields=<value> Comma-delimited list of fields to retrieve instead of the full field list; dot-notation relationship paths (e.g. Owner.Name) are allowed.
-i, --record-ids=<value> (required) Comma-delimited list of 15 or 18 character record ids to fetch.
-o, --target-org=<value> (required) Login username or alias for the target org.
-t, --truncate=<value> [default: 80] Width at which table cell values are truncated with an ellipsis; 0 means unlimited. Table output only.
--history Also show field history for each record, when history tracking is enabled on the object. Not supported with csv or toon output.
--omit-null Omit table rows where every record's value is null. Table output only.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Detect the object from the record id's key prefix, describe the object to build the full field list, query every field, and render the record transposed for the terminal: fields as rows, one column per record. If the key prefix is unknown to the regular API, detection falls back to the Tooling API, so setup entities (e.g. ApexClass) work the same way. Long values are truncated with an ellipsis; null values render as blank cells.
EXAMPLES
$ sf raven query record --record-ids 001Kf00001aBcDeFGH
$ sf raven query record --record-ids 001Kf00001aBcDeFGH,001Kf00001aBcDeXYZ
$ sf raven query record --record-ids 001Kf00001aBcDeFGH --fields Name,Industry,Owner.Name
$ sf raven query record --record-ids 001Kf00001aBcDeFGH --extra-fields Owner.Name,Owner.Profile.Name
$ sf raven query record --record-ids 001Kf00001aBcDeFGH --omit-null --truncate 0
$ sf raven query record --record-ids 001Kf00001aBcDeFGH --history
$ sf raven query record --record-ids 001Kf00001aBcDeFGH --format csv
$ sf raven query record --record-ids 001Kf00001aBcDeFGH --format toon
$ sf raven query record --record-ids 001Kf00001aBcDeFGH --jsonsf raven query recent
A zero-friction list view for poking at what just happened in an org: the newest records for an object, one row each.
By default you get the record Id, its name field, when it was created, and who created it. Use --modified to sort and report on last modification instead. --fields is additive - whatever you name is appended to those defaults rather than replacing them.
USAGE
$ sf raven query recent SOBJECT -o <value> [--json] [-l <value>] [--modified] [--recordtype
<value>] [-f <value>] [-F table|json|csv|toon] [-t <value>]
ARGUMENTS
SOBJECT API name of the sObject to list.
FLAGS
-F, --format=<option> [default: table] Output format.
<options: table|json|csv|toon>
-f, --fields=<value> Extra fields to show, as a comma-separated list. Appended to the default columns.
-l, --limit=<value> [default: 10] How many records to show.
-o, --target-org=<value> (required) Login username or alias for the target org.
-t, --truncate=<value> [default: 80] Truncate cell values to this many characters. Use 0 to disable.
--modified Sort by last modified date instead of created date, and show the modification columns.
--recordtype=<value> Only show records with this record type developer name.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show the most recently created records for an sObject.
A zero-friction list view for poking at what just happened in an org: the newest records for an object, one row each.
By default you get the record Id, its name field, when it was created, and who created it. Use --modified to sort and
report on last modification instead. --fields is additive: whatever you name is appended to those defaults rather than
replacing them.
EXAMPLES
Show the 10 newest Accounts:
$ sf raven query recent Account
Show the 25 most recently modified Cases:
$ sf raven query recent Case --modified --limit 25
Add extra columns:
$ sf raven query recent Opportunity --fields StageName,Amount
Only look at one record type:
$ sf raven query recent Opportunity --recordtype Enterprise
Output as CSV:
$ sf raven query recent Account --format csvsf raven audit display
Show recent entries in the Setup Audit Trail.
Returns the 20 most recent Setup Audit Trail entries, but this can be increased up to 2000 using the optional --limit flag. The results can be filtered by a particular user using the --username flag.
USAGE
$ sf raven audit display -o <value> [--json] [-u <value>] [-l <value>]
FLAGS
-l, --limit=<value> [default: 20] The number of audit trail entries to return. Maximum is 2000.
-o, --target-org=<value> (required) Login username or alias for the target org.
-u, --username=<value> Username to filter the audit trail by.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show recent entries in the Setup Audit Trail.
Returns the 20 most recent Setup Audit Trail entries, but this can be increased up to 2000 using the optional --limit flag. The results can be filtered by a particular user using the --username flag.
EXAMPLES
$ sf raven audit display --target-org dev
$ sf raven audit display --target-org dev --limit 200
$ sf raven audit display --target-org dev --username [email protected]
$ sf raven audit display --target-org dev --limit 50 --username [email protected]
OUTPUT
Date Username Type Action Delegate User
─────────────────── ───────────── ──────────── ─────────────────────────────────────────────────────────── ────────────────────
2023-09-29 17:23:47 [email protected] Apex Trigger Changed Account Created Trigger code: AccountTrigger null
2023-09-29 17:23:43 [email protected] Apex Trigger Created Account Created Trigger code: AccountCreatedTrigger null
...sf raven event subscribe
Subscribe to Platform Events.
Platform Events are printed to the terminal. An optional flag can be used to replay events from a given replay id. Default timeout is 3 minutes, but can be extended to 30 minutes.
USAGE
$ sf raven event subscribe -o <value> -e <value> [--json] [-r <value>] [-t <value>]
FLAGS
-e, --event=<value> (required) The name of the Platform Event that you want to subscribe with '/event/' prefix eg. /event/My_Event__e.
-o, --target-org=<value> (required) Login username or alias for the target org.
-r, --replayid=<value> The replay id to replay events from eg. 21980378.
-t, --timeout=<value> [default: 3] How long to subscribe for before timing out in minutes eg. 10. Default is 3 minutes.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Subscribe to Platform Events.
Platform Events are printed to the terminal. An optional flag can be used to replay events from a given replay id. Default timeout is 3 minutes, but can be extended to 30 minutes.
EXAMPLES
$ sf raven event subscribe --target-org dev --event /event/My_Event__e
$ sf raven event subscribe --target-org dev --event /event/My_Event__e --replayid 21980378
$ sf raven event subscribe --target-org dev --event /event/My_Event__e --timeout 10
$ sf raven event subscribe --target-org dev --event /event/My_Event__e --replayid 21980378 --timeout 10
OUTPUT
❯ 🔌 Connecting to org... done
❯ 📡 Listening for events...
{
"schema": "XdDXhymeO5NOxuhzFpgDJA",
"payload": {
"Some_Event_Field__c": "Hello World",
"CreatedDate": "2021-03-15T19:16:54.929Z",
},
"event": {
"replayId": 21980379
}
}sf raven event publish
The write-side twin of event subscribe, for testing platform event triggers end to end.
The payload can be a path to a JSON file or an inline JSON string - anything starting with { or [ is treated as inline JSON. A top-level object publishes one event, a top-level array publishes each of its elements in order, one result line each.
USAGE
$ sf raven event publish -o <value> -e <value> -p <value> [--json]
FLAGS
-e, --event=<value> (required) API name of the platform event, for example Order_Event__e. A /event/ prefix is
accepted and ignored.
-o, --target-org=<value> (required) Login username or alias for the target org.
-p, --payload=<value> (required) Path to a JSON file, or an inline JSON object or array.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Publish a platform event.
The write-side twin of event subscribe, for testing platform event triggers end to end.
The payload can be a path to a JSON file or an inline JSON string; anything starting with { or [ is treated as inline
JSON. A top-level object publishes one event, a top-level array publishes each of its elements in order, one result
line each.
The event API name is not validated up front, so an unknown event or an unrecognised field comes back as the API's own
error.
EXAMPLES
Publish one event from an inline payload:
$ sf raven event publish --event Order_Event__e --payload '{"Order_Number__c":"A-1001"}'
Publish a batch from a file:
$ sf raven event publish --event Order_Event__e --payload events.json
The subscribe-style channel prefix is accepted too:
$ sf raven event publish --event /event/Order_Event__e --payload '{"Order_Number__c":"A-1001"}'sf raven apex log
Tail Apex debug logs in real time, streamed to your terminal - a wrapper around the native sf apex tail log that makes it better.
- Automatically manages trace flags for your user, or another user passed in (via
--user) - By default strips the logs to only include USER_DEBUG and errors/exceptions (or full logs can be shown with
--rawflag) - Logs are formatted to be more clean / readable
- Ability to filter logs by an arbitrary value
- If you wanted to show only debug logs for a process you are actively debugging e.g.
System.debug('MyThing Account.Status: ' account.Status) - Then filter the logs with
--filter MyThing
- If you wanted to show only debug logs for a process you are actively debugging e.g.
USAGE
$ sf raven apex log [--json] [-o <value>] [-u <value>] [-f <value>] [--raw] [--no-trace] [-t <value>]
FLAGS
-f, --filter=<value> Only show USER_DEBUG lines containing this string. Errors and exceptions are always shown.
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
-t, --timeout=<value> [default: 3] Minutes to listen before exiting (1-30).
-u, --user=<value> Username to tail logs for. Defaults to the current authenticated user.
--no-trace Skip trace flag check. Use when managing trace flags externally.
--raw Print the full log body instead of filtering to USER_DEBUG and exception lines.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Stream Apex debug logs as they are written. Logs are filtered to show USER_DEBUG statements and exceptions by
default. Use --raw to see the full log body.
If no active trace flag exists for the target user, you will be prompted to create one. Without an active trace
flag, no logs will be captured.
EXAMPLES
$ sf raven apex log
$ sf raven apex log --target-org dev
$ sf raven apex log --target-org dev --user [email protected]
$ sf raven apex log --target-org dev --filter MyDebugPrefix
$ sf raven apex log --target-org dev --raw
OUTPUT
Trace flag active until 09:32:17.
Tailing logs for [email protected]. Press Ctrl+C to stop.
── executeAnonymous 09:31:58 245ms ──
[1] DEBUG Hello world
[3] DEBUG account = Account:{Name=Acme, ...}
── UserTrigger 09:32:04 18ms ──
[12] DEBUG entering trigger
⚠ [47] System.NullPointerException: Attempt to de-reference a null objectsf raven apex run
Runs an anonymous Apex file against the target org and prints the resulting debug log, filtered to USER_DEBUG statements and exceptions by default.
Execution uses the SOAP debugging header, so each run's log comes back with the result. No trace flag is needed and logs from other org activity are never mixed in - unlike apex log, which tails everything.
--watchre-runs the file every time you save it, so you can iterate in your editor and watch the output land in the terminal--ndjsonstreams a watch loop as machine-readable events, one JSON object per line- The command exits non-zero when the code fails to compile or throws at runtime, so it can be used in scripts
USAGE
$ sf raven apex run [--json] [-o <value>] [-f <value>] [--filter <value>] [--raw] [-w]
[--ndjson]
FLAGS
-f, --file=<value> [default: scripts/apex/scratch.apex] Path to the anonymous Apex file to execute.
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
-w, --watch Re-run the file every time it changes on disk. Press Ctrl+C to stop. Cannot be combined with
--json.
--filter=<value> Only show USER_DEBUG lines containing this string. Errors and exceptions are always shown.
--ndjson Stream machine-readable NDJSON events, one JSON object per line, instead of formatted
output. Requires --watch.
--raw Print the full log body instead of filtering to USER_DEBUG and exception lines.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Execute an anonymous Apex file and print clean debug output.
Runs an anonymous Apex file against the target org and prints the resulting debug log, filtered to USER_DEBUG
statements and exceptions by default.
Execution uses the SOAP debugging header, so each run's log is returned with the result. No trace flag is needed and
logs from other org activity are never mixed in.
The command exits non-zero when the code fails to compile or throws at runtime, so it can be used in scripts.
EXAMPLES
Run the default scratch file against the default org:
$ sf raven apex run
Run a specific file against a specific org:
$ sf raven apex run --file scripts/apex/backfill.apex --target-org dev
Only show debug lines containing a specific string:
$ sf raven apex run --filter MyDebugPrefix
Show the full raw log body:
$ sf raven a