JSPM

sfdx-jayree

4.7.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 70
  • Score
    100M100P100Q94467F
  • License BSD-3-Clause

A Salesforce CLI plugin containing commands and hooks for Salesforce Application Lifecycle Management tasks.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sfdx-jayree) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    sfdx-jayree

    A Salesforce CLI plugin containing commands and hooks for Salesforce Application Lifecycle Management tasks.

    sfdx Version test-and-release Downloads/week License Gitter

    Install

    sfdx plugins:install @jayree/sfdx-plugin-source

    Commands

    sfdx jayree:automation:changeset:deploy

    deploy incomming change set to an org (beta)

    USAGE
      $ sfdx jayree:automation:changeset:deploy [-r <string> -l <string>] [-c] [--nodialog -s <string>] [-u <string>] [--apiversion
        <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
    
    FLAGS
      -c, --checkonly                                                                   validate deploy but don’t save to
                                                                                        the org (default:false)
      -l, --testlevel=<option>                                                          deployment testing level
                                                                                        (Default,RunSpecifiedTests,RunLocalT
                                                                                        ests,RunAllTestsInOrg)
                                                                                        <options: Default|RunSpecifiedTests|
                                                                                        RunLocalTests|RunAllTestsInOrg>
      -r, --runtests=<value>                                                            tests to run if --testlevel
                                                                                        RunSpecifiedTests
      -s, --changeset=<value>                                                           name of changeset to deploy
      -u, --targetusername=<value>                                                      username or alias for the target
                                                                                        org; overrides default target org
      --apiversion=<value>                                                              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
      --nodialog                                                                        don't show the dialog wizard
    
    DESCRIPTION
      deploy incomming change set to an org (beta)
    
    EXAMPLES
      $ sfdx jayree:automation:changeset:deploy -s ChangeSet -l RunLocalTests --nodialog
      Deploying Change Set 'ChangeSet'...
      === Status
      Status: Pending
      jobid:  0Xxx100000xx1x1
    
      $ sfdx jayree:automation:changeset:deploy
      ? Change Sets Awaiting Deployment (Use arrow keys)
        ChangeSet3
        ChangeSet2
      ❯ ChangeSet1

    See code: @jayree/sfdx-plugin-legacy

    sfdx jayree:automation:changeset:list

    list incomming change sets of an org (beta)

    USAGE
      $ sfdx jayree:automation:changeset:list [-u <string>] [--apiversion <string>] [--json] [--loglevel
        trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
    
    FLAGS
      -u, --targetusername=<value>                                                      username or alias for the target
                                                                                        org; overrides default target org
      --apiversion=<value>                                                              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
    
    DESCRIPTION
      list incomming change sets of an org (beta)

    See code: @jayree/sfdx-plugin-legacy

    sfdx jayree:automation:ltngsync:status

    check the Lightning Sync User Sync Status and reset sync if needed (beta)

    USAGE
      $ sfdx jayree:automation:ltngsync:status -o <string> [-s] [-w <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
        trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
    
    FLAGS
      -o, --officeuser=<value>                                                          (required) 'name' (firstname
                                                                                        lastname) of the SF user
      -s, --statusonly                                                                  get Lightning Sync status of the SF
                                                                                        user, only
      -u, --targetusername=<value>                                                      username or alias for the target
                                                                                        org; overrides default target org
      -w, --wait=<value>                                                                wait time for command to wait for
                                                                                        status change in minutes (default:
                                                                                        infinitely)
      --apiversion=<value>                                                              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
    
    DESCRIPTION
      check the Lightning Sync User Sync Status and reset sync if needed (beta)
    
    EXAMPLES
      $ sfdx jayree:automation:ltngsync:status -o 'Name'
      configSetup: User assigned to active Lightning Sync configuration... Yes
      userContacts/userEvents: Salesforce and Exchange email addresses linked... Linked/Linked
      userContacts/userEvents: Salesforce to Exchange sync status... Initial sync completed/Initial sync completed
      userContacts/userEvents: Exchange to Salesforce sync status... Initial sync completed/Initial sync completed

    See code: @jayree/sfdx-plugin-legacy

    sfdx jayree:flowtestcoverage

    check the flow test coverage of an org

    USAGE
      $ sfdx jayree:flowtestcoverage -o <value> [--json] [--api-version <value>]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
      --api-version=<value>     Override the api version used for api requests made by this command
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    EXAMPLES
      $ sfdx jayree:flowtestcoverage
      === Flow Test Coverage
      Coverage: 82%
      ...

    See code: src/commands/jayree/flowtestcoverage.ts

    sfdx jayree:manifest:cleanup

    Removes those tags from a manifest file that are present in a second manifest file.

    USAGE
      $ sfdx jayree:manifest:cleanup -f <value> [--json] [-x <value>]
    
    FLAGS
      -f, --file=<value>      (required) Path to the second 'cleanup' manifest file.
      -x, --manifest=<value>  Path to the manifest file.
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    DESCRIPTION
      Removes those tags from a manifest file that are present in a second manifest file.
    
      Use this command to remove components or metadata types from a manifes file.
    
      If the 'cleanup' manifest file (--file) doesn't exist, a template file is created, which can then be modified.
    
    EXAMPLES
      $ sfdx jayree:manifest:cleanup --manifest=package.xml --file=packageignore.xml

    See code: @jayree/sfdx-plugin-manifest

    sfdx jayree:manifest:generate

    Generate a complete manifest file form the specified org.

    USAGE
      $ sfdx jayree:manifest:generate -o <value> [--json] [--api-version <value>] [-q <value>] [-c] [-w] [--include-flow-versions]
        [-f <value>] [--exclude-managed | --exclude-all]
    
    FLAGS
      -c, --match-case               Enable 'match case' for the quickfilter.
      -f, --file=<value>             Write to 'file' instead of stdout.
      -o, --target-org=<value>       (required) Username or alias of the target org.
      -q, --quick-filter=<value>...  Metadata type, member or file path to filter on.
      -w, --match-whole-word         Enable 'match whole word' for the quickfilter.
      --api-version=<value>          Override the api version used for api requests made by this command
      --exclude-all                  Exclude all packages from output.
      --exclude-managed              Exclude managed packages from output.
      --include-flow-versions        Include flow versions as with api version 43.0.
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    DESCRIPTION
      Generate a complete manifest file form the specified org.
    
      Use this command to generate a manifest file based on an existing org.
    
    EXAMPLES
      $ sfdx jayree:manifest:generate --targetusername myOrg@example.com
      <?xml version='1.0' encoding='UTF-8'?>
      <Package xmlns='http://soap.sforce.com/2006/04/metadata'>...</Package>

    See code: @jayree/sfdx-plugin-manifest

    sfdx jayree:manifest:git:diff

    Create a project manifest and destructiveChanges manifest that lists the metadata components you want to deploy or delete based on changes in your git history.

    USAGE
      $ sfdx jayree:manifest:git:diff REF1 [REF2] [--json] [--api-version <value>] [-d <value>] [--output-dir <value>]
        [--destructive-changes-only]
    
    ARGUMENTS
      REF1  Base commit or branch.
      REF2  Commit or branch to compare to the base commit.
    
    FLAGS
      -d, --source-dir=<value>...  Path to the local source files to include in the manifest.
      --api-version=<value>        Override the api version used for api requests made by this command
      --destructive-changes-only   Create a destructiveChanges manifest only.
      --output-dir=<value>         Directory to save the created manifest files.
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    DESCRIPTION
      Create a project manifest and destructiveChanges manifest that lists the metadata components you want to deploy or
      delete based on changes in your git history.
    
      Use this command to create a manifest and destructiveChanges manifest file based on the difference (git diff) of two
      git refs.
    
      You can use all ways to spell <commit> which are valid for 'git diff' (See https://git-scm.com/docs/git-diff).
    
    ALIASES
      $ sfdx jayree:manifest:beta:git:diff
    
    EXAMPLES
      Uses the changes between two arbitrary <commit>.
    
        $ sfdx jayree:manifest:git:diff <commit> <commit>
        $ sfdx jayree:manifest:git:diff <commit>..<commit>
    
      Uses the changes on the branch containing and up to the second <commit>, starting at a common ancestor of both
      <commit>.
    
        $ sfdx jayree:manifest:git:diff <commit>...<commit>
    
      Uses the diff of what is unique in branchB (REF2) and unique in branchA (REF1).
    
        $ sfdx jayree:manifest:git:diff branchA..branchB
    
      Uses the diff of what is unique in branchB (REF2).
    
        $ sfdx jayree:manifest:git:diff branchA...branchB
    
      Specify the flags before or after the REF args
    
        $ sfdx jayree:manifest:git:diff --output-dir package <commit> <commit>
        $ sfdx jayree:manifest:git:diff <commit> <commit> --output-dir package
    
      If you specify the 'source-dir' flag before the REF args, use '--' to separate the args from the 'source-dir'
      values.
    
        $ sfdx jayree:manifest:git:diff --source-dir force-app -- <commit> <commit>
    
    FLAG DESCRIPTIONS
      -d, --source-dir=<value>...  Path to the local source files to include in the manifest.
    
        The supplied path can be to a single file (in which case the operation is applied to only one file) or to a folder
        (in which case the operation is applied to all metadata types in the directory and its subdirectories).
    
        You can specify this flag more than once.
    
      --destructive-changes-only  Create a destructiveChanges manifest only.
    
        Use this flag to create a 'destructiveChanges.xml' and a blank 'package.xml'.
    
      --output-dir=<value>  Directory to save the created manifest files.
    
        The location can be an absolute path or relative to the current working directory.

    See code: @jayree/sfdx-plugin-manifest

    sfdx jayree:manifest:legacy:git:diff

    Create a project manifest and destructiveChanges manifest that lists the metadata components you want to deploy or delete based on changes in your git history.

    USAGE
      $ sfdx jayree:manifest:legacy:git:diff REF1 [REF2] [--json] [-d <value>] [--output-dir <value>]
      [--destructive-changes-only]
    
    ARGUMENTS
      REF1  Base commit or branch.
      REF2  Commit or branch to compare to the base commit.
    
    FLAGS
      -d, --source-dir=<value>...  Path to the local source files to include in the manifest.
      --destructive-changes-only   Create a destructiveChanges manifest only.
      --output-dir=<value>         Directory to save the created manifest files.
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    DESCRIPTION
      Create a project manifest and destructiveChanges manifest that lists the metadata components you want to deploy or
      delete based on changes in your git history.
    
      Use this command to create a manifest and destructiveChanges manifest file based on the difference (git diff) of two
      git refs.
    
      You can use all ways to spell <commit> which are valid for 'git diff' (See https://git-scm.com/docs/git-diff).
    
    EXAMPLES
      Uses the changes between two arbitrary <commit>.
    
        $ sfdx jayree:manifest:legacy:git:diff <commit> <commit>
        $ sfdx jayree:manifest:legacy:git:diff <commit>..<commit>
    
      Uses the changes on the branch containing and up to the second <commit>, starting at a common ancestor of both
      <commit>.
    
        $ sfdx jayree:manifest:legacy:git:diff <commit>...<commit>
    
      Uses the diff of what is unique in branchB (REF2) and unique in branchA (REF1).
    
        $ sfdx jayree:manifest:legacy:git:diff branchA..branchB
    
      Uses the diff of what is unique in branchB (REF2).
    
        $ sfdx jayree:manifest:legacy:git:diff branchA...branchB
    
      Specify the flags before or after the REF args
    
        $ sfdx jayree:manifest:legacy:git:diff --output-dir package <commit> <commit>
        $ sfdx jayree:manifest:legacy:git:diff <commit> <commit> --output-dir package
    
      If you specify the 'source-dir' flag before the REF args, use '--' to separate the args from the 'source-dir'
      values.
    
        $ sfdx jayree:manifest:legacy:git:diff --source-dir force-app -- <commit> <commit>
    
    FLAG DESCRIPTIONS
      -d, --source-dir=<value>...  Path to the local source files to include in the manifest.
    
        The supplied path can be to a single file (in which case the operation is applied to only one file) or to a folder
        (in which case the operation is applied to all metadata types in the directory and its subdirectories).
    
        You can specify this flag more than once.
    
      --destructive-changes-only  Create a destructiveChanges manifest only.
    
        Use this flag to create a 'destructiveChanges.xml' and a blank 'package.xml'.
    
      --output-dir=<value>  Directory to save the created manifest files.
    
        The location can be an absolute path or relative to the current working directory.

    See code: @jayree/sfdx-plugin-manifest

    sfdx jayree:org:configure

    make configuration changes that are not covered by the metadata API

    USAGE
      $ sfdx jayree:org:configure -o <value> [--json] [--api-version <value>] [-t <value>] [--concurrent]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
      -t, --tasks=<value>...    list of task titles, if no tasks are specified, all tasks marked as active will be executed
      --api-version=<value>     Override the api version used for api requests made by this command
      --concurrent              execute tasks in parallel
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    DESCRIPTION
      make configuration changes that are not covered by the metadata API
      See example configuration on how to define tasks
    
      make configuration changes that are not covered by the metadata API
      See example configuration on how to define tasks
    
    EXAMPLES
      $ sfdx jayree:org:configure
      $ sfdx jayree:org:configure -u me@my.org
      $ sfdx jayree:org:configure --tasks="Asset Settings","Activity Settings"
      $ sfdx jayree:org:configure --concurrent --tasks="Asset Settings","Activity Settings"

    See code: @jayree/sfdx-plugin-org

    sfdx jayree:org:configure:country

    update country integration values in the State/Country Picklists

    USAGE
      $ sfdx jayree:org:configure:country -o <value> [--json] [--api-version <value>]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
      --api-version=<value>     Override the api version used for api requests made by this command
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    DESCRIPTION
      update country integration values in the State/Country Picklists
    
      update country integration values in the State/Country Picklists

    See code: @jayree/sfdx-plugin-org

    sfdx jayree:org:configure:state

    import (create/update) states into the State/Country Picklists

    USAGE
      $ sfdx jayree:org:configure:state -o <value> [--json] [--api-version <value>] [--country-code <value>] [--category <value>]
        [--language <value>] [--concurrent <value>]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
      --api-version=<value>     Override the api version used for api requests made by this command
      --category=<value>        Subdivision category
      --concurrent=<value>      [default: 1] execute tasks in parallel
      --country-code=<value>    Alpha-2 code
      --language=<value>        Language code
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    DESCRIPTION
      import (create/update) states into the State/Country Picklists
    
      import (create/update) states into the State/Country Picklists

    See code: @jayree/sfdx-plugin-org

    sfdx jayree:org:settings

    write the current settings from an Org to a scratch org def file

    USAGE
      $ sfdx jayree:org:settings -o <value> [--json] [-w] [-f <value>]
    
    FLAGS
      -f, --file=<value>                  write to 'file' instead of project-scratch-def.json
      -o, --target-org=<value>            (required) Username or alias of the target org.
      -w, --writetoprojectscratchdeffile  write output to project-scratch-def.json file
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    EXAMPLES
      $ sfdx jayree:org:settings
      $ sfdx jayree:org:settings -u me@my.org
      $ sfdx jayree:org:settings -u MyTestOrg1 -w

    See code: src/commands/jayree/org/settings.ts

    sfdx jayree:org:streaming

    listen to streaming api and platform events

    USAGE
      $ sfdx jayree:org:streaming -o <value> -p <value> [--json] [--api-version <value>]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
      -p, --topic=<value>       (required) topic name
      --api-version=<value>     Override the api version used for api requests made by this command
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    EXAMPLES
      $ sfdx jayree:org:streaming --topic=/event/eventName__e
      ...

    See code: src/commands/jayree/org/streaming.ts

    sfdx jayree:packagedescription:create

    creates an empty package with the description

    USAGE
      $ sfdx jayree:packagedescription:create (-d <string> -f <string>) [--json] [--loglevel
        trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
    
    FLAGS
      -d, --description=<value>                                                         (required) new description value
      -f, --file=<value>                                                                (required) file to create
      --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
    
    DESCRIPTION
      creates an empty package with the description
    
    EXAMPLES
      $ sfdx jayree:packagedescription:create --file FILENAME --description 'DESCRIPTION'

    See code: @jayree/sfdx-plugin-legacy

    sfdx jayree:packagedescription:get

    get the description within a package

    USAGE
      $ sfdx jayree:packagedescription:get -f <string> [--json] [--loglevel
        trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
    
    FLAGS
      -f, --file=<value>                                                                (required) file to read
      --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
    
    DESCRIPTION
      get the description within a package
    
    EXAMPLES
      $ sfdx jayree:packagedescription:get --file FILENAME
      Description of Package FILENAME

    See code: @jayree/sfdx-plugin-legacy

    sfdx jayree:packagedescription:remove

    remove the description within a package

    USAGE
      $ sfdx jayree:packagedescription:remove -f <string> [--json] [--loglevel
        trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
    
    FLAGS
      -f, --file=<value>                                                                (required) file to read
      --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
    
    DESCRIPTION
      remove the description within a package
    
    EXAMPLES
      $ sfdx jayree:packagedescription:remove --file FILENAME

    See code: @jayree/sfdx-plugin-legacy

    sfdx jayree:packagedescription:set

    set the description within a package

    USAGE
      $ sfdx jayree:packagedescription:set (-d <string> -f <string>) [--json] [--loglevel
        trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
    
    FLAGS
      -d, --description=<value>                                                         (required) new description value
      -f, --file=<value>                                                                (required) file to read
      --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
    
    DESCRIPTION
      set the description within a package
    
    EXAMPLES
      $ sfdx jayree:packagedescription:set --file FILENAME --description 'NEW DESCRIPTION'

    See code: @jayree/sfdx-plugin-legacy

    sfdx jayree:source:fix

    fix local source files

    USAGE
      $ sfdx jayree:source:fix [--json] [-o <value>] [-t <value>] [--verbose]
    
    FLAGS
      -o, --target-org=<value>
      -t, --tag=<value>...      comma-separated list of tag names listed in .sfdx-jayree.json
      --verbose                 log output to console
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    FLAG DESCRIPTIONS
      --verbose  log output to console
    
        log output to console

    See code: src/commands/jayree/source/fix.ts

    sfdx jayree:source:snapshot:compare

    compares sfdx source snapshot files

    USAGE
      $ sfdx jayree:source:snapshot:compare [--json] [--filepath <value>]
    
    FLAGS
      --filepath=<value>  [default: ./sfdx-source-snapshot.json] path of the generated snapshot file
    
    GLOBAL FLAGS
      --json  Format output as json.

    See code: @jayree/sfdx-plugin-source

    sfdx jayree:source:snapshot:generate

    generates sfdx source snapshot files

    USAGE
      $ sfdx jayree:source:snapshot:generate [--json] [--filepath <value>]
    
    FLAGS
      --filepath=<value>  [default: ./sfdx-source-snapshot.json] path to save the generated snapshot file
    
    GLOBAL FLAGS
      --json  Format output as json.

    See code: @jayree/sfdx-plugin-source

    sfdx jayree:source:tracking:list

    list changes in a scratch org by remote revision counter number

    USAGE
      $ sfdx jayree:source:tracking:list -o <value> [--json] [--api-version <value>] [-r <value>]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
      -r, --revision=<value>    start at a specific revision counter number
      --api-version=<value>     Override the api version used for api requests made by this command
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    EXAMPLES
      $ sfdx jayree:source:tracking:list
      $ sfdx jayree:source:tracking:list -u me@my.org
      $ sfdx jayree:source:tracking:list -u me@my.org -r 101

    See code: @jayree/sfdx-plugin-source

    sfdx jayree:source:tracking:store:get

    get stored revision counter number

    USAGE
      $ sfdx jayree:source:tracking:store:get -o <value> [--json]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    EXAMPLES
      $ sfdx jayree:source:tracking:store:get
      $ sfdx jayree:source:tracking:store:get -u me@my.org

    See code: @jayree/sfdx-plugin-source

    sfdx jayree:source:tracking:store:set

    store revision counter number

    USAGE
      $ sfdx jayree:source:tracking:store:set -o <value> [--json] [--api-version <value>] [-r <value>]
    
    FLAGS
      -o, --target-org=<value>  (required) Username or alias of the target org.
      -r, --revision=<value>    revision counter number (default: remote revision counter number)
      --api-version=<value>     Override the api version used for api requests made by this command
    
    GLOBAL FLAGS
      --json  Format output as json.
    
    EXAMPLES
      $ sfdx jayree:source:tracking:store:set
      $ sfdx jayree:source:tracking:store:set -u me@my.org
      $ sfdx jayree:source:tracking:store:set -u MyTestOrg1 -r 101

    See code: @jayree/sfdx-plugin-source

    Hooks

    The following hooks are triggered after running force:source:retrieve or force:source:pull. They extend both standard commands with the same logic as jayree:source:retrieve:all and jayree:source:retrieve:full.

    Enable/Disable

    Set the following parameter in .sfdx-jayree.json to enable (true) or disable (false) the hooks:

    {
      "runHooks": true,
    }

    Hook flow

    Hooks Flow

    prerun

    • Resets source tracking using force:source:tracking:reset before executing force:source:pull.

    IMPORTANT: This hook will only run if SFDX_ENABLE_JAYREE_HOOKS_RESET_BEFORE_PULL=true is set. It uses the stored serverMaxRevisionCounter as revision counter number (see: jayree:source:tracking:store:set). If the hook doesn't find a stored value it asks if the current local revision counter number should be stored and used.

    preretrieve

    postretrieve (plugin-source plugin) / postsourceupdate (legacy salesforce-alm plugin)

    • Re-retrieves Profiles if source:pull triggered the hook.
    • Ensures Object- and User-Permissions settings. Review .sfdx-jayree-example.json how the configuration should look like.
    • Shrinks Permission Sets to avoid merge conflicts in git.
    • Applies source fixes of the jayree:source:fix command and moves source files to separate package directories. See the configuration file .sfdx-jayree-example.json for examples. Use the following parameter in .sfdx-jayree.json to specify which tags should be applied by the hooks:
    {
      "applySourceFixes": ["source:retrieve:full", "source:retrieve:all"],
    }

    IMPORTANT: Since the hook is not able to update the (JSON) output of the command, an additional output is generated. Set the environment variable SFDX_ENABLE_JAYREE_HOOKS_JSON_OUTPUT=true and additional comma-separated JSON output will be appended, where the output must be parsed as an array, e.g. JSON.parse(`[${stdout}]`). See an example below:

    import * as execa from 'execa';
    import { cli } from 'cli-ux';
    
    async function run() {
        const { stdout } = await execa('sfdx', [
            'force:source:retrieve',
            '--metadata="Group:*"',
            '--json'
        ]);
        const parsedStdout = JSON.parse(`[${stdout}]`);
            let consolidatedStdout: {
              result: {
                pulledSource?: any[];
                inboundFiles?: any[];
                fixedFiles?: any[];
              };
            };
        if (parsedStdout.length > 1) {
            const pulledSourceOrinboundFiles =
                parsedStdout[0].result?.pulledSource !== undefined
                    ? 'pulledSource'
                    : 'inboundFiles';
            consolidatedStdout = {
                ...parsedStdout[0],
                result: {
                    ...parsedStdout[0].result,
                    [pulledSourceOrinboundFiles]: [],
                    fixedFiles: []
                }
            };
            parsedStdout.shift();
            parsedStdout.forEach((element) => {
                consolidatedStdout.result[
                    pulledSourceOrinboundFiles
                ] = consolidatedStdout.result[pulledSourceOrinboundFiles].concat(
                    element.result[pulledSourceOrinboundFiles]
                );
                consolidatedStdout.result.fixedFiles = consolidatedStdout.result.fixedFiles.concat(
                    element.result.fixedFiles
                );
            });
        } else {
            consolidatedStdout = parsedStdout[0];
        }
        cli.styledJSON(consolidatedStdout);
    }
    }
    
    run();