sfdx-hardis 6.17.2-alpha202512261125.0 → 6.17.2-alpha202512261505.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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:datacloud:sql-query": {
@@ -5924,12 +5924,13 @@
5924
5924
  "import:data:org:hardis"
5925
5925
  ]
5926
5926
  },
5927
- "hardis:org:files:export": {
5927
+ "hardis:org:fix:listviewmine": {
5928
5928
  "aliases": [],
5929
5929
  "args": {},
5930
- "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",
5930
+ "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",
5931
5931
  "examples": [
5932
- "$ sf hardis:org:files:export"
5932
+ "$ sf hardis:org:fix:listviewmine",
5933
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5933
5934
  ],
5934
5935
  "flags": {
5935
5936
  "json": {
@@ -5947,48 +5948,14 @@
5947
5948
  "multiple": false,
5948
5949
  "type": "option"
5949
5950
  },
5950
- "path": {
5951
- "char": "p",
5952
- "description": "Path to the file export project",
5953
- "name": "path",
5954
- "hasDynamicHelp": false,
5955
- "multiple": false,
5956
- "type": "option"
5957
- },
5958
- "chunksize": {
5959
- "char": "c",
5960
- "description": "Number of records to add in a chunk before it is processed",
5961
- "name": "chunksize",
5962
- "default": 1000,
5963
- "hasDynamicHelp": false,
5964
- "multiple": false,
5965
- "type": "option"
5966
- },
5967
- "polltimeout": {
5968
- "char": "t",
5969
- "description": "Timeout in MS for Bulk API calls",
5970
- "name": "polltimeout",
5971
- "default": 300000,
5972
- "hasDynamicHelp": false,
5973
- "multiple": false,
5974
- "type": "option"
5975
- },
5976
- "startchunknumber": {
5977
- "char": "s",
5978
- "description": "Chunk number to start from",
5979
- "name": "startchunknumber",
5980
- "default": 0,
5951
+ "listviews": {
5952
+ "char": "l",
5953
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5954
+ "name": "listviews",
5981
5955
  "hasDynamicHelp": false,
5982
5956
  "multiple": false,
5983
5957
  "type": "option"
5984
5958
  },
5985
- "resume": {
5986
- "char": "r",
5987
- "description": "Resume previous export by checking existing files (default in CI)",
5988
- "name": "resume",
5989
- "allowNo": false,
5990
- "type": "boolean"
5991
- },
5992
5959
  "debug": {
5993
5960
  "char": "d",
5994
5961
  "description": "Activate debug mode (more logs)",
@@ -6027,57 +5994,60 @@
6027
5994
  },
6028
5995
  "hasDynamicHelp": true,
6029
5996
  "hiddenAliases": [],
6030
- "id": "hardis:org:files:export",
5997
+ "id": "hardis:org:fix:listviewmine",
6031
5998
  "pluginAlias": "sfdx-hardis",
6032
5999
  "pluginName": "sfdx-hardis",
6033
6000
  "pluginType": "core",
6034
6001
  "strict": true,
6035
6002
  "enableJsonFlag": true,
6036
- "title": "Export files",
6037
- "requiresProject": false,
6003
+ "title": "Fix listviews with ",
6004
+ "requiresProject": true,
6038
6005
  "isESM": true,
6039
6006
  "relativePath": [
6040
6007
  "lib",
6041
6008
  "commands",
6042
6009
  "hardis",
6043
6010
  "org",
6044
- "files",
6045
- "export.js"
6011
+ "fix",
6012
+ "listviewmine.js"
6046
6013
  ],
6047
6014
  "aliasPermutations": [],
6048
6015
  "permutations": [
6049
- "hardis:org:files:export",
6050
- "org:hardis:files:export",
6051
- "org:files:hardis:export",
6052
- "org:files:export:hardis",
6053
- "hardis:files:org:export",
6054
- "files:hardis:org:export",
6055
- "files:org:hardis:export",
6056
- "files:org:export:hardis",
6057
- "hardis:files:export:org",
6058
- "files:hardis:export:org",
6059
- "files:export:hardis:org",
6060
- "files:export:org:hardis",
6061
- "hardis:org:export:files",
6062
- "org:hardis:export:files",
6063
- "org:export:hardis:files",
6064
- "org:export:files:hardis",
6065
- "hardis:export:org:files",
6066
- "export:hardis:org:files",
6067
- "export:org:hardis:files",
6068
- "export:org:files:hardis",
6069
- "hardis:export:files:org",
6070
- "export:hardis:files:org",
6071
- "export:files:hardis:org",
6072
- "export:files:org:hardis"
6016
+ "hardis:org:fix:listviewmine",
6017
+ "org:hardis:fix:listviewmine",
6018
+ "org:fix:hardis:listviewmine",
6019
+ "org:fix:listviewmine:hardis",
6020
+ "hardis:fix:org:listviewmine",
6021
+ "fix:hardis:org:listviewmine",
6022
+ "fix:org:hardis:listviewmine",
6023
+ "fix:org:listviewmine:hardis",
6024
+ "hardis:fix:listviewmine:org",
6025
+ "fix:hardis:listviewmine:org",
6026
+ "fix:listviewmine:hardis:org",
6027
+ "fix:listviewmine:org:hardis",
6028
+ "hardis:org:listviewmine:fix",
6029
+ "org:hardis:listviewmine:fix",
6030
+ "org:listviewmine:hardis:fix",
6031
+ "org:listviewmine:fix:hardis",
6032
+ "hardis:listviewmine:org:fix",
6033
+ "listviewmine:hardis:org:fix",
6034
+ "listviewmine:org:hardis:fix",
6035
+ "listviewmine:org:fix:hardis",
6036
+ "hardis:listviewmine:fix:org",
6037
+ "listviewmine:hardis:fix:org",
6038
+ "listviewmine:fix:hardis:org",
6039
+ "listviewmine:fix:org:hardis"
6073
6040
  ]
6074
6041
  },
6075
- "hardis:org:files:import": {
6042
+ "hardis:org:diagnose:audittrail": {
6076
6043
  "aliases": [],
6077
6044
  "args": {},
6078
- "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",
6045
+ "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",
6079
6046
  "examples": [
6080
- "$ sf hardis:org:files:import"
6047
+ "$ sf hardis:org:diagnose:audittrail",
6048
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
6049
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
6050
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
6081
6051
  ],
6082
6052
  "flags": {
6083
6053
  "json": {
@@ -6095,20 +6065,29 @@
6095
6065
  "multiple": false,
6096
6066
  "type": "option"
6097
6067
  },
6098
- "path": {
6099
- "char": "p",
6100
- "description": "Path to the file export project",
6101
- "name": "path",
6068
+ "excludeusers": {
6069
+ "char": "e",
6070
+ "description": "Comma-separated list of usernames to exclude",
6071
+ "name": "excludeusers",
6102
6072
  "hasDynamicHelp": false,
6103
6073
  "multiple": false,
6104
6074
  "type": "option"
6105
6075
  },
6106
- "overwrite": {
6076
+ "lastndays": {
6077
+ "char": "t",
6078
+ "description": "Number of days to extract from today (included)",
6079
+ "name": "lastndays",
6080
+ "hasDynamicHelp": false,
6081
+ "multiple": false,
6082
+ "type": "option"
6083
+ },
6084
+ "outputfile": {
6107
6085
  "char": "f",
6108
- "description": "Override existing files (doubles the number of API calls)",
6109
- "name": "overwrite",
6110
- "allowNo": false,
6111
- "type": "boolean"
6086
+ "description": "Force the path and name of output report file. Must end with .csv",
6087
+ "name": "outputfile",
6088
+ "hasDynamicHelp": false,
6089
+ "multiple": false,
6090
+ "type": "option"
6112
6091
  },
6113
6092
  "debug": {
6114
6093
  "char": "d",
@@ -6148,13 +6127,13 @@
6148
6127
  },
6149
6128
  "hasDynamicHelp": true,
6150
6129
  "hiddenAliases": [],
6151
- "id": "hardis:org:files:import",
6130
+ "id": "hardis:org:diagnose:audittrail",
6152
6131
  "pluginAlias": "sfdx-hardis",
6153
6132
  "pluginName": "sfdx-hardis",
6154
6133
  "pluginType": "core",
6155
6134
  "strict": true,
6156
6135
  "enableJsonFlag": true,
6157
- "title": "Import files",
6136
+ "title": "Diagnose content of Setup Audit Trail",
6158
6137
  "requiresProject": false,
6159
6138
  "isESM": true,
6160
6139
  "relativePath": [
@@ -6162,44 +6141,43 @@
6162
6141
  "commands",
6163
6142
  "hardis",
6164
6143
  "org",
6165
- "files",
6166
- "import.js"
6144
+ "diagnose",
6145
+ "audittrail.js"
6167
6146
  ],
6168
6147
  "aliasPermutations": [],
6169
6148
  "permutations": [
6170
- "hardis:org:files:import",
6171
- "org:hardis:files:import",
6172
- "org:files:hardis:import",
6173
- "org:files:import:hardis",
6174
- "hardis:files:org:import",
6175
- "files:hardis:org:import",
6176
- "files:org:hardis:import",
6177
- "files:org:import:hardis",
6178
- "hardis:files:import:org",
6179
- "files:hardis:import:org",
6180
- "files:import:hardis:org",
6181
- "files:import:org:hardis",
6182
- "hardis:org:import:files",
6183
- "org:hardis:import:files",
6184
- "org:import:hardis:files",
6185
- "org:import:files:hardis",
6186
- "hardis:import:org:files",
6187
- "import:hardis:org:files",
6188
- "import:org:hardis:files",
6189
- "import:org:files:hardis",
6190
- "hardis:import:files:org",
6191
- "import:hardis:files:org",
6192
- "import:files:hardis:org",
6193
- "import:files:org:hardis"
6149
+ "hardis:org:diagnose:audittrail",
6150
+ "org:hardis:diagnose:audittrail",
6151
+ "org:diagnose:hardis:audittrail",
6152
+ "org:diagnose:audittrail:hardis",
6153
+ "hardis:diagnose:org:audittrail",
6154
+ "diagnose:hardis:org:audittrail",
6155
+ "diagnose:org:hardis:audittrail",
6156
+ "diagnose:org:audittrail:hardis",
6157
+ "hardis:diagnose:audittrail:org",
6158
+ "diagnose:hardis:audittrail:org",
6159
+ "diagnose:audittrail:hardis:org",
6160
+ "diagnose:audittrail:org:hardis",
6161
+ "hardis:org:audittrail:diagnose",
6162
+ "org:hardis:audittrail:diagnose",
6163
+ "org:audittrail:hardis:diagnose",
6164
+ "org:audittrail:diagnose:hardis",
6165
+ "hardis:audittrail:org:diagnose",
6166
+ "audittrail:hardis:org:diagnose",
6167
+ "audittrail:org:hardis:diagnose",
6168
+ "audittrail:org:diagnose:hardis",
6169
+ "hardis:audittrail:diagnose:org",
6170
+ "audittrail:hardis:diagnose:org",
6171
+ "audittrail:diagnose:hardis:org",
6172
+ "audittrail:diagnose:org:hardis"
6194
6173
  ]
6195
6174
  },
6196
- "hardis:org:fix:listviewmine": {
6175
+ "hardis:org:diagnose:instanceupgrade": {
6197
6176
  "aliases": [],
6198
6177
  "args": {},
6199
- "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",
6178
+ "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",
6200
6179
  "examples": [
6201
- "$ sf hardis:org:fix:listviewmine",
6202
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
6180
+ "$ sf hardis:org:diagnose:instanceupgrade"
6203
6181
  ],
6204
6182
  "flags": {
6205
6183
  "json": {
@@ -6217,14 +6195,6 @@
6217
6195
  "multiple": false,
6218
6196
  "type": "option"
6219
6197
  },
6220
- "listviews": {
6221
- "char": "l",
6222
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
6223
- "name": "listviews",
6224
- "hasDynamicHelp": false,
6225
- "multiple": false,
6226
- "type": "option"
6227
- },
6228
6198
  "debug": {
6229
6199
  "char": "d",
6230
6200
  "description": "Activate debug mode (more logs)",
@@ -6263,59 +6233,60 @@
6263
6233
  },
6264
6234
  "hasDynamicHelp": true,
6265
6235
  "hiddenAliases": [],
6266
- "id": "hardis:org:fix:listviewmine",
6236
+ "id": "hardis:org:diagnose:instanceupgrade",
6267
6237
  "pluginAlias": "sfdx-hardis",
6268
6238
  "pluginName": "sfdx-hardis",
6269
6239
  "pluginType": "core",
6270
6240
  "strict": true,
6271
6241
  "enableJsonFlag": true,
6272
- "title": "Fix listviews with ",
6273
- "requiresProject": true,
6242
+ "title": "Get Instance Upgrade date",
6243
+ "requiresProject": false,
6274
6244
  "isESM": true,
6275
6245
  "relativePath": [
6276
6246
  "lib",
6277
6247
  "commands",
6278
6248
  "hardis",
6279
6249
  "org",
6280
- "fix",
6281
- "listviewmine.js"
6250
+ "diagnose",
6251
+ "instanceupgrade.js"
6282
6252
  ],
6283
6253
  "aliasPermutations": [],
6284
6254
  "permutations": [
6285
- "hardis:org:fix:listviewmine",
6286
- "org:hardis:fix:listviewmine",
6287
- "org:fix:hardis:listviewmine",
6288
- "org:fix:listviewmine:hardis",
6289
- "hardis:fix:org:listviewmine",
6290
- "fix:hardis:org:listviewmine",
6291
- "fix:org:hardis:listviewmine",
6292
- "fix:org:listviewmine:hardis",
6293
- "hardis:fix:listviewmine:org",
6294
- "fix:hardis:listviewmine:org",
6295
- "fix:listviewmine:hardis:org",
6296
- "fix:listviewmine:org:hardis",
6297
- "hardis:org:listviewmine:fix",
6298
- "org:hardis:listviewmine:fix",
6299
- "org:listviewmine:hardis:fix",
6300
- "org:listviewmine:fix:hardis",
6301
- "hardis:listviewmine:org:fix",
6302
- "listviewmine:hardis:org:fix",
6303
- "listviewmine:org:hardis:fix",
6304
- "listviewmine:org:fix:hardis",
6305
- "hardis:listviewmine:fix:org",
6306
- "listviewmine:hardis:fix:org",
6307
- "listviewmine:fix:hardis:org",
6308
- "listviewmine:fix:org:hardis"
6255
+ "hardis:org:diagnose:instanceupgrade",
6256
+ "org:hardis:diagnose:instanceupgrade",
6257
+ "org:diagnose:hardis:instanceupgrade",
6258
+ "org:diagnose:instanceupgrade:hardis",
6259
+ "hardis:diagnose:org:instanceupgrade",
6260
+ "diagnose:hardis:org:instanceupgrade",
6261
+ "diagnose:org:hardis:instanceupgrade",
6262
+ "diagnose:org:instanceupgrade:hardis",
6263
+ "hardis:diagnose:instanceupgrade:org",
6264
+ "diagnose:hardis:instanceupgrade:org",
6265
+ "diagnose:instanceupgrade:hardis:org",
6266
+ "diagnose:instanceupgrade:org:hardis",
6267
+ "hardis:org:instanceupgrade:diagnose",
6268
+ "org:hardis:instanceupgrade:diagnose",
6269
+ "org:instanceupgrade:hardis:diagnose",
6270
+ "org:instanceupgrade:diagnose:hardis",
6271
+ "hardis:instanceupgrade:org:diagnose",
6272
+ "instanceupgrade:hardis:org:diagnose",
6273
+ "instanceupgrade:org:hardis:diagnose",
6274
+ "instanceupgrade:org:diagnose:hardis",
6275
+ "hardis:instanceupgrade:diagnose:org",
6276
+ "instanceupgrade:hardis:diagnose:org",
6277
+ "instanceupgrade:diagnose:hardis:org",
6278
+ "instanceupgrade:diagnose:org:hardis"
6309
6279
  ]
6310
6280
  },
6311
- "hardis:org:generate:packagexmlfull": {
6281
+ "hardis:org:diagnose:legacyapi": {
6312
6282
  "aliases": [],
6313
6283
  "args": {},
6314
- "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",
6284
+ "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",
6315
6285
  "examples": [
6316
- "$ sf hardis:org:generate:packagexmlfull",
6317
- "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
6318
- "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
6286
+ "$ sf hardis:org:diagnose:legacyapi",
6287
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
6288
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
6289
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6319
6290
  ],
6320
6291
  "flags": {
6321
6292
  "json": {
@@ -6333,8 +6304,27 @@
6333
6304
  "multiple": false,
6334
6305
  "type": "option"
6335
6306
  },
6307
+ "eventtype": {
6308
+ "char": "e",
6309
+ "description": "Type of EventLogFile event to analyze",
6310
+ "name": "eventtype",
6311
+ "default": "ApiTotalUsage",
6312
+ "hasDynamicHelp": false,
6313
+ "multiple": false,
6314
+ "type": "option"
6315
+ },
6316
+ "limit": {
6317
+ "char": "l",
6318
+ "description": "Number of latest EventLogFile events to analyze",
6319
+ "name": "limit",
6320
+ "default": 999,
6321
+ "hasDynamicHelp": false,
6322
+ "multiple": false,
6323
+ "type": "option"
6324
+ },
6336
6325
  "outputfile": {
6337
- "description": "Output package.xml file",
6326
+ "char": "f",
6327
+ "description": "Force the path and name of output report file. Must end with .csv",
6338
6328
  "name": "outputfile",
6339
6329
  "hasDynamicHelp": false,
6340
6330
  "multiple": false,
@@ -6347,13 +6337,6 @@
6347
6337
  "allowNo": false,
6348
6338
  "type": "boolean"
6349
6339
  },
6350
- "no-prompt": {
6351
- "char": "n",
6352
- "description": "Do not prompt for org username, use the default one",
6353
- "name": "no-prompt",
6354
- "allowNo": false,
6355
- "type": "boolean"
6356
- },
6357
6340
  "websocket": {
6358
6341
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
6359
6342
  "name": "websocket",
@@ -6385,13 +6368,13 @@
6385
6368
  },
6386
6369
  "hasDynamicHelp": true,
6387
6370
  "hiddenAliases": [],
6388
- "id": "hardis:org:generate:packagexmlfull",
6371
+ "id": "hardis:org:diagnose:legacyapi",
6389
6372
  "pluginAlias": "sfdx-hardis",
6390
6373
  "pluginName": "sfdx-hardis",
6391
6374
  "pluginType": "core",
6392
6375
  "strict": true,
6393
6376
  "enableJsonFlag": true,
6394
- "title": "Generate Full Org package.xml",
6377
+ "title": "Check for legacy API use",
6395
6378
  "requiresProject": false,
6396
6379
  "isESM": true,
6397
6380
  "relativePath": [
@@ -6399,43 +6382,43 @@
6399
6382
  "commands",
6400
6383
  "hardis",
6401
6384
  "org",
6402
- "generate",
6403
- "packagexmlfull.js"
6385
+ "diagnose",
6386
+ "legacyapi.js"
6404
6387
  ],
6405
6388
  "aliasPermutations": [],
6406
6389
  "permutations": [
6407
- "hardis:org:generate:packagexmlfull",
6408
- "org:hardis:generate:packagexmlfull",
6409
- "org:generate:hardis:packagexmlfull",
6410
- "org:generate:packagexmlfull:hardis",
6411
- "hardis:generate:org:packagexmlfull",
6412
- "generate:hardis:org:packagexmlfull",
6413
- "generate:org:hardis:packagexmlfull",
6414
- "generate:org:packagexmlfull:hardis",
6415
- "hardis:generate:packagexmlfull:org",
6416
- "generate:hardis:packagexmlfull:org",
6417
- "generate:packagexmlfull:hardis:org",
6418
- "generate:packagexmlfull:org:hardis",
6419
- "hardis:org:packagexmlfull:generate",
6420
- "org:hardis:packagexmlfull:generate",
6421
- "org:packagexmlfull:hardis:generate",
6422
- "org:packagexmlfull:generate:hardis",
6423
- "hardis:packagexmlfull:org:generate",
6424
- "packagexmlfull:hardis:org:generate",
6425
- "packagexmlfull:org:hardis:generate",
6426
- "packagexmlfull:org:generate:hardis",
6427
- "hardis:packagexmlfull:generate:org",
6428
- "packagexmlfull:hardis:generate:org",
6429
- "packagexmlfull:generate:hardis:org",
6430
- "packagexmlfull:generate:org:hardis"
6390
+ "hardis:org:diagnose:legacyapi",
6391
+ "org:hardis:diagnose:legacyapi",
6392
+ "org:diagnose:hardis:legacyapi",
6393
+ "org:diagnose:legacyapi:hardis",
6394
+ "hardis:diagnose:org:legacyapi",
6395
+ "diagnose:hardis:org:legacyapi",
6396
+ "diagnose:org:hardis:legacyapi",
6397
+ "diagnose:org:legacyapi:hardis",
6398
+ "hardis:diagnose:legacyapi:org",
6399
+ "diagnose:hardis:legacyapi:org",
6400
+ "diagnose:legacyapi:hardis:org",
6401
+ "diagnose:legacyapi:org:hardis",
6402
+ "hardis:org:legacyapi:diagnose",
6403
+ "org:hardis:legacyapi:diagnose",
6404
+ "org:legacyapi:hardis:diagnose",
6405
+ "org:legacyapi:diagnose:hardis",
6406
+ "hardis:legacyapi:org:diagnose",
6407
+ "legacyapi:hardis:org:diagnose",
6408
+ "legacyapi:org:hardis:diagnose",
6409
+ "legacyapi:org:diagnose:hardis",
6410
+ "hardis:legacyapi:diagnose:org",
6411
+ "legacyapi:hardis:diagnose:org",
6412
+ "legacyapi:diagnose:hardis:org",
6413
+ "legacyapi:diagnose:org:hardis"
6431
6414
  ]
6432
6415
  },
6433
- "hardis:org:monitor:all": {
6416
+ "hardis:org:diagnose:licenses": {
6434
6417
  "aliases": [],
6435
6418
  "args": {},
6436
- "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",
6419
+ "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",
6437
6420
  "examples": [
6438
- "$ sf hardis:org:monitor:all"
6421
+ "$ sf hardis:org:diagnose:licenses"
6439
6422
  ],
6440
6423
  "flags": {
6441
6424
  "json": {
@@ -6453,6 +6436,21 @@
6453
6436
  "multiple": false,
6454
6437
  "type": "option"
6455
6438
  },
6439
+ "outputfile": {
6440
+ "char": "f",
6441
+ "description": "Force the path and name of output report file. Must end with .csv",
6442
+ "name": "outputfile",
6443
+ "hasDynamicHelp": false,
6444
+ "multiple": false,
6445
+ "type": "option"
6446
+ },
6447
+ "usedonly": {
6448
+ "char": "u",
6449
+ "description": "Filter to have only used licenses",
6450
+ "name": "usedonly",
6451
+ "allowNo": false,
6452
+ "type": "boolean"
6453
+ },
6456
6454
  "debug": {
6457
6455
  "char": "d",
6458
6456
  "description": "Activate debug mode (more logs)",
@@ -6491,159 +6489,57 @@
6491
6489
  },
6492
6490
  "hasDynamicHelp": true,
6493
6491
  "hiddenAliases": [],
6494
- "id": "hardis:org:monitor:all",
6492
+ "id": "hardis:org:diagnose:licenses",
6495
6493
  "pluginAlias": "sfdx-hardis",
6496
6494
  "pluginName": "sfdx-hardis",
6497
6495
  "pluginType": "core",
6498
6496
  "strict": true,
6499
6497
  "enableJsonFlag": true,
6500
- "title": "Monitor org",
6501
- "monitoringCommandsDefault": [
6502
- {
6503
- "key": "AUDIT_TRAIL",
6504
- "title": "Detect suspect setup actions in major org",
6505
- "command": "sf hardis:org:diagnose:audittrail",
6506
- "frequency": "daily"
6507
- },
6508
- {
6509
- "key": "LEGACY_API",
6510
- "title": "Detect calls to deprecated API versions",
6511
- "command": "sf hardis:org:diagnose:legacyapi",
6512
- "frequency": "daily"
6513
- },
6514
- {
6515
- "key": "ORG_LIMITS",
6516
- "title": "Detect if org limits are close to be reached",
6517
- "command": "sf hardis:org:monitor:limits",
6518
- "frequency": "daily"
6519
- },
6520
- {
6521
- "key": "UNSECURED_CONNECTED_APPS",
6522
- "title": "Detect unsecured Connected Apps in an org",
6523
- "command": "sf hardis:org:diagnose:unsecure-connected-apps",
6524
- "frequency": "daily"
6525
- },
6526
- {
6527
- "key": "LICENSES",
6528
- "title": "Extract licenses information",
6529
- "command": "sf hardis:org:diagnose:licenses",
6530
- "frequency": "weekly"
6531
- },
6532
- {
6533
- "key": "LINT_ACCESS",
6534
- "title": "Detect custom elements with no access rights defined in permission sets",
6535
- "command": "sf hardis:lint:access",
6536
- "frequency": "weekly"
6537
- },
6538
- {
6539
- "key": "UNUSED_LICENSES",
6540
- "title": "Detect permission set licenses that are assigned to users that do not need them",
6541
- "command": "sf hardis:org:diagnose:unusedlicenses",
6542
- "frequency": "weekly"
6543
- },
6544
- {
6545
- "key": "UNUSED_USERS",
6546
- "title": "Detect active users without recent logins",
6547
- "command": "sf hardis:org:diagnose:unusedusers",
6548
- "frequency": "weekly"
6549
- },
6550
- {
6551
- "key": "ACTIVE_USERS",
6552
- "title": "Detect active users with recent logins",
6553
- "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
6554
- "frequency": "weekly"
6555
- },
6556
- {
6557
- "key": "ORG_INFO",
6558
- "title": "Get org info + SF instance info + next major upgrade date",
6559
- "command": "sf hardis:org:diagnose:instanceupgrade",
6560
- "frequency": "weekly"
6561
- },
6562
- {
6563
- "key": "RELEASE_UPDATES",
6564
- "title": "Gather warnings about incoming and overdue Release Updates",
6565
- "command": "sf hardis:org:diagnose:releaseupdates",
6566
- "frequency": "weekly"
6567
- },
6568
- {
6569
- "key": "UNUSED_METADATAS",
6570
- "title": "Detect custom labels and custom permissions that are not in use",
6571
- "command": "sf hardis:lint:unusedmetadatas",
6572
- "frequency": "weekly"
6573
- },
6574
- {
6575
- "key": "UNUSED_APEX_CLASSES",
6576
- "title": "Detect unused Apex classes in an org",
6577
- "command": "sf hardis:org:diagnose:unused-apex-classes",
6578
- "frequency": "weekly"
6579
- },
6580
- {
6581
- "key": "CONNECTED_APPS",
6582
- "title": "Detect unused Connected Apps in an org",
6583
- "command": "sf hardis:org:diagnose:unused-connected-apps",
6584
- "frequency": "weekly"
6585
- },
6586
- {
6587
- "key": "METADATA_STATUS",
6588
- "title": "Detect inactive metadata",
6589
- "command": "sf hardis:lint:metadatastatus",
6590
- "frequency": "weekly"
6591
- },
6592
- {
6593
- "key": "MISSING_ATTRIBUTES",
6594
- "title": "Detect missing description on custom field",
6595
- "command": "sf hardis:lint:missingattributes",
6596
- "frequency": "weekly"
6597
- }
6598
- ],
6599
- "requiresProject": true,
6600
- "triggerNotification": true,
6498
+ "title": "List licenses subscribed and used in a Salesforce org",
6499
+ "requiresProject": false,
6601
6500
  "isESM": true,
6602
6501
  "relativePath": [
6603
6502
  "lib",
6604
6503
  "commands",
6605
6504
  "hardis",
6606
6505
  "org",
6607
- "monitor",
6608
- "all.js"
6506
+ "diagnose",
6507
+ "licenses.js"
6609
6508
  ],
6610
6509
  "aliasPermutations": [],
6611
6510
  "permutations": [
6612
- "hardis:org:monitor:all",
6613
- "org:hardis:monitor:all",
6614
- "org:monitor:hardis:all",
6615
- "org:monitor:all:hardis",
6616
- "hardis:monitor:org:all",
6617
- "monitor:hardis:org:all",
6618
- "monitor:org:hardis:all",
6619
- "monitor:org:all:hardis",
6620
- "hardis:monitor:all:org",
6621
- "monitor:hardis:all:org",
6622
- "monitor:all:hardis:org",
6623
- "monitor:all:org:hardis",
6624
- "hardis:org:all:monitor",
6625
- "org:hardis:all:monitor",
6626
- "org:all:hardis:monitor",
6627
- "org:all:monitor:hardis",
6628
- "hardis:all:org:monitor",
6629
- "all:hardis:org:monitor",
6630
- "all:org:hardis:monitor",
6631
- "all:org:monitor:hardis",
6632
- "hardis:all:monitor:org",
6633
- "all:hardis:monitor:org",
6634
- "all:monitor:hardis:org",
6635
- "all:monitor:org:hardis"
6511
+ "hardis:org:diagnose:licenses",
6512
+ "org:hardis:diagnose:licenses",
6513
+ "org:diagnose:hardis:licenses",
6514
+ "org:diagnose:licenses:hardis",
6515
+ "hardis:diagnose:org:licenses",
6516
+ "diagnose:hardis:org:licenses",
6517
+ "diagnose:org:hardis:licenses",
6518
+ "diagnose:org:licenses:hardis",
6519
+ "hardis:diagnose:licenses:org",
6520
+ "diagnose:hardis:licenses:org",
6521
+ "diagnose:licenses:hardis:org",
6522
+ "diagnose:licenses:org:hardis",
6523
+ "hardis:org:licenses:diagnose",
6524
+ "org:hardis:licenses:diagnose",
6525
+ "org:licenses:hardis:diagnose",
6526
+ "org:licenses:diagnose:hardis",
6527
+ "hardis:licenses:org:diagnose",
6528
+ "licenses:hardis:org:diagnose",
6529
+ "licenses:org:hardis:diagnose",
6530
+ "licenses:org:diagnose:hardis",
6531
+ "hardis:licenses:diagnose:org",
6532
+ "licenses:hardis:diagnose:org",
6533
+ "licenses:diagnose:hardis:org",
6534
+ "licenses:diagnose:org:hardis"
6636
6535
  ]
6637
6536
  },
6638
- "hardis:org:monitor:backup": {
6537
+ "hardis:org:diagnose:releaseupdates": {
6639
6538
  "aliases": [],
6640
6539
  "args": {},
6641
- "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",
6540
+ "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",
6642
6541
  "examples": [
6643
- "$ sf hardis:org:monitor:backup",
6644
- "$ sf hardis:org:monitor:backup --full",
6645
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
6646
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
6542
+ "$ sf hardis:org:diagnose:releaseupdates"
6647
6543
  ],
6648
6544
  "flags": {
6649
6545
  "json": {
@@ -6661,49 +6557,6 @@
6661
6557
  "multiple": false,
6662
6558
  "type": "option"
6663
6559
  },
6664
- "full": {
6665
- "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
6666
- "name": "full",
6667
- "allowNo": false,
6668
- "type": "boolean"
6669
- },
6670
- "max-by-chunk": {
6671
- "char": "m",
6672
- "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
6673
- "name": "max-by-chunk",
6674
- "default": 3000,
6675
- "hasDynamicHelp": false,
6676
- "multiple": false,
6677
- "type": "option"
6678
- },
6679
- "exclude-namespaces": {
6680
- "char": "e",
6681
- "description": "If mode --full is activated, exclude namespaced metadatas",
6682
- "name": "exclude-namespaces",
6683
- "allowNo": false,
6684
- "type": "boolean"
6685
- },
6686
- "full-apply-filters": {
6687
- "char": "z",
6688
- "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
6689
- "name": "full-apply-filters",
6690
- "allowNo": false,
6691
- "type": "boolean"
6692
- },
6693
- "start-chunk": {
6694
- "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
6695
- "name": "start-chunk",
6696
- "default": 1,
6697
- "hasDynamicHelp": false,
6698
- "multiple": false,
6699
- "type": "option"
6700
- },
6701
- "skip-doc": {
6702
- "description": "Skip the generation of project documentation at the end of the command",
6703
- "name": "skip-doc",
6704
- "allowNo": false,
6705
- "type": "boolean"
6706
- },
6707
6560
  "outputfile": {
6708
6561
  "char": "f",
6709
6562
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6750,58 +6603,62 @@
6750
6603
  },
6751
6604
  "hasDynamicHelp": true,
6752
6605
  "hiddenAliases": [],
6753
- "id": "hardis:org:monitor:backup",
6606
+ "id": "hardis:org:diagnose:releaseupdates",
6754
6607
  "pluginAlias": "sfdx-hardis",
6755
6608
  "pluginName": "sfdx-hardis",
6756
6609
  "pluginType": "core",
6757
6610
  "strict": true,
6758
6611
  "enableJsonFlag": true,
6759
- "title": "Backup DX sources",
6760
- "requiresProject": true,
6761
- "triggerNotification": true,
6612
+ "title": "Check Release Updates of an org",
6613
+ "requiresProject": false,
6762
6614
  "isESM": true,
6763
6615
  "relativePath": [
6764
6616
  "lib",
6765
6617
  "commands",
6766
6618
  "hardis",
6767
6619
  "org",
6768
- "monitor",
6769
- "backup.js"
6620
+ "diagnose",
6621
+ "releaseupdates.js"
6770
6622
  ],
6771
6623
  "aliasPermutations": [],
6772
6624
  "permutations": [
6773
- "hardis:org:monitor:backup",
6774
- "org:hardis:monitor:backup",
6775
- "org:monitor:hardis:backup",
6776
- "org:monitor:backup:hardis",
6777
- "hardis:monitor:org:backup",
6778
- "monitor:hardis:org:backup",
6779
- "monitor:org:hardis:backup",
6780
- "monitor:org:backup:hardis",
6781
- "hardis:monitor:backup:org",
6782
- "monitor:hardis:backup:org",
6783
- "monitor:backup:hardis:org",
6784
- "monitor:backup:org:hardis",
6785
- "hardis:org:backup:monitor",
6786
- "org:hardis:backup:monitor",
6787
- "org:backup:hardis:monitor",
6788
- "org:backup:monitor:hardis",
6789
- "hardis:backup:org:monitor",
6790
- "backup:hardis:org:monitor",
6791
- "backup:org:hardis:monitor",
6792
- "backup:org:monitor:hardis",
6793
- "hardis:backup:monitor:org",
6794
- "backup:hardis:monitor:org",
6795
- "backup:monitor:hardis:org",
6796
- "backup:monitor:org:hardis"
6625
+ "hardis:org:diagnose:releaseupdates",
6626
+ "org:hardis:diagnose:releaseupdates",
6627
+ "org:diagnose:hardis:releaseupdates",
6628
+ "org:diagnose:releaseupdates:hardis",
6629
+ "hardis:diagnose:org:releaseupdates",
6630
+ "diagnose:hardis:org:releaseupdates",
6631
+ "diagnose:org:hardis:releaseupdates",
6632
+ "diagnose:org:releaseupdates:hardis",
6633
+ "hardis:diagnose:releaseupdates:org",
6634
+ "diagnose:hardis:releaseupdates:org",
6635
+ "diagnose:releaseupdates:hardis:org",
6636
+ "diagnose:releaseupdates:org:hardis",
6637
+ "hardis:org:releaseupdates:diagnose",
6638
+ "org:hardis:releaseupdates:diagnose",
6639
+ "org:releaseupdates:hardis:diagnose",
6640
+ "org:releaseupdates:diagnose:hardis",
6641
+ "hardis:releaseupdates:org:diagnose",
6642
+ "releaseupdates:hardis:org:diagnose",
6643
+ "releaseupdates:org:hardis:diagnose",
6644
+ "releaseupdates:org:diagnose:hardis",
6645
+ "hardis:releaseupdates:diagnose:org",
6646
+ "releaseupdates:hardis:diagnose:org",
6647
+ "releaseupdates:diagnose:hardis:org",
6648
+ "releaseupdates:diagnose:org:hardis"
6797
6649
  ]
6798
6650
  },
6799
- "hardis:org:monitor:limits": {
6651
+ "hardis:org:diagnose:storage-stats": {
6800
6652
  "aliases": [],
6801
6653
  "args": {},
6802
- "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",
6654
+ "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",
6803
6655
  "examples": [
6804
- "$ sf hardis:org:monitor:limits"
6656
+ "$ sf hardis:org:diagnose:storage-stats",
6657
+ "$ sf hardis:org:diagnose:storage-stats --breakdown-field \"CreatedDate\"",
6658
+ "$ sf hardis:org:diagnose:storage-stats -b \"RecordType.Name\"",
6659
+ "$ sf hardis:org:diagnose:storage-stats --where \"CreatedDate = LAST_N_DAYS:365\"",
6660
+ "$ sf hardis:org:diagnose:storage-stats -w \"Status__c = 'Active'\"",
6661
+ "$ sf hardis:org:diagnose:storage-stats -b \"LastModifiedDate\" -w \"IsDeleted = false\""
6805
6662
  ],
6806
6663
  "flags": {
6807
6664
  "json": {
@@ -6827,6 +6684,22 @@
6827
6684
  "multiple": false,
6828
6685
  "type": "option"
6829
6686
  },
6687
+ "breakdown-field": {
6688
+ "char": "b",
6689
+ "description": "Field to use for storage stats breakdown. Example: \"CreatedDate\", \"LastModifiedDate\", \"RecordType.Name\", or custom fields like \"Status__c\"",
6690
+ "name": "breakdown-field",
6691
+ "hasDynamicHelp": false,
6692
+ "multiple": false,
6693
+ "type": "option"
6694
+ },
6695
+ "where": {
6696
+ "char": "w",
6697
+ "description": "WHERE clause to filter records in the query (without the WHERE keyword). Example: \"CreatedDate = LAST_N_DAYS:365\" or \"Status__c = 'Active'\"",
6698
+ "name": "where",
6699
+ "hasDynamicHelp": false,
6700
+ "multiple": false,
6701
+ "type": "option"
6702
+ },
6830
6703
  "debug": {
6831
6704
  "char": "d",
6832
6705
  "description": "Activate debug mode (more logs)",
@@ -6865,61 +6738,57 @@
6865
6738
  },
6866
6739
  "hasDynamicHelp": true,
6867
6740
  "hiddenAliases": [],
6868
- "id": "hardis:org:monitor:limits",
6741
+ "id": "hardis:org:diagnose:storage-stats",
6869
6742
  "pluginAlias": "sfdx-hardis",
6870
6743
  "pluginName": "sfdx-hardis",
6871
6744
  "pluginType": "core",
6872
6745
  "strict": true,
6873
6746
  "enableJsonFlag": true,
6874
- "title": "Check org limits",
6747
+ "title": "Extract Data Storage stats",
6875
6748
  "requiresProject": true,
6876
- "triggerNotification": true,
6877
6749
  "isESM": true,
6878
6750
  "relativePath": [
6879
6751
  "lib",
6880
6752
  "commands",
6881
6753
  "hardis",
6882
6754
  "org",
6883
- "monitor",
6884
- "limits.js"
6755
+ "diagnose",
6756
+ "storage-stats.js"
6885
6757
  ],
6886
6758
  "aliasPermutations": [],
6887
6759
  "permutations": [
6888
- "hardis:org:monitor:limits",
6889
- "org:hardis:monitor:limits",
6890
- "org:monitor:hardis:limits",
6891
- "org:monitor:limits:hardis",
6892
- "hardis:monitor:org:limits",
6893
- "monitor:hardis:org:limits",
6894
- "monitor:org:hardis:limits",
6895
- "monitor:org:limits:hardis",
6896
- "hardis:monitor:limits:org",
6897
- "monitor:hardis:limits:org",
6898
- "monitor:limits:hardis:org",
6899
- "monitor:limits:org:hardis",
6900
- "hardis:org:limits:monitor",
6901
- "org:hardis:limits:monitor",
6902
- "org:limits:hardis:monitor",
6903
- "org:limits:monitor:hardis",
6904
- "hardis:limits:org:monitor",
6905
- "limits:hardis:org:monitor",
6906
- "limits:org:hardis:monitor",
6907
- "limits:org:monitor:hardis",
6908
- "hardis:limits:monitor:org",
6909
- "limits:hardis:monitor:org",
6910
- "limits:monitor:hardis:org",
6911
- "limits:monitor:org:hardis"
6760
+ "hardis:org:diagnose:storage-stats",
6761
+ "org:hardis:diagnose:storage-stats",
6762
+ "org:diagnose:hardis:storage-stats",
6763
+ "org:diagnose:storage-stats:hardis",
6764
+ "hardis:diagnose:org:storage-stats",
6765
+ "diagnose:hardis:org:storage-stats",
6766
+ "diagnose:org:hardis:storage-stats",
6767
+ "diagnose:org:storage-stats:hardis",
6768
+ "hardis:diagnose:storage-stats:org",
6769
+ "diagnose:hardis:storage-stats:org",
6770
+ "diagnose:storage-stats:hardis:org",
6771
+ "diagnose:storage-stats:org:hardis",
6772
+ "hardis:org:storage-stats:diagnose",
6773
+ "org:hardis:storage-stats:diagnose",
6774
+ "org:storage-stats:hardis:diagnose",
6775
+ "org:storage-stats:diagnose:hardis",
6776
+ "hardis:storage-stats:org:diagnose",
6777
+ "storage-stats:hardis:org:diagnose",
6778
+ "storage-stats:org:hardis:diagnose",
6779
+ "storage-stats:org:diagnose:hardis",
6780
+ "hardis:storage-stats:diagnose:org",
6781
+ "storage-stats:hardis:diagnose:org",
6782
+ "storage-stats:diagnose:hardis:org",
6783
+ "storage-stats:diagnose:org:hardis"
6912
6784
  ]
6913
6785
  },
6914
- "hardis:org:diagnose:audittrail": {
6786
+ "hardis:org:diagnose:unsecure-connected-apps": {
6915
6787
  "aliases": [],
6916
6788
  "args": {},
6917
- "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",
6789
+ "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",
6918
6790
  "examples": [
6919
- "$ sf hardis:org:diagnose:audittrail",
6920
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
6921
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
6922
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
6791
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6923
6792
  ],
6924
6793
  "flags": {
6925
6794
  "json": {
@@ -6937,22 +6806,6 @@
6937
6806
  "multiple": false,
6938
6807
  "type": "option"
6939
6808
  },
6940
- "excludeusers": {
6941
- "char": "e",
6942
- "description": "Comma-separated list of usernames to exclude",
6943
- "name": "excludeusers",
6944
- "hasDynamicHelp": false,
6945
- "multiple": false,
6946
- "type": "option"
6947
- },
6948
- "lastndays": {
6949
- "char": "t",
6950
- "description": "Number of days to extract from today (included)",
6951
- "name": "lastndays",
6952
- "hasDynamicHelp": false,
6953
- "multiple": false,
6954
- "type": "option"
6955
- },
6956
6809
  "outputfile": {
6957
6810
  "char": "f",
6958
6811
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6999,13 +6852,13 @@
6999
6852
  },
7000
6853
  "hasDynamicHelp": true,
7001
6854
  "hiddenAliases": [],
7002
- "id": "hardis:org:diagnose:audittrail",
6855
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
7003
6856
  "pluginAlias": "sfdx-hardis",
7004
6857
  "pluginName": "sfdx-hardis",
7005
6858
  "pluginType": "core",
7006
6859
  "strict": true,
7007
6860
  "enableJsonFlag": true,
7008
- "title": "Diagnose content of Setup Audit Trail",
6861
+ "title": "Detect Unsecured Connected Apps",
7009
6862
  "requiresProject": false,
7010
6863
  "isESM": true,
7011
6864
  "relativePath": [
@@ -7014,42 +6867,43 @@
7014
6867
  "hardis",
7015
6868
  "org",
7016
6869
  "diagnose",
7017
- "audittrail.js"
6870
+ "unsecure-connected-apps.js"
7018
6871
  ],
7019
6872
  "aliasPermutations": [],
7020
6873
  "permutations": [
7021
- "hardis:org:diagnose:audittrail",
7022
- "org:hardis:diagnose:audittrail",
7023
- "org:diagnose:hardis:audittrail",
7024
- "org:diagnose:audittrail:hardis",
7025
- "hardis:diagnose:org:audittrail",
7026
- "diagnose:hardis:org:audittrail",
7027
- "diagnose:org:hardis:audittrail",
7028
- "diagnose:org:audittrail:hardis",
7029
- "hardis:diagnose:audittrail:org",
7030
- "diagnose:hardis:audittrail:org",
7031
- "diagnose:audittrail:hardis:org",
7032
- "diagnose:audittrail:org:hardis",
7033
- "hardis:org:audittrail:diagnose",
7034
- "org:hardis:audittrail:diagnose",
7035
- "org:audittrail:hardis:diagnose",
7036
- "org:audittrail:diagnose:hardis",
7037
- "hardis:audittrail:org:diagnose",
7038
- "audittrail:hardis:org:diagnose",
7039
- "audittrail:org:hardis:diagnose",
7040
- "audittrail:org:diagnose:hardis",
7041
- "hardis:audittrail:diagnose:org",
7042
- "audittrail:hardis:diagnose:org",
7043
- "audittrail:diagnose:hardis:org",
7044
- "audittrail:diagnose:org:hardis"
6874
+ "hardis:org:diagnose:unsecure-connected-apps",
6875
+ "org:hardis:diagnose:unsecure-connected-apps",
6876
+ "org:diagnose:hardis:unsecure-connected-apps",
6877
+ "org:diagnose:unsecure-connected-apps:hardis",
6878
+ "hardis:diagnose:org:unsecure-connected-apps",
6879
+ "diagnose:hardis:org:unsecure-connected-apps",
6880
+ "diagnose:org:hardis:unsecure-connected-apps",
6881
+ "diagnose:org:unsecure-connected-apps:hardis",
6882
+ "hardis:diagnose:unsecure-connected-apps:org",
6883
+ "diagnose:hardis:unsecure-connected-apps:org",
6884
+ "diagnose:unsecure-connected-apps:hardis:org",
6885
+ "diagnose:unsecure-connected-apps:org:hardis",
6886
+ "hardis:org:unsecure-connected-apps:diagnose",
6887
+ "org:hardis:unsecure-connected-apps:diagnose",
6888
+ "org:unsecure-connected-apps:hardis:diagnose",
6889
+ "org:unsecure-connected-apps:diagnose:hardis",
6890
+ "hardis:unsecure-connected-apps:org:diagnose",
6891
+ "unsecure-connected-apps:hardis:org:diagnose",
6892
+ "unsecure-connected-apps:org:hardis:diagnose",
6893
+ "unsecure-connected-apps:org:diagnose:hardis",
6894
+ "hardis:unsecure-connected-apps:diagnose:org",
6895
+ "unsecure-connected-apps:hardis:diagnose:org",
6896
+ "unsecure-connected-apps:diagnose:hardis:org",
6897
+ "unsecure-connected-apps:diagnose:org:hardis"
7045
6898
  ]
7046
6899
  },
7047
- "hardis:org:diagnose:instanceupgrade": {
6900
+ "hardis:org:diagnose:unused-apex-classes": {
7048
6901
  "aliases": [],
7049
6902
  "args": {},
7050
- "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",
6903
+ "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",
7051
6904
  "examples": [
7052
- "$ sf hardis:org:diagnose:instanceupgrade"
6905
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6906
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
7053
6907
  ],
7054
6908
  "flags": {
7055
6909
  "json": {
@@ -7067,6 +6921,22 @@
7067
6921
  "multiple": false,
7068
6922
  "type": "option"
7069
6923
  },
6924
+ "outputfile": {
6925
+ "char": "f",
6926
+ "description": "Force the path and name of output report file. Must end with .csv",
6927
+ "name": "outputfile",
6928
+ "hasDynamicHelp": false,
6929
+ "multiple": false,
6930
+ "type": "option"
6931
+ },
6932
+ "days": {
6933
+ "char": "t",
6934
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6935
+ "name": "days",
6936
+ "hasDynamicHelp": false,
6937
+ "multiple": false,
6938
+ "type": "option"
6939
+ },
7070
6940
  "debug": {
7071
6941
  "char": "d",
7072
6942
  "description": "Activate debug mode (more logs)",
@@ -7105,13 +6975,13 @@
7105
6975
  },
7106
6976
  "hasDynamicHelp": true,
7107
6977
  "hiddenAliases": [],
7108
- "id": "hardis:org:diagnose:instanceupgrade",
6978
+ "id": "hardis:org:diagnose:unused-apex-classes",
7109
6979
  "pluginAlias": "sfdx-hardis",
7110
6980
  "pluginName": "sfdx-hardis",
7111
6981
  "pluginType": "core",
7112
6982
  "strict": true,
7113
6983
  "enableJsonFlag": true,
7114
- "title": "Get Instance Upgrade date",
6984
+ "title": "Detect unused Apex classes in an org",
7115
6985
  "requiresProject": false,
7116
6986
  "isESM": true,
7117
6987
  "relativePath": [
@@ -7120,45 +6990,42 @@
7120
6990
  "hardis",
7121
6991
  "org",
7122
6992
  "diagnose",
7123
- "instanceupgrade.js"
6993
+ "unused-apex-classes.js"
7124
6994
  ],
7125
6995
  "aliasPermutations": [],
7126
6996
  "permutations": [
7127
- "hardis:org:diagnose:instanceupgrade",
7128
- "org:hardis:diagnose:instanceupgrade",
7129
- "org:diagnose:hardis:instanceupgrade",
7130
- "org:diagnose:instanceupgrade:hardis",
7131
- "hardis:diagnose:org:instanceupgrade",
7132
- "diagnose:hardis:org:instanceupgrade",
7133
- "diagnose:org:hardis:instanceupgrade",
7134
- "diagnose:org:instanceupgrade:hardis",
7135
- "hardis:diagnose:instanceupgrade:org",
7136
- "diagnose:hardis:instanceupgrade:org",
7137
- "diagnose:instanceupgrade:hardis:org",
7138
- "diagnose:instanceupgrade:org:hardis",
7139
- "hardis:org:instanceupgrade:diagnose",
7140
- "org:hardis:instanceupgrade:diagnose",
7141
- "org:instanceupgrade:hardis:diagnose",
7142
- "org:instanceupgrade:diagnose:hardis",
7143
- "hardis:instanceupgrade:org:diagnose",
7144
- "instanceupgrade:hardis:org:diagnose",
7145
- "instanceupgrade:org:hardis:diagnose",
7146
- "instanceupgrade:org:diagnose:hardis",
7147
- "hardis:instanceupgrade:diagnose:org",
7148
- "instanceupgrade:hardis:diagnose:org",
7149
- "instanceupgrade:diagnose:hardis:org",
7150
- "instanceupgrade:diagnose:org:hardis"
6997
+ "hardis:org:diagnose:unused-apex-classes",
6998
+ "org:hardis:diagnose:unused-apex-classes",
6999
+ "org:diagnose:hardis:unused-apex-classes",
7000
+ "org:diagnose:unused-apex-classes:hardis",
7001
+ "hardis:diagnose:org:unused-apex-classes",
7002
+ "diagnose:hardis:org:unused-apex-classes",
7003
+ "diagnose:org:hardis:unused-apex-classes",
7004
+ "diagnose:org:unused-apex-classes:hardis",
7005
+ "hardis:diagnose:unused-apex-classes:org",
7006
+ "diagnose:hardis:unused-apex-classes:org",
7007
+ "diagnose:unused-apex-classes:hardis:org",
7008
+ "diagnose:unused-apex-classes:org:hardis",
7009
+ "hardis:org:unused-apex-classes:diagnose",
7010
+ "org:hardis:unused-apex-classes:diagnose",
7011
+ "org:unused-apex-classes:hardis:diagnose",
7012
+ "org:unused-apex-classes:diagnose:hardis",
7013
+ "hardis:unused-apex-classes:org:diagnose",
7014
+ "unused-apex-classes:hardis:org:diagnose",
7015
+ "unused-apex-classes:org:hardis:diagnose",
7016
+ "unused-apex-classes:org:diagnose:hardis",
7017
+ "hardis:unused-apex-classes:diagnose:org",
7018
+ "unused-apex-classes:hardis:diagnose:org",
7019
+ "unused-apex-classes:diagnose:hardis:org",
7020
+ "unused-apex-classes:diagnose:org:hardis"
7151
7021
  ]
7152
7022
  },
7153
- "hardis:org:diagnose:legacyapi": {
7023
+ "hardis:org:diagnose:unused-connected-apps": {
7154
7024
  "aliases": [],
7155
7025
  "args": {},
7156
- "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",
7026
+ "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",
7157
7027
  "examples": [
7158
- "$ sf hardis:org:diagnose:legacyapi",
7159
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
7160
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
7161
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
7028
+ "$ sf hardis:org:diagnose:unused-connected-apps"
7162
7029
  ],
7163
7030
  "flags": {
7164
7031
  "json": {
@@ -7176,28 +7043,10 @@
7176
7043
  "multiple": false,
7177
7044
  "type": "option"
7178
7045
  },
7179
- "eventtype": {
7180
- "char": "e",
7181
- "description": "Type of EventLogFile event to analyze",
7182
- "name": "eventtype",
7183
- "default": "ApiTotalUsage",
7184
- "hasDynamicHelp": false,
7185
- "multiple": false,
7186
- "type": "option"
7187
- },
7188
- "limit": {
7189
- "char": "l",
7190
- "description": "Number of latest EventLogFile events to analyze",
7191
- "name": "limit",
7192
- "default": 999,
7193
- "hasDynamicHelp": false,
7194
- "multiple": false,
7195
- "type": "option"
7196
- },
7197
- "outputfile": {
7198
- "char": "f",
7199
- "description": "Force the path and name of output report file. Must end with .csv",
7200
- "name": "outputfile",
7046
+ "outputfile": {
7047
+ "char": "f",
7048
+ "description": "Force the path and name of output report file. Must end with .csv",
7049
+ "name": "outputfile",
7201
7050
  "hasDynamicHelp": false,
7202
7051
  "multiple": false,
7203
7052
  "type": "option"
@@ -7240,13 +7089,30 @@
7240
7089
  },
7241
7090
  "hasDynamicHelp": true,
7242
7091
  "hiddenAliases": [],
7243
- "id": "hardis:org:diagnose:legacyapi",
7092
+ "id": "hardis:org:diagnose:unused-connected-apps",
7244
7093
  "pluginAlias": "sfdx-hardis",
7245
7094
  "pluginName": "sfdx-hardis",
7246
7095
  "pluginType": "core",
7247
7096
  "strict": true,
7248
7097
  "enableJsonFlag": true,
7249
- "title": "Check for legacy API use",
7098
+ "title": "Unused Connected Apps in an org",
7099
+ "allowedInactiveConnectedApps": [
7100
+ "Ant Migration Tool",
7101
+ "Chatter Desktop",
7102
+ "Chatter Mobile for BlackBerry",
7103
+ "Force.com IDE",
7104
+ "OIQ_Integration",
7105
+ "Salesforce CLI",
7106
+ "Salesforce Files",
7107
+ "Salesforce Mobile Dashboards",
7108
+ "Salesforce Touch",
7109
+ "Salesforce for Outlook",
7110
+ "SalesforceA",
7111
+ "SalesforceA for Android",
7112
+ "SalesforceA for iOS",
7113
+ "SalesforceDX Namespace Registry",
7114
+ "SalesforceIQ"
7115
+ ],
7250
7116
  "requiresProject": false,
7251
7117
  "isESM": true,
7252
7118
  "relativePath": [
@@ -7255,42 +7121,43 @@
7255
7121
  "hardis",
7256
7122
  "org",
7257
7123
  "diagnose",
7258
- "legacyapi.js"
7124
+ "unused-connected-apps.js"
7259
7125
  ],
7260
7126
  "aliasPermutations": [],
7261
7127
  "permutations": [
7262
- "hardis:org:diagnose:legacyapi",
7263
- "org:hardis:diagnose:legacyapi",
7264
- "org:diagnose:hardis:legacyapi",
7265
- "org:diagnose:legacyapi:hardis",
7266
- "hardis:diagnose:org:legacyapi",
7267
- "diagnose:hardis:org:legacyapi",
7268
- "diagnose:org:hardis:legacyapi",
7269
- "diagnose:org:legacyapi:hardis",
7270
- "hardis:diagnose:legacyapi:org",
7271
- "diagnose:hardis:legacyapi:org",
7272
- "diagnose:legacyapi:hardis:org",
7273
- "diagnose:legacyapi:org:hardis",
7274
- "hardis:org:legacyapi:diagnose",
7275
- "org:hardis:legacyapi:diagnose",
7276
- "org:legacyapi:hardis:diagnose",
7277
- "org:legacyapi:diagnose:hardis",
7278
- "hardis:legacyapi:org:diagnose",
7279
- "legacyapi:hardis:org:diagnose",
7280
- "legacyapi:org:hardis:diagnose",
7281
- "legacyapi:org:diagnose:hardis",
7282
- "hardis:legacyapi:diagnose:org",
7283
- "legacyapi:hardis:diagnose:org",
7284
- "legacyapi:diagnose:hardis:org",
7285
- "legacyapi:diagnose:org:hardis"
7128
+ "hardis:org:diagnose:unused-connected-apps",
7129
+ "org:hardis:diagnose:unused-connected-apps",
7130
+ "org:diagnose:hardis:unused-connected-apps",
7131
+ "org:diagnose:unused-connected-apps:hardis",
7132
+ "hardis:diagnose:org:unused-connected-apps",
7133
+ "diagnose:hardis:org:unused-connected-apps",
7134
+ "diagnose:org:hardis:unused-connected-apps",
7135
+ "diagnose:org:unused-connected-apps:hardis",
7136
+ "hardis:diagnose:unused-connected-apps:org",
7137
+ "diagnose:hardis:unused-connected-apps:org",
7138
+ "diagnose:unused-connected-apps:hardis:org",
7139
+ "diagnose:unused-connected-apps:org:hardis",
7140
+ "hardis:org:unused-connected-apps:diagnose",
7141
+ "org:hardis:unused-connected-apps:diagnose",
7142
+ "org:unused-connected-apps:hardis:diagnose",
7143
+ "org:unused-connected-apps:diagnose:hardis",
7144
+ "hardis:unused-connected-apps:org:diagnose",
7145
+ "unused-connected-apps:hardis:org:diagnose",
7146
+ "unused-connected-apps:org:hardis:diagnose",
7147
+ "unused-connected-apps:org:diagnose:hardis",
7148
+ "hardis:unused-connected-apps:diagnose:org",
7149
+ "unused-connected-apps:hardis:diagnose:org",
7150
+ "unused-connected-apps:diagnose:hardis:org",
7151
+ "unused-connected-apps:diagnose:org:hardis"
7286
7152
  ]
7287
7153
  },
7288
- "hardis:org:diagnose:licenses": {
7154
+ "hardis:org:diagnose:unusedlicenses": {
7289
7155
  "aliases": [],
7290
7156
  "args": {},
7291
- "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",
7157
+ "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",
7292
7158
  "examples": [
7293
- "$ sf hardis:org:diagnose:licenses"
7159
+ "$ sf hardis:org:diagnose:unusedlicenses",
7160
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
7294
7161
  ],
7295
7162
  "flags": {
7296
7163
  "json": {
@@ -7316,13 +7183,6 @@
7316
7183
  "multiple": false,
7317
7184
  "type": "option"
7318
7185
  },
7319
- "usedonly": {
7320
- "char": "u",
7321
- "description": "Filter to have only used licenses",
7322
- "name": "usedonly",
7323
- "allowNo": false,
7324
- "type": "boolean"
7325
- },
7326
7186
  "debug": {
7327
7187
  "char": "d",
7328
7188
  "description": "Activate debug mode (more logs)",
@@ -7361,14 +7221,32 @@
7361
7221
  },
7362
7222
  "hasDynamicHelp": true,
7363
7223
  "hiddenAliases": [],
7364
- "id": "hardis:org:diagnose:licenses",
7224
+ "id": "hardis:org:diagnose:unusedlicenses",
7365
7225
  "pluginAlias": "sfdx-hardis",
7366
7226
  "pluginName": "sfdx-hardis",
7367
7227
  "pluginType": "core",
7368
7228
  "strict": true,
7369
7229
  "enableJsonFlag": true,
7370
- "title": "List licenses subscribed and used in a Salesforce org",
7230
+ "title": "Detect unused Permission Set Licenses (beta)",
7371
7231
  "requiresProject": false,
7232
+ "additionalPermissionSetsToAlwaysGet": [
7233
+ "Sales_User"
7234
+ ],
7235
+ "permSetsPermSetLicenses": [
7236
+ {
7237
+ "permSet": "Sales_User",
7238
+ "permSetLicense": "SalesUserPsl"
7239
+ }
7240
+ ],
7241
+ "profilesPermissionSetLicenses": [
7242
+ {
7243
+ "profile": "Salesforce API Only",
7244
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
7245
+ }
7246
+ ],
7247
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
7248
+ "IdentityConnect"
7249
+ ],
7372
7250
  "isESM": true,
7373
7251
  "relativePath": [
7374
7252
  "lib",
@@ -7376,42 +7254,46 @@
7376
7254
  "hardis",
7377
7255
  "org",
7378
7256
  "diagnose",
7379
- "licenses.js"
7257
+ "unusedlicenses.js"
7380
7258
  ],
7381
7259
  "aliasPermutations": [],
7382
7260
  "permutations": [
7383
- "hardis:org:diagnose:licenses",
7384
- "org:hardis:diagnose:licenses",
7385
- "org:diagnose:hardis:licenses",
7386
- "org:diagnose:licenses:hardis",
7387
- "hardis:diagnose:org:licenses",
7388
- "diagnose:hardis:org:licenses",
7389
- "diagnose:org:hardis:licenses",
7390
- "diagnose:org:licenses:hardis",
7391
- "hardis:diagnose:licenses:org",
7392
- "diagnose:hardis:licenses:org",
7393
- "diagnose:licenses:hardis:org",
7394
- "diagnose:licenses:org:hardis",
7395
- "hardis:org:licenses:diagnose",
7396
- "org:hardis:licenses:diagnose",
7397
- "org:licenses:hardis:diagnose",
7398
- "org:licenses:diagnose:hardis",
7399
- "hardis:licenses:org:diagnose",
7400
- "licenses:hardis:org:diagnose",
7401
- "licenses:org:hardis:diagnose",
7402
- "licenses:org:diagnose:hardis",
7403
- "hardis:licenses:diagnose:org",
7404
- "licenses:hardis:diagnose:org",
7405
- "licenses:diagnose:hardis:org",
7406
- "licenses:diagnose:org:hardis"
7261
+ "hardis:org:diagnose:unusedlicenses",
7262
+ "org:hardis:diagnose:unusedlicenses",
7263
+ "org:diagnose:hardis:unusedlicenses",
7264
+ "org:diagnose:unusedlicenses:hardis",
7265
+ "hardis:diagnose:org:unusedlicenses",
7266
+ "diagnose:hardis:org:unusedlicenses",
7267
+ "diagnose:org:hardis:unusedlicenses",
7268
+ "diagnose:org:unusedlicenses:hardis",
7269
+ "hardis:diagnose:unusedlicenses:org",
7270
+ "diagnose:hardis:unusedlicenses:org",
7271
+ "diagnose:unusedlicenses:hardis:org",
7272
+ "diagnose:unusedlicenses:org:hardis",
7273
+ "hardis:org:unusedlicenses:diagnose",
7274
+ "org:hardis:unusedlicenses:diagnose",
7275
+ "org:unusedlicenses:hardis:diagnose",
7276
+ "org:unusedlicenses:diagnose:hardis",
7277
+ "hardis:unusedlicenses:org:diagnose",
7278
+ "unusedlicenses:hardis:org:diagnose",
7279
+ "unusedlicenses:org:hardis:diagnose",
7280
+ "unusedlicenses:org:diagnose:hardis",
7281
+ "hardis:unusedlicenses:diagnose:org",
7282
+ "unusedlicenses:hardis:diagnose:org",
7283
+ "unusedlicenses:diagnose:hardis:org",
7284
+ "unusedlicenses:diagnose:org:hardis"
7407
7285
  ]
7408
7286
  },
7409
- "hardis:org:diagnose:releaseupdates": {
7287
+ "hardis:org:diagnose:unusedusers": {
7410
7288
  "aliases": [],
7411
7289
  "args": {},
7412
- "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",
7290
+ "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>",
7413
7291
  "examples": [
7414
- "$ sf hardis:org:diagnose:releaseupdates"
7292
+ "$ sf hardis:org:diagnose:unusedusers",
7293
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
7294
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7295
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7296
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7415
7297
  ],
7416
7298
  "flags": {
7417
7299
  "json": {
@@ -7437,6 +7319,41 @@
7437
7319
  "multiple": false,
7438
7320
  "type": "option"
7439
7321
  },
7322
+ "days": {
7323
+ "char": "t",
7324
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7325
+ "name": "days",
7326
+ "hasDynamicHelp": false,
7327
+ "multiple": false,
7328
+ "type": "option"
7329
+ },
7330
+ "licensetypes": {
7331
+ "char": "l",
7332
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7333
+ "name": "licensetypes",
7334
+ "hasDynamicHelp": false,
7335
+ "multiple": false,
7336
+ "options": [
7337
+ "all",
7338
+ "all-crm",
7339
+ "all-paying"
7340
+ ],
7341
+ "type": "option"
7342
+ },
7343
+ "licenseidentifiers": {
7344
+ "char": "i",
7345
+ "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",
7346
+ "name": "licenseidentifiers",
7347
+ "hasDynamicHelp": false,
7348
+ "multiple": false,
7349
+ "type": "option"
7350
+ },
7351
+ "returnactiveusers": {
7352
+ "description": "Inverts the command by returning the active users",
7353
+ "name": "returnactiveusers",
7354
+ "allowNo": false,
7355
+ "type": "boolean"
7356
+ },
7440
7357
  "debug": {
7441
7358
  "char": "d",
7442
7359
  "description": "Activate debug mode (more logs)",
@@ -7475,13 +7392,13 @@
7475
7392
  },
7476
7393
  "hasDynamicHelp": true,
7477
7394
  "hiddenAliases": [],
7478
- "id": "hardis:org:diagnose:releaseupdates",
7395
+ "id": "hardis:org:diagnose:unusedusers",
7479
7396
  "pluginAlias": "sfdx-hardis",
7480
7397
  "pluginName": "sfdx-hardis",
7481
7398
  "pluginType": "core",
7482
7399
  "strict": true,
7483
7400
  "enableJsonFlag": true,
7484
- "title": "Check Release Updates of an org",
7401
+ "title": "Detect unused Users in Salesforce",
7485
7402
  "requiresProject": false,
7486
7403
  "isESM": true,
7487
7404
  "relativePath": [
@@ -7490,47 +7407,42 @@
7490
7407
  "hardis",
7491
7408
  "org",
7492
7409
  "diagnose",
7493
- "releaseupdates.js"
7410
+ "unusedusers.js"
7494
7411
  ],
7495
7412
  "aliasPermutations": [],
7496
7413
  "permutations": [
7497
- "hardis:org:diagnose:releaseupdates",
7498
- "org:hardis:diagnose:releaseupdates",
7499
- "org:diagnose:hardis:releaseupdates",
7500
- "org:diagnose:releaseupdates:hardis",
7501
- "hardis:diagnose:org:releaseupdates",
7502
- "diagnose:hardis:org:releaseupdates",
7503
- "diagnose:org:hardis:releaseupdates",
7504
- "diagnose:org:releaseupdates:hardis",
7505
- "hardis:diagnose:releaseupdates:org",
7506
- "diagnose:hardis:releaseupdates:org",
7507
- "diagnose:releaseupdates:hardis:org",
7508
- "diagnose:releaseupdates:org:hardis",
7509
- "hardis:org:releaseupdates:diagnose",
7510
- "org:hardis:releaseupdates:diagnose",
7511
- "org:releaseupdates:hardis:diagnose",
7512
- "org:releaseupdates:diagnose:hardis",
7513
- "hardis:releaseupdates:org:diagnose",
7514
- "releaseupdates:hardis:org:diagnose",
7515
- "releaseupdates:org:hardis:diagnose",
7516
- "releaseupdates:org:diagnose:hardis",
7517
- "hardis:releaseupdates:diagnose:org",
7518
- "releaseupdates:hardis:diagnose:org",
7519
- "releaseupdates:diagnose:hardis:org",
7520
- "releaseupdates:diagnose:org:hardis"
7521
- ]
7522
- },
7523
- "hardis:org:diagnose:storage-stats": {
7524
- "aliases": [],
7525
- "args": {},
7526
- "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",
7527
- "examples": [
7528
- "$ sf hardis:org:diagnose:storage-stats",
7529
- "$ sf hardis:org:diagnose:storage-stats --breakdown-field \"CreatedDate\"",
7530
- "$ sf hardis:org:diagnose:storage-stats -b \"RecordType.Name\"",
7531
- "$ sf hardis:org:diagnose:storage-stats --where \"CreatedDate = LAST_N_DAYS:365\"",
7532
- "$ sf hardis:org:diagnose:storage-stats -w \"Status__c = 'Active'\"",
7533
- "$ sf hardis:org:diagnose:storage-stats -b \"LastModifiedDate\" -w \"IsDeleted = false\""
7414
+ "hardis:org:diagnose:unusedusers",
7415
+ "org:hardis:diagnose:unusedusers",
7416
+ "org:diagnose:hardis:unusedusers",
7417
+ "org:diagnose:unusedusers:hardis",
7418
+ "hardis:diagnose:org:unusedusers",
7419
+ "diagnose:hardis:org:unusedusers",
7420
+ "diagnose:org:hardis:unusedusers",
7421
+ "diagnose:org:unusedusers:hardis",
7422
+ "hardis:diagnose:unusedusers:org",
7423
+ "diagnose:hardis:unusedusers:org",
7424
+ "diagnose:unusedusers:hardis:org",
7425
+ "diagnose:unusedusers:org:hardis",
7426
+ "hardis:org:unusedusers:diagnose",
7427
+ "org:hardis:unusedusers:diagnose",
7428
+ "org:unusedusers:hardis:diagnose",
7429
+ "org:unusedusers:diagnose:hardis",
7430
+ "hardis:unusedusers:org:diagnose",
7431
+ "unusedusers:hardis:org:diagnose",
7432
+ "unusedusers:org:hardis:diagnose",
7433
+ "unusedusers:org:diagnose:hardis",
7434
+ "hardis:unusedusers:diagnose:org",
7435
+ "unusedusers:hardis:diagnose:org",
7436
+ "unusedusers:diagnose:hardis:org",
7437
+ "unusedusers:diagnose:org:hardis"
7438
+ ]
7439
+ },
7440
+ "hardis:org:files:export": {
7441
+ "aliases": [],
7442
+ "args": {},
7443
+ "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",
7444
+ "examples": [
7445
+ "$ sf hardis:org:files:export"
7534
7446
  ],
7535
7447
  "flags": {
7536
7448
  "json": {
@@ -7548,30 +7460,48 @@
7548
7460
  "multiple": false,
7549
7461
  "type": "option"
7550
7462
  },
7551
- "outputfile": {
7552
- "char": "f",
7553
- "description": "Force the path and name of output report file. Must end with .csv",
7554
- "name": "outputfile",
7463
+ "path": {
7464
+ "char": "p",
7465
+ "description": "Path to the file export project",
7466
+ "name": "path",
7555
7467
  "hasDynamicHelp": false,
7556
7468
  "multiple": false,
7557
7469
  "type": "option"
7558
7470
  },
7559
- "breakdown-field": {
7560
- "char": "b",
7561
- "description": "Field to use for storage stats breakdown. Example: \"CreatedDate\", \"LastModifiedDate\", \"RecordType.Name\", or custom fields like \"Status__c\"",
7562
- "name": "breakdown-field",
7471
+ "chunksize": {
7472
+ "char": "c",
7473
+ "description": "Number of records to add in a chunk before it is processed",
7474
+ "name": "chunksize",
7475
+ "default": 1000,
7563
7476
  "hasDynamicHelp": false,
7564
7477
  "multiple": false,
7565
7478
  "type": "option"
7566
7479
  },
7567
- "where": {
7568
- "char": "w",
7569
- "description": "WHERE clause to filter records in the query (without the WHERE keyword). Example: \"CreatedDate = LAST_N_DAYS:365\" or \"Status__c = 'Active'\"",
7570
- "name": "where",
7480
+ "polltimeout": {
7481
+ "char": "t",
7482
+ "description": "Timeout in MS for Bulk API calls",
7483
+ "name": "polltimeout",
7484
+ "default": 300000,
7571
7485
  "hasDynamicHelp": false,
7572
7486
  "multiple": false,
7573
7487
  "type": "option"
7574
7488
  },
7489
+ "startchunknumber": {
7490
+ "char": "s",
7491
+ "description": "Chunk number to start from",
7492
+ "name": "startchunknumber",
7493
+ "default": 0,
7494
+ "hasDynamicHelp": false,
7495
+ "multiple": false,
7496
+ "type": "option"
7497
+ },
7498
+ "resume": {
7499
+ "char": "r",
7500
+ "description": "Resume previous export by checking existing files (default in CI)",
7501
+ "name": "resume",
7502
+ "allowNo": false,
7503
+ "type": "boolean"
7504
+ },
7575
7505
  "debug": {
7576
7506
  "char": "d",
7577
7507
  "description": "Activate debug mode (more logs)",
@@ -7610,57 +7540,57 @@
7610
7540
  },
7611
7541
  "hasDynamicHelp": true,
7612
7542
  "hiddenAliases": [],
7613
- "id": "hardis:org:diagnose:storage-stats",
7543
+ "id": "hardis:org:files:export",
7614
7544
  "pluginAlias": "sfdx-hardis",
7615
7545
  "pluginName": "sfdx-hardis",
7616
7546
  "pluginType": "core",
7617
7547
  "strict": true,
7618
7548
  "enableJsonFlag": true,
7619
- "title": "Extract Data Storage stats",
7620
- "requiresProject": true,
7549
+ "title": "Export files",
7550
+ "requiresProject": false,
7621
7551
  "isESM": true,
7622
7552
  "relativePath": [
7623
7553
  "lib",
7624
7554
  "commands",
7625
7555
  "hardis",
7626
7556
  "org",
7627
- "diagnose",
7628
- "storage-stats.js"
7557
+ "files",
7558
+ "export.js"
7629
7559
  ],
7630
7560
  "aliasPermutations": [],
7631
7561
  "permutations": [
7632
- "hardis:org:diagnose:storage-stats",
7633
- "org:hardis:diagnose:storage-stats",
7634
- "org:diagnose:hardis:storage-stats",
7635
- "org:diagnose:storage-stats:hardis",
7636
- "hardis:diagnose:org:storage-stats",
7637
- "diagnose:hardis:org:storage-stats",
7638
- "diagnose:org:hardis:storage-stats",
7639
- "diagnose:org:storage-stats:hardis",
7640
- "hardis:diagnose:storage-stats:org",
7641
- "diagnose:hardis:storage-stats:org",
7642
- "diagnose:storage-stats:hardis:org",
7643
- "diagnose:storage-stats:org:hardis",
7644
- "hardis:org:storage-stats:diagnose",
7645
- "org:hardis:storage-stats:diagnose",
7646
- "org:storage-stats:hardis:diagnose",
7647
- "org:storage-stats:diagnose:hardis",
7648
- "hardis:storage-stats:org:diagnose",
7649
- "storage-stats:hardis:org:diagnose",
7650
- "storage-stats:org:hardis:diagnose",
7651
- "storage-stats:org:diagnose:hardis",
7652
- "hardis:storage-stats:diagnose:org",
7653
- "storage-stats:hardis:diagnose:org",
7654
- "storage-stats:diagnose:hardis:org",
7655
- "storage-stats:diagnose:org:hardis"
7562
+ "hardis:org:files:export",
7563
+ "org:hardis:files:export",
7564
+ "org:files:hardis:export",
7565
+ "org:files:export:hardis",
7566
+ "hardis:files:org:export",
7567
+ "files:hardis:org:export",
7568
+ "files:org:hardis:export",
7569
+ "files:org:export:hardis",
7570
+ "hardis:files:export:org",
7571
+ "files:hardis:export:org",
7572
+ "files:export:hardis:org",
7573
+ "files:export:org:hardis",
7574
+ "hardis:org:export:files",
7575
+ "org:hardis:export:files",
7576
+ "org:export:hardis:files",
7577
+ "org:export:files:hardis",
7578
+ "hardis:export:org:files",
7579
+ "export:hardis:org:files",
7580
+ "export:org:hardis:files",
7581
+ "export:org:files:hardis",
7582
+ "hardis:export:files:org",
7583
+ "export:hardis:files:org",
7584
+ "export:files:hardis:org",
7585
+ "export:files:org:hardis"
7656
7586
  ]
7657
7587
  },
7658
- "hardis:org:diagnose:unsecure-connected-apps": {
7588
+ "hardis:org:files:import": {
7659
7589
  "aliases": [],
7660
7590
  "args": {},
7661
- "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",
7591
+ "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",
7662
7592
  "examples": [
7663
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
7593
+ "$ sf hardis:org:files:import"
7664
7594
  ],
7665
7595
  "flags": {
7666
7596
  "json": {
@@ -7678,14 +7608,21 @@
7678
7608
  "multiple": false,
7679
7609
  "type": "option"
7680
7610
  },
7681
- "outputfile": {
7682
- "char": "f",
7683
- "description": "Force the path and name of output report file. Must end with .csv",
7684
- "name": "outputfile",
7611
+ "path": {
7612
+ "char": "p",
7613
+ "description": "Path to the file export project",
7614
+ "name": "path",
7685
7615
  "hasDynamicHelp": false,
7686
7616
  "multiple": false,
7687
7617
  "type": "option"
7688
7618
  },
7619
+ "overwrite": {
7620
+ "char": "f",
7621
+ "description": "Override existing files (doubles the number of API calls)",
7622
+ "name": "overwrite",
7623
+ "allowNo": false,
7624
+ "type": "boolean"
7625
+ },
7689
7626
  "debug": {
7690
7627
  "char": "d",
7691
7628
  "description": "Activate debug mode (more logs)",
@@ -7724,13 +7661,13 @@
7724
7661
  },
7725
7662
  "hasDynamicHelp": true,
7726
7663
  "hiddenAliases": [],
7727
- "id": "hardis:org:diagnose:unsecure-connected-apps",
7664
+ "id": "hardis:org:files:import",
7728
7665
  "pluginAlias": "sfdx-hardis",
7729
7666
  "pluginName": "sfdx-hardis",
7730
7667
  "pluginType": "core",
7731
7668
  "strict": true,
7732
7669
  "enableJsonFlag": true,
7733
- "title": "Detect Unsecured Connected Apps",
7670
+ "title": "Import files",
7734
7671
  "requiresProject": false,
7735
7672
  "isESM": true,
7736
7673
  "relativePath": [
@@ -7738,44 +7675,45 @@
7738
7675
  "commands",
7739
7676
  "hardis",
7740
7677
  "org",
7741
- "diagnose",
7742
- "unsecure-connected-apps.js"
7678
+ "files",
7679
+ "import.js"
7743
7680
  ],
7744
7681
  "aliasPermutations": [],
7745
7682
  "permutations": [
7746
- "hardis:org:diagnose:unsecure-connected-apps",
7747
- "org:hardis:diagnose:unsecure-connected-apps",
7748
- "org:diagnose:hardis:unsecure-connected-apps",
7749
- "org:diagnose:unsecure-connected-apps:hardis",
7750
- "hardis:diagnose:org:unsecure-connected-apps",
7751
- "diagnose:hardis:org:unsecure-connected-apps",
7752
- "diagnose:org:hardis:unsecure-connected-apps",
7753
- "diagnose:org:unsecure-connected-apps:hardis",
7754
- "hardis:diagnose:unsecure-connected-apps:org",
7755
- "diagnose:hardis:unsecure-connected-apps:org",
7756
- "diagnose:unsecure-connected-apps:hardis:org",
7757
- "diagnose:unsecure-connected-apps:org:hardis",
7758
- "hardis:org:unsecure-connected-apps:diagnose",
7759
- "org:hardis:unsecure-connected-apps:diagnose",
7760
- "org:unsecure-connected-apps:hardis:diagnose",
7761
- "org:unsecure-connected-apps:diagnose:hardis",
7762
- "hardis:unsecure-connected-apps:org:diagnose",
7763
- "unsecure-connected-apps:hardis:org:diagnose",
7764
- "unsecure-connected-apps:org:hardis:diagnose",
7765
- "unsecure-connected-apps:org:diagnose:hardis",
7766
- "hardis:unsecure-connected-apps:diagnose:org",
7767
- "unsecure-connected-apps:hardis:diagnose:org",
7768
- "unsecure-connected-apps:diagnose:hardis:org",
7769
- "unsecure-connected-apps:diagnose:org:hardis"
7683
+ "hardis:org:files:import",
7684
+ "org:hardis:files:import",
7685
+ "org:files:hardis:import",
7686
+ "org:files:import:hardis",
7687
+ "hardis:files:org:import",
7688
+ "files:hardis:org:import",
7689
+ "files:org:hardis:import",
7690
+ "files:org:import:hardis",
7691
+ "hardis:files:import:org",
7692
+ "files:hardis:import:org",
7693
+ "files:import:hardis:org",
7694
+ "files:import:org:hardis",
7695
+ "hardis:org:import:files",
7696
+ "org:hardis:import:files",
7697
+ "org:import:hardis:files",
7698
+ "org:import:files:hardis",
7699
+ "hardis:import:org:files",
7700
+ "import:hardis:org:files",
7701
+ "import:org:hardis:files",
7702
+ "import:org:files:hardis",
7703
+ "hardis:import:files:org",
7704
+ "import:hardis:files:org",
7705
+ "import:files:hardis:org",
7706
+ "import:files:org:hardis"
7770
7707
  ]
7771
7708
  },
7772
- "hardis:org:diagnose:unused-apex-classes": {
7709
+ "hardis:org:generate:packagexmlfull": {
7773
7710
  "aliases": [],
7774
7711
  "args": {},
7775
- "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",
7712
+ "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",
7776
7713
  "examples": [
7777
- "$ sf hardis:org:diagnose:unused-apex-classes",
7778
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
7714
+ "$ sf hardis:org:generate:packagexmlfull",
7715
+ "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
7716
+ "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
7779
7717
  ],
7780
7718
  "flags": {
7781
7719
  "json": {
@@ -7794,21 +7732,12 @@
7794
7732
  "type": "option"
7795
7733
  },
7796
7734
  "outputfile": {
7797
- "char": "f",
7798
- "description": "Force the path and name of output report file. Must end with .csv",
7735
+ "description": "Output package.xml file",
7799
7736
  "name": "outputfile",
7800
7737
  "hasDynamicHelp": false,
7801
7738
  "multiple": false,
7802
7739
  "type": "option"
7803
7740
  },
7804
- "days": {
7805
- "char": "t",
7806
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7807
- "name": "days",
7808
- "hasDynamicHelp": false,
7809
- "multiple": false,
7810
- "type": "option"
7811
- },
7812
7741
  "debug": {
7813
7742
  "char": "d",
7814
7743
  "description": "Activate debug mode (more logs)",
@@ -7816,6 +7745,13 @@
7816
7745
  "allowNo": false,
7817
7746
  "type": "boolean"
7818
7747
  },
7748
+ "no-prompt": {
7749
+ "char": "n",
7750
+ "description": "Do not prompt for org username, use the default one",
7751
+ "name": "no-prompt",
7752
+ "allowNo": false,
7753
+ "type": "boolean"
7754
+ },
7819
7755
  "websocket": {
7820
7756
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
7821
7757
  "name": "websocket",
@@ -7847,13 +7783,13 @@
7847
7783
  },
7848
7784
  "hasDynamicHelp": true,
7849
7785
  "hiddenAliases": [],
7850
- "id": "hardis:org:diagnose:unused-apex-classes",
7786
+ "id": "hardis:org:generate:packagexmlfull",
7851
7787
  "pluginAlias": "sfdx-hardis",
7852
7788
  "pluginName": "sfdx-hardis",
7853
7789
  "pluginType": "core",
7854
7790
  "strict": true,
7855
7791
  "enableJsonFlag": true,
7856
- "title": "Detect unused Apex classes in an org",
7792
+ "title": "Generate Full Org package.xml",
7857
7793
  "requiresProject": false,
7858
7794
  "isESM": true,
7859
7795
  "relativePath": [
@@ -7861,43 +7797,43 @@
7861
7797
  "commands",
7862
7798
  "hardis",
7863
7799
  "org",
7864
- "diagnose",
7865
- "unused-apex-classes.js"
7800
+ "generate",
7801
+ "packagexmlfull.js"
7866
7802
  ],
7867
7803
  "aliasPermutations": [],
7868
7804
  "permutations": [
7869
- "hardis:org:diagnose:unused-apex-classes",
7870
- "org:hardis:diagnose:unused-apex-classes",
7871
- "org:diagnose:hardis:unused-apex-classes",
7872
- "org:diagnose:unused-apex-classes:hardis",
7873
- "hardis:diagnose:org:unused-apex-classes",
7874
- "diagnose:hardis:org:unused-apex-classes",
7875
- "diagnose:org:hardis:unused-apex-classes",
7876
- "diagnose:org:unused-apex-classes:hardis",
7877
- "hardis:diagnose:unused-apex-classes:org",
7878
- "diagnose:hardis:unused-apex-classes:org",
7879
- "diagnose:unused-apex-classes:hardis:org",
7880
- "diagnose:unused-apex-classes:org:hardis",
7881
- "hardis:org:unused-apex-classes:diagnose",
7882
- "org:hardis:unused-apex-classes:diagnose",
7883
- "org:unused-apex-classes:hardis:diagnose",
7884
- "org:unused-apex-classes:diagnose:hardis",
7885
- "hardis:unused-apex-classes:org:diagnose",
7886
- "unused-apex-classes:hardis:org:diagnose",
7887
- "unused-apex-classes:org:hardis:diagnose",
7888
- "unused-apex-classes:org:diagnose:hardis",
7889
- "hardis:unused-apex-classes:diagnose:org",
7890
- "unused-apex-classes:hardis:diagnose:org",
7891
- "unused-apex-classes:diagnose:hardis:org",
7892
- "unused-apex-classes:diagnose:org:hardis"
7805
+ "hardis:org:generate:packagexmlfull",
7806
+ "org:hardis:generate:packagexmlfull",
7807
+ "org:generate:hardis:packagexmlfull",
7808
+ "org:generate:packagexmlfull:hardis",
7809
+ "hardis:generate:org:packagexmlfull",
7810
+ "generate:hardis:org:packagexmlfull",
7811
+ "generate:org:hardis:packagexmlfull",
7812
+ "generate:org:packagexmlfull:hardis",
7813
+ "hardis:generate:packagexmlfull:org",
7814
+ "generate:hardis:packagexmlfull:org",
7815
+ "generate:packagexmlfull:hardis:org",
7816
+ "generate:packagexmlfull:org:hardis",
7817
+ "hardis:org:packagexmlfull:generate",
7818
+ "org:hardis:packagexmlfull:generate",
7819
+ "org:packagexmlfull:hardis:generate",
7820
+ "org:packagexmlfull:generate:hardis",
7821
+ "hardis:packagexmlfull:org:generate",
7822
+ "packagexmlfull:hardis:org:generate",
7823
+ "packagexmlfull:org:hardis:generate",
7824
+ "packagexmlfull:org:generate:hardis",
7825
+ "hardis:packagexmlfull:generate:org",
7826
+ "packagexmlfull:hardis:generate:org",
7827
+ "packagexmlfull:generate:hardis:org",
7828
+ "packagexmlfull:generate:org:hardis"
7893
7829
  ]
7894
7830
  },
7895
- "hardis:org:diagnose:unused-connected-apps": {
7831
+ "hardis:org:monitor:all": {
7896
7832
  "aliases": [],
7897
7833
  "args": {},
7898
- "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",
7834
+ "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",
7899
7835
  "examples": [
7900
- "$ sf hardis:org:diagnose:unused-connected-apps"
7836
+ "$ sf hardis:org:monitor:all"
7901
7837
  ],
7902
7838
  "flags": {
7903
7839
  "json": {
@@ -7915,14 +7851,6 @@
7915
7851
  "multiple": false,
7916
7852
  "type": "option"
7917
7853
  },
7918
- "outputfile": {
7919
- "char": "f",
7920
- "description": "Force the path and name of output report file. Must end with .csv",
7921
- "name": "outputfile",
7922
- "hasDynamicHelp": false,
7923
- "multiple": false,
7924
- "type": "option"
7925
- },
7926
7854
  "debug": {
7927
7855
  "char": "d",
7928
7856
  "description": "Activate debug mode (more logs)",
@@ -7961,364 +7889,159 @@
7961
7889
  },
7962
7890
  "hasDynamicHelp": true,
7963
7891
  "hiddenAliases": [],
7964
- "id": "hardis:org:diagnose:unused-connected-apps",
7892
+ "id": "hardis:org:monitor:all",
7965
7893
  "pluginAlias": "sfdx-hardis",
7966
7894
  "pluginName": "sfdx-hardis",
7967
7895
  "pluginType": "core",
7968
7896
  "strict": true,
7969
7897
  "enableJsonFlag": true,
7970
- "title": "Unused Connected Apps in an org",
7971
- "allowedInactiveConnectedApps": [
7972
- "Ant Migration Tool",
7973
- "Chatter Desktop",
7974
- "Chatter Mobile for BlackBerry",
7975
- "Force.com IDE",
7976
- "OIQ_Integration",
7977
- "Salesforce CLI",
7978
- "Salesforce Files",
7979
- "Salesforce Mobile Dashboards",
7980
- "Salesforce Touch",
7981
- "Salesforce for Outlook",
7982
- "SalesforceA",
7983
- "SalesforceA for Android",
7984
- "SalesforceA for iOS",
7985
- "SalesforceDX Namespace Registry",
7986
- "SalesforceIQ"
7987
- ],
7988
- "requiresProject": false,
7989
- "isESM": true,
7990
- "relativePath": [
7991
- "lib",
7992
- "commands",
7993
- "hardis",
7994
- "org",
7995
- "diagnose",
7996
- "unused-connected-apps.js"
7997
- ],
7998
- "aliasPermutations": [],
7999
- "permutations": [
8000
- "hardis:org:diagnose:unused-connected-apps",
8001
- "org:hardis:diagnose:unused-connected-apps",
8002
- "org:diagnose:hardis:unused-connected-apps",
8003
- "org:diagnose:unused-connected-apps:hardis",
8004
- "hardis:diagnose:org:unused-connected-apps",
8005
- "diagnose:hardis:org:unused-connected-apps",
8006
- "diagnose:org:hardis:unused-connected-apps",
8007
- "diagnose:org:unused-connected-apps:hardis",
8008
- "hardis:diagnose:unused-connected-apps:org",
8009
- "diagnose:hardis:unused-connected-apps:org",
8010
- "diagnose:unused-connected-apps:hardis:org",
8011
- "diagnose:unused-connected-apps:org:hardis",
8012
- "hardis:org:unused-connected-apps:diagnose",
8013
- "org:hardis:unused-connected-apps:diagnose",
8014
- "org:unused-connected-apps:hardis:diagnose",
8015
- "org:unused-connected-apps:diagnose:hardis",
8016
- "hardis:unused-connected-apps:org:diagnose",
8017
- "unused-connected-apps:hardis:org:diagnose",
8018
- "unused-connected-apps:org:hardis:diagnose",
8019
- "unused-connected-apps:org:diagnose:hardis",
8020
- "hardis:unused-connected-apps:diagnose:org",
8021
- "unused-connected-apps:hardis:diagnose:org",
8022
- "unused-connected-apps:diagnose:hardis:org",
8023
- "unused-connected-apps:diagnose:org:hardis"
8024
- ]
8025
- },
8026
- "hardis:org:diagnose:unusedlicenses": {
8027
- "aliases": [],
8028
- "args": {},
8029
- "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",
8030
- "examples": [
8031
- "$ sf hardis:org:diagnose:unusedlicenses",
8032
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
8033
- ],
8034
- "flags": {
8035
- "json": {
8036
- "description": "Format output as json.",
8037
- "helpGroup": "GLOBAL",
8038
- "name": "json",
8039
- "allowNo": false,
8040
- "type": "boolean"
8041
- },
8042
- "flags-dir": {
8043
- "helpGroup": "GLOBAL",
8044
- "name": "flags-dir",
8045
- "summary": "Import flag values from a directory.",
8046
- "hasDynamicHelp": false,
8047
- "multiple": false,
8048
- "type": "option"
8049
- },
8050
- "outputfile": {
8051
- "char": "f",
8052
- "description": "Force the path and name of output report file. Must end with .csv",
8053
- "name": "outputfile",
8054
- "hasDynamicHelp": false,
8055
- "multiple": false,
8056
- "type": "option"
7898
+ "title": "Monitor org",
7899
+ "monitoringCommandsDefault": [
7900
+ {
7901
+ "key": "AUDIT_TRAIL",
7902
+ "title": "Detect suspect setup actions in major org",
7903
+ "command": "sf hardis:org:diagnose:audittrail",
7904
+ "frequency": "daily"
8057
7905
  },
8058
- "debug": {
8059
- "char": "d",
8060
- "description": "Activate debug mode (more logs)",
8061
- "name": "debug",
8062
- "allowNo": false,
8063
- "type": "boolean"
7906
+ {
7907
+ "key": "LEGACY_API",
7908
+ "title": "Detect calls to deprecated API versions",
7909
+ "command": "sf hardis:org:diagnose:legacyapi",
7910
+ "frequency": "daily"
8064
7911
  },
8065
- "websocket": {
8066
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8067
- "name": "websocket",
8068
- "hasDynamicHelp": false,
8069
- "multiple": false,
8070
- "type": "option"
7912
+ {
7913
+ "key": "ORG_LIMITS",
7914
+ "title": "Detect if org limits are close to be reached",
7915
+ "command": "sf hardis:org:monitor:limits",
7916
+ "frequency": "daily"
8071
7917
  },
8072
- "skipauth": {
8073
- "description": "Skip authentication check when a default username is required",
8074
- "name": "skipauth",
8075
- "allowNo": false,
8076
- "type": "boolean"
7918
+ {
7919
+ "key": "UNSECURED_CONNECTED_APPS",
7920
+ "title": "Detect unsecured Connected Apps in an org",
7921
+ "command": "sf hardis:org:diagnose:unsecure-connected-apps",
7922
+ "frequency": "daily"
8077
7923
  },
8078
- "target-org": {
8079
- "aliases": [
8080
- "targetusername",
8081
- "u"
8082
- ],
8083
- "char": "o",
8084
- "deprecateAliases": true,
8085
- "name": "target-org",
8086
- "noCacheDefault": true,
8087
- "required": true,
8088
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8089
- "hasDynamicHelp": true,
8090
- "multiple": false,
8091
- "type": "option"
8092
- }
8093
- },
8094
- "hasDynamicHelp": true,
8095
- "hiddenAliases": [],
8096
- "id": "hardis:org:diagnose:unusedlicenses",
8097
- "pluginAlias": "sfdx-hardis",
8098
- "pluginName": "sfdx-hardis",
8099
- "pluginType": "core",
8100
- "strict": true,
8101
- "enableJsonFlag": true,
8102
- "title": "Detect unused Permission Set Licenses (beta)",
8103
- "requiresProject": false,
8104
- "additionalPermissionSetsToAlwaysGet": [
8105
- "Sales_User"
8106
- ],
8107
- "permSetsPermSetLicenses": [
8108
7924
  {
8109
- "permSet": "Sales_User",
8110
- "permSetLicense": "SalesUserPsl"
8111
- }
8112
- ],
8113
- "profilesPermissionSetLicenses": [
7925
+ "key": "LICENSES",
7926
+ "title": "Extract licenses information",
7927
+ "command": "sf hardis:org:diagnose:licenses",
7928
+ "frequency": "weekly"
7929
+ },
8114
7930
  {
8115
- "profile": "Salesforce API Only",
8116
- "permSetLicense": "SalesforceAPIIntegrationPsl"
8117
- }
8118
- ],
8119
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
8120
- "IdentityConnect"
8121
- ],
8122
- "isESM": true,
8123
- "relativePath": [
8124
- "lib",
8125
- "commands",
8126
- "hardis",
8127
- "org",
8128
- "diagnose",
8129
- "unusedlicenses.js"
8130
- ],
8131
- "aliasPermutations": [],
8132
- "permutations": [
8133
- "hardis:org:diagnose:unusedlicenses",
8134
- "org:hardis:diagnose:unusedlicenses",
8135
- "org:diagnose:hardis:unusedlicenses",
8136
- "org:diagnose:unusedlicenses:hardis",
8137
- "hardis:diagnose:org:unusedlicenses",
8138
- "diagnose:hardis:org:unusedlicenses",
8139
- "diagnose:org:hardis:unusedlicenses",
8140
- "diagnose:org:unusedlicenses:hardis",
8141
- "hardis:diagnose:unusedlicenses:org",
8142
- "diagnose:hardis:unusedlicenses:org",
8143
- "diagnose:unusedlicenses:hardis:org",
8144
- "diagnose:unusedlicenses:org:hardis",
8145
- "hardis:org:unusedlicenses:diagnose",
8146
- "org:hardis:unusedlicenses:diagnose",
8147
- "org:unusedlicenses:hardis:diagnose",
8148
- "org:unusedlicenses:diagnose:hardis",
8149
- "hardis:unusedlicenses:org:diagnose",
8150
- "unusedlicenses:hardis:org:diagnose",
8151
- "unusedlicenses:org:hardis:diagnose",
8152
- "unusedlicenses:org:diagnose:hardis",
8153
- "hardis:unusedlicenses:diagnose:org",
8154
- "unusedlicenses:hardis:diagnose:org",
8155
- "unusedlicenses:diagnose:hardis:org",
8156
- "unusedlicenses:diagnose:org:hardis"
8157
- ]
8158
- },
8159
- "hardis:org:diagnose:unusedusers": {
8160
- "aliases": [],
8161
- "args": {},
8162
- "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>",
8163
- "examples": [
8164
- "$ sf hardis:org:diagnose:unusedusers",
8165
- "$ sf hardis:org:diagnose:unusedusers --days 365",
8166
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
8167
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
8168
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
8169
- ],
8170
- "flags": {
8171
- "json": {
8172
- "description": "Format output as json.",
8173
- "helpGroup": "GLOBAL",
8174
- "name": "json",
8175
- "allowNo": false,
8176
- "type": "boolean"
7931
+ "key": "LINT_ACCESS",
7932
+ "title": "Detect custom elements with no access rights defined in permission sets",
7933
+ "command": "sf hardis:lint:access",
7934
+ "frequency": "weekly"
8177
7935
  },
8178
- "flags-dir": {
8179
- "helpGroup": "GLOBAL",
8180
- "name": "flags-dir",
8181
- "summary": "Import flag values from a directory.",
8182
- "hasDynamicHelp": false,
8183
- "multiple": false,
8184
- "type": "option"
7936
+ {
7937
+ "key": "UNUSED_LICENSES",
7938
+ "title": "Detect permission set licenses that are assigned to users that do not need them",
7939
+ "command": "sf hardis:org:diagnose:unusedlicenses",
7940
+ "frequency": "weekly"
8185
7941
  },
8186
- "outputfile": {
8187
- "char": "f",
8188
- "description": "Force the path and name of output report file. Must end with .csv",
8189
- "name": "outputfile",
8190
- "hasDynamicHelp": false,
8191
- "multiple": false,
8192
- "type": "option"
7942
+ {
7943
+ "key": "UNUSED_USERS",
7944
+ "title": "Detect active users without recent logins",
7945
+ "command": "sf hardis:org:diagnose:unusedusers",
7946
+ "frequency": "weekly"
8193
7947
  },
8194
- "days": {
8195
- "char": "t",
8196
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
8197
- "name": "days",
8198
- "hasDynamicHelp": false,
8199
- "multiple": false,
8200
- "type": "option"
7948
+ {
7949
+ "key": "ACTIVE_USERS",
7950
+ "title": "Detect active users with recent logins",
7951
+ "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
7952
+ "frequency": "weekly"
8201
7953
  },
8202
- "licensetypes": {
8203
- "char": "l",
8204
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
8205
- "name": "licensetypes",
8206
- "hasDynamicHelp": false,
8207
- "multiple": false,
8208
- "options": [
8209
- "all",
8210
- "all-crm",
8211
- "all-paying"
8212
- ],
8213
- "type": "option"
7954
+ {
7955
+ "key": "ORG_INFO",
7956
+ "title": "Get org info + SF instance info + next major upgrade date",
7957
+ "command": "sf hardis:org:diagnose:instanceupgrade",
7958
+ "frequency": "weekly"
8214
7959
  },
8215
- "licenseidentifiers": {
8216
- "char": "i",
8217
- "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",
8218
- "name": "licenseidentifiers",
8219
- "hasDynamicHelp": false,
8220
- "multiple": false,
8221
- "type": "option"
7960
+ {
7961
+ "key": "RELEASE_UPDATES",
7962
+ "title": "Gather warnings about incoming and overdue Release Updates",
7963
+ "command": "sf hardis:org:diagnose:releaseupdates",
7964
+ "frequency": "weekly"
8222
7965
  },
8223
- "returnactiveusers": {
8224
- "description": "Inverts the command by returning the active users",
8225
- "name": "returnactiveusers",
8226
- "allowNo": false,
8227
- "type": "boolean"
7966
+ {
7967
+ "key": "UNUSED_METADATAS",
7968
+ "title": "Detect custom labels and custom permissions that are not in use",
7969
+ "command": "sf hardis:lint:unusedmetadatas",
7970
+ "frequency": "weekly"
8228
7971
  },
8229
- "debug": {
8230
- "char": "d",
8231
- "description": "Activate debug mode (more logs)",
8232
- "name": "debug",
8233
- "allowNo": false,
8234
- "type": "boolean"
7972
+ {
7973
+ "key": "UNUSED_APEX_CLASSES",
7974
+ "title": "Detect unused Apex classes in an org",
7975
+ "command": "sf hardis:org:diagnose:unused-apex-classes",
7976
+ "frequency": "weekly"
8235
7977
  },
8236
- "websocket": {
8237
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8238
- "name": "websocket",
8239
- "hasDynamicHelp": false,
8240
- "multiple": false,
8241
- "type": "option"
7978
+ {
7979
+ "key": "CONNECTED_APPS",
7980
+ "title": "Detect unused Connected Apps in an org",
7981
+ "command": "sf hardis:org:diagnose:unused-connected-apps",
7982
+ "frequency": "weekly"
8242
7983
  },
8243
- "skipauth": {
8244
- "description": "Skip authentication check when a default username is required",
8245
- "name": "skipauth",
8246
- "allowNo": false,
8247
- "type": "boolean"
7984
+ {
7985
+ "key": "METADATA_STATUS",
7986
+ "title": "Detect inactive metadata",
7987
+ "command": "sf hardis:lint:metadatastatus",
7988
+ "frequency": "weekly"
8248
7989
  },
8249
- "target-org": {
8250
- "aliases": [
8251
- "targetusername",
8252
- "u"
8253
- ],
8254
- "char": "o",
8255
- "deprecateAliases": true,
8256
- "name": "target-org",
8257
- "noCacheDefault": true,
8258
- "required": true,
8259
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8260
- "hasDynamicHelp": true,
8261
- "multiple": false,
8262
- "type": "option"
7990
+ {
7991
+ "key": "MISSING_ATTRIBUTES",
7992
+ "title": "Detect missing description on custom field",
7993
+ "command": "sf hardis:lint:missingattributes",
7994
+ "frequency": "weekly"
8263
7995
  }
8264
- },
8265
- "hasDynamicHelp": true,
8266
- "hiddenAliases": [],
8267
- "id": "hardis:org:diagnose:unusedusers",
8268
- "pluginAlias": "sfdx-hardis",
8269
- "pluginName": "sfdx-hardis",
8270
- "pluginType": "core",
8271
- "strict": true,
8272
- "enableJsonFlag": true,
8273
- "title": "Detect unused Users in Salesforce",
8274
- "requiresProject": false,
7996
+ ],
7997
+ "requiresProject": true,
7998
+ "triggerNotification": true,
8275
7999
  "isESM": true,
8276
8000
  "relativePath": [
8277
8001
  "lib",
8278
8002
  "commands",
8279
8003
  "hardis",
8280
8004
  "org",
8281
- "diagnose",
8282
- "unusedusers.js"
8005
+ "monitor",
8006
+ "all.js"
8283
8007
  ],
8284
8008
  "aliasPermutations": [],
8285
8009
  "permutations": [
8286
- "hardis:org:diagnose:unusedusers",
8287
- "org:hardis:diagnose:unusedusers",
8288
- "org:diagnose:hardis:unusedusers",
8289
- "org:diagnose:unusedusers:hardis",
8290
- "hardis:diagnose:org:unusedusers",
8291
- "diagnose:hardis:org:unusedusers",
8292
- "diagnose:org:hardis:unusedusers",
8293
- "diagnose:org:unusedusers:hardis",
8294
- "hardis:diagnose:unusedusers:org",
8295
- "diagnose:hardis:unusedusers:org",
8296
- "diagnose:unusedusers:hardis:org",
8297
- "diagnose:unusedusers:org:hardis",
8298
- "hardis:org:unusedusers:diagnose",
8299
- "org:hardis:unusedusers:diagnose",
8300
- "org:unusedusers:hardis:diagnose",
8301
- "org:unusedusers:diagnose:hardis",
8302
- "hardis:unusedusers:org:diagnose",
8303
- "unusedusers:hardis:org:diagnose",
8304
- "unusedusers:org:hardis:diagnose",
8305
- "unusedusers:org:diagnose:hardis",
8306
- "hardis:unusedusers:diagnose:org",
8307
- "unusedusers:hardis:diagnose:org",
8308
- "unusedusers:diagnose:hardis:org",
8309
- "unusedusers:diagnose:org:hardis"
8010
+ "hardis:org:monitor:all",
8011
+ "org:hardis:monitor:all",
8012
+ "org:monitor:hardis:all",
8013
+ "org:monitor:all:hardis",
8014
+ "hardis:monitor:org:all",
8015
+ "monitor:hardis:org:all",
8016
+ "monitor:org:hardis:all",
8017
+ "monitor:org:all:hardis",
8018
+ "hardis:monitor:all:org",
8019
+ "monitor:hardis:all:org",
8020
+ "monitor:all:hardis:org",
8021
+ "monitor:all:org:hardis",
8022
+ "hardis:org:all:monitor",
8023
+ "org:hardis:all:monitor",
8024
+ "org:all:hardis:monitor",
8025
+ "org:all:monitor:hardis",
8026
+ "hardis:all:org:monitor",
8027
+ "all:hardis:org:monitor",
8028
+ "all:org:hardis:monitor",
8029
+ "all:org:monitor:hardis",
8030
+ "hardis:all:monitor:org",
8031
+ "all:hardis:monitor:org",
8032
+ "all:monitor:hardis:org",
8033
+ "all:monitor:org:hardis"
8310
8034
  ]
8311
8035
  },
8312
- "hardis:org:refresh:after-refresh": {
8036
+ "hardis:org:monitor:backup": {
8313
8037
  "aliases": [],
8314
8038
  "args": {},
8315
- "description": "\n## Command Behavior\n\n**Restores all previously backed-up Connected Apps (including Consumer Secrets), certificates, custom settings, records and other metadata to a Salesforce org after a sandbox refresh.**\n\nThis command is the second step in the sandbox refresh process. It scans the backup folder created before the refresh, allows interactive or flag-driven selection of items to restore, and automates cleanup and redeployment to the refreshed org while preserving credentials and configuration.\n\nKey functionalities:\n\n- **Choose a backup to restore:** Lets you pick the saved sandbox project that contains the artifacts to restore.\n- **Select which items to restore:** Finds Connected App XMLs, certificates, custom settings and other artifacts and lets you pick what to restore (or restore all).\n- **Safety checks and validation:** Confirms files exist and prompts before making changes to the target org.\n- **Prepare org for restore:** Optionally cleans up existing Connected Apps so saved apps can be re-deployed without conflict.\n- **Redeploy saved artifacts:** Restores Connected Apps (with saved secrets), certificates, SAML SSO configs, custom settings and other metadata.\n- **Handle SAML configs:** Cleans and updates SAML XML files and helps you choose certificates to wire into restored configs.\n- **Restore records:** Optionally runs data import from selected SFDMU workspaces to restore record data.\n- **Reporting & persistence:** Sends restore reports and can update project config to record what was restored.\n\nThis command is part of [sfdx-hardis Sandbox Refresh](https://sfdx-hardis.cloudity.com/salesforce-sandbox-refresh/) and is intended to be run after a sandbox refresh to re-apply saved metadata, credentials and data.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\n- **Backup Folder Handling:** Reads the immediate subfolders of `scripts/sandbox-refresh/` and validates the chosen project contains the expected `manifest/` and `force-app` layout.\n- **Metadata & Deployment APIs:** Uses `sf project deploy start --manifest` for package-based deploys, `sf project deploy start --metadata-dir` for MDAPI artifacts (certificates), and utility functions for Connected App deployment that preserve consumer secrets.\n- **SAML Handling:** Queries active certificates via tooling API, updates SAML XML files, and deploys using `sf project deploy start -m SamlSsoConfig`.\n- **Records Handling:** Uses interactive selection of SFDMU workspaces and runs data import utilities to restore records.\n- **Error Handling & Summary:** Aggregates results, logs success/warnings/errors, and returns a structured result indicating which items were restored and any failures.\n\n</details>\n",
8039
+ "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",
8316
8040
  "examples": [
8317
- "$ sf hardis:org:refresh:after-refresh",
8318
- "$ sf hardis:org:refresh:after-refresh --name \"MyConnectedApp\" // Process specific app, no selection prompt",
8319
- "$ sf hardis:org:refresh:after-refresh --name \"App1,App2,App3\" // Process multiple apps, no selection prompt",
8320
- "$ sf hardis:org:refresh:after-refresh --all // Process all apps, no selection prompt",
8321
- "$ sf hardis:org:refresh:after-refresh --target-org myDevOrg"
8041
+ "$ sf hardis:org:monitor:backup",
8042
+ "$ sf hardis:org:monitor:backup --full",
8043
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
8044
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
8322
8045
  ],
8323
8046
  "flags": {
8324
8047
  "json": {
@@ -8336,37 +8059,67 @@
8336
8059
  "multiple": false,
8337
8060
  "type": "option"
8338
8061
  },
8339
- "target-org": {
8340
- "char": "o",
8341
- "name": "target-org",
8342
- "noCacheDefault": true,
8343
- "required": true,
8344
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8345
- "hasDynamicHelp": true,
8062
+ "full": {
8063
+ "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
8064
+ "name": "full",
8065
+ "allowNo": false,
8066
+ "type": "boolean"
8067
+ },
8068
+ "max-by-chunk": {
8069
+ "char": "m",
8070
+ "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
8071
+ "name": "max-by-chunk",
8072
+ "default": 3000,
8073
+ "hasDynamicHelp": false,
8346
8074
  "multiple": false,
8347
8075
  "type": "option"
8348
8076
  },
8349
- "name": {
8350
- "char": "n",
8351
- "description": "Connected App name(s) to process (bypasses selection prompt). For multiple apps, separate with commas (e.g., \"App1,App2\")",
8352
- "name": "name",
8353
- "summary": "Filter according to Name criteria",
8077
+ "exclude-namespaces": {
8078
+ "char": "e",
8079
+ "description": "If mode --full is activated, exclude namespaced metadatas",
8080
+ "name": "exclude-namespaces",
8081
+ "allowNo": false,
8082
+ "type": "boolean"
8083
+ },
8084
+ "full-apply-filters": {
8085
+ "char": "z",
8086
+ "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
8087
+ "name": "full-apply-filters",
8088
+ "allowNo": false,
8089
+ "type": "boolean"
8090
+ },
8091
+ "start-chunk": {
8092
+ "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
8093
+ "name": "start-chunk",
8094
+ "default": 1,
8354
8095
  "hasDynamicHelp": false,
8355
8096
  "multiple": false,
8356
8097
  "type": "option"
8357
8098
  },
8358
- "all": {
8359
- "char": "a",
8360
- "description": "If set, all Connected Apps from the local repository will be processed. Takes precedence over --name if both are specified.",
8361
- "name": "all",
8362
- "summary": "Process all Connected Apps without selection prompt",
8099
+ "skip-doc": {
8100
+ "description": "Skip the generation of project documentation at the end of the command",
8101
+ "name": "skip-doc",
8102
+ "allowNo": false,
8103
+ "type": "boolean"
8104
+ },
8105
+ "outputfile": {
8106
+ "char": "f",
8107
+ "description": "Force the path and name of output report file. Must end with .csv",
8108
+ "name": "outputfile",
8109
+ "hasDynamicHelp": false,
8110
+ "multiple": false,
8111
+ "type": "option"
8112
+ },
8113
+ "debug": {
8114
+ "char": "d",
8115
+ "description": "Activate debug mode (more logs)",
8116
+ "name": "debug",
8363
8117
  "allowNo": false,
8364
8118
  "type": "boolean"
8365
8119
  },
8366
8120
  "websocket": {
8367
- "description": "WebSocket host:port for VS Code SFDX Hardis UI integration",
8121
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8368
8122
  "name": "websocket",
8369
- "summary": "Websocket host:port for VsCode SFDX Hardis UI integration",
8370
8123
  "hasDynamicHelp": false,
8371
8124
  "multiple": false,
8372
8125
  "type": "option"
@@ -8374,68 +8127,79 @@
8374
8127
  "skipauth": {
8375
8128
  "description": "Skip authentication check when a default username is required",
8376
8129
  "name": "skipauth",
8377
- "summary": "Skip authentication check when a default username is required",
8378
8130
  "allowNo": false,
8379
8131
  "type": "boolean"
8132
+ },
8133
+ "target-org": {
8134
+ "aliases": [
8135
+ "targetusername",
8136
+ "u"
8137
+ ],
8138
+ "char": "o",
8139
+ "deprecateAliases": true,
8140
+ "name": "target-org",
8141
+ "noCacheDefault": true,
8142
+ "required": true,
8143
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8144
+ "hasDynamicHelp": true,
8145
+ "multiple": false,
8146
+ "type": "option"
8380
8147
  }
8381
8148
  },
8382
8149
  "hasDynamicHelp": true,
8383
8150
  "hiddenAliases": [],
8384
- "id": "hardis:org:refresh:after-refresh",
8151
+ "id": "hardis:org:monitor:backup",
8385
8152
  "pluginAlias": "sfdx-hardis",
8386
8153
  "pluginName": "sfdx-hardis",
8387
8154
  "pluginType": "core",
8388
8155
  "strict": true,
8389
8156
  "enableJsonFlag": true,
8390
- "title": "Restore Connected Apps after org refresh",
8157
+ "title": "Backup DX sources",
8391
8158
  "requiresProject": true,
8159
+ "triggerNotification": true,
8392
8160
  "isESM": true,
8393
8161
  "relativePath": [
8394
8162
  "lib",
8395
8163
  "commands",
8396
8164
  "hardis",
8397
8165
  "org",
8398
- "refresh",
8399
- "after-refresh.js"
8166
+ "monitor",
8167
+ "backup.js"
8400
8168
  ],
8401
8169
  "aliasPermutations": [],
8402
8170
  "permutations": [
8403
- "hardis:org:refresh:after-refresh",
8404
- "org:hardis:refresh:after-refresh",
8405
- "org:refresh:hardis:after-refresh",
8406
- "org:refresh:after-refresh:hardis",
8407
- "hardis:refresh:org:after-refresh",
8408
- "refresh:hardis:org:after-refresh",
8409
- "refresh:org:hardis:after-refresh",
8410
- "refresh:org:after-refresh:hardis",
8411
- "hardis:refresh:after-refresh:org",
8412
- "refresh:hardis:after-refresh:org",
8413
- "refresh:after-refresh:hardis:org",
8414
- "refresh:after-refresh:org:hardis",
8415
- "hardis:org:after-refresh:refresh",
8416
- "org:hardis:after-refresh:refresh",
8417
- "org:after-refresh:hardis:refresh",
8418
- "org:after-refresh:refresh:hardis",
8419
- "hardis:after-refresh:org:refresh",
8420
- "after-refresh:hardis:org:refresh",
8421
- "after-refresh:org:hardis:refresh",
8422
- "after-refresh:org:refresh:hardis",
8423
- "hardis:after-refresh:refresh:org",
8424
- "after-refresh:hardis:refresh:org",
8425
- "after-refresh:refresh:hardis:org",
8426
- "after-refresh:refresh:org:hardis"
8171
+ "hardis:org:monitor:backup",
8172
+ "org:hardis:monitor:backup",
8173
+ "org:monitor:hardis:backup",
8174
+ "org:monitor:backup:hardis",
8175
+ "hardis:monitor:org:backup",
8176
+ "monitor:hardis:org:backup",
8177
+ "monitor:org:hardis:backup",
8178
+ "monitor:org:backup:hardis",
8179
+ "hardis:monitor:backup:org",
8180
+ "monitor:hardis:backup:org",
8181
+ "monitor:backup:hardis:org",
8182
+ "monitor:backup:org:hardis",
8183
+ "hardis:org:backup:monitor",
8184
+ "org:hardis:backup:monitor",
8185
+ "org:backup:hardis:monitor",
8186
+ "org:backup:monitor:hardis",
8187
+ "hardis:backup:org:monitor",
8188
+ "backup:hardis:org:monitor",
8189
+ "backup:org:hardis:monitor",
8190
+ "backup:org:monitor:hardis",
8191
+ "hardis:backup:monitor:org",
8192
+ "backup:hardis:monitor:org",
8193
+ "backup:monitor:hardis:org",
8194
+ "backup:monitor:org:hardis"
8427
8195
  ]
8428
8196
  },
8429
- "hardis:org:refresh:before-refresh": {
8197
+ "hardis:org:monitor:limits": {
8430
8198
  "aliases": [],
8431
8199
  "args": {},
8432
- "description": "\n## Command Behavior\n\n**Backs up all Connected Apps (including Consumer Secrets), certificates, custom settings, records and other metadata from a Salesforce org before a sandbox refresh, enabling full restoration after the refresh.**\n\nThis command prepares a complete backup prior to a sandbox refresh. It creates a dedicated project under `scripts/sandbox-refresh/<sandbox-folder>`, retrieves metadata and data, attempts to capture Connected App consumer secrets, and can optionally delete the apps so they can be reuploaded after the refresh.\n\nKey functionalities:\n\n- **Create a save project:** Generates a dedicated project folder to store all artifacts for the sandbox backup.\n- **Find and select Connected Apps:** Lists Connected Apps in the org and lets you pick specific apps, use a name filter, or process all apps.\n- **Save metadata for restore:** Builds a manifest and retrieves the metadata types you choose so they can be restored after the refresh.\n- **Capture Consumer Secrets:** Attempts to capture Connected App consumer secrets automatically (opens a browser session when possible) and falls back to a short manual prompt when needed.\n- **Collect certificates:** Saves certificate files and their definitions so they can be redeployed later.\n- **Export custom settings & records:** Lets you pick custom settings to export as JSON and optionally export records using configured data workspaces.\n- **Persist choices & report:** Stores your backup choices in project config and sends report files for traceability.\n- **Optional cleanup:** Can delete backed-up Connected Apps from the org so they can be re-uploaded cleanly after the refresh.\n- **Interactive safety checks:** Prompts you to confirm package contents and other potentially destructive actions; sensible defaults are chosen where appropriate.\n\nThis command is part of [sfdx-hardis Sandbox Refresh](https://sfdx-hardis.cloudity.com/salesforce-sandbox-refresh/) and is intended to be run before a sandbox refresh so that all credentials, certificates, metadata and data can be restored afterwards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\n- **Salesforce CLI Integration:** Uses `sf org list metadata`, `sf project retrieve start`, `sf project generate`, `sf project deploy start`, and `sf data tree export`/`import` where applicable.\n- **Metadata Handling:** Writes and reads package XML files under the generated project (`manifest/`), copies MDAPI certificate artifacts into `force-app/main/default/certs`, and produces `package-metadata-to-restore.xml` for post-refresh deployment.\n- **Consumer Secret Handling:** Uses `puppeteer-core` with an executable path from `getChromeExecutablePath()` (env var `PUPPETEER_EXECUTABLE_PATH` may be required). Falls back to manual prompt when browser automation cannot be used.\n- **Data & Records:** Exports custom settings to JSON and supports exporting records through SFDMU workspaces chosen interactively.\n- **Config & Reporting:** Updates project/user config under `config/.sfdx-hardis.yml#refreshSandboxConfig` and reports artifacts to the WebSocket client.\n- **Error Handling:** Provides clear error messages and a summary response object indicating success/failure and which secrets were captured.\n\n</details>\n",
8200
+ "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",
8433
8201
  "examples": [
8434
- "$ sf hardis:org:refresh:before-refresh",
8435
- "$ sf hardis:org:refresh:before-refresh --name \"MyConnectedApp\"",
8436
- "$ sf hardis:org:refresh:before-refresh --name \"App1,App2,App3\"",
8437
- "$ sf hardis:org:refresh:before-refresh --all",
8438
- "$ sf hardis:org:refresh:before-refresh --delete"
8202
+ "$ sf hardis:org:monitor:limits"
8439
8203
  ],
8440
8204
  "flags": {
8441
8205
  "json": {
@@ -8453,38 +8217,18 @@
8453
8217
  "multiple": false,
8454
8218
  "type": "option"
8455
8219
  },
8456
- "target-org": {
8457
- "char": "o",
8458
- "name": "target-org",
8459
- "noCacheDefault": true,
8460
- "required": true,
8461
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8462
- "hasDynamicHelp": true,
8463
- "multiple": false,
8464
- "type": "option"
8465
- },
8466
- "delete": {
8467
- "char": "d",
8468
- "description": "By default, Connected Apps are not deleted from the org after saving. Set this flag to force their deletion so they will be able to be reuploaded again after refreshing the org.",
8469
- "name": "delete",
8470
- "summary": "Delete Connected Apps from org after saving",
8471
- "allowNo": false,
8472
- "type": "boolean"
8473
- },
8474
- "name": {
8475
- "char": "n",
8476
- "description": "Connected App name(s) to process. For multiple apps, separate with commas (e.g., \"App1,App2\")",
8477
- "name": "name",
8478
- "summary": "Filter according to Name criteria",
8220
+ "outputfile": {
8221
+ "char": "f",
8222
+ "description": "Force the path and name of output report file. Must end with .csv",
8223
+ "name": "outputfile",
8479
8224
  "hasDynamicHelp": false,
8480
8225
  "multiple": false,
8481
8226
  "type": "option"
8482
8227
  },
8483
- "all": {
8484
- "char": "a",
8485
- "description": "If set, all Connected Apps from the org will be processed. Takes precedence over --name if both are specified.",
8486
- "name": "all",
8487
- "summary": "Process all Connected Apps without selection prompt",
8228
+ "debug": {
8229
+ "char": "d",
8230
+ "description": "Activate debug mode (more logs)",
8231
+ "name": "debug",
8488
8232
  "allowNo": false,
8489
8233
  "type": "boolean"
8490
8234
  },
@@ -8500,52 +8244,69 @@
8500
8244
  "name": "skipauth",
8501
8245
  "allowNo": false,
8502
8246
  "type": "boolean"
8247
+ },
8248
+ "target-org": {
8249
+ "aliases": [
8250
+ "targetusername",
8251
+ "u"
8252
+ ],
8253
+ "char": "o",
8254
+ "deprecateAliases": true,
8255
+ "name": "target-org",
8256
+ "noCacheDefault": true,
8257
+ "required": true,
8258
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8259
+ "hasDynamicHelp": true,
8260
+ "multiple": false,
8261
+ "type": "option"
8503
8262
  }
8504
8263
  },
8505
8264
  "hasDynamicHelp": true,
8506
8265
  "hiddenAliases": [],
8507
- "id": "hardis:org:refresh:before-refresh",
8266
+ "id": "hardis:org:monitor:limits",
8508
8267
  "pluginAlias": "sfdx-hardis",
8509
8268
  "pluginName": "sfdx-hardis",
8510
8269
  "pluginType": "core",
8511
8270
  "strict": true,
8512
8271
  "enableJsonFlag": true,
8272
+ "title": "Check org limits",
8513
8273
  "requiresProject": true,
8274
+ "triggerNotification": true,
8514
8275
  "isESM": true,
8515
8276
  "relativePath": [
8516
8277
  "lib",
8517
8278
  "commands",
8518
8279
  "hardis",
8519
8280
  "org",
8520
- "refresh",
8521
- "before-refresh.js"
8281
+ "monitor",
8282
+ "limits.js"
8522
8283
  ],
8523
8284
  "aliasPermutations": [],
8524
8285
  "permutations": [
8525
- "hardis:org:refresh:before-refresh",
8526
- "org:hardis:refresh:before-refresh",
8527
- "org:refresh:hardis:before-refresh",
8528
- "org:refresh:before-refresh:hardis",
8529
- "hardis:refresh:org:before-refresh",
8530
- "refresh:hardis:org:before-refresh",
8531
- "refresh:org:hardis:before-refresh",
8532
- "refresh:org:before-refresh:hardis",
8533
- "hardis:refresh:before-refresh:org",
8534
- "refresh:hardis:before-refresh:org",
8535
- "refresh:before-refresh:hardis:org",
8536
- "refresh:before-refresh:org:hardis",
8537
- "hardis:org:before-refresh:refresh",
8538
- "org:hardis:before-refresh:refresh",
8539
- "org:before-refresh:hardis:refresh",
8540
- "org:before-refresh:refresh:hardis",
8541
- "hardis:before-refresh:org:refresh",
8542
- "before-refresh:hardis:org:refresh",
8543
- "before-refresh:org:hardis:refresh",
8544
- "before-refresh:org:refresh:hardis",
8545
- "hardis:before-refresh:refresh:org",
8546
- "before-refresh:hardis:refresh:org",
8547
- "before-refresh:refresh:hardis:org",
8548
- "before-refresh:refresh:org:hardis"
8286
+ "hardis:org:monitor:limits",
8287
+ "org:hardis:monitor:limits",
8288
+ "org:monitor:hardis:limits",
8289
+ "org:monitor:limits:hardis",
8290
+ "hardis:monitor:org:limits",
8291
+ "monitor:hardis:org:limits",
8292
+ "monitor:org:hardis:limits",
8293
+ "monitor:org:limits:hardis",
8294
+ "hardis:monitor:limits:org",
8295
+ "monitor:hardis:limits:org",
8296
+ "monitor:limits:hardis:org",
8297
+ "monitor:limits:org:hardis",
8298
+ "hardis:org:limits:monitor",
8299
+ "org:hardis:limits:monitor",
8300
+ "org:limits:hardis:monitor",
8301
+ "org:limits:monitor:hardis",
8302
+ "hardis:limits:org:monitor",
8303
+ "limits:hardis:org:monitor",
8304
+ "limits:org:hardis:monitor",
8305
+ "limits:org:monitor:hardis",
8306
+ "hardis:limits:monitor:org",
8307
+ "limits:hardis:monitor:org",
8308
+ "limits:monitor:hardis:org",
8309
+ "limits:monitor:org:hardis"
8549
8310
  ]
8550
8311
  },
8551
8312
  "hardis:org:purge:apexlog": {
@@ -8848,10 +8609,264 @@
8848
8609
  "multiple": false,
8849
8610
  "type": "option"
8850
8611
  },
8851
- "debug": {
8852
- "char": "d",
8853
- "description": "Activate debug mode (more logs)",
8854
- "name": "debug",
8612
+ "debug": {
8613
+ "char": "d",
8614
+ "description": "Activate debug mode (more logs)",
8615
+ "name": "debug",
8616
+ "allowNo": false,
8617
+ "type": "boolean"
8618
+ },
8619
+ "websocket": {
8620
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8621
+ "name": "websocket",
8622
+ "hasDynamicHelp": false,
8623
+ "multiple": false,
8624
+ "type": "option"
8625
+ },
8626
+ "skipauth": {
8627
+ "description": "Skip authentication check when a default username is required",
8628
+ "name": "skipauth",
8629
+ "allowNo": false,
8630
+ "type": "boolean"
8631
+ },
8632
+ "target-org": {
8633
+ "aliases": [
8634
+ "targetusername",
8635
+ "u"
8636
+ ],
8637
+ "char": "o",
8638
+ "deprecateAliases": true,
8639
+ "name": "target-org",
8640
+ "noCacheDefault": true,
8641
+ "required": true,
8642
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8643
+ "hasDynamicHelp": true,
8644
+ "multiple": false,
8645
+ "type": "option"
8646
+ }
8647
+ },
8648
+ "hasDynamicHelp": true,
8649
+ "hiddenAliases": [],
8650
+ "id": "hardis:org:purge:profile",
8651
+ "pluginAlias": "sfdx-hardis",
8652
+ "pluginName": "sfdx-hardis",
8653
+ "pluginType": "core",
8654
+ "strict": true,
8655
+ "enableJsonFlag": true,
8656
+ "title": "Remove PS attributes from Profile",
8657
+ "isESM": true,
8658
+ "relativePath": [
8659
+ "lib",
8660
+ "commands",
8661
+ "hardis",
8662
+ "org",
8663
+ "purge",
8664
+ "profile.js"
8665
+ ],
8666
+ "aliasPermutations": [],
8667
+ "permutations": [
8668
+ "hardis:org:purge:profile",
8669
+ "org:hardis:purge:profile",
8670
+ "org:purge:hardis:profile",
8671
+ "org:purge:profile:hardis",
8672
+ "hardis:purge:org:profile",
8673
+ "purge:hardis:org:profile",
8674
+ "purge:org:hardis:profile",
8675
+ "purge:org:profile:hardis",
8676
+ "hardis:purge:profile:org",
8677
+ "purge:hardis:profile:org",
8678
+ "purge:profile:hardis:org",
8679
+ "purge:profile:org:hardis",
8680
+ "hardis:org:profile:purge",
8681
+ "org:hardis:profile:purge",
8682
+ "org:profile:hardis:purge",
8683
+ "org:profile:purge:hardis",
8684
+ "hardis:profile:org:purge",
8685
+ "profile:hardis:org:purge",
8686
+ "profile:org:hardis:purge",
8687
+ "profile:org:purge:hardis",
8688
+ "hardis:profile:purge:org",
8689
+ "profile:hardis:purge:org",
8690
+ "profile:purge:hardis:org",
8691
+ "profile:purge:org:hardis"
8692
+ ]
8693
+ },
8694
+ "hardis:org:refresh:after-refresh": {
8695
+ "aliases": [],
8696
+ "args": {},
8697
+ "description": "\n## Command Behavior\n\n**Restores all previously backed-up Connected Apps (including Consumer Secrets), certificates, custom settings, records and other metadata to a Salesforce org after a sandbox refresh.**\n\nThis command is the second step in the sandbox refresh process. It scans the backup folder created before the refresh, allows interactive or flag-driven selection of items to restore, and automates cleanup and redeployment to the refreshed org while preserving credentials and configuration.\n\nKey functionalities:\n\n- **Choose a backup to restore:** Lets you pick the saved sandbox project that contains the artifacts to restore.\n- **Select which items to restore:** Finds Connected App XMLs, certificates, custom settings and other artifacts and lets you pick what to restore (or restore all).\n- **Safety checks and validation:** Confirms files exist and prompts before making changes to the target org.\n- **Prepare org for restore:** Optionally cleans up existing Connected Apps so saved apps can be re-deployed without conflict.\n- **Redeploy saved artifacts:** Restores Connected Apps (with saved secrets), certificates, SAML SSO configs, custom settings and other metadata.\n- **Handle SAML configs:** Cleans and updates SAML XML files and helps you choose certificates to wire into restored configs.\n- **Restore records:** Optionally runs data import from selected SFDMU workspaces to restore record data.\n- **Reporting & persistence:** Sends restore reports and can update project config to record what was restored.\n\nThis command is part of [sfdx-hardis Sandbox Refresh](https://sfdx-hardis.cloudity.com/salesforce-sandbox-refresh/) and is intended to be run after a sandbox refresh to re-apply saved metadata, credentials and data.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\n- **Backup Folder Handling:** Reads the immediate subfolders of `scripts/sandbox-refresh/` and validates the chosen project contains the expected `manifest/` and `force-app` layout.\n- **Metadata & Deployment APIs:** Uses `sf project deploy start --manifest` for package-based deploys, `sf project deploy start --metadata-dir` for MDAPI artifacts (certificates), and utility functions for Connected App deployment that preserve consumer secrets.\n- **SAML Handling:** Queries active certificates via tooling API, updates SAML XML files, and deploys using `sf project deploy start -m SamlSsoConfig`.\n- **Records Handling:** Uses interactive selection of SFDMU workspaces and runs data import utilities to restore records.\n- **Error Handling & Summary:** Aggregates results, logs success/warnings/errors, and returns a structured result indicating which items were restored and any failures.\n\n</details>\n",
8698
+ "examples": [
8699
+ "$ sf hardis:org:refresh:after-refresh",
8700
+ "$ sf hardis:org:refresh:after-refresh --name \"MyConnectedApp\" // Process specific app, no selection prompt",
8701
+ "$ sf hardis:org:refresh:after-refresh --name \"App1,App2,App3\" // Process multiple apps, no selection prompt",
8702
+ "$ sf hardis:org:refresh:after-refresh --all // Process all apps, no selection prompt",
8703
+ "$ sf hardis:org:refresh:after-refresh --target-org myDevOrg"
8704
+ ],
8705
+ "flags": {
8706
+ "json": {
8707
+ "description": "Format output as json.",
8708
+ "helpGroup": "GLOBAL",
8709
+ "name": "json",
8710
+ "allowNo": false,
8711
+ "type": "boolean"
8712
+ },
8713
+ "flags-dir": {
8714
+ "helpGroup": "GLOBAL",
8715
+ "name": "flags-dir",
8716
+ "summary": "Import flag values from a directory.",
8717
+ "hasDynamicHelp": false,
8718
+ "multiple": false,
8719
+ "type": "option"
8720
+ },
8721
+ "target-org": {
8722
+ "char": "o",
8723
+ "name": "target-org",
8724
+ "noCacheDefault": true,
8725
+ "required": true,
8726
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8727
+ "hasDynamicHelp": true,
8728
+ "multiple": false,
8729
+ "type": "option"
8730
+ },
8731
+ "name": {
8732
+ "char": "n",
8733
+ "description": "Connected App name(s) to process (bypasses selection prompt). For multiple apps, separate with commas (e.g., \"App1,App2\")",
8734
+ "name": "name",
8735
+ "summary": "Filter according to Name criteria",
8736
+ "hasDynamicHelp": false,
8737
+ "multiple": false,
8738
+ "type": "option"
8739
+ },
8740
+ "all": {
8741
+ "char": "a",
8742
+ "description": "If set, all Connected Apps from the local repository will be processed. Takes precedence over --name if both are specified.",
8743
+ "name": "all",
8744
+ "summary": "Process all Connected Apps without selection prompt",
8745
+ "allowNo": false,
8746
+ "type": "boolean"
8747
+ },
8748
+ "websocket": {
8749
+ "description": "WebSocket host:port for VS Code SFDX Hardis UI integration",
8750
+ "name": "websocket",
8751
+ "summary": "Websocket host:port for VsCode SFDX Hardis UI integration",
8752
+ "hasDynamicHelp": false,
8753
+ "multiple": false,
8754
+ "type": "option"
8755
+ },
8756
+ "skipauth": {
8757
+ "description": "Skip authentication check when a default username is required",
8758
+ "name": "skipauth",
8759
+ "summary": "Skip authentication check when a default username is required",
8760
+ "allowNo": false,
8761
+ "type": "boolean"
8762
+ }
8763
+ },
8764
+ "hasDynamicHelp": true,
8765
+ "hiddenAliases": [],
8766
+ "id": "hardis:org:refresh:after-refresh",
8767
+ "pluginAlias": "sfdx-hardis",
8768
+ "pluginName": "sfdx-hardis",
8769
+ "pluginType": "core",
8770
+ "strict": true,
8771
+ "enableJsonFlag": true,
8772
+ "title": "Restore Connected Apps after org refresh",
8773
+ "requiresProject": true,
8774
+ "isESM": true,
8775
+ "relativePath": [
8776
+ "lib",
8777
+ "commands",
8778
+ "hardis",
8779
+ "org",
8780
+ "refresh",
8781
+ "after-refresh.js"
8782
+ ],
8783
+ "aliasPermutations": [],
8784
+ "permutations": [
8785
+ "hardis:org:refresh:after-refresh",
8786
+ "org:hardis:refresh:after-refresh",
8787
+ "org:refresh:hardis:after-refresh",
8788
+ "org:refresh:after-refresh:hardis",
8789
+ "hardis:refresh:org:after-refresh",
8790
+ "refresh:hardis:org:after-refresh",
8791
+ "refresh:org:hardis:after-refresh",
8792
+ "refresh:org:after-refresh:hardis",
8793
+ "hardis:refresh:after-refresh:org",
8794
+ "refresh:hardis:after-refresh:org",
8795
+ "refresh:after-refresh:hardis:org",
8796
+ "refresh:after-refresh:org:hardis",
8797
+ "hardis:org:after-refresh:refresh",
8798
+ "org:hardis:after-refresh:refresh",
8799
+ "org:after-refresh:hardis:refresh",
8800
+ "org:after-refresh:refresh:hardis",
8801
+ "hardis:after-refresh:org:refresh",
8802
+ "after-refresh:hardis:org:refresh",
8803
+ "after-refresh:org:hardis:refresh",
8804
+ "after-refresh:org:refresh:hardis",
8805
+ "hardis:after-refresh:refresh:org",
8806
+ "after-refresh:hardis:refresh:org",
8807
+ "after-refresh:refresh:hardis:org",
8808
+ "after-refresh:refresh:org:hardis"
8809
+ ]
8810
+ },
8811
+ "hardis:org:refresh:before-refresh": {
8812
+ "aliases": [],
8813
+ "args": {},
8814
+ "description": "\n## Command Behavior\n\n**Backs up all Connected Apps (including Consumer Secrets), certificates, custom settings, records and other metadata from a Salesforce org before a sandbox refresh, enabling full restoration after the refresh.**\n\nThis command prepares a complete backup prior to a sandbox refresh. It creates a dedicated project under `scripts/sandbox-refresh/<sandbox-folder>`, retrieves metadata and data, attempts to capture Connected App consumer secrets, and can optionally delete the apps so they can be reuploaded after the refresh.\n\nKey functionalities:\n\n- **Create a save project:** Generates a dedicated project folder to store all artifacts for the sandbox backup.\n- **Find and select Connected Apps:** Lists Connected Apps in the org and lets you pick specific apps, use a name filter, or process all apps.\n- **Save metadata for restore:** Builds a manifest and retrieves the metadata types you choose so they can be restored after the refresh.\n- **Capture Consumer Secrets:** Attempts to capture Connected App consumer secrets automatically (opens a browser session when possible) and falls back to a short manual prompt when needed.\n- **Collect certificates:** Saves certificate files and their definitions so they can be redeployed later.\n- **Export custom settings & records:** Lets you pick custom settings to export as JSON and optionally export records using configured data workspaces.\n- **Persist choices & report:** Stores your backup choices in project config and sends report files for traceability.\n- **Optional cleanup:** Can delete backed-up Connected Apps from the org so they can be re-uploaded cleanly after the refresh.\n- **Interactive safety checks:** Prompts you to confirm package contents and other potentially destructive actions; sensible defaults are chosen where appropriate.\n\nThis command is part of [sfdx-hardis Sandbox Refresh](https://sfdx-hardis.cloudity.com/salesforce-sandbox-refresh/) and is intended to be run before a sandbox refresh so that all credentials, certificates, metadata and data can be restored afterwards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\n- **Salesforce CLI Integration:** Uses `sf org list metadata`, `sf project retrieve start`, `sf project generate`, `sf project deploy start`, and `sf data tree export`/`import` where applicable.\n- **Metadata Handling:** Writes and reads package XML files under the generated project (`manifest/`), copies MDAPI certificate artifacts into `force-app/main/default/certs`, and produces `package-metadata-to-restore.xml` for post-refresh deployment.\n- **Consumer Secret Handling:** Uses `puppeteer-core` with an executable path from `getChromeExecutablePath()` (env var `PUPPETEER_EXECUTABLE_PATH` may be required). Falls back to manual prompt when browser automation cannot be used.\n- **Data & Records:** Exports custom settings to JSON and supports exporting records through SFDMU workspaces chosen interactively.\n- **Config & Reporting:** Updates project/user config under `config/.sfdx-hardis.yml#refreshSandboxConfig` and reports artifacts to the WebSocket client.\n- **Error Handling:** Provides clear error messages and a summary response object indicating success/failure and which secrets were captured.\n\n</details>\n",
8815
+ "examples": [
8816
+ "$ sf hardis:org:refresh:before-refresh",
8817
+ "$ sf hardis:org:refresh:before-refresh --name \"MyConnectedApp\"",
8818
+ "$ sf hardis:org:refresh:before-refresh --name \"App1,App2,App3\"",
8819
+ "$ sf hardis:org:refresh:before-refresh --all",
8820
+ "$ sf hardis:org:refresh:before-refresh --delete"
8821
+ ],
8822
+ "flags": {
8823
+ "json": {
8824
+ "description": "Format output as json.",
8825
+ "helpGroup": "GLOBAL",
8826
+ "name": "json",
8827
+ "allowNo": false,
8828
+ "type": "boolean"
8829
+ },
8830
+ "flags-dir": {
8831
+ "helpGroup": "GLOBAL",
8832
+ "name": "flags-dir",
8833
+ "summary": "Import flag values from a directory.",
8834
+ "hasDynamicHelp": false,
8835
+ "multiple": false,
8836
+ "type": "option"
8837
+ },
8838
+ "target-org": {
8839
+ "char": "o",
8840
+ "name": "target-org",
8841
+ "noCacheDefault": true,
8842
+ "required": true,
8843
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8844
+ "hasDynamicHelp": true,
8845
+ "multiple": false,
8846
+ "type": "option"
8847
+ },
8848
+ "delete": {
8849
+ "char": "d",
8850
+ "description": "By default, Connected Apps are not deleted from the org after saving. Set this flag to force their deletion so they will be able to be reuploaded again after refreshing the org.",
8851
+ "name": "delete",
8852
+ "summary": "Delete Connected Apps from org after saving",
8853
+ "allowNo": false,
8854
+ "type": "boolean"
8855
+ },
8856
+ "name": {
8857
+ "char": "n",
8858
+ "description": "Connected App name(s) to process. For multiple apps, separate with commas (e.g., \"App1,App2\")",
8859
+ "name": "name",
8860
+ "summary": "Filter according to Name criteria",
8861
+ "hasDynamicHelp": false,
8862
+ "multiple": false,
8863
+ "type": "option"
8864
+ },
8865
+ "all": {
8866
+ "char": "a",
8867
+ "description": "If set, all Connected Apps from the org will be processed. Takes precedence over --name if both are specified.",
8868
+ "name": "all",
8869
+ "summary": "Process all Connected Apps without selection prompt",
8855
8870
  "allowNo": false,
8856
8871
  "type": "boolean"
8857
8872
  },
@@ -8867,67 +8882,52 @@
8867
8882
  "name": "skipauth",
8868
8883
  "allowNo": false,
8869
8884
  "type": "boolean"
8870
- },
8871
- "target-org": {
8872
- "aliases": [
8873
- "targetusername",
8874
- "u"
8875
- ],
8876
- "char": "o",
8877
- "deprecateAliases": true,
8878
- "name": "target-org",
8879
- "noCacheDefault": true,
8880
- "required": true,
8881
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8882
- "hasDynamicHelp": true,
8883
- "multiple": false,
8884
- "type": "option"
8885
8885
  }
8886
8886
  },
8887
8887
  "hasDynamicHelp": true,
8888
8888
  "hiddenAliases": [],
8889
- "id": "hardis:org:purge:profile",
8889
+ "id": "hardis:org:refresh:before-refresh",
8890
8890
  "pluginAlias": "sfdx-hardis",
8891
8891
  "pluginName": "sfdx-hardis",
8892
8892
  "pluginType": "core",
8893
8893
  "strict": true,
8894
8894
  "enableJsonFlag": true,
8895
- "title": "Remove PS attributes from Profile",
8895
+ "requiresProject": true,
8896
8896
  "isESM": true,
8897
8897
  "relativePath": [
8898
8898
  "lib",
8899
8899
  "commands",
8900
8900
  "hardis",
8901
8901
  "org",
8902
- "purge",
8903
- "profile.js"
8902
+ "refresh",
8903
+ "before-refresh.js"
8904
8904
  ],
8905
8905
  "aliasPermutations": [],
8906
8906
  "permutations": [
8907
- "hardis:org:purge:profile",
8908
- "org:hardis:purge:profile",
8909
- "org:purge:hardis:profile",
8910
- "org:purge:profile:hardis",
8911
- "hardis:purge:org:profile",
8912
- "purge:hardis:org:profile",
8913
- "purge:org:hardis:profile",
8914
- "purge:org:profile:hardis",
8915
- "hardis:purge:profile:org",
8916
- "purge:hardis:profile:org",
8917
- "purge:profile:hardis:org",
8918
- "purge:profile:org:hardis",
8919
- "hardis:org:profile:purge",
8920
- "org:hardis:profile:purge",
8921
- "org:profile:hardis:purge",
8922
- "org:profile:purge:hardis",
8923
- "hardis:profile:org:purge",
8924
- "profile:hardis:org:purge",
8925
- "profile:org:hardis:purge",
8926
- "profile:org:purge:hardis",
8927
- "hardis:profile:purge:org",
8928
- "profile:hardis:purge:org",
8929
- "profile:purge:hardis:org",
8930
- "profile:purge:org:hardis"
8907
+ "hardis:org:refresh:before-refresh",
8908
+ "org:hardis:refresh:before-refresh",
8909
+ "org:refresh:hardis:before-refresh",
8910
+ "org:refresh:before-refresh:hardis",
8911
+ "hardis:refresh:org:before-refresh",
8912
+ "refresh:hardis:org:before-refresh",
8913
+ "refresh:org:hardis:before-refresh",
8914
+ "refresh:org:before-refresh:hardis",
8915
+ "hardis:refresh:before-refresh:org",
8916
+ "refresh:hardis:before-refresh:org",
8917
+ "refresh:before-refresh:hardis:org",
8918
+ "refresh:before-refresh:org:hardis",
8919
+ "hardis:org:before-refresh:refresh",
8920
+ "org:hardis:before-refresh:refresh",
8921
+ "org:before-refresh:hardis:refresh",
8922
+ "org:before-refresh:refresh:hardis",
8923
+ "hardis:before-refresh:org:refresh",
8924
+ "before-refresh:hardis:org:refresh",
8925
+ "before-refresh:org:hardis:refresh",
8926
+ "before-refresh:org:refresh:hardis",
8927
+ "hardis:before-refresh:refresh:org",
8928
+ "before-refresh:hardis:refresh:org",
8929
+ "before-refresh:refresh:hardis:org",
8930
+ "before-refresh:refresh:org:hardis"
8931
8931
  ]
8932
8932
  },
8933
8933
  "hardis:org:retrieve:packageconfig": {
@@ -12142,6 +12142,221 @@
12142
12142
  "xml:clean:project:hardis"
12143
12143
  ]
12144
12144
  },
12145
+ "hardis:project:fix:profiletabs": {
12146
+ "aliases": [],
12147
+ "args": {},
12148
+ "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",
12149
+ "examples": [
12150
+ "$ sf hardis:project:fix:profiletabs"
12151
+ ],
12152
+ "flags": {
12153
+ "json": {
12154
+ "description": "Format output as json.",
12155
+ "helpGroup": "GLOBAL",
12156
+ "name": "json",
12157
+ "allowNo": false,
12158
+ "type": "boolean"
12159
+ },
12160
+ "flags-dir": {
12161
+ "helpGroup": "GLOBAL",
12162
+ "name": "flags-dir",
12163
+ "summary": "Import flag values from a directory.",
12164
+ "hasDynamicHelp": false,
12165
+ "multiple": false,
12166
+ "type": "option"
12167
+ },
12168
+ "path": {
12169
+ "char": "p",
12170
+ "description": "Root folder",
12171
+ "name": "path",
12172
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12173
+ "hasDynamicHelp": false,
12174
+ "multiple": false,
12175
+ "type": "option"
12176
+ },
12177
+ "debug": {
12178
+ "char": "d",
12179
+ "description": "Activate debug mode (more logs)",
12180
+ "name": "debug",
12181
+ "allowNo": false,
12182
+ "type": "boolean"
12183
+ },
12184
+ "websocket": {
12185
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12186
+ "name": "websocket",
12187
+ "hasDynamicHelp": false,
12188
+ "multiple": false,
12189
+ "type": "option"
12190
+ },
12191
+ "skipauth": {
12192
+ "description": "Skip authentication check when a default username is required",
12193
+ "name": "skipauth",
12194
+ "allowNo": false,
12195
+ "type": "boolean"
12196
+ },
12197
+ "target-org": {
12198
+ "aliases": [
12199
+ "targetusername",
12200
+ "u"
12201
+ ],
12202
+ "char": "o",
12203
+ "deprecateAliases": true,
12204
+ "name": "target-org",
12205
+ "noCacheDefault": true,
12206
+ "required": true,
12207
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
12208
+ "hasDynamicHelp": true,
12209
+ "multiple": false,
12210
+ "type": "option"
12211
+ }
12212
+ },
12213
+ "hasDynamicHelp": true,
12214
+ "hiddenAliases": [],
12215
+ "id": "hardis:project:fix:profiletabs",
12216
+ "pluginAlias": "sfdx-hardis",
12217
+ "pluginName": "sfdx-hardis",
12218
+ "pluginType": "core",
12219
+ "strict": true,
12220
+ "enableJsonFlag": true,
12221
+ "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
12222
+ "requiresProject": true,
12223
+ "isESM": true,
12224
+ "relativePath": [
12225
+ "lib",
12226
+ "commands",
12227
+ "hardis",
12228
+ "project",
12229
+ "fix",
12230
+ "profiletabs.js"
12231
+ ],
12232
+ "aliasPermutations": [],
12233
+ "permutations": [
12234
+ "hardis:project:fix:profiletabs",
12235
+ "project:hardis:fix:profiletabs",
12236
+ "project:fix:hardis:profiletabs",
12237
+ "project:fix:profiletabs:hardis",
12238
+ "hardis:fix:project:profiletabs",
12239
+ "fix:hardis:project:profiletabs",
12240
+ "fix:project:hardis:profiletabs",
12241
+ "fix:project:profiletabs:hardis",
12242
+ "hardis:fix:profiletabs:project",
12243
+ "fix:hardis:profiletabs:project",
12244
+ "fix:profiletabs:hardis:project",
12245
+ "fix:profiletabs:project:hardis",
12246
+ "hardis:project:profiletabs:fix",
12247
+ "project:hardis:profiletabs:fix",
12248
+ "project:profiletabs:hardis:fix",
12249
+ "project:profiletabs:fix:hardis",
12250
+ "hardis:profiletabs:project:fix",
12251
+ "profiletabs:hardis:project:fix",
12252
+ "profiletabs:project:hardis:fix",
12253
+ "profiletabs:project:fix:hardis",
12254
+ "hardis:profiletabs:fix:project",
12255
+ "profiletabs:hardis:fix:project",
12256
+ "profiletabs:fix:hardis:project",
12257
+ "profiletabs:fix:project:hardis"
12258
+ ]
12259
+ },
12260
+ "hardis:project:fix:v53flexipages": {
12261
+ "aliases": [],
12262
+ "args": {},
12263
+ "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",
12264
+ "examples": [
12265
+ "$ sf hardis:project:fix:v53flexipages"
12266
+ ],
12267
+ "flags": {
12268
+ "json": {
12269
+ "description": "Format output as json.",
12270
+ "helpGroup": "GLOBAL",
12271
+ "name": "json",
12272
+ "allowNo": false,
12273
+ "type": "boolean"
12274
+ },
12275
+ "flags-dir": {
12276
+ "helpGroup": "GLOBAL",
12277
+ "name": "flags-dir",
12278
+ "summary": "Import flag values from a directory.",
12279
+ "hasDynamicHelp": false,
12280
+ "multiple": false,
12281
+ "type": "option"
12282
+ },
12283
+ "path": {
12284
+ "char": "p",
12285
+ "description": "Root folder",
12286
+ "name": "path",
12287
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12288
+ "hasDynamicHelp": false,
12289
+ "multiple": false,
12290
+ "type": "option"
12291
+ },
12292
+ "debug": {
12293
+ "char": "d",
12294
+ "description": "Activate debug mode (more logs)",
12295
+ "name": "debug",
12296
+ "allowNo": false,
12297
+ "type": "boolean"
12298
+ },
12299
+ "websocket": {
12300
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12301
+ "name": "websocket",
12302
+ "hasDynamicHelp": false,
12303
+ "multiple": false,
12304
+ "type": "option"
12305
+ },
12306
+ "skipauth": {
12307
+ "description": "Skip authentication check when a default username is required",
12308
+ "name": "skipauth",
12309
+ "allowNo": false,
12310
+ "type": "boolean"
12311
+ }
12312
+ },
12313
+ "hasDynamicHelp": false,
12314
+ "hiddenAliases": [],
12315
+ "id": "hardis:project:fix:v53flexipages",
12316
+ "pluginAlias": "sfdx-hardis",
12317
+ "pluginName": "sfdx-hardis",
12318
+ "pluginType": "core",
12319
+ "strict": true,
12320
+ "enableJsonFlag": true,
12321
+ "title": "Fix flexipages for v53",
12322
+ "requiresProject": true,
12323
+ "isESM": true,
12324
+ "relativePath": [
12325
+ "lib",
12326
+ "commands",
12327
+ "hardis",
12328
+ "project",
12329
+ "fix",
12330
+ "v53flexipages.js"
12331
+ ],
12332
+ "aliasPermutations": [],
12333
+ "permutations": [
12334
+ "hardis:project:fix:v53flexipages",
12335
+ "project:hardis:fix:v53flexipages",
12336
+ "project:fix:hardis:v53flexipages",
12337
+ "project:fix:v53flexipages:hardis",
12338
+ "hardis:fix:project:v53flexipages",
12339
+ "fix:hardis:project:v53flexipages",
12340
+ "fix:project:hardis:v53flexipages",
12341
+ "fix:project:v53flexipages:hardis",
12342
+ "hardis:fix:v53flexipages:project",
12343
+ "fix:hardis:v53flexipages:project",
12344
+ "fix:v53flexipages:hardis:project",
12345
+ "fix:v53flexipages:project:hardis",
12346
+ "hardis:project:v53flexipages:fix",
12347
+ "project:hardis:v53flexipages:fix",
12348
+ "project:v53flexipages:hardis:fix",
12349
+ "project:v53flexipages:fix:hardis",
12350
+ "hardis:v53flexipages:project:fix",
12351
+ "v53flexipages:hardis:project:fix",
12352
+ "v53flexipages:project:hardis:fix",
12353
+ "v53flexipages:project:fix:hardis",
12354
+ "hardis:v53flexipages:fix:project",
12355
+ "v53flexipages:hardis:fix:project",
12356
+ "v53flexipages:fix:hardis:project",
12357
+ "v53flexipages:fix:project:hardis"
12358
+ ]
12359
+ },
12145
12360
  "hardis:project:deploy:notify": {
12146
12361
  "aliases": [],
12147
12362
  "args": {},
@@ -13316,221 +13531,6 @@
13316
13531
  "validate:deploy:project:hardis"
13317
13532
  ]
13318
13533
  },
13319
- "hardis:project:fix:profiletabs": {
13320
- "aliases": [],
13321
- "args": {},
13322
- "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",
13323
- "examples": [
13324
- "$ sf hardis:project:fix:profiletabs"
13325
- ],
13326
- "flags": {
13327
- "json": {
13328
- "description": "Format output as json.",
13329
- "helpGroup": "GLOBAL",
13330
- "name": "json",
13331
- "allowNo": false,
13332
- "type": "boolean"
13333
- },
13334
- "flags-dir": {
13335
- "helpGroup": "GLOBAL",
13336
- "name": "flags-dir",
13337
- "summary": "Import flag values from a directory.",
13338
- "hasDynamicHelp": false,
13339
- "multiple": false,
13340
- "type": "option"
13341
- },
13342
- "path": {
13343
- "char": "p",
13344
- "description": "Root folder",
13345
- "name": "path",
13346
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13347
- "hasDynamicHelp": false,
13348
- "multiple": false,
13349
- "type": "option"
13350
- },
13351
- "debug": {
13352
- "char": "d",
13353
- "description": "Activate debug mode (more logs)",
13354
- "name": "debug",
13355
- "allowNo": false,
13356
- "type": "boolean"
13357
- },
13358
- "websocket": {
13359
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13360
- "name": "websocket",
13361
- "hasDynamicHelp": false,
13362
- "multiple": false,
13363
- "type": "option"
13364
- },
13365
- "skipauth": {
13366
- "description": "Skip authentication check when a default username is required",
13367
- "name": "skipauth",
13368
- "allowNo": false,
13369
- "type": "boolean"
13370
- },
13371
- "target-org": {
13372
- "aliases": [
13373
- "targetusername",
13374
- "u"
13375
- ],
13376
- "char": "o",
13377
- "deprecateAliases": true,
13378
- "name": "target-org",
13379
- "noCacheDefault": true,
13380
- "required": true,
13381
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
13382
- "hasDynamicHelp": true,
13383
- "multiple": false,
13384
- "type": "option"
13385
- }
13386
- },
13387
- "hasDynamicHelp": true,
13388
- "hiddenAliases": [],
13389
- "id": "hardis:project:fix:profiletabs",
13390
- "pluginAlias": "sfdx-hardis",
13391
- "pluginName": "sfdx-hardis",
13392
- "pluginType": "core",
13393
- "strict": true,
13394
- "enableJsonFlag": true,
13395
- "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
13396
- "requiresProject": true,
13397
- "isESM": true,
13398
- "relativePath": [
13399
- "lib",
13400
- "commands",
13401
- "hardis",
13402
- "project",
13403
- "fix",
13404
- "profiletabs.js"
13405
- ],
13406
- "aliasPermutations": [],
13407
- "permutations": [
13408
- "hardis:project:fix:profiletabs",
13409
- "project:hardis:fix:profiletabs",
13410
- "project:fix:hardis:profiletabs",
13411
- "project:fix:profiletabs:hardis",
13412
- "hardis:fix:project:profiletabs",
13413
- "fix:hardis:project:profiletabs",
13414
- "fix:project:hardis:profiletabs",
13415
- "fix:project:profiletabs:hardis",
13416
- "hardis:fix:profiletabs:project",
13417
- "fix:hardis:profiletabs:project",
13418
- "fix:profiletabs:hardis:project",
13419
- "fix:profiletabs:project:hardis",
13420
- "hardis:project:profiletabs:fix",
13421
- "project:hardis:profiletabs:fix",
13422
- "project:profiletabs:hardis:fix",
13423
- "project:profiletabs:fix:hardis",
13424
- "hardis:profiletabs:project:fix",
13425
- "profiletabs:hardis:project:fix",
13426
- "profiletabs:project:hardis:fix",
13427
- "profiletabs:project:fix:hardis",
13428
- "hardis:profiletabs:fix:project",
13429
- "profiletabs:hardis:fix:project",
13430
- "profiletabs:fix:hardis:project",
13431
- "profiletabs:fix:project:hardis"
13432
- ]
13433
- },
13434
- "hardis:project:fix:v53flexipages": {
13435
- "aliases": [],
13436
- "args": {},
13437
- "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",
13438
- "examples": [
13439
- "$ sf hardis:project:fix:v53flexipages"
13440
- ],
13441
- "flags": {
13442
- "json": {
13443
- "description": "Format output as json.",
13444
- "helpGroup": "GLOBAL",
13445
- "name": "json",
13446
- "allowNo": false,
13447
- "type": "boolean"
13448
- },
13449
- "flags-dir": {
13450
- "helpGroup": "GLOBAL",
13451
- "name": "flags-dir",
13452
- "summary": "Import flag values from a directory.",
13453
- "hasDynamicHelp": false,
13454
- "multiple": false,
13455
- "type": "option"
13456
- },
13457
- "path": {
13458
- "char": "p",
13459
- "description": "Root folder",
13460
- "name": "path",
13461
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13462
- "hasDynamicHelp": false,
13463
- "multiple": false,
13464
- "type": "option"
13465
- },
13466
- "debug": {
13467
- "char": "d",
13468
- "description": "Activate debug mode (more logs)",
13469
- "name": "debug",
13470
- "allowNo": false,
13471
- "type": "boolean"
13472
- },
13473
- "websocket": {
13474
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13475
- "name": "websocket",
13476
- "hasDynamicHelp": false,
13477
- "multiple": false,
13478
- "type": "option"
13479
- },
13480
- "skipauth": {
13481
- "description": "Skip authentication check when a default username is required",
13482
- "name": "skipauth",
13483
- "allowNo": false,
13484
- "type": "boolean"
13485
- }
13486
- },
13487
- "hasDynamicHelp": false,
13488
- "hiddenAliases": [],
13489
- "id": "hardis:project:fix:v53flexipages",
13490
- "pluginAlias": "sfdx-hardis",
13491
- "pluginName": "sfdx-hardis",
13492
- "pluginType": "core",
13493
- "strict": true,
13494
- "enableJsonFlag": true,
13495
- "title": "Fix flexipages for v53",
13496
- "requiresProject": true,
13497
- "isESM": true,
13498
- "relativePath": [
13499
- "lib",
13500
- "commands",
13501
- "hardis",
13502
- "project",
13503
- "fix",
13504
- "v53flexipages.js"
13505
- ],
13506
- "aliasPermutations": [],
13507
- "permutations": [
13508
- "hardis:project:fix:v53flexipages",
13509
- "project:hardis:fix:v53flexipages",
13510
- "project:fix:hardis:v53flexipages",
13511
- "project:fix:v53flexipages:hardis",
13512
- "hardis:fix:project:v53flexipages",
13513
- "fix:hardis:project:v53flexipages",
13514
- "fix:project:hardis:v53flexipages",
13515
- "fix:project:v53flexipages:hardis",
13516
- "hardis:fix:v53flexipages:project",
13517
- "fix:hardis:v53flexipages:project",
13518
- "fix:v53flexipages:hardis:project",
13519
- "fix:v53flexipages:project:hardis",
13520
- "hardis:project:v53flexipages:fix",
13521
- "project:hardis:v53flexipages:fix",
13522
- "project:v53flexipages:hardis:fix",
13523
- "project:v53flexipages:fix:hardis",
13524
- "hardis:v53flexipages:project:fix",
13525
- "v53flexipages:hardis:project:fix",
13526
- "v53flexipages:project:hardis:fix",
13527
- "v53flexipages:project:fix:hardis",
13528
- "hardis:v53flexipages:fix:project",
13529
- "v53flexipages:hardis:fix:project",
13530
- "v53flexipages:fix:hardis:project",
13531
- "v53flexipages:fix:project:hardis"
13532
- ]
13533
- },
13534
13534
  "hardis:project:generate:bypass": {
13535
13535
  "aliases": [],
13536
13536
  "args": {},
@@ -16104,5 +16104,5 @@
16104
16104
  ]
16105
16105
  }
16106
16106
  },
16107
- "version": "6.17.2-alpha202512261125.0"
16107
+ "version": "6.17.2-alpha202512261505.0"
16108
16108
  }