sfdx-hardis 6.7.1 → 6.7.2-beta202510122234.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.
@@ -4421,6 +4421,135 @@
4421
4421
  "ws:work:hardis"
4422
4422
  ]
4423
4423
  },
4424
+ "hardis:git:pull-requests:extract": {
4425
+ "aliases": [],
4426
+ "args": {},
4427
+ "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",
4428
+ "examples": [
4429
+ "$ sf hardis:git:pull-requests:extract",
4430
+ "$ sf hardis:git:pull-requests:extract --target-branch main --status merged"
4431
+ ],
4432
+ "flags": {
4433
+ "json": {
4434
+ "description": "Format output as json.",
4435
+ "helpGroup": "GLOBAL",
4436
+ "name": "json",
4437
+ "allowNo": false,
4438
+ "type": "boolean"
4439
+ },
4440
+ "flags-dir": {
4441
+ "helpGroup": "GLOBAL",
4442
+ "name": "flags-dir",
4443
+ "summary": "Import flag values from a directory.",
4444
+ "hasDynamicHelp": false,
4445
+ "multiple": false,
4446
+ "type": "option"
4447
+ },
4448
+ "target-branch": {
4449
+ "char": "t",
4450
+ "description": "Target branch of PRs",
4451
+ "name": "target-branch",
4452
+ "hasDynamicHelp": false,
4453
+ "multiple": false,
4454
+ "type": "option"
4455
+ },
4456
+ "status": {
4457
+ "char": "x",
4458
+ "description": "Status of the PR",
4459
+ "name": "status",
4460
+ "hasDynamicHelp": false,
4461
+ "multiple": false,
4462
+ "options": [
4463
+ "open",
4464
+ "merged",
4465
+ "abandoned"
4466
+ ],
4467
+ "type": "option"
4468
+ },
4469
+ "min-date": {
4470
+ "char": "m",
4471
+ "description": "Minimum date for PR",
4472
+ "name": "min-date",
4473
+ "hasDynamicHelp": false,
4474
+ "multiple": false,
4475
+ "type": "option"
4476
+ },
4477
+ "outputfile": {
4478
+ "char": "f",
4479
+ "description": "Force the path and name of output report file. Must end with .csv",
4480
+ "name": "outputfile",
4481
+ "hasDynamicHelp": false,
4482
+ "multiple": false,
4483
+ "type": "option"
4484
+ },
4485
+ "debug": {
4486
+ "char": "d",
4487
+ "description": "Activate debug mode (more logs)",
4488
+ "name": "debug",
4489
+ "allowNo": false,
4490
+ "type": "boolean"
4491
+ },
4492
+ "websocket": {
4493
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4494
+ "name": "websocket",
4495
+ "hasDynamicHelp": false,
4496
+ "multiple": false,
4497
+ "type": "option"
4498
+ },
4499
+ "skipauth": {
4500
+ "description": "Skip authentication check when a default username is required",
4501
+ "name": "skipauth",
4502
+ "allowNo": false,
4503
+ "type": "boolean"
4504
+ }
4505
+ },
4506
+ "hasDynamicHelp": false,
4507
+ "hiddenAliases": [],
4508
+ "id": "hardis:git:pull-requests:extract",
4509
+ "pluginAlias": "sfdx-hardis",
4510
+ "pluginName": "sfdx-hardis",
4511
+ "pluginType": "core",
4512
+ "strict": true,
4513
+ "enableJsonFlag": true,
4514
+ "title": "Extract pull requests",
4515
+ "requiresProject": true,
4516
+ "isESM": true,
4517
+ "relativePath": [
4518
+ "lib",
4519
+ "commands",
4520
+ "hardis",
4521
+ "git",
4522
+ "pull-requests",
4523
+ "extract.js"
4524
+ ],
4525
+ "aliasPermutations": [],
4526
+ "permutations": [
4527
+ "hardis:git:pull-requests:extract",
4528
+ "git:hardis:pull-requests:extract",
4529
+ "git:pull-requests:hardis:extract",
4530
+ "git:pull-requests:extract:hardis",
4531
+ "hardis:pull-requests:git:extract",
4532
+ "pull-requests:hardis:git:extract",
4533
+ "pull-requests:git:hardis:extract",
4534
+ "pull-requests:git:extract:hardis",
4535
+ "hardis:pull-requests:extract:git",
4536
+ "pull-requests:hardis:extract:git",
4537
+ "pull-requests:extract:hardis:git",
4538
+ "pull-requests:extract:git:hardis",
4539
+ "hardis:git:extract:pull-requests",
4540
+ "git:hardis:extract:pull-requests",
4541
+ "git:extract:hardis:pull-requests",
4542
+ "git:extract:pull-requests:hardis",
4543
+ "hardis:extract:git:pull-requests",
4544
+ "extract:hardis:git:pull-requests",
4545
+ "extract:git:hardis:pull-requests",
4546
+ "extract:git:pull-requests:hardis",
4547
+ "hardis:extract:pull-requests:git",
4548
+ "extract:hardis:pull-requests:git",
4549
+ "extract:pull-requests:hardis:git",
4550
+ "extract:pull-requests:git:hardis"
4551
+ ]
4552
+ },
4424
4553
  "hardis:doc:extract:permsetgroups": {
4425
4554
  "aliases": [],
4426
4555
  "args": {},
@@ -4611,13 +4740,13 @@
4611
4740
  "generate:plugin:doc:hardis"
4612
4741
  ]
4613
4742
  },
4614
- "hardis:git:pull-requests:extract": {
4743
+ "hardis:org:community:update": {
4615
4744
  "aliases": [],
4616
4745
  "args": {},
4617
- "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",
4746
+ "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
4747
  "examples": [
4619
- "$ sf hardis:git:pull-requests:extract",
4620
- "$ sf hardis:git:pull-requests:extract --target-branch main --status merged"
4748
+ "$ sf hardis:org:community:update --name 'MyNetworkName' --status DownForMaintenance",
4749
+ "$ sf hardis:org:community:update --name 'MyNetworkName,MySecondNetworkName' --status Live"
4621
4750
  ],
4622
4751
  "flags": {
4623
4752
  "json": {
@@ -4635,39 +4764,112 @@
4635
4764
  "multiple": false,
4636
4765
  "type": "option"
4637
4766
  },
4638
- "target-branch": {
4639
- "char": "t",
4640
- "description": "Target branch of PRs",
4641
- "name": "target-branch",
4767
+ "name": {
4768
+ "char": "n",
4769
+ "description": "List of Networks Names that you want to update, separated by comma",
4770
+ "name": "name",
4771
+ "required": true,
4642
4772
  "hasDynamicHelp": false,
4643
4773
  "multiple": false,
4644
4774
  "type": "option"
4645
4775
  },
4646
4776
  "status": {
4647
- "char": "x",
4648
- "description": "Status of the PR",
4777
+ "char": "s",
4778
+ "description": "New status for the community, available values are: Live, DownForMaintenance",
4649
4779
  "name": "status",
4780
+ "required": true,
4650
4781
  "hasDynamicHelp": false,
4651
4782
  "multiple": false,
4652
- "options": [
4653
- "open",
4654
- "merged",
4655
- "abandoned"
4656
- ],
4657
4783
  "type": "option"
4658
4784
  },
4659
- "min-date": {
4660
- "char": "m",
4661
- "description": "Minimum date for PR",
4662
- "name": "min-date",
4663
- "hasDynamicHelp": false,
4785
+ "debug": {
4786
+ "char": "d",
4787
+ "description": "Activate debug mode (more logs)",
4788
+ "name": "debug",
4789
+ "allowNo": false,
4790
+ "type": "boolean"
4791
+ },
4792
+ "target-org": {
4793
+ "aliases": [
4794
+ "targetusername",
4795
+ "u"
4796
+ ],
4797
+ "char": "o",
4798
+ "deprecateAliases": true,
4799
+ "name": "target-org",
4800
+ "noCacheDefault": true,
4801
+ "required": true,
4802
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
4803
+ "hasDynamicHelp": true,
4664
4804
  "multiple": false,
4665
4805
  "type": "option"
4806
+ }
4807
+ },
4808
+ "hasDynamicHelp": true,
4809
+ "hiddenAliases": [],
4810
+ "id": "hardis:org:community:update",
4811
+ "pluginAlias": "sfdx-hardis",
4812
+ "pluginName": "sfdx-hardis",
4813
+ "pluginType": "core",
4814
+ "strict": true,
4815
+ "summary": "Update a community status.",
4816
+ "enableJsonFlag": true,
4817
+ "isESM": true,
4818
+ "relativePath": [
4819
+ "lib",
4820
+ "commands",
4821
+ "hardis",
4822
+ "org",
4823
+ "community",
4824
+ "update.js"
4825
+ ],
4826
+ "aliasPermutations": [],
4827
+ "permutations": [
4828
+ "hardis:org:community:update",
4829
+ "org:hardis:community:update",
4830
+ "org:community:hardis:update",
4831
+ "org:community:update:hardis",
4832
+ "hardis:community:org:update",
4833
+ "community:hardis:org:update",
4834
+ "community:org:hardis:update",
4835
+ "community:org:update:hardis",
4836
+ "hardis:community:update:org",
4837
+ "community:hardis:update:org",
4838
+ "community:update:hardis:org",
4839
+ "community:update:org:hardis",
4840
+ "hardis:org:update:community",
4841
+ "org:hardis:update:community",
4842
+ "org:update:hardis:community",
4843
+ "org:update:community:hardis",
4844
+ "hardis:update:org:community",
4845
+ "update:hardis:org:community",
4846
+ "update:org:hardis:community",
4847
+ "update:org:community:hardis",
4848
+ "hardis:update:community:org",
4849
+ "update:hardis:community:org",
4850
+ "update:community:hardis:org",
4851
+ "update:community:org:hardis"
4852
+ ]
4853
+ },
4854
+ "hardis:org:configure:data": {
4855
+ "aliases": [],
4856
+ "args": {},
4857
+ "description": "\n## Command Behavior\n\n**Configures a Salesforce Data Migration Utility (SFDMU) project for data export and import operations.**\n\nThis command assists in setting up SFDMU workspaces, which are essential for managing data within your Salesforce environments. It streamlines the creation of `export.json` files and related configurations, enabling efficient data seeding, migration, and synchronization.\n\nKey functionalities:\n\n- **Template-Based Configuration:** Allows you to choose from predefined SFDMU templates or start with a blank configuration. Templates can pre-populate `export.json` with common data migration scenarios.\n- **Interactive Setup:** Guides you through the process of defining the SFDMU project folder name, label, and description.\n- **`export.json` Generation:** Creates the `export.json` file, which is the core configuration file for SFDMU, defining objects to export/import, queries, and operations.\n- **Additional File Generation:** Can generate additional configuration files, such as a `badwords.json` file for data filtering scenarios.\n- **Scratch Org Integration:** Offers to automatically configure the SFDMU project to be used for data import when initializing a new scratch org, ensuring consistent test data across development environments.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SFDMU Integration:** It acts as a setup wizard for SFDMU, generating the necessary configuration files that the `sfdmu` plugin consumes.\n- **Interactive Prompts:** Uses the `prompts` library to gather user input for various configuration parameters, such as the data path, label, and description.\n- **File System Operations:** Employs `fs-extra` to create directories (e.g., `data/your-project-name/`) and write the `export.json` and any additional configuration files.\n- **JSON Manipulation:** Constructs the `export.json` content dynamically based on user input and selected templates, including defining objects, queries, and operations.\n- **PascalCase Conversion:** Uses `pascalcase` to format the SFDMU folder name consistently.\n- **Configuration Persistence:** Updates the project's `sfdx-hardis.yml` file (via `setConfig`) to include the newly configured data package if it's intended for scratch org initialization.\n- **WebSocket Communication:** Uses `WebSocketClient.requestOpenFile` to open the generated `export.json` file in VS Code, facilitating immediate configuration.\n- **Required Plugin Check:** Explicitly lists `sfdmu` as a required plugin, ensuring the necessary dependency is present.\n</details>\n",
4858
+ "examples": [
4859
+ "$ sf hardis:org:configure:data"
4860
+ ],
4861
+ "flags": {
4862
+ "json": {
4863
+ "description": "Format output as json.",
4864
+ "helpGroup": "GLOBAL",
4865
+ "name": "json",
4866
+ "allowNo": false,
4867
+ "type": "boolean"
4666
4868
  },
4667
- "outputfile": {
4668
- "char": "f",
4669
- "description": "Force the path and name of output report file. Must end with .csv",
4670
- "name": "outputfile",
4869
+ "flags-dir": {
4870
+ "helpGroup": "GLOBAL",
4871
+ "name": "flags-dir",
4872
+ "summary": "Import flag values from a directory.",
4671
4873
  "hasDynamicHelp": false,
4672
4874
  "multiple": false,
4673
4875
  "type": "option"
@@ -4695,209 +4897,7 @@
4695
4897
  },
4696
4898
  "hasDynamicHelp": false,
4697
4899
  "hiddenAliases": [],
4698
- "id": "hardis:git:pull-requests:extract",
4699
- "pluginAlias": "sfdx-hardis",
4700
- "pluginName": "sfdx-hardis",
4701
- "pluginType": "core",
4702
- "strict": true,
4703
- "enableJsonFlag": true,
4704
- "title": "Extract pull requests",
4705
- "requiresProject": true,
4706
- "isESM": true,
4707
- "relativePath": [
4708
- "lib",
4709
- "commands",
4710
- "hardis",
4711
- "git",
4712
- "pull-requests",
4713
- "extract.js"
4714
- ],
4715
- "aliasPermutations": [],
4716
- "permutations": [
4717
- "hardis:git:pull-requests:extract",
4718
- "git:hardis:pull-requests:extract",
4719
- "git:pull-requests:hardis:extract",
4720
- "git:pull-requests:extract:hardis",
4721
- "hardis:pull-requests:git:extract",
4722
- "pull-requests:hardis:git:extract",
4723
- "pull-requests:git:hardis:extract",
4724
- "pull-requests:git:extract:hardis",
4725
- "hardis:pull-requests:extract:git",
4726
- "pull-requests:hardis:extract:git",
4727
- "pull-requests:extract:hardis:git",
4728
- "pull-requests:extract:git:hardis",
4729
- "hardis:git:extract:pull-requests",
4730
- "git:hardis:extract:pull-requests",
4731
- "git:extract:hardis:pull-requests",
4732
- "git:extract:pull-requests:hardis",
4733
- "hardis:extract:git:pull-requests",
4734
- "extract:hardis:git:pull-requests",
4735
- "extract:git:hardis:pull-requests",
4736
- "extract:git:pull-requests:hardis",
4737
- "hardis:extract:pull-requests:git",
4738
- "extract:hardis:pull-requests:git",
4739
- "extract:pull-requests:hardis:git",
4740
- "extract:pull-requests:git:hardis"
4741
- ]
4742
- },
4743
- "hardis:org:community:update": {
4744
- "aliases": [],
4745
- "args": {},
4746
- "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",
4747
- "examples": [
4748
- "$ sf hardis:org:community:update --name 'MyNetworkName' --status DownForMaintenance",
4749
- "$ sf hardis:org:community:update --name 'MyNetworkName,MySecondNetworkName' --status Live"
4750
- ],
4751
- "flags": {
4752
- "json": {
4753
- "description": "Format output as json.",
4754
- "helpGroup": "GLOBAL",
4755
- "name": "json",
4756
- "allowNo": false,
4757
- "type": "boolean"
4758
- },
4759
- "flags-dir": {
4760
- "helpGroup": "GLOBAL",
4761
- "name": "flags-dir",
4762
- "summary": "Import flag values from a directory.",
4763
- "hasDynamicHelp": false,
4764
- "multiple": false,
4765
- "type": "option"
4766
- },
4767
- "name": {
4768
- "char": "n",
4769
- "description": "List of Networks Names that you want to update, separated by comma",
4770
- "name": "name",
4771
- "required": true,
4772
- "hasDynamicHelp": false,
4773
- "multiple": false,
4774
- "type": "option"
4775
- },
4776
- "status": {
4777
- "char": "s",
4778
- "description": "New status for the community, available values are: Live, DownForMaintenance",
4779
- "name": "status",
4780
- "required": true,
4781
- "hasDynamicHelp": false,
4782
- "multiple": false,
4783
- "type": "option"
4784
- },
4785
- "debug": {
4786
- "char": "d",
4787
- "description": "Activate debug mode (more logs)",
4788
- "name": "debug",
4789
- "allowNo": false,
4790
- "type": "boolean"
4791
- },
4792
- "target-org": {
4793
- "aliases": [
4794
- "targetusername",
4795
- "u"
4796
- ],
4797
- "char": "o",
4798
- "deprecateAliases": true,
4799
- "name": "target-org",
4800
- "noCacheDefault": true,
4801
- "required": true,
4802
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
4803
- "hasDynamicHelp": true,
4804
- "multiple": false,
4805
- "type": "option"
4806
- }
4807
- },
4808
- "hasDynamicHelp": true,
4809
- "hiddenAliases": [],
4810
- "id": "hardis:org:community:update",
4811
- "pluginAlias": "sfdx-hardis",
4812
- "pluginName": "sfdx-hardis",
4813
- "pluginType": "core",
4814
- "strict": true,
4815
- "summary": "Update a community status.",
4816
- "enableJsonFlag": true,
4817
- "isESM": true,
4818
- "relativePath": [
4819
- "lib",
4820
- "commands",
4821
- "hardis",
4822
- "org",
4823
- "community",
4824
- "update.js"
4825
- ],
4826
- "aliasPermutations": [],
4827
- "permutations": [
4828
- "hardis:org:community:update",
4829
- "org:hardis:community:update",
4830
- "org:community:hardis:update",
4831
- "org:community:update:hardis",
4832
- "hardis:community:org:update",
4833
- "community:hardis:org:update",
4834
- "community:org:hardis:update",
4835
- "community:org:update:hardis",
4836
- "hardis:community:update:org",
4837
- "community:hardis:update:org",
4838
- "community:update:hardis:org",
4839
- "community:update:org:hardis",
4840
- "hardis:org:update:community",
4841
- "org:hardis:update:community",
4842
- "org:update:hardis:community",
4843
- "org:update:community:hardis",
4844
- "hardis:update:org:community",
4845
- "update:hardis:org:community",
4846
- "update:org:hardis:community",
4847
- "update:org:community:hardis",
4848
- "hardis:update:community:org",
4849
- "update:hardis:community:org",
4850
- "update:community:hardis:org",
4851
- "update:community:org:hardis"
4852
- ]
4853
- },
4854
- "hardis:org:configure:data": {
4855
- "aliases": [],
4856
- "args": {},
4857
- "description": "\n## Command Behavior\n\n**Configures a Salesforce Data Migration Utility (SFDMU) project for data export and import operations.**\n\nThis command assists in setting up SFDMU workspaces, which are essential for managing data within your Salesforce environments. It streamlines the creation of `export.json` files and related configurations, enabling efficient data seeding, migration, and synchronization.\n\nKey functionalities:\n\n- **Template-Based Configuration:** Allows you to choose from predefined SFDMU templates or start with a blank configuration. Templates can pre-populate `export.json` with common data migration scenarios.\n- **Interactive Setup:** Guides you through the process of defining the SFDMU project folder name, label, and description.\n- **`export.json` Generation:** Creates the `export.json` file, which is the core configuration file for SFDMU, defining objects to export/import, queries, and operations.\n- **Additional File Generation:** Can generate additional configuration files, such as a `badwords.json` file for data filtering scenarios.\n- **Scratch Org Integration:** Offers to automatically configure the SFDMU project to be used for data import when initializing a new scratch org, ensuring consistent test data across development environments.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SFDMU Integration:** It acts as a setup wizard for SFDMU, generating the necessary configuration files that the `sfdmu` plugin consumes.\n- **Interactive Prompts:** Uses the `prompts` library to gather user input for various configuration parameters, such as the data path, label, and description.\n- **File System Operations:** Employs `fs-extra` to create directories (e.g., `data/your-project-name/`) and write the `export.json` and any additional configuration files.\n- **JSON Manipulation:** Constructs the `export.json` content dynamically based on user input and selected templates, including defining objects, queries, and operations.\n- **PascalCase Conversion:** Uses `pascalcase` to format the SFDMU folder name consistently.\n- **Configuration Persistence:** Updates the project's `sfdx-hardis.yml` file (via `setConfig`) to include the newly configured data package if it's intended for scratch org initialization.\n- **WebSocket Communication:** Uses `WebSocketClient.requestOpenFile` to open the generated `export.json` file in VS Code, facilitating immediate configuration.\n- **Required Plugin Check:** Explicitly lists `sfdmu` as a required plugin, ensuring the necessary dependency is present.\n</details>\n",
4858
- "examples": [
4859
- "$ sf hardis:org:configure:data"
4860
- ],
4861
- "flags": {
4862
- "json": {
4863
- "description": "Format output as json.",
4864
- "helpGroup": "GLOBAL",
4865
- "name": "json",
4866
- "allowNo": false,
4867
- "type": "boolean"
4868
- },
4869
- "flags-dir": {
4870
- "helpGroup": "GLOBAL",
4871
- "name": "flags-dir",
4872
- "summary": "Import flag values from a directory.",
4873
- "hasDynamicHelp": false,
4874
- "multiple": false,
4875
- "type": "option"
4876
- },
4877
- "debug": {
4878
- "char": "d",
4879
- "description": "Activate debug mode (more logs)",
4880
- "name": "debug",
4881
- "allowNo": false,
4882
- "type": "boolean"
4883
- },
4884
- "websocket": {
4885
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4886
- "name": "websocket",
4887
- "hasDynamicHelp": false,
4888
- "multiple": false,
4889
- "type": "option"
4890
- },
4891
- "skipauth": {
4892
- "description": "Skip authentication check when a default username is required",
4893
- "name": "skipauth",
4894
- "allowNo": false,
4895
- "type": "boolean"
4896
- }
4897
- },
4898
- "hasDynamicHelp": false,
4899
- "hiddenAliases": [],
4900
- "id": "hardis:org:configure:data",
4900
+ "id": "hardis:org:configure:data",
4901
4901
  "pluginAlias": "sfdx-hardis",
4902
4902
  "pluginName": "sfdx-hardis",
4903
4903
  "pluginType": "core",
@@ -5538,15 +5538,12 @@
5538
5538
  "import:data:org:hardis"
5539
5539
  ]
5540
5540
  },
5541
- "hardis:org:diagnose:audittrail": {
5541
+ "hardis:org:files:export": {
5542
5542
  "aliases": [],
5543
5543
  "args": {},
5544
- "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",
5544
+ "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
5545
5545
  "examples": [
5546
- "$ sf hardis:org:diagnose:audittrail",
5547
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5548
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5549
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5546
+ "$ sf hardis:org:files:export"
5550
5547
  ],
5551
5548
  "flags": {
5552
5549
  "json": {
@@ -5564,30 +5561,48 @@
5564
5561
  "multiple": false,
5565
5562
  "type": "option"
5566
5563
  },
5567
- "excludeusers": {
5568
- "char": "e",
5569
- "description": "Comma-separated list of usernames to exclude",
5570
- "name": "excludeusers",
5564
+ "path": {
5565
+ "char": "p",
5566
+ "description": "Path to the file export project",
5567
+ "name": "path",
5571
5568
  "hasDynamicHelp": false,
5572
5569
  "multiple": false,
5573
5570
  "type": "option"
5574
5571
  },
5575
- "lastndays": {
5572
+ "chunksize": {
5573
+ "char": "c",
5574
+ "description": "Number of records to add in a chunk before it is processed",
5575
+ "name": "chunksize",
5576
+ "default": 1000,
5577
+ "hasDynamicHelp": false,
5578
+ "multiple": false,
5579
+ "type": "option"
5580
+ },
5581
+ "polltimeout": {
5576
5582
  "char": "t",
5577
- "description": "Number of days to extract from today (included)",
5578
- "name": "lastndays",
5583
+ "description": "Timeout in MS for Bulk API calls",
5584
+ "name": "polltimeout",
5585
+ "default": 300000,
5579
5586
  "hasDynamicHelp": false,
5580
5587
  "multiple": false,
5581
5588
  "type": "option"
5582
5589
  },
5583
- "outputfile": {
5584
- "char": "f",
5585
- "description": "Force the path and name of output report file. Must end with .csv",
5586
- "name": "outputfile",
5590
+ "startchunknumber": {
5591
+ "char": "s",
5592
+ "description": "Chunk number to start from",
5593
+ "name": "startchunknumber",
5594
+ "default": 0,
5587
5595
  "hasDynamicHelp": false,
5588
5596
  "multiple": false,
5589
5597
  "type": "option"
5590
5598
  },
5599
+ "resume": {
5600
+ "char": "r",
5601
+ "description": "Resume previous export by checking existing files (default in CI)",
5602
+ "name": "resume",
5603
+ "allowNo": false,
5604
+ "type": "boolean"
5605
+ },
5591
5606
  "debug": {
5592
5607
  "char": "d",
5593
5608
  "description": "Activate debug mode (more logs)",
@@ -5626,13 +5641,13 @@
5626
5641
  },
5627
5642
  "hasDynamicHelp": true,
5628
5643
  "hiddenAliases": [],
5629
- "id": "hardis:org:diagnose:audittrail",
5644
+ "id": "hardis:org:files:export",
5630
5645
  "pluginAlias": "sfdx-hardis",
5631
5646
  "pluginName": "sfdx-hardis",
5632
5647
  "pluginType": "core",
5633
5648
  "strict": true,
5634
5649
  "enableJsonFlag": true,
5635
- "title": "Diagnose content of Setup Audit Trail",
5650
+ "title": "Export files",
5636
5651
  "requiresProject": false,
5637
5652
  "isESM": true,
5638
5653
  "relativePath": [
@@ -5640,12 +5655,266 @@
5640
5655
  "commands",
5641
5656
  "hardis",
5642
5657
  "org",
5643
- "diagnose",
5644
- "audittrail.js"
5658
+ "files",
5659
+ "export.js"
5645
5660
  ],
5646
5661
  "aliasPermutations": [],
5647
5662
  "permutations": [
5648
- "hardis:org:diagnose:audittrail",
5663
+ "hardis:org:files:export",
5664
+ "org:hardis:files:export",
5665
+ "org:files:hardis:export",
5666
+ "org:files:export:hardis",
5667
+ "hardis:files:org:export",
5668
+ "files:hardis:org:export",
5669
+ "files:org:hardis:export",
5670
+ "files:org:export:hardis",
5671
+ "hardis:files:export:org",
5672
+ "files:hardis:export:org",
5673
+ "files:export:hardis:org",
5674
+ "files:export:org:hardis",
5675
+ "hardis:org:export:files",
5676
+ "org:hardis:export:files",
5677
+ "org:export:hardis:files",
5678
+ "org:export:files:hardis",
5679
+ "hardis:export:org:files",
5680
+ "export:hardis:org:files",
5681
+ "export:org:hardis:files",
5682
+ "export:org:files:hardis",
5683
+ "hardis:export:files:org",
5684
+ "export:hardis:files:org",
5685
+ "export:files:hardis:org",
5686
+ "export:files:org:hardis"
5687
+ ]
5688
+ },
5689
+ "hardis:org:files:import": {
5690
+ "aliases": [],
5691
+ "args": {},
5692
+ "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
5693
+ "examples": [
5694
+ "$ sf hardis:org:files:import"
5695
+ ],
5696
+ "flags": {
5697
+ "json": {
5698
+ "description": "Format output as json.",
5699
+ "helpGroup": "GLOBAL",
5700
+ "name": "json",
5701
+ "allowNo": false,
5702
+ "type": "boolean"
5703
+ },
5704
+ "flags-dir": {
5705
+ "helpGroup": "GLOBAL",
5706
+ "name": "flags-dir",
5707
+ "summary": "Import flag values from a directory.",
5708
+ "hasDynamicHelp": false,
5709
+ "multiple": false,
5710
+ "type": "option"
5711
+ },
5712
+ "path": {
5713
+ "char": "p",
5714
+ "description": "Path to the file export project",
5715
+ "name": "path",
5716
+ "hasDynamicHelp": false,
5717
+ "multiple": false,
5718
+ "type": "option"
5719
+ },
5720
+ "overwrite": {
5721
+ "char": "f",
5722
+ "description": "Override existing files (doubles the number of API calls)",
5723
+ "name": "overwrite",
5724
+ "allowNo": false,
5725
+ "type": "boolean"
5726
+ },
5727
+ "debug": {
5728
+ "char": "d",
5729
+ "description": "Activate debug mode (more logs)",
5730
+ "name": "debug",
5731
+ "allowNo": false,
5732
+ "type": "boolean"
5733
+ },
5734
+ "websocket": {
5735
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
5736
+ "name": "websocket",
5737
+ "hasDynamicHelp": false,
5738
+ "multiple": false,
5739
+ "type": "option"
5740
+ },
5741
+ "skipauth": {
5742
+ "description": "Skip authentication check when a default username is required",
5743
+ "name": "skipauth",
5744
+ "allowNo": false,
5745
+ "type": "boolean"
5746
+ },
5747
+ "target-org": {
5748
+ "aliases": [
5749
+ "targetusername",
5750
+ "u"
5751
+ ],
5752
+ "char": "o",
5753
+ "deprecateAliases": true,
5754
+ "name": "target-org",
5755
+ "noCacheDefault": true,
5756
+ "required": true,
5757
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
5758
+ "hasDynamicHelp": true,
5759
+ "multiple": false,
5760
+ "type": "option"
5761
+ }
5762
+ },
5763
+ "hasDynamicHelp": true,
5764
+ "hiddenAliases": [],
5765
+ "id": "hardis:org:files:import",
5766
+ "pluginAlias": "sfdx-hardis",
5767
+ "pluginName": "sfdx-hardis",
5768
+ "pluginType": "core",
5769
+ "strict": true,
5770
+ "enableJsonFlag": true,
5771
+ "title": "Import files",
5772
+ "requiresProject": false,
5773
+ "isESM": true,
5774
+ "relativePath": [
5775
+ "lib",
5776
+ "commands",
5777
+ "hardis",
5778
+ "org",
5779
+ "files",
5780
+ "import.js"
5781
+ ],
5782
+ "aliasPermutations": [],
5783
+ "permutations": [
5784
+ "hardis:org:files:import",
5785
+ "org:hardis:files:import",
5786
+ "org:files:hardis:import",
5787
+ "org:files:import:hardis",
5788
+ "hardis:files:org:import",
5789
+ "files:hardis:org:import",
5790
+ "files:org:hardis:import",
5791
+ "files:org:import:hardis",
5792
+ "hardis:files:import:org",
5793
+ "files:hardis:import:org",
5794
+ "files:import:hardis:org",
5795
+ "files:import:org:hardis",
5796
+ "hardis:org:import:files",
5797
+ "org:hardis:import:files",
5798
+ "org:import:hardis:files",
5799
+ "org:import:files:hardis",
5800
+ "hardis:import:org:files",
5801
+ "import:hardis:org:files",
5802
+ "import:org:hardis:files",
5803
+ "import:org:files:hardis",
5804
+ "hardis:import:files:org",
5805
+ "import:hardis:files:org",
5806
+ "import:files:hardis:org",
5807
+ "import:files:org:hardis"
5808
+ ]
5809
+ },
5810
+ "hardis:org:diagnose:audittrail": {
5811
+ "aliases": [],
5812
+ "args": {},
5813
+ "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",
5814
+ "examples": [
5815
+ "$ sf hardis:org:diagnose:audittrail",
5816
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5817
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5818
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5819
+ ],
5820
+ "flags": {
5821
+ "json": {
5822
+ "description": "Format output as json.",
5823
+ "helpGroup": "GLOBAL",
5824
+ "name": "json",
5825
+ "allowNo": false,
5826
+ "type": "boolean"
5827
+ },
5828
+ "flags-dir": {
5829
+ "helpGroup": "GLOBAL",
5830
+ "name": "flags-dir",
5831
+ "summary": "Import flag values from a directory.",
5832
+ "hasDynamicHelp": false,
5833
+ "multiple": false,
5834
+ "type": "option"
5835
+ },
5836
+ "excludeusers": {
5837
+ "char": "e",
5838
+ "description": "Comma-separated list of usernames to exclude",
5839
+ "name": "excludeusers",
5840
+ "hasDynamicHelp": false,
5841
+ "multiple": false,
5842
+ "type": "option"
5843
+ },
5844
+ "lastndays": {
5845
+ "char": "t",
5846
+ "description": "Number of days to extract from today (included)",
5847
+ "name": "lastndays",
5848
+ "hasDynamicHelp": false,
5849
+ "multiple": false,
5850
+ "type": "option"
5851
+ },
5852
+ "outputfile": {
5853
+ "char": "f",
5854
+ "description": "Force the path and name of output report file. Must end with .csv",
5855
+ "name": "outputfile",
5856
+ "hasDynamicHelp": false,
5857
+ "multiple": false,
5858
+ "type": "option"
5859
+ },
5860
+ "debug": {
5861
+ "char": "d",
5862
+ "description": "Activate debug mode (more logs)",
5863
+ "name": "debug",
5864
+ "allowNo": false,
5865
+ "type": "boolean"
5866
+ },
5867
+ "websocket": {
5868
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
5869
+ "name": "websocket",
5870
+ "hasDynamicHelp": false,
5871
+ "multiple": false,
5872
+ "type": "option"
5873
+ },
5874
+ "skipauth": {
5875
+ "description": "Skip authentication check when a default username is required",
5876
+ "name": "skipauth",
5877
+ "allowNo": false,
5878
+ "type": "boolean"
5879
+ },
5880
+ "target-org": {
5881
+ "aliases": [
5882
+ "targetusername",
5883
+ "u"
5884
+ ],
5885
+ "char": "o",
5886
+ "deprecateAliases": true,
5887
+ "name": "target-org",
5888
+ "noCacheDefault": true,
5889
+ "required": true,
5890
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
5891
+ "hasDynamicHelp": true,
5892
+ "multiple": false,
5893
+ "type": "option"
5894
+ }
5895
+ },
5896
+ "hasDynamicHelp": true,
5897
+ "hiddenAliases": [],
5898
+ "id": "hardis:org:diagnose:audittrail",
5899
+ "pluginAlias": "sfdx-hardis",
5900
+ "pluginName": "sfdx-hardis",
5901
+ "pluginType": "core",
5902
+ "strict": true,
5903
+ "enableJsonFlag": true,
5904
+ "title": "Diagnose content of Setup Audit Trail",
5905
+ "requiresProject": false,
5906
+ "isESM": true,
5907
+ "relativePath": [
5908
+ "lib",
5909
+ "commands",
5910
+ "hardis",
5911
+ "org",
5912
+ "diagnose",
5913
+ "audittrail.js"
5914
+ ],
5915
+ "aliasPermutations": [],
5916
+ "permutations": [
5917
+ "hardis:org:diagnose:audittrail",
5649
5918
  "org:hardis:diagnose:audittrail",
5650
5919
  "org:diagnose:hardis:audittrail",
5651
5920
  "org:diagnose:audittrail:hardis",
@@ -6542,329 +6811,10 @@
6542
6811
  "outputfile": {
6543
6812
  "char": "f",
6544
6813
  "description": "Force the path and name of output report file. Must end with .csv",
6545
- "name": "outputfile",
6546
- "hasDynamicHelp": false,
6547
- "multiple": false,
6548
- "type": "option"
6549
- },
6550
- "debug": {
6551
- "char": "d",
6552
- "description": "Activate debug mode (more logs)",
6553
- "name": "debug",
6554
- "allowNo": false,
6555
- "type": "boolean"
6556
- },
6557
- "websocket": {
6558
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
6559
- "name": "websocket",
6560
- "hasDynamicHelp": false,
6561
- "multiple": false,
6562
- "type": "option"
6563
- },
6564
- "skipauth": {
6565
- "description": "Skip authentication check when a default username is required",
6566
- "name": "skipauth",
6567
- "allowNo": false,
6568
- "type": "boolean"
6569
- },
6570
- "target-org": {
6571
- "aliases": [
6572
- "targetusername",
6573
- "u"
6574
- ],
6575
- "char": "o",
6576
- "deprecateAliases": true,
6577
- "name": "target-org",
6578
- "noCacheDefault": true,
6579
- "required": true,
6580
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
6581
- "hasDynamicHelp": true,
6582
- "multiple": false,
6583
- "type": "option"
6584
- }
6585
- },
6586
- "hasDynamicHelp": true,
6587
- "hiddenAliases": [],
6588
- "id": "hardis:org:diagnose:unusedlicenses",
6589
- "pluginAlias": "sfdx-hardis",
6590
- "pluginName": "sfdx-hardis",
6591
- "pluginType": "core",
6592
- "strict": true,
6593
- "enableJsonFlag": true,
6594
- "title": "Detect unused Permission Set Licenses (beta)",
6595
- "requiresProject": false,
6596
- "additionalPermissionSetsToAlwaysGet": [
6597
- "Sales_User"
6598
- ],
6599
- "permSetsPermSetLicenses": [
6600
- {
6601
- "permSet": "Sales_User",
6602
- "permSetLicense": "SalesUserPsl"
6603
- }
6604
- ],
6605
- "profilesPermissionSetLicenses": [
6606
- {
6607
- "profile": "Salesforce API Only",
6608
- "permSetLicense": "SalesforceAPIIntegrationPsl"
6609
- }
6610
- ],
6611
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6612
- "IdentityConnect"
6613
- ],
6614
- "isESM": true,
6615
- "relativePath": [
6616
- "lib",
6617
- "commands",
6618
- "hardis",
6619
- "org",
6620
- "diagnose",
6621
- "unusedlicenses.js"
6622
- ],
6623
- "aliasPermutations": [],
6624
- "permutations": [
6625
- "hardis:org:diagnose:unusedlicenses",
6626
- "org:hardis:diagnose:unusedlicenses",
6627
- "org:diagnose:hardis:unusedlicenses",
6628
- "org:diagnose:unusedlicenses:hardis",
6629
- "hardis:diagnose:org:unusedlicenses",
6630
- "diagnose:hardis:org:unusedlicenses",
6631
- "diagnose:org:hardis:unusedlicenses",
6632
- "diagnose:org:unusedlicenses:hardis",
6633
- "hardis:diagnose:unusedlicenses:org",
6634
- "diagnose:hardis:unusedlicenses:org",
6635
- "diagnose:unusedlicenses:hardis:org",
6636
- "diagnose:unusedlicenses:org:hardis",
6637
- "hardis:org:unusedlicenses:diagnose",
6638
- "org:hardis:unusedlicenses:diagnose",
6639
- "org:unusedlicenses:hardis:diagnose",
6640
- "org:unusedlicenses:diagnose:hardis",
6641
- "hardis:unusedlicenses:org:diagnose",
6642
- "unusedlicenses:hardis:org:diagnose",
6643
- "unusedlicenses:org:hardis:diagnose",
6644
- "unusedlicenses:org:diagnose:hardis",
6645
- "hardis:unusedlicenses:diagnose:org",
6646
- "unusedlicenses:hardis:diagnose:org",
6647
- "unusedlicenses:diagnose:hardis:org",
6648
- "unusedlicenses:diagnose:org:hardis"
6649
- ]
6650
- },
6651
- "hardis:org:diagnose:unusedusers": {
6652
- "aliases": [],
6653
- "args": {},
6654
- "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>",
6655
- "examples": [
6656
- "$ sf hardis:org:diagnose:unusedusers",
6657
- "$ sf hardis:org:diagnose:unusedusers --days 365",
6658
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6659
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6660
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6661
- ],
6662
- "flags": {
6663
- "json": {
6664
- "description": "Format output as json.",
6665
- "helpGroup": "GLOBAL",
6666
- "name": "json",
6667
- "allowNo": false,
6668
- "type": "boolean"
6669
- },
6670
- "flags-dir": {
6671
- "helpGroup": "GLOBAL",
6672
- "name": "flags-dir",
6673
- "summary": "Import flag values from a directory.",
6674
- "hasDynamicHelp": false,
6675
- "multiple": false,
6676
- "type": "option"
6677
- },
6678
- "outputfile": {
6679
- "char": "f",
6680
- "description": "Force the path and name of output report file. Must end with .csv",
6681
- "name": "outputfile",
6682
- "hasDynamicHelp": false,
6683
- "multiple": false,
6684
- "type": "option"
6685
- },
6686
- "days": {
6687
- "char": "t",
6688
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6689
- "name": "days",
6690
- "hasDynamicHelp": false,
6691
- "multiple": false,
6692
- "type": "option"
6693
- },
6694
- "licensetypes": {
6695
- "char": "l",
6696
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6697
- "name": "licensetypes",
6698
- "hasDynamicHelp": false,
6699
- "multiple": false,
6700
- "options": [
6701
- "all",
6702
- "all-crm",
6703
- "all-paying"
6704
- ],
6705
- "type": "option"
6706
- },
6707
- "licenseidentifiers": {
6708
- "char": "i",
6709
- "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",
6710
- "name": "licenseidentifiers",
6711
- "hasDynamicHelp": false,
6712
- "multiple": false,
6713
- "type": "option"
6714
- },
6715
- "returnactiveusers": {
6716
- "description": "Inverts the command by returning the active users",
6717
- "name": "returnactiveusers",
6718
- "allowNo": false,
6719
- "type": "boolean"
6720
- },
6721
- "debug": {
6722
- "char": "d",
6723
- "description": "Activate debug mode (more logs)",
6724
- "name": "debug",
6725
- "allowNo": false,
6726
- "type": "boolean"
6727
- },
6728
- "websocket": {
6729
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
6730
- "name": "websocket",
6731
- "hasDynamicHelp": false,
6732
- "multiple": false,
6733
- "type": "option"
6734
- },
6735
- "skipauth": {
6736
- "description": "Skip authentication check when a default username is required",
6737
- "name": "skipauth",
6738
- "allowNo": false,
6739
- "type": "boolean"
6740
- },
6741
- "target-org": {
6742
- "aliases": [
6743
- "targetusername",
6744
- "u"
6745
- ],
6746
- "char": "o",
6747
- "deprecateAliases": true,
6748
- "name": "target-org",
6749
- "noCacheDefault": true,
6750
- "required": true,
6751
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
6752
- "hasDynamicHelp": true,
6753
- "multiple": false,
6754
- "type": "option"
6755
- }
6756
- },
6757
- "hasDynamicHelp": true,
6758
- "hiddenAliases": [],
6759
- "id": "hardis:org:diagnose:unusedusers",
6760
- "pluginAlias": "sfdx-hardis",
6761
- "pluginName": "sfdx-hardis",
6762
- "pluginType": "core",
6763
- "strict": true,
6764
- "enableJsonFlag": true,
6765
- "title": "Detect unused Users in Salesforce",
6766
- "requiresProject": false,
6767
- "isESM": true,
6768
- "relativePath": [
6769
- "lib",
6770
- "commands",
6771
- "hardis",
6772
- "org",
6773
- "diagnose",
6774
- "unusedusers.js"
6775
- ],
6776
- "aliasPermutations": [],
6777
- "permutations": [
6778
- "hardis:org:diagnose:unusedusers",
6779
- "org:hardis:diagnose:unusedusers",
6780
- "org:diagnose:hardis:unusedusers",
6781
- "org:diagnose:unusedusers:hardis",
6782
- "hardis:diagnose:org:unusedusers",
6783
- "diagnose:hardis:org:unusedusers",
6784
- "diagnose:org:hardis:unusedusers",
6785
- "diagnose:org:unusedusers:hardis",
6786
- "hardis:diagnose:unusedusers:org",
6787
- "diagnose:hardis:unusedusers:org",
6788
- "diagnose:unusedusers:hardis:org",
6789
- "diagnose:unusedusers:org:hardis",
6790
- "hardis:org:unusedusers:diagnose",
6791
- "org:hardis:unusedusers:diagnose",
6792
- "org:unusedusers:hardis:diagnose",
6793
- "org:unusedusers:diagnose:hardis",
6794
- "hardis:unusedusers:org:diagnose",
6795
- "unusedusers:hardis:org:diagnose",
6796
- "unusedusers:org:hardis:diagnose",
6797
- "unusedusers:org:diagnose:hardis",
6798
- "hardis:unusedusers:diagnose:org",
6799
- "unusedusers:hardis:diagnose:org",
6800
- "unusedusers:diagnose:hardis:org",
6801
- "unusedusers:diagnose:org:hardis"
6802
- ]
6803
- },
6804
- "hardis:org:files:export": {
6805
- "aliases": [],
6806
- "args": {},
6807
- "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",
6808
- "examples": [
6809
- "$ sf hardis:org:files:export"
6810
- ],
6811
- "flags": {
6812
- "json": {
6813
- "description": "Format output as json.",
6814
- "helpGroup": "GLOBAL",
6815
- "name": "json",
6816
- "allowNo": false,
6817
- "type": "boolean"
6818
- },
6819
- "flags-dir": {
6820
- "helpGroup": "GLOBAL",
6821
- "name": "flags-dir",
6822
- "summary": "Import flag values from a directory.",
6823
- "hasDynamicHelp": false,
6824
- "multiple": false,
6825
- "type": "option"
6826
- },
6827
- "path": {
6828
- "char": "p",
6829
- "description": "Path to the file export project",
6830
- "name": "path",
6831
- "hasDynamicHelp": false,
6832
- "multiple": false,
6833
- "type": "option"
6834
- },
6835
- "chunksize": {
6836
- "char": "c",
6837
- "description": "Number of records to add in a chunk before it is processed",
6838
- "name": "chunksize",
6839
- "default": 1000,
6840
- "hasDynamicHelp": false,
6841
- "multiple": false,
6842
- "type": "option"
6843
- },
6844
- "polltimeout": {
6845
- "char": "t",
6846
- "description": "Timeout in MS for Bulk API calls",
6847
- "name": "polltimeout",
6848
- "default": 300000,
6849
- "hasDynamicHelp": false,
6850
- "multiple": false,
6851
- "type": "option"
6852
- },
6853
- "startchunknumber": {
6854
- "char": "s",
6855
- "description": "Chunk number to start from",
6856
- "name": "startchunknumber",
6857
- "default": 0,
6858
- "hasDynamicHelp": false,
6859
- "multiple": false,
6860
- "type": "option"
6861
- },
6862
- "resume": {
6863
- "char": "r",
6864
- "description": "Resume previous export by checking existing files (default in CI)",
6865
- "name": "resume",
6866
- "allowNo": false,
6867
- "type": "boolean"
6814
+ "name": "outputfile",
6815
+ "hasDynamicHelp": false,
6816
+ "multiple": false,
6817
+ "type": "option"
6868
6818
  },
6869
6819
  "debug": {
6870
6820
  "char": "d",
@@ -6904,57 +6854,79 @@
6904
6854
  },
6905
6855
  "hasDynamicHelp": true,
6906
6856
  "hiddenAliases": [],
6907
- "id": "hardis:org:files:export",
6857
+ "id": "hardis:org:diagnose:unusedlicenses",
6908
6858
  "pluginAlias": "sfdx-hardis",
6909
6859
  "pluginName": "sfdx-hardis",
6910
6860
  "pluginType": "core",
6911
6861
  "strict": true,
6912
6862
  "enableJsonFlag": true,
6913
- "title": "Export files",
6863
+ "title": "Detect unused Permission Set Licenses (beta)",
6914
6864
  "requiresProject": false,
6865
+ "additionalPermissionSetsToAlwaysGet": [
6866
+ "Sales_User"
6867
+ ],
6868
+ "permSetsPermSetLicenses": [
6869
+ {
6870
+ "permSet": "Sales_User",
6871
+ "permSetLicense": "SalesUserPsl"
6872
+ }
6873
+ ],
6874
+ "profilesPermissionSetLicenses": [
6875
+ {
6876
+ "profile": "Salesforce API Only",
6877
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
6878
+ }
6879
+ ],
6880
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6881
+ "IdentityConnect"
6882
+ ],
6915
6883
  "isESM": true,
6916
6884
  "relativePath": [
6917
6885
  "lib",
6918
6886
  "commands",
6919
6887
  "hardis",
6920
6888
  "org",
6921
- "files",
6922
- "export.js"
6889
+ "diagnose",
6890
+ "unusedlicenses.js"
6923
6891
  ],
6924
6892
  "aliasPermutations": [],
6925
6893
  "permutations": [
6926
- "hardis:org:files:export",
6927
- "org:hardis:files:export",
6928
- "org:files:hardis:export",
6929
- "org:files:export:hardis",
6930
- "hardis:files:org:export",
6931
- "files:hardis:org:export",
6932
- "files:org:hardis:export",
6933
- "files:org:export:hardis",
6934
- "hardis:files:export:org",
6935
- "files:hardis:export:org",
6936
- "files:export:hardis:org",
6937
- "files:export:org:hardis",
6938
- "hardis:org:export:files",
6939
- "org:hardis:export:files",
6940
- "org:export:hardis:files",
6941
- "org:export:files:hardis",
6942
- "hardis:export:org:files",
6943
- "export:hardis:org:files",
6944
- "export:org:hardis:files",
6945
- "export:org:files:hardis",
6946
- "hardis:export:files:org",
6947
- "export:hardis:files:org",
6948
- "export:files:hardis:org",
6949
- "export:files:org:hardis"
6894
+ "hardis:org:diagnose:unusedlicenses",
6895
+ "org:hardis:diagnose:unusedlicenses",
6896
+ "org:diagnose:hardis:unusedlicenses",
6897
+ "org:diagnose:unusedlicenses:hardis",
6898
+ "hardis:diagnose:org:unusedlicenses",
6899
+ "diagnose:hardis:org:unusedlicenses",
6900
+ "diagnose:org:hardis:unusedlicenses",
6901
+ "diagnose:org:unusedlicenses:hardis",
6902
+ "hardis:diagnose:unusedlicenses:org",
6903
+ "diagnose:hardis:unusedlicenses:org",
6904
+ "diagnose:unusedlicenses:hardis:org",
6905
+ "diagnose:unusedlicenses:org:hardis",
6906
+ "hardis:org:unusedlicenses:diagnose",
6907
+ "org:hardis:unusedlicenses:diagnose",
6908
+ "org:unusedlicenses:hardis:diagnose",
6909
+ "org:unusedlicenses:diagnose:hardis",
6910
+ "hardis:unusedlicenses:org:diagnose",
6911
+ "unusedlicenses:hardis:org:diagnose",
6912
+ "unusedlicenses:org:hardis:diagnose",
6913
+ "unusedlicenses:org:diagnose:hardis",
6914
+ "hardis:unusedlicenses:diagnose:org",
6915
+ "unusedlicenses:hardis:diagnose:org",
6916
+ "unusedlicenses:diagnose:hardis:org",
6917
+ "unusedlicenses:diagnose:org:hardis"
6950
6918
  ]
6951
6919
  },
6952
- "hardis:org:files:import": {
6920
+ "hardis:org:diagnose:unusedusers": {
6953
6921
  "aliases": [],
6954
6922
  "args": {},
6955
- "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",
6923
+ "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>",
6956
6924
  "examples": [
6957
- "$ sf hardis:org:files:import"
6925
+ "$ sf hardis:org:diagnose:unusedusers",
6926
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
6927
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6928
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6929
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6958
6930
  ],
6959
6931
  "flags": {
6960
6932
  "json": {
@@ -6972,18 +6944,46 @@
6972
6944
  "multiple": false,
6973
6945
  "type": "option"
6974
6946
  },
6975
- "path": {
6976
- "char": "p",
6977
- "description": "Path to the file export project",
6978
- "name": "path",
6947
+ "outputfile": {
6948
+ "char": "f",
6949
+ "description": "Force the path and name of output report file. Must end with .csv",
6950
+ "name": "outputfile",
6979
6951
  "hasDynamicHelp": false,
6980
6952
  "multiple": false,
6981
6953
  "type": "option"
6982
6954
  },
6983
- "overwrite": {
6984
- "char": "f",
6985
- "description": "Override existing files (doubles the number of API calls)",
6986
- "name": "overwrite",
6955
+ "days": {
6956
+ "char": "t",
6957
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6958
+ "name": "days",
6959
+ "hasDynamicHelp": false,
6960
+ "multiple": false,
6961
+ "type": "option"
6962
+ },
6963
+ "licensetypes": {
6964
+ "char": "l",
6965
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6966
+ "name": "licensetypes",
6967
+ "hasDynamicHelp": false,
6968
+ "multiple": false,
6969
+ "options": [
6970
+ "all",
6971
+ "all-crm",
6972
+ "all-paying"
6973
+ ],
6974
+ "type": "option"
6975
+ },
6976
+ "licenseidentifiers": {
6977
+ "char": "i",
6978
+ "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",
6979
+ "name": "licenseidentifiers",
6980
+ "hasDynamicHelp": false,
6981
+ "multiple": false,
6982
+ "type": "option"
6983
+ },
6984
+ "returnactiveusers": {
6985
+ "description": "Inverts the command by returning the active users",
6986
+ "name": "returnactiveusers",
6987
6987
  "allowNo": false,
6988
6988
  "type": "boolean"
6989
6989
  },
@@ -7025,13 +7025,13 @@
7025
7025
  },
7026
7026
  "hasDynamicHelp": true,
7027
7027
  "hiddenAliases": [],
7028
- "id": "hardis:org:files:import",
7028
+ "id": "hardis:org:diagnose:unusedusers",
7029
7029
  "pluginAlias": "sfdx-hardis",
7030
7030
  "pluginName": "sfdx-hardis",
7031
7031
  "pluginType": "core",
7032
7032
  "strict": true,
7033
7033
  "enableJsonFlag": true,
7034
- "title": "Import files",
7034
+ "title": "Detect unused Users in Salesforce",
7035
7035
  "requiresProject": false,
7036
7036
  "isESM": true,
7037
7037
  "relativePath": [
@@ -7039,35 +7039,35 @@
7039
7039
  "commands",
7040
7040
  "hardis",
7041
7041
  "org",
7042
- "files",
7043
- "import.js"
7042
+ "diagnose",
7043
+ "unusedusers.js"
7044
7044
  ],
7045
7045
  "aliasPermutations": [],
7046
7046
  "permutations": [
7047
- "hardis:org:files:import",
7048
- "org:hardis:files:import",
7049
- "org:files:hardis:import",
7050
- "org:files:import:hardis",
7051
- "hardis:files:org:import",
7052
- "files:hardis:org:import",
7053
- "files:org:hardis:import",
7054
- "files:org:import:hardis",
7055
- "hardis:files:import:org",
7056
- "files:hardis:import:org",
7057
- "files:import:hardis:org",
7058
- "files:import:org:hardis",
7059
- "hardis:org:import:files",
7060
- "org:hardis:import:files",
7061
- "org:import:hardis:files",
7062
- "org:import:files:hardis",
7063
- "hardis:import:org:files",
7064
- "import:hardis:org:files",
7065
- "import:org:hardis:files",
7066
- "import:org:files:hardis",
7067
- "hardis:import:files:org",
7068
- "import:hardis:files:org",
7069
- "import:files:hardis:org",
7070
- "import:files:org:hardis"
7047
+ "hardis:org:diagnose:unusedusers",
7048
+ "org:hardis:diagnose:unusedusers",
7049
+ "org:diagnose:hardis:unusedusers",
7050
+ "org:diagnose:unusedusers:hardis",
7051
+ "hardis:diagnose:org:unusedusers",
7052
+ "diagnose:hardis:org:unusedusers",
7053
+ "diagnose:org:hardis:unusedusers",
7054
+ "diagnose:org:unusedusers:hardis",
7055
+ "hardis:diagnose:unusedusers:org",
7056
+ "diagnose:hardis:unusedusers:org",
7057
+ "diagnose:unusedusers:hardis:org",
7058
+ "diagnose:unusedusers:org:hardis",
7059
+ "hardis:org:unusedusers:diagnose",
7060
+ "org:hardis:unusedusers:diagnose",
7061
+ "org:unusedusers:hardis:diagnose",
7062
+ "org:unusedusers:diagnose:hardis",
7063
+ "hardis:unusedusers:org:diagnose",
7064
+ "unusedusers:hardis:org:diagnose",
7065
+ "unusedusers:org:hardis:diagnose",
7066
+ "unusedusers:org:diagnose:hardis",
7067
+ "hardis:unusedusers:diagnose:org",
7068
+ "unusedusers:hardis:diagnose:org",
7069
+ "unusedusers:diagnose:hardis:org",
7070
+ "unusedusers:diagnose:org:hardis"
7071
7071
  ]
7072
7072
  },
7073
7073
  "hardis:org:fix:listviewmine": {
@@ -9598,12 +9598,103 @@
9598
9598
  "duplicatefiles:audit:project:hardis"
9599
9599
  ]
9600
9600
  },
9601
- "hardis:project:audit:remotesites": {
9601
+ "hardis:project:audit:remotesites": {
9602
+ "aliases": [],
9603
+ "args": {},
9604
+ "description": "\n## Command Behavior\n\n**Audits Salesforce Remote Site Settings in your project, providing a comprehensive overview of external endpoints accessed by your Salesforce org.**\n\nThis command is crucial for security reviews, compliance checks, and understanding the external integrations of your Salesforce environment. It helps identify all configured remote sites, their URLs, activity status, and associated protocols.\n\nKey functionalities:\n\n- **Remote Site Discovery:** Scans your project for RemoteSiteSetting metadata files (.remoteSite-meta.xml or .remoteSite).\n- **URL Extraction:** Extracts the URL, active status, and description for each remote site.\n- **Protocol and Domain Identification:** Determines the protocol (HTTP/HTTPS) and extracts the domain from each URL, providing a clearer picture of the external systems being accessed.\n- **Reporting:** Generates a CSV report summarizing all detected remote sites, including their protocol, domain, name, URL, active status, and description.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all RemoteSiteSetting metadata files within the project.\n- **Content Analysis:** Reads the content of each XML file and uses regular expressions (/<url>(.*?)<\\/url>/gim, /<isActive>(.*?)<\\/isActive>/gim, /<description>(.*?)<\\/description>/gim) to extract relevant details.\n- **`catchMatches` Utility:** This utility function is used to apply the defined regular expressions to each file and extract all matching occurrences.\n- **URL Parsing:** Uses Node.js's `url` module to parse the extracted URLs and `psl` (Public Suffix List) to extract the domain name from the hostname.\n- **Data Structuring:** Organizes the extracted information into a structured format, including the remote site's name, file name, namespace, URL, active status, description, protocol, and domain.\n- **Reporting:** Uses `generateReports` to create a CSV report and display a table in the console, summarizing the audit findings.\n</details>\n",
9605
+ "examples": [
9606
+ "$ sf hardis:project:audit:remotesites"
9607
+ ],
9608
+ "flags": {
9609
+ "json": {
9610
+ "description": "Format output as json.",
9611
+ "helpGroup": "GLOBAL",
9612
+ "name": "json",
9613
+ "allowNo": false,
9614
+ "type": "boolean"
9615
+ },
9616
+ "flags-dir": {
9617
+ "helpGroup": "GLOBAL",
9618
+ "name": "flags-dir",
9619
+ "summary": "Import flag values from a directory.",
9620
+ "hasDynamicHelp": false,
9621
+ "multiple": false,
9622
+ "type": "option"
9623
+ },
9624
+ "debug": {
9625
+ "char": "d",
9626
+ "description": "Activate debug mode (more logs)",
9627
+ "name": "debug",
9628
+ "allowNo": false,
9629
+ "type": "boolean"
9630
+ },
9631
+ "websocket": {
9632
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
9633
+ "name": "websocket",
9634
+ "hasDynamicHelp": false,
9635
+ "multiple": false,
9636
+ "type": "option"
9637
+ },
9638
+ "skipauth": {
9639
+ "description": "Skip authentication check when a default username is required",
9640
+ "name": "skipauth",
9641
+ "allowNo": false,
9642
+ "type": "boolean"
9643
+ }
9644
+ },
9645
+ "hasDynamicHelp": false,
9646
+ "hiddenAliases": [],
9647
+ "id": "hardis:project:audit:remotesites",
9648
+ "pluginAlias": "sfdx-hardis",
9649
+ "pluginName": "sfdx-hardis",
9650
+ "pluginType": "core",
9651
+ "strict": true,
9652
+ "enableJsonFlag": true,
9653
+ "title": "Audit Remote Sites",
9654
+ "requiresProject": true,
9655
+ "isESM": true,
9656
+ "relativePath": [
9657
+ "lib",
9658
+ "commands",
9659
+ "hardis",
9660
+ "project",
9661
+ "audit",
9662
+ "remotesites.js"
9663
+ ],
9664
+ "aliasPermutations": [],
9665
+ "permutations": [
9666
+ "hardis:project:audit:remotesites",
9667
+ "project:hardis:audit:remotesites",
9668
+ "project:audit:hardis:remotesites",
9669
+ "project:audit:remotesites:hardis",
9670
+ "hardis:audit:project:remotesites",
9671
+ "audit:hardis:project:remotesites",
9672
+ "audit:project:hardis:remotesites",
9673
+ "audit:project:remotesites:hardis",
9674
+ "hardis:audit:remotesites:project",
9675
+ "audit:hardis:remotesites:project",
9676
+ "audit:remotesites:hardis:project",
9677
+ "audit:remotesites:project:hardis",
9678
+ "hardis:project:remotesites:audit",
9679
+ "project:hardis:remotesites:audit",
9680
+ "project:remotesites:hardis:audit",
9681
+ "project:remotesites:audit:hardis",
9682
+ "hardis:remotesites:project:audit",
9683
+ "remotesites:hardis:project:audit",
9684
+ "remotesites:project:hardis:audit",
9685
+ "remotesites:project:audit:hardis",
9686
+ "hardis:remotesites:audit:project",
9687
+ "remotesites:hardis:audit:project",
9688
+ "remotesites:audit:hardis:project",
9689
+ "remotesites:audit:project:hardis"
9690
+ ]
9691
+ },
9692
+ "hardis:project:configure:auth": {
9602
9693
  "aliases": [],
9603
9694
  "args": {},
9604
- "description": "\n## Command Behavior\n\n**Audits Salesforce Remote Site Settings in your project, providing a comprehensive overview of external endpoints accessed by your Salesforce org.**\n\nThis command is crucial for security reviews, compliance checks, and understanding the external integrations of your Salesforce environment. It helps identify all configured remote sites, their URLs, activity status, and associated protocols.\n\nKey functionalities:\n\n- **Remote Site Discovery:** Scans your project for RemoteSiteSetting metadata files (.remoteSite-meta.xml or .remoteSite).\n- **URL Extraction:** Extracts the URL, active status, and description for each remote site.\n- **Protocol and Domain Identification:** Determines the protocol (HTTP/HTTPS) and extracts the domain from each URL, providing a clearer picture of the external systems being accessed.\n- **Reporting:** Generates a CSV report summarizing all detected remote sites, including their protocol, domain, name, URL, active status, and description.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all RemoteSiteSetting metadata files within the project.\n- **Content Analysis:** Reads the content of each XML file and uses regular expressions (/<url>(.*?)<\\/url>/gim, /<isActive>(.*?)<\\/isActive>/gim, /<description>(.*?)<\\/description>/gim) to extract relevant details.\n- **`catchMatches` Utility:** This utility function is used to apply the defined regular expressions to each file and extract all matching occurrences.\n- **URL Parsing:** Uses Node.js's `url` module to parse the extracted URLs and `psl` (Public Suffix List) to extract the domain name from the hostname.\n- **Data Structuring:** Organizes the extracted information into a structured format, including the remote site's name, file name, namespace, URL, active status, description, protocol, and domain.\n- **Reporting:** Uses `generateReports` to create a CSV report and display a table in the console, summarizing the audit findings.\n</details>\n",
9695
+ "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",
9605
9696
  "examples": [
9606
- "$ sf hardis:project:audit:remotesites"
9697
+ "$ sf hardis:project:configure:auth"
9607
9698
  ],
9608
9699
  "flags": {
9609
9700
  "json": {
@@ -9621,6 +9712,13 @@
9621
9712
  "multiple": false,
9622
9713
  "type": "option"
9623
9714
  },
9715
+ "devhub": {
9716
+ "char": "b",
9717
+ "description": "Configure project DevHub",
9718
+ "name": "devhub",
9719
+ "allowNo": false,
9720
+ "type": "boolean"
9721
+ },
9624
9722
  "debug": {
9625
9723
  "char": "d",
9626
9724
  "description": "Activate debug mode (more logs)",
@@ -9640,53 +9738,84 @@
9640
9738
  "name": "skipauth",
9641
9739
  "allowNo": false,
9642
9740
  "type": "boolean"
9741
+ },
9742
+ "target-org": {
9743
+ "aliases": [
9744
+ "targetusername",
9745
+ "u"
9746
+ ],
9747
+ "char": "o",
9748
+ "deprecateAliases": true,
9749
+ "name": "target-org",
9750
+ "noCacheDefault": true,
9751
+ "summary": "Username or alias of the target org.",
9752
+ "hasDynamicHelp": true,
9753
+ "multiple": false,
9754
+ "type": "option"
9755
+ },
9756
+ "target-dev-hub": {
9757
+ "aliases": [
9758
+ "targetdevhubusername"
9759
+ ],
9760
+ "char": "v",
9761
+ "deprecateAliases": true,
9762
+ "name": "target-dev-hub",
9763
+ "noCacheDefault": true,
9764
+ "required": false,
9765
+ "summary": "Username or alias of the Dev Hub org.",
9766
+ "hasDynamicHelp": true,
9767
+ "multiple": false,
9768
+ "type": "option"
9643
9769
  }
9644
9770
  },
9645
- "hasDynamicHelp": false,
9771
+ "hasDynamicHelp": true,
9646
9772
  "hiddenAliases": [],
9647
- "id": "hardis:project:audit:remotesites",
9773
+ "id": "hardis:project:configure:auth",
9648
9774
  "pluginAlias": "sfdx-hardis",
9649
9775
  "pluginName": "sfdx-hardis",
9650
9776
  "pluginType": "core",
9651
9777
  "strict": true,
9652
9778
  "enableJsonFlag": true,
9653
- "title": "Audit Remote Sites",
9654
- "requiresProject": true,
9779
+ "title": "Configure authentication",
9780
+ "requiresProject": false,
9781
+ "requiresDependencies": [
9782
+ "openssl"
9783
+ ],
9655
9784
  "isESM": true,
9656
9785
  "relativePath": [
9657
9786
  "lib",
9658
9787
  "commands",
9659
9788
  "hardis",
9660
9789
  "project",
9661
- "audit",
9662
- "remotesites.js"
9790
+ "configure",
9791
+ "auth.js"
9663
9792
  ],
9664
9793
  "aliasPermutations": [],
9665
9794
  "permutations": [
9666
- "hardis:project:audit:remotesites",
9667
- "project:hardis:audit:remotesites",
9668
- "project:audit:hardis:remotesites",
9669
- "project:audit:remotesites:hardis",
9670
- "hardis:audit:project:remotesites",
9671
- "audit:hardis:project:remotesites",
9672
- "audit:project:hardis:remotesites",
9673
- "audit:project:remotesites:hardis",
9674
- "hardis:audit:remotesites:project",
9675
- "audit:hardis:remotesites:project",
9676
- "audit:remotesites:hardis:project",
9677
- "audit:remotesites:project:hardis",
9678
- "hardis:project:remotesites:audit",
9679
- "project:hardis:remotesites:audit",
9680
- "project:remotesites:hardis:audit",
9681
- "project:remotesites:audit:hardis",
9682
- "hardis:remotesites:project:audit",
9683
- "remotesites:hardis:project:audit",
9684
- "remotesites:project:hardis:audit",
9685
- "remotesites:project:audit:hardis",
9686
- "hardis:remotesites:audit:project",
9687
- "remotesites:hardis:audit:project",
9688
- "remotesites:audit:hardis:project",
9689
- "remotesites:audit:project:hardis"
9795
+ "hardis:project:configure:auth",
9796
+ "project:hardis:configure:auth",
9797
+ "project:configure:hardis:auth",
9798
+ "project:configure:auth:hardis",
9799
+ "hardis:configure:project:auth",
9800
+ "configure:hardis:project:auth",
9801
+ "configure:project:hardis:auth",
9802
+ "configure:project:auth:hardis",
9803
+ "hardis:configure:auth:project",
9804
+ "configure:hardis:auth:project",
9805
+ "configure:auth:hardis:project",
9806
+ "configure:auth:project:hardis",
9807
+ "hardis:project:auth:configure",
9808
+ "project:hardis:auth:configure",
9809
+ "project:auth:hardis:configure",
9810
+ "project:auth:configure:hardis",
9811
+ "hardis:auth:project:configure",
9812
+ "auth:hardis:project:configure",
9813
+ "auth:project:hardis:configure",
9814
+ "auth:project:configure:hardis",
9815
+ "hardis:auth:configure:project",
9816
+ "auth:hardis:configure:project",
9817
+ "auth:configure:hardis:project",
9818
+ "auth:configure:project:hardis"
9690
9819
  ]
9691
9820
  },
9692
9821
  "hardis:project:clean:emptyitems": {
@@ -11174,135 +11303,6 @@
11174
11303
  "xml:clean:project:hardis"
11175
11304
  ]
11176
11305
  },
11177
- "hardis:project:configure:auth": {
11178
- "aliases": [],
11179
- "args": {},
11180
- "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",
11181
- "examples": [
11182
- "$ sf hardis:project:configure:auth"
11183
- ],
11184
- "flags": {
11185
- "json": {
11186
- "description": "Format output as json.",
11187
- "helpGroup": "GLOBAL",
11188
- "name": "json",
11189
- "allowNo": false,
11190
- "type": "boolean"
11191
- },
11192
- "flags-dir": {
11193
- "helpGroup": "GLOBAL",
11194
- "name": "flags-dir",
11195
- "summary": "Import flag values from a directory.",
11196
- "hasDynamicHelp": false,
11197
- "multiple": false,
11198
- "type": "option"
11199
- },
11200
- "devhub": {
11201
- "char": "b",
11202
- "description": "Configure project DevHub",
11203
- "name": "devhub",
11204
- "allowNo": false,
11205
- "type": "boolean"
11206
- },
11207
- "debug": {
11208
- "char": "d",
11209
- "description": "Activate debug mode (more logs)",
11210
- "name": "debug",
11211
- "allowNo": false,
11212
- "type": "boolean"
11213
- },
11214
- "websocket": {
11215
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11216
- "name": "websocket",
11217
- "hasDynamicHelp": false,
11218
- "multiple": false,
11219
- "type": "option"
11220
- },
11221
- "skipauth": {
11222
- "description": "Skip authentication check when a default username is required",
11223
- "name": "skipauth",
11224
- "allowNo": false,
11225
- "type": "boolean"
11226
- },
11227
- "target-org": {
11228
- "aliases": [
11229
- "targetusername",
11230
- "u"
11231
- ],
11232
- "char": "o",
11233
- "deprecateAliases": true,
11234
- "name": "target-org",
11235
- "noCacheDefault": true,
11236
- "summary": "Username or alias of the target org.",
11237
- "hasDynamicHelp": true,
11238
- "multiple": false,
11239
- "type": "option"
11240
- },
11241
- "target-dev-hub": {
11242
- "aliases": [
11243
- "targetdevhubusername"
11244
- ],
11245
- "char": "v",
11246
- "deprecateAliases": true,
11247
- "name": "target-dev-hub",
11248
- "noCacheDefault": true,
11249
- "required": false,
11250
- "summary": "Username or alias of the Dev Hub org.",
11251
- "hasDynamicHelp": true,
11252
- "multiple": false,
11253
- "type": "option"
11254
- }
11255
- },
11256
- "hasDynamicHelp": true,
11257
- "hiddenAliases": [],
11258
- "id": "hardis:project:configure:auth",
11259
- "pluginAlias": "sfdx-hardis",
11260
- "pluginName": "sfdx-hardis",
11261
- "pluginType": "core",
11262
- "strict": true,
11263
- "enableJsonFlag": true,
11264
- "title": "Configure authentication",
11265
- "requiresProject": false,
11266
- "requiresDependencies": [
11267
- "openssl"
11268
- ],
11269
- "isESM": true,
11270
- "relativePath": [
11271
- "lib",
11272
- "commands",
11273
- "hardis",
11274
- "project",
11275
- "configure",
11276
- "auth.js"
11277
- ],
11278
- "aliasPermutations": [],
11279
- "permutations": [
11280
- "hardis:project:configure:auth",
11281
- "project:hardis:configure:auth",
11282
- "project:configure:hardis:auth",
11283
- "project:configure:auth:hardis",
11284
- "hardis:configure:project:auth",
11285
- "configure:hardis:project:auth",
11286
- "configure:project:hardis:auth",
11287
- "configure:project:auth:hardis",
11288
- "hardis:configure:auth:project",
11289
- "configure:hardis:auth:project",
11290
- "configure:auth:hardis:project",
11291
- "configure:auth:project:hardis",
11292
- "hardis:project:auth:configure",
11293
- "project:hardis:auth:configure",
11294
- "project:auth:hardis:configure",
11295
- "project:auth:configure:hardis",
11296
- "hardis:auth:project:configure",
11297
- "auth:hardis:project:configure",
11298
- "auth:project:hardis:configure",
11299
- "auth:project:configure:hardis",
11300
- "hardis:auth:configure:project",
11301
- "auth:hardis:configure:project",
11302
- "auth:configure:hardis:project",
11303
- "auth:configure:project:hardis"
11304
- ]
11305
- },
11306
11306
  "hardis:project:convert:profilestopermsets": {
11307
11307
  "aliases": [],
11308
11308
  "args": {},
@@ -15369,5 +15369,5 @@
15369
15369
  ]
15370
15370
  }
15371
15371
  },
15372
- "version": "6.7.1"
15372
+ "version": "6.7.2-beta202510122234.0"
15373
15373
  }