sfdx-hardis 6.9.1-alpha202510261251.0 → 6.9.1-alpha202510261312.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,13 +4612,13 @@
4741
4612
  "generate:plugin:doc:hardis"
4742
4613
  ]
4743
4614
  },
4744
- "hardis:org:community:update": {
4615
+ "hardis:git:pull-requests:extract": {
4745
4616
  "aliases": [],
4746
4617
  "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",
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:community:update --name 'MyNetworkName' --status DownForMaintenance",
4750
- "$ sf hardis:org:community:update --name 'MyNetworkName,MySecondNetworkName' --status Live"
4620
+ "$ sf hardis:git:pull-requests:extract",
4621
+ "$ sf hardis:git:pull-requests:extract --target-branch main --status merged"
4751
4622
  ],
4752
4623
  "flags": {
4753
4624
  "json": {
@@ -4765,11 +4636,140 @@
4765
4636
  "multiple": false,
4766
4637
  "type": "option"
4767
4638
  },
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,
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
4773
  "hasDynamicHelp": false,
4774
4774
  "multiple": false,
4775
4775
  "type": "option"
@@ -5539,13 +5539,15 @@
5539
5539
  "import:data:org:hardis"
5540
5540
  ]
5541
5541
  },
5542
- "hardis:org:fix:listviewmine": {
5542
+ "hardis:org:diagnose:audittrail": {
5543
5543
  "aliases": [],
5544
5544
  "args": {},
5545
- "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
5545
+ "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
5546
5546
  "examples": [
5547
- "$ sf hardis:org:fix:listviewmine",
5548
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5547
+ "$ sf hardis:org:diagnose:audittrail",
5548
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5549
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5550
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5549
5551
  ],
5550
5552
  "flags": {
5551
5553
  "json": {
@@ -5563,10 +5565,26 @@
5563
5565
  "multiple": false,
5564
5566
  "type": "option"
5565
5567
  },
5566
- "listviews": {
5567
- "char": "l",
5568
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5569
- "name": "listviews",
5568
+ "excludeusers": {
5569
+ "char": "e",
5570
+ "description": "Comma-separated list of usernames to exclude",
5571
+ "name": "excludeusers",
5572
+ "hasDynamicHelp": false,
5573
+ "multiple": false,
5574
+ "type": "option"
5575
+ },
5576
+ "lastndays": {
5577
+ "char": "t",
5578
+ "description": "Number of days to extract from today (included)",
5579
+ "name": "lastndays",
5580
+ "hasDynamicHelp": false,
5581
+ "multiple": false,
5582
+ "type": "option"
5583
+ },
5584
+ "outputfile": {
5585
+ "char": "f",
5586
+ "description": "Force the path and name of output report file. Must end with .csv",
5587
+ "name": "outputfile",
5570
5588
  "hasDynamicHelp": false,
5571
5589
  "multiple": false,
5572
5590
  "type": "option"
@@ -5609,57 +5627,57 @@
5609
5627
  },
5610
5628
  "hasDynamicHelp": true,
5611
5629
  "hiddenAliases": [],
5612
- "id": "hardis:org:fix:listviewmine",
5630
+ "id": "hardis:org:diagnose:audittrail",
5613
5631
  "pluginAlias": "sfdx-hardis",
5614
5632
  "pluginName": "sfdx-hardis",
5615
5633
  "pluginType": "core",
5616
5634
  "strict": true,
5617
5635
  "enableJsonFlag": true,
5618
- "title": "Fix listviews with ",
5619
- "requiresProject": true,
5636
+ "title": "Diagnose content of Setup Audit Trail",
5637
+ "requiresProject": false,
5620
5638
  "isESM": true,
5621
5639
  "relativePath": [
5622
5640
  "lib",
5623
5641
  "commands",
5624
5642
  "hardis",
5625
5643
  "org",
5626
- "fix",
5627
- "listviewmine.js"
5644
+ "diagnose",
5645
+ "audittrail.js"
5628
5646
  ],
5629
5647
  "aliasPermutations": [],
5630
5648
  "permutations": [
5631
- "hardis:org:fix:listviewmine",
5632
- "org:hardis:fix:listviewmine",
5633
- "org:fix:hardis:listviewmine",
5634
- "org:fix:listviewmine:hardis",
5635
- "hardis:fix:org:listviewmine",
5636
- "fix:hardis:org:listviewmine",
5637
- "fix:org:hardis:listviewmine",
5638
- "fix:org:listviewmine:hardis",
5639
- "hardis:fix:listviewmine:org",
5640
- "fix:hardis:listviewmine:org",
5641
- "fix:listviewmine:hardis:org",
5642
- "fix:listviewmine:org:hardis",
5643
- "hardis:org:listviewmine:fix",
5644
- "org:hardis:listviewmine:fix",
5645
- "org:listviewmine:hardis:fix",
5646
- "org:listviewmine:fix:hardis",
5647
- "hardis:listviewmine:org:fix",
5648
- "listviewmine:hardis:org:fix",
5649
- "listviewmine:org:hardis:fix",
5650
- "listviewmine:org:fix:hardis",
5651
- "hardis:listviewmine:fix:org",
5652
- "listviewmine:hardis:fix:org",
5653
- "listviewmine:fix:hardis:org",
5654
- "listviewmine:fix:org:hardis"
5649
+ "hardis:org:diagnose:audittrail",
5650
+ "org:hardis:diagnose:audittrail",
5651
+ "org:diagnose:hardis:audittrail",
5652
+ "org:diagnose:audittrail:hardis",
5653
+ "hardis:diagnose:org:audittrail",
5654
+ "diagnose:hardis:org:audittrail",
5655
+ "diagnose:org:hardis:audittrail",
5656
+ "diagnose:org:audittrail:hardis",
5657
+ "hardis:diagnose:audittrail:org",
5658
+ "diagnose:hardis:audittrail:org",
5659
+ "diagnose:audittrail:hardis:org",
5660
+ "diagnose:audittrail:org:hardis",
5661
+ "hardis:org:audittrail:diagnose",
5662
+ "org:hardis:audittrail:diagnose",
5663
+ "org:audittrail:hardis:diagnose",
5664
+ "org:audittrail:diagnose:hardis",
5665
+ "hardis:audittrail:org:diagnose",
5666
+ "audittrail:hardis:org:diagnose",
5667
+ "audittrail:org:hardis:diagnose",
5668
+ "audittrail:org:diagnose:hardis",
5669
+ "hardis:audittrail:diagnose:org",
5670
+ "audittrail:hardis:diagnose:org",
5671
+ "audittrail:diagnose:hardis:org",
5672
+ "audittrail:diagnose:org:hardis"
5655
5673
  ]
5656
5674
  },
5657
- "hardis:org:files:export": {
5675
+ "hardis:org:diagnose:instanceupgrade": {
5658
5676
  "aliases": [],
5659
5677
  "args": {},
5660
- "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
5678
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
5661
5679
  "examples": [
5662
- "$ sf hardis:org:files:export"
5680
+ "$ sf hardis:org:diagnose:instanceupgrade"
5663
5681
  ],
5664
5682
  "flags": {
5665
5683
  "json": {
@@ -5677,58 +5695,16 @@
5677
5695
  "multiple": false,
5678
5696
  "type": "option"
5679
5697
  },
5680
- "path": {
5681
- "char": "p",
5682
- "description": "Path to the file export project",
5683
- "name": "path",
5684
- "hasDynamicHelp": false,
5685
- "multiple": false,
5686
- "type": "option"
5698
+ "debug": {
5699
+ "char": "d",
5700
+ "description": "Activate debug mode (more logs)",
5701
+ "name": "debug",
5702
+ "allowNo": false,
5703
+ "type": "boolean"
5687
5704
  },
5688
- "chunksize": {
5689
- "char": "c",
5690
- "description": "Number of records to add in a chunk before it is processed",
5691
- "name": "chunksize",
5692
- "default": 1000,
5693
- "hasDynamicHelp": false,
5694
- "multiple": false,
5695
- "type": "option"
5696
- },
5697
- "polltimeout": {
5698
- "char": "t",
5699
- "description": "Timeout in MS for Bulk API calls",
5700
- "name": "polltimeout",
5701
- "default": 300000,
5702
- "hasDynamicHelp": false,
5703
- "multiple": false,
5704
- "type": "option"
5705
- },
5706
- "startchunknumber": {
5707
- "char": "s",
5708
- "description": "Chunk number to start from",
5709
- "name": "startchunknumber",
5710
- "default": 0,
5711
- "hasDynamicHelp": false,
5712
- "multiple": false,
5713
- "type": "option"
5714
- },
5715
- "resume": {
5716
- "char": "r",
5717
- "description": "Resume previous export by checking existing files (default in CI)",
5718
- "name": "resume",
5719
- "allowNo": false,
5720
- "type": "boolean"
5721
- },
5722
- "debug": {
5723
- "char": "d",
5724
- "description": "Activate debug mode (more logs)",
5725
- "name": "debug",
5726
- "allowNo": false,
5727
- "type": "boolean"
5728
- },
5729
- "websocket": {
5730
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
5731
- "name": "websocket",
5705
+ "websocket": {
5706
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
5707
+ "name": "websocket",
5732
5708
  "hasDynamicHelp": false,
5733
5709
  "multiple": false,
5734
5710
  "type": "option"
@@ -5757,13 +5733,13 @@
5757
5733
  },
5758
5734
  "hasDynamicHelp": true,
5759
5735
  "hiddenAliases": [],
5760
- "id": "hardis:org:files:export",
5736
+ "id": "hardis:org:diagnose:instanceupgrade",
5761
5737
  "pluginAlias": "sfdx-hardis",
5762
5738
  "pluginName": "sfdx-hardis",
5763
5739
  "pluginType": "core",
5764
5740
  "strict": true,
5765
5741
  "enableJsonFlag": true,
5766
- "title": "Export files",
5742
+ "title": "Get Instance Upgrade date",
5767
5743
  "requiresProject": false,
5768
5744
  "isESM": true,
5769
5745
  "relativePath": [
@@ -5771,43 +5747,46 @@
5771
5747
  "commands",
5772
5748
  "hardis",
5773
5749
  "org",
5774
- "files",
5775
- "export.js"
5750
+ "diagnose",
5751
+ "instanceupgrade.js"
5776
5752
  ],
5777
5753
  "aliasPermutations": [],
5778
5754
  "permutations": [
5779
- "hardis:org:files:export",
5780
- "org:hardis:files:export",
5781
- "org:files:hardis:export",
5782
- "org:files:export:hardis",
5783
- "hardis:files:org:export",
5784
- "files:hardis:org:export",
5785
- "files:org:hardis:export",
5786
- "files:org:export:hardis",
5787
- "hardis:files:export:org",
5788
- "files:hardis:export:org",
5789
- "files:export:hardis:org",
5790
- "files:export:org:hardis",
5791
- "hardis:org:export:files",
5792
- "org:hardis:export:files",
5793
- "org:export:hardis:files",
5794
- "org:export:files:hardis",
5795
- "hardis:export:org:files",
5796
- "export:hardis:org:files",
5797
- "export:org:hardis:files",
5798
- "export:org:files:hardis",
5799
- "hardis:export:files:org",
5800
- "export:hardis:files:org",
5801
- "export:files:hardis:org",
5802
- "export:files:org:hardis"
5755
+ "hardis:org:diagnose:instanceupgrade",
5756
+ "org:hardis:diagnose:instanceupgrade",
5757
+ "org:diagnose:hardis:instanceupgrade",
5758
+ "org:diagnose:instanceupgrade:hardis",
5759
+ "hardis:diagnose:org:instanceupgrade",
5760
+ "diagnose:hardis:org:instanceupgrade",
5761
+ "diagnose:org:hardis:instanceupgrade",
5762
+ "diagnose:org:instanceupgrade:hardis",
5763
+ "hardis:diagnose:instanceupgrade:org",
5764
+ "diagnose:hardis:instanceupgrade:org",
5765
+ "diagnose:instanceupgrade:hardis:org",
5766
+ "diagnose:instanceupgrade:org:hardis",
5767
+ "hardis:org:instanceupgrade:diagnose",
5768
+ "org:hardis:instanceupgrade:diagnose",
5769
+ "org:instanceupgrade:hardis:diagnose",
5770
+ "org:instanceupgrade:diagnose:hardis",
5771
+ "hardis:instanceupgrade:org:diagnose",
5772
+ "instanceupgrade:hardis:org:diagnose",
5773
+ "instanceupgrade:org:hardis:diagnose",
5774
+ "instanceupgrade:org:diagnose:hardis",
5775
+ "hardis:instanceupgrade:diagnose:org",
5776
+ "instanceupgrade:hardis:diagnose:org",
5777
+ "instanceupgrade:diagnose:hardis:org",
5778
+ "instanceupgrade:diagnose:org:hardis"
5803
5779
  ]
5804
5780
  },
5805
- "hardis:org:files:import": {
5781
+ "hardis:org:diagnose:legacyapi": {
5806
5782
  "aliases": [],
5807
5783
  "args": {},
5808
- "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
5784
+ "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
5809
5785
  "examples": [
5810
- "$ sf hardis:org:files:import"
5786
+ "$ sf hardis:org:diagnose:legacyapi",
5787
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5788
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5789
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5811
5790
  ],
5812
5791
  "flags": {
5813
5792
  "json": {
@@ -5825,20 +5804,31 @@
5825
5804
  "multiple": false,
5826
5805
  "type": "option"
5827
5806
  },
5828
- "path": {
5829
- "char": "p",
5830
- "description": "Path to the file export project",
5831
- "name": "path",
5807
+ "eventtype": {
5808
+ "char": "e",
5809
+ "description": "Type of EventLogFile event to analyze",
5810
+ "name": "eventtype",
5811
+ "default": "ApiTotalUsage",
5832
5812
  "hasDynamicHelp": false,
5833
5813
  "multiple": false,
5834
5814
  "type": "option"
5835
5815
  },
5836
- "overwrite": {
5816
+ "limit": {
5817
+ "char": "l",
5818
+ "description": "Number of latest EventLogFile events to analyze",
5819
+ "name": "limit",
5820
+ "default": 999,
5821
+ "hasDynamicHelp": false,
5822
+ "multiple": false,
5823
+ "type": "option"
5824
+ },
5825
+ "outputfile": {
5837
5826
  "char": "f",
5838
- "description": "Override existing files (doubles the number of API calls)",
5839
- "name": "overwrite",
5840
- "allowNo": false,
5841
- "type": "boolean"
5827
+ "description": "Force the path and name of output report file. Must end with .csv",
5828
+ "name": "outputfile",
5829
+ "hasDynamicHelp": false,
5830
+ "multiple": false,
5831
+ "type": "option"
5842
5832
  },
5843
5833
  "debug": {
5844
5834
  "char": "d",
@@ -5878,13 +5868,13 @@
5878
5868
  },
5879
5869
  "hasDynamicHelp": true,
5880
5870
  "hiddenAliases": [],
5881
- "id": "hardis:org:files:import",
5871
+ "id": "hardis:org:diagnose:legacyapi",
5882
5872
  "pluginAlias": "sfdx-hardis",
5883
5873
  "pluginName": "sfdx-hardis",
5884
5874
  "pluginType": "core",
5885
5875
  "strict": true,
5886
5876
  "enableJsonFlag": true,
5887
- "title": "Import files",
5877
+ "title": "Check for legacy API use",
5888
5878
  "requiresProject": false,
5889
5879
  "isESM": true,
5890
5880
  "relativePath": [
@@ -5892,45 +5882,43 @@
5892
5882
  "commands",
5893
5883
  "hardis",
5894
5884
  "org",
5895
- "files",
5896
- "import.js"
5885
+ "diagnose",
5886
+ "legacyapi.js"
5897
5887
  ],
5898
5888
  "aliasPermutations": [],
5899
5889
  "permutations": [
5900
- "hardis:org:files:import",
5901
- "org:hardis:files:import",
5902
- "org:files:hardis:import",
5903
- "org:files:import:hardis",
5904
- "hardis:files:org:import",
5905
- "files:hardis:org:import",
5906
- "files:org:hardis:import",
5907
- "files:org:import:hardis",
5908
- "hardis:files:import:org",
5909
- "files:hardis:import:org",
5910
- "files:import:hardis:org",
5911
- "files:import:org:hardis",
5912
- "hardis:org:import:files",
5913
- "org:hardis:import:files",
5914
- "org:import:hardis:files",
5915
- "org:import:files:hardis",
5916
- "hardis:import:org:files",
5917
- "import:hardis:org:files",
5918
- "import:org:hardis:files",
5919
- "import:org:files:hardis",
5920
- "hardis:import:files:org",
5921
- "import:hardis:files:org",
5922
- "import:files:hardis:org",
5923
- "import:files:org:hardis"
5890
+ "hardis:org:diagnose:legacyapi",
5891
+ "org:hardis:diagnose:legacyapi",
5892
+ "org:diagnose:hardis:legacyapi",
5893
+ "org:diagnose:legacyapi:hardis",
5894
+ "hardis:diagnose:org:legacyapi",
5895
+ "diagnose:hardis:org:legacyapi",
5896
+ "diagnose:org:hardis:legacyapi",
5897
+ "diagnose:org:legacyapi:hardis",
5898
+ "hardis:diagnose:legacyapi:org",
5899
+ "diagnose:hardis:legacyapi:org",
5900
+ "diagnose:legacyapi:hardis:org",
5901
+ "diagnose:legacyapi:org:hardis",
5902
+ "hardis:org:legacyapi:diagnose",
5903
+ "org:hardis:legacyapi:diagnose",
5904
+ "org:legacyapi:hardis:diagnose",
5905
+ "org:legacyapi:diagnose:hardis",
5906
+ "hardis:legacyapi:org:diagnose",
5907
+ "legacyapi:hardis:org:diagnose",
5908
+ "legacyapi:org:hardis:diagnose",
5909
+ "legacyapi:org:diagnose:hardis",
5910
+ "hardis:legacyapi:diagnose:org",
5911
+ "legacyapi:hardis:diagnose:org",
5912
+ "legacyapi:diagnose:hardis:org",
5913
+ "legacyapi:diagnose:org:hardis"
5924
5914
  ]
5925
5915
  },
5926
- "hardis:org:generate:packagexmlfull": {
5916
+ "hardis:org:diagnose:licenses": {
5927
5917
  "aliases": [],
5928
5918
  "args": {},
5929
- "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
5919
+ "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
5930
5920
  "examples": [
5931
- "$ sf hardis:org:generate:packagexmlfull",
5932
- "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
5933
- "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
5921
+ "$ sf hardis:org:diagnose:licenses"
5934
5922
  ],
5935
5923
  "flags": {
5936
5924
  "json": {
@@ -5949,12 +5937,20 @@
5949
5937
  "type": "option"
5950
5938
  },
5951
5939
  "outputfile": {
5952
- "description": "Output package.xml file",
5940
+ "char": "f",
5941
+ "description": "Force the path and name of output report file. Must end with .csv",
5953
5942
  "name": "outputfile",
5954
5943
  "hasDynamicHelp": false,
5955
5944
  "multiple": false,
5956
5945
  "type": "option"
5957
5946
  },
5947
+ "usedonly": {
5948
+ "char": "u",
5949
+ "description": "Filter to have only used licenses",
5950
+ "name": "usedonly",
5951
+ "allowNo": false,
5952
+ "type": "boolean"
5953
+ },
5958
5954
  "debug": {
5959
5955
  "char": "d",
5960
5956
  "description": "Activate debug mode (more logs)",
@@ -5962,13 +5958,6 @@
5962
5958
  "allowNo": false,
5963
5959
  "type": "boolean"
5964
5960
  },
5965
- "no-prompt": {
5966
- "char": "n",
5967
- "description": "Do not prompt for org username, use the default one",
5968
- "name": "no-prompt",
5969
- "allowNo": false,
5970
- "type": "boolean"
5971
- },
5972
5961
  "websocket": {
5973
5962
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
5974
5963
  "name": "websocket",
@@ -6000,13 +5989,13 @@
6000
5989
  },
6001
5990
  "hasDynamicHelp": true,
6002
5991
  "hiddenAliases": [],
6003
- "id": "hardis:org:generate:packagexmlfull",
5992
+ "id": "hardis:org:diagnose:licenses",
6004
5993
  "pluginAlias": "sfdx-hardis",
6005
5994
  "pluginName": "sfdx-hardis",
6006
5995
  "pluginType": "core",
6007
5996
  "strict": true,
6008
5997
  "enableJsonFlag": true,
6009
- "title": "Generate Full Org package.xml",
5998
+ "title": "List licenses subscribed and used in a Salesforce org",
6010
5999
  "requiresProject": false,
6011
6000
  "isESM": true,
6012
6001
  "relativePath": [
@@ -6014,52 +6003,49 @@
6014
6003
  "commands",
6015
6004
  "hardis",
6016
6005
  "org",
6017
- "generate",
6018
- "packagexmlfull.js"
6006
+ "diagnose",
6007
+ "licenses.js"
6019
6008
  ],
6020
6009
  "aliasPermutations": [],
6021
6010
  "permutations": [
6022
- "hardis:org:generate:packagexmlfull",
6023
- "org:hardis:generate:packagexmlfull",
6024
- "org:generate:hardis:packagexmlfull",
6025
- "org:generate:packagexmlfull:hardis",
6026
- "hardis:generate:org:packagexmlfull",
6027
- "generate:hardis:org:packagexmlfull",
6028
- "generate:org:hardis:packagexmlfull",
6029
- "generate:org:packagexmlfull:hardis",
6030
- "hardis:generate:packagexmlfull:org",
6031
- "generate:hardis:packagexmlfull:org",
6032
- "generate:packagexmlfull:hardis:org",
6033
- "generate:packagexmlfull:org:hardis",
6034
- "hardis:org:packagexmlfull:generate",
6035
- "org:hardis:packagexmlfull:generate",
6036
- "org:packagexmlfull:hardis:generate",
6037
- "org:packagexmlfull:generate:hardis",
6038
- "hardis:packagexmlfull:org:generate",
6039
- "packagexmlfull:hardis:org:generate",
6040
- "packagexmlfull:org:hardis:generate",
6041
- "packagexmlfull:org:generate:hardis",
6042
- "hardis:packagexmlfull:generate:org",
6043
- "packagexmlfull:hardis:generate:org",
6044
- "packagexmlfull:generate:hardis:org",
6045
- "packagexmlfull:generate:org:hardis"
6046
- ]
6047
- },
6048
- "hardis:org:diagnose:audittrail": {
6049
- "aliases": [],
6050
- "args": {},
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
- "examples": [
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"
6057
- ],
6058
- "flags": {
6059
- "json": {
6060
- "description": "Format output as json.",
6061
- "helpGroup": "GLOBAL",
6062
- "name": "json",
6011
+ "hardis:org:diagnose:licenses",
6012
+ "org:hardis:diagnose:licenses",
6013
+ "org:diagnose:hardis:licenses",
6014
+ "org:diagnose:licenses:hardis",
6015
+ "hardis:diagnose:org:licenses",
6016
+ "diagnose:hardis:org:licenses",
6017
+ "diagnose:org:hardis:licenses",
6018
+ "diagnose:org:licenses:hardis",
6019
+ "hardis:diagnose:licenses:org",
6020
+ "diagnose:hardis:licenses:org",
6021
+ "diagnose:licenses:hardis:org",
6022
+ "diagnose:licenses:org:hardis",
6023
+ "hardis:org:licenses:diagnose",
6024
+ "org:hardis:licenses:diagnose",
6025
+ "org:licenses:hardis:diagnose",
6026
+ "org:licenses:diagnose:hardis",
6027
+ "hardis:licenses:org:diagnose",
6028
+ "licenses:hardis:org:diagnose",
6029
+ "licenses:org:hardis:diagnose",
6030
+ "licenses:org:diagnose:hardis",
6031
+ "hardis:licenses:diagnose:org",
6032
+ "licenses:hardis:diagnose:org",
6033
+ "licenses:diagnose:hardis:org",
6034
+ "licenses:diagnose:org:hardis"
6035
+ ]
6036
+ },
6037
+ "hardis:org:diagnose:releaseupdates": {
6038
+ "aliases": [],
6039
+ "args": {},
6040
+ "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6041
+ "examples": [
6042
+ "$ sf hardis:org:diagnose:releaseupdates"
6043
+ ],
6044
+ "flags": {
6045
+ "json": {
6046
+ "description": "Format output as json.",
6047
+ "helpGroup": "GLOBAL",
6048
+ "name": "json",
6063
6049
  "allowNo": false,
6064
6050
  "type": "boolean"
6065
6051
  },
@@ -6071,22 +6057,6 @@
6071
6057
  "multiple": false,
6072
6058
  "type": "option"
6073
6059
  },
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
6060
  "outputfile": {
6091
6061
  "char": "f",
6092
6062
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6133,13 +6103,13 @@
6133
6103
  },
6134
6104
  "hasDynamicHelp": true,
6135
6105
  "hiddenAliases": [],
6136
- "id": "hardis:org:diagnose:audittrail",
6106
+ "id": "hardis:org:diagnose:releaseupdates",
6137
6107
  "pluginAlias": "sfdx-hardis",
6138
6108
  "pluginName": "sfdx-hardis",
6139
6109
  "pluginType": "core",
6140
6110
  "strict": true,
6141
6111
  "enableJsonFlag": true,
6142
- "title": "Diagnose content of Setup Audit Trail",
6112
+ "title": "Check Release Updates of an org",
6143
6113
  "requiresProject": false,
6144
6114
  "isESM": true,
6145
6115
  "relativePath": [
@@ -6148,42 +6118,42 @@
6148
6118
  "hardis",
6149
6119
  "org",
6150
6120
  "diagnose",
6151
- "audittrail.js"
6121
+ "releaseupdates.js"
6152
6122
  ],
6153
6123
  "aliasPermutations": [],
6154
6124
  "permutations": [
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"
6125
+ "hardis:org:diagnose:releaseupdates",
6126
+ "org:hardis:diagnose:releaseupdates",
6127
+ "org:diagnose:hardis:releaseupdates",
6128
+ "org:diagnose:releaseupdates:hardis",
6129
+ "hardis:diagnose:org:releaseupdates",
6130
+ "diagnose:hardis:org:releaseupdates",
6131
+ "diagnose:org:hardis:releaseupdates",
6132
+ "diagnose:org:releaseupdates:hardis",
6133
+ "hardis:diagnose:releaseupdates:org",
6134
+ "diagnose:hardis:releaseupdates:org",
6135
+ "diagnose:releaseupdates:hardis:org",
6136
+ "diagnose:releaseupdates:org:hardis",
6137
+ "hardis:org:releaseupdates:diagnose",
6138
+ "org:hardis:releaseupdates:diagnose",
6139
+ "org:releaseupdates:hardis:diagnose",
6140
+ "org:releaseupdates:diagnose:hardis",
6141
+ "hardis:releaseupdates:org:diagnose",
6142
+ "releaseupdates:hardis:org:diagnose",
6143
+ "releaseupdates:org:hardis:diagnose",
6144
+ "releaseupdates:org:diagnose:hardis",
6145
+ "hardis:releaseupdates:diagnose:org",
6146
+ "releaseupdates:hardis:diagnose:org",
6147
+ "releaseupdates:diagnose:hardis:org",
6148
+ "releaseupdates:diagnose:org:hardis"
6179
6149
  ]
6180
6150
  },
6181
- "hardis:org:diagnose:instanceupgrade": {
6151
+ "hardis:org:diagnose:unsecure-connected-apps": {
6182
6152
  "aliases": [],
6183
6153
  "args": {},
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",
6154
+ "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",
6185
6155
  "examples": [
6186
- "$ sf hardis:org:diagnose:instanceupgrade"
6156
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6187
6157
  ],
6188
6158
  "flags": {
6189
6159
  "json": {
@@ -6201,6 +6171,14 @@
6201
6171
  "multiple": false,
6202
6172
  "type": "option"
6203
6173
  },
6174
+ "outputfile": {
6175
+ "char": "f",
6176
+ "description": "Force the path and name of output report file. Must end with .csv",
6177
+ "name": "outputfile",
6178
+ "hasDynamicHelp": false,
6179
+ "multiple": false,
6180
+ "type": "option"
6181
+ },
6204
6182
  "debug": {
6205
6183
  "char": "d",
6206
6184
  "description": "Activate debug mode (more logs)",
@@ -6239,13 +6217,13 @@
6239
6217
  },
6240
6218
  "hasDynamicHelp": true,
6241
6219
  "hiddenAliases": [],
6242
- "id": "hardis:org:diagnose:instanceupgrade",
6220
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
6243
6221
  "pluginAlias": "sfdx-hardis",
6244
6222
  "pluginName": "sfdx-hardis",
6245
6223
  "pluginType": "core",
6246
6224
  "strict": true,
6247
6225
  "enableJsonFlag": true,
6248
- "title": "Get Instance Upgrade date",
6226
+ "title": "Detect Unsecured Connected Apps",
6249
6227
  "requiresProject": false,
6250
6228
  "isESM": true,
6251
6229
  "relativePath": [
@@ -6254,45 +6232,43 @@
6254
6232
  "hardis",
6255
6233
  "org",
6256
6234
  "diagnose",
6257
- "instanceupgrade.js"
6235
+ "unsecure-connected-apps.js"
6258
6236
  ],
6259
6237
  "aliasPermutations": [],
6260
6238
  "permutations": [
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"
6239
+ "hardis:org:diagnose:unsecure-connected-apps",
6240
+ "org:hardis:diagnose:unsecure-connected-apps",
6241
+ "org:diagnose:hardis:unsecure-connected-apps",
6242
+ "org:diagnose:unsecure-connected-apps:hardis",
6243
+ "hardis:diagnose:org:unsecure-connected-apps",
6244
+ "diagnose:hardis:org:unsecure-connected-apps",
6245
+ "diagnose:org:hardis:unsecure-connected-apps",
6246
+ "diagnose:org:unsecure-connected-apps:hardis",
6247
+ "hardis:diagnose:unsecure-connected-apps:org",
6248
+ "diagnose:hardis:unsecure-connected-apps:org",
6249
+ "diagnose:unsecure-connected-apps:hardis:org",
6250
+ "diagnose:unsecure-connected-apps:org:hardis",
6251
+ "hardis:org:unsecure-connected-apps:diagnose",
6252
+ "org:hardis:unsecure-connected-apps:diagnose",
6253
+ "org:unsecure-connected-apps:hardis:diagnose",
6254
+ "org:unsecure-connected-apps:diagnose:hardis",
6255
+ "hardis:unsecure-connected-apps:org:diagnose",
6256
+ "unsecure-connected-apps:hardis:org:diagnose",
6257
+ "unsecure-connected-apps:org:hardis:diagnose",
6258
+ "unsecure-connected-apps:org:diagnose:hardis",
6259
+ "hardis:unsecure-connected-apps:diagnose:org",
6260
+ "unsecure-connected-apps:hardis:diagnose:org",
6261
+ "unsecure-connected-apps:diagnose:hardis:org",
6262
+ "unsecure-connected-apps:diagnose:org:hardis"
6285
6263
  ]
6286
6264
  },
6287
- "hardis:org:diagnose:legacyapi": {
6265
+ "hardis:org:diagnose:unused-apex-classes": {
6288
6266
  "aliases": [],
6289
6267
  "args": {},
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",
6268
+ "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",
6291
6269
  "examples": [
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"
6270
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6271
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6296
6272
  ],
6297
6273
  "flags": {
6298
6274
  "json": {
@@ -6310,24 +6286,6 @@
6310
6286
  "multiple": false,
6311
6287
  "type": "option"
6312
6288
  },
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
- },
6331
6289
  "outputfile": {
6332
6290
  "char": "f",
6333
6291
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6336,6 +6294,14 @@
6336
6294
  "multiple": false,
6337
6295
  "type": "option"
6338
6296
  },
6297
+ "days": {
6298
+ "char": "t",
6299
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6300
+ "name": "days",
6301
+ "hasDynamicHelp": false,
6302
+ "multiple": false,
6303
+ "type": "option"
6304
+ },
6339
6305
  "debug": {
6340
6306
  "char": "d",
6341
6307
  "description": "Activate debug mode (more logs)",
@@ -6374,13 +6340,13 @@
6374
6340
  },
6375
6341
  "hasDynamicHelp": true,
6376
6342
  "hiddenAliases": [],
6377
- "id": "hardis:org:diagnose:legacyapi",
6343
+ "id": "hardis:org:diagnose:unused-apex-classes",
6378
6344
  "pluginAlias": "sfdx-hardis",
6379
6345
  "pluginName": "sfdx-hardis",
6380
6346
  "pluginType": "core",
6381
6347
  "strict": true,
6382
6348
  "enableJsonFlag": true,
6383
- "title": "Check for legacy API use",
6349
+ "title": "Detect unused Apex classes in an org",
6384
6350
  "requiresProject": false,
6385
6351
  "isESM": true,
6386
6352
  "relativePath": [
@@ -6389,48 +6355,48 @@
6389
6355
  "hardis",
6390
6356
  "org",
6391
6357
  "diagnose",
6392
- "legacyapi.js"
6358
+ "unused-apex-classes.js"
6393
6359
  ],
6394
6360
  "aliasPermutations": [],
6395
6361
  "permutations": [
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"
6420
- ]
6421
- },
6422
- "hardis:org:diagnose:licenses": {
6423
- "aliases": [],
6424
- "args": {},
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",
6426
- "examples": [
6427
- "$ sf hardis:org:diagnose:licenses"
6428
- ],
6429
- "flags": {
6430
- "json": {
6431
- "description": "Format output as json.",
6432
- "helpGroup": "GLOBAL",
6433
- "name": "json",
6362
+ "hardis:org:diagnose:unused-apex-classes",
6363
+ "org:hardis:diagnose:unused-apex-classes",
6364
+ "org:diagnose:hardis:unused-apex-classes",
6365
+ "org:diagnose:unused-apex-classes:hardis",
6366
+ "hardis:diagnose:org:unused-apex-classes",
6367
+ "diagnose:hardis:org:unused-apex-classes",
6368
+ "diagnose:org:hardis:unused-apex-classes",
6369
+ "diagnose:org:unused-apex-classes:hardis",
6370
+ "hardis:diagnose:unused-apex-classes:org",
6371
+ "diagnose:hardis:unused-apex-classes:org",
6372
+ "diagnose:unused-apex-classes:hardis:org",
6373
+ "diagnose:unused-apex-classes:org:hardis",
6374
+ "hardis:org:unused-apex-classes:diagnose",
6375
+ "org:hardis:unused-apex-classes:diagnose",
6376
+ "org:unused-apex-classes:hardis:diagnose",
6377
+ "org:unused-apex-classes:diagnose:hardis",
6378
+ "hardis:unused-apex-classes:org:diagnose",
6379
+ "unused-apex-classes:hardis:org:diagnose",
6380
+ "unused-apex-classes:org:hardis:diagnose",
6381
+ "unused-apex-classes:org:diagnose:hardis",
6382
+ "hardis:unused-apex-classes:diagnose:org",
6383
+ "unused-apex-classes:hardis:diagnose:org",
6384
+ "unused-apex-classes:diagnose:hardis:org",
6385
+ "unused-apex-classes:diagnose:org:hardis"
6386
+ ]
6387
+ },
6388
+ "hardis:org:diagnose:unused-connected-apps": {
6389
+ "aliases": [],
6390
+ "args": {},
6391
+ "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",
6392
+ "examples": [
6393
+ "$ sf hardis:org:diagnose:unused-connected-apps"
6394
+ ],
6395
+ "flags": {
6396
+ "json": {
6397
+ "description": "Format output as json.",
6398
+ "helpGroup": "GLOBAL",
6399
+ "name": "json",
6434
6400
  "allowNo": false,
6435
6401
  "type": "boolean"
6436
6402
  },
@@ -6450,13 +6416,6 @@
6450
6416
  "multiple": false,
6451
6417
  "type": "option"
6452
6418
  },
6453
- "usedonly": {
6454
- "char": "u",
6455
- "description": "Filter to have only used licenses",
6456
- "name": "usedonly",
6457
- "allowNo": false,
6458
- "type": "boolean"
6459
- },
6460
6419
  "debug": {
6461
6420
  "char": "d",
6462
6421
  "description": "Activate debug mode (more logs)",
@@ -6495,13 +6454,30 @@
6495
6454
  },
6496
6455
  "hasDynamicHelp": true,
6497
6456
  "hiddenAliases": [],
6498
- "id": "hardis:org:diagnose:licenses",
6457
+ "id": "hardis:org:diagnose:unused-connected-apps",
6499
6458
  "pluginAlias": "sfdx-hardis",
6500
6459
  "pluginName": "sfdx-hardis",
6501
6460
  "pluginType": "core",
6502
6461
  "strict": true,
6503
6462
  "enableJsonFlag": true,
6504
- "title": "List licenses subscribed and used in a Salesforce org",
6463
+ "title": "Unused Connected Apps in an org",
6464
+ "allowedInactiveConnectedApps": [
6465
+ "Ant Migration Tool",
6466
+ "Chatter Desktop",
6467
+ "Chatter Mobile for BlackBerry",
6468
+ "Force.com IDE",
6469
+ "OIQ_Integration",
6470
+ "Salesforce CLI",
6471
+ "Salesforce Files",
6472
+ "Salesforce Mobile Dashboards",
6473
+ "Salesforce Touch",
6474
+ "Salesforce for Outlook",
6475
+ "SalesforceA",
6476
+ "SalesforceA for Android",
6477
+ "SalesforceA for iOS",
6478
+ "SalesforceDX Namespace Registry",
6479
+ "SalesforceIQ"
6480
+ ],
6505
6481
  "requiresProject": false,
6506
6482
  "isESM": true,
6507
6483
  "relativePath": [
@@ -6510,42 +6486,43 @@
6510
6486
  "hardis",
6511
6487
  "org",
6512
6488
  "diagnose",
6513
- "licenses.js"
6489
+ "unused-connected-apps.js"
6514
6490
  ],
6515
6491
  "aliasPermutations": [],
6516
6492
  "permutations": [
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"
6493
+ "hardis:org:diagnose:unused-connected-apps",
6494
+ "org:hardis:diagnose:unused-connected-apps",
6495
+ "org:diagnose:hardis:unused-connected-apps",
6496
+ "org:diagnose:unused-connected-apps:hardis",
6497
+ "hardis:diagnose:org:unused-connected-apps",
6498
+ "diagnose:hardis:org:unused-connected-apps",
6499
+ "diagnose:org:hardis:unused-connected-apps",
6500
+ "diagnose:org:unused-connected-apps:hardis",
6501
+ "hardis:diagnose:unused-connected-apps:org",
6502
+ "diagnose:hardis:unused-connected-apps:org",
6503
+ "diagnose:unused-connected-apps:hardis:org",
6504
+ "diagnose:unused-connected-apps:org:hardis",
6505
+ "hardis:org:unused-connected-apps:diagnose",
6506
+ "org:hardis:unused-connected-apps:diagnose",
6507
+ "org:unused-connected-apps:hardis:diagnose",
6508
+ "org:unused-connected-apps:diagnose:hardis",
6509
+ "hardis:unused-connected-apps:org:diagnose",
6510
+ "unused-connected-apps:hardis:org:diagnose",
6511
+ "unused-connected-apps:org:hardis:diagnose",
6512
+ "unused-connected-apps:org:diagnose:hardis",
6513
+ "hardis:unused-connected-apps:diagnose:org",
6514
+ "unused-connected-apps:hardis:diagnose:org",
6515
+ "unused-connected-apps:diagnose:hardis:org",
6516
+ "unused-connected-apps:diagnose:org:hardis"
6541
6517
  ]
6542
6518
  },
6543
- "hardis:org:diagnose:releaseupdates": {
6519
+ "hardis:org:diagnose:unusedlicenses": {
6544
6520
  "aliases": [],
6545
6521
  "args": {},
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",
6522
+ "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",
6547
6523
  "examples": [
6548
- "$ sf hardis:org:diagnose:releaseupdates"
6524
+ "$ sf hardis:org:diagnose:unusedlicenses",
6525
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
6549
6526
  ],
6550
6527
  "flags": {
6551
6528
  "json": {
@@ -6609,14 +6586,32 @@
6609
6586
  },
6610
6587
  "hasDynamicHelp": true,
6611
6588
  "hiddenAliases": [],
6612
- "id": "hardis:org:diagnose:releaseupdates",
6589
+ "id": "hardis:org:diagnose:unusedlicenses",
6613
6590
  "pluginAlias": "sfdx-hardis",
6614
6591
  "pluginName": "sfdx-hardis",
6615
6592
  "pluginType": "core",
6616
6593
  "strict": true,
6617
6594
  "enableJsonFlag": true,
6618
- "title": "Check Release Updates of an org",
6595
+ "title": "Detect unused Permission Set Licenses (beta)",
6619
6596
  "requiresProject": false,
6597
+ "additionalPermissionSetsToAlwaysGet": [
6598
+ "Sales_User"
6599
+ ],
6600
+ "permSetsPermSetLicenses": [
6601
+ {
6602
+ "permSet": "Sales_User",
6603
+ "permSetLicense": "SalesUserPsl"
6604
+ }
6605
+ ],
6606
+ "profilesPermissionSetLicenses": [
6607
+ {
6608
+ "profile": "Salesforce API Only",
6609
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
6610
+ }
6611
+ ],
6612
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6613
+ "IdentityConnect"
6614
+ ],
6620
6615
  "isESM": true,
6621
6616
  "relativePath": [
6622
6617
  "lib",
@@ -6624,42 +6619,46 @@
6624
6619
  "hardis",
6625
6620
  "org",
6626
6621
  "diagnose",
6627
- "releaseupdates.js"
6622
+ "unusedlicenses.js"
6628
6623
  ],
6629
6624
  "aliasPermutations": [],
6630
6625
  "permutations": [
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"
6626
+ "hardis:org:diagnose:unusedlicenses",
6627
+ "org:hardis:diagnose:unusedlicenses",
6628
+ "org:diagnose:hardis:unusedlicenses",
6629
+ "org:diagnose:unusedlicenses:hardis",
6630
+ "hardis:diagnose:org:unusedlicenses",
6631
+ "diagnose:hardis:org:unusedlicenses",
6632
+ "diagnose:org:hardis:unusedlicenses",
6633
+ "diagnose:org:unusedlicenses:hardis",
6634
+ "hardis:diagnose:unusedlicenses:org",
6635
+ "diagnose:hardis:unusedlicenses:org",
6636
+ "diagnose:unusedlicenses:hardis:org",
6637
+ "diagnose:unusedlicenses:org:hardis",
6638
+ "hardis:org:unusedlicenses:diagnose",
6639
+ "org:hardis:unusedlicenses:diagnose",
6640
+ "org:unusedlicenses:hardis:diagnose",
6641
+ "org:unusedlicenses:diagnose:hardis",
6642
+ "hardis:unusedlicenses:org:diagnose",
6643
+ "unusedlicenses:hardis:org:diagnose",
6644
+ "unusedlicenses:org:hardis:diagnose",
6645
+ "unusedlicenses:org:diagnose:hardis",
6646
+ "hardis:unusedlicenses:diagnose:org",
6647
+ "unusedlicenses:hardis:diagnose:org",
6648
+ "unusedlicenses:diagnose:hardis:org",
6649
+ "unusedlicenses:diagnose:org:hardis"
6655
6650
  ]
6656
6651
  },
6657
- "hardis:org:diagnose:unsecure-connected-apps": {
6652
+ "hardis:org:diagnose:unusedusers": {
6658
6653
  "aliases": [],
6659
6654
  "args": {},
6660
- "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",
6655
+ "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>",
6661
6656
  "examples": [
6662
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
6657
+ "$ sf hardis:org:diagnose:unusedusers",
6658
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
6659
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6660
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6661
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6663
6662
  ],
6664
6663
  "flags": {
6665
6664
  "json": {
@@ -6685,6 +6684,41 @@
6685
6684
  "multiple": false,
6686
6685
  "type": "option"
6687
6686
  },
6687
+ "days": {
6688
+ "char": "t",
6689
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6690
+ "name": "days",
6691
+ "hasDynamicHelp": false,
6692
+ "multiple": false,
6693
+ "type": "option"
6694
+ },
6695
+ "licensetypes": {
6696
+ "char": "l",
6697
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6698
+ "name": "licensetypes",
6699
+ "hasDynamicHelp": false,
6700
+ "multiple": false,
6701
+ "options": [
6702
+ "all",
6703
+ "all-crm",
6704
+ "all-paying"
6705
+ ],
6706
+ "type": "option"
6707
+ },
6708
+ "licenseidentifiers": {
6709
+ "char": "i",
6710
+ "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",
6711
+ "name": "licenseidentifiers",
6712
+ "hasDynamicHelp": false,
6713
+ "multiple": false,
6714
+ "type": "option"
6715
+ },
6716
+ "returnactiveusers": {
6717
+ "description": "Inverts the command by returning the active users",
6718
+ "name": "returnactiveusers",
6719
+ "allowNo": false,
6720
+ "type": "boolean"
6721
+ },
6688
6722
  "debug": {
6689
6723
  "char": "d",
6690
6724
  "description": "Activate debug mode (more logs)",
@@ -6723,13 +6757,13 @@
6723
6757
  },
6724
6758
  "hasDynamicHelp": true,
6725
6759
  "hiddenAliases": [],
6726
- "id": "hardis:org:diagnose:unsecure-connected-apps",
6760
+ "id": "hardis:org:diagnose:unusedusers",
6727
6761
  "pluginAlias": "sfdx-hardis",
6728
6762
  "pluginName": "sfdx-hardis",
6729
6763
  "pluginType": "core",
6730
6764
  "strict": true,
6731
6765
  "enableJsonFlag": true,
6732
- "title": "Detect Unsecured Connected Apps",
6766
+ "title": "Detect unused Users in Salesforce",
6733
6767
  "requiresProject": false,
6734
6768
  "isESM": true,
6735
6769
  "relativePath": [
@@ -6738,43 +6772,43 @@
6738
6772
  "hardis",
6739
6773
  "org",
6740
6774
  "diagnose",
6741
- "unsecure-connected-apps.js"
6775
+ "unusedusers.js"
6742
6776
  ],
6743
6777
  "aliasPermutations": [],
6744
6778
  "permutations": [
6745
- "hardis:org:diagnose:unsecure-connected-apps",
6746
- "org:hardis:diagnose:unsecure-connected-apps",
6747
- "org:diagnose:hardis:unsecure-connected-apps",
6748
- "org:diagnose:unsecure-connected-apps:hardis",
6749
- "hardis:diagnose:org:unsecure-connected-apps",
6750
- "diagnose:hardis:org:unsecure-connected-apps",
6751
- "diagnose:org:hardis:unsecure-connected-apps",
6752
- "diagnose:org:unsecure-connected-apps:hardis",
6753
- "hardis:diagnose:unsecure-connected-apps:org",
6754
- "diagnose:hardis:unsecure-connected-apps:org",
6755
- "diagnose:unsecure-connected-apps:hardis:org",
6756
- "diagnose:unsecure-connected-apps:org:hardis",
6757
- "hardis:org:unsecure-connected-apps:diagnose",
6758
- "org:hardis:unsecure-connected-apps:diagnose",
6759
- "org:unsecure-connected-apps:hardis:diagnose",
6760
- "org:unsecure-connected-apps:diagnose:hardis",
6761
- "hardis:unsecure-connected-apps:org:diagnose",
6762
- "unsecure-connected-apps:hardis:org:diagnose",
6763
- "unsecure-connected-apps:org:hardis:diagnose",
6764
- "unsecure-connected-apps:org:diagnose:hardis",
6765
- "hardis:unsecure-connected-apps:diagnose:org",
6766
- "unsecure-connected-apps:hardis:diagnose:org",
6767
- "unsecure-connected-apps:diagnose:hardis:org",
6768
- "unsecure-connected-apps:diagnose:org:hardis"
6779
+ "hardis:org:diagnose:unusedusers",
6780
+ "org:hardis:diagnose:unusedusers",
6781
+ "org:diagnose:hardis:unusedusers",
6782
+ "org:diagnose:unusedusers:hardis",
6783
+ "hardis:diagnose:org:unusedusers",
6784
+ "diagnose:hardis:org:unusedusers",
6785
+ "diagnose:org:hardis:unusedusers",
6786
+ "diagnose:org:unusedusers:hardis",
6787
+ "hardis:diagnose:unusedusers:org",
6788
+ "diagnose:hardis:unusedusers:org",
6789
+ "diagnose:unusedusers:hardis:org",
6790
+ "diagnose:unusedusers:org:hardis",
6791
+ "hardis:org:unusedusers:diagnose",
6792
+ "org:hardis:unusedusers:diagnose",
6793
+ "org:unusedusers:hardis:diagnose",
6794
+ "org:unusedusers:diagnose:hardis",
6795
+ "hardis:unusedusers:org:diagnose",
6796
+ "unusedusers:hardis:org:diagnose",
6797
+ "unusedusers:org:hardis:diagnose",
6798
+ "unusedusers:org:diagnose:hardis",
6799
+ "hardis:unusedusers:diagnose:org",
6800
+ "unusedusers:hardis:diagnose:org",
6801
+ "unusedusers:diagnose:hardis:org",
6802
+ "unusedusers:diagnose:org:hardis"
6769
6803
  ]
6770
6804
  },
6771
- "hardis:org:diagnose:unused-apex-classes": {
6805
+ "hardis:org:fix:listviewmine": {
6772
6806
  "aliases": [],
6773
6807
  "args": {},
6774
- "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",
6808
+ "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
6775
6809
  "examples": [
6776
- "$ sf hardis:org:diagnose:unused-apex-classes",
6777
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6810
+ "$ sf hardis:org:fix:listviewmine",
6811
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
6778
6812
  ],
6779
6813
  "flags": {
6780
6814
  "json": {
@@ -6792,18 +6826,10 @@
6792
6826
  "multiple": false,
6793
6827
  "type": "option"
6794
6828
  },
6795
- "outputfile": {
6796
- "char": "f",
6797
- "description": "Force the path and name of output report file. Must end with .csv",
6798
- "name": "outputfile",
6799
- "hasDynamicHelp": false,
6800
- "multiple": false,
6801
- "type": "option"
6802
- },
6803
- "days": {
6804
- "char": "t",
6805
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6806
- "name": "days",
6829
+ "listviews": {
6830
+ "char": "l",
6831
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
6832
+ "name": "listviews",
6807
6833
  "hasDynamicHelp": false,
6808
6834
  "multiple": false,
6809
6835
  "type": "option"
@@ -6846,57 +6872,59 @@
6846
6872
  },
6847
6873
  "hasDynamicHelp": true,
6848
6874
  "hiddenAliases": [],
6849
- "id": "hardis:org:diagnose:unused-apex-classes",
6875
+ "id": "hardis:org:fix:listviewmine",
6850
6876
  "pluginAlias": "sfdx-hardis",
6851
6877
  "pluginName": "sfdx-hardis",
6852
6878
  "pluginType": "core",
6853
6879
  "strict": true,
6854
6880
  "enableJsonFlag": true,
6855
- "title": "Detect unused Apex classes in an org",
6856
- "requiresProject": false,
6881
+ "title": "Fix listviews with ",
6882
+ "requiresProject": true,
6857
6883
  "isESM": true,
6858
6884
  "relativePath": [
6859
6885
  "lib",
6860
6886
  "commands",
6861
6887
  "hardis",
6862
6888
  "org",
6863
- "diagnose",
6864
- "unused-apex-classes.js"
6889
+ "fix",
6890
+ "listviewmine.js"
6865
6891
  ],
6866
6892
  "aliasPermutations": [],
6867
6893
  "permutations": [
6868
- "hardis:org:diagnose:unused-apex-classes",
6869
- "org:hardis:diagnose:unused-apex-classes",
6870
- "org:diagnose:hardis:unused-apex-classes",
6871
- "org:diagnose:unused-apex-classes:hardis",
6872
- "hardis:diagnose:org:unused-apex-classes",
6873
- "diagnose:hardis:org:unused-apex-classes",
6874
- "diagnose:org:hardis:unused-apex-classes",
6875
- "diagnose:org:unused-apex-classes:hardis",
6876
- "hardis:diagnose:unused-apex-classes:org",
6877
- "diagnose:hardis:unused-apex-classes:org",
6878
- "diagnose:unused-apex-classes:hardis:org",
6879
- "diagnose:unused-apex-classes:org:hardis",
6880
- "hardis:org:unused-apex-classes:diagnose",
6881
- "org:hardis:unused-apex-classes:diagnose",
6882
- "org:unused-apex-classes:hardis:diagnose",
6883
- "org:unused-apex-classes:diagnose:hardis",
6884
- "hardis:unused-apex-classes:org:diagnose",
6885
- "unused-apex-classes:hardis:org:diagnose",
6886
- "unused-apex-classes:org:hardis:diagnose",
6887
- "unused-apex-classes:org:diagnose:hardis",
6888
- "hardis:unused-apex-classes:diagnose:org",
6889
- "unused-apex-classes:hardis:diagnose:org",
6890
- "unused-apex-classes:diagnose:hardis:org",
6891
- "unused-apex-classes:diagnose:org:hardis"
6894
+ "hardis:org:fix:listviewmine",
6895
+ "org:hardis:fix:listviewmine",
6896
+ "org:fix:hardis:listviewmine",
6897
+ "org:fix:listviewmine:hardis",
6898
+ "hardis:fix:org:listviewmine",
6899
+ "fix:hardis:org:listviewmine",
6900
+ "fix:org:hardis:listviewmine",
6901
+ "fix:org:listviewmine:hardis",
6902
+ "hardis:fix:listviewmine:org",
6903
+ "fix:hardis:listviewmine:org",
6904
+ "fix:listviewmine:hardis:org",
6905
+ "fix:listviewmine:org:hardis",
6906
+ "hardis:org:listviewmine:fix",
6907
+ "org:hardis:listviewmine:fix",
6908
+ "org:listviewmine:hardis:fix",
6909
+ "org:listviewmine:fix:hardis",
6910
+ "hardis:listviewmine:org:fix",
6911
+ "listviewmine:hardis:org:fix",
6912
+ "listviewmine:org:hardis:fix",
6913
+ "listviewmine:org:fix:hardis",
6914
+ "hardis:listviewmine:fix:org",
6915
+ "listviewmine:hardis:fix:org",
6916
+ "listviewmine:fix:hardis:org",
6917
+ "listviewmine:fix:org:hardis"
6892
6918
  ]
6893
6919
  },
6894
- "hardis:org:diagnose:unused-connected-apps": {
6920
+ "hardis:org:generate:packagexmlfull": {
6895
6921
  "aliases": [],
6896
6922
  "args": {},
6897
- "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",
6923
+ "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
6898
6924
  "examples": [
6899
- "$ sf hardis:org:diagnose:unused-connected-apps"
6925
+ "$ sf hardis:org:generate:packagexmlfull",
6926
+ "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
6927
+ "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
6900
6928
  ],
6901
6929
  "flags": {
6902
6930
  "json": {
@@ -6915,8 +6943,7 @@
6915
6943
  "type": "option"
6916
6944
  },
6917
6945
  "outputfile": {
6918
- "char": "f",
6919
- "description": "Force the path and name of output report file. Must end with .csv",
6946
+ "description": "Output package.xml file",
6920
6947
  "name": "outputfile",
6921
6948
  "hasDynamicHelp": false,
6922
6949
  "multiple": false,
@@ -6929,6 +6956,13 @@
6929
6956
  "allowNo": false,
6930
6957
  "type": "boolean"
6931
6958
  },
6959
+ "no-prompt": {
6960
+ "char": "n",
6961
+ "description": "Do not prompt for org username, use the default one",
6962
+ "name": "no-prompt",
6963
+ "allowNo": false,
6964
+ "type": "boolean"
6965
+ },
6932
6966
  "websocket": {
6933
6967
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
6934
6968
  "name": "websocket",
@@ -6960,30 +6994,13 @@
6960
6994
  },
6961
6995
  "hasDynamicHelp": true,
6962
6996
  "hiddenAliases": [],
6963
- "id": "hardis:org:diagnose:unused-connected-apps",
6997
+ "id": "hardis:org:generate:packagexmlfull",
6964
6998
  "pluginAlias": "sfdx-hardis",
6965
6999
  "pluginName": "sfdx-hardis",
6966
7000
  "pluginType": "core",
6967
7001
  "strict": true,
6968
7002
  "enableJsonFlag": true,
6969
- "title": "Unused Connected Apps in an org",
6970
- "allowedInactiveConnectedApps": [
6971
- "Ant Migration Tool",
6972
- "Chatter Desktop",
6973
- "Chatter Mobile for BlackBerry",
6974
- "Force.com IDE",
6975
- "OIQ_Integration",
6976
- "Salesforce CLI",
6977
- "Salesforce Files",
6978
- "Salesforce Mobile Dashboards",
6979
- "Salesforce Touch",
6980
- "Salesforce for Outlook",
6981
- "SalesforceA",
6982
- "SalesforceA for Android",
6983
- "SalesforceA for iOS",
6984
- "SalesforceDX Namespace Registry",
6985
- "SalesforceIQ"
6986
- ],
7003
+ "title": "Generate Full Org package.xml",
6987
7004
  "requiresProject": false,
6988
7005
  "isESM": true,
6989
7006
  "relativePath": [
@@ -6991,44 +7008,43 @@
6991
7008
  "commands",
6992
7009
  "hardis",
6993
7010
  "org",
6994
- "diagnose",
6995
- "unused-connected-apps.js"
7011
+ "generate",
7012
+ "packagexmlfull.js"
6996
7013
  ],
6997
7014
  "aliasPermutations": [],
6998
7015
  "permutations": [
6999
- "hardis:org:diagnose:unused-connected-apps",
7000
- "org:hardis:diagnose:unused-connected-apps",
7001
- "org:diagnose:hardis:unused-connected-apps",
7002
- "org:diagnose:unused-connected-apps:hardis",
7003
- "hardis:diagnose:org:unused-connected-apps",
7004
- "diagnose:hardis:org:unused-connected-apps",
7005
- "diagnose:org:hardis:unused-connected-apps",
7006
- "diagnose:org:unused-connected-apps:hardis",
7007
- "hardis:diagnose:unused-connected-apps:org",
7008
- "diagnose:hardis:unused-connected-apps:org",
7009
- "diagnose:unused-connected-apps:hardis:org",
7010
- "diagnose:unused-connected-apps:org:hardis",
7011
- "hardis:org:unused-connected-apps:diagnose",
7012
- "org:hardis:unused-connected-apps:diagnose",
7013
- "org:unused-connected-apps:hardis:diagnose",
7014
- "org:unused-connected-apps:diagnose:hardis",
7015
- "hardis:unused-connected-apps:org:diagnose",
7016
- "unused-connected-apps:hardis:org:diagnose",
7017
- "unused-connected-apps:org:hardis:diagnose",
7018
- "unused-connected-apps:org:diagnose:hardis",
7019
- "hardis:unused-connected-apps:diagnose:org",
7020
- "unused-connected-apps:hardis:diagnose:org",
7021
- "unused-connected-apps:diagnose:hardis:org",
7022
- "unused-connected-apps:diagnose:org:hardis"
7016
+ "hardis:org:generate:packagexmlfull",
7017
+ "org:hardis:generate:packagexmlfull",
7018
+ "org:generate:hardis:packagexmlfull",
7019
+ "org:generate:packagexmlfull:hardis",
7020
+ "hardis:generate:org:packagexmlfull",
7021
+ "generate:hardis:org:packagexmlfull",
7022
+ "generate:org:hardis:packagexmlfull",
7023
+ "generate:org:packagexmlfull:hardis",
7024
+ "hardis:generate:packagexmlfull:org",
7025
+ "generate:hardis:packagexmlfull:org",
7026
+ "generate:packagexmlfull:hardis:org",
7027
+ "generate:packagexmlfull:org:hardis",
7028
+ "hardis:org:packagexmlfull:generate",
7029
+ "org:hardis:packagexmlfull:generate",
7030
+ "org:packagexmlfull:hardis:generate",
7031
+ "org:packagexmlfull:generate:hardis",
7032
+ "hardis:packagexmlfull:org:generate",
7033
+ "packagexmlfull:hardis:org:generate",
7034
+ "packagexmlfull:org:hardis:generate",
7035
+ "packagexmlfull:org:generate:hardis",
7036
+ "hardis:packagexmlfull:generate:org",
7037
+ "packagexmlfull:hardis:generate:org",
7038
+ "packagexmlfull:generate:hardis:org",
7039
+ "packagexmlfull:generate:org:hardis"
7023
7040
  ]
7024
7041
  },
7025
- "hardis:org:diagnose:unusedlicenses": {
7042
+ "hardis:org:files:export": {
7026
7043
  "aliases": [],
7027
7044
  "args": {},
7028
- "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",
7045
+ "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
7029
7046
  "examples": [
7030
- "$ sf hardis:org:diagnose:unusedlicenses",
7031
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
7047
+ "$ sf hardis:org:files:export"
7032
7048
  ],
7033
7049
  "flags": {
7034
7050
  "json": {
@@ -7046,14 +7062,48 @@
7046
7062
  "multiple": false,
7047
7063
  "type": "option"
7048
7064
  },
7049
- "outputfile": {
7050
- "char": "f",
7051
- "description": "Force the path and name of output report file. Must end with .csv",
7052
- "name": "outputfile",
7065
+ "path": {
7066
+ "char": "p",
7067
+ "description": "Path to the file export project",
7068
+ "name": "path",
7053
7069
  "hasDynamicHelp": false,
7054
7070
  "multiple": false,
7055
7071
  "type": "option"
7056
7072
  },
7073
+ "chunksize": {
7074
+ "char": "c",
7075
+ "description": "Number of records to add in a chunk before it is processed",
7076
+ "name": "chunksize",
7077
+ "default": 1000,
7078
+ "hasDynamicHelp": false,
7079
+ "multiple": false,
7080
+ "type": "option"
7081
+ },
7082
+ "polltimeout": {
7083
+ "char": "t",
7084
+ "description": "Timeout in MS for Bulk API calls",
7085
+ "name": "polltimeout",
7086
+ "default": 300000,
7087
+ "hasDynamicHelp": false,
7088
+ "multiple": false,
7089
+ "type": "option"
7090
+ },
7091
+ "startchunknumber": {
7092
+ "char": "s",
7093
+ "description": "Chunk number to start from",
7094
+ "name": "startchunknumber",
7095
+ "default": 0,
7096
+ "hasDynamicHelp": false,
7097
+ "multiple": false,
7098
+ "type": "option"
7099
+ },
7100
+ "resume": {
7101
+ "char": "r",
7102
+ "description": "Resume previous export by checking existing files (default in CI)",
7103
+ "name": "resume",
7104
+ "allowNo": false,
7105
+ "type": "boolean"
7106
+ },
7057
7107
  "debug": {
7058
7108
  "char": "d",
7059
7109
  "description": "Activate debug mode (more logs)",
@@ -7092,79 +7142,57 @@
7092
7142
  },
7093
7143
  "hasDynamicHelp": true,
7094
7144
  "hiddenAliases": [],
7095
- "id": "hardis:org:diagnose:unusedlicenses",
7145
+ "id": "hardis:org:files:export",
7096
7146
  "pluginAlias": "sfdx-hardis",
7097
7147
  "pluginName": "sfdx-hardis",
7098
7148
  "pluginType": "core",
7099
7149
  "strict": true,
7100
7150
  "enableJsonFlag": true,
7101
- "title": "Detect unused Permission Set Licenses (beta)",
7151
+ "title": "Export files",
7102
7152
  "requiresProject": false,
7103
- "additionalPermissionSetsToAlwaysGet": [
7104
- "Sales_User"
7105
- ],
7106
- "permSetsPermSetLicenses": [
7107
- {
7108
- "permSet": "Sales_User",
7109
- "permSetLicense": "SalesUserPsl"
7110
- }
7111
- ],
7112
- "profilesPermissionSetLicenses": [
7113
- {
7114
- "profile": "Salesforce API Only",
7115
- "permSetLicense": "SalesforceAPIIntegrationPsl"
7116
- }
7117
- ],
7118
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
7119
- "IdentityConnect"
7120
- ],
7121
7153
  "isESM": true,
7122
7154
  "relativePath": [
7123
7155
  "lib",
7124
7156
  "commands",
7125
7157
  "hardis",
7126
7158
  "org",
7127
- "diagnose",
7128
- "unusedlicenses.js"
7159
+ "files",
7160
+ "export.js"
7129
7161
  ],
7130
7162
  "aliasPermutations": [],
7131
7163
  "permutations": [
7132
- "hardis:org:diagnose:unusedlicenses",
7133
- "org:hardis:diagnose:unusedlicenses",
7134
- "org:diagnose:hardis:unusedlicenses",
7135
- "org:diagnose:unusedlicenses:hardis",
7136
- "hardis:diagnose:org:unusedlicenses",
7137
- "diagnose:hardis:org:unusedlicenses",
7138
- "diagnose:org:hardis:unusedlicenses",
7139
- "diagnose:org:unusedlicenses:hardis",
7140
- "hardis:diagnose:unusedlicenses:org",
7141
- "diagnose:hardis:unusedlicenses:org",
7142
- "diagnose:unusedlicenses:hardis:org",
7143
- "diagnose:unusedlicenses:org:hardis",
7144
- "hardis:org:unusedlicenses:diagnose",
7145
- "org:hardis:unusedlicenses:diagnose",
7146
- "org:unusedlicenses:hardis:diagnose",
7147
- "org:unusedlicenses:diagnose:hardis",
7148
- "hardis:unusedlicenses:org:diagnose",
7149
- "unusedlicenses:hardis:org:diagnose",
7150
- "unusedlicenses:org:hardis:diagnose",
7151
- "unusedlicenses:org:diagnose:hardis",
7152
- "hardis:unusedlicenses:diagnose:org",
7153
- "unusedlicenses:hardis:diagnose:org",
7154
- "unusedlicenses:diagnose:hardis:org",
7155
- "unusedlicenses:diagnose:org:hardis"
7164
+ "hardis:org:files:export",
7165
+ "org:hardis:files:export",
7166
+ "org:files:hardis:export",
7167
+ "org:files:export:hardis",
7168
+ "hardis:files:org:export",
7169
+ "files:hardis:org:export",
7170
+ "files:org:hardis:export",
7171
+ "files:org:export:hardis",
7172
+ "hardis:files:export:org",
7173
+ "files:hardis:export:org",
7174
+ "files:export:hardis:org",
7175
+ "files:export:org:hardis",
7176
+ "hardis:org:export:files",
7177
+ "org:hardis:export:files",
7178
+ "org:export:hardis:files",
7179
+ "org:export:files:hardis",
7180
+ "hardis:export:org:files",
7181
+ "export:hardis:org:files",
7182
+ "export:org:hardis:files",
7183
+ "export:org:files:hardis",
7184
+ "hardis:export:files:org",
7185
+ "export:hardis:files:org",
7186
+ "export:files:hardis:org",
7187
+ "export:files:org:hardis"
7156
7188
  ]
7157
7189
  },
7158
- "hardis:org:diagnose:unusedusers": {
7190
+ "hardis:org:files:import": {
7159
7191
  "aliases": [],
7160
7192
  "args": {},
7161
- "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>",
7193
+ "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
7162
7194
  "examples": [
7163
- "$ sf hardis:org:diagnose:unusedusers",
7164
- "$ sf hardis:org:diagnose:unusedusers --days 365",
7165
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7166
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7167
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7195
+ "$ sf hardis:org:files:import"
7168
7196
  ],
7169
7197
  "flags": {
7170
7198
  "json": {
@@ -7182,46 +7210,18 @@
7182
7210
  "multiple": false,
7183
7211
  "type": "option"
7184
7212
  },
7185
- "outputfile": {
7186
- "char": "f",
7187
- "description": "Force the path and name of output report file. Must end with .csv",
7188
- "name": "outputfile",
7189
- "hasDynamicHelp": false,
7190
- "multiple": false,
7191
- "type": "option"
7192
- },
7193
- "days": {
7194
- "char": "t",
7195
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7196
- "name": "days",
7197
- "hasDynamicHelp": false,
7198
- "multiple": false,
7199
- "type": "option"
7200
- },
7201
- "licensetypes": {
7202
- "char": "l",
7203
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7204
- "name": "licensetypes",
7205
- "hasDynamicHelp": false,
7206
- "multiple": false,
7207
- "options": [
7208
- "all",
7209
- "all-crm",
7210
- "all-paying"
7211
- ],
7212
- "type": "option"
7213
- },
7214
- "licenseidentifiers": {
7215
- "char": "i",
7216
- "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",
7217
- "name": "licenseidentifiers",
7213
+ "path": {
7214
+ "char": "p",
7215
+ "description": "Path to the file export project",
7216
+ "name": "path",
7218
7217
  "hasDynamicHelp": false,
7219
7218
  "multiple": false,
7220
7219
  "type": "option"
7221
7220
  },
7222
- "returnactiveusers": {
7223
- "description": "Inverts the command by returning the active users",
7224
- "name": "returnactiveusers",
7221
+ "overwrite": {
7222
+ "char": "f",
7223
+ "description": "Override existing files (doubles the number of API calls)",
7224
+ "name": "overwrite",
7225
7225
  "allowNo": false,
7226
7226
  "type": "boolean"
7227
7227
  },
@@ -7263,13 +7263,13 @@
7263
7263
  },
7264
7264
  "hasDynamicHelp": true,
7265
7265
  "hiddenAliases": [],
7266
- "id": "hardis:org:diagnose:unusedusers",
7266
+ "id": "hardis:org:files:import",
7267
7267
  "pluginAlias": "sfdx-hardis",
7268
7268
  "pluginName": "sfdx-hardis",
7269
7269
  "pluginType": "core",
7270
7270
  "strict": true,
7271
7271
  "enableJsonFlag": true,
7272
- "title": "Detect unused Users in Salesforce",
7272
+ "title": "Import files",
7273
7273
  "requiresProject": false,
7274
7274
  "isESM": true,
7275
7275
  "relativePath": [
@@ -7277,35 +7277,35 @@
7277
7277
  "commands",
7278
7278
  "hardis",
7279
7279
  "org",
7280
- "diagnose",
7281
- "unusedusers.js"
7280
+ "files",
7281
+ "import.js"
7282
7282
  ],
7283
7283
  "aliasPermutations": [],
7284
7284
  "permutations": [
7285
- "hardis:org:diagnose:unusedusers",
7286
- "org:hardis:diagnose:unusedusers",
7287
- "org:diagnose:hardis:unusedusers",
7288
- "org:diagnose:unusedusers:hardis",
7289
- "hardis:diagnose:org:unusedusers",
7290
- "diagnose:hardis:org:unusedusers",
7291
- "diagnose:org:hardis:unusedusers",
7292
- "diagnose:org:unusedusers:hardis",
7293
- "hardis:diagnose:unusedusers:org",
7294
- "diagnose:hardis:unusedusers:org",
7295
- "diagnose:unusedusers:hardis:org",
7296
- "diagnose:unusedusers:org:hardis",
7297
- "hardis:org:unusedusers:diagnose",
7298
- "org:hardis:unusedusers:diagnose",
7299
- "org:unusedusers:hardis:diagnose",
7300
- "org:unusedusers:diagnose:hardis",
7301
- "hardis:unusedusers:org:diagnose",
7302
- "unusedusers:hardis:org:diagnose",
7303
- "unusedusers:org:hardis:diagnose",
7304
- "unusedusers:org:diagnose:hardis",
7305
- "hardis:unusedusers:diagnose:org",
7306
- "unusedusers:hardis:diagnose:org",
7307
- "unusedusers:diagnose:hardis:org",
7308
- "unusedusers:diagnose:org:hardis"
7285
+ "hardis:org:files:import",
7286
+ "org:hardis:files:import",
7287
+ "org:files:hardis:import",
7288
+ "org:files:import:hardis",
7289
+ "hardis:files:org:import",
7290
+ "files:hardis:org:import",
7291
+ "files:org:hardis:import",
7292
+ "files:org:import:hardis",
7293
+ "hardis:files:import:org",
7294
+ "files:hardis:import:org",
7295
+ "files:import:hardis:org",
7296
+ "files:import:org:hardis",
7297
+ "hardis:org:import:files",
7298
+ "org:hardis:import:files",
7299
+ "org:import:hardis:files",
7300
+ "org:import:files:hardis",
7301
+ "hardis:import:org:files",
7302
+ "import:hardis:org:files",
7303
+ "import:org:hardis:files",
7304
+ "import:org:files:hardis",
7305
+ "hardis:import:files:org",
7306
+ "import:hardis:files:org",
7307
+ "import:files:hardis:org",
7308
+ "import:files:org:hardis"
7309
7309
  ]
7310
7310
  },
7311
7311
  "hardis:org:monitor:all": {
@@ -9690,6 +9690,238 @@
9690
9690
  "remotesites:audit:project:hardis"
9691
9691
  ]
9692
9692
  },
9693
+ "hardis:project:configure:auth": {
9694
+ "aliases": [],
9695
+ "args": {},
9696
+ "description": "\n## Command Behavior\n\n**Configures authentication between a Git branch and a target Salesforce org for CI/CD deployments.**\n\nThis command facilitates the setup of automated CI/CD pipelines, enabling seamless deployments from specific Git branches to designated Salesforce orgs. It supports both standard Salesforce orgs and Dev Hub configurations, catering to various enterprise deployment workflows.\n\nKey functionalities include:\n\n- **Org Selection/Login:** Guides the user to select an existing Salesforce org or log in to a new one.\n- **Git Branch Association:** Allows associating a specific Git branch with the chosen Salesforce org.\n- **Merge Target Definition:** Enables defining target Git branches into which the configured branch can merge, ensuring controlled deployment flows.\n- **Salesforce Username Configuration:** Prompts for the Salesforce username to be used by the CI server for deployments.\n- **SSL Certificate Generation:** Automatically generates an SSL certificate for secure authentication.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's implementation involves several key technical aspects:\n\n- **SF CLI Integration:** Utilizes \n@salesforce/sf-plugins-core\n for command structure and flag parsing.\n- **Interactive Prompts:** Employs the \nprompts\n library for interactive user input, guiding the configuration process.\n- **Git Integration:** Interacts with Git to retrieve branch information using \n`git().branch([\"--list\", \"-r\"])`\n.\n- **Configuration Management:** Leverages internal utilities (`checkConfig`, `getConfig`, `setConfig`, `setInConfigFile`) to read from and write to project-specific configuration files (e.g., `.sfdx-hardis.<branchName>.yml`).\n- **Salesforce CLI Execution:** Executes Salesforce CLI commands programmatically via `execSfdxJson` for org interactions.\n- **SSL Certificate Generation:** Calls `generateSSLCertificate` to create necessary SSL certificates for JWT-based authentication.\n- **WebSocket Communication:** Uses `WebSocketClient` for potential communication with external tools or processes, such as restarting the command in VS Code.\n- **Dependency Check:** Ensures the presence of `openssl` on the system, which is required for SSL certificate generation.\n",
9697
+ "examples": [
9698
+ "$ sf hardis:project:configure:auth"
9699
+ ],
9700
+ "flags": {
9701
+ "json": {
9702
+ "description": "Format output as json.",
9703
+ "helpGroup": "GLOBAL",
9704
+ "name": "json",
9705
+ "allowNo": false,
9706
+ "type": "boolean"
9707
+ },
9708
+ "flags-dir": {
9709
+ "helpGroup": "GLOBAL",
9710
+ "name": "flags-dir",
9711
+ "summary": "Import flag values from a directory.",
9712
+ "hasDynamicHelp": false,
9713
+ "multiple": false,
9714
+ "type": "option"
9715
+ },
9716
+ "devhub": {
9717
+ "char": "b",
9718
+ "description": "Configure project DevHub",
9719
+ "name": "devhub",
9720
+ "allowNo": false,
9721
+ "type": "boolean"
9722
+ },
9723
+ "debug": {
9724
+ "char": "d",
9725
+ "description": "Activate debug mode (more logs)",
9726
+ "name": "debug",
9727
+ "allowNo": false,
9728
+ "type": "boolean"
9729
+ },
9730
+ "websocket": {
9731
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
9732
+ "name": "websocket",
9733
+ "hasDynamicHelp": false,
9734
+ "multiple": false,
9735
+ "type": "option"
9736
+ },
9737
+ "skipauth": {
9738
+ "description": "Skip authentication check when a default username is required",
9739
+ "name": "skipauth",
9740
+ "allowNo": false,
9741
+ "type": "boolean"
9742
+ },
9743
+ "target-org": {
9744
+ "aliases": [
9745
+ "targetusername",
9746
+ "u"
9747
+ ],
9748
+ "char": "o",
9749
+ "deprecateAliases": true,
9750
+ "name": "target-org",
9751
+ "noCacheDefault": true,
9752
+ "summary": "Username or alias of the target org.",
9753
+ "hasDynamicHelp": true,
9754
+ "multiple": false,
9755
+ "type": "option"
9756
+ },
9757
+ "target-dev-hub": {
9758
+ "aliases": [
9759
+ "targetdevhubusername"
9760
+ ],
9761
+ "char": "v",
9762
+ "deprecateAliases": true,
9763
+ "name": "target-dev-hub",
9764
+ "noCacheDefault": true,
9765
+ "required": false,
9766
+ "summary": "Username or alias of the Dev Hub org.",
9767
+ "hasDynamicHelp": true,
9768
+ "multiple": false,
9769
+ "type": "option"
9770
+ }
9771
+ },
9772
+ "hasDynamicHelp": true,
9773
+ "hiddenAliases": [],
9774
+ "id": "hardis:project:configure:auth",
9775
+ "pluginAlias": "sfdx-hardis",
9776
+ "pluginName": "sfdx-hardis",
9777
+ "pluginType": "core",
9778
+ "strict": true,
9779
+ "enableJsonFlag": true,
9780
+ "title": "Configure authentication",
9781
+ "requiresProject": false,
9782
+ "requiresDependencies": [
9783
+ "openssl"
9784
+ ],
9785
+ "isESM": true,
9786
+ "relativePath": [
9787
+ "lib",
9788
+ "commands",
9789
+ "hardis",
9790
+ "project",
9791
+ "configure",
9792
+ "auth.js"
9793
+ ],
9794
+ "aliasPermutations": [],
9795
+ "permutations": [
9796
+ "hardis:project:configure:auth",
9797
+ "project:hardis:configure:auth",
9798
+ "project:configure:hardis:auth",
9799
+ "project:configure:auth:hardis",
9800
+ "hardis:configure:project:auth",
9801
+ "configure:hardis:project:auth",
9802
+ "configure:project:hardis:auth",
9803
+ "configure:project:auth:hardis",
9804
+ "hardis:configure:auth:project",
9805
+ "configure:hardis:auth:project",
9806
+ "configure:auth:hardis:project",
9807
+ "configure:auth:project:hardis",
9808
+ "hardis:project:auth:configure",
9809
+ "project:hardis:auth:configure",
9810
+ "project:auth:hardis:configure",
9811
+ "project:auth:configure:hardis",
9812
+ "hardis:auth:project:configure",
9813
+ "auth:hardis:project:configure",
9814
+ "auth:project:hardis:configure",
9815
+ "auth:project:configure:hardis",
9816
+ "hardis:auth:configure:project",
9817
+ "auth:hardis:configure:project",
9818
+ "auth:configure:hardis:project",
9819
+ "auth:configure:project:hardis"
9820
+ ]
9821
+ },
9822
+ "hardis:project:convert:profilestopermsets": {
9823
+ "aliases": [],
9824
+ "args": {},
9825
+ "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",
9826
+ "examples": [
9827
+ "$ sf hardis:project:convert:profilestopermsets"
9828
+ ],
9829
+ "flags": {
9830
+ "json": {
9831
+ "description": "Format output as json.",
9832
+ "helpGroup": "GLOBAL",
9833
+ "name": "json",
9834
+ "allowNo": false,
9835
+ "type": "boolean"
9836
+ },
9837
+ "flags-dir": {
9838
+ "helpGroup": "GLOBAL",
9839
+ "name": "flags-dir",
9840
+ "summary": "Import flag values from a directory.",
9841
+ "hasDynamicHelp": false,
9842
+ "multiple": false,
9843
+ "type": "option"
9844
+ },
9845
+ "except": {
9846
+ "char": "e",
9847
+ "description": "List of filters",
9848
+ "name": "except",
9849
+ "default": [],
9850
+ "hasDynamicHelp": false,
9851
+ "multiple": true,
9852
+ "type": "option"
9853
+ },
9854
+ "debug": {
9855
+ "char": "d",
9856
+ "description": "Activate debug mode (more logs)",
9857
+ "name": "debug",
9858
+ "allowNo": false,
9859
+ "type": "boolean"
9860
+ },
9861
+ "websocket": {
9862
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
9863
+ "name": "websocket",
9864
+ "hasDynamicHelp": false,
9865
+ "multiple": false,
9866
+ "type": "option"
9867
+ },
9868
+ "skipauth": {
9869
+ "description": "Skip authentication check when a default username is required",
9870
+ "name": "skipauth",
9871
+ "allowNo": false,
9872
+ "type": "boolean"
9873
+ }
9874
+ },
9875
+ "hasDynamicHelp": false,
9876
+ "hiddenAliases": [],
9877
+ "id": "hardis:project:convert:profilestopermsets",
9878
+ "pluginAlias": "sfdx-hardis",
9879
+ "pluginName": "sfdx-hardis",
9880
+ "pluginType": "core",
9881
+ "strict": true,
9882
+ "enableJsonFlag": true,
9883
+ "title": "Convert Profiles into Permission Sets",
9884
+ "requiresProject": true,
9885
+ "requiresSfdxPlugins": [
9886
+ "shane-sfdx-plugins"
9887
+ ],
9888
+ "isESM": true,
9889
+ "relativePath": [
9890
+ "lib",
9891
+ "commands",
9892
+ "hardis",
9893
+ "project",
9894
+ "convert",
9895
+ "profilestopermsets.js"
9896
+ ],
9897
+ "aliasPermutations": [],
9898
+ "permutations": [
9899
+ "hardis:project:convert:profilestopermsets",
9900
+ "project:hardis:convert:profilestopermsets",
9901
+ "project:convert:hardis:profilestopermsets",
9902
+ "project:convert:profilestopermsets:hardis",
9903
+ "hardis:convert:project:profilestopermsets",
9904
+ "convert:hardis:project:profilestopermsets",
9905
+ "convert:project:hardis:profilestopermsets",
9906
+ "convert:project:profilestopermsets:hardis",
9907
+ "hardis:convert:profilestopermsets:project",
9908
+ "convert:hardis:profilestopermsets:project",
9909
+ "convert:profilestopermsets:hardis:project",
9910
+ "convert:profilestopermsets:project:hardis",
9911
+ "hardis:project:profilestopermsets:convert",
9912
+ "project:hardis:profilestopermsets:convert",
9913
+ "project:profilestopermsets:hardis:convert",
9914
+ "project:profilestopermsets:convert:hardis",
9915
+ "hardis:profilestopermsets:project:convert",
9916
+ "profilestopermsets:hardis:project:convert",
9917
+ "profilestopermsets:project:hardis:convert",
9918
+ "profilestopermsets:project:convert:hardis",
9919
+ "hardis:profilestopermsets:convert:project",
9920
+ "profilestopermsets:hardis:convert:project",
9921
+ "profilestopermsets:convert:hardis:project",
9922
+ "profilestopermsets:convert:project:hardis"
9923
+ ]
9924
+ },
9693
9925
  "hardis:project:clean:emptyitems": {
9694
9926
  "aliases": [],
9695
9927
  "args": {},
@@ -11175,238 +11407,6 @@
11175
11407
  "xml:clean:project:hardis"
11176
11408
  ]
11177
11409
  },
11178
- "hardis:project:configure:auth": {
11179
- "aliases": [],
11180
- "args": {},
11181
- "description": "\n## Command Behavior\n\n**Configures authentication between a Git branch and a target Salesforce org for CI/CD deployments.**\n\nThis command facilitates the setup of automated CI/CD pipelines, enabling seamless deployments from specific Git branches to designated Salesforce orgs. It supports both standard Salesforce orgs and Dev Hub configurations, catering to various enterprise deployment workflows.\n\nKey functionalities include:\n\n- **Org Selection/Login:** Guides the user to select an existing Salesforce org or log in to a new one.\n- **Git Branch Association:** Allows associating a specific Git branch with the chosen Salesforce org.\n- **Merge Target Definition:** Enables defining target Git branches into which the configured branch can merge, ensuring controlled deployment flows.\n- **Salesforce Username Configuration:** Prompts for the Salesforce username to be used by the CI server for deployments.\n- **SSL Certificate Generation:** Automatically generates an SSL certificate for secure authentication.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's implementation involves several key technical aspects:\n\n- **SF CLI Integration:** Utilizes \n@salesforce/sf-plugins-core\n for command structure and flag parsing.\n- **Interactive Prompts:** Employs the \nprompts\n library for interactive user input, guiding the configuration process.\n- **Git Integration:** Interacts with Git to retrieve branch information using \n`git().branch([\"--list\", \"-r\"])`\n.\n- **Configuration Management:** Leverages internal utilities (`checkConfig`, `getConfig`, `setConfig`, `setInConfigFile`) to read from and write to project-specific configuration files (e.g., `.sfdx-hardis.<branchName>.yml`).\n- **Salesforce CLI Execution:** Executes Salesforce CLI commands programmatically via `execSfdxJson` for org interactions.\n- **SSL Certificate Generation:** Calls `generateSSLCertificate` to create necessary SSL certificates for JWT-based authentication.\n- **WebSocket Communication:** Uses `WebSocketClient` for potential communication with external tools or processes, such as restarting the command in VS Code.\n- **Dependency Check:** Ensures the presence of `openssl` on the system, which is required for SSL certificate generation.\n",
11182
- "examples": [
11183
- "$ sf hardis:project:configure:auth"
11184
- ],
11185
- "flags": {
11186
- "json": {
11187
- "description": "Format output as json.",
11188
- "helpGroup": "GLOBAL",
11189
- "name": "json",
11190
- "allowNo": false,
11191
- "type": "boolean"
11192
- },
11193
- "flags-dir": {
11194
- "helpGroup": "GLOBAL",
11195
- "name": "flags-dir",
11196
- "summary": "Import flag values from a directory.",
11197
- "hasDynamicHelp": false,
11198
- "multiple": false,
11199
- "type": "option"
11200
- },
11201
- "devhub": {
11202
- "char": "b",
11203
- "description": "Configure project DevHub",
11204
- "name": "devhub",
11205
- "allowNo": false,
11206
- "type": "boolean"
11207
- },
11208
- "debug": {
11209
- "char": "d",
11210
- "description": "Activate debug mode (more logs)",
11211
- "name": "debug",
11212
- "allowNo": false,
11213
- "type": "boolean"
11214
- },
11215
- "websocket": {
11216
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11217
- "name": "websocket",
11218
- "hasDynamicHelp": false,
11219
- "multiple": false,
11220
- "type": "option"
11221
- },
11222
- "skipauth": {
11223
- "description": "Skip authentication check when a default username is required",
11224
- "name": "skipauth",
11225
- "allowNo": false,
11226
- "type": "boolean"
11227
- },
11228
- "target-org": {
11229
- "aliases": [
11230
- "targetusername",
11231
- "u"
11232
- ],
11233
- "char": "o",
11234
- "deprecateAliases": true,
11235
- "name": "target-org",
11236
- "noCacheDefault": true,
11237
- "summary": "Username or alias of the target org.",
11238
- "hasDynamicHelp": true,
11239
- "multiple": false,
11240
- "type": "option"
11241
- },
11242
- "target-dev-hub": {
11243
- "aliases": [
11244
- "targetdevhubusername"
11245
- ],
11246
- "char": "v",
11247
- "deprecateAliases": true,
11248
- "name": "target-dev-hub",
11249
- "noCacheDefault": true,
11250
- "required": false,
11251
- "summary": "Username or alias of the Dev Hub org.",
11252
- "hasDynamicHelp": true,
11253
- "multiple": false,
11254
- "type": "option"
11255
- }
11256
- },
11257
- "hasDynamicHelp": true,
11258
- "hiddenAliases": [],
11259
- "id": "hardis:project:configure:auth",
11260
- "pluginAlias": "sfdx-hardis",
11261
- "pluginName": "sfdx-hardis",
11262
- "pluginType": "core",
11263
- "strict": true,
11264
- "enableJsonFlag": true,
11265
- "title": "Configure authentication",
11266
- "requiresProject": false,
11267
- "requiresDependencies": [
11268
- "openssl"
11269
- ],
11270
- "isESM": true,
11271
- "relativePath": [
11272
- "lib",
11273
- "commands",
11274
- "hardis",
11275
- "project",
11276
- "configure",
11277
- "auth.js"
11278
- ],
11279
- "aliasPermutations": [],
11280
- "permutations": [
11281
- "hardis:project:configure:auth",
11282
- "project:hardis:configure:auth",
11283
- "project:configure:hardis:auth",
11284
- "project:configure:auth:hardis",
11285
- "hardis:configure:project:auth",
11286
- "configure:hardis:project:auth",
11287
- "configure:project:hardis:auth",
11288
- "configure:project:auth:hardis",
11289
- "hardis:configure:auth:project",
11290
- "configure:hardis:auth:project",
11291
- "configure:auth:hardis:project",
11292
- "configure:auth:project:hardis",
11293
- "hardis:project:auth:configure",
11294
- "project:hardis:auth:configure",
11295
- "project:auth:hardis:configure",
11296
- "project:auth:configure:hardis",
11297
- "hardis:auth:project:configure",
11298
- "auth:hardis:project:configure",
11299
- "auth:project:hardis:configure",
11300
- "auth:project:configure:hardis",
11301
- "hardis:auth:configure:project",
11302
- "auth:hardis:configure:project",
11303
- "auth:configure:hardis:project",
11304
- "auth:configure:project:hardis"
11305
- ]
11306
- },
11307
- "hardis:project:convert:profilestopermsets": {
11308
- "aliases": [],
11309
- "args": {},
11310
- "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",
11311
- "examples": [
11312
- "$ sf hardis:project:convert:profilestopermsets"
11313
- ],
11314
- "flags": {
11315
- "json": {
11316
- "description": "Format output as json.",
11317
- "helpGroup": "GLOBAL",
11318
- "name": "json",
11319
- "allowNo": false,
11320
- "type": "boolean"
11321
- },
11322
- "flags-dir": {
11323
- "helpGroup": "GLOBAL",
11324
- "name": "flags-dir",
11325
- "summary": "Import flag values from a directory.",
11326
- "hasDynamicHelp": false,
11327
- "multiple": false,
11328
- "type": "option"
11329
- },
11330
- "except": {
11331
- "char": "e",
11332
- "description": "List of filters",
11333
- "name": "except",
11334
- "default": [],
11335
- "hasDynamicHelp": false,
11336
- "multiple": true,
11337
- "type": "option"
11338
- },
11339
- "debug": {
11340
- "char": "d",
11341
- "description": "Activate debug mode (more logs)",
11342
- "name": "debug",
11343
- "allowNo": false,
11344
- "type": "boolean"
11345
- },
11346
- "websocket": {
11347
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11348
- "name": "websocket",
11349
- "hasDynamicHelp": false,
11350
- "multiple": false,
11351
- "type": "option"
11352
- },
11353
- "skipauth": {
11354
- "description": "Skip authentication check when a default username is required",
11355
- "name": "skipauth",
11356
- "allowNo": false,
11357
- "type": "boolean"
11358
- }
11359
- },
11360
- "hasDynamicHelp": false,
11361
- "hiddenAliases": [],
11362
- "id": "hardis:project:convert:profilestopermsets",
11363
- "pluginAlias": "sfdx-hardis",
11364
- "pluginName": "sfdx-hardis",
11365
- "pluginType": "core",
11366
- "strict": true,
11367
- "enableJsonFlag": true,
11368
- "title": "Convert Profiles into Permission Sets",
11369
- "requiresProject": true,
11370
- "requiresSfdxPlugins": [
11371
- "shane-sfdx-plugins"
11372
- ],
11373
- "isESM": true,
11374
- "relativePath": [
11375
- "lib",
11376
- "commands",
11377
- "hardis",
11378
- "project",
11379
- "convert",
11380
- "profilestopermsets.js"
11381
- ],
11382
- "aliasPermutations": [],
11383
- "permutations": [
11384
- "hardis:project:convert:profilestopermsets",
11385
- "project:hardis:convert:profilestopermsets",
11386
- "project:convert:hardis:profilestopermsets",
11387
- "project:convert:profilestopermsets:hardis",
11388
- "hardis:convert:project:profilestopermsets",
11389
- "convert:hardis:project:profilestopermsets",
11390
- "convert:project:hardis:profilestopermsets",
11391
- "convert:project:profilestopermsets:hardis",
11392
- "hardis:convert:profilestopermsets:project",
11393
- "convert:hardis:profilestopermsets:project",
11394
- "convert:profilestopermsets:hardis:project",
11395
- "convert:profilestopermsets:project:hardis",
11396
- "hardis:project:profilestopermsets:convert",
11397
- "project:hardis:profilestopermsets:convert",
11398
- "project:profilestopermsets:hardis:convert",
11399
- "project:profilestopermsets:convert:hardis",
11400
- "hardis:profilestopermsets:project:convert",
11401
- "profilestopermsets:hardis:project:convert",
11402
- "profilestopermsets:project:hardis:convert",
11403
- "profilestopermsets:project:convert:hardis",
11404
- "hardis:profilestopermsets:convert:project",
11405
- "profilestopermsets:hardis:convert:project",
11406
- "profilestopermsets:convert:hardis:project",
11407
- "profilestopermsets:convert:project:hardis"
11408
- ]
11409
- },
11410
11410
  "hardis:project:deploy:notify": {
11411
11411
  "aliases": [],
11412
11412
  "args": {},
@@ -15370,5 +15370,5 @@
15370
15370
  ]
15371
15371
  }
15372
15372
  },
15373
- "version": "6.9.1-alpha202510261251.0"
15373
+ "version": "6.9.1-alpha202510261312.0"
15374
15374
  }