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
poolConfigfrom the project's .sfdx-hardis.yml file to ensure a pool is configured. - Pool Storage Interaction: It uses
listPoolOrgsto retrieve the current list of scratch orgs in the pool andremovePoolOrgsto remove them from the storage. With thegitProviderstorage, 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
authenticateWithSfdxUrlStoreand then executessf org delete scratchviaexecCommand. - 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.
Screenshots
Every scratch org of the pool is deleted, so the next refresh fills the pool again from scratch
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
