Skip to content

hardis:scratch:pool:reset

Description

Command Behavior

Resets the scratch org pool by deleting all existing scratch orgs within it.

This command provides a way to clear out the entire scratch org pool, effectively starting fresh. This can be useful for:

  • Troubleshooting: If the pool becomes corrupted or contains problematic scratch orgs.
  • Major Changes: When there are significant changes to the scratch org definition or initialization process that require all existing orgs to be recreated.
  • Cleanup: Periodically cleaning up the pool to ensure only the latest and most relevant scratch orgs are available.

Key functionalities:

  • Full Pool Deletion: Identifies all scratch orgs currently in the pool and initiates their deletion.
  • Dev Hub Integration: Works with your configured Dev Hub to manage the scratch orgs within the pool.
Technical explanations

The command's technical implementation involves:

  • Configuration Loading: It retrieves the poolConfig from the project's .sfdx-hardis.yml file to ensure a pool is configured.
  • Pool Storage Interaction: It uses listPoolOrgs to retrieve the current list of scratch orgs in the pool and removePoolOrgs to remove them from the storage. With the gitProvider storage, the encryption key of the pool is required.
  • Scratch Org Deletion: It iterates through each scratch org in the retrieved list. For each org, it authenticates to it using authenticateWithSfdxUrlStore and then executes sf org delete scratch via execCommand.
  • Logging: Provides clear messages about the deletion process and the status of each scratch org.

Agent Mode

Supports non-interactive execution with --agent:

sf hardis:scratch:pool:reset --agent

In agent mode, all interactive prompts are skipped and default values are used.

Parameters

Name Type Description Default Required Options
agent boolean Run in non-interactive mode for agents and automation
debug
-d
boolean Activate debug mode (more logs)
flags-dir option Import flag values from a directory.
json boolean Format output as json.
skipauth boolean Skip authentication check when a default username is required
target-dev-hub
-v
option Username or alias of the Dev Hub org. Not required if the target-dev-hub configuration variable is already set. true
websocket option Websocket host:port for VsCode SFDX Hardis UI integration

Examples

$ sf hardis:scratch:pool:reset
$ sf hardis:scratch:pool:reset --agent

Comments