sfdx-hardis 6.5.1 → 6.5.3

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.
@@ -152,12 +152,12 @@
152
152
  "login:auth:hardis"
153
153
  ]
154
154
  },
155
- "hardis:cache:clear": {
155
+ "hardis:config:get": {
156
156
  "aliases": [],
157
157
  "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",
158
+ "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
159
  "examples": [
160
- "$ sf hardis:cache:clear"
160
+ "$ sf hardis:project:deploy:sources:metadata"
161
161
  ],
162
162
  "flags": {
163
163
  "json": {
@@ -175,6 +175,20 @@
175
175
  "multiple": false,
176
176
  "type": "option"
177
177
  },
178
+ "level": {
179
+ "char": "l",
180
+ "description": "project,branch or user",
181
+ "name": "level",
182
+ "default": "project",
183
+ "hasDynamicHelp": false,
184
+ "multiple": false,
185
+ "options": [
186
+ "project",
187
+ "branch",
188
+ "user"
189
+ ],
190
+ "type": "option"
191
+ },
178
192
  "debug": {
179
193
  "char": "d",
180
194
  "description": "Activate debug mode (more logs)",
@@ -198,41 +212,38 @@
198
212
  },
199
213
  "hasDynamicHelp": false,
200
214
  "hiddenAliases": [],
201
- "id": "hardis:cache:clear",
215
+ "id": "hardis:config:get",
202
216
  "pluginAlias": "sfdx-hardis",
203
217
  "pluginName": "sfdx-hardis",
204
218
  "pluginType": "core",
205
219
  "strict": true,
206
220
  "enableJsonFlag": true,
207
- "title": "Clear sfdx-hardis cache",
208
- "uiConfig": {
209
- "hide": true
210
- },
221
+ "title": "Deploy metadata sources to org",
211
222
  "requiresProject": false,
212
223
  "isESM": true,
213
224
  "relativePath": [
214
225
  "lib",
215
226
  "commands",
216
227
  "hardis",
217
- "cache",
218
- "clear.js"
228
+ "config",
229
+ "get.js"
219
230
  ],
220
231
  "aliasPermutations": [],
221
232
  "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"
233
+ "hardis:config:get",
234
+ "config:hardis:get",
235
+ "config:get:hardis",
236
+ "hardis:get:config",
237
+ "get:hardis:config",
238
+ "get:config:hardis"
228
239
  ]
229
240
  },
230
- "hardis:config:get": {
241
+ "hardis:cache:clear": {
231
242
  "aliases": [],
232
243
  "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",
244
+ "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",
234
245
  "examples": [
235
- "$ sf hardis:project:deploy:sources:metadata"
246
+ "$ sf hardis:cache:clear"
236
247
  ],
237
248
  "flags": {
238
249
  "json": {
@@ -250,20 +261,6 @@
250
261
  "multiple": false,
251
262
  "type": "option"
252
263
  },
253
- "level": {
254
- "char": "l",
255
- "description": "project,branch or user",
256
- "name": "level",
257
- "default": "project",
258
- "hasDynamicHelp": false,
259
- "multiple": false,
260
- "options": [
261
- "project",
262
- "branch",
263
- "user"
264
- ],
265
- "type": "option"
266
- },
267
264
  "debug": {
268
265
  "char": "d",
269
266
  "description": "Activate debug mode (more logs)",
@@ -287,30 +284,33 @@
287
284
  },
288
285
  "hasDynamicHelp": false,
289
286
  "hiddenAliases": [],
290
- "id": "hardis:config:get",
287
+ "id": "hardis:cache:clear",
291
288
  "pluginAlias": "sfdx-hardis",
292
289
  "pluginName": "sfdx-hardis",
293
290
  "pluginType": "core",
294
291
  "strict": true,
295
292
  "enableJsonFlag": true,
296
- "title": "Deploy metadata sources to org",
293
+ "title": "Clear sfdx-hardis cache",
294
+ "uiConfig": {
295
+ "hide": true
296
+ },
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
+ "cache",
304
+ "clear.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:cache:clear",
309
+ "cache:hardis:clear",
310
+ "cache:clear:hardis",
311
+ "hardis:clear:cache",
312
+ "clear:hardis:cache",
313
+ "clear:cache:hardis"
314
314
  ]
315
315
  },
316
316
  "hardis:doc:fieldusage": {
@@ -5152,15 +5152,12 @@
5152
5152
  "monitoring:configure:org:hardis"
5153
5153
  ]
5154
5154
  },
5155
- "hardis:org:diagnose:audittrail": {
5155
+ "hardis:org:data:delete": {
5156
5156
  "aliases": [],
5157
5157
  "args": {},
5158
- "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",
5158
+ "description": "\n## Command Behavior\n\n**Deletes records in multiple Salesforce objects using an SFDMU (Salesforce Data Migration Utility) workspace.**\n\nThis command provides a powerful and controlled way to remove data from your Salesforce orgs based on configurations defined in an SFDMU workspace. It's particularly useful for:\n\n- **Data Cleanup:** Removing test data, obsolete records, or sensitive information.\n- **Environment Reset:** Preparing sandboxes for new development cycles by clearing specific data sets.\n- **Compliance:** Deleting data to meet regulatory requirements.\n\n**Important Considerations for Production Environments:**\n\nIf you intend to run this command in a production environment, you must:\n\n- Set `runnableInProduction` to `true` in your `export.json` file within the SFDMU workspace.\n- Define `sfdmuCanModify: YOUR_INSTANCE_URL` in your branch-specific configuration file (e.g., `config/branches/.sfdx-hardis.YOUR_BRANCH.yml`) to explicitly authorize data modification for that instance.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It leverages the `sfdmu` plugin to perform the actual data deletion operations. The command acts as a wrapper, providing an assisted interface for SFDMU execution.\n- **Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select a data workspace using `selectDataWorkspace`.\n- **Org Selection:** It ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt using `promptOrgUsernameDefault`) to specify where the data deletion will occur.\n- **`deleteData` Utility:** The core logic for executing the SFDMU deletion process is encapsulated within the `deleteData` utility function, which takes the SFDMU workspace path and the target username as arguments.\n- **Environment Awareness:** It checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
5159
5159
  "examples": [
5160
- "$ sf hardis:org:diagnose:audittrail",
5161
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5162
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5163
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5160
+ "$ sf hardis:org:data:delete"
5164
5161
  ],
5165
5162
  "flags": {
5166
5163
  "json": {
@@ -5178,26 +5175,10 @@
5178
5175
  "multiple": false,
5179
5176
  "type": "option"
5180
5177
  },
5181
- "excludeusers": {
5182
- "char": "e",
5183
- "description": "Comma-separated list of usernames to exclude",
5184
- "name": "excludeusers",
5185
- "hasDynamicHelp": false,
5186
- "multiple": false,
5187
- "type": "option"
5188
- },
5189
- "lastndays": {
5190
- "char": "t",
5191
- "description": "Number of days to extract from today (included)",
5192
- "name": "lastndays",
5193
- "hasDynamicHelp": false,
5194
- "multiple": false,
5195
- "type": "option"
5196
- },
5197
- "outputfile": {
5198
- "char": "f",
5199
- "description": "Force the path and name of output report file. Must end with .csv",
5200
- "name": "outputfile",
5178
+ "path": {
5179
+ "char": "p",
5180
+ "description": "Path to the sfdmu workspace folder",
5181
+ "name": "path",
5201
5182
  "hasDynamicHelp": false,
5202
5183
  "multiple": false,
5203
5184
  "type": "option"
@@ -5240,57 +5221,62 @@
5240
5221
  },
5241
5222
  "hasDynamicHelp": true,
5242
5223
  "hiddenAliases": [],
5243
- "id": "hardis:org:diagnose:audittrail",
5224
+ "id": "hardis:org:data:delete",
5244
5225
  "pluginAlias": "sfdx-hardis",
5245
5226
  "pluginName": "sfdx-hardis",
5246
5227
  "pluginType": "core",
5247
5228
  "strict": true,
5248
5229
  "enableJsonFlag": true,
5249
- "title": "Diagnose content of Setup Audit Trail",
5230
+ "title": "Delete data",
5250
5231
  "requiresProject": false,
5232
+ "requiresSfdxPlugins": [
5233
+ "sfdmu"
5234
+ ],
5251
5235
  "isESM": true,
5252
5236
  "relativePath": [
5253
5237
  "lib",
5254
5238
  "commands",
5255
5239
  "hardis",
5256
5240
  "org",
5257
- "diagnose",
5258
- "audittrail.js"
5241
+ "data",
5242
+ "delete.js"
5259
5243
  ],
5260
5244
  "aliasPermutations": [],
5261
5245
  "permutations": [
5262
- "hardis:org:diagnose:audittrail",
5263
- "org:hardis:diagnose:audittrail",
5264
- "org:diagnose:hardis:audittrail",
5265
- "org:diagnose:audittrail:hardis",
5266
- "hardis:diagnose:org:audittrail",
5267
- "diagnose:hardis:org:audittrail",
5268
- "diagnose:org:hardis:audittrail",
5269
- "diagnose:org:audittrail:hardis",
5270
- "hardis:diagnose:audittrail:org",
5271
- "diagnose:hardis:audittrail:org",
5272
- "diagnose:audittrail:hardis:org",
5273
- "diagnose:audittrail:org:hardis",
5274
- "hardis:org:audittrail:diagnose",
5275
- "org:hardis:audittrail:diagnose",
5276
- "org:audittrail:hardis:diagnose",
5277
- "org:audittrail:diagnose:hardis",
5278
- "hardis:audittrail:org:diagnose",
5279
- "audittrail:hardis:org:diagnose",
5280
- "audittrail:org:hardis:diagnose",
5281
- "audittrail:org:diagnose:hardis",
5282
- "hardis:audittrail:diagnose:org",
5283
- "audittrail:hardis:diagnose:org",
5284
- "audittrail:diagnose:hardis:org",
5285
- "audittrail:diagnose:org:hardis"
5246
+ "hardis:org:data:delete",
5247
+ "org:hardis:data:delete",
5248
+ "org:data:hardis:delete",
5249
+ "org:data:delete:hardis",
5250
+ "hardis:data:org:delete",
5251
+ "data:hardis:org:delete",
5252
+ "data:org:hardis:delete",
5253
+ "data:org:delete:hardis",
5254
+ "hardis:data:delete:org",
5255
+ "data:hardis:delete:org",
5256
+ "data:delete:hardis:org",
5257
+ "data:delete:org:hardis",
5258
+ "hardis:org:delete:data",
5259
+ "org:hardis:delete:data",
5260
+ "org:delete:hardis:data",
5261
+ "org:delete:data:hardis",
5262
+ "hardis:delete:org:data",
5263
+ "delete:hardis:org:data",
5264
+ "delete:org:hardis:data",
5265
+ "delete:org:data:hardis",
5266
+ "hardis:delete:data:org",
5267
+ "delete:hardis:data:org",
5268
+ "delete:data:hardis:org",
5269
+ "delete:data:org:hardis"
5286
5270
  ]
5287
5271
  },
5288
- "hardis:org:diagnose:instanceupgrade": {
5272
+ "hardis:org:data:export": {
5289
5273
  "aliases": [],
5290
5274
  "args": {},
5291
- "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",
5275
+ "description": "\n## Command Behavior\n\n**Exports data from a Salesforce org using an SFDMU (Salesforce Data Migration Utility) project.**\n\nThis command facilitates the extraction of data from your Salesforce environments based on configurations defined in an SFDMU workspace. It's a powerful tool for various data-related tasks, including:\n\n- **Data Backup:** Creating snapshots of your Salesforce data.\n- **Data Migration:** Extracting data for transfer to another Salesforce org or external system.\n- **Reporting and Analysis:** Exporting specific datasets for detailed analysis outside of Salesforce.\n- **Data Seeding:** Preparing data for import into other environments.\n\nKey functionalities:\n\n- **SFDMU Workspace Integration:** Leverages an existing SFDMU workspace (defined by an `export.json` file) to determine which objects and records to export, along with any filtering or transformation rules.\n- **Interactive Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Org Selection:** Ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt) to specify the source of the data export.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It acts as a wrapper around the `sfdmu` plugin, which performs the actual data export operations. The command provides an assisted interface for SFDMU execution.\n- **`exportData` Utility:** The core logic for executing the SFDMU export process is encapsulated within the `exportData` utility function, which takes the SFDMU workspace path and the source username as arguments.\n- **Interactive Prompts:** Uses `selectDataWorkspace` to allow the user to choose an SFDMU project and `promptOrgUsernameDefault` for selecting the source Salesforce org when not running in a CI environment.\n- **Environment Awareness:** Checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
5292
5276
  "examples": [
5293
- "$ sf hardis:org:diagnose:instanceupgrade"
5277
+ "$ sf hardis:org:data:export",
5278
+ "$ sf hardis:org:data:export --project-name MyDataProject --target-org my-org@example.com",
5279
+ "$ sf hardis:org:data:export --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com"
5294
5280
  ],
5295
5281
  "flags": {
5296
5282
  "json": {
@@ -5308,6 +5294,29 @@
5308
5294
  "multiple": false,
5309
5295
  "type": "option"
5310
5296
  },
5297
+ "project-name": {
5298
+ "char": "n",
5299
+ "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
5300
+ "name": "project-name",
5301
+ "hasDynamicHelp": false,
5302
+ "multiple": false,
5303
+ "type": "option"
5304
+ },
5305
+ "path": {
5306
+ "char": "p",
5307
+ "description": "Path to the sfdmu workspace folder",
5308
+ "name": "path",
5309
+ "hasDynamicHelp": false,
5310
+ "multiple": false,
5311
+ "type": "option"
5312
+ },
5313
+ "no-prompt": {
5314
+ "char": "r",
5315
+ "description": "Do not prompt for Org, use default org",
5316
+ "name": "no-prompt",
5317
+ "allowNo": false,
5318
+ "type": "boolean"
5319
+ },
5311
5320
  "debug": {
5312
5321
  "char": "d",
5313
5322
  "description": "Activate debug mode (more logs)",
@@ -5346,61 +5355,64 @@
5346
5355
  },
5347
5356
  "hasDynamicHelp": true,
5348
5357
  "hiddenAliases": [],
5349
- "id": "hardis:org:diagnose:instanceupgrade",
5358
+ "id": "hardis:org:data:export",
5350
5359
  "pluginAlias": "sfdx-hardis",
5351
5360
  "pluginName": "sfdx-hardis",
5352
5361
  "pluginType": "core",
5353
5362
  "strict": true,
5354
5363
  "enableJsonFlag": true,
5355
- "title": "Get Instance Upgrade date",
5364
+ "title": "Export data",
5356
5365
  "requiresProject": false,
5366
+ "requiresSfdxPlugins": [
5367
+ "sfdmu"
5368
+ ],
5357
5369
  "isESM": true,
5358
5370
  "relativePath": [
5359
5371
  "lib",
5360
5372
  "commands",
5361
5373
  "hardis",
5362
5374
  "org",
5363
- "diagnose",
5364
- "instanceupgrade.js"
5375
+ "data",
5376
+ "export.js"
5365
5377
  ],
5366
5378
  "aliasPermutations": [],
5367
5379
  "permutations": [
5368
- "hardis:org:diagnose:instanceupgrade",
5369
- "org:hardis:diagnose:instanceupgrade",
5370
- "org:diagnose:hardis:instanceupgrade",
5371
- "org:diagnose:instanceupgrade:hardis",
5372
- "hardis:diagnose:org:instanceupgrade",
5373
- "diagnose:hardis:org:instanceupgrade",
5374
- "diagnose:org:hardis:instanceupgrade",
5375
- "diagnose:org:instanceupgrade:hardis",
5376
- "hardis:diagnose:instanceupgrade:org",
5377
- "diagnose:hardis:instanceupgrade:org",
5378
- "diagnose:instanceupgrade:hardis:org",
5379
- "diagnose:instanceupgrade:org:hardis",
5380
- "hardis:org:instanceupgrade:diagnose",
5381
- "org:hardis:instanceupgrade:diagnose",
5382
- "org:instanceupgrade:hardis:diagnose",
5383
- "org:instanceupgrade:diagnose:hardis",
5384
- "hardis:instanceupgrade:org:diagnose",
5385
- "instanceupgrade:hardis:org:diagnose",
5386
- "instanceupgrade:org:hardis:diagnose",
5387
- "instanceupgrade:org:diagnose:hardis",
5388
- "hardis:instanceupgrade:diagnose:org",
5389
- "instanceupgrade:hardis:diagnose:org",
5390
- "instanceupgrade:diagnose:hardis:org",
5391
- "instanceupgrade:diagnose:org:hardis"
5392
- ]
5393
- },
5394
- "hardis:org:diagnose:legacyapi": {
5395
- "aliases": [],
5396
- "args": {},
5397
- "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",
5398
- "examples": [
5399
- "$ sf hardis:org:diagnose:legacyapi",
5400
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5401
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5402
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5403
- ],
5380
+ "hardis:org:data:export",
5381
+ "org:hardis:data:export",
5382
+ "org:data:hardis:export",
5383
+ "org:data:export:hardis",
5384
+ "hardis:data:org:export",
5385
+ "data:hardis:org:export",
5386
+ "data:org:hardis:export",
5387
+ "data:org:export:hardis",
5388
+ "hardis:data:export:org",
5389
+ "data:hardis:export:org",
5390
+ "data:export:hardis:org",
5391
+ "data:export:org:hardis",
5392
+ "hardis:org:export:data",
5393
+ "org:hardis:export:data",
5394
+ "org:export:hardis:data",
5395
+ "org:export:data:hardis",
5396
+ "hardis:export:org:data",
5397
+ "export:hardis:org:data",
5398
+ "export:org:hardis:data",
5399
+ "export:org:data:hardis",
5400
+ "hardis:export:data:org",
5401
+ "export:hardis:data:org",
5402
+ "export:data:hardis:org",
5403
+ "export:data:org:hardis"
5404
+ ]
5405
+ },
5406
+ "hardis:org:data:import": {
5407
+ "aliases": [],
5408
+ "args": {},
5409
+ "description": "Import/Load data in an org using a [SFDX Data Loader](https://help.sfdmu.com/) Project\n\nIf you need to run this command in a production org, you need to either:\n\n- Define **sfdmuCanModify** in your .sfdx-hardis.yml config file. (Example: `sfdmuCanModify: prod-instance.my.salesforce.com`)\n- Define an environment variable SFDMU_CAN_MODIFY. (Example: `SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com`)\n\nSee article:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n",
5410
+ "examples": [
5411
+ "$ sf hardis:org:data:import",
5412
+ "$ sf hardis:org:data:import --project-name MyDataProject --target-org my-org@example.com",
5413
+ "$ sf hardis:org:data:import --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com",
5414
+ "$ SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com sf hardis:org:data:import --project-name MyDataProject --target-org prod@example.com"
5415
+ ],
5404
5416
  "flags": {
5405
5417
  "json": {
5406
5418
  "description": "Format output as json.",
@@ -5417,31 +5429,28 @@
5417
5429
  "multiple": false,
5418
5430
  "type": "option"
5419
5431
  },
5420
- "eventtype": {
5421
- "char": "e",
5422
- "description": "Type of EventLogFile event to analyze",
5423
- "name": "eventtype",
5424
- "default": "ApiTotalUsage",
5432
+ "project-name": {
5433
+ "char": "n",
5434
+ "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
5435
+ "name": "project-name",
5425
5436
  "hasDynamicHelp": false,
5426
5437
  "multiple": false,
5427
5438
  "type": "option"
5428
5439
  },
5429
- "limit": {
5430
- "char": "l",
5431
- "description": "Number of latest EventLogFile events to analyze",
5432
- "name": "limit",
5433
- "default": 999,
5440
+ "path": {
5441
+ "char": "p",
5442
+ "description": "Path to the sfdmu workspace folder",
5443
+ "name": "path",
5434
5444
  "hasDynamicHelp": false,
5435
5445
  "multiple": false,
5436
5446
  "type": "option"
5437
5447
  },
5438
- "outputfile": {
5439
- "char": "f",
5440
- "description": "Force the path and name of output report file. Must end with .csv",
5441
- "name": "outputfile",
5442
- "hasDynamicHelp": false,
5443
- "multiple": false,
5444
- "type": "option"
5448
+ "no-prompt": {
5449
+ "char": "r",
5450
+ "description": "Do not prompt for Org, use default org",
5451
+ "name": "no-prompt",
5452
+ "allowNo": false,
5453
+ "type": "boolean"
5445
5454
  },
5446
5455
  "debug": {
5447
5456
  "char": "d",
@@ -5481,57 +5490,60 @@
5481
5490
  },
5482
5491
  "hasDynamicHelp": true,
5483
5492
  "hiddenAliases": [],
5484
- "id": "hardis:org:diagnose:legacyapi",
5493
+ "id": "hardis:org:data:import",
5485
5494
  "pluginAlias": "sfdx-hardis",
5486
5495
  "pluginName": "sfdx-hardis",
5487
5496
  "pluginType": "core",
5488
5497
  "strict": true,
5489
5498
  "enableJsonFlag": true,
5490
- "title": "Check for legacy API use",
5499
+ "title": "Import data",
5491
5500
  "requiresProject": false,
5501
+ "requiresSfdxPlugins": [
5502
+ "sfdmu"
5503
+ ],
5492
5504
  "isESM": true,
5493
5505
  "relativePath": [
5494
5506
  "lib",
5495
5507
  "commands",
5496
5508
  "hardis",
5497
5509
  "org",
5498
- "diagnose",
5499
- "legacyapi.js"
5510
+ "data",
5511
+ "import.js"
5500
5512
  ],
5501
5513
  "aliasPermutations": [],
5502
5514
  "permutations": [
5503
- "hardis:org:diagnose:legacyapi",
5504
- "org:hardis:diagnose:legacyapi",
5505
- "org:diagnose:hardis:legacyapi",
5506
- "org:diagnose:legacyapi:hardis",
5507
- "hardis:diagnose:org:legacyapi",
5508
- "diagnose:hardis:org:legacyapi",
5509
- "diagnose:org:hardis:legacyapi",
5510
- "diagnose:org:legacyapi:hardis",
5511
- "hardis:diagnose:legacyapi:org",
5512
- "diagnose:hardis:legacyapi:org",
5513
- "diagnose:legacyapi:hardis:org",
5514
- "diagnose:legacyapi:org:hardis",
5515
- "hardis:org:legacyapi:diagnose",
5516
- "org:hardis:legacyapi:diagnose",
5517
- "org:legacyapi:hardis:diagnose",
5518
- "org:legacyapi:diagnose:hardis",
5519
- "hardis:legacyapi:org:diagnose",
5520
- "legacyapi:hardis:org:diagnose",
5521
- "legacyapi:org:hardis:diagnose",
5522
- "legacyapi:org:diagnose:hardis",
5523
- "hardis:legacyapi:diagnose:org",
5524
- "legacyapi:hardis:diagnose:org",
5525
- "legacyapi:diagnose:hardis:org",
5526
- "legacyapi:diagnose:org:hardis"
5515
+ "hardis:org:data:import",
5516
+ "org:hardis:data:import",
5517
+ "org:data:hardis:import",
5518
+ "org:data:import:hardis",
5519
+ "hardis:data:org:import",
5520
+ "data:hardis:org:import",
5521
+ "data:org:hardis:import",
5522
+ "data:org:import:hardis",
5523
+ "hardis:data:import:org",
5524
+ "data:hardis:import:org",
5525
+ "data:import:hardis:org",
5526
+ "data:import:org:hardis",
5527
+ "hardis:org:import:data",
5528
+ "org:hardis:import:data",
5529
+ "org:import:hardis:data",
5530
+ "org:import:data:hardis",
5531
+ "hardis:import:org:data",
5532
+ "import:hardis:org:data",
5533
+ "import:org:hardis:data",
5534
+ "import:org:data:hardis",
5535
+ "hardis:import:data:org",
5536
+ "import:hardis:data:org",
5537
+ "import:data:hardis:org",
5538
+ "import:data:org:hardis"
5527
5539
  ]
5528
5540
  },
5529
- "hardis:org:diagnose:licenses": {
5541
+ "hardis:org:files:export": {
5530
5542
  "aliases": [],
5531
5543
  "args": {},
5532
- "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",
5544
+ "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",
5533
5545
  "examples": [
5534
- "$ sf hardis:org:diagnose:licenses"
5546
+ "$ sf hardis:org:files:export"
5535
5547
  ],
5536
5548
  "flags": {
5537
5549
  "json": {
@@ -5549,18 +5561,45 @@
5549
5561
  "multiple": false,
5550
5562
  "type": "option"
5551
5563
  },
5552
- "outputfile": {
5553
- "char": "f",
5554
- "description": "Force the path and name of output report file. Must end with .csv",
5555
- "name": "outputfile",
5564
+ "path": {
5565
+ "char": "p",
5566
+ "description": "Path to the file export project",
5567
+ "name": "path",
5556
5568
  "hasDynamicHelp": false,
5557
5569
  "multiple": false,
5558
5570
  "type": "option"
5559
5571
  },
5560
- "usedonly": {
5561
- "char": "u",
5562
- "description": "Filter to have only used licenses",
5563
- "name": "usedonly",
5572
+ "chunksize": {
5573
+ "char": "c",
5574
+ "description": "Number of records to add in a chunk before it is processed",
5575
+ "name": "chunksize",
5576
+ "default": 1000,
5577
+ "hasDynamicHelp": false,
5578
+ "multiple": false,
5579
+ "type": "option"
5580
+ },
5581
+ "polltimeout": {
5582
+ "char": "t",
5583
+ "description": "Timeout in MS for Bulk API calls",
5584
+ "name": "polltimeout",
5585
+ "default": 300000,
5586
+ "hasDynamicHelp": false,
5587
+ "multiple": false,
5588
+ "type": "option"
5589
+ },
5590
+ "startchunknumber": {
5591
+ "char": "s",
5592
+ "description": "Chunk number to start from",
5593
+ "name": "startchunknumber",
5594
+ "default": 0,
5595
+ "hasDynamicHelp": false,
5596
+ "multiple": false,
5597
+ "type": "option"
5598
+ },
5599
+ "resume": {
5600
+ "char": "r",
5601
+ "description": "Resume previous export by checking existing files (default in CI)",
5602
+ "name": "resume",
5564
5603
  "allowNo": false,
5565
5604
  "type": "boolean"
5566
5605
  },
@@ -5602,13 +5641,13 @@
5602
5641
  },
5603
5642
  "hasDynamicHelp": true,
5604
5643
  "hiddenAliases": [],
5605
- "id": "hardis:org:diagnose:licenses",
5644
+ "id": "hardis:org:files:export",
5606
5645
  "pluginAlias": "sfdx-hardis",
5607
5646
  "pluginName": "sfdx-hardis",
5608
5647
  "pluginType": "core",
5609
5648
  "strict": true,
5610
5649
  "enableJsonFlag": true,
5611
- "title": "List licenses subscribed and used in a Salesforce org",
5650
+ "title": "Export files",
5612
5651
  "requiresProject": false,
5613
5652
  "isESM": true,
5614
5653
  "relativePath": [
@@ -5616,43 +5655,43 @@
5616
5655
  "commands",
5617
5656
  "hardis",
5618
5657
  "org",
5619
- "diagnose",
5620
- "licenses.js"
5658
+ "files",
5659
+ "export.js"
5621
5660
  ],
5622
5661
  "aliasPermutations": [],
5623
5662
  "permutations": [
5624
- "hardis:org:diagnose:licenses",
5625
- "org:hardis:diagnose:licenses",
5626
- "org:diagnose:hardis:licenses",
5627
- "org:diagnose:licenses:hardis",
5628
- "hardis:diagnose:org:licenses",
5629
- "diagnose:hardis:org:licenses",
5630
- "diagnose:org:hardis:licenses",
5631
- "diagnose:org:licenses:hardis",
5632
- "hardis:diagnose:licenses:org",
5633
- "diagnose:hardis:licenses:org",
5634
- "diagnose:licenses:hardis:org",
5635
- "diagnose:licenses:org:hardis",
5636
- "hardis:org:licenses:diagnose",
5637
- "org:hardis:licenses:diagnose",
5638
- "org:licenses:hardis:diagnose",
5639
- "org:licenses:diagnose:hardis",
5640
- "hardis:licenses:org:diagnose",
5641
- "licenses:hardis:org:diagnose",
5642
- "licenses:org:hardis:diagnose",
5643
- "licenses:org:diagnose:hardis",
5644
- "hardis:licenses:diagnose:org",
5645
- "licenses:hardis:diagnose:org",
5646
- "licenses:diagnose:hardis:org",
5647
- "licenses:diagnose:org:hardis"
5663
+ "hardis:org:files:export",
5664
+ "org:hardis:files:export",
5665
+ "org:files:hardis:export",
5666
+ "org:files:export:hardis",
5667
+ "hardis:files:org:export",
5668
+ "files:hardis:org:export",
5669
+ "files:org:hardis:export",
5670
+ "files:org:export:hardis",
5671
+ "hardis:files:export:org",
5672
+ "files:hardis:export:org",
5673
+ "files:export:hardis:org",
5674
+ "files:export:org:hardis",
5675
+ "hardis:org:export:files",
5676
+ "org:hardis:export:files",
5677
+ "org:export:hardis:files",
5678
+ "org:export:files:hardis",
5679
+ "hardis:export:org:files",
5680
+ "export:hardis:org:files",
5681
+ "export:org:hardis:files",
5682
+ "export:org:files:hardis",
5683
+ "hardis:export:files:org",
5684
+ "export:hardis:files:org",
5685
+ "export:files:hardis:org",
5686
+ "export:files:org:hardis"
5648
5687
  ]
5649
5688
  },
5650
- "hardis:org:diagnose:releaseupdates": {
5689
+ "hardis:org:files:import": {
5651
5690
  "aliases": [],
5652
5691
  "args": {},
5653
- "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",
5692
+ "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",
5654
5693
  "examples": [
5655
- "$ sf hardis:org:diagnose:releaseupdates"
5694
+ "$ sf hardis:org:files:import"
5656
5695
  ],
5657
5696
  "flags": {
5658
5697
  "json": {
@@ -5670,14 +5709,21 @@
5670
5709
  "multiple": false,
5671
5710
  "type": "option"
5672
5711
  },
5673
- "outputfile": {
5674
- "char": "f",
5675
- "description": "Force the path and name of output report file. Must end with .csv",
5676
- "name": "outputfile",
5712
+ "path": {
5713
+ "char": "p",
5714
+ "description": "Path to the file export project",
5715
+ "name": "path",
5677
5716
  "hasDynamicHelp": false,
5678
5717
  "multiple": false,
5679
5718
  "type": "option"
5680
5719
  },
5720
+ "overwrite": {
5721
+ "char": "f",
5722
+ "description": "Override existing files (doubles the number of API calls)",
5723
+ "name": "overwrite",
5724
+ "allowNo": false,
5725
+ "type": "boolean"
5726
+ },
5681
5727
  "debug": {
5682
5728
  "char": "d",
5683
5729
  "description": "Activate debug mode (more logs)",
@@ -5716,13 +5762,13 @@
5716
5762
  },
5717
5763
  "hasDynamicHelp": true,
5718
5764
  "hiddenAliases": [],
5719
- "id": "hardis:org:diagnose:releaseupdates",
5765
+ "id": "hardis:org:files:import",
5720
5766
  "pluginAlias": "sfdx-hardis",
5721
5767
  "pluginName": "sfdx-hardis",
5722
5768
  "pluginType": "core",
5723
5769
  "strict": true,
5724
5770
  "enableJsonFlag": true,
5725
- "title": "Check Release Updates of an org",
5771
+ "title": "Import files",
5726
5772
  "requiresProject": false,
5727
5773
  "isESM": true,
5728
5774
  "relativePath": [
@@ -5730,43 +5776,44 @@
5730
5776
  "commands",
5731
5777
  "hardis",
5732
5778
  "org",
5733
- "diagnose",
5734
- "releaseupdates.js"
5779
+ "files",
5780
+ "import.js"
5735
5781
  ],
5736
5782
  "aliasPermutations": [],
5737
5783
  "permutations": [
5738
- "hardis:org:diagnose:releaseupdates",
5739
- "org:hardis:diagnose:releaseupdates",
5740
- "org:diagnose:hardis:releaseupdates",
5741
- "org:diagnose:releaseupdates:hardis",
5742
- "hardis:diagnose:org:releaseupdates",
5743
- "diagnose:hardis:org:releaseupdates",
5744
- "diagnose:org:hardis:releaseupdates",
5745
- "diagnose:org:releaseupdates:hardis",
5746
- "hardis:diagnose:releaseupdates:org",
5747
- "diagnose:hardis:releaseupdates:org",
5748
- "diagnose:releaseupdates:hardis:org",
5749
- "diagnose:releaseupdates:org:hardis",
5750
- "hardis:org:releaseupdates:diagnose",
5751
- "org:hardis:releaseupdates:diagnose",
5752
- "org:releaseupdates:hardis:diagnose",
5753
- "org:releaseupdates:diagnose:hardis",
5754
- "hardis:releaseupdates:org:diagnose",
5755
- "releaseupdates:hardis:org:diagnose",
5756
- "releaseupdates:org:hardis:diagnose",
5757
- "releaseupdates:org:diagnose:hardis",
5758
- "hardis:releaseupdates:diagnose:org",
5759
- "releaseupdates:hardis:diagnose:org",
5760
- "releaseupdates:diagnose:hardis:org",
5761
- "releaseupdates:diagnose:org:hardis"
5784
+ "hardis:org:files:import",
5785
+ "org:hardis:files:import",
5786
+ "org:files:hardis:import",
5787
+ "org:files:import:hardis",
5788
+ "hardis:files:org:import",
5789
+ "files:hardis:org:import",
5790
+ "files:org:hardis:import",
5791
+ "files:org:import:hardis",
5792
+ "hardis:files:import:org",
5793
+ "files:hardis:import:org",
5794
+ "files:import:hardis:org",
5795
+ "files:import:org:hardis",
5796
+ "hardis:org:import:files",
5797
+ "org:hardis:import:files",
5798
+ "org:import:hardis:files",
5799
+ "org:import:files:hardis",
5800
+ "hardis:import:org:files",
5801
+ "import:hardis:org:files",
5802
+ "import:org:hardis:files",
5803
+ "import:org:files:hardis",
5804
+ "hardis:import:files:org",
5805
+ "import:hardis:files:org",
5806
+ "import:files:hardis:org",
5807
+ "import:files:org:hardis"
5762
5808
  ]
5763
5809
  },
5764
- "hardis:org:diagnose:unsecure-connected-apps": {
5810
+ "hardis:org:fix:listviewmine": {
5765
5811
  "aliases": [],
5766
5812
  "args": {},
5767
- "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",
5813
+ "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",
5768
5814
  "examples": [
5769
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
5815
+ "$ sf hardis:org:fix:listviewmine",
5816
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5770
5817
  ],
5771
5818
  "flags": {
5772
5819
  "json": {
@@ -5784,10 +5831,10 @@
5784
5831
  "multiple": false,
5785
5832
  "type": "option"
5786
5833
  },
5787
- "outputfile": {
5788
- "char": "f",
5789
- "description": "Force the path and name of output report file. Must end with .csv",
5790
- "name": "outputfile",
5834
+ "listviews": {
5835
+ "char": "l",
5836
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5837
+ "name": "listviews",
5791
5838
  "hasDynamicHelp": false,
5792
5839
  "multiple": false,
5793
5840
  "type": "option"
@@ -5830,58 +5877,60 @@
5830
5877
  },
5831
5878
  "hasDynamicHelp": true,
5832
5879
  "hiddenAliases": [],
5833
- "id": "hardis:org:diagnose:unsecure-connected-apps",
5880
+ "id": "hardis:org:fix:listviewmine",
5834
5881
  "pluginAlias": "sfdx-hardis",
5835
5882
  "pluginName": "sfdx-hardis",
5836
5883
  "pluginType": "core",
5837
5884
  "strict": true,
5838
5885
  "enableJsonFlag": true,
5839
- "title": "Detect Unsecured Connected Apps",
5840
- "requiresProject": false,
5886
+ "title": "Fix listviews with ",
5887
+ "requiresProject": true,
5841
5888
  "isESM": true,
5842
5889
  "relativePath": [
5843
5890
  "lib",
5844
5891
  "commands",
5845
5892
  "hardis",
5846
5893
  "org",
5847
- "diagnose",
5848
- "unsecure-connected-apps.js"
5894
+ "fix",
5895
+ "listviewmine.js"
5849
5896
  ],
5850
5897
  "aliasPermutations": [],
5851
5898
  "permutations": [
5852
- "hardis:org:diagnose:unsecure-connected-apps",
5853
- "org:hardis:diagnose:unsecure-connected-apps",
5854
- "org:diagnose:hardis:unsecure-connected-apps",
5855
- "org:diagnose:unsecure-connected-apps:hardis",
5856
- "hardis:diagnose:org:unsecure-connected-apps",
5857
- "diagnose:hardis:org:unsecure-connected-apps",
5858
- "diagnose:org:hardis:unsecure-connected-apps",
5859
- "diagnose:org:unsecure-connected-apps:hardis",
5860
- "hardis:diagnose:unsecure-connected-apps:org",
5861
- "diagnose:hardis:unsecure-connected-apps:org",
5862
- "diagnose:unsecure-connected-apps:hardis:org",
5863
- "diagnose:unsecure-connected-apps:org:hardis",
5864
- "hardis:org:unsecure-connected-apps:diagnose",
5865
- "org:hardis:unsecure-connected-apps:diagnose",
5866
- "org:unsecure-connected-apps:hardis:diagnose",
5867
- "org:unsecure-connected-apps:diagnose:hardis",
5868
- "hardis:unsecure-connected-apps:org:diagnose",
5869
- "unsecure-connected-apps:hardis:org:diagnose",
5870
- "unsecure-connected-apps:org:hardis:diagnose",
5871
- "unsecure-connected-apps:org:diagnose:hardis",
5872
- "hardis:unsecure-connected-apps:diagnose:org",
5873
- "unsecure-connected-apps:hardis:diagnose:org",
5874
- "unsecure-connected-apps:diagnose:hardis:org",
5875
- "unsecure-connected-apps:diagnose:org:hardis"
5899
+ "hardis:org:fix:listviewmine",
5900
+ "org:hardis:fix:listviewmine",
5901
+ "org:fix:hardis:listviewmine",
5902
+ "org:fix:listviewmine:hardis",
5903
+ "hardis:fix:org:listviewmine",
5904
+ "fix:hardis:org:listviewmine",
5905
+ "fix:org:hardis:listviewmine",
5906
+ "fix:org:listviewmine:hardis",
5907
+ "hardis:fix:listviewmine:org",
5908
+ "fix:hardis:listviewmine:org",
5909
+ "fix:listviewmine:hardis:org",
5910
+ "fix:listviewmine:org:hardis",
5911
+ "hardis:org:listviewmine:fix",
5912
+ "org:hardis:listviewmine:fix",
5913
+ "org:listviewmine:hardis:fix",
5914
+ "org:listviewmine:fix:hardis",
5915
+ "hardis:listviewmine:org:fix",
5916
+ "listviewmine:hardis:org:fix",
5917
+ "listviewmine:org:hardis:fix",
5918
+ "listviewmine:org:fix:hardis",
5919
+ "hardis:listviewmine:fix:org",
5920
+ "listviewmine:hardis:fix:org",
5921
+ "listviewmine:fix:hardis:org",
5922
+ "listviewmine:fix:org:hardis"
5876
5923
  ]
5877
5924
  },
5878
- "hardis:org:diagnose:unused-apex-classes": {
5925
+ "hardis:org:diagnose:audittrail": {
5879
5926
  "aliases": [],
5880
5927
  "args": {},
5881
- "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",
5928
+ "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",
5882
5929
  "examples": [
5883
- "$ sf hardis:org:diagnose:unused-apex-classes",
5884
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
5930
+ "$ sf hardis:org:diagnose:audittrail",
5931
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5932
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5933
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5885
5934
  ],
5886
5935
  "flags": {
5887
5936
  "json": {
@@ -5899,18 +5948,26 @@
5899
5948
  "multiple": false,
5900
5949
  "type": "option"
5901
5950
  },
5902
- "outputfile": {
5903
- "char": "f",
5904
- "description": "Force the path and name of output report file. Must end with .csv",
5905
- "name": "outputfile",
5951
+ "excludeusers": {
5952
+ "char": "e",
5953
+ "description": "Comma-separated list of usernames to exclude",
5954
+ "name": "excludeusers",
5906
5955
  "hasDynamicHelp": false,
5907
5956
  "multiple": false,
5908
5957
  "type": "option"
5909
5958
  },
5910
- "days": {
5959
+ "lastndays": {
5911
5960
  "char": "t",
5912
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
5913
- "name": "days",
5961
+ "description": "Number of days to extract from today (included)",
5962
+ "name": "lastndays",
5963
+ "hasDynamicHelp": false,
5964
+ "multiple": false,
5965
+ "type": "option"
5966
+ },
5967
+ "outputfile": {
5968
+ "char": "f",
5969
+ "description": "Force the path and name of output report file. Must end with .csv",
5970
+ "name": "outputfile",
5914
5971
  "hasDynamicHelp": false,
5915
5972
  "multiple": false,
5916
5973
  "type": "option"
@@ -5953,13 +6010,13 @@
5953
6010
  },
5954
6011
  "hasDynamicHelp": true,
5955
6012
  "hiddenAliases": [],
5956
- "id": "hardis:org:diagnose:unused-apex-classes",
6013
+ "id": "hardis:org:diagnose:audittrail",
5957
6014
  "pluginAlias": "sfdx-hardis",
5958
6015
  "pluginName": "sfdx-hardis",
5959
6016
  "pluginType": "core",
5960
6017
  "strict": true,
5961
6018
  "enableJsonFlag": true,
5962
- "title": "Detect unused Apex classes in an org",
6019
+ "title": "Diagnose content of Setup Audit Trail",
5963
6020
  "requiresProject": false,
5964
6021
  "isESM": true,
5965
6022
  "relativePath": [
@@ -5968,42 +6025,42 @@
5968
6025
  "hardis",
5969
6026
  "org",
5970
6027
  "diagnose",
5971
- "unused-apex-classes.js"
6028
+ "audittrail.js"
5972
6029
  ],
5973
6030
  "aliasPermutations": [],
5974
6031
  "permutations": [
5975
- "hardis:org:diagnose:unused-apex-classes",
5976
- "org:hardis:diagnose:unused-apex-classes",
5977
- "org:diagnose:hardis:unused-apex-classes",
5978
- "org:diagnose:unused-apex-classes:hardis",
5979
- "hardis:diagnose:org:unused-apex-classes",
5980
- "diagnose:hardis:org:unused-apex-classes",
5981
- "diagnose:org:hardis:unused-apex-classes",
5982
- "diagnose:org:unused-apex-classes:hardis",
5983
- "hardis:diagnose:unused-apex-classes:org",
5984
- "diagnose:hardis:unused-apex-classes:org",
5985
- "diagnose:unused-apex-classes:hardis:org",
5986
- "diagnose:unused-apex-classes:org:hardis",
5987
- "hardis:org:unused-apex-classes:diagnose",
5988
- "org:hardis:unused-apex-classes:diagnose",
5989
- "org:unused-apex-classes:hardis:diagnose",
5990
- "org:unused-apex-classes:diagnose:hardis",
5991
- "hardis:unused-apex-classes:org:diagnose",
5992
- "unused-apex-classes:hardis:org:diagnose",
5993
- "unused-apex-classes:org:hardis:diagnose",
5994
- "unused-apex-classes:org:diagnose:hardis",
5995
- "hardis:unused-apex-classes:diagnose:org",
5996
- "unused-apex-classes:hardis:diagnose:org",
5997
- "unused-apex-classes:diagnose:hardis:org",
5998
- "unused-apex-classes:diagnose:org:hardis"
6032
+ "hardis:org:diagnose:audittrail",
6033
+ "org:hardis:diagnose:audittrail",
6034
+ "org:diagnose:hardis:audittrail",
6035
+ "org:diagnose:audittrail:hardis",
6036
+ "hardis:diagnose:org:audittrail",
6037
+ "diagnose:hardis:org:audittrail",
6038
+ "diagnose:org:hardis:audittrail",
6039
+ "diagnose:org:audittrail:hardis",
6040
+ "hardis:diagnose:audittrail:org",
6041
+ "diagnose:hardis:audittrail:org",
6042
+ "diagnose:audittrail:hardis:org",
6043
+ "diagnose:audittrail:org:hardis",
6044
+ "hardis:org:audittrail:diagnose",
6045
+ "org:hardis:audittrail:diagnose",
6046
+ "org:audittrail:hardis:diagnose",
6047
+ "org:audittrail:diagnose:hardis",
6048
+ "hardis:audittrail:org:diagnose",
6049
+ "audittrail:hardis:org:diagnose",
6050
+ "audittrail:org:hardis:diagnose",
6051
+ "audittrail:org:diagnose:hardis",
6052
+ "hardis:audittrail:diagnose:org",
6053
+ "audittrail:hardis:diagnose:org",
6054
+ "audittrail:diagnose:hardis:org",
6055
+ "audittrail:diagnose:org:hardis"
5999
6056
  ]
6000
6057
  },
6001
- "hardis:org:diagnose:unused-connected-apps": {
6058
+ "hardis:org:diagnose:instanceupgrade": {
6002
6059
  "aliases": [],
6003
6060
  "args": {},
6004
- "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",
6061
+ "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",
6005
6062
  "examples": [
6006
- "$ sf hardis:org:diagnose:unused-connected-apps"
6063
+ "$ sf hardis:org:diagnose:instanceupgrade"
6007
6064
  ],
6008
6065
  "flags": {
6009
6066
  "json": {
@@ -6021,14 +6078,6 @@
6021
6078
  "multiple": false,
6022
6079
  "type": "option"
6023
6080
  },
6024
- "outputfile": {
6025
- "char": "f",
6026
- "description": "Force the path and name of output report file. Must end with .csv",
6027
- "name": "outputfile",
6028
- "hasDynamicHelp": false,
6029
- "multiple": false,
6030
- "type": "option"
6031
- },
6032
6081
  "debug": {
6033
6082
  "char": "d",
6034
6083
  "description": "Activate debug mode (more logs)",
@@ -6067,30 +6116,13 @@
6067
6116
  },
6068
6117
  "hasDynamicHelp": true,
6069
6118
  "hiddenAliases": [],
6070
- "id": "hardis:org:diagnose:unused-connected-apps",
6119
+ "id": "hardis:org:diagnose:instanceupgrade",
6071
6120
  "pluginAlias": "sfdx-hardis",
6072
6121
  "pluginName": "sfdx-hardis",
6073
6122
  "pluginType": "core",
6074
6123
  "strict": true,
6075
6124
  "enableJsonFlag": true,
6076
- "title": "Unused Connected Apps in an org",
6077
- "allowedInactiveConnectedApps": [
6078
- "Ant Migration Tool",
6079
- "Chatter Desktop",
6080
- "Chatter Mobile for BlackBerry",
6081
- "Force.com IDE",
6082
- "OIQ_Integration",
6083
- "Salesforce CLI",
6084
- "Salesforce Files",
6085
- "Salesforce Mobile Dashboards",
6086
- "Salesforce Touch",
6087
- "Salesforce for Outlook",
6088
- "SalesforceA",
6089
- "SalesforceA for Android",
6090
- "SalesforceA for iOS",
6091
- "SalesforceDX Namespace Registry",
6092
- "SalesforceIQ"
6093
- ],
6125
+ "title": "Get Instance Upgrade date",
6094
6126
  "requiresProject": false,
6095
6127
  "isESM": true,
6096
6128
  "relativePath": [
@@ -6099,43 +6131,45 @@
6099
6131
  "hardis",
6100
6132
  "org",
6101
6133
  "diagnose",
6102
- "unused-connected-apps.js"
6134
+ "instanceupgrade.js"
6103
6135
  ],
6104
6136
  "aliasPermutations": [],
6105
6137
  "permutations": [
6106
- "hardis:org:diagnose:unused-connected-apps",
6107
- "org:hardis:diagnose:unused-connected-apps",
6108
- "org:diagnose:hardis:unused-connected-apps",
6109
- "org:diagnose:unused-connected-apps:hardis",
6110
- "hardis:diagnose:org:unused-connected-apps",
6111
- "diagnose:hardis:org:unused-connected-apps",
6112
- "diagnose:org:hardis:unused-connected-apps",
6113
- "diagnose:org:unused-connected-apps:hardis",
6114
- "hardis:diagnose:unused-connected-apps:org",
6115
- "diagnose:hardis:unused-connected-apps:org",
6116
- "diagnose:unused-connected-apps:hardis:org",
6117
- "diagnose:unused-connected-apps:org:hardis",
6118
- "hardis:org:unused-connected-apps:diagnose",
6119
- "org:hardis:unused-connected-apps:diagnose",
6120
- "org:unused-connected-apps:hardis:diagnose",
6121
- "org:unused-connected-apps:diagnose:hardis",
6122
- "hardis:unused-connected-apps:org:diagnose",
6123
- "unused-connected-apps:hardis:org:diagnose",
6124
- "unused-connected-apps:org:hardis:diagnose",
6125
- "unused-connected-apps:org:diagnose:hardis",
6126
- "hardis:unused-connected-apps:diagnose:org",
6127
- "unused-connected-apps:hardis:diagnose:org",
6128
- "unused-connected-apps:diagnose:hardis:org",
6129
- "unused-connected-apps:diagnose:org:hardis"
6138
+ "hardis:org:diagnose:instanceupgrade",
6139
+ "org:hardis:diagnose:instanceupgrade",
6140
+ "org:diagnose:hardis:instanceupgrade",
6141
+ "org:diagnose:instanceupgrade:hardis",
6142
+ "hardis:diagnose:org:instanceupgrade",
6143
+ "diagnose:hardis:org:instanceupgrade",
6144
+ "diagnose:org:hardis:instanceupgrade",
6145
+ "diagnose:org:instanceupgrade:hardis",
6146
+ "hardis:diagnose:instanceupgrade:org",
6147
+ "diagnose:hardis:instanceupgrade:org",
6148
+ "diagnose:instanceupgrade:hardis:org",
6149
+ "diagnose:instanceupgrade:org:hardis",
6150
+ "hardis:org:instanceupgrade:diagnose",
6151
+ "org:hardis:instanceupgrade:diagnose",
6152
+ "org:instanceupgrade:hardis:diagnose",
6153
+ "org:instanceupgrade:diagnose:hardis",
6154
+ "hardis:instanceupgrade:org:diagnose",
6155
+ "instanceupgrade:hardis:org:diagnose",
6156
+ "instanceupgrade:org:hardis:diagnose",
6157
+ "instanceupgrade:org:diagnose:hardis",
6158
+ "hardis:instanceupgrade:diagnose:org",
6159
+ "instanceupgrade:hardis:diagnose:org",
6160
+ "instanceupgrade:diagnose:hardis:org",
6161
+ "instanceupgrade:diagnose:org:hardis"
6130
6162
  ]
6131
6163
  },
6132
- "hardis:org:diagnose:unusedlicenses": {
6164
+ "hardis:org:diagnose:legacyapi": {
6133
6165
  "aliases": [],
6134
6166
  "args": {},
6135
- "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",
6167
+ "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",
6136
6168
  "examples": [
6137
- "$ sf hardis:org:diagnose:unusedlicenses",
6138
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
6169
+ "$ sf hardis:org:diagnose:legacyapi",
6170
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
6171
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
6172
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6139
6173
  ],
6140
6174
  "flags": {
6141
6175
  "json": {
@@ -6153,6 +6187,24 @@
6153
6187
  "multiple": false,
6154
6188
  "type": "option"
6155
6189
  },
6190
+ "eventtype": {
6191
+ "char": "e",
6192
+ "description": "Type of EventLogFile event to analyze",
6193
+ "name": "eventtype",
6194
+ "default": "ApiTotalUsage",
6195
+ "hasDynamicHelp": false,
6196
+ "multiple": false,
6197
+ "type": "option"
6198
+ },
6199
+ "limit": {
6200
+ "char": "l",
6201
+ "description": "Number of latest EventLogFile events to analyze",
6202
+ "name": "limit",
6203
+ "default": 999,
6204
+ "hasDynamicHelp": false,
6205
+ "multiple": false,
6206
+ "type": "option"
6207
+ },
6156
6208
  "outputfile": {
6157
6209
  "char": "f",
6158
6210
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6199,32 +6251,14 @@
6199
6251
  },
6200
6252
  "hasDynamicHelp": true,
6201
6253
  "hiddenAliases": [],
6202
- "id": "hardis:org:diagnose:unusedlicenses",
6254
+ "id": "hardis:org:diagnose:legacyapi",
6203
6255
  "pluginAlias": "sfdx-hardis",
6204
6256
  "pluginName": "sfdx-hardis",
6205
6257
  "pluginType": "core",
6206
6258
  "strict": true,
6207
6259
  "enableJsonFlag": true,
6208
- "title": "Detect unused Permission Set Licenses (beta)",
6260
+ "title": "Check for legacy API use",
6209
6261
  "requiresProject": false,
6210
- "additionalPermissionSetsToAlwaysGet": [
6211
- "Sales_User"
6212
- ],
6213
- "permSetsPermSetLicenses": [
6214
- {
6215
- "permSet": "Sales_User",
6216
- "permSetLicense": "SalesUserPsl"
6217
- }
6218
- ],
6219
- "profilesPermissionSetLicenses": [
6220
- {
6221
- "profile": "Salesforce API Only",
6222
- "permSetLicense": "SalesforceAPIIntegrationPsl"
6223
- }
6224
- ],
6225
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6226
- "IdentityConnect"
6227
- ],
6228
6262
  "isESM": true,
6229
6263
  "relativePath": [
6230
6264
  "lib",
@@ -6232,46 +6266,42 @@
6232
6266
  "hardis",
6233
6267
  "org",
6234
6268
  "diagnose",
6235
- "unusedlicenses.js"
6269
+ "legacyapi.js"
6236
6270
  ],
6237
6271
  "aliasPermutations": [],
6238
6272
  "permutations": [
6239
- "hardis:org:diagnose:unusedlicenses",
6240
- "org:hardis:diagnose:unusedlicenses",
6241
- "org:diagnose:hardis:unusedlicenses",
6242
- "org:diagnose:unusedlicenses:hardis",
6243
- "hardis:diagnose:org:unusedlicenses",
6244
- "diagnose:hardis:org:unusedlicenses",
6245
- "diagnose:org:hardis:unusedlicenses",
6246
- "diagnose:org:unusedlicenses:hardis",
6247
- "hardis:diagnose:unusedlicenses:org",
6248
- "diagnose:hardis:unusedlicenses:org",
6249
- "diagnose:unusedlicenses:hardis:org",
6250
- "diagnose:unusedlicenses:org:hardis",
6251
- "hardis:org:unusedlicenses:diagnose",
6252
- "org:hardis:unusedlicenses:diagnose",
6253
- "org:unusedlicenses:hardis:diagnose",
6254
- "org:unusedlicenses:diagnose:hardis",
6255
- "hardis:unusedlicenses:org:diagnose",
6256
- "unusedlicenses:hardis:org:diagnose",
6257
- "unusedlicenses:org:hardis:diagnose",
6258
- "unusedlicenses:org:diagnose:hardis",
6259
- "hardis:unusedlicenses:diagnose:org",
6260
- "unusedlicenses:hardis:diagnose:org",
6261
- "unusedlicenses:diagnose:hardis:org",
6262
- "unusedlicenses:diagnose:org:hardis"
6273
+ "hardis:org:diagnose:legacyapi",
6274
+ "org:hardis:diagnose:legacyapi",
6275
+ "org:diagnose:hardis:legacyapi",
6276
+ "org:diagnose:legacyapi:hardis",
6277
+ "hardis:diagnose:org:legacyapi",
6278
+ "diagnose:hardis:org:legacyapi",
6279
+ "diagnose:org:hardis:legacyapi",
6280
+ "diagnose:org:legacyapi:hardis",
6281
+ "hardis:diagnose:legacyapi:org",
6282
+ "diagnose:hardis:legacyapi:org",
6283
+ "diagnose:legacyapi:hardis:org",
6284
+ "diagnose:legacyapi:org:hardis",
6285
+ "hardis:org:legacyapi:diagnose",
6286
+ "org:hardis:legacyapi:diagnose",
6287
+ "org:legacyapi:hardis:diagnose",
6288
+ "org:legacyapi:diagnose:hardis",
6289
+ "hardis:legacyapi:org:diagnose",
6290
+ "legacyapi:hardis:org:diagnose",
6291
+ "legacyapi:org:hardis:diagnose",
6292
+ "legacyapi:org:diagnose:hardis",
6293
+ "hardis:legacyapi:diagnose:org",
6294
+ "legacyapi:hardis:diagnose:org",
6295
+ "legacyapi:diagnose:hardis:org",
6296
+ "legacyapi:diagnose:org:hardis"
6263
6297
  ]
6264
6298
  },
6265
- "hardis:org:diagnose:unusedusers": {
6299
+ "hardis:org:diagnose:licenses": {
6266
6300
  "aliases": [],
6267
6301
  "args": {},
6268
- "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>",
6302
+ "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",
6269
6303
  "examples": [
6270
- "$ sf hardis:org:diagnose:unusedusers",
6271
- "$ sf hardis:org:diagnose:unusedusers --days 365",
6272
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6273
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6274
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6304
+ "$ sf hardis:org:diagnose:licenses"
6275
6305
  ],
6276
6306
  "flags": {
6277
6307
  "json": {
@@ -6297,38 +6327,10 @@
6297
6327
  "multiple": false,
6298
6328
  "type": "option"
6299
6329
  },
6300
- "days": {
6301
- "char": "t",
6302
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6303
- "name": "days",
6304
- "hasDynamicHelp": false,
6305
- "multiple": false,
6306
- "type": "option"
6307
- },
6308
- "licensetypes": {
6309
- "char": "l",
6310
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6311
- "name": "licensetypes",
6312
- "hasDynamicHelp": false,
6313
- "multiple": false,
6314
- "options": [
6315
- "all",
6316
- "all-crm",
6317
- "all-paying"
6318
- ],
6319
- "type": "option"
6320
- },
6321
- "licenseidentifiers": {
6322
- "char": "i",
6323
- "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",
6324
- "name": "licenseidentifiers",
6325
- "hasDynamicHelp": false,
6326
- "multiple": false,
6327
- "type": "option"
6328
- },
6329
- "returnactiveusers": {
6330
- "description": "Inverts the command by returning the active users",
6331
- "name": "returnactiveusers",
6330
+ "usedonly": {
6331
+ "char": "u",
6332
+ "description": "Filter to have only used licenses",
6333
+ "name": "usedonly",
6332
6334
  "allowNo": false,
6333
6335
  "type": "boolean"
6334
6336
  },
@@ -6370,13 +6372,13 @@
6370
6372
  },
6371
6373
  "hasDynamicHelp": true,
6372
6374
  "hiddenAliases": [],
6373
- "id": "hardis:org:diagnose:unusedusers",
6375
+ "id": "hardis:org:diagnose:licenses",
6374
6376
  "pluginAlias": "sfdx-hardis",
6375
6377
  "pluginName": "sfdx-hardis",
6376
6378
  "pluginType": "core",
6377
6379
  "strict": true,
6378
6380
  "enableJsonFlag": true,
6379
- "title": "Detect unused Users in Salesforce",
6381
+ "title": "List licenses subscribed and used in a Salesforce org",
6380
6382
  "requiresProject": false,
6381
6383
  "isESM": true,
6382
6384
  "relativePath": [
@@ -6385,42 +6387,42 @@
6385
6387
  "hardis",
6386
6388
  "org",
6387
6389
  "diagnose",
6388
- "unusedusers.js"
6390
+ "licenses.js"
6389
6391
  ],
6390
6392
  "aliasPermutations": [],
6391
6393
  "permutations": [
6392
- "hardis:org:diagnose:unusedusers",
6393
- "org:hardis:diagnose:unusedusers",
6394
- "org:diagnose:hardis:unusedusers",
6395
- "org:diagnose:unusedusers:hardis",
6396
- "hardis:diagnose:org:unusedusers",
6397
- "diagnose:hardis:org:unusedusers",
6398
- "diagnose:org:hardis:unusedusers",
6399
- "diagnose:org:unusedusers:hardis",
6400
- "hardis:diagnose:unusedusers:org",
6401
- "diagnose:hardis:unusedusers:org",
6402
- "diagnose:unusedusers:hardis:org",
6403
- "diagnose:unusedusers:org:hardis",
6404
- "hardis:org:unusedusers:diagnose",
6405
- "org:hardis:unusedusers:diagnose",
6406
- "org:unusedusers:hardis:diagnose",
6407
- "org:unusedusers:diagnose:hardis",
6408
- "hardis:unusedusers:org:diagnose",
6409
- "unusedusers:hardis:org:diagnose",
6410
- "unusedusers:org:hardis:diagnose",
6411
- "unusedusers:org:diagnose:hardis",
6412
- "hardis:unusedusers:diagnose:org",
6413
- "unusedusers:hardis:diagnose:org",
6414
- "unusedusers:diagnose:hardis:org",
6415
- "unusedusers:diagnose:org:hardis"
6394
+ "hardis:org:diagnose:licenses",
6395
+ "org:hardis:diagnose:licenses",
6396
+ "org:diagnose:hardis:licenses",
6397
+ "org:diagnose:licenses:hardis",
6398
+ "hardis:diagnose:org:licenses",
6399
+ "diagnose:hardis:org:licenses",
6400
+ "diagnose:org:hardis:licenses",
6401
+ "diagnose:org:licenses:hardis",
6402
+ "hardis:diagnose:licenses:org",
6403
+ "diagnose:hardis:licenses:org",
6404
+ "diagnose:licenses:hardis:org",
6405
+ "diagnose:licenses:org:hardis",
6406
+ "hardis:org:licenses:diagnose",
6407
+ "org:hardis:licenses:diagnose",
6408
+ "org:licenses:hardis:diagnose",
6409
+ "org:licenses:diagnose:hardis",
6410
+ "hardis:licenses:org:diagnose",
6411
+ "licenses:hardis:org:diagnose",
6412
+ "licenses:org:hardis:diagnose",
6413
+ "licenses:org:diagnose:hardis",
6414
+ "hardis:licenses:diagnose:org",
6415
+ "licenses:hardis:diagnose:org",
6416
+ "licenses:diagnose:hardis:org",
6417
+ "licenses:diagnose:org:hardis"
6416
6418
  ]
6417
6419
  },
6418
- "hardis:org:files:export": {
6420
+ "hardis:org:diagnose:releaseupdates": {
6419
6421
  "aliases": [],
6420
6422
  "args": {},
6421
- "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",
6423
+ "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",
6422
6424
  "examples": [
6423
- "$ sf hardis:org:files:export"
6425
+ "$ sf hardis:org:diagnose:releaseupdates"
6424
6426
  ],
6425
6427
  "flags": {
6426
6428
  "json": {
@@ -6438,48 +6440,14 @@
6438
6440
  "multiple": false,
6439
6441
  "type": "option"
6440
6442
  },
6441
- "path": {
6442
- "char": "p",
6443
- "description": "Path to the file export project",
6444
- "name": "path",
6443
+ "outputfile": {
6444
+ "char": "f",
6445
+ "description": "Force the path and name of output report file. Must end with .csv",
6446
+ "name": "outputfile",
6445
6447
  "hasDynamicHelp": false,
6446
6448
  "multiple": false,
6447
6449
  "type": "option"
6448
6450
  },
6449
- "chunksize": {
6450
- "char": "c",
6451
- "description": "Number of records to add in a chunk before it is processed",
6452
- "name": "chunksize",
6453
- "default": 1000,
6454
- "hasDynamicHelp": false,
6455
- "multiple": false,
6456
- "type": "option"
6457
- },
6458
- "polltimeout": {
6459
- "char": "t",
6460
- "description": "Timeout in MS for Bulk API calls",
6461
- "name": "polltimeout",
6462
- "default": 300000,
6463
- "hasDynamicHelp": false,
6464
- "multiple": false,
6465
- "type": "option"
6466
- },
6467
- "startchunknumber": {
6468
- "char": "s",
6469
- "description": "Chunk number to start from",
6470
- "name": "startchunknumber",
6471
- "default": 0,
6472
- "hasDynamicHelp": false,
6473
- "multiple": false,
6474
- "type": "option"
6475
- },
6476
- "resume": {
6477
- "char": "r",
6478
- "description": "Resume previous export by checking existing files (default in CI)",
6479
- "name": "resume",
6480
- "allowNo": false,
6481
- "type": "boolean"
6482
- },
6483
6451
  "debug": {
6484
6452
  "char": "d",
6485
6453
  "description": "Activate debug mode (more logs)",
@@ -6518,13 +6486,13 @@
6518
6486
  },
6519
6487
  "hasDynamicHelp": true,
6520
6488
  "hiddenAliases": [],
6521
- "id": "hardis:org:files:export",
6489
+ "id": "hardis:org:diagnose:releaseupdates",
6522
6490
  "pluginAlias": "sfdx-hardis",
6523
6491
  "pluginName": "sfdx-hardis",
6524
6492
  "pluginType": "core",
6525
6493
  "strict": true,
6526
6494
  "enableJsonFlag": true,
6527
- "title": "Export files",
6495
+ "title": "Check Release Updates of an org",
6528
6496
  "requiresProject": false,
6529
6497
  "isESM": true,
6530
6498
  "relativePath": [
@@ -6532,43 +6500,43 @@
6532
6500
  "commands",
6533
6501
  "hardis",
6534
6502
  "org",
6535
- "files",
6536
- "export.js"
6503
+ "diagnose",
6504
+ "releaseupdates.js"
6537
6505
  ],
6538
6506
  "aliasPermutations": [],
6539
6507
  "permutations": [
6540
- "hardis:org:files:export",
6541
- "org:hardis:files:export",
6542
- "org:files:hardis:export",
6543
- "org:files:export:hardis",
6544
- "hardis:files:org:export",
6545
- "files:hardis:org:export",
6546
- "files:org:hardis:export",
6547
- "files:org:export:hardis",
6548
- "hardis:files:export:org",
6549
- "files:hardis:export:org",
6550
- "files:export:hardis:org",
6551
- "files:export:org:hardis",
6552
- "hardis:org:export:files",
6553
- "org:hardis:export:files",
6554
- "org:export:hardis:files",
6555
- "org:export:files:hardis",
6556
- "hardis:export:org:files",
6557
- "export:hardis:org:files",
6558
- "export:org:hardis:files",
6559
- "export:org:files:hardis",
6560
- "hardis:export:files:org",
6561
- "export:hardis:files:org",
6562
- "export:files:hardis:org",
6563
- "export:files:org:hardis"
6508
+ "hardis:org:diagnose:releaseupdates",
6509
+ "org:hardis:diagnose:releaseupdates",
6510
+ "org:diagnose:hardis:releaseupdates",
6511
+ "org:diagnose:releaseupdates:hardis",
6512
+ "hardis:diagnose:org:releaseupdates",
6513
+ "diagnose:hardis:org:releaseupdates",
6514
+ "diagnose:org:hardis:releaseupdates",
6515
+ "diagnose:org:releaseupdates:hardis",
6516
+ "hardis:diagnose:releaseupdates:org",
6517
+ "diagnose:hardis:releaseupdates:org",
6518
+ "diagnose:releaseupdates:hardis:org",
6519
+ "diagnose:releaseupdates:org:hardis",
6520
+ "hardis:org:releaseupdates:diagnose",
6521
+ "org:hardis:releaseupdates:diagnose",
6522
+ "org:releaseupdates:hardis:diagnose",
6523
+ "org:releaseupdates:diagnose:hardis",
6524
+ "hardis:releaseupdates:org:diagnose",
6525
+ "releaseupdates:hardis:org:diagnose",
6526
+ "releaseupdates:org:hardis:diagnose",
6527
+ "releaseupdates:org:diagnose:hardis",
6528
+ "hardis:releaseupdates:diagnose:org",
6529
+ "releaseupdates:hardis:diagnose:org",
6530
+ "releaseupdates:diagnose:hardis:org",
6531
+ "releaseupdates:diagnose:org:hardis"
6564
6532
  ]
6565
6533
  },
6566
- "hardis:org:files:import": {
6534
+ "hardis:org:diagnose:unsecure-connected-apps": {
6567
6535
  "aliases": [],
6568
6536
  "args": {},
6569
- "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",
6537
+ "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",
6570
6538
  "examples": [
6571
- "$ sf hardis:org:files:import"
6539
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6572
6540
  ],
6573
6541
  "flags": {
6574
6542
  "json": {
@@ -6586,21 +6554,14 @@
6586
6554
  "multiple": false,
6587
6555
  "type": "option"
6588
6556
  },
6589
- "path": {
6590
- "char": "p",
6591
- "description": "Path to the file export project",
6592
- "name": "path",
6557
+ "outputfile": {
6558
+ "char": "f",
6559
+ "description": "Force the path and name of output report file. Must end with .csv",
6560
+ "name": "outputfile",
6593
6561
  "hasDynamicHelp": false,
6594
6562
  "multiple": false,
6595
6563
  "type": "option"
6596
6564
  },
6597
- "overwrite": {
6598
- "char": "f",
6599
- "description": "Override existing files (doubles the number of API calls)",
6600
- "name": "overwrite",
6601
- "allowNo": false,
6602
- "type": "boolean"
6603
- },
6604
6565
  "debug": {
6605
6566
  "char": "d",
6606
6567
  "description": "Activate debug mode (more logs)",
@@ -6639,13 +6600,13 @@
6639
6600
  },
6640
6601
  "hasDynamicHelp": true,
6641
6602
  "hiddenAliases": [],
6642
- "id": "hardis:org:files:import",
6603
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
6643
6604
  "pluginAlias": "sfdx-hardis",
6644
6605
  "pluginName": "sfdx-hardis",
6645
6606
  "pluginType": "core",
6646
6607
  "strict": true,
6647
6608
  "enableJsonFlag": true,
6648
- "title": "Import files",
6609
+ "title": "Detect Unsecured Connected Apps",
6649
6610
  "requiresProject": false,
6650
6611
  "isESM": true,
6651
6612
  "relativePath": [
@@ -6653,43 +6614,44 @@
6653
6614
  "commands",
6654
6615
  "hardis",
6655
6616
  "org",
6656
- "files",
6657
- "import.js"
6617
+ "diagnose",
6618
+ "unsecure-connected-apps.js"
6658
6619
  ],
6659
6620
  "aliasPermutations": [],
6660
6621
  "permutations": [
6661
- "hardis:org:files:import",
6662
- "org:hardis:files:import",
6663
- "org:files:hardis:import",
6664
- "org:files:import:hardis",
6665
- "hardis:files:org:import",
6666
- "files:hardis:org:import",
6667
- "files:org:hardis:import",
6668
- "files:org:import:hardis",
6669
- "hardis:files:import:org",
6670
- "files:hardis:import:org",
6671
- "files:import:hardis:org",
6672
- "files:import:org:hardis",
6673
- "hardis:org:import:files",
6674
- "org:hardis:import:files",
6675
- "org:import:hardis:files",
6676
- "org:import:files:hardis",
6677
- "hardis:import:org:files",
6678
- "import:hardis:org:files",
6679
- "import:org:hardis:files",
6680
- "import:org:files:hardis",
6681
- "hardis:import:files:org",
6682
- "import:hardis:files:org",
6683
- "import:files:hardis:org",
6684
- "import:files:org:hardis"
6622
+ "hardis:org:diagnose:unsecure-connected-apps",
6623
+ "org:hardis:diagnose:unsecure-connected-apps",
6624
+ "org:diagnose:hardis:unsecure-connected-apps",
6625
+ "org:diagnose:unsecure-connected-apps:hardis",
6626
+ "hardis:diagnose:org:unsecure-connected-apps",
6627
+ "diagnose:hardis:org:unsecure-connected-apps",
6628
+ "diagnose:org:hardis:unsecure-connected-apps",
6629
+ "diagnose:org:unsecure-connected-apps:hardis",
6630
+ "hardis:diagnose:unsecure-connected-apps:org",
6631
+ "diagnose:hardis:unsecure-connected-apps:org",
6632
+ "diagnose:unsecure-connected-apps:hardis:org",
6633
+ "diagnose:unsecure-connected-apps:org:hardis",
6634
+ "hardis:org:unsecure-connected-apps:diagnose",
6635
+ "org:hardis:unsecure-connected-apps:diagnose",
6636
+ "org:unsecure-connected-apps:hardis:diagnose",
6637
+ "org:unsecure-connected-apps:diagnose:hardis",
6638
+ "hardis:unsecure-connected-apps:org:diagnose",
6639
+ "unsecure-connected-apps:hardis:org:diagnose",
6640
+ "unsecure-connected-apps:org:hardis:diagnose",
6641
+ "unsecure-connected-apps:org:diagnose:hardis",
6642
+ "hardis:unsecure-connected-apps:diagnose:org",
6643
+ "unsecure-connected-apps:hardis:diagnose:org",
6644
+ "unsecure-connected-apps:diagnose:hardis:org",
6645
+ "unsecure-connected-apps:diagnose:org:hardis"
6685
6646
  ]
6686
6647
  },
6687
- "hardis:org:data:delete": {
6648
+ "hardis:org:diagnose:unused-apex-classes": {
6688
6649
  "aliases": [],
6689
6650
  "args": {},
6690
- "description": "\n## Command Behavior\n\n**Deletes records in multiple Salesforce objects using an SFDMU (Salesforce Data Migration Utility) workspace.**\n\nThis command provides a powerful and controlled way to remove data from your Salesforce orgs based on configurations defined in an SFDMU workspace. It's particularly useful for:\n\n- **Data Cleanup:** Removing test data, obsolete records, or sensitive information.\n- **Environment Reset:** Preparing sandboxes for new development cycles by clearing specific data sets.\n- **Compliance:** Deleting data to meet regulatory requirements.\n\n**Important Considerations for Production Environments:**\n\nIf you intend to run this command in a production environment, you must:\n\n- Set `runnableInProduction` to `true` in your `export.json` file within the SFDMU workspace.\n- Define `sfdmuCanModify: YOUR_INSTANCE_URL` in your branch-specific configuration file (e.g., `config/branches/.sfdx-hardis.YOUR_BRANCH.yml`) to explicitly authorize data modification for that instance.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It leverages the `sfdmu` plugin to perform the actual data deletion operations. The command acts as a wrapper, providing an assisted interface for SFDMU execution.\n- **Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select a data workspace using `selectDataWorkspace`.\n- **Org Selection:** It ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt using `promptOrgUsernameDefault`) to specify where the data deletion will occur.\n- **`deleteData` Utility:** The core logic for executing the SFDMU deletion process is encapsulated within the `deleteData` utility function, which takes the SFDMU workspace path and the target username as arguments.\n- **Environment Awareness:** It checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
6651
+ "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",
6691
6652
  "examples": [
6692
- "$ sf hardis:org:data:delete"
6653
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6654
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6693
6655
  ],
6694
6656
  "flags": {
6695
6657
  "json": {
@@ -6707,10 +6669,18 @@
6707
6669
  "multiple": false,
6708
6670
  "type": "option"
6709
6671
  },
6710
- "path": {
6711
- "char": "p",
6712
- "description": "Path to the sfdmu workspace folder",
6713
- "name": "path",
6672
+ "outputfile": {
6673
+ "char": "f",
6674
+ "description": "Force the path and name of output report file. Must end with .csv",
6675
+ "name": "outputfile",
6676
+ "hasDynamicHelp": false,
6677
+ "multiple": false,
6678
+ "type": "option"
6679
+ },
6680
+ "days": {
6681
+ "char": "t",
6682
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6683
+ "name": "days",
6714
6684
  "hasDynamicHelp": false,
6715
6685
  "multiple": false,
6716
6686
  "type": "option"
@@ -6753,62 +6723,57 @@
6753
6723
  },
6754
6724
  "hasDynamicHelp": true,
6755
6725
  "hiddenAliases": [],
6756
- "id": "hardis:org:data:delete",
6726
+ "id": "hardis:org:diagnose:unused-apex-classes",
6757
6727
  "pluginAlias": "sfdx-hardis",
6758
6728
  "pluginName": "sfdx-hardis",
6759
6729
  "pluginType": "core",
6760
6730
  "strict": true,
6761
6731
  "enableJsonFlag": true,
6762
- "title": "Delete data",
6732
+ "title": "Detect unused Apex classes in an org",
6763
6733
  "requiresProject": false,
6764
- "requiresSfdxPlugins": [
6765
- "sfdmu"
6766
- ],
6767
6734
  "isESM": true,
6768
6735
  "relativePath": [
6769
6736
  "lib",
6770
6737
  "commands",
6771
6738
  "hardis",
6772
6739
  "org",
6773
- "data",
6774
- "delete.js"
6740
+ "diagnose",
6741
+ "unused-apex-classes.js"
6775
6742
  ],
6776
6743
  "aliasPermutations": [],
6777
6744
  "permutations": [
6778
- "hardis:org:data:delete",
6779
- "org:hardis:data:delete",
6780
- "org:data:hardis:delete",
6781
- "org:data:delete:hardis",
6782
- "hardis:data:org:delete",
6783
- "data:hardis:org:delete",
6784
- "data:org:hardis:delete",
6785
- "data:org:delete:hardis",
6786
- "hardis:data:delete:org",
6787
- "data:hardis:delete:org",
6788
- "data:delete:hardis:org",
6789
- "data:delete:org:hardis",
6790
- "hardis:org:delete:data",
6791
- "org:hardis:delete:data",
6792
- "org:delete:hardis:data",
6793
- "org:delete:data:hardis",
6794
- "hardis:delete:org:data",
6795
- "delete:hardis:org:data",
6796
- "delete:org:hardis:data",
6797
- "delete:org:data:hardis",
6798
- "hardis:delete:data:org",
6799
- "delete:hardis:data:org",
6800
- "delete:data:hardis:org",
6801
- "delete:data:org:hardis"
6745
+ "hardis:org:diagnose:unused-apex-classes",
6746
+ "org:hardis:diagnose:unused-apex-classes",
6747
+ "org:diagnose:hardis:unused-apex-classes",
6748
+ "org:diagnose:unused-apex-classes:hardis",
6749
+ "hardis:diagnose:org:unused-apex-classes",
6750
+ "diagnose:hardis:org:unused-apex-classes",
6751
+ "diagnose:org:hardis:unused-apex-classes",
6752
+ "diagnose:org:unused-apex-classes:hardis",
6753
+ "hardis:diagnose:unused-apex-classes:org",
6754
+ "diagnose:hardis:unused-apex-classes:org",
6755
+ "diagnose:unused-apex-classes:hardis:org",
6756
+ "diagnose:unused-apex-classes:org:hardis",
6757
+ "hardis:org:unused-apex-classes:diagnose",
6758
+ "org:hardis:unused-apex-classes:diagnose",
6759
+ "org:unused-apex-classes:hardis:diagnose",
6760
+ "org:unused-apex-classes:diagnose:hardis",
6761
+ "hardis:unused-apex-classes:org:diagnose",
6762
+ "unused-apex-classes:hardis:org:diagnose",
6763
+ "unused-apex-classes:org:hardis:diagnose",
6764
+ "unused-apex-classes:org:diagnose:hardis",
6765
+ "hardis:unused-apex-classes:diagnose:org",
6766
+ "unused-apex-classes:hardis:diagnose:org",
6767
+ "unused-apex-classes:diagnose:hardis:org",
6768
+ "unused-apex-classes:diagnose:org:hardis"
6802
6769
  ]
6803
6770
  },
6804
- "hardis:org:data:export": {
6771
+ "hardis:org:diagnose:unused-connected-apps": {
6805
6772
  "aliases": [],
6806
6773
  "args": {},
6807
- "description": "\n## Command Behavior\n\n**Exports data from a Salesforce org using an SFDMU (Salesforce Data Migration Utility) project.**\n\nThis command facilitates the extraction of data from your Salesforce environments based on configurations defined in an SFDMU workspace. It's a powerful tool for various data-related tasks, including:\n\n- **Data Backup:** Creating snapshots of your Salesforce data.\n- **Data Migration:** Extracting data for transfer to another Salesforce org or external system.\n- **Reporting and Analysis:** Exporting specific datasets for detailed analysis outside of Salesforce.\n- **Data Seeding:** Preparing data for import into other environments.\n\nKey functionalities:\n\n- **SFDMU Workspace Integration:** Leverages an existing SFDMU workspace (defined by an `export.json` file) to determine which objects and records to export, along with any filtering or transformation rules.\n- **Interactive Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Org Selection:** Ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt) to specify the source of the data export.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It acts as a wrapper around the `sfdmu` plugin, which performs the actual data export operations. The command provides an assisted interface for SFDMU execution.\n- **`exportData` Utility:** The core logic for executing the SFDMU export process is encapsulated within the `exportData` utility function, which takes the SFDMU workspace path and the source username as arguments.\n- **Interactive Prompts:** Uses `selectDataWorkspace` to allow the user to choose an SFDMU project and `promptOrgUsernameDefault` for selecting the source Salesforce org when not running in a CI environment.\n- **Environment Awareness:** Checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
6774
+ "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",
6808
6775
  "examples": [
6809
- "$ sf hardis:org:data:export",
6810
- "$ sf hardis:org:data:export --project-name MyDataProject --target-org my-org@example.com",
6811
- "$ sf hardis:org:data:export --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com"
6776
+ "$ sf hardis:org:diagnose:unused-connected-apps"
6812
6777
  ],
6813
6778
  "flags": {
6814
6779
  "json": {
@@ -6826,29 +6791,14 @@
6826
6791
  "multiple": false,
6827
6792
  "type": "option"
6828
6793
  },
6829
- "project-name": {
6830
- "char": "n",
6831
- "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
6832
- "name": "project-name",
6833
- "hasDynamicHelp": false,
6834
- "multiple": false,
6835
- "type": "option"
6836
- },
6837
- "path": {
6838
- "char": "p",
6839
- "description": "Path to the sfdmu workspace folder",
6840
- "name": "path",
6794
+ "outputfile": {
6795
+ "char": "f",
6796
+ "description": "Force the path and name of output report file. Must end with .csv",
6797
+ "name": "outputfile",
6841
6798
  "hasDynamicHelp": false,
6842
6799
  "multiple": false,
6843
6800
  "type": "option"
6844
6801
  },
6845
- "no-prompt": {
6846
- "char": "r",
6847
- "description": "Do not prompt for Org, use default org",
6848
- "name": "no-prompt",
6849
- "allowNo": false,
6850
- "type": "boolean"
6851
- },
6852
6802
  "debug": {
6853
6803
  "char": "d",
6854
6804
  "description": "Activate debug mode (more logs)",
@@ -6887,63 +6837,75 @@
6887
6837
  },
6888
6838
  "hasDynamicHelp": true,
6889
6839
  "hiddenAliases": [],
6890
- "id": "hardis:org:data:export",
6840
+ "id": "hardis:org:diagnose:unused-connected-apps",
6891
6841
  "pluginAlias": "sfdx-hardis",
6892
6842
  "pluginName": "sfdx-hardis",
6893
6843
  "pluginType": "core",
6894
6844
  "strict": true,
6895
6845
  "enableJsonFlag": true,
6896
- "title": "Export data",
6897
- "requiresProject": false,
6898
- "requiresSfdxPlugins": [
6899
- "sfdmu"
6846
+ "title": "Unused Connected Apps in an org",
6847
+ "allowedInactiveConnectedApps": [
6848
+ "Ant Migration Tool",
6849
+ "Chatter Desktop",
6850
+ "Chatter Mobile for BlackBerry",
6851
+ "Force.com IDE",
6852
+ "OIQ_Integration",
6853
+ "Salesforce CLI",
6854
+ "Salesforce Files",
6855
+ "Salesforce Mobile Dashboards",
6856
+ "Salesforce Touch",
6857
+ "Salesforce for Outlook",
6858
+ "SalesforceA",
6859
+ "SalesforceA for Android",
6860
+ "SalesforceA for iOS",
6861
+ "SalesforceDX Namespace Registry",
6862
+ "SalesforceIQ"
6900
6863
  ],
6864
+ "requiresProject": false,
6901
6865
  "isESM": true,
6902
6866
  "relativePath": [
6903
6867
  "lib",
6904
6868
  "commands",
6905
6869
  "hardis",
6906
6870
  "org",
6907
- "data",
6908
- "export.js"
6871
+ "diagnose",
6872
+ "unused-connected-apps.js"
6909
6873
  ],
6910
6874
  "aliasPermutations": [],
6911
6875
  "permutations": [
6912
- "hardis:org:data:export",
6913
- "org:hardis:data:export",
6914
- "org:data:hardis:export",
6915
- "org:data:export:hardis",
6916
- "hardis:data:org:export",
6917
- "data:hardis:org:export",
6918
- "data:org:hardis:export",
6919
- "data:org:export:hardis",
6920
- "hardis:data:export:org",
6921
- "data:hardis:export:org",
6922
- "data:export:hardis:org",
6923
- "data:export:org:hardis",
6924
- "hardis:org:export:data",
6925
- "org:hardis:export:data",
6926
- "org:export:hardis:data",
6927
- "org:export:data:hardis",
6928
- "hardis:export:org:data",
6929
- "export:hardis:org:data",
6930
- "export:org:hardis:data",
6931
- "export:org:data:hardis",
6932
- "hardis:export:data:org",
6933
- "export:hardis:data:org",
6934
- "export:data:hardis:org",
6935
- "export:data:org:hardis"
6876
+ "hardis:org:diagnose:unused-connected-apps",
6877
+ "org:hardis:diagnose:unused-connected-apps",
6878
+ "org:diagnose:hardis:unused-connected-apps",
6879
+ "org:diagnose:unused-connected-apps:hardis",
6880
+ "hardis:diagnose:org:unused-connected-apps",
6881
+ "diagnose:hardis:org:unused-connected-apps",
6882
+ "diagnose:org:hardis:unused-connected-apps",
6883
+ "diagnose:org:unused-connected-apps:hardis",
6884
+ "hardis:diagnose:unused-connected-apps:org",
6885
+ "diagnose:hardis:unused-connected-apps:org",
6886
+ "diagnose:unused-connected-apps:hardis:org",
6887
+ "diagnose:unused-connected-apps:org:hardis",
6888
+ "hardis:org:unused-connected-apps:diagnose",
6889
+ "org:hardis:unused-connected-apps:diagnose",
6890
+ "org:unused-connected-apps:hardis:diagnose",
6891
+ "org:unused-connected-apps:diagnose:hardis",
6892
+ "hardis:unused-connected-apps:org:diagnose",
6893
+ "unused-connected-apps:hardis:org:diagnose",
6894
+ "unused-connected-apps:org:hardis:diagnose",
6895
+ "unused-connected-apps:org:diagnose:hardis",
6896
+ "hardis:unused-connected-apps:diagnose:org",
6897
+ "unused-connected-apps:hardis:diagnose:org",
6898
+ "unused-connected-apps:diagnose:hardis:org",
6899
+ "unused-connected-apps:diagnose:org:hardis"
6936
6900
  ]
6937
6901
  },
6938
- "hardis:org:data:import": {
6902
+ "hardis:org:diagnose:unusedlicenses": {
6939
6903
  "aliases": [],
6940
6904
  "args": {},
6941
- "description": "Import/Load data in an org using a [SFDX Data Loader](https://help.sfdmu.com/) Project\n\nIf you need to run this command in a production org, you need to either:\n\n- Define **sfdmuCanModify** in your .sfdx-hardis.yml config file. (Example: `sfdmuCanModify: prod-instance.my.salesforce.com`)\n- Define an environment variable SFDMU_CAN_MODIFY. (Example: `SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com`)\n\nSee article:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n",
6905
+ "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",
6942
6906
  "examples": [
6943
- "$ sf hardis:org:data:import",
6944
- "$ sf hardis:org:data:import --project-name MyDataProject --target-org my-org@example.com",
6945
- "$ sf hardis:org:data:import --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com",
6946
- "$ SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com sf hardis:org:data:import --project-name MyDataProject --target-org prod@example.com"
6907
+ "$ sf hardis:org:diagnose:unusedlicenses",
6908
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
6947
6909
  ],
6948
6910
  "flags": {
6949
6911
  "json": {
@@ -6961,29 +6923,14 @@
6961
6923
  "multiple": false,
6962
6924
  "type": "option"
6963
6925
  },
6964
- "project-name": {
6965
- "char": "n",
6966
- "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
6967
- "name": "project-name",
6968
- "hasDynamicHelp": false,
6969
- "multiple": false,
6970
- "type": "option"
6971
- },
6972
- "path": {
6973
- "char": "p",
6974
- "description": "Path to the sfdmu workspace folder",
6975
- "name": "path",
6926
+ "outputfile": {
6927
+ "char": "f",
6928
+ "description": "Force the path and name of output report file. Must end with .csv",
6929
+ "name": "outputfile",
6976
6930
  "hasDynamicHelp": false,
6977
6931
  "multiple": false,
6978
6932
  "type": "option"
6979
6933
  },
6980
- "no-prompt": {
6981
- "char": "r",
6982
- "description": "Do not prompt for Org, use default org",
6983
- "name": "no-prompt",
6984
- "allowNo": false,
6985
- "type": "boolean"
6986
- },
6987
6934
  "debug": {
6988
6935
  "char": "d",
6989
6936
  "description": "Activate debug mode (more logs)",
@@ -7022,16 +6969,31 @@
7022
6969
  },
7023
6970
  "hasDynamicHelp": true,
7024
6971
  "hiddenAliases": [],
7025
- "id": "hardis:org:data:import",
6972
+ "id": "hardis:org:diagnose:unusedlicenses",
7026
6973
  "pluginAlias": "sfdx-hardis",
7027
6974
  "pluginName": "sfdx-hardis",
7028
6975
  "pluginType": "core",
7029
6976
  "strict": true,
7030
6977
  "enableJsonFlag": true,
7031
- "title": "Import data",
6978
+ "title": "Detect unused Permission Set Licenses (beta)",
7032
6979
  "requiresProject": false,
7033
- "requiresSfdxPlugins": [
7034
- "sfdmu"
6980
+ "additionalPermissionSetsToAlwaysGet": [
6981
+ "Sales_User"
6982
+ ],
6983
+ "permSetsPermSetLicenses": [
6984
+ {
6985
+ "permSet": "Sales_User",
6986
+ "permSetLicense": "SalesUserPsl"
6987
+ }
6988
+ ],
6989
+ "profilesPermissionSetLicenses": [
6990
+ {
6991
+ "profile": "Salesforce API Only",
6992
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
6993
+ }
6994
+ ],
6995
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6996
+ "IdentityConnect"
7035
6997
  ],
7036
6998
  "isESM": true,
7037
6999
  "relativePath": [
@@ -7039,44 +7001,47 @@
7039
7001
  "commands",
7040
7002
  "hardis",
7041
7003
  "org",
7042
- "data",
7043
- "import.js"
7004
+ "diagnose",
7005
+ "unusedlicenses.js"
7044
7006
  ],
7045
7007
  "aliasPermutations": [],
7046
7008
  "permutations": [
7047
- "hardis:org:data:import",
7048
- "org:hardis:data:import",
7049
- "org:data:hardis:import",
7050
- "org:data:import:hardis",
7051
- "hardis:data:org:import",
7052
- "data:hardis:org:import",
7053
- "data:org:hardis:import",
7054
- "data:org:import:hardis",
7055
- "hardis:data:import:org",
7056
- "data:hardis:import:org",
7057
- "data:import:hardis:org",
7058
- "data:import:org:hardis",
7059
- "hardis:org:import:data",
7060
- "org:hardis:import:data",
7061
- "org:import:hardis:data",
7062
- "org:import:data:hardis",
7063
- "hardis:import:org:data",
7064
- "import:hardis:org:data",
7065
- "import:org:hardis:data",
7066
- "import:org:data:hardis",
7067
- "hardis:import:data:org",
7068
- "import:hardis:data:org",
7069
- "import:data:hardis:org",
7070
- "import:data:org:hardis"
7009
+ "hardis:org:diagnose:unusedlicenses",
7010
+ "org:hardis:diagnose:unusedlicenses",
7011
+ "org:diagnose:hardis:unusedlicenses",
7012
+ "org:diagnose:unusedlicenses:hardis",
7013
+ "hardis:diagnose:org:unusedlicenses",
7014
+ "diagnose:hardis:org:unusedlicenses",
7015
+ "diagnose:org:hardis:unusedlicenses",
7016
+ "diagnose:org:unusedlicenses:hardis",
7017
+ "hardis:diagnose:unusedlicenses:org",
7018
+ "diagnose:hardis:unusedlicenses:org",
7019
+ "diagnose:unusedlicenses:hardis:org",
7020
+ "diagnose:unusedlicenses:org:hardis",
7021
+ "hardis:org:unusedlicenses:diagnose",
7022
+ "org:hardis:unusedlicenses:diagnose",
7023
+ "org:unusedlicenses:hardis:diagnose",
7024
+ "org:unusedlicenses:diagnose:hardis",
7025
+ "hardis:unusedlicenses:org:diagnose",
7026
+ "unusedlicenses:hardis:org:diagnose",
7027
+ "unusedlicenses:org:hardis:diagnose",
7028
+ "unusedlicenses:org:diagnose:hardis",
7029
+ "hardis:unusedlicenses:diagnose:org",
7030
+ "unusedlicenses:hardis:diagnose:org",
7031
+ "unusedlicenses:diagnose:hardis:org",
7032
+ "unusedlicenses:diagnose:org:hardis"
7071
7033
  ]
7072
7034
  },
7073
- "hardis:org:fix:listviewmine": {
7035
+ "hardis:org:diagnose:unusedusers": {
7074
7036
  "aliases": [],
7075
7037
  "args": {},
7076
- "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",
7038
+ "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>",
7077
7039
  "examples": [
7078
- "$ sf hardis:org:fix:listviewmine",
7079
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
7040
+ "$ sf hardis:org:diagnose:unusedusers",
7041
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
7042
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7043
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7044
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7080
7045
  ],
7081
7046
  "flags": {
7082
7047
  "json": {
@@ -7094,14 +7059,49 @@
7094
7059
  "multiple": false,
7095
7060
  "type": "option"
7096
7061
  },
7097
- "listviews": {
7062
+ "outputfile": {
7063
+ "char": "f",
7064
+ "description": "Force the path and name of output report file. Must end with .csv",
7065
+ "name": "outputfile",
7066
+ "hasDynamicHelp": false,
7067
+ "multiple": false,
7068
+ "type": "option"
7069
+ },
7070
+ "days": {
7071
+ "char": "t",
7072
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7073
+ "name": "days",
7074
+ "hasDynamicHelp": false,
7075
+ "multiple": false,
7076
+ "type": "option"
7077
+ },
7078
+ "licensetypes": {
7098
7079
  "char": "l",
7099
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
7100
- "name": "listviews",
7080
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7081
+ "name": "licensetypes",
7082
+ "hasDynamicHelp": false,
7083
+ "multiple": false,
7084
+ "options": [
7085
+ "all",
7086
+ "all-crm",
7087
+ "all-paying"
7088
+ ],
7089
+ "type": "option"
7090
+ },
7091
+ "licenseidentifiers": {
7092
+ "char": "i",
7093
+ "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",
7094
+ "name": "licenseidentifiers",
7101
7095
  "hasDynamicHelp": false,
7102
7096
  "multiple": false,
7103
7097
  "type": "option"
7104
7098
  },
7099
+ "returnactiveusers": {
7100
+ "description": "Inverts the command by returning the active users",
7101
+ "name": "returnactiveusers",
7102
+ "allowNo": false,
7103
+ "type": "boolean"
7104
+ },
7105
7105
  "debug": {
7106
7106
  "char": "d",
7107
7107
  "description": "Activate debug mode (more logs)",
@@ -7140,49 +7140,49 @@
7140
7140
  },
7141
7141
  "hasDynamicHelp": true,
7142
7142
  "hiddenAliases": [],
7143
- "id": "hardis:org:fix:listviewmine",
7143
+ "id": "hardis:org:diagnose:unusedusers",
7144
7144
  "pluginAlias": "sfdx-hardis",
7145
7145
  "pluginName": "sfdx-hardis",
7146
7146
  "pluginType": "core",
7147
7147
  "strict": true,
7148
7148
  "enableJsonFlag": true,
7149
- "title": "Fix listviews with ",
7150
- "requiresProject": true,
7149
+ "title": "Detect unused Users in Salesforce",
7150
+ "requiresProject": false,
7151
7151
  "isESM": true,
7152
7152
  "relativePath": [
7153
7153
  "lib",
7154
7154
  "commands",
7155
7155
  "hardis",
7156
7156
  "org",
7157
- "fix",
7158
- "listviewmine.js"
7157
+ "diagnose",
7158
+ "unusedusers.js"
7159
7159
  ],
7160
7160
  "aliasPermutations": [],
7161
7161
  "permutations": [
7162
- "hardis:org:fix:listviewmine",
7163
- "org:hardis:fix:listviewmine",
7164
- "org:fix:hardis:listviewmine",
7165
- "org:fix:listviewmine:hardis",
7166
- "hardis:fix:org:listviewmine",
7167
- "fix:hardis:org:listviewmine",
7168
- "fix:org:hardis:listviewmine",
7169
- "fix:org:listviewmine:hardis",
7170
- "hardis:fix:listviewmine:org",
7171
- "fix:hardis:listviewmine:org",
7172
- "fix:listviewmine:hardis:org",
7173
- "fix:listviewmine:org:hardis",
7174
- "hardis:org:listviewmine:fix",
7175
- "org:hardis:listviewmine:fix",
7176
- "org:listviewmine:hardis:fix",
7177
- "org:listviewmine:fix:hardis",
7178
- "hardis:listviewmine:org:fix",
7179
- "listviewmine:hardis:org:fix",
7180
- "listviewmine:org:hardis:fix",
7181
- "listviewmine:org:fix:hardis",
7182
- "hardis:listviewmine:fix:org",
7183
- "listviewmine:hardis:fix:org",
7184
- "listviewmine:fix:hardis:org",
7185
- "listviewmine:fix:org:hardis"
7162
+ "hardis:org:diagnose:unusedusers",
7163
+ "org:hardis:diagnose:unusedusers",
7164
+ "org:diagnose:hardis:unusedusers",
7165
+ "org:diagnose:unusedusers:hardis",
7166
+ "hardis:diagnose:org:unusedusers",
7167
+ "diagnose:hardis:org:unusedusers",
7168
+ "diagnose:org:hardis:unusedusers",
7169
+ "diagnose:org:unusedusers:hardis",
7170
+ "hardis:diagnose:unusedusers:org",
7171
+ "diagnose:hardis:unusedusers:org",
7172
+ "diagnose:unusedusers:hardis:org",
7173
+ "diagnose:unusedusers:org:hardis",
7174
+ "hardis:org:unusedusers:diagnose",
7175
+ "org:hardis:unusedusers:diagnose",
7176
+ "org:unusedusers:hardis:diagnose",
7177
+ "org:unusedusers:diagnose:hardis",
7178
+ "hardis:unusedusers:org:diagnose",
7179
+ "unusedusers:hardis:org:diagnose",
7180
+ "unusedusers:org:hardis:diagnose",
7181
+ "unusedusers:org:diagnose:hardis",
7182
+ "hardis:unusedusers:diagnose:org",
7183
+ "unusedusers:hardis:diagnose:org",
7184
+ "unusedusers:diagnose:hardis:org",
7185
+ "unusedusers:diagnose:org:hardis"
7186
7186
  ]
7187
7187
  },
7188
7188
  "hardis:org:generate:packagexmlfull": {
@@ -8056,6 +8056,233 @@
8056
8056
  "flow:purge:org:hardis"
8057
8057
  ]
8058
8058
  },
8059
+ "hardis:org:retrieve:packageconfig": {
8060
+ "aliases": [],
8061
+ "args": {},
8062
+ "description": "\n**Retrieves the installed package configuration from a Salesforce org and optionally updates the local project configuration.**\n\nThis command is useful for maintaining an accurate record of installed packages within your Salesforce project, which is crucial for managing dependencies and ensuring consistent deployments across environments.\n\nKey functionalities:\n\n- **Package Listing:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a list of all installed packages.\n- **Configuration Update:** Offers the option to update your local project's configuration with the retrieved list of installed packages. This can be beneficial for automating package installations during environment setup or CI/CD processes.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Org Connection:** It establishes a connection to the target Salesforce org using the provided or prompted username.\n- **Metadata Retrieval:** It utilizes `MetadataUtils.listInstalledPackages` to query the Salesforce org and obtain details about the installed packages.\n- **Interactive Prompt:** It uses the `prompts` library to ask the user whether they want to update their local project configuration with the retrieved package list.\n- **Configuration Management:** If the user confirms, it calls `managePackageConfig` to update the project's configuration file (likely `.sfdx-hardis.yml`) with the new package information.\n- **User Feedback:** Provides clear messages to the user about the success of the package retrieval and configuration update.\n</details>\n",
8063
+ "examples": [
8064
+ "$ sf hardis:org:retrieve:packageconfig",
8065
+ "sf hardis:org:retrieve:packageconfig -u myOrg"
8066
+ ],
8067
+ "flags": {
8068
+ "json": {
8069
+ "description": "Format output as json.",
8070
+ "helpGroup": "GLOBAL",
8071
+ "name": "json",
8072
+ "allowNo": false,
8073
+ "type": "boolean"
8074
+ },
8075
+ "flags-dir": {
8076
+ "helpGroup": "GLOBAL",
8077
+ "name": "flags-dir",
8078
+ "summary": "Import flag values from a directory.",
8079
+ "hasDynamicHelp": false,
8080
+ "multiple": false,
8081
+ "type": "option"
8082
+ },
8083
+ "debug": {
8084
+ "char": "d",
8085
+ "description": "Activate debug mode (more logs)",
8086
+ "name": "debug",
8087
+ "allowNo": false,
8088
+ "type": "boolean"
8089
+ },
8090
+ "websocket": {
8091
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8092
+ "name": "websocket",
8093
+ "hasDynamicHelp": false,
8094
+ "multiple": false,
8095
+ "type": "option"
8096
+ },
8097
+ "skipauth": {
8098
+ "description": "Skip authentication check when a default username is required",
8099
+ "name": "skipauth",
8100
+ "allowNo": false,
8101
+ "type": "boolean"
8102
+ },
8103
+ "target-org": {
8104
+ "aliases": [
8105
+ "targetusername",
8106
+ "u"
8107
+ ],
8108
+ "char": "o",
8109
+ "deprecateAliases": true,
8110
+ "name": "target-org",
8111
+ "noCacheDefault": true,
8112
+ "required": true,
8113
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8114
+ "hasDynamicHelp": true,
8115
+ "multiple": false,
8116
+ "type": "option"
8117
+ }
8118
+ },
8119
+ "hasDynamicHelp": true,
8120
+ "hiddenAliases": [],
8121
+ "id": "hardis:org:retrieve:packageconfig",
8122
+ "pluginAlias": "sfdx-hardis",
8123
+ "pluginName": "sfdx-hardis",
8124
+ "pluginType": "core",
8125
+ "strict": true,
8126
+ "enableJsonFlag": true,
8127
+ "title": "Retrieve package configuration from an org",
8128
+ "requiresProject": false,
8129
+ "isESM": true,
8130
+ "relativePath": [
8131
+ "lib",
8132
+ "commands",
8133
+ "hardis",
8134
+ "org",
8135
+ "retrieve",
8136
+ "packageconfig.js"
8137
+ ],
8138
+ "aliasPermutations": [],
8139
+ "permutations": [
8140
+ "hardis:org:retrieve:packageconfig",
8141
+ "org:hardis:retrieve:packageconfig",
8142
+ "org:retrieve:hardis:packageconfig",
8143
+ "org:retrieve:packageconfig:hardis",
8144
+ "hardis:retrieve:org:packageconfig",
8145
+ "retrieve:hardis:org:packageconfig",
8146
+ "retrieve:org:hardis:packageconfig",
8147
+ "retrieve:org:packageconfig:hardis",
8148
+ "hardis:retrieve:packageconfig:org",
8149
+ "retrieve:hardis:packageconfig:org",
8150
+ "retrieve:packageconfig:hardis:org",
8151
+ "retrieve:packageconfig:org:hardis",
8152
+ "hardis:org:packageconfig:retrieve",
8153
+ "org:hardis:packageconfig:retrieve",
8154
+ "org:packageconfig:hardis:retrieve",
8155
+ "org:packageconfig:retrieve:hardis",
8156
+ "hardis:packageconfig:org:retrieve",
8157
+ "packageconfig:hardis:org:retrieve",
8158
+ "packageconfig:org:hardis:retrieve",
8159
+ "packageconfig:org:retrieve:hardis",
8160
+ "hardis:packageconfig:retrieve:org",
8161
+ "packageconfig:hardis:retrieve:org",
8162
+ "packageconfig:retrieve:hardis:org",
8163
+ "packageconfig:retrieve:org:hardis"
8164
+ ]
8165
+ },
8166
+ "hardis:org:test:apex": {
8167
+ "aliases": [],
8168
+ "args": {},
8169
+ "description": "Run apex tests in Salesforce org\n\nIf following configuration is defined, it will fail if apex coverage target is not reached:\n\n- Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide`\n- Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide`\n\nYou can override env var SFDX_TEST_WAIT_MINUTES to wait more than 60 minutes.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-apex-tests/) and can output Grafana, Slack and MsTeams Notifications.\n",
8170
+ "examples": [
8171
+ "$ sf hardis:org:test:apex"
8172
+ ],
8173
+ "flags": {
8174
+ "json": {
8175
+ "description": "Format output as json.",
8176
+ "helpGroup": "GLOBAL",
8177
+ "name": "json",
8178
+ "allowNo": false,
8179
+ "type": "boolean"
8180
+ },
8181
+ "flags-dir": {
8182
+ "helpGroup": "GLOBAL",
8183
+ "name": "flags-dir",
8184
+ "summary": "Import flag values from a directory.",
8185
+ "hasDynamicHelp": false,
8186
+ "multiple": false,
8187
+ "type": "option"
8188
+ },
8189
+ "testlevel": {
8190
+ "char": "l",
8191
+ "description": "Level of tests to apply to validate deployment",
8192
+ "name": "testlevel",
8193
+ "default": "RunLocalTests",
8194
+ "hasDynamicHelp": false,
8195
+ "multiple": false,
8196
+ "options": [
8197
+ "NoTestRun",
8198
+ "RunSpecifiedTests",
8199
+ "RunLocalTests",
8200
+ "RunAllTestsInOrg"
8201
+ ],
8202
+ "type": "option"
8203
+ },
8204
+ "debug": {
8205
+ "char": "d",
8206
+ "description": "Activate debug mode (more logs)",
8207
+ "name": "debug",
8208
+ "allowNo": false,
8209
+ "type": "boolean"
8210
+ },
8211
+ "websocket": {
8212
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8213
+ "name": "websocket",
8214
+ "hasDynamicHelp": false,
8215
+ "multiple": false,
8216
+ "type": "option"
8217
+ },
8218
+ "skipauth": {
8219
+ "description": "Skip authentication check when a default username is required",
8220
+ "name": "skipauth",
8221
+ "allowNo": false,
8222
+ "type": "boolean"
8223
+ },
8224
+ "target-org": {
8225
+ "aliases": [
8226
+ "targetusername",
8227
+ "u"
8228
+ ],
8229
+ "char": "o",
8230
+ "deprecateAliases": true,
8231
+ "name": "target-org",
8232
+ "noCacheDefault": true,
8233
+ "required": true,
8234
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8235
+ "hasDynamicHelp": true,
8236
+ "multiple": false,
8237
+ "type": "option"
8238
+ }
8239
+ },
8240
+ "hasDynamicHelp": true,
8241
+ "hiddenAliases": [],
8242
+ "id": "hardis:org:test:apex",
8243
+ "pluginAlias": "sfdx-hardis",
8244
+ "pluginName": "sfdx-hardis",
8245
+ "pluginType": "core",
8246
+ "strict": true,
8247
+ "enableJsonFlag": true,
8248
+ "title": "Run apex tests",
8249
+ "isESM": true,
8250
+ "relativePath": [
8251
+ "lib",
8252
+ "commands",
8253
+ "hardis",
8254
+ "org",
8255
+ "test",
8256
+ "apex.js"
8257
+ ],
8258
+ "aliasPermutations": [],
8259
+ "permutations": [
8260
+ "hardis:org:test:apex",
8261
+ "org:hardis:test:apex",
8262
+ "org:test:hardis:apex",
8263
+ "org:test:apex:hardis",
8264
+ "hardis:test:org:apex",
8265
+ "test:hardis:org:apex",
8266
+ "test:org:hardis:apex",
8267
+ "test:org:apex:hardis",
8268
+ "hardis:test:apex:org",
8269
+ "test:hardis:apex:org",
8270
+ "test:apex:hardis:org",
8271
+ "test:apex:org:hardis",
8272
+ "hardis:org:apex:test",
8273
+ "org:hardis:apex:test",
8274
+ "org:apex:hardis:test",
8275
+ "org:apex:test:hardis",
8276
+ "hardis:apex:org:test",
8277
+ "apex:hardis:org:test",
8278
+ "apex:org:hardis:test",
8279
+ "apex:org:test:hardis",
8280
+ "hardis:apex:test:org",
8281
+ "apex:hardis:test:org",
8282
+ "apex:test:hardis:org",
8283
+ "apex:test:org:hardis"
8284
+ ]
8285
+ },
8059
8286
  "hardis:org:refresh:after-refresh": {
8060
8287
  "aliases": [],
8061
8288
  "args": {},
@@ -8223,227 +8450,15 @@
8223
8450
  "description": "Connected App name(s) to process. For multiple apps, separate with commas (e.g., \"App1,App2\")",
8224
8451
  "name": "name",
8225
8452
  "summary": "Filter according to Name criteria",
8226
- "hasDynamicHelp": false,
8227
- "multiple": false,
8228
- "type": "option"
8229
- },
8230
- "all": {
8231
- "char": "a",
8232
- "description": "If set, all Connected Apps from the org will be processed. Takes precedence over --name if both are specified.",
8233
- "name": "all",
8234
- "summary": "Process all Connected Apps without selection prompt",
8235
- "allowNo": false,
8236
- "type": "boolean"
8237
- },
8238
- "websocket": {
8239
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8240
- "name": "websocket",
8241
- "hasDynamicHelp": false,
8242
- "multiple": false,
8243
- "type": "option"
8244
- },
8245
- "skipauth": {
8246
- "description": "Skip authentication check when a default username is required",
8247
- "name": "skipauth",
8248
- "allowNo": false,
8249
- "type": "boolean"
8250
- }
8251
- },
8252
- "hasDynamicHelp": true,
8253
- "hiddenAliases": [],
8254
- "id": "hardis:org:refresh:before-refresh",
8255
- "pluginAlias": "sfdx-hardis",
8256
- "pluginName": "sfdx-hardis",
8257
- "pluginType": "core",
8258
- "strict": true,
8259
- "enableJsonFlag": true,
8260
- "requiresProject": true,
8261
- "isESM": true,
8262
- "relativePath": [
8263
- "lib",
8264
- "commands",
8265
- "hardis",
8266
- "org",
8267
- "refresh",
8268
- "before-refresh.js"
8269
- ],
8270
- "aliasPermutations": [],
8271
- "permutations": [
8272
- "hardis:org:refresh:before-refresh",
8273
- "org:hardis:refresh:before-refresh",
8274
- "org:refresh:hardis:before-refresh",
8275
- "org:refresh:before-refresh:hardis",
8276
- "hardis:refresh:org:before-refresh",
8277
- "refresh:hardis:org:before-refresh",
8278
- "refresh:org:hardis:before-refresh",
8279
- "refresh:org:before-refresh:hardis",
8280
- "hardis:refresh:before-refresh:org",
8281
- "refresh:hardis:before-refresh:org",
8282
- "refresh:before-refresh:hardis:org",
8283
- "refresh:before-refresh:org:hardis",
8284
- "hardis:org:before-refresh:refresh",
8285
- "org:hardis:before-refresh:refresh",
8286
- "org:before-refresh:hardis:refresh",
8287
- "org:before-refresh:refresh:hardis",
8288
- "hardis:before-refresh:org:refresh",
8289
- "before-refresh:hardis:org:refresh",
8290
- "before-refresh:org:hardis:refresh",
8291
- "before-refresh:org:refresh:hardis",
8292
- "hardis:before-refresh:refresh:org",
8293
- "before-refresh:hardis:refresh:org",
8294
- "before-refresh:refresh:hardis:org",
8295
- "before-refresh:refresh:org:hardis"
8296
- ]
8297
- },
8298
- "hardis:org:retrieve:packageconfig": {
8299
- "aliases": [],
8300
- "args": {},
8301
- "description": "\n**Retrieves the installed package configuration from a Salesforce org and optionally updates the local project configuration.**\n\nThis command is useful for maintaining an accurate record of installed packages within your Salesforce project, which is crucial for managing dependencies and ensuring consistent deployments across environments.\n\nKey functionalities:\n\n- **Package Listing:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a list of all installed packages.\n- **Configuration Update:** Offers the option to update your local project's configuration with the retrieved list of installed packages. This can be beneficial for automating package installations during environment setup or CI/CD processes.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Org Connection:** It establishes a connection to the target Salesforce org using the provided or prompted username.\n- **Metadata Retrieval:** It utilizes `MetadataUtils.listInstalledPackages` to query the Salesforce org and obtain details about the installed packages.\n- **Interactive Prompt:** It uses the `prompts` library to ask the user whether they want to update their local project configuration with the retrieved package list.\n- **Configuration Management:** If the user confirms, it calls `managePackageConfig` to update the project's configuration file (likely `.sfdx-hardis.yml`) with the new package information.\n- **User Feedback:** Provides clear messages to the user about the success of the package retrieval and configuration update.\n</details>\n",
8302
- "examples": [
8303
- "$ sf hardis:org:retrieve:packageconfig",
8304
- "sf hardis:org:retrieve:packageconfig -u myOrg"
8305
- ],
8306
- "flags": {
8307
- "json": {
8308
- "description": "Format output as json.",
8309
- "helpGroup": "GLOBAL",
8310
- "name": "json",
8311
- "allowNo": false,
8312
- "type": "boolean"
8313
- },
8314
- "flags-dir": {
8315
- "helpGroup": "GLOBAL",
8316
- "name": "flags-dir",
8317
- "summary": "Import flag values from a directory.",
8318
- "hasDynamicHelp": false,
8319
- "multiple": false,
8320
- "type": "option"
8321
- },
8322
- "debug": {
8323
- "char": "d",
8324
- "description": "Activate debug mode (more logs)",
8325
- "name": "debug",
8326
- "allowNo": false,
8327
- "type": "boolean"
8328
- },
8329
- "websocket": {
8330
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8331
- "name": "websocket",
8332
- "hasDynamicHelp": false,
8333
- "multiple": false,
8334
- "type": "option"
8335
- },
8336
- "skipauth": {
8337
- "description": "Skip authentication check when a default username is required",
8338
- "name": "skipauth",
8339
- "allowNo": false,
8340
- "type": "boolean"
8341
- },
8342
- "target-org": {
8343
- "aliases": [
8344
- "targetusername",
8345
- "u"
8346
- ],
8347
- "char": "o",
8348
- "deprecateAliases": true,
8349
- "name": "target-org",
8350
- "noCacheDefault": true,
8351
- "required": true,
8352
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8353
- "hasDynamicHelp": true,
8354
- "multiple": false,
8355
- "type": "option"
8356
- }
8357
- },
8358
- "hasDynamicHelp": true,
8359
- "hiddenAliases": [],
8360
- "id": "hardis:org:retrieve:packageconfig",
8361
- "pluginAlias": "sfdx-hardis",
8362
- "pluginName": "sfdx-hardis",
8363
- "pluginType": "core",
8364
- "strict": true,
8365
- "enableJsonFlag": true,
8366
- "title": "Retrieve package configuration from an org",
8367
- "requiresProject": false,
8368
- "isESM": true,
8369
- "relativePath": [
8370
- "lib",
8371
- "commands",
8372
- "hardis",
8373
- "org",
8374
- "retrieve",
8375
- "packageconfig.js"
8376
- ],
8377
- "aliasPermutations": [],
8378
- "permutations": [
8379
- "hardis:org:retrieve:packageconfig",
8380
- "org:hardis:retrieve:packageconfig",
8381
- "org:retrieve:hardis:packageconfig",
8382
- "org:retrieve:packageconfig:hardis",
8383
- "hardis:retrieve:org:packageconfig",
8384
- "retrieve:hardis:org:packageconfig",
8385
- "retrieve:org:hardis:packageconfig",
8386
- "retrieve:org:packageconfig:hardis",
8387
- "hardis:retrieve:packageconfig:org",
8388
- "retrieve:hardis:packageconfig:org",
8389
- "retrieve:packageconfig:hardis:org",
8390
- "retrieve:packageconfig:org:hardis",
8391
- "hardis:org:packageconfig:retrieve",
8392
- "org:hardis:packageconfig:retrieve",
8393
- "org:packageconfig:hardis:retrieve",
8394
- "org:packageconfig:retrieve:hardis",
8395
- "hardis:packageconfig:org:retrieve",
8396
- "packageconfig:hardis:org:retrieve",
8397
- "packageconfig:org:hardis:retrieve",
8398
- "packageconfig:org:retrieve:hardis",
8399
- "hardis:packageconfig:retrieve:org",
8400
- "packageconfig:hardis:retrieve:org",
8401
- "packageconfig:retrieve:hardis:org",
8402
- "packageconfig:retrieve:org:hardis"
8403
- ]
8404
- },
8405
- "hardis:org:test:apex": {
8406
- "aliases": [],
8407
- "args": {},
8408
- "description": "Run apex tests in Salesforce org\n\nIf following configuration is defined, it will fail if apex coverage target is not reached:\n\n- Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide`\n- Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide`\n\nYou can override env var SFDX_TEST_WAIT_MINUTES to wait more than 60 minutes.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-apex-tests/) and can output Grafana, Slack and MsTeams Notifications.\n",
8409
- "examples": [
8410
- "$ sf hardis:org:test:apex"
8411
- ],
8412
- "flags": {
8413
- "json": {
8414
- "description": "Format output as json.",
8415
- "helpGroup": "GLOBAL",
8416
- "name": "json",
8417
- "allowNo": false,
8418
- "type": "boolean"
8419
- },
8420
- "flags-dir": {
8421
- "helpGroup": "GLOBAL",
8422
- "name": "flags-dir",
8423
- "summary": "Import flag values from a directory.",
8424
- "hasDynamicHelp": false,
8425
- "multiple": false,
8426
- "type": "option"
8427
- },
8428
- "testlevel": {
8429
- "char": "l",
8430
- "description": "Level of tests to apply to validate deployment",
8431
- "name": "testlevel",
8432
- "default": "RunLocalTests",
8433
- "hasDynamicHelp": false,
8434
- "multiple": false,
8435
- "options": [
8436
- "NoTestRun",
8437
- "RunSpecifiedTests",
8438
- "RunLocalTests",
8439
- "RunAllTestsInOrg"
8440
- ],
8453
+ "hasDynamicHelp": false,
8454
+ "multiple": false,
8441
8455
  "type": "option"
8442
8456
  },
8443
- "debug": {
8444
- "char": "d",
8445
- "description": "Activate debug mode (more logs)",
8446
- "name": "debug",
8457
+ "all": {
8458
+ "char": "a",
8459
+ "description": "If set, all Connected Apps from the org will be processed. Takes precedence over --name if both are specified.",
8460
+ "name": "all",
8461
+ "summary": "Process all Connected Apps without selection prompt",
8447
8462
  "allowNo": false,
8448
8463
  "type": "boolean"
8449
8464
  },
@@ -8459,67 +8474,52 @@
8459
8474
  "name": "skipauth",
8460
8475
  "allowNo": false,
8461
8476
  "type": "boolean"
8462
- },
8463
- "target-org": {
8464
- "aliases": [
8465
- "targetusername",
8466
- "u"
8467
- ],
8468
- "char": "o",
8469
- "deprecateAliases": true,
8470
- "name": "target-org",
8471
- "noCacheDefault": true,
8472
- "required": true,
8473
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8474
- "hasDynamicHelp": true,
8475
- "multiple": false,
8476
- "type": "option"
8477
8477
  }
8478
8478
  },
8479
8479
  "hasDynamicHelp": true,
8480
8480
  "hiddenAliases": [],
8481
- "id": "hardis:org:test:apex",
8481
+ "id": "hardis:org:refresh:before-refresh",
8482
8482
  "pluginAlias": "sfdx-hardis",
8483
8483
  "pluginName": "sfdx-hardis",
8484
8484
  "pluginType": "core",
8485
8485
  "strict": true,
8486
8486
  "enableJsonFlag": true,
8487
- "title": "Run apex tests",
8487
+ "requiresProject": true,
8488
8488
  "isESM": true,
8489
8489
  "relativePath": [
8490
8490
  "lib",
8491
8491
  "commands",
8492
8492
  "hardis",
8493
8493
  "org",
8494
- "test",
8495
- "apex.js"
8494
+ "refresh",
8495
+ "before-refresh.js"
8496
8496
  ],
8497
8497
  "aliasPermutations": [],
8498
8498
  "permutations": [
8499
- "hardis:org:test:apex",
8500
- "org:hardis:test:apex",
8501
- "org:test:hardis:apex",
8502
- "org:test:apex:hardis",
8503
- "hardis:test:org:apex",
8504
- "test:hardis:org:apex",
8505
- "test:org:hardis:apex",
8506
- "test:org:apex:hardis",
8507
- "hardis:test:apex:org",
8508
- "test:hardis:apex:org",
8509
- "test:apex:hardis:org",
8510
- "test:apex:org:hardis",
8511
- "hardis:org:apex:test",
8512
- "org:hardis:apex:test",
8513
- "org:apex:hardis:test",
8514
- "org:apex:test:hardis",
8515
- "hardis:apex:org:test",
8516
- "apex:hardis:org:test",
8517
- "apex:org:hardis:test",
8518
- "apex:org:test:hardis",
8519
- "hardis:apex:test:org",
8520
- "apex:hardis:test:org",
8521
- "apex:test:hardis:org",
8522
- "apex:test:org:hardis"
8499
+ "hardis:org:refresh:before-refresh",
8500
+ "org:hardis:refresh:before-refresh",
8501
+ "org:refresh:hardis:before-refresh",
8502
+ "org:refresh:before-refresh:hardis",
8503
+ "hardis:refresh:org:before-refresh",
8504
+ "refresh:hardis:org:before-refresh",
8505
+ "refresh:org:hardis:before-refresh",
8506
+ "refresh:org:before-refresh:hardis",
8507
+ "hardis:refresh:before-refresh:org",
8508
+ "refresh:hardis:before-refresh:org",
8509
+ "refresh:before-refresh:hardis:org",
8510
+ "refresh:before-refresh:org:hardis",
8511
+ "hardis:org:before-refresh:refresh",
8512
+ "org:hardis:before-refresh:refresh",
8513
+ "org:before-refresh:hardis:refresh",
8514
+ "org:before-refresh:refresh:hardis",
8515
+ "hardis:before-refresh:org:refresh",
8516
+ "before-refresh:hardis:org:refresh",
8517
+ "before-refresh:org:hardis:refresh",
8518
+ "before-refresh:org:refresh:hardis",
8519
+ "hardis:before-refresh:refresh:org",
8520
+ "before-refresh:hardis:refresh:org",
8521
+ "before-refresh:refresh:hardis:org",
8522
+ "before-refresh:refresh:org:hardis"
8523
8523
  ]
8524
8524
  },
8525
8525
  "hardis:org:user:activateinvalid": {
@@ -11406,6 +11406,221 @@
11406
11406
  "profilestopermsets:convert:project:hardis"
11407
11407
  ]
11408
11408
  },
11409
+ "hardis:project:fix:profiletabs": {
11410
+ "aliases": [],
11411
+ "args": {},
11412
+ "description": "\n## Command Behavior\n\n**Interactively updates tab visibility settings in Salesforce profiles, addressing a common issue where tab visibilities are not correctly retrieved by `sf project retrieve start`.**\n\nThis command provides a user-friendly interface to manage tab settings within your profile XML files, ensuring that your local project accurately reflects the intended tab configurations in your Salesforce org.\n\nKey functionalities:\n\n- **Interactive Tab Selection:** Displays a multi-select menu of all available tabs in your org, allowing you to choose which tabs to update.\n- **Visibility Control:** Lets you set the visibility for the selected tabs to either `DefaultOn` (Visible) or `Hidden`.\n- **Profile Selection:** Presents a multi-select menu of all .profile-meta.xml files in your project, allowing you to apply the tab visibility changes to specific profiles.\n- **XML Updates:** Modifies the <tabVisibilities> section of the selected profile XML files to reflect the chosen tab settings. If a tab visibility setting already exists for a selected tab, it will be updated; otherwise, a new one will be added.\n- **Sorted Output:** The <tabVisibilities> in the updated profile XML files are sorted alphabetically for consistency and readability.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Queries (Tooling API):** It queries the `TabDefinition` object using `soqlQueryTooling` to retrieve a list of all available tabs in the target org.\n- **File Discovery:** Uses `glob` to find all .profile-meta.xml files within the specified project path.\n- **Interactive Prompts:** Leverages the `prompts` library to create interactive menus for selecting tabs, visibility settings, and profiles.\n- **XML Parsing and Manipulation:** Uses `parseXmlFile` to read the content of profile XML files and `writeXmlFile` to write the modified content back. It manipulates the `tabVisibilities` array within the parsed XML to add or update tab settings.\n- **Array Sorting:** Employs the `sort-array` library to sort the `tabVisibilities` alphabetically by tab name.\n- **Logging:** Provides feedback to the user about which profiles have been updated and a summary of the changes.\n</details>\n",
11413
+ "examples": [
11414
+ "$ sf hardis:project:fix:profiletabs"
11415
+ ],
11416
+ "flags": {
11417
+ "json": {
11418
+ "description": "Format output as json.",
11419
+ "helpGroup": "GLOBAL",
11420
+ "name": "json",
11421
+ "allowNo": false,
11422
+ "type": "boolean"
11423
+ },
11424
+ "flags-dir": {
11425
+ "helpGroup": "GLOBAL",
11426
+ "name": "flags-dir",
11427
+ "summary": "Import flag values from a directory.",
11428
+ "hasDynamicHelp": false,
11429
+ "multiple": false,
11430
+ "type": "option"
11431
+ },
11432
+ "path": {
11433
+ "char": "p",
11434
+ "description": "Root folder",
11435
+ "name": "path",
11436
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
11437
+ "hasDynamicHelp": false,
11438
+ "multiple": false,
11439
+ "type": "option"
11440
+ },
11441
+ "debug": {
11442
+ "char": "d",
11443
+ "description": "Activate debug mode (more logs)",
11444
+ "name": "debug",
11445
+ "allowNo": false,
11446
+ "type": "boolean"
11447
+ },
11448
+ "websocket": {
11449
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11450
+ "name": "websocket",
11451
+ "hasDynamicHelp": false,
11452
+ "multiple": false,
11453
+ "type": "option"
11454
+ },
11455
+ "skipauth": {
11456
+ "description": "Skip authentication check when a default username is required",
11457
+ "name": "skipauth",
11458
+ "allowNo": false,
11459
+ "type": "boolean"
11460
+ },
11461
+ "target-org": {
11462
+ "aliases": [
11463
+ "targetusername",
11464
+ "u"
11465
+ ],
11466
+ "char": "o",
11467
+ "deprecateAliases": true,
11468
+ "name": "target-org",
11469
+ "noCacheDefault": true,
11470
+ "required": true,
11471
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
11472
+ "hasDynamicHelp": true,
11473
+ "multiple": false,
11474
+ "type": "option"
11475
+ }
11476
+ },
11477
+ "hasDynamicHelp": true,
11478
+ "hiddenAliases": [],
11479
+ "id": "hardis:project:fix:profiletabs",
11480
+ "pluginAlias": "sfdx-hardis",
11481
+ "pluginName": "sfdx-hardis",
11482
+ "pluginType": "core",
11483
+ "strict": true,
11484
+ "enableJsonFlag": true,
11485
+ "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
11486
+ "requiresProject": true,
11487
+ "isESM": true,
11488
+ "relativePath": [
11489
+ "lib",
11490
+ "commands",
11491
+ "hardis",
11492
+ "project",
11493
+ "fix",
11494
+ "profiletabs.js"
11495
+ ],
11496
+ "aliasPermutations": [],
11497
+ "permutations": [
11498
+ "hardis:project:fix:profiletabs",
11499
+ "project:hardis:fix:profiletabs",
11500
+ "project:fix:hardis:profiletabs",
11501
+ "project:fix:profiletabs:hardis",
11502
+ "hardis:fix:project:profiletabs",
11503
+ "fix:hardis:project:profiletabs",
11504
+ "fix:project:hardis:profiletabs",
11505
+ "fix:project:profiletabs:hardis",
11506
+ "hardis:fix:profiletabs:project",
11507
+ "fix:hardis:profiletabs:project",
11508
+ "fix:profiletabs:hardis:project",
11509
+ "fix:profiletabs:project:hardis",
11510
+ "hardis:project:profiletabs:fix",
11511
+ "project:hardis:profiletabs:fix",
11512
+ "project:profiletabs:hardis:fix",
11513
+ "project:profiletabs:fix:hardis",
11514
+ "hardis:profiletabs:project:fix",
11515
+ "profiletabs:hardis:project:fix",
11516
+ "profiletabs:project:hardis:fix",
11517
+ "profiletabs:project:fix:hardis",
11518
+ "hardis:profiletabs:fix:project",
11519
+ "profiletabs:hardis:fix:project",
11520
+ "profiletabs:fix:hardis:project",
11521
+ "profiletabs:fix:project:hardis"
11522
+ ]
11523
+ },
11524
+ "hardis:project:fix:v53flexipages": {
11525
+ "aliases": [],
11526
+ "args": {},
11527
+ "description": "\n## Command Behavior\n\n**Fixes Salesforce FlexiPages for compatibility with API Version 53.0 (Winter '22 release) by adding missing identifiers to component instances.**\n\nSalesforce introduced a change in API Version 53.0 that requires `identifier` tags within `componentInstance` and `fieldInstance` elements in FlexiPage metadata. If these identifiers are missing, deployments to orgs with API version 53.0 or higher will fail. This command automates the process of adding these missing identifiers, ensuring your FlexiPages remain deployable.\n\nKey functionalities:\n\n- **Targeted FlexiPage Processing:** Scans all .flexipage-meta.xml files within the specified root folder (defaults to current working directory).\n- **Identifier Injection:** Inserts a unique `identifier` tag (e.g., `SFDX_HARDIS_REPLACEMENT_ID`) into `componentInstance` and `fieldInstance` elements that lack one.\n\n**Important Note:** After running this command, ensure you update your `apiVersion` to `53.0` (or higher) in your `package.xml` and `sfdx-project.json` files.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all .flexipage-meta.xml files.\n- **Content Reading:** Reads the XML content of each FlexiPage file.\n- **Regular Expression Replacement:** Employs a set of regular expressions to identify specific XML patterns (componentName.../componentName.../componentInstance, componentName.../componentName.../visibilityRule, fieldItem.../fieldItem.../fieldInstance) that are missing the `identifier` tag.\n- **Dynamic ID Generation:** For each match, it generates a unique identifier (e.g., `sfdxHardisIdX`) and injects it into the XML structure.\n- **File Writing:** If changes are made, the modified XML content is written back to the FlexiPage file using `fs.writeFile`.\n- **Logging:** Provides messages about which FlexiPages are being processed and a summary of the total number of identifiers added.\n</details>\n",
11528
+ "examples": [
11529
+ "$ sf hardis:project:fix:v53flexipages"
11530
+ ],
11531
+ "flags": {
11532
+ "json": {
11533
+ "description": "Format output as json.",
11534
+ "helpGroup": "GLOBAL",
11535
+ "name": "json",
11536
+ "allowNo": false,
11537
+ "type": "boolean"
11538
+ },
11539
+ "flags-dir": {
11540
+ "helpGroup": "GLOBAL",
11541
+ "name": "flags-dir",
11542
+ "summary": "Import flag values from a directory.",
11543
+ "hasDynamicHelp": false,
11544
+ "multiple": false,
11545
+ "type": "option"
11546
+ },
11547
+ "path": {
11548
+ "char": "p",
11549
+ "description": "Root folder",
11550
+ "name": "path",
11551
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
11552
+ "hasDynamicHelp": false,
11553
+ "multiple": false,
11554
+ "type": "option"
11555
+ },
11556
+ "debug": {
11557
+ "char": "d",
11558
+ "description": "Activate debug mode (more logs)",
11559
+ "name": "debug",
11560
+ "allowNo": false,
11561
+ "type": "boolean"
11562
+ },
11563
+ "websocket": {
11564
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11565
+ "name": "websocket",
11566
+ "hasDynamicHelp": false,
11567
+ "multiple": false,
11568
+ "type": "option"
11569
+ },
11570
+ "skipauth": {
11571
+ "description": "Skip authentication check when a default username is required",
11572
+ "name": "skipauth",
11573
+ "allowNo": false,
11574
+ "type": "boolean"
11575
+ }
11576
+ },
11577
+ "hasDynamicHelp": false,
11578
+ "hiddenAliases": [],
11579
+ "id": "hardis:project:fix:v53flexipages",
11580
+ "pluginAlias": "sfdx-hardis",
11581
+ "pluginName": "sfdx-hardis",
11582
+ "pluginType": "core",
11583
+ "strict": true,
11584
+ "enableJsonFlag": true,
11585
+ "title": "Fix flexipages for v53",
11586
+ "requiresProject": true,
11587
+ "isESM": true,
11588
+ "relativePath": [
11589
+ "lib",
11590
+ "commands",
11591
+ "hardis",
11592
+ "project",
11593
+ "fix",
11594
+ "v53flexipages.js"
11595
+ ],
11596
+ "aliasPermutations": [],
11597
+ "permutations": [
11598
+ "hardis:project:fix:v53flexipages",
11599
+ "project:hardis:fix:v53flexipages",
11600
+ "project:fix:hardis:v53flexipages",
11601
+ "project:fix:v53flexipages:hardis",
11602
+ "hardis:fix:project:v53flexipages",
11603
+ "fix:hardis:project:v53flexipages",
11604
+ "fix:project:hardis:v53flexipages",
11605
+ "fix:project:v53flexipages:hardis",
11606
+ "hardis:fix:v53flexipages:project",
11607
+ "fix:hardis:v53flexipages:project",
11608
+ "fix:v53flexipages:hardis:project",
11609
+ "fix:v53flexipages:project:hardis",
11610
+ "hardis:project:v53flexipages:fix",
11611
+ "project:hardis:v53flexipages:fix",
11612
+ "project:v53flexipages:hardis:fix",
11613
+ "project:v53flexipages:fix:hardis",
11614
+ "hardis:v53flexipages:project:fix",
11615
+ "v53flexipages:hardis:project:fix",
11616
+ "v53flexipages:project:hardis:fix",
11617
+ "v53flexipages:project:fix:hardis",
11618
+ "hardis:v53flexipages:fix:project",
11619
+ "v53flexipages:hardis:fix:project",
11620
+ "v53flexipages:fix:hardis:project",
11621
+ "v53flexipages:fix:project:hardis"
11622
+ ]
11623
+ },
11409
11624
  "hardis:project:deploy:notify": {
11410
11625
  "aliases": [],
11411
11626
  "args": {},
@@ -12976,221 +13191,6 @@
12976
13191
  "gitdelta:generate:project:hardis"
12977
13192
  ]
12978
13193
  },
12979
- "hardis:project:fix:profiletabs": {
12980
- "aliases": [],
12981
- "args": {},
12982
- "description": "\n## Command Behavior\n\n**Interactively updates tab visibility settings in Salesforce profiles, addressing a common issue where tab visibilities are not correctly retrieved by `sf project retrieve start`.**\n\nThis command provides a user-friendly interface to manage tab settings within your profile XML files, ensuring that your local project accurately reflects the intended tab configurations in your Salesforce org.\n\nKey functionalities:\n\n- **Interactive Tab Selection:** Displays a multi-select menu of all available tabs in your org, allowing you to choose which tabs to update.\n- **Visibility Control:** Lets you set the visibility for the selected tabs to either `DefaultOn` (Visible) or `Hidden`.\n- **Profile Selection:** Presents a multi-select menu of all .profile-meta.xml files in your project, allowing you to apply the tab visibility changes to specific profiles.\n- **XML Updates:** Modifies the <tabVisibilities> section of the selected profile XML files to reflect the chosen tab settings. If a tab visibility setting already exists for a selected tab, it will be updated; otherwise, a new one will be added.\n- **Sorted Output:** The <tabVisibilities> in the updated profile XML files are sorted alphabetically for consistency and readability.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Queries (Tooling API):** It queries the `TabDefinition` object using `soqlQueryTooling` to retrieve a list of all available tabs in the target org.\n- **File Discovery:** Uses `glob` to find all .profile-meta.xml files within the specified project path.\n- **Interactive Prompts:** Leverages the `prompts` library to create interactive menus for selecting tabs, visibility settings, and profiles.\n- **XML Parsing and Manipulation:** Uses `parseXmlFile` to read the content of profile XML files and `writeXmlFile` to write the modified content back. It manipulates the `tabVisibilities` array within the parsed XML to add or update tab settings.\n- **Array Sorting:** Employs the `sort-array` library to sort the `tabVisibilities` alphabetically by tab name.\n- **Logging:** Provides feedback to the user about which profiles have been updated and a summary of the changes.\n</details>\n",
12983
- "examples": [
12984
- "$ sf hardis:project:fix:profiletabs"
12985
- ],
12986
- "flags": {
12987
- "json": {
12988
- "description": "Format output as json.",
12989
- "helpGroup": "GLOBAL",
12990
- "name": "json",
12991
- "allowNo": false,
12992
- "type": "boolean"
12993
- },
12994
- "flags-dir": {
12995
- "helpGroup": "GLOBAL",
12996
- "name": "flags-dir",
12997
- "summary": "Import flag values from a directory.",
12998
- "hasDynamicHelp": false,
12999
- "multiple": false,
13000
- "type": "option"
13001
- },
13002
- "path": {
13003
- "char": "p",
13004
- "description": "Root folder",
13005
- "name": "path",
13006
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13007
- "hasDynamicHelp": false,
13008
- "multiple": false,
13009
- "type": "option"
13010
- },
13011
- "debug": {
13012
- "char": "d",
13013
- "description": "Activate debug mode (more logs)",
13014
- "name": "debug",
13015
- "allowNo": false,
13016
- "type": "boolean"
13017
- },
13018
- "websocket": {
13019
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13020
- "name": "websocket",
13021
- "hasDynamicHelp": false,
13022
- "multiple": false,
13023
- "type": "option"
13024
- },
13025
- "skipauth": {
13026
- "description": "Skip authentication check when a default username is required",
13027
- "name": "skipauth",
13028
- "allowNo": false,
13029
- "type": "boolean"
13030
- },
13031
- "target-org": {
13032
- "aliases": [
13033
- "targetusername",
13034
- "u"
13035
- ],
13036
- "char": "o",
13037
- "deprecateAliases": true,
13038
- "name": "target-org",
13039
- "noCacheDefault": true,
13040
- "required": true,
13041
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
13042
- "hasDynamicHelp": true,
13043
- "multiple": false,
13044
- "type": "option"
13045
- }
13046
- },
13047
- "hasDynamicHelp": true,
13048
- "hiddenAliases": [],
13049
- "id": "hardis:project:fix:profiletabs",
13050
- "pluginAlias": "sfdx-hardis",
13051
- "pluginName": "sfdx-hardis",
13052
- "pluginType": "core",
13053
- "strict": true,
13054
- "enableJsonFlag": true,
13055
- "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
13056
- "requiresProject": true,
13057
- "isESM": true,
13058
- "relativePath": [
13059
- "lib",
13060
- "commands",
13061
- "hardis",
13062
- "project",
13063
- "fix",
13064
- "profiletabs.js"
13065
- ],
13066
- "aliasPermutations": [],
13067
- "permutations": [
13068
- "hardis:project:fix:profiletabs",
13069
- "project:hardis:fix:profiletabs",
13070
- "project:fix:hardis:profiletabs",
13071
- "project:fix:profiletabs:hardis",
13072
- "hardis:fix:project:profiletabs",
13073
- "fix:hardis:project:profiletabs",
13074
- "fix:project:hardis:profiletabs",
13075
- "fix:project:profiletabs:hardis",
13076
- "hardis:fix:profiletabs:project",
13077
- "fix:hardis:profiletabs:project",
13078
- "fix:profiletabs:hardis:project",
13079
- "fix:profiletabs:project:hardis",
13080
- "hardis:project:profiletabs:fix",
13081
- "project:hardis:profiletabs:fix",
13082
- "project:profiletabs:hardis:fix",
13083
- "project:profiletabs:fix:hardis",
13084
- "hardis:profiletabs:project:fix",
13085
- "profiletabs:hardis:project:fix",
13086
- "profiletabs:project:hardis:fix",
13087
- "profiletabs:project:fix:hardis",
13088
- "hardis:profiletabs:fix:project",
13089
- "profiletabs:hardis:fix:project",
13090
- "profiletabs:fix:hardis:project",
13091
- "profiletabs:fix:project:hardis"
13092
- ]
13093
- },
13094
- "hardis:project:fix:v53flexipages": {
13095
- "aliases": [],
13096
- "args": {},
13097
- "description": "\n## Command Behavior\n\n**Fixes Salesforce FlexiPages for compatibility with API Version 53.0 (Winter '22 release) by adding missing identifiers to component instances.**\n\nSalesforce introduced a change in API Version 53.0 that requires `identifier` tags within `componentInstance` and `fieldInstance` elements in FlexiPage metadata. If these identifiers are missing, deployments to orgs with API version 53.0 or higher will fail. This command automates the process of adding these missing identifiers, ensuring your FlexiPages remain deployable.\n\nKey functionalities:\n\n- **Targeted FlexiPage Processing:** Scans all .flexipage-meta.xml files within the specified root folder (defaults to current working directory).\n- **Identifier Injection:** Inserts a unique `identifier` tag (e.g., `SFDX_HARDIS_REPLACEMENT_ID`) into `componentInstance` and `fieldInstance` elements that lack one.\n\n**Important Note:** After running this command, ensure you update your `apiVersion` to `53.0` (or higher) in your `package.xml` and `sfdx-project.json` files.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all .flexipage-meta.xml files.\n- **Content Reading:** Reads the XML content of each FlexiPage file.\n- **Regular Expression Replacement:** Employs a set of regular expressions to identify specific XML patterns (componentName.../componentName.../componentInstance, componentName.../componentName.../visibilityRule, fieldItem.../fieldItem.../fieldInstance) that are missing the `identifier` tag.\n- **Dynamic ID Generation:** For each match, it generates a unique identifier (e.g., `sfdxHardisIdX`) and injects it into the XML structure.\n- **File Writing:** If changes are made, the modified XML content is written back to the FlexiPage file using `fs.writeFile`.\n- **Logging:** Provides messages about which FlexiPages are being processed and a summary of the total number of identifiers added.\n</details>\n",
13098
- "examples": [
13099
- "$ sf hardis:project:fix:v53flexipages"
13100
- ],
13101
- "flags": {
13102
- "json": {
13103
- "description": "Format output as json.",
13104
- "helpGroup": "GLOBAL",
13105
- "name": "json",
13106
- "allowNo": false,
13107
- "type": "boolean"
13108
- },
13109
- "flags-dir": {
13110
- "helpGroup": "GLOBAL",
13111
- "name": "flags-dir",
13112
- "summary": "Import flag values from a directory.",
13113
- "hasDynamicHelp": false,
13114
- "multiple": false,
13115
- "type": "option"
13116
- },
13117
- "path": {
13118
- "char": "p",
13119
- "description": "Root folder",
13120
- "name": "path",
13121
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13122
- "hasDynamicHelp": false,
13123
- "multiple": false,
13124
- "type": "option"
13125
- },
13126
- "debug": {
13127
- "char": "d",
13128
- "description": "Activate debug mode (more logs)",
13129
- "name": "debug",
13130
- "allowNo": false,
13131
- "type": "boolean"
13132
- },
13133
- "websocket": {
13134
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13135
- "name": "websocket",
13136
- "hasDynamicHelp": false,
13137
- "multiple": false,
13138
- "type": "option"
13139
- },
13140
- "skipauth": {
13141
- "description": "Skip authentication check when a default username is required",
13142
- "name": "skipauth",
13143
- "allowNo": false,
13144
- "type": "boolean"
13145
- }
13146
- },
13147
- "hasDynamicHelp": false,
13148
- "hiddenAliases": [],
13149
- "id": "hardis:project:fix:v53flexipages",
13150
- "pluginAlias": "sfdx-hardis",
13151
- "pluginName": "sfdx-hardis",
13152
- "pluginType": "core",
13153
- "strict": true,
13154
- "enableJsonFlag": true,
13155
- "title": "Fix flexipages for v53",
13156
- "requiresProject": true,
13157
- "isESM": true,
13158
- "relativePath": [
13159
- "lib",
13160
- "commands",
13161
- "hardis",
13162
- "project",
13163
- "fix",
13164
- "v53flexipages.js"
13165
- ],
13166
- "aliasPermutations": [],
13167
- "permutations": [
13168
- "hardis:project:fix:v53flexipages",
13169
- "project:hardis:fix:v53flexipages",
13170
- "project:fix:hardis:v53flexipages",
13171
- "project:fix:v53flexipages:hardis",
13172
- "hardis:fix:project:v53flexipages",
13173
- "fix:hardis:project:v53flexipages",
13174
- "fix:project:hardis:v53flexipages",
13175
- "fix:project:v53flexipages:hardis",
13176
- "hardis:fix:v53flexipages:project",
13177
- "fix:hardis:v53flexipages:project",
13178
- "fix:v53flexipages:hardis:project",
13179
- "fix:v53flexipages:project:hardis",
13180
- "hardis:project:v53flexipages:fix",
13181
- "project:hardis:v53flexipages:fix",
13182
- "project:v53flexipages:hardis:fix",
13183
- "project:v53flexipages:fix:hardis",
13184
- "hardis:v53flexipages:project:fix",
13185
- "v53flexipages:hardis:project:fix",
13186
- "v53flexipages:project:hardis:fix",
13187
- "v53flexipages:project:fix:hardis",
13188
- "hardis:v53flexipages:fix:project",
13189
- "v53flexipages:hardis:fix:project",
13190
- "v53flexipages:fix:hardis:project",
13191
- "v53flexipages:fix:project:hardis"
13192
- ]
13193
- },
13194
13194
  "hardis:project:metadata:findduplicates": {
13195
13195
  "aliases": [],
13196
13196
  "args": {},
@@ -15278,5 +15278,5 @@
15278
15278
  ]
15279
15279
  }
15280
15280
  },
15281
- "version": "6.5.1"
15281
+ "version": "6.5.3"
15282
15282
  }