sfdx-hardis 6.10.1-alpha202511021043.0 → 6.10.1-alpha202511022140.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,12 +132,13 @@
132
132
  "clear:cache:hardis"
133
133
  ]
134
134
  },
135
- "hardis:config:get": {
135
+ "hardis:auth:login": {
136
136
  "aliases": [],
137
137
  "args": {},
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",
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",
139
139
  "examples": [
140
- "$ sf hardis:project:deploy:sources:metadata"
140
+ "$ sf hardis:auth:login",
141
+ "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
141
142
  ],
142
143
  "flags": {
143
144
  "json": {
@@ -155,20 +156,28 @@
155
156
  "multiple": false,
156
157
  "type": "option"
157
158
  },
158
- "level": {
159
- "char": "l",
160
- "description": "project,branch or user",
161
- "name": "level",
162
- "default": "project",
159
+ "instanceurl": {
160
+ "char": "r",
161
+ "description": "URL of org instance",
162
+ "name": "instanceurl",
163
163
  "hasDynamicHelp": false,
164
164
  "multiple": false,
165
- "options": [
166
- "project",
167
- "branch",
168
- "user"
169
- ],
170
165
  "type": "option"
171
166
  },
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
+ },
172
181
  "debug": {
173
182
  "char": "d",
174
183
  "description": "Activate debug mode (more logs)",
@@ -192,39 +201,38 @@
192
201
  },
193
202
  "hasDynamicHelp": false,
194
203
  "hiddenAliases": [],
195
- "id": "hardis:config:get",
204
+ "id": "hardis:auth:login",
196
205
  "pluginAlias": "sfdx-hardis",
197
206
  "pluginName": "sfdx-hardis",
198
207
  "pluginType": "core",
199
208
  "strict": true,
200
209
  "enableJsonFlag": true,
201
- "title": "Deploy metadata sources to org",
210
+ "title": "Login",
202
211
  "requiresProject": false,
203
212
  "isESM": true,
204
213
  "relativePath": [
205
214
  "lib",
206
215
  "commands",
207
216
  "hardis",
208
- "config",
209
- "get.js"
217
+ "auth",
218
+ "login.js"
210
219
  ],
211
220
  "aliasPermutations": [],
212
221
  "permutations": [
213
- "hardis:config:get",
214
- "config:hardis:get",
215
- "config:get:hardis",
216
- "hardis:get:config",
217
- "get:hardis:config",
218
- "get:config:hardis"
222
+ "hardis:auth:login",
223
+ "auth:hardis:login",
224
+ "auth:login:hardis",
225
+ "hardis:login:auth",
226
+ "login:hardis:auth",
227
+ "login:auth:hardis"
219
228
  ]
220
229
  },
221
- "hardis:auth:login": {
230
+ "hardis:config:get": {
222
231
  "aliases": [],
223
232
  "args": {},
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",
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",
225
234
  "examples": [
226
- "$ sf hardis:auth:login",
227
- "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
235
+ "$ sf hardis:project:deploy:sources:metadata"
228
236
  ],
229
237
  "flags": {
230
238
  "json": {
@@ -242,28 +250,20 @@
242
250
  "multiple": false,
243
251
  "type": "option"
244
252
  },
245
- "instanceurl": {
246
- "char": "r",
247
- "description": "URL of org instance",
248
- "name": "instanceurl",
253
+ "level": {
254
+ "char": "l",
255
+ "description": "project,branch or user",
256
+ "name": "level",
257
+ "default": "project",
249
258
  "hasDynamicHelp": false,
250
259
  "multiple": false,
260
+ "options": [
261
+ "project",
262
+ "branch",
263
+ "user"
264
+ ],
251
265
  "type": "option"
252
266
  },
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:auth:login",
290
+ "id": "hardis:config:get",
291
291
  "pluginAlias": "sfdx-hardis",
292
292
  "pluginName": "sfdx-hardis",
293
293
  "pluginType": "core",
294
294
  "strict": true,
295
295
  "enableJsonFlag": true,
296
- "title": "Login",
296
+ "title": "Deploy metadata sources to org",
297
297
  "requiresProject": false,
298
298
  "isESM": true,
299
299
  "relativePath": [
300
300
  "lib",
301
301
  "commands",
302
302
  "hardis",
303
- "auth",
304
- "login.js"
303
+ "config",
304
+ "get.js"
305
305
  ],
306
306
  "aliasPermutations": [],
307
307
  "permutations": [
308
- "hardis:auth:login",
309
- "auth:hardis:login",
310
- "auth:login:hardis",
311
- "hardis:login:auth",
312
- "login:hardis:auth",
313
- "login:auth:hardis"
308
+ "hardis:config:get",
309
+ "config:hardis:get",
310
+ "config:get:hardis",
311
+ "hardis:get:config",
312
+ "get:hardis:config",
313
+ "get:config:hardis"
314
314
  ]
315
315
  },
316
316
  "hardis:doc:fieldusage": {
@@ -4422,135 +4422,6 @@
4422
4422
  "ws:work:hardis"
4423
4423
  ]
4424
4424
  },
4425
- "hardis:git:pull-requests:extract": {
4426
- "aliases": [],
4427
- "args": {},
4428
- "description": "\n## Command Behavior\n\n**Extracts pull request information from your Git server based on specified filtering criteria.**\n\nThis command provides a powerful way to query and retrieve details about pull requests (or merge requests, depending on your Git provider) in your repository. It's highly useful for reporting, auditing, and analyzing development workflows.\n\nKey functionalities include:\n\n- **Target Branch Filtering:** You can filter pull requests by their target branch using the `--target-branch` flag. If not specified, the command will prompt you to select one.\n- **Status Filtering:** Filter pull requests by their status: `open`, `merged`, or `abandoned` using the `--status` flag. An interactive prompt is provided if no status is specified.\n- **Minimum Date Filtering:** Use the `--min-date` flag to retrieve pull requests created or updated after a specific date.\n- **CSV Output:** The extracted pull request data is generated into a CSV file, which can be used for further analysis in spreadsheet software.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves interacting with a Git provider's API:\n\n- **Git Provider Abstraction:** It uses the `GitProvider.getInstance(true)` to abstract away the specifics of different Git platforms (e.g., GitHub, GitLab, Azure DevOps). This ensures the command can work across various environments.\n- **API Calls:** The `gitProvider.listPullRequests()` method is called with a `prConstraint` object that encapsulates the filtering criteria (target branch, minimum date, status).\n- **Interactive Prompts:** The `prompts` library is used to interactively gather input from the user for the target branch and pull request status if they are not provided as command-line flags.\n- **Date Handling:** The `moment` library is used to parse and handle date inputs for the `--min-date` flag.\n- **CSV Generation:** The `generateCsvFile` utility is responsible for converting the retrieved pull request data into a CSV format, and `generateReportPath` determines the output file location.\n- **Error Handling:** It includes error handling for cases where a Git provider cannot be identified.\n</details>\n",
4429
- "examples": [
4430
- "$ sf hardis:git:pull-requests:extract",
4431
- "$ sf hardis:git:pull-requests:extract --target-branch main --status merged"
4432
- ],
4433
- "flags": {
4434
- "json": {
4435
- "description": "Format output as json.",
4436
- "helpGroup": "GLOBAL",
4437
- "name": "json",
4438
- "allowNo": false,
4439
- "type": "boolean"
4440
- },
4441
- "flags-dir": {
4442
- "helpGroup": "GLOBAL",
4443
- "name": "flags-dir",
4444
- "summary": "Import flag values from a directory.",
4445
- "hasDynamicHelp": false,
4446
- "multiple": false,
4447
- "type": "option"
4448
- },
4449
- "target-branch": {
4450
- "char": "t",
4451
- "description": "Target branch of PRs",
4452
- "name": "target-branch",
4453
- "hasDynamicHelp": false,
4454
- "multiple": false,
4455
- "type": "option"
4456
- },
4457
- "status": {
4458
- "char": "x",
4459
- "description": "Status of the PR",
4460
- "name": "status",
4461
- "hasDynamicHelp": false,
4462
- "multiple": false,
4463
- "options": [
4464
- "open",
4465
- "merged",
4466
- "abandoned"
4467
- ],
4468
- "type": "option"
4469
- },
4470
- "min-date": {
4471
- "char": "m",
4472
- "description": "Minimum date for PR",
4473
- "name": "min-date",
4474
- "hasDynamicHelp": false,
4475
- "multiple": false,
4476
- "type": "option"
4477
- },
4478
- "outputfile": {
4479
- "char": "f",
4480
- "description": "Force the path and name of output report file. Must end with .csv",
4481
- "name": "outputfile",
4482
- "hasDynamicHelp": false,
4483
- "multiple": false,
4484
- "type": "option"
4485
- },
4486
- "debug": {
4487
- "char": "d",
4488
- "description": "Activate debug mode (more logs)",
4489
- "name": "debug",
4490
- "allowNo": false,
4491
- "type": "boolean"
4492
- },
4493
- "websocket": {
4494
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4495
- "name": "websocket",
4496
- "hasDynamicHelp": false,
4497
- "multiple": false,
4498
- "type": "option"
4499
- },
4500
- "skipauth": {
4501
- "description": "Skip authentication check when a default username is required",
4502
- "name": "skipauth",
4503
- "allowNo": false,
4504
- "type": "boolean"
4505
- }
4506
- },
4507
- "hasDynamicHelp": false,
4508
- "hiddenAliases": [],
4509
- "id": "hardis:git:pull-requests:extract",
4510
- "pluginAlias": "sfdx-hardis",
4511
- "pluginName": "sfdx-hardis",
4512
- "pluginType": "core",
4513
- "strict": true,
4514
- "enableJsonFlag": true,
4515
- "title": "Extract pull requests",
4516
- "requiresProject": true,
4517
- "isESM": true,
4518
- "relativePath": [
4519
- "lib",
4520
- "commands",
4521
- "hardis",
4522
- "git",
4523
- "pull-requests",
4524
- "extract.js"
4525
- ],
4526
- "aliasPermutations": [],
4527
- "permutations": [
4528
- "hardis:git:pull-requests:extract",
4529
- "git:hardis:pull-requests:extract",
4530
- "git:pull-requests:hardis:extract",
4531
- "git:pull-requests:extract:hardis",
4532
- "hardis:pull-requests:git:extract",
4533
- "pull-requests:hardis:git:extract",
4534
- "pull-requests:git:hardis:extract",
4535
- "pull-requests:git:extract:hardis",
4536
- "hardis:pull-requests:extract:git",
4537
- "pull-requests:hardis:extract:git",
4538
- "pull-requests:extract:hardis:git",
4539
- "pull-requests:extract:git:hardis",
4540
- "hardis:git:extract:pull-requests",
4541
- "git:hardis:extract:pull-requests",
4542
- "git:extract:hardis:pull-requests",
4543
- "git:extract:pull-requests:hardis",
4544
- "hardis:extract:git:pull-requests",
4545
- "extract:hardis:git:pull-requests",
4546
- "extract:git:hardis:pull-requests",
4547
- "extract:git:pull-requests:hardis",
4548
- "hardis:extract:pull-requests:git",
4549
- "extract:hardis:pull-requests:git",
4550
- "extract:pull-requests:hardis:git",
4551
- "extract:pull-requests:git:hardis"
4552
- ]
4553
- },
4554
4425
  "hardis:doc:extract:permsetgroups": {
4555
4426
  "aliases": [],
4556
4427
  "args": {},
@@ -4741,12 +4612,13 @@
4741
4612
  "generate:plugin:doc:hardis"
4742
4613
  ]
4743
4614
  },
4744
- "hardis:org:configure:data": {
4615
+ "hardis:git:pull-requests:extract": {
4745
4616
  "aliases": [],
4746
4617
  "args": {},
4747
- "description": "\n## Command Behavior\n\n**Configures a Salesforce Data Migration Utility (SFDMU) project for data export and import operations.**\n\nThis command assists in setting up SFDMU workspaces, which are essential for managing data within your Salesforce environments. It streamlines the creation of `export.json` files and related configurations, enabling efficient data seeding, migration, and synchronization.\n\nKey functionalities:\n\n- **Template-Based Configuration:** Allows you to choose from predefined SFDMU templates or start with a blank configuration. Templates can pre-populate `export.json` with common data migration scenarios.\n- **Interactive Setup:** Guides you through the process of defining the SFDMU project folder name, label, and description.\n- **`export.json` Generation:** Creates the `export.json` file, which is the core configuration file for SFDMU, defining objects to export/import, queries, and operations.\n- **Additional File Generation:** Can generate additional configuration files, such as a `badwords.json` file for data filtering scenarios.\n- **Scratch Org Integration:** Offers to automatically configure the SFDMU project to be used for data import when initializing a new scratch org, ensuring consistent test data across development environments.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SFDMU Integration:** It acts as a setup wizard for SFDMU, generating the necessary configuration files that the `sfdmu` plugin consumes.\n- **Interactive Prompts:** Uses the `prompts` library to gather user input for various configuration parameters, such as the data path, label, and description.\n- **File System Operations:** Employs `fs-extra` to create directories (e.g., `data/your-project-name/`) and write the `export.json` and any additional configuration files.\n- **JSON Manipulation:** Constructs the `export.json` content dynamically based on user input and selected templates, including defining objects, queries, and operations.\n- **PascalCase Conversion:** Uses `pascalcase` to format the SFDMU folder name consistently.\n- **Configuration Persistence:** Updates the project's `sfdx-hardis.yml` file (via `setConfig`) to include the newly configured data package if it's intended for scratch org initialization.\n- **WebSocket Communication:** Uses `WebSocketClient.requestOpenFile` to open the generated `export.json` file in VS Code, facilitating immediate configuration.\n- **Required Plugin Check:** Explicitly lists `sfdmu` as a required plugin, ensuring the necessary dependency is present.\n</details>\n",
4618
+ "description": "\n## Command Behavior\n\n**Extracts pull request information from your Git server based on specified filtering criteria.**\n\nThis command provides a powerful way to query and retrieve details about pull requests (or merge requests, depending on your Git provider) in your repository. It's highly useful for reporting, auditing, and analyzing development workflows.\n\nKey functionalities include:\n\n- **Target Branch Filtering:** You can filter pull requests by their target branch using the `--target-branch` flag. If not specified, the command will prompt you to select one.\n- **Status Filtering:** Filter pull requests by their status: `open`, `merged`, or `abandoned` using the `--status` flag. An interactive prompt is provided if no status is specified.\n- **Minimum Date Filtering:** Use the `--min-date` flag to retrieve pull requests created or updated after a specific date.\n- **CSV Output:** The extracted pull request data is generated into a CSV file, which can be used for further analysis in spreadsheet software.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves interacting with a Git provider's API:\n\n- **Git Provider Abstraction:** It uses the `GitProvider.getInstance(true)` to abstract away the specifics of different Git platforms (e.g., GitHub, GitLab, Azure DevOps). This ensures the command can work across various environments.\n- **API Calls:** The `gitProvider.listPullRequests()` method is called with a `prConstraint` object that encapsulates the filtering criteria (target branch, minimum date, status).\n- **Interactive Prompts:** The `prompts` library is used to interactively gather input from the user for the target branch and pull request status if they are not provided as command-line flags.\n- **Date Handling:** The `moment` library is used to parse and handle date inputs for the `--min-date` flag.\n- **CSV Generation:** The `generateCsvFile` utility is responsible for converting the retrieved pull request data into a CSV format, and `generateReportPath` determines the output file location.\n- **Error Handling:** It includes error handling for cases where a Git provider cannot be identified.\n</details>\n",
4748
4619
  "examples": [
4749
- "$ sf hardis:org:configure:data"
4620
+ "$ sf hardis:git:pull-requests:extract",
4621
+ "$ sf hardis:git:pull-requests:extract --target-branch main --status merged"
4750
4622
  ],
4751
4623
  "flags": {
4752
4624
  "json": {
@@ -4764,16 +4636,255 @@
4764
4636
  "multiple": false,
4765
4637
  "type": "option"
4766
4638
  },
4767
- "debug": {
4768
- "char": "d",
4769
- "description": "Activate debug mode (more logs)",
4770
- "name": "debug",
4771
- "allowNo": false,
4772
- "type": "boolean"
4773
- },
4774
- "websocket": {
4775
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4776
- "name": "websocket",
4639
+ "target-branch": {
4640
+ "char": "t",
4641
+ "description": "Target branch of PRs",
4642
+ "name": "target-branch",
4643
+ "hasDynamicHelp": false,
4644
+ "multiple": false,
4645
+ "type": "option"
4646
+ },
4647
+ "status": {
4648
+ "char": "x",
4649
+ "description": "Status of the PR",
4650
+ "name": "status",
4651
+ "hasDynamicHelp": false,
4652
+ "multiple": false,
4653
+ "options": [
4654
+ "open",
4655
+ "merged",
4656
+ "abandoned"
4657
+ ],
4658
+ "type": "option"
4659
+ },
4660
+ "min-date": {
4661
+ "char": "m",
4662
+ "description": "Minimum date for PR",
4663
+ "name": "min-date",
4664
+ "hasDynamicHelp": false,
4665
+ "multiple": false,
4666
+ "type": "option"
4667
+ },
4668
+ "outputfile": {
4669
+ "char": "f",
4670
+ "description": "Force the path and name of output report file. Must end with .csv",
4671
+ "name": "outputfile",
4672
+ "hasDynamicHelp": false,
4673
+ "multiple": false,
4674
+ "type": "option"
4675
+ },
4676
+ "debug": {
4677
+ "char": "d",
4678
+ "description": "Activate debug mode (more logs)",
4679
+ "name": "debug",
4680
+ "allowNo": false,
4681
+ "type": "boolean"
4682
+ },
4683
+ "websocket": {
4684
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4685
+ "name": "websocket",
4686
+ "hasDynamicHelp": false,
4687
+ "multiple": false,
4688
+ "type": "option"
4689
+ },
4690
+ "skipauth": {
4691
+ "description": "Skip authentication check when a default username is required",
4692
+ "name": "skipauth",
4693
+ "allowNo": false,
4694
+ "type": "boolean"
4695
+ }
4696
+ },
4697
+ "hasDynamicHelp": false,
4698
+ "hiddenAliases": [],
4699
+ "id": "hardis:git:pull-requests:extract",
4700
+ "pluginAlias": "sfdx-hardis",
4701
+ "pluginName": "sfdx-hardis",
4702
+ "pluginType": "core",
4703
+ "strict": true,
4704
+ "enableJsonFlag": true,
4705
+ "title": "Extract pull requests",
4706
+ "requiresProject": true,
4707
+ "isESM": true,
4708
+ "relativePath": [
4709
+ "lib",
4710
+ "commands",
4711
+ "hardis",
4712
+ "git",
4713
+ "pull-requests",
4714
+ "extract.js"
4715
+ ],
4716
+ "aliasPermutations": [],
4717
+ "permutations": [
4718
+ "hardis:git:pull-requests:extract",
4719
+ "git:hardis:pull-requests:extract",
4720
+ "git:pull-requests:hardis:extract",
4721
+ "git:pull-requests:extract:hardis",
4722
+ "hardis:pull-requests:git:extract",
4723
+ "pull-requests:hardis:git:extract",
4724
+ "pull-requests:git:hardis:extract",
4725
+ "pull-requests:git:extract:hardis",
4726
+ "hardis:pull-requests:extract:git",
4727
+ "pull-requests:hardis:extract:git",
4728
+ "pull-requests:extract:hardis:git",
4729
+ "pull-requests:extract:git:hardis",
4730
+ "hardis:git:extract:pull-requests",
4731
+ "git:hardis:extract:pull-requests",
4732
+ "git:extract:hardis:pull-requests",
4733
+ "git:extract:pull-requests:hardis",
4734
+ "hardis:extract:git:pull-requests",
4735
+ "extract:hardis:git:pull-requests",
4736
+ "extract:git:hardis:pull-requests",
4737
+ "extract:git:pull-requests:hardis",
4738
+ "hardis:extract:pull-requests:git",
4739
+ "extract:hardis:pull-requests:git",
4740
+ "extract:pull-requests:hardis:git",
4741
+ "extract:pull-requests:git:hardis"
4742
+ ]
4743
+ },
4744
+ "hardis:org:community:update": {
4745
+ "aliases": [],
4746
+ "args": {},
4747
+ "description": "\n## Command Behavior\n\n**Updates the status of one or more Salesforce Experience Cloud (Community) networks.**\n\nThis command provides a way to programmatically change the status of your Salesforce Communities, allowing you to manage their availability. This is particularly useful for:\n\n- **Maintenance:** Taking communities offline for planned maintenance (`DownForMaintenance`).\n- **Activation/Deactivation:** Bringing communities online or offline (`Live`, `DownForMaintenance`).\n- **Automation:** Integrating community status changes into CI/CD pipelines or scheduled jobs.\n\nKey functionalities:\n\n- **Network Selection:** You can specify one or more community network names (separated by commas) using the `--name` flag.\n- **Status Update:** You can set the new status for the selected communities using the `--status` flag. Supported values are `Live` and `DownForMaintenance`.\n- **Confirmation Prompt:** In non-CI environments, it provides a confirmation prompt before executing the update, ensuring intentional changes.\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 Salesforce `Network` object using SOQL to retrieve the `Id`, `Name`, and `Status` of the specified communities. This ensures that only existing communities are targeted.\n- **SObject Update:** It then constructs an array of `Network` sObjects with their `Id` and the new `Status` and performs a DML update operation using `conn.sobject(\"Network\").update()`. The `allOrNone: false` option is used to allow partial success in case some updates fail.\n- **Error Handling and Reporting:** It iterates through the update results, logging success or failure for each community. It also provides a summary of successful and erroneous updates.\n- **User Interaction:** Uses `prompts` to confirm the update action with the user when not running in a CI environment.\n- **Salesforce Connection:** Establishes a connection to the target Salesforce org using the `target-org` flag.\n</details>\n",
4748
+ "examples": [
4749
+ "$ sf hardis:org:community:update --name 'MyNetworkName' --status DownForMaintenance",
4750
+ "$ sf hardis:org:community:update --name 'MyNetworkName,MySecondNetworkName' --status Live"
4751
+ ],
4752
+ "flags": {
4753
+ "json": {
4754
+ "description": "Format output as json.",
4755
+ "helpGroup": "GLOBAL",
4756
+ "name": "json",
4757
+ "allowNo": false,
4758
+ "type": "boolean"
4759
+ },
4760
+ "flags-dir": {
4761
+ "helpGroup": "GLOBAL",
4762
+ "name": "flags-dir",
4763
+ "summary": "Import flag values from a directory.",
4764
+ "hasDynamicHelp": false,
4765
+ "multiple": false,
4766
+ "type": "option"
4767
+ },
4768
+ "name": {
4769
+ "char": "n",
4770
+ "description": "List of Networks Names that you want to update, separated by comma",
4771
+ "name": "name",
4772
+ "required": true,
4773
+ "hasDynamicHelp": false,
4774
+ "multiple": false,
4775
+ "type": "option"
4776
+ },
4777
+ "status": {
4778
+ "char": "s",
4779
+ "description": "New status for the community, available values are: Live, DownForMaintenance",
4780
+ "name": "status",
4781
+ "required": true,
4782
+ "hasDynamicHelp": false,
4783
+ "multiple": false,
4784
+ "type": "option"
4785
+ },
4786
+ "debug": {
4787
+ "char": "d",
4788
+ "description": "Activate debug mode (more logs)",
4789
+ "name": "debug",
4790
+ "allowNo": false,
4791
+ "type": "boolean"
4792
+ },
4793
+ "target-org": {
4794
+ "aliases": [
4795
+ "targetusername",
4796
+ "u"
4797
+ ],
4798
+ "char": "o",
4799
+ "deprecateAliases": true,
4800
+ "name": "target-org",
4801
+ "noCacheDefault": true,
4802
+ "required": true,
4803
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
4804
+ "hasDynamicHelp": true,
4805
+ "multiple": false,
4806
+ "type": "option"
4807
+ }
4808
+ },
4809
+ "hasDynamicHelp": true,
4810
+ "hiddenAliases": [],
4811
+ "id": "hardis:org:community:update",
4812
+ "pluginAlias": "sfdx-hardis",
4813
+ "pluginName": "sfdx-hardis",
4814
+ "pluginType": "core",
4815
+ "strict": true,
4816
+ "summary": "Update a community status.",
4817
+ "enableJsonFlag": true,
4818
+ "isESM": true,
4819
+ "relativePath": [
4820
+ "lib",
4821
+ "commands",
4822
+ "hardis",
4823
+ "org",
4824
+ "community",
4825
+ "update.js"
4826
+ ],
4827
+ "aliasPermutations": [],
4828
+ "permutations": [
4829
+ "hardis:org:community:update",
4830
+ "org:hardis:community:update",
4831
+ "org:community:hardis:update",
4832
+ "org:community:update:hardis",
4833
+ "hardis:community:org:update",
4834
+ "community:hardis:org:update",
4835
+ "community:org:hardis:update",
4836
+ "community:org:update:hardis",
4837
+ "hardis:community:update:org",
4838
+ "community:hardis:update:org",
4839
+ "community:update:hardis:org",
4840
+ "community:update:org:hardis",
4841
+ "hardis:org:update:community",
4842
+ "org:hardis:update:community",
4843
+ "org:update:hardis:community",
4844
+ "org:update:community:hardis",
4845
+ "hardis:update:org:community",
4846
+ "update:hardis:org:community",
4847
+ "update:org:hardis:community",
4848
+ "update:org:community:hardis",
4849
+ "hardis:update:community:org",
4850
+ "update:hardis:community:org",
4851
+ "update:community:hardis:org",
4852
+ "update:community:org:hardis"
4853
+ ]
4854
+ },
4855
+ "hardis:org:configure:data": {
4856
+ "aliases": [],
4857
+ "args": {},
4858
+ "description": "\n## Command Behavior\n\n**Configures a Salesforce Data Migration Utility (SFDMU) project for data export and import operations.**\n\nThis command assists in setting up SFDMU workspaces, which are essential for managing data within your Salesforce environments. It streamlines the creation of `export.json` files and related configurations, enabling efficient data seeding, migration, and synchronization.\n\nKey functionalities:\n\n- **Template-Based Configuration:** Allows you to choose from predefined SFDMU templates or start with a blank configuration. Templates can pre-populate `export.json` with common data migration scenarios.\n- **Interactive Setup:** Guides you through the process of defining the SFDMU project folder name, label, and description.\n- **`export.json` Generation:** Creates the `export.json` file, which is the core configuration file for SFDMU, defining objects to export/import, queries, and operations.\n- **Additional File Generation:** Can generate additional configuration files, such as a `badwords.json` file for data filtering scenarios.\n- **Scratch Org Integration:** Offers to automatically configure the SFDMU project to be used for data import when initializing a new scratch org, ensuring consistent test data across development environments.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SFDMU Integration:** It acts as a setup wizard for SFDMU, generating the necessary configuration files that the `sfdmu` plugin consumes.\n- **Interactive Prompts:** Uses the `prompts` library to gather user input for various configuration parameters, such as the data path, label, and description.\n- **File System Operations:** Employs `fs-extra` to create directories (e.g., `data/your-project-name/`) and write the `export.json` and any additional configuration files.\n- **JSON Manipulation:** Constructs the `export.json` content dynamically based on user input and selected templates, including defining objects, queries, and operations.\n- **PascalCase Conversion:** Uses `pascalcase` to format the SFDMU folder name consistently.\n- **Configuration Persistence:** Updates the project's `sfdx-hardis.yml` file (via `setConfig`) to include the newly configured data package if it's intended for scratch org initialization.\n- **WebSocket Communication:** Uses `WebSocketClient.requestOpenFile` to open the generated `export.json` file in VS Code, facilitating immediate configuration.\n- **Required Plugin Check:** Explicitly lists `sfdmu` as a required plugin, ensuring the necessary dependency is present.\n</details>\n",
4859
+ "examples": [
4860
+ "$ sf hardis:org:configure:data"
4861
+ ],
4862
+ "flags": {
4863
+ "json": {
4864
+ "description": "Format output as json.",
4865
+ "helpGroup": "GLOBAL",
4866
+ "name": "json",
4867
+ "allowNo": false,
4868
+ "type": "boolean"
4869
+ },
4870
+ "flags-dir": {
4871
+ "helpGroup": "GLOBAL",
4872
+ "name": "flags-dir",
4873
+ "summary": "Import flag values from a directory.",
4874
+ "hasDynamicHelp": false,
4875
+ "multiple": false,
4876
+ "type": "option"
4877
+ },
4878
+ "debug": {
4879
+ "char": "d",
4880
+ "description": "Activate debug mode (more logs)",
4881
+ "name": "debug",
4882
+ "allowNo": false,
4883
+ "type": "boolean"
4884
+ },
4885
+ "websocket": {
4886
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4887
+ "name": "websocket",
4777
4888
  "hasDynamicHelp": false,
4778
4889
  "multiple": false,
4779
4890
  "type": "option"
@@ -5042,123 +5153,12 @@
5042
5153
  "monitoring:configure:org:hardis"
5043
5154
  ]
5044
5155
  },
5045
- "hardis:org:community:update": {
5156
+ "hardis:org:data:delete": {
5046
5157
  "aliases": [],
5047
5158
  "args": {},
5048
- "description": "\n## Command Behavior\n\n**Updates the status of one or more Salesforce Experience Cloud (Community) networks.**\n\nThis command provides a way to programmatically change the status of your Salesforce Communities, allowing you to manage their availability. This is particularly useful for:\n\n- **Maintenance:** Taking communities offline for planned maintenance (`DownForMaintenance`).\n- **Activation/Deactivation:** Bringing communities online or offline (`Live`, `DownForMaintenance`).\n- **Automation:** Integrating community status changes into CI/CD pipelines or scheduled jobs.\n\nKey functionalities:\n\n- **Network Selection:** You can specify one or more community network names (separated by commas) using the `--name` flag.\n- **Status Update:** You can set the new status for the selected communities using the `--status` flag. Supported values are `Live` and `DownForMaintenance`.\n- **Confirmation Prompt:** In non-CI environments, it provides a confirmation prompt before executing the update, ensuring intentional changes.\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 Salesforce `Network` object using SOQL to retrieve the `Id`, `Name`, and `Status` of the specified communities. This ensures that only existing communities are targeted.\n- **SObject Update:** It then constructs an array of `Network` sObjects with their `Id` and the new `Status` and performs a DML update operation using `conn.sobject(\"Network\").update()`. The `allOrNone: false` option is used to allow partial success in case some updates fail.\n- **Error Handling and Reporting:** It iterates through the update results, logging success or failure for each community. It also provides a summary of successful and erroneous updates.\n- **User Interaction:** Uses `prompts` to confirm the update action with the user when not running in a CI environment.\n- **Salesforce Connection:** Establishes a connection to the target Salesforce org using the `target-org` flag.\n</details>\n",
5159
+ "description": "\n## Command Behavior\n\n**Deletes records in multiple Salesforce objects using an SFDMU (Salesforce Data Migration Utility) workspace.**\n\nThis command provides a powerful and controlled way to remove data from your Salesforce orgs based on configurations defined in an SFDMU workspace. It's particularly useful for:\n\n- **Data Cleanup:** Removing test data, obsolete records, or sensitive information.\n- **Environment Reset:** Preparing sandboxes for new development cycles by clearing specific data sets.\n- **Compliance:** Deleting data to meet regulatory requirements.\n\n**Important Considerations for Production Environments:**\n\nIf you intend to run this command in a production environment, you must:\n\n- Set `runnableInProduction` to `true` in your `export.json` file within the SFDMU workspace.\n- Define `sfdmuCanModify: YOUR_INSTANCE_URL` in your branch-specific configuration file (e.g., `config/branches/.sfdx-hardis.YOUR_BRANCH.yml`) to explicitly authorize data modification for that instance.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It leverages the `sfdmu` plugin to perform the actual data deletion operations. The command acts as a wrapper, providing an assisted interface for SFDMU execution.\n- **Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select a data workspace using `selectDataWorkspace`.\n- **Org Selection:** It ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt using `promptOrgUsernameDefault`) to specify where the data deletion will occur.\n- **`deleteData` Utility:** The core logic for executing the SFDMU deletion process is encapsulated within the `deleteData` utility function, which takes the SFDMU workspace path and the target username as arguments.\n- **Environment Awareness:** It checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
5049
5160
  "examples": [
5050
- "$ sf hardis:org:community:update --name 'MyNetworkName' --status DownForMaintenance",
5051
- "$ sf hardis:org:community:update --name 'MyNetworkName,MySecondNetworkName' --status Live"
5052
- ],
5053
- "flags": {
5054
- "json": {
5055
- "description": "Format output as json.",
5056
- "helpGroup": "GLOBAL",
5057
- "name": "json",
5058
- "allowNo": false,
5059
- "type": "boolean"
5060
- },
5061
- "flags-dir": {
5062
- "helpGroup": "GLOBAL",
5063
- "name": "flags-dir",
5064
- "summary": "Import flag values from a directory.",
5065
- "hasDynamicHelp": false,
5066
- "multiple": false,
5067
- "type": "option"
5068
- },
5069
- "name": {
5070
- "char": "n",
5071
- "description": "List of Networks Names that you want to update, separated by comma",
5072
- "name": "name",
5073
- "required": true,
5074
- "hasDynamicHelp": false,
5075
- "multiple": false,
5076
- "type": "option"
5077
- },
5078
- "status": {
5079
- "char": "s",
5080
- "description": "New status for the community, available values are: Live, DownForMaintenance",
5081
- "name": "status",
5082
- "required": true,
5083
- "hasDynamicHelp": false,
5084
- "multiple": false,
5085
- "type": "option"
5086
- },
5087
- "debug": {
5088
- "char": "d",
5089
- "description": "Activate debug mode (more logs)",
5090
- "name": "debug",
5091
- "allowNo": false,
5092
- "type": "boolean"
5093
- },
5094
- "target-org": {
5095
- "aliases": [
5096
- "targetusername",
5097
- "u"
5098
- ],
5099
- "char": "o",
5100
- "deprecateAliases": true,
5101
- "name": "target-org",
5102
- "noCacheDefault": true,
5103
- "required": true,
5104
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
5105
- "hasDynamicHelp": true,
5106
- "multiple": false,
5107
- "type": "option"
5108
- }
5109
- },
5110
- "hasDynamicHelp": true,
5111
- "hiddenAliases": [],
5112
- "id": "hardis:org:community:update",
5113
- "pluginAlias": "sfdx-hardis",
5114
- "pluginName": "sfdx-hardis",
5115
- "pluginType": "core",
5116
- "strict": true,
5117
- "summary": "Update a community status.",
5118
- "enableJsonFlag": true,
5119
- "isESM": true,
5120
- "relativePath": [
5121
- "lib",
5122
- "commands",
5123
- "hardis",
5124
- "org",
5125
- "community",
5126
- "update.js"
5127
- ],
5128
- "aliasPermutations": [],
5129
- "permutations": [
5130
- "hardis:org:community:update",
5131
- "org:hardis:community:update",
5132
- "org:community:hardis:update",
5133
- "org:community:update:hardis",
5134
- "hardis:community:org:update",
5135
- "community:hardis:org:update",
5136
- "community:org:hardis:update",
5137
- "community:org:update:hardis",
5138
- "hardis:community:update:org",
5139
- "community:hardis:update:org",
5140
- "community:update:hardis:org",
5141
- "community:update:org:hardis",
5142
- "hardis:org:update:community",
5143
- "org:hardis:update:community",
5144
- "org:update:hardis:community",
5145
- "org:update:community:hardis",
5146
- "hardis:update:org:community",
5147
- "update:hardis:org:community",
5148
- "update:org:hardis:community",
5149
- "update:org:community:hardis",
5150
- "hardis:update:community:org",
5151
- "update:hardis:community:org",
5152
- "update:community:hardis:org",
5153
- "update:community:org:hardis"
5154
- ]
5155
- },
5156
- "hardis:org:data:delete": {
5157
- "aliases": [],
5158
- "args": {},
5159
- "description": "\n## Command Behavior\n\n**Deletes records in multiple Salesforce objects using an SFDMU (Salesforce Data Migration Utility) workspace.**\n\nThis command provides a powerful and controlled way to remove data from your Salesforce orgs based on configurations defined in an SFDMU workspace. It's particularly useful for:\n\n- **Data Cleanup:** Removing test data, obsolete records, or sensitive information.\n- **Environment Reset:** Preparing sandboxes for new development cycles by clearing specific data sets.\n- **Compliance:** Deleting data to meet regulatory requirements.\n\n**Important Considerations for Production Environments:**\n\nIf you intend to run this command in a production environment, you must:\n\n- Set `runnableInProduction` to `true` in your `export.json` file within the SFDMU workspace.\n- Define `sfdmuCanModify: YOUR_INSTANCE_URL` in your branch-specific configuration file (e.g., `config/branches/.sfdx-hardis.YOUR_BRANCH.yml`) to explicitly authorize data modification for that instance.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It leverages the `sfdmu` plugin to perform the actual data deletion operations. The command acts as a wrapper, providing an assisted interface for SFDMU execution.\n- **Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select a data workspace using `selectDataWorkspace`.\n- **Org Selection:** It ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt using `promptOrgUsernameDefault`) to specify where the data deletion will occur.\n- **`deleteData` Utility:** The core logic for executing the SFDMU deletion process is encapsulated within the `deleteData` utility function, which takes the SFDMU workspace path and the target username as arguments.\n- **Environment Awareness:** It checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
5160
- "examples": [
5161
- "$ sf hardis:org:data:delete"
5161
+ "$ sf hardis:org:data:delete"
5162
5162
  ],
5163
5163
  "flags": {
5164
5164
  "json": {
@@ -6045,12 +6045,15 @@
6045
6045
  "packagexmlfull:generate:org:hardis"
6046
6046
  ]
6047
6047
  },
6048
- "hardis:org:monitor:all": {
6048
+ "hardis:org:diagnose:audittrail": {
6049
6049
  "aliases": [],
6050
6050
  "args": {},
6051
- "description": "Monitor org, generate reports and sends notifications\n\nYou can disable some commands defining either a **monitoringDisable** property in `.sfdx-hardis.yml`, or a comma separated list in env variable **MONITORING_DISABLE**\n\nExample in .sfdx-hardis.yml:\n \n```yaml\nmonitoringDisable:\n - METADATA_STATUS\n - MISSING_ATTRIBUTES\n - UNUSED_METADATAS\n```\n \nExample in env var:\n\n```sh\nMONITORING_DISABLE=METADATA_STATUS,MISSING_ATTRIBUTES,UNUSED_METADATAS\n```\n\nA [default list of monitoring commands](https://sfdx-hardis.cloudity.com/salesforce-monitoring-home/#monitoring-commands) is used, if you want to override it you can define property **monitoringCommands** in your .sfdx-hardis.yml file\n\nExample:\n\n```yaml\nmonitoringCommands:\n - title: My Custom command\n command: sf my:custom:command\n - title: My Custom command 2\n command: sf my:other:custom:command\n```\n\nYou can force the daily run of all commands by defining env var `MONITORING_IGNORE_FREQUENCY=true`\n\nThe default list of commands is the following:\n\n| Key | Description | Command | Frequency |\n| :---: | :---- | :---- | :-----: |\n| [AUDIT_TRAIL](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | Detect suspect setup actions in major org | [sf hardis:org:diagnose:audittrail](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | daily |\n| [LEGACY_API](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | Detect calls to deprecated API versions | [sf hardis:org:diagnose:legacyapi](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | daily |\n| [ORG_LIMITS](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | Detect if org limits are close to be reached | [sf hardis:org:monitor:limits](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | daily |\n| [UNSECURED_CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | Detect unsecured Connected Apps in an org | [sf hardis:org:diagnose:unsecure-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | daily |\n| [LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | Extract licenses information | [sf hardis:org:diagnose:licenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | weekly |\n| [LINT_ACCESS](https://sfdx-hardis.cloudity.com/hardis/lint/access) | Detect custom elements with no access rights defined in permission sets | [sf hardis:lint:access](https://sfdx-hardis.cloudity.com/hardis/lint/access) | weekly |\n| [UNUSED_LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | Detect permission set licenses that are assigned to users that do not need them | [sf hardis:org:diagnose:unusedlicenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | weekly |\n| [UNUSED_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users without recent logins | [sf hardis:org:diagnose:unusedusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ACTIVE_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users with recent logins | [sf hardis:org:diagnose:unusedusers --returnactiveusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ORG_INFO](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | Get org info + SF instance info + next major upgrade date | [sf hardis:org:diagnose:instanceupgrade](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | weekly |\n| [RELEASE_UPDATES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | Gather warnings about incoming and overdue Release Updates | [sf hardis:org:diagnose:releaseupdates](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | weekly |\n| [UNUSED_METADATAS](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | Detect custom labels and custom permissions that are not in use | [sf hardis:lint:unusedmetadatas](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | weekly |\n| [UNUSED_APEX_CLASSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | Detect unused Apex classes in an org | [sf hardis:org:diagnose:unused-apex-classes](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | weekly |\n| [CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | Detect unused Connected Apps in an org | [sf hardis:org:diagnose:unused-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | weekly |\n| [METADATA_STATUS](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | Detect inactive metadata | [sf hardis:lint:metadatastatus](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | weekly |\n| [MISSING_ATTRIBUTES](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | Detect missing description on custom field | [sf hardis:lint:missingattributes](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | weekly |\n\n",
6051
+ "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
6052
6052
  "examples": [
6053
- "$ sf hardis:org:monitor:all"
6053
+ "$ sf hardis:org:diagnose:audittrail",
6054
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
6055
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
6056
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
6054
6057
  ],
6055
6058
  "flags": {
6056
6059
  "json": {
@@ -6068,6 +6071,30 @@
6068
6071
  "multiple": false,
6069
6072
  "type": "option"
6070
6073
  },
6074
+ "excludeusers": {
6075
+ "char": "e",
6076
+ "description": "Comma-separated list of usernames to exclude",
6077
+ "name": "excludeusers",
6078
+ "hasDynamicHelp": false,
6079
+ "multiple": false,
6080
+ "type": "option"
6081
+ },
6082
+ "lastndays": {
6083
+ "char": "t",
6084
+ "description": "Number of days to extract from today (included)",
6085
+ "name": "lastndays",
6086
+ "hasDynamicHelp": false,
6087
+ "multiple": false,
6088
+ "type": "option"
6089
+ },
6090
+ "outputfile": {
6091
+ "char": "f",
6092
+ "description": "Force the path and name of output report file. Must end with .csv",
6093
+ "name": "outputfile",
6094
+ "hasDynamicHelp": false,
6095
+ "multiple": false,
6096
+ "type": "option"
6097
+ },
6071
6098
  "debug": {
6072
6099
  "char": "d",
6073
6100
  "description": "Activate debug mode (more logs)",
@@ -6106,159 +6133,57 @@
6106
6133
  },
6107
6134
  "hasDynamicHelp": true,
6108
6135
  "hiddenAliases": [],
6109
- "id": "hardis:org:monitor:all",
6136
+ "id": "hardis:org:diagnose:audittrail",
6110
6137
  "pluginAlias": "sfdx-hardis",
6111
6138
  "pluginName": "sfdx-hardis",
6112
6139
  "pluginType": "core",
6113
6140
  "strict": true,
6114
6141
  "enableJsonFlag": true,
6115
- "title": "Monitor org",
6116
- "monitoringCommandsDefault": [
6117
- {
6118
- "key": "AUDIT_TRAIL",
6119
- "title": "Detect suspect setup actions in major org",
6120
- "command": "sf hardis:org:diagnose:audittrail",
6121
- "frequency": "daily"
6122
- },
6123
- {
6124
- "key": "LEGACY_API",
6125
- "title": "Detect calls to deprecated API versions",
6126
- "command": "sf hardis:org:diagnose:legacyapi",
6127
- "frequency": "daily"
6128
- },
6129
- {
6130
- "key": "ORG_LIMITS",
6131
- "title": "Detect if org limits are close to be reached",
6132
- "command": "sf hardis:org:monitor:limits",
6133
- "frequency": "daily"
6134
- },
6135
- {
6136
- "key": "UNSECURED_CONNECTED_APPS",
6137
- "title": "Detect unsecured Connected Apps in an org",
6138
- "command": "sf hardis:org:diagnose:unsecure-connected-apps",
6139
- "frequency": "daily"
6140
- },
6141
- {
6142
- "key": "LICENSES",
6143
- "title": "Extract licenses information",
6144
- "command": "sf hardis:org:diagnose:licenses",
6145
- "frequency": "weekly"
6146
- },
6147
- {
6148
- "key": "LINT_ACCESS",
6149
- "title": "Detect custom elements with no access rights defined in permission sets",
6150
- "command": "sf hardis:lint:access",
6151
- "frequency": "weekly"
6152
- },
6153
- {
6154
- "key": "UNUSED_LICENSES",
6155
- "title": "Detect permission set licenses that are assigned to users that do not need them",
6156
- "command": "sf hardis:org:diagnose:unusedlicenses",
6157
- "frequency": "weekly"
6158
- },
6159
- {
6160
- "key": "UNUSED_USERS",
6161
- "title": "Detect active users without recent logins",
6162
- "command": "sf hardis:org:diagnose:unusedusers",
6163
- "frequency": "weekly"
6164
- },
6165
- {
6166
- "key": "ACTIVE_USERS",
6167
- "title": "Detect active users with recent logins",
6168
- "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
6169
- "frequency": "weekly"
6170
- },
6171
- {
6172
- "key": "ORG_INFO",
6173
- "title": "Get org info + SF instance info + next major upgrade date",
6174
- "command": "sf hardis:org:diagnose:instanceupgrade",
6175
- "frequency": "weekly"
6176
- },
6177
- {
6178
- "key": "RELEASE_UPDATES",
6179
- "title": "Gather warnings about incoming and overdue Release Updates",
6180
- "command": "sf hardis:org:diagnose:releaseupdates",
6181
- "frequency": "weekly"
6182
- },
6183
- {
6184
- "key": "UNUSED_METADATAS",
6185
- "title": "Detect custom labels and custom permissions that are not in use",
6186
- "command": "sf hardis:lint:unusedmetadatas",
6187
- "frequency": "weekly"
6188
- },
6189
- {
6190
- "key": "UNUSED_APEX_CLASSES",
6191
- "title": "Detect unused Apex classes in an org",
6192
- "command": "sf hardis:org:diagnose:unused-apex-classes",
6193
- "frequency": "weekly"
6194
- },
6195
- {
6196
- "key": "CONNECTED_APPS",
6197
- "title": "Detect unused Connected Apps in an org",
6198
- "command": "sf hardis:org:diagnose:unused-connected-apps",
6199
- "frequency": "weekly"
6200
- },
6201
- {
6202
- "key": "METADATA_STATUS",
6203
- "title": "Detect inactive metadata",
6204
- "command": "sf hardis:lint:metadatastatus",
6205
- "frequency": "weekly"
6206
- },
6207
- {
6208
- "key": "MISSING_ATTRIBUTES",
6209
- "title": "Detect missing description on custom field",
6210
- "command": "sf hardis:lint:missingattributes",
6211
- "frequency": "weekly"
6212
- }
6213
- ],
6214
- "requiresProject": true,
6215
- "triggerNotification": true,
6142
+ "title": "Diagnose content of Setup Audit Trail",
6143
+ "requiresProject": false,
6216
6144
  "isESM": true,
6217
6145
  "relativePath": [
6218
6146
  "lib",
6219
6147
  "commands",
6220
6148
  "hardis",
6221
6149
  "org",
6222
- "monitor",
6223
- "all.js"
6150
+ "diagnose",
6151
+ "audittrail.js"
6224
6152
  ],
6225
6153
  "aliasPermutations": [],
6226
6154
  "permutations": [
6227
- "hardis:org:monitor:all",
6228
- "org:hardis:monitor:all",
6229
- "org:monitor:hardis:all",
6230
- "org:monitor:all:hardis",
6231
- "hardis:monitor:org:all",
6232
- "monitor:hardis:org:all",
6233
- "monitor:org:hardis:all",
6234
- "monitor:org:all:hardis",
6235
- "hardis:monitor:all:org",
6236
- "monitor:hardis:all:org",
6237
- "monitor:all:hardis:org",
6238
- "monitor:all:org:hardis",
6239
- "hardis:org:all:monitor",
6240
- "org:hardis:all:monitor",
6241
- "org:all:hardis:monitor",
6242
- "org:all:monitor:hardis",
6243
- "hardis:all:org:monitor",
6244
- "all:hardis:org:monitor",
6245
- "all:org:hardis:monitor",
6246
- "all:org:monitor:hardis",
6247
- "hardis:all:monitor:org",
6248
- "all:hardis:monitor:org",
6249
- "all:monitor:hardis:org",
6250
- "all:monitor:org:hardis"
6155
+ "hardis:org:diagnose:audittrail",
6156
+ "org:hardis:diagnose:audittrail",
6157
+ "org:diagnose:hardis:audittrail",
6158
+ "org:diagnose:audittrail:hardis",
6159
+ "hardis:diagnose:org:audittrail",
6160
+ "diagnose:hardis:org:audittrail",
6161
+ "diagnose:org:hardis:audittrail",
6162
+ "diagnose:org:audittrail:hardis",
6163
+ "hardis:diagnose:audittrail:org",
6164
+ "diagnose:hardis:audittrail:org",
6165
+ "diagnose:audittrail:hardis:org",
6166
+ "diagnose:audittrail:org:hardis",
6167
+ "hardis:org:audittrail:diagnose",
6168
+ "org:hardis:audittrail:diagnose",
6169
+ "org:audittrail:hardis:diagnose",
6170
+ "org:audittrail:diagnose:hardis",
6171
+ "hardis:audittrail:org:diagnose",
6172
+ "audittrail:hardis:org:diagnose",
6173
+ "audittrail:org:hardis:diagnose",
6174
+ "audittrail:org:diagnose:hardis",
6175
+ "hardis:audittrail:diagnose:org",
6176
+ "audittrail:hardis:diagnose:org",
6177
+ "audittrail:diagnose:hardis:org",
6178
+ "audittrail:diagnose:org:hardis"
6251
6179
  ]
6252
6180
  },
6253
- "hardis:org:monitor:backup": {
6181
+ "hardis:org:diagnose:instanceupgrade": {
6254
6182
  "aliases": [],
6255
6183
  "args": {},
6256
- "description": "Retrieve sfdx sources in the context of a monitoring backup\n\nThe command exists in 2 modes: filtered(default & recommended) and full.\n\n## Filtered mode (default, better performances)\n\nAutomatically skips metadatas from installed packages with namespace. \n\nYou can remove more metadata types from backup, especially in case you have too many metadatas and that provokes a crash, using:\n\n- Manual update of `manifest/package-skip-items.xml` config file (then commit & push in the same branch)\n\n - Works with full wildcard (`<members>*</members>`) , named metadata (`<members>Account.Name</members>`) or partial wildcards names (`<members>pi__*</members>` , `<members>*__dlm</members>` , or `<members>prefix*suffix</members>`)\n\n- Environment variable MONITORING_BACKUP_SKIP_METADATA_TYPES (example: `MONITORING_BACKUP_SKIP_METADATA_TYPES=CustomLabel,StaticResource,Translation`): that will be applied to all monitoring branches.\n\n## Full mode\n\nActivate it with **--full** parameter, or variable MONITORING_BACKUP_MODE_FULL=true\n\nIgnores filters (namespaces items & manifest/package-skip-items.xml) to retrieve ALL metadatas, including those you might not care about (reports, translations...)\n\nAs we can retrieve only 10000 files by call, the list of all metadatas will be chunked to make multiple calls (and take more time than filtered mode)\n\n- if you use `--full-apply-filters` , manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES filters will be applied anyway\n- if you use `--exclude-namespaces` , namespaced items will be ignored\n\n_With those both options, it's like if you are not using --full, but with chunked metadata download_\n\n## In CI/CD\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-metadata-backup/) and can output Grafana, Slack and MsTeams Notifications.\n\n## Troubleshooting\n\nIf you have unknown errors (it happens !), you can investigate using the full command with smaller chunks.\n\nExample: `sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters --max-by-chunk 500`\n\nIt will allow you the identify the responsible metadata and ignore it using package-skip-items.xml or MONITORING_BACKUP_SKIP_METADATA_TYPES env variable.\n\n## Documentation\n\n[Doc generation (including visual flows)](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/) is triggered at the end of the command.\n\nIf you want to also upload HTML Documentation on your Salesforce Org as static resource, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_ORG=\"true\"**\n\nIf you want to also upload HTML Documentation on Cloudflare, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_CLOUDFLARE=\"true\"**\n\n- If you want to generate the documentation in multiple languages, define variable SFDX_DOC_LANGUAGES (ex: SFDX_DOC_LANGUAGES=en,fr,de)\n- You can define one Cloudflare site by language, for example with the following variables:\n - CLOUDFLARE_PROJECT_NAME_EN=cloudity-demo-english\n - CLOUDFLARE_PROJECT_NAME_FR=cloudity-demo-french\n - CLOUDFLARE_PROJECT_NAME_DE=cloudity-demo-german\n\nIf Flow history doc always display a single state, you probably need to update your workflow configuration:\n\n- on Gitlab: Env variable [`GIT_FETCH_EXTRA_FLAGS: --depth 10000`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11)\n- on GitHub: [`fetch-depth: 0`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml#L58)\n- on Azure: [`fetchDepth: \"0\"`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml#L39)\n- on Bitbucket: [`step: clone: depth: full`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml#L18)\n",
6184
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
6257
6185
  "examples": [
6258
- "$ sf hardis:org:monitor:backup",
6259
- "$ sf hardis:org:monitor:backup --full",
6260
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
6261
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
6186
+ "$ sf hardis:org:diagnose:instanceupgrade"
6262
6187
  ],
6263
6188
  "flags": {
6264
6189
  "json": {
@@ -6276,57 +6201,6 @@
6276
6201
  "multiple": false,
6277
6202
  "type": "option"
6278
6203
  },
6279
- "full": {
6280
- "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
6281
- "name": "full",
6282
- "allowNo": false,
6283
- "type": "boolean"
6284
- },
6285
- "max-by-chunk": {
6286
- "char": "m",
6287
- "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
6288
- "name": "max-by-chunk",
6289
- "default": 3000,
6290
- "hasDynamicHelp": false,
6291
- "multiple": false,
6292
- "type": "option"
6293
- },
6294
- "exclude-namespaces": {
6295
- "char": "e",
6296
- "description": "If mode --full is activated, exclude namespaced metadatas",
6297
- "name": "exclude-namespaces",
6298
- "allowNo": false,
6299
- "type": "boolean"
6300
- },
6301
- "full-apply-filters": {
6302
- "char": "z",
6303
- "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
6304
- "name": "full-apply-filters",
6305
- "allowNo": false,
6306
- "type": "boolean"
6307
- },
6308
- "start-chunk": {
6309
- "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
6310
- "name": "start-chunk",
6311
- "default": 1,
6312
- "hasDynamicHelp": false,
6313
- "multiple": false,
6314
- "type": "option"
6315
- },
6316
- "skip-doc": {
6317
- "description": "Skip the generation of project documentation at the end of the command",
6318
- "name": "skip-doc",
6319
- "allowNo": false,
6320
- "type": "boolean"
6321
- },
6322
- "outputfile": {
6323
- "char": "f",
6324
- "description": "Force the path and name of output report file. Must end with .csv",
6325
- "name": "outputfile",
6326
- "hasDynamicHelp": false,
6327
- "multiple": false,
6328
- "type": "option"
6329
- },
6330
6204
  "debug": {
6331
6205
  "char": "d",
6332
6206
  "description": "Activate debug mode (more logs)",
@@ -6365,58 +6239,60 @@
6365
6239
  },
6366
6240
  "hasDynamicHelp": true,
6367
6241
  "hiddenAliases": [],
6368
- "id": "hardis:org:monitor:backup",
6242
+ "id": "hardis:org:diagnose:instanceupgrade",
6369
6243
  "pluginAlias": "sfdx-hardis",
6370
6244
  "pluginName": "sfdx-hardis",
6371
6245
  "pluginType": "core",
6372
6246
  "strict": true,
6373
6247
  "enableJsonFlag": true,
6374
- "title": "Backup DX sources",
6375
- "requiresProject": true,
6376
- "triggerNotification": true,
6248
+ "title": "Get Instance Upgrade date",
6249
+ "requiresProject": false,
6377
6250
  "isESM": true,
6378
6251
  "relativePath": [
6379
6252
  "lib",
6380
6253
  "commands",
6381
6254
  "hardis",
6382
6255
  "org",
6383
- "monitor",
6384
- "backup.js"
6256
+ "diagnose",
6257
+ "instanceupgrade.js"
6385
6258
  ],
6386
6259
  "aliasPermutations": [],
6387
6260
  "permutations": [
6388
- "hardis:org:monitor:backup",
6389
- "org:hardis:monitor:backup",
6390
- "org:monitor:hardis:backup",
6391
- "org:monitor:backup:hardis",
6392
- "hardis:monitor:org:backup",
6393
- "monitor:hardis:org:backup",
6394
- "monitor:org:hardis:backup",
6395
- "monitor:org:backup:hardis",
6396
- "hardis:monitor:backup:org",
6397
- "monitor:hardis:backup:org",
6398
- "monitor:backup:hardis:org",
6399
- "monitor:backup:org:hardis",
6400
- "hardis:org:backup:monitor",
6401
- "org:hardis:backup:monitor",
6402
- "org:backup:hardis:monitor",
6403
- "org:backup:monitor:hardis",
6404
- "hardis:backup:org:monitor",
6405
- "backup:hardis:org:monitor",
6406
- "backup:org:hardis:monitor",
6407
- "backup:org:monitor:hardis",
6408
- "hardis:backup:monitor:org",
6409
- "backup:hardis:monitor:org",
6410
- "backup:monitor:hardis:org",
6411
- "backup:monitor:org:hardis"
6261
+ "hardis:org:diagnose:instanceupgrade",
6262
+ "org:hardis:diagnose:instanceupgrade",
6263
+ "org:diagnose:hardis:instanceupgrade",
6264
+ "org:diagnose:instanceupgrade:hardis",
6265
+ "hardis:diagnose:org:instanceupgrade",
6266
+ "diagnose:hardis:org:instanceupgrade",
6267
+ "diagnose:org:hardis:instanceupgrade",
6268
+ "diagnose:org:instanceupgrade:hardis",
6269
+ "hardis:diagnose:instanceupgrade:org",
6270
+ "diagnose:hardis:instanceupgrade:org",
6271
+ "diagnose:instanceupgrade:hardis:org",
6272
+ "diagnose:instanceupgrade:org:hardis",
6273
+ "hardis:org:instanceupgrade:diagnose",
6274
+ "org:hardis:instanceupgrade:diagnose",
6275
+ "org:instanceupgrade:hardis:diagnose",
6276
+ "org:instanceupgrade:diagnose:hardis",
6277
+ "hardis:instanceupgrade:org:diagnose",
6278
+ "instanceupgrade:hardis:org:diagnose",
6279
+ "instanceupgrade:org:hardis:diagnose",
6280
+ "instanceupgrade:org:diagnose:hardis",
6281
+ "hardis:instanceupgrade:diagnose:org",
6282
+ "instanceupgrade:hardis:diagnose:org",
6283
+ "instanceupgrade:diagnose:hardis:org",
6284
+ "instanceupgrade:diagnose:org:hardis"
6412
6285
  ]
6413
6286
  },
6414
- "hardis:org:monitor:limits": {
6287
+ "hardis:org:diagnose:legacyapi": {
6415
6288
  "aliases": [],
6416
6289
  "args": {},
6417
- "description": "\n## Command Behavior\n\n**Checks the current usage of various Salesforce org limits and sends notifications if thresholds are exceeded.**\n\nThis command is a critical component of proactive Salesforce org management, helping administrators and developers monitor resource consumption and prevent hitting critical limits that could impact performance or functionality. It provides early warnings when limits are approaching their capacity.\n\nKey functionalities:\n\n- **Limit Retrieval:** Fetches a comprehensive list of all Salesforce org limits using the Salesforce CLI.\n- **Usage Calculation:** Calculates the percentage of each limit that is currently being used.\n- **Threshold-Based Alerting:** Assigns a severity (success, warning, or error) to each limit based on configurable thresholds:\n - **Warning:** If usage exceeds 50% (configurable via `LIMIT_THRESHOLD_WARNING` environment variable).\n - **Error:** If usage exceeds 75% (configurable via `LIMIT_THRESHOLD_ERROR` environment variable).\n- **CSV Report Generation:** Generates a CSV file containing all org limits, their current usage, maximum allowed, and calculated percentage used, along with the assigned severity.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of limits that have exceeded the warning or error thresholds.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-limits/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce CLI Integration:** It executes the `sf org limits list` command to retrieve the current org limits. It parses the JSON output of this command.\n- **Data Processing:** It iterates through the retrieved limits, calculates the `used` and `percentUsed` values, and assigns a `severity` (success, warning, error) based on the configured thresholds.\n- **Environment Variable Configuration:** Reads `LIMIT_THRESHOLD_WARNING` and `LIMIT_THRESHOLD_ERROR` environment variables to set the warning and error thresholds for limit usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of org limits.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and detailed metrics for each limit, which can be consumed by monitoring dashboards like Grafana.\n- **Exit Code Management:** Sets the process exit code to 1 if any limit is in an 'error' state, indicating a critical issue.\n</details>\n",
6290
+ "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
6418
6291
  "examples": [
6419
- "$ sf hardis:org:monitor:limits"
6292
+ "$ sf hardis:org:diagnose:legacyapi",
6293
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
6294
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
6295
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6420
6296
  ],
6421
6297
  "flags": {
6422
6298
  "json": {
@@ -6434,6 +6310,24 @@
6434
6310
  "multiple": false,
6435
6311
  "type": "option"
6436
6312
  },
6313
+ "eventtype": {
6314
+ "char": "e",
6315
+ "description": "Type of EventLogFile event to analyze",
6316
+ "name": "eventtype",
6317
+ "default": "ApiTotalUsage",
6318
+ "hasDynamicHelp": false,
6319
+ "multiple": false,
6320
+ "type": "option"
6321
+ },
6322
+ "limit": {
6323
+ "char": "l",
6324
+ "description": "Number of latest EventLogFile events to analyze",
6325
+ "name": "limit",
6326
+ "default": 999,
6327
+ "hasDynamicHelp": false,
6328
+ "multiple": false,
6329
+ "type": "option"
6330
+ },
6437
6331
  "outputfile": {
6438
6332
  "char": "f",
6439
6333
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6480,61 +6374,57 @@
6480
6374
  },
6481
6375
  "hasDynamicHelp": true,
6482
6376
  "hiddenAliases": [],
6483
- "id": "hardis:org:monitor:limits",
6377
+ "id": "hardis:org:diagnose:legacyapi",
6484
6378
  "pluginAlias": "sfdx-hardis",
6485
6379
  "pluginName": "sfdx-hardis",
6486
6380
  "pluginType": "core",
6487
6381
  "strict": true,
6488
6382
  "enableJsonFlag": true,
6489
- "title": "Check org limits",
6490
- "requiresProject": true,
6491
- "triggerNotification": true,
6383
+ "title": "Check for legacy API use",
6384
+ "requiresProject": false,
6492
6385
  "isESM": true,
6493
6386
  "relativePath": [
6494
6387
  "lib",
6495
6388
  "commands",
6496
6389
  "hardis",
6497
6390
  "org",
6498
- "monitor",
6499
- "limits.js"
6391
+ "diagnose",
6392
+ "legacyapi.js"
6500
6393
  ],
6501
6394
  "aliasPermutations": [],
6502
6395
  "permutations": [
6503
- "hardis:org:monitor:limits",
6504
- "org:hardis:monitor:limits",
6505
- "org:monitor:hardis:limits",
6506
- "org:monitor:limits:hardis",
6507
- "hardis:monitor:org:limits",
6508
- "monitor:hardis:org:limits",
6509
- "monitor:org:hardis:limits",
6510
- "monitor:org:limits:hardis",
6511
- "hardis:monitor:limits:org",
6512
- "monitor:hardis:limits:org",
6513
- "monitor:limits:hardis:org",
6514
- "monitor:limits:org:hardis",
6515
- "hardis:org:limits:monitor",
6516
- "org:hardis:limits:monitor",
6517
- "org:limits:hardis:monitor",
6518
- "org:limits:monitor:hardis",
6519
- "hardis:limits:org:monitor",
6520
- "limits:hardis:org:monitor",
6521
- "limits:org:hardis:monitor",
6522
- "limits:org:monitor:hardis",
6523
- "hardis:limits:monitor:org",
6524
- "limits:hardis:monitor:org",
6525
- "limits:monitor:hardis:org",
6526
- "limits:monitor:org:hardis"
6396
+ "hardis:org:diagnose:legacyapi",
6397
+ "org:hardis:diagnose:legacyapi",
6398
+ "org:diagnose:hardis:legacyapi",
6399
+ "org:diagnose:legacyapi:hardis",
6400
+ "hardis:diagnose:org:legacyapi",
6401
+ "diagnose:hardis:org:legacyapi",
6402
+ "diagnose:org:hardis:legacyapi",
6403
+ "diagnose:org:legacyapi:hardis",
6404
+ "hardis:diagnose:legacyapi:org",
6405
+ "diagnose:hardis:legacyapi:org",
6406
+ "diagnose:legacyapi:hardis:org",
6407
+ "diagnose:legacyapi:org:hardis",
6408
+ "hardis:org:legacyapi:diagnose",
6409
+ "org:hardis:legacyapi:diagnose",
6410
+ "org:legacyapi:hardis:diagnose",
6411
+ "org:legacyapi:diagnose:hardis",
6412
+ "hardis:legacyapi:org:diagnose",
6413
+ "legacyapi:hardis:org:diagnose",
6414
+ "legacyapi:org:hardis:diagnose",
6415
+ "legacyapi:org:diagnose:hardis",
6416
+ "hardis:legacyapi:diagnose:org",
6417
+ "legacyapi:hardis:diagnose:org",
6418
+ "legacyapi:diagnose:hardis:org",
6419
+ "legacyapi:diagnose:org:hardis"
6527
6420
  ]
6528
6421
  },
6529
- "hardis:org:diagnose:audittrail": {
6422
+ "hardis:org:diagnose:licenses": {
6530
6423
  "aliases": [],
6531
6424
  "args": {},
6532
- "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",
6425
+ "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
6533
6426
  "examples": [
6534
- "$ sf hardis:org:diagnose:audittrail",
6535
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
6536
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
6537
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
6427
+ "$ sf hardis:org:diagnose:licenses"
6538
6428
  ],
6539
6429
  "flags": {
6540
6430
  "json": {
@@ -6552,22 +6442,6 @@
6552
6442
  "multiple": false,
6553
6443
  "type": "option"
6554
6444
  },
6555
- "excludeusers": {
6556
- "char": "e",
6557
- "description": "Comma-separated list of usernames to exclude",
6558
- "name": "excludeusers",
6559
- "hasDynamicHelp": false,
6560
- "multiple": false,
6561
- "type": "option"
6562
- },
6563
- "lastndays": {
6564
- "char": "t",
6565
- "description": "Number of days to extract from today (included)",
6566
- "name": "lastndays",
6567
- "hasDynamicHelp": false,
6568
- "multiple": false,
6569
- "type": "option"
6570
- },
6571
6445
  "outputfile": {
6572
6446
  "char": "f",
6573
6447
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6576,6 +6450,13 @@
6576
6450
  "multiple": false,
6577
6451
  "type": "option"
6578
6452
  },
6453
+ "usedonly": {
6454
+ "char": "u",
6455
+ "description": "Filter to have only used licenses",
6456
+ "name": "usedonly",
6457
+ "allowNo": false,
6458
+ "type": "boolean"
6459
+ },
6579
6460
  "debug": {
6580
6461
  "char": "d",
6581
6462
  "description": "Activate debug mode (more logs)",
@@ -6614,13 +6495,13 @@
6614
6495
  },
6615
6496
  "hasDynamicHelp": true,
6616
6497
  "hiddenAliases": [],
6617
- "id": "hardis:org:diagnose:audittrail",
6498
+ "id": "hardis:org:diagnose:licenses",
6618
6499
  "pluginAlias": "sfdx-hardis",
6619
6500
  "pluginName": "sfdx-hardis",
6620
6501
  "pluginType": "core",
6621
6502
  "strict": true,
6622
6503
  "enableJsonFlag": true,
6623
- "title": "Diagnose content of Setup Audit Trail",
6504
+ "title": "List licenses subscribed and used in a Salesforce org",
6624
6505
  "requiresProject": false,
6625
6506
  "isESM": true,
6626
6507
  "relativePath": [
@@ -6629,42 +6510,42 @@
6629
6510
  "hardis",
6630
6511
  "org",
6631
6512
  "diagnose",
6632
- "audittrail.js"
6513
+ "licenses.js"
6633
6514
  ],
6634
6515
  "aliasPermutations": [],
6635
6516
  "permutations": [
6636
- "hardis:org:diagnose:audittrail",
6637
- "org:hardis:diagnose:audittrail",
6638
- "org:diagnose:hardis:audittrail",
6639
- "org:diagnose:audittrail:hardis",
6640
- "hardis:diagnose:org:audittrail",
6641
- "diagnose:hardis:org:audittrail",
6642
- "diagnose:org:hardis:audittrail",
6643
- "diagnose:org:audittrail:hardis",
6644
- "hardis:diagnose:audittrail:org",
6645
- "diagnose:hardis:audittrail:org",
6646
- "diagnose:audittrail:hardis:org",
6647
- "diagnose:audittrail:org:hardis",
6648
- "hardis:org:audittrail:diagnose",
6649
- "org:hardis:audittrail:diagnose",
6650
- "org:audittrail:hardis:diagnose",
6651
- "org:audittrail:diagnose:hardis",
6652
- "hardis:audittrail:org:diagnose",
6653
- "audittrail:hardis:org:diagnose",
6654
- "audittrail:org:hardis:diagnose",
6655
- "audittrail:org:diagnose:hardis",
6656
- "hardis:audittrail:diagnose:org",
6657
- "audittrail:hardis:diagnose:org",
6658
- "audittrail:diagnose:hardis:org",
6659
- "audittrail:diagnose:org:hardis"
6517
+ "hardis:org:diagnose:licenses",
6518
+ "org:hardis:diagnose:licenses",
6519
+ "org:diagnose:hardis:licenses",
6520
+ "org:diagnose:licenses:hardis",
6521
+ "hardis:diagnose:org:licenses",
6522
+ "diagnose:hardis:org:licenses",
6523
+ "diagnose:org:hardis:licenses",
6524
+ "diagnose:org:licenses:hardis",
6525
+ "hardis:diagnose:licenses:org",
6526
+ "diagnose:hardis:licenses:org",
6527
+ "diagnose:licenses:hardis:org",
6528
+ "diagnose:licenses:org:hardis",
6529
+ "hardis:org:licenses:diagnose",
6530
+ "org:hardis:licenses:diagnose",
6531
+ "org:licenses:hardis:diagnose",
6532
+ "org:licenses:diagnose:hardis",
6533
+ "hardis:licenses:org:diagnose",
6534
+ "licenses:hardis:org:diagnose",
6535
+ "licenses:org:hardis:diagnose",
6536
+ "licenses:org:diagnose:hardis",
6537
+ "hardis:licenses:diagnose:org",
6538
+ "licenses:hardis:diagnose:org",
6539
+ "licenses:diagnose:hardis:org",
6540
+ "licenses:diagnose:org:hardis"
6660
6541
  ]
6661
6542
  },
6662
- "hardis:org:diagnose:instanceupgrade": {
6543
+ "hardis:org:diagnose:releaseupdates": {
6663
6544
  "aliases": [],
6664
6545
  "args": {},
6665
- "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",
6546
+ "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6666
6547
  "examples": [
6667
- "$ sf hardis:org:diagnose:instanceupgrade"
6548
+ "$ sf hardis:org:diagnose:releaseupdates"
6668
6549
  ],
6669
6550
  "flags": {
6670
6551
  "json": {
@@ -6682,6 +6563,14 @@
6682
6563
  "multiple": false,
6683
6564
  "type": "option"
6684
6565
  },
6566
+ "outputfile": {
6567
+ "char": "f",
6568
+ "description": "Force the path and name of output report file. Must end with .csv",
6569
+ "name": "outputfile",
6570
+ "hasDynamicHelp": false,
6571
+ "multiple": false,
6572
+ "type": "option"
6573
+ },
6685
6574
  "debug": {
6686
6575
  "char": "d",
6687
6576
  "description": "Activate debug mode (more logs)",
@@ -6720,13 +6609,13 @@
6720
6609
  },
6721
6610
  "hasDynamicHelp": true,
6722
6611
  "hiddenAliases": [],
6723
- "id": "hardis:org:diagnose:instanceupgrade",
6612
+ "id": "hardis:org:diagnose:releaseupdates",
6724
6613
  "pluginAlias": "sfdx-hardis",
6725
6614
  "pluginName": "sfdx-hardis",
6726
6615
  "pluginType": "core",
6727
6616
  "strict": true,
6728
6617
  "enableJsonFlag": true,
6729
- "title": "Get Instance Upgrade date",
6618
+ "title": "Check Release Updates of an org",
6730
6619
  "requiresProject": false,
6731
6620
  "isESM": true,
6732
6621
  "relativePath": [
@@ -6735,45 +6624,42 @@
6735
6624
  "hardis",
6736
6625
  "org",
6737
6626
  "diagnose",
6738
- "instanceupgrade.js"
6627
+ "releaseupdates.js"
6739
6628
  ],
6740
6629
  "aliasPermutations": [],
6741
6630
  "permutations": [
6742
- "hardis:org:diagnose:instanceupgrade",
6743
- "org:hardis:diagnose:instanceupgrade",
6744
- "org:diagnose:hardis:instanceupgrade",
6745
- "org:diagnose:instanceupgrade:hardis",
6746
- "hardis:diagnose:org:instanceupgrade",
6747
- "diagnose:hardis:org:instanceupgrade",
6748
- "diagnose:org:hardis:instanceupgrade",
6749
- "diagnose:org:instanceupgrade:hardis",
6750
- "hardis:diagnose:instanceupgrade:org",
6751
- "diagnose:hardis:instanceupgrade:org",
6752
- "diagnose:instanceupgrade:hardis:org",
6753
- "diagnose:instanceupgrade:org:hardis",
6754
- "hardis:org:instanceupgrade:diagnose",
6755
- "org:hardis:instanceupgrade:diagnose",
6756
- "org:instanceupgrade:hardis:diagnose",
6757
- "org:instanceupgrade:diagnose:hardis",
6758
- "hardis:instanceupgrade:org:diagnose",
6759
- "instanceupgrade:hardis:org:diagnose",
6760
- "instanceupgrade:org:hardis:diagnose",
6761
- "instanceupgrade:org:diagnose:hardis",
6762
- "hardis:instanceupgrade:diagnose:org",
6763
- "instanceupgrade:hardis:diagnose:org",
6764
- "instanceupgrade:diagnose:hardis:org",
6765
- "instanceupgrade:diagnose:org:hardis"
6631
+ "hardis:org:diagnose:releaseupdates",
6632
+ "org:hardis:diagnose:releaseupdates",
6633
+ "org:diagnose:hardis:releaseupdates",
6634
+ "org:diagnose:releaseupdates:hardis",
6635
+ "hardis:diagnose:org:releaseupdates",
6636
+ "diagnose:hardis:org:releaseupdates",
6637
+ "diagnose:org:hardis:releaseupdates",
6638
+ "diagnose:org:releaseupdates:hardis",
6639
+ "hardis:diagnose:releaseupdates:org",
6640
+ "diagnose:hardis:releaseupdates:org",
6641
+ "diagnose:releaseupdates:hardis:org",
6642
+ "diagnose:releaseupdates:org:hardis",
6643
+ "hardis:org:releaseupdates:diagnose",
6644
+ "org:hardis:releaseupdates:diagnose",
6645
+ "org:releaseupdates:hardis:diagnose",
6646
+ "org:releaseupdates:diagnose:hardis",
6647
+ "hardis:releaseupdates:org:diagnose",
6648
+ "releaseupdates:hardis:org:diagnose",
6649
+ "releaseupdates:org:hardis:diagnose",
6650
+ "releaseupdates:org:diagnose:hardis",
6651
+ "hardis:releaseupdates:diagnose:org",
6652
+ "releaseupdates:hardis:diagnose:org",
6653
+ "releaseupdates:diagnose:hardis:org",
6654
+ "releaseupdates:diagnose:org:hardis"
6766
6655
  ]
6767
6656
  },
6768
- "hardis:org:diagnose:legacyapi": {
6657
+ "hardis:org:diagnose:storage-stats": {
6769
6658
  "aliases": [],
6770
6659
  "args": {},
6771
- "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",
6660
+ "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with yearly trends.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose between `CreatedDate` or `LastModifiedDate` for temporal breakdown.\n- **Yearly Storage Breakdown:** Executes grouped SOQL queries per object to calculate record counts by year, providing historical growth trends.\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed by-year breakdown and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects and single-select for date field choice. All objects are pre-selected by default for user convenience.\n- **Yearly Aggregation Queries:** For each selected SObject, executes a grouped SOQL query: `SELECT CALENDAR_YEAR(<DateField>) year, COUNT(Id) total FROM <SObject> GROUP BY CALENDAR_YEAR(<DateField>) ORDER BY CALENDAR_YEAR(<DateField>) DESC`. Handles query errors gracefully (logs error and continues with next object).\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and year.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all yearly statistics per object\n - Totals summary: includes only aggregate totals per object\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
6772
6661
  "examples": [
6773
- "$ sf hardis:org:diagnose:legacyapi",
6774
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
6775
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
6776
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6662
+ "$ sf hardis:org:diagnose:storage-stats"
6777
6663
  ],
6778
6664
  "flags": {
6779
6665
  "json": {
@@ -6791,24 +6677,6 @@
6791
6677
  "multiple": false,
6792
6678
  "type": "option"
6793
6679
  },
6794
- "eventtype": {
6795
- "char": "e",
6796
- "description": "Type of EventLogFile event to analyze",
6797
- "name": "eventtype",
6798
- "default": "ApiTotalUsage",
6799
- "hasDynamicHelp": false,
6800
- "multiple": false,
6801
- "type": "option"
6802
- },
6803
- "limit": {
6804
- "char": "l",
6805
- "description": "Number of latest EventLogFile events to analyze",
6806
- "name": "limit",
6807
- "default": 999,
6808
- "hasDynamicHelp": false,
6809
- "multiple": false,
6810
- "type": "option"
6811
- },
6812
6680
  "outputfile": {
6813
6681
  "char": "f",
6814
6682
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6855,14 +6723,14 @@
6855
6723
  },
6856
6724
  "hasDynamicHelp": true,
6857
6725
  "hiddenAliases": [],
6858
- "id": "hardis:org:diagnose:legacyapi",
6726
+ "id": "hardis:org:diagnose:storage-stats",
6859
6727
  "pluginAlias": "sfdx-hardis",
6860
6728
  "pluginName": "sfdx-hardis",
6861
6729
  "pluginType": "core",
6862
6730
  "strict": true,
6863
6731
  "enableJsonFlag": true,
6864
- "title": "Check for legacy API use",
6865
- "requiresProject": false,
6732
+ "title": "Extract Data Storage stats",
6733
+ "requiresProject": true,
6866
6734
  "isESM": true,
6867
6735
  "relativePath": [
6868
6736
  "lib",
@@ -6870,42 +6738,42 @@
6870
6738
  "hardis",
6871
6739
  "org",
6872
6740
  "diagnose",
6873
- "legacyapi.js"
6741
+ "storage-stats.js"
6874
6742
  ],
6875
6743
  "aliasPermutations": [],
6876
6744
  "permutations": [
6877
- "hardis:org:diagnose:legacyapi",
6878
- "org:hardis:diagnose:legacyapi",
6879
- "org:diagnose:hardis:legacyapi",
6880
- "org:diagnose:legacyapi:hardis",
6881
- "hardis:diagnose:org:legacyapi",
6882
- "diagnose:hardis:org:legacyapi",
6883
- "diagnose:org:hardis:legacyapi",
6884
- "diagnose:org:legacyapi:hardis",
6885
- "hardis:diagnose:legacyapi:org",
6886
- "diagnose:hardis:legacyapi:org",
6887
- "diagnose:legacyapi:hardis:org",
6888
- "diagnose:legacyapi:org:hardis",
6889
- "hardis:org:legacyapi:diagnose",
6890
- "org:hardis:legacyapi:diagnose",
6891
- "org:legacyapi:hardis:diagnose",
6892
- "org:legacyapi:diagnose:hardis",
6893
- "hardis:legacyapi:org:diagnose",
6894
- "legacyapi:hardis:org:diagnose",
6895
- "legacyapi:org:hardis:diagnose",
6896
- "legacyapi:org:diagnose:hardis",
6897
- "hardis:legacyapi:diagnose:org",
6898
- "legacyapi:hardis:diagnose:org",
6899
- "legacyapi:diagnose:hardis:org",
6900
- "legacyapi:diagnose:org:hardis"
6745
+ "hardis:org:diagnose:storage-stats",
6746
+ "org:hardis:diagnose:storage-stats",
6747
+ "org:diagnose:hardis:storage-stats",
6748
+ "org:diagnose:storage-stats:hardis",
6749
+ "hardis:diagnose:org:storage-stats",
6750
+ "diagnose:hardis:org:storage-stats",
6751
+ "diagnose:org:hardis:storage-stats",
6752
+ "diagnose:org:storage-stats:hardis",
6753
+ "hardis:diagnose:storage-stats:org",
6754
+ "diagnose:hardis:storage-stats:org",
6755
+ "diagnose:storage-stats:hardis:org",
6756
+ "diagnose:storage-stats:org:hardis",
6757
+ "hardis:org:storage-stats:diagnose",
6758
+ "org:hardis:storage-stats:diagnose",
6759
+ "org:storage-stats:hardis:diagnose",
6760
+ "org:storage-stats:diagnose:hardis",
6761
+ "hardis:storage-stats:org:diagnose",
6762
+ "storage-stats:hardis:org:diagnose",
6763
+ "storage-stats:org:hardis:diagnose",
6764
+ "storage-stats:org:diagnose:hardis",
6765
+ "hardis:storage-stats:diagnose:org",
6766
+ "storage-stats:hardis:diagnose:org",
6767
+ "storage-stats:diagnose:hardis:org",
6768
+ "storage-stats:diagnose:org:hardis"
6901
6769
  ]
6902
6770
  },
6903
- "hardis:org:diagnose:licenses": {
6771
+ "hardis:org:diagnose:unsecure-connected-apps": {
6904
6772
  "aliases": [],
6905
6773
  "args": {},
6906
- "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",
6774
+ "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",
6907
6775
  "examples": [
6908
- "$ sf hardis:org:diagnose:licenses"
6776
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6909
6777
  ],
6910
6778
  "flags": {
6911
6779
  "json": {
@@ -6931,13 +6799,6 @@
6931
6799
  "multiple": false,
6932
6800
  "type": "option"
6933
6801
  },
6934
- "usedonly": {
6935
- "char": "u",
6936
- "description": "Filter to have only used licenses",
6937
- "name": "usedonly",
6938
- "allowNo": false,
6939
- "type": "boolean"
6940
- },
6941
6802
  "debug": {
6942
6803
  "char": "d",
6943
6804
  "description": "Activate debug mode (more logs)",
@@ -6976,13 +6837,13 @@
6976
6837
  },
6977
6838
  "hasDynamicHelp": true,
6978
6839
  "hiddenAliases": [],
6979
- "id": "hardis:org:diagnose:licenses",
6840
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
6980
6841
  "pluginAlias": "sfdx-hardis",
6981
6842
  "pluginName": "sfdx-hardis",
6982
6843
  "pluginType": "core",
6983
6844
  "strict": true,
6984
6845
  "enableJsonFlag": true,
6985
- "title": "List licenses subscribed and used in a Salesforce org",
6846
+ "title": "Detect Unsecured Connected Apps",
6986
6847
  "requiresProject": false,
6987
6848
  "isESM": true,
6988
6849
  "relativePath": [
@@ -6991,42 +6852,43 @@
6991
6852
  "hardis",
6992
6853
  "org",
6993
6854
  "diagnose",
6994
- "licenses.js"
6855
+ "unsecure-connected-apps.js"
6995
6856
  ],
6996
6857
  "aliasPermutations": [],
6997
6858
  "permutations": [
6998
- "hardis:org:diagnose:licenses",
6999
- "org:hardis:diagnose:licenses",
7000
- "org:diagnose:hardis:licenses",
7001
- "org:diagnose:licenses:hardis",
7002
- "hardis:diagnose:org:licenses",
7003
- "diagnose:hardis:org:licenses",
7004
- "diagnose:org:hardis:licenses",
7005
- "diagnose:org:licenses:hardis",
7006
- "hardis:diagnose:licenses:org",
7007
- "diagnose:hardis:licenses:org",
7008
- "diagnose:licenses:hardis:org",
7009
- "diagnose:licenses:org:hardis",
7010
- "hardis:org:licenses:diagnose",
7011
- "org:hardis:licenses:diagnose",
7012
- "org:licenses:hardis:diagnose",
7013
- "org:licenses:diagnose:hardis",
7014
- "hardis:licenses:org:diagnose",
7015
- "licenses:hardis:org:diagnose",
7016
- "licenses:org:hardis:diagnose",
7017
- "licenses:org:diagnose:hardis",
7018
- "hardis:licenses:diagnose:org",
7019
- "licenses:hardis:diagnose:org",
7020
- "licenses:diagnose:hardis:org",
7021
- "licenses:diagnose:org:hardis"
6859
+ "hardis:org:diagnose:unsecure-connected-apps",
6860
+ "org:hardis:diagnose:unsecure-connected-apps",
6861
+ "org:diagnose:hardis:unsecure-connected-apps",
6862
+ "org:diagnose:unsecure-connected-apps:hardis",
6863
+ "hardis:diagnose:org:unsecure-connected-apps",
6864
+ "diagnose:hardis:org:unsecure-connected-apps",
6865
+ "diagnose:org:hardis:unsecure-connected-apps",
6866
+ "diagnose:org:unsecure-connected-apps:hardis",
6867
+ "hardis:diagnose:unsecure-connected-apps:org",
6868
+ "diagnose:hardis:unsecure-connected-apps:org",
6869
+ "diagnose:unsecure-connected-apps:hardis:org",
6870
+ "diagnose:unsecure-connected-apps:org:hardis",
6871
+ "hardis:org:unsecure-connected-apps:diagnose",
6872
+ "org:hardis:unsecure-connected-apps:diagnose",
6873
+ "org:unsecure-connected-apps:hardis:diagnose",
6874
+ "org:unsecure-connected-apps:diagnose:hardis",
6875
+ "hardis:unsecure-connected-apps:org:diagnose",
6876
+ "unsecure-connected-apps:hardis:org:diagnose",
6877
+ "unsecure-connected-apps:org:hardis:diagnose",
6878
+ "unsecure-connected-apps:org:diagnose:hardis",
6879
+ "hardis:unsecure-connected-apps:diagnose:org",
6880
+ "unsecure-connected-apps:hardis:diagnose:org",
6881
+ "unsecure-connected-apps:diagnose:hardis:org",
6882
+ "unsecure-connected-apps:diagnose:org:hardis"
7022
6883
  ]
7023
6884
  },
7024
- "hardis:org:diagnose:releaseupdates": {
6885
+ "hardis:org:diagnose:unused-apex-classes": {
7025
6886
  "aliases": [],
7026
6887
  "args": {},
7027
- "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",
6888
+ "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",
7028
6889
  "examples": [
7029
- "$ sf hardis:org:diagnose:releaseupdates"
6890
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6891
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
7030
6892
  ],
7031
6893
  "flags": {
7032
6894
  "json": {
@@ -7052,6 +6914,14 @@
7052
6914
  "multiple": false,
7053
6915
  "type": "option"
7054
6916
  },
6917
+ "days": {
6918
+ "char": "t",
6919
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6920
+ "name": "days",
6921
+ "hasDynamicHelp": false,
6922
+ "multiple": false,
6923
+ "type": "option"
6924
+ },
7055
6925
  "debug": {
7056
6926
  "char": "d",
7057
6927
  "description": "Activate debug mode (more logs)",
@@ -7090,13 +6960,13 @@
7090
6960
  },
7091
6961
  "hasDynamicHelp": true,
7092
6962
  "hiddenAliases": [],
7093
- "id": "hardis:org:diagnose:releaseupdates",
6963
+ "id": "hardis:org:diagnose:unused-apex-classes",
7094
6964
  "pluginAlias": "sfdx-hardis",
7095
6965
  "pluginName": "sfdx-hardis",
7096
6966
  "pluginType": "core",
7097
6967
  "strict": true,
7098
6968
  "enableJsonFlag": true,
7099
- "title": "Check Release Updates of an org",
6969
+ "title": "Detect unused Apex classes in an org",
7100
6970
  "requiresProject": false,
7101
6971
  "isESM": true,
7102
6972
  "relativePath": [
@@ -7105,42 +6975,42 @@
7105
6975
  "hardis",
7106
6976
  "org",
7107
6977
  "diagnose",
7108
- "releaseupdates.js"
6978
+ "unused-apex-classes.js"
7109
6979
  ],
7110
6980
  "aliasPermutations": [],
7111
6981
  "permutations": [
7112
- "hardis:org:diagnose:releaseupdates",
7113
- "org:hardis:diagnose:releaseupdates",
7114
- "org:diagnose:hardis:releaseupdates",
7115
- "org:diagnose:releaseupdates:hardis",
7116
- "hardis:diagnose:org:releaseupdates",
7117
- "diagnose:hardis:org:releaseupdates",
7118
- "diagnose:org:hardis:releaseupdates",
7119
- "diagnose:org:releaseupdates:hardis",
7120
- "hardis:diagnose:releaseupdates:org",
7121
- "diagnose:hardis:releaseupdates:org",
7122
- "diagnose:releaseupdates:hardis:org",
7123
- "diagnose:releaseupdates:org:hardis",
7124
- "hardis:org:releaseupdates:diagnose",
7125
- "org:hardis:releaseupdates:diagnose",
7126
- "org:releaseupdates:hardis:diagnose",
7127
- "org:releaseupdates:diagnose:hardis",
7128
- "hardis:releaseupdates:org:diagnose",
7129
- "releaseupdates:hardis:org:diagnose",
7130
- "releaseupdates:org:hardis:diagnose",
7131
- "releaseupdates:org:diagnose:hardis",
7132
- "hardis:releaseupdates:diagnose:org",
7133
- "releaseupdates:hardis:diagnose:org",
7134
- "releaseupdates:diagnose:hardis:org",
7135
- "releaseupdates:diagnose:org:hardis"
6982
+ "hardis:org:diagnose:unused-apex-classes",
6983
+ "org:hardis:diagnose:unused-apex-classes",
6984
+ "org:diagnose:hardis:unused-apex-classes",
6985
+ "org:diagnose:unused-apex-classes:hardis",
6986
+ "hardis:diagnose:org:unused-apex-classes",
6987
+ "diagnose:hardis:org:unused-apex-classes",
6988
+ "diagnose:org:hardis:unused-apex-classes",
6989
+ "diagnose:org:unused-apex-classes:hardis",
6990
+ "hardis:diagnose:unused-apex-classes:org",
6991
+ "diagnose:hardis:unused-apex-classes:org",
6992
+ "diagnose:unused-apex-classes:hardis:org",
6993
+ "diagnose:unused-apex-classes:org:hardis",
6994
+ "hardis:org:unused-apex-classes:diagnose",
6995
+ "org:hardis:unused-apex-classes:diagnose",
6996
+ "org:unused-apex-classes:hardis:diagnose",
6997
+ "org:unused-apex-classes:diagnose:hardis",
6998
+ "hardis:unused-apex-classes:org:diagnose",
6999
+ "unused-apex-classes:hardis:org:diagnose",
7000
+ "unused-apex-classes:org:hardis:diagnose",
7001
+ "unused-apex-classes:org:diagnose:hardis",
7002
+ "hardis:unused-apex-classes:diagnose:org",
7003
+ "unused-apex-classes:hardis:diagnose:org",
7004
+ "unused-apex-classes:diagnose:hardis:org",
7005
+ "unused-apex-classes:diagnose:org:hardis"
7136
7006
  ]
7137
7007
  },
7138
- "hardis:org:diagnose:storage-stats": {
7008
+ "hardis:org:diagnose:unused-connected-apps": {
7139
7009
  "aliases": [],
7140
7010
  "args": {},
7141
- "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with yearly trends.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose between `CreatedDate` or `LastModifiedDate` for temporal breakdown.\n- **Yearly Storage Breakdown:** Executes grouped SOQL queries per object to calculate record counts by year, providing historical growth trends.\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed by-year breakdown and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects and single-select for date field choice. All objects are pre-selected by default for user convenience.\n- **Yearly Aggregation Queries:** For each selected SObject, executes a grouped SOQL query: `SELECT CALENDAR_YEAR(<DateField>) year, COUNT(Id) total FROM <SObject> GROUP BY CALENDAR_YEAR(<DateField>) ORDER BY CALENDAR_YEAR(<DateField>) DESC`. Handles query errors gracefully (logs error and continues with next object).\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and year.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all yearly statistics per object\n - Totals summary: includes only aggregate totals per object\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
7011
+ "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",
7142
7012
  "examples": [
7143
- "$ sf hardis:org:diagnose:storage-stats"
7013
+ "$ sf hardis:org:diagnose:unused-connected-apps"
7144
7014
  ],
7145
7015
  "flags": {
7146
7016
  "json": {
@@ -7204,14 +7074,31 @@
7204
7074
  },
7205
7075
  "hasDynamicHelp": true,
7206
7076
  "hiddenAliases": [],
7207
- "id": "hardis:org:diagnose:storage-stats",
7077
+ "id": "hardis:org:diagnose:unused-connected-apps",
7208
7078
  "pluginAlias": "sfdx-hardis",
7209
7079
  "pluginName": "sfdx-hardis",
7210
7080
  "pluginType": "core",
7211
7081
  "strict": true,
7212
7082
  "enableJsonFlag": true,
7213
- "title": "Extract Data Storage stats",
7214
- "requiresProject": true,
7083
+ "title": "Unused Connected Apps in an org",
7084
+ "allowedInactiveConnectedApps": [
7085
+ "Ant Migration Tool",
7086
+ "Chatter Desktop",
7087
+ "Chatter Mobile for BlackBerry",
7088
+ "Force.com IDE",
7089
+ "OIQ_Integration",
7090
+ "Salesforce CLI",
7091
+ "Salesforce Files",
7092
+ "Salesforce Mobile Dashboards",
7093
+ "Salesforce Touch",
7094
+ "Salesforce for Outlook",
7095
+ "SalesforceA",
7096
+ "SalesforceA for Android",
7097
+ "SalesforceA for iOS",
7098
+ "SalesforceDX Namespace Registry",
7099
+ "SalesforceIQ"
7100
+ ],
7101
+ "requiresProject": false,
7215
7102
  "isESM": true,
7216
7103
  "relativePath": [
7217
7104
  "lib",
@@ -7219,42 +7106,43 @@
7219
7106
  "hardis",
7220
7107
  "org",
7221
7108
  "diagnose",
7222
- "storage-stats.js"
7109
+ "unused-connected-apps.js"
7223
7110
  ],
7224
7111
  "aliasPermutations": [],
7225
7112
  "permutations": [
7226
- "hardis:org:diagnose:storage-stats",
7227
- "org:hardis:diagnose:storage-stats",
7228
- "org:diagnose:hardis:storage-stats",
7229
- "org:diagnose:storage-stats:hardis",
7230
- "hardis:diagnose:org:storage-stats",
7231
- "diagnose:hardis:org:storage-stats",
7232
- "diagnose:org:hardis:storage-stats",
7233
- "diagnose:org:storage-stats:hardis",
7234
- "hardis:diagnose:storage-stats:org",
7235
- "diagnose:hardis:storage-stats:org",
7236
- "diagnose:storage-stats:hardis:org",
7237
- "diagnose:storage-stats:org:hardis",
7238
- "hardis:org:storage-stats:diagnose",
7239
- "org:hardis:storage-stats:diagnose",
7240
- "org:storage-stats:hardis:diagnose",
7241
- "org:storage-stats:diagnose:hardis",
7242
- "hardis:storage-stats:org:diagnose",
7243
- "storage-stats:hardis:org:diagnose",
7244
- "storage-stats:org:hardis:diagnose",
7245
- "storage-stats:org:diagnose:hardis",
7246
- "hardis:storage-stats:diagnose:org",
7247
- "storage-stats:hardis:diagnose:org",
7248
- "storage-stats:diagnose:hardis:org",
7249
- "storage-stats:diagnose:org:hardis"
7113
+ "hardis:org:diagnose:unused-connected-apps",
7114
+ "org:hardis:diagnose:unused-connected-apps",
7115
+ "org:diagnose:hardis:unused-connected-apps",
7116
+ "org:diagnose:unused-connected-apps:hardis",
7117
+ "hardis:diagnose:org:unused-connected-apps",
7118
+ "diagnose:hardis:org:unused-connected-apps",
7119
+ "diagnose:org:hardis:unused-connected-apps",
7120
+ "diagnose:org:unused-connected-apps:hardis",
7121
+ "hardis:diagnose:unused-connected-apps:org",
7122
+ "diagnose:hardis:unused-connected-apps:org",
7123
+ "diagnose:unused-connected-apps:hardis:org",
7124
+ "diagnose:unused-connected-apps:org:hardis",
7125
+ "hardis:org:unused-connected-apps:diagnose",
7126
+ "org:hardis:unused-connected-apps:diagnose",
7127
+ "org:unused-connected-apps:hardis:diagnose",
7128
+ "org:unused-connected-apps:diagnose:hardis",
7129
+ "hardis:unused-connected-apps:org:diagnose",
7130
+ "unused-connected-apps:hardis:org:diagnose",
7131
+ "unused-connected-apps:org:hardis:diagnose",
7132
+ "unused-connected-apps:org:diagnose:hardis",
7133
+ "hardis:unused-connected-apps:diagnose:org",
7134
+ "unused-connected-apps:hardis:diagnose:org",
7135
+ "unused-connected-apps:diagnose:hardis:org",
7136
+ "unused-connected-apps:diagnose:org:hardis"
7250
7137
  ]
7251
7138
  },
7252
- "hardis:org:diagnose:unsecure-connected-apps": {
7139
+ "hardis:org:diagnose:unusedlicenses": {
7253
7140
  "aliases": [],
7254
7141
  "args": {},
7255
- "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",
7142
+ "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",
7256
7143
  "examples": [
7257
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
7144
+ "$ sf hardis:org:diagnose:unusedlicenses",
7145
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
7258
7146
  ],
7259
7147
  "flags": {
7260
7148
  "json": {
@@ -7318,14 +7206,32 @@
7318
7206
  },
7319
7207
  "hasDynamicHelp": true,
7320
7208
  "hiddenAliases": [],
7321
- "id": "hardis:org:diagnose:unsecure-connected-apps",
7209
+ "id": "hardis:org:diagnose:unusedlicenses",
7322
7210
  "pluginAlias": "sfdx-hardis",
7323
7211
  "pluginName": "sfdx-hardis",
7324
7212
  "pluginType": "core",
7325
7213
  "strict": true,
7326
7214
  "enableJsonFlag": true,
7327
- "title": "Detect Unsecured Connected Apps",
7215
+ "title": "Detect unused Permission Set Licenses (beta)",
7328
7216
  "requiresProject": false,
7217
+ "additionalPermissionSetsToAlwaysGet": [
7218
+ "Sales_User"
7219
+ ],
7220
+ "permSetsPermSetLicenses": [
7221
+ {
7222
+ "permSet": "Sales_User",
7223
+ "permSetLicense": "SalesUserPsl"
7224
+ }
7225
+ ],
7226
+ "profilesPermissionSetLicenses": [
7227
+ {
7228
+ "profile": "Salesforce API Only",
7229
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
7230
+ }
7231
+ ],
7232
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
7233
+ "IdentityConnect"
7234
+ ],
7329
7235
  "isESM": true,
7330
7236
  "relativePath": [
7331
7237
  "lib",
@@ -7333,43 +7239,46 @@
7333
7239
  "hardis",
7334
7240
  "org",
7335
7241
  "diagnose",
7336
- "unsecure-connected-apps.js"
7242
+ "unusedlicenses.js"
7337
7243
  ],
7338
7244
  "aliasPermutations": [],
7339
7245
  "permutations": [
7340
- "hardis:org:diagnose:unsecure-connected-apps",
7341
- "org:hardis:diagnose:unsecure-connected-apps",
7342
- "org:diagnose:hardis:unsecure-connected-apps",
7343
- "org:diagnose:unsecure-connected-apps:hardis",
7344
- "hardis:diagnose:org:unsecure-connected-apps",
7345
- "diagnose:hardis:org:unsecure-connected-apps",
7346
- "diagnose:org:hardis:unsecure-connected-apps",
7347
- "diagnose:org:unsecure-connected-apps:hardis",
7348
- "hardis:diagnose:unsecure-connected-apps:org",
7349
- "diagnose:hardis:unsecure-connected-apps:org",
7350
- "diagnose:unsecure-connected-apps:hardis:org",
7351
- "diagnose:unsecure-connected-apps:org:hardis",
7352
- "hardis:org:unsecure-connected-apps:diagnose",
7353
- "org:hardis:unsecure-connected-apps:diagnose",
7354
- "org:unsecure-connected-apps:hardis:diagnose",
7355
- "org:unsecure-connected-apps:diagnose:hardis",
7356
- "hardis:unsecure-connected-apps:org:diagnose",
7357
- "unsecure-connected-apps:hardis:org:diagnose",
7358
- "unsecure-connected-apps:org:hardis:diagnose",
7359
- "unsecure-connected-apps:org:diagnose:hardis",
7360
- "hardis:unsecure-connected-apps:diagnose:org",
7361
- "unsecure-connected-apps:hardis:diagnose:org",
7362
- "unsecure-connected-apps:diagnose:hardis:org",
7363
- "unsecure-connected-apps:diagnose:org:hardis"
7246
+ "hardis:org:diagnose:unusedlicenses",
7247
+ "org:hardis:diagnose:unusedlicenses",
7248
+ "org:diagnose:hardis:unusedlicenses",
7249
+ "org:diagnose:unusedlicenses:hardis",
7250
+ "hardis:diagnose:org:unusedlicenses",
7251
+ "diagnose:hardis:org:unusedlicenses",
7252
+ "diagnose:org:hardis:unusedlicenses",
7253
+ "diagnose:org:unusedlicenses:hardis",
7254
+ "hardis:diagnose:unusedlicenses:org",
7255
+ "diagnose:hardis:unusedlicenses:org",
7256
+ "diagnose:unusedlicenses:hardis:org",
7257
+ "diagnose:unusedlicenses:org:hardis",
7258
+ "hardis:org:unusedlicenses:diagnose",
7259
+ "org:hardis:unusedlicenses:diagnose",
7260
+ "org:unusedlicenses:hardis:diagnose",
7261
+ "org:unusedlicenses:diagnose:hardis",
7262
+ "hardis:unusedlicenses:org:diagnose",
7263
+ "unusedlicenses:hardis:org:diagnose",
7264
+ "unusedlicenses:org:hardis:diagnose",
7265
+ "unusedlicenses:org:diagnose:hardis",
7266
+ "hardis:unusedlicenses:diagnose:org",
7267
+ "unusedlicenses:hardis:diagnose:org",
7268
+ "unusedlicenses:diagnose:hardis:org",
7269
+ "unusedlicenses:diagnose:org:hardis"
7364
7270
  ]
7365
7271
  },
7366
- "hardis:org:diagnose:unused-apex-classes": {
7272
+ "hardis:org:diagnose:unusedusers": {
7367
7273
  "aliases": [],
7368
7274
  "args": {},
7369
- "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",
7275
+ "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>",
7370
7276
  "examples": [
7371
- "$ sf hardis:org:diagnose:unused-apex-classes",
7372
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
7277
+ "$ sf hardis:org:diagnose:unusedusers",
7278
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
7279
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7280
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7281
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7373
7282
  ],
7374
7283
  "flags": {
7375
7284
  "json": {
@@ -7403,6 +7312,33 @@
7403
7312
  "multiple": false,
7404
7313
  "type": "option"
7405
7314
  },
7315
+ "licensetypes": {
7316
+ "char": "l",
7317
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7318
+ "name": "licensetypes",
7319
+ "hasDynamicHelp": false,
7320
+ "multiple": false,
7321
+ "options": [
7322
+ "all",
7323
+ "all-crm",
7324
+ "all-paying"
7325
+ ],
7326
+ "type": "option"
7327
+ },
7328
+ "licenseidentifiers": {
7329
+ "char": "i",
7330
+ "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",
7331
+ "name": "licenseidentifiers",
7332
+ "hasDynamicHelp": false,
7333
+ "multiple": false,
7334
+ "type": "option"
7335
+ },
7336
+ "returnactiveusers": {
7337
+ "description": "Inverts the command by returning the active users",
7338
+ "name": "returnactiveusers",
7339
+ "allowNo": false,
7340
+ "type": "boolean"
7341
+ },
7406
7342
  "debug": {
7407
7343
  "char": "d",
7408
7344
  "description": "Activate debug mode (more logs)",
@@ -7441,13 +7377,13 @@
7441
7377
  },
7442
7378
  "hasDynamicHelp": true,
7443
7379
  "hiddenAliases": [],
7444
- "id": "hardis:org:diagnose:unused-apex-classes",
7380
+ "id": "hardis:org:diagnose:unusedusers",
7445
7381
  "pluginAlias": "sfdx-hardis",
7446
7382
  "pluginName": "sfdx-hardis",
7447
7383
  "pluginType": "core",
7448
7384
  "strict": true,
7449
7385
  "enableJsonFlag": true,
7450
- "title": "Detect unused Apex classes in an org",
7386
+ "title": "Detect unused Users in Salesforce",
7451
7387
  "requiresProject": false,
7452
7388
  "isESM": true,
7453
7389
  "relativePath": [
@@ -7456,42 +7392,42 @@
7456
7392
  "hardis",
7457
7393
  "org",
7458
7394
  "diagnose",
7459
- "unused-apex-classes.js"
7395
+ "unusedusers.js"
7460
7396
  ],
7461
7397
  "aliasPermutations": [],
7462
7398
  "permutations": [
7463
- "hardis:org:diagnose:unused-apex-classes",
7464
- "org:hardis:diagnose:unused-apex-classes",
7465
- "org:diagnose:hardis:unused-apex-classes",
7466
- "org:diagnose:unused-apex-classes:hardis",
7467
- "hardis:diagnose:org:unused-apex-classes",
7468
- "diagnose:hardis:org:unused-apex-classes",
7469
- "diagnose:org:hardis:unused-apex-classes",
7470
- "diagnose:org:unused-apex-classes:hardis",
7471
- "hardis:diagnose:unused-apex-classes:org",
7472
- "diagnose:hardis:unused-apex-classes:org",
7473
- "diagnose:unused-apex-classes:hardis:org",
7474
- "diagnose:unused-apex-classes:org:hardis",
7475
- "hardis:org:unused-apex-classes:diagnose",
7476
- "org:hardis:unused-apex-classes:diagnose",
7477
- "org:unused-apex-classes:hardis:diagnose",
7478
- "org:unused-apex-classes:diagnose:hardis",
7479
- "hardis:unused-apex-classes:org:diagnose",
7480
- "unused-apex-classes:hardis:org:diagnose",
7481
- "unused-apex-classes:org:hardis:diagnose",
7482
- "unused-apex-classes:org:diagnose:hardis",
7483
- "hardis:unused-apex-classes:diagnose:org",
7484
- "unused-apex-classes:hardis:diagnose:org",
7485
- "unused-apex-classes:diagnose:hardis:org",
7486
- "unused-apex-classes:diagnose:org:hardis"
7399
+ "hardis:org:diagnose:unusedusers",
7400
+ "org:hardis:diagnose:unusedusers",
7401
+ "org:diagnose:hardis:unusedusers",
7402
+ "org:diagnose:unusedusers:hardis",
7403
+ "hardis:diagnose:org:unusedusers",
7404
+ "diagnose:hardis:org:unusedusers",
7405
+ "diagnose:org:hardis:unusedusers",
7406
+ "diagnose:org:unusedusers:hardis",
7407
+ "hardis:diagnose:unusedusers:org",
7408
+ "diagnose:hardis:unusedusers:org",
7409
+ "diagnose:unusedusers:hardis:org",
7410
+ "diagnose:unusedusers:org:hardis",
7411
+ "hardis:org:unusedusers:diagnose",
7412
+ "org:hardis:unusedusers:diagnose",
7413
+ "org:unusedusers:hardis:diagnose",
7414
+ "org:unusedusers:diagnose:hardis",
7415
+ "hardis:unusedusers:org:diagnose",
7416
+ "unusedusers:hardis:org:diagnose",
7417
+ "unusedusers:org:hardis:diagnose",
7418
+ "unusedusers:org:diagnose:hardis",
7419
+ "hardis:unusedusers:diagnose:org",
7420
+ "unusedusers:hardis:diagnose:org",
7421
+ "unusedusers:diagnose:hardis:org",
7422
+ "unusedusers:diagnose:org:hardis"
7487
7423
  ]
7488
7424
  },
7489
- "hardis:org:diagnose:unused-connected-apps": {
7425
+ "hardis:org:monitor:all": {
7490
7426
  "aliases": [],
7491
7427
  "args": {},
7492
- "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",
7428
+ "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",
7493
7429
  "examples": [
7494
- "$ sf hardis:org:diagnose:unused-connected-apps"
7430
+ "$ sf hardis:org:monitor:all"
7495
7431
  ],
7496
7432
  "flags": {
7497
7433
  "json": {
@@ -7509,14 +7445,6 @@
7509
7445
  "multiple": false,
7510
7446
  "type": "option"
7511
7447
  },
7512
- "outputfile": {
7513
- "char": "f",
7514
- "description": "Force the path and name of output report file. Must end with .csv",
7515
- "name": "outputfile",
7516
- "hasDynamicHelp": false,
7517
- "multiple": false,
7518
- "type": "option"
7519
- },
7520
7448
  "debug": {
7521
7449
  "char": "d",
7522
7450
  "description": "Activate debug mode (more logs)",
@@ -7555,75 +7483,159 @@
7555
7483
  },
7556
7484
  "hasDynamicHelp": true,
7557
7485
  "hiddenAliases": [],
7558
- "id": "hardis:org:diagnose:unused-connected-apps",
7486
+ "id": "hardis:org:monitor:all",
7559
7487
  "pluginAlias": "sfdx-hardis",
7560
7488
  "pluginName": "sfdx-hardis",
7561
7489
  "pluginType": "core",
7562
7490
  "strict": true,
7563
7491
  "enableJsonFlag": true,
7564
- "title": "Unused Connected Apps in an org",
7565
- "allowedInactiveConnectedApps": [
7566
- "Ant Migration Tool",
7567
- "Chatter Desktop",
7568
- "Chatter Mobile for BlackBerry",
7569
- "Force.com IDE",
7570
- "OIQ_Integration",
7571
- "Salesforce CLI",
7572
- "Salesforce Files",
7573
- "Salesforce Mobile Dashboards",
7574
- "Salesforce Touch",
7575
- "Salesforce for Outlook",
7576
- "SalesforceA",
7577
- "SalesforceA for Android",
7578
- "SalesforceA for iOS",
7579
- "SalesforceDX Namespace Registry",
7580
- "SalesforceIQ"
7492
+ "title": "Monitor org",
7493
+ "monitoringCommandsDefault": [
7494
+ {
7495
+ "key": "AUDIT_TRAIL",
7496
+ "title": "Detect suspect setup actions in major org",
7497
+ "command": "sf hardis:org:diagnose:audittrail",
7498
+ "frequency": "daily"
7499
+ },
7500
+ {
7501
+ "key": "LEGACY_API",
7502
+ "title": "Detect calls to deprecated API versions",
7503
+ "command": "sf hardis:org:diagnose:legacyapi",
7504
+ "frequency": "daily"
7505
+ },
7506
+ {
7507
+ "key": "ORG_LIMITS",
7508
+ "title": "Detect if org limits are close to be reached",
7509
+ "command": "sf hardis:org:monitor:limits",
7510
+ "frequency": "daily"
7511
+ },
7512
+ {
7513
+ "key": "UNSECURED_CONNECTED_APPS",
7514
+ "title": "Detect unsecured Connected Apps in an org",
7515
+ "command": "sf hardis:org:diagnose:unsecure-connected-apps",
7516
+ "frequency": "daily"
7517
+ },
7518
+ {
7519
+ "key": "LICENSES",
7520
+ "title": "Extract licenses information",
7521
+ "command": "sf hardis:org:diagnose:licenses",
7522
+ "frequency": "weekly"
7523
+ },
7524
+ {
7525
+ "key": "LINT_ACCESS",
7526
+ "title": "Detect custom elements with no access rights defined in permission sets",
7527
+ "command": "sf hardis:lint:access",
7528
+ "frequency": "weekly"
7529
+ },
7530
+ {
7531
+ "key": "UNUSED_LICENSES",
7532
+ "title": "Detect permission set licenses that are assigned to users that do not need them",
7533
+ "command": "sf hardis:org:diagnose:unusedlicenses",
7534
+ "frequency": "weekly"
7535
+ },
7536
+ {
7537
+ "key": "UNUSED_USERS",
7538
+ "title": "Detect active users without recent logins",
7539
+ "command": "sf hardis:org:diagnose:unusedusers",
7540
+ "frequency": "weekly"
7541
+ },
7542
+ {
7543
+ "key": "ACTIVE_USERS",
7544
+ "title": "Detect active users with recent logins",
7545
+ "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
7546
+ "frequency": "weekly"
7547
+ },
7548
+ {
7549
+ "key": "ORG_INFO",
7550
+ "title": "Get org info + SF instance info + next major upgrade date",
7551
+ "command": "sf hardis:org:diagnose:instanceupgrade",
7552
+ "frequency": "weekly"
7553
+ },
7554
+ {
7555
+ "key": "RELEASE_UPDATES",
7556
+ "title": "Gather warnings about incoming and overdue Release Updates",
7557
+ "command": "sf hardis:org:diagnose:releaseupdates",
7558
+ "frequency": "weekly"
7559
+ },
7560
+ {
7561
+ "key": "UNUSED_METADATAS",
7562
+ "title": "Detect custom labels and custom permissions that are not in use",
7563
+ "command": "sf hardis:lint:unusedmetadatas",
7564
+ "frequency": "weekly"
7565
+ },
7566
+ {
7567
+ "key": "UNUSED_APEX_CLASSES",
7568
+ "title": "Detect unused Apex classes in an org",
7569
+ "command": "sf hardis:org:diagnose:unused-apex-classes",
7570
+ "frequency": "weekly"
7571
+ },
7572
+ {
7573
+ "key": "CONNECTED_APPS",
7574
+ "title": "Detect unused Connected Apps in an org",
7575
+ "command": "sf hardis:org:diagnose:unused-connected-apps",
7576
+ "frequency": "weekly"
7577
+ },
7578
+ {
7579
+ "key": "METADATA_STATUS",
7580
+ "title": "Detect inactive metadata",
7581
+ "command": "sf hardis:lint:metadatastatus",
7582
+ "frequency": "weekly"
7583
+ },
7584
+ {
7585
+ "key": "MISSING_ATTRIBUTES",
7586
+ "title": "Detect missing description on custom field",
7587
+ "command": "sf hardis:lint:missingattributes",
7588
+ "frequency": "weekly"
7589
+ }
7581
7590
  ],
7582
- "requiresProject": false,
7591
+ "requiresProject": true,
7592
+ "triggerNotification": true,
7583
7593
  "isESM": true,
7584
7594
  "relativePath": [
7585
7595
  "lib",
7586
7596
  "commands",
7587
7597
  "hardis",
7588
7598
  "org",
7589
- "diagnose",
7590
- "unused-connected-apps.js"
7599
+ "monitor",
7600
+ "all.js"
7591
7601
  ],
7592
7602
  "aliasPermutations": [],
7593
7603
  "permutations": [
7594
- "hardis:org:diagnose:unused-connected-apps",
7595
- "org:hardis:diagnose:unused-connected-apps",
7596
- "org:diagnose:hardis:unused-connected-apps",
7597
- "org:diagnose:unused-connected-apps:hardis",
7598
- "hardis:diagnose:org:unused-connected-apps",
7599
- "diagnose:hardis:org:unused-connected-apps",
7600
- "diagnose:org:hardis:unused-connected-apps",
7601
- "diagnose:org:unused-connected-apps:hardis",
7602
- "hardis:diagnose:unused-connected-apps:org",
7603
- "diagnose:hardis:unused-connected-apps:org",
7604
- "diagnose:unused-connected-apps:hardis:org",
7605
- "diagnose:unused-connected-apps:org:hardis",
7606
- "hardis:org:unused-connected-apps:diagnose",
7607
- "org:hardis:unused-connected-apps:diagnose",
7608
- "org:unused-connected-apps:hardis:diagnose",
7609
- "org:unused-connected-apps:diagnose:hardis",
7610
- "hardis:unused-connected-apps:org:diagnose",
7611
- "unused-connected-apps:hardis:org:diagnose",
7612
- "unused-connected-apps:org:hardis:diagnose",
7613
- "unused-connected-apps:org:diagnose:hardis",
7614
- "hardis:unused-connected-apps:diagnose:org",
7615
- "unused-connected-apps:hardis:diagnose:org",
7616
- "unused-connected-apps:diagnose:hardis:org",
7617
- "unused-connected-apps:diagnose:org:hardis"
7604
+ "hardis:org:monitor:all",
7605
+ "org:hardis:monitor:all",
7606
+ "org:monitor:hardis:all",
7607
+ "org:monitor:all:hardis",
7608
+ "hardis:monitor:org:all",
7609
+ "monitor:hardis:org:all",
7610
+ "monitor:org:hardis:all",
7611
+ "monitor:org:all:hardis",
7612
+ "hardis:monitor:all:org",
7613
+ "monitor:hardis:all:org",
7614
+ "monitor:all:hardis:org",
7615
+ "monitor:all:org:hardis",
7616
+ "hardis:org:all:monitor",
7617
+ "org:hardis:all:monitor",
7618
+ "org:all:hardis:monitor",
7619
+ "org:all:monitor:hardis",
7620
+ "hardis:all:org:monitor",
7621
+ "all:hardis:org:monitor",
7622
+ "all:org:hardis:monitor",
7623
+ "all:org:monitor:hardis",
7624
+ "hardis:all:monitor:org",
7625
+ "all:hardis:monitor:org",
7626
+ "all:monitor:hardis:org",
7627
+ "all:monitor:org:hardis"
7618
7628
  ]
7619
7629
  },
7620
- "hardis:org:diagnose:unusedlicenses": {
7630
+ "hardis:org:monitor:backup": {
7621
7631
  "aliases": [],
7622
7632
  "args": {},
7623
- "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",
7633
+ "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",
7624
7634
  "examples": [
7625
- "$ sf hardis:org:diagnose:unusedlicenses",
7626
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
7635
+ "$ sf hardis:org:monitor:backup",
7636
+ "$ sf hardis:org:monitor:backup --full",
7637
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
7638
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
7627
7639
  ],
7628
7640
  "flags": {
7629
7641
  "json": {
@@ -7641,6 +7653,49 @@
7641
7653
  "multiple": false,
7642
7654
  "type": "option"
7643
7655
  },
7656
+ "full": {
7657
+ "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
7658
+ "name": "full",
7659
+ "allowNo": false,
7660
+ "type": "boolean"
7661
+ },
7662
+ "max-by-chunk": {
7663
+ "char": "m",
7664
+ "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
7665
+ "name": "max-by-chunk",
7666
+ "default": 3000,
7667
+ "hasDynamicHelp": false,
7668
+ "multiple": false,
7669
+ "type": "option"
7670
+ },
7671
+ "exclude-namespaces": {
7672
+ "char": "e",
7673
+ "description": "If mode --full is activated, exclude namespaced metadatas",
7674
+ "name": "exclude-namespaces",
7675
+ "allowNo": false,
7676
+ "type": "boolean"
7677
+ },
7678
+ "full-apply-filters": {
7679
+ "char": "z",
7680
+ "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
7681
+ "name": "full-apply-filters",
7682
+ "allowNo": false,
7683
+ "type": "boolean"
7684
+ },
7685
+ "start-chunk": {
7686
+ "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
7687
+ "name": "start-chunk",
7688
+ "default": 1,
7689
+ "hasDynamicHelp": false,
7690
+ "multiple": false,
7691
+ "type": "option"
7692
+ },
7693
+ "skip-doc": {
7694
+ "description": "Skip the generation of project documentation at the end of the command",
7695
+ "name": "skip-doc",
7696
+ "allowNo": false,
7697
+ "type": "boolean"
7698
+ },
7644
7699
  "outputfile": {
7645
7700
  "char": "f",
7646
7701
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -7687,79 +7742,58 @@
7687
7742
  },
7688
7743
  "hasDynamicHelp": true,
7689
7744
  "hiddenAliases": [],
7690
- "id": "hardis:org:diagnose:unusedlicenses",
7745
+ "id": "hardis:org:monitor:backup",
7691
7746
  "pluginAlias": "sfdx-hardis",
7692
7747
  "pluginName": "sfdx-hardis",
7693
7748
  "pluginType": "core",
7694
7749
  "strict": true,
7695
7750
  "enableJsonFlag": true,
7696
- "title": "Detect unused Permission Set Licenses (beta)",
7697
- "requiresProject": false,
7698
- "additionalPermissionSetsToAlwaysGet": [
7699
- "Sales_User"
7700
- ],
7701
- "permSetsPermSetLicenses": [
7702
- {
7703
- "permSet": "Sales_User",
7704
- "permSetLicense": "SalesUserPsl"
7705
- }
7706
- ],
7707
- "profilesPermissionSetLicenses": [
7708
- {
7709
- "profile": "Salesforce API Only",
7710
- "permSetLicense": "SalesforceAPIIntegrationPsl"
7711
- }
7712
- ],
7713
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
7714
- "IdentityConnect"
7715
- ],
7751
+ "title": "Backup DX sources",
7752
+ "requiresProject": true,
7753
+ "triggerNotification": true,
7716
7754
  "isESM": true,
7717
7755
  "relativePath": [
7718
7756
  "lib",
7719
7757
  "commands",
7720
7758
  "hardis",
7721
7759
  "org",
7722
- "diagnose",
7723
- "unusedlicenses.js"
7760
+ "monitor",
7761
+ "backup.js"
7724
7762
  ],
7725
7763
  "aliasPermutations": [],
7726
7764
  "permutations": [
7727
- "hardis:org:diagnose:unusedlicenses",
7728
- "org:hardis:diagnose:unusedlicenses",
7729
- "org:diagnose:hardis:unusedlicenses",
7730
- "org:diagnose:unusedlicenses:hardis",
7731
- "hardis:diagnose:org:unusedlicenses",
7732
- "diagnose:hardis:org:unusedlicenses",
7733
- "diagnose:org:hardis:unusedlicenses",
7734
- "diagnose:org:unusedlicenses:hardis",
7735
- "hardis:diagnose:unusedlicenses:org",
7736
- "diagnose:hardis:unusedlicenses:org",
7737
- "diagnose:unusedlicenses:hardis:org",
7738
- "diagnose:unusedlicenses:org:hardis",
7739
- "hardis:org:unusedlicenses:diagnose",
7740
- "org:hardis:unusedlicenses:diagnose",
7741
- "org:unusedlicenses:hardis:diagnose",
7742
- "org:unusedlicenses:diagnose:hardis",
7743
- "hardis:unusedlicenses:org:diagnose",
7744
- "unusedlicenses:hardis:org:diagnose",
7745
- "unusedlicenses:org:hardis:diagnose",
7746
- "unusedlicenses:org:diagnose:hardis",
7747
- "hardis:unusedlicenses:diagnose:org",
7748
- "unusedlicenses:hardis:diagnose:org",
7749
- "unusedlicenses:diagnose:hardis:org",
7750
- "unusedlicenses:diagnose:org:hardis"
7765
+ "hardis:org:monitor:backup",
7766
+ "org:hardis:monitor:backup",
7767
+ "org:monitor:hardis:backup",
7768
+ "org:monitor:backup:hardis",
7769
+ "hardis:monitor:org:backup",
7770
+ "monitor:hardis:org:backup",
7771
+ "monitor:org:hardis:backup",
7772
+ "monitor:org:backup:hardis",
7773
+ "hardis:monitor:backup:org",
7774
+ "monitor:hardis:backup:org",
7775
+ "monitor:backup:hardis:org",
7776
+ "monitor:backup:org:hardis",
7777
+ "hardis:org:backup:monitor",
7778
+ "org:hardis:backup:monitor",
7779
+ "org:backup:hardis:monitor",
7780
+ "org:backup:monitor:hardis",
7781
+ "hardis:backup:org:monitor",
7782
+ "backup:hardis:org:monitor",
7783
+ "backup:org:hardis:monitor",
7784
+ "backup:org:monitor:hardis",
7785
+ "hardis:backup:monitor:org",
7786
+ "backup:hardis:monitor:org",
7787
+ "backup:monitor:hardis:org",
7788
+ "backup:monitor:org:hardis"
7751
7789
  ]
7752
7790
  },
7753
- "hardis:org:diagnose:unusedusers": {
7791
+ "hardis:org:monitor:limits": {
7754
7792
  "aliases": [],
7755
7793
  "args": {},
7756
- "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>",
7794
+ "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",
7757
7795
  "examples": [
7758
- "$ sf hardis:org:diagnose:unusedusers",
7759
- "$ sf hardis:org:diagnose:unusedusers --days 365",
7760
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7761
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7762
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7796
+ "$ sf hardis:org:monitor:limits"
7763
7797
  ],
7764
7798
  "flags": {
7765
7799
  "json": {
@@ -7785,41 +7819,6 @@
7785
7819
  "multiple": false,
7786
7820
  "type": "option"
7787
7821
  },
7788
- "days": {
7789
- "char": "t",
7790
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7791
- "name": "days",
7792
- "hasDynamicHelp": false,
7793
- "multiple": false,
7794
- "type": "option"
7795
- },
7796
- "licensetypes": {
7797
- "char": "l",
7798
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7799
- "name": "licensetypes",
7800
- "hasDynamicHelp": false,
7801
- "multiple": false,
7802
- "options": [
7803
- "all",
7804
- "all-crm",
7805
- "all-paying"
7806
- ],
7807
- "type": "option"
7808
- },
7809
- "licenseidentifiers": {
7810
- "char": "i",
7811
- "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",
7812
- "name": "licenseidentifiers",
7813
- "hasDynamicHelp": false,
7814
- "multiple": false,
7815
- "type": "option"
7816
- },
7817
- "returnactiveusers": {
7818
- "description": "Inverts the command by returning the active users",
7819
- "name": "returnactiveusers",
7820
- "allowNo": false,
7821
- "type": "boolean"
7822
- },
7823
7822
  "debug": {
7824
7823
  "char": "d",
7825
7824
  "description": "Activate debug mode (more logs)",
@@ -7858,49 +7857,50 @@
7858
7857
  },
7859
7858
  "hasDynamicHelp": true,
7860
7859
  "hiddenAliases": [],
7861
- "id": "hardis:org:diagnose:unusedusers",
7860
+ "id": "hardis:org:monitor:limits",
7862
7861
  "pluginAlias": "sfdx-hardis",
7863
7862
  "pluginName": "sfdx-hardis",
7864
7863
  "pluginType": "core",
7865
7864
  "strict": true,
7866
7865
  "enableJsonFlag": true,
7867
- "title": "Detect unused Users in Salesforce",
7868
- "requiresProject": false,
7866
+ "title": "Check org limits",
7867
+ "requiresProject": true,
7868
+ "triggerNotification": true,
7869
7869
  "isESM": true,
7870
7870
  "relativePath": [
7871
7871
  "lib",
7872
7872
  "commands",
7873
7873
  "hardis",
7874
7874
  "org",
7875
- "diagnose",
7876
- "unusedusers.js"
7875
+ "monitor",
7876
+ "limits.js"
7877
7877
  ],
7878
7878
  "aliasPermutations": [],
7879
7879
  "permutations": [
7880
- "hardis:org:diagnose:unusedusers",
7881
- "org:hardis:diagnose:unusedusers",
7882
- "org:diagnose:hardis:unusedusers",
7883
- "org:diagnose:unusedusers:hardis",
7884
- "hardis:diagnose:org:unusedusers",
7885
- "diagnose:hardis:org:unusedusers",
7886
- "diagnose:org:hardis:unusedusers",
7887
- "diagnose:org:unusedusers:hardis",
7888
- "hardis:diagnose:unusedusers:org",
7889
- "diagnose:hardis:unusedusers:org",
7890
- "diagnose:unusedusers:hardis:org",
7891
- "diagnose:unusedusers:org:hardis",
7892
- "hardis:org:unusedusers:diagnose",
7893
- "org:hardis:unusedusers:diagnose",
7894
- "org:unusedusers:hardis:diagnose",
7895
- "org:unusedusers:diagnose:hardis",
7896
- "hardis:unusedusers:org:diagnose",
7897
- "unusedusers:hardis:org:diagnose",
7898
- "unusedusers:org:hardis:diagnose",
7899
- "unusedusers:org:diagnose:hardis",
7900
- "hardis:unusedusers:diagnose:org",
7901
- "unusedusers:hardis:diagnose:org",
7902
- "unusedusers:diagnose:hardis:org",
7903
- "unusedusers:diagnose:org:hardis"
7880
+ "hardis:org:monitor:limits",
7881
+ "org:hardis:monitor:limits",
7882
+ "org:monitor:hardis:limits",
7883
+ "org:monitor:limits:hardis",
7884
+ "hardis:monitor:org:limits",
7885
+ "monitor:hardis:org:limits",
7886
+ "monitor:org:hardis:limits",
7887
+ "monitor:org:limits:hardis",
7888
+ "hardis:monitor:limits:org",
7889
+ "monitor:hardis:limits:org",
7890
+ "monitor:limits:hardis:org",
7891
+ "monitor:limits:org:hardis",
7892
+ "hardis:org:limits:monitor",
7893
+ "org:hardis:limits:monitor",
7894
+ "org:limits:hardis:monitor",
7895
+ "org:limits:monitor:hardis",
7896
+ "hardis:limits:org:monitor",
7897
+ "limits:hardis:org:monitor",
7898
+ "limits:org:hardis:monitor",
7899
+ "limits:org:monitor:hardis",
7900
+ "hardis:limits:monitor:org",
7901
+ "limits:hardis:monitor:org",
7902
+ "limits:monitor:hardis:org",
7903
+ "limits:monitor:org:hardis"
7904
7904
  ]
7905
7905
  },
7906
7906
  "hardis:org:purge:apexlog": {
@@ -9933,109 +9933,6 @@
9933
9933
  "auth:configure:project:hardis"
9934
9934
  ]
9935
9935
  },
9936
- "hardis:project:convert:profilestopermsets": {
9937
- "aliases": [],
9938
- "args": {},
9939
- "description": "\n## Command Behavior\n\n**Converts existing Salesforce Profiles into Permission Sets, facilitating a more granular and recommended security model.**\n\nThis command helps in migrating permissions from Profiles to Permission Sets, which is a best practice for managing user access in Salesforce. It creates a new Permission Set for each specified Profile, adopting a naming convention of `PS_PROFILENAME`.\n\nKey functionalities:\n\n- **Profile to Permission Set Conversion:** Automatically extracts permissions from a Profile and creates a corresponding Permission Set.\n- **Naming Convention:** New Permission Sets are named with a `PS_` prefix followed by the Profile name (e.g., `PS_Standard_User`).\n- **Exclusion Filter:** Allows you to exclude specific Profiles from the conversion process using the `--except` flag.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **External Plugin Integration:** It relies on the `shane-sfdx-plugins` (specifically the `sf shane:profile:convert` command) to perform the actual conversion.\n- **File System Scan:** It reads the contents of the `force-app/main/default/profiles` directory to identify all available Profile metadata files.\n- **Command Execution:** For each identified Profile (that is not excluded), it constructs and executes the `sf shane:profile:convert` command with the appropriate Profile name and desired Permission Set name.\n- **Error Handling:** Includes basic error handling for the external command execution.\n</details>\n",
9940
- "examples": [
9941
- "$ sf hardis:project:convert:profilestopermsets"
9942
- ],
9943
- "flags": {
9944
- "json": {
9945
- "description": "Format output as json.",
9946
- "helpGroup": "GLOBAL",
9947
- "name": "json",
9948
- "allowNo": false,
9949
- "type": "boolean"
9950
- },
9951
- "flags-dir": {
9952
- "helpGroup": "GLOBAL",
9953
- "name": "flags-dir",
9954
- "summary": "Import flag values from a directory.",
9955
- "hasDynamicHelp": false,
9956
- "multiple": false,
9957
- "type": "option"
9958
- },
9959
- "except": {
9960
- "char": "e",
9961
- "description": "List of filters",
9962
- "name": "except",
9963
- "default": [],
9964
- "hasDynamicHelp": false,
9965
- "multiple": true,
9966
- "type": "option"
9967
- },
9968
- "debug": {
9969
- "char": "d",
9970
- "description": "Activate debug mode (more logs)",
9971
- "name": "debug",
9972
- "allowNo": false,
9973
- "type": "boolean"
9974
- },
9975
- "websocket": {
9976
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
9977
- "name": "websocket",
9978
- "hasDynamicHelp": false,
9979
- "multiple": false,
9980
- "type": "option"
9981
- },
9982
- "skipauth": {
9983
- "description": "Skip authentication check when a default username is required",
9984
- "name": "skipauth",
9985
- "allowNo": false,
9986
- "type": "boolean"
9987
- }
9988
- },
9989
- "hasDynamicHelp": false,
9990
- "hiddenAliases": [],
9991
- "id": "hardis:project:convert:profilestopermsets",
9992
- "pluginAlias": "sfdx-hardis",
9993
- "pluginName": "sfdx-hardis",
9994
- "pluginType": "core",
9995
- "strict": true,
9996
- "enableJsonFlag": true,
9997
- "title": "Convert Profiles into Permission Sets",
9998
- "requiresProject": true,
9999
- "requiresSfdxPlugins": [
10000
- "shane-sfdx-plugins"
10001
- ],
10002
- "isESM": true,
10003
- "relativePath": [
10004
- "lib",
10005
- "commands",
10006
- "hardis",
10007
- "project",
10008
- "convert",
10009
- "profilestopermsets.js"
10010
- ],
10011
- "aliasPermutations": [],
10012
- "permutations": [
10013
- "hardis:project:convert:profilestopermsets",
10014
- "project:hardis:convert:profilestopermsets",
10015
- "project:convert:hardis:profilestopermsets",
10016
- "project:convert:profilestopermsets:hardis",
10017
- "hardis:convert:project:profilestopermsets",
10018
- "convert:hardis:project:profilestopermsets",
10019
- "convert:project:hardis:profilestopermsets",
10020
- "convert:project:profilestopermsets:hardis",
10021
- "hardis:convert:profilestopermsets:project",
10022
- "convert:hardis:profilestopermsets:project",
10023
- "convert:profilestopermsets:hardis:project",
10024
- "convert:profilestopermsets:project:hardis",
10025
- "hardis:project:profilestopermsets:convert",
10026
- "project:hardis:profilestopermsets:convert",
10027
- "project:profilestopermsets:hardis:convert",
10028
- "project:profilestopermsets:convert:hardis",
10029
- "hardis:profilestopermsets:project:convert",
10030
- "profilestopermsets:hardis:project:convert",
10031
- "profilestopermsets:project:hardis:convert",
10032
- "profilestopermsets:project:convert:hardis",
10033
- "hardis:profilestopermsets:convert:project",
10034
- "profilestopermsets:hardis:convert:project",
10035
- "profilestopermsets:convert:hardis:project",
10036
- "profilestopermsets:convert:project:hardis"
10037
- ]
10038
- },
10039
9936
  "hardis:project:clean:emptyitems": {
10040
9937
  "aliases": [],
10041
9938
  "args": {},
@@ -11433,24 +11330,124 @@
11433
11330
  "multiple": false,
11434
11331
  "type": "option"
11435
11332
  },
11436
- "xpath": {
11437
- "char": "x",
11438
- "dependsOn": [
11439
- "globpattern"
11440
- ],
11441
- "description": "XPath to use to detect the elements to remove. Ex: //ns:flexiPageRegions//ns:name[contains(text(),'dashboardName')]",
11442
- "name": "xpath",
11333
+ "xpath": {
11334
+ "char": "x",
11335
+ "dependsOn": [
11336
+ "globpattern"
11337
+ ],
11338
+ "description": "XPath to use to detect the elements to remove. Ex: //ns:flexiPageRegions//ns:name[contains(text(),'dashboardName')]",
11339
+ "name": "xpath",
11340
+ "hasDynamicHelp": false,
11341
+ "multiple": false,
11342
+ "type": "option"
11343
+ },
11344
+ "namespace": {
11345
+ "char": "n",
11346
+ "description": "XML Namespace to use",
11347
+ "name": "namespace",
11348
+ "default": "http://soap.sforce.com/2006/04/metadata",
11349
+ "hasDynamicHelp": false,
11350
+ "multiple": false,
11351
+ "type": "option"
11352
+ },
11353
+ "debug": {
11354
+ "char": "d",
11355
+ "description": "Activate debug mode (more logs)",
11356
+ "name": "debug",
11357
+ "allowNo": false,
11358
+ "type": "boolean"
11359
+ },
11360
+ "websocket": {
11361
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11362
+ "name": "websocket",
11363
+ "hasDynamicHelp": false,
11364
+ "multiple": false,
11365
+ "type": "option"
11366
+ },
11367
+ "skipauth": {
11368
+ "description": "Skip authentication check when a default username is required",
11369
+ "name": "skipauth",
11370
+ "allowNo": false,
11371
+ "type": "boolean"
11372
+ }
11373
+ },
11374
+ "hasDynamicHelp": false,
11375
+ "hiddenAliases": [],
11376
+ "id": "hardis:project:clean:xml",
11377
+ "pluginAlias": "sfdx-hardis",
11378
+ "pluginName": "sfdx-hardis",
11379
+ "pluginType": "core",
11380
+ "strict": true,
11381
+ "enableJsonFlag": true,
11382
+ "title": "Clean retrieved empty items in dx sources",
11383
+ "requiresProject": true,
11384
+ "isESM": true,
11385
+ "relativePath": [
11386
+ "lib",
11387
+ "commands",
11388
+ "hardis",
11389
+ "project",
11390
+ "clean",
11391
+ "xml.js"
11392
+ ],
11393
+ "aliasPermutations": [],
11394
+ "permutations": [
11395
+ "hardis:project:clean:xml",
11396
+ "project:hardis:clean:xml",
11397
+ "project:clean:hardis:xml",
11398
+ "project:clean:xml:hardis",
11399
+ "hardis:clean:project:xml",
11400
+ "clean:hardis:project:xml",
11401
+ "clean:project:hardis:xml",
11402
+ "clean:project:xml:hardis",
11403
+ "hardis:clean:xml:project",
11404
+ "clean:hardis:xml:project",
11405
+ "clean:xml:hardis:project",
11406
+ "clean:xml:project:hardis",
11407
+ "hardis:project:xml:clean",
11408
+ "project:hardis:xml:clean",
11409
+ "project:xml:hardis:clean",
11410
+ "project:xml:clean:hardis",
11411
+ "hardis:xml:project:clean",
11412
+ "xml:hardis:project:clean",
11413
+ "xml:project:hardis:clean",
11414
+ "xml:project:clean:hardis",
11415
+ "hardis:xml:clean:project",
11416
+ "xml:hardis:clean:project",
11417
+ "xml:clean:hardis:project",
11418
+ "xml:clean:project:hardis"
11419
+ ]
11420
+ },
11421
+ "hardis:project:convert:profilestopermsets": {
11422
+ "aliases": [],
11423
+ "args": {},
11424
+ "description": "\n## Command Behavior\n\n**Converts existing Salesforce Profiles into Permission Sets, facilitating a more granular and recommended security model.**\n\nThis command helps in migrating permissions from Profiles to Permission Sets, which is a best practice for managing user access in Salesforce. It creates a new Permission Set for each specified Profile, adopting a naming convention of `PS_PROFILENAME`.\n\nKey functionalities:\n\n- **Profile to Permission Set Conversion:** Automatically extracts permissions from a Profile and creates a corresponding Permission Set.\n- **Naming Convention:** New Permission Sets are named with a `PS_` prefix followed by the Profile name (e.g., `PS_Standard_User`).\n- **Exclusion Filter:** Allows you to exclude specific Profiles from the conversion process using the `--except` flag.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **External Plugin Integration:** It relies on the `shane-sfdx-plugins` (specifically the `sf shane:profile:convert` command) to perform the actual conversion.\n- **File System Scan:** It reads the contents of the `force-app/main/default/profiles` directory to identify all available Profile metadata files.\n- **Command Execution:** For each identified Profile (that is not excluded), it constructs and executes the `sf shane:profile:convert` command with the appropriate Profile name and desired Permission Set name.\n- **Error Handling:** Includes basic error handling for the external command execution.\n</details>\n",
11425
+ "examples": [
11426
+ "$ sf hardis:project:convert:profilestopermsets"
11427
+ ],
11428
+ "flags": {
11429
+ "json": {
11430
+ "description": "Format output as json.",
11431
+ "helpGroup": "GLOBAL",
11432
+ "name": "json",
11433
+ "allowNo": false,
11434
+ "type": "boolean"
11435
+ },
11436
+ "flags-dir": {
11437
+ "helpGroup": "GLOBAL",
11438
+ "name": "flags-dir",
11439
+ "summary": "Import flag values from a directory.",
11443
11440
  "hasDynamicHelp": false,
11444
11441
  "multiple": false,
11445
11442
  "type": "option"
11446
11443
  },
11447
- "namespace": {
11448
- "char": "n",
11449
- "description": "XML Namespace to use",
11450
- "name": "namespace",
11451
- "default": "http://soap.sforce.com/2006/04/metadata",
11444
+ "except": {
11445
+ "char": "e",
11446
+ "description": "List of filters",
11447
+ "name": "except",
11448
+ "default": [],
11452
11449
  "hasDynamicHelp": false,
11453
- "multiple": false,
11450
+ "multiple": true,
11454
11451
  "type": "option"
11455
11452
  },
11456
11453
  "debug": {
@@ -11476,49 +11473,52 @@
11476
11473
  },
11477
11474
  "hasDynamicHelp": false,
11478
11475
  "hiddenAliases": [],
11479
- "id": "hardis:project:clean:xml",
11476
+ "id": "hardis:project:convert:profilestopermsets",
11480
11477
  "pluginAlias": "sfdx-hardis",
11481
11478
  "pluginName": "sfdx-hardis",
11482
11479
  "pluginType": "core",
11483
11480
  "strict": true,
11484
11481
  "enableJsonFlag": true,
11485
- "title": "Clean retrieved empty items in dx sources",
11482
+ "title": "Convert Profiles into Permission Sets",
11486
11483
  "requiresProject": true,
11484
+ "requiresSfdxPlugins": [
11485
+ "shane-sfdx-plugins"
11486
+ ],
11487
11487
  "isESM": true,
11488
11488
  "relativePath": [
11489
11489
  "lib",
11490
11490
  "commands",
11491
11491
  "hardis",
11492
11492
  "project",
11493
- "clean",
11494
- "xml.js"
11493
+ "convert",
11494
+ "profilestopermsets.js"
11495
11495
  ],
11496
11496
  "aliasPermutations": [],
11497
11497
  "permutations": [
11498
- "hardis:project:clean:xml",
11499
- "project:hardis:clean:xml",
11500
- "project:clean:hardis:xml",
11501
- "project:clean:xml:hardis",
11502
- "hardis:clean:project:xml",
11503
- "clean:hardis:project:xml",
11504
- "clean:project:hardis:xml",
11505
- "clean:project:xml:hardis",
11506
- "hardis:clean:xml:project",
11507
- "clean:hardis:xml:project",
11508
- "clean:xml:hardis:project",
11509
- "clean:xml:project:hardis",
11510
- "hardis:project:xml:clean",
11511
- "project:hardis:xml:clean",
11512
- "project:xml:hardis:clean",
11513
- "project:xml:clean:hardis",
11514
- "hardis:xml:project:clean",
11515
- "xml:hardis:project:clean",
11516
- "xml:project:hardis:clean",
11517
- "xml:project:clean:hardis",
11518
- "hardis:xml:clean:project",
11519
- "xml:hardis:clean:project",
11520
- "xml:clean:hardis:project",
11521
- "xml:clean:project:hardis"
11498
+ "hardis:project:convert:profilestopermsets",
11499
+ "project:hardis:convert:profilestopermsets",
11500
+ "project:convert:hardis:profilestopermsets",
11501
+ "project:convert:profilestopermsets:hardis",
11502
+ "hardis:convert:project:profilestopermsets",
11503
+ "convert:hardis:project:profilestopermsets",
11504
+ "convert:project:hardis:profilestopermsets",
11505
+ "convert:project:profilestopermsets:hardis",
11506
+ "hardis:convert:profilestopermsets:project",
11507
+ "convert:hardis:profilestopermsets:project",
11508
+ "convert:profilestopermsets:hardis:project",
11509
+ "convert:profilestopermsets:project:hardis",
11510
+ "hardis:project:profilestopermsets:convert",
11511
+ "project:hardis:profilestopermsets:convert",
11512
+ "project:profilestopermsets:hardis:convert",
11513
+ "project:profilestopermsets:convert:hardis",
11514
+ "hardis:profilestopermsets:project:convert",
11515
+ "profilestopermsets:hardis:project:convert",
11516
+ "profilestopermsets:project:hardis:convert",
11517
+ "profilestopermsets:project:convert:hardis",
11518
+ "hardis:profilestopermsets:convert:project",
11519
+ "profilestopermsets:hardis:convert:project",
11520
+ "profilestopermsets:convert:hardis:project",
11521
+ "profilestopermsets:convert:project:hardis"
11522
11522
  ]
11523
11523
  },
11524
11524
  "hardis:project:deploy:notify": {
@@ -12696,6 +12696,221 @@
12696
12696
  "validate:deploy:project:hardis"
12697
12697
  ]
12698
12698
  },
12699
+ "hardis:project:fix:profiletabs": {
12700
+ "aliases": [],
12701
+ "args": {},
12702
+ "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",
12703
+ "examples": [
12704
+ "$ sf hardis:project:fix:profiletabs"
12705
+ ],
12706
+ "flags": {
12707
+ "json": {
12708
+ "description": "Format output as json.",
12709
+ "helpGroup": "GLOBAL",
12710
+ "name": "json",
12711
+ "allowNo": false,
12712
+ "type": "boolean"
12713
+ },
12714
+ "flags-dir": {
12715
+ "helpGroup": "GLOBAL",
12716
+ "name": "flags-dir",
12717
+ "summary": "Import flag values from a directory.",
12718
+ "hasDynamicHelp": false,
12719
+ "multiple": false,
12720
+ "type": "option"
12721
+ },
12722
+ "path": {
12723
+ "char": "p",
12724
+ "description": "Root folder",
12725
+ "name": "path",
12726
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12727
+ "hasDynamicHelp": false,
12728
+ "multiple": false,
12729
+ "type": "option"
12730
+ },
12731
+ "debug": {
12732
+ "char": "d",
12733
+ "description": "Activate debug mode (more logs)",
12734
+ "name": "debug",
12735
+ "allowNo": false,
12736
+ "type": "boolean"
12737
+ },
12738
+ "websocket": {
12739
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12740
+ "name": "websocket",
12741
+ "hasDynamicHelp": false,
12742
+ "multiple": false,
12743
+ "type": "option"
12744
+ },
12745
+ "skipauth": {
12746
+ "description": "Skip authentication check when a default username is required",
12747
+ "name": "skipauth",
12748
+ "allowNo": false,
12749
+ "type": "boolean"
12750
+ },
12751
+ "target-org": {
12752
+ "aliases": [
12753
+ "targetusername",
12754
+ "u"
12755
+ ],
12756
+ "char": "o",
12757
+ "deprecateAliases": true,
12758
+ "name": "target-org",
12759
+ "noCacheDefault": true,
12760
+ "required": true,
12761
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
12762
+ "hasDynamicHelp": true,
12763
+ "multiple": false,
12764
+ "type": "option"
12765
+ }
12766
+ },
12767
+ "hasDynamicHelp": true,
12768
+ "hiddenAliases": [],
12769
+ "id": "hardis:project:fix:profiletabs",
12770
+ "pluginAlias": "sfdx-hardis",
12771
+ "pluginName": "sfdx-hardis",
12772
+ "pluginType": "core",
12773
+ "strict": true,
12774
+ "enableJsonFlag": true,
12775
+ "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
12776
+ "requiresProject": true,
12777
+ "isESM": true,
12778
+ "relativePath": [
12779
+ "lib",
12780
+ "commands",
12781
+ "hardis",
12782
+ "project",
12783
+ "fix",
12784
+ "profiletabs.js"
12785
+ ],
12786
+ "aliasPermutations": [],
12787
+ "permutations": [
12788
+ "hardis:project:fix:profiletabs",
12789
+ "project:hardis:fix:profiletabs",
12790
+ "project:fix:hardis:profiletabs",
12791
+ "project:fix:profiletabs:hardis",
12792
+ "hardis:fix:project:profiletabs",
12793
+ "fix:hardis:project:profiletabs",
12794
+ "fix:project:hardis:profiletabs",
12795
+ "fix:project:profiletabs:hardis",
12796
+ "hardis:fix:profiletabs:project",
12797
+ "fix:hardis:profiletabs:project",
12798
+ "fix:profiletabs:hardis:project",
12799
+ "fix:profiletabs:project:hardis",
12800
+ "hardis:project:profiletabs:fix",
12801
+ "project:hardis:profiletabs:fix",
12802
+ "project:profiletabs:hardis:fix",
12803
+ "project:profiletabs:fix:hardis",
12804
+ "hardis:profiletabs:project:fix",
12805
+ "profiletabs:hardis:project:fix",
12806
+ "profiletabs:project:hardis:fix",
12807
+ "profiletabs:project:fix:hardis",
12808
+ "hardis:profiletabs:fix:project",
12809
+ "profiletabs:hardis:fix:project",
12810
+ "profiletabs:fix:hardis:project",
12811
+ "profiletabs:fix:project:hardis"
12812
+ ]
12813
+ },
12814
+ "hardis:project:fix:v53flexipages": {
12815
+ "aliases": [],
12816
+ "args": {},
12817
+ "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",
12818
+ "examples": [
12819
+ "$ sf hardis:project:fix:v53flexipages"
12820
+ ],
12821
+ "flags": {
12822
+ "json": {
12823
+ "description": "Format output as json.",
12824
+ "helpGroup": "GLOBAL",
12825
+ "name": "json",
12826
+ "allowNo": false,
12827
+ "type": "boolean"
12828
+ },
12829
+ "flags-dir": {
12830
+ "helpGroup": "GLOBAL",
12831
+ "name": "flags-dir",
12832
+ "summary": "Import flag values from a directory.",
12833
+ "hasDynamicHelp": false,
12834
+ "multiple": false,
12835
+ "type": "option"
12836
+ },
12837
+ "path": {
12838
+ "char": "p",
12839
+ "description": "Root folder",
12840
+ "name": "path",
12841
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12842
+ "hasDynamicHelp": false,
12843
+ "multiple": false,
12844
+ "type": "option"
12845
+ },
12846
+ "debug": {
12847
+ "char": "d",
12848
+ "description": "Activate debug mode (more logs)",
12849
+ "name": "debug",
12850
+ "allowNo": false,
12851
+ "type": "boolean"
12852
+ },
12853
+ "websocket": {
12854
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12855
+ "name": "websocket",
12856
+ "hasDynamicHelp": false,
12857
+ "multiple": false,
12858
+ "type": "option"
12859
+ },
12860
+ "skipauth": {
12861
+ "description": "Skip authentication check when a default username is required",
12862
+ "name": "skipauth",
12863
+ "allowNo": false,
12864
+ "type": "boolean"
12865
+ }
12866
+ },
12867
+ "hasDynamicHelp": false,
12868
+ "hiddenAliases": [],
12869
+ "id": "hardis:project:fix:v53flexipages",
12870
+ "pluginAlias": "sfdx-hardis",
12871
+ "pluginName": "sfdx-hardis",
12872
+ "pluginType": "core",
12873
+ "strict": true,
12874
+ "enableJsonFlag": true,
12875
+ "title": "Fix flexipages for v53",
12876
+ "requiresProject": true,
12877
+ "isESM": true,
12878
+ "relativePath": [
12879
+ "lib",
12880
+ "commands",
12881
+ "hardis",
12882
+ "project",
12883
+ "fix",
12884
+ "v53flexipages.js"
12885
+ ],
12886
+ "aliasPermutations": [],
12887
+ "permutations": [
12888
+ "hardis:project:fix:v53flexipages",
12889
+ "project:hardis:fix:v53flexipages",
12890
+ "project:fix:hardis:v53flexipages",
12891
+ "project:fix:v53flexipages:hardis",
12892
+ "hardis:fix:project:v53flexipages",
12893
+ "fix:hardis:project:v53flexipages",
12894
+ "fix:project:hardis:v53flexipages",
12895
+ "fix:project:v53flexipages:hardis",
12896
+ "hardis:fix:v53flexipages:project",
12897
+ "fix:hardis:v53flexipages:project",
12898
+ "fix:v53flexipages:hardis:project",
12899
+ "fix:v53flexipages:project:hardis",
12900
+ "hardis:project:v53flexipages:fix",
12901
+ "project:hardis:v53flexipages:fix",
12902
+ "project:v53flexipages:hardis:fix",
12903
+ "project:v53flexipages:fix:hardis",
12904
+ "hardis:v53flexipages:project:fix",
12905
+ "v53flexipages:hardis:project:fix",
12906
+ "v53flexipages:project:hardis:fix",
12907
+ "v53flexipages:project:fix:hardis",
12908
+ "hardis:v53flexipages:fix:project",
12909
+ "v53flexipages:hardis:fix:project",
12910
+ "v53flexipages:fix:hardis:project",
12911
+ "v53flexipages:fix:project:hardis"
12912
+ ]
12913
+ },
12699
12914
  "hardis:project:generate:bypass": {
12700
12915
  "aliases": [],
12701
12916
  "args": {},
@@ -13091,221 +13306,6 @@
13091
13306
  "gitdelta:generate:project:hardis"
13092
13307
  ]
13093
13308
  },
13094
- "hardis:project:fix:profiletabs": {
13095
- "aliases": [],
13096
- "args": {},
13097
- "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",
13098
- "examples": [
13099
- "$ sf hardis:project:fix:profiletabs"
13100
- ],
13101
- "flags": {
13102
- "json": {
13103
- "description": "Format output as json.",
13104
- "helpGroup": "GLOBAL",
13105
- "name": "json",
13106
- "allowNo": false,
13107
- "type": "boolean"
13108
- },
13109
- "flags-dir": {
13110
- "helpGroup": "GLOBAL",
13111
- "name": "flags-dir",
13112
- "summary": "Import flag values from a directory.",
13113
- "hasDynamicHelp": false,
13114
- "multiple": false,
13115
- "type": "option"
13116
- },
13117
- "path": {
13118
- "char": "p",
13119
- "description": "Root folder",
13120
- "name": "path",
13121
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13122
- "hasDynamicHelp": false,
13123
- "multiple": false,
13124
- "type": "option"
13125
- },
13126
- "debug": {
13127
- "char": "d",
13128
- "description": "Activate debug mode (more logs)",
13129
- "name": "debug",
13130
- "allowNo": false,
13131
- "type": "boolean"
13132
- },
13133
- "websocket": {
13134
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13135
- "name": "websocket",
13136
- "hasDynamicHelp": false,
13137
- "multiple": false,
13138
- "type": "option"
13139
- },
13140
- "skipauth": {
13141
- "description": "Skip authentication check when a default username is required",
13142
- "name": "skipauth",
13143
- "allowNo": false,
13144
- "type": "boolean"
13145
- },
13146
- "target-org": {
13147
- "aliases": [
13148
- "targetusername",
13149
- "u"
13150
- ],
13151
- "char": "o",
13152
- "deprecateAliases": true,
13153
- "name": "target-org",
13154
- "noCacheDefault": true,
13155
- "required": true,
13156
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
13157
- "hasDynamicHelp": true,
13158
- "multiple": false,
13159
- "type": "option"
13160
- }
13161
- },
13162
- "hasDynamicHelp": true,
13163
- "hiddenAliases": [],
13164
- "id": "hardis:project:fix:profiletabs",
13165
- "pluginAlias": "sfdx-hardis",
13166
- "pluginName": "sfdx-hardis",
13167
- "pluginType": "core",
13168
- "strict": true,
13169
- "enableJsonFlag": true,
13170
- "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
13171
- "requiresProject": true,
13172
- "isESM": true,
13173
- "relativePath": [
13174
- "lib",
13175
- "commands",
13176
- "hardis",
13177
- "project",
13178
- "fix",
13179
- "profiletabs.js"
13180
- ],
13181
- "aliasPermutations": [],
13182
- "permutations": [
13183
- "hardis:project:fix:profiletabs",
13184
- "project:hardis:fix:profiletabs",
13185
- "project:fix:hardis:profiletabs",
13186
- "project:fix:profiletabs:hardis",
13187
- "hardis:fix:project:profiletabs",
13188
- "fix:hardis:project:profiletabs",
13189
- "fix:project:hardis:profiletabs",
13190
- "fix:project:profiletabs:hardis",
13191
- "hardis:fix:profiletabs:project",
13192
- "fix:hardis:profiletabs:project",
13193
- "fix:profiletabs:hardis:project",
13194
- "fix:profiletabs:project:hardis",
13195
- "hardis:project:profiletabs:fix",
13196
- "project:hardis:profiletabs:fix",
13197
- "project:profiletabs:hardis:fix",
13198
- "project:profiletabs:fix:hardis",
13199
- "hardis:profiletabs:project:fix",
13200
- "profiletabs:hardis:project:fix",
13201
- "profiletabs:project:hardis:fix",
13202
- "profiletabs:project:fix:hardis",
13203
- "hardis:profiletabs:fix:project",
13204
- "profiletabs:hardis:fix:project",
13205
- "profiletabs:fix:hardis:project",
13206
- "profiletabs:fix:project:hardis"
13207
- ]
13208
- },
13209
- "hardis:project:fix:v53flexipages": {
13210
- "aliases": [],
13211
- "args": {},
13212
- "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",
13213
- "examples": [
13214
- "$ sf hardis:project:fix:v53flexipages"
13215
- ],
13216
- "flags": {
13217
- "json": {
13218
- "description": "Format output as json.",
13219
- "helpGroup": "GLOBAL",
13220
- "name": "json",
13221
- "allowNo": false,
13222
- "type": "boolean"
13223
- },
13224
- "flags-dir": {
13225
- "helpGroup": "GLOBAL",
13226
- "name": "flags-dir",
13227
- "summary": "Import flag values from a directory.",
13228
- "hasDynamicHelp": false,
13229
- "multiple": false,
13230
- "type": "option"
13231
- },
13232
- "path": {
13233
- "char": "p",
13234
- "description": "Root folder",
13235
- "name": "path",
13236
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13237
- "hasDynamicHelp": false,
13238
- "multiple": false,
13239
- "type": "option"
13240
- },
13241
- "debug": {
13242
- "char": "d",
13243
- "description": "Activate debug mode (more logs)",
13244
- "name": "debug",
13245
- "allowNo": false,
13246
- "type": "boolean"
13247
- },
13248
- "websocket": {
13249
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13250
- "name": "websocket",
13251
- "hasDynamicHelp": false,
13252
- "multiple": false,
13253
- "type": "option"
13254
- },
13255
- "skipauth": {
13256
- "description": "Skip authentication check when a default username is required",
13257
- "name": "skipauth",
13258
- "allowNo": false,
13259
- "type": "boolean"
13260
- }
13261
- },
13262
- "hasDynamicHelp": false,
13263
- "hiddenAliases": [],
13264
- "id": "hardis:project:fix:v53flexipages",
13265
- "pluginAlias": "sfdx-hardis",
13266
- "pluginName": "sfdx-hardis",
13267
- "pluginType": "core",
13268
- "strict": true,
13269
- "enableJsonFlag": true,
13270
- "title": "Fix flexipages for v53",
13271
- "requiresProject": true,
13272
- "isESM": true,
13273
- "relativePath": [
13274
- "lib",
13275
- "commands",
13276
- "hardis",
13277
- "project",
13278
- "fix",
13279
- "v53flexipages.js"
13280
- ],
13281
- "aliasPermutations": [],
13282
- "permutations": [
13283
- "hardis:project:fix:v53flexipages",
13284
- "project:hardis:fix:v53flexipages",
13285
- "project:fix:hardis:v53flexipages",
13286
- "project:fix:v53flexipages:hardis",
13287
- "hardis:fix:project:v53flexipages",
13288
- "fix:hardis:project:v53flexipages",
13289
- "fix:project:hardis:v53flexipages",
13290
- "fix:project:v53flexipages:hardis",
13291
- "hardis:fix:v53flexipages:project",
13292
- "fix:hardis:v53flexipages:project",
13293
- "fix:v53flexipages:hardis:project",
13294
- "fix:v53flexipages:project:hardis",
13295
- "hardis:project:v53flexipages:fix",
13296
- "project:hardis:v53flexipages:fix",
13297
- "project:v53flexipages:hardis:fix",
13298
- "project:v53flexipages:fix:hardis",
13299
- "hardis:v53flexipages:project:fix",
13300
- "v53flexipages:hardis:project:fix",
13301
- "v53flexipages:project:hardis:fix",
13302
- "v53flexipages:project:fix:hardis",
13303
- "hardis:v53flexipages:fix:project",
13304
- "v53flexipages:hardis:fix:project",
13305
- "v53flexipages:fix:hardis:project",
13306
- "v53flexipages:fix:project:hardis"
13307
- ]
13308
- },
13309
13309
  "hardis:project:metadata:activate-decomposed": {
13310
13310
  "aliases": [],
13311
13311
  "args": {},
@@ -15484,5 +15484,5 @@
15484
15484
  ]
15485
15485
  }
15486
15486
  },
15487
- "version": "6.10.1-alpha202511021043.0"
15487
+ "version": "6.10.1-alpha202511022140.0"
15488
15488
  }