sfdx-hardis 6.12.3 → 6.12.5

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.
@@ -57,13 +57,12 @@
57
57
  "world:hello"
58
58
  ]
59
59
  },
60
- "hardis:auth:login": {
60
+ "hardis:cache:clear": {
61
61
  "aliases": [],
62
62
  "args": {},
63
- "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
63
+ "description": "\n## Command Behavior\n\n**Clears the local cache generated by the sfdx-hardis plugin.**\n\nThis command is designed to remove temporary files, stored configurations, and other cached data that sfdx-hardis uses to optimize its operations. Clearing the cache can be beneficial for:\n\n- **Troubleshooting:** Resolving unexpected behavior or inconsistencies.\n- **Disk Space Management:** Freeing up storage on your local machine.\n- **Ensuring Fresh Data:** Guaranteeing that the plugin operates with the most current data and configurations.\n\n## Technical explanations\n\nThe command's technical implementation is straightforward:\n\n- **Direct Function Call:** It directly invokes the `clearCache()` function, which is imported from \buri../../../common/cache/index.js\buri.\n- **Cache Management Logic:** The \buriclearCache()` function encapsulates the logic for identifying and removing the specific files and directories that constitute the sfdx-hardis cache.\n",
64
64
  "examples": [
65
- "$ sf hardis:auth:login",
66
- "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
65
+ "$ sf hardis:cache:clear"
67
66
  ],
68
67
  "flags": {
69
68
  "json": {
@@ -81,28 +80,6 @@
81
80
  "multiple": false,
82
81
  "type": "option"
83
82
  },
84
- "instanceurl": {
85
- "char": "r",
86
- "description": "URL of org instance",
87
- "name": "instanceurl",
88
- "hasDynamicHelp": false,
89
- "multiple": false,
90
- "type": "option"
91
- },
92
- "devhub": {
93
- "char": "h",
94
- "description": "Also connect associated DevHub",
95
- "name": "devhub",
96
- "allowNo": false,
97
- "type": "boolean"
98
- },
99
- "scratchorg": {
100
- "char": "s",
101
- "description": "Scratch org",
102
- "name": "scratchorg",
103
- "allowNo": false,
104
- "type": "boolean"
105
- },
106
83
  "debug": {
107
84
  "char": "d",
108
85
  "description": "Activate debug mode (more logs)",
@@ -126,38 +103,41 @@
126
103
  },
127
104
  "hasDynamicHelp": false,
128
105
  "hiddenAliases": [],
129
- "id": "hardis:auth:login",
106
+ "id": "hardis:cache:clear",
130
107
  "pluginAlias": "sfdx-hardis",
131
108
  "pluginName": "sfdx-hardis",
132
109
  "pluginType": "core",
133
110
  "strict": true,
134
111
  "enableJsonFlag": true,
135
- "title": "Login",
112
+ "title": "Clear sfdx-hardis cache",
113
+ "uiConfig": {
114
+ "hide": true
115
+ },
136
116
  "requiresProject": false,
137
117
  "isESM": true,
138
118
  "relativePath": [
139
119
  "lib",
140
120
  "commands",
141
121
  "hardis",
142
- "auth",
143
- "login.js"
122
+ "cache",
123
+ "clear.js"
144
124
  ],
145
125
  "aliasPermutations": [],
146
126
  "permutations": [
147
- "hardis:auth:login",
148
- "auth:hardis:login",
149
- "auth:login:hardis",
150
- "hardis:login:auth",
151
- "login:hardis:auth",
152
- "login:auth:hardis"
127
+ "hardis:cache:clear",
128
+ "cache:hardis:clear",
129
+ "cache:clear:hardis",
130
+ "hardis:clear:cache",
131
+ "clear:hardis:cache",
132
+ "clear:cache:hardis"
153
133
  ]
154
134
  },
155
- "hardis:cache:clear": {
135
+ "hardis:config:get": {
156
136
  "aliases": [],
157
137
  "args": {},
158
- "description": "\n## Command Behavior\n\n**Clears the local cache generated by the sfdx-hardis plugin.**\n\nThis command is designed to remove temporary files, stored configurations, and other cached data that sfdx-hardis uses to optimize its operations. Clearing the cache can be beneficial for:\n\n- **Troubleshooting:** Resolving unexpected behavior or inconsistencies.\n- **Disk Space Management:** Freeing up storage on your local machine.\n- **Ensuring Fresh Data:** Guaranteeing that the plugin operates with the most current data and configurations.\n\n## Technical explanations\n\nThe command's technical implementation is straightforward:\n\n- **Direct Function Call:** It directly invokes the `clearCache()` function, which is imported from \buri../../../common/cache/index.js\buri.\n- **Cache Management Logic:** The \buriclearCache()` function encapsulates the logic for identifying and removing the specific files and directories that constitute the sfdx-hardis cache.\n",
138
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the sfdx-hardis configuration for a specified level.**\n\nThis command allows you to inspect the configuration that is currently in effect for your project, which is useful for debugging and understanding how sfdx-hardis will behave.\n\n- **Configuration levels:** It can retrieve configuration from three different levels:\n - **Project:** The configuration defined in the project's `.sfdx-hardis.yml` file.\n - **Branch:** The configuration defined in a branch-specific configuration file (e.g., `.sfdx-hardis.production.yml`).\n - **User:** The global user-level configuration.\n\n## Technical explanations\n\nThe command's logic is straightforward:\n\n- **`getConfig` function:** It calls the `getConfig` utility function, passing the desired configuration level as an argument.\n- **Configuration loading:** The `getConfig` function is responsible for finding the appropriate configuration file, reading its contents, and parsing it as YAML or JSON.\n- **Output:** The retrieved configuration is then displayed to the user as a JSON string.\n",
159
139
  "examples": [
160
- "$ sf hardis:cache:clear"
140
+ "$ sf hardis:project:deploy:sources:metadata"
161
141
  ],
162
142
  "flags": {
163
143
  "json": {
@@ -175,6 +155,20 @@
175
155
  "multiple": false,
176
156
  "type": "option"
177
157
  },
158
+ "level": {
159
+ "char": "l",
160
+ "description": "project,branch or user",
161
+ "name": "level",
162
+ "default": "project",
163
+ "hasDynamicHelp": false,
164
+ "multiple": false,
165
+ "options": [
166
+ "project",
167
+ "branch",
168
+ "user"
169
+ ],
170
+ "type": "option"
171
+ },
178
172
  "debug": {
179
173
  "char": "d",
180
174
  "description": "Activate debug mode (more logs)",
@@ -198,41 +192,39 @@
198
192
  },
199
193
  "hasDynamicHelp": false,
200
194
  "hiddenAliases": [],
201
- "id": "hardis:cache:clear",
195
+ "id": "hardis:config:get",
202
196
  "pluginAlias": "sfdx-hardis",
203
197
  "pluginName": "sfdx-hardis",
204
198
  "pluginType": "core",
205
199
  "strict": true,
206
200
  "enableJsonFlag": true,
207
- "title": "Clear sfdx-hardis cache",
208
- "uiConfig": {
209
- "hide": true
210
- },
201
+ "title": "Deploy metadata sources to org",
211
202
  "requiresProject": false,
212
203
  "isESM": true,
213
204
  "relativePath": [
214
205
  "lib",
215
206
  "commands",
216
207
  "hardis",
217
- "cache",
218
- "clear.js"
208
+ "config",
209
+ "get.js"
219
210
  ],
220
211
  "aliasPermutations": [],
221
212
  "permutations": [
222
- "hardis:cache:clear",
223
- "cache:hardis:clear",
224
- "cache:clear:hardis",
225
- "hardis:clear:cache",
226
- "clear:hardis:cache",
227
- "clear:cache:hardis"
213
+ "hardis:config:get",
214
+ "config:hardis:get",
215
+ "config:get:hardis",
216
+ "hardis:get:config",
217
+ "get:hardis:config",
218
+ "get:config:hardis"
228
219
  ]
229
220
  },
230
- "hardis:config:get": {
221
+ "hardis:auth:login": {
231
222
  "aliases": [],
232
223
  "args": {},
233
- "description": "\n## Command Behavior\n\n**Retrieves and displays the sfdx-hardis configuration for a specified level.**\n\nThis command allows you to inspect the configuration that is currently in effect for your project, which is useful for debugging and understanding how sfdx-hardis will behave.\n\n- **Configuration levels:** It can retrieve configuration from three different levels:\n - **Project:** The configuration defined in the project's `.sfdx-hardis.yml` file.\n - **Branch:** The configuration defined in a branch-specific configuration file (e.g., `.sfdx-hardis.production.yml`).\n - **User:** The global user-level configuration.\n\n## Technical explanations\n\nThe command's logic is straightforward:\n\n- **`getConfig` function:** It calls the `getConfig` utility function, passing the desired configuration level as an argument.\n- **Configuration loading:** The `getConfig` function is responsible for finding the appropriate configuration file, reading its contents, and parsing it as YAML or JSON.\n- **Output:** The retrieved configuration is then displayed to the user as a JSON string.\n",
224
+ "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
234
225
  "examples": [
235
- "$ sf hardis:project:deploy:sources:metadata"
226
+ "$ sf hardis:auth:login",
227
+ "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
236
228
  ],
237
229
  "flags": {
238
230
  "json": {
@@ -250,20 +242,28 @@
250
242
  "multiple": false,
251
243
  "type": "option"
252
244
  },
253
- "level": {
254
- "char": "l",
255
- "description": "project,branch or user",
256
- "name": "level",
257
- "default": "project",
245
+ "instanceurl": {
246
+ "char": "r",
247
+ "description": "URL of org instance",
248
+ "name": "instanceurl",
258
249
  "hasDynamicHelp": false,
259
250
  "multiple": false,
260
- "options": [
261
- "project",
262
- "branch",
263
- "user"
264
- ],
265
251
  "type": "option"
266
252
  },
253
+ "devhub": {
254
+ "char": "h",
255
+ "description": "Also connect associated DevHub",
256
+ "name": "devhub",
257
+ "allowNo": false,
258
+ "type": "boolean"
259
+ },
260
+ "scratchorg": {
261
+ "char": "s",
262
+ "description": "Scratch org",
263
+ "name": "scratchorg",
264
+ "allowNo": false,
265
+ "type": "boolean"
266
+ },
267
267
  "debug": {
268
268
  "char": "d",
269
269
  "description": "Activate debug mode (more logs)",
@@ -287,30 +287,30 @@
287
287
  },
288
288
  "hasDynamicHelp": false,
289
289
  "hiddenAliases": [],
290
- "id": "hardis:config:get",
290
+ "id": "hardis:auth:login",
291
291
  "pluginAlias": "sfdx-hardis",
292
292
  "pluginName": "sfdx-hardis",
293
293
  "pluginType": "core",
294
294
  "strict": true,
295
295
  "enableJsonFlag": true,
296
- "title": "Deploy metadata sources to org",
296
+ "title": "Login",
297
297
  "requiresProject": false,
298
298
  "isESM": true,
299
299
  "relativePath": [
300
300
  "lib",
301
301
  "commands",
302
302
  "hardis",
303
- "config",
304
- "get.js"
303
+ "auth",
304
+ "login.js"
305
305
  ],
306
306
  "aliasPermutations": [],
307
307
  "permutations": [
308
- "hardis:config:get",
309
- "config:hardis:get",
310
- "config:get:hardis",
311
- "hardis:get:config",
312
- "get:hardis:config",
313
- "get:config:hardis"
308
+ "hardis:auth:login",
309
+ "auth:hardis:login",
310
+ "auth:login:hardis",
311
+ "hardis:login:auth",
312
+ "login:hardis:auth",
313
+ "login:auth:hardis"
314
314
  ]
315
315
  },
316
316
  "hardis:doc:fieldusage": {
@@ -4741,13 +4741,12 @@
4741
4741
  "extract:pull-requests:git:hardis"
4742
4742
  ]
4743
4743
  },
4744
- "hardis:org:community:update": {
4744
+ "hardis:org:configure:data": {
4745
4745
  "aliases": [],
4746
4746
  "args": {},
4747
- "description": "\n## Command Behavior\n\n**Updates the status of one or more Salesforce Experience Cloud (Community) networks.**\n\nThis command provides a way to programmatically change the status of your Salesforce Communities, allowing you to manage their availability. This is particularly useful for:\n\n- **Maintenance:** Taking communities offline for planned maintenance (`DownForMaintenance`).\n- **Activation/Deactivation:** Bringing communities online or offline (`Live`, `DownForMaintenance`).\n- **Automation:** Integrating community status changes into CI/CD pipelines or scheduled jobs.\n\nKey functionalities:\n\n- **Network Selection:** You can specify one or more community network names (separated by commas) using the `--name` flag.\n- **Status Update:** You can set the new status for the selected communities using the `--status` flag. Supported values are `Live` and `DownForMaintenance`.\n- **Confirmation Prompt:** In non-CI environments, it provides a confirmation prompt before executing the update, ensuring intentional changes.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the Salesforce `Network` object using SOQL to retrieve the `Id`, `Name`, and `Status` of the specified communities. This ensures that only existing communities are targeted.\n- **SObject Update:** It then constructs an array of `Network` sObjects with their `Id` and the new `Status` and performs a DML update operation using `conn.sobject(\"Network\").update()`. The `allOrNone: false` option is used to allow partial success in case some updates fail.\n- **Error Handling and Reporting:** It iterates through the update results, logging success or failure for each community. It also provides a summary of successful and erroneous updates.\n- **User Interaction:** Uses `prompts` to confirm the update action with the user when not running in a CI environment.\n- **Salesforce Connection:** Establishes a connection to the target Salesforce org using the `target-org` flag.\n</details>\n",
4747
+ "description": "\n## Command Behavior\n\n**Configures a Salesforce Data Migration Utility (SFDMU) project for data export and import operations.**\n\nThis command assists in setting up SFDMU workspaces, which are essential for managing data within your Salesforce environments. It streamlines the creation of `export.json` files and related configurations, enabling efficient data seeding, migration, and synchronization.\n\nKey functionalities:\n\n- **Template-Based Configuration:** Allows you to choose from predefined SFDMU templates or start with a blank configuration. Templates can pre-populate `export.json` with common data migration scenarios.\n- **Interactive Setup:** Guides you through the process of defining the SFDMU project folder name, label, and description.\n- **`export.json` Generation:** Creates the `export.json` file, which is the core configuration file for SFDMU, defining objects to export/import, queries, and operations.\n- **Additional File Generation:** Can generate additional configuration files, such as a `badwords.json` file for data filtering scenarios.\n- **Scratch Org Integration:** Offers to automatically configure the SFDMU project to be used for data import when initializing a new scratch org, ensuring consistent test data across development environments.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SFDMU Integration:** It acts as a setup wizard for SFDMU, generating the necessary configuration files that the `sfdmu` plugin consumes.\n- **Interactive Prompts:** Uses the `prompts` library to gather user input for various configuration parameters, such as the data path, label, and description.\n- **File System Operations:** Employs `fs-extra` to create directories (e.g., `data/your-project-name/`) and write the `export.json` and any additional configuration files.\n- **JSON Manipulation:** Constructs the `export.json` content dynamically based on user input and selected templates, including defining objects, queries, and operations.\n- **PascalCase Conversion:** Uses `pascalcase` to format the SFDMU folder name consistently.\n- **Configuration Persistence:** Updates the project's `sfdx-hardis.yml` file (via `setConfig`) to include the newly configured data package if it's intended for scratch org initialization.\n- **WebSocket Communication:** Uses `WebSocketClient.requestOpenFile` to open the generated `export.json` file in VS Code, facilitating immediate configuration.\n- **Required Plugin Check:** Explicitly lists `sfdmu` as a required plugin, ensuring the necessary dependency is present.\n</details>\n",
4748
4748
  "examples": [
4749
- "$ sf hardis:org:community:update --name 'MyNetworkName' --status DownForMaintenance",
4750
- "$ sf hardis:org:community:update --name 'MyNetworkName,MySecondNetworkName' --status Live"
4749
+ "$ sf hardis:org:configure:data"
4751
4750
  ],
4752
4751
  "flags": {
4753
4752
  "json": {
@@ -4765,24 +4764,6 @@
4765
4764
  "multiple": false,
4766
4765
  "type": "option"
4767
4766
  },
4768
- "name": {
4769
- "char": "n",
4770
- "description": "List of Networks Names that you want to update, separated by comma",
4771
- "name": "name",
4772
- "required": true,
4773
- "hasDynamicHelp": false,
4774
- "multiple": false,
4775
- "type": "option"
4776
- },
4777
- "status": {
4778
- "char": "s",
4779
- "description": "New status for the community, available values are: Live, DownForMaintenance",
4780
- "name": "status",
4781
- "required": true,
4782
- "hasDynamicHelp": false,
4783
- "multiple": false,
4784
- "type": "option"
4785
- },
4786
4767
  "debug": {
4787
4768
  "char": "d",
4788
4769
  "description": "Activate debug mode (more logs)",
@@ -4790,133 +4771,41 @@
4790
4771
  "allowNo": false,
4791
4772
  "type": "boolean"
4792
4773
  },
4793
- "target-org": {
4794
- "aliases": [
4795
- "targetusername",
4796
- "u"
4797
- ],
4798
- "char": "o",
4799
- "deprecateAliases": true,
4800
- "name": "target-org",
4801
- "noCacheDefault": true,
4802
- "required": true,
4803
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
4804
- "hasDynamicHelp": true,
4774
+ "websocket": {
4775
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4776
+ "name": "websocket",
4777
+ "hasDynamicHelp": false,
4805
4778
  "multiple": false,
4806
4779
  "type": "option"
4780
+ },
4781
+ "skipauth": {
4782
+ "description": "Skip authentication check when a default username is required",
4783
+ "name": "skipauth",
4784
+ "allowNo": false,
4785
+ "type": "boolean"
4807
4786
  }
4808
4787
  },
4809
- "hasDynamicHelp": true,
4788
+ "hasDynamicHelp": false,
4810
4789
  "hiddenAliases": [],
4811
- "id": "hardis:org:community:update",
4790
+ "id": "hardis:org:configure:data",
4812
4791
  "pluginAlias": "sfdx-hardis",
4813
4792
  "pluginName": "sfdx-hardis",
4814
4793
  "pluginType": "core",
4815
4794
  "strict": true,
4816
- "summary": "Update a community status.",
4817
4795
  "enableJsonFlag": true,
4796
+ "title": "Configure Data project",
4797
+ "requiresProject": false,
4798
+ "requiresSfdxPlugins": [
4799
+ "sfdmu"
4800
+ ],
4818
4801
  "isESM": true,
4819
4802
  "relativePath": [
4820
4803
  "lib",
4821
4804
  "commands",
4822
4805
  "hardis",
4823
4806
  "org",
4824
- "community",
4825
- "update.js"
4826
- ],
4827
- "aliasPermutations": [],
4828
- "permutations": [
4829
- "hardis:org:community:update",
4830
- "org:hardis:community:update",
4831
- "org:community:hardis:update",
4832
- "org:community:update:hardis",
4833
- "hardis:community:org:update",
4834
- "community:hardis:org:update",
4835
- "community:org:hardis:update",
4836
- "community:org:update:hardis",
4837
- "hardis:community:update:org",
4838
- "community:hardis:update:org",
4839
- "community:update:hardis:org",
4840
- "community:update:org:hardis",
4841
- "hardis:org:update:community",
4842
- "org:hardis:update:community",
4843
- "org:update:hardis:community",
4844
- "org:update:community:hardis",
4845
- "hardis:update:org:community",
4846
- "update:hardis:org:community",
4847
- "update:org:hardis:community",
4848
- "update:org:community:hardis",
4849
- "hardis:update:community:org",
4850
- "update:hardis:community:org",
4851
- "update:community:hardis:org",
4852
- "update:community:org:hardis"
4853
- ]
4854
- },
4855
- "hardis:org:configure:data": {
4856
- "aliases": [],
4857
- "args": {},
4858
- "description": "\n## Command Behavior\n\n**Configures a Salesforce Data Migration Utility (SFDMU) project for data export and import operations.**\n\nThis command assists in setting up SFDMU workspaces, which are essential for managing data within your Salesforce environments. It streamlines the creation of `export.json` files and related configurations, enabling efficient data seeding, migration, and synchronization.\n\nKey functionalities:\n\n- **Template-Based Configuration:** Allows you to choose from predefined SFDMU templates or start with a blank configuration. Templates can pre-populate `export.json` with common data migration scenarios.\n- **Interactive Setup:** Guides you through the process of defining the SFDMU project folder name, label, and description.\n- **`export.json` Generation:** Creates the `export.json` file, which is the core configuration file for SFDMU, defining objects to export/import, queries, and operations.\n- **Additional File Generation:** Can generate additional configuration files, such as a `badwords.json` file for data filtering scenarios.\n- **Scratch Org Integration:** Offers to automatically configure the SFDMU project to be used for data import when initializing a new scratch org, ensuring consistent test data across development environments.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SFDMU Integration:** It acts as a setup wizard for SFDMU, generating the necessary configuration files that the `sfdmu` plugin consumes.\n- **Interactive Prompts:** Uses the `prompts` library to gather user input for various configuration parameters, such as the data path, label, and description.\n- **File System Operations:** Employs `fs-extra` to create directories (e.g., `data/your-project-name/`) and write the `export.json` and any additional configuration files.\n- **JSON Manipulation:** Constructs the `export.json` content dynamically based on user input and selected templates, including defining objects, queries, and operations.\n- **PascalCase Conversion:** Uses `pascalcase` to format the SFDMU folder name consistently.\n- **Configuration Persistence:** Updates the project's `sfdx-hardis.yml` file (via `setConfig`) to include the newly configured data package if it's intended for scratch org initialization.\n- **WebSocket Communication:** Uses `WebSocketClient.requestOpenFile` to open the generated `export.json` file in VS Code, facilitating immediate configuration.\n- **Required Plugin Check:** Explicitly lists `sfdmu` as a required plugin, ensuring the necessary dependency is present.\n</details>\n",
4859
- "examples": [
4860
- "$ sf hardis:org:configure:data"
4861
- ],
4862
- "flags": {
4863
- "json": {
4864
- "description": "Format output as json.",
4865
- "helpGroup": "GLOBAL",
4866
- "name": "json",
4867
- "allowNo": false,
4868
- "type": "boolean"
4869
- },
4870
- "flags-dir": {
4871
- "helpGroup": "GLOBAL",
4872
- "name": "flags-dir",
4873
- "summary": "Import flag values from a directory.",
4874
- "hasDynamicHelp": false,
4875
- "multiple": false,
4876
- "type": "option"
4877
- },
4878
- "debug": {
4879
- "char": "d",
4880
- "description": "Activate debug mode (more logs)",
4881
- "name": "debug",
4882
- "allowNo": false,
4883
- "type": "boolean"
4884
- },
4885
- "websocket": {
4886
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
4887
- "name": "websocket",
4888
- "hasDynamicHelp": false,
4889
- "multiple": false,
4890
- "type": "option"
4891
- },
4892
- "skipauth": {
4893
- "description": "Skip authentication check when a default username is required",
4894
- "name": "skipauth",
4895
- "allowNo": false,
4896
- "type": "boolean"
4897
- }
4898
- },
4899
- "hasDynamicHelp": false,
4900
- "hiddenAliases": [],
4901
- "id": "hardis:org:configure:data",
4902
- "pluginAlias": "sfdx-hardis",
4903
- "pluginName": "sfdx-hardis",
4904
- "pluginType": "core",
4905
- "strict": true,
4906
- "enableJsonFlag": true,
4907
- "title": "Configure Data project",
4908
- "requiresProject": false,
4909
- "requiresSfdxPlugins": [
4910
- "sfdmu"
4911
- ],
4912
- "isESM": true,
4913
- "relativePath": [
4914
- "lib",
4915
- "commands",
4916
- "hardis",
4917
- "org",
4918
- "configure",
4919
- "data.js"
4807
+ "configure",
4808
+ "data.js"
4920
4809
  ],
4921
4810
  "aliasPermutations": [],
4922
4811
  "permutations": [
@@ -5153,6 +5042,117 @@
5153
5042
  "monitoring:configure:org:hardis"
5154
5043
  ]
5155
5044
  },
5045
+ "hardis:org:community:update": {
5046
+ "aliases": [],
5047
+ "args": {},
5048
+ "description": "\n## Command Behavior\n\n**Updates the status of one or more Salesforce Experience Cloud (Community) networks.**\n\nThis command provides a way to programmatically change the status of your Salesforce Communities, allowing you to manage their availability. This is particularly useful for:\n\n- **Maintenance:** Taking communities offline for planned maintenance (`DownForMaintenance`).\n- **Activation/Deactivation:** Bringing communities online or offline (`Live`, `DownForMaintenance`).\n- **Automation:** Integrating community status changes into CI/CD pipelines or scheduled jobs.\n\nKey functionalities:\n\n- **Network Selection:** You can specify one or more community network names (separated by commas) using the `--name` flag.\n- **Status Update:** You can set the new status for the selected communities using the `--status` flag. Supported values are `Live` and `DownForMaintenance`.\n- **Confirmation Prompt:** In non-CI environments, it provides a confirmation prompt before executing the update, ensuring intentional changes.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the Salesforce `Network` object using SOQL to retrieve the `Id`, `Name`, and `Status` of the specified communities. This ensures that only existing communities are targeted.\n- **SObject Update:** It then constructs an array of `Network` sObjects with their `Id` and the new `Status` and performs a DML update operation using `conn.sobject(\"Network\").update()`. The `allOrNone: false` option is used to allow partial success in case some updates fail.\n- **Error Handling and Reporting:** It iterates through the update results, logging success or failure for each community. It also provides a summary of successful and erroneous updates.\n- **User Interaction:** Uses `prompts` to confirm the update action with the user when not running in a CI environment.\n- **Salesforce Connection:** Establishes a connection to the target Salesforce org using the `target-org` flag.\n</details>\n",
5049
+ "examples": [
5050
+ "$ sf hardis:org:community:update --name 'MyNetworkName' --status DownForMaintenance",
5051
+ "$ sf hardis:org:community:update --name 'MyNetworkName,MySecondNetworkName' --status Live"
5052
+ ],
5053
+ "flags": {
5054
+ "json": {
5055
+ "description": "Format output as json.",
5056
+ "helpGroup": "GLOBAL",
5057
+ "name": "json",
5058
+ "allowNo": false,
5059
+ "type": "boolean"
5060
+ },
5061
+ "flags-dir": {
5062
+ "helpGroup": "GLOBAL",
5063
+ "name": "flags-dir",
5064
+ "summary": "Import flag values from a directory.",
5065
+ "hasDynamicHelp": false,
5066
+ "multiple": false,
5067
+ "type": "option"
5068
+ },
5069
+ "name": {
5070
+ "char": "n",
5071
+ "description": "List of Networks Names that you want to update, separated by comma",
5072
+ "name": "name",
5073
+ "required": true,
5074
+ "hasDynamicHelp": false,
5075
+ "multiple": false,
5076
+ "type": "option"
5077
+ },
5078
+ "status": {
5079
+ "char": "s",
5080
+ "description": "New status for the community, available values are: Live, DownForMaintenance",
5081
+ "name": "status",
5082
+ "required": true,
5083
+ "hasDynamicHelp": false,
5084
+ "multiple": false,
5085
+ "type": "option"
5086
+ },
5087
+ "debug": {
5088
+ "char": "d",
5089
+ "description": "Activate debug mode (more logs)",
5090
+ "name": "debug",
5091
+ "allowNo": false,
5092
+ "type": "boolean"
5093
+ },
5094
+ "target-org": {
5095
+ "aliases": [
5096
+ "targetusername",
5097
+ "u"
5098
+ ],
5099
+ "char": "o",
5100
+ "deprecateAliases": true,
5101
+ "name": "target-org",
5102
+ "noCacheDefault": true,
5103
+ "required": true,
5104
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
5105
+ "hasDynamicHelp": true,
5106
+ "multiple": false,
5107
+ "type": "option"
5108
+ }
5109
+ },
5110
+ "hasDynamicHelp": true,
5111
+ "hiddenAliases": [],
5112
+ "id": "hardis:org:community:update",
5113
+ "pluginAlias": "sfdx-hardis",
5114
+ "pluginName": "sfdx-hardis",
5115
+ "pluginType": "core",
5116
+ "strict": true,
5117
+ "summary": "Update a community status.",
5118
+ "enableJsonFlag": true,
5119
+ "isESM": true,
5120
+ "relativePath": [
5121
+ "lib",
5122
+ "commands",
5123
+ "hardis",
5124
+ "org",
5125
+ "community",
5126
+ "update.js"
5127
+ ],
5128
+ "aliasPermutations": [],
5129
+ "permutations": [
5130
+ "hardis:org:community:update",
5131
+ "org:hardis:community:update",
5132
+ "org:community:hardis:update",
5133
+ "org:community:update:hardis",
5134
+ "hardis:community:org:update",
5135
+ "community:hardis:org:update",
5136
+ "community:org:hardis:update",
5137
+ "community:org:update:hardis",
5138
+ "hardis:community:update:org",
5139
+ "community:hardis:update:org",
5140
+ "community:update:hardis:org",
5141
+ "community:update:org:hardis",
5142
+ "hardis:org:update:community",
5143
+ "org:hardis:update:community",
5144
+ "org:update:hardis:community",
5145
+ "org:update:community:hardis",
5146
+ "hardis:update:org:community",
5147
+ "update:hardis:org:community",
5148
+ "update:org:hardis:community",
5149
+ "update:org:community:hardis",
5150
+ "hardis:update:community:org",
5151
+ "update:hardis:community:org",
5152
+ "update:community:hardis:org",
5153
+ "update:community:org:hardis"
5154
+ ]
5155
+ },
5156
5156
  "hardis:org:data:delete": {
5157
5157
  "aliases": [],
5158
5158
  "args": {},
@@ -5539,15 +5539,12 @@
5539
5539
  "import:data:org:hardis"
5540
5540
  ]
5541
5541
  },
5542
- "hardis:org:diagnose:audittrail": {
5542
+ "hardis:org:files:export": {
5543
5543
  "aliases": [],
5544
5544
  "args": {},
5545
- "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
5545
+ "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
5546
5546
  "examples": [
5547
- "$ sf hardis:org:diagnose:audittrail",
5548
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5549
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5550
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5547
+ "$ sf hardis:org:files:export"
5551
5548
  ],
5552
5549
  "flags": {
5553
5550
  "json": {
@@ -5565,30 +5562,48 @@
5565
5562
  "multiple": false,
5566
5563
  "type": "option"
5567
5564
  },
5568
- "excludeusers": {
5569
- "char": "e",
5570
- "description": "Comma-separated list of usernames to exclude",
5571
- "name": "excludeusers",
5565
+ "path": {
5566
+ "char": "p",
5567
+ "description": "Path to the file export project",
5568
+ "name": "path",
5572
5569
  "hasDynamicHelp": false,
5573
5570
  "multiple": false,
5574
5571
  "type": "option"
5575
5572
  },
5576
- "lastndays": {
5573
+ "chunksize": {
5574
+ "char": "c",
5575
+ "description": "Number of records to add in a chunk before it is processed",
5576
+ "name": "chunksize",
5577
+ "default": 1000,
5578
+ "hasDynamicHelp": false,
5579
+ "multiple": false,
5580
+ "type": "option"
5581
+ },
5582
+ "polltimeout": {
5577
5583
  "char": "t",
5578
- "description": "Number of days to extract from today (included)",
5579
- "name": "lastndays",
5584
+ "description": "Timeout in MS for Bulk API calls",
5585
+ "name": "polltimeout",
5586
+ "default": 300000,
5580
5587
  "hasDynamicHelp": false,
5581
5588
  "multiple": false,
5582
5589
  "type": "option"
5583
5590
  },
5584
- "outputfile": {
5585
- "char": "f",
5586
- "description": "Force the path and name of output report file. Must end with .csv",
5587
- "name": "outputfile",
5591
+ "startchunknumber": {
5592
+ "char": "s",
5593
+ "description": "Chunk number to start from",
5594
+ "name": "startchunknumber",
5595
+ "default": 0,
5588
5596
  "hasDynamicHelp": false,
5589
5597
  "multiple": false,
5590
5598
  "type": "option"
5591
5599
  },
5600
+ "resume": {
5601
+ "char": "r",
5602
+ "description": "Resume previous export by checking existing files (default in CI)",
5603
+ "name": "resume",
5604
+ "allowNo": false,
5605
+ "type": "boolean"
5606
+ },
5592
5607
  "debug": {
5593
5608
  "char": "d",
5594
5609
  "description": "Activate debug mode (more logs)",
@@ -5627,13 +5642,13 @@
5627
5642
  },
5628
5643
  "hasDynamicHelp": true,
5629
5644
  "hiddenAliases": [],
5630
- "id": "hardis:org:diagnose:audittrail",
5645
+ "id": "hardis:org:files:export",
5631
5646
  "pluginAlias": "sfdx-hardis",
5632
5647
  "pluginName": "sfdx-hardis",
5633
5648
  "pluginType": "core",
5634
5649
  "strict": true,
5635
5650
  "enableJsonFlag": true,
5636
- "title": "Diagnose content of Setup Audit Trail",
5651
+ "title": "Export files",
5637
5652
  "requiresProject": false,
5638
5653
  "isESM": true,
5639
5654
  "relativePath": [
@@ -5641,50 +5656,50 @@
5641
5656
  "commands",
5642
5657
  "hardis",
5643
5658
  "org",
5644
- "diagnose",
5645
- "audittrail.js"
5659
+ "files",
5660
+ "export.js"
5646
5661
  ],
5647
5662
  "aliasPermutations": [],
5648
5663
  "permutations": [
5649
- "hardis:org:diagnose:audittrail",
5650
- "org:hardis:diagnose:audittrail",
5651
- "org:diagnose:hardis:audittrail",
5652
- "org:diagnose:audittrail:hardis",
5653
- "hardis:diagnose:org:audittrail",
5654
- "diagnose:hardis:org:audittrail",
5655
- "diagnose:org:hardis:audittrail",
5656
- "diagnose:org:audittrail:hardis",
5657
- "hardis:diagnose:audittrail:org",
5658
- "diagnose:hardis:audittrail:org",
5659
- "diagnose:audittrail:hardis:org",
5660
- "diagnose:audittrail:org:hardis",
5661
- "hardis:org:audittrail:diagnose",
5662
- "org:hardis:audittrail:diagnose",
5663
- "org:audittrail:hardis:diagnose",
5664
- "org:audittrail:diagnose:hardis",
5665
- "hardis:audittrail:org:diagnose",
5666
- "audittrail:hardis:org:diagnose",
5667
- "audittrail:org:hardis:diagnose",
5668
- "audittrail:org:diagnose:hardis",
5669
- "hardis:audittrail:diagnose:org",
5670
- "audittrail:hardis:diagnose:org",
5671
- "audittrail:diagnose:hardis:org",
5672
- "audittrail:diagnose:org:hardis"
5673
- ]
5674
- },
5675
- "hardis:org:diagnose:instanceupgrade": {
5676
- "aliases": [],
5677
- "args": {},
5678
- "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
5679
- "examples": [
5680
- "$ sf hardis:org:diagnose:instanceupgrade"
5681
- ],
5682
- "flags": {
5683
- "json": {
5684
- "description": "Format output as json.",
5685
- "helpGroup": "GLOBAL",
5686
- "name": "json",
5687
- "allowNo": false,
5664
+ "hardis:org:files:export",
5665
+ "org:hardis:files:export",
5666
+ "org:files:hardis:export",
5667
+ "org:files:export:hardis",
5668
+ "hardis:files:org:export",
5669
+ "files:hardis:org:export",
5670
+ "files:org:hardis:export",
5671
+ "files:org:export:hardis",
5672
+ "hardis:files:export:org",
5673
+ "files:hardis:export:org",
5674
+ "files:export:hardis:org",
5675
+ "files:export:org:hardis",
5676
+ "hardis:org:export:files",
5677
+ "org:hardis:export:files",
5678
+ "org:export:hardis:files",
5679
+ "org:export:files:hardis",
5680
+ "hardis:export:org:files",
5681
+ "export:hardis:org:files",
5682
+ "export:org:hardis:files",
5683
+ "export:org:files:hardis",
5684
+ "hardis:export:files:org",
5685
+ "export:hardis:files:org",
5686
+ "export:files:hardis:org",
5687
+ "export:files:org:hardis"
5688
+ ]
5689
+ },
5690
+ "hardis:org:files:import": {
5691
+ "aliases": [],
5692
+ "args": {},
5693
+ "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",
5694
+ "examples": [
5695
+ "$ sf hardis:org:files:import"
5696
+ ],
5697
+ "flags": {
5698
+ "json": {
5699
+ "description": "Format output as json.",
5700
+ "helpGroup": "GLOBAL",
5701
+ "name": "json",
5702
+ "allowNo": false,
5688
5703
  "type": "boolean"
5689
5704
  },
5690
5705
  "flags-dir": {
@@ -5695,6 +5710,21 @@
5695
5710
  "multiple": false,
5696
5711
  "type": "option"
5697
5712
  },
5713
+ "path": {
5714
+ "char": "p",
5715
+ "description": "Path to the file export project",
5716
+ "name": "path",
5717
+ "hasDynamicHelp": false,
5718
+ "multiple": false,
5719
+ "type": "option"
5720
+ },
5721
+ "overwrite": {
5722
+ "char": "f",
5723
+ "description": "Override existing files (doubles the number of API calls)",
5724
+ "name": "overwrite",
5725
+ "allowNo": false,
5726
+ "type": "boolean"
5727
+ },
5698
5728
  "debug": {
5699
5729
  "char": "d",
5700
5730
  "description": "Activate debug mode (more logs)",
@@ -5733,13 +5763,13 @@
5733
5763
  },
5734
5764
  "hasDynamicHelp": true,
5735
5765
  "hiddenAliases": [],
5736
- "id": "hardis:org:diagnose:instanceupgrade",
5766
+ "id": "hardis:org:files:import",
5737
5767
  "pluginAlias": "sfdx-hardis",
5738
5768
  "pluginName": "sfdx-hardis",
5739
5769
  "pluginType": "core",
5740
5770
  "strict": true,
5741
5771
  "enableJsonFlag": true,
5742
- "title": "Get Instance Upgrade date",
5772
+ "title": "Import files",
5743
5773
  "requiresProject": false,
5744
5774
  "isESM": true,
5745
5775
  "relativePath": [
@@ -5747,46 +5777,44 @@
5747
5777
  "commands",
5748
5778
  "hardis",
5749
5779
  "org",
5750
- "diagnose",
5751
- "instanceupgrade.js"
5780
+ "files",
5781
+ "import.js"
5752
5782
  ],
5753
5783
  "aliasPermutations": [],
5754
5784
  "permutations": [
5755
- "hardis:org:diagnose:instanceupgrade",
5756
- "org:hardis:diagnose:instanceupgrade",
5757
- "org:diagnose:hardis:instanceupgrade",
5758
- "org:diagnose:instanceupgrade:hardis",
5759
- "hardis:diagnose:org:instanceupgrade",
5760
- "diagnose:hardis:org:instanceupgrade",
5761
- "diagnose:org:hardis:instanceupgrade",
5762
- "diagnose:org:instanceupgrade:hardis",
5763
- "hardis:diagnose:instanceupgrade:org",
5764
- "diagnose:hardis:instanceupgrade:org",
5765
- "diagnose:instanceupgrade:hardis:org",
5766
- "diagnose:instanceupgrade:org:hardis",
5767
- "hardis:org:instanceupgrade:diagnose",
5768
- "org:hardis:instanceupgrade:diagnose",
5769
- "org:instanceupgrade:hardis:diagnose",
5770
- "org:instanceupgrade:diagnose:hardis",
5771
- "hardis:instanceupgrade:org:diagnose",
5772
- "instanceupgrade:hardis:org:diagnose",
5773
- "instanceupgrade:org:hardis:diagnose",
5774
- "instanceupgrade:org:diagnose:hardis",
5775
- "hardis:instanceupgrade:diagnose:org",
5776
- "instanceupgrade:hardis:diagnose:org",
5777
- "instanceupgrade:diagnose:hardis:org",
5778
- "instanceupgrade:diagnose:org:hardis"
5785
+ "hardis:org:files:import",
5786
+ "org:hardis:files:import",
5787
+ "org:files:hardis:import",
5788
+ "org:files:import:hardis",
5789
+ "hardis:files:org:import",
5790
+ "files:hardis:org:import",
5791
+ "files:org:hardis:import",
5792
+ "files:org:import:hardis",
5793
+ "hardis:files:import:org",
5794
+ "files:hardis:import:org",
5795
+ "files:import:hardis:org",
5796
+ "files:import:org:hardis",
5797
+ "hardis:org:import:files",
5798
+ "org:hardis:import:files",
5799
+ "org:import:hardis:files",
5800
+ "org:import:files:hardis",
5801
+ "hardis:import:org:files",
5802
+ "import:hardis:org:files",
5803
+ "import:org:hardis:files",
5804
+ "import:org:files:hardis",
5805
+ "hardis:import:files:org",
5806
+ "import:hardis:files:org",
5807
+ "import:files:hardis:org",
5808
+ "import:files:org:hardis"
5779
5809
  ]
5780
5810
  },
5781
- "hardis:org:diagnose:legacyapi": {
5811
+ "hardis:org:fix:listviewmine": {
5782
5812
  "aliases": [],
5783
5813
  "args": {},
5784
- "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
5814
+ "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",
5785
5815
  "examples": [
5786
- "$ sf hardis:org:diagnose:legacyapi",
5787
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5788
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5789
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5816
+ "$ sf hardis:org:fix:listviewmine",
5817
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
5790
5818
  ],
5791
5819
  "flags": {
5792
5820
  "json": {
@@ -5804,28 +5832,10 @@
5804
5832
  "multiple": false,
5805
5833
  "type": "option"
5806
5834
  },
5807
- "eventtype": {
5808
- "char": "e",
5809
- "description": "Type of EventLogFile event to analyze",
5810
- "name": "eventtype",
5811
- "default": "ApiTotalUsage",
5812
- "hasDynamicHelp": false,
5813
- "multiple": false,
5814
- "type": "option"
5815
- },
5816
- "limit": {
5835
+ "listviews": {
5817
5836
  "char": "l",
5818
- "description": "Number of latest EventLogFile events to analyze",
5819
- "name": "limit",
5820
- "default": 999,
5821
- "hasDynamicHelp": false,
5822
- "multiple": false,
5823
- "type": "option"
5824
- },
5825
- "outputfile": {
5826
- "char": "f",
5827
- "description": "Force the path and name of output report file. Must end with .csv",
5828
- "name": "outputfile",
5837
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
5838
+ "name": "listviews",
5829
5839
  "hasDynamicHelp": false,
5830
5840
  "multiple": false,
5831
5841
  "type": "option"
@@ -5868,57 +5878,60 @@
5868
5878
  },
5869
5879
  "hasDynamicHelp": true,
5870
5880
  "hiddenAliases": [],
5871
- "id": "hardis:org:diagnose:legacyapi",
5881
+ "id": "hardis:org:fix:listviewmine",
5872
5882
  "pluginAlias": "sfdx-hardis",
5873
5883
  "pluginName": "sfdx-hardis",
5874
5884
  "pluginType": "core",
5875
5885
  "strict": true,
5876
5886
  "enableJsonFlag": true,
5877
- "title": "Check for legacy API use",
5878
- "requiresProject": false,
5887
+ "title": "Fix listviews with ",
5888
+ "requiresProject": true,
5879
5889
  "isESM": true,
5880
5890
  "relativePath": [
5881
5891
  "lib",
5882
5892
  "commands",
5883
5893
  "hardis",
5884
5894
  "org",
5885
- "diagnose",
5886
- "legacyapi.js"
5895
+ "fix",
5896
+ "listviewmine.js"
5887
5897
  ],
5888
5898
  "aliasPermutations": [],
5889
5899
  "permutations": [
5890
- "hardis:org:diagnose:legacyapi",
5891
- "org:hardis:diagnose:legacyapi",
5892
- "org:diagnose:hardis:legacyapi",
5893
- "org:diagnose:legacyapi:hardis",
5894
- "hardis:diagnose:org:legacyapi",
5895
- "diagnose:hardis:org:legacyapi",
5896
- "diagnose:org:hardis:legacyapi",
5897
- "diagnose:org:legacyapi:hardis",
5898
- "hardis:diagnose:legacyapi:org",
5899
- "diagnose:hardis:legacyapi:org",
5900
- "diagnose:legacyapi:hardis:org",
5901
- "diagnose:legacyapi:org:hardis",
5902
- "hardis:org:legacyapi:diagnose",
5903
- "org:hardis:legacyapi:diagnose",
5904
- "org:legacyapi:hardis:diagnose",
5905
- "org:legacyapi:diagnose:hardis",
5906
- "hardis:legacyapi:org:diagnose",
5907
- "legacyapi:hardis:org:diagnose",
5908
- "legacyapi:org:hardis:diagnose",
5909
- "legacyapi:org:diagnose:hardis",
5910
- "hardis:legacyapi:diagnose:org",
5911
- "legacyapi:hardis:diagnose:org",
5912
- "legacyapi:diagnose:hardis:org",
5913
- "legacyapi:diagnose:org:hardis"
5900
+ "hardis:org:fix:listviewmine",
5901
+ "org:hardis:fix:listviewmine",
5902
+ "org:fix:hardis:listviewmine",
5903
+ "org:fix:listviewmine:hardis",
5904
+ "hardis:fix:org:listviewmine",
5905
+ "fix:hardis:org:listviewmine",
5906
+ "fix:org:hardis:listviewmine",
5907
+ "fix:org:listviewmine:hardis",
5908
+ "hardis:fix:listviewmine:org",
5909
+ "fix:hardis:listviewmine:org",
5910
+ "fix:listviewmine:hardis:org",
5911
+ "fix:listviewmine:org:hardis",
5912
+ "hardis:org:listviewmine:fix",
5913
+ "org:hardis:listviewmine:fix",
5914
+ "org:listviewmine:hardis:fix",
5915
+ "org:listviewmine:fix:hardis",
5916
+ "hardis:listviewmine:org:fix",
5917
+ "listviewmine:hardis:org:fix",
5918
+ "listviewmine:org:hardis:fix",
5919
+ "listviewmine:org:fix:hardis",
5920
+ "hardis:listviewmine:fix:org",
5921
+ "listviewmine:hardis:fix:org",
5922
+ "listviewmine:fix:hardis:org",
5923
+ "listviewmine:fix:org:hardis"
5914
5924
  ]
5915
5925
  },
5916
- "hardis:org:diagnose:licenses": {
5926
+ "hardis:org:diagnose:audittrail": {
5917
5927
  "aliases": [],
5918
5928
  "args": {},
5919
- "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
5929
+ "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",
5920
5930
  "examples": [
5921
- "$ sf hardis:org:diagnose:licenses"
5931
+ "$ sf hardis:org:diagnose:audittrail",
5932
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5933
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5934
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5922
5935
  ],
5923
5936
  "flags": {
5924
5937
  "json": {
@@ -5936,6 +5949,22 @@
5936
5949
  "multiple": false,
5937
5950
  "type": "option"
5938
5951
  },
5952
+ "excludeusers": {
5953
+ "char": "e",
5954
+ "description": "Comma-separated list of usernames to exclude",
5955
+ "name": "excludeusers",
5956
+ "hasDynamicHelp": false,
5957
+ "multiple": false,
5958
+ "type": "option"
5959
+ },
5960
+ "lastndays": {
5961
+ "char": "t",
5962
+ "description": "Number of days to extract from today (included)",
5963
+ "name": "lastndays",
5964
+ "hasDynamicHelp": false,
5965
+ "multiple": false,
5966
+ "type": "option"
5967
+ },
5939
5968
  "outputfile": {
5940
5969
  "char": "f",
5941
5970
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -5944,13 +5973,6 @@
5944
5973
  "multiple": false,
5945
5974
  "type": "option"
5946
5975
  },
5947
- "usedonly": {
5948
- "char": "u",
5949
- "description": "Filter to have only used licenses",
5950
- "name": "usedonly",
5951
- "allowNo": false,
5952
- "type": "boolean"
5953
- },
5954
5976
  "debug": {
5955
5977
  "char": "d",
5956
5978
  "description": "Activate debug mode (more logs)",
@@ -5989,13 +6011,13 @@
5989
6011
  },
5990
6012
  "hasDynamicHelp": true,
5991
6013
  "hiddenAliases": [],
5992
- "id": "hardis:org:diagnose:licenses",
6014
+ "id": "hardis:org:diagnose:audittrail",
5993
6015
  "pluginAlias": "sfdx-hardis",
5994
6016
  "pluginName": "sfdx-hardis",
5995
6017
  "pluginType": "core",
5996
6018
  "strict": true,
5997
6019
  "enableJsonFlag": true,
5998
- "title": "List licenses subscribed and used in a Salesforce org",
6020
+ "title": "Diagnose content of Setup Audit Trail",
5999
6021
  "requiresProject": false,
6000
6022
  "isESM": true,
6001
6023
  "relativePath": [
@@ -6004,42 +6026,42 @@
6004
6026
  "hardis",
6005
6027
  "org",
6006
6028
  "diagnose",
6007
- "licenses.js"
6029
+ "audittrail.js"
6008
6030
  ],
6009
6031
  "aliasPermutations": [],
6010
6032
  "permutations": [
6011
- "hardis:org:diagnose:licenses",
6012
- "org:hardis:diagnose:licenses",
6013
- "org:diagnose:hardis:licenses",
6014
- "org:diagnose:licenses:hardis",
6015
- "hardis:diagnose:org:licenses",
6016
- "diagnose:hardis:org:licenses",
6017
- "diagnose:org:hardis:licenses",
6018
- "diagnose:org:licenses:hardis",
6019
- "hardis:diagnose:licenses:org",
6020
- "diagnose:hardis:licenses:org",
6021
- "diagnose:licenses:hardis:org",
6022
- "diagnose:licenses:org:hardis",
6023
- "hardis:org:licenses:diagnose",
6024
- "org:hardis:licenses:diagnose",
6025
- "org:licenses:hardis:diagnose",
6026
- "org:licenses:diagnose:hardis",
6027
- "hardis:licenses:org:diagnose",
6028
- "licenses:hardis:org:diagnose",
6029
- "licenses:org:hardis:diagnose",
6030
- "licenses:org:diagnose:hardis",
6031
- "hardis:licenses:diagnose:org",
6032
- "licenses:hardis:diagnose:org",
6033
- "licenses:diagnose:hardis:org",
6034
- "licenses:diagnose:org:hardis"
6033
+ "hardis:org:diagnose:audittrail",
6034
+ "org:hardis:diagnose:audittrail",
6035
+ "org:diagnose:hardis:audittrail",
6036
+ "org:diagnose:audittrail:hardis",
6037
+ "hardis:diagnose:org:audittrail",
6038
+ "diagnose:hardis:org:audittrail",
6039
+ "diagnose:org:hardis:audittrail",
6040
+ "diagnose:org:audittrail:hardis",
6041
+ "hardis:diagnose:audittrail:org",
6042
+ "diagnose:hardis:audittrail:org",
6043
+ "diagnose:audittrail:hardis:org",
6044
+ "diagnose:audittrail:org:hardis",
6045
+ "hardis:org:audittrail:diagnose",
6046
+ "org:hardis:audittrail:diagnose",
6047
+ "org:audittrail:hardis:diagnose",
6048
+ "org:audittrail:diagnose:hardis",
6049
+ "hardis:audittrail:org:diagnose",
6050
+ "audittrail:hardis:org:diagnose",
6051
+ "audittrail:org:hardis:diagnose",
6052
+ "audittrail:org:diagnose:hardis",
6053
+ "hardis:audittrail:diagnose:org",
6054
+ "audittrail:hardis:diagnose:org",
6055
+ "audittrail:diagnose:hardis:org",
6056
+ "audittrail:diagnose:org:hardis"
6035
6057
  ]
6036
6058
  },
6037
- "hardis:org:diagnose:releaseupdates": {
6059
+ "hardis:org:diagnose:instanceupgrade": {
6038
6060
  "aliases": [],
6039
6061
  "args": {},
6040
- "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6062
+ "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",
6041
6063
  "examples": [
6042
- "$ sf hardis:org:diagnose:releaseupdates"
6064
+ "$ sf hardis:org:diagnose:instanceupgrade"
6043
6065
  ],
6044
6066
  "flags": {
6045
6067
  "json": {
@@ -6057,14 +6079,6 @@
6057
6079
  "multiple": false,
6058
6080
  "type": "option"
6059
6081
  },
6060
- "outputfile": {
6061
- "char": "f",
6062
- "description": "Force the path and name of output report file. Must end with .csv",
6063
- "name": "outputfile",
6064
- "hasDynamicHelp": false,
6065
- "multiple": false,
6066
- "type": "option"
6067
- },
6068
6082
  "debug": {
6069
6083
  "char": "d",
6070
6084
  "description": "Activate debug mode (more logs)",
@@ -6103,13 +6117,13 @@
6103
6117
  },
6104
6118
  "hasDynamicHelp": true,
6105
6119
  "hiddenAliases": [],
6106
- "id": "hardis:org:diagnose:releaseupdates",
6120
+ "id": "hardis:org:diagnose:instanceupgrade",
6107
6121
  "pluginAlias": "sfdx-hardis",
6108
6122
  "pluginName": "sfdx-hardis",
6109
6123
  "pluginType": "core",
6110
6124
  "strict": true,
6111
6125
  "enableJsonFlag": true,
6112
- "title": "Check Release Updates of an org",
6126
+ "title": "Get Instance Upgrade date",
6113
6127
  "requiresProject": false,
6114
6128
  "isESM": true,
6115
6129
  "relativePath": [
@@ -6118,47 +6132,45 @@
6118
6132
  "hardis",
6119
6133
  "org",
6120
6134
  "diagnose",
6121
- "releaseupdates.js"
6135
+ "instanceupgrade.js"
6122
6136
  ],
6123
6137
  "aliasPermutations": [],
6124
6138
  "permutations": [
6125
- "hardis:org:diagnose:releaseupdates",
6126
- "org:hardis:diagnose:releaseupdates",
6127
- "org:diagnose:hardis:releaseupdates",
6128
- "org:diagnose:releaseupdates:hardis",
6129
- "hardis:diagnose:org:releaseupdates",
6130
- "diagnose:hardis:org:releaseupdates",
6131
- "diagnose:org:hardis:releaseupdates",
6132
- "diagnose:org:releaseupdates:hardis",
6133
- "hardis:diagnose:releaseupdates:org",
6134
- "diagnose:hardis:releaseupdates:org",
6135
- "diagnose:releaseupdates:hardis:org",
6136
- "diagnose:releaseupdates:org:hardis",
6137
- "hardis:org:releaseupdates:diagnose",
6138
- "org:hardis:releaseupdates:diagnose",
6139
- "org:releaseupdates:hardis:diagnose",
6140
- "org:releaseupdates:diagnose:hardis",
6141
- "hardis:releaseupdates:org:diagnose",
6142
- "releaseupdates:hardis:org:diagnose",
6143
- "releaseupdates:org:hardis:diagnose",
6144
- "releaseupdates:org:diagnose:hardis",
6145
- "hardis:releaseupdates:diagnose:org",
6146
- "releaseupdates:hardis:diagnose:org",
6147
- "releaseupdates:diagnose:hardis:org",
6148
- "releaseupdates:diagnose:org:hardis"
6139
+ "hardis:org:diagnose:instanceupgrade",
6140
+ "org:hardis:diagnose:instanceupgrade",
6141
+ "org:diagnose:hardis:instanceupgrade",
6142
+ "org:diagnose:instanceupgrade:hardis",
6143
+ "hardis:diagnose:org:instanceupgrade",
6144
+ "diagnose:hardis:org:instanceupgrade",
6145
+ "diagnose:org:hardis:instanceupgrade",
6146
+ "diagnose:org:instanceupgrade:hardis",
6147
+ "hardis:diagnose:instanceupgrade:org",
6148
+ "diagnose:hardis:instanceupgrade:org",
6149
+ "diagnose:instanceupgrade:hardis:org",
6150
+ "diagnose:instanceupgrade:org:hardis",
6151
+ "hardis:org:instanceupgrade:diagnose",
6152
+ "org:hardis:instanceupgrade:diagnose",
6153
+ "org:instanceupgrade:hardis:diagnose",
6154
+ "org:instanceupgrade:diagnose:hardis",
6155
+ "hardis:instanceupgrade:org:diagnose",
6156
+ "instanceupgrade:hardis:org:diagnose",
6157
+ "instanceupgrade:org:hardis:diagnose",
6158
+ "instanceupgrade:org:diagnose:hardis",
6159
+ "hardis:instanceupgrade:diagnose:org",
6160
+ "instanceupgrade:hardis:diagnose:org",
6161
+ "instanceupgrade:diagnose:hardis:org",
6162
+ "instanceupgrade:diagnose:org:hardis"
6149
6163
  ]
6150
6164
  },
6151
- "hardis:org:diagnose:storage-stats": {
6165
+ "hardis:org:diagnose:legacyapi": {
6152
6166
  "aliases": [],
6153
6167
  "args": {},
6154
- "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with flexible grouping options.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose breakdown fields (date fields, RecordType, custom fields, or relationship fields).\n- **Flexible Breakdown Field:** Supports grouping by any field including:\n - Date/DateTime fields (`CreatedDate`, `LastModifiedDate`, custom date fields)\n - RecordType (`RecordType.Name`)\n - Custom fields (`Status__c`, picklists, text fields)\n - Nested relationship fields (`SBQQ__Quote__r.RecordType.Name`)\n- **Date Granularity Options:** For date/datetime fields, choose between:\n - Year-based grouping (`CALENDAR_YEAR`)\n - Month-based grouping (`CALENDAR_MONTH`)\n - Day-based grouping (exact date)\n- **WHERE Clause Filtering:** Apply SOQL WHERE conditions to filter records before calculating storage (e.g., only active records, records from the last year).\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed breakdown by selected field and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects, breakdown field selection, granularity choice (for date fields), and optional WHERE conditions. All objects are pre-selected by default for user convenience.\n- **Field Validation:** Recursively validates breakdown fields including nested relationships (e.g., `SBQQ__Quote__r.RecordType.Name`) by traversing the relationship chain and checking field existence on each related object. Automatically handles special cases like `RecordType` -> `RecordTypeId` and `__r` -> `__c` conversions.\n- **Dynamic Query Generation:** Builds SOQL queries based on field type and granularity:\n - For date fields with year granularity: `SELECT CALENDAR_YEAR(<Field>) breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>) ORDER BY CALENDAR_YEAR(<Field>)`\n - For date fields with month granularity: `SELECT CALENDAR_YEAR(<Field>) year, CALENDAR_MONTH(<Field>) month, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>) ORDER BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>)`\n - For non-date fields: `SELECT <Field> breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY <Field> ORDER BY <Field>`\n- **WHERE Clause Support:** Accepts user-provided WHERE conditions via flag (`--where`) or interactive prompt. Injects the condition into all SOQL queries for consistent filtering across all objects.\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and breakdown value.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all statistics per breakdown value per object (e.g., by year, by month, by RecordType)\n - Totals summary: includes only aggregate totals per object\n - File naming includes breakdown field, granularity (for date fields), and `-filtered` suffix when WHERE clause is applied\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
6168
+ "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
6169
  "examples": [
6156
- "$ sf hardis:org:diagnose:storage-stats",
6157
- "$ sf hardis:org:diagnose:storage-stats --breakdown-field \"CreatedDate\"",
6158
- "$ sf hardis:org:diagnose:storage-stats -b \"RecordType.Name\"",
6159
- "$ sf hardis:org:diagnose:storage-stats --where \"CreatedDate = LAST_N_DAYS:365\"",
6160
- "$ sf hardis:org:diagnose:storage-stats -w \"Status__c = 'Active'\"",
6161
- "$ sf hardis:org:diagnose:storage-stats -b \"LastModifiedDate\" -w \"IsDeleted = false\""
6170
+ "$ sf hardis:org:diagnose:legacyapi",
6171
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
6172
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
6173
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
6162
6174
  ],
6163
6175
  "flags": {
6164
6176
  "json": {
@@ -6176,26 +6188,28 @@
6176
6188
  "multiple": false,
6177
6189
  "type": "option"
6178
6190
  },
6179
- "outputfile": {
6180
- "char": "f",
6181
- "description": "Force the path and name of output report file. Must end with .csv",
6182
- "name": "outputfile",
6191
+ "eventtype": {
6192
+ "char": "e",
6193
+ "description": "Type of EventLogFile event to analyze",
6194
+ "name": "eventtype",
6195
+ "default": "ApiTotalUsage",
6183
6196
  "hasDynamicHelp": false,
6184
6197
  "multiple": false,
6185
6198
  "type": "option"
6186
6199
  },
6187
- "breakdown-field": {
6188
- "char": "b",
6189
- "description": "Field to use for storage stats breakdown. Example: \"CreatedDate\", \"LastModifiedDate\", \"RecordType.Name\", or custom fields like \"Status__c\"",
6190
- "name": "breakdown-field",
6200
+ "limit": {
6201
+ "char": "l",
6202
+ "description": "Number of latest EventLogFile events to analyze",
6203
+ "name": "limit",
6204
+ "default": 999,
6191
6205
  "hasDynamicHelp": false,
6192
6206
  "multiple": false,
6193
6207
  "type": "option"
6194
6208
  },
6195
- "where": {
6196
- "char": "w",
6197
- "description": "WHERE clause to filter records in the query (without the WHERE keyword). Example: \"CreatedDate = LAST_N_DAYS:365\" or \"Status__c = 'Active'\"",
6198
- "name": "where",
6209
+ "outputfile": {
6210
+ "char": "f",
6211
+ "description": "Force the path and name of output report file. Must end with .csv",
6212
+ "name": "outputfile",
6199
6213
  "hasDynamicHelp": false,
6200
6214
  "multiple": false,
6201
6215
  "type": "option"
@@ -6238,14 +6252,14 @@
6238
6252
  },
6239
6253
  "hasDynamicHelp": true,
6240
6254
  "hiddenAliases": [],
6241
- "id": "hardis:org:diagnose:storage-stats",
6255
+ "id": "hardis:org:diagnose:legacyapi",
6242
6256
  "pluginAlias": "sfdx-hardis",
6243
6257
  "pluginName": "sfdx-hardis",
6244
6258
  "pluginType": "core",
6245
6259
  "strict": true,
6246
6260
  "enableJsonFlag": true,
6247
- "title": "Extract Data Storage stats",
6248
- "requiresProject": true,
6261
+ "title": "Check for legacy API use",
6262
+ "requiresProject": false,
6249
6263
  "isESM": true,
6250
6264
  "relativePath": [
6251
6265
  "lib",
@@ -6253,42 +6267,42 @@
6253
6267
  "hardis",
6254
6268
  "org",
6255
6269
  "diagnose",
6256
- "storage-stats.js"
6270
+ "legacyapi.js"
6257
6271
  ],
6258
6272
  "aliasPermutations": [],
6259
6273
  "permutations": [
6260
- "hardis:org:diagnose:storage-stats",
6261
- "org:hardis:diagnose:storage-stats",
6262
- "org:diagnose:hardis:storage-stats",
6263
- "org:diagnose:storage-stats:hardis",
6264
- "hardis:diagnose:org:storage-stats",
6265
- "diagnose:hardis:org:storage-stats",
6266
- "diagnose:org:hardis:storage-stats",
6267
- "diagnose:org:storage-stats:hardis",
6268
- "hardis:diagnose:storage-stats:org",
6269
- "diagnose:hardis:storage-stats:org",
6270
- "diagnose:storage-stats:hardis:org",
6271
- "diagnose:storage-stats:org:hardis",
6272
- "hardis:org:storage-stats:diagnose",
6273
- "org:hardis:storage-stats:diagnose",
6274
- "org:storage-stats:hardis:diagnose",
6275
- "org:storage-stats:diagnose:hardis",
6276
- "hardis:storage-stats:org:diagnose",
6277
- "storage-stats:hardis:org:diagnose",
6278
- "storage-stats:org:hardis:diagnose",
6279
- "storage-stats:org:diagnose:hardis",
6280
- "hardis:storage-stats:diagnose:org",
6281
- "storage-stats:hardis:diagnose:org",
6282
- "storage-stats:diagnose:hardis:org",
6283
- "storage-stats:diagnose:org:hardis"
6274
+ "hardis:org:diagnose:legacyapi",
6275
+ "org:hardis:diagnose:legacyapi",
6276
+ "org:diagnose:hardis:legacyapi",
6277
+ "org:diagnose:legacyapi:hardis",
6278
+ "hardis:diagnose:org:legacyapi",
6279
+ "diagnose:hardis:org:legacyapi",
6280
+ "diagnose:org:hardis:legacyapi",
6281
+ "diagnose:org:legacyapi:hardis",
6282
+ "hardis:diagnose:legacyapi:org",
6283
+ "diagnose:hardis:legacyapi:org",
6284
+ "diagnose:legacyapi:hardis:org",
6285
+ "diagnose:legacyapi:org:hardis",
6286
+ "hardis:org:legacyapi:diagnose",
6287
+ "org:hardis:legacyapi:diagnose",
6288
+ "org:legacyapi:hardis:diagnose",
6289
+ "org:legacyapi:diagnose:hardis",
6290
+ "hardis:legacyapi:org:diagnose",
6291
+ "legacyapi:hardis:org:diagnose",
6292
+ "legacyapi:org:hardis:diagnose",
6293
+ "legacyapi:org:diagnose:hardis",
6294
+ "hardis:legacyapi:diagnose:org",
6295
+ "legacyapi:hardis:diagnose:org",
6296
+ "legacyapi:diagnose:hardis:org",
6297
+ "legacyapi:diagnose:org:hardis"
6284
6298
  ]
6285
6299
  },
6286
- "hardis:org:diagnose:unsecure-connected-apps": {
6300
+ "hardis:org:diagnose:licenses": {
6287
6301
  "aliases": [],
6288
6302
  "args": {},
6289
- "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",
6303
+ "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",
6290
6304
  "examples": [
6291
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
6305
+ "$ sf hardis:org:diagnose:licenses"
6292
6306
  ],
6293
6307
  "flags": {
6294
6308
  "json": {
@@ -6314,6 +6328,13 @@
6314
6328
  "multiple": false,
6315
6329
  "type": "option"
6316
6330
  },
6331
+ "usedonly": {
6332
+ "char": "u",
6333
+ "description": "Filter to have only used licenses",
6334
+ "name": "usedonly",
6335
+ "allowNo": false,
6336
+ "type": "boolean"
6337
+ },
6317
6338
  "debug": {
6318
6339
  "char": "d",
6319
6340
  "description": "Activate debug mode (more logs)",
@@ -6352,13 +6373,13 @@
6352
6373
  },
6353
6374
  "hasDynamicHelp": true,
6354
6375
  "hiddenAliases": [],
6355
- "id": "hardis:org:diagnose:unsecure-connected-apps",
6376
+ "id": "hardis:org:diagnose:licenses",
6356
6377
  "pluginAlias": "sfdx-hardis",
6357
6378
  "pluginName": "sfdx-hardis",
6358
6379
  "pluginType": "core",
6359
6380
  "strict": true,
6360
6381
  "enableJsonFlag": true,
6361
- "title": "Detect Unsecured Connected Apps",
6382
+ "title": "List licenses subscribed and used in a Salesforce org",
6362
6383
  "requiresProject": false,
6363
6384
  "isESM": true,
6364
6385
  "relativePath": [
@@ -6367,51 +6388,50 @@
6367
6388
  "hardis",
6368
6389
  "org",
6369
6390
  "diagnose",
6370
- "unsecure-connected-apps.js"
6391
+ "licenses.js"
6371
6392
  ],
6372
6393
  "aliasPermutations": [],
6373
6394
  "permutations": [
6374
- "hardis:org:diagnose:unsecure-connected-apps",
6375
- "org:hardis:diagnose:unsecure-connected-apps",
6376
- "org:diagnose:hardis:unsecure-connected-apps",
6377
- "org:diagnose:unsecure-connected-apps:hardis",
6378
- "hardis:diagnose:org:unsecure-connected-apps",
6379
- "diagnose:hardis:org:unsecure-connected-apps",
6380
- "diagnose:org:hardis:unsecure-connected-apps",
6381
- "diagnose:org:unsecure-connected-apps:hardis",
6382
- "hardis:diagnose:unsecure-connected-apps:org",
6383
- "diagnose:hardis:unsecure-connected-apps:org",
6384
- "diagnose:unsecure-connected-apps:hardis:org",
6385
- "diagnose:unsecure-connected-apps:org:hardis",
6386
- "hardis:org:unsecure-connected-apps:diagnose",
6387
- "org:hardis:unsecure-connected-apps:diagnose",
6388
- "org:unsecure-connected-apps:hardis:diagnose",
6389
- "org:unsecure-connected-apps:diagnose:hardis",
6390
- "hardis:unsecure-connected-apps:org:diagnose",
6391
- "unsecure-connected-apps:hardis:org:diagnose",
6392
- "unsecure-connected-apps:org:hardis:diagnose",
6393
- "unsecure-connected-apps:org:diagnose:hardis",
6394
- "hardis:unsecure-connected-apps:diagnose:org",
6395
- "unsecure-connected-apps:hardis:diagnose:org",
6396
- "unsecure-connected-apps:diagnose:hardis:org",
6397
- "unsecure-connected-apps:diagnose:org:hardis"
6398
- ]
6399
- },
6400
- "hardis:org:diagnose:unused-apex-classes": {
6401
- "aliases": [],
6402
- "args": {},
6403
- "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",
6404
- "examples": [
6405
- "$ sf hardis:org:diagnose:unused-apex-classes",
6406
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6407
- ],
6408
- "flags": {
6409
- "json": {
6410
- "description": "Format output as json.",
6411
- "helpGroup": "GLOBAL",
6412
- "name": "json",
6413
- "allowNo": false,
6414
- "type": "boolean"
6395
+ "hardis:org:diagnose:licenses",
6396
+ "org:hardis:diagnose:licenses",
6397
+ "org:diagnose:hardis:licenses",
6398
+ "org:diagnose:licenses:hardis",
6399
+ "hardis:diagnose:org:licenses",
6400
+ "diagnose:hardis:org:licenses",
6401
+ "diagnose:org:hardis:licenses",
6402
+ "diagnose:org:licenses:hardis",
6403
+ "hardis:diagnose:licenses:org",
6404
+ "diagnose:hardis:licenses:org",
6405
+ "diagnose:licenses:hardis:org",
6406
+ "diagnose:licenses:org:hardis",
6407
+ "hardis:org:licenses:diagnose",
6408
+ "org:hardis:licenses:diagnose",
6409
+ "org:licenses:hardis:diagnose",
6410
+ "org:licenses:diagnose:hardis",
6411
+ "hardis:licenses:org:diagnose",
6412
+ "licenses:hardis:org:diagnose",
6413
+ "licenses:org:hardis:diagnose",
6414
+ "licenses:org:diagnose:hardis",
6415
+ "hardis:licenses:diagnose:org",
6416
+ "licenses:hardis:diagnose:org",
6417
+ "licenses:diagnose:hardis:org",
6418
+ "licenses:diagnose:org:hardis"
6419
+ ]
6420
+ },
6421
+ "hardis:org:diagnose:releaseupdates": {
6422
+ "aliases": [],
6423
+ "args": {},
6424
+ "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",
6425
+ "examples": [
6426
+ "$ sf hardis:org:diagnose:releaseupdates"
6427
+ ],
6428
+ "flags": {
6429
+ "json": {
6430
+ "description": "Format output as json.",
6431
+ "helpGroup": "GLOBAL",
6432
+ "name": "json",
6433
+ "allowNo": false,
6434
+ "type": "boolean"
6415
6435
  },
6416
6436
  "flags-dir": {
6417
6437
  "helpGroup": "GLOBAL",
@@ -6429,14 +6449,6 @@
6429
6449
  "multiple": false,
6430
6450
  "type": "option"
6431
6451
  },
6432
- "days": {
6433
- "char": "t",
6434
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6435
- "name": "days",
6436
- "hasDynamicHelp": false,
6437
- "multiple": false,
6438
- "type": "option"
6439
- },
6440
6452
  "debug": {
6441
6453
  "char": "d",
6442
6454
  "description": "Activate debug mode (more logs)",
@@ -6475,13 +6487,13 @@
6475
6487
  },
6476
6488
  "hasDynamicHelp": true,
6477
6489
  "hiddenAliases": [],
6478
- "id": "hardis:org:diagnose:unused-apex-classes",
6490
+ "id": "hardis:org:diagnose:releaseupdates",
6479
6491
  "pluginAlias": "sfdx-hardis",
6480
6492
  "pluginName": "sfdx-hardis",
6481
6493
  "pluginType": "core",
6482
6494
  "strict": true,
6483
6495
  "enableJsonFlag": true,
6484
- "title": "Detect unused Apex classes in an org",
6496
+ "title": "Check Release Updates of an org",
6485
6497
  "requiresProject": false,
6486
6498
  "isESM": true,
6487
6499
  "relativePath": [
@@ -6490,42 +6502,47 @@
6490
6502
  "hardis",
6491
6503
  "org",
6492
6504
  "diagnose",
6493
- "unused-apex-classes.js"
6505
+ "releaseupdates.js"
6494
6506
  ],
6495
6507
  "aliasPermutations": [],
6496
6508
  "permutations": [
6497
- "hardis:org:diagnose:unused-apex-classes",
6498
- "org:hardis:diagnose:unused-apex-classes",
6499
- "org:diagnose:hardis:unused-apex-classes",
6500
- "org:diagnose:unused-apex-classes:hardis",
6501
- "hardis:diagnose:org:unused-apex-classes",
6502
- "diagnose:hardis:org:unused-apex-classes",
6503
- "diagnose:org:hardis:unused-apex-classes",
6504
- "diagnose:org:unused-apex-classes:hardis",
6505
- "hardis:diagnose:unused-apex-classes:org",
6506
- "diagnose:hardis:unused-apex-classes:org",
6507
- "diagnose:unused-apex-classes:hardis:org",
6508
- "diagnose:unused-apex-classes:org:hardis",
6509
- "hardis:org:unused-apex-classes:diagnose",
6510
- "org:hardis:unused-apex-classes:diagnose",
6511
- "org:unused-apex-classes:hardis:diagnose",
6512
- "org:unused-apex-classes:diagnose:hardis",
6513
- "hardis:unused-apex-classes:org:diagnose",
6514
- "unused-apex-classes:hardis:org:diagnose",
6515
- "unused-apex-classes:org:hardis:diagnose",
6516
- "unused-apex-classes:org:diagnose:hardis",
6517
- "hardis:unused-apex-classes:diagnose:org",
6518
- "unused-apex-classes:hardis:diagnose:org",
6519
- "unused-apex-classes:diagnose:hardis:org",
6520
- "unused-apex-classes:diagnose:org:hardis"
6509
+ "hardis:org:diagnose:releaseupdates",
6510
+ "org:hardis:diagnose:releaseupdates",
6511
+ "org:diagnose:hardis:releaseupdates",
6512
+ "org:diagnose:releaseupdates:hardis",
6513
+ "hardis:diagnose:org:releaseupdates",
6514
+ "diagnose:hardis:org:releaseupdates",
6515
+ "diagnose:org:hardis:releaseupdates",
6516
+ "diagnose:org:releaseupdates:hardis",
6517
+ "hardis:diagnose:releaseupdates:org",
6518
+ "diagnose:hardis:releaseupdates:org",
6519
+ "diagnose:releaseupdates:hardis:org",
6520
+ "diagnose:releaseupdates:org:hardis",
6521
+ "hardis:org:releaseupdates:diagnose",
6522
+ "org:hardis:releaseupdates:diagnose",
6523
+ "org:releaseupdates:hardis:diagnose",
6524
+ "org:releaseupdates:diagnose:hardis",
6525
+ "hardis:releaseupdates:org:diagnose",
6526
+ "releaseupdates:hardis:org:diagnose",
6527
+ "releaseupdates:org:hardis:diagnose",
6528
+ "releaseupdates:org:diagnose:hardis",
6529
+ "hardis:releaseupdates:diagnose:org",
6530
+ "releaseupdates:hardis:diagnose:org",
6531
+ "releaseupdates:diagnose:hardis:org",
6532
+ "releaseupdates:diagnose:org:hardis"
6521
6533
  ]
6522
6534
  },
6523
- "hardis:org:diagnose:unused-connected-apps": {
6535
+ "hardis:org:diagnose:storage-stats": {
6524
6536
  "aliases": [],
6525
6537
  "args": {},
6526
- "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",
6538
+ "description": "**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with flexible grouping options.**\n\nThis command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:\n\n- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.\n- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.\n- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.\n- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.\n\nKey functionalities:\n\n- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.\n- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).\n- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose breakdown fields (date fields, RecordType, custom fields, or relationship fields).\n- **Flexible Breakdown Field:** Supports grouping by any field including:\n - Date/DateTime fields (`CreatedDate`, `LastModifiedDate`, custom date fields)\n - RecordType (`RecordType.Name`)\n - Custom fields (`Status__c`, picklists, text fields)\n - Nested relationship fields (`SBQQ__Quote__r.RecordType.Name`)\n- **Date Granularity Options:** For date/datetime fields, choose between:\n - Year-based grouping (`CALENDAR_YEAR`)\n - Month-based grouping (`CALENDAR_MONTH`)\n - Day-based grouping (exact date)\n- **WHERE Clause Filtering:** Apply SOQL WHERE conditions to filter records before calculating storage (e.g., only active records, records from the last year).\n- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.\n- **Dual CSV Reports:** Generates two CSV files: a detailed breakdown by selected field and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.\n- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.\n- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Limits Retrieval:** Calls `conn.limits()` to retrieve the `DataStorageMB` object containing `Max` and `Remaining` values. Handles negative `Remaining` values (over-usage scenarios) by calculating `overUsageMB` and adjusting display values.\n- **SObject Discovery:** Uses `conn.metadata.list([{ type: 'CustomObject' }])` to get custom objects and `conn.describeGlobal()` to get all SObjects. Filters by object capabilities (`layoutable`, `queryable`, `retrieveable`, `createable`, `updateable`, `deletable`) and excludes metadata types (`__mdt` suffix) and cached empty objects.\n- **User Interaction:** Uses `prompts` for interactive multi-select of SObjects, breakdown field selection, granularity choice (for date fields), and optional WHERE conditions. All objects are pre-selected by default for user convenience.\n- **Field Validation:** Recursively validates breakdown fields including nested relationships (e.g., `SBQQ__Quote__r.RecordType.Name`) by traversing the relationship chain and checking field existence on each related object. Automatically handles special cases like `RecordType` -> `RecordTypeId` and `__r` -> `__c` conversions.\n- **Dynamic Query Generation:** Builds SOQL queries based on field type and granularity:\n - For date fields with year granularity: `SELECT CALENDAR_YEAR(<Field>) breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>) ORDER BY CALENDAR_YEAR(<Field>)`\n - For date fields with month granularity: `SELECT CALENDAR_YEAR(<Field>) year, CALENDAR_MONTH(<Field>) month, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>) ORDER BY CALENDAR_YEAR(<Field>), CALENDAR_MONTH(<Field>)`\n - For non-date fields: `SELECT <Field> breakdown, COUNT(Id) total FROM <SObject> [WHERE ...] GROUP BY <Field> ORDER BY <Field>`\n- **WHERE Clause Support:** Accepts user-provided WHERE conditions via flag (`--where`) or interactive prompt. Injects the condition into all SOQL queries for consistent filtering across all objects.\n- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and breakdown value.\n- **Report Generation:** Uses `generateCsvFile` and `generateReportPath` helpers to create two CSV files in the reports directory:\n - Detailed breakdown: includes all statistics per breakdown value per object (e.g., by year, by month, by RecordType)\n - Totals summary: includes only aggregate totals per object\n - File naming includes breakdown field, granularity (for date fields), and `-filtered` suffix when WHERE clause is applied\n- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (`<username>_empty_tables_cache.json`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.\n- **Progress & UX:** Uses `WebSocketClient` to emit start/step/end progress messages for external monitoring. Outputs summary tables with `uxLogTable` and status messages with `uxLog`.\n- **Return Value:** Returns a JSON object containing `tableStorageInfos` (all rows), `tableStorageInfosTotals` (summary rows), `storageLimits` (org limits object), and `outputFiles` (paths to generated CSV/XLSX reports).\n</details>\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-year-breakdown.png)\n\n![](https://sfdx-hardis.cloudity.com/assets/images/storage-usage-total.png)\n",
6527
6539
  "examples": [
6528
- "$ sf hardis:org:diagnose:unused-connected-apps"
6540
+ "$ sf hardis:org:diagnose:storage-stats",
6541
+ "$ sf hardis:org:diagnose:storage-stats --breakdown-field \"CreatedDate\"",
6542
+ "$ sf hardis:org:diagnose:storage-stats -b \"RecordType.Name\"",
6543
+ "$ sf hardis:org:diagnose:storage-stats --where \"CreatedDate = LAST_N_DAYS:365\"",
6544
+ "$ sf hardis:org:diagnose:storage-stats -w \"Status__c = 'Active'\"",
6545
+ "$ sf hardis:org:diagnose:storage-stats -b \"LastModifiedDate\" -w \"IsDeleted = false\""
6529
6546
  ],
6530
6547
  "flags": {
6531
6548
  "json": {
@@ -6551,6 +6568,22 @@
6551
6568
  "multiple": false,
6552
6569
  "type": "option"
6553
6570
  },
6571
+ "breakdown-field": {
6572
+ "char": "b",
6573
+ "description": "Field to use for storage stats breakdown. Example: \"CreatedDate\", \"LastModifiedDate\", \"RecordType.Name\", or custom fields like \"Status__c\"",
6574
+ "name": "breakdown-field",
6575
+ "hasDynamicHelp": false,
6576
+ "multiple": false,
6577
+ "type": "option"
6578
+ },
6579
+ "where": {
6580
+ "char": "w",
6581
+ "description": "WHERE clause to filter records in the query (without the WHERE keyword). Example: \"CreatedDate = LAST_N_DAYS:365\" or \"Status__c = 'Active'\"",
6582
+ "name": "where",
6583
+ "hasDynamicHelp": false,
6584
+ "multiple": false,
6585
+ "type": "option"
6586
+ },
6554
6587
  "debug": {
6555
6588
  "char": "d",
6556
6589
  "description": "Activate debug mode (more logs)",
@@ -6589,31 +6622,14 @@
6589
6622
  },
6590
6623
  "hasDynamicHelp": true,
6591
6624
  "hiddenAliases": [],
6592
- "id": "hardis:org:diagnose:unused-connected-apps",
6625
+ "id": "hardis:org:diagnose:storage-stats",
6593
6626
  "pluginAlias": "sfdx-hardis",
6594
6627
  "pluginName": "sfdx-hardis",
6595
6628
  "pluginType": "core",
6596
6629
  "strict": true,
6597
6630
  "enableJsonFlag": true,
6598
- "title": "Unused Connected Apps in an org",
6599
- "allowedInactiveConnectedApps": [
6600
- "Ant Migration Tool",
6601
- "Chatter Desktop",
6602
- "Chatter Mobile for BlackBerry",
6603
- "Force.com IDE",
6604
- "OIQ_Integration",
6605
- "Salesforce CLI",
6606
- "Salesforce Files",
6607
- "Salesforce Mobile Dashboards",
6608
- "Salesforce Touch",
6609
- "Salesforce for Outlook",
6610
- "SalesforceA",
6611
- "SalesforceA for Android",
6612
- "SalesforceA for iOS",
6613
- "SalesforceDX Namespace Registry",
6614
- "SalesforceIQ"
6615
- ],
6616
- "requiresProject": false,
6631
+ "title": "Extract Data Storage stats",
6632
+ "requiresProject": true,
6617
6633
  "isESM": true,
6618
6634
  "relativePath": [
6619
6635
  "lib",
@@ -6621,43 +6637,42 @@
6621
6637
  "hardis",
6622
6638
  "org",
6623
6639
  "diagnose",
6624
- "unused-connected-apps.js"
6640
+ "storage-stats.js"
6625
6641
  ],
6626
6642
  "aliasPermutations": [],
6627
6643
  "permutations": [
6628
- "hardis:org:diagnose:unused-connected-apps",
6629
- "org:hardis:diagnose:unused-connected-apps",
6630
- "org:diagnose:hardis:unused-connected-apps",
6631
- "org:diagnose:unused-connected-apps:hardis",
6632
- "hardis:diagnose:org:unused-connected-apps",
6633
- "diagnose:hardis:org:unused-connected-apps",
6634
- "diagnose:org:hardis:unused-connected-apps",
6635
- "diagnose:org:unused-connected-apps:hardis",
6636
- "hardis:diagnose:unused-connected-apps:org",
6637
- "diagnose:hardis:unused-connected-apps:org",
6638
- "diagnose:unused-connected-apps:hardis:org",
6639
- "diagnose:unused-connected-apps:org:hardis",
6640
- "hardis:org:unused-connected-apps:diagnose",
6641
- "org:hardis:unused-connected-apps:diagnose",
6642
- "org:unused-connected-apps:hardis:diagnose",
6643
- "org:unused-connected-apps:diagnose:hardis",
6644
- "hardis:unused-connected-apps:org:diagnose",
6645
- "unused-connected-apps:hardis:org:diagnose",
6646
- "unused-connected-apps:org:hardis:diagnose",
6647
- "unused-connected-apps:org:diagnose:hardis",
6648
- "hardis:unused-connected-apps:diagnose:org",
6649
- "unused-connected-apps:hardis:diagnose:org",
6650
- "unused-connected-apps:diagnose:hardis:org",
6651
- "unused-connected-apps:diagnose:org:hardis"
6644
+ "hardis:org:diagnose:storage-stats",
6645
+ "org:hardis:diagnose:storage-stats",
6646
+ "org:diagnose:hardis:storage-stats",
6647
+ "org:diagnose:storage-stats:hardis",
6648
+ "hardis:diagnose:org:storage-stats",
6649
+ "diagnose:hardis:org:storage-stats",
6650
+ "diagnose:org:hardis:storage-stats",
6651
+ "diagnose:org:storage-stats:hardis",
6652
+ "hardis:diagnose:storage-stats:org",
6653
+ "diagnose:hardis:storage-stats:org",
6654
+ "diagnose:storage-stats:hardis:org",
6655
+ "diagnose:storage-stats:org:hardis",
6656
+ "hardis:org:storage-stats:diagnose",
6657
+ "org:hardis:storage-stats:diagnose",
6658
+ "org:storage-stats:hardis:diagnose",
6659
+ "org:storage-stats:diagnose:hardis",
6660
+ "hardis:storage-stats:org:diagnose",
6661
+ "storage-stats:hardis:org:diagnose",
6662
+ "storage-stats:org:hardis:diagnose",
6663
+ "storage-stats:org:diagnose:hardis",
6664
+ "hardis:storage-stats:diagnose:org",
6665
+ "storage-stats:hardis:diagnose:org",
6666
+ "storage-stats:diagnose:hardis:org",
6667
+ "storage-stats:diagnose:org:hardis"
6652
6668
  ]
6653
6669
  },
6654
- "hardis:org:diagnose:unusedlicenses": {
6670
+ "hardis:org:diagnose:unsecure-connected-apps": {
6655
6671
  "aliases": [],
6656
6672
  "args": {},
6657
- "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",
6673
+ "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",
6658
6674
  "examples": [
6659
- "$ sf hardis:org:diagnose:unusedlicenses",
6660
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
6675
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
6661
6676
  ],
6662
6677
  "flags": {
6663
6678
  "json": {
@@ -6721,32 +6736,14 @@
6721
6736
  },
6722
6737
  "hasDynamicHelp": true,
6723
6738
  "hiddenAliases": [],
6724
- "id": "hardis:org:diagnose:unusedlicenses",
6739
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
6725
6740
  "pluginAlias": "sfdx-hardis",
6726
6741
  "pluginName": "sfdx-hardis",
6727
6742
  "pluginType": "core",
6728
6743
  "strict": true,
6729
6744
  "enableJsonFlag": true,
6730
- "title": "Detect unused Permission Set Licenses (beta)",
6745
+ "title": "Detect Unsecured Connected Apps",
6731
6746
  "requiresProject": false,
6732
- "additionalPermissionSetsToAlwaysGet": [
6733
- "Sales_User"
6734
- ],
6735
- "permSetsPermSetLicenses": [
6736
- {
6737
- "permSet": "Sales_User",
6738
- "permSetLicense": "SalesUserPsl"
6739
- }
6740
- ],
6741
- "profilesPermissionSetLicenses": [
6742
- {
6743
- "profile": "Salesforce API Only",
6744
- "permSetLicense": "SalesforceAPIIntegrationPsl"
6745
- }
6746
- ],
6747
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6748
- "IdentityConnect"
6749
- ],
6750
6747
  "isESM": true,
6751
6748
  "relativePath": [
6752
6749
  "lib",
@@ -6754,46 +6751,43 @@
6754
6751
  "hardis",
6755
6752
  "org",
6756
6753
  "diagnose",
6757
- "unusedlicenses.js"
6754
+ "unsecure-connected-apps.js"
6758
6755
  ],
6759
6756
  "aliasPermutations": [],
6760
6757
  "permutations": [
6761
- "hardis:org:diagnose:unusedlicenses",
6762
- "org:hardis:diagnose:unusedlicenses",
6763
- "org:diagnose:hardis:unusedlicenses",
6764
- "org:diagnose:unusedlicenses:hardis",
6765
- "hardis:diagnose:org:unusedlicenses",
6766
- "diagnose:hardis:org:unusedlicenses",
6767
- "diagnose:org:hardis:unusedlicenses",
6768
- "diagnose:org:unusedlicenses:hardis",
6769
- "hardis:diagnose:unusedlicenses:org",
6770
- "diagnose:hardis:unusedlicenses:org",
6771
- "diagnose:unusedlicenses:hardis:org",
6772
- "diagnose:unusedlicenses:org:hardis",
6773
- "hardis:org:unusedlicenses:diagnose",
6774
- "org:hardis:unusedlicenses:diagnose",
6775
- "org:unusedlicenses:hardis:diagnose",
6776
- "org:unusedlicenses:diagnose:hardis",
6777
- "hardis:unusedlicenses:org:diagnose",
6778
- "unusedlicenses:hardis:org:diagnose",
6779
- "unusedlicenses:org:hardis:diagnose",
6780
- "unusedlicenses:org:diagnose:hardis",
6781
- "hardis:unusedlicenses:diagnose:org",
6782
- "unusedlicenses:hardis:diagnose:org",
6783
- "unusedlicenses:diagnose:hardis:org",
6784
- "unusedlicenses:diagnose:org:hardis"
6758
+ "hardis:org:diagnose:unsecure-connected-apps",
6759
+ "org:hardis:diagnose:unsecure-connected-apps",
6760
+ "org:diagnose:hardis:unsecure-connected-apps",
6761
+ "org:diagnose:unsecure-connected-apps:hardis",
6762
+ "hardis:diagnose:org:unsecure-connected-apps",
6763
+ "diagnose:hardis:org:unsecure-connected-apps",
6764
+ "diagnose:org:hardis:unsecure-connected-apps",
6765
+ "diagnose:org:unsecure-connected-apps:hardis",
6766
+ "hardis:diagnose:unsecure-connected-apps:org",
6767
+ "diagnose:hardis:unsecure-connected-apps:org",
6768
+ "diagnose:unsecure-connected-apps:hardis:org",
6769
+ "diagnose:unsecure-connected-apps:org:hardis",
6770
+ "hardis:org:unsecure-connected-apps:diagnose",
6771
+ "org:hardis:unsecure-connected-apps:diagnose",
6772
+ "org:unsecure-connected-apps:hardis:diagnose",
6773
+ "org:unsecure-connected-apps:diagnose:hardis",
6774
+ "hardis:unsecure-connected-apps:org:diagnose",
6775
+ "unsecure-connected-apps:hardis:org:diagnose",
6776
+ "unsecure-connected-apps:org:hardis:diagnose",
6777
+ "unsecure-connected-apps:org:diagnose:hardis",
6778
+ "hardis:unsecure-connected-apps:diagnose:org",
6779
+ "unsecure-connected-apps:hardis:diagnose:org",
6780
+ "unsecure-connected-apps:diagnose:hardis:org",
6781
+ "unsecure-connected-apps:diagnose:org:hardis"
6785
6782
  ]
6786
6783
  },
6787
- "hardis:org:diagnose:unusedusers": {
6784
+ "hardis:org:diagnose:unused-apex-classes": {
6788
6785
  "aliases": [],
6789
6786
  "args": {},
6790
- "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>",
6787
+ "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",
6791
6788
  "examples": [
6792
- "$ sf hardis:org:diagnose:unusedusers",
6793
- "$ sf hardis:org:diagnose:unusedusers --days 365",
6794
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6795
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6796
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6789
+ "$ sf hardis:org:diagnose:unused-apex-classes",
6790
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6797
6791
  ],
6798
6792
  "flags": {
6799
6793
  "json": {
@@ -6827,33 +6821,6 @@
6827
6821
  "multiple": false,
6828
6822
  "type": "option"
6829
6823
  },
6830
- "licensetypes": {
6831
- "char": "l",
6832
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6833
- "name": "licensetypes",
6834
- "hasDynamicHelp": false,
6835
- "multiple": false,
6836
- "options": [
6837
- "all",
6838
- "all-crm",
6839
- "all-paying"
6840
- ],
6841
- "type": "option"
6842
- },
6843
- "licenseidentifiers": {
6844
- "char": "i",
6845
- "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",
6846
- "name": "licenseidentifiers",
6847
- "hasDynamicHelp": false,
6848
- "multiple": false,
6849
- "type": "option"
6850
- },
6851
- "returnactiveusers": {
6852
- "description": "Inverts the command by returning the active users",
6853
- "name": "returnactiveusers",
6854
- "allowNo": false,
6855
- "type": "boolean"
6856
- },
6857
6824
  "debug": {
6858
6825
  "char": "d",
6859
6826
  "description": "Activate debug mode (more logs)",
@@ -6892,13 +6859,13 @@
6892
6859
  },
6893
6860
  "hasDynamicHelp": true,
6894
6861
  "hiddenAliases": [],
6895
- "id": "hardis:org:diagnose:unusedusers",
6862
+ "id": "hardis:org:diagnose:unused-apex-classes",
6896
6863
  "pluginAlias": "sfdx-hardis",
6897
6864
  "pluginName": "sfdx-hardis",
6898
6865
  "pluginType": "core",
6899
6866
  "strict": true,
6900
6867
  "enableJsonFlag": true,
6901
- "title": "Detect unused Users in Salesforce",
6868
+ "title": "Detect unused Apex classes in an org",
6902
6869
  "requiresProject": false,
6903
6870
  "isESM": true,
6904
6871
  "relativePath": [
@@ -6907,42 +6874,42 @@
6907
6874
  "hardis",
6908
6875
  "org",
6909
6876
  "diagnose",
6910
- "unusedusers.js"
6877
+ "unused-apex-classes.js"
6911
6878
  ],
6912
6879
  "aliasPermutations": [],
6913
6880
  "permutations": [
6914
- "hardis:org:diagnose:unusedusers",
6915
- "org:hardis:diagnose:unusedusers",
6916
- "org:diagnose:hardis:unusedusers",
6917
- "org:diagnose:unusedusers:hardis",
6918
- "hardis:diagnose:org:unusedusers",
6919
- "diagnose:hardis:org:unusedusers",
6920
- "diagnose:org:hardis:unusedusers",
6921
- "diagnose:org:unusedusers:hardis",
6922
- "hardis:diagnose:unusedusers:org",
6923
- "diagnose:hardis:unusedusers:org",
6924
- "diagnose:unusedusers:hardis:org",
6925
- "diagnose:unusedusers:org:hardis",
6926
- "hardis:org:unusedusers:diagnose",
6927
- "org:hardis:unusedusers:diagnose",
6928
- "org:unusedusers:hardis:diagnose",
6929
- "org:unusedusers:diagnose:hardis",
6930
- "hardis:unusedusers:org:diagnose",
6931
- "unusedusers:hardis:org:diagnose",
6932
- "unusedusers:org:hardis:diagnose",
6933
- "unusedusers:org:diagnose:hardis",
6934
- "hardis:unusedusers:diagnose:org",
6935
- "unusedusers:hardis:diagnose:org",
6936
- "unusedusers:diagnose:hardis:org",
6937
- "unusedusers:diagnose:org:hardis"
6881
+ "hardis:org:diagnose:unused-apex-classes",
6882
+ "org:hardis:diagnose:unused-apex-classes",
6883
+ "org:diagnose:hardis:unused-apex-classes",
6884
+ "org:diagnose:unused-apex-classes:hardis",
6885
+ "hardis:diagnose:org:unused-apex-classes",
6886
+ "diagnose:hardis:org:unused-apex-classes",
6887
+ "diagnose:org:hardis:unused-apex-classes",
6888
+ "diagnose:org:unused-apex-classes:hardis",
6889
+ "hardis:diagnose:unused-apex-classes:org",
6890
+ "diagnose:hardis:unused-apex-classes:org",
6891
+ "diagnose:unused-apex-classes:hardis:org",
6892
+ "diagnose:unused-apex-classes:org:hardis",
6893
+ "hardis:org:unused-apex-classes:diagnose",
6894
+ "org:hardis:unused-apex-classes:diagnose",
6895
+ "org:unused-apex-classes:hardis:diagnose",
6896
+ "org:unused-apex-classes:diagnose:hardis",
6897
+ "hardis:unused-apex-classes:org:diagnose",
6898
+ "unused-apex-classes:hardis:org:diagnose",
6899
+ "unused-apex-classes:org:hardis:diagnose",
6900
+ "unused-apex-classes:org:diagnose:hardis",
6901
+ "hardis:unused-apex-classes:diagnose:org",
6902
+ "unused-apex-classes:hardis:diagnose:org",
6903
+ "unused-apex-classes:diagnose:hardis:org",
6904
+ "unused-apex-classes:diagnose:org:hardis"
6938
6905
  ]
6939
6906
  },
6940
- "hardis:org:files:export": {
6907
+ "hardis:org:diagnose:unused-connected-apps": {
6941
6908
  "aliases": [],
6942
6909
  "args": {},
6943
- "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **Configuration-Driven Export:** Relies on an `export.json` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.\n- **File Size Filtering:** Supports minimum file size filtering via the `fileSizeMin` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **Resume Mode:** When `--resume` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **Interactive Mode:** When existing files are found and `--resume` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Configurable Export Options:** Allows overriding default export settings such as `chunksize` (number of records processed in a batch), `polltimeout` (timeout for Bulk API calls), and `startchunknumber` (to resume a failed export).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file export project, `promptFilesExportConfiguration` for customizing export options, and prompts for resume/restart choice when existing files are found.\n- **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (`success`, `failed`, `skipped`, `invalid`) for comprehensive tracking and troubleshooting.\n</details>\n",
6910
+ "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",
6944
6911
  "examples": [
6945
- "$ sf hardis:org:files:export"
6912
+ "$ sf hardis:org:diagnose:unused-connected-apps"
6946
6913
  ],
6947
6914
  "flags": {
6948
6915
  "json": {
@@ -6960,48 +6927,14 @@
6960
6927
  "multiple": false,
6961
6928
  "type": "option"
6962
6929
  },
6963
- "path": {
6964
- "char": "p",
6965
- "description": "Path to the file export project",
6966
- "name": "path",
6967
- "hasDynamicHelp": false,
6968
- "multiple": false,
6969
- "type": "option"
6970
- },
6971
- "chunksize": {
6972
- "char": "c",
6973
- "description": "Number of records to add in a chunk before it is processed",
6974
- "name": "chunksize",
6975
- "default": 1000,
6976
- "hasDynamicHelp": false,
6977
- "multiple": false,
6978
- "type": "option"
6979
- },
6980
- "polltimeout": {
6981
- "char": "t",
6982
- "description": "Timeout in MS for Bulk API calls",
6983
- "name": "polltimeout",
6984
- "default": 300000,
6985
- "hasDynamicHelp": false,
6986
- "multiple": false,
6987
- "type": "option"
6988
- },
6989
- "startchunknumber": {
6990
- "char": "s",
6991
- "description": "Chunk number to start from",
6992
- "name": "startchunknumber",
6993
- "default": 0,
6930
+ "outputfile": {
6931
+ "char": "f",
6932
+ "description": "Force the path and name of output report file. Must end with .csv",
6933
+ "name": "outputfile",
6994
6934
  "hasDynamicHelp": false,
6995
6935
  "multiple": false,
6996
6936
  "type": "option"
6997
6937
  },
6998
- "resume": {
6999
- "char": "r",
7000
- "description": "Resume previous export by checking existing files (default in CI)",
7001
- "name": "resume",
7002
- "allowNo": false,
7003
- "type": "boolean"
7004
- },
7005
6938
  "debug": {
7006
6939
  "char": "d",
7007
6940
  "description": "Activate debug mode (more logs)",
@@ -7040,13 +6973,30 @@
7040
6973
  },
7041
6974
  "hasDynamicHelp": true,
7042
6975
  "hiddenAliases": [],
7043
- "id": "hardis:org:files:export",
6976
+ "id": "hardis:org:diagnose:unused-connected-apps",
7044
6977
  "pluginAlias": "sfdx-hardis",
7045
6978
  "pluginName": "sfdx-hardis",
7046
6979
  "pluginType": "core",
7047
6980
  "strict": true,
7048
6981
  "enableJsonFlag": true,
7049
- "title": "Export files",
6982
+ "title": "Unused Connected Apps in an org",
6983
+ "allowedInactiveConnectedApps": [
6984
+ "Ant Migration Tool",
6985
+ "Chatter Desktop",
6986
+ "Chatter Mobile for BlackBerry",
6987
+ "Force.com IDE",
6988
+ "OIQ_Integration",
6989
+ "Salesforce CLI",
6990
+ "Salesforce Files",
6991
+ "Salesforce Mobile Dashboards",
6992
+ "Salesforce Touch",
6993
+ "Salesforce for Outlook",
6994
+ "SalesforceA",
6995
+ "SalesforceA for Android",
6996
+ "SalesforceA for iOS",
6997
+ "SalesforceDX Namespace Registry",
6998
+ "SalesforceIQ"
6999
+ ],
7050
7000
  "requiresProject": false,
7051
7001
  "isESM": true,
7052
7002
  "relativePath": [
@@ -7054,43 +7004,44 @@
7054
7004
  "commands",
7055
7005
  "hardis",
7056
7006
  "org",
7057
- "files",
7058
- "export.js"
7007
+ "diagnose",
7008
+ "unused-connected-apps.js"
7059
7009
  ],
7060
7010
  "aliasPermutations": [],
7061
7011
  "permutations": [
7062
- "hardis:org:files:export",
7063
- "org:hardis:files:export",
7064
- "org:files:hardis:export",
7065
- "org:files:export:hardis",
7066
- "hardis:files:org:export",
7067
- "files:hardis:org:export",
7068
- "files:org:hardis:export",
7069
- "files:org:export:hardis",
7070
- "hardis:files:export:org",
7071
- "files:hardis:export:org",
7072
- "files:export:hardis:org",
7073
- "files:export:org:hardis",
7074
- "hardis:org:export:files",
7075
- "org:hardis:export:files",
7076
- "org:export:hardis:files",
7077
- "org:export:files:hardis",
7078
- "hardis:export:org:files",
7079
- "export:hardis:org:files",
7080
- "export:org:hardis:files",
7081
- "export:org:files:hardis",
7082
- "hardis:export:files:org",
7083
- "export:hardis:files:org",
7084
- "export:files:hardis:org",
7085
- "export:files:org:hardis"
7012
+ "hardis:org:diagnose:unused-connected-apps",
7013
+ "org:hardis:diagnose:unused-connected-apps",
7014
+ "org:diagnose:hardis:unused-connected-apps",
7015
+ "org:diagnose:unused-connected-apps:hardis",
7016
+ "hardis:diagnose:org:unused-connected-apps",
7017
+ "diagnose:hardis:org:unused-connected-apps",
7018
+ "diagnose:org:hardis:unused-connected-apps",
7019
+ "diagnose:org:unused-connected-apps:hardis",
7020
+ "hardis:diagnose:unused-connected-apps:org",
7021
+ "diagnose:hardis:unused-connected-apps:org",
7022
+ "diagnose:unused-connected-apps:hardis:org",
7023
+ "diagnose:unused-connected-apps:org:hardis",
7024
+ "hardis:org:unused-connected-apps:diagnose",
7025
+ "org:hardis:unused-connected-apps:diagnose",
7026
+ "org:unused-connected-apps:hardis:diagnose",
7027
+ "org:unused-connected-apps:diagnose:hardis",
7028
+ "hardis:unused-connected-apps:org:diagnose",
7029
+ "unused-connected-apps:hardis:org:diagnose",
7030
+ "unused-connected-apps:org:hardis:diagnose",
7031
+ "unused-connected-apps:org:diagnose:hardis",
7032
+ "hardis:unused-connected-apps:diagnose:org",
7033
+ "unused-connected-apps:hardis:diagnose:org",
7034
+ "unused-connected-apps:diagnose:hardis:org",
7035
+ "unused-connected-apps:diagnose:org:hardis"
7086
7036
  ]
7087
7037
  },
7088
- "hardis:org:files:import": {
7038
+ "hardis:org:diagnose:unusedlicenses": {
7089
7039
  "aliases": [],
7090
7040
  "args": {},
7091
- "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",
7041
+ "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",
7092
7042
  "examples": [
7093
- "$ sf hardis:org:files:import"
7043
+ "$ sf hardis:org:diagnose:unusedlicenses",
7044
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
7094
7045
  ],
7095
7046
  "flags": {
7096
7047
  "json": {
@@ -7108,21 +7059,14 @@
7108
7059
  "multiple": false,
7109
7060
  "type": "option"
7110
7061
  },
7111
- "path": {
7112
- "char": "p",
7113
- "description": "Path to the file export project",
7114
- "name": "path",
7062
+ "outputfile": {
7063
+ "char": "f",
7064
+ "description": "Force the path and name of output report file. Must end with .csv",
7065
+ "name": "outputfile",
7115
7066
  "hasDynamicHelp": false,
7116
7067
  "multiple": false,
7117
7068
  "type": "option"
7118
7069
  },
7119
- "overwrite": {
7120
- "char": "f",
7121
- "description": "Override existing files (doubles the number of API calls)",
7122
- "name": "overwrite",
7123
- "allowNo": false,
7124
- "type": "boolean"
7125
- },
7126
7070
  "debug": {
7127
7071
  "char": "d",
7128
7072
  "description": "Activate debug mode (more logs)",
@@ -7161,58 +7105,79 @@
7161
7105
  },
7162
7106
  "hasDynamicHelp": true,
7163
7107
  "hiddenAliases": [],
7164
- "id": "hardis:org:files:import",
7108
+ "id": "hardis:org:diagnose:unusedlicenses",
7165
7109
  "pluginAlias": "sfdx-hardis",
7166
7110
  "pluginName": "sfdx-hardis",
7167
7111
  "pluginType": "core",
7168
7112
  "strict": true,
7169
7113
  "enableJsonFlag": true,
7170
- "title": "Import files",
7114
+ "title": "Detect unused Permission Set Licenses (beta)",
7171
7115
  "requiresProject": false,
7116
+ "additionalPermissionSetsToAlwaysGet": [
7117
+ "Sales_User"
7118
+ ],
7119
+ "permSetsPermSetLicenses": [
7120
+ {
7121
+ "permSet": "Sales_User",
7122
+ "permSetLicense": "SalesUserPsl"
7123
+ }
7124
+ ],
7125
+ "profilesPermissionSetLicenses": [
7126
+ {
7127
+ "profile": "Salesforce API Only",
7128
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
7129
+ }
7130
+ ],
7131
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
7132
+ "IdentityConnect"
7133
+ ],
7172
7134
  "isESM": true,
7173
7135
  "relativePath": [
7174
7136
  "lib",
7175
7137
  "commands",
7176
7138
  "hardis",
7177
7139
  "org",
7178
- "files",
7179
- "import.js"
7140
+ "diagnose",
7141
+ "unusedlicenses.js"
7180
7142
  ],
7181
7143
  "aliasPermutations": [],
7182
7144
  "permutations": [
7183
- "hardis:org:files:import",
7184
- "org:hardis:files:import",
7185
- "org:files:hardis:import",
7186
- "org:files:import:hardis",
7187
- "hardis:files:org:import",
7188
- "files:hardis:org:import",
7189
- "files:org:hardis:import",
7190
- "files:org:import:hardis",
7191
- "hardis:files:import:org",
7192
- "files:hardis:import:org",
7193
- "files:import:hardis:org",
7194
- "files:import:org:hardis",
7195
- "hardis:org:import:files",
7196
- "org:hardis:import:files",
7197
- "org:import:hardis:files",
7198
- "org:import:files:hardis",
7199
- "hardis:import:org:files",
7200
- "import:hardis:org:files",
7201
- "import:org:hardis:files",
7202
- "import:org:files:hardis",
7203
- "hardis:import:files:org",
7204
- "import:hardis:files:org",
7205
- "import:files:hardis:org",
7206
- "import:files:org:hardis"
7145
+ "hardis:org:diagnose:unusedlicenses",
7146
+ "org:hardis:diagnose:unusedlicenses",
7147
+ "org:diagnose:hardis:unusedlicenses",
7148
+ "org:diagnose:unusedlicenses:hardis",
7149
+ "hardis:diagnose:org:unusedlicenses",
7150
+ "diagnose:hardis:org:unusedlicenses",
7151
+ "diagnose:org:hardis:unusedlicenses",
7152
+ "diagnose:org:unusedlicenses:hardis",
7153
+ "hardis:diagnose:unusedlicenses:org",
7154
+ "diagnose:hardis:unusedlicenses:org",
7155
+ "diagnose:unusedlicenses:hardis:org",
7156
+ "diagnose:unusedlicenses:org:hardis",
7157
+ "hardis:org:unusedlicenses:diagnose",
7158
+ "org:hardis:unusedlicenses:diagnose",
7159
+ "org:unusedlicenses:hardis:diagnose",
7160
+ "org:unusedlicenses:diagnose:hardis",
7161
+ "hardis:unusedlicenses:org:diagnose",
7162
+ "unusedlicenses:hardis:org:diagnose",
7163
+ "unusedlicenses:org:hardis:diagnose",
7164
+ "unusedlicenses:org:diagnose:hardis",
7165
+ "hardis:unusedlicenses:diagnose:org",
7166
+ "unusedlicenses:hardis:diagnose:org",
7167
+ "unusedlicenses:diagnose:hardis:org",
7168
+ "unusedlicenses:diagnose:org:hardis"
7207
7169
  ]
7208
7170
  },
7209
- "hardis:org:fix:listviewmine": {
7171
+ "hardis:org:diagnose:unusedusers": {
7210
7172
  "aliases": [],
7211
7173
  "args": {},
7212
- "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",
7174
+ "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>",
7213
7175
  "examples": [
7214
- "$ sf hardis:org:fix:listviewmine",
7215
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
7176
+ "$ sf hardis:org:diagnose:unusedusers",
7177
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
7178
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
7179
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
7180
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
7216
7181
  ],
7217
7182
  "flags": {
7218
7183
  "json": {
@@ -7230,14 +7195,49 @@
7230
7195
  "multiple": false,
7231
7196
  "type": "option"
7232
7197
  },
7233
- "listviews": {
7198
+ "outputfile": {
7199
+ "char": "f",
7200
+ "description": "Force the path and name of output report file. Must end with .csv",
7201
+ "name": "outputfile",
7202
+ "hasDynamicHelp": false,
7203
+ "multiple": false,
7204
+ "type": "option"
7205
+ },
7206
+ "days": {
7207
+ "char": "t",
7208
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
7209
+ "name": "days",
7210
+ "hasDynamicHelp": false,
7211
+ "multiple": false,
7212
+ "type": "option"
7213
+ },
7214
+ "licensetypes": {
7234
7215
  "char": "l",
7235
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
7236
- "name": "listviews",
7216
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
7217
+ "name": "licensetypes",
7218
+ "hasDynamicHelp": false,
7219
+ "multiple": false,
7220
+ "options": [
7221
+ "all",
7222
+ "all-crm",
7223
+ "all-paying"
7224
+ ],
7225
+ "type": "option"
7226
+ },
7227
+ "licenseidentifiers": {
7228
+ "char": "i",
7229
+ "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",
7230
+ "name": "licenseidentifiers",
7237
7231
  "hasDynamicHelp": false,
7238
7232
  "multiple": false,
7239
7233
  "type": "option"
7240
7234
  },
7235
+ "returnactiveusers": {
7236
+ "description": "Inverts the command by returning the active users",
7237
+ "name": "returnactiveusers",
7238
+ "allowNo": false,
7239
+ "type": "boolean"
7240
+ },
7241
7241
  "debug": {
7242
7242
  "char": "d",
7243
7243
  "description": "Activate debug mode (more logs)",
@@ -7276,49 +7276,49 @@
7276
7276
  },
7277
7277
  "hasDynamicHelp": true,
7278
7278
  "hiddenAliases": [],
7279
- "id": "hardis:org:fix:listviewmine",
7279
+ "id": "hardis:org:diagnose:unusedusers",
7280
7280
  "pluginAlias": "sfdx-hardis",
7281
7281
  "pluginName": "sfdx-hardis",
7282
7282
  "pluginType": "core",
7283
- "strict": true,
7284
- "enableJsonFlag": true,
7285
- "title": "Fix listviews with ",
7286
- "requiresProject": true,
7287
- "isESM": true,
7288
- "relativePath": [
7289
- "lib",
7290
- "commands",
7291
- "hardis",
7292
- "org",
7293
- "fix",
7294
- "listviewmine.js"
7295
- ],
7296
- "aliasPermutations": [],
7297
- "permutations": [
7298
- "hardis:org:fix:listviewmine",
7299
- "org:hardis:fix:listviewmine",
7300
- "org:fix:hardis:listviewmine",
7301
- "org:fix:listviewmine:hardis",
7302
- "hardis:fix:org:listviewmine",
7303
- "fix:hardis:org:listviewmine",
7304
- "fix:org:hardis:listviewmine",
7305
- "fix:org:listviewmine:hardis",
7306
- "hardis:fix:listviewmine:org",
7307
- "fix:hardis:listviewmine:org",
7308
- "fix:listviewmine:hardis:org",
7309
- "fix:listviewmine:org:hardis",
7310
- "hardis:org:listviewmine:fix",
7311
- "org:hardis:listviewmine:fix",
7312
- "org:listviewmine:hardis:fix",
7313
- "org:listviewmine:fix:hardis",
7314
- "hardis:listviewmine:org:fix",
7315
- "listviewmine:hardis:org:fix",
7316
- "listviewmine:org:hardis:fix",
7317
- "listviewmine:org:fix:hardis",
7318
- "hardis:listviewmine:fix:org",
7319
- "listviewmine:hardis:fix:org",
7320
- "listviewmine:fix:hardis:org",
7321
- "listviewmine:fix:org:hardis"
7283
+ "strict": true,
7284
+ "enableJsonFlag": true,
7285
+ "title": "Detect unused Users in Salesforce",
7286
+ "requiresProject": false,
7287
+ "isESM": true,
7288
+ "relativePath": [
7289
+ "lib",
7290
+ "commands",
7291
+ "hardis",
7292
+ "org",
7293
+ "diagnose",
7294
+ "unusedusers.js"
7295
+ ],
7296
+ "aliasPermutations": [],
7297
+ "permutations": [
7298
+ "hardis:org:diagnose:unusedusers",
7299
+ "org:hardis:diagnose:unusedusers",
7300
+ "org:diagnose:hardis:unusedusers",
7301
+ "org:diagnose:unusedusers:hardis",
7302
+ "hardis:diagnose:org:unusedusers",
7303
+ "diagnose:hardis:org:unusedusers",
7304
+ "diagnose:org:hardis:unusedusers",
7305
+ "diagnose:org:unusedusers:hardis",
7306
+ "hardis:diagnose:unusedusers:org",
7307
+ "diagnose:hardis:unusedusers:org",
7308
+ "diagnose:unusedusers:hardis:org",
7309
+ "diagnose:unusedusers:org:hardis",
7310
+ "hardis:org:unusedusers:diagnose",
7311
+ "org:hardis:unusedusers:diagnose",
7312
+ "org:unusedusers:hardis:diagnose",
7313
+ "org:unusedusers:diagnose:hardis",
7314
+ "hardis:unusedusers:org:diagnose",
7315
+ "unusedusers:hardis:org:diagnose",
7316
+ "unusedusers:org:hardis:diagnose",
7317
+ "unusedusers:org:diagnose:hardis",
7318
+ "hardis:unusedusers:diagnose:org",
7319
+ "unusedusers:hardis:diagnose:org",
7320
+ "unusedusers:diagnose:hardis:org",
7321
+ "unusedusers:diagnose:org:hardis"
7322
7322
  ]
7323
7323
  },
7324
7324
  "hardis:org:generate:packagexmlfull": {
@@ -8192,113 +8192,6 @@
8192
8192
  "flow:purge:org:hardis"
8193
8193
  ]
8194
8194
  },
8195
- "hardis:org:retrieve:packageconfig": {
8196
- "aliases": [],
8197
- "args": {},
8198
- "description": "\n**Retrieves the installed package configuration from a Salesforce org and optionally updates the local project configuration.**\n\nThis command is useful for maintaining an accurate record of installed packages within your Salesforce project, which is crucial for managing dependencies and ensuring consistent deployments across environments.\n\nKey functionalities:\n\n- **Package Listing:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a list of all installed packages.\n- **Configuration Update:** Offers the option to update your local project's configuration with the retrieved list of installed packages. This can be beneficial for automating package installations during environment setup or CI/CD processes.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Org Connection:** It establishes a connection to the target Salesforce org using the provided or prompted username.\n- **Metadata Retrieval:** It utilizes `MetadataUtils.listInstalledPackages` to query the Salesforce org and obtain details about the installed packages.\n- **Interactive Prompt:** It uses the `prompts` library to ask the user whether they want to update their local project configuration with the retrieved package list.\n- **Configuration Management:** If the user confirms, it calls `managePackageConfig` to update the project's configuration file (likely `.sfdx-hardis.yml`) with the new package information.\n- **User Feedback:** Provides clear messages to the user about the success of the package retrieval and configuration update.\n</details>\n",
8199
- "examples": [
8200
- "$ sf hardis:org:retrieve:packageconfig",
8201
- "sf hardis:org:retrieve:packageconfig -u myOrg"
8202
- ],
8203
- "flags": {
8204
- "json": {
8205
- "description": "Format output as json.",
8206
- "helpGroup": "GLOBAL",
8207
- "name": "json",
8208
- "allowNo": false,
8209
- "type": "boolean"
8210
- },
8211
- "flags-dir": {
8212
- "helpGroup": "GLOBAL",
8213
- "name": "flags-dir",
8214
- "summary": "Import flag values from a directory.",
8215
- "hasDynamicHelp": false,
8216
- "multiple": false,
8217
- "type": "option"
8218
- },
8219
- "debug": {
8220
- "char": "d",
8221
- "description": "Activate debug mode (more logs)",
8222
- "name": "debug",
8223
- "allowNo": false,
8224
- "type": "boolean"
8225
- },
8226
- "websocket": {
8227
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8228
- "name": "websocket",
8229
- "hasDynamicHelp": false,
8230
- "multiple": false,
8231
- "type": "option"
8232
- },
8233
- "skipauth": {
8234
- "description": "Skip authentication check when a default username is required",
8235
- "name": "skipauth",
8236
- "allowNo": false,
8237
- "type": "boolean"
8238
- },
8239
- "target-org": {
8240
- "aliases": [
8241
- "targetusername",
8242
- "u"
8243
- ],
8244
- "char": "o",
8245
- "deprecateAliases": true,
8246
- "name": "target-org",
8247
- "noCacheDefault": true,
8248
- "required": true,
8249
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8250
- "hasDynamicHelp": true,
8251
- "multiple": false,
8252
- "type": "option"
8253
- }
8254
- },
8255
- "hasDynamicHelp": true,
8256
- "hiddenAliases": [],
8257
- "id": "hardis:org:retrieve:packageconfig",
8258
- "pluginAlias": "sfdx-hardis",
8259
- "pluginName": "sfdx-hardis",
8260
- "pluginType": "core",
8261
- "strict": true,
8262
- "enableJsonFlag": true,
8263
- "title": "Retrieve package configuration from an org",
8264
- "requiresProject": false,
8265
- "isESM": true,
8266
- "relativePath": [
8267
- "lib",
8268
- "commands",
8269
- "hardis",
8270
- "org",
8271
- "retrieve",
8272
- "packageconfig.js"
8273
- ],
8274
- "aliasPermutations": [],
8275
- "permutations": [
8276
- "hardis:org:retrieve:packageconfig",
8277
- "org:hardis:retrieve:packageconfig",
8278
- "org:retrieve:hardis:packageconfig",
8279
- "org:retrieve:packageconfig:hardis",
8280
- "hardis:retrieve:org:packageconfig",
8281
- "retrieve:hardis:org:packageconfig",
8282
- "retrieve:org:hardis:packageconfig",
8283
- "retrieve:org:packageconfig:hardis",
8284
- "hardis:retrieve:packageconfig:org",
8285
- "retrieve:hardis:packageconfig:org",
8286
- "retrieve:packageconfig:hardis:org",
8287
- "retrieve:packageconfig:org:hardis",
8288
- "hardis:org:packageconfig:retrieve",
8289
- "org:hardis:packageconfig:retrieve",
8290
- "org:packageconfig:hardis:retrieve",
8291
- "org:packageconfig:retrieve:hardis",
8292
- "hardis:packageconfig:org:retrieve",
8293
- "packageconfig:hardis:org:retrieve",
8294
- "packageconfig:org:hardis:retrieve",
8295
- "packageconfig:org:retrieve:hardis",
8296
- "hardis:packageconfig:retrieve:org",
8297
- "packageconfig:hardis:retrieve:org",
8298
- "packageconfig:retrieve:hardis:org",
8299
- "packageconfig:retrieve:org:hardis"
8300
- ]
8301
- },
8302
8195
  "hardis:org:refresh:after-refresh": {
8303
8196
  "aliases": [],
8304
8197
  "args": {},
@@ -8538,6 +8431,113 @@
8538
8431
  "before-refresh:refresh:org:hardis"
8539
8432
  ]
8540
8433
  },
8434
+ "hardis:org:retrieve:packageconfig": {
8435
+ "aliases": [],
8436
+ "args": {},
8437
+ "description": "\n**Retrieves the installed package configuration from a Salesforce org and optionally updates the local project configuration.**\n\nThis command is useful for maintaining an accurate record of installed packages within your Salesforce project, which is crucial for managing dependencies and ensuring consistent deployments across environments.\n\nKey functionalities:\n\n- **Package Listing:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a list of all installed packages.\n- **Configuration Update:** Offers the option to update your local project's configuration with the retrieved list of installed packages. This can be beneficial for automating package installations during environment setup or CI/CD processes.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Org Connection:** It establishes a connection to the target Salesforce org using the provided or prompted username.\n- **Metadata Retrieval:** It utilizes `MetadataUtils.listInstalledPackages` to query the Salesforce org and obtain details about the installed packages.\n- **Interactive Prompt:** It uses the `prompts` library to ask the user whether they want to update their local project configuration with the retrieved package list.\n- **Configuration Management:** If the user confirms, it calls `managePackageConfig` to update the project's configuration file (likely `.sfdx-hardis.yml`) with the new package information.\n- **User Feedback:** Provides clear messages to the user about the success of the package retrieval and configuration update.\n</details>\n",
8438
+ "examples": [
8439
+ "$ sf hardis:org:retrieve:packageconfig",
8440
+ "sf hardis:org:retrieve:packageconfig -u myOrg"
8441
+ ],
8442
+ "flags": {
8443
+ "json": {
8444
+ "description": "Format output as json.",
8445
+ "helpGroup": "GLOBAL",
8446
+ "name": "json",
8447
+ "allowNo": false,
8448
+ "type": "boolean"
8449
+ },
8450
+ "flags-dir": {
8451
+ "helpGroup": "GLOBAL",
8452
+ "name": "flags-dir",
8453
+ "summary": "Import flag values from a directory.",
8454
+ "hasDynamicHelp": false,
8455
+ "multiple": false,
8456
+ "type": "option"
8457
+ },
8458
+ "debug": {
8459
+ "char": "d",
8460
+ "description": "Activate debug mode (more logs)",
8461
+ "name": "debug",
8462
+ "allowNo": false,
8463
+ "type": "boolean"
8464
+ },
8465
+ "websocket": {
8466
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
8467
+ "name": "websocket",
8468
+ "hasDynamicHelp": false,
8469
+ "multiple": false,
8470
+ "type": "option"
8471
+ },
8472
+ "skipauth": {
8473
+ "description": "Skip authentication check when a default username is required",
8474
+ "name": "skipauth",
8475
+ "allowNo": false,
8476
+ "type": "boolean"
8477
+ },
8478
+ "target-org": {
8479
+ "aliases": [
8480
+ "targetusername",
8481
+ "u"
8482
+ ],
8483
+ "char": "o",
8484
+ "deprecateAliases": true,
8485
+ "name": "target-org",
8486
+ "noCacheDefault": true,
8487
+ "required": true,
8488
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
8489
+ "hasDynamicHelp": true,
8490
+ "multiple": false,
8491
+ "type": "option"
8492
+ }
8493
+ },
8494
+ "hasDynamicHelp": true,
8495
+ "hiddenAliases": [],
8496
+ "id": "hardis:org:retrieve:packageconfig",
8497
+ "pluginAlias": "sfdx-hardis",
8498
+ "pluginName": "sfdx-hardis",
8499
+ "pluginType": "core",
8500
+ "strict": true,
8501
+ "enableJsonFlag": true,
8502
+ "title": "Retrieve package configuration from an org",
8503
+ "requiresProject": false,
8504
+ "isESM": true,
8505
+ "relativePath": [
8506
+ "lib",
8507
+ "commands",
8508
+ "hardis",
8509
+ "org",
8510
+ "retrieve",
8511
+ "packageconfig.js"
8512
+ ],
8513
+ "aliasPermutations": [],
8514
+ "permutations": [
8515
+ "hardis:org:retrieve:packageconfig",
8516
+ "org:hardis:retrieve:packageconfig",
8517
+ "org:retrieve:hardis:packageconfig",
8518
+ "org:retrieve:packageconfig:hardis",
8519
+ "hardis:retrieve:org:packageconfig",
8520
+ "retrieve:hardis:org:packageconfig",
8521
+ "retrieve:org:hardis:packageconfig",
8522
+ "retrieve:org:packageconfig:hardis",
8523
+ "hardis:retrieve:packageconfig:org",
8524
+ "retrieve:hardis:packageconfig:org",
8525
+ "retrieve:packageconfig:hardis:org",
8526
+ "retrieve:packageconfig:org:hardis",
8527
+ "hardis:org:packageconfig:retrieve",
8528
+ "org:hardis:packageconfig:retrieve",
8529
+ "org:packageconfig:hardis:retrieve",
8530
+ "org:packageconfig:retrieve:hardis",
8531
+ "hardis:packageconfig:org:retrieve",
8532
+ "packageconfig:hardis:org:retrieve",
8533
+ "packageconfig:org:hardis:retrieve",
8534
+ "packageconfig:org:retrieve:hardis",
8535
+ "hardis:packageconfig:retrieve:org",
8536
+ "packageconfig:hardis:retrieve:org",
8537
+ "packageconfig:retrieve:hardis:org",
8538
+ "packageconfig:retrieve:org:hardis"
8539
+ ]
8540
+ },
8541
8541
  "hardis:org:test:apex": {
8542
8542
  "aliases": [],
8543
8543
  "args": {},
@@ -11626,8 +11626,7 @@
11626
11626
  "deprecateAliases": true,
11627
11627
  "name": "target-org",
11628
11628
  "noCacheDefault": true,
11629
- "required": true,
11630
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
11629
+ "summary": "Username or alias of the target org.",
11631
11630
  "hasDynamicHelp": true,
11632
11631
  "multiple": false,
11633
11632
  "type": "option"
@@ -15505,5 +15504,5 @@
15505
15504
  ]
15506
15505
  }
15507
15506
  },
15508
- "version": "6.12.3"
15507
+ "version": "6.12.5"
15509
15508
  }