sfdx-hardis 6.21.2-beta202601131228.0 → 6.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/oclif.manifest.json +638 -638
  2. package/package.json +1 -1
@@ -132,13 +132,12 @@
132
132
  "clear:cache:hardis"
133
133
  ]
134
134
  },
135
- "hardis:auth:login": {
135
+ "hardis:config:get": {
136
136
  "aliases": [],
137
137
  "args": {},
138
- "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
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",
139
139
  "examples": [
140
- "$ sf hardis:auth:login",
141
- "CI=true CI_COMMIT_REF_NAME=monitoring_myclient sf hardis:auth:login"
140
+ "$ sf hardis:project:deploy:sources:metadata"
142
141
  ],
143
142
  "flags": {
144
143
  "json": {
@@ -156,28 +155,20 @@
156
155
  "multiple": false,
157
156
  "type": "option"
158
157
  },
159
- "instanceurl": {
160
- "char": "r",
161
- "description": "URL of org instance",
162
- "name": "instanceurl",
158
+ "level": {
159
+ "char": "l",
160
+ "description": "project,branch or user",
161
+ "name": "level",
162
+ "default": "project",
163
163
  "hasDynamicHelp": false,
164
164
  "multiple": false,
165
+ "options": [
166
+ "project",
167
+ "branch",
168
+ "user"
169
+ ],
165
170
  "type": "option"
166
171
  },
167
- "devhub": {
168
- "char": "h",
169
- "description": "Also connect associated DevHub",
170
- "name": "devhub",
171
- "allowNo": false,
172
- "type": "boolean"
173
- },
174
- "scratchorg": {
175
- "char": "s",
176
- "description": "Scratch org",
177
- "name": "scratchorg",
178
- "allowNo": false,
179
- "type": "boolean"
180
- },
181
172
  "debug": {
182
173
  "char": "d",
183
174
  "description": "Activate debug mode (more logs)",
@@ -201,38 +192,39 @@
201
192
  },
202
193
  "hasDynamicHelp": false,
203
194
  "hiddenAliases": [],
204
- "id": "hardis:auth:login",
195
+ "id": "hardis:config:get",
205
196
  "pluginAlias": "sfdx-hardis",
206
197
  "pluginName": "sfdx-hardis",
207
198
  "pluginType": "core",
208
199
  "strict": true,
209
200
  "enableJsonFlag": true,
210
- "title": "Login",
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
- "auth",
218
- "login.js"
208
+ "config",
209
+ "get.js"
219
210
  ],
220
211
  "aliasPermutations": [],
221
212
  "permutations": [
222
- "hardis:auth:login",
223
- "auth:hardis:login",
224
- "auth:login:hardis",
225
- "hardis:login:auth",
226
- "login:hardis:auth",
227
- "login:auth: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:datacloud:sql-query": {
@@ -7536,14 +7536,12 @@
7536
7536
  "listviewmine:fix:org:hardis"
7537
7537
  ]
7538
7538
  },
7539
- "hardis:org:generate:packagexmlfull": {
7539
+ "hardis:org:files:export": {
7540
7540
  "aliases": [],
7541
7541
  "args": {},
7542
- "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
7542
+ "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",
7543
7543
  "examples": [
7544
- "$ sf hardis:org:generate:packagexmlfull",
7545
- "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
7546
- "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
7544
+ "$ sf hardis:org:files:export"
7547
7545
  ],
7548
7546
  "flags": {
7549
7547
  "json": {
@@ -7561,13 +7559,48 @@
7561
7559
  "multiple": false,
7562
7560
  "type": "option"
7563
7561
  },
7564
- "outputfile": {
7565
- "description": "Output package.xml file",
7566
- "name": "outputfile",
7562
+ "path": {
7563
+ "char": "p",
7564
+ "description": "Path to the file export project",
7565
+ "name": "path",
7566
+ "hasDynamicHelp": false,
7567
+ "multiple": false,
7568
+ "type": "option"
7569
+ },
7570
+ "chunksize": {
7571
+ "char": "c",
7572
+ "description": "Number of records to add in a chunk before it is processed",
7573
+ "name": "chunksize",
7574
+ "default": 1000,
7575
+ "hasDynamicHelp": false,
7576
+ "multiple": false,
7577
+ "type": "option"
7578
+ },
7579
+ "polltimeout": {
7580
+ "char": "t",
7581
+ "description": "Timeout in MS for Bulk API calls",
7582
+ "name": "polltimeout",
7583
+ "default": 300000,
7584
+ "hasDynamicHelp": false,
7585
+ "multiple": false,
7586
+ "type": "option"
7587
+ },
7588
+ "startchunknumber": {
7589
+ "char": "s",
7590
+ "description": "Chunk number to start from",
7591
+ "name": "startchunknumber",
7592
+ "default": 0,
7567
7593
  "hasDynamicHelp": false,
7568
7594
  "multiple": false,
7569
7595
  "type": "option"
7570
7596
  },
7597
+ "resume": {
7598
+ "char": "r",
7599
+ "description": "Resume previous export by checking existing files (default in CI)",
7600
+ "name": "resume",
7601
+ "allowNo": false,
7602
+ "type": "boolean"
7603
+ },
7571
7604
  "debug": {
7572
7605
  "char": "d",
7573
7606
  "description": "Activate debug mode (more logs)",
@@ -7575,13 +7608,6 @@
7575
7608
  "allowNo": false,
7576
7609
  "type": "boolean"
7577
7610
  },
7578
- "no-prompt": {
7579
- "char": "n",
7580
- "description": "Do not prompt for org username, use the default one",
7581
- "name": "no-prompt",
7582
- "allowNo": false,
7583
- "type": "boolean"
7584
- },
7585
7611
  "websocket": {
7586
7612
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
7587
7613
  "name": "websocket",
@@ -7613,13 +7639,13 @@
7613
7639
  },
7614
7640
  "hasDynamicHelp": true,
7615
7641
  "hiddenAliases": [],
7616
- "id": "hardis:org:generate:packagexmlfull",
7642
+ "id": "hardis:org:files:export",
7617
7643
  "pluginAlias": "sfdx-hardis",
7618
7644
  "pluginName": "sfdx-hardis",
7619
7645
  "pluginType": "core",
7620
7646
  "strict": true,
7621
7647
  "enableJsonFlag": true,
7622
- "title": "Generate Full Org package.xml",
7648
+ "title": "Export files",
7623
7649
  "requiresProject": false,
7624
7650
  "isESM": true,
7625
7651
  "relativePath": [
@@ -7627,43 +7653,43 @@
7627
7653
  "commands",
7628
7654
  "hardis",
7629
7655
  "org",
7630
- "generate",
7631
- "packagexmlfull.js"
7656
+ "files",
7657
+ "export.js"
7632
7658
  ],
7633
7659
  "aliasPermutations": [],
7634
7660
  "permutations": [
7635
- "hardis:org:generate:packagexmlfull",
7636
- "org:hardis:generate:packagexmlfull",
7637
- "org:generate:hardis:packagexmlfull",
7638
- "org:generate:packagexmlfull:hardis",
7639
- "hardis:generate:org:packagexmlfull",
7640
- "generate:hardis:org:packagexmlfull",
7641
- "generate:org:hardis:packagexmlfull",
7642
- "generate:org:packagexmlfull:hardis",
7643
- "hardis:generate:packagexmlfull:org",
7644
- "generate:hardis:packagexmlfull:org",
7645
- "generate:packagexmlfull:hardis:org",
7646
- "generate:packagexmlfull:org:hardis",
7647
- "hardis:org:packagexmlfull:generate",
7648
- "org:hardis:packagexmlfull:generate",
7649
- "org:packagexmlfull:hardis:generate",
7650
- "org:packagexmlfull:generate:hardis",
7651
- "hardis:packagexmlfull:org:generate",
7652
- "packagexmlfull:hardis:org:generate",
7653
- "packagexmlfull:org:hardis:generate",
7654
- "packagexmlfull:org:generate:hardis",
7655
- "hardis:packagexmlfull:generate:org",
7656
- "packagexmlfull:hardis:generate:org",
7657
- "packagexmlfull:generate:hardis:org",
7658
- "packagexmlfull:generate:org:hardis"
7661
+ "hardis:org:files:export",
7662
+ "org:hardis:files:export",
7663
+ "org:files:hardis:export",
7664
+ "org:files:export:hardis",
7665
+ "hardis:files:org:export",
7666
+ "files:hardis:org:export",
7667
+ "files:org:hardis:export",
7668
+ "files:org:export:hardis",
7669
+ "hardis:files:export:org",
7670
+ "files:hardis:export:org",
7671
+ "files:export:hardis:org",
7672
+ "files:export:org:hardis",
7673
+ "hardis:org:export:files",
7674
+ "org:hardis:export:files",
7675
+ "org:export:hardis:files",
7676
+ "org:export:files:hardis",
7677
+ "hardis:export:org:files",
7678
+ "export:hardis:org:files",
7679
+ "export:org:hardis:files",
7680
+ "export:org:files:hardis",
7681
+ "hardis:export:files:org",
7682
+ "export:hardis:files:org",
7683
+ "export:files:hardis:org",
7684
+ "export:files:org:hardis"
7659
7685
  ]
7660
7686
  },
7661
- "hardis:org:monitor:all": {
7687
+ "hardis:org:files:import": {
7662
7688
  "aliases": [],
7663
7689
  "args": {},
7664
- "description": "Monitor org, generate reports and sends notifications\n\nYou can disable some commands defining either a **monitoringDisable** property in `.sfdx-hardis.yml`, or a comma separated list in env variable **MONITORING_DISABLE**\n\nExample in .sfdx-hardis.yml:\n \n```yaml\nmonitoringDisable:\n - METADATA_STATUS\n - MISSING_ATTRIBUTES\n - UNUSED_METADATAS\n```\n \nExample in env var:\n\n```sh\nMONITORING_DISABLE=METADATA_STATUS,MISSING_ATTRIBUTES,UNUSED_METADATAS\n```\n\nA [default list of monitoring commands](https://sfdx-hardis.cloudity.com/salesforce-monitoring-home/#monitoring-commands) is used, if you want to override it you can define property **monitoringCommands** in your .sfdx-hardis.yml file\n\nExample:\n\n```yaml\nmonitoringCommands:\n - title: My Custom command\n command: sf my:custom:command\n - title: My Custom command 2\n command: sf my:other:custom:command\n```\n\nYou can force the daily run of all commands by defining env var `MONITORING_IGNORE_FREQUENCY=true`\n\nThe default list of commands is the following:\n\n| Key | Description | Command | Frequency |\n| :---: | :---- | :---- | :-----: |\n| [AUDIT_TRAIL](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | Detect suspect setup actions in major org | [sf hardis:org:diagnose:audittrail](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | daily |\n| [LEGACY_API](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | Detect calls to deprecated API versions | [sf hardis:org:diagnose:legacyapi](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | daily |\n| [ORG_LIMITS](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | Detect if org limits are close to be reached | [sf hardis:org:monitor:limits](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | daily |\n| [UNSECURED_CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | Detect unsecured Connected Apps in an org | [sf hardis:org:diagnose:unsecure-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | daily |\n| [LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | Extract licenses information | [sf hardis:org:diagnose:licenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | weekly |\n| [LINT_ACCESS](https://sfdx-hardis.cloudity.com/hardis/lint/access) | Detect custom elements with no access rights defined in permission sets | [sf hardis:lint:access](https://sfdx-hardis.cloudity.com/hardis/lint/access) | weekly |\n| [UNUSED_LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | Detect permission set licenses that are assigned to users that do not need them | [sf hardis:org:diagnose:unusedlicenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | weekly |\n| [UNUSED_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users without recent logins | [sf hardis:org:diagnose:unusedusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ACTIVE_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users with recent logins | [sf hardis:org:diagnose:unusedusers --returnactiveusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ORG_INFO](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | Get org info + SF instance info + next major upgrade date | [sf hardis:org:diagnose:instanceupgrade](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | weekly |\n| [RELEASE_UPDATES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | Gather warnings about incoming and overdue Release Updates | [sf hardis:org:diagnose:releaseupdates](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | weekly |\n| [UNUSED_METADATAS](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | Detect custom labels and custom permissions that are not in use | [sf hardis:lint:unusedmetadatas](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | weekly |\n| [UNUSED_APEX_CLASSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | Detect unused Apex classes in an org | [sf hardis:org:diagnose:unused-apex-classes](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | weekly |\n| [CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | Detect unused Connected Apps in an org | [sf hardis:org:diagnose:unused-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | weekly |\n| [METADATA_STATUS](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | Detect inactive metadata | [sf hardis:lint:metadatastatus](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | weekly |\n| [MISSING_ATTRIBUTES](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | Detect missing description on custom field | [sf hardis:lint:missingattributes](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | weekly |\n\n",
7690
+ "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",
7665
7691
  "examples": [
7666
- "$ sf hardis:org:monitor:all"
7692
+ "$ sf hardis:org:files:import"
7667
7693
  ],
7668
7694
  "flags": {
7669
7695
  "json": {
@@ -7681,6 +7707,21 @@
7681
7707
  "multiple": false,
7682
7708
  "type": "option"
7683
7709
  },
7710
+ "path": {
7711
+ "char": "p",
7712
+ "description": "Path to the file export project",
7713
+ "name": "path",
7714
+ "hasDynamicHelp": false,
7715
+ "multiple": false,
7716
+ "type": "option"
7717
+ },
7718
+ "overwrite": {
7719
+ "char": "f",
7720
+ "description": "Override existing files (doubles the number of API calls)",
7721
+ "name": "overwrite",
7722
+ "allowNo": false,
7723
+ "type": "boolean"
7724
+ },
7684
7725
  "debug": {
7685
7726
  "char": "d",
7686
7727
  "description": "Activate debug mode (more logs)",
@@ -7719,159 +7760,59 @@
7719
7760
  },
7720
7761
  "hasDynamicHelp": true,
7721
7762
  "hiddenAliases": [],
7722
- "id": "hardis:org:monitor:all",
7763
+ "id": "hardis:org:files:import",
7723
7764
  "pluginAlias": "sfdx-hardis",
7724
7765
  "pluginName": "sfdx-hardis",
7725
7766
  "pluginType": "core",
7726
7767
  "strict": true,
7727
7768
  "enableJsonFlag": true,
7728
- "title": "Monitor org",
7729
- "monitoringCommandsDefault": [
7730
- {
7731
- "key": "AUDIT_TRAIL",
7732
- "title": "Detect suspect setup actions in major org",
7733
- "command": "sf hardis:org:diagnose:audittrail",
7734
- "frequency": "daily"
7735
- },
7736
- {
7737
- "key": "LEGACY_API",
7738
- "title": "Detect calls to deprecated API versions",
7739
- "command": "sf hardis:org:diagnose:legacyapi",
7740
- "frequency": "daily"
7741
- },
7742
- {
7743
- "key": "ORG_LIMITS",
7744
- "title": "Detect if org limits are close to be reached",
7745
- "command": "sf hardis:org:monitor:limits",
7746
- "frequency": "daily"
7747
- },
7748
- {
7749
- "key": "UNSECURED_CONNECTED_APPS",
7750
- "title": "Detect unsecured Connected Apps in an org",
7751
- "command": "sf hardis:org:diagnose:unsecure-connected-apps",
7752
- "frequency": "daily"
7753
- },
7754
- {
7755
- "key": "LICENSES",
7756
- "title": "Extract licenses information",
7757
- "command": "sf hardis:org:diagnose:licenses",
7758
- "frequency": "weekly"
7759
- },
7760
- {
7761
- "key": "LINT_ACCESS",
7762
- "title": "Detect custom elements with no access rights defined in permission sets",
7763
- "command": "sf hardis:lint:access",
7764
- "frequency": "weekly"
7765
- },
7766
- {
7767
- "key": "UNUSED_LICENSES",
7768
- "title": "Detect permission set licenses that are assigned to users that do not need them",
7769
- "command": "sf hardis:org:diagnose:unusedlicenses",
7770
- "frequency": "weekly"
7771
- },
7772
- {
7773
- "key": "UNUSED_USERS",
7774
- "title": "Detect active users without recent logins",
7775
- "command": "sf hardis:org:diagnose:unusedusers",
7776
- "frequency": "weekly"
7777
- },
7778
- {
7779
- "key": "ACTIVE_USERS",
7780
- "title": "Detect active users with recent logins",
7781
- "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
7782
- "frequency": "weekly"
7783
- },
7784
- {
7785
- "key": "ORG_INFO",
7786
- "title": "Get org info + SF instance info + next major upgrade date",
7787
- "command": "sf hardis:org:diagnose:instanceupgrade",
7788
- "frequency": "weekly"
7789
- },
7790
- {
7791
- "key": "RELEASE_UPDATES",
7792
- "title": "Gather warnings about incoming and overdue Release Updates",
7793
- "command": "sf hardis:org:diagnose:releaseupdates",
7794
- "frequency": "weekly"
7795
- },
7796
- {
7797
- "key": "UNUSED_METADATAS",
7798
- "title": "Detect custom labels and custom permissions that are not in use",
7799
- "command": "sf hardis:lint:unusedmetadatas",
7800
- "frequency": "weekly"
7801
- },
7802
- {
7803
- "key": "UNUSED_APEX_CLASSES",
7804
- "title": "Detect unused Apex classes in an org",
7805
- "command": "sf hardis:org:diagnose:unused-apex-classes",
7806
- "frequency": "weekly"
7807
- },
7808
- {
7809
- "key": "CONNECTED_APPS",
7810
- "title": "Detect unused Connected Apps in an org",
7811
- "command": "sf hardis:org:diagnose:unused-connected-apps",
7812
- "frequency": "weekly"
7813
- },
7814
- {
7815
- "key": "METADATA_STATUS",
7816
- "title": "Detect inactive metadata",
7817
- "command": "sf hardis:lint:metadatastatus",
7818
- "frequency": "weekly"
7819
- },
7820
- {
7821
- "key": "MISSING_ATTRIBUTES",
7822
- "title": "Detect missing description on custom field",
7823
- "command": "sf hardis:lint:missingattributes",
7824
- "frequency": "weekly"
7825
- }
7826
- ],
7827
- "requiresProject": true,
7828
- "triggerNotification": true,
7769
+ "title": "Import files",
7770
+ "requiresProject": false,
7829
7771
  "isESM": true,
7830
7772
  "relativePath": [
7831
7773
  "lib",
7832
7774
  "commands",
7833
7775
  "hardis",
7834
7776
  "org",
7835
- "monitor",
7836
- "all.js"
7777
+ "files",
7778
+ "import.js"
7837
7779
  ],
7838
7780
  "aliasPermutations": [],
7839
7781
  "permutations": [
7840
- "hardis:org:monitor:all",
7841
- "org:hardis:monitor:all",
7842
- "org:monitor:hardis:all",
7843
- "org:monitor:all:hardis",
7844
- "hardis:monitor:org:all",
7845
- "monitor:hardis:org:all",
7846
- "monitor:org:hardis:all",
7847
- "monitor:org:all:hardis",
7848
- "hardis:monitor:all:org",
7849
- "monitor:hardis:all:org",
7850
- "monitor:all:hardis:org",
7851
- "monitor:all:org:hardis",
7852
- "hardis:org:all:monitor",
7853
- "org:hardis:all:monitor",
7854
- "org:all:hardis:monitor",
7855
- "org:all:monitor:hardis",
7856
- "hardis:all:org:monitor",
7857
- "all:hardis:org:monitor",
7858
- "all:org:hardis:monitor",
7859
- "all:org:monitor:hardis",
7860
- "hardis:all:monitor:org",
7861
- "all:hardis:monitor:org",
7862
- "all:monitor:hardis:org",
7863
- "all:monitor:org:hardis"
7782
+ "hardis:org:files:import",
7783
+ "org:hardis:files:import",
7784
+ "org:files:hardis:import",
7785
+ "org:files:import:hardis",
7786
+ "hardis:files:org:import",
7787
+ "files:hardis:org:import",
7788
+ "files:org:hardis:import",
7789
+ "files:org:import:hardis",
7790
+ "hardis:files:import:org",
7791
+ "files:hardis:import:org",
7792
+ "files:import:hardis:org",
7793
+ "files:import:org:hardis",
7794
+ "hardis:org:import:files",
7795
+ "org:hardis:import:files",
7796
+ "org:import:hardis:files",
7797
+ "org:import:files:hardis",
7798
+ "hardis:import:org:files",
7799
+ "import:hardis:org:files",
7800
+ "import:org:hardis:files",
7801
+ "import:org:files:hardis",
7802
+ "hardis:import:files:org",
7803
+ "import:hardis:files:org",
7804
+ "import:files:hardis:org",
7805
+ "import:files:org:hardis"
7864
7806
  ]
7865
7807
  },
7866
- "hardis:org:monitor:backup": {
7808
+ "hardis:org:generate:packagexmlfull": {
7867
7809
  "aliases": [],
7868
7810
  "args": {},
7869
- "description": "Retrieve sfdx sources in the context of a monitoring backup\n\nThe command exists in 2 modes: filtered(default & recommended) and full.\n\n## Filtered mode (default, better performances)\n\nAutomatically skips metadatas from installed packages with namespace. \n\nYou can remove more metadata types from backup, especially in case you have too many metadatas and that provokes a crash, using:\n\n- Manual update of `manifest/package-skip-items.xml` config file (then commit & push in the same branch)\n\n - Works with full wildcard (`<members>*</members>`) , named metadata (`<members>Account.Name</members>`) or partial wildcards names (`<members>pi__*</members>` , `<members>*__dlm</members>` , or `<members>prefix*suffix</members>`)\n\n- Environment variable MONITORING_BACKUP_SKIP_METADATA_TYPES (example: `MONITORING_BACKUP_SKIP_METADATA_TYPES=CustomLabel,StaticResource,Translation`): that will be applied to all monitoring branches.\n\n## Full mode\n\nActivate it with **--full** parameter, or variable MONITORING_BACKUP_MODE_FULL=true\n\nIgnores filters (namespaces items & manifest/package-skip-items.xml) to retrieve ALL metadatas, including those you might not care about (reports, translations...)\n\nAs we can retrieve only 10000 files by call, the list of all metadatas will be chunked to make multiple calls (and take more time than filtered mode)\n\n- if you use `--full-apply-filters` , manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES filters will be applied anyway\n- if you use `--exclude-namespaces` , namespaced items will be ignored\n\n_With those both options, it's like if you are not using --full, but with chunked metadata download_\n\n## In CI/CD\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-metadata-backup/) and can output Grafana, Slack and MsTeams Notifications.\n\n## Troubleshooting\n\nIf you have unknown errors (it happens !), you can investigate using the full command with smaller chunks.\n\nExample: `sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters --max-by-chunk 500`\n\nIt will allow you the identify the responsible metadata and ignore it using package-skip-items.xml or MONITORING_BACKUP_SKIP_METADATA_TYPES env variable.\n\n## Documentation\n\n[Doc generation (including visual flows)](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/) is triggered at the end of the command.\n\nIf you want to also upload HTML Documentation on your Salesforce Org as static resource, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_ORG=\"true\"**\n\nIf you want to also upload HTML Documentation on Cloudflare, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_CLOUDFLARE=\"true\"**\n\n- If you want to generate the documentation in multiple languages, define variable SFDX_DOC_LANGUAGES (ex: SFDX_DOC_LANGUAGES=en,fr,de)\n- You can define one Cloudflare site by language, for example with the following variables:\n - CLOUDFLARE_PROJECT_NAME_EN=cloudity-demo-english\n - CLOUDFLARE_PROJECT_NAME_FR=cloudity-demo-french\n - CLOUDFLARE_PROJECT_NAME_DE=cloudity-demo-german\n\nIf Flow history doc always display a single state, you probably need to update your workflow configuration:\n\n- on Gitlab: Env variable [`GIT_FETCH_EXTRA_FLAGS: --depth 10000`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11)\n- on GitHub: [`fetch-depth: 0`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml#L58)\n- on Azure: [`fetchDepth: \"0\"`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml#L39)\n- on Bitbucket: [`step: clone: depth: full`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml#L18)\n",
7811
+ "description": "\n## Command Behavior\n\n**Generates a comprehensive `package.xml` file for a Salesforce org, including all metadata components, even managed ones.**\n\nThis command is essential for various Salesforce development and administration tasks, especially when you need a complete snapshot of an org's metadata. It goes beyond typical source tracking by including managed package components, which is crucial for understanding the full metadata footprint of an org.\n\nKey functionalities:\n\n- **Full Org Metadata Retrieval:** Connects to a specified Salesforce org (or prompts for one if not provided) and retrieves a complete list of all metadata types and their members.\n- **Managed Package Inclusion:** Unlike standard source retrieval, this command explicitly includes metadata from managed packages, providing a truly comprehensive `package.xml`.\n- **Customizable Output:** Allows you to specify the output file path for the generated `package.xml`.\n- **Interactive Org Selection:** If no target org is specified, it interactively prompts the user to choose an org. (or use --no-prompt to skip this step)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce Metadata API Interaction:** It leverages the Salesforce Metadata API to list all available metadata types and then retrieve all components for each type.\n- **`buildOrgManifest` Utility:** The core logic for querying the org's metadata and constructing the `package.xml` is encapsulated within the `buildOrgManifest` utility function.\n- **XML Generation:** It dynamically builds the XML structure of the `package.xml` file, including the `types` and `members` elements for all retrieved metadata.\n- **File System Operations:** It writes the generated `package.xml` file to the specified output path.\n- **Interactive Prompts:** Uses `promptOrgUsernameDefault` to guide the user in selecting the target Salesforce org.\n</details>\n",
7870
7812
  "examples": [
7871
- "$ sf hardis:org:monitor:backup",
7872
- "$ sf hardis:org:monitor:backup --full",
7873
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
7874
- "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
7813
+ "$ sf hardis:org:generate:packagexmlfull",
7814
+ "$ sf hardis:org:generate:packagexmlfull --outputfile /tmp/packagexmlfull.xml",
7815
+ "$ sf hardis:org:generate:packagexmlfull --target-org nico@example.com"
7875
7816
  ],
7876
7817
  "flags": {
7877
7818
  "json": {
@@ -7889,52 +7830,8 @@
7889
7830
  "multiple": false,
7890
7831
  "type": "option"
7891
7832
  },
7892
- "full": {
7893
- "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
7894
- "name": "full",
7895
- "allowNo": false,
7896
- "type": "boolean"
7897
- },
7898
- "max-by-chunk": {
7899
- "char": "m",
7900
- "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
7901
- "name": "max-by-chunk",
7902
- "default": 3000,
7903
- "hasDynamicHelp": false,
7904
- "multiple": false,
7905
- "type": "option"
7906
- },
7907
- "exclude-namespaces": {
7908
- "char": "e",
7909
- "description": "If mode --full is activated, exclude namespaced metadatas",
7910
- "name": "exclude-namespaces",
7911
- "allowNo": false,
7912
- "type": "boolean"
7913
- },
7914
- "full-apply-filters": {
7915
- "char": "z",
7916
- "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
7917
- "name": "full-apply-filters",
7918
- "allowNo": false,
7919
- "type": "boolean"
7920
- },
7921
- "start-chunk": {
7922
- "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
7923
- "name": "start-chunk",
7924
- "default": 1,
7925
- "hasDynamicHelp": false,
7926
- "multiple": false,
7927
- "type": "option"
7928
- },
7929
- "skip-doc": {
7930
- "description": "Skip the generation of project documentation at the end of the command",
7931
- "name": "skip-doc",
7932
- "allowNo": false,
7933
- "type": "boolean"
7934
- },
7935
7833
  "outputfile": {
7936
- "char": "f",
7937
- "description": "Force the path and name of output report file. Must end with .csv",
7834
+ "description": "Output package.xml file",
7938
7835
  "name": "outputfile",
7939
7836
  "hasDynamicHelp": false,
7940
7837
  "multiple": false,
@@ -7947,6 +7844,13 @@
7947
7844
  "allowNo": false,
7948
7845
  "type": "boolean"
7949
7846
  },
7847
+ "no-prompt": {
7848
+ "char": "n",
7849
+ "description": "Do not prompt for org username, use the default one",
7850
+ "name": "no-prompt",
7851
+ "allowNo": false,
7852
+ "type": "boolean"
7853
+ },
7950
7854
  "websocket": {
7951
7855
  "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
7952
7856
  "name": "websocket",
@@ -7978,58 +7882,57 @@
7978
7882
  },
7979
7883
  "hasDynamicHelp": true,
7980
7884
  "hiddenAliases": [],
7981
- "id": "hardis:org:monitor:backup",
7885
+ "id": "hardis:org:generate:packagexmlfull",
7982
7886
  "pluginAlias": "sfdx-hardis",
7983
7887
  "pluginName": "sfdx-hardis",
7984
7888
  "pluginType": "core",
7985
7889
  "strict": true,
7986
7890
  "enableJsonFlag": true,
7987
- "title": "Backup DX sources",
7988
- "requiresProject": true,
7989
- "triggerNotification": true,
7891
+ "title": "Generate Full Org package.xml",
7892
+ "requiresProject": false,
7990
7893
  "isESM": true,
7991
7894
  "relativePath": [
7992
7895
  "lib",
7993
7896
  "commands",
7994
7897
  "hardis",
7995
7898
  "org",
7996
- "monitor",
7997
- "backup.js"
7899
+ "generate",
7900
+ "packagexmlfull.js"
7998
7901
  ],
7999
7902
  "aliasPermutations": [],
8000
7903
  "permutations": [
8001
- "hardis:org:monitor:backup",
8002
- "org:hardis:monitor:backup",
8003
- "org:monitor:hardis:backup",
8004
- "org:monitor:backup:hardis",
8005
- "hardis:monitor:org:backup",
8006
- "monitor:hardis:org:backup",
8007
- "monitor:org:hardis:backup",
8008
- "monitor:org:backup:hardis",
8009
- "hardis:monitor:backup:org",
8010
- "monitor:hardis:backup:org",
8011
- "monitor:backup:hardis:org",
8012
- "monitor:backup:org:hardis",
8013
- "hardis:org:backup:monitor",
8014
- "org:hardis:backup:monitor",
8015
- "org:backup:hardis:monitor",
8016
- "org:backup:monitor:hardis",
8017
- "hardis:backup:org:monitor",
8018
- "backup:hardis:org:monitor",
8019
- "backup:org:hardis:monitor",
8020
- "backup:org:monitor:hardis",
8021
- "hardis:backup:monitor:org",
8022
- "backup:hardis:monitor:org",
8023
- "backup:monitor:hardis:org",
8024
- "backup:monitor:org:hardis"
7904
+ "hardis:org:generate:packagexmlfull",
7905
+ "org:hardis:generate:packagexmlfull",
7906
+ "org:generate:hardis:packagexmlfull",
7907
+ "org:generate:packagexmlfull:hardis",
7908
+ "hardis:generate:org:packagexmlfull",
7909
+ "generate:hardis:org:packagexmlfull",
7910
+ "generate:org:hardis:packagexmlfull",
7911
+ "generate:org:packagexmlfull:hardis",
7912
+ "hardis:generate:packagexmlfull:org",
7913
+ "generate:hardis:packagexmlfull:org",
7914
+ "generate:packagexmlfull:hardis:org",
7915
+ "generate:packagexmlfull:org:hardis",
7916
+ "hardis:org:packagexmlfull:generate",
7917
+ "org:hardis:packagexmlfull:generate",
7918
+ "org:packagexmlfull:hardis:generate",
7919
+ "org:packagexmlfull:generate:hardis",
7920
+ "hardis:packagexmlfull:org:generate",
7921
+ "packagexmlfull:hardis:org:generate",
7922
+ "packagexmlfull:org:hardis:generate",
7923
+ "packagexmlfull:org:generate:hardis",
7924
+ "hardis:packagexmlfull:generate:org",
7925
+ "packagexmlfull:hardis:generate:org",
7926
+ "packagexmlfull:generate:hardis:org",
7927
+ "packagexmlfull:generate:org:hardis"
8025
7928
  ]
8026
7929
  },
8027
- "hardis:org:monitor:limits": {
7930
+ "hardis:org:monitor:all": {
8028
7931
  "aliases": [],
8029
7932
  "args": {},
8030
- "description": "\n## Command Behavior\n\n**Checks the current usage of various Salesforce org limits and sends notifications if thresholds are exceeded.**\n\nThis command is a critical component of proactive Salesforce org management, helping administrators and developers monitor resource consumption and prevent hitting critical limits that could impact performance or functionality. It provides early warnings when limits are approaching their capacity.\n\nKey functionalities:\n\n- **Limit Retrieval:** Fetches a comprehensive list of all Salesforce org limits using the Salesforce CLI.\n- **Usage Calculation:** Calculates the percentage of each limit that is currently being used.\n- **Threshold-Based Alerting:** Assigns a severity (success, warning, or error) to each limit based on configurable thresholds:\n - **Warning:** If usage exceeds 50% (configurable via `LIMIT_THRESHOLD_WARNING` environment variable).\n - **Error:** If usage exceeds 75% (configurable via `LIMIT_THRESHOLD_ERROR` environment variable).\n- **CSV Report Generation:** Generates a CSV file containing all org limits, their current usage, maximum allowed, and calculated percentage used, along with the assigned severity.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of limits that have exceeded the warning or error thresholds.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-limits/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce CLI Integration:** It executes the `sf org limits list` command to retrieve the current org limits. It parses the JSON output of this command.\n- **Data Processing:** It iterates through the retrieved limits, calculates the `used` and `percentUsed` values, and assigns a `severity` (success, warning, error) based on the configured thresholds.\n- **Environment Variable Configuration:** Reads `LIMIT_THRESHOLD_WARNING` and `LIMIT_THRESHOLD_ERROR` environment variables to set the warning and error thresholds for limit usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of org limits.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and detailed metrics for each limit, which can be consumed by monitoring dashboards like Grafana.\n- **Exit Code Management:** Sets the process exit code to 1 if any limit is in an 'error' state, indicating a critical issue.\n</details>\n",
7933
+ "description": "Monitor org, generate reports and sends notifications\n\nYou can disable some commands defining either a **monitoringDisable** property in `.sfdx-hardis.yml`, or a comma separated list in env variable **MONITORING_DISABLE**\n\nExample in .sfdx-hardis.yml:\n \n```yaml\nmonitoringDisable:\n - METADATA_STATUS\n - MISSING_ATTRIBUTES\n - UNUSED_METADATAS\n```\n \nExample in env var:\n\n```sh\nMONITORING_DISABLE=METADATA_STATUS,MISSING_ATTRIBUTES,UNUSED_METADATAS\n```\n\nA [default list of monitoring commands](https://sfdx-hardis.cloudity.com/salesforce-monitoring-home/#monitoring-commands) is used, if you want to override it you can define property **monitoringCommands** in your .sfdx-hardis.yml file\n\nExample:\n\n```yaml\nmonitoringCommands:\n - title: My Custom command\n command: sf my:custom:command\n - title: My Custom command 2\n command: sf my:other:custom:command\n```\n\nYou can force the daily run of all commands by defining env var `MONITORING_IGNORE_FREQUENCY=true`\n\nThe default list of commands is the following:\n\n| Key | Description | Command | Frequency |\n| :---: | :---- | :---- | :-----: |\n| [AUDIT_TRAIL](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | Detect suspect setup actions in major org | [sf hardis:org:diagnose:audittrail](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/audittrail) | daily |\n| [LEGACY_API](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | Detect calls to deprecated API versions | [sf hardis:org:diagnose:legacyapi](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/legacyapi) | daily |\n| [ORG_LIMITS](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | Detect if org limits are close to be reached | [sf hardis:org:monitor:limits](https://sfdx-hardis.cloudity.com/hardis/org/monitor/limits) | daily |\n| [UNSECURED_CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | Detect unsecured Connected Apps in an org | [sf hardis:org:diagnose:unsecure-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps) | daily |\n| [LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | Extract licenses information | [sf hardis:org:diagnose:licenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/licenses) | weekly |\n| [LINT_ACCESS](https://sfdx-hardis.cloudity.com/hardis/lint/access) | Detect custom elements with no access rights defined in permission sets | [sf hardis:lint:access](https://sfdx-hardis.cloudity.com/hardis/lint/access) | weekly |\n| [UNUSED_LICENSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | Detect permission set licenses that are assigned to users that do not need them | [sf hardis:org:diagnose:unusedlicenses](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedlicenses) | weekly |\n| [UNUSED_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users without recent logins | [sf hardis:org:diagnose:unusedusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ACTIVE_USERS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | Detect active users with recent logins | [sf hardis:org:diagnose:unusedusers --returnactiveusers](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unusedusers) | weekly |\n| [ORG_INFO](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | Get org info + SF instance info + next major upgrade date | [sf hardis:org:diagnose:instanceupgrade](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/instanceupgrade) | weekly |\n| [RELEASE_UPDATES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | Gather warnings about incoming and overdue Release Updates | [sf hardis:org:diagnose:releaseupdates](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/releaseupdates) | weekly |\n| [UNUSED_METADATAS](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | Detect custom labels and custom permissions that are not in use | [sf hardis:lint:unusedmetadatas](https://sfdx-hardis.cloudity.com/hardis/lint/unusedmetadatas) | weekly |\n| [UNUSED_APEX_CLASSES](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | Detect unused Apex classes in an org | [sf hardis:org:diagnose:unused-apex-classes](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-apex-classes) | weekly |\n| [CONNECTED_APPS](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | Detect unused Connected Apps in an org | [sf hardis:org:diagnose:unused-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unused-connected-apps) | weekly |\n| [METADATA_STATUS](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | Detect inactive metadata | [sf hardis:lint:metadatastatus](https://sfdx-hardis.cloudity.com/hardis/lint/metadatastatus) | weekly |\n| [MISSING_ATTRIBUTES](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | Detect missing description on custom field | [sf hardis:lint:missingattributes](https://sfdx-hardis.cloudity.com/hardis/lint/missingattributes) | weekly |\n\n",
8031
7934
  "examples": [
8032
- "$ sf hardis:org:monitor:limits"
7935
+ "$ sf hardis:org:monitor:all"
8033
7936
  ],
8034
7937
  "flags": {
8035
7938
  "json": {
@@ -8047,14 +7950,6 @@
8047
7950
  "multiple": false,
8048
7951
  "type": "option"
8049
7952
  },
8050
- "outputfile": {
8051
- "char": "f",
8052
- "description": "Force the path and name of output report file. Must end with .csv",
8053
- "name": "outputfile",
8054
- "hasDynamicHelp": false,
8055
- "multiple": false,
8056
- "type": "option"
8057
- },
8058
7953
  "debug": {
8059
7954
  "char": "d",
8060
7955
  "description": "Activate debug mode (more logs)",
@@ -8093,13 +7988,111 @@
8093
7988
  },
8094
7989
  "hasDynamicHelp": true,
8095
7990
  "hiddenAliases": [],
8096
- "id": "hardis:org:monitor:limits",
7991
+ "id": "hardis:org:monitor:all",
8097
7992
  "pluginAlias": "sfdx-hardis",
8098
7993
  "pluginName": "sfdx-hardis",
8099
7994
  "pluginType": "core",
8100
7995
  "strict": true,
8101
7996
  "enableJsonFlag": true,
8102
- "title": "Check org limits",
7997
+ "title": "Monitor org",
7998
+ "monitoringCommandsDefault": [
7999
+ {
8000
+ "key": "AUDIT_TRAIL",
8001
+ "title": "Detect suspect setup actions in major org",
8002
+ "command": "sf hardis:org:diagnose:audittrail",
8003
+ "frequency": "daily"
8004
+ },
8005
+ {
8006
+ "key": "LEGACY_API",
8007
+ "title": "Detect calls to deprecated API versions",
8008
+ "command": "sf hardis:org:diagnose:legacyapi",
8009
+ "frequency": "daily"
8010
+ },
8011
+ {
8012
+ "key": "ORG_LIMITS",
8013
+ "title": "Detect if org limits are close to be reached",
8014
+ "command": "sf hardis:org:monitor:limits",
8015
+ "frequency": "daily"
8016
+ },
8017
+ {
8018
+ "key": "UNSECURED_CONNECTED_APPS",
8019
+ "title": "Detect unsecured Connected Apps in an org",
8020
+ "command": "sf hardis:org:diagnose:unsecure-connected-apps",
8021
+ "frequency": "daily"
8022
+ },
8023
+ {
8024
+ "key": "LICENSES",
8025
+ "title": "Extract licenses information",
8026
+ "command": "sf hardis:org:diagnose:licenses",
8027
+ "frequency": "weekly"
8028
+ },
8029
+ {
8030
+ "key": "LINT_ACCESS",
8031
+ "title": "Detect custom elements with no access rights defined in permission sets",
8032
+ "command": "sf hardis:lint:access",
8033
+ "frequency": "weekly"
8034
+ },
8035
+ {
8036
+ "key": "UNUSED_LICENSES",
8037
+ "title": "Detect permission set licenses that are assigned to users that do not need them",
8038
+ "command": "sf hardis:org:diagnose:unusedlicenses",
8039
+ "frequency": "weekly"
8040
+ },
8041
+ {
8042
+ "key": "UNUSED_USERS",
8043
+ "title": "Detect active users without recent logins",
8044
+ "command": "sf hardis:org:diagnose:unusedusers",
8045
+ "frequency": "weekly"
8046
+ },
8047
+ {
8048
+ "key": "ACTIVE_USERS",
8049
+ "title": "Detect active users with recent logins",
8050
+ "command": "sf hardis:org:diagnose:unusedusers --returnactiveusers",
8051
+ "frequency": "weekly"
8052
+ },
8053
+ {
8054
+ "key": "ORG_INFO",
8055
+ "title": "Get org info + SF instance info + next major upgrade date",
8056
+ "command": "sf hardis:org:diagnose:instanceupgrade",
8057
+ "frequency": "weekly"
8058
+ },
8059
+ {
8060
+ "key": "RELEASE_UPDATES",
8061
+ "title": "Gather warnings about incoming and overdue Release Updates",
8062
+ "command": "sf hardis:org:diagnose:releaseupdates",
8063
+ "frequency": "weekly"
8064
+ },
8065
+ {
8066
+ "key": "UNUSED_METADATAS",
8067
+ "title": "Detect custom labels and custom permissions that are not in use",
8068
+ "command": "sf hardis:lint:unusedmetadatas",
8069
+ "frequency": "weekly"
8070
+ },
8071
+ {
8072
+ "key": "UNUSED_APEX_CLASSES",
8073
+ "title": "Detect unused Apex classes in an org",
8074
+ "command": "sf hardis:org:diagnose:unused-apex-classes",
8075
+ "frequency": "weekly"
8076
+ },
8077
+ {
8078
+ "key": "CONNECTED_APPS",
8079
+ "title": "Detect unused Connected Apps in an org",
8080
+ "command": "sf hardis:org:diagnose:unused-connected-apps",
8081
+ "frequency": "weekly"
8082
+ },
8083
+ {
8084
+ "key": "METADATA_STATUS",
8085
+ "title": "Detect inactive metadata",
8086
+ "command": "sf hardis:lint:metadatastatus",
8087
+ "frequency": "weekly"
8088
+ },
8089
+ {
8090
+ "key": "MISSING_ATTRIBUTES",
8091
+ "title": "Detect missing description on custom field",
8092
+ "command": "sf hardis:lint:missingattributes",
8093
+ "frequency": "weekly"
8094
+ }
8095
+ ],
8103
8096
  "requiresProject": true,
8104
8097
  "triggerNotification": true,
8105
8098
  "isESM": true,
@@ -8109,42 +8102,45 @@
8109
8102
  "hardis",
8110
8103
  "org",
8111
8104
  "monitor",
8112
- "limits.js"
8105
+ "all.js"
8113
8106
  ],
8114
8107
  "aliasPermutations": [],
8115
8108
  "permutations": [
8116
- "hardis:org:monitor:limits",
8117
- "org:hardis:monitor:limits",
8118
- "org:monitor:hardis:limits",
8119
- "org:monitor:limits:hardis",
8120
- "hardis:monitor:org:limits",
8121
- "monitor:hardis:org:limits",
8122
- "monitor:org:hardis:limits",
8123
- "monitor:org:limits:hardis",
8124
- "hardis:monitor:limits:org",
8125
- "monitor:hardis:limits:org",
8126
- "monitor:limits:hardis:org",
8127
- "monitor:limits:org:hardis",
8128
- "hardis:org:limits:monitor",
8129
- "org:hardis:limits:monitor",
8130
- "org:limits:hardis:monitor",
8131
- "org:limits:monitor:hardis",
8132
- "hardis:limits:org:monitor",
8133
- "limits:hardis:org:monitor",
8134
- "limits:org:hardis:monitor",
8135
- "limits:org:monitor:hardis",
8136
- "hardis:limits:monitor:org",
8137
- "limits:hardis:monitor:org",
8138
- "limits:monitor:hardis:org",
8139
- "limits:monitor:org:hardis"
8109
+ "hardis:org:monitor:all",
8110
+ "org:hardis:monitor:all",
8111
+ "org:monitor:hardis:all",
8112
+ "org:monitor:all:hardis",
8113
+ "hardis:monitor:org:all",
8114
+ "monitor:hardis:org:all",
8115
+ "monitor:org:hardis:all",
8116
+ "monitor:org:all:hardis",
8117
+ "hardis:monitor:all:org",
8118
+ "monitor:hardis:all:org",
8119
+ "monitor:all:hardis:org",
8120
+ "monitor:all:org:hardis",
8121
+ "hardis:org:all:monitor",
8122
+ "org:hardis:all:monitor",
8123
+ "org:all:hardis:monitor",
8124
+ "org:all:monitor:hardis",
8125
+ "hardis:all:org:monitor",
8126
+ "all:hardis:org:monitor",
8127
+ "all:org:hardis:monitor",
8128
+ "all:org:monitor:hardis",
8129
+ "hardis:all:monitor:org",
8130
+ "all:hardis:monitor:org",
8131
+ "all:monitor:hardis:org",
8132
+ "all:monitor:org:hardis"
8140
8133
  ]
8141
8134
  },
8142
- "hardis:org:files:export": {
8135
+ "hardis:org:monitor:backup": {
8143
8136
  "aliases": [],
8144
8137
  "args": {},
8145
- "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",
8138
+ "description": "Retrieve sfdx sources in the context of a monitoring backup\n\nThe command exists in 2 modes: filtered(default & recommended) and full.\n\n## Filtered mode (default, better performances)\n\nAutomatically skips metadatas from installed packages with namespace. \n\nYou can remove more metadata types from backup, especially in case you have too many metadatas and that provokes a crash, using:\n\n- Manual update of `manifest/package-skip-items.xml` config file (then commit & push in the same branch)\n\n - Works with full wildcard (`<members>*</members>`) , named metadata (`<members>Account.Name</members>`) or partial wildcards names (`<members>pi__*</members>` , `<members>*__dlm</members>` , or `<members>prefix*suffix</members>`)\n\n- Environment variable MONITORING_BACKUP_SKIP_METADATA_TYPES (example: `MONITORING_BACKUP_SKIP_METADATA_TYPES=CustomLabel,StaticResource,Translation`): that will be applied to all monitoring branches.\n\n## Full mode\n\nActivate it with **--full** parameter, or variable MONITORING_BACKUP_MODE_FULL=true\n\nIgnores filters (namespaces items & manifest/package-skip-items.xml) to retrieve ALL metadatas, including those you might not care about (reports, translations...)\n\nAs we can retrieve only 10000 files by call, the list of all metadatas will be chunked to make multiple calls (and take more time than filtered mode)\n\n- if you use `--full-apply-filters` , manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES filters will be applied anyway\n- if you use `--exclude-namespaces` , namespaced items will be ignored\n\n_With those both options, it's like if you are not using --full, but with chunked metadata download_\n\n## In CI/CD\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-metadata-backup/) and can output Grafana, Slack and MsTeams Notifications.\n\n## Troubleshooting\n\nIf you have unknown errors (it happens !), you can investigate using the full command with smaller chunks.\n\nExample: `sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters --max-by-chunk 500`\n\nIt will allow you the identify the responsible metadata and ignore it using package-skip-items.xml or MONITORING_BACKUP_SKIP_METADATA_TYPES env variable.\n\n## Documentation\n\n[Doc generation (including visual flows)](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/) is triggered at the end of the command.\n\nIf you want to also upload HTML Documentation on your Salesforce Org as static resource, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_ORG=\"true\"**\n\nIf you want to also upload HTML Documentation on Cloudflare, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_CLOUDFLARE=\"true\"**\n\n- If you want to generate the documentation in multiple languages, define variable SFDX_DOC_LANGUAGES (ex: SFDX_DOC_LANGUAGES=en,fr,de)\n- You can define one Cloudflare site by language, for example with the following variables:\n - CLOUDFLARE_PROJECT_NAME_EN=cloudity-demo-english\n - CLOUDFLARE_PROJECT_NAME_FR=cloudity-demo-french\n - CLOUDFLARE_PROJECT_NAME_DE=cloudity-demo-german\n\nIf Flow history doc always display a single state, you probably need to update your workflow configuration:\n\n- on Gitlab: Env variable [`GIT_FETCH_EXTRA_FLAGS: --depth 10000`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11)\n- on GitHub: [`fetch-depth: 0`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml#L58)\n- on Azure: [`fetchDepth: \"0\"`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml#L39)\n- on Bitbucket: [`step: clone: depth: full`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml#L18)\n",
8146
8139
  "examples": [
8147
- "$ sf hardis:org:files:export"
8140
+ "$ sf hardis:org:monitor:backup",
8141
+ "$ sf hardis:org:monitor:backup --full",
8142
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces",
8143
+ "$ sf hardis:org:monitor:backup --full --exclude-namespaces --full-apply-filters"
8148
8144
  ],
8149
8145
  "flags": {
8150
8146
  "json": {
@@ -8162,48 +8158,57 @@
8162
8158
  "multiple": false,
8163
8159
  "type": "option"
8164
8160
  },
8165
- "path": {
8166
- "char": "p",
8167
- "description": "Path to the file export project",
8168
- "name": "path",
8169
- "hasDynamicHelp": false,
8170
- "multiple": false,
8171
- "type": "option"
8161
+ "full": {
8162
+ "description": "Dot not take in account filtering using package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES. Efficient but much much slower !",
8163
+ "name": "full",
8164
+ "allowNo": false,
8165
+ "type": "boolean"
8172
8166
  },
8173
- "chunksize": {
8174
- "char": "c",
8175
- "description": "Number of records to add in a chunk before it is processed",
8176
- "name": "chunksize",
8177
- "default": 1000,
8167
+ "max-by-chunk": {
8168
+ "char": "m",
8169
+ "description": "If mode --full is activated, maximum number of metadatas in a package.xml chunk",
8170
+ "name": "max-by-chunk",
8171
+ "default": 3000,
8178
8172
  "hasDynamicHelp": false,
8179
8173
  "multiple": false,
8180
8174
  "type": "option"
8181
8175
  },
8182
- "polltimeout": {
8183
- "char": "t",
8184
- "description": "Timeout in MS for Bulk API calls",
8185
- "name": "polltimeout",
8186
- "default": 300000,
8187
- "hasDynamicHelp": false,
8188
- "multiple": false,
8189
- "type": "option"
8176
+ "exclude-namespaces": {
8177
+ "char": "e",
8178
+ "description": "If mode --full is activated, exclude namespaced metadatas",
8179
+ "name": "exclude-namespaces",
8180
+ "allowNo": false,
8181
+ "type": "boolean"
8190
8182
  },
8191
- "startchunknumber": {
8192
- "char": "s",
8193
- "description": "Chunk number to start from",
8194
- "name": "startchunknumber",
8195
- "default": 0,
8183
+ "full-apply-filters": {
8184
+ "char": "z",
8185
+ "description": "If mode --full is activated, apply filters of manifest/package-skip-items.xml and MONITORING_BACKUP_SKIP_METADATA_TYPES anyway",
8186
+ "name": "full-apply-filters",
8187
+ "allowNo": false,
8188
+ "type": "boolean"
8189
+ },
8190
+ "start-chunk": {
8191
+ "description": "Use this parameter to troubleshoot a specific chunk. It will be used as the first chunk to retrieve",
8192
+ "name": "start-chunk",
8193
+ "default": 1,
8196
8194
  "hasDynamicHelp": false,
8197
8195
  "multiple": false,
8198
8196
  "type": "option"
8199
8197
  },
8200
- "resume": {
8201
- "char": "r",
8202
- "description": "Resume previous export by checking existing files (default in CI)",
8203
- "name": "resume",
8198
+ "skip-doc": {
8199
+ "description": "Skip the generation of project documentation at the end of the command",
8200
+ "name": "skip-doc",
8204
8201
  "allowNo": false,
8205
8202
  "type": "boolean"
8206
8203
  },
8204
+ "outputfile": {
8205
+ "char": "f",
8206
+ "description": "Force the path and name of output report file. Must end with .csv",
8207
+ "name": "outputfile",
8208
+ "hasDynamicHelp": false,
8209
+ "multiple": false,
8210
+ "type": "option"
8211
+ },
8207
8212
  "debug": {
8208
8213
  "char": "d",
8209
8214
  "description": "Activate debug mode (more logs)",
@@ -8242,57 +8247,58 @@
8242
8247
  },
8243
8248
  "hasDynamicHelp": true,
8244
8249
  "hiddenAliases": [],
8245
- "id": "hardis:org:files:export",
8250
+ "id": "hardis:org:monitor:backup",
8246
8251
  "pluginAlias": "sfdx-hardis",
8247
8252
  "pluginName": "sfdx-hardis",
8248
8253
  "pluginType": "core",
8249
8254
  "strict": true,
8250
8255
  "enableJsonFlag": true,
8251
- "title": "Export files",
8252
- "requiresProject": false,
8256
+ "title": "Backup DX sources",
8257
+ "requiresProject": true,
8258
+ "triggerNotification": true,
8253
8259
  "isESM": true,
8254
8260
  "relativePath": [
8255
8261
  "lib",
8256
8262
  "commands",
8257
8263
  "hardis",
8258
8264
  "org",
8259
- "files",
8260
- "export.js"
8265
+ "monitor",
8266
+ "backup.js"
8261
8267
  ],
8262
8268
  "aliasPermutations": [],
8263
8269
  "permutations": [
8264
- "hardis:org:files:export",
8265
- "org:hardis:files:export",
8266
- "org:files:hardis:export",
8267
- "org:files:export:hardis",
8268
- "hardis:files:org:export",
8269
- "files:hardis:org:export",
8270
- "files:org:hardis:export",
8271
- "files:org:export:hardis",
8272
- "hardis:files:export:org",
8273
- "files:hardis:export:org",
8274
- "files:export:hardis:org",
8275
- "files:export:org:hardis",
8276
- "hardis:org:export:files",
8277
- "org:hardis:export:files",
8278
- "org:export:hardis:files",
8279
- "org:export:files:hardis",
8280
- "hardis:export:org:files",
8281
- "export:hardis:org:files",
8282
- "export:org:hardis:files",
8283
- "export:org:files:hardis",
8284
- "hardis:export:files:org",
8285
- "export:hardis:files:org",
8286
- "export:files:hardis:org",
8287
- "export:files:org:hardis"
8270
+ "hardis:org:monitor:backup",
8271
+ "org:hardis:monitor:backup",
8272
+ "org:monitor:hardis:backup",
8273
+ "org:monitor:backup:hardis",
8274
+ "hardis:monitor:org:backup",
8275
+ "monitor:hardis:org:backup",
8276
+ "monitor:org:hardis:backup",
8277
+ "monitor:org:backup:hardis",
8278
+ "hardis:monitor:backup:org",
8279
+ "monitor:hardis:backup:org",
8280
+ "monitor:backup:hardis:org",
8281
+ "monitor:backup:org:hardis",
8282
+ "hardis:org:backup:monitor",
8283
+ "org:hardis:backup:monitor",
8284
+ "org:backup:hardis:monitor",
8285
+ "org:backup:monitor:hardis",
8286
+ "hardis:backup:org:monitor",
8287
+ "backup:hardis:org:monitor",
8288
+ "backup:org:hardis:monitor",
8289
+ "backup:org:monitor:hardis",
8290
+ "hardis:backup:monitor:org",
8291
+ "backup:hardis:monitor:org",
8292
+ "backup:monitor:hardis:org",
8293
+ "backup:monitor:org:hardis"
8288
8294
  ]
8289
8295
  },
8290
- "hardis:org:files:import": {
8296
+ "hardis:org:monitor:limits": {
8291
8297
  "aliases": [],
8292
8298
  "args": {},
8293
- "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",
8299
+ "description": "\n## Command Behavior\n\n**Checks the current usage of various Salesforce org limits and sends notifications if thresholds are exceeded.**\n\nThis command is a critical component of proactive Salesforce org management, helping administrators and developers monitor resource consumption and prevent hitting critical limits that could impact performance or functionality. It provides early warnings when limits are approaching their capacity.\n\nKey functionalities:\n\n- **Limit Retrieval:** Fetches a comprehensive list of all Salesforce org limits using the Salesforce CLI.\n- **Usage Calculation:** Calculates the percentage of each limit that is currently being used.\n- **Threshold-Based Alerting:** Assigns a severity (success, warning, or error) to each limit based on configurable thresholds:\n - **Warning:** If usage exceeds 50% (configurable via `LIMIT_THRESHOLD_WARNING` environment variable).\n - **Error:** If usage exceeds 75% (configurable via `LIMIT_THRESHOLD_ERROR` environment variable).\n- **CSV Report Generation:** Generates a CSV file containing all org limits, their current usage, maximum allowed, and calculated percentage used, along with the assigned severity.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of limits that have exceeded the warning or error thresholds.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-limits/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce CLI Integration:** It executes the `sf org limits list` command to retrieve the current org limits. It parses the JSON output of this command.\n- **Data Processing:** It iterates through the retrieved limits, calculates the `used` and `percentUsed` values, and assigns a `severity` (success, warning, error) based on the configured thresholds.\n- **Environment Variable Configuration:** Reads `LIMIT_THRESHOLD_WARNING` and `LIMIT_THRESHOLD_ERROR` environment variables to set the warning and error thresholds for limit usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of org limits.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and detailed metrics for each limit, which can be consumed by monitoring dashboards like Grafana.\n- **Exit Code Management:** Sets the process exit code to 1 if any limit is in an 'error' state, indicating a critical issue.\n</details>\n",
8294
8300
  "examples": [
8295
- "$ sf hardis:org:files:import"
8301
+ "$ sf hardis:org:monitor:limits"
8296
8302
  ],
8297
8303
  "flags": {
8298
8304
  "json": {
@@ -8310,21 +8316,14 @@
8310
8316
  "multiple": false,
8311
8317
  "type": "option"
8312
8318
  },
8313
- "path": {
8314
- "char": "p",
8315
- "description": "Path to the file export project",
8316
- "name": "path",
8319
+ "outputfile": {
8320
+ "char": "f",
8321
+ "description": "Force the path and name of output report file. Must end with .csv",
8322
+ "name": "outputfile",
8317
8323
  "hasDynamicHelp": false,
8318
8324
  "multiple": false,
8319
8325
  "type": "option"
8320
8326
  },
8321
- "overwrite": {
8322
- "char": "f",
8323
- "description": "Override existing files (doubles the number of API calls)",
8324
- "name": "overwrite",
8325
- "allowNo": false,
8326
- "type": "boolean"
8327
- },
8328
8327
  "debug": {
8329
8328
  "char": "d",
8330
8329
  "description": "Activate debug mode (more logs)",
@@ -8363,49 +8362,50 @@
8363
8362
  },
8364
8363
  "hasDynamicHelp": true,
8365
8364
  "hiddenAliases": [],
8366
- "id": "hardis:org:files:import",
8365
+ "id": "hardis:org:monitor:limits",
8367
8366
  "pluginAlias": "sfdx-hardis",
8368
8367
  "pluginName": "sfdx-hardis",
8369
8368
  "pluginType": "core",
8370
8369
  "strict": true,
8371
8370
  "enableJsonFlag": true,
8372
- "title": "Import files",
8373
- "requiresProject": false,
8371
+ "title": "Check org limits",
8372
+ "requiresProject": true,
8373
+ "triggerNotification": true,
8374
8374
  "isESM": true,
8375
8375
  "relativePath": [
8376
8376
  "lib",
8377
8377
  "commands",
8378
8378
  "hardis",
8379
8379
  "org",
8380
- "files",
8381
- "import.js"
8380
+ "monitor",
8381
+ "limits.js"
8382
8382
  ],
8383
8383
  "aliasPermutations": [],
8384
8384
  "permutations": [
8385
- "hardis:org:files:import",
8386
- "org:hardis:files:import",
8387
- "org:files:hardis:import",
8388
- "org:files:import:hardis",
8389
- "hardis:files:org:import",
8390
- "files:hardis:org:import",
8391
- "files:org:hardis:import",
8392
- "files:org:import:hardis",
8393
- "hardis:files:import:org",
8394
- "files:hardis:import:org",
8395
- "files:import:hardis:org",
8396
- "files:import:org:hardis",
8397
- "hardis:org:import:files",
8398
- "org:hardis:import:files",
8399
- "org:import:hardis:files",
8400
- "org:import:files:hardis",
8401
- "hardis:import:org:files",
8402
- "import:hardis:org:files",
8403
- "import:org:hardis:files",
8404
- "import:org:files:hardis",
8405
- "hardis:import:files:org",
8406
- "import:hardis:files:org",
8407
- "import:files:hardis:org",
8408
- "import:files:org:hardis"
8385
+ "hardis:org:monitor:limits",
8386
+ "org:hardis:monitor:limits",
8387
+ "org:monitor:hardis:limits",
8388
+ "org:monitor:limits:hardis",
8389
+ "hardis:monitor:org:limits",
8390
+ "monitor:hardis:org:limits",
8391
+ "monitor:org:hardis:limits",
8392
+ "monitor:org:limits:hardis",
8393
+ "hardis:monitor:limits:org",
8394
+ "monitor:hardis:limits:org",
8395
+ "monitor:limits:hardis:org",
8396
+ "monitor:limits:org:hardis",
8397
+ "hardis:org:limits:monitor",
8398
+ "org:hardis:limits:monitor",
8399
+ "org:limits:hardis:monitor",
8400
+ "org:limits:monitor:hardis",
8401
+ "hardis:limits:org:monitor",
8402
+ "limits:hardis:org:monitor",
8403
+ "limits:org:hardis:monitor",
8404
+ "limits:org:monitor:hardis",
8405
+ "hardis:limits:monitor:org",
8406
+ "limits:hardis:monitor:org",
8407
+ "limits:monitor:hardis:org",
8408
+ "limits:monitor:org:hardis"
8409
8409
  ]
8410
8410
  },
8411
8411
  "hardis:org:purge:apexlog": {
@@ -10307,128 +10307,37 @@
10307
10307
  "aliasPermutations": [],
10308
10308
  "permutations": [
10309
10309
  "hardis:project:audit:duplicatefiles",
10310
- "project:hardis:audit:duplicatefiles",
10311
- "project:audit:hardis:duplicatefiles",
10312
- "project:audit:duplicatefiles:hardis",
10313
- "hardis:audit:project:duplicatefiles",
10314
- "audit:hardis:project:duplicatefiles",
10315
- "audit:project:hardis:duplicatefiles",
10316
- "audit:project:duplicatefiles:hardis",
10317
- "hardis:audit:duplicatefiles:project",
10318
- "audit:hardis:duplicatefiles:project",
10319
- "audit:duplicatefiles:hardis:project",
10320
- "audit:duplicatefiles:project:hardis",
10321
- "hardis:project:duplicatefiles:audit",
10322
- "project:hardis:duplicatefiles:audit",
10323
- "project:duplicatefiles:hardis:audit",
10324
- "project:duplicatefiles:audit:hardis",
10325
- "hardis:duplicatefiles:project:audit",
10326
- "duplicatefiles:hardis:project:audit",
10327
- "duplicatefiles:project:hardis:audit",
10328
- "duplicatefiles:project:audit:hardis",
10329
- "hardis:duplicatefiles:audit:project",
10330
- "duplicatefiles:hardis:audit:project",
10331
- "duplicatefiles:audit:hardis:project",
10332
- "duplicatefiles:audit:project:hardis"
10333
- ]
10334
- },
10335
- "hardis:project:audit:remotesites": {
10336
- "aliases": [],
10337
- "args": {},
10338
- "description": "\n## Command Behavior\n\n**Audits Salesforce Remote Site Settings in your project, providing a comprehensive overview of external endpoints accessed by your Salesforce org.**\n\nThis command is crucial for security reviews, compliance checks, and understanding the external integrations of your Salesforce environment. It helps identify all configured remote sites, their URLs, activity status, and associated protocols.\n\nKey functionalities:\n\n- **Remote Site Discovery:** Scans your project for RemoteSiteSetting metadata files (.remoteSite-meta.xml or .remoteSite).\n- **URL Extraction:** Extracts the URL, active status, and description for each remote site.\n- **Protocol and Domain Identification:** Determines the protocol (HTTP/HTTPS) and extracts the domain from each URL, providing a clearer picture of the external systems being accessed.\n- **Reporting:** Generates a CSV report summarizing all detected remote sites, including their protocol, domain, name, URL, active status, and description.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all RemoteSiteSetting metadata files within the project.\n- **Content Analysis:** Reads the content of each XML file and uses regular expressions (/<url>(.*?)<\\/url>/gim, /<isActive>(.*?)<\\/isActive>/gim, /<description>(.*?)<\\/description>/gim) to extract relevant details.\n- **`catchMatches` Utility:** This utility function is used to apply the defined regular expressions to each file and extract all matching occurrences.\n- **URL Parsing:** Uses Node.js's `url` module to parse the extracted URLs and `psl` (Public Suffix List) to extract the domain name from the hostname.\n- **Data Structuring:** Organizes the extracted information into a structured format, including the remote site's name, file name, namespace, URL, active status, description, protocol, and domain.\n- **Reporting:** Uses `generateReports` to create a CSV report and display a table in the console, summarizing the audit findings.\n</details>\n",
10339
- "examples": [
10340
- "$ sf hardis:project:audit:remotesites"
10341
- ],
10342
- "flags": {
10343
- "json": {
10344
- "description": "Format output as json.",
10345
- "helpGroup": "GLOBAL",
10346
- "name": "json",
10347
- "allowNo": false,
10348
- "type": "boolean"
10349
- },
10350
- "flags-dir": {
10351
- "helpGroup": "GLOBAL",
10352
- "name": "flags-dir",
10353
- "summary": "Import flag values from a directory.",
10354
- "hasDynamicHelp": false,
10355
- "multiple": false,
10356
- "type": "option"
10357
- },
10358
- "debug": {
10359
- "char": "d",
10360
- "description": "Activate debug mode (more logs)",
10361
- "name": "debug",
10362
- "allowNo": false,
10363
- "type": "boolean"
10364
- },
10365
- "websocket": {
10366
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
10367
- "name": "websocket",
10368
- "hasDynamicHelp": false,
10369
- "multiple": false,
10370
- "type": "option"
10371
- },
10372
- "skipauth": {
10373
- "description": "Skip authentication check when a default username is required",
10374
- "name": "skipauth",
10375
- "allowNo": false,
10376
- "type": "boolean"
10377
- }
10378
- },
10379
- "hasDynamicHelp": false,
10380
- "hiddenAliases": [],
10381
- "id": "hardis:project:audit:remotesites",
10382
- "pluginAlias": "sfdx-hardis",
10383
- "pluginName": "sfdx-hardis",
10384
- "pluginType": "core",
10385
- "strict": true,
10386
- "enableJsonFlag": true,
10387
- "title": "Audit Remote Sites",
10388
- "requiresProject": true,
10389
- "isESM": true,
10390
- "relativePath": [
10391
- "lib",
10392
- "commands",
10393
- "hardis",
10394
- "project",
10395
- "audit",
10396
- "remotesites.js"
10397
- ],
10398
- "aliasPermutations": [],
10399
- "permutations": [
10400
- "hardis:project:audit:remotesites",
10401
- "project:hardis:audit:remotesites",
10402
- "project:audit:hardis:remotesites",
10403
- "project:audit:remotesites:hardis",
10404
- "hardis:audit:project:remotesites",
10405
- "audit:hardis:project:remotesites",
10406
- "audit:project:hardis:remotesites",
10407
- "audit:project:remotesites:hardis",
10408
- "hardis:audit:remotesites:project",
10409
- "audit:hardis:remotesites:project",
10410
- "audit:remotesites:hardis:project",
10411
- "audit:remotesites:project:hardis",
10412
- "hardis:project:remotesites:audit",
10413
- "project:hardis:remotesites:audit",
10414
- "project:remotesites:hardis:audit",
10415
- "project:remotesites:audit:hardis",
10416
- "hardis:remotesites:project:audit",
10417
- "remotesites:hardis:project:audit",
10418
- "remotesites:project:hardis:audit",
10419
- "remotesites:project:audit:hardis",
10420
- "hardis:remotesites:audit:project",
10421
- "remotesites:hardis:audit:project",
10422
- "remotesites:audit:hardis:project",
10423
- "remotesites:audit:project:hardis"
10310
+ "project:hardis:audit:duplicatefiles",
10311
+ "project:audit:hardis:duplicatefiles",
10312
+ "project:audit:duplicatefiles:hardis",
10313
+ "hardis:audit:project:duplicatefiles",
10314
+ "audit:hardis:project:duplicatefiles",
10315
+ "audit:project:hardis:duplicatefiles",
10316
+ "audit:project:duplicatefiles:hardis",
10317
+ "hardis:audit:duplicatefiles:project",
10318
+ "audit:hardis:duplicatefiles:project",
10319
+ "audit:duplicatefiles:hardis:project",
10320
+ "audit:duplicatefiles:project:hardis",
10321
+ "hardis:project:duplicatefiles:audit",
10322
+ "project:hardis:duplicatefiles:audit",
10323
+ "project:duplicatefiles:hardis:audit",
10324
+ "project:duplicatefiles:audit:hardis",
10325
+ "hardis:duplicatefiles:project:audit",
10326
+ "duplicatefiles:hardis:project:audit",
10327
+ "duplicatefiles:project:hardis:audit",
10328
+ "duplicatefiles:project:audit:hardis",
10329
+ "hardis:duplicatefiles:audit:project",
10330
+ "duplicatefiles:hardis:audit:project",
10331
+ "duplicatefiles:audit:hardis:project",
10332
+ "duplicatefiles:audit:project:hardis"
10424
10333
  ]
10425
10334
  },
10426
- "hardis:project:configure:auth": {
10335
+ "hardis:project:audit:remotesites": {
10427
10336
  "aliases": [],
10428
10337
  "args": {},
10429
- "description": "\n## Command Behavior\n\n**Configures authentication between a Git branch and a target Salesforce org for CI/CD deployments.**\n\nThis command facilitates the setup of automated CI/CD pipelines, enabling seamless deployments from specific Git branches to designated Salesforce orgs. It supports both standard Salesforce orgs and Dev Hub configurations, catering to various enterprise deployment workflows.\n\nThis command supports two authentication app types:\n- **Connected App** (traditional) - Standard OAuth app that works with all Salesforce editions\n- **External Client App** (modern) - Fully metadata-based, packageable in 2GP, requires API v59+\n\nBoth use JWT Bearer flow with SSL certificates for secure CI/CD authentication.\n\nKey functionalities include:\n\n- **Org Selection/Login:** Guides the user to select an existing Salesforce org or log in to a new one.\n- **Git Branch Association:** Allows associating a specific Git branch with the chosen Salesforce org.\n- **Merge Target Definition:** Enables defining target Git branches into which the configured branch can merge, ensuring controlled deployment flows.\n- **Salesforce Username Configuration:** Prompts for the Salesforce username to be used by the CI server for deployments.\n- **SSL Certificate Generation:** Automatically generates an SSL certificate for secure authentication.\n- **App Type Selection:** Choose between Connected App (traditional) or External Client App (modern, metadata-based).\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's implementation involves several key technical aspects:\n\n- **SF CLI Integration:** Utilizes \n@salesforce/sf-plugins-core\n for command structure and flag parsing.\n- **Interactive Prompts:** Employs the \nprompts\n library for interactive user input, guiding the configuration process.\n- **Git Integration:** Interacts with Git to retrieve branch information using \n`git().branch([\"--list\", \"-r\"])`\n.\n- **Configuration Management:** Leverages internal utilities (`checkConfig`, `getConfig`, `setConfig`, `setInConfigFile`) to read from and write to project-specific configuration files (e.g., `.sfdx-hardis.<branchName>.yml`).\n- **Salesforce CLI Execution:** Executes Salesforce CLI commands programmatically via `execSfdxJson` for org interactions.\n- **SSL Certificate Generation:** Calls `generateSSLCertificate` to create necessary SSL certificates for JWT-based authentication.\n- **WebSocket Communication:** Uses `WebSocketClient` for potential communication with external tools or processes, such as restarting the command in VS Code.\n- **Dependency Check:** Ensures the presence of `openssl` on the system, which is required for SSL certificate generation.\n",
10338
+ "description": "\n## Command Behavior\n\n**Audits Salesforce Remote Site Settings in your project, providing a comprehensive overview of external endpoints accessed by your Salesforce org.**\n\nThis command is crucial for security reviews, compliance checks, and understanding the external integrations of your Salesforce environment. It helps identify all configured remote sites, their URLs, activity status, and associated protocols.\n\nKey functionalities:\n\n- **Remote Site Discovery:** Scans your project for RemoteSiteSetting metadata files (.remoteSite-meta.xml or .remoteSite).\n- **URL Extraction:** Extracts the URL, active status, and description for each remote site.\n- **Protocol and Domain Identification:** Determines the protocol (HTTP/HTTPS) and extracts the domain from each URL, providing a clearer picture of the external systems being accessed.\n- **Reporting:** Generates a CSV report summarizing all detected remote sites, including their protocol, domain, name, URL, active status, and description.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all RemoteSiteSetting metadata files within the project.\n- **Content Analysis:** Reads the content of each XML file and uses regular expressions (/<url>(.*?)<\\/url>/gim, /<isActive>(.*?)<\\/isActive>/gim, /<description>(.*?)<\\/description>/gim) to extract relevant details.\n- **`catchMatches` Utility:** This utility function is used to apply the defined regular expressions to each file and extract all matching occurrences.\n- **URL Parsing:** Uses Node.js's `url` module to parse the extracted URLs and `psl` (Public Suffix List) to extract the domain name from the hostname.\n- **Data Structuring:** Organizes the extracted information into a structured format, including the remote site's name, file name, namespace, URL, active status, description, protocol, and domain.\n- **Reporting:** Uses `generateReports` to create a CSV report and display a table in the console, summarizing the audit findings.\n</details>\n",
10430
10339
  "examples": [
10431
- "$ sf hardis:project:configure:auth"
10340
+ "$ sf hardis:project:audit:remotesites"
10432
10341
  ],
10433
10342
  "flags": {
10434
10343
  "json": {
@@ -10446,13 +10355,6 @@
10446
10355
  "multiple": false,
10447
10356
  "type": "option"
10448
10357
  },
10449
- "devhub": {
10450
- "char": "b",
10451
- "description": "Configure project DevHub",
10452
- "name": "devhub",
10453
- "allowNo": false,
10454
- "type": "boolean"
10455
- },
10456
10358
  "debug": {
10457
10359
  "char": "d",
10458
10360
  "description": "Activate debug mode (more logs)",
@@ -10472,84 +10374,53 @@
10472
10374
  "name": "skipauth",
10473
10375
  "allowNo": false,
10474
10376
  "type": "boolean"
10475
- },
10476
- "target-org": {
10477
- "aliases": [
10478
- "targetusername",
10479
- "u"
10480
- ],
10481
- "char": "o",
10482
- "deprecateAliases": true,
10483
- "name": "target-org",
10484
- "noCacheDefault": true,
10485
- "summary": "Username or alias of the target org.",
10486
- "hasDynamicHelp": true,
10487
- "multiple": false,
10488
- "type": "option"
10489
- },
10490
- "target-dev-hub": {
10491
- "aliases": [
10492
- "targetdevhubusername"
10493
- ],
10494
- "char": "v",
10495
- "deprecateAliases": true,
10496
- "name": "target-dev-hub",
10497
- "noCacheDefault": true,
10498
- "required": false,
10499
- "summary": "Username or alias of the Dev Hub org.",
10500
- "hasDynamicHelp": true,
10501
- "multiple": false,
10502
- "type": "option"
10503
10377
  }
10504
10378
  },
10505
- "hasDynamicHelp": true,
10379
+ "hasDynamicHelp": false,
10506
10380
  "hiddenAliases": [],
10507
- "id": "hardis:project:configure:auth",
10381
+ "id": "hardis:project:audit:remotesites",
10508
10382
  "pluginAlias": "sfdx-hardis",
10509
10383
  "pluginName": "sfdx-hardis",
10510
10384
  "pluginType": "core",
10511
10385
  "strict": true,
10512
10386
  "enableJsonFlag": true,
10513
- "title": "Configure authentication",
10514
- "requiresProject": false,
10515
- "requiresDependencies": [
10516
- "openssl"
10517
- ],
10387
+ "title": "Audit Remote Sites",
10388
+ "requiresProject": true,
10518
10389
  "isESM": true,
10519
10390
  "relativePath": [
10520
10391
  "lib",
10521
10392
  "commands",
10522
10393
  "hardis",
10523
10394
  "project",
10524
- "configure",
10525
- "auth.js"
10395
+ "audit",
10396
+ "remotesites.js"
10526
10397
  ],
10527
10398
  "aliasPermutations": [],
10528
10399
  "permutations": [
10529
- "hardis:project:configure:auth",
10530
- "project:hardis:configure:auth",
10531
- "project:configure:hardis:auth",
10532
- "project:configure:auth:hardis",
10533
- "hardis:configure:project:auth",
10534
- "configure:hardis:project:auth",
10535
- "configure:project:hardis:auth",
10536
- "configure:project:auth:hardis",
10537
- "hardis:configure:auth:project",
10538
- "configure:hardis:auth:project",
10539
- "configure:auth:hardis:project",
10540
- "configure:auth:project:hardis",
10541
- "hardis:project:auth:configure",
10542
- "project:hardis:auth:configure",
10543
- "project:auth:hardis:configure",
10544
- "project:auth:configure:hardis",
10545
- "hardis:auth:project:configure",
10546
- "auth:hardis:project:configure",
10547
- "auth:project:hardis:configure",
10548
- "auth:project:configure:hardis",
10549
- "hardis:auth:configure:project",
10550
- "auth:hardis:configure:project",
10551
- "auth:configure:hardis:project",
10552
- "auth:configure:project:hardis"
10400
+ "hardis:project:audit:remotesites",
10401
+ "project:hardis:audit:remotesites",
10402
+ "project:audit:hardis:remotesites",
10403
+ "project:audit:remotesites:hardis",
10404
+ "hardis:audit:project:remotesites",
10405
+ "audit:hardis:project:remotesites",
10406
+ "audit:project:hardis:remotesites",
10407
+ "audit:project:remotesites:hardis",
10408
+ "hardis:audit:remotesites:project",
10409
+ "audit:hardis:remotesites:project",
10410
+ "audit:remotesites:hardis:project",
10411
+ "audit:remotesites:project:hardis",
10412
+ "hardis:project:remotesites:audit",
10413
+ "project:hardis:remotesites:audit",
10414
+ "project:remotesites:hardis:audit",
10415
+ "project:remotesites:audit:hardis",
10416
+ "hardis:remotesites:project:audit",
10417
+ "remotesites:hardis:project:audit",
10418
+ "remotesites:project:hardis:audit",
10419
+ "remotesites:project:audit:hardis",
10420
+ "hardis:remotesites:audit:project",
10421
+ "remotesites:hardis:audit:project",
10422
+ "remotesites:audit:hardis:project",
10423
+ "remotesites:audit:project:hardis"
10553
10424
  ]
10554
10425
  },
10555
10426
  "hardis:project:clean:emptyitems": {
@@ -12138,6 +12009,135 @@
12138
12009
  "xml:clean:project:hardis"
12139
12010
  ]
12140
12011
  },
12012
+ "hardis:project:configure:auth": {
12013
+ "aliases": [],
12014
+ "args": {},
12015
+ "description": "\n## Command Behavior\n\n**Configures authentication between a Git branch and a target Salesforce org for CI/CD deployments.**\n\nThis command facilitates the setup of automated CI/CD pipelines, enabling seamless deployments from specific Git branches to designated Salesforce orgs. It supports both standard Salesforce orgs and Dev Hub configurations, catering to various enterprise deployment workflows.\n\nThis command supports two authentication app types:\n- **Connected App** (traditional) - Standard OAuth app that works with all Salesforce editions\n- **External Client App** (modern) - Fully metadata-based, packageable in 2GP, requires API v59+\n\nBoth use JWT Bearer flow with SSL certificates for secure CI/CD authentication.\n\nKey functionalities include:\n\n- **Org Selection/Login:** Guides the user to select an existing Salesforce org or log in to a new one.\n- **Git Branch Association:** Allows associating a specific Git branch with the chosen Salesforce org.\n- **Merge Target Definition:** Enables defining target Git branches into which the configured branch can merge, ensuring controlled deployment flows.\n- **Salesforce Username Configuration:** Prompts for the Salesforce username to be used by the CI server for deployments.\n- **SSL Certificate Generation:** Automatically generates an SSL certificate for secure authentication.\n- **App Type Selection:** Choose between Connected App (traditional) or External Client App (modern, metadata-based).\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's implementation involves several key technical aspects:\n\n- **SF CLI Integration:** Utilizes \n@salesforce/sf-plugins-core\n for command structure and flag parsing.\n- **Interactive Prompts:** Employs the \nprompts\n library for interactive user input, guiding the configuration process.\n- **Git Integration:** Interacts with Git to retrieve branch information using \n`git().branch([\"--list\", \"-r\"])`\n.\n- **Configuration Management:** Leverages internal utilities (`checkConfig`, `getConfig`, `setConfig`, `setInConfigFile`) to read from and write to project-specific configuration files (e.g., `.sfdx-hardis.<branchName>.yml`).\n- **Salesforce CLI Execution:** Executes Salesforce CLI commands programmatically via `execSfdxJson` for org interactions.\n- **SSL Certificate Generation:** Calls `generateSSLCertificate` to create necessary SSL certificates for JWT-based authentication.\n- **WebSocket Communication:** Uses `WebSocketClient` for potential communication with external tools or processes, such as restarting the command in VS Code.\n- **Dependency Check:** Ensures the presence of `openssl` on the system, which is required for SSL certificate generation.\n",
12016
+ "examples": [
12017
+ "$ sf hardis:project:configure:auth"
12018
+ ],
12019
+ "flags": {
12020
+ "json": {
12021
+ "description": "Format output as json.",
12022
+ "helpGroup": "GLOBAL",
12023
+ "name": "json",
12024
+ "allowNo": false,
12025
+ "type": "boolean"
12026
+ },
12027
+ "flags-dir": {
12028
+ "helpGroup": "GLOBAL",
12029
+ "name": "flags-dir",
12030
+ "summary": "Import flag values from a directory.",
12031
+ "hasDynamicHelp": false,
12032
+ "multiple": false,
12033
+ "type": "option"
12034
+ },
12035
+ "devhub": {
12036
+ "char": "b",
12037
+ "description": "Configure project DevHub",
12038
+ "name": "devhub",
12039
+ "allowNo": false,
12040
+ "type": "boolean"
12041
+ },
12042
+ "debug": {
12043
+ "char": "d",
12044
+ "description": "Activate debug mode (more logs)",
12045
+ "name": "debug",
12046
+ "allowNo": false,
12047
+ "type": "boolean"
12048
+ },
12049
+ "websocket": {
12050
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12051
+ "name": "websocket",
12052
+ "hasDynamicHelp": false,
12053
+ "multiple": false,
12054
+ "type": "option"
12055
+ },
12056
+ "skipauth": {
12057
+ "description": "Skip authentication check when a default username is required",
12058
+ "name": "skipauth",
12059
+ "allowNo": false,
12060
+ "type": "boolean"
12061
+ },
12062
+ "target-org": {
12063
+ "aliases": [
12064
+ "targetusername",
12065
+ "u"
12066
+ ],
12067
+ "char": "o",
12068
+ "deprecateAliases": true,
12069
+ "name": "target-org",
12070
+ "noCacheDefault": true,
12071
+ "summary": "Username or alias of the target org.",
12072
+ "hasDynamicHelp": true,
12073
+ "multiple": false,
12074
+ "type": "option"
12075
+ },
12076
+ "target-dev-hub": {
12077
+ "aliases": [
12078
+ "targetdevhubusername"
12079
+ ],
12080
+ "char": "v",
12081
+ "deprecateAliases": true,
12082
+ "name": "target-dev-hub",
12083
+ "noCacheDefault": true,
12084
+ "required": false,
12085
+ "summary": "Username or alias of the Dev Hub org.",
12086
+ "hasDynamicHelp": true,
12087
+ "multiple": false,
12088
+ "type": "option"
12089
+ }
12090
+ },
12091
+ "hasDynamicHelp": true,
12092
+ "hiddenAliases": [],
12093
+ "id": "hardis:project:configure:auth",
12094
+ "pluginAlias": "sfdx-hardis",
12095
+ "pluginName": "sfdx-hardis",
12096
+ "pluginType": "core",
12097
+ "strict": true,
12098
+ "enableJsonFlag": true,
12099
+ "title": "Configure authentication",
12100
+ "requiresProject": false,
12101
+ "requiresDependencies": [
12102
+ "openssl"
12103
+ ],
12104
+ "isESM": true,
12105
+ "relativePath": [
12106
+ "lib",
12107
+ "commands",
12108
+ "hardis",
12109
+ "project",
12110
+ "configure",
12111
+ "auth.js"
12112
+ ],
12113
+ "aliasPermutations": [],
12114
+ "permutations": [
12115
+ "hardis:project:configure:auth",
12116
+ "project:hardis:configure:auth",
12117
+ "project:configure:hardis:auth",
12118
+ "project:configure:auth:hardis",
12119
+ "hardis:configure:project:auth",
12120
+ "configure:hardis:project:auth",
12121
+ "configure:project:hardis:auth",
12122
+ "configure:project:auth:hardis",
12123
+ "hardis:configure:auth:project",
12124
+ "configure:hardis:auth:project",
12125
+ "configure:auth:hardis:project",
12126
+ "configure:auth:project:hardis",
12127
+ "hardis:project:auth:configure",
12128
+ "project:hardis:auth:configure",
12129
+ "project:auth:hardis:configure",
12130
+ "project:auth:configure:hardis",
12131
+ "hardis:auth:project:configure",
12132
+ "auth:hardis:project:configure",
12133
+ "auth:project:hardis:configure",
12134
+ "auth:project:configure:hardis",
12135
+ "hardis:auth:configure:project",
12136
+ "auth:hardis:configure:project",
12137
+ "auth:configure:hardis:project",
12138
+ "auth:configure:project:hardis"
12139
+ ]
12140
+ },
12141
12141
  "hardis:project:convert:profilestopermsets": {
12142
12142
  "aliases": [],
12143
12143
  "args": {},
@@ -16221,5 +16221,5 @@
16221
16221
  ]
16222
16222
  }
16223
16223
  },
16224
- "version": "6.21.2-beta202601131228.0"
16224
+ "version": "6.22.0"
16225
16225
  }