sfdx-hardis 6.16.0 → 6.16.1-beta202512161830.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,13 +57,12 @@
57
57
  "world:hello"
58
58
  ]
59
59
  },
60
- "hardis:auth:login": {
60
+ "hardis:cache:clear": {
61
61
  "aliases": [],
62
62
  "args": {},
63
- "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
63
+ "description": "\n## Command Behavior\n\n**Clears the local cache generated by the sfdx-hardis plugin.**\n\nThis command is designed to remove temporary files, stored configurations, and other cached data that sfdx-hardis uses to optimize its operations. Clearing the cache can be beneficial for:\n\n- **Troubleshooting:** Resolving unexpected behavior or inconsistencies.\n- **Disk Space Management:** Freeing up storage on your local machine.\n- **Ensuring Fresh Data:** Guaranteeing that the plugin operates with the most current data and configurations.\n\n## Technical explanations\n\nThe command's technical implementation is straightforward:\n\n- **Direct Function Call:** It directly invokes the `clearCache()` function, which is imported from \buri../../../common/cache/index.js\buri.\n- **Cache Management Logic:** The \buriclearCache()` function encapsulates the logic for identifying and removing the specific files and directories that constitute the sfdx-hardis cache.\n",
64
64
  "examples": [
65
- "$ sf hardis:auth:login",
66
- "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
65
+ "$ sf hardis:cache:clear"
67
66
  ],
68
67
  "flags": {
69
68
  "json": {
@@ -81,28 +80,6 @@
81
80
  "multiple": false,
82
81
  "type": "option"
83
82
  },
84
- "instanceurl": {
85
- "char": "r",
86
- "description": "URL of org instance",
87
- "name": "instanceurl",
88
- "hasDynamicHelp": false,
89
- "multiple": false,
90
- "type": "option"
91
- },
92
- "devhub": {
93
- "char": "h",
94
- "description": "Also connect associated DevHub",
95
- "name": "devhub",
96
- "allowNo": false,
97
- "type": "boolean"
98
- },
99
- "scratchorg": {
100
- "char": "s",
101
- "description": "Scratch org",
102
- "name": "scratchorg",
103
- "allowNo": false,
104
- "type": "boolean"
105
- },
106
83
  "debug": {
107
84
  "char": "d",
108
85
  "description": "Activate debug mode (more logs)",
@@ -126,38 +103,41 @@
126
103
  },
127
104
  "hasDynamicHelp": false,
128
105
  "hiddenAliases": [],
129
- "id": "hardis:auth:login",
106
+ "id": "hardis:cache:clear",
130
107
  "pluginAlias": "sfdx-hardis",
131
108
  "pluginName": "sfdx-hardis",
132
109
  "pluginType": "core",
133
110
  "strict": true,
134
111
  "enableJsonFlag": true,
135
- "title": "Login",
112
+ "title": "Clear sfdx-hardis cache",
113
+ "uiConfig": {
114
+ "hide": true
115
+ },
136
116
  "requiresProject": false,
137
117
  "isESM": true,
138
118
  "relativePath": [
139
119
  "lib",
140
120
  "commands",
141
121
  "hardis",
142
- "auth",
143
- "login.js"
122
+ "cache",
123
+ "clear.js"
144
124
  ],
145
125
  "aliasPermutations": [],
146
126
  "permutations": [
147
- "hardis:auth:login",
148
- "auth:hardis:login",
149
- "auth:login:hardis",
150
- "hardis:login:auth",
151
- "login:hardis:auth",
152
- "login:auth:hardis"
127
+ "hardis:cache:clear",
128
+ "cache:hardis:clear",
129
+ "cache:clear:hardis",
130
+ "hardis:clear:cache",
131
+ "clear:hardis:cache",
132
+ "clear:cache:hardis"
153
133
  ]
154
134
  },
155
- "hardis:cache:clear": {
135
+ "hardis:config:get": {
156
136
  "aliases": [],
157
137
  "args": {},
158
- "description": "\n## Command Behavior\n\n**Clears the local cache generated by the sfdx-hardis plugin.**\n\nThis command is designed to remove temporary files, stored configurations, and other cached data that sfdx-hardis uses to optimize its operations. Clearing the cache can be beneficial for:\n\n- **Troubleshooting:** Resolving unexpected behavior or inconsistencies.\n- **Disk Space Management:** Freeing up storage on your local machine.\n- **Ensuring Fresh Data:** Guaranteeing that the plugin operates with the most current data and configurations.\n\n## Technical explanations\n\nThe command's technical implementation is straightforward:\n\n- **Direct Function Call:** It directly invokes the `clearCache()` function, which is imported from \buri../../../common/cache/index.js\buri.\n- **Cache Management Logic:** The \buriclearCache()` function encapsulates the logic for identifying and removing the specific files and directories that constitute the sfdx-hardis cache.\n",
138
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the sfdx-hardis configuration for a specified level.**\n\nThis command allows you to inspect the configuration that is currently in effect for your project, which is useful for debugging and understanding how sfdx-hardis will behave.\n\n- **Configuration levels:** It can retrieve configuration from three different levels:\n - **Project:** The configuration defined in the project's `.sfdx-hardis.yml` file.\n - **Branch:** The configuration defined in a branch-specific configuration file (e.g., `.sfdx-hardis.production.yml`).\n - **User:** The global user-level configuration.\n\n## Technical explanations\n\nThe command's logic is straightforward:\n\n- **`getConfig` function:** It calls the `getConfig` utility function, passing the desired configuration level as an argument.\n- **Configuration loading:** The `getConfig` function is responsible for finding the appropriate configuration file, reading its contents, and parsing it as YAML or JSON.\n- **Output:** The retrieved configuration is then displayed to the user as a JSON string.\n",
159
139
  "examples": [
160
- "$ sf hardis:cache:clear"
140
+ "$ sf hardis:project:deploy:sources:metadata"
161
141
  ],
162
142
  "flags": {
163
143
  "json": {
@@ -175,6 +155,20 @@
175
155
  "multiple": false,
176
156
  "type": "option"
177
157
  },
158
+ "level": {
159
+ "char": "l",
160
+ "description": "project,branch or user",
161
+ "name": "level",
162
+ "default": "project",
163
+ "hasDynamicHelp": false,
164
+ "multiple": false,
165
+ "options": [
166
+ "project",
167
+ "branch",
168
+ "user"
169
+ ],
170
+ "type": "option"
171
+ },
178
172
  "debug": {
179
173
  "char": "d",
180
174
  "description": "Activate debug mode (more logs)",
@@ -198,41 +192,39 @@
198
192
  },
199
193
  "hasDynamicHelp": false,
200
194
  "hiddenAliases": [],
201
- "id": "hardis:cache:clear",
195
+ "id": "hardis:config:get",
202
196
  "pluginAlias": "sfdx-hardis",
203
197
  "pluginName": "sfdx-hardis",
204
198
  "pluginType": "core",
205
199
  "strict": true,
206
200
  "enableJsonFlag": true,
207
- "title": "Clear sfdx-hardis cache",
208
- "uiConfig": {
209
- "hide": true
210
- },
201
+ "title": "Deploy metadata sources to org",
211
202
  "requiresProject": false,
212
203
  "isESM": true,
213
204
  "relativePath": [
214
205
  "lib",
215
206
  "commands",
216
207
  "hardis",
217
- "cache",
218
- "clear.js"
208
+ "config",
209
+ "get.js"
219
210
  ],
220
211
  "aliasPermutations": [],
221
212
  "permutations": [
222
- "hardis:cache:clear",
223
- "cache:hardis:clear",
224
- "cache:clear:hardis",
225
- "hardis:clear:cache",
226
- "clear:hardis:cache",
227
- "clear:cache:hardis"
213
+ "hardis:config:get",
214
+ "config:hardis:get",
215
+ "config:get:hardis",
216
+ "hardis:get:config",
217
+ "get:hardis:config",
218
+ "get:config:hardis"
228
219
  ]
229
220
  },
230
- "hardis:config:get": {
221
+ "hardis:auth:login": {
231
222
  "aliases": [],
232
223
  "args": {},
233
- "description": "\n## Command Behavior\n\n**Retrieves and displays the sfdx-hardis configuration for a specified level.**\n\nThis command allows you to inspect the configuration that is currently in effect for your project, which is useful for debugging and understanding how sfdx-hardis will behave.\n\n- **Configuration levels:** It can retrieve configuration from three different levels:\n - **Project:** The configuration defined in the project's `.sfdx-hardis.yml` file.\n - **Branch:** The configuration defined in a branch-specific configuration file (e.g., `.sfdx-hardis.production.yml`).\n - **User:** The global user-level configuration.\n\n## Technical explanations\n\nThe command's logic is straightforward:\n\n- **`getConfig` function:** It calls the `getConfig` utility function, passing the desired configuration level as an argument.\n- **Configuration loading:** The `getConfig` function is responsible for finding the appropriate configuration file, reading its contents, and parsing it as YAML or JSON.\n- **Output:** The retrieved configuration is then displayed to the user as a JSON string.\n",
224
+ "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
234
225
  "examples": [
235
- "$ sf hardis:project:deploy:sources:metadata"
226
+ "$ sf hardis:auth:login",
227
+ "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
236
228
  ],
237
229
  "flags": {
238
230
  "json": {
@@ -250,20 +242,28 @@
250
242
  "multiple": false,
251
243
  "type": "option"
252
244
  },
253
- "level": {
254
- "char": "l",
255
- "description": "project,branch or user",
256
- "name": "level",
257
- "default": "project",
245
+ "instanceurl": {
246
+ "char": "r",
247
+ "description": "URL of org instance",
248
+ "name": "instanceurl",
258
249
  "hasDynamicHelp": false,
259
250
  "multiple": false,
260
- "options": [
261
- "project",
262
- "branch",
263
- "user"
264
- ],
265
251
  "type": "option"
266
252
  },
253
+ "devhub": {
254
+ "char": "h",
255
+ "description": "Also connect associated DevHub",
256
+ "name": "devhub",
257
+ "allowNo": false,
258
+ "type": "boolean"
259
+ },
260
+ "scratchorg": {
261
+ "char": "s",
262
+ "description": "Scratch org",
263
+ "name": "scratchorg",
264
+ "allowNo": false,
265
+ "type": "boolean"
266
+ },
267
267
  "debug": {
268
268
  "char": "d",
269
269
  "description": "Activate debug mode (more logs)",
@@ -287,30 +287,30 @@
287
287
  },
288
288
  "hasDynamicHelp": false,
289
289
  "hiddenAliases": [],
290
- "id": "hardis:config:get",
290
+ "id": "hardis:auth:login",
291
291
  "pluginAlias": "sfdx-hardis",
292
292
  "pluginName": "sfdx-hardis",
293
293
  "pluginType": "core",
294
294
  "strict": true,
295
295
  "enableJsonFlag": true,
296
- "title": "Deploy metadata sources to org",
296
+ "title": "Login",
297
297
  "requiresProject": false,
298
298
  "isESM": true,
299
299
  "relativePath": [
300
300
  "lib",
301
301
  "commands",
302
302
  "hardis",
303
- "config",
304
- "get.js"
303
+ "auth",
304
+ "login.js"
305
305
  ],
306
306
  "aliasPermutations": [],
307
307
  "permutations": [
308
- "hardis:config:get",
309
- "config:hardis:get",
310
- "config:get:hardis",
311
- "hardis:get:config",
312
- "get:hardis:config",
313
- "get:config:hardis"
308
+ "hardis:auth:login",
309
+ "auth:hardis:login",
310
+ "auth:login:hardis",
311
+ "hardis:login:auth",
312
+ "login:hardis:auth",
313
+ "login:auth:hardis"
314
314
  ]
315
315
  },
316
316
  "hardis:doc:fieldusage": {
@@ -3035,12 +3035,12 @@
3035
3035
  "lint:project:hardis"
3036
3036
  ]
3037
3037
  },
3038
- "hardis:source:deploy": {
3038
+ "hardis:scratch:create": {
3039
3039
  "aliases": [],
3040
3040
  "args": {},
3041
- "description": "sfdx-hardis wrapper for sfdx force:source:deploy that displays tips to solve deployment errors.\n\nAdditional to the base command wrapper: If using **--checkonly**, add options **--checkcoverage** and **--coverageformatters json-summary** to check that org coverage is > 75% (or value defined in .sfdx-hardis.yml property **apexTestsMinCoverageOrgWide**)\n\n### Deployment results\n\nYou can also have deployment results as pull request comments, on:\n\n- GitHub (see [GitHub Pull Requests comments config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-github/))\n- Gitlab (see [Gitlab integration configuration](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-gitlab/))\n- Azure DevOps (see [Azure integration configuration](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-azure/))\n\n\n[![Assisted solving of Salesforce deployments errors](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deployment-errors.jpg)](https://nicolas.vuillamy.fr/assisted-solving-of-salesforce-deployments-errors-47f3666a9ed0)\n\n### Deployment pre or post commands\n\nYou can define command lines to run before or after a deployment, with parameters:\n\n- **id**: Unique Id for the command\n- **label**: Human readable label for the command\n- **skipIfError**: If defined to \"true\", the post-command won't be run if there is a deployment failure\n- **context**: Defines the context where the command will be run. Can be **all** (default), **check-deployment-only** or **process-deployment-only**\n- **runOnlyOnceByOrg**: If set to true, the command will be run only one time per org. A record of SfdxHardisTrace__c is stored to make that possible (it needs to be existing in target org)\n\nIf the commands are not the same depending on the target org, you can define them into **config/branches/.sfdx-hardis-BRANCHNAME.yml** instead of root **config/.sfdx-hardis.yml**\n\nExample:\n\n```yaml\ncommandsPreDeploy:\n - id: knowledgeUnassign\n label: Remove KnowledgeUser right to the user who has it\n command: sf data update record --sobject User --where \"UserPermissionsKnowledgeUser='true'\" --values \"UserPermissionsKnowledgeUser='false'\" --json\n - id: knowledgeAssign\n label: Assign Knowledge user to the deployment user\n command: sf data update record --sobject User --where \"Username='deploy.github@myclient.com'\" --values \"UserPermissionsKnowledgeUser='true'\" --json\n\ncommandsPostDeploy:\n - id: knowledgeUnassign\n label: Remove KnowledgeUser right to the user who has it\n command: sf data update record --sobject User --where \"UserPermissionsKnowledgeUser='true'\" --values \"UserPermissionsKnowledgeUser='false'\" --json\n - id: knowledgeAssign\n label: Assign Knowledge user to desired username\n command: sf data update record --sobject User --where \"Username='admin-yser@myclient.com'\" --values \"UserPermissionsKnowledgeUser='true'\" --json\n - id: someActionToRunJustOneTime\n label: And to run only if deployment is success\n command: sf sfdmu:run ...\n skipIfError: true\n context: process-deployment-only\n runOnlyOnceByOrg: true\n```\n\nNotes:\n\n- You can disable coloring of errors in red by defining env variable SFDX_HARDIS_DEPLOY_ERR_COLORS=false\n\n[See documentation of Salesforce command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_deploy)\n",
3041
+ "description": "\n## Command Behavior\n\n**Creates and fully initializes a Salesforce scratch org with complete development environment setup.**\n\nThis command is a comprehensive scratch org provisioning tool that automates the entire process of creating, configuring, and initializing a Salesforce scratch org for development work. It handles everything from basic org creation to advanced configuration including package installation, metadata deployment, and data initialization.\n\nKey functionalities:\n\n- **Intelligent Org Management:** Automatically generates unique scratch org aliases based on username, git branch, and timestamp, with options to reuse existing orgs or force creation of new ones.\n- **Scratch Org Pool Integration:** Supports fetching pre-configured scratch orgs from pools for faster development cycles and CI/CD optimization.\n- **Custom Scratch Definition:** Dynamically builds project-scratch-def.json files with user-specific configurations including email, username patterns, and org shape settings (set variable **SCRATCH_ORG_SHAPE** to use org shapes).\n- **Package Installation:** Automatically installs all configured packages defined in `installedPackages` configuration property.\n- **Metadata Deployment:** Pushes source code and deploys metadata using optimized deployment strategies for scratch org environments.\n- **Permission Set Assignment:** Assigns specified permission sets defined in `initPermissionSets` configuration to the scratch org user.\n- **Apex Script Execution:** Runs custom Apex initialization scripts defined in `scratchOrgInitApexScripts` for org-specific setup.\n- **Data Loading:** Loads initial data using SFDMU data packages from `dataPackages` configuration for realistic development environments.\n- **User Configuration:** Automatically configures the scratch org admin user with proper names, email, country settings, and marketing user permissions.\n- **Password Generation:** Creates and stores secure passwords for easy scratch org access during development.\n- **CI/CD Integration:** Provides specialized handling for continuous integration environments including automated cleanup and pool management.\n- **Error Handling:** Comprehensive error recovery including scratch org cleanup on failure and detailed troubleshooting messages.\n\nThe command configuration can be customized using:\n\n- `config/.sfdx-hardis.yml` file with properties like `installedPackages`, `initPermissionSets`, `scratchOrgInitApexScripts`, and `dataPackages`.\n- Environment variable **SCRATCH_ORG_SHAPE** with shape org id, if you want to use org shapes\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Configuration Management:** Loads hierarchical configuration from `.sfdx-hardis.yml`, branch-specific, and user-specific configuration files using `getConfig('user')`.\n- **Alias Generation Logic:** Creates intelligent scratch org aliases using username, git branch, timestamp patterns with CI and pool prefixes for different environments.\n- **Scratch Org Definition Building:** Dynamically constructs `project-scratch-def.json` with user email, custom usernames, org shapes, and feature flags like StateAndCountryPicklist and MarketingUser.\n- **Pool Integration:** Implements scratch org pool fetching using `fetchScratchOrg` for rapid org provisioning in development and CI environments.\n- **Salesforce CLI Integration:** Executes `sf org create scratch` commands with proper parameter handling including wait times, duration, and dev hub targeting.\n- **Package Installation Pipeline:** Uses `installPackages` utility to install managed and unmanaged packages with dependency resolution and error handling.\n- **Metadata Deployment:** Leverages `initOrgMetadatas` for optimized source pushing and metadata deployment specific to scratch org environments.\n- **Permission Set Assignment:** Implements `initPermissionSetAssignments` for automated permission set assignment to scratch org users.\n- **Apex Script Execution:** Runs custom Apex initialization scripts using `initApexScripts` for org-specific configuration and setup.\n- **Data Loading Integration:** Uses SFDMU integration through `initOrgData` for comprehensive data loading from configured data packages.\n- **User Management:** Performs SOQL queries and DML operations to configure scratch org users with proper names, emails, country codes, and permission flags.\n- **Authentication Management:** Handles SFDX auth URL generation and storage for CI/CD environments and scratch org pool management.\n- **Error Recovery:** Implements comprehensive error handling with scratch org cleanup, pool management, and detailed error messaging for troubleshooting.\n- **WebSocket Integration:** Provides real-time status updates and file reporting through WebSocket connections for VS Code extension integration.\n</details>\n",
3042
3042
  "examples": [
3043
- "$ sf hardis:source:deploy -x manifest/package.xml --wait 60 --ignorewarnings --testlevel RunLocalTests --postdestructivechanges ./manifest/destructiveChanges.xml --target-org nicolas.vuillamy@cloudity.com.sfdxhardis --checkonly --checkcoverage --verbose --coverageformatters json-summary"
3043
+ "$ sf hardis:scratch:create"
3044
3044
  ],
3045
3045
  "flags": {
3046
3046
  "json": {
@@ -3058,216 +3058,138 @@
3058
3058
  "multiple": false,
3059
3059
  "type": "option"
3060
3060
  },
3061
- "checkonly": {
3062
- "char": "c",
3063
- "description": "checkonly",
3064
- "name": "checkonly",
3065
- "allowNo": false,
3066
- "type": "boolean"
3067
- },
3068
- "soapdeploy": {
3069
- "description": "soapDeploy",
3070
- "name": "soapdeploy",
3061
+ "forcenew": {
3062
+ "char": "n",
3063
+ "description": "If an existing scratch org exists, do not reuse it but create a new one",
3064
+ "name": "forcenew",
3071
3065
  "allowNo": false,
3072
3066
  "type": "boolean"
3073
3067
  },
3074
- "wait": {
3075
- "char": "w",
3076
- "description": "wait",
3077
- "name": "wait",
3078
- "default": 60,
3079
- "hasDynamicHelp": false,
3080
- "multiple": false,
3081
- "type": "option"
3082
- },
3083
- "testlevel": {
3084
- "char": "l",
3085
- "description": "testlevel",
3086
- "name": "testlevel",
3087
- "default": "NoTestRun",
3088
- "hasDynamicHelp": false,
3089
- "multiple": false,
3090
- "options": [
3091
- "NoTestRun",
3092
- "RunSpecifiedTests",
3093
- "RunLocalTests",
3094
- "RunAllTestsInOrg"
3095
- ],
3096
- "type": "option"
3097
- },
3098
- "runtests": {
3099
- "char": "r",
3100
- "description": "runTests",
3101
- "name": "runtests",
3102
- "default": [],
3103
- "hasDynamicHelp": false,
3104
- "multiple": true,
3105
- "type": "option"
3106
- },
3107
- "ignoreerrors": {
3108
- "description": "ignoreErrors",
3109
- "name": "ignoreerrors",
3068
+ "pool": {
3069
+ "description": "Creates the scratch org for a scratch org pool",
3070
+ "name": "pool",
3110
3071
  "allowNo": false,
3111
3072
  "type": "boolean"
3112
3073
  },
3113
- "ignorewarnings": {
3114
- "char": "g",
3115
- "description": "ignoreWarnings",
3116
- "name": "ignorewarnings",
3074
+ "debug": {
3075
+ "char": "d",
3076
+ "description": "Activate debug mode (more logs)",
3077
+ "name": "debug",
3117
3078
  "allowNo": false,
3118
3079
  "type": "boolean"
3119
3080
  },
3120
- "validateddeployrequestid": {
3121
- "char": "q",
3122
- "description": "validateDeployRequestId",
3123
- "exclusive": [
3124
- "manifest",
3125
- "metadata",
3126
- "sourcepath",
3127
- "checkonly",
3128
- "testlevel",
3129
- "runtests",
3130
- "ignoreerrors",
3131
- "ignorewarnings"
3132
- ],
3133
- "name": "validateddeployrequestid",
3081
+ "websocket": {
3082
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3083
+ "name": "websocket",
3134
3084
  "hasDynamicHelp": false,
3135
3085
  "multiple": false,
3136
3086
  "type": "option"
3137
3087
  },
3138
- "verbose": {
3139
- "description": "verbose",
3140
- "name": "verbose",
3088
+ "skipauth": {
3089
+ "description": "Skip authentication check when a default username is required",
3090
+ "name": "skipauth",
3141
3091
  "allowNo": false,
3142
3092
  "type": "boolean"
3143
3093
  },
3144
- "metadata": {
3145
- "char": "m",
3146
- "description": "metadata",
3147
- "exclusive": [
3148
- "manifest",
3149
- "sourcepath"
3094
+ "target-dev-hub": {
3095
+ "aliases": [
3096
+ "targetdevhubusername"
3150
3097
  ],
3151
- "name": "metadata",
3152
- "hasDynamicHelp": false,
3153
- "multiple": true,
3154
- "type": "option"
3155
- },
3156
- "sourcepath": {
3157
- "char": "p",
3158
- "description": "sourcePath",
3159
- "exclusive": [
3160
- "manifest",
3161
- "metadata"
3162
- ],
3163
- "name": "sourcepath",
3164
- "hasDynamicHelp": false,
3165
- "multiple": true,
3166
- "type": "option"
3167
- },
3168
- "manifest": {
3169
- "char": "x",
3170
- "description": "flagsLong.manifest",
3171
- "exclusive": [
3172
- "metadata",
3173
- "sourcepath"
3174
- ],
3175
- "name": "manifest",
3176
- "hasDynamicHelp": false,
3177
- "multiple": false,
3178
- "type": "option"
3179
- },
3180
- "predestructivechanges": {
3181
- "dependsOn": [
3182
- "manifest"
3183
- ],
3184
- "description": "predestructivechanges",
3185
- "name": "predestructivechanges",
3186
- "hasDynamicHelp": false,
3187
- "multiple": false,
3188
- "type": "option"
3189
- },
3190
- "postdestructivechanges": {
3191
- "dependsOn": [
3192
- "manifest"
3193
- ],
3194
- "description": "postdestructivechanges",
3195
- "name": "postdestructivechanges",
3196
- "hasDynamicHelp": false,
3098
+ "char": "v",
3099
+ "deprecateAliases": true,
3100
+ "name": "target-dev-hub",
3101
+ "noCacheDefault": true,
3102
+ "required": true,
3103
+ "summary": "Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set.",
3104
+ "hasDynamicHelp": true,
3197
3105
  "multiple": false,
3198
3106
  "type": "option"
3199
- },
3200
- "tracksource": {
3201
- "char": "t",
3202
- "description": "tracksource",
3203
- "exclusive": [
3204
- "checkonly",
3205
- "validateddeployrequestid"
3206
- ],
3207
- "name": "tracksource",
3208
- "allowNo": false,
3209
- "type": "boolean"
3210
- },
3211
- "forceoverwrite": {
3212
- "char": "f",
3213
- "dependsOn": [
3214
- "tracksource"
3215
- ],
3216
- "description": "forceoverwrite",
3217
- "name": "forceoverwrite",
3107
+ }
3108
+ },
3109
+ "hasDynamicHelp": true,
3110
+ "hiddenAliases": [],
3111
+ "id": "hardis:scratch:create",
3112
+ "pluginAlias": "sfdx-hardis",
3113
+ "pluginName": "sfdx-hardis",
3114
+ "pluginType": "core",
3115
+ "strict": true,
3116
+ "enableJsonFlag": true,
3117
+ "title": "Create and initialize scratch org",
3118
+ "requiresProject": true,
3119
+ "requiresSfdxPlugins": [
3120
+ "sfdmu"
3121
+ ],
3122
+ "isESM": true,
3123
+ "relativePath": [
3124
+ "lib",
3125
+ "commands",
3126
+ "hardis",
3127
+ "scratch",
3128
+ "create.js"
3129
+ ],
3130
+ "aliasPermutations": [],
3131
+ "permutations": [
3132
+ "hardis:scratch:create",
3133
+ "scratch:hardis:create",
3134
+ "scratch:create:hardis",
3135
+ "hardis:create:scratch",
3136
+ "create:hardis:scratch",
3137
+ "create:scratch:hardis"
3138
+ ]
3139
+ },
3140
+ "hardis:scratch:delete": {
3141
+ "aliases": [],
3142
+ "args": {},
3143
+ "description": "## Command Behavior\n\n**Provides an assisted menu to delete Salesforce scratch orgs associated with a Dev Hub.**\n\nThis command simplifies the process of cleaning up your Salesforce development environments by allowing you to easily select and delete multiple scratch orgs. This is crucial for managing your scratch org limits and ensuring that you don't accumulate unnecessary or expired orgs.\n\nKey functionalities:\n\n- **Interactive Scratch Org Selection:** Displays a list of all active scratch orgs linked to your Dev Hub, including their usernames, instance URLs, and last used dates.\n- **Multi-Selection:** Allows you to select multiple scratch orgs for deletion.\n- **Confirmation Prompt:** Prompts for confirmation before proceeding with the deletion, ensuring that you don't accidentally delete important orgs.\n- **Dev Hub Integration:** Works with your configured Dev Hub to manage scratch orgs.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce CLI Integration:** It executes the `sf org list` command to retrieve a list of all scratch orgs associated with the current Dev Hub. It then filters this list to show only active orgs.\n- **Interactive Prompts:** Uses the `prompts` library to present a multi-select menu of scratch orgs to the user.\n- **Scratch Org Deletion:** For each selected scratch org, it executes the `sf org delete scratch --no-prompt` command to perform the deletion.\n- **Error Handling:** Includes basic error handling for Salesforce CLI commands.\n- **Data Sorting:** Sorts the list of scratch orgs by username, alias, and instance URL for better readability in the interactive menu.\n</details>\n",
3144
+ "examples": [
3145
+ "$ sf hardis:scratch:delete"
3146
+ ],
3147
+ "flags": {
3148
+ "json": {
3149
+ "description": "Format output as json.",
3150
+ "helpGroup": "GLOBAL",
3151
+ "name": "json",
3218
3152
  "allowNo": false,
3219
3153
  "type": "boolean"
3220
3154
  },
3221
- "resultsdir": {
3222
- "description": "resultsdir",
3223
- "name": "resultsdir",
3155
+ "flags-dir": {
3156
+ "helpGroup": "GLOBAL",
3157
+ "name": "flags-dir",
3158
+ "summary": "Import flag values from a directory.",
3224
3159
  "hasDynamicHelp": false,
3225
3160
  "multiple": false,
3226
3161
  "type": "option"
3227
3162
  },
3228
- "coverageformatters": {
3229
- "description": "coverageformatters",
3230
- "name": "coverageformatters",
3231
- "hasDynamicHelp": false,
3232
- "multiple": true,
3233
- "type": "option"
3234
- },
3235
- "junit": {
3236
- "description": "junit",
3237
- "name": "junit",
3238
- "allowNo": false,
3239
- "type": "boolean"
3240
- },
3241
- "checkcoverage": {
3242
- "description": "Check Apex org coverage",
3243
- "name": "checkcoverage",
3244
- "allowNo": false,
3245
- "type": "boolean"
3246
- },
3247
3163
  "debug": {
3248
- "description": "debug",
3164
+ "char": "d",
3165
+ "description": "Activate debug mode (more logs)",
3249
3166
  "name": "debug",
3250
3167
  "allowNo": false,
3251
3168
  "type": "boolean"
3252
3169
  },
3253
3170
  "websocket": {
3254
- "description": "websocket",
3171
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3255
3172
  "name": "websocket",
3256
3173
  "hasDynamicHelp": false,
3257
3174
  "multiple": false,
3258
3175
  "type": "option"
3259
3176
  },
3260
- "target-org": {
3177
+ "skipauth": {
3178
+ "description": "Skip authentication check when a default username is required",
3179
+ "name": "skipauth",
3180
+ "allowNo": false,
3181
+ "type": "boolean"
3182
+ },
3183
+ "target-dev-hub": {
3261
3184
  "aliases": [
3262
- "targetusername",
3263
- "u"
3185
+ "targetdevhubusername"
3264
3186
  ],
3265
- "char": "o",
3187
+ "char": "v",
3266
3188
  "deprecateAliases": true,
3267
- "name": "target-org",
3189
+ "name": "target-dev-hub",
3268
3190
  "noCacheDefault": true,
3269
3191
  "required": true,
3270
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
3192
+ "summary": "Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set.",
3271
3193
  "hasDynamicHelp": true,
3272
3194
  "multiple": false,
3273
3195
  "type": "option"
@@ -3275,35 +3197,38 @@
3275
3197
  },
3276
3198
  "hasDynamicHelp": true,
3277
3199
  "hiddenAliases": [],
3278
- "id": "hardis:source:deploy",
3200
+ "id": "hardis:scratch:delete",
3279
3201
  "pluginAlias": "sfdx-hardis",
3280
3202
  "pluginName": "sfdx-hardis",
3281
3203
  "pluginType": "core",
3282
3204
  "strict": true,
3283
3205
  "enableJsonFlag": true,
3284
- "requiresProject": true,
3206
+ "title": "Delete scratch orgs(s)",
3285
3207
  "isESM": true,
3286
3208
  "relativePath": [
3287
3209
  "lib",
3288
3210
  "commands",
3289
3211
  "hardis",
3290
- "source",
3291
- "deploy.js"
3212
+ "scratch",
3213
+ "delete.js"
3292
3214
  ],
3293
3215
  "aliasPermutations": [],
3294
3216
  "permutations": [
3295
- "hardis:source:deploy",
3296
- "source:hardis:deploy",
3297
- "source:deploy:hardis",
3298
- "hardis:deploy:source",
3299
- "deploy:hardis:source",
3300
- "deploy:source:hardis"
3217
+ "hardis:scratch:delete",
3218
+ "scratch:hardis:delete",
3219
+ "scratch:delete:hardis",
3220
+ "hardis:delete:scratch",
3221
+ "delete:hardis:scratch",
3222
+ "delete:scratch:hardis"
3301
3223
  ]
3302
3224
  },
3303
- "hardis:source:push": {
3225
+ "hardis:scratch:pull": {
3304
3226
  "aliases": [],
3305
3227
  "args": {},
3306
- "description": "sfdx-hardis wrapper for sfdx force:source:push that displays tips to solve deployment errors.\n\n[![Assisted solving of Salesforce deployments errors](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deployment-errors.jpg)](https://nicolas.vuillamy.fr/assisted-solving-of-salesforce-deployments-errors-47f3666a9ed0)\n\n[See documentation of Salesforce command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_push)\n",
3228
+ "description": "\n## Command Behavior\n\n**Pulls metadata changes from your scratch org or source-tracked sandbox into your local project files.**\n\nThis command is essential for synchronizing your local development environment with the changes you've made directly in your Salesforce org. After pulling, you can then stage and commit the relevant files to your version control system.\n\nKey features and considerations:\n\n- **Underlying Command:** Internally, this command executes `sf project retrieve start` to fetch the metadata.\n- **Error Handling:** If the pull operation encounters errors, it offers to automatically add the problematic items to your `.forceignore` file and then attempts to pull again, helping you resolve conflicts and ignore unwanted metadata.\n- **Missing Updates:** If you don't see certain updated items in the pull results, you might need to manually retrieve them using the Salesforce Extension's **Org Browser** or the **Salesforce CLI** directly. Refer to the [Retrieve Metadatas documentation](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-publish-task/#retrieve-metadatas) for more details.\n- **Automatic Retrieval:** You can configure the `autoRetrieveWhenPull` property in your `.sfdx-hardis.yml` file to always retrieve specific metadata types (e.g., `CustomApplication`) that might not always be detected as updates by `project:retrieve:start`.\n\nExample `.sfdx-hardis.yml` configuration for `autoRetrieveWhenPull`:\n```yaml\nautoRetrieveWhenPull:\n - CustomApplication:MyCustomApplication\n - CustomApplication:MyOtherCustomApplication\n - CustomApplication:MyThirdCustomApp\n```\n\nFor a visual explanation of the process, watch this video:\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Ik6whtflmfY\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation focuses on robust metadata synchronization:\n\n- **Salesforce CLI Wrapper:** It acts as a wrapper around the standard Salesforce CLI `sf project retrieve start` command, providing enhanced error handling and configuration options.\n- **Force Source Pull Utility:** The core logic resides in the `forceSourcePull` utility function, which orchestrates the retrieval process, including handling `.forceignore` updates.\n- **Configuration Integration:** It reads the `autoRetrieveWhenPull` setting from the project's `.sfdx-hardis.yml` to determine additional metadata to retrieve automatically.\n- **User Feedback:** Provides clear messages to the user regarding the pull status and guidance for troubleshooting.\n</details>\n",
3229
+ "examples": [
3230
+ "$ sf hardis:scratch:pull"
3231
+ ],
3307
3232
  "flags": {
3308
3233
  "json": {
3309
3234
  "description": "Format output as json.",
@@ -3320,48 +3245,26 @@
3320
3245
  "multiple": false,
3321
3246
  "type": "option"
3322
3247
  },
3323
- "forceoverwrite": {
3324
- "char": "f",
3325
- "description": "forceoverwrite",
3326
- "name": "forceoverwrite",
3327
- "allowNo": false,
3328
- "type": "boolean"
3329
- },
3330
- "wait": {
3331
- "char": "w",
3332
- "description": "wait",
3333
- "name": "wait",
3334
- "default": 60,
3335
- "hasDynamicHelp": false,
3336
- "multiple": false,
3337
- "type": "option"
3338
- },
3339
- "ignorewarnings": {
3340
- "char": "g",
3341
- "description": "ignorewarnings",
3342
- "name": "ignorewarnings",
3343
- "allowNo": false,
3344
- "type": "boolean"
3345
- },
3346
- "quiet": {
3347
- "description": "quiet",
3348
- "name": "quiet",
3349
- "allowNo": false,
3350
- "type": "boolean"
3351
- },
3352
3248
  "debug": {
3353
- "description": "debug",
3249
+ "char": "d",
3250
+ "description": "Activate debug mode (more logs)",
3354
3251
  "name": "debug",
3355
3252
  "allowNo": false,
3356
3253
  "type": "boolean"
3357
3254
  },
3358
3255
  "websocket": {
3359
- "description": "websocket",
3256
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3360
3257
  "name": "websocket",
3361
3258
  "hasDynamicHelp": false,
3362
3259
  "multiple": false,
3363
3260
  "type": "option"
3364
3261
  },
3262
+ "skipauth": {
3263
+ "description": "Skip authentication check when a default username is required",
3264
+ "name": "skipauth",
3265
+ "allowNo": false,
3266
+ "type": "boolean"
3267
+ },
3365
3268
  "target-org": {
3366
3269
  "aliases": [
3367
3270
  "targetusername",
@@ -3380,36 +3283,39 @@
3380
3283
  },
3381
3284
  "hasDynamicHelp": true,
3382
3285
  "hiddenAliases": [],
3383
- "id": "hardis:source:push",
3286
+ "id": "hardis:scratch:pull",
3384
3287
  "pluginAlias": "sfdx-hardis",
3385
3288
  "pluginName": "sfdx-hardis",
3386
3289
  "pluginType": "core",
3387
3290
  "strict": true,
3388
3291
  "enableJsonFlag": true,
3292
+ "title": "Scratch PULL",
3389
3293
  "requiresProject": true,
3390
3294
  "isESM": true,
3391
3295
  "relativePath": [
3392
3296
  "lib",
3393
3297
  "commands",
3394
3298
  "hardis",
3395
- "source",
3396
- "push.js"
3299
+ "scratch",
3300
+ "pull.js"
3397
3301
  ],
3398
3302
  "aliasPermutations": [],
3399
3303
  "permutations": [
3400
- "hardis:source:push",
3401
- "source:hardis:push",
3402
- "source:push:hardis",
3403
- "hardis:push:source",
3404
- "push:hardis:source",
3405
- "push:source:hardis"
3304
+ "hardis:scratch:pull",
3305
+ "scratch:hardis:pull",
3306
+ "scratch:pull:hardis",
3307
+ "hardis:pull:scratch",
3308
+ "pull:hardis:scratch",
3309
+ "pull:scratch:hardis"
3406
3310
  ]
3407
3311
  },
3408
- "hardis:source:retrieve": {
3312
+ "hardis:scratch:push": {
3409
3313
  "aliases": [],
3410
3314
  "args": {},
3411
- "description": "\n## Command Behavior\n\n**A wrapper command for Salesforce CLI's `sf project retrieve start` (formerly `sfdx force:source:retrieve`), with enhanced interactive features.**\n\nThis command facilitates the retrieval of metadata from a Salesforce org into your local project. It provides an assisted experience, especially when no specific retrieval constraints are provided.\n\nKey features:\n\n- **Assisted Metadata Selection:** If no `sourcepath`, `manifest`, `metadata`, or `packagenames` flags are specified, an interactive menu will prompt you to select the metadata types you wish to retrieve.\n- **Assisted Org Selection:** If no target org is specified, an interactive menu will guide you to choose an org for the retrieval operation.\n- **Backward Compatibility:** While this command wraps the newer `sf project retrieve start`, it maintains compatibility with the older `sfdx force:source:retrieve` flags.\n\n**Important Note:** The underlying Salesforce CLI command `sfdx force:source:retrieve` is being deprecated by Salesforce in November 2024. It is recommended to migrate to `sf project retrieve start` for future compatibility. See [Salesforce CLI Migration Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_mig_deploy_retrieve.htm) for more information.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThis command acts as an intelligent wrapper around the Salesforce CLI's source retrieval functionality:\n\n- **Command Wrapping:** It uses the `wrapSfdxCoreCommand` utility to execute the `sfdx force:source:retrieve` (or its equivalent `sf project retrieve start`) command, passing through all relevant flags and arguments.\n- **Interactive Prompts:** It leverages `MetadataUtils.promptMetadataTypes()` and `promptOrgUsernameDefault()` to provide interactive menus for metadata and org selection when the user does not provide them as flags.\n- **Argument Transformation:** It dynamically constructs the command-line arguments for the underlying Salesforce CLI command based on user selections and provided flags.\n- **Error Handling:** It includes basic error handling, such as prompting the user to re-select an org if an issue occurs during org selection.\n- **Deprecation Warning:** It explicitly logs warnings about the deprecation of `sfdx force:source:retrieve` to inform users about upcoming changes.\n</details>\n",
3412
- "examples": [],
3315
+ "description": "## Command Behavior\n\n**Pushes local Salesforce DX source files to a scratch org or source-tracked sandbox.**\n\nThis command is a fundamental operation in Salesforce DX development, allowing developers to synchronize their local codebase with their development org. It ensures that changes made locally are reflected in the scratch org, enabling testing and validation.\n\nKey functionalities:\n\n- **Source Synchronization:** Deploys all local changes (metadata and code) to the target scratch org.\n- **Underlying Command:** Internally, this command executes `sf project deploy start` to perform the push operation.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce CLI Wrapper:** It acts as a wrapper around the standard Salesforce CLI `sf project deploy start` command.\n- **`forceSourcePush` Utility:** The core logic resides in the `forceSourcePush` utility function, which orchestrates the deployment process.\n- **Connection Handling:** It uses the connection to the target org to perform the push operation.\n</details>\n",
3316
+ "examples": [
3317
+ "$ sf hardis:scratch:push"
3318
+ ],
3413
3319
  "flags": {
3414
3320
  "json": {
3415
3321
  "description": "Format output as json.",
@@ -3426,98 +3332,15 @@
3426
3332
  "multiple": false,
3427
3333
  "type": "option"
3428
3334
  },
3429
- "apiversion": {
3430
- "char": "a",
3431
- "description": "Override the api version used for api requests made by this command",
3432
- "name": "apiversion",
3433
- "hasDynamicHelp": false,
3434
- "multiple": false,
3435
- "type": "option"
3436
- },
3437
- "sourcepath": {
3438
- "char": "p",
3439
- "description": "sourcePath",
3440
- "exclusive": [
3441
- "manifest",
3442
- "metadata"
3443
- ],
3444
- "name": "sourcepath",
3445
- "hasDynamicHelp": false,
3446
- "multiple": true,
3447
- "type": "option"
3448
- },
3449
- "wait": {
3450
- "char": "w",
3451
- "description": "wait",
3452
- "name": "wait",
3453
- "hasDynamicHelp": false,
3454
- "multiple": false,
3455
- "type": "option"
3456
- },
3457
- "manifest": {
3458
- "char": "x",
3459
- "description": "manifest",
3460
- "exclusive": [
3461
- "metadata",
3462
- "sourcepath"
3463
- ],
3464
- "name": "manifest",
3465
- "hasDynamicHelp": false,
3466
- "multiple": false,
3467
- "type": "option"
3468
- },
3469
- "metadata": {
3470
- "char": "m",
3471
- "description": "metadata",
3472
- "exclusive": [
3473
- "manifest",
3474
- "sourcepath"
3475
- ],
3476
- "name": "metadata",
3477
- "hasDynamicHelp": false,
3478
- "multiple": true,
3479
- "type": "option"
3480
- },
3481
- "packagenames": {
3482
- "char": "n",
3483
- "description": "packagenames",
3484
- "name": "packagenames",
3485
- "hasDynamicHelp": false,
3486
- "multiple": true,
3487
- "type": "option"
3488
- },
3489
- "tracksource": {
3490
- "char": "t",
3491
- "description": "tracksource",
3492
- "name": "tracksource",
3493
- "allowNo": false,
3494
- "type": "boolean"
3495
- },
3496
- "forceoverwrite": {
3497
- "char": "f",
3498
- "dependsOn": [
3499
- "tracksource"
3500
- ],
3501
- "description": "forceoverwrite",
3502
- "name": "forceoverwrite",
3503
- "allowNo": false,
3504
- "type": "boolean"
3505
- },
3506
- "verbose": {
3507
- "description": "verbose",
3508
- "name": "verbose",
3509
- "allowNo": false,
3510
- "type": "boolean"
3511
- },
3512
3335
  "debug": {
3513
3336
  "char": "d",
3514
- "description": "debugMode",
3337
+ "description": "Activate debug mode (more logs)",
3515
3338
  "name": "debug",
3516
3339
  "allowNo": false,
3517
3340
  "type": "boolean"
3518
3341
  },
3519
3342
  "websocket": {
3520
- "description": "websocket",
3343
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3521
3344
  "name": "websocket",
3522
3345
  "hasDynamicHelp": false,
3523
3346
  "multiple": false,
@@ -3547,37 +3370,38 @@
3547
3370
  },
3548
3371
  "hasDynamicHelp": true,
3549
3372
  "hiddenAliases": [],
3550
- "id": "hardis:source:retrieve",
3373
+ "id": "hardis:scratch:push",
3551
3374
  "pluginAlias": "sfdx-hardis",
3552
3375
  "pluginName": "sfdx-hardis",
3553
3376
  "pluginType": "core",
3554
3377
  "strict": true,
3555
3378
  "enableJsonFlag": true,
3379
+ "title": "Scratch PUSH",
3556
3380
  "requiresProject": true,
3557
3381
  "isESM": true,
3558
3382
  "relativePath": [
3559
3383
  "lib",
3560
3384
  "commands",
3561
3385
  "hardis",
3562
- "source",
3563
- "retrieve.js"
3386
+ "scratch",
3387
+ "push.js"
3564
3388
  ],
3565
3389
  "aliasPermutations": [],
3566
3390
  "permutations": [
3567
- "hardis:source:retrieve",
3568
- "source:hardis:retrieve",
3569
- "source:retrieve:hardis",
3570
- "hardis:retrieve:source",
3571
- "retrieve:hardis:source",
3572
- "retrieve:source:hardis"
3391
+ "hardis:scratch:push",
3392
+ "scratch:hardis:push",
3393
+ "scratch:push:hardis",
3394
+ "hardis:push:scratch",
3395
+ "push:hardis:scratch",
3396
+ "push:scratch:hardis"
3573
3397
  ]
3574
3398
  },
3575
- "hardis:scratch:create": {
3399
+ "hardis:source:deploy": {
3576
3400
  "aliases": [],
3577
3401
  "args": {},
3578
- "description": "\n## Command Behavior\n\n**Creates and fully initializes a Salesforce scratch org with complete development environment setup.**\n\nThis command is a comprehensive scratch org provisioning tool that automates the entire process of creating, configuring, and initializing a Salesforce scratch org for development work. It handles everything from basic org creation to advanced configuration including package installation, metadata deployment, and data initialization.\n\nKey functionalities:\n\n- **Intelligent Org Management:** Automatically generates unique scratch org aliases based on username, git branch, and timestamp, with options to reuse existing orgs or force creation of new ones.\n- **Scratch Org Pool Integration:** Supports fetching pre-configured scratch orgs from pools for faster development cycles and CI/CD optimization.\n- **Custom Scratch Definition:** Dynamically builds project-scratch-def.json files with user-specific configurations including email, username patterns, and org shape settings (set variable **SCRATCH_ORG_SHAPE** to use org shapes).\n- **Package Installation:** Automatically installs all configured packages defined in `installedPackages` configuration property.\n- **Metadata Deployment:** Pushes source code and deploys metadata using optimized deployment strategies for scratch org environments.\n- **Permission Set Assignment:** Assigns specified permission sets defined in `initPermissionSets` configuration to the scratch org user.\n- **Apex Script Execution:** Runs custom Apex initialization scripts defined in `scratchOrgInitApexScripts` for org-specific setup.\n- **Data Loading:** Loads initial data using SFDMU data packages from `dataPackages` configuration for realistic development environments.\n- **User Configuration:** Automatically configures the scratch org admin user with proper names, email, country settings, and marketing user permissions.\n- **Password Generation:** Creates and stores secure passwords for easy scratch org access during development.\n- **CI/CD Integration:** Provides specialized handling for continuous integration environments including automated cleanup and pool management.\n- **Error Handling:** Comprehensive error recovery including scratch org cleanup on failure and detailed troubleshooting messages.\n\nThe command configuration can be customized using:\n\n- `config/.sfdx-hardis.yml` file with properties like `installedPackages`, `initPermissionSets`, `scratchOrgInitApexScripts`, and `dataPackages`.\n- Environment variable **SCRATCH_ORG_SHAPE** with shape org id, if you want to use org shapes\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Configuration Management:** Loads hierarchical configuration from `.sfdx-hardis.yml`, branch-specific, and user-specific configuration files using `getConfig('user')`.\n- **Alias Generation Logic:** Creates intelligent scratch org aliases using username, git branch, timestamp patterns with CI and pool prefixes for different environments.\n- **Scratch Org Definition Building:** Dynamically constructs `project-scratch-def.json` with user email, custom usernames, org shapes, and feature flags like StateAndCountryPicklist and MarketingUser.\n- **Pool Integration:** Implements scratch org pool fetching using `fetchScratchOrg` for rapid org provisioning in development and CI environments.\n- **Salesforce CLI Integration:** Executes `sf org create scratch` commands with proper parameter handling including wait times, duration, and dev hub targeting.\n- **Package Installation Pipeline:** Uses `installPackages` utility to install managed and unmanaged packages with dependency resolution and error handling.\n- **Metadata Deployment:** Leverages `initOrgMetadatas` for optimized source pushing and metadata deployment specific to scratch org environments.\n- **Permission Set Assignment:** Implements `initPermissionSetAssignments` for automated permission set assignment to scratch org users.\n- **Apex Script Execution:** Runs custom Apex initialization scripts using `initApexScripts` for org-specific configuration and setup.\n- **Data Loading Integration:** Uses SFDMU integration through `initOrgData` for comprehensive data loading from configured data packages.\n- **User Management:** Performs SOQL queries and DML operations to configure scratch org users with proper names, emails, country codes, and permission flags.\n- **Authentication Management:** Handles SFDX auth URL generation and storage for CI/CD environments and scratch org pool management.\n- **Error Recovery:** Implements comprehensive error handling with scratch org cleanup, pool management, and detailed error messaging for troubleshooting.\n- **WebSocket Integration:** Provides real-time status updates and file reporting through WebSocket connections for VS Code extension integration.\n</details>\n",
3402
+ "description": "sfdx-hardis wrapper for sfdx force:source:deploy that displays tips to solve deployment errors.\n\nAdditional to the base command wrapper: If using **--checkonly**, add options **--checkcoverage** and **--coverageformatters json-summary** to check that org coverage is > 75% (or value defined in .sfdx-hardis.yml property **apexTestsMinCoverageOrgWide**)\n\n### Deployment results\n\nYou can also have deployment results as pull request comments, on:\n\n- GitHub (see [GitHub Pull Requests comments config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-github/))\n- Gitlab (see [Gitlab integration configuration](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-gitlab/))\n- Azure DevOps (see [Azure integration configuration](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-azure/))\n\n\n[![Assisted solving of Salesforce deployments errors](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deployment-errors.jpg)](https://nicolas.vuillamy.fr/assisted-solving-of-salesforce-deployments-errors-47f3666a9ed0)\n\n### Deployment pre or post commands\n\nYou can define command lines to run before or after a deployment, with parameters:\n\n- **id**: Unique Id for the command\n- **label**: Human readable label for the command\n- **skipIfError**: If defined to \"true\", the post-command won't be run if there is a deployment failure\n- **context**: Defines the context where the command will be run. Can be **all** (default), **check-deployment-only** or **process-deployment-only**\n- **runOnlyOnceByOrg**: If set to true, the command will be run only one time per org. A record of SfdxHardisTrace__c is stored to make that possible (it needs to be existing in target org)\n\nIf the commands are not the same depending on the target org, you can define them into **config/branches/.sfdx-hardis-BRANCHNAME.yml** instead of root **config/.sfdx-hardis.yml**\n\nExample:\n\n```yaml\ncommandsPreDeploy:\n - id: knowledgeUnassign\n label: Remove KnowledgeUser right to the user who has it\n command: sf data update record --sobject User --where \"UserPermissionsKnowledgeUser='true'\" --values \"UserPermissionsKnowledgeUser='false'\" --json\n - id: knowledgeAssign\n label: Assign Knowledge user to the deployment user\n command: sf data update record --sobject User --where \"Username='deploy.github@myclient.com'\" --values \"UserPermissionsKnowledgeUser='true'\" --json\n\ncommandsPostDeploy:\n - id: knowledgeUnassign\n label: Remove KnowledgeUser right to the user who has it\n command: sf data update record --sobject User --where \"UserPermissionsKnowledgeUser='true'\" --values \"UserPermissionsKnowledgeUser='false'\" --json\n - id: knowledgeAssign\n label: Assign Knowledge user to desired username\n command: sf data update record --sobject User --where \"Username='admin-yser@myclient.com'\" --values \"UserPermissionsKnowledgeUser='true'\" --json\n - id: someActionToRunJustOneTime\n label: And to run only if deployment is success\n command: sf sfdmu:run ...\n skipIfError: true\n context: process-deployment-only\n runOnlyOnceByOrg: true\n```\n\nNotes:\n\n- You can disable coloring of errors in red by defining env variable SFDX_HARDIS_DEPLOY_ERR_COLORS=false\n\n[See documentation of Salesforce command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_deploy)\n",
3579
3403
  "examples": [
3580
- "$ sf hardis:scratch:create"
3404
+ "$ sf hardis:source:deploy -x manifest/package.xml --wait 60 --ignorewarnings --testlevel RunLocalTests --postdestructivechanges ./manifest/destructiveChanges.xml --target-org nicolas.vuillamy@cloudity.com.sfdxhardis --checkonly --checkcoverage --verbose --coverageformatters json-summary"
3581
3405
  ],
3582
3406
  "flags": {
3583
3407
  "json": {
@@ -3595,138 +3419,216 @@
3595
3419
  "multiple": false,
3596
3420
  "type": "option"
3597
3421
  },
3598
- "forcenew": {
3599
- "char": "n",
3600
- "description": "If an existing scratch org exists, do not reuse it but create a new one",
3601
- "name": "forcenew",
3422
+ "checkonly": {
3423
+ "char": "c",
3424
+ "description": "checkonly",
3425
+ "name": "checkonly",
3602
3426
  "allowNo": false,
3603
3427
  "type": "boolean"
3604
3428
  },
3605
- "pool": {
3606
- "description": "Creates the scratch org for a scratch org pool",
3607
- "name": "pool",
3429
+ "soapdeploy": {
3430
+ "description": "soapDeploy",
3431
+ "name": "soapdeploy",
3608
3432
  "allowNo": false,
3609
3433
  "type": "boolean"
3610
3434
  },
3611
- "debug": {
3612
- "char": "d",
3613
- "description": "Activate debug mode (more logs)",
3614
- "name": "debug",
3435
+ "wait": {
3436
+ "char": "w",
3437
+ "description": "wait",
3438
+ "name": "wait",
3439
+ "default": 60,
3440
+ "hasDynamicHelp": false,
3441
+ "multiple": false,
3442
+ "type": "option"
3443
+ },
3444
+ "testlevel": {
3445
+ "char": "l",
3446
+ "description": "testlevel",
3447
+ "name": "testlevel",
3448
+ "default": "NoTestRun",
3449
+ "hasDynamicHelp": false,
3450
+ "multiple": false,
3451
+ "options": [
3452
+ "NoTestRun",
3453
+ "RunSpecifiedTests",
3454
+ "RunLocalTests",
3455
+ "RunAllTestsInOrg"
3456
+ ],
3457
+ "type": "option"
3458
+ },
3459
+ "runtests": {
3460
+ "char": "r",
3461
+ "description": "runTests",
3462
+ "name": "runtests",
3463
+ "default": [],
3464
+ "hasDynamicHelp": false,
3465
+ "multiple": true,
3466
+ "type": "option"
3467
+ },
3468
+ "ignoreerrors": {
3469
+ "description": "ignoreErrors",
3470
+ "name": "ignoreerrors",
3615
3471
  "allowNo": false,
3616
3472
  "type": "boolean"
3617
3473
  },
3618
- "websocket": {
3619
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3620
- "name": "websocket",
3474
+ "ignorewarnings": {
3475
+ "char": "g",
3476
+ "description": "ignoreWarnings",
3477
+ "name": "ignorewarnings",
3478
+ "allowNo": false,
3479
+ "type": "boolean"
3480
+ },
3481
+ "validateddeployrequestid": {
3482
+ "char": "q",
3483
+ "description": "validateDeployRequestId",
3484
+ "exclusive": [
3485
+ "manifest",
3486
+ "metadata",
3487
+ "sourcepath",
3488
+ "checkonly",
3489
+ "testlevel",
3490
+ "runtests",
3491
+ "ignoreerrors",
3492
+ "ignorewarnings"
3493
+ ],
3494
+ "name": "validateddeployrequestid",
3621
3495
  "hasDynamicHelp": false,
3622
3496
  "multiple": false,
3623
3497
  "type": "option"
3624
3498
  },
3625
- "skipauth": {
3626
- "description": "Skip authentication check when a default username is required",
3627
- "name": "skipauth",
3499
+ "verbose": {
3500
+ "description": "verbose",
3501
+ "name": "verbose",
3628
3502
  "allowNo": false,
3629
3503
  "type": "boolean"
3630
3504
  },
3631
- "target-dev-hub": {
3632
- "aliases": [
3633
- "targetdevhubusername"
3505
+ "metadata": {
3506
+ "char": "m",
3507
+ "description": "metadata",
3508
+ "exclusive": [
3509
+ "manifest",
3510
+ "sourcepath"
3634
3511
  ],
3635
- "char": "v",
3636
- "deprecateAliases": true,
3637
- "name": "target-dev-hub",
3638
- "noCacheDefault": true,
3639
- "required": true,
3640
- "summary": "Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set.",
3641
- "hasDynamicHelp": true,
3512
+ "name": "metadata",
3513
+ "hasDynamicHelp": false,
3514
+ "multiple": true,
3515
+ "type": "option"
3516
+ },
3517
+ "sourcepath": {
3518
+ "char": "p",
3519
+ "description": "sourcePath",
3520
+ "exclusive": [
3521
+ "manifest",
3522
+ "metadata"
3523
+ ],
3524
+ "name": "sourcepath",
3525
+ "hasDynamicHelp": false,
3526
+ "multiple": true,
3527
+ "type": "option"
3528
+ },
3529
+ "manifest": {
3530
+ "char": "x",
3531
+ "description": "flagsLong.manifest",
3532
+ "exclusive": [
3533
+ "metadata",
3534
+ "sourcepath"
3535
+ ],
3536
+ "name": "manifest",
3537
+ "hasDynamicHelp": false,
3642
3538
  "multiple": false,
3643
3539
  "type": "option"
3644
- }
3645
- },
3646
- "hasDynamicHelp": true,
3647
- "hiddenAliases": [],
3648
- "id": "hardis:scratch:create",
3649
- "pluginAlias": "sfdx-hardis",
3650
- "pluginName": "sfdx-hardis",
3651
- "pluginType": "core",
3652
- "strict": true,
3653
- "enableJsonFlag": true,
3654
- "title": "Create and initialize scratch org",
3655
- "requiresProject": true,
3656
- "requiresSfdxPlugins": [
3657
- "sfdmu"
3658
- ],
3659
- "isESM": true,
3660
- "relativePath": [
3661
- "lib",
3662
- "commands",
3663
- "hardis",
3664
- "scratch",
3665
- "create.js"
3666
- ],
3667
- "aliasPermutations": [],
3668
- "permutations": [
3669
- "hardis:scratch:create",
3670
- "scratch:hardis:create",
3671
- "scratch:create:hardis",
3672
- "hardis:create:scratch",
3673
- "create:hardis:scratch",
3674
- "create:scratch:hardis"
3675
- ]
3676
- },
3677
- "hardis:scratch:delete": {
3678
- "aliases": [],
3679
- "args": {},
3680
- "description": "## Command Behavior\n\n**Provides an assisted menu to delete Salesforce scratch orgs associated with a Dev Hub.**\n\nThis command simplifies the process of cleaning up your Salesforce development environments by allowing you to easily select and delete multiple scratch orgs. This is crucial for managing your scratch org limits and ensuring that you don't accumulate unnecessary or expired orgs.\n\nKey functionalities:\n\n- **Interactive Scratch Org Selection:** Displays a list of all active scratch orgs linked to your Dev Hub, including their usernames, instance URLs, and last used dates.\n- **Multi-Selection:** Allows you to select multiple scratch orgs for deletion.\n- **Confirmation Prompt:** Prompts for confirmation before proceeding with the deletion, ensuring that you don't accidentally delete important orgs.\n- **Dev Hub Integration:** Works with your configured Dev Hub to manage scratch orgs.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce CLI Integration:** It executes the `sf org list` command to retrieve a list of all scratch orgs associated with the current Dev Hub. It then filters this list to show only active orgs.\n- **Interactive Prompts:** Uses the `prompts` library to present a multi-select menu of scratch orgs to the user.\n- **Scratch Org Deletion:** For each selected scratch org, it executes the `sf org delete scratch --no-prompt` command to perform the deletion.\n- **Error Handling:** Includes basic error handling for Salesforce CLI commands.\n- **Data Sorting:** Sorts the list of scratch orgs by username, alias, and instance URL for better readability in the interactive menu.\n</details>\n",
3681
- "examples": [
3682
- "$ sf hardis:scratch:delete"
3683
- ],
3684
- "flags": {
3685
- "json": {
3686
- "description": "Format output as json.",
3687
- "helpGroup": "GLOBAL",
3688
- "name": "json",
3540
+ },
3541
+ "predestructivechanges": {
3542
+ "dependsOn": [
3543
+ "manifest"
3544
+ ],
3545
+ "description": "predestructivechanges",
3546
+ "name": "predestructivechanges",
3547
+ "hasDynamicHelp": false,
3548
+ "multiple": false,
3549
+ "type": "option"
3550
+ },
3551
+ "postdestructivechanges": {
3552
+ "dependsOn": [
3553
+ "manifest"
3554
+ ],
3555
+ "description": "postdestructivechanges",
3556
+ "name": "postdestructivechanges",
3557
+ "hasDynamicHelp": false,
3558
+ "multiple": false,
3559
+ "type": "option"
3560
+ },
3561
+ "tracksource": {
3562
+ "char": "t",
3563
+ "description": "tracksource",
3564
+ "exclusive": [
3565
+ "checkonly",
3566
+ "validateddeployrequestid"
3567
+ ],
3568
+ "name": "tracksource",
3689
3569
  "allowNo": false,
3690
3570
  "type": "boolean"
3691
3571
  },
3692
- "flags-dir": {
3693
- "helpGroup": "GLOBAL",
3694
- "name": "flags-dir",
3695
- "summary": "Import flag values from a directory.",
3572
+ "forceoverwrite": {
3573
+ "char": "f",
3574
+ "dependsOn": [
3575
+ "tracksource"
3576
+ ],
3577
+ "description": "forceoverwrite",
3578
+ "name": "forceoverwrite",
3579
+ "allowNo": false,
3580
+ "type": "boolean"
3581
+ },
3582
+ "resultsdir": {
3583
+ "description": "resultsdir",
3584
+ "name": "resultsdir",
3696
3585
  "hasDynamicHelp": false,
3697
3586
  "multiple": false,
3698
3587
  "type": "option"
3699
3588
  },
3589
+ "coverageformatters": {
3590
+ "description": "coverageformatters",
3591
+ "name": "coverageformatters",
3592
+ "hasDynamicHelp": false,
3593
+ "multiple": true,
3594
+ "type": "option"
3595
+ },
3596
+ "junit": {
3597
+ "description": "junit",
3598
+ "name": "junit",
3599
+ "allowNo": false,
3600
+ "type": "boolean"
3601
+ },
3602
+ "checkcoverage": {
3603
+ "description": "Check Apex org coverage",
3604
+ "name": "checkcoverage",
3605
+ "allowNo": false,
3606
+ "type": "boolean"
3607
+ },
3700
3608
  "debug": {
3701
- "char": "d",
3702
- "description": "Activate debug mode (more logs)",
3609
+ "description": "debug",
3703
3610
  "name": "debug",
3704
3611
  "allowNo": false,
3705
3612
  "type": "boolean"
3706
3613
  },
3707
3614
  "websocket": {
3708
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3615
+ "description": "websocket",
3709
3616
  "name": "websocket",
3710
3617
  "hasDynamicHelp": false,
3711
3618
  "multiple": false,
3712
- "type": "option"
3713
- },
3714
- "skipauth": {
3715
- "description": "Skip authentication check when a default username is required",
3716
- "name": "skipauth",
3717
- "allowNo": false,
3718
- "type": "boolean"
3619
+ "type": "option"
3719
3620
  },
3720
- "target-dev-hub": {
3621
+ "target-org": {
3721
3622
  "aliases": [
3722
- "targetdevhubusername"
3623
+ "targetusername",
3624
+ "u"
3723
3625
  ],
3724
- "char": "v",
3626
+ "char": "o",
3725
3627
  "deprecateAliases": true,
3726
- "name": "target-dev-hub",
3628
+ "name": "target-org",
3727
3629
  "noCacheDefault": true,
3728
3630
  "required": true,
3729
- "summary": "Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set.",
3631
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
3730
3632
  "hasDynamicHelp": true,
3731
3633
  "multiple": false,
3732
3634
  "type": "option"
@@ -3734,38 +3636,35 @@
3734
3636
  },
3735
3637
  "hasDynamicHelp": true,
3736
3638
  "hiddenAliases": [],
3737
- "id": "hardis:scratch:delete",
3639
+ "id": "hardis:source:deploy",
3738
3640
  "pluginAlias": "sfdx-hardis",
3739
3641
  "pluginName": "sfdx-hardis",
3740
3642
  "pluginType": "core",
3741
3643
  "strict": true,
3742
3644
  "enableJsonFlag": true,
3743
- "title": "Delete scratch orgs(s)",
3645
+ "requiresProject": true,
3744
3646
  "isESM": true,
3745
3647
  "relativePath": [
3746
3648
  "lib",
3747
3649
  "commands",
3748
3650
  "hardis",
3749
- "scratch",
3750
- "delete.js"
3651
+ "source",
3652
+ "deploy.js"
3751
3653
  ],
3752
3654
  "aliasPermutations": [],
3753
3655
  "permutations": [
3754
- "hardis:scratch:delete",
3755
- "scratch:hardis:delete",
3756
- "scratch:delete:hardis",
3757
- "hardis:delete:scratch",
3758
- "delete:hardis:scratch",
3759
- "delete:scratch:hardis"
3656
+ "hardis:source:deploy",
3657
+ "source:hardis:deploy",
3658
+ "source:deploy:hardis",
3659
+ "hardis:deploy:source",
3660
+ "deploy:hardis:source",
3661
+ "deploy:source:hardis"
3760
3662
  ]
3761
3663
  },
3762
- "hardis:scratch:pull": {
3664
+ "hardis:source:push": {
3763
3665
  "aliases": [],
3764
3666
  "args": {},
3765
- "description": "\n## Command Behavior\n\n**Pulls metadata changes from your scratch org or source-tracked sandbox into your local project files.**\n\nThis command is essential for synchronizing your local development environment with the changes you've made directly in your Salesforce org. After pulling, you can then stage and commit the relevant files to your version control system.\n\nKey features and considerations:\n\n- **Underlying Command:** Internally, this command executes `sf project retrieve start` to fetch the metadata.\n- **Error Handling:** If the pull operation encounters errors, it offers to automatically add the problematic items to your `.forceignore` file and then attempts to pull again, helping you resolve conflicts and ignore unwanted metadata.\n- **Missing Updates:** If you don't see certain updated items in the pull results, you might need to manually retrieve them using the Salesforce Extension's **Org Browser** or the **Salesforce CLI** directly. Refer to the [Retrieve Metadatas documentation](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-publish-task/#retrieve-metadatas) for more details.\n- **Automatic Retrieval:** You can configure the `autoRetrieveWhenPull` property in your `.sfdx-hardis.yml` file to always retrieve specific metadata types (e.g., `CustomApplication`) that might not always be detected as updates by `project:retrieve:start`.\n\nExample `.sfdx-hardis.yml` configuration for `autoRetrieveWhenPull`:\n```yaml\nautoRetrieveWhenPull:\n - CustomApplication:MyCustomApplication\n - CustomApplication:MyOtherCustomApplication\n - CustomApplication:MyThirdCustomApp\n```\n\nFor a visual explanation of the process, watch this video:\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Ik6whtflmfY\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation focuses on robust metadata synchronization:\n\n- **Salesforce CLI Wrapper:** It acts as a wrapper around the standard Salesforce CLI `sf project retrieve start` command, providing enhanced error handling and configuration options.\n- **Force Source Pull Utility:** The core logic resides in the `forceSourcePull` utility function, which orchestrates the retrieval process, including handling `.forceignore` updates.\n- **Configuration Integration:** It reads the `autoRetrieveWhenPull` setting from the project's `.sfdx-hardis.yml` to determine additional metadata to retrieve automatically.\n- **User Feedback:** Provides clear messages to the user regarding the pull status and guidance for troubleshooting.\n</details>\n",
3766
- "examples": [
3767
- "$ sf hardis:scratch:pull"
3768
- ],
3667
+ "description": "sfdx-hardis wrapper for sfdx force:source:push that displays tips to solve deployment errors.\n\n[![Assisted solving of Salesforce deployments errors](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deployment-errors.jpg)](https://nicolas.vuillamy.fr/assisted-solving-of-salesforce-deployments-errors-47f3666a9ed0)\n\n[See documentation of Salesforce command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_push)\n",
3769
3668
  "flags": {
3770
3669
  "json": {
3771
3670
  "description": "Format output as json.",
@@ -3782,26 +3681,48 @@
3782
3681
  "multiple": false,
3783
3682
  "type": "option"
3784
3683
  },
3684
+ "forceoverwrite": {
3685
+ "char": "f",
3686
+ "description": "forceoverwrite",
3687
+ "name": "forceoverwrite",
3688
+ "allowNo": false,
3689
+ "type": "boolean"
3690
+ },
3691
+ "wait": {
3692
+ "char": "w",
3693
+ "description": "wait",
3694
+ "name": "wait",
3695
+ "default": 60,
3696
+ "hasDynamicHelp": false,
3697
+ "multiple": false,
3698
+ "type": "option"
3699
+ },
3700
+ "ignorewarnings": {
3701
+ "char": "g",
3702
+ "description": "ignorewarnings",
3703
+ "name": "ignorewarnings",
3704
+ "allowNo": false,
3705
+ "type": "boolean"
3706
+ },
3707
+ "quiet": {
3708
+ "description": "quiet",
3709
+ "name": "quiet",
3710
+ "allowNo": false,
3711
+ "type": "boolean"
3712
+ },
3785
3713
  "debug": {
3786
- "char": "d",
3787
- "description": "Activate debug mode (more logs)",
3714
+ "description": "debug",
3788
3715
  "name": "debug",
3789
3716
  "allowNo": false,
3790
3717
  "type": "boolean"
3791
3718
  },
3792
3719
  "websocket": {
3793
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3720
+ "description": "websocket",
3794
3721
  "name": "websocket",
3795
3722
  "hasDynamicHelp": false,
3796
3723
  "multiple": false,
3797
3724
  "type": "option"
3798
3725
  },
3799
- "skipauth": {
3800
- "description": "Skip authentication check when a default username is required",
3801
- "name": "skipauth",
3802
- "allowNo": false,
3803
- "type": "boolean"
3804
- },
3805
3726
  "target-org": {
3806
3727
  "aliases": [
3807
3728
  "targetusername",
@@ -3820,39 +3741,36 @@
3820
3741
  },
3821
3742
  "hasDynamicHelp": true,
3822
3743
  "hiddenAliases": [],
3823
- "id": "hardis:scratch:pull",
3744
+ "id": "hardis:source:push",
3824
3745
  "pluginAlias": "sfdx-hardis",
3825
3746
  "pluginName": "sfdx-hardis",
3826
3747
  "pluginType": "core",
3827
3748
  "strict": true,
3828
3749
  "enableJsonFlag": true,
3829
- "title": "Scratch PULL",
3830
3750
  "requiresProject": true,
3831
3751
  "isESM": true,
3832
3752
  "relativePath": [
3833
3753
  "lib",
3834
3754
  "commands",
3835
3755
  "hardis",
3836
- "scratch",
3837
- "pull.js"
3756
+ "source",
3757
+ "push.js"
3838
3758
  ],
3839
3759
  "aliasPermutations": [],
3840
3760
  "permutations": [
3841
- "hardis:scratch:pull",
3842
- "scratch:hardis:pull",
3843
- "scratch:pull:hardis",
3844
- "hardis:pull:scratch",
3845
- "pull:hardis:scratch",
3846
- "pull:scratch:hardis"
3761
+ "hardis:source:push",
3762
+ "source:hardis:push",
3763
+ "source:push:hardis",
3764
+ "hardis:push:source",
3765
+ "push:hardis:source",
3766
+ "push:source:hardis"
3847
3767
  ]
3848
3768
  },
3849
- "hardis:scratch:push": {
3769
+ "hardis:source:retrieve": {
3850
3770
  "aliases": [],
3851
3771
  "args": {},
3852
- "description": "## Command Behavior\n\n**Pushes local Salesforce DX source files to a scratch org or source-tracked sandbox.**\n\nThis command is a fundamental operation in Salesforce DX development, allowing developers to synchronize their local codebase with their development org. It ensures that changes made locally are reflected in the scratch org, enabling testing and validation.\n\nKey functionalities:\n\n- **Source Synchronization:** Deploys all local changes (metadata and code) to the target scratch org.\n- **Underlying Command:** Internally, this command executes `sf project deploy start` to perform the push operation.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce CLI Wrapper:** It acts as a wrapper around the standard Salesforce CLI `sf project deploy start` command.\n- **`forceSourcePush` Utility:** The core logic resides in the `forceSourcePush` utility function, which orchestrates the deployment process.\n- **Connection Handling:** It uses the connection to the target org to perform the push operation.\n</details>\n",
3853
- "examples": [
3854
- "$ sf hardis:scratch:push"
3855
- ],
3772
+ "description": "\n## Command Behavior\n\n**A wrapper command for Salesforce CLI's `sf project retrieve start` (formerly `sfdx force:source:retrieve`), with enhanced interactive features.**\n\nThis command facilitates the retrieval of metadata from a Salesforce org into your local project. It provides an assisted experience, especially when no specific retrieval constraints are provided.\n\nKey features:\n\n- **Assisted Metadata Selection:** If no `sourcepath`, `manifest`, `metadata`, or `packagenames` flags are specified, an interactive menu will prompt you to select the metadata types you wish to retrieve.\n- **Assisted Org Selection:** If no target org is specified, an interactive menu will guide you to choose an org for the retrieval operation.\n- **Backward Compatibility:** While this command wraps the newer `sf project retrieve start`, it maintains compatibility with the older `sfdx force:source:retrieve` flags.\n\n**Important Note:** The underlying Salesforce CLI command `sfdx force:source:retrieve` is being deprecated by Salesforce in November 2024. It is recommended to migrate to `sf project retrieve start` for future compatibility. See [Salesforce CLI Migration Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_mig_deploy_retrieve.htm) for more information.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThis command acts as an intelligent wrapper around the Salesforce CLI's source retrieval functionality:\n\n- **Command Wrapping:** It uses the `wrapSfdxCoreCommand` utility to execute the `sfdx force:source:retrieve` (or its equivalent `sf project retrieve start`) command, passing through all relevant flags and arguments.\n- **Interactive Prompts:** It leverages `MetadataUtils.promptMetadataTypes()` and `promptOrgUsernameDefault()` to provide interactive menus for metadata and org selection when the user does not provide them as flags.\n- **Argument Transformation:** It dynamically constructs the command-line arguments for the underlying Salesforce CLI command based on user selections and provided flags.\n- **Error Handling:** It includes basic error handling, such as prompting the user to re-select an org if an issue occurs during org selection.\n- **Deprecation Warning:** It explicitly logs warnings about the deprecation of `sfdx force:source:retrieve` to inform users about upcoming changes.\n</details>\n",
3773
+ "examples": [],
3856
3774
  "flags": {
3857
3775
  "json": {
3858
3776
  "description": "Format output as json.",
@@ -3869,15 +3787,98 @@
3869
3787
  "multiple": false,
3870
3788
  "type": "option"
3871
3789
  },
3790
+ "apiversion": {
3791
+ "char": "a",
3792
+ "description": "Override the api version used for api requests made by this command",
3793
+ "name": "apiversion",
3794
+ "hasDynamicHelp": false,
3795
+ "multiple": false,
3796
+ "type": "option"
3797
+ },
3798
+ "sourcepath": {
3799
+ "char": "p",
3800
+ "description": "sourcePath",
3801
+ "exclusive": [
3802
+ "manifest",
3803
+ "metadata"
3804
+ ],
3805
+ "name": "sourcepath",
3806
+ "hasDynamicHelp": false,
3807
+ "multiple": true,
3808
+ "type": "option"
3809
+ },
3810
+ "wait": {
3811
+ "char": "w",
3812
+ "description": "wait",
3813
+ "name": "wait",
3814
+ "hasDynamicHelp": false,
3815
+ "multiple": false,
3816
+ "type": "option"
3817
+ },
3818
+ "manifest": {
3819
+ "char": "x",
3820
+ "description": "manifest",
3821
+ "exclusive": [
3822
+ "metadata",
3823
+ "sourcepath"
3824
+ ],
3825
+ "name": "manifest",
3826
+ "hasDynamicHelp": false,
3827
+ "multiple": false,
3828
+ "type": "option"
3829
+ },
3830
+ "metadata": {
3831
+ "char": "m",
3832
+ "description": "metadata",
3833
+ "exclusive": [
3834
+ "manifest",
3835
+ "sourcepath"
3836
+ ],
3837
+ "name": "metadata",
3838
+ "hasDynamicHelp": false,
3839
+ "multiple": true,
3840
+ "type": "option"
3841
+ },
3842
+ "packagenames": {
3843
+ "char": "n",
3844
+ "description": "packagenames",
3845
+ "name": "packagenames",
3846
+ "hasDynamicHelp": false,
3847
+ "multiple": true,
3848
+ "type": "option"
3849
+ },
3850
+ "tracksource": {
3851
+ "char": "t",
3852
+ "description": "tracksource",
3853
+ "name": "tracksource",
3854
+ "allowNo": false,
3855
+ "type": "boolean"
3856
+ },
3857
+ "forceoverwrite": {
3858
+ "char": "f",
3859
+ "dependsOn": [
3860
+ "tracksource"
3861
+ ],
3862
+ "description": "forceoverwrite",
3863
+ "name": "forceoverwrite",
3864
+ "allowNo": false,
3865
+ "type": "boolean"
3866
+ },
3867
+ "verbose": {
3868
+ "description": "verbose",
3869
+ "name": "verbose",
3870
+ "allowNo": false,
3871
+ "type": "boolean"
3872
+ },
3872
3873
  "debug": {
3873
3874
  "char": "d",
3874
- "description": "Activate debug mode (more logs)",
3875
+ "description": "debugMode",
3875
3876
  "name": "debug",
3876
3877
  "allowNo": false,
3877
3878
  "type": "boolean"
3878
3879
  },
3879
3880
  "websocket": {
3880
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
3881
+ "description": "websocket",
3881
3882
  "name": "websocket",
3882
3883
  "hasDynamicHelp": false,
3883
3884
  "multiple": false,
@@ -3907,30 +3908,29 @@
3907
3908
  },
3908
3909
  "hasDynamicHelp": true,
3909
3910
  "hiddenAliases": [],
3910
- "id": "hardis:scratch:push",
3911
+ "id": "hardis:source:retrieve",
3911
3912
  "pluginAlias": "sfdx-hardis",
3912
3913
  "pluginName": "sfdx-hardis",
3913
3914
  "pluginType": "core",
3914
3915
  "strict": true,
3915
3916
  "enableJsonFlag": true,
3916
- "title": "Scratch PUSH",
3917
3917
  "requiresProject": true,
3918
3918
  "isESM": true,
3919
3919
  "relativePath": [
3920
3920
  "lib",
3921
3921
  "commands",
3922
3922
  "hardis",
3923
- "scratch",
3924
- "push.js"
3923
+ "source",
3924
+ "retrieve.js"
3925
3925
  ],
3926
3926
  "aliasPermutations": [],
3927
3927
  "permutations": [
3928
- "hardis:scratch:push",
3929
- "scratch:hardis:push",
3930
- "scratch:push:hardis",
3931
- "hardis:push:scratch",
3932
- "push:hardis:scratch",
3933
- "push:scratch:hardis"
3928
+ "hardis:source:retrieve",
3929
+ "source:hardis:retrieve",
3930
+ "source:retrieve:hardis",
3931
+ "hardis:retrieve:source",
3932
+ "retrieve:hardis:source",
3933
+ "retrieve:source:hardis"
3934
3934
  ]
3935
3935
  },
3936
3936
  "hardis:work:new": {
@@ -5539,15 +5539,12 @@
5539
5539
  "import:data:org:hardis"
5540
5540
  ]
5541
5541
  },
5542
- "hardis:org:diagnose:audittrail": {
5542
+ "hardis:org:files:export": {
5543
5543
  "aliases": [],
5544
5544
  "args": {},
5545
- "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
5545
+ "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
5546
5546
  "examples": [
5547
- "$ sf hardis:org:diagnose:audittrail",
5548
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5549
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5550
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5547
+ "$ sf hardis:org:files:export"
5551
5548
  ],
5552
5549
  "flags": {
5553
5550
  "json": {
@@ -5565,30 +5562,48 @@
5565
5562
  "multiple": false,
5566
5563
  "type": "option"
5567
5564
  },
5568
- "excludeusers": {
5569
- "char": "e",
5570
- "description": "Comma-separated list of usernames to exclude",
5571
- "name": "excludeusers",
5565
+ "path": {
5566
+ "char": "p",
5567
+ "description": "Path to the file export project",
5568
+ "name": "path",
5572
5569
  "hasDynamicHelp": false,
5573
5570
  "multiple": false,
5574
5571
  "type": "option"
5575
5572
  },
5576
- "lastndays": {
5573
+ "chunksize": {
5574
+ "char": "c",
5575
+ "description": "Number of records to add in a chunk before it is processed",
5576
+ "name": "chunksize",
5577
+ "default": 1000,
5578
+ "hasDynamicHelp": false,
5579
+ "multiple": false,
5580
+ "type": "option"
5581
+ },
5582
+ "polltimeout": {
5577
5583
  "char": "t",
5578
- "description": "Number of days to extract from today (included)",
5579
- "name": "lastndays",
5584
+ "description": "Timeout in MS for Bulk API calls",
5585
+ "name": "polltimeout",
5586
+ "default": 300000,
5580
5587
  "hasDynamicHelp": false,
5581
5588
  "multiple": false,
5582
5589
  "type": "option"
5583
5590
  },
5584
- "outputfile": {
5585
- "char": "f",
5586
- "description": "Force the path and name of output report file. Must end with .csv",
5587
- "name": "outputfile",
5591
+ "startchunknumber": {
5592
+ "char": "s",
5593
+ "description": "Chunk number to start from",
5594
+ "name": "startchunknumber",
5595
+ "default": 0,
5588
5596
  "hasDynamicHelp": false,
5589
5597
  "multiple": false,
5590
5598
  "type": "option"
5591
5599
  },
5600
+ "resume": {
5601
+ "char": "r",
5602
+ "description": "Resume previous export by checking existing files (default in CI)",
5603
+ "name": "resume",
5604
+ "allowNo": false,
5605
+ "type": "boolean"
5606
+ },
5592
5607
  "debug": {
5593
5608
  "char": "d",
5594
5609
  "description": "Activate debug mode (more logs)",
@@ -5627,13 +5642,13 @@
5627
5642
  },
5628
5643
  "hasDynamicHelp": true,
5629
5644
  "hiddenAliases": [],
5630
- "id": "hardis:org:diagnose:audittrail",
5645
+ "id": "hardis:org:files:export",
5631
5646
  "pluginAlias": "sfdx-hardis",
5632
5647
  "pluginName": "sfdx-hardis",
5633
5648
  "pluginType": "core",
5634
5649
  "strict": true,
5635
5650
  "enableJsonFlag": true,
5636
- "title": "Diagnose content of Setup Audit Trail",
5651
+ "title": "Export files",
5637
5652
  "requiresProject": false,
5638
5653
  "isESM": true,
5639
5654
  "relativePath": [
@@ -5641,43 +5656,43 @@
5641
5656
  "commands",
5642
5657
  "hardis",
5643
5658
  "org",
5644
- "diagnose",
5645
- "audittrail.js"
5659
+ "files",
5660
+ "export.js"
5646
5661
  ],
5647
5662
  "aliasPermutations": [],
5648
5663
  "permutations": [
5649
- "hardis:org:diagnose:audittrail",
5650
- "org:hardis:diagnose:audittrail",
5651
- "org:diagnose:hardis:audittrail",
5652
- "org:diagnose:audittrail:hardis",
5653
- "hardis:diagnose:org:audittrail",
5654
- "diagnose:hardis:org:audittrail",
5655
- "diagnose:org:hardis:audittrail",
5656
- "diagnose:org:audittrail:hardis",
5657
- "hardis:diagnose:audittrail:org",
5658
- "diagnose:hardis:audittrail:org",
5659
- "diagnose:audittrail:hardis:org",
5660
- "diagnose:audittrail:org:hardis",
5661
- "hardis:org:audittrail:diagnose",
5662
- "org:hardis:audittrail:diagnose",
5663
- "org:audittrail:hardis:diagnose",
5664
- "org:audittrail:diagnose:hardis",
5665
- "hardis:audittrail:org:diagnose",
5666
- "audittrail:hardis:org:diagnose",
5667
- "audittrail:org:hardis:diagnose",
5668
- "audittrail:org:diagnose:hardis",
5669
- "hardis:audittrail:diagnose:org",
5670
- "audittrail:hardis:diagnose:org",
5671
- "audittrail:diagnose:hardis:org",
5672
- "audittrail:diagnose:org:hardis"
5664
+ "hardis:org:files:export",
5665
+ "org:hardis:files:export",
5666
+ "org:files:hardis:export",
5667
+ "org:files:export:hardis",
5668
+ "hardis:files:org:export",
5669
+ "files:hardis:org:export",
5670
+ "files:org:hardis:export",
5671
+ "files:org:export:hardis",
5672
+ "hardis:files:export:org",
5673
+ "files:hardis:export:org",
5674
+ "files:export:hardis:org",
5675
+ "files:export:org:hardis",
5676
+ "hardis:org:export:files",
5677
+ "org:hardis:export:files",
5678
+ "org:export:hardis:files",
5679
+ "org:export:files:hardis",
5680
+ "hardis:export:org:files",
5681
+ "export:hardis:org:files",
5682
+ "export:org:hardis:files",
5683
+ "export:org:files:hardis",
5684
+ "hardis:export:files:org",
5685
+ "export:hardis:files:org",
5686
+ "export:files:hardis:org",
5687
+ "export:files:org:hardis"
5673
5688
  ]
5674
5689
  },
5675
- "hardis:org:diagnose:instanceupgrade": {
5690
+ "hardis:org:files:import": {
5676
5691
  "aliases": [],
5677
5692
  "args": {},
5678
- "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
5693
+ "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
5679
5694
  "examples": [
5680
- "$ sf hardis:org:diagnose:instanceupgrade"
5695
+ "$ sf hardis:org:files:import"
5681
5696
  ],
5682
5697
  "flags": {
5683
5698
  "json": {
@@ -5695,6 +5710,21 @@
5695
5710
  "multiple": false,
5696
5711
  "type": "option"
5697
5712
  },
5713
+ "path": {
5714
+ "char": "p",
5715
+ "description": "Path to the file export project",
5716
+ "name": "path",
5717
+ "hasDynamicHelp": false,
5718
+ "multiple": false,
5719
+ "type": "option"
5720
+ },
5721
+ "overwrite": {
5722
+ "char": "f",
5723
+ "description": "Override existing files (doubles the number of API calls)",
5724
+ "name": "overwrite",
5725
+ "allowNo": false,
5726
+ "type": "boolean"
5727
+ },
5698
5728
  "debug": {
5699
5729
  "char": "d",
5700
5730
  "description": "Activate debug mode (more logs)",
@@ -5733,13 +5763,13 @@
5733
5763
  },
5734
5764
  "hasDynamicHelp": true,
5735
5765
  "hiddenAliases": [],
5736
- "id": "hardis:org:diagnose:instanceupgrade",
5766
+ "id": "hardis:org:files:import",
5737
5767
  "pluginAlias": "sfdx-hardis",
5738
5768
  "pluginName": "sfdx-hardis",
5739
5769
  "pluginType": "core",
5740
5770
  "strict": true,
5741
5771
  "enableJsonFlag": true,
5742
- "title": "Get Instance Upgrade date",
5772
+ "title": "Import files",
5743
5773
  "requiresProject": false,
5744
5774
  "isESM": true,
5745
5775
  "relativePath": [
@@ -5747,46 +5777,44 @@
5747
5777
  "commands",
5748
5778
  "hardis",
5749
5779
  "org",
5750
- "diagnose",
5751
- "instanceupgrade.js"
5780
+ "files",
5781
+ "import.js"
5752
5782
  ],
5753
5783
  "aliasPermutations": [],
5754
5784
  "permutations": [
5755
- "hardis:org:diagnose:instanceupgrade",
5756
- "org:hardis:diagnose:instanceupgrade",
5757
- "org:diagnose:hardis:instanceupgrade",
5758
- "org:diagnose:instanceupgrade:hardis",
5759
- "hardis:diagnose:org:instanceupgrade",
5760
- "diagnose:hardis:org:instanceupgrade",
5761
- "diagnose:org:hardis:instanceupgrade",
5762
- "diagnose:org:instanceupgrade:hardis",
5763
- "hardis:diagnose:instanceupgrade:org",
5764
- "diagnose:hardis:instanceupgrade:org",
5765
- "diagnose:instanceupgrade:hardis:org",
5766
- "diagnose:instanceupgrade:org:hardis",
5767
- "hardis:org:instanceupgrade:diagnose",
5768
- "org:hardis:instanceupgrade:diagnose",
5769
- "org:instanceupgrade:hardis:diagnose",
5770
- "org:instanceupgrade:diagnose:hardis",
5771
- "hardis:instanceupgrade:org:diagnose",
5772
- "instanceupgrade:hardis:org:diagnose",
5773
- "instanceupgrade:org:hardis:diagnose",
5774
- "instanceupgrade:org:diagnose:hardis",
5775
- "hardis:instanceupgrade:diagnose:org",
5776
- "instanceupgrade:hardis:diagnose:org",
5777
- "instanceupgrade:diagnose:hardis:org",
5778
- "instanceupgrade:diagnose:org:hardis"
5785
+ "hardis:org:files:import",
5786
+ "org:hardis:files:import",
5787
+ "org:files:hardis:import",
5788
+ "org:files:import:hardis",
5789
+ "hardis:files:org:import",
5790
+ "files:hardis:org:import",
5791
+ "files:org:hardis:import",
5792
+ "files:org:import:hardis",
5793
+ "hardis:files:import:org",
5794
+ "files:hardis:import:org",
5795
+ "files:import:hardis:org",
5796
+ "files:import:org:hardis",
5797
+ "hardis:org:import:files",
5798
+ "org:hardis:import:files",
5799
+ "org:import:hardis:files",
5800
+ "org:import:files:hardis",
5801
+ "hardis:import:org:files",
5802
+ "import:hardis:org:files",
5803
+ "import:org:hardis:files",
5804
+ "import:org:files:hardis",
5805
+ "hardis:import:files:org",
5806
+ "import:hardis:files:org",
5807
+ "import:files:hardis:org",
5808
+ "import:files:org:hardis"
5779
5809
  ]
5780
5810
  },
5781
- "hardis:org:diagnose:legacyapi": {
5811
+ "hardis:org:fix:listviewmine": {
5782
5812
  "aliases": [],
5783
5813
  "args": {},
5784
- "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
5814
+ "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
5785
5815
  "examples": [
5786
- "$ sf hardis:org:diagnose:legacyapi",
5787
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5788
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5789
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5816
+ "$ sf hardis:org:fix:listviewmine",
5817
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5790
5818
  ],
5791
5819
  "flags": {
5792
5820
  "json": {
@@ -5804,28 +5832,10 @@
5804
5832
  "multiple": false,
5805
5833
  "type": "option"
5806
5834
  },
5807
- "eventtype": {
5808
- "char": "e",
5809
- "description": "Type of EventLogFile event to analyze",
5810
- "name": "eventtype",
5811
- "default": "ApiTotalUsage",
5812
- "hasDynamicHelp": false,
5813
- "multiple": false,
5814
- "type": "option"
5815
- },
5816
- "limit": {
5835
+ "listviews": {
5817
5836
  "char": "l",
5818
- "description": "Number of latest EventLogFile events to analyze",
5819
- "name": "limit",
5820
- "default": 999,
5821
- "hasDynamicHelp": false,
5822
- "multiple": false,
5823
- "type": "option"
5824
- },
5825
- "outputfile": {
5826
- "char": "f",
5827
- "description": "Force the path and name of output report file. Must end with .csv",
5828
- "name": "outputfile",
5837
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5838
+ "name": "listviews",
5829
5839
  "hasDynamicHelp": false,
5830
5840
  "multiple": false,
5831
5841
  "type": "option"
@@ -5868,57 +5878,59 @@
5868
5878
  },
5869
5879
  "hasDynamicHelp": true,
5870
5880
  "hiddenAliases": [],
5871
- "id": "hardis:org:diagnose:legacyapi",
5881
+ "id": "hardis:org:fix:listviewmine",
5872
5882
  "pluginAlias": "sfdx-hardis",
5873
5883
  "pluginName": "sfdx-hardis",
5874
5884
  "pluginType": "core",
5875
5885
  "strict": true,
5876
5886
  "enableJsonFlag": true,
5877
- "title": "Check for legacy API use",
5878
- "requiresProject": false,
5887
+ "title": "Fix listviews with ",
5888
+ "requiresProject": true,
5879
5889
  "isESM": true,
5880
5890
  "relativePath": [
5881
5891
  "lib",
5882
5892
  "commands",
5883
5893
  "hardis",
5884
5894
  "org",
5885
- "diagnose",
5886
- "legacyapi.js"
5895
+ "fix",
5896
+ "listviewmine.js"
5887
5897
  ],
5888
5898
  "aliasPermutations": [],
5889
5899
  "permutations": [
5890
- "hardis:org:diagnose:legacyapi",
5891
- "org:hardis:diagnose:legacyapi",
5892
- "org:diagnose:hardis:legacyapi",
5893
- "org:diagnose:legacyapi:hardis",
5894
- "hardis:diagnose:org:legacyapi",
5895
- "diagnose:hardis:org:legacyapi",
5896
- "diagnose:org:hardis:legacyapi",
5897
- "diagnose:org:legacyapi:hardis",
5898
- "hardis:diagnose:legacyapi:org",
5899
- "diagnose:hardis:legacyapi:org",
5900
- "diagnose:legacyapi:hardis:org",
5901
- "diagnose:legacyapi:org:hardis",
5902
- "hardis:org:legacyapi:diagnose",
5903
- "org:hardis:legacyapi:diagnose",
5904
- "org:legacyapi:hardis:diagnose",
5905
- "org:legacyapi:diagnose:hardis",
5906
- "hardis:legacyapi:org:diagnose",
5907
- "legacyapi:hardis:org:diagnose",
5908
- "legacyapi:org:hardis:diagnose",
5909
- "legacyapi:org:diagnose:hardis",
5910
- "hardis:legacyapi:diagnose:org",
5911
- "legacyapi:hardis:diagnose:org",
5912
- "legacyapi:diagnose:hardis:org",
5913
- "legacyapi:diagnose:org:hardis"
5900
+ "hardis:org:fix:listviewmine",
5901
+ "org:hardis:fix:listviewmine",
5902
+ "org:fix:hardis:listviewmine",
5903
+ "org:fix:listviewmine:hardis",
5904
+ "hardis:fix:org:listviewmine",
5905
+ "fix:hardis:org:listviewmine",
5906
+ "fix:org:hardis:listviewmine",
5907
+ "fix:org:listviewmine:hardis",
5908
+ "hardis:fix:listviewmine:org",
5909
+ "fix:hardis:listviewmine:org",
5910
+ "fix:listviewmine:hardis:org",
5911
+ "fix:listviewmine:org:hardis",
5912
+ "hardis:org:listviewmine:fix",
5913
+ "org:hardis:listviewmine:fix",
5914
+ "org:listviewmine:hardis:fix",
5915
+ "org:listviewmine:fix:hardis",
5916
+ "hardis:listviewmine:org:fix",
5917
+ "listviewmine:hardis:org:fix",
5918
+ "listviewmine:org:hardis:fix",
5919
+ "listviewmine:org:fix:hardis",
5920
+ "hardis:listviewmine:fix:org",
5921
+ "listviewmine:hardis:fix:org",
5922
+ "listviewmine:fix:hardis:org",
5923
+ "listviewmine:fix:org:hardis"
5914
5924
  ]
5915
5925
  },
5916
- "hardis:org:diagnose:licenses": {
5926
+ "hardis:org:generate:packagexmlfull": {
5917
5927
  "aliases": [],
5918
5928
  "args": {},
5919
- "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
5929
+ "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
5920
5930
  "examples": [
5921
- "$ sf hardis:org:diagnose:licenses"
5931
+ "$ sf hardis:org:generate:packagexmlfull",
5932
+ "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
5933
+ "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
5922
5934
  ],
5923
5935
  "flags": {
5924
5936
  "json": {
@@ -5937,20 +5949,12 @@
5937
5949
  "type": "option"
5938
5950
  },
5939
5951
  "outputfile": {
5940
- "char": "f",
5941
- "description": "Force the path and name of output report file. Must end with .csv",
5952
+ "description": "Output package.xml file",
5942
5953
  "name": "outputfile",
5943
5954
  "hasDynamicHelp": false,
5944
5955
  "multiple": false,
5945
5956
  "type": "option"
5946
5957
  },
5947
- "usedonly": {
5948
- "char": "u",
5949
- "description": "Filter to have only used licenses",
5950
- "name": "usedonly",
5951
- "allowNo": false,
5952
- "type": "boolean"
5953
- },
5954
5958
  "debug": {
5955
5959
  "char": "d",
5956
5960
  "description": "Activate debug mode (more logs)",
@@ -5958,6 +5962,13 @@
5958
5962
  "allowNo": false,
5959
5963
  "type": "boolean"
5960
5964
  },
5965
+ "no-prompt": {
5966
+ "char": "n",
5967
+ "description": "Do not prompt for org username, use the default one",
5968
+ "name": "no-prompt",
5969
+ "allowNo": false,
5970
+ "type": "boolean"
5971
+ },
5961
5972
  "websocket": {
5962
5973
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
5963
5974
  "name": "websocket",
@@ -5989,13 +6000,13 @@
5989
6000
  },
5990
6001
  "hasDynamicHelp": true,
5991
6002
  "hiddenAliases": [],
5992
- "id": "hardis:org:diagnose:licenses",
6003
+ "id": "hardis:org:generate:packagexmlfull",
5993
6004
  "pluginAlias": "sfdx-hardis",
5994
6005
  "pluginName": "sfdx-hardis",
5995
6006
  "pluginType": "core",
5996
6007
  "strict": true,
5997
6008
  "enableJsonFlag": true,
5998
- "title": "List licenses subscribed and used in a Salesforce org",
6009
+ "title": "Generate Full Org package.xml",
5999
6010
  "requiresProject": false,
6000
6011
  "isESM": true,
6001
6012
  "relativePath": [
@@ -6003,43 +6014,46 @@
6003
6014
  "commands",
6004
6015
  "hardis",
6005
6016
  "org",
6006
- "diagnose",
6007
- "licenses.js"
6017
+ "generate",
6018
+ "packagexmlfull.js"
6008
6019
  ],
6009
6020
  "aliasPermutations": [],
6010
6021
  "permutations": [
6011
- "hardis:org:diagnose:licenses",
6012
- "org:hardis:diagnose:licenses",
6013
- "org:diagnose:hardis:licenses",
6014
- "org:diagnose:licenses:hardis",
6015
- "hardis:diagnose:org:licenses",
6016
- "diagnose:hardis:org:licenses",
6017
- "diagnose:org:hardis:licenses",
6018
- "diagnose:org:licenses:hardis",
6019
- "hardis:diagnose:licenses:org",
6020
- "diagnose:hardis:licenses:org",
6021
- "diagnose:licenses:hardis:org",
6022
- "diagnose:licenses:org:hardis",
6023
- "hardis:org:licenses:diagnose",
6024
- "org:hardis:licenses:diagnose",
6025
- "org:licenses:hardis:diagnose",
6026
- "org:licenses:diagnose:hardis",
6027
- "hardis:licenses:org:diagnose",
6028
- "licenses:hardis:org:diagnose",
6029
- "licenses:org:hardis:diagnose",
6030
- "licenses:org:diagnose:hardis",
6031
- "hardis:licenses:diagnose:org",
6032
- "licenses:hardis:diagnose:org",
6033
- "licenses:diagnose:hardis:org",
6034
- "licenses:diagnose:org:hardis"
6022
+ "hardis:org:generate:packagexmlfull",
6023
+ "org:hardis:generate:packagexmlfull",
6024
+ "org:generate:hardis:packagexmlfull",
6025
+ "org:generate:packagexmlfull:hardis",
6026
+ "hardis:generate:org:packagexmlfull",
6027
+ "generate:hardis:org:packagexmlfull",
6028
+ "generate:org:hardis:packagexmlfull",
6029
+ "generate:org:packagexmlfull:hardis",
6030
+ "hardis:generate:packagexmlfull:org",
6031
+ "generate:hardis:packagexmlfull:org",
6032
+ "generate:packagexmlfull:hardis:org",
6033
+ "generate:packagexmlfull:org:hardis",
6034
+ "hardis:org:packagexmlfull:generate",
6035
+ "org:hardis:packagexmlfull:generate",
6036
+ "org:packagexmlfull:hardis:generate",
6037
+ "org:packagexmlfull:generate:hardis",
6038
+ "hardis:packagexmlfull:org:generate",
6039
+ "packagexmlfull:hardis:org:generate",
6040
+ "packagexmlfull:org:hardis:generate",
6041
+ "packagexmlfull:org:generate:hardis",
6042
+ "hardis:packagexmlfull:generate:org",
6043
+ "packagexmlfull:hardis:generate:org",
6044
+ "packagexmlfull:generate:hardis:org",
6045
+ "packagexmlfull:generate:org:hardis"
6035
6046
  ]
6036
6047
  },
6037
- "hardis:org:diagnose:releaseupdates": {
6048
+ "hardis:org:diagnose:audittrail": {
6038
6049
  "aliases": [],
6039
6050
  "args": {},
6040
- "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6051
+ "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
6041
6052
  "examples": [
6042
- "$ sf hardis:org:diagnose:releaseupdates"
6053
+ "$ sf hardis:org:diagnose:audittrail",
6054
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
6055
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
6056
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
6043
6057
  ],
6044
6058
  "flags": {
6045
6059
  "json": {
@@ -6057,6 +6071,22 @@
6057
6071
  "multiple": false,
6058
6072
  "type": "option"
6059
6073
  },
6074
+ "excludeusers": {
6075
+ "char": "e",
6076
+ "description": "Comma-separated list of usernames to exclude",
6077
+ "name": "excludeusers",
6078
+ "hasDynamicHelp": false,
6079
+ "multiple": false,
6080
+ "type": "option"
6081
+ },
6082
+ "lastndays": {
6083
+ "char": "t",
6084
+ "description": "Number of days to extract from today (included)",
6085
+ "name": "lastndays",
6086
+ "hasDynamicHelp": false,
6087
+ "multiple": false,
6088
+ "type": "option"
6089
+ },
6060
6090
  "outputfile": {
6061
6091
  "char": "f",
6062
6092
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6103,13 +6133,13 @@
6103
6133
  },
6104
6134
  "hasDynamicHelp": true,
6105
6135
  "hiddenAliases": [],
6106
- "id": "hardis:org:diagnose:releaseupdates",
6136
+ "id": "hardis:org:diagnose:audittrail",
6107
6137
  "pluginAlias": "sfdx-hardis",
6108
6138
  "pluginName": "sfdx-hardis",
6109
6139
  "pluginType": "core",
6110
6140
  "strict": true,
6111
6141
  "enableJsonFlag": true,
6112
- "title": "Check Release Updates of an org",
6142
+ "title": "Diagnose content of Setup Audit Trail",
6113
6143
  "requiresProject": false,
6114
6144
  "isESM": true,
6115
6145
  "relativePath": [
@@ -6118,47 +6148,42 @@
6118
6148
  "hardis",
6119
6149
  "org",
6120
6150
  "diagnose",
6121
- "releaseupdates.js"
6151
+ "audittrail.js"
6122
6152
  ],
6123
6153
  "aliasPermutations": [],
6124
6154
  "permutations": [
6125
- "hardis:org:diagnose:releaseupdates",
6126
- "org:hardis:diagnose:releaseupdates",
6127
- "org:diagnose:hardis:releaseupdates",
6128
- "org:diagnose:releaseupdates:hardis",
6129
- "hardis:diagnose:org:releaseupdates",
6130
- "diagnose:hardis:org:releaseupdates",
6131
- "diagnose:org:hardis:releaseupdates",
6132
- "diagnose:org:releaseupdates:hardis",
6133
- "hardis:diagnose:releaseupdates:org",
6134
- "diagnose:hardis:releaseupdates:org",
6135
- "diagnose:releaseupdates:hardis:org",
6136
- "diagnose:releaseupdates:org:hardis",
6137
- "hardis:org:releaseupdates:diagnose",
6138
- "org:hardis:releaseupdates:diagnose",
6139
- "org:releaseupdates:hardis:diagnose",
6140
- "org:releaseupdates:diagnose:hardis",
6141
- "hardis:releaseupdates:org:diagnose",
6142
- "releaseupdates:hardis:org:diagnose",
6143
- "releaseupdates:org:hardis:diagnose",
6144
- "releaseupdates:org:diagnose:hardis",
6145
- "hardis:releaseupdates:diagnose:org",
6146
- "releaseupdates:hardis:diagnose:org",
6147
- "releaseupdates:diagnose:hardis:org",
6148
- "releaseupdates:diagnose:org:hardis"
6155
+ "hardis:org:diagnose:audittrail",
6156
+ "org:hardis:diagnose:audittrail",
6157
+ "org:diagnose:hardis:audittrail",
6158
+ "org:diagnose:audittrail:hardis",
6159
+ "hardis:diagnose:org:audittrail",
6160
+ "diagnose:hardis:org:audittrail",
6161
+ "diagnose:org:hardis:audittrail",
6162
+ "diagnose:org:audittrail:hardis",
6163
+ "hardis:diagnose:audittrail:org",
6164
+ "diagnose:hardis:audittrail:org",
6165
+ "diagnose:audittrail:hardis:org",
6166
+ "diagnose:audittrail:org:hardis",
6167
+ "hardis:org:audittrail:diagnose",
6168
+ "org:hardis:audittrail:diagnose",
6169
+ "org:audittrail:hardis:diagnose",
6170
+ "org:audittrail:diagnose:hardis",
6171
+ "hardis:audittrail:org:diagnose",
6172
+ "audittrail:hardis:org:diagnose",
6173
+ "audittrail:org:hardis:diagnose",
6174
+ "audittrail:org:diagnose:hardis",
6175
+ "hardis:audittrail:diagnose:org",
6176
+ "audittrail:hardis:diagnose:org",
6177
+ "audittrail:diagnose:hardis:org",
6178
+ "audittrail:diagnose:org:hardis"
6149
6179
  ]
6150
6180
  },
6151
- "hardis:org:diagnose:storage-stats": {
6181
+ "hardis:org:diagnose:instanceupgrade": {
6152
6182
  "aliases": [],
6153
6183
  "args": {},
6154
- "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with flexible grouping options.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose breakdown fields (date fields, RecordType, custom fields, or relationship fields).\n- **Flexible Breakdown Field:** Supports grouping by any field including:\n - Date/DateTime fields (`CreatedDate`, `LastModifiedDate`, custom date fields)\n - RecordType (`RecordType.Name`)\n - Custom fields (`Status__c`, picklists, text fields)\n - Nested relationship fields (`SBQQ__Quote__r.RecordType.Name`)\n- **Date Granularity Options:** For date/datetime fields, choose between:\n - Year-based grouping (`CALENDAR_YEAR`)\n - Month-based grouping (`CALENDAR_MONTH`)\n - Day-based grouping (exact date)\n- **WHERE Clause Filtering:** Apply SOQL WHERE conditions to filter records before calculating storage (e.g., only active records, records from the last year).\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed breakdown by selected field and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects, breakdown field selection, granularity choice (for date fields), and optional WHERE conditions. All objects are pre-selected by default for user convenience.\n- **Field Validation:** Recursively validates breakdown fields including nested relationships (e.g., `SBQQ__Quote__r.RecordType.Name`) by traversing the relationship chain and checking field existence on each related object. Automatically handles special cases like `RecordType` -> `RecordTypeId` and `__r` -> `__c` conversions.\n- **Dynamic Query Generation:** Builds SOQL queries based on field type and granularity:\n - For date fields with year granularity: `SELECT CALENDAR_YEAR(<Field>) breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>) ORDER BY CALENDAR_YEAR(<Field>)`\n - For date fields with month granularity: `SELECT CALENDAR_YEAR(<Field>) year, CALENDAR_MONTH(<Field>) month, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>) ORDER BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>)`\n - For non-date fields: `SELECT <Field> breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY <Field> ORDER BY <Field>`\n- **WHERE Clause Support:** Accepts user-provided WHERE conditions via flag (`--where`) or interactive prompt. Injects the condition into all SOQL queries for consistent filtering across all objects.\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and breakdown value.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all statistics per breakdown value per object (e.g., by year, by month, by RecordType)\n - Totals summary: includes only aggregate totals per object\n - File naming includes breakdown field, granularity (for date fields), and `-filtered` suffix when WHERE clause is applied\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
6184
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
6155
6185
  "examples": [
6156
- "$ sf hardis:org:diagnose:storage-stats",
6157
- "$ sf hardis:org:diagnose:storage-stats --breakdown-field \"CreatedDate\"",
6158
- "$ sf hardis:org:diagnose:storage-stats -b \"RecordType.Name\"",
6159
- "$ sf hardis:org:diagnose:storage-stats --where \"CreatedDate = LAST_N_DAYS:365\"",
6160
- "$ sf hardis:org:diagnose:storage-stats -w \"Status__c = 'Active'\"",
6161
- "$ sf hardis:org:diagnose:storage-stats -b \"LastModifiedDate\" -w \"IsDeleted = false\""
6186
+ "$ sf hardis:org:diagnose:instanceupgrade"
6162
6187
  ],
6163
6188
  "flags": {
6164
6189
  "json": {
@@ -6176,30 +6201,6 @@
6176
6201
  "multiple": false,
6177
6202
  "type": "option"
6178
6203
  },
6179
- "outputfile": {
6180
- "char": "f",
6181
- "description": "Force the path and name of output report file. Must end with .csv",
6182
- "name": "outputfile",
6183
- "hasDynamicHelp": false,
6184
- "multiple": false,
6185
- "type": "option"
6186
- },
6187
- "breakdown-field": {
6188
- "char": "b",
6189
- "description": "Field to use for storage stats breakdown. Example: \"CreatedDate\", \"LastModifiedDate\", \"RecordType.Name\", or custom fields like \"Status__c\"",
6190
- "name": "breakdown-field",
6191
- "hasDynamicHelp": false,
6192
- "multiple": false,
6193
- "type": "option"
6194
- },
6195
- "where": {
6196
- "char": "w",
6197
- "description": "WHERE clause to filter records in the query (without the WHERE keyword). Example: \"CreatedDate = LAST_N_DAYS:365\" or \"Status__c = 'Active'\"",
6198
- "name": "where",
6199
- "hasDynamicHelp": false,
6200
- "multiple": false,
6201
- "type": "option"
6202
- },
6203
6204
  "debug": {
6204
6205
  "char": "d",
6205
6206
  "description": "Activate debug mode (more logs)",
@@ -6238,14 +6239,14 @@
6238
6239
  },
6239
6240
  "hasDynamicHelp": true,
6240
6241
  "hiddenAliases": [],
6241
- "id": "hardis:org:diagnose:storage-stats",
6242
+ "id": "hardis:org:diagnose:instanceupgrade",
6242
6243
  "pluginAlias": "sfdx-hardis",
6243
6244
  "pluginName": "sfdx-hardis",
6244
6245
  "pluginType": "core",
6245
6246
  "strict": true,
6246
6247
  "enableJsonFlag": true,
6247
- "title": "Extract Data Storage stats",
6248
- "requiresProject": true,
6248
+ "title": "Get Instance Upgrade date",
6249
+ "requiresProject": false,
6249
6250
  "isESM": true,
6250
6251
  "relativePath": [
6251
6252
  "lib",
@@ -6253,42 +6254,45 @@
6253
6254
  "hardis",
6254
6255
  "org",
6255
6256
  "diagnose",
6256
- "storage-stats.js"
6257
+ "instanceupgrade.js"
6257
6258
  ],
6258
6259
  "aliasPermutations": [],
6259
6260
  "permutations": [
6260
- "hardis:org:diagnose:storage-stats",
6261
- "org:hardis:diagnose:storage-stats",
6262
- "org:diagnose:hardis:storage-stats",
6263
- "org:diagnose:storage-stats:hardis",
6264
- "hardis:diagnose:org:storage-stats",
6265
- "diagnose:hardis:org:storage-stats",
6266
- "diagnose:org:hardis:storage-stats",
6267
- "diagnose:org:storage-stats:hardis",
6268
- "hardis:diagnose:storage-stats:org",
6269
- "diagnose:hardis:storage-stats:org",
6270
- "diagnose:storage-stats:hardis:org",
6271
- "diagnose:storage-stats:org:hardis",
6272
- "hardis:org:storage-stats:diagnose",
6273
- "org:hardis:storage-stats:diagnose",
6274
- "org:storage-stats:hardis:diagnose",
6275
- "org:storage-stats:diagnose:hardis",
6276
- "hardis:storage-stats:org:diagnose",
6277
- "storage-stats:hardis:org:diagnose",
6278
- "storage-stats:org:hardis:diagnose",
6279
- "storage-stats:org:diagnose:hardis",
6280
- "hardis:storage-stats:diagnose:org",
6281
- "storage-stats:hardis:diagnose:org",
6282
- "storage-stats:diagnose:hardis:org",
6283
- "storage-stats:diagnose:org:hardis"
6261
+ "hardis:org:diagnose:instanceupgrade",
6262
+ "org:hardis:diagnose:instanceupgrade",
6263
+ "org:diagnose:hardis:instanceupgrade",
6264
+ "org:diagnose:instanceupgrade:hardis",
6265
+ "hardis:diagnose:org:instanceupgrade",
6266
+ "diagnose:hardis:org:instanceupgrade",
6267
+ "diagnose:org:hardis:instanceupgrade",
6268
+ "diagnose:org:instanceupgrade:hardis",
6269
+ "hardis:diagnose:instanceupgrade:org",
6270
+ "diagnose:hardis:instanceupgrade:org",
6271
+ "diagnose:instanceupgrade:hardis:org",
6272
+ "diagnose:instanceupgrade:org:hardis",
6273
+ "hardis:org:instanceupgrade:diagnose",
6274
+ "org:hardis:instanceupgrade:diagnose",
6275
+ "org:instanceupgrade:hardis:diagnose",
6276
+ "org:instanceupgrade:diagnose:hardis",
6277
+ "hardis:instanceupgrade:org:diagnose",
6278
+ "instanceupgrade:hardis:org:diagnose",
6279
+ "instanceupgrade:org:hardis:diagnose",
6280
+ "instanceupgrade:org:diagnose:hardis",
6281
+ "hardis:instanceupgrade:diagnose:org",
6282
+ "instanceupgrade:hardis:diagnose:org",
6283
+ "instanceupgrade:diagnose:hardis:org",
6284
+ "instanceupgrade:diagnose:org:hardis"
6284
6285
  ]
6285
6286
  },
6286
- "hardis:org:diagnose:unsecure-connected-apps": {
6287
+ "hardis:org:diagnose:legacyapi": {
6287
6288
  "aliases": [],
6288
6289
  "args": {},
6289
- "description": "\n## Command Behavior\n\n**Detects unsecured Connected Apps in a Salesforce org and generates detailed reports for security analysis.**\n\nThis command is a critical security diagnostic tool that helps administrators identify Connected Apps that may pose security risks due to improper configuration. It provides comprehensive analysis of OAuth tokens and Connected App security settings to ensure proper access control.\n\nKey functionalities:\n\n- **OAuth Token Analysis:** Queries all OAuth tokens in the org using SOQL to retrieve comprehensive token information including app names, users, authorization status, and usage statistics.\n- **Security Status Assessment:** Evaluates each Connected App's security configuration by checking the `IsUsingAdminAuthorization` flag to determine if admin pre-approval is required.\n- **Unsecured App Detection:** Identifies Connected Apps that allow users to authorize themselves without admin approval, which can pose security risks.\n- **Detailed Reporting:** Generates two comprehensive CSV reports:\n - **OAuth Tokens Report:** Lists all OAuth tokens with security status, user information, and usage data\n - **Connected Apps Summary:** Aggregates unsecured Connected Apps with counts of associated OAuth tokens\n- **Visual Indicators:** Uses status icons (❌ for unsecured, ✅ for secured) to provide immediate visual feedback on security status.\n- **Security Recommendations:** Provides actionable guidance on how to secure Connected Apps through proper configuration.\n- **Notifications:** Sends alerts to configured channels (Grafana, Slack, MS Teams) with security findings and attached reports.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-security/) and can output Grafana, Slack and MsTeams Notifications.\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/jHv8yrSK8Dg\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query Execution:** Executes a comprehensive SOQL query on the `OauthToken` object, joining with `AppMenuItem` and `User` objects to gather complete security context.\n- **Security Analysis Logic:** Analyzes the `AppMenuItem.IsUsingAdminAuthorization` field to determine if a Connected App requires admin pre-approval for user authorization.\n- **Data Transformation:** Processes raw SOQL results to add security status indicators and reorganize data for optimal reporting and analysis.\n- **Aggregation Processing:** Groups OAuth tokens by Connected App name to provide summary statistics and identify the most problematic applications.\n- **Report Generation:** Uses `generateCsvFile` to create structured CSV reports with proper formatting and metadata for easy analysis and sharing.\n- **Notification Integration:** Integrates with the `NotifProvider` to send security alerts with detailed metrics, including the number of unsecured Connected Apps and associated OAuth tokens.\n- **File Management:** Generates multiple output formats (CSV, XLSX) and manages file paths using `generateReportPath` for consistent report organization.\n- **Connection Management:** Uses `setConnectionVariables` to ensure proper authentication context for notification providers that require org connection details.\n</details>\n",
6290
+ "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
6290
6291
  "examples": [
6291
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
6292
+ "$ sf hardis:org:diagnose:legacyapi",
6293
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
6294
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
6295
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6292
6296
  ],
6293
6297
  "flags": {
6294
6298
  "json": {
@@ -6306,6 +6310,24 @@
6306
6310
  "multiple": false,
6307
6311
  "type": "option"
6308
6312
  },
6313
+ "eventtype": {
6314
+ "char": "e",
6315
+ "description": "Type of EventLogFile event to analyze",
6316
+ "name": "eventtype",
6317
+ "default": "ApiTotalUsage",
6318
+ "hasDynamicHelp": false,
6319
+ "multiple": false,
6320
+ "type": "option"
6321
+ },
6322
+ "limit": {
6323
+ "char": "l",
6324
+ "description": "Number of latest EventLogFile events to analyze",
6325
+ "name": "limit",
6326
+ "default": 999,
6327
+ "hasDynamicHelp": false,
6328
+ "multiple": false,
6329
+ "type": "option"
6330
+ },
6309
6331
  "outputfile": {
6310
6332
  "char": "f",
6311
6333
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6352,13 +6374,13 @@
6352
6374
  },
6353
6375
  "hasDynamicHelp": true,
6354
6376
  "hiddenAliases": [],
6355
- "id": "hardis:org:diagnose:unsecure-connected-apps",
6377
+ "id": "hardis:org:diagnose:legacyapi",
6356
6378
  "pluginAlias": "sfdx-hardis",
6357
6379
  "pluginName": "sfdx-hardis",
6358
6380
  "pluginType": "core",
6359
6381
  "strict": true,
6360
6382
  "enableJsonFlag": true,
6361
- "title": "Detect Unsecured Connected Apps",
6383
+ "title": "Check for legacy API use",
6362
6384
  "requiresProject": false,
6363
6385
  "isESM": true,
6364
6386
  "relativePath": [
@@ -6367,43 +6389,42 @@
6367
6389
  "hardis",
6368
6390
  "org",
6369
6391
  "diagnose",
6370
- "unsecure-connected-apps.js"
6392
+ "legacyapi.js"
6371
6393
  ],
6372
6394
  "aliasPermutations": [],
6373
6395
  "permutations": [
6374
- "hardis:org:diagnose:unsecure-connected-apps",
6375
- "org:hardis:diagnose:unsecure-connected-apps",
6376
- "org:diagnose:hardis:unsecure-connected-apps",
6377
- "org:diagnose:unsecure-connected-apps:hardis",
6378
- "hardis:diagnose:org:unsecure-connected-apps",
6379
- "diagnose:hardis:org:unsecure-connected-apps",
6380
- "diagnose:org:hardis:unsecure-connected-apps",
6381
- "diagnose:org:unsecure-connected-apps:hardis",
6382
- "hardis:diagnose:unsecure-connected-apps:org",
6383
- "diagnose:hardis:unsecure-connected-apps:org",
6384
- "diagnose:unsecure-connected-apps:hardis:org",
6385
- "diagnose:unsecure-connected-apps:org:hardis",
6386
- "hardis:org:unsecure-connected-apps:diagnose",
6387
- "org:hardis:unsecure-connected-apps:diagnose",
6388
- "org:unsecure-connected-apps:hardis:diagnose",
6389
- "org:unsecure-connected-apps:diagnose:hardis",
6390
- "hardis:unsecure-connected-apps:org:diagnose",
6391
- "unsecure-connected-apps:hardis:org:diagnose",
6392
- "unsecure-connected-apps:org:hardis:diagnose",
6393
- "unsecure-connected-apps:org:diagnose:hardis",
6394
- "hardis:unsecure-connected-apps:diagnose:org",
6395
- "unsecure-connected-apps:hardis:diagnose:org",
6396
- "unsecure-connected-apps:diagnose:hardis:org",
6397
- "unsecure-connected-apps:diagnose:org:hardis"
6396
+ "hardis:org:diagnose:legacyapi",
6397
+ "org:hardis:diagnose:legacyapi",
6398
+ "org:diagnose:hardis:legacyapi",
6399
+ "org:diagnose:legacyapi:hardis",
6400
+ "hardis:diagnose:org:legacyapi",
6401
+ "diagnose:hardis:org:legacyapi",
6402
+ "diagnose:org:hardis:legacyapi",
6403
+ "diagnose:org:legacyapi:hardis",
6404
+ "hardis:diagnose:legacyapi:org",
6405
+ "diagnose:hardis:legacyapi:org",
6406
+ "diagnose:legacyapi:hardis:org",
6407
+ "diagnose:legacyapi:org:hardis",
6408
+ "hardis:org:legacyapi:diagnose",
6409
+ "org:hardis:legacyapi:diagnose",
6410
+ "org:legacyapi:hardis:diagnose",
6411
+ "org:legacyapi:diagnose:hardis",
6412
+ "hardis:legacyapi:org:diagnose",
6413
+ "legacyapi:hardis:org:diagnose",
6414
+ "legacyapi:org:hardis:diagnose",
6415
+ "legacyapi:org:diagnose:hardis",
6416
+ "hardis:legacyapi:diagnose:org",
6417
+ "legacyapi:hardis:diagnose:org",
6418
+ "legacyapi:diagnose:hardis:org",
6419
+ "legacyapi:diagnose:org:hardis"
6398
6420
  ]
6399
6421
  },
6400
- "hardis:org:diagnose:unused-apex-classes": {
6422
+ "hardis:org:diagnose:licenses": {
6401
6423
  "aliases": [],
6402
6424
  "args": {},
6403
- "description": "List all async Apex classes (Batch,Queueable,Schedulable) that has not been called for more than 365 days.\n \nThe result class list probably can be removed from the project, and that will improve your test classes performances 😊\n\nThe number of unused day is overridable using --days option. \n\nThe command uses queries on AsyncApexJob and CronTrigger technical tables to build the result.\n\nApex Classes CreatedBy and CreatedOn fields are calculated from MIN(date from git, date from org)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-apex-classes/) and can output Grafana, Slack and MsTeams Notifications.\n\n![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-monitoring-unused-apex-grafana.jpg)\n",
6425
+ "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
6404
6426
  "examples": [
6405
- "$ sf hardis:org:diagnose:unused-apex-classes",
6406
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6427
+ "$ sf hardis:org:diagnose:licenses"
6407
6428
  ],
6408
6429
  "flags": {
6409
6430
  "json": {
@@ -6429,13 +6450,12 @@
6429
6450
  "multiple": false,
6430
6451
  "type": "option"
6431
6452
  },
6432
- "days": {
6433
- "char": "t",
6434
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6435
- "name": "days",
6436
- "hasDynamicHelp": false,
6437
- "multiple": false,
6438
- "type": "option"
6453
+ "usedonly": {
6454
+ "char": "u",
6455
+ "description": "Filter to have only used licenses",
6456
+ "name": "usedonly",
6457
+ "allowNo": false,
6458
+ "type": "boolean"
6439
6459
  },
6440
6460
  "debug": {
6441
6461
  "char": "d",
@@ -6475,13 +6495,13 @@
6475
6495
  },
6476
6496
  "hasDynamicHelp": true,
6477
6497
  "hiddenAliases": [],
6478
- "id": "hardis:org:diagnose:unused-apex-classes",
6498
+ "id": "hardis:org:diagnose:licenses",
6479
6499
  "pluginAlias": "sfdx-hardis",
6480
6500
  "pluginName": "sfdx-hardis",
6481
6501
  "pluginType": "core",
6482
6502
  "strict": true,
6483
6503
  "enableJsonFlag": true,
6484
- "title": "Detect unused Apex classes in an org",
6504
+ "title": "List licenses subscribed and used in a Salesforce org",
6485
6505
  "requiresProject": false,
6486
6506
  "isESM": true,
6487
6507
  "relativePath": [
@@ -6490,42 +6510,42 @@
6490
6510
  "hardis",
6491
6511
  "org",
6492
6512
  "diagnose",
6493
- "unused-apex-classes.js"
6513
+ "licenses.js"
6494
6514
  ],
6495
6515
  "aliasPermutations": [],
6496
6516
  "permutations": [
6497
- "hardis:org:diagnose:unused-apex-classes",
6498
- "org:hardis:diagnose:unused-apex-classes",
6499
- "org:diagnose:hardis:unused-apex-classes",
6500
- "org:diagnose:unused-apex-classes:hardis",
6501
- "hardis:diagnose:org:unused-apex-classes",
6502
- "diagnose:hardis:org:unused-apex-classes",
6503
- "diagnose:org:hardis:unused-apex-classes",
6504
- "diagnose:org:unused-apex-classes:hardis",
6505
- "hardis:diagnose:unused-apex-classes:org",
6506
- "diagnose:hardis:unused-apex-classes:org",
6507
- "diagnose:unused-apex-classes:hardis:org",
6508
- "diagnose:unused-apex-classes:org:hardis",
6509
- "hardis:org:unused-apex-classes:diagnose",
6510
- "org:hardis:unused-apex-classes:diagnose",
6511
- "org:unused-apex-classes:hardis:diagnose",
6512
- "org:unused-apex-classes:diagnose:hardis",
6513
- "hardis:unused-apex-classes:org:diagnose",
6514
- "unused-apex-classes:hardis:org:diagnose",
6515
- "unused-apex-classes:org:hardis:diagnose",
6516
- "unused-apex-classes:org:diagnose:hardis",
6517
- "hardis:unused-apex-classes:diagnose:org",
6518
- "unused-apex-classes:hardis:diagnose:org",
6519
- "unused-apex-classes:diagnose:hardis:org",
6520
- "unused-apex-classes:diagnose:org:hardis"
6517
+ "hardis:org:diagnose:licenses",
6518
+ "org:hardis:diagnose:licenses",
6519
+ "org:diagnose:hardis:licenses",
6520
+ "org:diagnose:licenses:hardis",
6521
+ "hardis:diagnose:org:licenses",
6522
+ "diagnose:hardis:org:licenses",
6523
+ "diagnose:org:hardis:licenses",
6524
+ "diagnose:org:licenses:hardis",
6525
+ "hardis:diagnose:licenses:org",
6526
+ "diagnose:hardis:licenses:org",
6527
+ "diagnose:licenses:hardis:org",
6528
+ "diagnose:licenses:org:hardis",
6529
+ "hardis:org:licenses:diagnose",
6530
+ "org:hardis:licenses:diagnose",
6531
+ "org:licenses:hardis:diagnose",
6532
+ "org:licenses:diagnose:hardis",
6533
+ "hardis:licenses:org:diagnose",
6534
+ "licenses:hardis:org:diagnose",
6535
+ "licenses:org:hardis:diagnose",
6536
+ "licenses:org:diagnose:hardis",
6537
+ "hardis:licenses:diagnose:org",
6538
+ "licenses:hardis:diagnose:org",
6539
+ "licenses:diagnose:hardis:org",
6540
+ "licenses:diagnose:org:hardis"
6521
6541
  ]
6522
6542
  },
6523
- "hardis:org:diagnose:unused-connected-apps": {
6543
+ "hardis:org:diagnose:releaseupdates": {
6524
6544
  "aliases": [],
6525
6545
  "args": {},
6526
- "description": "\n## Command Behavior\n\n**Identifies and reports on potentially unused Connected Apps in a Salesforce org, suggesting candidates for deletion or deactivation.**\n\nThis command helps improve org security and reduce technical debt by pinpointing Connected Apps that are no longer actively used. Connected Apps can pose security risks if left unmonitored, and cleaning them up contributes to a healthier Salesforce environment.\n\nKey functionalities:\n\n- **Connected App Data Collection:** Gathers information about all Connected Apps in the org, including creation and last modified dates, and associated users.\n- **Usage Analysis:** Analyzes `LoginHistory` and `OAuthToken` records to determine the last usage date of each Connected App.\n- **Inactivity Detection:** Flags Connected Apps as potentially unused if they have no recent login history or OAuth token usage.\n- **Accessibility Check:** Examines Connected App metadata to identify if they are accessible (e.g., if they require admin approval and have no profiles or permission sets assigned).\n- **Ignored Apps:** Automatically ignores a predefined list of common Salesforce Connected Apps (e.g., `Salesforce CLI`, `Salesforce Mobile Dashboards`). You can extend this list by defining the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n- **CSV Report Generation:** Generates a CSV file containing details of all analyzed Connected Apps, including their usage status, last usage date, and reasons for being flagged as potentially unused.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of potentially unused Connected Apps.\n\n**Default Ignored Connected Apps:**\n\n- Ant Migration Tool\n- Chatter Desktop\n- Chatter Mobile for BlackBerry\n- Force.com IDE\n- OIQ_Integration\n- Salesforce CLI\n- Salesforce Files\n- Salesforce Mobile Dashboards\n- Salesforce Touch\n- Salesforce for Outlook\n- SalesforceA\n- SalesforceA for Android\n- SalesforceA for iOS\n- SalesforceDX Namespace Registry\n- SalesforceIQ\n\nYou can add more ignored apps by defining a comma-separated list of names in the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n\n_Example: \nALLOWED_INACTIVE_CONNECTED_APPS=My App 1,My App 2, My App 3_\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-connected-apps/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It performs SOQL queries against `ConnectedApplication`, `LoginHistory`, and `OAuthToken` objects to gather comprehensive data about Connected Apps and their usage.\n- **Temporary SFDX Project:** It creates a temporary SFDX project to retrieve Connected App metadata, allowing for local parsing and analysis of their XML files.\n- **Metadata Parsing:** It parses the `connectedApp-meta.xml` files to check for `isAdminApproved` and the presence of `profileName` or `permissionsetName` to determine accessibility.\n- **Data Correlation:** It correlates data from various Salesforce objects to build a complete picture of each Connected App's usage and status.\n- **Date Calculation:** Uses `moment` to calculate the time since the last OAuth token usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused Connected Apps.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **File System Operations:** Uses `fs-extra` for creating and removing temporary directories and files.\n- **Environment Variable Reading:** Reads the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable to customize the list of ignored Connected Apps.\n</details>\n",
6546
+ "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6527
6547
  "examples": [
6528
- "$ sf hardis:org:diagnose:unused-connected-apps"
6548
+ "$ sf hardis:org:diagnose:releaseupdates"
6529
6549
  ],
6530
6550
  "flags": {
6531
6551
  "json": {
@@ -6589,30 +6609,13 @@
6589
6609
  },
6590
6610
  "hasDynamicHelp": true,
6591
6611
  "hiddenAliases": [],
6592
- "id": "hardis:org:diagnose:unused-connected-apps",
6612
+ "id": "hardis:org:diagnose:releaseupdates",
6593
6613
  "pluginAlias": "sfdx-hardis",
6594
6614
  "pluginName": "sfdx-hardis",
6595
6615
  "pluginType": "core",
6596
6616
  "strict": true,
6597
6617
  "enableJsonFlag": true,
6598
- "title": "Unused Connected Apps in an org",
6599
- "allowedInactiveConnectedApps": [
6600
- "Ant Migration Tool",
6601
- "Chatter Desktop",
6602
- "Chatter Mobile for BlackBerry",
6603
- "Force.com IDE",
6604
- "OIQ_Integration",
6605
- "Salesforce CLI",
6606
- "Salesforce Files",
6607
- "Salesforce Mobile Dashboards",
6608
- "Salesforce Touch",
6609
- "Salesforce for Outlook",
6610
- "SalesforceA",
6611
- "SalesforceA for Android",
6612
- "SalesforceA for iOS",
6613
- "SalesforceDX Namespace Registry",
6614
- "SalesforceIQ"
6615
- ],
6618
+ "title": "Check Release Updates of an org",
6616
6619
  "requiresProject": false,
6617
6620
  "isESM": true,
6618
6621
  "relativePath": [
@@ -6621,43 +6624,47 @@
6621
6624
  "hardis",
6622
6625
  "org",
6623
6626
  "diagnose",
6624
- "unused-connected-apps.js"
6627
+ "releaseupdates.js"
6625
6628
  ],
6626
6629
  "aliasPermutations": [],
6627
6630
  "permutations": [
6628
- "hardis:org:diagnose:unused-connected-apps",
6629
- "org:hardis:diagnose:unused-connected-apps",
6630
- "org:diagnose:hardis:unused-connected-apps",
6631
- "org:diagnose:unused-connected-apps:hardis",
6632
- "hardis:diagnose:org:unused-connected-apps",
6633
- "diagnose:hardis:org:unused-connected-apps",
6634
- "diagnose:org:hardis:unused-connected-apps",
6635
- "diagnose:org:unused-connected-apps:hardis",
6636
- "hardis:diagnose:unused-connected-apps:org",
6637
- "diagnose:hardis:unused-connected-apps:org",
6638
- "diagnose:unused-connected-apps:hardis:org",
6639
- "diagnose:unused-connected-apps:org:hardis",
6640
- "hardis:org:unused-connected-apps:diagnose",
6641
- "org:hardis:unused-connected-apps:diagnose",
6642
- "org:unused-connected-apps:hardis:diagnose",
6643
- "org:unused-connected-apps:diagnose:hardis",
6644
- "hardis:unused-connected-apps:org:diagnose",
6645
- "unused-connected-apps:hardis:org:diagnose",
6646
- "unused-connected-apps:org:hardis:diagnose",
6647
- "unused-connected-apps:org:diagnose:hardis",
6648
- "hardis:unused-connected-apps:diagnose:org",
6649
- "unused-connected-apps:hardis:diagnose:org",
6650
- "unused-connected-apps:diagnose:hardis:org",
6651
- "unused-connected-apps:diagnose:org:hardis"
6631
+ "hardis:org:diagnose:releaseupdates",
6632
+ "org:hardis:diagnose:releaseupdates",
6633
+ "org:diagnose:hardis:releaseupdates",
6634
+ "org:diagnose:releaseupdates:hardis",
6635
+ "hardis:diagnose:org:releaseupdates",
6636
+ "diagnose:hardis:org:releaseupdates",
6637
+ "diagnose:org:hardis:releaseupdates",
6638
+ "diagnose:org:releaseupdates:hardis",
6639
+ "hardis:diagnose:releaseupdates:org",
6640
+ "diagnose:hardis:releaseupdates:org",
6641
+ "diagnose:releaseupdates:hardis:org",
6642
+ "diagnose:releaseupdates:org:hardis",
6643
+ "hardis:org:releaseupdates:diagnose",
6644
+ "org:hardis:releaseupdates:diagnose",
6645
+ "org:releaseupdates:hardis:diagnose",
6646
+ "org:releaseupdates:diagnose:hardis",
6647
+ "hardis:releaseupdates:org:diagnose",
6648
+ "releaseupdates:hardis:org:diagnose",
6649
+ "releaseupdates:org:hardis:diagnose",
6650
+ "releaseupdates:org:diagnose:hardis",
6651
+ "hardis:releaseupdates:diagnose:org",
6652
+ "releaseupdates:hardis:diagnose:org",
6653
+ "releaseupdates:diagnose:hardis:org",
6654
+ "releaseupdates:diagnose:org:hardis"
6652
6655
  ]
6653
6656
  },
6654
- "hardis:org:diagnose:unusedlicenses": {
6657
+ "hardis:org:diagnose:storage-stats": {
6655
6658
  "aliases": [],
6656
6659
  "args": {},
6657
- "description": "\n## Command Behavior\n\n**Detects and suggests the deletion of unused Permission Set License Assignments in a Salesforce org.**\n\nWhen a Permission Set (PS) linked to a Permission Set License (PSL) is assigned to a user, a Permission Set License Assignment (PSLA) is automatically created. However, when that PS is unassigned from the user, the PSLA is *not* automatically deleted. This can lead to organizations being charged for unused PSLAs, representing a hidden cost and technical debt.\n\nThis command identifies such useless PSLAs and provides options to delete them, helping to optimize license usage and reduce unnecessary expenses.\n\nKey functionalities:\n\n- **PSLA Detection:** Queries the Salesforce org to find all active PSLAs.\n- **Usage Verification:** Correlates PSLAs with actual Permission Set Assignments and Permission Set Group Assignments to determine if the underlying Permission Sets are still assigned to the user.\n- **Special Case Handling:** Accounts for specific scenarios where profiles might implicitly assign PSLAs (e.g., `Salesforce API Only` profile assigning `SalesforceAPIIntegrationPsl`) and allows for always excluding certain PSLAs from the unused check.\n- **Reporting:** Generates a CSV report of all identified unused PSLAs, including the user and the associated Permission Set License.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of unused PSLAs.\n- **Interactive Deletion:** In non-CI environments, it offers an interactive prompt to bulk delete the identified unused PSLAs.\n\nMany thanks to [Vincent Finet](https://www.linkedin.com/in/vincentfinet/) for the inspiration during his great speaker session at [French Touch Dreamin '23](https://frenchtouchdreamin.com/), and his kind agreement for reusing such inspiration in this command 😊\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-licenses/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves extensive querying of Salesforce objects and data correlation:\n\n- **SOQL Queries (Bulk API):** It uses `bulkQuery` and `bulkQueryChunksIn` to efficiently retrieve large volumes of data from `PermissionSetLicenseAssign`, `PermissionSetLicense`, `PermissionSet`, `PermissionSetGroupComponent`, and `PermissionSetAssignment` objects.\n- **Data Correlation:** It meticulously correlates data across these objects to determine if a `PermissionSetLicenseAssign` record has a corresponding active assignment to a Permission Set or Permission Set Group for the same user.\n- **Filtering Logic:** It applies complex filtering logic to exclude PSLAs that are genuinely in use or are part of predefined exceptions (e.g., `alwaysExcludeForActiveUsersPermissionSetLicenses`).\n- **Bulk Deletion:** If the user opts to delete unused PSLAs, it uses `bulkUpdate` with the `delete` operation to efficiently remove multiple records.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused PSLAs.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Interaction:** Uses `prompts` for interactive confirmation before performing deletion operations.\n</details>\n",
6660
+ "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with flexible grouping options.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose breakdown fields (date fields, RecordType, custom fields, or relationship fields).\n- **Flexible Breakdown Field:** Supports grouping by any field including:\n - Date/DateTime fields (`CreatedDate`, `LastModifiedDate`, custom date fields)\n - RecordType (`RecordType.Name`)\n - Custom fields (`Status__c`, picklists, text fields)\n - Nested relationship fields (`SBQQ__Quote__r.RecordType.Name`)\n- **Date Granularity Options:** For date/datetime fields, choose between:\n - Year-based grouping (`CALENDAR_YEAR`)\n - Month-based grouping (`CALENDAR_MONTH`)\n - Day-based grouping (exact date)\n- **WHERE Clause Filtering:** Apply SOQL WHERE conditions to filter records before calculating storage (e.g., only active records, records from the last year).\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed breakdown by selected field and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects, breakdown field selection, granularity choice (for date fields), and optional WHERE conditions. All objects are pre-selected by default for user convenience.\n- **Field Validation:** Recursively validates breakdown fields including nested relationships (e.g., `SBQQ__Quote__r.RecordType.Name`) by traversing the relationship chain and checking field existence on each related object. Automatically handles special cases like `RecordType` -> `RecordTypeId` and `__r` -> `__c` conversions.\n- **Dynamic Query Generation:** Builds SOQL queries based on field type and granularity:\n - For date fields with year granularity: `SELECT CALENDAR_YEAR(<Field>) breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>) ORDER BY CALENDAR_YEAR(<Field>)`\n - For date fields with month granularity: `SELECT CALENDAR_YEAR(<Field>) year, CALENDAR_MONTH(<Field>) month, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>) ORDER BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>)`\n - For non-date fields: `SELECT <Field> breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY <Field> ORDER BY <Field>`\n- **WHERE Clause Support:** Accepts user-provided WHERE conditions via flag (`--where`) or interactive prompt. Injects the condition into all SOQL queries for consistent filtering across all objects.\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and breakdown value.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all statistics per breakdown value per object (e.g., by year, by month, by RecordType)\n - Totals summary: includes only aggregate totals per object\n - File naming includes breakdown field, granularity (for date fields), and `-filtered` suffix when WHERE clause is applied\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
6658
6661
  "examples": [
6659
- "$ sf hardis:org:diagnose:unusedlicenses",
6660
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
6662
+ "$ sf hardis:org:diagnose:storage-stats",
6663
+ "$ sf hardis:org:diagnose:storage-stats --breakdown-field \"CreatedDate\"",
6664
+ "$ sf hardis:org:diagnose:storage-stats -b \"RecordType.Name\"",
6665
+ "$ sf hardis:org:diagnose:storage-stats --where \"CreatedDate = LAST_N_DAYS:365\"",
6666
+ "$ sf hardis:org:diagnose:storage-stats -w \"Status__c = 'Active'\"",
6667
+ "$ sf hardis:org:diagnose:storage-stats -b \"LastModifiedDate\" -w \"IsDeleted = false\""
6661
6668
  ],
6662
6669
  "flags": {
6663
6670
  "json": {
@@ -6683,6 +6690,22 @@
6683
6690
  "multiple": false,
6684
6691
  "type": "option"
6685
6692
  },
6693
+ "breakdown-field": {
6694
+ "char": "b",
6695
+ "description": "Field to use for storage stats breakdown. Example: \"CreatedDate\", \"LastModifiedDate\", \"RecordType.Name\", or custom fields like \"Status__c\"",
6696
+ "name": "breakdown-field",
6697
+ "hasDynamicHelp": false,
6698
+ "multiple": false,
6699
+ "type": "option"
6700
+ },
6701
+ "where": {
6702
+ "char": "w",
6703
+ "description": "WHERE clause to filter records in the query (without the WHERE keyword). Example: \"CreatedDate = LAST_N_DAYS:365\" or \"Status__c = 'Active'\"",
6704
+ "name": "where",
6705
+ "hasDynamicHelp": false,
6706
+ "multiple": false,
6707
+ "type": "option"
6708
+ },
6686
6709
  "debug": {
6687
6710
  "char": "d",
6688
6711
  "description": "Activate debug mode (more logs)",
@@ -6720,33 +6743,15 @@
6720
6743
  }
6721
6744
  },
6722
6745
  "hasDynamicHelp": true,
6723
- "hiddenAliases": [],
6724
- "id": "hardis:org:diagnose:unusedlicenses",
6725
- "pluginAlias": "sfdx-hardis",
6726
- "pluginName": "sfdx-hardis",
6727
- "pluginType": "core",
6728
- "strict": true,
6729
- "enableJsonFlag": true,
6730
- "title": "Detect unused Permission Set Licenses (beta)",
6731
- "requiresProject": false,
6732
- "additionalPermissionSetsToAlwaysGet": [
6733
- "Sales_User"
6734
- ],
6735
- "permSetsPermSetLicenses": [
6736
- {
6737
- "permSet": "Sales_User",
6738
- "permSetLicense": "SalesUserPsl"
6739
- }
6740
- ],
6741
- "profilesPermissionSetLicenses": [
6742
- {
6743
- "profile": "Salesforce API Only",
6744
- "permSetLicense": "SalesforceAPIIntegrationPsl"
6745
- }
6746
- ],
6747
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6748
- "IdentityConnect"
6749
- ],
6746
+ "hiddenAliases": [],
6747
+ "id": "hardis:org:diagnose:storage-stats",
6748
+ "pluginAlias": "sfdx-hardis",
6749
+ "pluginName": "sfdx-hardis",
6750
+ "pluginType": "core",
6751
+ "strict": true,
6752
+ "enableJsonFlag": true,
6753
+ "title": "Extract Data Storage stats",
6754
+ "requiresProject": true,
6750
6755
  "isESM": true,
6751
6756
  "relativePath": [
6752
6757
  "lib",
@@ -6754,46 +6759,42 @@
6754
6759
  "hardis",
6755
6760
  "org",
6756
6761
  "diagnose",
6757
- "unusedlicenses.js"
6762
+ "storage-stats.js"
6758
6763
  ],
6759
6764
  "aliasPermutations": [],
6760
6765
  "permutations": [
6761
- "hardis:org:diagnose:unusedlicenses",
6762
- "org:hardis:diagnose:unusedlicenses",
6763
- "org:diagnose:hardis:unusedlicenses",
6764
- "org:diagnose:unusedlicenses:hardis",
6765
- "hardis:diagnose:org:unusedlicenses",
6766
- "diagnose:hardis:org:unusedlicenses",
6767
- "diagnose:org:hardis:unusedlicenses",
6768
- "diagnose:org:unusedlicenses:hardis",
6769
- "hardis:diagnose:unusedlicenses:org",
6770
- "diagnose:hardis:unusedlicenses:org",
6771
- "diagnose:unusedlicenses:hardis:org",
6772
- "diagnose:unusedlicenses:org:hardis",
6773
- "hardis:org:unusedlicenses:diagnose",
6774
- "org:hardis:unusedlicenses:diagnose",
6775
- "org:unusedlicenses:hardis:diagnose",
6776
- "org:unusedlicenses:diagnose:hardis",
6777
- "hardis:unusedlicenses:org:diagnose",
6778
- "unusedlicenses:hardis:org:diagnose",
6779
- "unusedlicenses:org:hardis:diagnose",
6780
- "unusedlicenses:org:diagnose:hardis",
6781
- "hardis:unusedlicenses:diagnose:org",
6782
- "unusedlicenses:hardis:diagnose:org",
6783
- "unusedlicenses:diagnose:hardis:org",
6784
- "unusedlicenses:diagnose:org:hardis"
6766
+ "hardis:org:diagnose:storage-stats",
6767
+ "org:hardis:diagnose:storage-stats",
6768
+ "org:diagnose:hardis:storage-stats",
6769
+ "org:diagnose:storage-stats:hardis",
6770
+ "hardis:diagnose:org:storage-stats",
6771
+ "diagnose:hardis:org:storage-stats",
6772
+ "diagnose:org:hardis:storage-stats",
6773
+ "diagnose:org:storage-stats:hardis",
6774
+ "hardis:diagnose:storage-stats:org",
6775
+ "diagnose:hardis:storage-stats:org",
6776
+ "diagnose:storage-stats:hardis:org",
6777
+ "diagnose:storage-stats:org:hardis",
6778
+ "hardis:org:storage-stats:diagnose",
6779
+ "org:hardis:storage-stats:diagnose",
6780
+ "org:storage-stats:hardis:diagnose",
6781
+ "org:storage-stats:diagnose:hardis",
6782
+ "hardis:storage-stats:org:diagnose",
6783
+ "storage-stats:hardis:org:diagnose",
6784
+ "storage-stats:org:hardis:diagnose",
6785
+ "storage-stats:org:diagnose:hardis",
6786
+ "hardis:storage-stats:diagnose:org",
6787
+ "storage-stats:hardis:diagnose:org",
6788
+ "storage-stats:diagnose:hardis:org",
6789
+ "storage-stats:diagnose:org:hardis"
6785
6790
  ]
6786
6791
  },
6787
- "hardis:org:diagnose:unusedusers": {
6792
+ "hardis:org:diagnose:unsecure-connected-apps": {
6788
6793
  "aliases": [],
6789
6794
  "args": {},
6790
- "description": "\n## Command Behavior\n\n**Detects and reports on inactive or unused Salesforce user accounts, helping to optimize license usage and enhance security.**\n\nEfficient user management is vital in Salesforce to ensure resources are optimized and costs are controlled. However, inactive or unused user accounts can often go unnoticed, leading to wasted licenses and potential security risks. This tool addresses this challenge by enabling administrators to identify users who haven't logged in within a specified period.\n\nBy analyzing user login activity and last login timestamps, this feature highlights inactive user accounts, allowing administrators to take appropriate action. Whether it's deactivating dormant accounts, freeing up licenses, or ensuring compliance with security policies, this functionality empowers administrators to maintain a lean and secure Salesforce environment.\n\nKey functionalities:\n\n- **Inactivity Detection:** Identifies users who have not logged in for a specified number of days (`--days` flag, default 180 days in CI, 365 days otherwise).\n- **License Type Filtering:** Allows filtering users by license type using `--licensetypes` (e.g., `all-crm`, `all-paying`) or specific license identifiers using `--licenseidentifiers`.\n - `all-crm`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT` licenses.\n - `all-paying`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT`, `PID_Customer_Community`, `PID_Customer_Community_Login`, `PID_Partner_Community`, `PID_Partner_Community_Login` licenses.\n - Note: You can see the full list of available license identifiers in [Salesforce Documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/sfdx_cli_reference/sforce_api_objects_userlicense.htm).\n- **Active User Retrieval:** The `--returnactiveusers` flag inverts the command, allowing you to retrieve active users who *have* logged in during the specified period.\n- **CSV Report Generation:** Generates a CSV file containing details of all identified users (inactive or active), including their last login date, profile, and license information.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of inactive or active users.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-inactive-users/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query (Bulk API):** It uses `bulkQuery` to efficiently retrieve user records from the Salesforce `User` object. The SOQL query dynamically constructs its WHERE clause based on the `--days`, `--licensetypes`, `--licenseidentifiers`, and `--returnactiveusers` flags.\n- **Interactive Prompts:** Uses `prompts` to interactively ask the user for the number of inactive days and license types if not provided via flags.\n- **License Mapping:** Internally maps common license type aliases (e.g., `all-crm`) to their corresponding Salesforce `LicenseDefinitionKey` values.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of users.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides a summary of the findings in the console, indicating the number of inactive or active users found.\n</details>",
6795
+ "description": "\n## Command Behavior\n\n**Detects unsecured Connected Apps in a Salesforce org and generates detailed reports for security analysis.**\n\nThis command is a critical security diagnostic tool that helps administrators identify Connected Apps that may pose security risks due to improper configuration. It provides comprehensive analysis of OAuth tokens and Connected App security settings to ensure proper access control.\n\nKey functionalities:\n\n- **OAuth Token Analysis:** Queries all OAuth tokens in the org using SOQL to retrieve comprehensive token information including app names, users, authorization status, and usage statistics.\n- **Security Status Assessment:** Evaluates each Connected App's security configuration by checking the `IsUsingAdminAuthorization` flag to determine if admin pre-approval is required.\n- **Unsecured App Detection:** Identifies Connected Apps that allow users to authorize themselves without admin approval, which can pose security risks.\n- **Detailed Reporting:** Generates two comprehensive CSV reports:\n - **OAuth Tokens Report:** Lists all OAuth tokens with security status, user information, and usage data\n - **Connected Apps Summary:** Aggregates unsecured Connected Apps with counts of associated OAuth tokens\n- **Visual Indicators:** Uses status icons (❌ for unsecured, for secured) to provide immediate visual feedback on security status.\n- **Security Recommendations:** Provides actionable guidance on how to secure Connected Apps through proper configuration.\n- **Notifications:** Sends alerts to configured channels (Grafana, Slack, MS Teams) with security findings and attached reports.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-security/) and can output Grafana, Slack and MsTeams Notifications.\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/jHv8yrSK8Dg\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query Execution:** Executes a comprehensive SOQL query on the `OauthToken` object, joining with `AppMenuItem` and `User` objects to gather complete security context.\n- **Security Analysis Logic:** Analyzes the `AppMenuItem.IsUsingAdminAuthorization` field to determine if a Connected App requires admin pre-approval for user authorization.\n- **Data Transformation:** Processes raw SOQL results to add security status indicators and reorganize data for optimal reporting and analysis.\n- **Aggregation Processing:** Groups OAuth tokens by Connected App name to provide summary statistics and identify the most problematic applications.\n- **Report Generation:** Uses `generateCsvFile` to create structured CSV reports with proper formatting and metadata for easy analysis and sharing.\n- **Notification Integration:** Integrates with the `NotifProvider` to send security alerts with detailed metrics, including the number of unsecured Connected Apps and associated OAuth tokens.\n- **File Management:** Generates multiple output formats (CSV, XLSX) and manages file paths using `generateReportPath` for consistent report organization.\n- **Connection Management:** Uses `setConnectionVariables` to ensure proper authentication context for notification providers that require org connection details.\n</details>\n",
6791
6796
  "examples": [
6792
- "$ sf hardis:org:diagnose:unusedusers",
6793
- "$ sf hardis:org:diagnose:unusedusers --days 365",
6794
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6795
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6796
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6797
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6797
6798
  ],
6798
6799
  "flags": {
6799
6800
  "json": {
@@ -6819,41 +6820,6 @@
6819
6820
  "multiple": false,
6820
6821
  "type": "option"
6821
6822
  },
6822
- "days": {
6823
- "char": "t",
6824
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6825
- "name": "days",
6826
- "hasDynamicHelp": false,
6827
- "multiple": false,
6828
- "type": "option"
6829
- },
6830
- "licensetypes": {
6831
- "char": "l",
6832
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6833
- "name": "licensetypes",
6834
- "hasDynamicHelp": false,
6835
- "multiple": false,
6836
- "options": [
6837
- "all",
6838
- "all-crm",
6839
- "all-paying"
6840
- ],
6841
- "type": "option"
6842
- },
6843
- "licenseidentifiers": {
6844
- "char": "i",
6845
- "description": "Comma-separated list of license identifiers, in case licensetypes is not used.. Identifiers available at https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_userlicense.htm",
6846
- "name": "licenseidentifiers",
6847
- "hasDynamicHelp": false,
6848
- "multiple": false,
6849
- "type": "option"
6850
- },
6851
- "returnactiveusers": {
6852
- "description": "Inverts the command by returning the active users",
6853
- "name": "returnactiveusers",
6854
- "allowNo": false,
6855
- "type": "boolean"
6856
- },
6857
6823
  "debug": {
6858
6824
  "char": "d",
6859
6825
  "description": "Activate debug mode (more logs)",
@@ -6892,13 +6858,13 @@
6892
6858
  },
6893
6859
  "hasDynamicHelp": true,
6894
6860
  "hiddenAliases": [],
6895
- "id": "hardis:org:diagnose:unusedusers",
6861
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
6896
6862
  "pluginAlias": "sfdx-hardis",
6897
6863
  "pluginName": "sfdx-hardis",
6898
6864
  "pluginType": "core",
6899
6865
  "strict": true,
6900
6866
  "enableJsonFlag": true,
6901
- "title": "Detect unused Users in Salesforce",
6867
+ "title": "Detect Unsecured Connected Apps",
6902
6868
  "requiresProject": false,
6903
6869
  "isESM": true,
6904
6870
  "relativePath": [
@@ -6907,42 +6873,43 @@
6907
6873
  "hardis",
6908
6874
  "org",
6909
6875
  "diagnose",
6910
- "unusedusers.js"
6876
+ "unsecure-connected-apps.js"
6911
6877
  ],
6912
6878
  "aliasPermutations": [],
6913
6879
  "permutations": [
6914
- "hardis:org:diagnose:unusedusers",
6915
- "org:hardis:diagnose:unusedusers",
6916
- "org:diagnose:hardis:unusedusers",
6917
- "org:diagnose:unusedusers:hardis",
6918
- "hardis:diagnose:org:unusedusers",
6919
- "diagnose:hardis:org:unusedusers",
6920
- "diagnose:org:hardis:unusedusers",
6921
- "diagnose:org:unusedusers:hardis",
6922
- "hardis:diagnose:unusedusers:org",
6923
- "diagnose:hardis:unusedusers:org",
6924
- "diagnose:unusedusers:hardis:org",
6925
- "diagnose:unusedusers:org:hardis",
6926
- "hardis:org:unusedusers:diagnose",
6927
- "org:hardis:unusedusers:diagnose",
6928
- "org:unusedusers:hardis:diagnose",
6929
- "org:unusedusers:diagnose:hardis",
6930
- "hardis:unusedusers:org:diagnose",
6931
- "unusedusers:hardis:org:diagnose",
6932
- "unusedusers:org:hardis:diagnose",
6933
- "unusedusers:org:diagnose:hardis",
6934
- "hardis:unusedusers:diagnose:org",
6935
- "unusedusers:hardis:diagnose:org",
6936
- "unusedusers:diagnose:hardis:org",
6937
- "unusedusers:diagnose:org:hardis"
6880
+ "hardis:org:diagnose:unsecure-connected-apps",
6881
+ "org:hardis:diagnose:unsecure-connected-apps",
6882
+ "org:diagnose:hardis:unsecure-connected-apps",
6883
+ "org:diagnose:unsecure-connected-apps:hardis",
6884
+ "hardis:diagnose:org:unsecure-connected-apps",
6885
+ "diagnose:hardis:org:unsecure-connected-apps",
6886
+ "diagnose:org:hardis:unsecure-connected-apps",
6887
+ "diagnose:org:unsecure-connected-apps:hardis",
6888
+ "hardis:diagnose:unsecure-connected-apps:org",
6889
+ "diagnose:hardis:unsecure-connected-apps:org",
6890
+ "diagnose:unsecure-connected-apps:hardis:org",
6891
+ "diagnose:unsecure-connected-apps:org:hardis",
6892
+ "hardis:org:unsecure-connected-apps:diagnose",
6893
+ "org:hardis:unsecure-connected-apps:diagnose",
6894
+ "org:unsecure-connected-apps:hardis:diagnose",
6895
+ "org:unsecure-connected-apps:diagnose:hardis",
6896
+ "hardis:unsecure-connected-apps:org:diagnose",
6897
+ "unsecure-connected-apps:hardis:org:diagnose",
6898
+ "unsecure-connected-apps:org:hardis:diagnose",
6899
+ "unsecure-connected-apps:org:diagnose:hardis",
6900
+ "hardis:unsecure-connected-apps:diagnose:org",
6901
+ "unsecure-connected-apps:hardis:diagnose:org",
6902
+ "unsecure-connected-apps:diagnose:hardis:org",
6903
+ "unsecure-connected-apps:diagnose:org:hardis"
6938
6904
  ]
6939
6905
  },
6940
- "hardis:org:files:export": {
6906
+ "hardis:org:diagnose:unused-apex-classes": {
6941
6907
  "aliases": [],
6942
6908
  "args": {},
6943
- "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
6909
+ "description": "List all async Apex classes (Batch,Queueable,Schedulable) that has not been called for more than 365 days.\n \nThe result class list probably can be removed from the project, and that will improve your test classes performances 😊\n\nThe number of unused day is overridable using --days option. \n\nThe command uses queries on AsyncApexJob and CronTrigger technical tables to build the result.\n\nApex Classes CreatedBy and CreatedOn fields are calculated from MIN(date from git, date from org)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-apex-classes/) and can output Grafana, Slack and MsTeams Notifications.\n\n![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-monitoring-unused-apex-grafana.jpg)\n",
6944
6910
  "examples": [
6945
- "$ sf hardis:org:files:export"
6911
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6912
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6946
6913
  ],
6947
6914
  "flags": {
6948
6915
  "json": {
@@ -6960,48 +6927,22 @@
6960
6927
  "multiple": false,
6961
6928
  "type": "option"
6962
6929
  },
6963
- "path": {
6964
- "char": "p",
6965
- "description": "Path to the file export project",
6966
- "name": "path",
6967
- "hasDynamicHelp": false,
6968
- "multiple": false,
6969
- "type": "option"
6970
- },
6971
- "chunksize": {
6972
- "char": "c",
6973
- "description": "Number of records to add in a chunk before it is processed",
6974
- "name": "chunksize",
6975
- "default": 1000,
6930
+ "outputfile": {
6931
+ "char": "f",
6932
+ "description": "Force the path and name of output report file. Must end with .csv",
6933
+ "name": "outputfile",
6976
6934
  "hasDynamicHelp": false,
6977
6935
  "multiple": false,
6978
6936
  "type": "option"
6979
6937
  },
6980
- "polltimeout": {
6938
+ "days": {
6981
6939
  "char": "t",
6982
- "description": "Timeout in MS for Bulk API calls",
6983
- "name": "polltimeout",
6984
- "default": 300000,
6985
- "hasDynamicHelp": false,
6986
- "multiple": false,
6987
- "type": "option"
6988
- },
6989
- "startchunknumber": {
6990
- "char": "s",
6991
- "description": "Chunk number to start from",
6992
- "name": "startchunknumber",
6993
- "default": 0,
6940
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6941
+ "name": "days",
6994
6942
  "hasDynamicHelp": false,
6995
6943
  "multiple": false,
6996
6944
  "type": "option"
6997
6945
  },
6998
- "resume": {
6999
- "char": "r",
7000
- "description": "Resume previous export by checking existing files (default in CI)",
7001
- "name": "resume",
7002
- "allowNo": false,
7003
- "type": "boolean"
7004
- },
7005
6946
  "debug": {
7006
6947
  "char": "d",
7007
6948
  "description": "Activate debug mode (more logs)",
@@ -7040,13 +6981,13 @@
7040
6981
  },
7041
6982
  "hasDynamicHelp": true,
7042
6983
  "hiddenAliases": [],
7043
- "id": "hardis:org:files:export",
6984
+ "id": "hardis:org:diagnose:unused-apex-classes",
7044
6985
  "pluginAlias": "sfdx-hardis",
7045
6986
  "pluginName": "sfdx-hardis",
7046
6987
  "pluginType": "core",
7047
6988
  "strict": true,
7048
6989
  "enableJsonFlag": true,
7049
- "title": "Export files",
6990
+ "title": "Detect unused Apex classes in an org",
7050
6991
  "requiresProject": false,
7051
6992
  "isESM": true,
7052
6993
  "relativePath": [
@@ -7054,43 +6995,43 @@
7054
6995
  "commands",
7055
6996
  "hardis",
7056
6997
  "org",
7057
- "files",
7058
- "export.js"
6998
+ "diagnose",
6999
+ "unused-apex-classes.js"
7059
7000
  ],
7060
7001
  "aliasPermutations": [],
7061
7002
  "permutations": [
7062
- "hardis:org:files:export",
7063
- "org:hardis:files:export",
7064
- "org:files:hardis:export",
7065
- "org:files:export:hardis",
7066
- "hardis:files:org:export",
7067
- "files:hardis:org:export",
7068
- "files:org:hardis:export",
7069
- "files:org:export:hardis",
7070
- "hardis:files:export:org",
7071
- "files:hardis:export:org",
7072
- "files:export:hardis:org",
7073
- "files:export:org:hardis",
7074
- "hardis:org:export:files",
7075
- "org:hardis:export:files",
7076
- "org:export:hardis:files",
7077
- "org:export:files:hardis",
7078
- "hardis:export:org:files",
7079
- "export:hardis:org:files",
7080
- "export:org:hardis:files",
7081
- "export:org:files:hardis",
7082
- "hardis:export:files:org",
7083
- "export:hardis:files:org",
7084
- "export:files:hardis:org",
7085
- "export:files:org:hardis"
7003
+ "hardis:org:diagnose:unused-apex-classes",
7004
+ "org:hardis:diagnose:unused-apex-classes",
7005
+ "org:diagnose:hardis:unused-apex-classes",
7006
+ "org:diagnose:unused-apex-classes:hardis",
7007
+ "hardis:diagnose:org:unused-apex-classes",
7008
+ "diagnose:hardis:org:unused-apex-classes",
7009
+ "diagnose:org:hardis:unused-apex-classes",
7010
+ "diagnose:org:unused-apex-classes:hardis",
7011
+ "hardis:diagnose:unused-apex-classes:org",
7012
+ "diagnose:hardis:unused-apex-classes:org",
7013
+ "diagnose:unused-apex-classes:hardis:org",
7014
+ "diagnose:unused-apex-classes:org:hardis",
7015
+ "hardis:org:unused-apex-classes:diagnose",
7016
+ "org:hardis:unused-apex-classes:diagnose",
7017
+ "org:unused-apex-classes:hardis:diagnose",
7018
+ "org:unused-apex-classes:diagnose:hardis",
7019
+ "hardis:unused-apex-classes:org:diagnose",
7020
+ "unused-apex-classes:hardis:org:diagnose",
7021
+ "unused-apex-classes:org:hardis:diagnose",
7022
+ "unused-apex-classes:org:diagnose:hardis",
7023
+ "hardis:unused-apex-classes:diagnose:org",
7024
+ "unused-apex-classes:hardis:diagnose:org",
7025
+ "unused-apex-classes:diagnose:hardis:org",
7026
+ "unused-apex-classes:diagnose:org:hardis"
7086
7027
  ]
7087
7028
  },
7088
- "hardis:org:files:import": {
7029
+ "hardis:org:diagnose:unused-connected-apps": {
7089
7030
  "aliases": [],
7090
7031
  "args": {},
7091
- "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
7032
+ "description": "\n## Command Behavior\n\n**Identifies and reports on potentially unused Connected Apps in a Salesforce org, suggesting candidates for deletion or deactivation.**\n\nThis command helps improve org security and reduce technical debt by pinpointing Connected Apps that are no longer actively used. Connected Apps can pose security risks if left unmonitored, and cleaning them up contributes to a healthier Salesforce environment.\n\nKey functionalities:\n\n- **Connected App Data Collection:** Gathers information about all Connected Apps in the org, including creation and last modified dates, and associated users.\n- **Usage Analysis:** Analyzes `LoginHistory` and `OAuthToken` records to determine the last usage date of each Connected App.\n- **Inactivity Detection:** Flags Connected Apps as potentially unused if they have no recent login history or OAuth token usage.\n- **Accessibility Check:** Examines Connected App metadata to identify if they are accessible (e.g., if they require admin approval and have no profiles or permission sets assigned).\n- **Ignored Apps:** Automatically ignores a predefined list of common Salesforce Connected Apps (e.g., `Salesforce CLI`, `Salesforce Mobile Dashboards`). You can extend this list by defining the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n- **CSV Report Generation:** Generates a CSV file containing details of all analyzed Connected Apps, including their usage status, last usage date, and reasons for being flagged as potentially unused.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of potentially unused Connected Apps.\n\n**Default Ignored Connected Apps:**\n\n- Ant Migration Tool\n- Chatter Desktop\n- Chatter Mobile for BlackBerry\n- Force.com IDE\n- OIQ_Integration\n- Salesforce CLI\n- Salesforce Files\n- Salesforce Mobile Dashboards\n- Salesforce Touch\n- Salesforce for Outlook\n- SalesforceA\n- SalesforceA for Android\n- SalesforceA for iOS\n- SalesforceDX Namespace Registry\n- SalesforceIQ\n\nYou can add more ignored apps by defining a comma-separated list of names in the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n\n_Example: \nALLOWED_INACTIVE_CONNECTED_APPS=My App 1,My App 2, My App 3_\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-connected-apps/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It performs SOQL queries against `ConnectedApplication`, `LoginHistory`, and `OAuthToken` objects to gather comprehensive data about Connected Apps and their usage.\n- **Temporary SFDX Project:** It creates a temporary SFDX project to retrieve Connected App metadata, allowing for local parsing and analysis of their XML files.\n- **Metadata Parsing:** It parses the `connectedApp-meta.xml` files to check for `isAdminApproved` and the presence of `profileName` or `permissionsetName` to determine accessibility.\n- **Data Correlation:** It correlates data from various Salesforce objects to build a complete picture of each Connected App's usage and status.\n- **Date Calculation:** Uses `moment` to calculate the time since the last OAuth token usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused Connected Apps.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **File System Operations:** Uses `fs-extra` for creating and removing temporary directories and files.\n- **Environment Variable Reading:** Reads the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable to customize the list of ignored Connected Apps.\n</details>\n",
7092
7033
  "examples": [
7093
- "$ sf hardis:org:files:import"
7034
+ "$ sf hardis:org:diagnose:unused-connected-apps"
7094
7035
  ],
7095
7036
  "flags": {
7096
7037
  "json": {
@@ -7108,21 +7049,14 @@
7108
7049
  "multiple": false,
7109
7050
  "type": "option"
7110
7051
  },
7111
- "path": {
7112
- "char": "p",
7113
- "description": "Path to the file export project",
7114
- "name": "path",
7052
+ "outputfile": {
7053
+ "char": "f",
7054
+ "description": "Force the path and name of output report file. Must end with .csv",
7055
+ "name": "outputfile",
7115
7056
  "hasDynamicHelp": false,
7116
7057
  "multiple": false,
7117
7058
  "type": "option"
7118
7059
  },
7119
- "overwrite": {
7120
- "char": "f",
7121
- "description": "Override existing files (doubles the number of API calls)",
7122
- "name": "overwrite",
7123
- "allowNo": false,
7124
- "type": "boolean"
7125
- },
7126
7060
  "debug": {
7127
7061
  "char": "d",
7128
7062
  "description": "Activate debug mode (more logs)",
@@ -7161,13 +7095,30 @@
7161
7095
  },
7162
7096
  "hasDynamicHelp": true,
7163
7097
  "hiddenAliases": [],
7164
- "id": "hardis:org:files:import",
7098
+ "id": "hardis:org:diagnose:unused-connected-apps",
7165
7099
  "pluginAlias": "sfdx-hardis",
7166
7100
  "pluginName": "sfdx-hardis",
7167
7101
  "pluginType": "core",
7168
7102
  "strict": true,
7169
7103
  "enableJsonFlag": true,
7170
- "title": "Import files",
7104
+ "title": "Unused Connected Apps in an org",
7105
+ "allowedInactiveConnectedApps": [
7106
+ "Ant Migration Tool",
7107
+ "Chatter Desktop",
7108
+ "Chatter Mobile for BlackBerry",
7109
+ "Force.com IDE",
7110
+ "OIQ_Integration",
7111
+ "Salesforce CLI",
7112
+ "Salesforce Files",
7113
+ "Salesforce Mobile Dashboards",
7114
+ "Salesforce Touch",
7115
+ "Salesforce for Outlook",
7116
+ "SalesforceA",
7117
+ "SalesforceA for Android",
7118
+ "SalesforceA for iOS",
7119
+ "SalesforceDX Namespace Registry",
7120
+ "SalesforceIQ"
7121
+ ],
7171
7122
  "requiresProject": false,
7172
7123
  "isESM": true,
7173
7124
  "relativePath": [
@@ -7175,44 +7126,44 @@
7175
7126
  "commands",
7176
7127
  "hardis",
7177
7128
  "org",
7178
- "files",
7179
- "import.js"
7129
+ "diagnose",
7130
+ "unused-connected-apps.js"
7180
7131
  ],
7181
7132
  "aliasPermutations": [],
7182
7133
  "permutations": [
7183
- "hardis:org:files:import",
7184
- "org:hardis:files:import",
7185
- "org:files:hardis:import",
7186
- "org:files:import:hardis",
7187
- "hardis:files:org:import",
7188
- "files:hardis:org:import",
7189
- "files:org:hardis:import",
7190
- "files:org:import:hardis",
7191
- "hardis:files:import:org",
7192
- "files:hardis:import:org",
7193
- "files:import:hardis:org",
7194
- "files:import:org:hardis",
7195
- "hardis:org:import:files",
7196
- "org:hardis:import:files",
7197
- "org:import:hardis:files",
7198
- "org:import:files:hardis",
7199
- "hardis:import:org:files",
7200
- "import:hardis:org:files",
7201
- "import:org:hardis:files",
7202
- "import:org:files:hardis",
7203
- "hardis:import:files:org",
7204
- "import:hardis:files:org",
7205
- "import:files:hardis:org",
7206
- "import:files:org:hardis"
7134
+ "hardis:org:diagnose:unused-connected-apps",
7135
+ "org:hardis:diagnose:unused-connected-apps",
7136
+ "org:diagnose:hardis:unused-connected-apps",
7137
+ "org:diagnose:unused-connected-apps:hardis",
7138
+ "hardis:diagnose:org:unused-connected-apps",
7139
+ "diagnose:hardis:org:unused-connected-apps",
7140
+ "diagnose:org:hardis:unused-connected-apps",
7141
+ "diagnose:org:unused-connected-apps:hardis",
7142
+ "hardis:diagnose:unused-connected-apps:org",
7143
+ "diagnose:hardis:unused-connected-apps:org",
7144
+ "diagnose:unused-connected-apps:hardis:org",
7145
+ "diagnose:unused-connected-apps:org:hardis",
7146
+ "hardis:org:unused-connected-apps:diagnose",
7147
+ "org:hardis:unused-connected-apps:diagnose",
7148
+ "org:unused-connected-apps:hardis:diagnose",
7149
+ "org:unused-connected-apps:diagnose:hardis",
7150
+ "hardis:unused-connected-apps:org:diagnose",
7151
+ "unused-connected-apps:hardis:org:diagnose",
7152
+ "unused-connected-apps:org:hardis:diagnose",
7153
+ "unused-connected-apps:org:diagnose:hardis",
7154
+ "hardis:unused-connected-apps:diagnose:org",
7155
+ "unused-connected-apps:hardis:diagnose:org",
7156
+ "unused-connected-apps:diagnose:hardis:org",
7157
+ "unused-connected-apps:diagnose:org:hardis"
7207
7158
  ]
7208
7159
  },
7209
- "hardis:org:fix:listviewmine": {
7160
+ "hardis:org:diagnose:unusedlicenses": {
7210
7161
  "aliases": [],
7211
7162
  "args": {},
7212
- "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
7163
+ "description": "\n## Command Behavior\n\n**Detects and suggests the deletion of unused Permission Set License Assignments in a Salesforce org.**\n\nWhen a Permission Set (PS) linked to a Permission Set License (PSL) is assigned to a user, a Permission Set License Assignment (PSLA) is automatically created. However, when that PS is unassigned from the user, the PSLA is *not* automatically deleted. This can lead to organizations being charged for unused PSLAs, representing a hidden cost and technical debt.\n\nThis command identifies such useless PSLAs and provides options to delete them, helping to optimize license usage and reduce unnecessary expenses.\n\nKey functionalities:\n\n- **PSLA Detection:** Queries the Salesforce org to find all active PSLAs.\n- **Usage Verification:** Correlates PSLAs with actual Permission Set Assignments and Permission Set Group Assignments to determine if the underlying Permission Sets are still assigned to the user.\n- **Special Case Handling:** Accounts for specific scenarios where profiles might implicitly assign PSLAs (e.g., `Salesforce API Only` profile assigning `SalesforceAPIIntegrationPsl`) and allows for always excluding certain PSLAs from the unused check.\n- **Reporting:** Generates a CSV report of all identified unused PSLAs, including the user and the associated Permission Set License.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of unused PSLAs.\n- **Interactive Deletion:** In non-CI environments, it offers an interactive prompt to bulk delete the identified unused PSLAs.\n\nMany thanks to [Vincent Finet](https://www.linkedin.com/in/vincentfinet/) for the inspiration during his great speaker session at [French Touch Dreamin '23](https://frenchtouchdreamin.com/), and his kind agreement for reusing such inspiration in this command 😊\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-licenses/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves extensive querying of Salesforce objects and data correlation:\n\n- **SOQL Queries (Bulk API):** It uses `bulkQuery` and `bulkQueryChunksIn` to efficiently retrieve large volumes of data from `PermissionSetLicenseAssign`, `PermissionSetLicense`, `PermissionSet`, `PermissionSetGroupComponent`, and `PermissionSetAssignment` objects.\n- **Data Correlation:** It meticulously correlates data across these objects to determine if a `PermissionSetLicenseAssign` record has a corresponding active assignment to a Permission Set or Permission Set Group for the same user.\n- **Filtering Logic:** It applies complex filtering logic to exclude PSLAs that are genuinely in use or are part of predefined exceptions (e.g., `alwaysExcludeForActiveUsersPermissionSetLicenses`).\n- **Bulk Deletion:** If the user opts to delete unused PSLAs, it uses `bulkUpdate` with the `delete` operation to efficiently remove multiple records.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused PSLAs.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Interaction:** Uses `prompts` for interactive confirmation before performing deletion operations.\n</details>\n",
7213
7164
  "examples": [
7214
- "$ sf hardis:org:fix:listviewmine",
7215
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
7165
+ "$ sf hardis:org:diagnose:unusedlicenses",
7166
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
7216
7167
  ],
7217
7168
  "flags": {
7218
7169
  "json": {
@@ -7230,10 +7181,10 @@
7230
7181
  "multiple": false,
7231
7182
  "type": "option"
7232
7183
  },
7233
- "listviews": {
7234
- "char": "l",
7235
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
7236
- "name": "listviews",
7184
+ "outputfile": {
7185
+ "char": "f",
7186
+ "description": "Force the path and name of output report file. Must end with .csv",
7187
+ "name": "outputfile",
7237
7188
  "hasDynamicHelp": false,
7238
7189
  "multiple": false,
7239
7190
  "type": "option"
@@ -7276,59 +7227,79 @@
7276
7227
  },
7277
7228
  "hasDynamicHelp": true,
7278
7229
  "hiddenAliases": [],
7279
- "id": "hardis:org:fix:listviewmine",
7230
+ "id": "hardis:org:diagnose:unusedlicenses",
7280
7231
  "pluginAlias": "sfdx-hardis",
7281
7232
  "pluginName": "sfdx-hardis",
7282
7233
  "pluginType": "core",
7283
7234
  "strict": true,
7284
7235
  "enableJsonFlag": true,
7285
- "title": "Fix listviews with ",
7286
- "requiresProject": true,
7236
+ "title": "Detect unused Permission Set Licenses (beta)",
7237
+ "requiresProject": false,
7238
+ "additionalPermissionSetsToAlwaysGet": [
7239
+ "Sales_User"
7240
+ ],
7241
+ "permSetsPermSetLicenses": [
7242
+ {
7243
+ "permSet": "Sales_User",
7244
+ "permSetLicense": "SalesUserPsl"
7245
+ }
7246
+ ],
7247
+ "profilesPermissionSetLicenses": [
7248
+ {
7249
+ "profile": "Salesforce API Only",
7250
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
7251
+ }
7252
+ ],
7253
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
7254
+ "IdentityConnect"
7255
+ ],
7287
7256
  "isESM": true,
7288
7257
  "relativePath": [
7289
7258
  "lib",
7290
7259
  "commands",
7291
7260
  "hardis",
7292
7261
  "org",
7293
- "fix",
7294
- "listviewmine.js"
7262
+ "diagnose",
7263
+ "unusedlicenses.js"
7295
7264
  ],
7296
7265
  "aliasPermutations": [],
7297
7266
  "permutations": [
7298
- "hardis:org:fix:listviewmine",
7299
- "org:hardis:fix:listviewmine",
7300
- "org:fix:hardis:listviewmine",
7301
- "org:fix:listviewmine:hardis",
7302
- "hardis:fix:org:listviewmine",
7303
- "fix:hardis:org:listviewmine",
7304
- "fix:org:hardis:listviewmine",
7305
- "fix:org:listviewmine:hardis",
7306
- "hardis:fix:listviewmine:org",
7307
- "fix:hardis:listviewmine:org",
7308
- "fix:listviewmine:hardis:org",
7309
- "fix:listviewmine:org:hardis",
7310
- "hardis:org:listviewmine:fix",
7311
- "org:hardis:listviewmine:fix",
7312
- "org:listviewmine:hardis:fix",
7313
- "org:listviewmine:fix:hardis",
7314
- "hardis:listviewmine:org:fix",
7315
- "listviewmine:hardis:org:fix",
7316
- "listviewmine:org:hardis:fix",
7317
- "listviewmine:org:fix:hardis",
7318
- "hardis:listviewmine:fix:org",
7319
- "listviewmine:hardis:fix:org",
7320
- "listviewmine:fix:hardis:org",
7321
- "listviewmine:fix:org:hardis"
7267
+ "hardis:org:diagnose:unusedlicenses",
7268
+ "org:hardis:diagnose:unusedlicenses",
7269
+ "org:diagnose:hardis:unusedlicenses",
7270
+ "org:diagnose:unusedlicenses:hardis",
7271
+ "hardis:diagnose:org:unusedlicenses",
7272
+ "diagnose:hardis:org:unusedlicenses",
7273
+ "diagnose:org:hardis:unusedlicenses",
7274
+ "diagnose:org:unusedlicenses:hardis",
7275
+ "hardis:diagnose:unusedlicenses:org",
7276
+ "diagnose:hardis:unusedlicenses:org",
7277
+ "diagnose:unusedlicenses:hardis:org",
7278
+ "diagnose:unusedlicenses:org:hardis",
7279
+ "hardis:org:unusedlicenses:diagnose",
7280
+ "org:hardis:unusedlicenses:diagnose",
7281
+ "org:unusedlicenses:hardis:diagnose",
7282
+ "org:unusedlicenses:diagnose:hardis",
7283
+ "hardis:unusedlicenses:org:diagnose",
7284
+ "unusedlicenses:hardis:org:diagnose",
7285
+ "unusedlicenses:org:hardis:diagnose",
7286
+ "unusedlicenses:org:diagnose:hardis",
7287
+ "hardis:unusedlicenses:diagnose:org",
7288
+ "unusedlicenses:hardis:diagnose:org",
7289
+ "unusedlicenses:diagnose:hardis:org",
7290
+ "unusedlicenses:diagnose:org:hardis"
7322
7291
  ]
7323
7292
  },
7324
- "hardis:org:generate:packagexmlfull": {
7293
+ "hardis:org:diagnose:unusedusers": {
7325
7294
  "aliases": [],
7326
7295
  "args": {},
7327
- "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
7296
+ "description": "\n## Command Behavior\n\n**Detects and reports on inactive or unused Salesforce user accounts, helping to optimize license usage and enhance security.**\n\nEfficient user management is vital in Salesforce to ensure resources are optimized and costs are controlled. However, inactive or unused user accounts can often go unnoticed, leading to wasted licenses and potential security risks. This tool addresses this challenge by enabling administrators to identify users who haven't logged in within a specified period.\n\nBy analyzing user login activity and last login timestamps, this feature highlights inactive user accounts, allowing administrators to take appropriate action. Whether it's deactivating dormant accounts, freeing up licenses, or ensuring compliance with security policies, this functionality empowers administrators to maintain a lean and secure Salesforce environment.\n\nKey functionalities:\n\n- **Inactivity Detection:** Identifies users who have not logged in for a specified number of days (`--days` flag, default 180 days in CI, 365 days otherwise).\n- **License Type Filtering:** Allows filtering users by license type using `--licensetypes` (e.g., `all-crm`, `all-paying`) or specific license identifiers using `--licenseidentifiers`.\n - `all-crm`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT` licenses.\n - `all-paying`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT`, `PID_Customer_Community`, `PID_Customer_Community_Login`, `PID_Partner_Community`, `PID_Partner_Community_Login` licenses.\n - Note: You can see the full list of available license identifiers in [Salesforce Documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/sfdx_cli_reference/sforce_api_objects_userlicense.htm).\n- **Active User Retrieval:** The `--returnactiveusers` flag inverts the command, allowing you to retrieve active users who *have* logged in during the specified period.\n- **CSV Report Generation:** Generates a CSV file containing details of all identified users (inactive or active), including their last login date, profile, and license information.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of inactive or active users.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-inactive-users/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query (Bulk API):** It uses `bulkQuery` to efficiently retrieve user records from the Salesforce `User` object. The SOQL query dynamically constructs its WHERE clause based on the `--days`, `--licensetypes`, `--licenseidentifiers`, and `--returnactiveusers` flags.\n- **Interactive Prompts:** Uses `prompts` to interactively ask the user for the number of inactive days and license types if not provided via flags.\n- **License Mapping:** Internally maps common license type aliases (e.g., `all-crm`) to their corresponding Salesforce `LicenseDefinitionKey` values.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of users.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides a summary of the findings in the console, indicating the number of inactive or active users found.\n</details>",
7328
7297
  "examples": [
7329
- "$ sf hardis:org:generate:packagexmlfull",
7330
- "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
7331
- "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
7298
+ "$ sf hardis:org:diagnose:unusedusers",
7299
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
7300
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7301
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7302
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7332
7303
  ],
7333
7304
  "flags": {
7334
7305
  "json": {
@@ -7347,12 +7318,48 @@
7347
7318
  "type": "option"
7348
7319
  },
7349
7320
  "outputfile": {
7350
- "description": "Output package.xml file",
7321
+ "char": "f",
7322
+ "description": "Force the path and name of output report file. Must end with .csv",
7351
7323
  "name": "outputfile",
7352
7324
  "hasDynamicHelp": false,
7353
7325
  "multiple": false,
7354
7326
  "type": "option"
7355
7327
  },
7328
+ "days": {
7329
+ "char": "t",
7330
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7331
+ "name": "days",
7332
+ "hasDynamicHelp": false,
7333
+ "multiple": false,
7334
+ "type": "option"
7335
+ },
7336
+ "licensetypes": {
7337
+ "char": "l",
7338
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7339
+ "name": "licensetypes",
7340
+ "hasDynamicHelp": false,
7341
+ "multiple": false,
7342
+ "options": [
7343
+ "all",
7344
+ "all-crm",
7345
+ "all-paying"
7346
+ ],
7347
+ "type": "option"
7348
+ },
7349
+ "licenseidentifiers": {
7350
+ "char": "i",
7351
+ "description": "Comma-separated list of license identifiers, in case licensetypes is not used.. Identifiers available at https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_userlicense.htm",
7352
+ "name": "licenseidentifiers",
7353
+ "hasDynamicHelp": false,
7354
+ "multiple": false,
7355
+ "type": "option"
7356
+ },
7357
+ "returnactiveusers": {
7358
+ "description": "Inverts the command by returning the active users",
7359
+ "name": "returnactiveusers",
7360
+ "allowNo": false,
7361
+ "type": "boolean"
7362
+ },
7356
7363
  "debug": {
7357
7364
  "char": "d",
7358
7365
  "description": "Activate debug mode (more logs)",
@@ -7360,13 +7367,6 @@
7360
7367
  "allowNo": false,
7361
7368
  "type": "boolean"
7362
7369
  },
7363
- "no-prompt": {
7364
- "char": "n",
7365
- "description": "Do not prompt for org username, use the default one",
7366
- "name": "no-prompt",
7367
- "allowNo": false,
7368
- "type": "boolean"
7369
- },
7370
7370
  "websocket": {
7371
7371
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
7372
7372
  "name": "websocket",
@@ -7398,13 +7398,13 @@
7398
7398
  },
7399
7399
  "hasDynamicHelp": true,
7400
7400
  "hiddenAliases": [],
7401
- "id": "hardis:org:generate:packagexmlfull",
7401
+ "id": "hardis:org:diagnose:unusedusers",
7402
7402
  "pluginAlias": "sfdx-hardis",
7403
7403
  "pluginName": "sfdx-hardis",
7404
7404
  "pluginType": "core",
7405
7405
  "strict": true,
7406
7406
  "enableJsonFlag": true,
7407
- "title": "Generate Full Org package.xml",
7407
+ "title": "Detect unused Users in Salesforce",
7408
7408
  "requiresProject": false,
7409
7409
  "isESM": true,
7410
7410
  "relativePath": [
@@ -7412,35 +7412,35 @@
7412
7412
  "commands",
7413
7413
  "hardis",
7414
7414
  "org",
7415
- "generate",
7416
- "packagexmlfull.js"
7415
+ "diagnose",
7416
+ "unusedusers.js"
7417
7417
  ],
7418
7418
  "aliasPermutations": [],
7419
7419
  "permutations": [
7420
- "hardis:org:generate:packagexmlfull",
7421
- "org:hardis:generate:packagexmlfull",
7422
- "org:generate:hardis:packagexmlfull",
7423
- "org:generate:packagexmlfull:hardis",
7424
- "hardis:generate:org:packagexmlfull",
7425
- "generate:hardis:org:packagexmlfull",
7426
- "generate:org:hardis:packagexmlfull",
7427
- "generate:org:packagexmlfull:hardis",
7428
- "hardis:generate:packagexmlfull:org",
7429
- "generate:hardis:packagexmlfull:org",
7430
- "generate:packagexmlfull:hardis:org",
7431
- "generate:packagexmlfull:org:hardis",
7432
- "hardis:org:packagexmlfull:generate",
7433
- "org:hardis:packagexmlfull:generate",
7434
- "org:packagexmlfull:hardis:generate",
7435
- "org:packagexmlfull:generate:hardis",
7436
- "hardis:packagexmlfull:org:generate",
7437
- "packagexmlfull:hardis:org:generate",
7438
- "packagexmlfull:org:hardis:generate",
7439
- "packagexmlfull:org:generate:hardis",
7440
- "hardis:packagexmlfull:generate:org",
7441
- "packagexmlfull:hardis:generate:org",
7442
- "packagexmlfull:generate:hardis:org",
7443
- "packagexmlfull:generate:org:hardis"
7420
+ "hardis:org:diagnose:unusedusers",
7421
+ "org:hardis:diagnose:unusedusers",
7422
+ "org:diagnose:hardis:unusedusers",
7423
+ "org:diagnose:unusedusers:hardis",
7424
+ "hardis:diagnose:org:unusedusers",
7425
+ "diagnose:hardis:org:unusedusers",
7426
+ "diagnose:org:hardis:unusedusers",
7427
+ "diagnose:org:unusedusers:hardis",
7428
+ "hardis:diagnose:unusedusers:org",
7429
+ "diagnose:hardis:unusedusers:org",
7430
+ "diagnose:unusedusers:hardis:org",
7431
+ "diagnose:unusedusers:org:hardis",
7432
+ "hardis:org:unusedusers:diagnose",
7433
+ "org:hardis:unusedusers:diagnose",
7434
+ "org:unusedusers:hardis:diagnose",
7435
+ "org:unusedusers:diagnose:hardis",
7436
+ "hardis:unusedusers:org:diagnose",
7437
+ "unusedusers:hardis:org:diagnose",
7438
+ "unusedusers:org:hardis:diagnose",
7439
+ "unusedusers:org:diagnose:hardis",
7440
+ "hardis:unusedusers:diagnose:org",
7441
+ "unusedusers:hardis:diagnose:org",
7442
+ "unusedusers:diagnose:hardis:org",
7443
+ "unusedusers:diagnose:org:hardis"
7444
7444
  ]
7445
7445
  },
7446
7446
  "hardis:org:monitor:all": {
@@ -9939,6 +9939,238 @@
9939
9939
  "remotesites:audit:project:hardis"
9940
9940
  ]
9941
9941
  },
9942
+ "hardis:project:configure:auth": {
9943
+ "aliases": [],
9944
+ "args": {},
9945
+ "description": "\n## Command Behavior\n\n**Configures authentication between a Git branch and a target Salesforce org for CI/CD deployments.**\n\nThis command facilitates the setup of automated CI/CD pipelines, enabling seamless deployments from specific Git branches to designated Salesforce orgs. It supports both standard Salesforce orgs and Dev Hub configurations, catering to various enterprise deployment workflows.\n\nKey functionalities include:\n\n- **Org Selection/Login:** Guides the user to select an existing Salesforce org or log in to a new one.\n- **Git Branch Association:** Allows associating a specific Git branch with the chosen Salesforce org.\n- **Merge Target Definition:** Enables defining target Git branches into which the configured branch can merge, ensuring controlled deployment flows.\n- **Salesforce Username Configuration:** Prompts for the Salesforce username to be used by the CI server for deployments.\n- **SSL Certificate Generation:** Automatically generates an SSL certificate for secure authentication.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's implementation involves several key technical aspects:\n\n- **SF CLI Integration:** Utilizes \n@salesforce/sf-plugins-core\n for command structure and flag parsing.\n- **Interactive Prompts:** Employs the \nprompts\n library for interactive user input, guiding the configuration process.\n- **Git Integration:** Interacts with Git to retrieve branch information using \n`git().branch([\"--list\", \"-r\"])`\n.\n- **Configuration Management:** Leverages internal utilities (`checkConfig`, `getConfig`, `setConfig`, `setInConfigFile`) to read from and write to project-specific configuration files (e.g., `.sfdx-hardis.<branchName>.yml`).\n- **Salesforce CLI Execution:** Executes Salesforce CLI commands programmatically via `execSfdxJson` for org interactions.\n- **SSL Certificate Generation:** Calls `generateSSLCertificate` to create necessary SSL certificates for JWT-based authentication.\n- **WebSocket Communication:** Uses `WebSocketClient` for potential communication with external tools or processes, such as restarting the command in VS Code.\n- **Dependency Check:** Ensures the presence of `openssl` on the system, which is required for SSL certificate generation.\n",
9946
+ "examples": [
9947
+ "$ sf hardis:project:configure:auth"
9948
+ ],
9949
+ "flags": {
9950
+ "json": {
9951
+ "description": "Format output as json.",
9952
+ "helpGroup": "GLOBAL",
9953
+ "name": "json",
9954
+ "allowNo": false,
9955
+ "type": "boolean"
9956
+ },
9957
+ "flags-dir": {
9958
+ "helpGroup": "GLOBAL",
9959
+ "name": "flags-dir",
9960
+ "summary": "Import flag values from a directory.",
9961
+ "hasDynamicHelp": false,
9962
+ "multiple": false,
9963
+ "type": "option"
9964
+ },
9965
+ "devhub": {
9966
+ "char": "b",
9967
+ "description": "Configure project DevHub",
9968
+ "name": "devhub",
9969
+ "allowNo": false,
9970
+ "type": "boolean"
9971
+ },
9972
+ "debug": {
9973
+ "char": "d",
9974
+ "description": "Activate debug mode (more logs)",
9975
+ "name": "debug",
9976
+ "allowNo": false,
9977
+ "type": "boolean"
9978
+ },
9979
+ "websocket": {
9980
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
9981
+ "name": "websocket",
9982
+ "hasDynamicHelp": false,
9983
+ "multiple": false,
9984
+ "type": "option"
9985
+ },
9986
+ "skipauth": {
9987
+ "description": "Skip authentication check when a default username is required",
9988
+ "name": "skipauth",
9989
+ "allowNo": false,
9990
+ "type": "boolean"
9991
+ },
9992
+ "target-org": {
9993
+ "aliases": [
9994
+ "targetusername",
9995
+ "u"
9996
+ ],
9997
+ "char": "o",
9998
+ "deprecateAliases": true,
9999
+ "name": "target-org",
10000
+ "noCacheDefault": true,
10001
+ "summary": "Username or alias of the target org.",
10002
+ "hasDynamicHelp": true,
10003
+ "multiple": false,
10004
+ "type": "option"
10005
+ },
10006
+ "target-dev-hub": {
10007
+ "aliases": [
10008
+ "targetdevhubusername"
10009
+ ],
10010
+ "char": "v",
10011
+ "deprecateAliases": true,
10012
+ "name": "target-dev-hub",
10013
+ "noCacheDefault": true,
10014
+ "required": false,
10015
+ "summary": "Username or alias of the Dev Hub org.",
10016
+ "hasDynamicHelp": true,
10017
+ "multiple": false,
10018
+ "type": "option"
10019
+ }
10020
+ },
10021
+ "hasDynamicHelp": true,
10022
+ "hiddenAliases": [],
10023
+ "id": "hardis:project:configure:auth",
10024
+ "pluginAlias": "sfdx-hardis",
10025
+ "pluginName": "sfdx-hardis",
10026
+ "pluginType": "core",
10027
+ "strict": true,
10028
+ "enableJsonFlag": true,
10029
+ "title": "Configure authentication",
10030
+ "requiresProject": false,
10031
+ "requiresDependencies": [
10032
+ "openssl"
10033
+ ],
10034
+ "isESM": true,
10035
+ "relativePath": [
10036
+ "lib",
10037
+ "commands",
10038
+ "hardis",
10039
+ "project",
10040
+ "configure",
10041
+ "auth.js"
10042
+ ],
10043
+ "aliasPermutations": [],
10044
+ "permutations": [
10045
+ "hardis:project:configure:auth",
10046
+ "project:hardis:configure:auth",
10047
+ "project:configure:hardis:auth",
10048
+ "project:configure:auth:hardis",
10049
+ "hardis:configure:project:auth",
10050
+ "configure:hardis:project:auth",
10051
+ "configure:project:hardis:auth",
10052
+ "configure:project:auth:hardis",
10053
+ "hardis:configure:auth:project",
10054
+ "configure:hardis:auth:project",
10055
+ "configure:auth:hardis:project",
10056
+ "configure:auth:project:hardis",
10057
+ "hardis:project:auth:configure",
10058
+ "project:hardis:auth:configure",
10059
+ "project:auth:hardis:configure",
10060
+ "project:auth:configure:hardis",
10061
+ "hardis:auth:project:configure",
10062
+ "auth:hardis:project:configure",
10063
+ "auth:project:hardis:configure",
10064
+ "auth:project:configure:hardis",
10065
+ "hardis:auth:configure:project",
10066
+ "auth:hardis:configure:project",
10067
+ "auth:configure:hardis:project",
10068
+ "auth:configure:project:hardis"
10069
+ ]
10070
+ },
10071
+ "hardis:project:convert:profilestopermsets": {
10072
+ "aliases": [],
10073
+ "args": {},
10074
+ "description": "\n## Command Behavior\n\n**Converts existing Salesforce Profiles into Permission Sets, facilitating a more granular and recommended security model.**\n\nThis command helps in migrating permissions from Profiles to Permission Sets, which is a best practice for managing user access in Salesforce. It creates a new Permission Set for each specified Profile, adopting a naming convention of `PS_PROFILENAME`.\n\nKey functionalities:\n\n- **Profile to Permission Set Conversion:** Automatically extracts permissions from a Profile and creates a corresponding Permission Set.\n- **Naming Convention:** New Permission Sets are named with a `PS_` prefix followed by the Profile name (e.g., `PS_Standard_User`).\n- **Exclusion Filter:** Allows you to exclude specific Profiles from the conversion process using the `--except` flag.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **External Plugin Integration:** It relies on the `shane-sfdx-plugins` (specifically the `sf shane:profile:convert` command) to perform the actual conversion.\n- **File System Scan:** It reads the contents of the `force-app/main/default/profiles` directory to identify all available Profile metadata files.\n- **Command Execution:** For each identified Profile (that is not excluded), it constructs and executes the `sf shane:profile:convert` command with the appropriate Profile name and desired Permission Set name.\n- **Error Handling:** Includes basic error handling for the external command execution.\n</details>\n",
10075
+ "examples": [
10076
+ "$ sf hardis:project:convert:profilestopermsets"
10077
+ ],
10078
+ "flags": {
10079
+ "json": {
10080
+ "description": "Format output as json.",
10081
+ "helpGroup": "GLOBAL",
10082
+ "name": "json",
10083
+ "allowNo": false,
10084
+ "type": "boolean"
10085
+ },
10086
+ "flags-dir": {
10087
+ "helpGroup": "GLOBAL",
10088
+ "name": "flags-dir",
10089
+ "summary": "Import flag values from a directory.",
10090
+ "hasDynamicHelp": false,
10091
+ "multiple": false,
10092
+ "type": "option"
10093
+ },
10094
+ "except": {
10095
+ "char": "e",
10096
+ "description": "List of filters",
10097
+ "name": "except",
10098
+ "default": [],
10099
+ "hasDynamicHelp": false,
10100
+ "multiple": true,
10101
+ "type": "option"
10102
+ },
10103
+ "debug": {
10104
+ "char": "d",
10105
+ "description": "Activate debug mode (more logs)",
10106
+ "name": "debug",
10107
+ "allowNo": false,
10108
+ "type": "boolean"
10109
+ },
10110
+ "websocket": {
10111
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
10112
+ "name": "websocket",
10113
+ "hasDynamicHelp": false,
10114
+ "multiple": false,
10115
+ "type": "option"
10116
+ },
10117
+ "skipauth": {
10118
+ "description": "Skip authentication check when a default username is required",
10119
+ "name": "skipauth",
10120
+ "allowNo": false,
10121
+ "type": "boolean"
10122
+ }
10123
+ },
10124
+ "hasDynamicHelp": false,
10125
+ "hiddenAliases": [],
10126
+ "id": "hardis:project:convert:profilestopermsets",
10127
+ "pluginAlias": "sfdx-hardis",
10128
+ "pluginName": "sfdx-hardis",
10129
+ "pluginType": "core",
10130
+ "strict": true,
10131
+ "enableJsonFlag": true,
10132
+ "title": "Convert Profiles into Permission Sets",
10133
+ "requiresProject": true,
10134
+ "requiresSfdxPlugins": [
10135
+ "shane-sfdx-plugins"
10136
+ ],
10137
+ "isESM": true,
10138
+ "relativePath": [
10139
+ "lib",
10140
+ "commands",
10141
+ "hardis",
10142
+ "project",
10143
+ "convert",
10144
+ "profilestopermsets.js"
10145
+ ],
10146
+ "aliasPermutations": [],
10147
+ "permutations": [
10148
+ "hardis:project:convert:profilestopermsets",
10149
+ "project:hardis:convert:profilestopermsets",
10150
+ "project:convert:hardis:profilestopermsets",
10151
+ "project:convert:profilestopermsets:hardis",
10152
+ "hardis:convert:project:profilestopermsets",
10153
+ "convert:hardis:project:profilestopermsets",
10154
+ "convert:project:hardis:profilestopermsets",
10155
+ "convert:project:profilestopermsets:hardis",
10156
+ "hardis:convert:profilestopermsets:project",
10157
+ "convert:hardis:profilestopermsets:project",
10158
+ "convert:profilestopermsets:hardis:project",
10159
+ "convert:profilestopermsets:project:hardis",
10160
+ "hardis:project:profilestopermsets:convert",
10161
+ "project:hardis:profilestopermsets:convert",
10162
+ "project:profilestopermsets:hardis:convert",
10163
+ "project:profilestopermsets:convert:hardis",
10164
+ "hardis:profilestopermsets:project:convert",
10165
+ "profilestopermsets:hardis:project:convert",
10166
+ "profilestopermsets:project:hardis:convert",
10167
+ "profilestopermsets:project:convert:hardis",
10168
+ "hardis:profilestopermsets:convert:project",
10169
+ "profilestopermsets:hardis:convert:project",
10170
+ "profilestopermsets:convert:hardis:project",
10171
+ "profilestopermsets:convert:project:hardis"
10172
+ ]
10173
+ },
9942
10174
  "hardis:project:clean:emptyitems": {
9943
10175
  "aliases": [],
9944
10176
  "args": {},
@@ -11525,238 +11757,6 @@
11525
11757
  "xml:clean:project:hardis"
11526
11758
  ]
11527
11759
  },
11528
- "hardis:project:configure:auth": {
11529
- "aliases": [],
11530
- "args": {},
11531
- "description": "\n## Command Behavior\n\n**Configures authentication between a Git branch and a target Salesforce org for CI/CD deployments.**\n\nThis command facilitates the setup of automated CI/CD pipelines, enabling seamless deployments from specific Git branches to designated Salesforce orgs. It supports both standard Salesforce orgs and Dev Hub configurations, catering to various enterprise deployment workflows.\n\nKey functionalities include:\n\n- **Org Selection/Login:** Guides the user to select an existing Salesforce org or log in to a new one.\n- **Git Branch Association:** Allows associating a specific Git branch with the chosen Salesforce org.\n- **Merge Target Definition:** Enables defining target Git branches into which the configured branch can merge, ensuring controlled deployment flows.\n- **Salesforce Username Configuration:** Prompts for the Salesforce username to be used by the CI server for deployments.\n- **SSL Certificate Generation:** Automatically generates an SSL certificate for secure authentication.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's implementation involves several key technical aspects:\n\n- **SF CLI Integration:** Utilizes \n@salesforce/sf-plugins-core\n for command structure and flag parsing.\n- **Interactive Prompts:** Employs the \nprompts\n library for interactive user input, guiding the configuration process.\n- **Git Integration:** Interacts with Git to retrieve branch information using \n`git().branch([\"--list\", \"-r\"])`\n.\n- **Configuration Management:** Leverages internal utilities (`checkConfig`, `getConfig`, `setConfig`, `setInConfigFile`) to read from and write to project-specific configuration files (e.g., `.sfdx-hardis.<branchName>.yml`).\n- **Salesforce CLI Execution:** Executes Salesforce CLI commands programmatically via `execSfdxJson` for org interactions.\n- **SSL Certificate Generation:** Calls `generateSSLCertificate` to create necessary SSL certificates for JWT-based authentication.\n- **WebSocket Communication:** Uses `WebSocketClient` for potential communication with external tools or processes, such as restarting the command in VS Code.\n- **Dependency Check:** Ensures the presence of `openssl` on the system, which is required for SSL certificate generation.\n",
11532
- "examples": [
11533
- "$ sf hardis:project:configure:auth"
11534
- ],
11535
- "flags": {
11536
- "json": {
11537
- "description": "Format output as json.",
11538
- "helpGroup": "GLOBAL",
11539
- "name": "json",
11540
- "allowNo": false,
11541
- "type": "boolean"
11542
- },
11543
- "flags-dir": {
11544
- "helpGroup": "GLOBAL",
11545
- "name": "flags-dir",
11546
- "summary": "Import flag values from a directory.",
11547
- "hasDynamicHelp": false,
11548
- "multiple": false,
11549
- "type": "option"
11550
- },
11551
- "devhub": {
11552
- "char": "b",
11553
- "description": "Configure project DevHub",
11554
- "name": "devhub",
11555
- "allowNo": false,
11556
- "type": "boolean"
11557
- },
11558
- "debug": {
11559
- "char": "d",
11560
- "description": "Activate debug mode (more logs)",
11561
- "name": "debug",
11562
- "allowNo": false,
11563
- "type": "boolean"
11564
- },
11565
- "websocket": {
11566
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11567
- "name": "websocket",
11568
- "hasDynamicHelp": false,
11569
- "multiple": false,
11570
- "type": "option"
11571
- },
11572
- "skipauth": {
11573
- "description": "Skip authentication check when a default username is required",
11574
- "name": "skipauth",
11575
- "allowNo": false,
11576
- "type": "boolean"
11577
- },
11578
- "target-org": {
11579
- "aliases": [
11580
- "targetusername",
11581
- "u"
11582
- ],
11583
- "char": "o",
11584
- "deprecateAliases": true,
11585
- "name": "target-org",
11586
- "noCacheDefault": true,
11587
- "summary": "Username or alias of the target org.",
11588
- "hasDynamicHelp": true,
11589
- "multiple": false,
11590
- "type": "option"
11591
- },
11592
- "target-dev-hub": {
11593
- "aliases": [
11594
- "targetdevhubusername"
11595
- ],
11596
- "char": "v",
11597
- "deprecateAliases": true,
11598
- "name": "target-dev-hub",
11599
- "noCacheDefault": true,
11600
- "required": false,
11601
- "summary": "Username or alias of the Dev Hub org.",
11602
- "hasDynamicHelp": true,
11603
- "multiple": false,
11604
- "type": "option"
11605
- }
11606
- },
11607
- "hasDynamicHelp": true,
11608
- "hiddenAliases": [],
11609
- "id": "hardis:project:configure:auth",
11610
- "pluginAlias": "sfdx-hardis",
11611
- "pluginName": "sfdx-hardis",
11612
- "pluginType": "core",
11613
- "strict": true,
11614
- "enableJsonFlag": true,
11615
- "title": "Configure authentication",
11616
- "requiresProject": false,
11617
- "requiresDependencies": [
11618
- "openssl"
11619
- ],
11620
- "isESM": true,
11621
- "relativePath": [
11622
- "lib",
11623
- "commands",
11624
- "hardis",
11625
- "project",
11626
- "configure",
11627
- "auth.js"
11628
- ],
11629
- "aliasPermutations": [],
11630
- "permutations": [
11631
- "hardis:project:configure:auth",
11632
- "project:hardis:configure:auth",
11633
- "project:configure:hardis:auth",
11634
- "project:configure:auth:hardis",
11635
- "hardis:configure:project:auth",
11636
- "configure:hardis:project:auth",
11637
- "configure:project:hardis:auth",
11638
- "configure:project:auth:hardis",
11639
- "hardis:configure:auth:project",
11640
- "configure:hardis:auth:project",
11641
- "configure:auth:hardis:project",
11642
- "configure:auth:project:hardis",
11643
- "hardis:project:auth:configure",
11644
- "project:hardis:auth:configure",
11645
- "project:auth:hardis:configure",
11646
- "project:auth:configure:hardis",
11647
- "hardis:auth:project:configure",
11648
- "auth:hardis:project:configure",
11649
- "auth:project:hardis:configure",
11650
- "auth:project:configure:hardis",
11651
- "hardis:auth:configure:project",
11652
- "auth:hardis:configure:project",
11653
- "auth:configure:hardis:project",
11654
- "auth:configure:project:hardis"
11655
- ]
11656
- },
11657
- "hardis:project:convert:profilestopermsets": {
11658
- "aliases": [],
11659
- "args": {},
11660
- "description": "\n## Command Behavior\n\n**Converts existing Salesforce Profiles into Permission Sets, facilitating a more granular and recommended security model.**\n\nThis command helps in migrating permissions from Profiles to Permission Sets, which is a best practice for managing user access in Salesforce. It creates a new Permission Set for each specified Profile, adopting a naming convention of `PS_PROFILENAME`.\n\nKey functionalities:\n\n- **Profile to Permission Set Conversion:** Automatically extracts permissions from a Profile and creates a corresponding Permission Set.\n- **Naming Convention:** New Permission Sets are named with a `PS_` prefix followed by the Profile name (e.g., `PS_Standard_User`).\n- **Exclusion Filter:** Allows you to exclude specific Profiles from the conversion process using the `--except` flag.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **External Plugin Integration:** It relies on the `shane-sfdx-plugins` (specifically the `sf shane:profile:convert` command) to perform the actual conversion.\n- **File System Scan:** It reads the contents of the `force-app/main/default/profiles` directory to identify all available Profile metadata files.\n- **Command Execution:** For each identified Profile (that is not excluded), it constructs and executes the `sf shane:profile:convert` command with the appropriate Profile name and desired Permission Set name.\n- **Error Handling:** Includes basic error handling for the external command execution.\n</details>\n",
11661
- "examples": [
11662
- "$ sf hardis:project:convert:profilestopermsets"
11663
- ],
11664
- "flags": {
11665
- "json": {
11666
- "description": "Format output as json.",
11667
- "helpGroup": "GLOBAL",
11668
- "name": "json",
11669
- "allowNo": false,
11670
- "type": "boolean"
11671
- },
11672
- "flags-dir": {
11673
- "helpGroup": "GLOBAL",
11674
- "name": "flags-dir",
11675
- "summary": "Import flag values from a directory.",
11676
- "hasDynamicHelp": false,
11677
- "multiple": false,
11678
- "type": "option"
11679
- },
11680
- "except": {
11681
- "char": "e",
11682
- "description": "List of filters",
11683
- "name": "except",
11684
- "default": [],
11685
- "hasDynamicHelp": false,
11686
- "multiple": true,
11687
- "type": "option"
11688
- },
11689
- "debug": {
11690
- "char": "d",
11691
- "description": "Activate debug mode (more logs)",
11692
- "name": "debug",
11693
- "allowNo": false,
11694
- "type": "boolean"
11695
- },
11696
- "websocket": {
11697
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11698
- "name": "websocket",
11699
- "hasDynamicHelp": false,
11700
- "multiple": false,
11701
- "type": "option"
11702
- },
11703
- "skipauth": {
11704
- "description": "Skip authentication check when a default username is required",
11705
- "name": "skipauth",
11706
- "allowNo": false,
11707
- "type": "boolean"
11708
- }
11709
- },
11710
- "hasDynamicHelp": false,
11711
- "hiddenAliases": [],
11712
- "id": "hardis:project:convert:profilestopermsets",
11713
- "pluginAlias": "sfdx-hardis",
11714
- "pluginName": "sfdx-hardis",
11715
- "pluginType": "core",
11716
- "strict": true,
11717
- "enableJsonFlag": true,
11718
- "title": "Convert Profiles into Permission Sets",
11719
- "requiresProject": true,
11720
- "requiresSfdxPlugins": [
11721
- "shane-sfdx-plugins"
11722
- ],
11723
- "isESM": true,
11724
- "relativePath": [
11725
- "lib",
11726
- "commands",
11727
- "hardis",
11728
- "project",
11729
- "convert",
11730
- "profilestopermsets.js"
11731
- ],
11732
- "aliasPermutations": [],
11733
- "permutations": [
11734
- "hardis:project:convert:profilestopermsets",
11735
- "project:hardis:convert:profilestopermsets",
11736
- "project:convert:hardis:profilestopermsets",
11737
- "project:convert:profilestopermsets:hardis",
11738
- "hardis:convert:project:profilestopermsets",
11739
- "convert:hardis:project:profilestopermsets",
11740
- "convert:project:hardis:profilestopermsets",
11741
- "convert:project:profilestopermsets:hardis",
11742
- "hardis:convert:profilestopermsets:project",
11743
- "convert:hardis:profilestopermsets:project",
11744
- "convert:profilestopermsets:hardis:project",
11745
- "convert:profilestopermsets:project:hardis",
11746
- "hardis:project:profilestopermsets:convert",
11747
- "project:hardis:profilestopermsets:convert",
11748
- "project:profilestopermsets:hardis:convert",
11749
- "project:profilestopermsets:convert:hardis",
11750
- "hardis:profilestopermsets:project:convert",
11751
- "profilestopermsets:hardis:project:convert",
11752
- "profilestopermsets:project:hardis:convert",
11753
- "profilestopermsets:project:convert:hardis",
11754
- "hardis:profilestopermsets:convert:project",
11755
- "profilestopermsets:hardis:convert:project",
11756
- "profilestopermsets:convert:hardis:project",
11757
- "profilestopermsets:convert:project:hardis"
11758
- ]
11759
- },
11760
11760
  "hardis:project:deploy:notify": {
11761
11761
  "aliases": [],
11762
11762
  "args": {},
@@ -15719,5 +15719,5 @@
15719
15719
  ]
15720
15720
  }
15721
15721
  },
15722
- "version": "6.16.0"
15722
+ "version": "6.16.1-beta202512161830.0"
15723
15723
  }