sfdx-hardis 6.11.1 → 6.11.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.
@@ -132,13 +132,12 @@
132
132
  "clear:cache:hardis"
133
133
  ]
134
134
  },
135
- "hardis:auth:login": {
135
+ "hardis:config:get": {
136
136
  "aliases": [],
137
137
  "args": {},
138
- "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
138
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the sfdx-hardis configuration for a specified level.**\n\nThis command allows you to inspect the configuration that is currently in effect for your project, which is useful for debugging and understanding how sfdx-hardis will behave.\n\n- **Configuration levels:** It can retrieve configuration from three different levels:\n - **Project:** The configuration defined in the project's `.sfdx-hardis.yml` file.\n - **Branch:** The configuration defined in a branch-specific configuration file (e.g., `.sfdx-hardis.production.yml`).\n - **User:** The global user-level configuration.\n\n## Technical explanations\n\nThe command's logic is straightforward:\n\n- **`getConfig` function:** It calls the `getConfig` utility function, passing the desired configuration level as an argument.\n- **Configuration loading:** The `getConfig` function is responsible for finding the appropriate configuration file, reading its contents, and parsing it as YAML or JSON.\n- **Output:** The retrieved configuration is then displayed to the user as a JSON string.\n",
139
139
  "examples": [
140
- "$ sf hardis:auth:login",
141
- "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
140
+ "$ sf hardis:project:deploy:sources:metadata"
142
141
  ],
143
142
  "flags": {
144
143
  "json": {
@@ -156,28 +155,20 @@
156
155
  "multiple": false,
157
156
  "type": "option"
158
157
  },
159
- "instanceurl": {
160
- "char": "r",
161
- "description": "URL of org instance",
162
- "name": "instanceurl",
158
+ "level": {
159
+ "char": "l",
160
+ "description": "project,branch or user",
161
+ "name": "level",
162
+ "default": "project",
163
163
  "hasDynamicHelp": false,
164
164
  "multiple": false,
165
+ "options": [
166
+ "project",
167
+ "branch",
168
+ "user"
169
+ ],
165
170
  "type": "option"
166
171
  },
167
- "devhub": {
168
- "char": "h",
169
- "description": "Also connect associated DevHub",
170
- "name": "devhub",
171
- "allowNo": false,
172
- "type": "boolean"
173
- },
174
- "scratchorg": {
175
- "char": "s",
176
- "description": "Scratch org",
177
- "name": "scratchorg",
178
- "allowNo": false,
179
- "type": "boolean"
180
- },
181
172
  "debug": {
182
173
  "char": "d",
183
174
  "description": "Activate debug mode (more logs)",
@@ -201,38 +192,39 @@
201
192
  },
202
193
  "hasDynamicHelp": false,
203
194
  "hiddenAliases": [],
204
- "id": "hardis:auth:login",
195
+ "id": "hardis:config:get",
205
196
  "pluginAlias": "sfdx-hardis",
206
197
  "pluginName": "sfdx-hardis",
207
198
  "pluginType": "core",
208
199
  "strict": true,
209
200
  "enableJsonFlag": true,
210
- "title": "Login",
201
+ "title": "Deploy metadata sources to org",
211
202
  "requiresProject": false,
212
203
  "isESM": true,
213
204
  "relativePath": [
214
205
  "lib",
215
206
  "commands",
216
207
  "hardis",
217
- "auth",
218
- "login.js"
208
+ "config",
209
+ "get.js"
219
210
  ],
220
211
  "aliasPermutations": [],
221
212
  "permutations": [
222
- "hardis:auth:login",
223
- "auth:hardis:login",
224
- "auth:login:hardis",
225
- "hardis:login:auth",
226
- "login:hardis:auth",
227
- "login:auth:hardis"
213
+ "hardis:config:get",
214
+ "config:hardis:get",
215
+ "config:get:hardis",
216
+ "hardis:get:config",
217
+ "get:hardis:config",
218
+ "get:config:hardis"
228
219
  ]
229
220
  },
230
- "hardis:config:get": {
221
+ "hardis:auth:login": {
231
222
  "aliases": [],
232
223
  "args": {},
233
- "description": "\n## Command Behavior\n\n**Retrieves and displays the sfdx-hardis configuration for a specified level.**\n\nThis command allows you to inspect the configuration that is currently in effect for your project, which is useful for debugging and understanding how sfdx-hardis will behave.\n\n- **Configuration levels:** It can retrieve configuration from three different levels:\n - **Project:** The configuration defined in the project's `.sfdx-hardis.yml` file.\n - **Branch:** The configuration defined in a branch-specific configuration file (e.g., `.sfdx-hardis.production.yml`).\n - **User:** The global user-level configuration.\n\n## Technical explanations\n\nThe command's logic is straightforward:\n\n- **`getConfig` function:** It calls the `getConfig` utility function, passing the desired configuration level as an argument.\n- **Configuration loading:** The `getConfig` function is responsible for finding the appropriate configuration file, reading its contents, and parsing it as YAML or JSON.\n- **Output:** The retrieved configuration is then displayed to the user as a JSON string.\n",
224
+ "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
234
225
  "examples": [
235
- "$ sf hardis:project:deploy:sources:metadata"
226
+ "$ sf hardis:auth:login",
227
+ "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
236
228
  ],
237
229
  "flags": {
238
230
  "json": {
@@ -250,20 +242,28 @@
250
242
  "multiple": false,
251
243
  "type": "option"
252
244
  },
253
- "level": {
254
- "char": "l",
255
- "description": "project,branch or user",
256
- "name": "level",
257
- "default": "project",
245
+ "instanceurl": {
246
+ "char": "r",
247
+ "description": "URL of org instance",
248
+ "name": "instanceurl",
258
249
  "hasDynamicHelp": false,
259
250
  "multiple": false,
260
- "options": [
261
- "project",
262
- "branch",
263
- "user"
264
- ],
265
251
  "type": "option"
266
252
  },
253
+ "devhub": {
254
+ "char": "h",
255
+ "description": "Also connect associated DevHub",
256
+ "name": "devhub",
257
+ "allowNo": false,
258
+ "type": "boolean"
259
+ },
260
+ "scratchorg": {
261
+ "char": "s",
262
+ "description": "Scratch org",
263
+ "name": "scratchorg",
264
+ "allowNo": false,
265
+ "type": "boolean"
266
+ },
267
267
  "debug": {
268
268
  "char": "d",
269
269
  "description": "Activate debug mode (more logs)",
@@ -287,30 +287,30 @@
287
287
  },
288
288
  "hasDynamicHelp": false,
289
289
  "hiddenAliases": [],
290
- "id": "hardis:config:get",
290
+ "id": "hardis:auth:login",
291
291
  "pluginAlias": "sfdx-hardis",
292
292
  "pluginName": "sfdx-hardis",
293
293
  "pluginType": "core",
294
294
  "strict": true,
295
295
  "enableJsonFlag": true,
296
- "title": "Deploy metadata sources to org",
296
+ "title": "Login",
297
297
  "requiresProject": false,
298
298
  "isESM": true,
299
299
  "relativePath": [
300
300
  "lib",
301
301
  "commands",
302
302
  "hardis",
303
- "config",
304
- "get.js"
303
+ "auth",
304
+ "login.js"
305
305
  ],
306
306
  "aliasPermutations": [],
307
307
  "permutations": [
308
- "hardis:config:get",
309
- "config:hardis:get",
310
- "config:get:hardis",
311
- "hardis:get:config",
312
- "get:hardis:config",
313
- "get:config:hardis"
308
+ "hardis:auth:login",
309
+ "auth:hardis:login",
310
+ "auth:login:hardis",
311
+ "hardis:login:auth",
312
+ "login:hardis:auth",
313
+ "login:auth:hardis"
314
314
  ]
315
315
  },
316
316
  "hardis:doc:fieldusage": {
@@ -5539,12 +5539,15 @@
5539
5539
  "import:data:org:hardis"
5540
5540
  ]
5541
5541
  },
5542
- "hardis:org:files:export": {
5542
+ "hardis:org:diagnose:audittrail": {
5543
5543
  "aliases": [],
5544
5544
  "args": {},
5545
- "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
5545
+ "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
5546
5546
  "examples": [
5547
- "$ sf hardis:org:files:export"
5547
+ "$ sf hardis:org:diagnose:audittrail",
5548
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5549
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5550
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5548
5551
  ],
5549
5552
  "flags": {
5550
5553
  "json": {
@@ -5562,48 +5565,30 @@
5562
5565
  "multiple": false,
5563
5566
  "type": "option"
5564
5567
  },
5565
- "path": {
5566
- "char": "p",
5567
- "description": "Path to the file export project",
5568
- "name": "path",
5569
- "hasDynamicHelp": false,
5570
- "multiple": false,
5571
- "type": "option"
5572
- },
5573
- "chunksize": {
5574
- "char": "c",
5575
- "description": "Number of records to add in a chunk before it is processed",
5576
- "name": "chunksize",
5577
- "default": 1000,
5568
+ "excludeusers": {
5569
+ "char": "e",
5570
+ "description": "Comma-separated list of usernames to exclude",
5571
+ "name": "excludeusers",
5578
5572
  "hasDynamicHelp": false,
5579
5573
  "multiple": false,
5580
5574
  "type": "option"
5581
5575
  },
5582
- "polltimeout": {
5576
+ "lastndays": {
5583
5577
  "char": "t",
5584
- "description": "Timeout in MS for Bulk API calls",
5585
- "name": "polltimeout",
5586
- "default": 300000,
5578
+ "description": "Number of days to extract from today (included)",
5579
+ "name": "lastndays",
5587
5580
  "hasDynamicHelp": false,
5588
5581
  "multiple": false,
5589
5582
  "type": "option"
5590
5583
  },
5591
- "startchunknumber": {
5592
- "char": "s",
5593
- "description": "Chunk number to start from",
5594
- "name": "startchunknumber",
5595
- "default": 0,
5584
+ "outputfile": {
5585
+ "char": "f",
5586
+ "description": "Force the path and name of output report file. Must end with .csv",
5587
+ "name": "outputfile",
5596
5588
  "hasDynamicHelp": false,
5597
5589
  "multiple": false,
5598
5590
  "type": "option"
5599
5591
  },
5600
- "resume": {
5601
- "char": "r",
5602
- "description": "Resume previous export by checking existing files (default in CI)",
5603
- "name": "resume",
5604
- "allowNo": false,
5605
- "type": "boolean"
5606
- },
5607
5592
  "debug": {
5608
5593
  "char": "d",
5609
5594
  "description": "Activate debug mode (more logs)",
@@ -5642,13 +5627,13 @@
5642
5627
  },
5643
5628
  "hasDynamicHelp": true,
5644
5629
  "hiddenAliases": [],
5645
- "id": "hardis:org:files:export",
5630
+ "id": "hardis:org:diagnose:audittrail",
5646
5631
  "pluginAlias": "sfdx-hardis",
5647
5632
  "pluginName": "sfdx-hardis",
5648
5633
  "pluginType": "core",
5649
5634
  "strict": true,
5650
5635
  "enableJsonFlag": true,
5651
- "title": "Export files",
5636
+ "title": "Diagnose content of Setup Audit Trail",
5652
5637
  "requiresProject": false,
5653
5638
  "isESM": true,
5654
5639
  "relativePath": [
@@ -5656,43 +5641,43 @@
5656
5641
  "commands",
5657
5642
  "hardis",
5658
5643
  "org",
5659
- "files",
5660
- "export.js"
5644
+ "diagnose",
5645
+ "audittrail.js"
5661
5646
  ],
5662
5647
  "aliasPermutations": [],
5663
5648
  "permutations": [
5664
- "hardis:org:files:export",
5665
- "org:hardis:files:export",
5666
- "org:files:hardis:export",
5667
- "org:files:export:hardis",
5668
- "hardis:files:org:export",
5669
- "files:hardis:org:export",
5670
- "files:org:hardis:export",
5671
- "files:org:export:hardis",
5672
- "hardis:files:export:org",
5673
- "files:hardis:export:org",
5674
- "files:export:hardis:org",
5675
- "files:export:org:hardis",
5676
- "hardis:org:export:files",
5677
- "org:hardis:export:files",
5678
- "org:export:hardis:files",
5679
- "org:export:files:hardis",
5680
- "hardis:export:org:files",
5681
- "export:hardis:org:files",
5682
- "export:org:hardis:files",
5683
- "export:org:files:hardis",
5684
- "hardis:export:files:org",
5685
- "export:hardis:files:org",
5686
- "export:files:hardis:org",
5687
- "export:files:org:hardis"
5649
+ "hardis:org:diagnose:audittrail",
5650
+ "org:hardis:diagnose:audittrail",
5651
+ "org:diagnose:hardis:audittrail",
5652
+ "org:diagnose:audittrail:hardis",
5653
+ "hardis:diagnose:org:audittrail",
5654
+ "diagnose:hardis:org:audittrail",
5655
+ "diagnose:org:hardis:audittrail",
5656
+ "diagnose:org:audittrail:hardis",
5657
+ "hardis:diagnose:audittrail:org",
5658
+ "diagnose:hardis:audittrail:org",
5659
+ "diagnose:audittrail:hardis:org",
5660
+ "diagnose:audittrail:org:hardis",
5661
+ "hardis:org:audittrail:diagnose",
5662
+ "org:hardis:audittrail:diagnose",
5663
+ "org:audittrail:hardis:diagnose",
5664
+ "org:audittrail:diagnose:hardis",
5665
+ "hardis:audittrail:org:diagnose",
5666
+ "audittrail:hardis:org:diagnose",
5667
+ "audittrail:org:hardis:diagnose",
5668
+ "audittrail:org:diagnose:hardis",
5669
+ "hardis:audittrail:diagnose:org",
5670
+ "audittrail:hardis:diagnose:org",
5671
+ "audittrail:diagnose:hardis:org",
5672
+ "audittrail:diagnose:org:hardis"
5688
5673
  ]
5689
5674
  },
5690
- "hardis:org:files:import": {
5675
+ "hardis:org:diagnose:instanceupgrade": {
5691
5676
  "aliases": [],
5692
5677
  "args": {},
5693
- "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
5678
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
5694
5679
  "examples": [
5695
- "$ sf hardis:org:files:import"
5680
+ "$ sf hardis:org:diagnose:instanceupgrade"
5696
5681
  ],
5697
5682
  "flags": {
5698
5683
  "json": {
@@ -5710,21 +5695,6 @@
5710
5695
  "multiple": false,
5711
5696
  "type": "option"
5712
5697
  },
5713
- "path": {
5714
- "char": "p",
5715
- "description": "Path to the file export project",
5716
- "name": "path",
5717
- "hasDynamicHelp": false,
5718
- "multiple": false,
5719
- "type": "option"
5720
- },
5721
- "overwrite": {
5722
- "char": "f",
5723
- "description": "Override existing files (doubles the number of API calls)",
5724
- "name": "overwrite",
5725
- "allowNo": false,
5726
- "type": "boolean"
5727
- },
5728
5698
  "debug": {
5729
5699
  "char": "d",
5730
5700
  "description": "Activate debug mode (more logs)",
@@ -5763,13 +5733,13 @@
5763
5733
  },
5764
5734
  "hasDynamicHelp": true,
5765
5735
  "hiddenAliases": [],
5766
- "id": "hardis:org:files:import",
5736
+ "id": "hardis:org:diagnose:instanceupgrade",
5767
5737
  "pluginAlias": "sfdx-hardis",
5768
5738
  "pluginName": "sfdx-hardis",
5769
5739
  "pluginType": "core",
5770
5740
  "strict": true,
5771
5741
  "enableJsonFlag": true,
5772
- "title": "Import files",
5742
+ "title": "Get Instance Upgrade date",
5773
5743
  "requiresProject": false,
5774
5744
  "isESM": true,
5775
5745
  "relativePath": [
@@ -5777,44 +5747,46 @@
5777
5747
  "commands",
5778
5748
  "hardis",
5779
5749
  "org",
5780
- "files",
5781
- "import.js"
5750
+ "diagnose",
5751
+ "instanceupgrade.js"
5782
5752
  ],
5783
5753
  "aliasPermutations": [],
5784
5754
  "permutations": [
5785
- "hardis:org:files:import",
5786
- "org:hardis:files:import",
5787
- "org:files:hardis:import",
5788
- "org:files:import:hardis",
5789
- "hardis:files:org:import",
5790
- "files:hardis:org:import",
5791
- "files:org:hardis:import",
5792
- "files:org:import:hardis",
5793
- "hardis:files:import:org",
5794
- "files:hardis:import:org",
5795
- "files:import:hardis:org",
5796
- "files:import:org:hardis",
5797
- "hardis:org:import:files",
5798
- "org:hardis:import:files",
5799
- "org:import:hardis:files",
5800
- "org:import:files:hardis",
5801
- "hardis:import:org:files",
5802
- "import:hardis:org:files",
5803
- "import:org:hardis:files",
5804
- "import:org:files:hardis",
5805
- "hardis:import:files:org",
5806
- "import:hardis:files:org",
5807
- "import:files:hardis:org",
5808
- "import:files:org:hardis"
5755
+ "hardis:org:diagnose:instanceupgrade",
5756
+ "org:hardis:diagnose:instanceupgrade",
5757
+ "org:diagnose:hardis:instanceupgrade",
5758
+ "org:diagnose:instanceupgrade:hardis",
5759
+ "hardis:diagnose:org:instanceupgrade",
5760
+ "diagnose:hardis:org:instanceupgrade",
5761
+ "diagnose:org:hardis:instanceupgrade",
5762
+ "diagnose:org:instanceupgrade:hardis",
5763
+ "hardis:diagnose:instanceupgrade:org",
5764
+ "diagnose:hardis:instanceupgrade:org",
5765
+ "diagnose:instanceupgrade:hardis:org",
5766
+ "diagnose:instanceupgrade:org:hardis",
5767
+ "hardis:org:instanceupgrade:diagnose",
5768
+ "org:hardis:instanceupgrade:diagnose",
5769
+ "org:instanceupgrade:hardis:diagnose",
5770
+ "org:instanceupgrade:diagnose:hardis",
5771
+ "hardis:instanceupgrade:org:diagnose",
5772
+ "instanceupgrade:hardis:org:diagnose",
5773
+ "instanceupgrade:org:hardis:diagnose",
5774
+ "instanceupgrade:org:diagnose:hardis",
5775
+ "hardis:instanceupgrade:diagnose:org",
5776
+ "instanceupgrade:hardis:diagnose:org",
5777
+ "instanceupgrade:diagnose:hardis:org",
5778
+ "instanceupgrade:diagnose:org:hardis"
5809
5779
  ]
5810
5780
  },
5811
- "hardis:org:fix:listviewmine": {
5781
+ "hardis:org:diagnose:legacyapi": {
5812
5782
  "aliases": [],
5813
5783
  "args": {},
5814
- "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
5784
+ "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
5815
5785
  "examples": [
5816
- "$ sf hardis:org:fix:listviewmine",
5817
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5786
+ "$ sf hardis:org:diagnose:legacyapi",
5787
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5788
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5789
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5818
5790
  ],
5819
5791
  "flags": {
5820
5792
  "json": {
@@ -5832,10 +5804,28 @@
5832
5804
  "multiple": false,
5833
5805
  "type": "option"
5834
5806
  },
5835
- "listviews": {
5807
+ "eventtype": {
5808
+ "char": "e",
5809
+ "description": "Type of EventLogFile event to analyze",
5810
+ "name": "eventtype",
5811
+ "default": "ApiTotalUsage",
5812
+ "hasDynamicHelp": false,
5813
+ "multiple": false,
5814
+ "type": "option"
5815
+ },
5816
+ "limit": {
5836
5817
  "char": "l",
5837
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5838
- "name": "listviews",
5818
+ "description": "Number of latest EventLogFile events to analyze",
5819
+ "name": "limit",
5820
+ "default": 999,
5821
+ "hasDynamicHelp": false,
5822
+ "multiple": false,
5823
+ "type": "option"
5824
+ },
5825
+ "outputfile": {
5826
+ "char": "f",
5827
+ "description": "Force the path and name of output report file. Must end with .csv",
5828
+ "name": "outputfile",
5839
5829
  "hasDynamicHelp": false,
5840
5830
  "multiple": false,
5841
5831
  "type": "option"
@@ -5878,59 +5868,57 @@
5878
5868
  },
5879
5869
  "hasDynamicHelp": true,
5880
5870
  "hiddenAliases": [],
5881
- "id": "hardis:org:fix:listviewmine",
5871
+ "id": "hardis:org:diagnose:legacyapi",
5882
5872
  "pluginAlias": "sfdx-hardis",
5883
5873
  "pluginName": "sfdx-hardis",
5884
5874
  "pluginType": "core",
5885
5875
  "strict": true,
5886
5876
  "enableJsonFlag": true,
5887
- "title": "Fix listviews with ",
5888
- "requiresProject": true,
5877
+ "title": "Check for legacy API use",
5878
+ "requiresProject": false,
5889
5879
  "isESM": true,
5890
5880
  "relativePath": [
5891
5881
  "lib",
5892
5882
  "commands",
5893
5883
  "hardis",
5894
5884
  "org",
5895
- "fix",
5896
- "listviewmine.js"
5885
+ "diagnose",
5886
+ "legacyapi.js"
5897
5887
  ],
5898
5888
  "aliasPermutations": [],
5899
5889
  "permutations": [
5900
- "hardis:org:fix:listviewmine",
5901
- "org:hardis:fix:listviewmine",
5902
- "org:fix:hardis:listviewmine",
5903
- "org:fix:listviewmine:hardis",
5904
- "hardis:fix:org:listviewmine",
5905
- "fix:hardis:org:listviewmine",
5906
- "fix:org:hardis:listviewmine",
5907
- "fix:org:listviewmine:hardis",
5908
- "hardis:fix:listviewmine:org",
5909
- "fix:hardis:listviewmine:org",
5910
- "fix:listviewmine:hardis:org",
5911
- "fix:listviewmine:org:hardis",
5912
- "hardis:org:listviewmine:fix",
5913
- "org:hardis:listviewmine:fix",
5914
- "org:listviewmine:hardis:fix",
5915
- "org:listviewmine:fix:hardis",
5916
- "hardis:listviewmine:org:fix",
5917
- "listviewmine:hardis:org:fix",
5918
- "listviewmine:org:hardis:fix",
5919
- "listviewmine:org:fix:hardis",
5920
- "hardis:listviewmine:fix:org",
5921
- "listviewmine:hardis:fix:org",
5922
- "listviewmine:fix:hardis:org",
5923
- "listviewmine:fix:org:hardis"
5890
+ "hardis:org:diagnose:legacyapi",
5891
+ "org:hardis:diagnose:legacyapi",
5892
+ "org:diagnose:hardis:legacyapi",
5893
+ "org:diagnose:legacyapi:hardis",
5894
+ "hardis:diagnose:org:legacyapi",
5895
+ "diagnose:hardis:org:legacyapi",
5896
+ "diagnose:org:hardis:legacyapi",
5897
+ "diagnose:org:legacyapi:hardis",
5898
+ "hardis:diagnose:legacyapi:org",
5899
+ "diagnose:hardis:legacyapi:org",
5900
+ "diagnose:legacyapi:hardis:org",
5901
+ "diagnose:legacyapi:org:hardis",
5902
+ "hardis:org:legacyapi:diagnose",
5903
+ "org:hardis:legacyapi:diagnose",
5904
+ "org:legacyapi:hardis:diagnose",
5905
+ "org:legacyapi:diagnose:hardis",
5906
+ "hardis:legacyapi:org:diagnose",
5907
+ "legacyapi:hardis:org:diagnose",
5908
+ "legacyapi:org:hardis:diagnose",
5909
+ "legacyapi:org:diagnose:hardis",
5910
+ "hardis:legacyapi:diagnose:org",
5911
+ "legacyapi:hardis:diagnose:org",
5912
+ "legacyapi:diagnose:hardis:org",
5913
+ "legacyapi:diagnose:org:hardis"
5924
5914
  ]
5925
5915
  },
5926
- "hardis:org:generate:packagexmlfull": {
5916
+ "hardis:org:diagnose:licenses": {
5927
5917
  "aliases": [],
5928
5918
  "args": {},
5929
- "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
5919
+ "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
5930
5920
  "examples": [
5931
- "$ sf hardis:org:generate:packagexmlfull",
5932
- "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
5933
- "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
5921
+ "$ sf hardis:org:diagnose:licenses"
5934
5922
  ],
5935
5923
  "flags": {
5936
5924
  "json": {
@@ -5949,12 +5937,20 @@
5949
5937
  "type": "option"
5950
5938
  },
5951
5939
  "outputfile": {
5952
- "description": "Output package.xml file",
5940
+ "char": "f",
5941
+ "description": "Force the path and name of output report file. Must end with .csv",
5953
5942
  "name": "outputfile",
5954
5943
  "hasDynamicHelp": false,
5955
5944
  "multiple": false,
5956
5945
  "type": "option"
5957
5946
  },
5947
+ "usedonly": {
5948
+ "char": "u",
5949
+ "description": "Filter to have only used licenses",
5950
+ "name": "usedonly",
5951
+ "allowNo": false,
5952
+ "type": "boolean"
5953
+ },
5958
5954
  "debug": {
5959
5955
  "char": "d",
5960
5956
  "description": "Activate debug mode (more logs)",
@@ -5962,13 +5958,6 @@
5962
5958
  "allowNo": false,
5963
5959
  "type": "boolean"
5964
5960
  },
5965
- "no-prompt": {
5966
- "char": "n",
5967
- "description": "Do not prompt for org username, use the default one",
5968
- "name": "no-prompt",
5969
- "allowNo": false,
5970
- "type": "boolean"
5971
- },
5972
5961
  "websocket": {
5973
5962
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
5974
5963
  "name": "websocket",
@@ -6000,13 +5989,13 @@
6000
5989
  },
6001
5990
  "hasDynamicHelp": true,
6002
5991
  "hiddenAliases": [],
6003
- "id": "hardis:org:generate:packagexmlfull",
5992
+ "id": "hardis:org:diagnose:licenses",
6004
5993
  "pluginAlias": "sfdx-hardis",
6005
5994
  "pluginName": "sfdx-hardis",
6006
5995
  "pluginType": "core",
6007
5996
  "strict": true,
6008
5997
  "enableJsonFlag": true,
6009
- "title": "Generate Full Org package.xml",
5998
+ "title": "List licenses subscribed and used in a Salesforce org",
6010
5999
  "requiresProject": false,
6011
6000
  "isESM": true,
6012
6001
  "relativePath": [
@@ -6014,43 +6003,43 @@
6014
6003
  "commands",
6015
6004
  "hardis",
6016
6005
  "org",
6017
- "generate",
6018
- "packagexmlfull.js"
6006
+ "diagnose",
6007
+ "licenses.js"
6019
6008
  ],
6020
6009
  "aliasPermutations": [],
6021
6010
  "permutations": [
6022
- "hardis:org:generate:packagexmlfull",
6023
- "org:hardis:generate:packagexmlfull",
6024
- "org:generate:hardis:packagexmlfull",
6025
- "org:generate:packagexmlfull:hardis",
6026
- "hardis:generate:org:packagexmlfull",
6027
- "generate:hardis:org:packagexmlfull",
6028
- "generate:org:hardis:packagexmlfull",
6029
- "generate:org:packagexmlfull:hardis",
6030
- "hardis:generate:packagexmlfull:org",
6031
- "generate:hardis:packagexmlfull:org",
6032
- "generate:packagexmlfull:hardis:org",
6033
- "generate:packagexmlfull:org:hardis",
6034
- "hardis:org:packagexmlfull:generate",
6035
- "org:hardis:packagexmlfull:generate",
6036
- "org:packagexmlfull:hardis:generate",
6037
- "org:packagexmlfull:generate:hardis",
6038
- "hardis:packagexmlfull:org:generate",
6039
- "packagexmlfull:hardis:org:generate",
6040
- "packagexmlfull:org:hardis:generate",
6041
- "packagexmlfull:org:generate:hardis",
6042
- "hardis:packagexmlfull:generate:org",
6043
- "packagexmlfull:hardis:generate:org",
6044
- "packagexmlfull:generate:hardis:org",
6045
- "packagexmlfull:generate:org:hardis"
6011
+ "hardis:org:diagnose:licenses",
6012
+ "org:hardis:diagnose:licenses",
6013
+ "org:diagnose:hardis:licenses",
6014
+ "org:diagnose:licenses:hardis",
6015
+ "hardis:diagnose:org:licenses",
6016
+ "diagnose:hardis:org:licenses",
6017
+ "diagnose:org:hardis:licenses",
6018
+ "diagnose:org:licenses:hardis",
6019
+ "hardis:diagnose:licenses:org",
6020
+ "diagnose:hardis:licenses:org",
6021
+ "diagnose:licenses:hardis:org",
6022
+ "diagnose:licenses:org:hardis",
6023
+ "hardis:org:licenses:diagnose",
6024
+ "org:hardis:licenses:diagnose",
6025
+ "org:licenses:hardis:diagnose",
6026
+ "org:licenses:diagnose:hardis",
6027
+ "hardis:licenses:org:diagnose",
6028
+ "licenses:hardis:org:diagnose",
6029
+ "licenses:org:hardis:diagnose",
6030
+ "licenses:org:diagnose:hardis",
6031
+ "hardis:licenses:diagnose:org",
6032
+ "licenses:hardis:diagnose:org",
6033
+ "licenses:diagnose:hardis:org",
6034
+ "licenses:diagnose:org:hardis"
6046
6035
  ]
6047
6036
  },
6048
- "hardis:org:monitor:all": {
6037
+ "hardis:org:diagnose:releaseupdates": {
6049
6038
  "aliases": [],
6050
6039
  "args": {},
6051
- "description": "Monitor org, generate reports and sends notifications\n\nYou can disable some commands defining either a **monitoringDisable** property in `.sfdx-hardis.yml`, or a comma separated list in env variable **MONITORING_DISABLE**\n\nExample in .sfdx-hardis.yml:\n \n```yaml\nmonitoringDisable:\n - METADATA_STATUS\n - MISSING_ATTRIBUTES\n - UNUSED_METADATAS\n```\n \nExample in env var:\n\n```sh\nMONITORING_DISABLE=METADATA_STATUS,MISSING_ATTRIBUTES,UNUSED_METADATAS\n```\n\nA [default list of monitoring commands](https://sfdx-hardis.cloudity.com/salesforce-monitoring-home/#monitoring-commands) is used, if you want to override it you can define property **monitoringCommands** in your .sfdx-hardis.yml file\n\nExample:\n\n```yaml\nmonitoringCommands:\n - title: My Custom command\n command: sf my:custom:command\n - title: My Custom command 2\n command: sf my:other:custom:command\n```\n\nYou can force the daily run of all commands by defining env var `MONITORING_IGNORE_FREQUENCY=true`\n\nThe default list of commands is the following:\n\n| Key | Description | Command | Frequency |\n| :---: | :---- | :---- | :-----: |\n| [AUDIT_TRAIL](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | Detect suspect setup actions in major org | [sf hardis:org:diagnose:audittrail](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | daily |\n| [LEGACY_API](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | Detect calls to deprecated API versions | [sf hardis:org:diagnose:legacyapi](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | daily |\n| [ORG_LIMITS](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | Detect if org limits are close to be reached | [sf hardis:org:monitor:limits](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | daily |\n| [UNSECURED_CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | Detect unsecured Connected Apps in an org | [sf hardis:org:diagnose:unsecure-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | daily |\n| [LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | Extract licenses information | [sf hardis:org:diagnose:licenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | weekly |\n| [LINT_ACCESS](https://sfdx-hardis.cloudity.com/hardis/lint/access) | Detect custom elements with no access rights defined in permission sets | [sf hardis:lint:access](https://sfdx-hardis.cloudity.com/hardis/lint/access) | weekly |\n| [UNUSED_LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | Detect permission set licenses that are assigned to users that do not need them | [sf hardis:org:diagnose:unusedlicenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | weekly |\n| [UNUSED_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users without recent logins | [sf hardis:org:diagnose:unusedusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ACTIVE_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users with recent logins | [sf hardis:org:diagnose:unusedusers --returnactiveusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ORG_INFO](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | Get org info + SF instance info + next major upgrade date | [sf hardis:org:diagnose:instanceupgrade](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | weekly |\n| [RELEASE_UPDATES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | Gather warnings about incoming and overdue Release Updates | [sf hardis:org:diagnose:releaseupdates](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | weekly |\n| [UNUSED_METADATAS](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | Detect custom labels and custom permissions that are not in use | [sf hardis:lint:unusedmetadatas](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | weekly |\n| [UNUSED_APEX_CLASSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | Detect unused Apex classes in an org | [sf hardis:org:diagnose:unused-apex-classes](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | weekly |\n| [CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | Detect unused Connected Apps in an org | [sf hardis:org:diagnose:unused-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | weekly |\n| [METADATA_STATUS](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | Detect inactive metadata | [sf hardis:lint:metadatastatus](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | weekly |\n| [MISSING_ATTRIBUTES](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | Detect missing description on custom field | [sf hardis:lint:missingattributes](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | weekly |\n\n",
6040
+ "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6052
6041
  "examples": [
6053
- "$ sf hardis:org:monitor:all"
6042
+ "$ sf hardis:org:diagnose:releaseupdates"
6054
6043
  ],
6055
6044
  "flags": {
6056
6045
  "json": {
@@ -6068,6 +6057,14 @@
6068
6057
  "multiple": false,
6069
6058
  "type": "option"
6070
6059
  },
6060
+ "outputfile": {
6061
+ "char": "f",
6062
+ "description": "Force the path and name of output report file. Must end with .csv",
6063
+ "name": "outputfile",
6064
+ "hasDynamicHelp": false,
6065
+ "multiple": false,
6066
+ "type": "option"
6067
+ },
6071
6068
  "debug": {
6072
6069
  "char": "d",
6073
6070
  "description": "Activate debug mode (more logs)",
@@ -6106,159 +6103,62 @@
6106
6103
  },
6107
6104
  "hasDynamicHelp": true,
6108
6105
  "hiddenAliases": [],
6109
- "id": "hardis:org:monitor:all",
6106
+ "id": "hardis:org:diagnose:releaseupdates",
6110
6107
  "pluginAlias": "sfdx-hardis",
6111
6108
  "pluginName": "sfdx-hardis",
6112
6109
  "pluginType": "core",
6113
6110
  "strict": true,
6114
6111
  "enableJsonFlag": true,
6115
- "title": "Monitor org",
6116
- "monitoringCommandsDefault": [
6117
- {
6118
- "key": "AUDIT_TRAIL",
6119
- "title": "Detect suspect setup actions in major org",
6120
- "command": "sf hardis:org:diagnose:audittrail",
6121
- "frequency": "daily"
6122
- },
6123
- {
6124
- "key": "LEGACY_API",
6125
- "title": "Detect calls to deprecated API versions",
6126
- "command": "sf hardis:org:diagnose:legacyapi",
6127
- "frequency": "daily"
6128
- },
6129
- {
6130
- "key": "ORG_LIMITS",
6131
- "title": "Detect if org limits are close to be reached",
6132
- "command": "sf hardis:org:monitor:limits",
6133
- "frequency": "daily"
6134
- },
6135
- {
6136
- "key": "UNSECURED_CONNECTED_APPS",
6137
- "title": "Detect unsecured Connected Apps in an org",
6138
- "command": "sf hardis:org:diagnose:unsecure-connected-apps",
6139
- "frequency": "daily"
6140
- },
6141
- {
6142
- "key": "LICENSES",
6143
- "title": "Extract licenses information",
6144
- "command": "sf hardis:org:diagnose:licenses",
6145
- "frequency": "weekly"
6146
- },
6147
- {
6148
- "key": "LINT_ACCESS",
6149
- "title": "Detect custom elements with no access rights defined in permission sets",
6150
- "command": "sf hardis:lint:access",
6151
- "frequency": "weekly"
6152
- },
6153
- {
6154
- "key": "UNUSED_LICENSES",
6155
- "title": "Detect permission set licenses that are assigned to users that do not need them",
6156
- "command": "sf hardis:org:diagnose:unusedlicenses",
6157
- "frequency": "weekly"
6158
- },
6159
- {
6160
- "key": "UNUSED_USERS",
6161
- "title": "Detect active users without recent logins",
6162
- "command": "sf hardis:org:diagnose:unusedusers",
6163
- "frequency": "weekly"
6164
- },
6165
- {
6166
- "key": "ACTIVE_USERS",
6167
- "title": "Detect active users with recent logins",
6168
- "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
6169
- "frequency": "weekly"
6170
- },
6171
- {
6172
- "key": "ORG_INFO",
6173
- "title": "Get org info + SF instance info + next major upgrade date",
6174
- "command": "sf hardis:org:diagnose:instanceupgrade",
6175
- "frequency": "weekly"
6176
- },
6177
- {
6178
- "key": "RELEASE_UPDATES",
6179
- "title": "Gather warnings about incoming and overdue Release Updates",
6180
- "command": "sf hardis:org:diagnose:releaseupdates",
6181
- "frequency": "weekly"
6182
- },
6183
- {
6184
- "key": "UNUSED_METADATAS",
6185
- "title": "Detect custom labels and custom permissions that are not in use",
6186
- "command": "sf hardis:lint:unusedmetadatas",
6187
- "frequency": "weekly"
6188
- },
6189
- {
6190
- "key": "UNUSED_APEX_CLASSES",
6191
- "title": "Detect unused Apex classes in an org",
6192
- "command": "sf hardis:org:diagnose:unused-apex-classes",
6193
- "frequency": "weekly"
6194
- },
6195
- {
6196
- "key": "CONNECTED_APPS",
6197
- "title": "Detect unused Connected Apps in an org",
6198
- "command": "sf hardis:org:diagnose:unused-connected-apps",
6199
- "frequency": "weekly"
6200
- },
6201
- {
6202
- "key": "METADATA_STATUS",
6203
- "title": "Detect inactive metadata",
6204
- "command": "sf hardis:lint:metadatastatus",
6205
- "frequency": "weekly"
6206
- },
6207
- {
6208
- "key": "MISSING_ATTRIBUTES",
6209
- "title": "Detect missing description on custom field",
6210
- "command": "sf hardis:lint:missingattributes",
6211
- "frequency": "weekly"
6212
- }
6213
- ],
6214
- "requiresProject": true,
6215
- "triggerNotification": true,
6112
+ "title": "Check Release Updates of an org",
6113
+ "requiresProject": false,
6216
6114
  "isESM": true,
6217
6115
  "relativePath": [
6218
6116
  "lib",
6219
6117
  "commands",
6220
6118
  "hardis",
6221
6119
  "org",
6222
- "monitor",
6223
- "all.js"
6120
+ "diagnose",
6121
+ "releaseupdates.js"
6224
6122
  ],
6225
6123
  "aliasPermutations": [],
6226
6124
  "permutations": [
6227
- "hardis:org:monitor:all",
6228
- "org:hardis:monitor:all",
6229
- "org:monitor:hardis:all",
6230
- "org:monitor:all:hardis",
6231
- "hardis:monitor:org:all",
6232
- "monitor:hardis:org:all",
6233
- "monitor:org:hardis:all",
6234
- "monitor:org:all:hardis",
6235
- "hardis:monitor:all:org",
6236
- "monitor:hardis:all:org",
6237
- "monitor:all:hardis:org",
6238
- "monitor:all:org:hardis",
6239
- "hardis:org:all:monitor",
6240
- "org:hardis:all:monitor",
6241
- "org:all:hardis:monitor",
6242
- "org:all:monitor:hardis",
6243
- "hardis:all:org:monitor",
6244
- "all:hardis:org:monitor",
6245
- "all:org:hardis:monitor",
6246
- "all:org:monitor:hardis",
6247
- "hardis:all:monitor:org",
6248
- "all:hardis:monitor:org",
6249
- "all:monitor:hardis:org",
6250
- "all:monitor:org:hardis"
6125
+ "hardis:org:diagnose:releaseupdates",
6126
+ "org:hardis:diagnose:releaseupdates",
6127
+ "org:diagnose:hardis:releaseupdates",
6128
+ "org:diagnose:releaseupdates:hardis",
6129
+ "hardis:diagnose:org:releaseupdates",
6130
+ "diagnose:hardis:org:releaseupdates",
6131
+ "diagnose:org:hardis:releaseupdates",
6132
+ "diagnose:org:releaseupdates:hardis",
6133
+ "hardis:diagnose:releaseupdates:org",
6134
+ "diagnose:hardis:releaseupdates:org",
6135
+ "diagnose:releaseupdates:hardis:org",
6136
+ "diagnose:releaseupdates:org:hardis",
6137
+ "hardis:org:releaseupdates:diagnose",
6138
+ "org:hardis:releaseupdates:diagnose",
6139
+ "org:releaseupdates:hardis:diagnose",
6140
+ "org:releaseupdates:diagnose:hardis",
6141
+ "hardis:releaseupdates:org:diagnose",
6142
+ "releaseupdates:hardis:org:diagnose",
6143
+ "releaseupdates:org:hardis:diagnose",
6144
+ "releaseupdates:org:diagnose:hardis",
6145
+ "hardis:releaseupdates:diagnose:org",
6146
+ "releaseupdates:hardis:diagnose:org",
6147
+ "releaseupdates:diagnose:hardis:org",
6148
+ "releaseupdates:diagnose:org:hardis"
6251
6149
  ]
6252
6150
  },
6253
- "hardis:org:monitor:backup": {
6151
+ "hardis:org:diagnose:storage-stats": {
6254
6152
  "aliases": [],
6255
6153
  "args": {},
6256
- "description": "Retrieve sfdx sources in the context of a monitoring backup\n\nThe command exists in 2 modes: filtered(default & recommended) and full.\n\n## Filtered mode (default, better performances)\n\nAutomatically skips metadatas from installed packages with namespace. \n\nYou can remove more metadata types from backup, especially in case you have too many metadatas and that provokes a crash, using:\n\n- Manual update of `manifest/package-skip-items.xml` config file (then commit & push in the same branch)\n\n - Works with full wildcard (`<members>*</members>`) , named metadata (`<members>Account.Name</members>`) or partial wildcards names (`<members>pi__*</members>` , `<members>*__dlm</members>` , or `<members>prefix*suffix</members>`)\n\n- Environment variable MONITORING_BACKUP_SKIP_METADATA_TYPES (example: `MONITORING_BACKUP_SKIP_METADATA_TYPES=CustomLabel,StaticResource,Translation`): that will be applied to all monitoring branches.\n\n## Full mode\n\nActivate it with **--full** parameter, or variable MONITORING_BACKUP_MODE_FULL=true\n\nIgnores filters (namespaces items & manifest/package-skip-items.xml) to retrieve ALL metadatas, including those you might not care about (reports, translations...)\n\nAs we can retrieve only 10000 files by call, the list of all metadatas will be chunked to make multiple calls (and take more time than filtered mode)\n\n- if you use `--full-apply-filters` , manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES filters will be applied anyway\n- if you use `--exclude-namespaces` , namespaced items will be ignored\n\n_With those both options, it's like if you are not using --full, but with chunked metadata download_\n\n## In CI/CD\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-metadata-backup/) and can output Grafana, Slack and MsTeams Notifications.\n\n## Troubleshooting\n\nIf you have unknown errors (it happens !), you can investigate using the full command with smaller chunks.\n\nExample: `sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters --max-by-chunk 500`\n\nIt will allow you the identify the responsible metadata and ignore it using package-skip-items.xml or MONITORING_BACKUP_SKIP_METADATA_TYPES env variable.\n\n## Documentation\n\n[Doc generation (including visual flows)](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/) is triggered at the end of the command.\n\nIf you want to also upload HTML Documentation on your Salesforce Org as static resource, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_ORG=\"true\"**\n\nIf you want to also upload HTML Documentation on Cloudflare, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_CLOUDFLARE=\"true\"**\n\n- If you want to generate the documentation in multiple languages, define variable SFDX_DOC_LANGUAGES (ex: SFDX_DOC_LANGUAGES=en,fr,de)\n- You can define one Cloudflare site by language, for example with the following variables:\n - CLOUDFLARE_PROJECT_NAME_EN=cloudity-demo-english\n - CLOUDFLARE_PROJECT_NAME_FR=cloudity-demo-french\n - CLOUDFLARE_PROJECT_NAME_DE=cloudity-demo-german\n\nIf Flow history doc always display a single state, you probably need to update your workflow configuration:\n\n- on Gitlab: Env variable [`GIT_FETCH_EXTRA_FLAGS: --depth 10000`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11)\n- on GitHub: [`fetch-depth: 0`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml#L58)\n- on Azure: [`fetchDepth: \"0\"`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml#L39)\n- on Bitbucket: [`step: clone: depth: full`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml#L18)\n",
6154
+ "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with flexible grouping options.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose breakdown fields (date fields, RecordType, custom fields, or relationship fields).\n- **Flexible Breakdown Field:** Supports grouping by any field including:\n - Date/DateTime fields (`CreatedDate`, `LastModifiedDate`, custom date fields)\n - RecordType (`RecordType.Name`)\n - Custom fields (`Status__c`, picklists, text fields)\n - Nested relationship fields (`SBQQ__Quote__r.RecordType.Name`)\n- **Date Granularity Options:** For date/datetime fields, choose between:\n - Year-based grouping (`CALENDAR_YEAR`)\n - Month-based grouping (`CALENDAR_MONTH`)\n - Day-based grouping (exact date)\n- **WHERE Clause Filtering:** Apply SOQL WHERE conditions to filter records before calculating storage (e.g., only active records, records from the last year).\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed breakdown by selected field and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects, breakdown field selection, granularity choice (for date fields), and optional WHERE conditions. All objects are pre-selected by default for user convenience.\n- **Field Validation:** Recursively validates breakdown fields including nested relationships (e.g., `SBQQ__Quote__r.RecordType.Name`) by traversing the relationship chain and checking field existence on each related object. Automatically handles special cases like `RecordType` -> `RecordTypeId` and `__r` -> `__c` conversions.\n- **Dynamic Query Generation:** Builds SOQL queries based on field type and granularity:\n - For date fields with year granularity: `SELECT CALENDAR_YEAR(<Field>) breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>) ORDER BY CALENDAR_YEAR(<Field>)`\n - For date fields with month granularity: `SELECT CALENDAR_YEAR(<Field>) year, CALENDAR_MONTH(<Field>) month, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>) ORDER BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>)`\n - For non-date fields: `SELECT <Field> breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY <Field> ORDER BY <Field>`\n- **WHERE Clause Support:** Accepts user-provided WHERE conditions via flag (`--where`) or interactive prompt. Injects the condition into all SOQL queries for consistent filtering across all objects.\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and breakdown value.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all statistics per breakdown value per object (e.g., by year, by month, by RecordType)\n - Totals summary: includes only aggregate totals per object\n - File naming includes breakdown field, granularity (for date fields), and `-filtered` suffix when WHERE clause is applied\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
6257
6155
  "examples": [
6258
- "$ sf hardis:org:monitor:backup",
6259
- "$ sf hardis:org:monitor:backup --full",
6260
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
6261
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
6156
+ "$ sf hardis:org:diagnose:storage-stats",
6157
+ "$ sf hardis:org:diagnose:storage-stats --breakdown-field \"CreatedDate\"",
6158
+ "$ sf hardis:org:diagnose:storage-stats -b \"RecordType.Name\"",
6159
+ "$ sf hardis:org:diagnose:storage-stats --where \"CreatedDate = LAST_N_DAYS:365\"",
6160
+ "$ sf hardis:org:diagnose:storage-stats -w \"Status__c = 'Active'\"",
6161
+ "$ sf hardis:org:diagnose:storage-stats -b \"LastModifiedDate\" -w \"IsDeleted = false\""
6262
6162
  ],
6263
6163
  "flags": {
6264
6164
  "json": {
@@ -6276,53 +6176,26 @@
6276
6176
  "multiple": false,
6277
6177
  "type": "option"
6278
6178
  },
6279
- "full": {
6280
- "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
6281
- "name": "full",
6282
- "allowNo": false,
6283
- "type": "boolean"
6284
- },
6285
- "max-by-chunk": {
6286
- "char": "m",
6287
- "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
6288
- "name": "max-by-chunk",
6289
- "default": 3000,
6179
+ "outputfile": {
6180
+ "char": "f",
6181
+ "description": "Force the path and name of output report file. Must end with .csv",
6182
+ "name": "outputfile",
6290
6183
  "hasDynamicHelp": false,
6291
6184
  "multiple": false,
6292
6185
  "type": "option"
6293
6186
  },
6294
- "exclude-namespaces": {
6295
- "char": "e",
6296
- "description": "If mode --full is activated, exclude namespaced metadatas",
6297
- "name": "exclude-namespaces",
6298
- "allowNo": false,
6299
- "type": "boolean"
6300
- },
6301
- "full-apply-filters": {
6302
- "char": "z",
6303
- "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
6304
- "name": "full-apply-filters",
6305
- "allowNo": false,
6306
- "type": "boolean"
6307
- },
6308
- "start-chunk": {
6309
- "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
6310
- "name": "start-chunk",
6311
- "default": 1,
6187
+ "breakdown-field": {
6188
+ "char": "b",
6189
+ "description": "Field to use for storage stats breakdown. Example: \"CreatedDate\", \"LastModifiedDate\", \"RecordType.Name\", or custom fields like \"Status__c\"",
6190
+ "name": "breakdown-field",
6312
6191
  "hasDynamicHelp": false,
6313
6192
  "multiple": false,
6314
6193
  "type": "option"
6315
6194
  },
6316
- "skip-doc": {
6317
- "description": "Skip the generation of project documentation at the end of the command",
6318
- "name": "skip-doc",
6319
- "allowNo": false,
6320
- "type": "boolean"
6321
- },
6322
- "outputfile": {
6323
- "char": "f",
6324
- "description": "Force the path and name of output report file. Must end with .csv",
6325
- "name": "outputfile",
6195
+ "where": {
6196
+ "char": "w",
6197
+ "description": "WHERE clause to filter records in the query (without the WHERE keyword). Example: \"CreatedDate = LAST_N_DAYS:365\" or \"Status__c = 'Active'\"",
6198
+ "name": "where",
6326
6199
  "hasDynamicHelp": false,
6327
6200
  "multiple": false,
6328
6201
  "type": "option"
@@ -6365,58 +6238,57 @@
6365
6238
  },
6366
6239
  "hasDynamicHelp": true,
6367
6240
  "hiddenAliases": [],
6368
- "id": "hardis:org:monitor:backup",
6241
+ "id": "hardis:org:diagnose:storage-stats",
6369
6242
  "pluginAlias": "sfdx-hardis",
6370
6243
  "pluginName": "sfdx-hardis",
6371
6244
  "pluginType": "core",
6372
6245
  "strict": true,
6373
6246
  "enableJsonFlag": true,
6374
- "title": "Backup DX sources",
6247
+ "title": "Extract Data Storage stats",
6375
6248
  "requiresProject": true,
6376
- "triggerNotification": true,
6377
6249
  "isESM": true,
6378
6250
  "relativePath": [
6379
6251
  "lib",
6380
6252
  "commands",
6381
6253
  "hardis",
6382
6254
  "org",
6383
- "monitor",
6384
- "backup.js"
6255
+ "diagnose",
6256
+ "storage-stats.js"
6385
6257
  ],
6386
6258
  "aliasPermutations": [],
6387
6259
  "permutations": [
6388
- "hardis:org:monitor:backup",
6389
- "org:hardis:monitor:backup",
6390
- "org:monitor:hardis:backup",
6391
- "org:monitor:backup:hardis",
6392
- "hardis:monitor:org:backup",
6393
- "monitor:hardis:org:backup",
6394
- "monitor:org:hardis:backup",
6395
- "monitor:org:backup:hardis",
6396
- "hardis:monitor:backup:org",
6397
- "monitor:hardis:backup:org",
6398
- "monitor:backup:hardis:org",
6399
- "monitor:backup:org:hardis",
6400
- "hardis:org:backup:monitor",
6401
- "org:hardis:backup:monitor",
6402
- "org:backup:hardis:monitor",
6403
- "org:backup:monitor:hardis",
6404
- "hardis:backup:org:monitor",
6405
- "backup:hardis:org:monitor",
6406
- "backup:org:hardis:monitor",
6407
- "backup:org:monitor:hardis",
6408
- "hardis:backup:monitor:org",
6409
- "backup:hardis:monitor:org",
6410
- "backup:monitor:hardis:org",
6411
- "backup:monitor:org:hardis"
6260
+ "hardis:org:diagnose:storage-stats",
6261
+ "org:hardis:diagnose:storage-stats",
6262
+ "org:diagnose:hardis:storage-stats",
6263
+ "org:diagnose:storage-stats:hardis",
6264
+ "hardis:diagnose:org:storage-stats",
6265
+ "diagnose:hardis:org:storage-stats",
6266
+ "diagnose:org:hardis:storage-stats",
6267
+ "diagnose:org:storage-stats:hardis",
6268
+ "hardis:diagnose:storage-stats:org",
6269
+ "diagnose:hardis:storage-stats:org",
6270
+ "diagnose:storage-stats:hardis:org",
6271
+ "diagnose:storage-stats:org:hardis",
6272
+ "hardis:org:storage-stats:diagnose",
6273
+ "org:hardis:storage-stats:diagnose",
6274
+ "org:storage-stats:hardis:diagnose",
6275
+ "org:storage-stats:diagnose:hardis",
6276
+ "hardis:storage-stats:org:diagnose",
6277
+ "storage-stats:hardis:org:diagnose",
6278
+ "storage-stats:org:hardis:diagnose",
6279
+ "storage-stats:org:diagnose:hardis",
6280
+ "hardis:storage-stats:diagnose:org",
6281
+ "storage-stats:hardis:diagnose:org",
6282
+ "storage-stats:diagnose:hardis:org",
6283
+ "storage-stats:diagnose:org:hardis"
6412
6284
  ]
6413
6285
  },
6414
- "hardis:org:monitor:limits": {
6286
+ "hardis:org:diagnose:unsecure-connected-apps": {
6415
6287
  "aliases": [],
6416
6288
  "args": {},
6417
- "description": "\n## Command Behavior\n\n**Checks the current usage of various Salesforce org limits and sends notifications if thresholds are exceeded.**\n\nThis command is a critical component of proactive Salesforce org management, helping administrators and developers monitor resource consumption and prevent hitting critical limits that could impact performance or functionality. It provides early warnings when limits are approaching their capacity.\n\nKey functionalities:\n\n- **Limit Retrieval:** Fetches a comprehensive list of all Salesforce org limits using the Salesforce CLI.\n- **Usage Calculation:** Calculates the percentage of each limit that is currently being used.\n- **Threshold-Based Alerting:** Assigns a severity (success, warning, or error) to each limit based on configurable thresholds:\n - **Warning:** If usage exceeds 50% (configurable via `LIMIT_THRESHOLD_WARNING` environment variable).\n - **Error:** If usage exceeds 75% (configurable via `LIMIT_THRESHOLD_ERROR` environment variable).\n- **CSV Report Generation:** Generates a CSV file containing all org limits, their current usage, maximum allowed, and calculated percentage used, along with the assigned severity.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of limits that have exceeded the warning or error thresholds.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-limits/) 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 CLI Integration:** It executes the `sf org limits list` command to retrieve the current org limits. It parses the JSON output of this command.\n- **Data Processing:** It iterates through the retrieved limits, calculates the `used` and `percentUsed` values, and assigns a `severity` (success, warning, error) based on the configured thresholds.\n- **Environment Variable Configuration:** Reads `LIMIT_THRESHOLD_WARNING` and `LIMIT_THRESHOLD_ERROR` environment variables to set the warning and error thresholds for limit usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of org limits.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and detailed metrics for each limit, which can be consumed by monitoring dashboards like Grafana.\n- **Exit Code Management:** Sets the process exit code to 1 if any limit is in an 'error' state, indicating a critical issue.\n</details>\n",
6289
+ "description": "\n## Command Behavior\n\n**Detects unsecured Connected Apps in a Salesforce org and generates detailed reports for security analysis.**\n\nThis command is a critical security diagnostic tool that helps administrators identify Connected Apps that may pose security risks due to improper configuration. It provides comprehensive analysis of OAuth tokens and Connected App security settings to ensure proper access control.\n\nKey functionalities:\n\n- **OAuth Token Analysis:** Queries all OAuth tokens in the org using SOQL to retrieve comprehensive token information including app names, users, authorization status, and usage statistics.\n- **Security Status Assessment:** Evaluates each Connected App's security configuration by checking the `IsUsingAdminAuthorization` flag to determine if admin pre-approval is required.\n- **Unsecured App Detection:** Identifies Connected Apps that allow users to authorize themselves without admin approval, which can pose security risks.\n- **Detailed Reporting:** Generates two comprehensive CSV reports:\n - **OAuth Tokens Report:** Lists all OAuth tokens with security status, user information, and usage data\n - **Connected Apps Summary:** Aggregates unsecured Connected Apps with counts of associated OAuth tokens\n- **Visual Indicators:** Uses status icons (❌ for unsecured, for secured) to provide immediate visual feedback on security status.\n- **Security Recommendations:** Provides actionable guidance on how to secure Connected Apps through proper configuration.\n- **Notifications:** Sends alerts to configured channels (Grafana, Slack, MS Teams) with security findings and attached reports.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-security/) and can output Grafana, Slack and MsTeams Notifications.\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/jHv8yrSK8Dg\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query Execution:** Executes a comprehensive SOQL query on the `OauthToken` object, joining with `AppMenuItem` and `User` objects to gather complete security context.\n- **Security Analysis Logic:** Analyzes the `AppMenuItem.IsUsingAdminAuthorization` field to determine if a Connected App requires admin pre-approval for user authorization.\n- **Data Transformation:** Processes raw SOQL results to add security status indicators and reorganize data for optimal reporting and analysis.\n- **Aggregation Processing:** Groups OAuth tokens by Connected App name to provide summary statistics and identify the most problematic applications.\n- **Report Generation:** Uses `generateCsvFile` to create structured CSV reports with proper formatting and metadata for easy analysis and sharing.\n- **Notification Integration:** Integrates with the `NotifProvider` to send security alerts with detailed metrics, including the number of unsecured Connected Apps and associated OAuth tokens.\n- **File Management:** Generates multiple output formats (CSV, XLSX) and manages file paths using `generateReportPath` for consistent report organization.\n- **Connection Management:** Uses `setConnectionVariables` to ensure proper authentication context for notification providers that require org connection details.\n</details>\n",
6418
6290
  "examples": [
6419
- "$ sf hardis:org:monitor:limits"
6291
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6420
6292
  ],
6421
6293
  "flags": {
6422
6294
  "json": {
@@ -6480,59 +6352,58 @@
6480
6352
  },
6481
6353
  "hasDynamicHelp": true,
6482
6354
  "hiddenAliases": [],
6483
- "id": "hardis:org:monitor:limits",
6355
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
6484
6356
  "pluginAlias": "sfdx-hardis",
6485
6357
  "pluginName": "sfdx-hardis",
6486
6358
  "pluginType": "core",
6487
6359
  "strict": true,
6488
6360
  "enableJsonFlag": true,
6489
- "title": "Check org limits",
6490
- "requiresProject": true,
6491
- "triggerNotification": true,
6361
+ "title": "Detect Unsecured Connected Apps",
6362
+ "requiresProject": false,
6492
6363
  "isESM": true,
6493
6364
  "relativePath": [
6494
6365
  "lib",
6495
6366
  "commands",
6496
6367
  "hardis",
6497
6368
  "org",
6498
- "monitor",
6499
- "limits.js"
6369
+ "diagnose",
6370
+ "unsecure-connected-apps.js"
6500
6371
  ],
6501
6372
  "aliasPermutations": [],
6502
6373
  "permutations": [
6503
- "hardis:org:monitor:limits",
6504
- "org:hardis:monitor:limits",
6505
- "org:monitor:hardis:limits",
6506
- "org:monitor:limits:hardis",
6507
- "hardis:monitor:org:limits",
6508
- "monitor:hardis:org:limits",
6509
- "monitor:org:hardis:limits",
6510
- "monitor:org:limits:hardis",
6511
- "hardis:monitor:limits:org",
6512
- "monitor:hardis:limits:org",
6513
- "monitor:limits:hardis:org",
6514
- "monitor:limits:org:hardis",
6515
- "hardis:org:limits:monitor",
6516
- "org:hardis:limits:monitor",
6517
- "org:limits:hardis:monitor",
6518
- "org:limits:monitor:hardis",
6519
- "hardis:limits:org:monitor",
6520
- "limits:hardis:org:monitor",
6521
- "limits:org:hardis:monitor",
6522
- "limits:org:monitor:hardis",
6523
- "hardis:limits:monitor:org",
6524
- "limits:hardis:monitor:org",
6525
- "limits:monitor:hardis:org",
6526
- "limits:monitor:org:hardis"
6374
+ "hardis:org:diagnose:unsecure-connected-apps",
6375
+ "org:hardis:diagnose:unsecure-connected-apps",
6376
+ "org:diagnose:hardis:unsecure-connected-apps",
6377
+ "org:diagnose:unsecure-connected-apps:hardis",
6378
+ "hardis:diagnose:org:unsecure-connected-apps",
6379
+ "diagnose:hardis:org:unsecure-connected-apps",
6380
+ "diagnose:org:hardis:unsecure-connected-apps",
6381
+ "diagnose:org:unsecure-connected-apps:hardis",
6382
+ "hardis:diagnose:unsecure-connected-apps:org",
6383
+ "diagnose:hardis:unsecure-connected-apps:org",
6384
+ "diagnose:unsecure-connected-apps:hardis:org",
6385
+ "diagnose:unsecure-connected-apps:org:hardis",
6386
+ "hardis:org:unsecure-connected-apps:diagnose",
6387
+ "org:hardis:unsecure-connected-apps:diagnose",
6388
+ "org:unsecure-connected-apps:hardis:diagnose",
6389
+ "org:unsecure-connected-apps:diagnose:hardis",
6390
+ "hardis:unsecure-connected-apps:org:diagnose",
6391
+ "unsecure-connected-apps:hardis:org:diagnose",
6392
+ "unsecure-connected-apps:org:hardis:diagnose",
6393
+ "unsecure-connected-apps:org:diagnose:hardis",
6394
+ "hardis:unsecure-connected-apps:diagnose:org",
6395
+ "unsecure-connected-apps:hardis:diagnose:org",
6396
+ "unsecure-connected-apps:diagnose:hardis:org",
6397
+ "unsecure-connected-apps:diagnose:org:hardis"
6527
6398
  ]
6528
6399
  },
6529
- "hardis:org:purge:apexlog": {
6400
+ "hardis:org:diagnose:unused-apex-classes": {
6530
6401
  "aliases": [],
6531
6402
  "args": {},
6532
- "description": "\n**Purges Apex debug logs from a Salesforce org.**\n\nThis command provides a quick and efficient way to clear out accumulated Apex debug logs from your Salesforce environment. This is particularly useful for:\n\n- **Storage Management:** Freeing up valuable data storage space in your Salesforce org.\n- **Performance Optimization:** Reducing the overhead associated with large volumes of debug logs.\n- **Troubleshooting:** Ensuring that new debug logs are generated cleanly without interference from old, irrelevant logs.\n\nKey functionalities:\n\n- **Log Identification:** Queries the `ApexLog` object to identify all existing debug logs.\n- **Confirmation Prompt:** Before deletion, it prompts for user confirmation, displaying the number of Apex logs that will be deleted.\n- **Bulk Deletion:** Uses the Salesforce Bulk API to efficiently delete a large number of Apex logs.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query:** It executes a SOQL query (`SELECT Id FROM ApexLog LIMIT 50000`) to retrieve the IDs of Apex logs to be deleted. The limit is set to 50,000 to handle large volumes of logs.\n- **CSV Export:** The retrieved log IDs are temporarily exported to a CSV file (`ApexLogsToDelete_*.csv`) in the `./tmp` directory.\n- **User Confirmation:** It uses the `prompts` library to ask for user confirmation before proceeding with the deletion, displaying the count of logs to be purged.\n- **Bulk API Deletion:** It then uses the Salesforce CLI's `sf data delete bulk` command, pointing to the generated CSV file, to perform the mass deletion of Apex logs.\n- **File System Operations:** It uses `fs-extra` to create the temporary directory and manage the CSV file.\n- **Error Handling:** Includes error handling for the query and deletion operations.\n</details>\n",
6403
+ "description": "List all async Apex classes (Batch,Queueable,Schedulable) that has not been called for more than 365 days.\n \nThe result class list probably can be removed from the project, and that will improve your test classes performances 😊\n\nThe number of unused day is overridable using --days option. \n\nThe command uses queries on AsyncApexJob and CronTrigger technical tables to build the result.\n\nApex Classes CreatedBy and CreatedOn fields are calculated from MIN(date from git, date from org)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-apex-classes/) and can output Grafana, Slack and MsTeams Notifications.\n\n![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-monitoring-unused-apex-grafana.jpg)\n",
6533
6404
  "examples": [
6534
- "$ sf hardis:org:purge:apexlog",
6535
- "$ sf hardis:org:purge:apexlog --target-org nicolas.vuillamy@gmail.com"
6405
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6406
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6536
6407
  ],
6537
6408
  "flags": {
6538
6409
  "json": {
@@ -6550,12 +6421,21 @@
6550
6421
  "multiple": false,
6551
6422
  "type": "option"
6552
6423
  },
6553
- "prompt": {
6554
- "char": "z",
6555
- "description": "Prompt for confirmation (true by default, use --no-prompt to skip)",
6556
- "name": "prompt",
6557
- "allowNo": true,
6558
- "type": "boolean"
6424
+ "outputfile": {
6425
+ "char": "f",
6426
+ "description": "Force the path and name of output report file. Must end with .csv",
6427
+ "name": "outputfile",
6428
+ "hasDynamicHelp": false,
6429
+ "multiple": false,
6430
+ "type": "option"
6431
+ },
6432
+ "days": {
6433
+ "char": "t",
6434
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6435
+ "name": "days",
6436
+ "hasDynamicHelp": false,
6437
+ "multiple": false,
6438
+ "type": "option"
6559
6439
  },
6560
6440
  "debug": {
6561
6441
  "char": "d",
@@ -6595,13 +6475,13 @@
6595
6475
  },
6596
6476
  "hasDynamicHelp": true,
6597
6477
  "hiddenAliases": [],
6598
- "id": "hardis:org:purge:apexlog",
6478
+ "id": "hardis:org:diagnose:unused-apex-classes",
6599
6479
  "pluginAlias": "sfdx-hardis",
6600
6480
  "pluginName": "sfdx-hardis",
6601
6481
  "pluginType": "core",
6602
6482
  "strict": true,
6603
6483
  "enableJsonFlag": true,
6604
- "title": "Purge Apex Logs",
6484
+ "title": "Detect unused Apex classes in an org",
6605
6485
  "requiresProject": false,
6606
6486
  "isESM": true,
6607
6487
  "relativePath": [
@@ -6609,45 +6489,43 @@
6609
6489
  "commands",
6610
6490
  "hardis",
6611
6491
  "org",
6612
- "purge",
6613
- "apexlog.js"
6492
+ "diagnose",
6493
+ "unused-apex-classes.js"
6614
6494
  ],
6615
6495
  "aliasPermutations": [],
6616
6496
  "permutations": [
6617
- "hardis:org:purge:apexlog",
6618
- "org:hardis:purge:apexlog",
6619
- "org:purge:hardis:apexlog",
6620
- "org:purge:apexlog:hardis",
6621
- "hardis:purge:org:apexlog",
6622
- "purge:hardis:org:apexlog",
6623
- "purge:org:hardis:apexlog",
6624
- "purge:org:apexlog:hardis",
6625
- "hardis:purge:apexlog:org",
6626
- "purge:hardis:apexlog:org",
6627
- "purge:apexlog:hardis:org",
6628
- "purge:apexlog:org:hardis",
6629
- "hardis:org:apexlog:purge",
6630
- "org:hardis:apexlog:purge",
6631
- "org:apexlog:hardis:purge",
6632
- "org:apexlog:purge:hardis",
6633
- "hardis:apexlog:org:purge",
6634
- "apexlog:hardis:org:purge",
6635
- "apexlog:org:hardis:purge",
6636
- "apexlog:org:purge:hardis",
6637
- "hardis:apexlog:purge:org",
6638
- "apexlog:hardis:purge:org",
6639
- "apexlog:purge:hardis:org",
6640
- "apexlog:purge:org:hardis"
6497
+ "hardis:org:diagnose:unused-apex-classes",
6498
+ "org:hardis:diagnose:unused-apex-classes",
6499
+ "org:diagnose:hardis:unused-apex-classes",
6500
+ "org:diagnose:unused-apex-classes:hardis",
6501
+ "hardis:diagnose:org:unused-apex-classes",
6502
+ "diagnose:hardis:org:unused-apex-classes",
6503
+ "diagnose:org:hardis:unused-apex-classes",
6504
+ "diagnose:org:unused-apex-classes:hardis",
6505
+ "hardis:diagnose:unused-apex-classes:org",
6506
+ "diagnose:hardis:unused-apex-classes:org",
6507
+ "diagnose:unused-apex-classes:hardis:org",
6508
+ "diagnose:unused-apex-classes:org:hardis",
6509
+ "hardis:org:unused-apex-classes:diagnose",
6510
+ "org:hardis:unused-apex-classes:diagnose",
6511
+ "org:unused-apex-classes:hardis:diagnose",
6512
+ "org:unused-apex-classes:diagnose:hardis",
6513
+ "hardis:unused-apex-classes:org:diagnose",
6514
+ "unused-apex-classes:hardis:org:diagnose",
6515
+ "unused-apex-classes:org:hardis:diagnose",
6516
+ "unused-apex-classes:org:diagnose:hardis",
6517
+ "hardis:unused-apex-classes:diagnose:org",
6518
+ "unused-apex-classes:hardis:diagnose:org",
6519
+ "unused-apex-classes:diagnose:hardis:org",
6520
+ "unused-apex-classes:diagnose:org:hardis"
6641
6521
  ]
6642
6522
  },
6643
- "hardis:org:purge:flow": {
6523
+ "hardis:org:diagnose:unused-connected-apps": {
6644
6524
  "aliases": [],
6645
6525
  "args": {},
6646
- "description": "\n**Purges old or unwanted Flow versions from a Salesforce org, with an option to delete related Flow Interviews.**\n\nThis command helps maintain a clean and performant Salesforce org by removing obsolete Flow versions. Over time, multiple versions of Flows can accumulate, consuming storage and potentially impacting performance. This tool provides a controlled way to clean up these versions.\n\nKey functionalities:\n\n- **Targeted Flow Selection:** Allows you to filter Flow versions to delete by name (`--name`) and status (`--status`, e.g., `Obsolete`, `Draft`, `Inactive`).\n- **Flow Interview Deletion:** If a Flow version cannot be deleted due to active Flow Interviews, the `--delete-flow-interviews` flag (or interactive prompt) allows you to delete these interviews first, then retry the Flow version deletion.\n- **Confirmation Prompt:** In interactive mode, it prompts for confirmation before proceeding with the deletion of Flow versions and Flow Interviews.\n- **Partial Success Handling:** The `--allowpurgefailure` flag (default `true`) allows the command to continue even if some deletions fail, reporting the errors.\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 `Flow` object (using the Tooling API) to list Flow versions based on the provided filters (name, status, manageable state).\n- **Bulk Deletion (Tooling API):** It uses `bulkDeleteTooling` to perform mass deletions of Flow versions. If deletion fails due to active interviews, it extracts the interview IDs.\n- **Flow Interview Management:** If `delete-flow-interviews` is enabled, it queries `FlowInterview` objects, performs bulk deletion of the identified interviews using `bulkDelete`, and then retries the Flow version deletion.\n- **Interactive Prompts:** Uses the `prompts` library to interact with the user for selecting Flows, statuses, and confirming deletion actions.\n- **Error Reporting:** Logs detailed error messages for failed deletions, including the specific reasons.\n- **Command-Line Execution:** Uses `execSfdxJson` to execute Salesforce CLI commands for querying Flow data.\n</details>\n",
6526
+ "description": "\n## Command Behavior\n\n**Identifies and reports on potentially unused Connected Apps in a Salesforce org, suggesting candidates for deletion or deactivation.**\n\nThis command helps improve org security and reduce technical debt by pinpointing Connected Apps that are no longer actively used. Connected Apps can pose security risks if left unmonitored, and cleaning them up contributes to a healthier Salesforce environment.\n\nKey functionalities:\n\n- **Connected App Data Collection:** Gathers information about all Connected Apps in the org, including creation and last modified dates, and associated users.\n- **Usage Analysis:** Analyzes `LoginHistory` and `OAuthToken` records to determine the last usage date of each Connected App.\n- **Inactivity Detection:** Flags Connected Apps as potentially unused if they have no recent login history or OAuth token usage.\n- **Accessibility Check:** Examines Connected App metadata to identify if they are accessible (e.g., if they require admin approval and have no profiles or permission sets assigned).\n- **Ignored Apps:** Automatically ignores a predefined list of common Salesforce Connected Apps (e.g., `Salesforce CLI`, `Salesforce Mobile Dashboards`). You can extend this list by defining the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n- **CSV Report Generation:** Generates a CSV file containing details of all analyzed Connected Apps, including their usage status, last usage date, and reasons for being flagged as potentially unused.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of potentially unused Connected Apps.\n\n**Default Ignored Connected Apps:**\n\n- Ant Migration Tool\n- Chatter Desktop\n- Chatter Mobile for BlackBerry\n- Force.com IDE\n- OIQ_Integration\n- Salesforce CLI\n- Salesforce Files\n- Salesforce Mobile Dashboards\n- Salesforce Touch\n- Salesforce for Outlook\n- SalesforceA\n- SalesforceA for Android\n- SalesforceA for iOS\n- SalesforceDX Namespace Registry\n- SalesforceIQ\n\nYou can add more ignored apps by defining a comma-separated list of names in the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n\n_Example: \nALLOWED_INACTIVE_CONNECTED_APPS=My App 1,My App 2, My App 3_\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-connected-apps/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It performs SOQL queries against `ConnectedApplication`, `LoginHistory`, and `OAuthToken` objects to gather comprehensive data about Connected Apps and their usage.\n- **Temporary SFDX Project:** It creates a temporary SFDX project to retrieve Connected App metadata, allowing for local parsing and analysis of their XML files.\n- **Metadata Parsing:** It parses the `connectedApp-meta.xml` files to check for `isAdminApproved` and the presence of `profileName` or `permissionsetName` to determine accessibility.\n- **Data Correlation:** It correlates data from various Salesforce objects to build a complete picture of each Connected App's usage and status.\n- **Date Calculation:** Uses `moment` to calculate the time since the last OAuth token usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused Connected Apps.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **File System Operations:** Uses `fs-extra` for creating and removing temporary directories and files.\n- **Environment Variable Reading:** Reads the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable to customize the list of ignored Connected Apps.\n</details>\n",
6647
6527
  "examples": [
6648
- "$ sf hardis:org:purge:flow",
6649
- "$ sf hardis:org:purge:flow --target-org nicolas.vuillamy@gmail.com --no-prompt --delete-flow-interviews",
6650
- "$ sf hardis:org:purge:flow --target-org nicolas.vuillamy@gmail.com --status \"Obsolete,Draft,InvalidDraft\" --name TestFlow"
6528
+ "$ sf hardis:org:diagnose:unused-connected-apps"
6651
6529
  ],
6652
6530
  "flags": {
6653
6531
  "json": {
@@ -6665,48 +6543,10 @@
6665
6543
  "multiple": false,
6666
6544
  "type": "option"
6667
6545
  },
6668
- "prompt": {
6669
- "char": "z",
6670
- "description": "Prompt for confirmation (true by default, use --no-prompt to skip)",
6671
- "name": "prompt",
6672
- "allowNo": true,
6673
- "type": "boolean"
6674
- },
6675
- "name": {
6676
- "char": "n",
6677
- "description": "Filter according to Name criteria",
6678
- "name": "name",
6679
- "hasDynamicHelp": false,
6680
- "multiple": false,
6681
- "type": "option"
6682
- },
6683
- "status": {
6684
- "char": "s",
6685
- "description": "Filter according to Status criteria",
6686
- "name": "status",
6687
- "hasDynamicHelp": false,
6688
- "multiple": false,
6689
- "type": "option"
6690
- },
6691
- "delete-flow-interviews": {
6692
- "char": "w",
6693
- "description": "If the presence of Flow interviews prevent to delete flows versions, delete them before retrying to delete flow versions",
6694
- "name": "delete-flow-interviews",
6695
- "allowNo": false,
6696
- "type": "boolean"
6697
- },
6698
- "allowpurgefailure": {
6546
+ "outputfile": {
6699
6547
  "char": "f",
6700
- "description": "Allows purges to fail without exiting with 1. Use --no-allowpurgefailure to disable",
6701
- "name": "allowpurgefailure",
6702
- "allowNo": true,
6703
- "type": "boolean"
6704
- },
6705
- "instanceurl": {
6706
- "char": "r",
6707
- "description": "URL of org instance",
6708
- "name": "instanceurl",
6709
- "default": "https://login.salesforce.com",
6548
+ "description": "Force the path and name of output report file. Must end with .csv",
6549
+ "name": "outputfile",
6710
6550
  "hasDynamicHelp": false,
6711
6551
  "multiple": false,
6712
6552
  "type": "option"
@@ -6749,13 +6589,30 @@
6749
6589
  },
6750
6590
  "hasDynamicHelp": true,
6751
6591
  "hiddenAliases": [],
6752
- "id": "hardis:org:purge:flow",
6592
+ "id": "hardis:org:diagnose:unused-connected-apps",
6753
6593
  "pluginAlias": "sfdx-hardis",
6754
6594
  "pluginName": "sfdx-hardis",
6755
6595
  "pluginType": "core",
6756
6596
  "strict": true,
6757
6597
  "enableJsonFlag": true,
6758
- "title": "Purge Flow versions",
6598
+ "title": "Unused Connected Apps in an org",
6599
+ "allowedInactiveConnectedApps": [
6600
+ "Ant Migration Tool",
6601
+ "Chatter Desktop",
6602
+ "Chatter Mobile for BlackBerry",
6603
+ "Force.com IDE",
6604
+ "OIQ_Integration",
6605
+ "Salesforce CLI",
6606
+ "Salesforce Files",
6607
+ "Salesforce Mobile Dashboards",
6608
+ "Salesforce Touch",
6609
+ "Salesforce for Outlook",
6610
+ "SalesforceA",
6611
+ "SalesforceA for Android",
6612
+ "SalesforceA for iOS",
6613
+ "SalesforceDX Namespace Registry",
6614
+ "SalesforceIQ"
6615
+ ],
6759
6616
  "requiresProject": false,
6760
6617
  "isESM": true,
6761
6618
  "relativePath": [
@@ -6763,46 +6620,44 @@
6763
6620
  "commands",
6764
6621
  "hardis",
6765
6622
  "org",
6766
- "purge",
6767
- "flow.js"
6623
+ "diagnose",
6624
+ "unused-connected-apps.js"
6768
6625
  ],
6769
6626
  "aliasPermutations": [],
6770
6627
  "permutations": [
6771
- "hardis:org:purge:flow",
6772
- "org:hardis:purge:flow",
6773
- "org:purge:hardis:flow",
6774
- "org:purge:flow:hardis",
6775
- "hardis:purge:org:flow",
6776
- "purge:hardis:org:flow",
6777
- "purge:org:hardis:flow",
6778
- "purge:org:flow:hardis",
6779
- "hardis:purge:flow:org",
6780
- "purge:hardis:flow:org",
6781
- "purge:flow:hardis:org",
6782
- "purge:flow:org:hardis",
6783
- "hardis:org:flow:purge",
6784
- "org:hardis:flow:purge",
6785
- "org:flow:hardis:purge",
6786
- "org:flow:purge:hardis",
6787
- "hardis:flow:org:purge",
6788
- "flow:hardis:org:purge",
6789
- "flow:org:hardis:purge",
6790
- "flow:org:purge:hardis",
6791
- "hardis:flow:purge:org",
6792
- "flow:hardis:purge:org",
6793
- "flow:purge:hardis:org",
6794
- "flow:purge:org:hardis"
6628
+ "hardis:org:diagnose:unused-connected-apps",
6629
+ "org:hardis:diagnose:unused-connected-apps",
6630
+ "org:diagnose:hardis:unused-connected-apps",
6631
+ "org:diagnose:unused-connected-apps:hardis",
6632
+ "hardis:diagnose:org:unused-connected-apps",
6633
+ "diagnose:hardis:org:unused-connected-apps",
6634
+ "diagnose:org:hardis:unused-connected-apps",
6635
+ "diagnose:org:unused-connected-apps:hardis",
6636
+ "hardis:diagnose:unused-connected-apps:org",
6637
+ "diagnose:hardis:unused-connected-apps:org",
6638
+ "diagnose:unused-connected-apps:hardis:org",
6639
+ "diagnose:unused-connected-apps:org:hardis",
6640
+ "hardis:org:unused-connected-apps:diagnose",
6641
+ "org:hardis:unused-connected-apps:diagnose",
6642
+ "org:unused-connected-apps:hardis:diagnose",
6643
+ "org:unused-connected-apps:diagnose:hardis",
6644
+ "hardis:unused-connected-apps:org:diagnose",
6645
+ "unused-connected-apps:hardis:org:diagnose",
6646
+ "unused-connected-apps:org:hardis:diagnose",
6647
+ "unused-connected-apps:org:diagnose:hardis",
6648
+ "hardis:unused-connected-apps:diagnose:org",
6649
+ "unused-connected-apps:hardis:diagnose:org",
6650
+ "unused-connected-apps:diagnose:hardis:org",
6651
+ "unused-connected-apps:diagnose:org:hardis"
6795
6652
  ]
6796
6653
  },
6797
- "hardis:org:diagnose:audittrail": {
6654
+ "hardis:org:diagnose:unusedlicenses": {
6798
6655
  "aliases": [],
6799
6656
  "args": {},
6800
- "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",
6657
+ "description": "\n## Command Behavior\n\n**Detects and suggests the deletion of unused Permission Set License Assignments in a Salesforce org.**\n\nWhen a Permission Set (PS) linked to a Permission Set License (PSL) is assigned to a user, a Permission Set License Assignment (PSLA) is automatically created. However, when that PS is unassigned from the user, the PSLA is *not* automatically deleted. This can lead to organizations being charged for unused PSLAs, representing a hidden cost and technical debt.\n\nThis command identifies such useless PSLAs and provides options to delete them, helping to optimize license usage and reduce unnecessary expenses.\n\nKey functionalities:\n\n- **PSLA Detection:** Queries the Salesforce org to find all active PSLAs.\n- **Usage Verification:** Correlates PSLAs with actual Permission Set Assignments and Permission Set Group Assignments to determine if the underlying Permission Sets are still assigned to the user.\n- **Special Case Handling:** Accounts for specific scenarios where profiles might implicitly assign PSLAs (e.g., `Salesforce API Only` profile assigning `SalesforceAPIIntegrationPsl`) and allows for always excluding certain PSLAs from the unused check.\n- **Reporting:** Generates a CSV report of all identified unused PSLAs, including the user and the associated Permission Set License.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of unused PSLAs.\n- **Interactive Deletion:** In non-CI environments, it offers an interactive prompt to bulk delete the identified unused PSLAs.\n\nMany thanks to [Vincent Finet](https://www.linkedin.com/in/vincentfinet/) for the inspiration during his great speaker session at [French Touch Dreamin '23](https://frenchtouchdreamin.com/), and his kind agreement for reusing such inspiration in this command 😊\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-licenses/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves extensive querying of Salesforce objects and data correlation:\n\n- **SOQL Queries (Bulk API):** It uses `bulkQuery` and `bulkQueryChunksIn` to efficiently retrieve large volumes of data from `PermissionSetLicenseAssign`, `PermissionSetLicense`, `PermissionSet`, `PermissionSetGroupComponent`, and `PermissionSetAssignment` objects.\n- **Data Correlation:** It meticulously correlates data across these objects to determine if a `PermissionSetLicenseAssign` record has a corresponding active assignment to a Permission Set or Permission Set Group for the same user.\n- **Filtering Logic:** It applies complex filtering logic to exclude PSLAs that are genuinely in use or are part of predefined exceptions (e.g., `alwaysExcludeForActiveUsersPermissionSetLicenses`).\n- **Bulk Deletion:** If the user opts to delete unused PSLAs, it uses `bulkUpdate` with the `delete` operation to efficiently remove multiple records.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused PSLAs.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Interaction:** Uses `prompts` for interactive confirmation before performing deletion operations.\n</details>\n",
6801
6658
  "examples": [
6802
- "$ sf hardis:org:diagnose:audittrail",
6803
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
6804
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
6805
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
6659
+ "$ sf hardis:org:diagnose:unusedlicenses",
6660
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
6806
6661
  ],
6807
6662
  "flags": {
6808
6663
  "json": {
@@ -6820,22 +6675,6 @@
6820
6675
  "multiple": false,
6821
6676
  "type": "option"
6822
6677
  },
6823
- "excludeusers": {
6824
- "char": "e",
6825
- "description": "Comma-separated list of usernames to exclude",
6826
- "name": "excludeusers",
6827
- "hasDynamicHelp": false,
6828
- "multiple": false,
6829
- "type": "option"
6830
- },
6831
- "lastndays": {
6832
- "char": "t",
6833
- "description": "Number of days to extract from today (included)",
6834
- "name": "lastndays",
6835
- "hasDynamicHelp": false,
6836
- "multiple": false,
6837
- "type": "option"
6838
- },
6839
6678
  "outputfile": {
6840
6679
  "char": "f",
6841
6680
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6882,14 +6721,32 @@
6882
6721
  },
6883
6722
  "hasDynamicHelp": true,
6884
6723
  "hiddenAliases": [],
6885
- "id": "hardis:org:diagnose:audittrail",
6724
+ "id": "hardis:org:diagnose:unusedlicenses",
6886
6725
  "pluginAlias": "sfdx-hardis",
6887
6726
  "pluginName": "sfdx-hardis",
6888
6727
  "pluginType": "core",
6889
6728
  "strict": true,
6890
6729
  "enableJsonFlag": true,
6891
- "title": "Diagnose content of Setup Audit Trail",
6730
+ "title": "Detect unused Permission Set Licenses (beta)",
6892
6731
  "requiresProject": false,
6732
+ "additionalPermissionSetsToAlwaysGet": [
6733
+ "Sales_User"
6734
+ ],
6735
+ "permSetsPermSetLicenses": [
6736
+ {
6737
+ "permSet": "Sales_User",
6738
+ "permSetLicense": "SalesUserPsl"
6739
+ }
6740
+ ],
6741
+ "profilesPermissionSetLicenses": [
6742
+ {
6743
+ "profile": "Salesforce API Only",
6744
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
6745
+ }
6746
+ ],
6747
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6748
+ "IdentityConnect"
6749
+ ],
6893
6750
  "isESM": true,
6894
6751
  "relativePath": [
6895
6752
  "lib",
@@ -6897,42 +6754,46 @@
6897
6754
  "hardis",
6898
6755
  "org",
6899
6756
  "diagnose",
6900
- "audittrail.js"
6757
+ "unusedlicenses.js"
6901
6758
  ],
6902
6759
  "aliasPermutations": [],
6903
6760
  "permutations": [
6904
- "hardis:org:diagnose:audittrail",
6905
- "org:hardis:diagnose:audittrail",
6906
- "org:diagnose:hardis:audittrail",
6907
- "org:diagnose:audittrail:hardis",
6908
- "hardis:diagnose:org:audittrail",
6909
- "diagnose:hardis:org:audittrail",
6910
- "diagnose:org:hardis:audittrail",
6911
- "diagnose:org:audittrail:hardis",
6912
- "hardis:diagnose:audittrail:org",
6913
- "diagnose:hardis:audittrail:org",
6914
- "diagnose:audittrail:hardis:org",
6915
- "diagnose:audittrail:org:hardis",
6916
- "hardis:org:audittrail:diagnose",
6917
- "org:hardis:audittrail:diagnose",
6918
- "org:audittrail:hardis:diagnose",
6919
- "org:audittrail:diagnose:hardis",
6920
- "hardis:audittrail:org:diagnose",
6921
- "audittrail:hardis:org:diagnose",
6922
- "audittrail:org:hardis:diagnose",
6923
- "audittrail:org:diagnose:hardis",
6924
- "hardis:audittrail:diagnose:org",
6925
- "audittrail:hardis:diagnose:org",
6926
- "audittrail:diagnose:hardis:org",
6927
- "audittrail:diagnose:org:hardis"
6761
+ "hardis:org:diagnose:unusedlicenses",
6762
+ "org:hardis:diagnose:unusedlicenses",
6763
+ "org:diagnose:hardis:unusedlicenses",
6764
+ "org:diagnose:unusedlicenses:hardis",
6765
+ "hardis:diagnose:org:unusedlicenses",
6766
+ "diagnose:hardis:org:unusedlicenses",
6767
+ "diagnose:org:hardis:unusedlicenses",
6768
+ "diagnose:org:unusedlicenses:hardis",
6769
+ "hardis:diagnose:unusedlicenses:org",
6770
+ "diagnose:hardis:unusedlicenses:org",
6771
+ "diagnose:unusedlicenses:hardis:org",
6772
+ "diagnose:unusedlicenses:org:hardis",
6773
+ "hardis:org:unusedlicenses:diagnose",
6774
+ "org:hardis:unusedlicenses:diagnose",
6775
+ "org:unusedlicenses:hardis:diagnose",
6776
+ "org:unusedlicenses:diagnose:hardis",
6777
+ "hardis:unusedlicenses:org:diagnose",
6778
+ "unusedlicenses:hardis:org:diagnose",
6779
+ "unusedlicenses:org:hardis:diagnose",
6780
+ "unusedlicenses:org:diagnose:hardis",
6781
+ "hardis:unusedlicenses:diagnose:org",
6782
+ "unusedlicenses:hardis:diagnose:org",
6783
+ "unusedlicenses:diagnose:hardis:org",
6784
+ "unusedlicenses:diagnose:org:hardis"
6928
6785
  ]
6929
6786
  },
6930
- "hardis:org:diagnose:instanceupgrade": {
6787
+ "hardis:org:diagnose:unusedusers": {
6931
6788
  "aliases": [],
6932
6789
  "args": {},
6933
- "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",
6790
+ "description": "\n## Command Behavior\n\n**Detects and reports on inactive or unused Salesforce user accounts, helping to optimize license usage and enhance security.**\n\nEfficient user management is vital in Salesforce to ensure resources are optimized and costs are controlled. However, inactive or unused user accounts can often go unnoticed, leading to wasted licenses and potential security risks. This tool addresses this challenge by enabling administrators to identify users who haven't logged in within a specified period.\n\nBy analyzing user login activity and last login timestamps, this feature highlights inactive user accounts, allowing administrators to take appropriate action. Whether it's deactivating dormant accounts, freeing up licenses, or ensuring compliance with security policies, this functionality empowers administrators to maintain a lean and secure Salesforce environment.\n\nKey functionalities:\n\n- **Inactivity Detection:** Identifies users who have not logged in for a specified number of days (`--days` flag, default 180 days in CI, 365 days otherwise).\n- **License Type Filtering:** Allows filtering users by license type using `--licensetypes` (e.g., `all-crm`, `all-paying`) or specific license identifiers using `--licenseidentifiers`.\n - `all-crm`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT` licenses.\n - `all-paying`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT`, `PID_Customer_Community`, `PID_Customer_Community_Login`, `PID_Partner_Community`, `PID_Partner_Community_Login` licenses.\n - Note: You can see the full list of available license identifiers in [Salesforce Documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/sfdx_cli_reference/sforce_api_objects_userlicense.htm).\n- **Active User Retrieval:** The `--returnactiveusers` flag inverts the command, allowing you to retrieve active users who *have* logged in during the specified period.\n- **CSV Report Generation:** Generates a CSV file containing details of all identified users (inactive or active), including their last login date, profile, and license information.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of inactive or active users.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-inactive-users/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query (Bulk API):** It uses `bulkQuery` to efficiently retrieve user records from the Salesforce `User` object. The SOQL query dynamically constructs its WHERE clause based on the `--days`, `--licensetypes`, `--licenseidentifiers`, and `--returnactiveusers` flags.\n- **Interactive Prompts:** Uses `prompts` to interactively ask the user for the number of inactive days and license types if not provided via flags.\n- **License Mapping:** Internally maps common license type aliases (e.g., `all-crm`) to their corresponding Salesforce `LicenseDefinitionKey` values.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of users.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides a summary of the findings in the console, indicating the number of inactive or active users found.\n</details>",
6934
6791
  "examples": [
6935
- "$ sf hardis:org:diagnose:instanceupgrade"
6792
+ "$ sf hardis:org:diagnose:unusedusers",
6793
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
6794
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6795
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6796
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6936
6797
  ],
6937
6798
  "flags": {
6938
6799
  "json": {
@@ -6950,6 +6811,49 @@
6950
6811
  "multiple": false,
6951
6812
  "type": "option"
6952
6813
  },
6814
+ "outputfile": {
6815
+ "char": "f",
6816
+ "description": "Force the path and name of output report file. Must end with .csv",
6817
+ "name": "outputfile",
6818
+ "hasDynamicHelp": false,
6819
+ "multiple": false,
6820
+ "type": "option"
6821
+ },
6822
+ "days": {
6823
+ "char": "t",
6824
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6825
+ "name": "days",
6826
+ "hasDynamicHelp": false,
6827
+ "multiple": false,
6828
+ "type": "option"
6829
+ },
6830
+ "licensetypes": {
6831
+ "char": "l",
6832
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6833
+ "name": "licensetypes",
6834
+ "hasDynamicHelp": false,
6835
+ "multiple": false,
6836
+ "options": [
6837
+ "all",
6838
+ "all-crm",
6839
+ "all-paying"
6840
+ ],
6841
+ "type": "option"
6842
+ },
6843
+ "licenseidentifiers": {
6844
+ "char": "i",
6845
+ "description": "Comma-separated list of license identifiers, in case licensetypes is not used.. Identifiers available at https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_userlicense.htm",
6846
+ "name": "licenseidentifiers",
6847
+ "hasDynamicHelp": false,
6848
+ "multiple": false,
6849
+ "type": "option"
6850
+ },
6851
+ "returnactiveusers": {
6852
+ "description": "Inverts the command by returning the active users",
6853
+ "name": "returnactiveusers",
6854
+ "allowNo": false,
6855
+ "type": "boolean"
6856
+ },
6953
6857
  "debug": {
6954
6858
  "char": "d",
6955
6859
  "description": "Activate debug mode (more logs)",
@@ -6988,13 +6892,13 @@
6988
6892
  },
6989
6893
  "hasDynamicHelp": true,
6990
6894
  "hiddenAliases": [],
6991
- "id": "hardis:org:diagnose:instanceupgrade",
6895
+ "id": "hardis:org:diagnose:unusedusers",
6992
6896
  "pluginAlias": "sfdx-hardis",
6993
6897
  "pluginName": "sfdx-hardis",
6994
6898
  "pluginType": "core",
6995
6899
  "strict": true,
6996
6900
  "enableJsonFlag": true,
6997
- "title": "Get Instance Upgrade date",
6901
+ "title": "Detect unused Users in Salesforce",
6998
6902
  "requiresProject": false,
6999
6903
  "isESM": true,
7000
6904
  "relativePath": [
@@ -7003,45 +6907,42 @@
7003
6907
  "hardis",
7004
6908
  "org",
7005
6909
  "diagnose",
7006
- "instanceupgrade.js"
6910
+ "unusedusers.js"
7007
6911
  ],
7008
6912
  "aliasPermutations": [],
7009
6913
  "permutations": [
7010
- "hardis:org:diagnose:instanceupgrade",
7011
- "org:hardis:diagnose:instanceupgrade",
7012
- "org:diagnose:hardis:instanceupgrade",
7013
- "org:diagnose:instanceupgrade:hardis",
7014
- "hardis:diagnose:org:instanceupgrade",
7015
- "diagnose:hardis:org:instanceupgrade",
7016
- "diagnose:org:hardis:instanceupgrade",
7017
- "diagnose:org:instanceupgrade:hardis",
7018
- "hardis:diagnose:instanceupgrade:org",
7019
- "diagnose:hardis:instanceupgrade:org",
7020
- "diagnose:instanceupgrade:hardis:org",
7021
- "diagnose:instanceupgrade:org:hardis",
7022
- "hardis:org:instanceupgrade:diagnose",
7023
- "org:hardis:instanceupgrade:diagnose",
7024
- "org:instanceupgrade:hardis:diagnose",
7025
- "org:instanceupgrade:diagnose:hardis",
7026
- "hardis:instanceupgrade:org:diagnose",
7027
- "instanceupgrade:hardis:org:diagnose",
7028
- "instanceupgrade:org:hardis:diagnose",
7029
- "instanceupgrade:org:diagnose:hardis",
7030
- "hardis:instanceupgrade:diagnose:org",
7031
- "instanceupgrade:hardis:diagnose:org",
7032
- "instanceupgrade:diagnose:hardis:org",
7033
- "instanceupgrade:diagnose:org:hardis"
6914
+ "hardis:org:diagnose:unusedusers",
6915
+ "org:hardis:diagnose:unusedusers",
6916
+ "org:diagnose:hardis:unusedusers",
6917
+ "org:diagnose:unusedusers:hardis",
6918
+ "hardis:diagnose:org:unusedusers",
6919
+ "diagnose:hardis:org:unusedusers",
6920
+ "diagnose:org:hardis:unusedusers",
6921
+ "diagnose:org:unusedusers:hardis",
6922
+ "hardis:diagnose:unusedusers:org",
6923
+ "diagnose:hardis:unusedusers:org",
6924
+ "diagnose:unusedusers:hardis:org",
6925
+ "diagnose:unusedusers:org:hardis",
6926
+ "hardis:org:unusedusers:diagnose",
6927
+ "org:hardis:unusedusers:diagnose",
6928
+ "org:unusedusers:hardis:diagnose",
6929
+ "org:unusedusers:diagnose:hardis",
6930
+ "hardis:unusedusers:org:diagnose",
6931
+ "unusedusers:hardis:org:diagnose",
6932
+ "unusedusers:org:hardis:diagnose",
6933
+ "unusedusers:org:diagnose:hardis",
6934
+ "hardis:unusedusers:diagnose:org",
6935
+ "unusedusers:hardis:diagnose:org",
6936
+ "unusedusers:diagnose:hardis:org",
6937
+ "unusedusers:diagnose:org:hardis"
7034
6938
  ]
7035
6939
  },
7036
- "hardis:org:diagnose:legacyapi": {
6940
+ "hardis:org:files:export": {
7037
6941
  "aliases": [],
7038
6942
  "args": {},
7039
- "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",
6943
+ "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
7040
6944
  "examples": [
7041
- "$ sf hardis:org:diagnose:legacyapi",
7042
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
7043
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
7044
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6945
+ "$ sf hardis:org:files:export"
7045
6946
  ],
7046
6947
  "flags": {
7047
6948
  "json": {
@@ -7059,32 +6960,48 @@
7059
6960
  "multiple": false,
7060
6961
  "type": "option"
7061
6962
  },
7062
- "eventtype": {
7063
- "char": "e",
7064
- "description": "Type of EventLogFile event to analyze",
7065
- "name": "eventtype",
7066
- "default": "ApiTotalUsage",
6963
+ "path": {
6964
+ "char": "p",
6965
+ "description": "Path to the file export project",
6966
+ "name": "path",
7067
6967
  "hasDynamicHelp": false,
7068
6968
  "multiple": false,
7069
6969
  "type": "option"
7070
6970
  },
7071
- "limit": {
7072
- "char": "l",
7073
- "description": "Number of latest EventLogFile events to analyze",
7074
- "name": "limit",
7075
- "default": 999,
6971
+ "chunksize": {
6972
+ "char": "c",
6973
+ "description": "Number of records to add in a chunk before it is processed",
6974
+ "name": "chunksize",
6975
+ "default": 1000,
7076
6976
  "hasDynamicHelp": false,
7077
6977
  "multiple": false,
7078
6978
  "type": "option"
7079
6979
  },
7080
- "outputfile": {
7081
- "char": "f",
7082
- "description": "Force the path and name of output report file. Must end with .csv",
7083
- "name": "outputfile",
6980
+ "polltimeout": {
6981
+ "char": "t",
6982
+ "description": "Timeout in MS for Bulk API calls",
6983
+ "name": "polltimeout",
6984
+ "default": 300000,
6985
+ "hasDynamicHelp": false,
6986
+ "multiple": false,
6987
+ "type": "option"
6988
+ },
6989
+ "startchunknumber": {
6990
+ "char": "s",
6991
+ "description": "Chunk number to start from",
6992
+ "name": "startchunknumber",
6993
+ "default": 0,
7084
6994
  "hasDynamicHelp": false,
7085
6995
  "multiple": false,
7086
6996
  "type": "option"
7087
6997
  },
6998
+ "resume": {
6999
+ "char": "r",
7000
+ "description": "Resume previous export by checking existing files (default in CI)",
7001
+ "name": "resume",
7002
+ "allowNo": false,
7003
+ "type": "boolean"
7004
+ },
7088
7005
  "debug": {
7089
7006
  "char": "d",
7090
7007
  "description": "Activate debug mode (more logs)",
@@ -7123,13 +7040,13 @@
7123
7040
  },
7124
7041
  "hasDynamicHelp": true,
7125
7042
  "hiddenAliases": [],
7126
- "id": "hardis:org:diagnose:legacyapi",
7043
+ "id": "hardis:org:files:export",
7127
7044
  "pluginAlias": "sfdx-hardis",
7128
7045
  "pluginName": "sfdx-hardis",
7129
7046
  "pluginType": "core",
7130
7047
  "strict": true,
7131
7048
  "enableJsonFlag": true,
7132
- "title": "Check for legacy API use",
7049
+ "title": "Export files",
7133
7050
  "requiresProject": false,
7134
7051
  "isESM": true,
7135
7052
  "relativePath": [
@@ -7137,43 +7054,43 @@
7137
7054
  "commands",
7138
7055
  "hardis",
7139
7056
  "org",
7140
- "diagnose",
7141
- "legacyapi.js"
7057
+ "files",
7058
+ "export.js"
7142
7059
  ],
7143
7060
  "aliasPermutations": [],
7144
7061
  "permutations": [
7145
- "hardis:org:diagnose:legacyapi",
7146
- "org:hardis:diagnose:legacyapi",
7147
- "org:diagnose:hardis:legacyapi",
7148
- "org:diagnose:legacyapi:hardis",
7149
- "hardis:diagnose:org:legacyapi",
7150
- "diagnose:hardis:org:legacyapi",
7151
- "diagnose:org:hardis:legacyapi",
7152
- "diagnose:org:legacyapi:hardis",
7153
- "hardis:diagnose:legacyapi:org",
7154
- "diagnose:hardis:legacyapi:org",
7155
- "diagnose:legacyapi:hardis:org",
7156
- "diagnose:legacyapi:org:hardis",
7157
- "hardis:org:legacyapi:diagnose",
7158
- "org:hardis:legacyapi:diagnose",
7159
- "org:legacyapi:hardis:diagnose",
7160
- "org:legacyapi:diagnose:hardis",
7161
- "hardis:legacyapi:org:diagnose",
7162
- "legacyapi:hardis:org:diagnose",
7163
- "legacyapi:org:hardis:diagnose",
7164
- "legacyapi:org:diagnose:hardis",
7165
- "hardis:legacyapi:diagnose:org",
7166
- "legacyapi:hardis:diagnose:org",
7167
- "legacyapi:diagnose:hardis:org",
7168
- "legacyapi:diagnose:org:hardis"
7062
+ "hardis:org:files:export",
7063
+ "org:hardis:files:export",
7064
+ "org:files:hardis:export",
7065
+ "org:files:export:hardis",
7066
+ "hardis:files:org:export",
7067
+ "files:hardis:org:export",
7068
+ "files:org:hardis:export",
7069
+ "files:org:export:hardis",
7070
+ "hardis:files:export:org",
7071
+ "files:hardis:export:org",
7072
+ "files:export:hardis:org",
7073
+ "files:export:org:hardis",
7074
+ "hardis:org:export:files",
7075
+ "org:hardis:export:files",
7076
+ "org:export:hardis:files",
7077
+ "org:export:files:hardis",
7078
+ "hardis:export:org:files",
7079
+ "export:hardis:org:files",
7080
+ "export:org:hardis:files",
7081
+ "export:org:files:hardis",
7082
+ "hardis:export:files:org",
7083
+ "export:hardis:files:org",
7084
+ "export:files:hardis:org",
7085
+ "export:files:org:hardis"
7169
7086
  ]
7170
7087
  },
7171
- "hardis:org:diagnose:licenses": {
7088
+ "hardis:org:files:import": {
7172
7089
  "aliases": [],
7173
7090
  "args": {},
7174
- "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",
7091
+ "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
7175
7092
  "examples": [
7176
- "$ sf hardis:org:diagnose:licenses"
7093
+ "$ sf hardis:org:files:import"
7177
7094
  ],
7178
7095
  "flags": {
7179
7096
  "json": {
@@ -7191,18 +7108,18 @@
7191
7108
  "multiple": false,
7192
7109
  "type": "option"
7193
7110
  },
7194
- "outputfile": {
7195
- "char": "f",
7196
- "description": "Force the path and name of output report file. Must end with .csv",
7197
- "name": "outputfile",
7111
+ "path": {
7112
+ "char": "p",
7113
+ "description": "Path to the file export project",
7114
+ "name": "path",
7198
7115
  "hasDynamicHelp": false,
7199
7116
  "multiple": false,
7200
7117
  "type": "option"
7201
7118
  },
7202
- "usedonly": {
7203
- "char": "u",
7204
- "description": "Filter to have only used licenses",
7205
- "name": "usedonly",
7119
+ "overwrite": {
7120
+ "char": "f",
7121
+ "description": "Override existing files (doubles the number of API calls)",
7122
+ "name": "overwrite",
7206
7123
  "allowNo": false,
7207
7124
  "type": "boolean"
7208
7125
  },
@@ -7244,13 +7161,13 @@
7244
7161
  },
7245
7162
  "hasDynamicHelp": true,
7246
7163
  "hiddenAliases": [],
7247
- "id": "hardis:org:diagnose:licenses",
7164
+ "id": "hardis:org:files:import",
7248
7165
  "pluginAlias": "sfdx-hardis",
7249
7166
  "pluginName": "sfdx-hardis",
7250
7167
  "pluginType": "core",
7251
7168
  "strict": true,
7252
7169
  "enableJsonFlag": true,
7253
- "title": "List licenses subscribed and used in a Salesforce org",
7170
+ "title": "Import files",
7254
7171
  "requiresProject": false,
7255
7172
  "isESM": true,
7256
7173
  "relativePath": [
@@ -7258,43 +7175,44 @@
7258
7175
  "commands",
7259
7176
  "hardis",
7260
7177
  "org",
7261
- "diagnose",
7262
- "licenses.js"
7178
+ "files",
7179
+ "import.js"
7263
7180
  ],
7264
7181
  "aliasPermutations": [],
7265
7182
  "permutations": [
7266
- "hardis:org:diagnose:licenses",
7267
- "org:hardis:diagnose:licenses",
7268
- "org:diagnose:hardis:licenses",
7269
- "org:diagnose:licenses:hardis",
7270
- "hardis:diagnose:org:licenses",
7271
- "diagnose:hardis:org:licenses",
7272
- "diagnose:org:hardis:licenses",
7273
- "diagnose:org:licenses:hardis",
7274
- "hardis:diagnose:licenses:org",
7275
- "diagnose:hardis:licenses:org",
7276
- "diagnose:licenses:hardis:org",
7277
- "diagnose:licenses:org:hardis",
7278
- "hardis:org:licenses:diagnose",
7279
- "org:hardis:licenses:diagnose",
7280
- "org:licenses:hardis:diagnose",
7281
- "org:licenses:diagnose:hardis",
7282
- "hardis:licenses:org:diagnose",
7283
- "licenses:hardis:org:diagnose",
7284
- "licenses:org:hardis:diagnose",
7285
- "licenses:org:diagnose:hardis",
7286
- "hardis:licenses:diagnose:org",
7287
- "licenses:hardis:diagnose:org",
7288
- "licenses:diagnose:hardis:org",
7289
- "licenses:diagnose:org:hardis"
7183
+ "hardis:org:files:import",
7184
+ "org:hardis:files:import",
7185
+ "org:files:hardis:import",
7186
+ "org:files:import:hardis",
7187
+ "hardis:files:org:import",
7188
+ "files:hardis:org:import",
7189
+ "files:org:hardis:import",
7190
+ "files:org:import:hardis",
7191
+ "hardis:files:import:org",
7192
+ "files:hardis:import:org",
7193
+ "files:import:hardis:org",
7194
+ "files:import:org:hardis",
7195
+ "hardis:org:import:files",
7196
+ "org:hardis:import:files",
7197
+ "org:import:hardis:files",
7198
+ "org:import:files:hardis",
7199
+ "hardis:import:org:files",
7200
+ "import:hardis:org:files",
7201
+ "import:org:hardis:files",
7202
+ "import:org:files:hardis",
7203
+ "hardis:import:files:org",
7204
+ "import:hardis:files:org",
7205
+ "import:files:hardis:org",
7206
+ "import:files:org:hardis"
7290
7207
  ]
7291
7208
  },
7292
- "hardis:org:diagnose:releaseupdates": {
7209
+ "hardis:org:fix:listviewmine": {
7293
7210
  "aliases": [],
7294
7211
  "args": {},
7295
- "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",
7212
+ "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
7296
7213
  "examples": [
7297
- "$ sf hardis:org:diagnose:releaseupdates"
7214
+ "$ sf hardis:org:fix:listviewmine",
7215
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
7298
7216
  ],
7299
7217
  "flags": {
7300
7218
  "json": {
@@ -7312,10 +7230,10 @@
7312
7230
  "multiple": false,
7313
7231
  "type": "option"
7314
7232
  },
7315
- "outputfile": {
7316
- "char": "f",
7317
- "description": "Force the path and name of output report file. Must end with .csv",
7318
- "name": "outputfile",
7233
+ "listviews": {
7234
+ "char": "l",
7235
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
7236
+ "name": "listviews",
7319
7237
  "hasDynamicHelp": false,
7320
7238
  "multiple": false,
7321
7239
  "type": "option"
@@ -7358,57 +7276,59 @@
7358
7276
  },
7359
7277
  "hasDynamicHelp": true,
7360
7278
  "hiddenAliases": [],
7361
- "id": "hardis:org:diagnose:releaseupdates",
7279
+ "id": "hardis:org:fix:listviewmine",
7362
7280
  "pluginAlias": "sfdx-hardis",
7363
7281
  "pluginName": "sfdx-hardis",
7364
7282
  "pluginType": "core",
7365
7283
  "strict": true,
7366
7284
  "enableJsonFlag": true,
7367
- "title": "Check Release Updates of an org",
7368
- "requiresProject": false,
7285
+ "title": "Fix listviews with ",
7286
+ "requiresProject": true,
7369
7287
  "isESM": true,
7370
7288
  "relativePath": [
7371
7289
  "lib",
7372
7290
  "commands",
7373
7291
  "hardis",
7374
7292
  "org",
7375
- "diagnose",
7376
- "releaseupdates.js"
7293
+ "fix",
7294
+ "listviewmine.js"
7377
7295
  ],
7378
7296
  "aliasPermutations": [],
7379
7297
  "permutations": [
7380
- "hardis:org:diagnose:releaseupdates",
7381
- "org:hardis:diagnose:releaseupdates",
7382
- "org:diagnose:hardis:releaseupdates",
7383
- "org:diagnose:releaseupdates:hardis",
7384
- "hardis:diagnose:org:releaseupdates",
7385
- "diagnose:hardis:org:releaseupdates",
7386
- "diagnose:org:hardis:releaseupdates",
7387
- "diagnose:org:releaseupdates:hardis",
7388
- "hardis:diagnose:releaseupdates:org",
7389
- "diagnose:hardis:releaseupdates:org",
7390
- "diagnose:releaseupdates:hardis:org",
7391
- "diagnose:releaseupdates:org:hardis",
7392
- "hardis:org:releaseupdates:diagnose",
7393
- "org:hardis:releaseupdates:diagnose",
7394
- "org:releaseupdates:hardis:diagnose",
7395
- "org:releaseupdates:diagnose:hardis",
7396
- "hardis:releaseupdates:org:diagnose",
7397
- "releaseupdates:hardis:org:diagnose",
7398
- "releaseupdates:org:hardis:diagnose",
7399
- "releaseupdates:org:diagnose:hardis",
7400
- "hardis:releaseupdates:diagnose:org",
7401
- "releaseupdates:hardis:diagnose:org",
7402
- "releaseupdates:diagnose:hardis:org",
7403
- "releaseupdates:diagnose:org:hardis"
7298
+ "hardis:org:fix:listviewmine",
7299
+ "org:hardis:fix:listviewmine",
7300
+ "org:fix:hardis:listviewmine",
7301
+ "org:fix:listviewmine:hardis",
7302
+ "hardis:fix:org:listviewmine",
7303
+ "fix:hardis:org:listviewmine",
7304
+ "fix:org:hardis:listviewmine",
7305
+ "fix:org:listviewmine:hardis",
7306
+ "hardis:fix:listviewmine:org",
7307
+ "fix:hardis:listviewmine:org",
7308
+ "fix:listviewmine:hardis:org",
7309
+ "fix:listviewmine:org:hardis",
7310
+ "hardis:org:listviewmine:fix",
7311
+ "org:hardis:listviewmine:fix",
7312
+ "org:listviewmine:hardis:fix",
7313
+ "org:listviewmine:fix:hardis",
7314
+ "hardis:listviewmine:org:fix",
7315
+ "listviewmine:hardis:org:fix",
7316
+ "listviewmine:org:hardis:fix",
7317
+ "listviewmine:org:fix:hardis",
7318
+ "hardis:listviewmine:fix:org",
7319
+ "listviewmine:hardis:fix:org",
7320
+ "listviewmine:fix:hardis:org",
7321
+ "listviewmine:fix:org:hardis"
7404
7322
  ]
7405
7323
  },
7406
- "hardis:org:diagnose:storage-stats": {
7324
+ "hardis:org:generate:packagexmlfull": {
7407
7325
  "aliases": [],
7408
7326
  "args": {},
7409
- "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with yearly trends.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose between `CreatedDate` or `LastModifiedDate` for temporal breakdown.\n- **Yearly Storage Breakdown:** Executes grouped SOQL queries per object to calculate record counts by year, providing historical growth trends.\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed by-year breakdown and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects and single-select for date field choice. All objects are pre-selected by default for user convenience.\n- **Yearly Aggregation Queries:** For each selected SObject, executes a grouped SOQL query: `SELECT CALENDAR_YEAR(<DateField>) year, COUNT(Id) total FROM <SObject> GROUP BY CALENDAR_YEAR(<DateField>) ORDER BY CALENDAR_YEAR(<DateField>) DESC`. Handles query errors gracefully (logs error and continues with next object).\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and year.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all yearly statistics per object\n - Totals summary: includes only aggregate totals per object\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
7327
+ "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
7410
7328
  "examples": [
7411
- "$ sf hardis:org:diagnose:storage-stats"
7329
+ "$ sf hardis:org:generate:packagexmlfull",
7330
+ "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
7331
+ "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
7412
7332
  ],
7413
7333
  "flags": {
7414
7334
  "json": {
@@ -7427,8 +7347,7 @@
7427
7347
  "type": "option"
7428
7348
  },
7429
7349
  "outputfile": {
7430
- "char": "f",
7431
- "description": "Force the path and name of output report file. Must end with .csv",
7350
+ "description": "Output package.xml file",
7432
7351
  "name": "outputfile",
7433
7352
  "hasDynamicHelp": false,
7434
7353
  "multiple": false,
@@ -7441,6 +7360,13 @@
7441
7360
  "allowNo": false,
7442
7361
  "type": "boolean"
7443
7362
  },
7363
+ "no-prompt": {
7364
+ "char": "n",
7365
+ "description": "Do not prompt for org username, use the default one",
7366
+ "name": "no-prompt",
7367
+ "allowNo": false,
7368
+ "type": "boolean"
7369
+ },
7444
7370
  "websocket": {
7445
7371
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
7446
7372
  "name": "websocket",
@@ -7472,57 +7398,57 @@
7472
7398
  },
7473
7399
  "hasDynamicHelp": true,
7474
7400
  "hiddenAliases": [],
7475
- "id": "hardis:org:diagnose:storage-stats",
7401
+ "id": "hardis:org:generate:packagexmlfull",
7476
7402
  "pluginAlias": "sfdx-hardis",
7477
7403
  "pluginName": "sfdx-hardis",
7478
7404
  "pluginType": "core",
7479
7405
  "strict": true,
7480
7406
  "enableJsonFlag": true,
7481
- "title": "Extract Data Storage stats",
7482
- "requiresProject": true,
7407
+ "title": "Generate Full Org package.xml",
7408
+ "requiresProject": false,
7483
7409
  "isESM": true,
7484
7410
  "relativePath": [
7485
7411
  "lib",
7486
7412
  "commands",
7487
7413
  "hardis",
7488
7414
  "org",
7489
- "diagnose",
7490
- "storage-stats.js"
7415
+ "generate",
7416
+ "packagexmlfull.js"
7491
7417
  ],
7492
7418
  "aliasPermutations": [],
7493
7419
  "permutations": [
7494
- "hardis:org:diagnose:storage-stats",
7495
- "org:hardis:diagnose:storage-stats",
7496
- "org:diagnose:hardis:storage-stats",
7497
- "org:diagnose:storage-stats:hardis",
7498
- "hardis:diagnose:org:storage-stats",
7499
- "diagnose:hardis:org:storage-stats",
7500
- "diagnose:org:hardis:storage-stats",
7501
- "diagnose:org:storage-stats:hardis",
7502
- "hardis:diagnose:storage-stats:org",
7503
- "diagnose:hardis:storage-stats:org",
7504
- "diagnose:storage-stats:hardis:org",
7505
- "diagnose:storage-stats:org:hardis",
7506
- "hardis:org:storage-stats:diagnose",
7507
- "org:hardis:storage-stats:diagnose",
7508
- "org:storage-stats:hardis:diagnose",
7509
- "org:storage-stats:diagnose:hardis",
7510
- "hardis:storage-stats:org:diagnose",
7511
- "storage-stats:hardis:org:diagnose",
7512
- "storage-stats:org:hardis:diagnose",
7513
- "storage-stats:org:diagnose:hardis",
7514
- "hardis:storage-stats:diagnose:org",
7515
- "storage-stats:hardis:diagnose:org",
7516
- "storage-stats:diagnose:hardis:org",
7517
- "storage-stats:diagnose:org:hardis"
7518
- ]
7420
+ "hardis:org:generate:packagexmlfull",
7421
+ "org:hardis:generate:packagexmlfull",
7422
+ "org:generate:hardis:packagexmlfull",
7423
+ "org:generate:packagexmlfull:hardis",
7424
+ "hardis:generate:org:packagexmlfull",
7425
+ "generate:hardis:org:packagexmlfull",
7426
+ "generate:org:hardis:packagexmlfull",
7427
+ "generate:org:packagexmlfull:hardis",
7428
+ "hardis:generate:packagexmlfull:org",
7429
+ "generate:hardis:packagexmlfull:org",
7430
+ "generate:packagexmlfull:hardis:org",
7431
+ "generate:packagexmlfull:org:hardis",
7432
+ "hardis:org:packagexmlfull:generate",
7433
+ "org:hardis:packagexmlfull:generate",
7434
+ "org:packagexmlfull:hardis:generate",
7435
+ "org:packagexmlfull:generate:hardis",
7436
+ "hardis:packagexmlfull:org:generate",
7437
+ "packagexmlfull:hardis:org:generate",
7438
+ "packagexmlfull:org:hardis:generate",
7439
+ "packagexmlfull:org:generate:hardis",
7440
+ "hardis:packagexmlfull:generate:org",
7441
+ "packagexmlfull:hardis:generate:org",
7442
+ "packagexmlfull:generate:hardis:org",
7443
+ "packagexmlfull:generate:org:hardis"
7444
+ ]
7519
7445
  },
7520
- "hardis:org:diagnose:unsecure-connected-apps": {
7446
+ "hardis:org:monitor:all": {
7521
7447
  "aliases": [],
7522
7448
  "args": {},
7523
- "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",
7449
+ "description": "Monitor org, generate reports and sends notifications\n\nYou can disable some commands defining either a **monitoringDisable** property in `.sfdx-hardis.yml`, or a comma separated list in env variable **MONITORING_DISABLE**\n\nExample in .sfdx-hardis.yml:\n \n```yaml\nmonitoringDisable:\n - METADATA_STATUS\n - MISSING_ATTRIBUTES\n - UNUSED_METADATAS\n```\n \nExample in env var:\n\n```sh\nMONITORING_DISABLE=METADATA_STATUS,MISSING_ATTRIBUTES,UNUSED_METADATAS\n```\n\nA [default list of monitoring commands](https://sfdx-hardis.cloudity.com/salesforce-monitoring-home/#monitoring-commands) is used, if you want to override it you can define property **monitoringCommands** in your .sfdx-hardis.yml file\n\nExample:\n\n```yaml\nmonitoringCommands:\n - title: My Custom command\n command: sf my:custom:command\n - title: My Custom command 2\n command: sf my:other:custom:command\n```\n\nYou can force the daily run of all commands by defining env var `MONITORING_IGNORE_FREQUENCY=true`\n\nThe default list of commands is the following:\n\n| Key | Description | Command | Frequency |\n| :---: | :---- | :---- | :-----: |\n| [AUDIT_TRAIL](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | Detect suspect setup actions in major org | [sf hardis:org:diagnose:audittrail](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | daily |\n| [LEGACY_API](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | Detect calls to deprecated API versions | [sf hardis:org:diagnose:legacyapi](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | daily |\n| [ORG_LIMITS](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | Detect if org limits are close to be reached | [sf hardis:org:monitor:limits](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | daily |\n| [UNSECURED_CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | Detect unsecured Connected Apps in an org | [sf hardis:org:diagnose:unsecure-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | daily |\n| [LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | Extract licenses information | [sf hardis:org:diagnose:licenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | weekly |\n| [LINT_ACCESS](https://sfdx-hardis.cloudity.com/hardis/lint/access) | Detect custom elements with no access rights defined in permission sets | [sf hardis:lint:access](https://sfdx-hardis.cloudity.com/hardis/lint/access) | weekly |\n| [UNUSED_LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | Detect permission set licenses that are assigned to users that do not need them | [sf hardis:org:diagnose:unusedlicenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | weekly |\n| [UNUSED_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users without recent logins | [sf hardis:org:diagnose:unusedusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ACTIVE_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users with recent logins | [sf hardis:org:diagnose:unusedusers --returnactiveusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ORG_INFO](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | Get org info + SF instance info + next major upgrade date | [sf hardis:org:diagnose:instanceupgrade](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | weekly |\n| [RELEASE_UPDATES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | Gather warnings about incoming and overdue Release Updates | [sf hardis:org:diagnose:releaseupdates](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | weekly |\n| [UNUSED_METADATAS](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | Detect custom labels and custom permissions that are not in use | [sf hardis:lint:unusedmetadatas](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | weekly |\n| [UNUSED_APEX_CLASSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | Detect unused Apex classes in an org | [sf hardis:org:diagnose:unused-apex-classes](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | weekly |\n| [CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | Detect unused Connected Apps in an org | [sf hardis:org:diagnose:unused-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | weekly |\n| [METADATA_STATUS](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | Detect inactive metadata | [sf hardis:lint:metadatastatus](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | weekly |\n| [MISSING_ATTRIBUTES](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | Detect missing description on custom field | [sf hardis:lint:missingattributes](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | weekly |\n\n",
7524
7450
  "examples": [
7525
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
7451
+ "$ sf hardis:org:monitor:all"
7526
7452
  ],
7527
7453
  "flags": {
7528
7454
  "json": {
@@ -7540,14 +7466,6 @@
7540
7466
  "multiple": false,
7541
7467
  "type": "option"
7542
7468
  },
7543
- "outputfile": {
7544
- "char": "f",
7545
- "description": "Force the path and name of output report file. Must end with .csv",
7546
- "name": "outputfile",
7547
- "hasDynamicHelp": false,
7548
- "multiple": false,
7549
- "type": "option"
7550
- },
7551
7469
  "debug": {
7552
7470
  "char": "d",
7553
7471
  "description": "Activate debug mode (more logs)",
@@ -7586,58 +7504,159 @@
7586
7504
  },
7587
7505
  "hasDynamicHelp": true,
7588
7506
  "hiddenAliases": [],
7589
- "id": "hardis:org:diagnose:unsecure-connected-apps",
7507
+ "id": "hardis:org:monitor:all",
7590
7508
  "pluginAlias": "sfdx-hardis",
7591
7509
  "pluginName": "sfdx-hardis",
7592
7510
  "pluginType": "core",
7593
7511
  "strict": true,
7594
7512
  "enableJsonFlag": true,
7595
- "title": "Detect Unsecured Connected Apps",
7596
- "requiresProject": false,
7513
+ "title": "Monitor org",
7514
+ "monitoringCommandsDefault": [
7515
+ {
7516
+ "key": "AUDIT_TRAIL",
7517
+ "title": "Detect suspect setup actions in major org",
7518
+ "command": "sf hardis:org:diagnose:audittrail",
7519
+ "frequency": "daily"
7520
+ },
7521
+ {
7522
+ "key": "LEGACY_API",
7523
+ "title": "Detect calls to deprecated API versions",
7524
+ "command": "sf hardis:org:diagnose:legacyapi",
7525
+ "frequency": "daily"
7526
+ },
7527
+ {
7528
+ "key": "ORG_LIMITS",
7529
+ "title": "Detect if org limits are close to be reached",
7530
+ "command": "sf hardis:org:monitor:limits",
7531
+ "frequency": "daily"
7532
+ },
7533
+ {
7534
+ "key": "UNSECURED_CONNECTED_APPS",
7535
+ "title": "Detect unsecured Connected Apps in an org",
7536
+ "command": "sf hardis:org:diagnose:unsecure-connected-apps",
7537
+ "frequency": "daily"
7538
+ },
7539
+ {
7540
+ "key": "LICENSES",
7541
+ "title": "Extract licenses information",
7542
+ "command": "sf hardis:org:diagnose:licenses",
7543
+ "frequency": "weekly"
7544
+ },
7545
+ {
7546
+ "key": "LINT_ACCESS",
7547
+ "title": "Detect custom elements with no access rights defined in permission sets",
7548
+ "command": "sf hardis:lint:access",
7549
+ "frequency": "weekly"
7550
+ },
7551
+ {
7552
+ "key": "UNUSED_LICENSES",
7553
+ "title": "Detect permission set licenses that are assigned to users that do not need them",
7554
+ "command": "sf hardis:org:diagnose:unusedlicenses",
7555
+ "frequency": "weekly"
7556
+ },
7557
+ {
7558
+ "key": "UNUSED_USERS",
7559
+ "title": "Detect active users without recent logins",
7560
+ "command": "sf hardis:org:diagnose:unusedusers",
7561
+ "frequency": "weekly"
7562
+ },
7563
+ {
7564
+ "key": "ACTIVE_USERS",
7565
+ "title": "Detect active users with recent logins",
7566
+ "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
7567
+ "frequency": "weekly"
7568
+ },
7569
+ {
7570
+ "key": "ORG_INFO",
7571
+ "title": "Get org info + SF instance info + next major upgrade date",
7572
+ "command": "sf hardis:org:diagnose:instanceupgrade",
7573
+ "frequency": "weekly"
7574
+ },
7575
+ {
7576
+ "key": "RELEASE_UPDATES",
7577
+ "title": "Gather warnings about incoming and overdue Release Updates",
7578
+ "command": "sf hardis:org:diagnose:releaseupdates",
7579
+ "frequency": "weekly"
7580
+ },
7581
+ {
7582
+ "key": "UNUSED_METADATAS",
7583
+ "title": "Detect custom labels and custom permissions that are not in use",
7584
+ "command": "sf hardis:lint:unusedmetadatas",
7585
+ "frequency": "weekly"
7586
+ },
7587
+ {
7588
+ "key": "UNUSED_APEX_CLASSES",
7589
+ "title": "Detect unused Apex classes in an org",
7590
+ "command": "sf hardis:org:diagnose:unused-apex-classes",
7591
+ "frequency": "weekly"
7592
+ },
7593
+ {
7594
+ "key": "CONNECTED_APPS",
7595
+ "title": "Detect unused Connected Apps in an org",
7596
+ "command": "sf hardis:org:diagnose:unused-connected-apps",
7597
+ "frequency": "weekly"
7598
+ },
7599
+ {
7600
+ "key": "METADATA_STATUS",
7601
+ "title": "Detect inactive metadata",
7602
+ "command": "sf hardis:lint:metadatastatus",
7603
+ "frequency": "weekly"
7604
+ },
7605
+ {
7606
+ "key": "MISSING_ATTRIBUTES",
7607
+ "title": "Detect missing description on custom field",
7608
+ "command": "sf hardis:lint:missingattributes",
7609
+ "frequency": "weekly"
7610
+ }
7611
+ ],
7612
+ "requiresProject": true,
7613
+ "triggerNotification": true,
7597
7614
  "isESM": true,
7598
7615
  "relativePath": [
7599
7616
  "lib",
7600
7617
  "commands",
7601
7618
  "hardis",
7602
7619
  "org",
7603
- "diagnose",
7604
- "unsecure-connected-apps.js"
7620
+ "monitor",
7621
+ "all.js"
7605
7622
  ],
7606
7623
  "aliasPermutations": [],
7607
7624
  "permutations": [
7608
- "hardis:org:diagnose:unsecure-connected-apps",
7609
- "org:hardis:diagnose:unsecure-connected-apps",
7610
- "org:diagnose:hardis:unsecure-connected-apps",
7611
- "org:diagnose:unsecure-connected-apps:hardis",
7612
- "hardis:diagnose:org:unsecure-connected-apps",
7613
- "diagnose:hardis:org:unsecure-connected-apps",
7614
- "diagnose:org:hardis:unsecure-connected-apps",
7615
- "diagnose:org:unsecure-connected-apps:hardis",
7616
- "hardis:diagnose:unsecure-connected-apps:org",
7617
- "diagnose:hardis:unsecure-connected-apps:org",
7618
- "diagnose:unsecure-connected-apps:hardis:org",
7619
- "diagnose:unsecure-connected-apps:org:hardis",
7620
- "hardis:org:unsecure-connected-apps:diagnose",
7621
- "org:hardis:unsecure-connected-apps:diagnose",
7622
- "org:unsecure-connected-apps:hardis:diagnose",
7623
- "org:unsecure-connected-apps:diagnose:hardis",
7624
- "hardis:unsecure-connected-apps:org:diagnose",
7625
- "unsecure-connected-apps:hardis:org:diagnose",
7626
- "unsecure-connected-apps:org:hardis:diagnose",
7627
- "unsecure-connected-apps:org:diagnose:hardis",
7628
- "hardis:unsecure-connected-apps:diagnose:org",
7629
- "unsecure-connected-apps:hardis:diagnose:org",
7630
- "unsecure-connected-apps:diagnose:hardis:org",
7631
- "unsecure-connected-apps:diagnose:org:hardis"
7625
+ "hardis:org:monitor:all",
7626
+ "org:hardis:monitor:all",
7627
+ "org:monitor:hardis:all",
7628
+ "org:monitor:all:hardis",
7629
+ "hardis:monitor:org:all",
7630
+ "monitor:hardis:org:all",
7631
+ "monitor:org:hardis:all",
7632
+ "monitor:org:all:hardis",
7633
+ "hardis:monitor:all:org",
7634
+ "monitor:hardis:all:org",
7635
+ "monitor:all:hardis:org",
7636
+ "monitor:all:org:hardis",
7637
+ "hardis:org:all:monitor",
7638
+ "org:hardis:all:monitor",
7639
+ "org:all:hardis:monitor",
7640
+ "org:all:monitor:hardis",
7641
+ "hardis:all:org:monitor",
7642
+ "all:hardis:org:monitor",
7643
+ "all:org:hardis:monitor",
7644
+ "all:org:monitor:hardis",
7645
+ "hardis:all:monitor:org",
7646
+ "all:hardis:monitor:org",
7647
+ "all:monitor:hardis:org",
7648
+ "all:monitor:org:hardis"
7632
7649
  ]
7633
7650
  },
7634
- "hardis:org:diagnose:unused-apex-classes": {
7651
+ "hardis:org:monitor:backup": {
7635
7652
  "aliases": [],
7636
7653
  "args": {},
7637
- "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",
7654
+ "description": "Retrieve sfdx sources in the context of a monitoring backup\n\nThe command exists in 2 modes: filtered(default & recommended) and full.\n\n## Filtered mode (default, better performances)\n\nAutomatically skips metadatas from installed packages with namespace. \n\nYou can remove more metadata types from backup, especially in case you have too many metadatas and that provokes a crash, using:\n\n- Manual update of `manifest/package-skip-items.xml` config file (then commit & push in the same branch)\n\n - Works with full wildcard (`<members>*</members>`) , named metadata (`<members>Account.Name</members>`) or partial wildcards names (`<members>pi__*</members>` , `<members>*__dlm</members>` , or `<members>prefix*suffix</members>`)\n\n- Environment variable MONITORING_BACKUP_SKIP_METADATA_TYPES (example: `MONITORING_BACKUP_SKIP_METADATA_TYPES=CustomLabel,StaticResource,Translation`): that will be applied to all monitoring branches.\n\n## Full mode\n\nActivate it with **--full** parameter, or variable MONITORING_BACKUP_MODE_FULL=true\n\nIgnores filters (namespaces items & manifest/package-skip-items.xml) to retrieve ALL metadatas, including those you might not care about (reports, translations...)\n\nAs we can retrieve only 10000 files by call, the list of all metadatas will be chunked to make multiple calls (and take more time than filtered mode)\n\n- if you use `--full-apply-filters` , manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES filters will be applied anyway\n- if you use `--exclude-namespaces` , namespaced items will be ignored\n\n_With those both options, it's like if you are not using --full, but with chunked metadata download_\n\n## In CI/CD\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-metadata-backup/) and can output Grafana, Slack and MsTeams Notifications.\n\n## Troubleshooting\n\nIf you have unknown errors (it happens !), you can investigate using the full command with smaller chunks.\n\nExample: `sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters --max-by-chunk 500`\n\nIt will allow you the identify the responsible metadata and ignore it using package-skip-items.xml or MONITORING_BACKUP_SKIP_METADATA_TYPES env variable.\n\n## Documentation\n\n[Doc generation (including visual flows)](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/) is triggered at the end of the command.\n\nIf you want to also upload HTML Documentation on your Salesforce Org as static resource, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_ORG=\"true\"**\n\nIf you want to also upload HTML Documentation on Cloudflare, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_CLOUDFLARE=\"true\"**\n\n- If you want to generate the documentation in multiple languages, define variable SFDX_DOC_LANGUAGES (ex: SFDX_DOC_LANGUAGES=en,fr,de)\n- You can define one Cloudflare site by language, for example with the following variables:\n - CLOUDFLARE_PROJECT_NAME_EN=cloudity-demo-english\n - CLOUDFLARE_PROJECT_NAME_FR=cloudity-demo-french\n - CLOUDFLARE_PROJECT_NAME_DE=cloudity-demo-german\n\nIf Flow history doc always display a single state, you probably need to update your workflow configuration:\n\n- on Gitlab: Env variable [`GIT_FETCH_EXTRA_FLAGS: --depth 10000`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11)\n- on GitHub: [`fetch-depth: 0`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml#L58)\n- on Azure: [`fetchDepth: \"0\"`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml#L39)\n- on Bitbucket: [`step: clone: depth: full`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml#L18)\n",
7638
7655
  "examples": [
7639
- "$ sf hardis:org:diagnose:unused-apex-classes",
7640
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
7656
+ "$ sf hardis:org:monitor:backup",
7657
+ "$ sf hardis:org:monitor:backup --full",
7658
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
7659
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
7641
7660
  ],
7642
7661
  "flags": {
7643
7662
  "json": {
@@ -7655,18 +7674,53 @@
7655
7674
  "multiple": false,
7656
7675
  "type": "option"
7657
7676
  },
7658
- "outputfile": {
7659
- "char": "f",
7660
- "description": "Force the path and name of output report file. Must end with .csv",
7661
- "name": "outputfile",
7677
+ "full": {
7678
+ "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
7679
+ "name": "full",
7680
+ "allowNo": false,
7681
+ "type": "boolean"
7682
+ },
7683
+ "max-by-chunk": {
7684
+ "char": "m",
7685
+ "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
7686
+ "name": "max-by-chunk",
7687
+ "default": 3000,
7662
7688
  "hasDynamicHelp": false,
7663
7689
  "multiple": false,
7664
7690
  "type": "option"
7665
7691
  },
7666
- "days": {
7667
- "char": "t",
7668
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7669
- "name": "days",
7692
+ "exclude-namespaces": {
7693
+ "char": "e",
7694
+ "description": "If mode --full is activated, exclude namespaced metadatas",
7695
+ "name": "exclude-namespaces",
7696
+ "allowNo": false,
7697
+ "type": "boolean"
7698
+ },
7699
+ "full-apply-filters": {
7700
+ "char": "z",
7701
+ "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
7702
+ "name": "full-apply-filters",
7703
+ "allowNo": false,
7704
+ "type": "boolean"
7705
+ },
7706
+ "start-chunk": {
7707
+ "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
7708
+ "name": "start-chunk",
7709
+ "default": 1,
7710
+ "hasDynamicHelp": false,
7711
+ "multiple": false,
7712
+ "type": "option"
7713
+ },
7714
+ "skip-doc": {
7715
+ "description": "Skip the generation of project documentation at the end of the command",
7716
+ "name": "skip-doc",
7717
+ "allowNo": false,
7718
+ "type": "boolean"
7719
+ },
7720
+ "outputfile": {
7721
+ "char": "f",
7722
+ "description": "Force the path and name of output report file. Must end with .csv",
7723
+ "name": "outputfile",
7670
7724
  "hasDynamicHelp": false,
7671
7725
  "multiple": false,
7672
7726
  "type": "option"
@@ -7707,59 +7761,60 @@
7707
7761
  "type": "option"
7708
7762
  }
7709
7763
  },
7710
- "hasDynamicHelp": true,
7711
- "hiddenAliases": [],
7712
- "id": "hardis:org:diagnose:unused-apex-classes",
7713
- "pluginAlias": "sfdx-hardis",
7714
- "pluginName": "sfdx-hardis",
7715
- "pluginType": "core",
7716
- "strict": true,
7717
- "enableJsonFlag": true,
7718
- "title": "Detect unused Apex classes in an org",
7719
- "requiresProject": false,
7720
- "isESM": true,
7721
- "relativePath": [
7722
- "lib",
7723
- "commands",
7724
- "hardis",
7725
- "org",
7726
- "diagnose",
7727
- "unused-apex-classes.js"
7728
- ],
7729
- "aliasPermutations": [],
7730
- "permutations": [
7731
- "hardis:org:diagnose:unused-apex-classes",
7732
- "org:hardis:diagnose:unused-apex-classes",
7733
- "org:diagnose:hardis:unused-apex-classes",
7734
- "org:diagnose:unused-apex-classes:hardis",
7735
- "hardis:diagnose:org:unused-apex-classes",
7736
- "diagnose:hardis:org:unused-apex-classes",
7737
- "diagnose:org:hardis:unused-apex-classes",
7738
- "diagnose:org:unused-apex-classes:hardis",
7739
- "hardis:diagnose:unused-apex-classes:org",
7740
- "diagnose:hardis:unused-apex-classes:org",
7741
- "diagnose:unused-apex-classes:hardis:org",
7742
- "diagnose:unused-apex-classes:org:hardis",
7743
- "hardis:org:unused-apex-classes:diagnose",
7744
- "org:hardis:unused-apex-classes:diagnose",
7745
- "org:unused-apex-classes:hardis:diagnose",
7746
- "org:unused-apex-classes:diagnose:hardis",
7747
- "hardis:unused-apex-classes:org:diagnose",
7748
- "unused-apex-classes:hardis:org:diagnose",
7749
- "unused-apex-classes:org:hardis:diagnose",
7750
- "unused-apex-classes:org:diagnose:hardis",
7751
- "hardis:unused-apex-classes:diagnose:org",
7752
- "unused-apex-classes:hardis:diagnose:org",
7753
- "unused-apex-classes:diagnose:hardis:org",
7754
- "unused-apex-classes:diagnose:org:hardis"
7764
+ "hasDynamicHelp": true,
7765
+ "hiddenAliases": [],
7766
+ "id": "hardis:org:monitor:backup",
7767
+ "pluginAlias": "sfdx-hardis",
7768
+ "pluginName": "sfdx-hardis",
7769
+ "pluginType": "core",
7770
+ "strict": true,
7771
+ "enableJsonFlag": true,
7772
+ "title": "Backup DX sources",
7773
+ "requiresProject": true,
7774
+ "triggerNotification": true,
7775
+ "isESM": true,
7776
+ "relativePath": [
7777
+ "lib",
7778
+ "commands",
7779
+ "hardis",
7780
+ "org",
7781
+ "monitor",
7782
+ "backup.js"
7783
+ ],
7784
+ "aliasPermutations": [],
7785
+ "permutations": [
7786
+ "hardis:org:monitor:backup",
7787
+ "org:hardis:monitor:backup",
7788
+ "org:monitor:hardis:backup",
7789
+ "org:monitor:backup:hardis",
7790
+ "hardis:monitor:org:backup",
7791
+ "monitor:hardis:org:backup",
7792
+ "monitor:org:hardis:backup",
7793
+ "monitor:org:backup:hardis",
7794
+ "hardis:monitor:backup:org",
7795
+ "monitor:hardis:backup:org",
7796
+ "monitor:backup:hardis:org",
7797
+ "monitor:backup:org:hardis",
7798
+ "hardis:org:backup:monitor",
7799
+ "org:hardis:backup:monitor",
7800
+ "org:backup:hardis:monitor",
7801
+ "org:backup:monitor:hardis",
7802
+ "hardis:backup:org:monitor",
7803
+ "backup:hardis:org:monitor",
7804
+ "backup:org:hardis:monitor",
7805
+ "backup:org:monitor:hardis",
7806
+ "hardis:backup:monitor:org",
7807
+ "backup:hardis:monitor:org",
7808
+ "backup:monitor:hardis:org",
7809
+ "backup:monitor:org:hardis"
7755
7810
  ]
7756
7811
  },
7757
- "hardis:org:diagnose:unused-connected-apps": {
7812
+ "hardis:org:monitor:limits": {
7758
7813
  "aliases": [],
7759
7814
  "args": {},
7760
- "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",
7815
+ "description": "\n## Command Behavior\n\n**Checks the current usage of various Salesforce org limits and sends notifications if thresholds are exceeded.**\n\nThis command is a critical component of proactive Salesforce org management, helping administrators and developers monitor resource consumption and prevent hitting critical limits that could impact performance or functionality. It provides early warnings when limits are approaching their capacity.\n\nKey functionalities:\n\n- **Limit Retrieval:** Fetches a comprehensive list of all Salesforce org limits using the Salesforce CLI.\n- **Usage Calculation:** Calculates the percentage of each limit that is currently being used.\n- **Threshold-Based Alerting:** Assigns a severity (success, warning, or error) to each limit based on configurable thresholds:\n - **Warning:** If usage exceeds 50% (configurable via `LIMIT_THRESHOLD_WARNING` environment variable).\n - **Error:** If usage exceeds 75% (configurable via `LIMIT_THRESHOLD_ERROR` environment variable).\n- **CSV Report Generation:** Generates a CSV file containing all org limits, their current usage, maximum allowed, and calculated percentage used, along with the assigned severity.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of limits that have exceeded the warning or error thresholds.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-limits/) 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 CLI Integration:** It executes the `sf org limits list` command to retrieve the current org limits. It parses the JSON output of this command.\n- **Data Processing:** It iterates through the retrieved limits, calculates the `used` and `percentUsed` values, and assigns a `severity` (success, warning, error) based on the configured thresholds.\n- **Environment Variable Configuration:** Reads `LIMIT_THRESHOLD_WARNING` and `LIMIT_THRESHOLD_ERROR` environment variables to set the warning and error thresholds for limit usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of org limits.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and detailed metrics for each limit, which can be consumed by monitoring dashboards like Grafana.\n- **Exit Code Management:** Sets the process exit code to 1 if any limit is in an 'error' state, indicating a critical issue.\n</details>\n",
7761
7816
  "examples": [
7762
- "$ sf hardis:org:diagnose:unused-connected-apps"
7817
+ "$ sf hardis:org:monitor:limits"
7763
7818
  ],
7764
7819
  "flags": {
7765
7820
  "json": {
@@ -7823,75 +7878,59 @@
7823
7878
  },
7824
7879
  "hasDynamicHelp": true,
7825
7880
  "hiddenAliases": [],
7826
- "id": "hardis:org:diagnose:unused-connected-apps",
7881
+ "id": "hardis:org:monitor:limits",
7827
7882
  "pluginAlias": "sfdx-hardis",
7828
7883
  "pluginName": "sfdx-hardis",
7829
7884
  "pluginType": "core",
7830
7885
  "strict": true,
7831
7886
  "enableJsonFlag": true,
7832
- "title": "Unused Connected Apps in an org",
7833
- "allowedInactiveConnectedApps": [
7834
- "Ant Migration Tool",
7835
- "Chatter Desktop",
7836
- "Chatter Mobile for BlackBerry",
7837
- "Force.com IDE",
7838
- "OIQ_Integration",
7839
- "Salesforce CLI",
7840
- "Salesforce Files",
7841
- "Salesforce Mobile Dashboards",
7842
- "Salesforce Touch",
7843
- "Salesforce for Outlook",
7844
- "SalesforceA",
7845
- "SalesforceA for Android",
7846
- "SalesforceA for iOS",
7847
- "SalesforceDX Namespace Registry",
7848
- "SalesforceIQ"
7849
- ],
7850
- "requiresProject": false,
7887
+ "title": "Check org limits",
7888
+ "requiresProject": true,
7889
+ "triggerNotification": true,
7851
7890
  "isESM": true,
7852
7891
  "relativePath": [
7853
7892
  "lib",
7854
7893
  "commands",
7855
7894
  "hardis",
7856
7895
  "org",
7857
- "diagnose",
7858
- "unused-connected-apps.js"
7896
+ "monitor",
7897
+ "limits.js"
7859
7898
  ],
7860
7899
  "aliasPermutations": [],
7861
7900
  "permutations": [
7862
- "hardis:org:diagnose:unused-connected-apps",
7863
- "org:hardis:diagnose:unused-connected-apps",
7864
- "org:diagnose:hardis:unused-connected-apps",
7865
- "org:diagnose:unused-connected-apps:hardis",
7866
- "hardis:diagnose:org:unused-connected-apps",
7867
- "diagnose:hardis:org:unused-connected-apps",
7868
- "diagnose:org:hardis:unused-connected-apps",
7869
- "diagnose:org:unused-connected-apps:hardis",
7870
- "hardis:diagnose:unused-connected-apps:org",
7871
- "diagnose:hardis:unused-connected-apps:org",
7872
- "diagnose:unused-connected-apps:hardis:org",
7873
- "diagnose:unused-connected-apps:org:hardis",
7874
- "hardis:org:unused-connected-apps:diagnose",
7875
- "org:hardis:unused-connected-apps:diagnose",
7876
- "org:unused-connected-apps:hardis:diagnose",
7877
- "org:unused-connected-apps:diagnose:hardis",
7878
- "hardis:unused-connected-apps:org:diagnose",
7879
- "unused-connected-apps:hardis:org:diagnose",
7880
- "unused-connected-apps:org:hardis:diagnose",
7881
- "unused-connected-apps:org:diagnose:hardis",
7882
- "hardis:unused-connected-apps:diagnose:org",
7883
- "unused-connected-apps:hardis:diagnose:org",
7884
- "unused-connected-apps:diagnose:hardis:org",
7885
- "unused-connected-apps:diagnose:org:hardis"
7901
+ "hardis:org:monitor:limits",
7902
+ "org:hardis:monitor:limits",
7903
+ "org:monitor:hardis:limits",
7904
+ "org:monitor:limits:hardis",
7905
+ "hardis:monitor:org:limits",
7906
+ "monitor:hardis:org:limits",
7907
+ "monitor:org:hardis:limits",
7908
+ "monitor:org:limits:hardis",
7909
+ "hardis:monitor:limits:org",
7910
+ "monitor:hardis:limits:org",
7911
+ "monitor:limits:hardis:org",
7912
+ "monitor:limits:org:hardis",
7913
+ "hardis:org:limits:monitor",
7914
+ "org:hardis:limits:monitor",
7915
+ "org:limits:hardis:monitor",
7916
+ "org:limits:monitor:hardis",
7917
+ "hardis:limits:org:monitor",
7918
+ "limits:hardis:org:monitor",
7919
+ "limits:org:hardis:monitor",
7920
+ "limits:org:monitor:hardis",
7921
+ "hardis:limits:monitor:org",
7922
+ "limits:hardis:monitor:org",
7923
+ "limits:monitor:hardis:org",
7924
+ "limits:monitor:org:hardis"
7886
7925
  ]
7887
7926
  },
7888
- "hardis:org:diagnose:unusedlicenses": {
7927
+ "hardis:org:purge:apexlog": {
7889
7928
  "aliases": [],
7890
7929
  "args": {},
7891
- "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",
7930
+ "description": "\n**Purges Apex debug logs from a Salesforce org.**\n\nThis command provides a quick and efficient way to clear out accumulated Apex debug logs from your Salesforce environment. This is particularly useful for:\n\n- **Storage Management:** Freeing up valuable data storage space in your Salesforce org.\n- **Performance Optimization:** Reducing the overhead associated with large volumes of debug logs.\n- **Troubleshooting:** Ensuring that new debug logs are generated cleanly without interference from old, irrelevant logs.\n\nKey functionalities:\n\n- **Log Identification:** Queries the `ApexLog` object to identify all existing debug logs.\n- **Confirmation Prompt:** Before deletion, it prompts for user confirmation, displaying the number of Apex logs that will be deleted.\n- **Bulk Deletion:** Uses the Salesforce Bulk API to efficiently delete a large number of Apex logs.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query:** It executes a SOQL query (`SELECT Id FROM ApexLog LIMIT 50000`) to retrieve the IDs of Apex logs to be deleted. The limit is set to 50,000 to handle large volumes of logs.\n- **CSV Export:** The retrieved log IDs are temporarily exported to a CSV file (`ApexLogsToDelete_*.csv`) in the `./tmp` directory.\n- **User Confirmation:** It uses the `prompts` library to ask for user confirmation before proceeding with the deletion, displaying the count of logs to be purged.\n- **Bulk API Deletion:** It then uses the Salesforce CLI's `sf data delete bulk` command, pointing to the generated CSV file, to perform the mass deletion of Apex logs.\n- **File System Operations:** It uses `fs-extra` to create the temporary directory and manage the CSV file.\n- **Error Handling:** Includes error handling for the query and deletion operations.\n</details>\n",
7892
7931
  "examples": [
7893
- "$ sf hardis:org:diagnose:unusedlicenses",
7894
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
7932
+ "$ sf hardis:org:purge:apexlog",
7933
+ "$ sf hardis:org:purge:apexlog --target-org nicolas.vuillamy@gmail.com"
7895
7934
  ],
7896
7935
  "flags": {
7897
7936
  "json": {
@@ -7909,13 +7948,12 @@
7909
7948
  "multiple": false,
7910
7949
  "type": "option"
7911
7950
  },
7912
- "outputfile": {
7913
- "char": "f",
7914
- "description": "Force the path and name of output report file. Must end with .csv",
7915
- "name": "outputfile",
7916
- "hasDynamicHelp": false,
7917
- "multiple": false,
7918
- "type": "option"
7951
+ "prompt": {
7952
+ "char": "z",
7953
+ "description": "Prompt for confirmation (true by default, use --no-prompt to skip)",
7954
+ "name": "prompt",
7955
+ "allowNo": true,
7956
+ "type": "boolean"
7919
7957
  },
7920
7958
  "debug": {
7921
7959
  "char": "d",
@@ -7955,79 +7993,59 @@
7955
7993
  },
7956
7994
  "hasDynamicHelp": true,
7957
7995
  "hiddenAliases": [],
7958
- "id": "hardis:org:diagnose:unusedlicenses",
7996
+ "id": "hardis:org:purge:apexlog",
7959
7997
  "pluginAlias": "sfdx-hardis",
7960
7998
  "pluginName": "sfdx-hardis",
7961
7999
  "pluginType": "core",
7962
8000
  "strict": true,
7963
8001
  "enableJsonFlag": true,
7964
- "title": "Detect unused Permission Set Licenses (beta)",
8002
+ "title": "Purge Apex Logs",
7965
8003
  "requiresProject": false,
7966
- "additionalPermissionSetsToAlwaysGet": [
7967
- "Sales_User"
7968
- ],
7969
- "permSetsPermSetLicenses": [
7970
- {
7971
- "permSet": "Sales_User",
7972
- "permSetLicense": "SalesUserPsl"
7973
- }
7974
- ],
7975
- "profilesPermissionSetLicenses": [
7976
- {
7977
- "profile": "Salesforce API Only",
7978
- "permSetLicense": "SalesforceAPIIntegrationPsl"
7979
- }
7980
- ],
7981
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
7982
- "IdentityConnect"
7983
- ],
7984
8004
  "isESM": true,
7985
8005
  "relativePath": [
7986
8006
  "lib",
7987
8007
  "commands",
7988
8008
  "hardis",
7989
8009
  "org",
7990
- "diagnose",
7991
- "unusedlicenses.js"
8010
+ "purge",
8011
+ "apexlog.js"
7992
8012
  ],
7993
8013
  "aliasPermutations": [],
7994
8014
  "permutations": [
7995
- "hardis:org:diagnose:unusedlicenses",
7996
- "org:hardis:diagnose:unusedlicenses",
7997
- "org:diagnose:hardis:unusedlicenses",
7998
- "org:diagnose:unusedlicenses:hardis",
7999
- "hardis:diagnose:org:unusedlicenses",
8000
- "diagnose:hardis:org:unusedlicenses",
8001
- "diagnose:org:hardis:unusedlicenses",
8002
- "diagnose:org:unusedlicenses:hardis",
8003
- "hardis:diagnose:unusedlicenses:org",
8004
- "diagnose:hardis:unusedlicenses:org",
8005
- "diagnose:unusedlicenses:hardis:org",
8006
- "diagnose:unusedlicenses:org:hardis",
8007
- "hardis:org:unusedlicenses:diagnose",
8008
- "org:hardis:unusedlicenses:diagnose",
8009
- "org:unusedlicenses:hardis:diagnose",
8010
- "org:unusedlicenses:diagnose:hardis",
8011
- "hardis:unusedlicenses:org:diagnose",
8012
- "unusedlicenses:hardis:org:diagnose",
8013
- "unusedlicenses:org:hardis:diagnose",
8014
- "unusedlicenses:org:diagnose:hardis",
8015
- "hardis:unusedlicenses:diagnose:org",
8016
- "unusedlicenses:hardis:diagnose:org",
8017
- "unusedlicenses:diagnose:hardis:org",
8018
- "unusedlicenses:diagnose:org:hardis"
8015
+ "hardis:org:purge:apexlog",
8016
+ "org:hardis:purge:apexlog",
8017
+ "org:purge:hardis:apexlog",
8018
+ "org:purge:apexlog:hardis",
8019
+ "hardis:purge:org:apexlog",
8020
+ "purge:hardis:org:apexlog",
8021
+ "purge:org:hardis:apexlog",
8022
+ "purge:org:apexlog:hardis",
8023
+ "hardis:purge:apexlog:org",
8024
+ "purge:hardis:apexlog:org",
8025
+ "purge:apexlog:hardis:org",
8026
+ "purge:apexlog:org:hardis",
8027
+ "hardis:org:apexlog:purge",
8028
+ "org:hardis:apexlog:purge",
8029
+ "org:apexlog:hardis:purge",
8030
+ "org:apexlog:purge:hardis",
8031
+ "hardis:apexlog:org:purge",
8032
+ "apexlog:hardis:org:purge",
8033
+ "apexlog:org:hardis:purge",
8034
+ "apexlog:org:purge:hardis",
8035
+ "hardis:apexlog:purge:org",
8036
+ "apexlog:hardis:purge:org",
8037
+ "apexlog:purge:hardis:org",
8038
+ "apexlog:purge:org:hardis"
8019
8039
  ]
8020
8040
  },
8021
- "hardis:org:diagnose:unusedusers": {
8041
+ "hardis:org:purge:flow": {
8022
8042
  "aliases": [],
8023
8043
  "args": {},
8024
- "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>",
8044
+ "description": "\n**Purges old or unwanted Flow versions from a Salesforce org, with an option to delete related Flow Interviews.**\n\nThis command helps maintain a clean and performant Salesforce org by removing obsolete Flow versions. Over time, multiple versions of Flows can accumulate, consuming storage and potentially impacting performance. This tool provides a controlled way to clean up these versions.\n\nKey functionalities:\n\n- **Targeted Flow Selection:** Allows you to filter Flow versions to delete by name (`--name`) and status (`--status`, e.g., `Obsolete`, `Draft`, `Inactive`).\n- **Flow Interview Deletion:** If a Flow version cannot be deleted due to active Flow Interviews, the `--delete-flow-interviews` flag (or interactive prompt) allows you to delete these interviews first, then retry the Flow version deletion.\n- **Confirmation Prompt:** In interactive mode, it prompts for confirmation before proceeding with the deletion of Flow versions and Flow Interviews.\n- **Partial Success Handling:** The `--allowpurgefailure` flag (default `true`) allows the command to continue even if some deletions fail, reporting the errors.\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 `Flow` object (using the Tooling API) to list Flow versions based on the provided filters (name, status, manageable state).\n- **Bulk Deletion (Tooling API):** It uses `bulkDeleteTooling` to perform mass deletions of Flow versions. If deletion fails due to active interviews, it extracts the interview IDs.\n- **Flow Interview Management:** If `delete-flow-interviews` is enabled, it queries `FlowInterview` objects, performs bulk deletion of the identified interviews using `bulkDelete`, and then retries the Flow version deletion.\n- **Interactive Prompts:** Uses the `prompts` library to interact with the user for selecting Flows, statuses, and confirming deletion actions.\n- **Error Reporting:** Logs detailed error messages for failed deletions, including the specific reasons.\n- **Command-Line Execution:** Uses `execSfdxJson` to execute Salesforce CLI commands for querying Flow data.\n</details>\n",
8025
8045
  "examples": [
8026
- "$ sf hardis:org:diagnose:unusedusers",
8027
- "$ sf hardis:org:diagnose:unusedusers --days 365",
8028
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
8029
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
8030
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
8046
+ "$ sf hardis:org:purge:flow",
8047
+ "$ sf hardis:org:purge:flow --target-org nicolas.vuillamy@gmail.com --no-prompt --delete-flow-interviews",
8048
+ "$ sf hardis:org:purge:flow --target-org nicolas.vuillamy@gmail.com --status \"Obsolete,Draft,InvalidDraft\" --name TestFlow"
8031
8049
  ],
8032
8050
  "flags": {
8033
8051
  "json": {
@@ -8045,49 +8063,52 @@
8045
8063
  "multiple": false,
8046
8064
  "type": "option"
8047
8065
  },
8048
- "outputfile": {
8049
- "char": "f",
8050
- "description": "Force the path and name of output report file. Must end with .csv",
8051
- "name": "outputfile",
8052
- "hasDynamicHelp": false,
8053
- "multiple": false,
8054
- "type": "option"
8066
+ "prompt": {
8067
+ "char": "z",
8068
+ "description": "Prompt for confirmation (true by default, use --no-prompt to skip)",
8069
+ "name": "prompt",
8070
+ "allowNo": true,
8071
+ "type": "boolean"
8055
8072
  },
8056
- "days": {
8057
- "char": "t",
8058
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
8059
- "name": "days",
8073
+ "name": {
8074
+ "char": "n",
8075
+ "description": "Filter according to Name criteria",
8076
+ "name": "name",
8060
8077
  "hasDynamicHelp": false,
8061
8078
  "multiple": false,
8062
8079
  "type": "option"
8063
8080
  },
8064
- "licensetypes": {
8065
- "char": "l",
8066
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
8067
- "name": "licensetypes",
8081
+ "status": {
8082
+ "char": "s",
8083
+ "description": "Filter according to Status criteria",
8084
+ "name": "status",
8068
8085
  "hasDynamicHelp": false,
8069
8086
  "multiple": false,
8070
- "options": [
8071
- "all",
8072
- "all-crm",
8073
- "all-paying"
8074
- ],
8075
8087
  "type": "option"
8076
8088
  },
8077
- "licenseidentifiers": {
8078
- "char": "i",
8079
- "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",
8080
- "name": "licenseidentifiers",
8089
+ "delete-flow-interviews": {
8090
+ "char": "w",
8091
+ "description": "If the presence of Flow interviews prevent to delete flows versions, delete them before retrying to delete flow versions",
8092
+ "name": "delete-flow-interviews",
8093
+ "allowNo": false,
8094
+ "type": "boolean"
8095
+ },
8096
+ "allowpurgefailure": {
8097
+ "char": "f",
8098
+ "description": "Allows purges to fail without exiting with 1. Use --no-allowpurgefailure to disable",
8099
+ "name": "allowpurgefailure",
8100
+ "allowNo": true,
8101
+ "type": "boolean"
8102
+ },
8103
+ "instanceurl": {
8104
+ "char": "r",
8105
+ "description": "URL of org instance",
8106
+ "name": "instanceurl",
8107
+ "default": "https://login.salesforce.com",
8081
8108
  "hasDynamicHelp": false,
8082
8109
  "multiple": false,
8083
8110
  "type": "option"
8084
8111
  },
8085
- "returnactiveusers": {
8086
- "description": "Inverts the command by returning the active users",
8087
- "name": "returnactiveusers",
8088
- "allowNo": false,
8089
- "type": "boolean"
8090
- },
8091
8112
  "debug": {
8092
8113
  "char": "d",
8093
8114
  "description": "Activate debug mode (more logs)",
@@ -8126,13 +8147,13 @@
8126
8147
  },
8127
8148
  "hasDynamicHelp": true,
8128
8149
  "hiddenAliases": [],
8129
- "id": "hardis:org:diagnose:unusedusers",
8150
+ "id": "hardis:org:purge:flow",
8130
8151
  "pluginAlias": "sfdx-hardis",
8131
8152
  "pluginName": "sfdx-hardis",
8132
8153
  "pluginType": "core",
8133
8154
  "strict": true,
8134
8155
  "enableJsonFlag": true,
8135
- "title": "Detect unused Users in Salesforce",
8156
+ "title": "Purge Flow versions",
8136
8157
  "requiresProject": false,
8137
8158
  "isESM": true,
8138
8159
  "relativePath": [
@@ -8140,35 +8161,35 @@
8140
8161
  "commands",
8141
8162
  "hardis",
8142
8163
  "org",
8143
- "diagnose",
8144
- "unusedusers.js"
8164
+ "purge",
8165
+ "flow.js"
8145
8166
  ],
8146
8167
  "aliasPermutations": [],
8147
8168
  "permutations": [
8148
- "hardis:org:diagnose:unusedusers",
8149
- "org:hardis:diagnose:unusedusers",
8150
- "org:diagnose:hardis:unusedusers",
8151
- "org:diagnose:unusedusers:hardis",
8152
- "hardis:diagnose:org:unusedusers",
8153
- "diagnose:hardis:org:unusedusers",
8154
- "diagnose:org:hardis:unusedusers",
8155
- "diagnose:org:unusedusers:hardis",
8156
- "hardis:diagnose:unusedusers:org",
8157
- "diagnose:hardis:unusedusers:org",
8158
- "diagnose:unusedusers:hardis:org",
8159
- "diagnose:unusedusers:org:hardis",
8160
- "hardis:org:unusedusers:diagnose",
8161
- "org:hardis:unusedusers:diagnose",
8162
- "org:unusedusers:hardis:diagnose",
8163
- "org:unusedusers:diagnose:hardis",
8164
- "hardis:unusedusers:org:diagnose",
8165
- "unusedusers:hardis:org:diagnose",
8166
- "unusedusers:org:hardis:diagnose",
8167
- "unusedusers:org:diagnose:hardis",
8168
- "hardis:unusedusers:diagnose:org",
8169
- "unusedusers:hardis:diagnose:org",
8170
- "unusedusers:diagnose:hardis:org",
8171
- "unusedusers:diagnose:org:hardis"
8169
+ "hardis:org:purge:flow",
8170
+ "org:hardis:purge:flow",
8171
+ "org:purge:hardis:flow",
8172
+ "org:purge:flow:hardis",
8173
+ "hardis:purge:org:flow",
8174
+ "purge:hardis:org:flow",
8175
+ "purge:org:hardis:flow",
8176
+ "purge:org:flow:hardis",
8177
+ "hardis:purge:flow:org",
8178
+ "purge:hardis:flow:org",
8179
+ "purge:flow:hardis:org",
8180
+ "purge:flow:org:hardis",
8181
+ "hardis:org:flow:purge",
8182
+ "org:hardis:flow:purge",
8183
+ "org:flow:hardis:purge",
8184
+ "org:flow:purge:hardis",
8185
+ "hardis:flow:org:purge",
8186
+ "flow:hardis:org:purge",
8187
+ "flow:org:hardis:purge",
8188
+ "flow:org:purge:hardis",
8189
+ "hardis:flow:purge:org",
8190
+ "flow:hardis:purge:org",
8191
+ "flow:purge:hardis:org",
8192
+ "flow:purge:org:hardis"
8172
8193
  ]
8173
8194
  },
8174
8195
  "hardis:org:refresh:after-refresh": {
@@ -8410,12 +8431,13 @@
8410
8431
  "before-refresh:refresh:org:hardis"
8411
8432
  ]
8412
8433
  },
8413
- "hardis:org:test:apex": {
8434
+ "hardis:org:retrieve:packageconfig": {
8414
8435
  "aliases": [],
8415
8436
  "args": {},
8416
- "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 120 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",
8437
+ "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",
8417
8438
  "examples": [
8418
- "$ sf hardis:org:test:apex"
8439
+ "$ sf hardis:org:retrieve:packageconfig",
8440
+ "sf hardis:org:retrieve:packageconfig -u myOrg"
8419
8441
  ],
8420
8442
  "flags": {
8421
8443
  "json": {
@@ -8433,21 +8455,6 @@
8433
8455
  "multiple": false,
8434
8456
  "type": "option"
8435
8457
  },
8436
- "testlevel": {
8437
- "char": "l",
8438
- "description": "Level of tests to apply to validate deployment",
8439
- "name": "testlevel",
8440
- "default": "RunLocalTests",
8441
- "hasDynamicHelp": false,
8442
- "multiple": false,
8443
- "options": [
8444
- "NoTestRun",
8445
- "RunSpecifiedTests",
8446
- "RunLocalTests",
8447
- "RunAllTestsInOrg"
8448
- ],
8449
- "type": "option"
8450
- },
8451
8458
  "debug": {
8452
8459
  "char": "d",
8453
8460
  "description": "Activate debug mode (more logs)",
@@ -8486,57 +8493,57 @@
8486
8493
  },
8487
8494
  "hasDynamicHelp": true,
8488
8495
  "hiddenAliases": [],
8489
- "id": "hardis:org:test:apex",
8496
+ "id": "hardis:org:retrieve:packageconfig",
8490
8497
  "pluginAlias": "sfdx-hardis",
8491
8498
  "pluginName": "sfdx-hardis",
8492
8499
  "pluginType": "core",
8493
8500
  "strict": true,
8494
8501
  "enableJsonFlag": true,
8495
- "title": "Run apex tests",
8502
+ "title": "Retrieve package configuration from an org",
8503
+ "requiresProject": false,
8496
8504
  "isESM": true,
8497
8505
  "relativePath": [
8498
8506
  "lib",
8499
8507
  "commands",
8500
8508
  "hardis",
8501
8509
  "org",
8502
- "test",
8503
- "apex.js"
8510
+ "retrieve",
8511
+ "packageconfig.js"
8504
8512
  ],
8505
8513
  "aliasPermutations": [],
8506
8514
  "permutations": [
8507
- "hardis:org:test:apex",
8508
- "org:hardis:test:apex",
8509
- "org:test:hardis:apex",
8510
- "org:test:apex:hardis",
8511
- "hardis:test:org:apex",
8512
- "test:hardis:org:apex",
8513
- "test:org:hardis:apex",
8514
- "test:org:apex:hardis",
8515
- "hardis:test:apex:org",
8516
- "test:hardis:apex:org",
8517
- "test:apex:hardis:org",
8518
- "test:apex:org:hardis",
8519
- "hardis:org:apex:test",
8520
- "org:hardis:apex:test",
8521
- "org:apex:hardis:test",
8522
- "org:apex:test:hardis",
8523
- "hardis:apex:org:test",
8524
- "apex:hardis:org:test",
8525
- "apex:org:hardis:test",
8526
- "apex:org:test:hardis",
8527
- "hardis:apex:test:org",
8528
- "apex:hardis:test:org",
8529
- "apex:test:hardis:org",
8530
- "apex:test:org:hardis"
8515
+ "hardis:org:retrieve:packageconfig",
8516
+ "org:hardis:retrieve:packageconfig",
8517
+ "org:retrieve:hardis:packageconfig",
8518
+ "org:retrieve:packageconfig:hardis",
8519
+ "hardis:retrieve:org:packageconfig",
8520
+ "retrieve:hardis:org:packageconfig",
8521
+ "retrieve:org:hardis:packageconfig",
8522
+ "retrieve:org:packageconfig:hardis",
8523
+ "hardis:retrieve:packageconfig:org",
8524
+ "retrieve:hardis:packageconfig:org",
8525
+ "retrieve:packageconfig:hardis:org",
8526
+ "retrieve:packageconfig:org:hardis",
8527
+ "hardis:org:packageconfig:retrieve",
8528
+ "org:hardis:packageconfig:retrieve",
8529
+ "org:packageconfig:hardis:retrieve",
8530
+ "org:packageconfig:retrieve:hardis",
8531
+ "hardis:packageconfig:org:retrieve",
8532
+ "packageconfig:hardis:org:retrieve",
8533
+ "packageconfig:org:hardis:retrieve",
8534
+ "packageconfig:org:retrieve:hardis",
8535
+ "hardis:packageconfig:retrieve:org",
8536
+ "packageconfig:hardis:retrieve:org",
8537
+ "packageconfig:retrieve:hardis:org",
8538
+ "packageconfig:retrieve:org:hardis"
8531
8539
  ]
8532
8540
  },
8533
- "hardis:org:retrieve:packageconfig": {
8541
+ "hardis:org:test:apex": {
8534
8542
  "aliases": [],
8535
8543
  "args": {},
8536
- "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",
8544
+ "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 120 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",
8537
8545
  "examples": [
8538
- "$ sf hardis:org:retrieve:packageconfig",
8539
- "sf hardis:org:retrieve:packageconfig -u myOrg"
8546
+ "$ sf hardis:org:test:apex"
8540
8547
  ],
8541
8548
  "flags": {
8542
8549
  "json": {
@@ -8554,6 +8561,21 @@
8554
8561
  "multiple": false,
8555
8562
  "type": "option"
8556
8563
  },
8564
+ "testlevel": {
8565
+ "char": "l",
8566
+ "description": "Level of tests to apply to validate deployment",
8567
+ "name": "testlevel",
8568
+ "default": "RunLocalTests",
8569
+ "hasDynamicHelp": false,
8570
+ "multiple": false,
8571
+ "options": [
8572
+ "NoTestRun",
8573
+ "RunSpecifiedTests",
8574
+ "RunLocalTests",
8575
+ "RunAllTestsInOrg"
8576
+ ],
8577
+ "type": "option"
8578
+ },
8557
8579
  "debug": {
8558
8580
  "char": "d",
8559
8581
  "description": "Activate debug mode (more logs)",
@@ -8592,49 +8614,48 @@
8592
8614
  },
8593
8615
  "hasDynamicHelp": true,
8594
8616
  "hiddenAliases": [],
8595
- "id": "hardis:org:retrieve:packageconfig",
8617
+ "id": "hardis:org:test:apex",
8596
8618
  "pluginAlias": "sfdx-hardis",
8597
8619
  "pluginName": "sfdx-hardis",
8598
8620
  "pluginType": "core",
8599
8621
  "strict": true,
8600
8622
  "enableJsonFlag": true,
8601
- "title": "Retrieve package configuration from an org",
8602
- "requiresProject": false,
8623
+ "title": "Run apex tests",
8603
8624
  "isESM": true,
8604
8625
  "relativePath": [
8605
8626
  "lib",
8606
8627
  "commands",
8607
8628
  "hardis",
8608
8629
  "org",
8609
- "retrieve",
8610
- "packageconfig.js"
8630
+ "test",
8631
+ "apex.js"
8611
8632
  ],
8612
8633
  "aliasPermutations": [],
8613
8634
  "permutations": [
8614
- "hardis:org:retrieve:packageconfig",
8615
- "org:hardis:retrieve:packageconfig",
8616
- "org:retrieve:hardis:packageconfig",
8617
- "org:retrieve:packageconfig:hardis",
8618
- "hardis:retrieve:org:packageconfig",
8619
- "retrieve:hardis:org:packageconfig",
8620
- "retrieve:org:hardis:packageconfig",
8621
- "retrieve:org:packageconfig:hardis",
8622
- "hardis:retrieve:packageconfig:org",
8623
- "retrieve:hardis:packageconfig:org",
8624
- "retrieve:packageconfig:hardis:org",
8625
- "retrieve:packageconfig:org:hardis",
8626
- "hardis:org:packageconfig:retrieve",
8627
- "org:hardis:packageconfig:retrieve",
8628
- "org:packageconfig:hardis:retrieve",
8629
- "org:packageconfig:retrieve:hardis",
8630
- "hardis:packageconfig:org:retrieve",
8631
- "packageconfig:hardis:org:retrieve",
8632
- "packageconfig:org:hardis:retrieve",
8633
- "packageconfig:org:retrieve:hardis",
8634
- "hardis:packageconfig:retrieve:org",
8635
- "packageconfig:hardis:retrieve:org",
8636
- "packageconfig:retrieve:hardis:org",
8637
- "packageconfig:retrieve:org:hardis"
8635
+ "hardis:org:test:apex",
8636
+ "org:hardis:test:apex",
8637
+ "org:test:hardis:apex",
8638
+ "org:test:apex:hardis",
8639
+ "hardis:test:org:apex",
8640
+ "test:hardis:org:apex",
8641
+ "test:org:hardis:apex",
8642
+ "test:org:apex:hardis",
8643
+ "hardis:test:apex:org",
8644
+ "test:hardis:apex:org",
8645
+ "test:apex:hardis:org",
8646
+ "test:apex:org:hardis",
8647
+ "hardis:org:apex:test",
8648
+ "org:hardis:apex:test",
8649
+ "org:apex:hardis:test",
8650
+ "org:apex:test:hardis",
8651
+ "hardis:apex:org:test",
8652
+ "apex:hardis:org:test",
8653
+ "apex:org:hardis:test",
8654
+ "apex:org:test:hardis",
8655
+ "hardis:apex:test:org",
8656
+ "apex:hardis:test:org",
8657
+ "apex:test:hardis:org",
8658
+ "apex:test:org:hardis"
8638
8659
  ]
8639
8660
  },
8640
8661
  "hardis:org:user:activateinvalid": {
@@ -11478,262 +11499,47 @@
11478
11499
  "pluginName": "sfdx-hardis",
11479
11500
  "pluginType": "core",
11480
11501
  "strict": true,
11481
- "enableJsonFlag": true,
11482
- "title": "Convert Profiles into Permission Sets",
11483
- "requiresProject": true,
11484
- "requiresSfdxPlugins": [
11485
- "shane-sfdx-plugins"
11486
- ],
11487
- "isESM": true,
11488
- "relativePath": [
11489
- "lib",
11490
- "commands",
11491
- "hardis",
11492
- "project",
11493
- "convert",
11494
- "profilestopermsets.js"
11495
- ],
11496
- "aliasPermutations": [],
11497
- "permutations": [
11498
- "hardis:project:convert:profilestopermsets",
11499
- "project:hardis:convert:profilestopermsets",
11500
- "project:convert:hardis:profilestopermsets",
11501
- "project:convert:profilestopermsets:hardis",
11502
- "hardis:convert:project:profilestopermsets",
11503
- "convert:hardis:project:profilestopermsets",
11504
- "convert:project:hardis:profilestopermsets",
11505
- "convert:project:profilestopermsets:hardis",
11506
- "hardis:convert:profilestopermsets:project",
11507
- "convert:hardis:profilestopermsets:project",
11508
- "convert:profilestopermsets:hardis:project",
11509
- "convert:profilestopermsets:project:hardis",
11510
- "hardis:project:profilestopermsets:convert",
11511
- "project:hardis:profilestopermsets:convert",
11512
- "project:profilestopermsets:hardis:convert",
11513
- "project:profilestopermsets:convert:hardis",
11514
- "hardis:profilestopermsets:project:convert",
11515
- "profilestopermsets:hardis:project:convert",
11516
- "profilestopermsets:project:hardis:convert",
11517
- "profilestopermsets:project:convert:hardis",
11518
- "hardis:profilestopermsets:convert:project",
11519
- "profilestopermsets:hardis:convert:project",
11520
- "profilestopermsets:convert:hardis:project",
11521
- "profilestopermsets:convert:project:hardis"
11522
- ]
11523
- },
11524
- "hardis:project:fix:profiletabs": {
11525
- "aliases": [],
11526
- "args": {},
11527
- "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",
11528
- "examples": [
11529
- "$ sf hardis:project:fix:profiletabs"
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
- "target-org": {
11577
- "aliases": [
11578
- "targetusername",
11579
- "u"
11580
- ],
11581
- "char": "o",
11582
- "deprecateAliases": true,
11583
- "name": "target-org",
11584
- "noCacheDefault": true,
11585
- "required": true,
11586
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
11587
- "hasDynamicHelp": true,
11588
- "multiple": false,
11589
- "type": "option"
11590
- }
11591
- },
11592
- "hasDynamicHelp": true,
11593
- "hiddenAliases": [],
11594
- "id": "hardis:project:fix:profiletabs",
11595
- "pluginAlias": "sfdx-hardis",
11596
- "pluginName": "sfdx-hardis",
11597
- "pluginType": "core",
11598
- "strict": true,
11599
- "enableJsonFlag": true,
11600
- "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
11601
- "requiresProject": true,
11602
- "isESM": true,
11603
- "relativePath": [
11604
- "lib",
11605
- "commands",
11606
- "hardis",
11607
- "project",
11608
- "fix",
11609
- "profiletabs.js"
11610
- ],
11611
- "aliasPermutations": [],
11612
- "permutations": [
11613
- "hardis:project:fix:profiletabs",
11614
- "project:hardis:fix:profiletabs",
11615
- "project:fix:hardis:profiletabs",
11616
- "project:fix:profiletabs:hardis",
11617
- "hardis:fix:project:profiletabs",
11618
- "fix:hardis:project:profiletabs",
11619
- "fix:project:hardis:profiletabs",
11620
- "fix:project:profiletabs:hardis",
11621
- "hardis:fix:profiletabs:project",
11622
- "fix:hardis:profiletabs:project",
11623
- "fix:profiletabs:hardis:project",
11624
- "fix:profiletabs:project:hardis",
11625
- "hardis:project:profiletabs:fix",
11626
- "project:hardis:profiletabs:fix",
11627
- "project:profiletabs:hardis:fix",
11628
- "project:profiletabs:fix:hardis",
11629
- "hardis:profiletabs:project:fix",
11630
- "profiletabs:hardis:project:fix",
11631
- "profiletabs:project:hardis:fix",
11632
- "profiletabs:project:fix:hardis",
11633
- "hardis:profiletabs:fix:project",
11634
- "profiletabs:hardis:fix:project",
11635
- "profiletabs:fix:hardis:project",
11636
- "profiletabs:fix:project:hardis"
11637
- ]
11638
- },
11639
- "hardis:project:fix:v53flexipages": {
11640
- "aliases": [],
11641
- "args": {},
11642
- "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",
11643
- "examples": [
11644
- "$ sf hardis:project:fix:v53flexipages"
11645
- ],
11646
- "flags": {
11647
- "json": {
11648
- "description": "Format output as json.",
11649
- "helpGroup": "GLOBAL",
11650
- "name": "json",
11651
- "allowNo": false,
11652
- "type": "boolean"
11653
- },
11654
- "flags-dir": {
11655
- "helpGroup": "GLOBAL",
11656
- "name": "flags-dir",
11657
- "summary": "Import flag values from a directory.",
11658
- "hasDynamicHelp": false,
11659
- "multiple": false,
11660
- "type": "option"
11661
- },
11662
- "path": {
11663
- "char": "p",
11664
- "description": "Root folder",
11665
- "name": "path",
11666
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
11667
- "hasDynamicHelp": false,
11668
- "multiple": false,
11669
- "type": "option"
11670
- },
11671
- "debug": {
11672
- "char": "d",
11673
- "description": "Activate debug mode (more logs)",
11674
- "name": "debug",
11675
- "allowNo": false,
11676
- "type": "boolean"
11677
- },
11678
- "websocket": {
11679
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11680
- "name": "websocket",
11681
- "hasDynamicHelp": false,
11682
- "multiple": false,
11683
- "type": "option"
11684
- },
11685
- "skipauth": {
11686
- "description": "Skip authentication check when a default username is required",
11687
- "name": "skipauth",
11688
- "allowNo": false,
11689
- "type": "boolean"
11690
- }
11691
- },
11692
- "hasDynamicHelp": false,
11693
- "hiddenAliases": [],
11694
- "id": "hardis:project:fix:v53flexipages",
11695
- "pluginAlias": "sfdx-hardis",
11696
- "pluginName": "sfdx-hardis",
11697
- "pluginType": "core",
11698
- "strict": true,
11699
- "enableJsonFlag": true,
11700
- "title": "Fix flexipages for v53",
11701
- "requiresProject": true,
11702
- "isESM": true,
11703
- "relativePath": [
11704
- "lib",
11705
- "commands",
11706
- "hardis",
11707
- "project",
11708
- "fix",
11709
- "v53flexipages.js"
11710
- ],
11711
- "aliasPermutations": [],
11712
- "permutations": [
11713
- "hardis:project:fix:v53flexipages",
11714
- "project:hardis:fix:v53flexipages",
11715
- "project:fix:hardis:v53flexipages",
11716
- "project:fix:v53flexipages:hardis",
11717
- "hardis:fix:project:v53flexipages",
11718
- "fix:hardis:project:v53flexipages",
11719
- "fix:project:hardis:v53flexipages",
11720
- "fix:project:v53flexipages:hardis",
11721
- "hardis:fix:v53flexipages:project",
11722
- "fix:hardis:v53flexipages:project",
11723
- "fix:v53flexipages:hardis:project",
11724
- "fix:v53flexipages:project:hardis",
11725
- "hardis:project:v53flexipages:fix",
11726
- "project:hardis:v53flexipages:fix",
11727
- "project:v53flexipages:hardis:fix",
11728
- "project:v53flexipages:fix:hardis",
11729
- "hardis:v53flexipages:project:fix",
11730
- "v53flexipages:hardis:project:fix",
11731
- "v53flexipages:project:hardis:fix",
11732
- "v53flexipages:project:fix:hardis",
11733
- "hardis:v53flexipages:fix:project",
11734
- "v53flexipages:hardis:fix:project",
11735
- "v53flexipages:fix:hardis:project",
11736
- "v53flexipages:fix:project:hardis"
11502
+ "enableJsonFlag": true,
11503
+ "title": "Convert Profiles into Permission Sets",
11504
+ "requiresProject": true,
11505
+ "requiresSfdxPlugins": [
11506
+ "shane-sfdx-plugins"
11507
+ ],
11508
+ "isESM": true,
11509
+ "relativePath": [
11510
+ "lib",
11511
+ "commands",
11512
+ "hardis",
11513
+ "project",
11514
+ "convert",
11515
+ "profilestopermsets.js"
11516
+ ],
11517
+ "aliasPermutations": [],
11518
+ "permutations": [
11519
+ "hardis:project:convert:profilestopermsets",
11520
+ "project:hardis:convert:profilestopermsets",
11521
+ "project:convert:hardis:profilestopermsets",
11522
+ "project:convert:profilestopermsets:hardis",
11523
+ "hardis:convert:project:profilestopermsets",
11524
+ "convert:hardis:project:profilestopermsets",
11525
+ "convert:project:hardis:profilestopermsets",
11526
+ "convert:project:profilestopermsets:hardis",
11527
+ "hardis:convert:profilestopermsets:project",
11528
+ "convert:hardis:profilestopermsets:project",
11529
+ "convert:profilestopermsets:hardis:project",
11530
+ "convert:profilestopermsets:project:hardis",
11531
+ "hardis:project:profilestopermsets:convert",
11532
+ "project:hardis:profilestopermsets:convert",
11533
+ "project:profilestopermsets:hardis:convert",
11534
+ "project:profilestopermsets:convert:hardis",
11535
+ "hardis:profilestopermsets:project:convert",
11536
+ "profilestopermsets:hardis:project:convert",
11537
+ "profilestopermsets:project:hardis:convert",
11538
+ "profilestopermsets:project:convert:hardis",
11539
+ "hardis:profilestopermsets:convert:project",
11540
+ "profilestopermsets:hardis:convert:project",
11541
+ "profilestopermsets:convert:hardis:project",
11542
+ "profilestopermsets:convert:project:hardis"
11737
11543
  ]
11738
11544
  },
11739
11545
  "hardis:project:deploy:notify": {
@@ -12911,6 +12717,221 @@
12911
12717
  "validate:deploy:project:hardis"
12912
12718
  ]
12913
12719
  },
12720
+ "hardis:project:fix:profiletabs": {
12721
+ "aliases": [],
12722
+ "args": {},
12723
+ "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",
12724
+ "examples": [
12725
+ "$ sf hardis:project:fix:profiletabs"
12726
+ ],
12727
+ "flags": {
12728
+ "json": {
12729
+ "description": "Format output as json.",
12730
+ "helpGroup": "GLOBAL",
12731
+ "name": "json",
12732
+ "allowNo": false,
12733
+ "type": "boolean"
12734
+ },
12735
+ "flags-dir": {
12736
+ "helpGroup": "GLOBAL",
12737
+ "name": "flags-dir",
12738
+ "summary": "Import flag values from a directory.",
12739
+ "hasDynamicHelp": false,
12740
+ "multiple": false,
12741
+ "type": "option"
12742
+ },
12743
+ "path": {
12744
+ "char": "p",
12745
+ "description": "Root folder",
12746
+ "name": "path",
12747
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12748
+ "hasDynamicHelp": false,
12749
+ "multiple": false,
12750
+ "type": "option"
12751
+ },
12752
+ "debug": {
12753
+ "char": "d",
12754
+ "description": "Activate debug mode (more logs)",
12755
+ "name": "debug",
12756
+ "allowNo": false,
12757
+ "type": "boolean"
12758
+ },
12759
+ "websocket": {
12760
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12761
+ "name": "websocket",
12762
+ "hasDynamicHelp": false,
12763
+ "multiple": false,
12764
+ "type": "option"
12765
+ },
12766
+ "skipauth": {
12767
+ "description": "Skip authentication check when a default username is required",
12768
+ "name": "skipauth",
12769
+ "allowNo": false,
12770
+ "type": "boolean"
12771
+ },
12772
+ "target-org": {
12773
+ "aliases": [
12774
+ "targetusername",
12775
+ "u"
12776
+ ],
12777
+ "char": "o",
12778
+ "deprecateAliases": true,
12779
+ "name": "target-org",
12780
+ "noCacheDefault": true,
12781
+ "required": true,
12782
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
12783
+ "hasDynamicHelp": true,
12784
+ "multiple": false,
12785
+ "type": "option"
12786
+ }
12787
+ },
12788
+ "hasDynamicHelp": true,
12789
+ "hiddenAliases": [],
12790
+ "id": "hardis:project:fix:profiletabs",
12791
+ "pluginAlias": "sfdx-hardis",
12792
+ "pluginName": "sfdx-hardis",
12793
+ "pluginType": "core",
12794
+ "strict": true,
12795
+ "enableJsonFlag": true,
12796
+ "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
12797
+ "requiresProject": true,
12798
+ "isESM": true,
12799
+ "relativePath": [
12800
+ "lib",
12801
+ "commands",
12802
+ "hardis",
12803
+ "project",
12804
+ "fix",
12805
+ "profiletabs.js"
12806
+ ],
12807
+ "aliasPermutations": [],
12808
+ "permutations": [
12809
+ "hardis:project:fix:profiletabs",
12810
+ "project:hardis:fix:profiletabs",
12811
+ "project:fix:hardis:profiletabs",
12812
+ "project:fix:profiletabs:hardis",
12813
+ "hardis:fix:project:profiletabs",
12814
+ "fix:hardis:project:profiletabs",
12815
+ "fix:project:hardis:profiletabs",
12816
+ "fix:project:profiletabs:hardis",
12817
+ "hardis:fix:profiletabs:project",
12818
+ "fix:hardis:profiletabs:project",
12819
+ "fix:profiletabs:hardis:project",
12820
+ "fix:profiletabs:project:hardis",
12821
+ "hardis:project:profiletabs:fix",
12822
+ "project:hardis:profiletabs:fix",
12823
+ "project:profiletabs:hardis:fix",
12824
+ "project:profiletabs:fix:hardis",
12825
+ "hardis:profiletabs:project:fix",
12826
+ "profiletabs:hardis:project:fix",
12827
+ "profiletabs:project:hardis:fix",
12828
+ "profiletabs:project:fix:hardis",
12829
+ "hardis:profiletabs:fix:project",
12830
+ "profiletabs:hardis:fix:project",
12831
+ "profiletabs:fix:hardis:project",
12832
+ "profiletabs:fix:project:hardis"
12833
+ ]
12834
+ },
12835
+ "hardis:project:fix:v53flexipages": {
12836
+ "aliases": [],
12837
+ "args": {},
12838
+ "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",
12839
+ "examples": [
12840
+ "$ sf hardis:project:fix:v53flexipages"
12841
+ ],
12842
+ "flags": {
12843
+ "json": {
12844
+ "description": "Format output as json.",
12845
+ "helpGroup": "GLOBAL",
12846
+ "name": "json",
12847
+ "allowNo": false,
12848
+ "type": "boolean"
12849
+ },
12850
+ "flags-dir": {
12851
+ "helpGroup": "GLOBAL",
12852
+ "name": "flags-dir",
12853
+ "summary": "Import flag values from a directory.",
12854
+ "hasDynamicHelp": false,
12855
+ "multiple": false,
12856
+ "type": "option"
12857
+ },
12858
+ "path": {
12859
+ "char": "p",
12860
+ "description": "Root folder",
12861
+ "name": "path",
12862
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12863
+ "hasDynamicHelp": false,
12864
+ "multiple": false,
12865
+ "type": "option"
12866
+ },
12867
+ "debug": {
12868
+ "char": "d",
12869
+ "description": "Activate debug mode (more logs)",
12870
+ "name": "debug",
12871
+ "allowNo": false,
12872
+ "type": "boolean"
12873
+ },
12874
+ "websocket": {
12875
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12876
+ "name": "websocket",
12877
+ "hasDynamicHelp": false,
12878
+ "multiple": false,
12879
+ "type": "option"
12880
+ },
12881
+ "skipauth": {
12882
+ "description": "Skip authentication check when a default username is required",
12883
+ "name": "skipauth",
12884
+ "allowNo": false,
12885
+ "type": "boolean"
12886
+ }
12887
+ },
12888
+ "hasDynamicHelp": false,
12889
+ "hiddenAliases": [],
12890
+ "id": "hardis:project:fix:v53flexipages",
12891
+ "pluginAlias": "sfdx-hardis",
12892
+ "pluginName": "sfdx-hardis",
12893
+ "pluginType": "core",
12894
+ "strict": true,
12895
+ "enableJsonFlag": true,
12896
+ "title": "Fix flexipages for v53",
12897
+ "requiresProject": true,
12898
+ "isESM": true,
12899
+ "relativePath": [
12900
+ "lib",
12901
+ "commands",
12902
+ "hardis",
12903
+ "project",
12904
+ "fix",
12905
+ "v53flexipages.js"
12906
+ ],
12907
+ "aliasPermutations": [],
12908
+ "permutations": [
12909
+ "hardis:project:fix:v53flexipages",
12910
+ "project:hardis:fix:v53flexipages",
12911
+ "project:fix:hardis:v53flexipages",
12912
+ "project:fix:v53flexipages:hardis",
12913
+ "hardis:fix:project:v53flexipages",
12914
+ "fix:hardis:project:v53flexipages",
12915
+ "fix:project:hardis:v53flexipages",
12916
+ "fix:project:v53flexipages:hardis",
12917
+ "hardis:fix:v53flexipages:project",
12918
+ "fix:hardis:v53flexipages:project",
12919
+ "fix:v53flexipages:hardis:project",
12920
+ "fix:v53flexipages:project:hardis",
12921
+ "hardis:project:v53flexipages:fix",
12922
+ "project:hardis:v53flexipages:fix",
12923
+ "project:v53flexipages:hardis:fix",
12924
+ "project:v53flexipages:fix:hardis",
12925
+ "hardis:v53flexipages:project:fix",
12926
+ "v53flexipages:hardis:project:fix",
12927
+ "v53flexipages:project:hardis:fix",
12928
+ "v53flexipages:project:fix:hardis",
12929
+ "hardis:v53flexipages:fix:project",
12930
+ "v53flexipages:hardis:fix:project",
12931
+ "v53flexipages:fix:hardis:project",
12932
+ "v53flexipages:fix:project:hardis"
12933
+ ]
12934
+ },
12914
12935
  "hardis:project:generate:bypass": {
12915
12936
  "aliases": [],
12916
12937
  "args": {},
@@ -15484,5 +15505,5 @@
15484
15505
  ]
15485
15506
  }
15486
15507
  },
15487
- "version": "6.11.1"
15508
+ "version": "6.11.3"
15488
15509
  }