sfdx-hardis 6.4.1-beta202509082207.0 → 6.4.1

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.
@@ -5538,13 +5538,12 @@
5538
5538
  "import:data:org:hardis"
5539
5539
  ]
5540
5540
  },
5541
- "hardis:org:fix:listviewmine": {
5541
+ "hardis:org:files:export": {
5542
5542
  "aliases": [],
5543
5543
  "args": {},
5544
- "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
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, and output naming conventions.\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.\n- **File Download:** Downloads the actual file content from Salesforce.\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 and `promptFilesExportConfiguration` for customizing export options.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues or API limits.\n</details>\n",
5545
5545
  "examples": [
5546
- "$ sf hardis:org:fix:listviewmine",
5547
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5546
+ "$ sf hardis:org:files:export"
5548
5547
  ],
5549
5548
  "flags": {
5550
5549
  "json": {
@@ -5562,10 +5561,37 @@
5562
5561
  "multiple": false,
5563
5562
  "type": "option"
5564
5563
  },
5565
- "listviews": {
5566
- "char": "l",
5567
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5568
- "name": "listviews",
5564
+ "path": {
5565
+ "char": "p",
5566
+ "description": "Path to the file export project",
5567
+ "name": "path",
5568
+ "hasDynamicHelp": false,
5569
+ "multiple": false,
5570
+ "type": "option"
5571
+ },
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": {
5582
+ "char": "t",
5583
+ "description": "Timeout in MS for Bulk API calls",
5584
+ "name": "polltimeout",
5585
+ "default": 300000,
5586
+ "hasDynamicHelp": false,
5587
+ "multiple": false,
5588
+ "type": "option"
5589
+ },
5590
+ "startchunknumber": {
5591
+ "char": "s",
5592
+ "description": "Chunk number to start from",
5593
+ "name": "startchunknumber",
5594
+ "default": 0,
5569
5595
  "hasDynamicHelp": false,
5570
5596
  "multiple": false,
5571
5597
  "type": "option"
@@ -5608,60 +5634,57 @@
5608
5634
  },
5609
5635
  "hasDynamicHelp": true,
5610
5636
  "hiddenAliases": [],
5611
- "id": "hardis:org:fix:listviewmine",
5637
+ "id": "hardis:org:files:export",
5612
5638
  "pluginAlias": "sfdx-hardis",
5613
5639
  "pluginName": "sfdx-hardis",
5614
5640
  "pluginType": "core",
5615
5641
  "strict": true,
5616
5642
  "enableJsonFlag": true,
5617
- "title": "Fix listviews with ",
5618
- "requiresProject": true,
5643
+ "title": "Export files",
5644
+ "requiresProject": false,
5619
5645
  "isESM": true,
5620
5646
  "relativePath": [
5621
5647
  "lib",
5622
5648
  "commands",
5623
5649
  "hardis",
5624
5650
  "org",
5625
- "fix",
5626
- "listviewmine.js"
5651
+ "files",
5652
+ "export.js"
5627
5653
  ],
5628
5654
  "aliasPermutations": [],
5629
5655
  "permutations": [
5630
- "hardis:org:fix:listviewmine",
5631
- "org:hardis:fix:listviewmine",
5632
- "org:fix:hardis:listviewmine",
5633
- "org:fix:listviewmine:hardis",
5634
- "hardis:fix:org:listviewmine",
5635
- "fix:hardis:org:listviewmine",
5636
- "fix:org:hardis:listviewmine",
5637
- "fix:org:listviewmine:hardis",
5638
- "hardis:fix:listviewmine:org",
5639
- "fix:hardis:listviewmine:org",
5640
- "fix:listviewmine:hardis:org",
5641
- "fix:listviewmine:org:hardis",
5642
- "hardis:org:listviewmine:fix",
5643
- "org:hardis:listviewmine:fix",
5644
- "org:listviewmine:hardis:fix",
5645
- "org:listviewmine:fix:hardis",
5646
- "hardis:listviewmine:org:fix",
5647
- "listviewmine:hardis:org:fix",
5648
- "listviewmine:org:hardis:fix",
5649
- "listviewmine:org:fix:hardis",
5650
- "hardis:listviewmine:fix:org",
5651
- "listviewmine:hardis:fix:org",
5652
- "listviewmine:fix:hardis:org",
5653
- "listviewmine:fix:org:hardis"
5656
+ "hardis:org:files:export",
5657
+ "org:hardis:files:export",
5658
+ "org:files:hardis:export",
5659
+ "org:files:export:hardis",
5660
+ "hardis:files:org:export",
5661
+ "files:hardis:org:export",
5662
+ "files:org:hardis:export",
5663
+ "files:org:export:hardis",
5664
+ "hardis:files:export:org",
5665
+ "files:hardis:export:org",
5666
+ "files:export:hardis:org",
5667
+ "files:export:org:hardis",
5668
+ "hardis:org:export:files",
5669
+ "org:hardis:export:files",
5670
+ "org:export:hardis:files",
5671
+ "org:export:files:hardis",
5672
+ "hardis:export:org:files",
5673
+ "export:hardis:org:files",
5674
+ "export:org:hardis:files",
5675
+ "export:org:files:hardis",
5676
+ "hardis:export:files:org",
5677
+ "export:hardis:files:org",
5678
+ "export:files:hardis:org",
5679
+ "export:files:org:hardis"
5654
5680
  ]
5655
5681
  },
5656
- "hardis:org:diagnose:audittrail": {
5682
+ "hardis:org:files:import": {
5657
5683
  "aliases": [],
5658
5684
  "args": {},
5659
- "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",
5685
+ "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",
5660
5686
  "examples": [
5661
- "$ sf hardis:org:diagnose:audittrail",
5662
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5663
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5664
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5687
+ "$ sf hardis:org:files:import"
5665
5688
  ],
5666
5689
  "flags": {
5667
5690
  "json": {
@@ -5679,29 +5702,20 @@
5679
5702
  "multiple": false,
5680
5703
  "type": "option"
5681
5704
  },
5682
- "excludeusers": {
5683
- "char": "e",
5684
- "description": "Comma-separated list of usernames to exclude",
5685
- "name": "excludeusers",
5686
- "hasDynamicHelp": false,
5687
- "multiple": false,
5688
- "type": "option"
5689
- },
5690
- "lastndays": {
5691
- "char": "t",
5692
- "description": "Number of days to extract from today (included)",
5693
- "name": "lastndays",
5705
+ "path": {
5706
+ "char": "p",
5707
+ "description": "Path to the file export project",
5708
+ "name": "path",
5694
5709
  "hasDynamicHelp": false,
5695
5710
  "multiple": false,
5696
5711
  "type": "option"
5697
5712
  },
5698
- "outputfile": {
5713
+ "overwrite": {
5699
5714
  "char": "f",
5700
- "description": "Force the path and name of output report file. Must end with .csv",
5701
- "name": "outputfile",
5702
- "hasDynamicHelp": false,
5703
- "multiple": false,
5704
- "type": "option"
5715
+ "description": "Override existing files (doubles the number of API calls)",
5716
+ "name": "overwrite",
5717
+ "allowNo": false,
5718
+ "type": "boolean"
5705
5719
  },
5706
5720
  "debug": {
5707
5721
  "char": "d",
@@ -5741,13 +5755,13 @@
5741
5755
  },
5742
5756
  "hasDynamicHelp": true,
5743
5757
  "hiddenAliases": [],
5744
- "id": "hardis:org:diagnose:audittrail",
5758
+ "id": "hardis:org:files:import",
5745
5759
  "pluginAlias": "sfdx-hardis",
5746
5760
  "pluginName": "sfdx-hardis",
5747
5761
  "pluginType": "core",
5748
5762
  "strict": true,
5749
5763
  "enableJsonFlag": true,
5750
- "title": "Diagnose content of Setup Audit Trail",
5764
+ "title": "Import files",
5751
5765
  "requiresProject": false,
5752
5766
  "isESM": true,
5753
5767
  "relativePath": [
@@ -5755,43 +5769,44 @@
5755
5769
  "commands",
5756
5770
  "hardis",
5757
5771
  "org",
5758
- "diagnose",
5759
- "audittrail.js"
5772
+ "files",
5773
+ "import.js"
5760
5774
  ],
5761
5775
  "aliasPermutations": [],
5762
5776
  "permutations": [
5763
- "hardis:org:diagnose:audittrail",
5764
- "org:hardis:diagnose:audittrail",
5765
- "org:diagnose:hardis:audittrail",
5766
- "org:diagnose:audittrail:hardis",
5767
- "hardis:diagnose:org:audittrail",
5768
- "diagnose:hardis:org:audittrail",
5769
- "diagnose:org:hardis:audittrail",
5770
- "diagnose:org:audittrail:hardis",
5771
- "hardis:diagnose:audittrail:org",
5772
- "diagnose:hardis:audittrail:org",
5773
- "diagnose:audittrail:hardis:org",
5774
- "diagnose:audittrail:org:hardis",
5775
- "hardis:org:audittrail:diagnose",
5776
- "org:hardis:audittrail:diagnose",
5777
- "org:audittrail:hardis:diagnose",
5778
- "org:audittrail:diagnose:hardis",
5779
- "hardis:audittrail:org:diagnose",
5780
- "audittrail:hardis:org:diagnose",
5781
- "audittrail:org:hardis:diagnose",
5782
- "audittrail:org:diagnose:hardis",
5783
- "hardis:audittrail:diagnose:org",
5784
- "audittrail:hardis:diagnose:org",
5785
- "audittrail:diagnose:hardis:org",
5786
- "audittrail:diagnose:org:hardis"
5777
+ "hardis:org:files:import",
5778
+ "org:hardis:files:import",
5779
+ "org:files:hardis:import",
5780
+ "org:files:import:hardis",
5781
+ "hardis:files:org:import",
5782
+ "files:hardis:org:import",
5783
+ "files:org:hardis:import",
5784
+ "files:org:import:hardis",
5785
+ "hardis:files:import:org",
5786
+ "files:hardis:import:org",
5787
+ "files:import:hardis:org",
5788
+ "files:import:org:hardis",
5789
+ "hardis:org:import:files",
5790
+ "org:hardis:import:files",
5791
+ "org:import:hardis:files",
5792
+ "org:import:files:hardis",
5793
+ "hardis:import:org:files",
5794
+ "import:hardis:org:files",
5795
+ "import:org:hardis:files",
5796
+ "import:org:files:hardis",
5797
+ "hardis:import:files:org",
5798
+ "import:hardis:files:org",
5799
+ "import:files:hardis:org",
5800
+ "import:files:org:hardis"
5787
5801
  ]
5788
5802
  },
5789
- "hardis:org:diagnose:instanceupgrade": {
5803
+ "hardis:org:fix:listviewmine": {
5790
5804
  "aliases": [],
5791
5805
  "args": {},
5792
- "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
5806
+ "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
5793
5807
  "examples": [
5794
- "$ sf hardis:org:diagnose:instanceupgrade"
5808
+ "$ sf hardis:org:fix:listviewmine",
5809
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5795
5810
  ],
5796
5811
  "flags": {
5797
5812
  "json": {
@@ -5809,6 +5824,14 @@
5809
5824
  "multiple": false,
5810
5825
  "type": "option"
5811
5826
  },
5827
+ "listviews": {
5828
+ "char": "l",
5829
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5830
+ "name": "listviews",
5831
+ "hasDynamicHelp": false,
5832
+ "multiple": false,
5833
+ "type": "option"
5834
+ },
5812
5835
  "debug": {
5813
5836
  "char": "d",
5814
5837
  "description": "Activate debug mode (more logs)",
@@ -5847,64 +5870,64 @@
5847
5870
  },
5848
5871
  "hasDynamicHelp": true,
5849
5872
  "hiddenAliases": [],
5850
- "id": "hardis:org:diagnose:instanceupgrade",
5873
+ "id": "hardis:org:fix:listviewmine",
5851
5874
  "pluginAlias": "sfdx-hardis",
5852
5875
  "pluginName": "sfdx-hardis",
5853
5876
  "pluginType": "core",
5854
5877
  "strict": true,
5855
5878
  "enableJsonFlag": true,
5856
- "title": "Get Instance Upgrade date",
5857
- "requiresProject": false,
5879
+ "title": "Fix listviews with ",
5880
+ "requiresProject": true,
5858
5881
  "isESM": true,
5859
5882
  "relativePath": [
5860
5883
  "lib",
5861
5884
  "commands",
5862
5885
  "hardis",
5863
5886
  "org",
5864
- "diagnose",
5865
- "instanceupgrade.js"
5887
+ "fix",
5888
+ "listviewmine.js"
5866
5889
  ],
5867
5890
  "aliasPermutations": [],
5868
5891
  "permutations": [
5869
- "hardis:org:diagnose:instanceupgrade",
5870
- "org:hardis:diagnose:instanceupgrade",
5871
- "org:diagnose:hardis:instanceupgrade",
5872
- "org:diagnose:instanceupgrade:hardis",
5873
- "hardis:diagnose:org:instanceupgrade",
5874
- "diagnose:hardis:org:instanceupgrade",
5875
- "diagnose:org:hardis:instanceupgrade",
5876
- "diagnose:org:instanceupgrade:hardis",
5877
- "hardis:diagnose:instanceupgrade:org",
5878
- "diagnose:hardis:instanceupgrade:org",
5879
- "diagnose:instanceupgrade:hardis:org",
5880
- "diagnose:instanceupgrade:org:hardis",
5881
- "hardis:org:instanceupgrade:diagnose",
5882
- "org:hardis:instanceupgrade:diagnose",
5883
- "org:instanceupgrade:hardis:diagnose",
5884
- "org:instanceupgrade:diagnose:hardis",
5885
- "hardis:instanceupgrade:org:diagnose",
5886
- "instanceupgrade:hardis:org:diagnose",
5887
- "instanceupgrade:org:hardis:diagnose",
5888
- "instanceupgrade:org:diagnose:hardis",
5889
- "hardis:instanceupgrade:diagnose:org",
5890
- "instanceupgrade:hardis:diagnose:org",
5891
- "instanceupgrade:diagnose:hardis:org",
5892
- "instanceupgrade:diagnose:org:hardis"
5893
- ]
5894
- },
5895
- "hardis:org:diagnose:legacyapi": {
5896
- "aliases": [],
5897
- "args": {},
5898
- "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
5899
- "examples": [
5900
- "$ sf hardis:org:diagnose:legacyapi",
5901
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5902
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5903
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5904
- ],
5905
- "flags": {
5906
- "json": {
5907
- "description": "Format output as json.",
5892
+ "hardis:org:fix:listviewmine",
5893
+ "org:hardis:fix:listviewmine",
5894
+ "org:fix:hardis:listviewmine",
5895
+ "org:fix:listviewmine:hardis",
5896
+ "hardis:fix:org:listviewmine",
5897
+ "fix:hardis:org:listviewmine",
5898
+ "fix:org:hardis:listviewmine",
5899
+ "fix:org:listviewmine:hardis",
5900
+ "hardis:fix:listviewmine:org",
5901
+ "fix:hardis:listviewmine:org",
5902
+ "fix:listviewmine:hardis:org",
5903
+ "fix:listviewmine:org:hardis",
5904
+ "hardis:org:listviewmine:fix",
5905
+ "org:hardis:listviewmine:fix",
5906
+ "org:listviewmine:hardis:fix",
5907
+ "org:listviewmine:fix:hardis",
5908
+ "hardis:listviewmine:org:fix",
5909
+ "listviewmine:hardis:org:fix",
5910
+ "listviewmine:org:hardis:fix",
5911
+ "listviewmine:org:fix:hardis",
5912
+ "hardis:listviewmine:fix:org",
5913
+ "listviewmine:hardis:fix:org",
5914
+ "listviewmine:fix:hardis:org",
5915
+ "listviewmine:fix:org:hardis"
5916
+ ]
5917
+ },
5918
+ "hardis:org:diagnose:audittrail": {
5919
+ "aliases": [],
5920
+ "args": {},
5921
+ "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",
5922
+ "examples": [
5923
+ "$ sf hardis:org:diagnose:audittrail",
5924
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5925
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5926
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5927
+ ],
5928
+ "flags": {
5929
+ "json": {
5930
+ "description": "Format output as json.",
5908
5931
  "helpGroup": "GLOBAL",
5909
5932
  "name": "json",
5910
5933
  "allowNo": false,
@@ -5918,20 +5941,18 @@
5918
5941
  "multiple": false,
5919
5942
  "type": "option"
5920
5943
  },
5921
- "eventtype": {
5944
+ "excludeusers": {
5922
5945
  "char": "e",
5923
- "description": "Type of EventLogFile event to analyze",
5924
- "name": "eventtype",
5925
- "default": "ApiTotalUsage",
5946
+ "description": "Comma-separated list of usernames to exclude",
5947
+ "name": "excludeusers",
5926
5948
  "hasDynamicHelp": false,
5927
5949
  "multiple": false,
5928
5950
  "type": "option"
5929
5951
  },
5930
- "limit": {
5931
- "char": "l",
5932
- "description": "Number of latest EventLogFile events to analyze",
5933
- "name": "limit",
5934
- "default": 999,
5952
+ "lastndays": {
5953
+ "char": "t",
5954
+ "description": "Number of days to extract from today (included)",
5955
+ "name": "lastndays",
5935
5956
  "hasDynamicHelp": false,
5936
5957
  "multiple": false,
5937
5958
  "type": "option"
@@ -5982,13 +6003,13 @@
5982
6003
  },
5983
6004
  "hasDynamicHelp": true,
5984
6005
  "hiddenAliases": [],
5985
- "id": "hardis:org:diagnose:legacyapi",
6006
+ "id": "hardis:org:diagnose:audittrail",
5986
6007
  "pluginAlias": "sfdx-hardis",
5987
6008
  "pluginName": "sfdx-hardis",
5988
6009
  "pluginType": "core",
5989
6010
  "strict": true,
5990
6011
  "enableJsonFlag": true,
5991
- "title": "Check for legacy API use",
6012
+ "title": "Diagnose content of Setup Audit Trail",
5992
6013
  "requiresProject": false,
5993
6014
  "isESM": true,
5994
6015
  "relativePath": [
@@ -5997,42 +6018,42 @@
5997
6018
  "hardis",
5998
6019
  "org",
5999
6020
  "diagnose",
6000
- "legacyapi.js"
6021
+ "audittrail.js"
6001
6022
  ],
6002
6023
  "aliasPermutations": [],
6003
6024
  "permutations": [
6004
- "hardis:org:diagnose:legacyapi",
6005
- "org:hardis:diagnose:legacyapi",
6006
- "org:diagnose:hardis:legacyapi",
6007
- "org:diagnose:legacyapi:hardis",
6008
- "hardis:diagnose:org:legacyapi",
6009
- "diagnose:hardis:org:legacyapi",
6010
- "diagnose:org:hardis:legacyapi",
6011
- "diagnose:org:legacyapi:hardis",
6012
- "hardis:diagnose:legacyapi:org",
6013
- "diagnose:hardis:legacyapi:org",
6014
- "diagnose:legacyapi:hardis:org",
6015
- "diagnose:legacyapi:org:hardis",
6016
- "hardis:org:legacyapi:diagnose",
6017
- "org:hardis:legacyapi:diagnose",
6018
- "org:legacyapi:hardis:diagnose",
6019
- "org:legacyapi:diagnose:hardis",
6020
- "hardis:legacyapi:org:diagnose",
6021
- "legacyapi:hardis:org:diagnose",
6022
- "legacyapi:org:hardis:diagnose",
6023
- "legacyapi:org:diagnose:hardis",
6024
- "hardis:legacyapi:diagnose:org",
6025
- "legacyapi:hardis:diagnose:org",
6026
- "legacyapi:diagnose:hardis:org",
6027
- "legacyapi:diagnose:org:hardis"
6025
+ "hardis:org:diagnose:audittrail",
6026
+ "org:hardis:diagnose:audittrail",
6027
+ "org:diagnose:hardis:audittrail",
6028
+ "org:diagnose:audittrail:hardis",
6029
+ "hardis:diagnose:org:audittrail",
6030
+ "diagnose:hardis:org:audittrail",
6031
+ "diagnose:org:hardis:audittrail",
6032
+ "diagnose:org:audittrail:hardis",
6033
+ "hardis:diagnose:audittrail:org",
6034
+ "diagnose:hardis:audittrail:org",
6035
+ "diagnose:audittrail:hardis:org",
6036
+ "diagnose:audittrail:org:hardis",
6037
+ "hardis:org:audittrail:diagnose",
6038
+ "org:hardis:audittrail:diagnose",
6039
+ "org:audittrail:hardis:diagnose",
6040
+ "org:audittrail:diagnose:hardis",
6041
+ "hardis:audittrail:org:diagnose",
6042
+ "audittrail:hardis:org:diagnose",
6043
+ "audittrail:org:hardis:diagnose",
6044
+ "audittrail:org:diagnose:hardis",
6045
+ "hardis:audittrail:diagnose:org",
6046
+ "audittrail:hardis:diagnose:org",
6047
+ "audittrail:diagnose:hardis:org",
6048
+ "audittrail:diagnose:org:hardis"
6028
6049
  ]
6029
6050
  },
6030
- "hardis:org:diagnose:licenses": {
6051
+ "hardis:org:diagnose:instanceupgrade": {
6031
6052
  "aliases": [],
6032
6053
  "args": {},
6033
- "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
6054
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
6034
6055
  "examples": [
6035
- "$ sf hardis:org:diagnose:licenses"
6056
+ "$ sf hardis:org:diagnose:instanceupgrade"
6036
6057
  ],
6037
6058
  "flags": {
6038
6059
  "json": {
@@ -6050,21 +6071,6 @@
6050
6071
  "multiple": false,
6051
6072
  "type": "option"
6052
6073
  },
6053
- "outputfile": {
6054
- "char": "f",
6055
- "description": "Force the path and name of output report file. Must end with .csv",
6056
- "name": "outputfile",
6057
- "hasDynamicHelp": false,
6058
- "multiple": false,
6059
- "type": "option"
6060
- },
6061
- "usedonly": {
6062
- "char": "u",
6063
- "description": "Filter to have only used licenses",
6064
- "name": "usedonly",
6065
- "allowNo": false,
6066
- "type": "boolean"
6067
- },
6068
6074
  "debug": {
6069
6075
  "char": "d",
6070
6076
  "description": "Activate debug mode (more logs)",
@@ -6103,13 +6109,13 @@
6103
6109
  },
6104
6110
  "hasDynamicHelp": true,
6105
6111
  "hiddenAliases": [],
6106
- "id": "hardis:org:diagnose:licenses",
6112
+ "id": "hardis:org:diagnose:instanceupgrade",
6107
6113
  "pluginAlias": "sfdx-hardis",
6108
6114
  "pluginName": "sfdx-hardis",
6109
6115
  "pluginType": "core",
6110
6116
  "strict": true,
6111
6117
  "enableJsonFlag": true,
6112
- "title": "List licenses subscribed and used in a Salesforce org",
6118
+ "title": "Get Instance Upgrade date",
6113
6119
  "requiresProject": false,
6114
6120
  "isESM": true,
6115
6121
  "relativePath": [
@@ -6118,42 +6124,45 @@
6118
6124
  "hardis",
6119
6125
  "org",
6120
6126
  "diagnose",
6121
- "licenses.js"
6127
+ "instanceupgrade.js"
6122
6128
  ],
6123
6129
  "aliasPermutations": [],
6124
6130
  "permutations": [
6125
- "hardis:org:diagnose:licenses",
6126
- "org:hardis:diagnose:licenses",
6127
- "org:diagnose:hardis:licenses",
6128
- "org:diagnose:licenses:hardis",
6129
- "hardis:diagnose:org:licenses",
6130
- "diagnose:hardis:org:licenses",
6131
- "diagnose:org:hardis:licenses",
6132
- "diagnose:org:licenses:hardis",
6133
- "hardis:diagnose:licenses:org",
6134
- "diagnose:hardis:licenses:org",
6135
- "diagnose:licenses:hardis:org",
6136
- "diagnose:licenses:org:hardis",
6137
- "hardis:org:licenses:diagnose",
6138
- "org:hardis:licenses:diagnose",
6139
- "org:licenses:hardis:diagnose",
6140
- "org:licenses:diagnose:hardis",
6141
- "hardis:licenses:org:diagnose",
6142
- "licenses:hardis:org:diagnose",
6143
- "licenses:org:hardis:diagnose",
6144
- "licenses:org:diagnose:hardis",
6145
- "hardis:licenses:diagnose:org",
6146
- "licenses:hardis:diagnose:org",
6147
- "licenses:diagnose:hardis:org",
6148
- "licenses:diagnose:org:hardis"
6131
+ "hardis:org:diagnose:instanceupgrade",
6132
+ "org:hardis:diagnose:instanceupgrade",
6133
+ "org:diagnose:hardis:instanceupgrade",
6134
+ "org:diagnose:instanceupgrade:hardis",
6135
+ "hardis:diagnose:org:instanceupgrade",
6136
+ "diagnose:hardis:org:instanceupgrade",
6137
+ "diagnose:org:hardis:instanceupgrade",
6138
+ "diagnose:org:instanceupgrade:hardis",
6139
+ "hardis:diagnose:instanceupgrade:org",
6140
+ "diagnose:hardis:instanceupgrade:org",
6141
+ "diagnose:instanceupgrade:hardis:org",
6142
+ "diagnose:instanceupgrade:org:hardis",
6143
+ "hardis:org:instanceupgrade:diagnose",
6144
+ "org:hardis:instanceupgrade:diagnose",
6145
+ "org:instanceupgrade:hardis:diagnose",
6146
+ "org:instanceupgrade:diagnose:hardis",
6147
+ "hardis:instanceupgrade:org:diagnose",
6148
+ "instanceupgrade:hardis:org:diagnose",
6149
+ "instanceupgrade:org:hardis:diagnose",
6150
+ "instanceupgrade:org:diagnose:hardis",
6151
+ "hardis:instanceupgrade:diagnose:org",
6152
+ "instanceupgrade:hardis:diagnose:org",
6153
+ "instanceupgrade:diagnose:hardis:org",
6154
+ "instanceupgrade:diagnose:org:hardis"
6149
6155
  ]
6150
6156
  },
6151
- "hardis:org:diagnose:releaseupdates": {
6157
+ "hardis:org:diagnose:legacyapi": {
6152
6158
  "aliases": [],
6153
6159
  "args": {},
6154
- "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6160
+ "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
6155
6161
  "examples": [
6156
- "$ sf hardis:org:diagnose:releaseupdates"
6162
+ "$ sf hardis:org:diagnose:legacyapi",
6163
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
6164
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
6165
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6157
6166
  ],
6158
6167
  "flags": {
6159
6168
  "json": {
@@ -6171,6 +6180,24 @@
6171
6180
  "multiple": false,
6172
6181
  "type": "option"
6173
6182
  },
6183
+ "eventtype": {
6184
+ "char": "e",
6185
+ "description": "Type of EventLogFile event to analyze",
6186
+ "name": "eventtype",
6187
+ "default": "ApiTotalUsage",
6188
+ "hasDynamicHelp": false,
6189
+ "multiple": false,
6190
+ "type": "option"
6191
+ },
6192
+ "limit": {
6193
+ "char": "l",
6194
+ "description": "Number of latest EventLogFile events to analyze",
6195
+ "name": "limit",
6196
+ "default": 999,
6197
+ "hasDynamicHelp": false,
6198
+ "multiple": false,
6199
+ "type": "option"
6200
+ },
6174
6201
  "outputfile": {
6175
6202
  "char": "f",
6176
6203
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -6217,13 +6244,13 @@
6217
6244
  },
6218
6245
  "hasDynamicHelp": true,
6219
6246
  "hiddenAliases": [],
6220
- "id": "hardis:org:diagnose:releaseupdates",
6247
+ "id": "hardis:org:diagnose:legacyapi",
6221
6248
  "pluginAlias": "sfdx-hardis",
6222
6249
  "pluginName": "sfdx-hardis",
6223
6250
  "pluginType": "core",
6224
6251
  "strict": true,
6225
6252
  "enableJsonFlag": true,
6226
- "title": "Check Release Updates of an org",
6253
+ "title": "Check for legacy API use",
6227
6254
  "requiresProject": false,
6228
6255
  "isESM": true,
6229
6256
  "relativePath": [
@@ -6232,49 +6259,49 @@
6232
6259
  "hardis",
6233
6260
  "org",
6234
6261
  "diagnose",
6235
- "releaseupdates.js"
6262
+ "legacyapi.js"
6236
6263
  ],
6237
6264
  "aliasPermutations": [],
6238
6265
  "permutations": [
6239
- "hardis:org:diagnose:releaseupdates",
6240
- "org:hardis:diagnose:releaseupdates",
6241
- "org:diagnose:hardis:releaseupdates",
6242
- "org:diagnose:releaseupdates:hardis",
6243
- "hardis:diagnose:org:releaseupdates",
6244
- "diagnose:hardis:org:releaseupdates",
6245
- "diagnose:org:hardis:releaseupdates",
6246
- "diagnose:org:releaseupdates:hardis",
6247
- "hardis:diagnose:releaseupdates:org",
6248
- "diagnose:hardis:releaseupdates:org",
6249
- "diagnose:releaseupdates:hardis:org",
6250
- "diagnose:releaseupdates:org:hardis",
6251
- "hardis:org:releaseupdates:diagnose",
6252
- "org:hardis:releaseupdates:diagnose",
6253
- "org:releaseupdates:hardis:diagnose",
6254
- "org:releaseupdates:diagnose:hardis",
6255
- "hardis:releaseupdates:org:diagnose",
6256
- "releaseupdates:hardis:org:diagnose",
6257
- "releaseupdates:org:hardis:diagnose",
6258
- "releaseupdates:org:diagnose:hardis",
6259
- "hardis:releaseupdates:diagnose:org",
6260
- "releaseupdates:hardis:diagnose:org",
6261
- "releaseupdates:diagnose:hardis:org",
6262
- "releaseupdates:diagnose:org:hardis"
6263
- ]
6264
- },
6265
- "hardis:org:diagnose:unsecure-connected-apps": {
6266
- "aliases": [],
6267
- "args": {},
6268
- "description": "\n## Command Behavior\n\n**Detects unsecured Connected Apps in a Salesforce org and generates detailed reports for security analysis.**\n\nThis command is a critical security diagnostic tool that helps administrators identify Connected Apps that may pose security risks due to improper configuration. It provides comprehensive analysis of OAuth tokens and Connected App security settings to ensure proper access control.\n\nKey functionalities:\n\n- **OAuth Token Analysis:** Queries all OAuth tokens in the org using SOQL to retrieve comprehensive token information including app names, users, authorization status, and usage statistics.\n- **Security Status Assessment:** Evaluates each Connected App's security configuration by checking the `IsUsingAdminAuthorization` flag to determine if admin pre-approval is required.\n- **Unsecured App Detection:** Identifies Connected Apps that allow users to authorize themselves without admin approval, which can pose security risks.\n- **Detailed Reporting:** Generates two comprehensive CSV reports:\n - **OAuth Tokens Report:** Lists all OAuth tokens with security status, user information, and usage data\n - **Connected Apps Summary:** Aggregates unsecured Connected Apps with counts of associated OAuth tokens\n- **Visual Indicators:** Uses status icons (❌ for unsecured, for secured) to provide immediate visual feedback on security status.\n- **Security Recommendations:** Provides actionable guidance on how to secure Connected Apps through proper configuration.\n- **Notifications:** Sends alerts to configured channels (Grafana, Slack, MS Teams) with security findings and attached reports.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-security/) and can output Grafana, Slack and MsTeams Notifications.\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/jHv8yrSK8Dg\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query Execution:** Executes a comprehensive SOQL query on the `OauthToken` object, joining with `AppMenuItem` and `User` objects to gather complete security context.\n- **Security Analysis Logic:** Analyzes the `AppMenuItem.IsUsingAdminAuthorization` field to determine if a Connected App requires admin pre-approval for user authorization.\n- **Data Transformation:** Processes raw SOQL results to add security status indicators and reorganize data for optimal reporting and analysis.\n- **Aggregation Processing:** Groups OAuth tokens by Connected App name to provide summary statistics and identify the most problematic applications.\n- **Report Generation:** Uses `generateCsvFile` to create structured CSV reports with proper formatting and metadata for easy analysis and sharing.\n- **Notification Integration:** Integrates with the `NotifProvider` to send security alerts with detailed metrics, including the number of unsecured Connected Apps and associated OAuth tokens.\n- **File Management:** Generates multiple output formats (CSV, XLSX) and manages file paths using `generateReportPath` for consistent report organization.\n- **Connection Management:** Uses `setConnectionVariables` to ensure proper authentication context for notification providers that require org connection details.\n</details>\n",
6269
- "examples": [
6270
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
6271
- ],
6272
- "flags": {
6273
- "json": {
6274
- "description": "Format output as json.",
6275
- "helpGroup": "GLOBAL",
6276
- "name": "json",
6277
- "allowNo": false,
6266
+ "hardis:org:diagnose:legacyapi",
6267
+ "org:hardis:diagnose:legacyapi",
6268
+ "org:diagnose:hardis:legacyapi",
6269
+ "org:diagnose:legacyapi:hardis",
6270
+ "hardis:diagnose:org:legacyapi",
6271
+ "diagnose:hardis:org:legacyapi",
6272
+ "diagnose:org:hardis:legacyapi",
6273
+ "diagnose:org:legacyapi:hardis",
6274
+ "hardis:diagnose:legacyapi:org",
6275
+ "diagnose:hardis:legacyapi:org",
6276
+ "diagnose:legacyapi:hardis:org",
6277
+ "diagnose:legacyapi:org:hardis",
6278
+ "hardis:org:legacyapi:diagnose",
6279
+ "org:hardis:legacyapi:diagnose",
6280
+ "org:legacyapi:hardis:diagnose",
6281
+ "org:legacyapi:diagnose:hardis",
6282
+ "hardis:legacyapi:org:diagnose",
6283
+ "legacyapi:hardis:org:diagnose",
6284
+ "legacyapi:org:hardis:diagnose",
6285
+ "legacyapi:org:diagnose:hardis",
6286
+ "hardis:legacyapi:diagnose:org",
6287
+ "legacyapi:hardis:diagnose:org",
6288
+ "legacyapi:diagnose:hardis:org",
6289
+ "legacyapi:diagnose:org:hardis"
6290
+ ]
6291
+ },
6292
+ "hardis:org:diagnose:licenses": {
6293
+ "aliases": [],
6294
+ "args": {},
6295
+ "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
6296
+ "examples": [
6297
+ "$ sf hardis:org:diagnose:licenses"
6298
+ ],
6299
+ "flags": {
6300
+ "json": {
6301
+ "description": "Format output as json.",
6302
+ "helpGroup": "GLOBAL",
6303
+ "name": "json",
6304
+ "allowNo": false,
6278
6305
  "type": "boolean"
6279
6306
  },
6280
6307
  "flags-dir": {
@@ -6293,6 +6320,13 @@
6293
6320
  "multiple": false,
6294
6321
  "type": "option"
6295
6322
  },
6323
+ "usedonly": {
6324
+ "char": "u",
6325
+ "description": "Filter to have only used licenses",
6326
+ "name": "usedonly",
6327
+ "allowNo": false,
6328
+ "type": "boolean"
6329
+ },
6296
6330
  "debug": {
6297
6331
  "char": "d",
6298
6332
  "description": "Activate debug mode (more logs)",
@@ -6331,13 +6365,13 @@
6331
6365
  },
6332
6366
  "hasDynamicHelp": true,
6333
6367
  "hiddenAliases": [],
6334
- "id": "hardis:org:diagnose:unsecure-connected-apps",
6368
+ "id": "hardis:org:diagnose:licenses",
6335
6369
  "pluginAlias": "sfdx-hardis",
6336
6370
  "pluginName": "sfdx-hardis",
6337
6371
  "pluginType": "core",
6338
6372
  "strict": true,
6339
6373
  "enableJsonFlag": true,
6340
- "title": "Detect Unsecured Connected Apps",
6374
+ "title": "List licenses subscribed and used in a Salesforce org",
6341
6375
  "requiresProject": false,
6342
6376
  "isESM": true,
6343
6377
  "relativePath": [
@@ -6346,43 +6380,42 @@
6346
6380
  "hardis",
6347
6381
  "org",
6348
6382
  "diagnose",
6349
- "unsecure-connected-apps.js"
6383
+ "licenses.js"
6350
6384
  ],
6351
6385
  "aliasPermutations": [],
6352
6386
  "permutations": [
6353
- "hardis:org:diagnose:unsecure-connected-apps",
6354
- "org:hardis:diagnose:unsecure-connected-apps",
6355
- "org:diagnose:hardis:unsecure-connected-apps",
6356
- "org:diagnose:unsecure-connected-apps:hardis",
6357
- "hardis:diagnose:org:unsecure-connected-apps",
6358
- "diagnose:hardis:org:unsecure-connected-apps",
6359
- "diagnose:org:hardis:unsecure-connected-apps",
6360
- "diagnose:org:unsecure-connected-apps:hardis",
6361
- "hardis:diagnose:unsecure-connected-apps:org",
6362
- "diagnose:hardis:unsecure-connected-apps:org",
6363
- "diagnose:unsecure-connected-apps:hardis:org",
6364
- "diagnose:unsecure-connected-apps:org:hardis",
6365
- "hardis:org:unsecure-connected-apps:diagnose",
6366
- "org:hardis:unsecure-connected-apps:diagnose",
6367
- "org:unsecure-connected-apps:hardis:diagnose",
6368
- "org:unsecure-connected-apps:diagnose:hardis",
6369
- "hardis:unsecure-connected-apps:org:diagnose",
6370
- "unsecure-connected-apps:hardis:org:diagnose",
6371
- "unsecure-connected-apps:org:hardis:diagnose",
6372
- "unsecure-connected-apps:org:diagnose:hardis",
6373
- "hardis:unsecure-connected-apps:diagnose:org",
6374
- "unsecure-connected-apps:hardis:diagnose:org",
6375
- "unsecure-connected-apps:diagnose:hardis:org",
6376
- "unsecure-connected-apps:diagnose:org:hardis"
6387
+ "hardis:org:diagnose:licenses",
6388
+ "org:hardis:diagnose:licenses",
6389
+ "org:diagnose:hardis:licenses",
6390
+ "org:diagnose:licenses:hardis",
6391
+ "hardis:diagnose:org:licenses",
6392
+ "diagnose:hardis:org:licenses",
6393
+ "diagnose:org:hardis:licenses",
6394
+ "diagnose:org:licenses:hardis",
6395
+ "hardis:diagnose:licenses:org",
6396
+ "diagnose:hardis:licenses:org",
6397
+ "diagnose:licenses:hardis:org",
6398
+ "diagnose:licenses:org:hardis",
6399
+ "hardis:org:licenses:diagnose",
6400
+ "org:hardis:licenses:diagnose",
6401
+ "org:licenses:hardis:diagnose",
6402
+ "org:licenses:diagnose:hardis",
6403
+ "hardis:licenses:org:diagnose",
6404
+ "licenses:hardis:org:diagnose",
6405
+ "licenses:org:hardis:diagnose",
6406
+ "licenses:org:diagnose:hardis",
6407
+ "hardis:licenses:diagnose:org",
6408
+ "licenses:hardis:diagnose:org",
6409
+ "licenses:diagnose:hardis:org",
6410
+ "licenses:diagnose:org:hardis"
6377
6411
  ]
6378
6412
  },
6379
- "hardis:org:diagnose:unused-apex-classes": {
6413
+ "hardis:org:diagnose:releaseupdates": {
6380
6414
  "aliases": [],
6381
6415
  "args": {},
6382
- "description": "List all async Apex classes (Batch,Queueable,Schedulable) that has not been called for more than 365 days.\n \nThe result class list probably can be removed from the project, and that will improve your test classes performances :)\n\nThe number of unused day is overridable using --days option. \n\nThe command uses queries on AsyncApexJob and CronTrigger technical tables to build the result.\n\nApex Classes CreatedBy and CreatedOn fields are calculated from MIN(date from git, date from org)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-apex-classes/) and can output Grafana, Slack and MsTeams Notifications.\n\n![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-monitoring-unused-apex-grafana.jpg)\n",
6416
+ "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6383
6417
  "examples": [
6384
- "$ sf hardis:org:diagnose:unused-apex-classes",
6385
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6418
+ "$ sf hardis:org:diagnose:releaseupdates"
6386
6419
  ],
6387
6420
  "flags": {
6388
6421
  "json": {
@@ -6408,14 +6441,6 @@
6408
6441
  "multiple": false,
6409
6442
  "type": "option"
6410
6443
  },
6411
- "days": {
6412
- "char": "t",
6413
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6414
- "name": "days",
6415
- "hasDynamicHelp": false,
6416
- "multiple": false,
6417
- "type": "option"
6418
- },
6419
6444
  "debug": {
6420
6445
  "char": "d",
6421
6446
  "description": "Activate debug mode (more logs)",
@@ -6454,13 +6479,13 @@
6454
6479
  },
6455
6480
  "hasDynamicHelp": true,
6456
6481
  "hiddenAliases": [],
6457
- "id": "hardis:org:diagnose:unused-apex-classes",
6482
+ "id": "hardis:org:diagnose:releaseupdates",
6458
6483
  "pluginAlias": "sfdx-hardis",
6459
6484
  "pluginName": "sfdx-hardis",
6460
6485
  "pluginType": "core",
6461
6486
  "strict": true,
6462
6487
  "enableJsonFlag": true,
6463
- "title": "Detect unused Apex classes in an org",
6488
+ "title": "Check Release Updates of an org",
6464
6489
  "requiresProject": false,
6465
6490
  "isESM": true,
6466
6491
  "relativePath": [
@@ -6469,42 +6494,42 @@
6469
6494
  "hardis",
6470
6495
  "org",
6471
6496
  "diagnose",
6472
- "unused-apex-classes.js"
6497
+ "releaseupdates.js"
6473
6498
  ],
6474
6499
  "aliasPermutations": [],
6475
6500
  "permutations": [
6476
- "hardis:org:diagnose:unused-apex-classes",
6477
- "org:hardis:diagnose:unused-apex-classes",
6478
- "org:diagnose:hardis:unused-apex-classes",
6479
- "org:diagnose:unused-apex-classes:hardis",
6480
- "hardis:diagnose:org:unused-apex-classes",
6481
- "diagnose:hardis:org:unused-apex-classes",
6482
- "diagnose:org:hardis:unused-apex-classes",
6483
- "diagnose:org:unused-apex-classes:hardis",
6484
- "hardis:diagnose:unused-apex-classes:org",
6485
- "diagnose:hardis:unused-apex-classes:org",
6486
- "diagnose:unused-apex-classes:hardis:org",
6487
- "diagnose:unused-apex-classes:org:hardis",
6488
- "hardis:org:unused-apex-classes:diagnose",
6489
- "org:hardis:unused-apex-classes:diagnose",
6490
- "org:unused-apex-classes:hardis:diagnose",
6491
- "org:unused-apex-classes:diagnose:hardis",
6492
- "hardis:unused-apex-classes:org:diagnose",
6493
- "unused-apex-classes:hardis:org:diagnose",
6494
- "unused-apex-classes:org:hardis:diagnose",
6495
- "unused-apex-classes:org:diagnose:hardis",
6496
- "hardis:unused-apex-classes:diagnose:org",
6497
- "unused-apex-classes:hardis:diagnose:org",
6498
- "unused-apex-classes:diagnose:hardis:org",
6499
- "unused-apex-classes:diagnose:org:hardis"
6501
+ "hardis:org:diagnose:releaseupdates",
6502
+ "org:hardis:diagnose:releaseupdates",
6503
+ "org:diagnose:hardis:releaseupdates",
6504
+ "org:diagnose:releaseupdates:hardis",
6505
+ "hardis:diagnose:org:releaseupdates",
6506
+ "diagnose:hardis:org:releaseupdates",
6507
+ "diagnose:org:hardis:releaseupdates",
6508
+ "diagnose:org:releaseupdates:hardis",
6509
+ "hardis:diagnose:releaseupdates:org",
6510
+ "diagnose:hardis:releaseupdates:org",
6511
+ "diagnose:releaseupdates:hardis:org",
6512
+ "diagnose:releaseupdates:org:hardis",
6513
+ "hardis:org:releaseupdates:diagnose",
6514
+ "org:hardis:releaseupdates:diagnose",
6515
+ "org:releaseupdates:hardis:diagnose",
6516
+ "org:releaseupdates:diagnose:hardis",
6517
+ "hardis:releaseupdates:org:diagnose",
6518
+ "releaseupdates:hardis:org:diagnose",
6519
+ "releaseupdates:org:hardis:diagnose",
6520
+ "releaseupdates:org:diagnose:hardis",
6521
+ "hardis:releaseupdates:diagnose:org",
6522
+ "releaseupdates:hardis:diagnose:org",
6523
+ "releaseupdates:diagnose:hardis:org",
6524
+ "releaseupdates:diagnose:org:hardis"
6500
6525
  ]
6501
6526
  },
6502
- "hardis:org:diagnose:unused-connected-apps": {
6527
+ "hardis:org:diagnose:unsecure-connected-apps": {
6503
6528
  "aliases": [],
6504
6529
  "args": {},
6505
- "description": "\n## Command Behavior\n\n**Identifies and reports on potentially unused Connected Apps in a Salesforce org, suggesting candidates for deletion or deactivation.**\n\nThis command helps improve org security and reduce technical debt by pinpointing Connected Apps that are no longer actively used. Connected Apps can pose security risks if left unmonitored, and cleaning them up contributes to a healthier Salesforce environment.\n\nKey functionalities:\n\n- **Connected App Data Collection:** Gathers information about all Connected Apps in the org, including creation and last modified dates, and associated users.\n- **Usage Analysis:** Analyzes `LoginHistory` and `OAuthToken` records to determine the last usage date of each Connected App.\n- **Inactivity Detection:** Flags Connected Apps as potentially unused if they have no recent login history or OAuth token usage.\n- **Accessibility Check:** Examines Connected App metadata to identify if they are accessible (e.g., if they require admin approval and have no profiles or permission sets assigned).\n- **Ignored Apps:** Automatically ignores a predefined list of common Salesforce Connected Apps (e.g., `Salesforce CLI`, `Salesforce Mobile Dashboards`). You can extend this list by defining the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n- **CSV Report Generation:** Generates a CSV file containing details of all analyzed Connected Apps, including their usage status, last usage date, and reasons for being flagged as potentially unused.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of potentially unused Connected Apps.\n\n**Default Ignored Connected Apps:**\n\n- Ant Migration Tool\n- Chatter Desktop\n- Chatter Mobile for BlackBerry\n- Force.com IDE\n- OIQ_Integration\n- Salesforce CLI\n- Salesforce Files\n- Salesforce Mobile Dashboards\n- Salesforce Touch\n- Salesforce for Outlook\n- SalesforceA\n- SalesforceA for Android\n- SalesforceA for iOS\n- SalesforceDX Namespace Registry\n- SalesforceIQ\n\nYou can add more ignored apps by defining a comma-separated list of names in the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n\n_Example: \nALLOWED_INACTIVE_CONNECTED_APPS=My App 1,My App 2, My App 3_\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-connected-apps/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It performs SOQL queries against `ConnectedApplication`, `LoginHistory`, and `OAuthToken` objects to gather comprehensive data about Connected Apps and their usage.\n- **Temporary SFDX Project:** It creates a temporary SFDX project to retrieve Connected App metadata, allowing for local parsing and analysis of their XML files.\n- **Metadata Parsing:** It parses the `connectedApp-meta.xml` files to check for `isAdminApproved` and the presence of `profileName` or `permissionsetName` to determine accessibility.\n- **Data Correlation:** It correlates data from various Salesforce objects to build a complete picture of each Connected App's usage and status.\n- **Date Calculation:** Uses `moment` to calculate the time since the last OAuth token usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused Connected Apps.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **File System Operations:** Uses `fs-extra` for creating and removing temporary directories and files.\n- **Environment Variable Reading:** Reads the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable to customize the list of ignored Connected Apps.\n</details>\n",
6530
+ "description": "\n## Command Behavior\n\n**Detects unsecured Connected Apps in a Salesforce org and generates detailed reports for security analysis.**\n\nThis command is a critical security diagnostic tool that helps administrators identify Connected Apps that may pose security risks due to improper configuration. It provides comprehensive analysis of OAuth tokens and Connected App security settings to ensure proper access control.\n\nKey functionalities:\n\n- **OAuth Token Analysis:** Queries all OAuth tokens in the org using SOQL to retrieve comprehensive token information including app names, users, authorization status, and usage statistics.\n- **Security Status Assessment:** Evaluates each Connected App's security configuration by checking the `IsUsingAdminAuthorization` flag to determine if admin pre-approval is required.\n- **Unsecured App Detection:** Identifies Connected Apps that allow users to authorize themselves without admin approval, which can pose security risks.\n- **Detailed Reporting:** Generates two comprehensive CSV reports:\n - **OAuth Tokens Report:** Lists all OAuth tokens with security status, user information, and usage data\n - **Connected Apps Summary:** Aggregates unsecured Connected Apps with counts of associated OAuth tokens\n- **Visual Indicators:** Uses status icons (❌ for unsecured, for secured) to provide immediate visual feedback on security status.\n- **Security Recommendations:** Provides actionable guidance on how to secure Connected Apps through proper configuration.\n- **Notifications:** Sends alerts to configured channels (Grafana, Slack, MS Teams) with security findings and attached reports.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-security/) and can output Grafana, Slack and MsTeams Notifications.\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/jHv8yrSK8Dg\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query Execution:** Executes a comprehensive SOQL query on the `OauthToken` object, joining with `AppMenuItem` and `User` objects to gather complete security context.\n- **Security Analysis Logic:** Analyzes the `AppMenuItem.IsUsingAdminAuthorization` field to determine if a Connected App requires admin pre-approval for user authorization.\n- **Data Transformation:** Processes raw SOQL results to add security status indicators and reorganize data for optimal reporting and analysis.\n- **Aggregation Processing:** Groups OAuth tokens by Connected App name to provide summary statistics and identify the most problematic applications.\n- **Report Generation:** Uses `generateCsvFile` to create structured CSV reports with proper formatting and metadata for easy analysis and sharing.\n- **Notification Integration:** Integrates with the `NotifProvider` to send security alerts with detailed metrics, including the number of unsecured Connected Apps and associated OAuth tokens.\n- **File Management:** Generates multiple output formats (CSV, XLSX) and manages file paths using `generateReportPath` for consistent report organization.\n- **Connection Management:** Uses `setConnectionVariables` to ensure proper authentication context for notification providers that require org connection details.\n</details>\n",
6506
6531
  "examples": [
6507
- "$ sf hardis:org:diagnose:unused-connected-apps"
6532
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6508
6533
  ],
6509
6534
  "flags": {
6510
6535
  "json": {
@@ -6568,30 +6593,13 @@
6568
6593
  },
6569
6594
  "hasDynamicHelp": true,
6570
6595
  "hiddenAliases": [],
6571
- "id": "hardis:org:diagnose:unused-connected-apps",
6596
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
6572
6597
  "pluginAlias": "sfdx-hardis",
6573
6598
  "pluginName": "sfdx-hardis",
6574
6599
  "pluginType": "core",
6575
6600
  "strict": true,
6576
6601
  "enableJsonFlag": true,
6577
- "title": "Unused Connected Apps in an org",
6578
- "allowedInactiveConnectedApps": [
6579
- "Ant Migration Tool",
6580
- "Chatter Desktop",
6581
- "Chatter Mobile for BlackBerry",
6582
- "Force.com IDE",
6583
- "OIQ_Integration",
6584
- "Salesforce CLI",
6585
- "Salesforce Files",
6586
- "Salesforce Mobile Dashboards",
6587
- "Salesforce Touch",
6588
- "Salesforce for Outlook",
6589
- "SalesforceA",
6590
- "SalesforceA for Android",
6591
- "SalesforceA for iOS",
6592
- "SalesforceDX Namespace Registry",
6593
- "SalesforceIQ"
6594
- ],
6602
+ "title": "Detect Unsecured Connected Apps",
6595
6603
  "requiresProject": false,
6596
6604
  "isESM": true,
6597
6605
  "relativePath": [
@@ -6600,43 +6608,43 @@
6600
6608
  "hardis",
6601
6609
  "org",
6602
6610
  "diagnose",
6603
- "unused-connected-apps.js"
6611
+ "unsecure-connected-apps.js"
6604
6612
  ],
6605
6613
  "aliasPermutations": [],
6606
6614
  "permutations": [
6607
- "hardis:org:diagnose:unused-connected-apps",
6608
- "org:hardis:diagnose:unused-connected-apps",
6609
- "org:diagnose:hardis:unused-connected-apps",
6610
- "org:diagnose:unused-connected-apps:hardis",
6611
- "hardis:diagnose:org:unused-connected-apps",
6612
- "diagnose:hardis:org:unused-connected-apps",
6613
- "diagnose:org:hardis:unused-connected-apps",
6614
- "diagnose:org:unused-connected-apps:hardis",
6615
- "hardis:diagnose:unused-connected-apps:org",
6616
- "diagnose:hardis:unused-connected-apps:org",
6617
- "diagnose:unused-connected-apps:hardis:org",
6618
- "diagnose:unused-connected-apps:org:hardis",
6619
- "hardis:org:unused-connected-apps:diagnose",
6620
- "org:hardis:unused-connected-apps:diagnose",
6621
- "org:unused-connected-apps:hardis:diagnose",
6622
- "org:unused-connected-apps:diagnose:hardis",
6623
- "hardis:unused-connected-apps:org:diagnose",
6624
- "unused-connected-apps:hardis:org:diagnose",
6625
- "unused-connected-apps:org:hardis:diagnose",
6626
- "unused-connected-apps:org:diagnose:hardis",
6627
- "hardis:unused-connected-apps:diagnose:org",
6628
- "unused-connected-apps:hardis:diagnose:org",
6629
- "unused-connected-apps:diagnose:hardis:org",
6630
- "unused-connected-apps:diagnose:org:hardis"
6615
+ "hardis:org:diagnose:unsecure-connected-apps",
6616
+ "org:hardis:diagnose:unsecure-connected-apps",
6617
+ "org:diagnose:hardis:unsecure-connected-apps",
6618
+ "org:diagnose:unsecure-connected-apps:hardis",
6619
+ "hardis:diagnose:org:unsecure-connected-apps",
6620
+ "diagnose:hardis:org:unsecure-connected-apps",
6621
+ "diagnose:org:hardis:unsecure-connected-apps",
6622
+ "diagnose:org:unsecure-connected-apps:hardis",
6623
+ "hardis:diagnose:unsecure-connected-apps:org",
6624
+ "diagnose:hardis:unsecure-connected-apps:org",
6625
+ "diagnose:unsecure-connected-apps:hardis:org",
6626
+ "diagnose:unsecure-connected-apps:org:hardis",
6627
+ "hardis:org:unsecure-connected-apps:diagnose",
6628
+ "org:hardis:unsecure-connected-apps:diagnose",
6629
+ "org:unsecure-connected-apps:hardis:diagnose",
6630
+ "org:unsecure-connected-apps:diagnose:hardis",
6631
+ "hardis:unsecure-connected-apps:org:diagnose",
6632
+ "unsecure-connected-apps:hardis:org:diagnose",
6633
+ "unsecure-connected-apps:org:hardis:diagnose",
6634
+ "unsecure-connected-apps:org:diagnose:hardis",
6635
+ "hardis:unsecure-connected-apps:diagnose:org",
6636
+ "unsecure-connected-apps:hardis:diagnose:org",
6637
+ "unsecure-connected-apps:diagnose:hardis:org",
6638
+ "unsecure-connected-apps:diagnose:org:hardis"
6631
6639
  ]
6632
6640
  },
6633
- "hardis:org:diagnose:unusedlicenses": {
6641
+ "hardis:org:diagnose:unused-apex-classes": {
6634
6642
  "aliases": [],
6635
6643
  "args": {},
6636
- "description": "\n## Command Behavior\n\n**Detects and suggests the deletion of unused Permission Set License Assignments in a Salesforce org.**\n\nWhen a Permission Set (PS) linked to a Permission Set License (PSL) is assigned to a user, a Permission Set License Assignment (PSLA) is automatically created. However, when that PS is unassigned from the user, the PSLA is *not* automatically deleted. This can lead to organizations being charged for unused PSLAs, representing a hidden cost and technical debt.\n\nThis command identifies such useless PSLAs and provides options to delete them, helping to optimize license usage and reduce unnecessary expenses.\n\nKey functionalities:\n\n- **PSLA Detection:** Queries the Salesforce org to find all active PSLAs.\n- **Usage Verification:** Correlates PSLAs with actual Permission Set Assignments and Permission Set Group Assignments to determine if the underlying Permission Sets are still assigned to the user.\n- **Special Case Handling:** Accounts for specific scenarios where profiles might implicitly assign PSLAs (e.g., `Salesforce API Only` profile assigning `SalesforceAPIIntegrationPsl`) and allows for always excluding certain PSLAs from the unused check.\n- **Reporting:** Generates a CSV report of all identified unused PSLAs, including the user and the associated Permission Set License.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of unused PSLAs.\n- **Interactive Deletion:** In non-CI environments, it offers an interactive prompt to bulk delete the identified unused PSLAs.\n\nMany thanks to [Vincent Finet](https://www.linkedin.com/in/vincentfinet/) for the inspiration during his great speaker session at [French Touch Dreamin '23](https://frenchtouchdreamin.com/), and his kind agreement for reusing such inspiration in this command :)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-licenses/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves extensive querying of Salesforce objects and data correlation:\n\n- **SOQL Queries (Bulk API):** It uses `bulkQuery` and `bulkQueryChunksIn` to efficiently retrieve large volumes of data from `PermissionSetLicenseAssign`, `PermissionSetLicense`, `PermissionSet`, `PermissionSetGroupComponent`, and `PermissionSetAssignment` objects.\n- **Data Correlation:** It meticulously correlates data across these objects to determine if a `PermissionSetLicenseAssign` record has a corresponding active assignment to a Permission Set or Permission Set Group for the same user.\n- **Filtering Logic:** It applies complex filtering logic to exclude PSLAs that are genuinely in use or are part of predefined exceptions (e.g., `alwaysExcludeForActiveUsersPermissionSetLicenses`).\n- **Bulk Deletion:** If the user opts to delete unused PSLAs, it uses `bulkUpdate` with the `delete` operation to efficiently remove multiple records.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused PSLAs.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Interaction:** Uses `prompts` for interactive confirmation before performing deletion operations.\n</details>\n",
6644
+ "description": "List all async Apex classes (Batch,Queueable,Schedulable) that has not been called for more than 365 days.\n \nThe result class list probably can be removed from the project, and that will improve your test classes performances :)\n\nThe number of unused day is overridable using --days option. \n\nThe command uses queries on AsyncApexJob and CronTrigger technical tables to build the result.\n\nApex Classes CreatedBy and CreatedOn fields are calculated from MIN(date from git, date from org)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-apex-classes/) and can output Grafana, Slack and MsTeams Notifications.\n\n![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-monitoring-unused-apex-grafana.jpg)\n",
6637
6645
  "examples": [
6638
- "$ sf hardis:org:diagnose:unusedlicenses",
6639
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
6646
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6647
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6640
6648
  ],
6641
6649
  "flags": {
6642
6650
  "json": {
@@ -6662,6 +6670,14 @@
6662
6670
  "multiple": false,
6663
6671
  "type": "option"
6664
6672
  },
6673
+ "days": {
6674
+ "char": "t",
6675
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6676
+ "name": "days",
6677
+ "hasDynamicHelp": false,
6678
+ "multiple": false,
6679
+ "type": "option"
6680
+ },
6665
6681
  "debug": {
6666
6682
  "char": "d",
6667
6683
  "description": "Activate debug mode (more logs)",
@@ -6700,32 +6716,14 @@
6700
6716
  },
6701
6717
  "hasDynamicHelp": true,
6702
6718
  "hiddenAliases": [],
6703
- "id": "hardis:org:diagnose:unusedlicenses",
6719
+ "id": "hardis:org:diagnose:unused-apex-classes",
6704
6720
  "pluginAlias": "sfdx-hardis",
6705
6721
  "pluginName": "sfdx-hardis",
6706
6722
  "pluginType": "core",
6707
6723
  "strict": true,
6708
6724
  "enableJsonFlag": true,
6709
- "title": "Detect unused Permission Set Licenses (beta)",
6725
+ "title": "Detect unused Apex classes in an org",
6710
6726
  "requiresProject": false,
6711
- "additionalPermissionSetsToAlwaysGet": [
6712
- "Sales_User"
6713
- ],
6714
- "permSetsPermSetLicenses": [
6715
- {
6716
- "permSet": "Sales_User",
6717
- "permSetLicense": "SalesUserPsl"
6718
- }
6719
- ],
6720
- "profilesPermissionSetLicenses": [
6721
- {
6722
- "profile": "Salesforce API Only",
6723
- "permSetLicense": "SalesforceAPIIntegrationPsl"
6724
- }
6725
- ],
6726
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6727
- "IdentityConnect"
6728
- ],
6729
6727
  "isESM": true,
6730
6728
  "relativePath": [
6731
6729
  "lib",
@@ -6733,46 +6731,42 @@
6733
6731
  "hardis",
6734
6732
  "org",
6735
6733
  "diagnose",
6736
- "unusedlicenses.js"
6734
+ "unused-apex-classes.js"
6737
6735
  ],
6738
6736
  "aliasPermutations": [],
6739
6737
  "permutations": [
6740
- "hardis:org:diagnose:unusedlicenses",
6741
- "org:hardis:diagnose:unusedlicenses",
6742
- "org:diagnose:hardis:unusedlicenses",
6743
- "org:diagnose:unusedlicenses:hardis",
6744
- "hardis:diagnose:org:unusedlicenses",
6745
- "diagnose:hardis:org:unusedlicenses",
6746
- "diagnose:org:hardis:unusedlicenses",
6747
- "diagnose:org:unusedlicenses:hardis",
6748
- "hardis:diagnose:unusedlicenses:org",
6749
- "diagnose:hardis:unusedlicenses:org",
6750
- "diagnose:unusedlicenses:hardis:org",
6751
- "diagnose:unusedlicenses:org:hardis",
6752
- "hardis:org:unusedlicenses:diagnose",
6753
- "org:hardis:unusedlicenses:diagnose",
6754
- "org:unusedlicenses:hardis:diagnose",
6755
- "org:unusedlicenses:diagnose:hardis",
6756
- "hardis:unusedlicenses:org:diagnose",
6757
- "unusedlicenses:hardis:org:diagnose",
6758
- "unusedlicenses:org:hardis:diagnose",
6759
- "unusedlicenses:org:diagnose:hardis",
6760
- "hardis:unusedlicenses:diagnose:org",
6761
- "unusedlicenses:hardis:diagnose:org",
6762
- "unusedlicenses:diagnose:hardis:org",
6763
- "unusedlicenses:diagnose:org:hardis"
6738
+ "hardis:org:diagnose:unused-apex-classes",
6739
+ "org:hardis:diagnose:unused-apex-classes",
6740
+ "org:diagnose:hardis:unused-apex-classes",
6741
+ "org:diagnose:unused-apex-classes:hardis",
6742
+ "hardis:diagnose:org:unused-apex-classes",
6743
+ "diagnose:hardis:org:unused-apex-classes",
6744
+ "diagnose:org:hardis:unused-apex-classes",
6745
+ "diagnose:org:unused-apex-classes:hardis",
6746
+ "hardis:diagnose:unused-apex-classes:org",
6747
+ "diagnose:hardis:unused-apex-classes:org",
6748
+ "diagnose:unused-apex-classes:hardis:org",
6749
+ "diagnose:unused-apex-classes:org:hardis",
6750
+ "hardis:org:unused-apex-classes:diagnose",
6751
+ "org:hardis:unused-apex-classes:diagnose",
6752
+ "org:unused-apex-classes:hardis:diagnose",
6753
+ "org:unused-apex-classes:diagnose:hardis",
6754
+ "hardis:unused-apex-classes:org:diagnose",
6755
+ "unused-apex-classes:hardis:org:diagnose",
6756
+ "unused-apex-classes:org:hardis:diagnose",
6757
+ "unused-apex-classes:org:diagnose:hardis",
6758
+ "hardis:unused-apex-classes:diagnose:org",
6759
+ "unused-apex-classes:hardis:diagnose:org",
6760
+ "unused-apex-classes:diagnose:hardis:org",
6761
+ "unused-apex-classes:diagnose:org:hardis"
6764
6762
  ]
6765
6763
  },
6766
- "hardis:org:diagnose:unusedusers": {
6764
+ "hardis:org:diagnose:unused-connected-apps": {
6767
6765
  "aliases": [],
6768
6766
  "args": {},
6769
- "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>",
6767
+ "description": "\n## Command Behavior\n\n**Identifies and reports on potentially unused Connected Apps in a Salesforce org, suggesting candidates for deletion or deactivation.**\n\nThis command helps improve org security and reduce technical debt by pinpointing Connected Apps that are no longer actively used. Connected Apps can pose security risks if left unmonitored, and cleaning them up contributes to a healthier Salesforce environment.\n\nKey functionalities:\n\n- **Connected App Data Collection:** Gathers information about all Connected Apps in the org, including creation and last modified dates, and associated users.\n- **Usage Analysis:** Analyzes `LoginHistory` and `OAuthToken` records to determine the last usage date of each Connected App.\n- **Inactivity Detection:** Flags Connected Apps as potentially unused if they have no recent login history or OAuth token usage.\n- **Accessibility Check:** Examines Connected App metadata to identify if they are accessible (e.g., if they require admin approval and have no profiles or permission sets assigned).\n- **Ignored Apps:** Automatically ignores a predefined list of common Salesforce Connected Apps (e.g., `Salesforce CLI`, `Salesforce Mobile Dashboards`). You can extend this list by defining the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n- **CSV Report Generation:** Generates a CSV file containing details of all analyzed Connected Apps, including their usage status, last usage date, and reasons for being flagged as potentially unused.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of potentially unused Connected Apps.\n\n**Default Ignored Connected Apps:**\n\n- Ant Migration Tool\n- Chatter Desktop\n- Chatter Mobile for BlackBerry\n- Force.com IDE\n- OIQ_Integration\n- Salesforce CLI\n- Salesforce Files\n- Salesforce Mobile Dashboards\n- Salesforce Touch\n- Salesforce for Outlook\n- SalesforceA\n- SalesforceA for Android\n- SalesforceA for iOS\n- SalesforceDX Namespace Registry\n- SalesforceIQ\n\nYou can add more ignored apps by defining a comma-separated list of names in the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n\n_Example: \nALLOWED_INACTIVE_CONNECTED_APPS=My App 1,My App 2, My App 3_\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-connected-apps/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It performs SOQL queries against `ConnectedApplication`, `LoginHistory`, and `OAuthToken` objects to gather comprehensive data about Connected Apps and their usage.\n- **Temporary SFDX Project:** It creates a temporary SFDX project to retrieve Connected App metadata, allowing for local parsing and analysis of their XML files.\n- **Metadata Parsing:** It parses the `connectedApp-meta.xml` files to check for `isAdminApproved` and the presence of `profileName` or `permissionsetName` to determine accessibility.\n- **Data Correlation:** It correlates data from various Salesforce objects to build a complete picture of each Connected App's usage and status.\n- **Date Calculation:** Uses `moment` to calculate the time since the last OAuth token usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused Connected Apps.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **File System Operations:** Uses `fs-extra` for creating and removing temporary directories and files.\n- **Environment Variable Reading:** Reads the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable to customize the list of ignored Connected Apps.\n</details>\n",
6770
6768
  "examples": [
6771
- "$ sf hardis:org:diagnose:unusedusers",
6772
- "$ sf hardis:org:diagnose:unusedusers --days 365",
6773
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6774
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6775
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6769
+ "$ sf hardis:org:diagnose:unused-connected-apps"
6776
6770
  ],
6777
6771
  "flags": {
6778
6772
  "json": {
@@ -6798,41 +6792,6 @@
6798
6792
  "multiple": false,
6799
6793
  "type": "option"
6800
6794
  },
6801
- "days": {
6802
- "char": "t",
6803
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6804
- "name": "days",
6805
- "hasDynamicHelp": false,
6806
- "multiple": false,
6807
- "type": "option"
6808
- },
6809
- "licensetypes": {
6810
- "char": "l",
6811
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6812
- "name": "licensetypes",
6813
- "hasDynamicHelp": false,
6814
- "multiple": false,
6815
- "options": [
6816
- "all",
6817
- "all-crm",
6818
- "all-paying"
6819
- ],
6820
- "type": "option"
6821
- },
6822
- "licenseidentifiers": {
6823
- "char": "i",
6824
- "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",
6825
- "name": "licenseidentifiers",
6826
- "hasDynamicHelp": false,
6827
- "multiple": false,
6828
- "type": "option"
6829
- },
6830
- "returnactiveusers": {
6831
- "description": "Inverts the command by returning the active users",
6832
- "name": "returnactiveusers",
6833
- "allowNo": false,
6834
- "type": "boolean"
6835
- },
6836
6795
  "debug": {
6837
6796
  "char": "d",
6838
6797
  "description": "Activate debug mode (more logs)",
@@ -6871,13 +6830,30 @@
6871
6830
  },
6872
6831
  "hasDynamicHelp": true,
6873
6832
  "hiddenAliases": [],
6874
- "id": "hardis:org:diagnose:unusedusers",
6833
+ "id": "hardis:org:diagnose:unused-connected-apps",
6875
6834
  "pluginAlias": "sfdx-hardis",
6876
6835
  "pluginName": "sfdx-hardis",
6877
6836
  "pluginType": "core",
6878
6837
  "strict": true,
6879
6838
  "enableJsonFlag": true,
6880
- "title": "Detect unused Users in Salesforce",
6839
+ "title": "Unused Connected Apps in an org",
6840
+ "allowedInactiveConnectedApps": [
6841
+ "Ant Migration Tool",
6842
+ "Chatter Desktop",
6843
+ "Chatter Mobile for BlackBerry",
6844
+ "Force.com IDE",
6845
+ "OIQ_Integration",
6846
+ "Salesforce CLI",
6847
+ "Salesforce Files",
6848
+ "Salesforce Mobile Dashboards",
6849
+ "Salesforce Touch",
6850
+ "Salesforce for Outlook",
6851
+ "SalesforceA",
6852
+ "SalesforceA for Android",
6853
+ "SalesforceA for iOS",
6854
+ "SalesforceDX Namespace Registry",
6855
+ "SalesforceIQ"
6856
+ ],
6881
6857
  "requiresProject": false,
6882
6858
  "isESM": true,
6883
6859
  "relativePath": [
@@ -6886,44 +6862,43 @@
6886
6862
  "hardis",
6887
6863
  "org",
6888
6864
  "diagnose",
6889
- "unusedusers.js"
6865
+ "unused-connected-apps.js"
6890
6866
  ],
6891
6867
  "aliasPermutations": [],
6892
6868
  "permutations": [
6893
- "hardis:org:diagnose:unusedusers",
6894
- "org:hardis:diagnose:unusedusers",
6895
- "org:diagnose:hardis:unusedusers",
6896
- "org:diagnose:unusedusers:hardis",
6897
- "hardis:diagnose:org:unusedusers",
6898
- "diagnose:hardis:org:unusedusers",
6899
- "diagnose:org:hardis:unusedusers",
6900
- "diagnose:org:unusedusers:hardis",
6901
- "hardis:diagnose:unusedusers:org",
6902
- "diagnose:hardis:unusedusers:org",
6903
- "diagnose:unusedusers:hardis:org",
6904
- "diagnose:unusedusers:org:hardis",
6905
- "hardis:org:unusedusers:diagnose",
6906
- "org:hardis:unusedusers:diagnose",
6907
- "org:unusedusers:hardis:diagnose",
6908
- "org:unusedusers:diagnose:hardis",
6909
- "hardis:unusedusers:org:diagnose",
6910
- "unusedusers:hardis:org:diagnose",
6911
- "unusedusers:org:hardis:diagnose",
6912
- "unusedusers:org:diagnose:hardis",
6913
- "hardis:unusedusers:diagnose:org",
6914
- "unusedusers:hardis:diagnose:org",
6915
- "unusedusers:diagnose:hardis:org",
6916
- "unusedusers:diagnose:org:hardis"
6869
+ "hardis:org:diagnose:unused-connected-apps",
6870
+ "org:hardis:diagnose:unused-connected-apps",
6871
+ "org:diagnose:hardis:unused-connected-apps",
6872
+ "org:diagnose:unused-connected-apps:hardis",
6873
+ "hardis:diagnose:org:unused-connected-apps",
6874
+ "diagnose:hardis:org:unused-connected-apps",
6875
+ "diagnose:org:hardis:unused-connected-apps",
6876
+ "diagnose:org:unused-connected-apps:hardis",
6877
+ "hardis:diagnose:unused-connected-apps:org",
6878
+ "diagnose:hardis:unused-connected-apps:org",
6879
+ "diagnose:unused-connected-apps:hardis:org",
6880
+ "diagnose:unused-connected-apps:org:hardis",
6881
+ "hardis:org:unused-connected-apps:diagnose",
6882
+ "org:hardis:unused-connected-apps:diagnose",
6883
+ "org:unused-connected-apps:hardis:diagnose",
6884
+ "org:unused-connected-apps:diagnose:hardis",
6885
+ "hardis:unused-connected-apps:org:diagnose",
6886
+ "unused-connected-apps:hardis:org:diagnose",
6887
+ "unused-connected-apps:org:hardis:diagnose",
6888
+ "unused-connected-apps:org:diagnose:hardis",
6889
+ "hardis:unused-connected-apps:diagnose:org",
6890
+ "unused-connected-apps:hardis:diagnose:org",
6891
+ "unused-connected-apps:diagnose:hardis:org",
6892
+ "unused-connected-apps:diagnose:org:hardis"
6917
6893
  ]
6918
6894
  },
6919
- "hardis:org:generate:packagexmlfull": {
6895
+ "hardis:org:diagnose:unusedlicenses": {
6920
6896
  "aliases": [],
6921
6897
  "args": {},
6922
- "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
6898
+ "description": "\n## Command Behavior\n\n**Detects and suggests the deletion of unused Permission Set License Assignments in a Salesforce org.**\n\nWhen a Permission Set (PS) linked to a Permission Set License (PSL) is assigned to a user, a Permission Set License Assignment (PSLA) is automatically created. However, when that PS is unassigned from the user, the PSLA is *not* automatically deleted. This can lead to organizations being charged for unused PSLAs, representing a hidden cost and technical debt.\n\nThis command identifies such useless PSLAs and provides options to delete them, helping to optimize license usage and reduce unnecessary expenses.\n\nKey functionalities:\n\n- **PSLA Detection:** Queries the Salesforce org to find all active PSLAs.\n- **Usage Verification:** Correlates PSLAs with actual Permission Set Assignments and Permission Set Group Assignments to determine if the underlying Permission Sets are still assigned to the user.\n- **Special Case Handling:** Accounts for specific scenarios where profiles might implicitly assign PSLAs (e.g., `Salesforce API Only` profile assigning `SalesforceAPIIntegrationPsl`) and allows for always excluding certain PSLAs from the unused check.\n- **Reporting:** Generates a CSV report of all identified unused PSLAs, including the user and the associated Permission Set License.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of unused PSLAs.\n- **Interactive Deletion:** In non-CI environments, it offers an interactive prompt to bulk delete the identified unused PSLAs.\n\nMany thanks to [Vincent Finet](https://www.linkedin.com/in/vincentfinet/) for the inspiration during his great speaker session at [French Touch Dreamin '23](https://frenchtouchdreamin.com/), and his kind agreement for reusing such inspiration in this command :)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-licenses/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves extensive querying of Salesforce objects and data correlation:\n\n- **SOQL Queries (Bulk API):** It uses `bulkQuery` and `bulkQueryChunksIn` to efficiently retrieve large volumes of data from `PermissionSetLicenseAssign`, `PermissionSetLicense`, `PermissionSet`, `PermissionSetGroupComponent`, and `PermissionSetAssignment` objects.\n- **Data Correlation:** It meticulously correlates data across these objects to determine if a `PermissionSetLicenseAssign` record has a corresponding active assignment to a Permission Set or Permission Set Group for the same user.\n- **Filtering Logic:** It applies complex filtering logic to exclude PSLAs that are genuinely in use or are part of predefined exceptions (e.g., `alwaysExcludeForActiveUsersPermissionSetLicenses`).\n- **Bulk Deletion:** If the user opts to delete unused PSLAs, it uses `bulkUpdate` with the `delete` operation to efficiently remove multiple records.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused PSLAs.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Interaction:** Uses `prompts` for interactive confirmation before performing deletion operations.\n</details>\n",
6923
6899
  "examples": [
6924
- "$ sf hardis:org:generate:packagexmlfull",
6925
- "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
6926
- "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
6900
+ "$ sf hardis:org:diagnose:unusedlicenses",
6901
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
6927
6902
  ],
6928
6903
  "flags": {
6929
6904
  "json": {
@@ -6942,7 +6917,8 @@
6942
6917
  "type": "option"
6943
6918
  },
6944
6919
  "outputfile": {
6945
- "description": "Output package.xml file",
6920
+ "char": "f",
6921
+ "description": "Force the path and name of output report file. Must end with .csv",
6946
6922
  "name": "outputfile",
6947
6923
  "hasDynamicHelp": false,
6948
6924
  "multiple": false,
@@ -6955,13 +6931,6 @@
6955
6931
  "allowNo": false,
6956
6932
  "type": "boolean"
6957
6933
  },
6958
- "no-prompt": {
6959
- "char": "n",
6960
- "description": "Do not prompt for org username, use the default one",
6961
- "name": "no-prompt",
6962
- "allowNo": false,
6963
- "type": "boolean"
6964
- },
6965
6934
  "websocket": {
6966
6935
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
6967
6936
  "name": "websocket",
@@ -6993,57 +6962,79 @@
6993
6962
  },
6994
6963
  "hasDynamicHelp": true,
6995
6964
  "hiddenAliases": [],
6996
- "id": "hardis:org:generate:packagexmlfull",
6965
+ "id": "hardis:org:diagnose:unusedlicenses",
6997
6966
  "pluginAlias": "sfdx-hardis",
6998
6967
  "pluginName": "sfdx-hardis",
6999
6968
  "pluginType": "core",
7000
6969
  "strict": true,
7001
6970
  "enableJsonFlag": true,
7002
- "title": "Generate Full Org package.xml",
6971
+ "title": "Detect unused Permission Set Licenses (beta)",
7003
6972
  "requiresProject": false,
6973
+ "additionalPermissionSetsToAlwaysGet": [
6974
+ "Sales_User"
6975
+ ],
6976
+ "permSetsPermSetLicenses": [
6977
+ {
6978
+ "permSet": "Sales_User",
6979
+ "permSetLicense": "SalesUserPsl"
6980
+ }
6981
+ ],
6982
+ "profilesPermissionSetLicenses": [
6983
+ {
6984
+ "profile": "Salesforce API Only",
6985
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
6986
+ }
6987
+ ],
6988
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6989
+ "IdentityConnect"
6990
+ ],
7004
6991
  "isESM": true,
7005
6992
  "relativePath": [
7006
6993
  "lib",
7007
6994
  "commands",
7008
6995
  "hardis",
7009
6996
  "org",
7010
- "generate",
7011
- "packagexmlfull.js"
6997
+ "diagnose",
6998
+ "unusedlicenses.js"
7012
6999
  ],
7013
7000
  "aliasPermutations": [],
7014
7001
  "permutations": [
7015
- "hardis:org:generate:packagexmlfull",
7016
- "org:hardis:generate:packagexmlfull",
7017
- "org:generate:hardis:packagexmlfull",
7018
- "org:generate:packagexmlfull:hardis",
7019
- "hardis:generate:org:packagexmlfull",
7020
- "generate:hardis:org:packagexmlfull",
7021
- "generate:org:hardis:packagexmlfull",
7022
- "generate:org:packagexmlfull:hardis",
7023
- "hardis:generate:packagexmlfull:org",
7024
- "generate:hardis:packagexmlfull:org",
7025
- "generate:packagexmlfull:hardis:org",
7026
- "generate:packagexmlfull:org:hardis",
7027
- "hardis:org:packagexmlfull:generate",
7028
- "org:hardis:packagexmlfull:generate",
7029
- "org:packagexmlfull:hardis:generate",
7030
- "org:packagexmlfull:generate:hardis",
7031
- "hardis:packagexmlfull:org:generate",
7032
- "packagexmlfull:hardis:org:generate",
7033
- "packagexmlfull:org:hardis:generate",
7034
- "packagexmlfull:org:generate:hardis",
7035
- "hardis:packagexmlfull:generate:org",
7036
- "packagexmlfull:hardis:generate:org",
7037
- "packagexmlfull:generate:hardis:org",
7038
- "packagexmlfull:generate:org:hardis"
7002
+ "hardis:org:diagnose:unusedlicenses",
7003
+ "org:hardis:diagnose:unusedlicenses",
7004
+ "org:diagnose:hardis:unusedlicenses",
7005
+ "org:diagnose:unusedlicenses:hardis",
7006
+ "hardis:diagnose:org:unusedlicenses",
7007
+ "diagnose:hardis:org:unusedlicenses",
7008
+ "diagnose:org:hardis:unusedlicenses",
7009
+ "diagnose:org:unusedlicenses:hardis",
7010
+ "hardis:diagnose:unusedlicenses:org",
7011
+ "diagnose:hardis:unusedlicenses:org",
7012
+ "diagnose:unusedlicenses:hardis:org",
7013
+ "diagnose:unusedlicenses:org:hardis",
7014
+ "hardis:org:unusedlicenses:diagnose",
7015
+ "org:hardis:unusedlicenses:diagnose",
7016
+ "org:unusedlicenses:hardis:diagnose",
7017
+ "org:unusedlicenses:diagnose:hardis",
7018
+ "hardis:unusedlicenses:org:diagnose",
7019
+ "unusedlicenses:hardis:org:diagnose",
7020
+ "unusedlicenses:org:hardis:diagnose",
7021
+ "unusedlicenses:org:diagnose:hardis",
7022
+ "hardis:unusedlicenses:diagnose:org",
7023
+ "unusedlicenses:hardis:diagnose:org",
7024
+ "unusedlicenses:diagnose:hardis:org",
7025
+ "unusedlicenses:diagnose:org:hardis"
7039
7026
  ]
7040
7027
  },
7041
- "hardis:org:files:export": {
7028
+ "hardis:org:diagnose:unusedusers": {
7042
7029
  "aliases": [],
7043
7030
  "args": {},
7044
- "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, and output naming conventions.\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.\n- **File Download:** Downloads the actual file content from Salesforce.\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 and `promptFilesExportConfiguration` for customizing export options.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues or API limits.\n</details>\n",
7031
+ "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>",
7045
7032
  "examples": [
7046
- "$ sf hardis:org:files:export"
7033
+ "$ sf hardis:org:diagnose:unusedusers",
7034
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
7035
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7036
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7037
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7047
7038
  ],
7048
7039
  "flags": {
7049
7040
  "json": {
@@ -7061,41 +7052,49 @@
7061
7052
  "multiple": false,
7062
7053
  "type": "option"
7063
7054
  },
7064
- "path": {
7065
- "char": "p",
7066
- "description": "Path to the file export project",
7067
- "name": "path",
7055
+ "outputfile": {
7056
+ "char": "f",
7057
+ "description": "Force the path and name of output report file. Must end with .csv",
7058
+ "name": "outputfile",
7068
7059
  "hasDynamicHelp": false,
7069
7060
  "multiple": false,
7070
7061
  "type": "option"
7071
7062
  },
7072
- "chunksize": {
7073
- "char": "c",
7074
- "description": "Number of records to add in a chunk before it is processed",
7075
- "name": "chunksize",
7076
- "default": 1000,
7063
+ "days": {
7064
+ "char": "t",
7065
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7066
+ "name": "days",
7077
7067
  "hasDynamicHelp": false,
7078
7068
  "multiple": false,
7079
7069
  "type": "option"
7080
7070
  },
7081
- "polltimeout": {
7082
- "char": "t",
7083
- "description": "Timeout in MS for Bulk API calls",
7084
- "name": "polltimeout",
7085
- "default": 300000,
7071
+ "licensetypes": {
7072
+ "char": "l",
7073
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7074
+ "name": "licensetypes",
7086
7075
  "hasDynamicHelp": false,
7087
7076
  "multiple": false,
7077
+ "options": [
7078
+ "all",
7079
+ "all-crm",
7080
+ "all-paying"
7081
+ ],
7088
7082
  "type": "option"
7089
7083
  },
7090
- "startchunknumber": {
7091
- "char": "s",
7092
- "description": "Chunk number to start from",
7093
- "name": "startchunknumber",
7094
- "default": 0,
7084
+ "licenseidentifiers": {
7085
+ "char": "i",
7086
+ "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",
7087
+ "name": "licenseidentifiers",
7095
7088
  "hasDynamicHelp": false,
7096
7089
  "multiple": false,
7097
7090
  "type": "option"
7098
7091
  },
7092
+ "returnactiveusers": {
7093
+ "description": "Inverts the command by returning the active users",
7094
+ "name": "returnactiveusers",
7095
+ "allowNo": false,
7096
+ "type": "boolean"
7097
+ },
7099
7098
  "debug": {
7100
7099
  "char": "d",
7101
7100
  "description": "Activate debug mode (more logs)",
@@ -7134,13 +7133,13 @@
7134
7133
  },
7135
7134
  "hasDynamicHelp": true,
7136
7135
  "hiddenAliases": [],
7137
- "id": "hardis:org:files:export",
7136
+ "id": "hardis:org:diagnose:unusedusers",
7138
7137
  "pluginAlias": "sfdx-hardis",
7139
7138
  "pluginName": "sfdx-hardis",
7140
7139
  "pluginType": "core",
7141
7140
  "strict": true,
7142
7141
  "enableJsonFlag": true,
7143
- "title": "Export files",
7142
+ "title": "Detect unused Users in Salesforce",
7144
7143
  "requiresProject": false,
7145
7144
  "isESM": true,
7146
7145
  "relativePath": [
@@ -7148,43 +7147,45 @@
7148
7147
  "commands",
7149
7148
  "hardis",
7150
7149
  "org",
7151
- "files",
7152
- "export.js"
7150
+ "diagnose",
7151
+ "unusedusers.js"
7153
7152
  ],
7154
7153
  "aliasPermutations": [],
7155
7154
  "permutations": [
7156
- "hardis:org:files:export",
7157
- "org:hardis:files:export",
7158
- "org:files:hardis:export",
7159
- "org:files:export:hardis",
7160
- "hardis:files:org:export",
7161
- "files:hardis:org:export",
7162
- "files:org:hardis:export",
7163
- "files:org:export:hardis",
7164
- "hardis:files:export:org",
7165
- "files:hardis:export:org",
7166
- "files:export:hardis:org",
7167
- "files:export:org:hardis",
7168
- "hardis:org:export:files",
7169
- "org:hardis:export:files",
7170
- "org:export:hardis:files",
7171
- "org:export:files:hardis",
7172
- "hardis:export:org:files",
7173
- "export:hardis:org:files",
7174
- "export:org:hardis:files",
7175
- "export:org:files:hardis",
7176
- "hardis:export:files:org",
7177
- "export:hardis:files:org",
7178
- "export:files:hardis:org",
7179
- "export:files:org:hardis"
7155
+ "hardis:org:diagnose:unusedusers",
7156
+ "org:hardis:diagnose:unusedusers",
7157
+ "org:diagnose:hardis:unusedusers",
7158
+ "org:diagnose:unusedusers:hardis",
7159
+ "hardis:diagnose:org:unusedusers",
7160
+ "diagnose:hardis:org:unusedusers",
7161
+ "diagnose:org:hardis:unusedusers",
7162
+ "diagnose:org:unusedusers:hardis",
7163
+ "hardis:diagnose:unusedusers:org",
7164
+ "diagnose:hardis:unusedusers:org",
7165
+ "diagnose:unusedusers:hardis:org",
7166
+ "diagnose:unusedusers:org:hardis",
7167
+ "hardis:org:unusedusers:diagnose",
7168
+ "org:hardis:unusedusers:diagnose",
7169
+ "org:unusedusers:hardis:diagnose",
7170
+ "org:unusedusers:diagnose:hardis",
7171
+ "hardis:unusedusers:org:diagnose",
7172
+ "unusedusers:hardis:org:diagnose",
7173
+ "unusedusers:org:hardis:diagnose",
7174
+ "unusedusers:org:diagnose:hardis",
7175
+ "hardis:unusedusers:diagnose:org",
7176
+ "unusedusers:hardis:diagnose:org",
7177
+ "unusedusers:diagnose:hardis:org",
7178
+ "unusedusers:diagnose:org:hardis"
7180
7179
  ]
7181
7180
  },
7182
- "hardis:org:files:import": {
7181
+ "hardis:org:generate:packagexmlfull": {
7183
7182
  "aliases": [],
7184
7183
  "args": {},
7185
- "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",
7184
+ "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
7186
7185
  "examples": [
7187
- "$ sf hardis:org:files:import"
7186
+ "$ sf hardis:org:generate:packagexmlfull",
7187
+ "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
7188
+ "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
7188
7189
  ],
7189
7190
  "flags": {
7190
7191
  "json": {
@@ -7202,21 +7203,13 @@
7202
7203
  "multiple": false,
7203
7204
  "type": "option"
7204
7205
  },
7205
- "path": {
7206
- "char": "p",
7207
- "description": "Path to the file export project",
7208
- "name": "path",
7206
+ "outputfile": {
7207
+ "description": "Output package.xml file",
7208
+ "name": "outputfile",
7209
7209
  "hasDynamicHelp": false,
7210
7210
  "multiple": false,
7211
7211
  "type": "option"
7212
7212
  },
7213
- "overwrite": {
7214
- "char": "f",
7215
- "description": "Override existing files (doubles the number of API calls)",
7216
- "name": "overwrite",
7217
- "allowNo": false,
7218
- "type": "boolean"
7219
- },
7220
7213
  "debug": {
7221
7214
  "char": "d",
7222
7215
  "description": "Activate debug mode (more logs)",
@@ -7224,6 +7217,13 @@
7224
7217
  "allowNo": false,
7225
7218
  "type": "boolean"
7226
7219
  },
7220
+ "no-prompt": {
7221
+ "char": "n",
7222
+ "description": "Do not prompt for org username, use the default one",
7223
+ "name": "no-prompt",
7224
+ "allowNo": false,
7225
+ "type": "boolean"
7226
+ },
7227
7227
  "websocket": {
7228
7228
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
7229
7229
  "name": "websocket",
@@ -7255,13 +7255,13 @@
7255
7255
  },
7256
7256
  "hasDynamicHelp": true,
7257
7257
  "hiddenAliases": [],
7258
- "id": "hardis:org:files:import",
7258
+ "id": "hardis:org:generate:packagexmlfull",
7259
7259
  "pluginAlias": "sfdx-hardis",
7260
7260
  "pluginName": "sfdx-hardis",
7261
7261
  "pluginType": "core",
7262
7262
  "strict": true,
7263
7263
  "enableJsonFlag": true,
7264
- "title": "Import files",
7264
+ "title": "Generate Full Org package.xml",
7265
7265
  "requiresProject": false,
7266
7266
  "isESM": true,
7267
7267
  "relativePath": [
@@ -7269,35 +7269,35 @@
7269
7269
  "commands",
7270
7270
  "hardis",
7271
7271
  "org",
7272
- "files",
7273
- "import.js"
7272
+ "generate",
7273
+ "packagexmlfull.js"
7274
7274
  ],
7275
7275
  "aliasPermutations": [],
7276
7276
  "permutations": [
7277
- "hardis:org:files:import",
7278
- "org:hardis:files:import",
7279
- "org:files:hardis:import",
7280
- "org:files:import:hardis",
7281
- "hardis:files:org:import",
7282
- "files:hardis:org:import",
7283
- "files:org:hardis:import",
7284
- "files:org:import:hardis",
7285
- "hardis:files:import:org",
7286
- "files:hardis:import:org",
7287
- "files:import:hardis:org",
7288
- "files:import:org:hardis",
7289
- "hardis:org:import:files",
7290
- "org:hardis:import:files",
7291
- "org:import:hardis:files",
7292
- "org:import:files:hardis",
7293
- "hardis:import:org:files",
7294
- "import:hardis:org:files",
7295
- "import:org:hardis:files",
7296
- "import:org:files:hardis",
7297
- "hardis:import:files:org",
7298
- "import:hardis:files:org",
7299
- "import:files:hardis:org",
7300
- "import:files:org:hardis"
7277
+ "hardis:org:generate:packagexmlfull",
7278
+ "org:hardis:generate:packagexmlfull",
7279
+ "org:generate:hardis:packagexmlfull",
7280
+ "org:generate:packagexmlfull:hardis",
7281
+ "hardis:generate:org:packagexmlfull",
7282
+ "generate:hardis:org:packagexmlfull",
7283
+ "generate:org:hardis:packagexmlfull",
7284
+ "generate:org:packagexmlfull:hardis",
7285
+ "hardis:generate:packagexmlfull:org",
7286
+ "generate:hardis:packagexmlfull:org",
7287
+ "generate:packagexmlfull:hardis:org",
7288
+ "generate:packagexmlfull:org:hardis",
7289
+ "hardis:org:packagexmlfull:generate",
7290
+ "org:hardis:packagexmlfull:generate",
7291
+ "org:packagexmlfull:hardis:generate",
7292
+ "org:packagexmlfull:generate:hardis",
7293
+ "hardis:packagexmlfull:org:generate",
7294
+ "packagexmlfull:hardis:org:generate",
7295
+ "packagexmlfull:org:hardis:generate",
7296
+ "packagexmlfull:org:generate:hardis",
7297
+ "hardis:packagexmlfull:generate:org",
7298
+ "packagexmlfull:hardis:generate:org",
7299
+ "packagexmlfull:generate:hardis:org",
7300
+ "packagexmlfull:generate:org:hardis"
7301
7301
  ]
7302
7302
  },
7303
7303
  "hardis:org:monitor:all": {
@@ -9811,109 +9811,6 @@
9811
9811
  "auth:configure:project:hardis"
9812
9812
  ]
9813
9813
  },
9814
- "hardis:project:convert:profilestopermsets": {
9815
- "aliases": [],
9816
- "args": {},
9817
- "description": "\n## Command Behavior\n\n**Converts existing Salesforce Profiles into Permission Sets, facilitating a more granular and recommended security model.**\n\nThis command helps in migrating permissions from Profiles to Permission Sets, which is a best practice for managing user access in Salesforce. It creates a new Permission Set for each specified Profile, adopting a naming convention of `PS_PROFILENAME`.\n\nKey functionalities:\n\n- **Profile to Permission Set Conversion:** Automatically extracts permissions from a Profile and creates a corresponding Permission Set.\n- **Naming Convention:** New Permission Sets are named with a `PS_` prefix followed by the Profile name (e.g., `PS_Standard_User`).\n- **Exclusion Filter:** Allows you to exclude specific Profiles from the conversion process using the `--except` flag.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **External Plugin Integration:** It relies on the `shane-sfdx-plugins` (specifically the `sf shane:profile:convert` command) to perform the actual conversion.\n- **File System Scan:** It reads the contents of the `force-app/main/default/profiles` directory to identify all available Profile metadata files.\n- **Command Execution:** For each identified Profile (that is not excluded), it constructs and executes the `sf shane:profile:convert` command with the appropriate Profile name and desired Permission Set name.\n- **Error Handling:** Includes basic error handling for the external command execution.\n</details>\n",
9818
- "examples": [
9819
- "$ sf hardis:project:convert:profilestopermsets"
9820
- ],
9821
- "flags": {
9822
- "json": {
9823
- "description": "Format output as json.",
9824
- "helpGroup": "GLOBAL",
9825
- "name": "json",
9826
- "allowNo": false,
9827
- "type": "boolean"
9828
- },
9829
- "flags-dir": {
9830
- "helpGroup": "GLOBAL",
9831
- "name": "flags-dir",
9832
- "summary": "Import flag values from a directory.",
9833
- "hasDynamicHelp": false,
9834
- "multiple": false,
9835
- "type": "option"
9836
- },
9837
- "except": {
9838
- "char": "e",
9839
- "description": "List of filters",
9840
- "name": "except",
9841
- "default": [],
9842
- "hasDynamicHelp": false,
9843
- "multiple": true,
9844
- "type": "option"
9845
- },
9846
- "debug": {
9847
- "char": "d",
9848
- "description": "Activate debug mode (more logs)",
9849
- "name": "debug",
9850
- "allowNo": false,
9851
- "type": "boolean"
9852
- },
9853
- "websocket": {
9854
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
9855
- "name": "websocket",
9856
- "hasDynamicHelp": false,
9857
- "multiple": false,
9858
- "type": "option"
9859
- },
9860
- "skipauth": {
9861
- "description": "Skip authentication check when a default username is required",
9862
- "name": "skipauth",
9863
- "allowNo": false,
9864
- "type": "boolean"
9865
- }
9866
- },
9867
- "hasDynamicHelp": false,
9868
- "hiddenAliases": [],
9869
- "id": "hardis:project:convert:profilestopermsets",
9870
- "pluginAlias": "sfdx-hardis",
9871
- "pluginName": "sfdx-hardis",
9872
- "pluginType": "core",
9873
- "strict": true,
9874
- "enableJsonFlag": true,
9875
- "title": "Convert Profiles into Permission Sets",
9876
- "requiresProject": true,
9877
- "requiresSfdxPlugins": [
9878
- "shane-sfdx-plugins"
9879
- ],
9880
- "isESM": true,
9881
- "relativePath": [
9882
- "lib",
9883
- "commands",
9884
- "hardis",
9885
- "project",
9886
- "convert",
9887
- "profilestopermsets.js"
9888
- ],
9889
- "aliasPermutations": [],
9890
- "permutations": [
9891
- "hardis:project:convert:profilestopermsets",
9892
- "project:hardis:convert:profilestopermsets",
9893
- "project:convert:hardis:profilestopermsets",
9894
- "project:convert:profilestopermsets:hardis",
9895
- "hardis:convert:project:profilestopermsets",
9896
- "convert:hardis:project:profilestopermsets",
9897
- "convert:project:hardis:profilestopermsets",
9898
- "convert:project:profilestopermsets:hardis",
9899
- "hardis:convert:profilestopermsets:project",
9900
- "convert:hardis:profilestopermsets:project",
9901
- "convert:profilestopermsets:hardis:project",
9902
- "convert:profilestopermsets:project:hardis",
9903
- "hardis:project:profilestopermsets:convert",
9904
- "project:hardis:profilestopermsets:convert",
9905
- "project:profilestopermsets:hardis:convert",
9906
- "project:profilestopermsets:convert:hardis",
9907
- "hardis:profilestopermsets:project:convert",
9908
- "profilestopermsets:hardis:project:convert",
9909
- "profilestopermsets:project:hardis:convert",
9910
- "profilestopermsets:project:convert:hardis",
9911
- "hardis:profilestopermsets:convert:project",
9912
- "profilestopermsets:hardis:convert:project",
9913
- "profilestopermsets:convert:hardis:project",
9914
- "profilestopermsets:convert:project:hardis"
9915
- ]
9916
- },
9917
9814
  "hardis:project:clean:emptyitems": {
9918
9815
  "aliases": [],
9919
9816
  "args": {},
@@ -11399,6 +11296,109 @@
11399
11296
  "xml:clean:project:hardis"
11400
11297
  ]
11401
11298
  },
11299
+ "hardis:project:convert:profilestopermsets": {
11300
+ "aliases": [],
11301
+ "args": {},
11302
+ "description": "\n## Command Behavior\n\n**Converts existing Salesforce Profiles into Permission Sets, facilitating a more granular and recommended security model.**\n\nThis command helps in migrating permissions from Profiles to Permission Sets, which is a best practice for managing user access in Salesforce. It creates a new Permission Set for each specified Profile, adopting a naming convention of `PS_PROFILENAME`.\n\nKey functionalities:\n\n- **Profile to Permission Set Conversion:** Automatically extracts permissions from a Profile and creates a corresponding Permission Set.\n- **Naming Convention:** New Permission Sets are named with a `PS_` prefix followed by the Profile name (e.g., `PS_Standard_User`).\n- **Exclusion Filter:** Allows you to exclude specific Profiles from the conversion process using the `--except` flag.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **External Plugin Integration:** It relies on the `shane-sfdx-plugins` (specifically the `sf shane:profile:convert` command) to perform the actual conversion.\n- **File System Scan:** It reads the contents of the `force-app/main/default/profiles` directory to identify all available Profile metadata files.\n- **Command Execution:** For each identified Profile (that is not excluded), it constructs and executes the `sf shane:profile:convert` command with the appropriate Profile name and desired Permission Set name.\n- **Error Handling:** Includes basic error handling for the external command execution.\n</details>\n",
11303
+ "examples": [
11304
+ "$ sf hardis:project:convert:profilestopermsets"
11305
+ ],
11306
+ "flags": {
11307
+ "json": {
11308
+ "description": "Format output as json.",
11309
+ "helpGroup": "GLOBAL",
11310
+ "name": "json",
11311
+ "allowNo": false,
11312
+ "type": "boolean"
11313
+ },
11314
+ "flags-dir": {
11315
+ "helpGroup": "GLOBAL",
11316
+ "name": "flags-dir",
11317
+ "summary": "Import flag values from a directory.",
11318
+ "hasDynamicHelp": false,
11319
+ "multiple": false,
11320
+ "type": "option"
11321
+ },
11322
+ "except": {
11323
+ "char": "e",
11324
+ "description": "List of filters",
11325
+ "name": "except",
11326
+ "default": [],
11327
+ "hasDynamicHelp": false,
11328
+ "multiple": true,
11329
+ "type": "option"
11330
+ },
11331
+ "debug": {
11332
+ "char": "d",
11333
+ "description": "Activate debug mode (more logs)",
11334
+ "name": "debug",
11335
+ "allowNo": false,
11336
+ "type": "boolean"
11337
+ },
11338
+ "websocket": {
11339
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
11340
+ "name": "websocket",
11341
+ "hasDynamicHelp": false,
11342
+ "multiple": false,
11343
+ "type": "option"
11344
+ },
11345
+ "skipauth": {
11346
+ "description": "Skip authentication check when a default username is required",
11347
+ "name": "skipauth",
11348
+ "allowNo": false,
11349
+ "type": "boolean"
11350
+ }
11351
+ },
11352
+ "hasDynamicHelp": false,
11353
+ "hiddenAliases": [],
11354
+ "id": "hardis:project:convert:profilestopermsets",
11355
+ "pluginAlias": "sfdx-hardis",
11356
+ "pluginName": "sfdx-hardis",
11357
+ "pluginType": "core",
11358
+ "strict": true,
11359
+ "enableJsonFlag": true,
11360
+ "title": "Convert Profiles into Permission Sets",
11361
+ "requiresProject": true,
11362
+ "requiresSfdxPlugins": [
11363
+ "shane-sfdx-plugins"
11364
+ ],
11365
+ "isESM": true,
11366
+ "relativePath": [
11367
+ "lib",
11368
+ "commands",
11369
+ "hardis",
11370
+ "project",
11371
+ "convert",
11372
+ "profilestopermsets.js"
11373
+ ],
11374
+ "aliasPermutations": [],
11375
+ "permutations": [
11376
+ "hardis:project:convert:profilestopermsets",
11377
+ "project:hardis:convert:profilestopermsets",
11378
+ "project:convert:hardis:profilestopermsets",
11379
+ "project:convert:profilestopermsets:hardis",
11380
+ "hardis:convert:project:profilestopermsets",
11381
+ "convert:hardis:project:profilestopermsets",
11382
+ "convert:project:hardis:profilestopermsets",
11383
+ "convert:project:profilestopermsets:hardis",
11384
+ "hardis:convert:profilestopermsets:project",
11385
+ "convert:hardis:profilestopermsets:project",
11386
+ "convert:profilestopermsets:hardis:project",
11387
+ "convert:profilestopermsets:project:hardis",
11388
+ "hardis:project:profilestopermsets:convert",
11389
+ "project:hardis:profilestopermsets:convert",
11390
+ "project:profilestopermsets:hardis:convert",
11391
+ "project:profilestopermsets:convert:hardis",
11392
+ "hardis:profilestopermsets:project:convert",
11393
+ "profilestopermsets:hardis:project:convert",
11394
+ "profilestopermsets:project:hardis:convert",
11395
+ "profilestopermsets:project:convert:hardis",
11396
+ "hardis:profilestopermsets:convert:project",
11397
+ "profilestopermsets:hardis:convert:project",
11398
+ "profilestopermsets:convert:hardis:project",
11399
+ "profilestopermsets:convert:project:hardis"
11400
+ ]
11401
+ },
11402
11402
  "hardis:project:deploy:notify": {
11403
11403
  "aliases": [],
11404
11404
  "args": {},
@@ -15271,5 +15271,5 @@
15271
15271
  ]
15272
15272
  }
15273
15273
  },
15274
- "version": "6.4.1-beta202509082207.0"
15274
+ "version": "6.4.1"
15275
15275
  }