sfdx-stools
v0.4.3
Published
sfdx plugin tools by peter sewell (stools)
Downloads
123
Readme
sfdx-stools
sfdx plugin tools by peter sewell - sewell tools > stools
$ npm install -g sfdx-stools
$ sfdx COMMAND
running command...
$ sfdx (-v|--version|version)
sfdx-stools/0.4.3 darwin-arm64 node-v18.4.0
$ sfdx --help [COMMAND]
USAGE
$ sfdx COMMAND
...
sfdx stools:org:dif -s <string> -t <string> -m <array> [-d] [-f <string>] [-x] [-k <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx stools:org:nobypass -c <string> [-o] [-i] [-k <string>] [-w <url>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx stools:perms:compare -s <array> -t <array> [-g] [-d] [-f <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx stools:perms:make [-o] [-n] [-x] [-f <string>] [-c] [-s <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx stools:perms:merge -p <array> [-l] [-g] [-d] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx stools:org:dif -s <string> -t <string> -m <array> [-d] [-f <string>] [-x] [-k <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Compares metadata between 2 orgs
USAGE
$ sfdx stools:org:dif -s <string> -t <string> -m <array> [-d] [-f <string>] [-x] [-k <string>] [-u <string>]
[--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-d, --deepmatch Deep match contents of source vs
target metadata, return differences
in git diff summary format, eg. show
number of line differences of
ApexClass
-f, --folder=folder If -d flag set, then write full git
diff output to file in specified
folder, file name will be in the
form type.entity
-k, --key=key Post the results to New Relic,
authenticating using the KEY
parameter as the X-License-Key
header
-m, --metadatatypes=metadatatypes (required) The metadata type to be
retrieved, such as CustomObject or
Report. The metadata type value is
case-sensitive
-s, --source=source (required) The source org's username
or the folder containing the source
metadata to be compared. Assume
username if contains an @
-t, --target=target (required) The target org's username
or the folder containing the target
metadata to be compared. Assume
username if contains an @
-u, --targetusername=targetusername username or alias for the target
org; overrides default target org
-x, --excludematch Exclude matches from output
--apiversion=apiversion override the api version used for
api requests made by this command
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLES
$ sfdx stools:org:dif -m CustomObject
$ sfdx stools:perms:make -m CustomObject --json
See code: lib/commands/stools/org/dif.js
sfdx stools:org:nobypass -c <string> [-o] [-i] [-k <string>] [-w <url>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Checks whether the listed entities contain bypass logic as determined by regex
USAGE
$ sfdx stools:org:nobypass -c <string> [-o] [-i] [-k <string>] [-w <url>] [-u <string>] [--apiversion <string>]
[--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-c, --config=config (required) config file containing
tab separated list of metadata types
to check, associated bypass regex,
and any whitelisted components
-i, --ignorecase ignore case in the regex. e.g.
No_Triggers__c = no_triggers__c. The
default is to be case sensitive
-k, --key=key Post the results to New Relic,
authenticating using the KEY
parameter as the X-License-Key
header
-o, --org run the command against an org
instead of a folder, the org is
identified by -u or uses default if
not specified
-u, --targetusername=targetusername username or alias for the target
org; overrides default target org
-w, --webaddress=webaddress New Relic API URL to post the
results if the -k option is
specified. The default URL is
https://log-api.newrelic.com/log/v1
--apiversion=apiversion override the api version used for
api requests made by this command
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLES
$ sfdx stools:org:nobypass -c config.cfg
$ sfdx stools:org:nobypass -c config.cfg -o -u myorg --json
See code: lib/commands/stools/org/nobypass.js
sfdx stools:perms:compare -s <array> -t <array> [-g] [-d] [-f <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Compares aggregate permisisons from source list against and target list writing higher permissions contained in target list to stdout
USAGE
$ sfdx stools:perms:compare -s <array> -t <array> [-g] [-d] [-f <string>] [-u <string>] [--apiversion <string>]
[--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-d, --getpermsdir look for permission sets in the sfdx
project permissions folder
-f, --tofile=tofile write differences to file in xml
format
-g, --getorg look for permission sets on
Salesforce org
-s, --sourceperms=sourceperms (required) Source list of permission
set files to be compared against
target (use permission set names
when using -g or -d); list is comma
separated
-t, --targetperms=targetperms (required) Target list of permission
set files to be compared against
target (use permission set names
when using -g or -d); list is comma
separated
-u, --targetusername=targetusername username or alias for the target
org; overrides default target org
--apiversion=apiversion override the api version used for
api requests made by this command
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLES
$ sfdx stools:perms:compare -s permset1.xml,permset2.xml -t permset3.xml,permset4.xml -f differences.xml
$ sfdx stools:perms:compare -s permset1 -t permset2,permset3 -g
See code: lib/commands/stools/perms/compare.js
sfdx stools:perms:make [-o] [-n] [-x] [-f <string>] [-c] [-s <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Makes a permission set file containing permissions as set by other flags
USAGE
$ sfdx stools:perms:make [-o] [-n] [-x] [-f <string>] [-c] [-s <array>] [-u <string>] [--apiversion <string>] [--json]
[--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-c, --consolidate
when used with -s and -f, consolidate all field permissions into a single object-based permissions set
-f, --sourcefolder=sourcefolder
source folder: for -n or -o is the folder to source the objects from (rather than an org), for -s is the output
folder to store permisison sets
-n, --noobjectaccess
explicity grant no access to objects in org
-o, --makeobjects
grant read only access to all custom objects in org
-s, --makesensitivefields=makesensitivefields
create a pair of permission sets (RO and RW) for each field classified with value in the comma separated list (Refer
Data Classification Metadata Fields, SecurityClassifications)
-u, --targetusername=targetusername
username or alias for the target org; overrides default target org
-x, --standardobjectsonly
include only standard objects when used with -n
--apiversion=apiversion
override the api version used for api requests made by this command
--json
format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
[default: warn] logging level for this command invocation
EXAMPLES
$ sfdx stools:perms:make -o
$ sfdx stools:perms:make -n -f ./src
$ sfdx stools:perms:make -s "Protected,MissionCritical" -f ./perms
$ sfdx stools:perms:make -s "Protected,MissionCritical" -f ./perms -c
$ sfdx stools:perms:make -o --json
See code: lib/commands/stools/perms/make.js
sfdx stools:perms:merge -p <array> [-l] [-g] [-d] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Merges permission sets and writes to stdout
USAGE
$ sfdx stools:perms:merge -p <array> [-l] [-g] [-d] [-u <string>] [--apiversion <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-d, --getpermsdir look for permission sets in the sfdx
project permissions folder
-g, --getorg look for permission sets on
Salesforce org
-l, --formatasprofile format output as profile metadata
(default is permission set)
-p, --permissionsets=permissionsets (required) list of permission set
files to merge (or names when using
-g or -d); list is comma separated
-u, --targetusername=targetusername username or alias for the target
org; overrides default target org
--apiversion=apiversion override the api version used for
api requests made by this command
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLES
$ sfdx stools:perms:merge -p permset1.xml,permset2.xml,permset3.xml
$ sfdx stools:perms:merge -p permset1,permset2,permset3 -g
See code: lib/commands/stools/perms/merge.js
Debugging your plugin
We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the .vscode
directory of this plugin is a launch.json
config file, which allows you to attach a debugger to the node process when running your commands.
To debug the hello:org
command:
- Start the inspector
If you linked your plugin to the sfdx cli, call your command with the dev-suspend
switch:
$ sfdx hello:org -u myOrg@example.com --dev-suspend
Alternatively, to call your command using the bin/run
script, set the NODE_OPTIONS
environment variable to --inspect-brk
when starting the debugger:
$ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
- Set some breakpoints in your command code
- Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
- In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
- Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
- Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5). Congrats, you are debugging!