rflib-plugin 0.21.10 → 0.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.
@@ -93,13 +93,12 @@
93
93
  "upgrade:packages:rflib"
94
94
  ]
95
95
  },
96
- "rflib:debug:logarchives:get": {
96
+ "rflib:logging:apex:instrument": {
97
97
  "aliases": [],
98
98
  "args": {},
99
- "description": "Retrieves rflib_Logs_Archive__b records from the target org's big object store via the Salesforce REST API.\nEach log record contains log level, context, request ID, and full log messages in the format: [timestamp]|[LEVEL]|[TRACE_ID]|[CONTEXT]|[MESSAGE].\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to rflib_Logs_Archive__b).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
99
+ "description": "Analyzes Apex classes and adds RFLIB logging statements for method entry and error handling. Adds class-level logger initialization if not already present. \nFor Apex Test classes, the `@TestSetup` method will be updated to include `rflib_TestUtil.prepareLoggerForUnitTests();` to avoid test failures caused by the logging framework.",
100
100
  "examples": [
101
- "Get log archives from the last 24 hours:\n$ sf rflib debug logarchives get --target-org myOrg",
102
- "Get log archives for a specific date range:\n$ sf rflib debug logarchives get --target-org myOrg --start-date 2024-01-01T00:00:00Z --end-date 2024-01-02T00:00:00Z"
101
+ "- Add logging statements to all Apex classes in a directory:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes\n\n- Preview changes without modifying files:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --dryrun\n\n- Add logging statements and format code:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --prettier"
103
102
  ],
104
103
  "flags": {
105
104
  "json": {
@@ -117,88 +116,133 @@
117
116
  "multiple": false,
118
117
  "type": "option"
119
118
  },
120
- "target-org": {
121
- "char": "o",
122
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
123
- "name": "target-org",
124
- "noCacheDefault": true,
119
+ "sourcepath": {
120
+ "char": "s",
121
+ "description": "Path to the source directory containing Apex classes that should be instrumented with RFLIB logging statements. Test classes (ending with 'Test.cls') are automatically excluded.",
122
+ "name": "sourcepath",
125
123
  "required": true,
126
- "summary": "Username or alias of the target org.",
127
- "hasDynamicHelp": true,
124
+ "summary": "Directory containing Apex classes to instrument with logging.",
125
+ "hasDynamicHelp": false,
128
126
  "multiple": false,
129
127
  "type": "option"
130
128
  },
131
- "start-date": {
132
- "char": "s",
133
- "description": "Only return log archives created on or after this date. Must be in ISO 8601 format, e.g. 2024-01-01T00:00:00Z. Defaults to 24 hours ago if omitted.",
134
- "name": "start-date",
135
- "summary": "Start of the date range in ISO 8601 format. Defaults to 24 hours ago.",
129
+ "dryrun": {
130
+ "char": "d",
131
+ "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
132
+ "name": "dryrun",
133
+ "summary": "Preview changes without modifying files.",
134
+ "allowNo": false,
135
+ "type": "boolean"
136
+ },
137
+ "prettier": {
138
+ "char": "p",
139
+ "description": "When enabled, formats the modified Apex files using prettier-plugin-apex after adding logging statements. Maintains consistent code style with:\n\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs",
140
+ "name": "prettier",
141
+ "summary": "Format modified files using Prettier.",
142
+ "allowNo": false,
143
+ "type": "boolean"
144
+ },
145
+ "no-if": {
146
+ "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
147
+ "name": "no-if",
148
+ "summary": "Exclude the instrumentation of if-else statements.",
149
+ "allowNo": false,
150
+ "type": "boolean"
151
+ },
152
+ "no-catch": {
153
+ "description": "When provided, the command will not add error log statements inside of `catch` blocks.",
154
+ "name": "no-catch",
155
+ "summary": "Exclude the instrumentation of catch blocks.",
156
+ "allowNo": false,
157
+ "type": "boolean"
158
+ },
159
+ "skip-instrumented": {
160
+ "description": "When provided, the command will not add log statements to any Apex class that contains the `rflib_Logger` reference.",
161
+ "name": "skip-instrumented",
162
+ "summary": "Skips any files where a logger is already present.",
163
+ "allowNo": false,
164
+ "type": "boolean"
165
+ },
166
+ "verbose": {
167
+ "char": "v",
168
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
169
+ "name": "verbose",
170
+ "summary": "Enable verbose output.",
171
+ "allowNo": false,
172
+ "type": "boolean"
173
+ },
174
+ "exclude": {
175
+ "char": "e",
176
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cls\" to skip auto-generated classes.",
177
+ "name": "exclude",
178
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
136
179
  "hasDynamicHelp": false,
137
180
  "multiple": false,
138
181
  "type": "option"
139
182
  },
140
- "end-date": {
141
- "char": "d",
142
- "description": "Only return log archives created on or before this date. Must be in ISO 8601 format, e.g. 2024-12-31T23:59:59Z. Defaults to the current time if omitted.",
143
- "name": "end-date",
144
- "summary": "End of the date range in ISO 8601 format. Defaults to now.",
183
+ "concurrency": {
184
+ "char": "c",
185
+ "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
186
+ "name": "concurrency",
187
+ "summary": "Limits the number of files processed concurrently.",
188
+ "default": 10,
145
189
  "hasDynamicHelp": false,
146
190
  "multiple": false,
147
191
  "type": "option"
148
192
  }
149
193
  },
150
- "hasDynamicHelp": true,
194
+ "hasDynamicHelp": false,
151
195
  "hiddenAliases": [],
152
- "id": "rflib:debug:logarchives:get",
196
+ "id": "rflib:logging:apex:instrument",
153
197
  "pluginAlias": "rflib-plugin",
154
198
  "pluginName": "rflib-plugin",
155
199
  "pluginType": "core",
156
200
  "strict": true,
157
- "summary": "Query RFLIB log archives from a Salesforce org.",
201
+ "summary": "Instrument Apex classes with RFLIB logging statements automatically.",
158
202
  "enableJsonFlag": true,
159
203
  "isESM": true,
160
204
  "relativePath": [
161
205
  "lib",
162
206
  "commands",
163
207
  "rflib",
164
- "debug",
165
- "logarchives",
166
- "get.js"
208
+ "logging",
209
+ "apex",
210
+ "instrument.js"
167
211
  ],
168
212
  "aliasPermutations": [],
169
213
  "permutations": [
170
- "rflib:debug:logarchives:get",
171
- "debug:rflib:logarchives:get",
172
- "debug:logarchives:rflib:get",
173
- "debug:logarchives:get:rflib",
174
- "rflib:logarchives:debug:get",
175
- "logarchives:rflib:debug:get",
176
- "logarchives:debug:rflib:get",
177
- "logarchives:debug:get:rflib",
178
- "rflib:logarchives:get:debug",
179
- "logarchives:rflib:get:debug",
180
- "logarchives:get:rflib:debug",
181
- "logarchives:get:debug:rflib",
182
- "rflib:debug:get:logarchives",
183
- "debug:rflib:get:logarchives",
184
- "debug:get:rflib:logarchives",
185
- "debug:get:logarchives:rflib",
186
- "rflib:get:debug:logarchives",
187
- "get:rflib:debug:logarchives",
188
- "get:debug:rflib:logarchives",
189
- "get:debug:logarchives:rflib",
190
- "rflib:get:logarchives:debug",
191
- "get:rflib:logarchives:debug",
192
- "get:logarchives:rflib:debug",
193
- "get:logarchives:debug:rflib"
214
+ "rflib:logging:apex:instrument",
215
+ "logging:rflib:apex:instrument",
216
+ "logging:apex:rflib:instrument",
217
+ "logging:apex:instrument:rflib",
218
+ "rflib:apex:logging:instrument",
219
+ "apex:rflib:logging:instrument",
220
+ "apex:logging:rflib:instrument",
221
+ "apex:logging:instrument:rflib",
222
+ "rflib:apex:instrument:logging",
223
+ "apex:rflib:instrument:logging",
224
+ "apex:instrument:rflib:logging",
225
+ "apex:instrument:logging:rflib",
226
+ "rflib:logging:instrument:apex",
227
+ "logging:rflib:instrument:apex",
228
+ "logging:instrument:rflib:apex",
229
+ "logging:instrument:apex:rflib",
230
+ "rflib:instrument:logging:apex",
231
+ "instrument:rflib:logging:apex",
232
+ "instrument:logging:rflib:apex",
233
+ "instrument:logging:apex:rflib",
234
+ "rflib:instrument:apex:logging",
235
+ "instrument:rflib:apex:logging",
236
+ "instrument:apex:rflib:logging",
237
+ "instrument:apex:logging:rflib"
194
238
  ]
195
239
  },
196
- "rflib:debug:loggersettings:get": {
240
+ "rflib:logging:aura:instrument": {
197
241
  "aliases": [],
198
242
  "args": {},
199
- "description": "Retrieves all rflib_Logger_Settings__c hierarchy custom setting records from the target org via the Salesforce REST API.\nReturns settings across org-wide defaults, profile overrides, and user overrides, along with embedded best-practice recommendations.\n\nUse \"sf rflib debug loggersettings update\" to apply changes.\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to rflib_Logger_Settings__c).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
243
+ "description": "Analyzes Aura Component files and adds RFLIB logging statements for:\n- Method entry logging with parameter values in Controller, Helper, and Renderer files\n- Error logging in try-catch blocks\n- Error logging in Promise catch handlers\n- Adds rflibLoggerCmp component if not present\n- Replaces console.log and similar method invocations\n- Formats modified files using Prettier (optional)\n\nThe command processes:\n- Component (.cmp) files to add the logger component\n- Controller (.js) files for method instrumentation\n- Helper (.js) files for method instrumentation\n- Renderer (.js) files for method instrumentation",
200
244
  "examples": [
201
- "Read all logger settings from the target org:\n$ sf rflib debug loggersettings get --target-org myOrg"
245
+ "- Add logging to all aura files:\n$ sf rflib logging aura instrument --sourcepath force-app\n\n- Preview changes:\n$ sf rflib logging aura instrument --sourcepath force-app --dryrun\n\n- Add logging and format code:\n$ sf rflib logging aura instrument --sourcepath force-app --prettier\n\n- Process specific component:\n$ sf rflib logging aura instrument --sourcepath force-app/main/default/aura/myComponent"
202
246
  ],
203
247
  "flags": {
204
248
  "json": {
@@ -216,71 +260,129 @@
216
260
  "multiple": false,
217
261
  "type": "option"
218
262
  },
219
- "target-org": {
220
- "char": "o",
221
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
222
- "name": "target-org",
223
- "noCacheDefault": true,
263
+ "sourcepath": {
264
+ "char": "s",
265
+ "description": "Path to the source directory containing Aura components that should be instrumented with RFLIB logging statements. The command will:\n- Scan for 'aura' directories recursively\n- Process all Aura components found\n- Add <c:rflibLoggerCmp> to component files\n- Add logging statements to JavaScript files\n- Initialize logger in methods using component.find()",
266
+ "name": "sourcepath",
224
267
  "required": true,
225
- "summary": "Username or alias of the target org.",
226
- "hasDynamicHelp": true,
268
+ "summary": "Directory containing Aura components to instrument with logging.",
269
+ "hasDynamicHelp": false,
270
+ "multiple": false,
271
+ "type": "option"
272
+ },
273
+ "dryrun": {
274
+ "char": "d",
275
+ "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes. Shows:\n- Files that would be modified\n- Number of processed files\n- Number of modified files\n- Number of formatted files",
276
+ "name": "dryrun",
277
+ "summary": "Preview changes without modifying files.",
278
+ "allowNo": false,
279
+ "type": "boolean"
280
+ },
281
+ "prettier": {
282
+ "char": "p",
283
+ "description": "When enabled, formats the modified JavaScript files using Prettier after adding logging statements. Maintains consistent code style with:\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs\n- No trailing commas",
284
+ "name": "prettier",
285
+ "summary": "Format modified files using Prettier.",
286
+ "allowNo": false,
287
+ "type": "boolean"
288
+ },
289
+ "no-if": {
290
+ "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
291
+ "name": "no-if",
292
+ "summary": "Exclude the instrumentation of if-else statements.",
293
+ "allowNo": false,
294
+ "type": "boolean"
295
+ },
296
+ "skip-instrumented": {
297
+ "description": "When provided, the command will not add log statements to any Aura component that contains the `` component.",
298
+ "name": "skip-instrumented",
299
+ "summary": "Skips any files where a logger is already present.",
300
+ "allowNo": false,
301
+ "type": "boolean"
302
+ },
303
+ "verbose": {
304
+ "char": "v",
305
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
306
+ "name": "verbose",
307
+ "summary": "Enable verbose output.",
308
+ "allowNo": false,
309
+ "type": "boolean"
310
+ },
311
+ "exclude": {
312
+ "char": "e",
313
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cmp\" to skip auto-generated components.",
314
+ "name": "exclude",
315
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
316
+ "hasDynamicHelp": false,
317
+ "multiple": false,
318
+ "type": "option"
319
+ },
320
+ "concurrency": {
321
+ "char": "c",
322
+ "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
323
+ "name": "concurrency",
324
+ "summary": "Limits the number of files processed concurrently.",
325
+ "default": 10,
326
+ "hasDynamicHelp": false,
227
327
  "multiple": false,
228
328
  "type": "option"
229
329
  }
230
330
  },
231
- "hasDynamicHelp": true,
331
+ "hasDynamicHelp": false,
232
332
  "hiddenAliases": [],
233
- "id": "rflib:debug:loggersettings:get",
333
+ "id": "rflib:logging:aura:instrument",
234
334
  "pluginAlias": "rflib-plugin",
235
335
  "pluginName": "rflib-plugin",
236
336
  "pluginType": "core",
237
337
  "strict": true,
238
- "summary": "Read all RFLIB Logger Settings from a Salesforce org.",
338
+ "summary": "Instrument Aura Components with RFLIB logging statements automatically.",
239
339
  "enableJsonFlag": true,
240
340
  "isESM": true,
241
341
  "relativePath": [
242
342
  "lib",
243
343
  "commands",
244
344
  "rflib",
245
- "debug",
246
- "loggersettings",
247
- "get.js"
345
+ "logging",
346
+ "aura",
347
+ "instrument.js"
248
348
  ],
249
349
  "aliasPermutations": [],
250
350
  "permutations": [
251
- "rflib:debug:loggersettings:get",
252
- "debug:rflib:loggersettings:get",
253
- "debug:loggersettings:rflib:get",
254
- "debug:loggersettings:get:rflib",
255
- "rflib:loggersettings:debug:get",
256
- "loggersettings:rflib:debug:get",
257
- "loggersettings:debug:rflib:get",
258
- "loggersettings:debug:get:rflib",
259
- "rflib:loggersettings:get:debug",
260
- "loggersettings:rflib:get:debug",
261
- "loggersettings:get:rflib:debug",
262
- "loggersettings:get:debug:rflib",
263
- "rflib:debug:get:loggersettings",
264
- "debug:rflib:get:loggersettings",
265
- "debug:get:rflib:loggersettings",
266
- "debug:get:loggersettings:rflib",
267
- "rflib:get:debug:loggersettings",
268
- "get:rflib:debug:loggersettings",
269
- "get:debug:rflib:loggersettings",
270
- "get:debug:loggersettings:rflib",
271
- "rflib:get:loggersettings:debug",
272
- "get:rflib:loggersettings:debug",
273
- "get:loggersettings:rflib:debug",
274
- "get:loggersettings:debug:rflib"
351
+ "rflib:logging:aura:instrument",
352
+ "logging:rflib:aura:instrument",
353
+ "logging:aura:rflib:instrument",
354
+ "logging:aura:instrument:rflib",
355
+ "rflib:aura:logging:instrument",
356
+ "aura:rflib:logging:instrument",
357
+ "aura:logging:rflib:instrument",
358
+ "aura:logging:instrument:rflib",
359
+ "rflib:aura:instrument:logging",
360
+ "aura:rflib:instrument:logging",
361
+ "aura:instrument:rflib:logging",
362
+ "aura:instrument:logging:rflib",
363
+ "rflib:logging:instrument:aura",
364
+ "logging:rflib:instrument:aura",
365
+ "logging:instrument:rflib:aura",
366
+ "logging:instrument:aura:rflib",
367
+ "rflib:instrument:logging:aura",
368
+ "instrument:rflib:logging:aura",
369
+ "instrument:logging:rflib:aura",
370
+ "instrument:logging:aura:rflib",
371
+ "rflib:instrument:aura:logging",
372
+ "instrument:rflib:aura:logging",
373
+ "instrument:aura:rflib:logging",
374
+ "instrument:aura:logging:rflib"
275
375
  ]
276
376
  },
277
- "rflib:debug:loggersettings:update": {
377
+ "rflib:logging:flow:instrument": {
278
378
  "aliases": [],
279
379
  "args": {},
280
- "description": "Creates or updates a single field on an rflib_Logger_Settings__c record in the target org via the Salesforce REST API.\nValidates field values and warns about best-practice violations.\n\nTo update an existing record, provide --record-id. To create a new record, provide --setup-owner-id with an org ID (00D...), profile ID (00E...), or user ID.\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent update access to rflib_Logger_Settings__c).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
380
+ "description": "Automatically adds RFLIB logging statements to Salesforce Flows to provide enhanced tracking and debugging capabilities. Works with both standard Flows and Auto-Launched Flows. Instruments flow invocations and decision paths with logging actions, and logs an error on the fault path of every element that can fail. Existing fault paths continue after the error is logged. Elements without a fault path get one that logs the error and then terminates the transaction, so the Flow still fails as before; this requires the Terminate Transaction option of the RFLIB Log Message action, which was added in RFLIB 11.4.0. The command checks the RFLIB version in the target org, using the installed RFLIB package or, if RFLIB was deployed as source, its RFLIB_Version custom label, and skips the fault paths if the org runs an older version, RFLIB is not found, or the version cannot be determined. Also sets the CanvasMode to AUTO_LAYOUT_CANVAS for better flow visualization while preserving the original processType.",
281
381
  "examples": [
282
- "Update the Log_Event_Reporting_Level__c field on an existing record:\n$ sf rflib debug loggersettings update --target-org myOrg --record-id a0A000000001234 --field-name Log_Event_Reporting_Level__c --field-value WARN",
283
- "Create a new org-wide Logger Setting:\n$ sf rflib debug loggersettings update --target-org myOrg --setup-owner-id 00D000000000001 --field-name Log_Event_Reporting_Level__c --field-value WARN"
382
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app",
383
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --dryrun",
384
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-instrumented",
385
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-fault-paths"
284
386
  ],
285
387
  "flags": {
286
388
  "json": {
@@ -300,7 +402,7 @@
300
402
  },
301
403
  "target-org": {
302
404
  "char": "o",
303
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
405
+ "description": "The Salesforce org the instrumented Flows will be deployed to. The fault paths this command creates use the Terminate Transaction option of the RFLIB Log Message action, which was added in RFLIB 11.4.0, so Flows that use it fail to deploy to an org running an older RFLIB version. Before changing any files, the command runs a read-only Tooling API query for the packages installed in this org. If RFLIB is not installed as a package, for example because it was deployed as source, a second query reads the RFLIB_Version custom label instead. If the org runs RFLIB 11.4.0 or later, fault paths are instrumented; if it runs an older version, RFLIB is not found, or a query fails, they are skipped with a warning. Nothing in the org is changed. The flag is required even with --skip-fault-paths, although the org is not queried in that case.",
304
406
  "name": "target-org",
305
407
  "noCacheDefault": true,
306
408
  "required": true,
@@ -309,99 +411,257 @@
309
411
  "multiple": false,
310
412
  "type": "option"
311
413
  },
312
- "field-name": {
313
- "char": "f",
314
- "description": "The API name of the field to create or update, e.g. Log_Event_Reporting_Level__c. For log level fields, valid values are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, NONE.",
315
- "name": "field-name",
414
+ "sourcepath": {
415
+ "char": "s",
416
+ "description": "Path to the source directory containing Flow files that should be instrumented with RFLIB logging statements. Processes .flow-meta.xml files with processType=\"Flow\" or \"AutoLaunchedFlow\".",
417
+ "name": "sourcepath",
316
418
  "required": true,
317
- "summary": "API name of the rflib_Logger_Settings__c field to update.",
419
+ "summary": "Directory containing Flow files to instrument with logging.",
318
420
  "hasDynamicHelp": false,
319
421
  "multiple": false,
320
422
  "type": "option"
321
423
  },
322
- "field-value": {
424
+ "dryrun": {
425
+ "char": "d",
426
+ "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
427
+ "name": "dryrun",
428
+ "summary": "Preview changes without modifying files.",
429
+ "allowNo": false,
430
+ "type": "boolean"
431
+ },
432
+ "skip-instrumented": {
433
+ "description": "When provided, the command will not add log statements to any Flows that already contain RFLIB logging actions.",
434
+ "name": "skip-instrumented",
435
+ "summary": "Skips any files where a logger is already present.",
436
+ "allowNo": false,
437
+ "type": "boolean"
438
+ },
439
+ "skip-fault-paths": {
440
+ "description": "When provided, the command will not add error logging to fault paths and will not create fault paths for elements that have none, regardless of the RFLIB version installed in the target org.",
441
+ "name": "skip-fault-paths",
442
+ "summary": "Skips logging errors on fault paths.",
443
+ "allowNo": false,
444
+ "type": "boolean"
445
+ },
446
+ "verbose": {
323
447
  "char": "v",
324
- "description": "The new value to set on the specified field. For log level fields, valid values are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, NONE.",
325
- "name": "field-value",
326
- "required": true,
327
- "summary": "New value for the specified field.",
448
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
449
+ "name": "verbose",
450
+ "summary": "Enable verbose output.",
451
+ "allowNo": false,
452
+ "type": "boolean"
453
+ },
454
+ "exclude": {
455
+ "char": "e",
456
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Test_*.flow-meta.xml\" to skip certain flows.",
457
+ "name": "exclude",
458
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
328
459
  "hasDynamicHelp": false,
329
460
  "multiple": false,
330
461
  "type": "option"
331
462
  },
332
- "record-id": {
333
- "char": "r",
334
- "description": "The Salesforce record ID of an existing rflib_Logger_Settings__c record to update. Omit this flag to create a new record (requires --setup-owner-id).",
335
- "name": "record-id",
336
- "summary": "ID of an existing rflib_Logger_Settings__c record to update.",
463
+ "concurrency": {
464
+ "char": "c",
465
+ "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
466
+ "name": "concurrency",
467
+ "summary": "Limits the number of files processed concurrently.",
468
+ "default": 10,
469
+ "hasDynamicHelp": false,
470
+ "multiple": false,
471
+ "type": "option"
472
+ }
473
+ },
474
+ "hasDynamicHelp": true,
475
+ "hiddenAliases": [],
476
+ "id": "rflib:logging:flow:instrument",
477
+ "pluginAlias": "rflib-plugin",
478
+ "pluginName": "rflib-plugin",
479
+ "pluginType": "core",
480
+ "strict": true,
481
+ "summary": "Adds RFLIB logging statements to Salesforce Flows.",
482
+ "enableJsonFlag": true,
483
+ "isESM": true,
484
+ "relativePath": [
485
+ "lib",
486
+ "commands",
487
+ "rflib",
488
+ "logging",
489
+ "flow",
490
+ "instrument.js"
491
+ ],
492
+ "aliasPermutations": [],
493
+ "permutations": [
494
+ "rflib:logging:flow:instrument",
495
+ "logging:rflib:flow:instrument",
496
+ "logging:flow:rflib:instrument",
497
+ "logging:flow:instrument:rflib",
498
+ "rflib:flow:logging:instrument",
499
+ "flow:rflib:logging:instrument",
500
+ "flow:logging:rflib:instrument",
501
+ "flow:logging:instrument:rflib",
502
+ "rflib:flow:instrument:logging",
503
+ "flow:rflib:instrument:logging",
504
+ "flow:instrument:rflib:logging",
505
+ "flow:instrument:logging:rflib",
506
+ "rflib:logging:instrument:flow",
507
+ "logging:rflib:instrument:flow",
508
+ "logging:instrument:rflib:flow",
509
+ "logging:instrument:flow:rflib",
510
+ "rflib:instrument:logging:flow",
511
+ "instrument:rflib:logging:flow",
512
+ "instrument:logging:rflib:flow",
513
+ "instrument:logging:flow:rflib",
514
+ "rflib:instrument:flow:logging",
515
+ "instrument:rflib:flow:logging",
516
+ "instrument:flow:rflib:logging",
517
+ "instrument:flow:logging:rflib"
518
+ ]
519
+ },
520
+ "rflib:logging:lwc:instrument": {
521
+ "aliases": [],
522
+ "args": {},
523
+ "description": "Analyzes Lightning Web Component JavaScript files and adds RFLIB logging statements for:\n- Method entry logging with parameter values\n- Error logging in try-catch blocks\n- Error logging in Promise catch handlers\n- Condition logging in if/else blocks\n- Adds logger import if not present\n- Adds logger initialization if not present\n- Replaces console.log and similar method invocations\n- Formats modified files using Prettier (optional)",
524
+ "examples": [
525
+ "- Add logging to all LWC files:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc\n\n- Preview changes:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --dryrun\n\n- Add logging and format code:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --prettier\n\n- Process specific component:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc/myComponent"
526
+ ],
527
+ "flags": {
528
+ "json": {
529
+ "description": "Format output as json.",
530
+ "helpGroup": "GLOBAL",
531
+ "name": "json",
532
+ "allowNo": false,
533
+ "type": "boolean"
534
+ },
535
+ "flags-dir": {
536
+ "helpGroup": "GLOBAL",
537
+ "name": "flags-dir",
538
+ "summary": "Import flag values from a directory.",
337
539
  "hasDynamicHelp": false,
338
540
  "multiple": false,
339
541
  "type": "option"
340
542
  },
341
- "setup-owner-id": {
543
+ "sourcepath": {
342
544
  "char": "s",
343
- "description": "Required when creating a new Logger Setting record. Accepts an org ID (00D...), profile ID (00E...), or user ID. Read existing record IDs using \"sf rflib debug loggersettings get\".",
344
- "name": "setup-owner-id",
345
- "summary": "Setup owner ID for creating a new Logger Setting record.",
545
+ "description": "Path to the source directory containing Lightning Web Component JavaScript files that should be instrumented with RFLIB logging statements. Aura component files are automatically excluded. The command will:\n- Process all .js files in the directory and subdirectories\n- Skip files in 'aura' directories\n- Add import statement: import { createLogger } from 'c/rflibLogger'\n- Add logger initialization: const logger = createLogger('ComponentName')",
546
+ "name": "sourcepath",
547
+ "required": true,
548
+ "summary": "Directory containing LWC JavaScript files to instrument with logging.",
549
+ "hasDynamicHelp": false,
550
+ "multiple": false,
551
+ "type": "option"
552
+ },
553
+ "dryrun": {
554
+ "char": "d",
555
+ "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes. Shows:\n- Files that would be modified\n- Number of processed files\n- Number of modified files\n- Number of formatted files",
556
+ "name": "dryrun",
557
+ "summary": "Preview changes without modifying files.",
558
+ "allowNo": false,
559
+ "type": "boolean"
560
+ },
561
+ "prettier": {
562
+ "char": "p",
563
+ "description": "When enabled, formats the modified JavaScript files using Prettier after adding logging statements. Maintains consistent code style with:\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs",
564
+ "name": "prettier",
565
+ "summary": "Format modified files using Prettier.",
566
+ "allowNo": false,
567
+ "type": "boolean"
568
+ },
569
+ "no-if": {
570
+ "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
571
+ "name": "no-if",
572
+ "summary": "Exclude the instrumentation of if-else statements.",
573
+ "allowNo": false,
574
+ "type": "boolean"
575
+ },
576
+ "skip-instrumented": {
577
+ "description": "When provided, the command will not add log statements to any Apex class that contains the `rflib` import statement.",
578
+ "name": "skip-instrumented",
579
+ "summary": "Skips any files where a logger is already present.",
580
+ "allowNo": false,
581
+ "type": "boolean"
582
+ },
583
+ "verbose": {
584
+ "char": "v",
585
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
586
+ "name": "verbose",
587
+ "summary": "Enable verbose output.",
588
+ "allowNo": false,
589
+ "type": "boolean"
590
+ },
591
+ "exclude": {
592
+ "char": "e",
593
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.js\" to skip auto-generated components.",
594
+ "name": "exclude",
595
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
596
+ "hasDynamicHelp": false,
597
+ "multiple": false,
598
+ "type": "option"
599
+ },
600
+ "concurrency": {
601
+ "char": "c",
602
+ "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
603
+ "name": "concurrency",
604
+ "summary": "Limits the number of files processed concurrently.",
605
+ "default": 10,
346
606
  "hasDynamicHelp": false,
347
607
  "multiple": false,
348
608
  "type": "option"
349
609
  }
350
610
  },
351
- "hasDynamicHelp": true,
611
+ "hasDynamicHelp": false,
352
612
  "hiddenAliases": [],
353
- "id": "rflib:debug:loggersettings:update",
613
+ "id": "rflib:logging:lwc:instrument",
354
614
  "pluginAlias": "rflib-plugin",
355
615
  "pluginName": "rflib-plugin",
356
616
  "pluginType": "core",
357
617
  "strict": true,
358
- "summary": "Create or update an RFLIB Logger Setting in a Salesforce org.",
618
+ "summary": "Instrument Lightning Web Components with RFLIB logging statements automatically.",
359
619
  "enableJsonFlag": true,
360
620
  "isESM": true,
361
621
  "relativePath": [
362
622
  "lib",
363
623
  "commands",
364
624
  "rflib",
365
- "debug",
366
- "loggersettings",
367
- "update.js"
625
+ "logging",
626
+ "lwc",
627
+ "instrument.js"
368
628
  ],
369
629
  "aliasPermutations": [],
370
630
  "permutations": [
371
- "rflib:debug:loggersettings:update",
372
- "debug:rflib:loggersettings:update",
373
- "debug:loggersettings:rflib:update",
374
- "debug:loggersettings:update:rflib",
375
- "rflib:loggersettings:debug:update",
376
- "loggersettings:rflib:debug:update",
377
- "loggersettings:debug:rflib:update",
378
- "loggersettings:debug:update:rflib",
379
- "rflib:loggersettings:update:debug",
380
- "loggersettings:rflib:update:debug",
381
- "loggersettings:update:rflib:debug",
382
- "loggersettings:update:debug:rflib",
383
- "rflib:debug:update:loggersettings",
384
- "debug:rflib:update:loggersettings",
385
- "debug:update:rflib:loggersettings",
386
- "debug:update:loggersettings:rflib",
387
- "rflib:update:debug:loggersettings",
388
- "update:rflib:debug:loggersettings",
389
- "update:debug:rflib:loggersettings",
390
- "update:debug:loggersettings:rflib",
391
- "rflib:update:loggersettings:debug",
392
- "update:rflib:loggersettings:debug",
393
- "update:loggersettings:rflib:debug",
394
- "update:loggersettings:debug:rflib"
631
+ "rflib:logging:lwc:instrument",
632
+ "logging:rflib:lwc:instrument",
633
+ "logging:lwc:rflib:instrument",
634
+ "logging:lwc:instrument:rflib",
635
+ "rflib:lwc:logging:instrument",
636
+ "lwc:rflib:logging:instrument",
637
+ "lwc:logging:rflib:instrument",
638
+ "lwc:logging:instrument:rflib",
639
+ "rflib:lwc:instrument:logging",
640
+ "lwc:rflib:instrument:logging",
641
+ "lwc:instrument:rflib:logging",
642
+ "lwc:instrument:logging:rflib",
643
+ "rflib:logging:instrument:lwc",
644
+ "logging:rflib:instrument:lwc",
645
+ "logging:instrument:rflib:lwc",
646
+ "logging:instrument:lwc:rflib",
647
+ "rflib:instrument:logging:lwc",
648
+ "instrument:rflib:logging:lwc",
649
+ "instrument:logging:rflib:lwc",
650
+ "instrument:logging:lwc:rflib",
651
+ "rflib:instrument:lwc:logging",
652
+ "instrument:rflib:lwc:logging",
653
+ "instrument:lwc:rflib:logging",
654
+ "instrument:lwc:logging:rflib"
395
655
  ]
396
656
  },
397
- "rflib:debug:userpermissions:get": {
657
+ "rflib:debug:applicationevents:get": {
398
658
  "aliases": [],
399
659
  "args": {},
400
- "description": "Retrieves FLS (Field-Level Security), OLS (Object-Level Security), and Apex class/page permissions for a specific user\nvia the Salesforce REST API. Permissions are aggregated across the user's profile, permission sets, and permission set groups.\n\nUse --sobject-type to narrow FLS or OLS results to a specific SObject.\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to the relevant permission objects).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
660
+ "description": "Retrieves rflib_Application_Event__c records from the target org via the Salesforce REST API.\nApplication Events are business-level events used to track feature adoption, user actions, and domain-specific milestones.\nResults are ordered by Occurred_On__c descending (most recent first).\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to rflib_Application_Event__c).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
401
661
  "examples": [
402
- "Check all permissions for a user:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type ALL",
403
- "Check FLS for a specific object:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type FLS --sobject-type Account",
404
- "Check Apex access:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type APEX"
662
+ "Get all application events from the default org:\n$ sf rflib debug applicationevents get --target-org myOrg",
663
+ "Get events filtered by name and date range:\n$ sf rflib debug applicationevents get --target-org myOrg --event-name \"order-%\" --start-date 2024-01-01T00:00:00Z",
664
+ "Get events related to a specific record with a custom limit:\n$ sf rflib debug applicationevents get --target-org myOrg --related-record-id 0017000000XXXXXX --record-limit 50"
405
665
  ],
406
666
  "flags": {
407
667
  "json": {
@@ -430,37 +690,47 @@
430
690
  "multiple": false,
431
691
  "type": "option"
432
692
  },
433
- "user-id": {
434
- "char": "u",
435
- "description": "The Salesforce User ID (15 or 18 characters) of the user whose permissions should be retrieved.",
436
- "name": "user-id",
437
- "required": true,
438
- "summary": "Salesforce User ID (15 or 18 character) to check permissions for.",
693
+ "event-name": {
694
+ "char": "e",
695
+ "description": "Filter Application Events by their Event_Name__c field. Use the % character as a wildcard for partial matches, for example \"order-%\".",
696
+ "name": "event-name",
697
+ "summary": "Filter by event name. Use % as a wildcard.",
439
698
  "hasDynamicHelp": false,
440
699
  "multiple": false,
441
700
  "type": "option"
442
701
  },
443
- "permission-type": {
444
- "char": "t",
445
- "description": "Controls which permission types are returned:\n - FLS: Field-Level Security only\n - OLS: Object-Level Security only\n - APEX: Apex class and page access only\n - ALL: All three permission types",
446
- "name": "permission-type",
447
- "required": true,
448
- "summary": "Type of permissions to retrieve: FLS, OLS, APEX, or ALL.",
702
+ "start-date": {
703
+ "char": "s",
704
+ "description": "Only return events where Occurred_On__c is on or after this date. Must be in ISO 8601 format, e.g. 2024-01-01T00:00:00Z.",
705
+ "name": "start-date",
706
+ "summary": "Filter events on or after this ISO 8601 date.",
449
707
  "hasDynamicHelp": false,
450
708
  "multiple": false,
451
- "options": [
452
- "FLS",
453
- "OLS",
454
- "APEX",
455
- "ALL"
456
- ],
457
709
  "type": "option"
458
710
  },
459
- "sobject-type": {
460
- "char": "b",
461
- "description": "Filters Field-Level Security or Object-Level Security results to a specific SObject type, e.g. Account, Contact, Opportunity.",
462
- "name": "sobject-type",
463
- "summary": "Optional SObject API name to filter FLS or OLS results.",
711
+ "end-date": {
712
+ "char": "d",
713
+ "description": "Only return events where Occurred_On__c is on or before this date. Must be in ISO 8601 format, e.g. 2024-12-31T23:59:59Z.",
714
+ "name": "end-date",
715
+ "summary": "Filter events on or before this ISO 8601 date.",
716
+ "hasDynamicHelp": false,
717
+ "multiple": false,
718
+ "type": "option"
719
+ },
720
+ "related-record-id": {
721
+ "char": "r",
722
+ "description": "Only return events associated with this specific record ID.",
723
+ "name": "related-record-id",
724
+ "summary": "Filter by Related_Record_ID__c (exact match).",
725
+ "hasDynamicHelp": false,
726
+ "multiple": false,
727
+ "type": "option"
728
+ },
729
+ "record-limit": {
730
+ "char": "l",
731
+ "description": "Controls how many Application Event records are returned. Defaults to 200. Maximum allowed value is 2000.",
732
+ "name": "record-limit",
733
+ "summary": "Maximum number of records to return (default 200, max 2000).",
464
734
  "hasDynamicHelp": false,
465
735
  "multiple": false,
466
736
  "type": "option"
@@ -468,12 +738,12 @@
468
738
  },
469
739
  "hasDynamicHelp": true,
470
740
  "hiddenAliases": [],
471
- "id": "rflib:debug:userpermissions:get",
741
+ "id": "rflib:debug:applicationevents:get",
472
742
  "pluginAlias": "rflib-plugin",
473
743
  "pluginName": "rflib-plugin",
474
744
  "pluginType": "core",
475
745
  "strict": true,
476
- "summary": "Check Salesforce permissions for a user in the target org.",
746
+ "summary": "Query RFLIB Application Events from a Salesforce org.",
477
747
  "enableJsonFlag": true,
478
748
  "isESM": true,
479
749
  "relativePath": [
@@ -481,43 +751,44 @@
481
751
  "commands",
482
752
  "rflib",
483
753
  "debug",
484
- "userpermissions",
754
+ "applicationevents",
485
755
  "get.js"
486
756
  ],
487
757
  "aliasPermutations": [],
488
758
  "permutations": [
489
- "rflib:debug:userpermissions:get",
490
- "debug:rflib:userpermissions:get",
491
- "debug:userpermissions:rflib:get",
492
- "debug:userpermissions:get:rflib",
493
- "rflib:userpermissions:debug:get",
494
- "userpermissions:rflib:debug:get",
495
- "userpermissions:debug:rflib:get",
496
- "userpermissions:debug:get:rflib",
497
- "rflib:userpermissions:get:debug",
498
- "userpermissions:rflib:get:debug",
499
- "userpermissions:get:rflib:debug",
500
- "userpermissions:get:debug:rflib",
501
- "rflib:debug:get:userpermissions",
502
- "debug:rflib:get:userpermissions",
503
- "debug:get:rflib:userpermissions",
504
- "debug:get:userpermissions:rflib",
505
- "rflib:get:debug:userpermissions",
506
- "get:rflib:debug:userpermissions",
507
- "get:debug:rflib:userpermissions",
508
- "get:debug:userpermissions:rflib",
509
- "rflib:get:userpermissions:debug",
510
- "get:rflib:userpermissions:debug",
511
- "get:userpermissions:rflib:debug",
512
- "get:userpermissions:debug:rflib"
759
+ "rflib:debug:applicationevents:get",
760
+ "debug:rflib:applicationevents:get",
761
+ "debug:applicationevents:rflib:get",
762
+ "debug:applicationevents:get:rflib",
763
+ "rflib:applicationevents:debug:get",
764
+ "applicationevents:rflib:debug:get",
765
+ "applicationevents:debug:rflib:get",
766
+ "applicationevents:debug:get:rflib",
767
+ "rflib:applicationevents:get:debug",
768
+ "applicationevents:rflib:get:debug",
769
+ "applicationevents:get:rflib:debug",
770
+ "applicationevents:get:debug:rflib",
771
+ "rflib:debug:get:applicationevents",
772
+ "debug:rflib:get:applicationevents",
773
+ "debug:get:rflib:applicationevents",
774
+ "debug:get:applicationevents:rflib",
775
+ "rflib:get:debug:applicationevents",
776
+ "get:rflib:debug:applicationevents",
777
+ "get:debug:rflib:applicationevents",
778
+ "get:debug:applicationevents:rflib",
779
+ "rflib:get:applicationevents:debug",
780
+ "get:rflib:applicationevents:debug",
781
+ "get:applicationevents:rflib:debug",
782
+ "get:applicationevents:debug:rflib"
513
783
  ]
514
784
  },
515
- "rflib:logging:apex:instrument": {
785
+ "rflib:debug:logarchives:get": {
516
786
  "aliases": [],
517
787
  "args": {},
518
- "description": "Analyzes Apex classes and adds RFLIB logging statements for method entry and error handling. Adds class-level logger initialization if not already present. \nFor Apex Test classes, the `@TestSetup` method will be updated to include `rflib_TestUtil.prepareLoggerForUnitTests();` to avoid test failures caused by the logging framework.",
788
+ "description": "Retrieves rflib_Logs_Archive__b records from the target org's big object store via the Salesforce REST API.\nEach log record contains log level, context, request ID, and full log messages in the format: [timestamp]|[LEVEL]|[TRACE_ID]|[CONTEXT]|[MESSAGE].\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to rflib_Logs_Archive__b).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
519
789
  "examples": [
520
- "- Add logging statements to all Apex classes in a directory:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes\n\n- Preview changes without modifying files:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --dryrun\n\n- Add logging statements and format code:\n\n$ sf rflib logging apex instrument --sourcepath force-app/main/default/classes --prettier"
790
+ "Get log archives from the last 24 hours:\n$ sf rflib debug logarchives get --target-org myOrg",
791
+ "Get log archives for a specific date range:\n$ sf rflib debug logarchives get --target-org myOrg --start-date 2024-01-01T00:00:00Z --end-date 2024-01-02T00:00:00Z"
521
792
  ],
522
793
  "flags": {
523
794
  "json": {
@@ -535,133 +806,88 @@
535
806
  "multiple": false,
536
807
  "type": "option"
537
808
  },
538
- "sourcepath": {
539
- "char": "s",
540
- "description": "Path to the source directory containing Apex classes that should be instrumented with RFLIB logging statements. Test classes (ending with 'Test.cls') are automatically excluded.",
541
- "name": "sourcepath",
809
+ "target-org": {
810
+ "char": "o",
811
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
812
+ "name": "target-org",
813
+ "noCacheDefault": true,
542
814
  "required": true,
543
- "summary": "Directory containing Apex classes to instrument with logging.",
544
- "hasDynamicHelp": false,
815
+ "summary": "Username or alias of the target org.",
816
+ "hasDynamicHelp": true,
545
817
  "multiple": false,
546
818
  "type": "option"
547
819
  },
548
- "dryrun": {
549
- "char": "d",
550
- "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
551
- "name": "dryrun",
552
- "summary": "Preview changes without modifying files.",
553
- "allowNo": false,
554
- "type": "boolean"
555
- },
556
- "prettier": {
557
- "char": "p",
558
- "description": "When enabled, formats the modified Apex files using prettier-plugin-apex after adding logging statements. Maintains consistent code style with:\n\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs",
559
- "name": "prettier",
560
- "summary": "Format modified files using Prettier.",
561
- "allowNo": false,
562
- "type": "boolean"
563
- },
564
- "no-if": {
565
- "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
566
- "name": "no-if",
567
- "summary": "Exclude the instrumentation of if-else statements.",
568
- "allowNo": false,
569
- "type": "boolean"
570
- },
571
- "no-catch": {
572
- "description": "When provided, the command will not add error log statements inside of `catch` blocks.",
573
- "name": "no-catch",
574
- "summary": "Exclude the instrumentation of catch blocks.",
575
- "allowNo": false,
576
- "type": "boolean"
577
- },
578
- "skip-instrumented": {
579
- "description": "When provided, the command will not add log statements to any Apex class that contains the `rflib_Logger` reference.",
580
- "name": "skip-instrumented",
581
- "summary": "Skips any files where a logger is already present.",
582
- "allowNo": false,
583
- "type": "boolean"
584
- },
585
- "verbose": {
586
- "char": "v",
587
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
588
- "name": "verbose",
589
- "summary": "Enable verbose output.",
590
- "allowNo": false,
591
- "type": "boolean"
592
- },
593
- "exclude": {
594
- "char": "e",
595
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cls\" to skip auto-generated classes.",
596
- "name": "exclude",
597
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
820
+ "start-date": {
821
+ "char": "s",
822
+ "description": "Only return log archives created on or after this date. Must be in ISO 8601 format, e.g. 2024-01-01T00:00:00Z. Defaults to 24 hours ago if omitted.",
823
+ "name": "start-date",
824
+ "summary": "Start of the date range in ISO 8601 format. Defaults to 24 hours ago.",
598
825
  "hasDynamicHelp": false,
599
826
  "multiple": false,
600
827
  "type": "option"
601
828
  },
602
- "concurrency": {
603
- "char": "c",
604
- "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
605
- "name": "concurrency",
606
- "summary": "Limits the number of files processed concurrently.",
607
- "default": 10,
829
+ "end-date": {
830
+ "char": "d",
831
+ "description": "Only return log archives created on or before this date. Must be in ISO 8601 format, e.g. 2024-12-31T23:59:59Z. Defaults to the current time if omitted.",
832
+ "name": "end-date",
833
+ "summary": "End of the date range in ISO 8601 format. Defaults to now.",
608
834
  "hasDynamicHelp": false,
609
835
  "multiple": false,
610
836
  "type": "option"
611
837
  }
612
838
  },
613
- "hasDynamicHelp": false,
839
+ "hasDynamicHelp": true,
614
840
  "hiddenAliases": [],
615
- "id": "rflib:logging:apex:instrument",
841
+ "id": "rflib:debug:logarchives:get",
616
842
  "pluginAlias": "rflib-plugin",
617
843
  "pluginName": "rflib-plugin",
618
844
  "pluginType": "core",
619
845
  "strict": true,
620
- "summary": "Instrument Apex classes with RFLIB logging statements automatically.",
846
+ "summary": "Query RFLIB log archives from a Salesforce org.",
621
847
  "enableJsonFlag": true,
622
848
  "isESM": true,
623
849
  "relativePath": [
624
850
  "lib",
625
851
  "commands",
626
852
  "rflib",
627
- "logging",
628
- "apex",
629
- "instrument.js"
853
+ "debug",
854
+ "logarchives",
855
+ "get.js"
630
856
  ],
631
857
  "aliasPermutations": [],
632
858
  "permutations": [
633
- "rflib:logging:apex:instrument",
634
- "logging:rflib:apex:instrument",
635
- "logging:apex:rflib:instrument",
636
- "logging:apex:instrument:rflib",
637
- "rflib:apex:logging:instrument",
638
- "apex:rflib:logging:instrument",
639
- "apex:logging:rflib:instrument",
640
- "apex:logging:instrument:rflib",
641
- "rflib:apex:instrument:logging",
642
- "apex:rflib:instrument:logging",
643
- "apex:instrument:rflib:logging",
644
- "apex:instrument:logging:rflib",
645
- "rflib:logging:instrument:apex",
646
- "logging:rflib:instrument:apex",
647
- "logging:instrument:rflib:apex",
648
- "logging:instrument:apex:rflib",
649
- "rflib:instrument:logging:apex",
650
- "instrument:rflib:logging:apex",
651
- "instrument:logging:rflib:apex",
652
- "instrument:logging:apex:rflib",
653
- "rflib:instrument:apex:logging",
654
- "instrument:rflib:apex:logging",
655
- "instrument:apex:rflib:logging",
656
- "instrument:apex:logging:rflib"
859
+ "rflib:debug:logarchives:get",
860
+ "debug:rflib:logarchives:get",
861
+ "debug:logarchives:rflib:get",
862
+ "debug:logarchives:get:rflib",
863
+ "rflib:logarchives:debug:get",
864
+ "logarchives:rflib:debug:get",
865
+ "logarchives:debug:rflib:get",
866
+ "logarchives:debug:get:rflib",
867
+ "rflib:logarchives:get:debug",
868
+ "logarchives:rflib:get:debug",
869
+ "logarchives:get:rflib:debug",
870
+ "logarchives:get:debug:rflib",
871
+ "rflib:debug:get:logarchives",
872
+ "debug:rflib:get:logarchives",
873
+ "debug:get:rflib:logarchives",
874
+ "debug:get:logarchives:rflib",
875
+ "rflib:get:debug:logarchives",
876
+ "get:rflib:debug:logarchives",
877
+ "get:debug:rflib:logarchives",
878
+ "get:debug:logarchives:rflib",
879
+ "rflib:get:logarchives:debug",
880
+ "get:rflib:logarchives:debug",
881
+ "get:logarchives:rflib:debug",
882
+ "get:logarchives:debug:rflib"
657
883
  ]
658
884
  },
659
- "rflib:logging:aura:instrument": {
885
+ "rflib:debug:loggersettings:get": {
660
886
  "aliases": [],
661
887
  "args": {},
662
- "description": "Analyzes Aura Component files and adds RFLIB logging statements for:\n- Method entry logging with parameter values in Controller, Helper, and Renderer files\n- Error logging in try-catch blocks\n- Error logging in Promise catch handlers\n- Adds rflibLoggerCmp component if not present\n- Replaces console.log and similar method invocations\n- Formats modified files using Prettier (optional)\n\nThe command processes:\n- Component (.cmp) files to add the logger component\n- Controller (.js) files for method instrumentation\n- Helper (.js) files for method instrumentation\n- Renderer (.js) files for method instrumentation",
888
+ "description": "Retrieves all rflib_Logger_Settings__c hierarchy custom setting records from the target org via the Salesforce REST API.\nReturns settings across org-wide defaults, profile overrides, and user overrides, along with embedded best-practice recommendations.\n\nUse \"sf rflib debug loggersettings update\" to apply changes.\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to rflib_Logger_Settings__c).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
663
889
  "examples": [
664
- "- Add logging to all aura files:\n$ sf rflib logging aura instrument --sourcepath force-app\n\n- Preview changes:\n$ sf rflib logging aura instrument --sourcepath force-app --dryrun\n\n- Add logging and format code:\n$ sf rflib logging aura instrument --sourcepath force-app --prettier\n\n- Process specific component:\n$ sf rflib logging aura instrument --sourcepath force-app/main/default/aura/myComponent"
890
+ "Read all logger settings from the target org:\n$ sf rflib debug loggersettings get --target-org myOrg"
665
891
  ],
666
892
  "flags": {
667
893
  "json": {
@@ -679,128 +905,71 @@
679
905
  "multiple": false,
680
906
  "type": "option"
681
907
  },
682
- "sourcepath": {
683
- "char": "s",
684
- "description": "Path to the source directory containing Aura components that should be instrumented with RFLIB logging statements. The command will:\n- Scan for 'aura' directories recursively\n- Process all Aura components found\n- Add <c:rflibLoggerCmp> to component files\n- Add logging statements to JavaScript files\n- Initialize logger in methods using component.find()",
685
- "name": "sourcepath",
908
+ "target-org": {
909
+ "char": "o",
910
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
911
+ "name": "target-org",
912
+ "noCacheDefault": true,
686
913
  "required": true,
687
- "summary": "Directory containing Aura components to instrument with logging.",
688
- "hasDynamicHelp": false,
689
- "multiple": false,
690
- "type": "option"
691
- },
692
- "dryrun": {
693
- "char": "d",
694
- "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes. Shows:\n- Files that would be modified\n- Number of processed files\n- Number of modified files\n- Number of formatted files",
695
- "name": "dryrun",
696
- "summary": "Preview changes without modifying files.",
697
- "allowNo": false,
698
- "type": "boolean"
699
- },
700
- "prettier": {
701
- "char": "p",
702
- "description": "When enabled, formats the modified JavaScript files using Prettier after adding logging statements. Maintains consistent code style with:\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs\n- No trailing commas",
703
- "name": "prettier",
704
- "summary": "Format modified files using Prettier.",
705
- "allowNo": false,
706
- "type": "boolean"
707
- },
708
- "no-if": {
709
- "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
710
- "name": "no-if",
711
- "summary": "Exclude the instrumentation of if-else statements.",
712
- "allowNo": false,
713
- "type": "boolean"
714
- },
715
- "skip-instrumented": {
716
- "description": "When provided, the command will not add log statements to any Aura component that contains the `` component.",
717
- "name": "skip-instrumented",
718
- "summary": "Skips any files where a logger is already present.",
719
- "allowNo": false,
720
- "type": "boolean"
721
- },
722
- "verbose": {
723
- "char": "v",
724
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
725
- "name": "verbose",
726
- "summary": "Enable verbose output.",
727
- "allowNo": false,
728
- "type": "boolean"
729
- },
730
- "exclude": {
731
- "char": "e",
732
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cmp\" to skip auto-generated components.",
733
- "name": "exclude",
734
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
735
- "hasDynamicHelp": false,
736
- "multiple": false,
737
- "type": "option"
738
- },
739
- "concurrency": {
740
- "char": "c",
741
- "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
742
- "name": "concurrency",
743
- "summary": "Limits the number of files processed concurrently.",
744
- "default": 10,
745
- "hasDynamicHelp": false,
914
+ "summary": "Username or alias of the target org.",
915
+ "hasDynamicHelp": true,
746
916
  "multiple": false,
747
917
  "type": "option"
748
918
  }
749
919
  },
750
- "hasDynamicHelp": false,
920
+ "hasDynamicHelp": true,
751
921
  "hiddenAliases": [],
752
- "id": "rflib:logging:aura:instrument",
922
+ "id": "rflib:debug:loggersettings:get",
753
923
  "pluginAlias": "rflib-plugin",
754
924
  "pluginName": "rflib-plugin",
755
925
  "pluginType": "core",
756
926
  "strict": true,
757
- "summary": "Instrument Aura Components with RFLIB logging statements automatically.",
927
+ "summary": "Read all RFLIB Logger Settings from a Salesforce org.",
758
928
  "enableJsonFlag": true,
759
929
  "isESM": true,
760
930
  "relativePath": [
761
931
  "lib",
762
932
  "commands",
763
933
  "rflib",
764
- "logging",
765
- "aura",
766
- "instrument.js"
934
+ "debug",
935
+ "loggersettings",
936
+ "get.js"
767
937
  ],
768
938
  "aliasPermutations": [],
769
939
  "permutations": [
770
- "rflib:logging:aura:instrument",
771
- "logging:rflib:aura:instrument",
772
- "logging:aura:rflib:instrument",
773
- "logging:aura:instrument:rflib",
774
- "rflib:aura:logging:instrument",
775
- "aura:rflib:logging:instrument",
776
- "aura:logging:rflib:instrument",
777
- "aura:logging:instrument:rflib",
778
- "rflib:aura:instrument:logging",
779
- "aura:rflib:instrument:logging",
780
- "aura:instrument:rflib:logging",
781
- "aura:instrument:logging:rflib",
782
- "rflib:logging:instrument:aura",
783
- "logging:rflib:instrument:aura",
784
- "logging:instrument:rflib:aura",
785
- "logging:instrument:aura:rflib",
786
- "rflib:instrument:logging:aura",
787
- "instrument:rflib:logging:aura",
788
- "instrument:logging:rflib:aura",
789
- "instrument:logging:aura:rflib",
790
- "rflib:instrument:aura:logging",
791
- "instrument:rflib:aura:logging",
792
- "instrument:aura:rflib:logging",
793
- "instrument:aura:logging:rflib"
940
+ "rflib:debug:loggersettings:get",
941
+ "debug:rflib:loggersettings:get",
942
+ "debug:loggersettings:rflib:get",
943
+ "debug:loggersettings:get:rflib",
944
+ "rflib:loggersettings:debug:get",
945
+ "loggersettings:rflib:debug:get",
946
+ "loggersettings:debug:rflib:get",
947
+ "loggersettings:debug:get:rflib",
948
+ "rflib:loggersettings:get:debug",
949
+ "loggersettings:rflib:get:debug",
950
+ "loggersettings:get:rflib:debug",
951
+ "loggersettings:get:debug:rflib",
952
+ "rflib:debug:get:loggersettings",
953
+ "debug:rflib:get:loggersettings",
954
+ "debug:get:rflib:loggersettings",
955
+ "debug:get:loggersettings:rflib",
956
+ "rflib:get:debug:loggersettings",
957
+ "get:rflib:debug:loggersettings",
958
+ "get:debug:rflib:loggersettings",
959
+ "get:debug:loggersettings:rflib",
960
+ "rflib:get:loggersettings:debug",
961
+ "get:rflib:loggersettings:debug",
962
+ "get:loggersettings:rflib:debug",
963
+ "get:loggersettings:debug:rflib"
794
964
  ]
795
965
  },
796
- "rflib:debug:applicationevents:get": {
966
+ "rflib:debug:loggersettings:update": {
797
967
  "aliases": [],
798
968
  "args": {},
799
- "description": "Retrieves rflib_Application_Event__c records from the target org via the Salesforce REST API.\nApplication Events are business-level events used to track feature adoption, user actions, and domain-specific milestones.\nResults are ordered by Occurred_On__c descending (most recent first).\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to rflib_Application_Event__c).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
969
+ "description": "Creates or updates a single field on an rflib_Logger_Settings__c record in the target org via the Salesforce REST API.\nValidates field values and warns about best-practice violations.\n\nTo update an existing record, provide --record-id. To create a new record, provide --setup-owner-id with an org ID (00D...), profile ID (00E...), or user ID.\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent update access to rflib_Logger_Settings__c).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
800
970
  "examples": [
801
- "Get all application events from the default org:\n$ sf rflib debug applicationevents get --target-org myOrg",
802
- "Get events filtered by name and date range:\n$ sf rflib debug applicationevents get --target-org myOrg --event-name \"order-%\" --start-date 2024-01-01T00:00:00Z",
803
- "Get events related to a specific record with a custom limit:\n$ sf rflib debug applicationevents get --target-org myOrg --related-record-id 0017000000XXXXXX --record-limit 50"
971
+ "Update the Log_Event_Reporting_Level__c field on an existing record:\n$ sf rflib debug loggersettings update --target-org myOrg --record-id a0A000000001234 --field-name Log_Event_Reporting_Level__c --field-value WARN",
972
+ "Create a new org-wide Logger Setting:\n$ sf rflib debug loggersettings update --target-org myOrg --setup-owner-id 00D000000000001 --field-name Log_Event_Reporting_Level__c --field-value WARN"
804
973
  ],
805
974
  "flags": {
806
975
  "json": {
@@ -829,47 +998,40 @@
829
998
  "multiple": false,
830
999
  "type": "option"
831
1000
  },
832
- "event-name": {
833
- "char": "e",
834
- "description": "Filter Application Events by their Event_Name__c field. Use the % character as a wildcard for partial matches, for example \"order-%\".",
835
- "name": "event-name",
836
- "summary": "Filter by event name. Use % as a wildcard.",
837
- "hasDynamicHelp": false,
838
- "multiple": false,
839
- "type": "option"
840
- },
841
- "start-date": {
842
- "char": "s",
843
- "description": "Only return events where Occurred_On__c is on or after this date. Must be in ISO 8601 format, e.g. 2024-01-01T00:00:00Z.",
844
- "name": "start-date",
845
- "summary": "Filter events on or after this ISO 8601 date.",
1001
+ "field-name": {
1002
+ "char": "f",
1003
+ "description": "The API name of the field to create or update, e.g. Log_Event_Reporting_Level__c. For log level fields, valid values are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, NONE.",
1004
+ "name": "field-name",
1005
+ "required": true,
1006
+ "summary": "API name of the rflib_Logger_Settings__c field to update.",
846
1007
  "hasDynamicHelp": false,
847
1008
  "multiple": false,
848
1009
  "type": "option"
849
1010
  },
850
- "end-date": {
851
- "char": "d",
852
- "description": "Only return events where Occurred_On__c is on or before this date. Must be in ISO 8601 format, e.g. 2024-12-31T23:59:59Z.",
853
- "name": "end-date",
854
- "summary": "Filter events on or before this ISO 8601 date.",
1011
+ "field-value": {
1012
+ "char": "v",
1013
+ "description": "The new value to set on the specified field. For log level fields, valid values are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, NONE.",
1014
+ "name": "field-value",
1015
+ "required": true,
1016
+ "summary": "New value for the specified field.",
855
1017
  "hasDynamicHelp": false,
856
1018
  "multiple": false,
857
1019
  "type": "option"
858
1020
  },
859
- "related-record-id": {
1021
+ "record-id": {
860
1022
  "char": "r",
861
- "description": "Only return events associated with this specific record ID.",
862
- "name": "related-record-id",
863
- "summary": "Filter by Related_Record_ID__c (exact match).",
1023
+ "description": "The Salesforce record ID of an existing rflib_Logger_Settings__c record to update. Omit this flag to create a new record (requires --setup-owner-id).",
1024
+ "name": "record-id",
1025
+ "summary": "ID of an existing rflib_Logger_Settings__c record to update.",
864
1026
  "hasDynamicHelp": false,
865
1027
  "multiple": false,
866
1028
  "type": "option"
867
1029
  },
868
- "record-limit": {
869
- "char": "l",
870
- "description": "Controls how many Application Event records are returned. Defaults to 200. Maximum allowed value is 2000.",
871
- "name": "record-limit",
872
- "summary": "Maximum number of records to return (default 200, max 2000).",
1030
+ "setup-owner-id": {
1031
+ "char": "s",
1032
+ "description": "Required when creating a new Logger Setting record. Accepts an org ID (00D...), profile ID (00E...), or user ID. Read existing record IDs using \"sf rflib debug loggersettings get\".",
1033
+ "name": "setup-owner-id",
1034
+ "summary": "Setup owner ID for creating a new Logger Setting record.",
873
1035
  "hasDynamicHelp": false,
874
1036
  "multiple": false,
875
1037
  "type": "option"
@@ -877,12 +1039,12 @@
877
1039
  },
878
1040
  "hasDynamicHelp": true,
879
1041
  "hiddenAliases": [],
880
- "id": "rflib:debug:applicationevents:get",
1042
+ "id": "rflib:debug:loggersettings:update",
881
1043
  "pluginAlias": "rflib-plugin",
882
1044
  "pluginName": "rflib-plugin",
883
1045
  "pluginType": "core",
884
1046
  "strict": true,
885
- "summary": "Query RFLIB Application Events from a Salesforce org.",
1047
+ "summary": "Create or update an RFLIB Logger Setting in a Salesforce org.",
886
1048
  "enableJsonFlag": true,
887
1049
  "isESM": true,
888
1050
  "relativePath": [
@@ -890,46 +1052,47 @@
890
1052
  "commands",
891
1053
  "rflib",
892
1054
  "debug",
893
- "applicationevents",
894
- "get.js"
1055
+ "loggersettings",
1056
+ "update.js"
895
1057
  ],
896
1058
  "aliasPermutations": [],
897
1059
  "permutations": [
898
- "rflib:debug:applicationevents:get",
899
- "debug:rflib:applicationevents:get",
900
- "debug:applicationevents:rflib:get",
901
- "debug:applicationevents:get:rflib",
902
- "rflib:applicationevents:debug:get",
903
- "applicationevents:rflib:debug:get",
904
- "applicationevents:debug:rflib:get",
905
- "applicationevents:debug:get:rflib",
906
- "rflib:applicationevents:get:debug",
907
- "applicationevents:rflib:get:debug",
908
- "applicationevents:get:rflib:debug",
909
- "applicationevents:get:debug:rflib",
910
- "rflib:debug:get:applicationevents",
911
- "debug:rflib:get:applicationevents",
912
- "debug:get:rflib:applicationevents",
913
- "debug:get:applicationevents:rflib",
914
- "rflib:get:debug:applicationevents",
915
- "get:rflib:debug:applicationevents",
916
- "get:debug:rflib:applicationevents",
917
- "get:debug:applicationevents:rflib",
918
- "rflib:get:applicationevents:debug",
919
- "get:rflib:applicationevents:debug",
920
- "get:applicationevents:rflib:debug",
921
- "get:applicationevents:debug:rflib"
1060
+ "rflib:debug:loggersettings:update",
1061
+ "debug:rflib:loggersettings:update",
1062
+ "debug:loggersettings:rflib:update",
1063
+ "debug:loggersettings:update:rflib",
1064
+ "rflib:loggersettings:debug:update",
1065
+ "loggersettings:rflib:debug:update",
1066
+ "loggersettings:debug:rflib:update",
1067
+ "loggersettings:debug:update:rflib",
1068
+ "rflib:loggersettings:update:debug",
1069
+ "loggersettings:rflib:update:debug",
1070
+ "loggersettings:update:rflib:debug",
1071
+ "loggersettings:update:debug:rflib",
1072
+ "rflib:debug:update:loggersettings",
1073
+ "debug:rflib:update:loggersettings",
1074
+ "debug:update:rflib:loggersettings",
1075
+ "debug:update:loggersettings:rflib",
1076
+ "rflib:update:debug:loggersettings",
1077
+ "update:rflib:debug:loggersettings",
1078
+ "update:debug:rflib:loggersettings",
1079
+ "update:debug:loggersettings:rflib",
1080
+ "rflib:update:loggersettings:debug",
1081
+ "update:rflib:loggersettings:debug",
1082
+ "update:loggersettings:rflib:debug",
1083
+ "update:loggersettings:debug:rflib"
922
1084
  ]
923
1085
  },
924
- "rflib:logging:flow:instrument": {
1086
+ "rflib:debug:userpermissions:check": {
925
1087
  "aliases": [],
926
1088
  "args": {},
927
- "description": "Automatically adds RFLIB logging statements to Salesforce Flows to provide enhanced tracking and debugging capabilities. Works with both standard Flows and Auto-Launched Flows. Instruments flow invocations and decision paths with logging actions, and logs an error on the fault path of every element that can fail. Existing fault paths continue after the error is logged. Elements without a fault path get one that logs the error and then terminates the transaction, so the Flow still fails as before; this requires the Terminate Transaction option of the RFLIB Log Message action, which was added in RFLIB 11.4.0. The command checks the RFLIB version in the target org, using the installed RFLIB package or, if RFLIB was deployed as source, its RFLIB_Version custom label, and skips the fault paths if the org runs an older version, RFLIB is not found, or the version cannot be determined. Also sets the CanvasMode to AUTO_LAYOUT_CANVAS for better flow visualization while preserving the original processType.",
1089
+ "description": "Answers questions such as \"Can this user edit Account.AnnualRevenue?\" or \"Does this user have Modify All Data?\". The command checks the user's profile, permission sets, and permission set groups, and returns whether the permission is granted and which of them grant it.\n\nCheck exactly one of the following:\n - An object permission (--object, with --access read, create, edit, delete, viewall, modifyall, or viewallfields)\n - A field permission (--field, with --access read or edit)\n - Access to an Apex class (--apex-class) or a Visualforce page (--apex-page)\n - A custom permission (--custom-permission)\n - A system permission (--system-permission), e.g. ModifyAllData or ViewSetup\n\nField checks take the object permissions into account: a field is only accessible when the user also has Read (or Edit) on the object. View All Fields on the object grants Read on all of its fields. Apex class and Visualforce page checks include access granted by the Author Apex and Customize Application system permissions.\n\nSharing and record-level access aren't checked.\n\nThe command only reads standard setup objects, so the RFLIB package doesn't need to be installed. The running user needs the View Setup and Configuration permission.",
928
1090
  "examples": [
929
- "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app",
930
- "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --dryrun",
931
- "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-instrumented",
932
- "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-fault-paths"
1091
+ "Check whether a user can edit a field:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --field Account.AnnualRevenue --access edit",
1092
+ "Check whether a user can delete Opportunity records:\n$ sf rflib debug userpermissions check --target-org myOrg --user 0057000000XXXXXX --object Opportunity --access delete",
1093
+ "Check access to an Apex class:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --apex-class OrderController",
1094
+ "Check a custom permission:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --custom-permission Approve_Discounts",
1095
+ "Check a system permission:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --system-permission ModifyAllData"
933
1096
  ],
934
1097
  "flags": {
935
1098
  "json": {
@@ -949,7 +1112,7 @@
949
1112
  },
950
1113
  "target-org": {
951
1114
  "char": "o",
952
- "description": "The Salesforce org the instrumented Flows will be deployed to. The fault paths this command creates use the Terminate Transaction option of the RFLIB Log Message action, which was added in RFLIB 11.4.0, so Flows that use it fail to deploy to an org running an older RFLIB version. Before changing any files, the command runs a read-only Tooling API query for the packages installed in this org. If RFLIB is not installed as a package, for example because it was deployed as source, a second query reads the RFLIB_Version custom label instead. If the org runs RFLIB 11.4.0 or later, fault paths are instrumented; if it runs an older version, RFLIB is not found, or a query fails, they are skipped with a warning. Nothing in the org is changed. The flag is required even with --skip-fault-paths, although the org is not queried in that case.",
1115
+ "description": "The username or alias of the Salesforce org to check the permission in.",
953
1116
  "name": "target-org",
954
1117
  "noCacheDefault": true,
955
1118
  "required": true,
@@ -958,61 +1121,80 @@
958
1121
  "multiple": false,
959
1122
  "type": "option"
960
1123
  },
961
- "sourcepath": {
962
- "char": "s",
963
- "description": "Path to the source directory containing Flow files that should be instrumented with RFLIB logging statements. Processes .flow-meta.xml files with processType=\"Flow\" or \"AutoLaunchedFlow\".",
964
- "name": "sourcepath",
1124
+ "user": {
1125
+ "char": "u",
1126
+ "description": "The Salesforce User ID (15 or 18 characters) or the username of the user whose permission should be checked.",
1127
+ "name": "user",
965
1128
  "required": true,
966
- "summary": "Directory containing Flow files to instrument with logging.",
1129
+ "summary": "User ID (15 or 18 characters) or username of the user to check.",
967
1130
  "hasDynamicHelp": false,
968
1131
  "multiple": false,
969
1132
  "type": "option"
970
1133
  },
971
- "dryrun": {
972
- "char": "d",
973
- "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
974
- "name": "dryrun",
975
- "summary": "Preview changes without modifying files.",
976
- "allowNo": false,
977
- "type": "boolean"
1134
+ "object": {
1135
+ "char": "b",
1136
+ "description": "Checks an object permission. Use --access to choose which one; the default is read.",
1137
+ "name": "object",
1138
+ "summary": "API name of the object to check object permissions for, e.g. Account.",
1139
+ "hasDynamicHelp": false,
1140
+ "multiple": false,
1141
+ "type": "option"
978
1142
  },
979
- "skip-instrumented": {
980
- "description": "When provided, the command will not add log statements to any Flows that already contain RFLIB logging actions.",
981
- "name": "skip-instrumented",
982
- "summary": "Skips any files where a logger is already present.",
983
- "allowNo": false,
984
- "type": "boolean"
1143
+ "field": {
1144
+ "char": "f",
1145
+ "description": "Checks field-level security for a field. Use --access read (default) or --access edit.",
1146
+ "name": "field",
1147
+ "summary": "Field to check field-level security for, in the form Object.Field, e.g. Account.AnnualRevenue.",
1148
+ "hasDynamicHelp": false,
1149
+ "multiple": false,
1150
+ "type": "option"
985
1151
  },
986
- "skip-fault-paths": {
987
- "description": "When provided, the command will not add error logging to fault paths and will not create fault paths for elements that have none, regardless of the RFLIB version installed in the target org.",
988
- "name": "skip-fault-paths",
989
- "summary": "Skips logging errors on fault paths.",
990
- "allowNo": false,
991
- "type": "boolean"
1152
+ "access": {
1153
+ "char": "a",
1154
+ "description": "The access level to check:\n - read, edit: for objects and fields\n - create, delete, viewall (View All Records), modifyall (Modify All Records), viewallfields (View All Fields): for objects only",
1155
+ "name": "access",
1156
+ "summary": "Access level to check for --object or --field. Default: read.",
1157
+ "hasDynamicHelp": false,
1158
+ "multiple": false,
1159
+ "options": [
1160
+ "read",
1161
+ "create",
1162
+ "edit",
1163
+ "delete",
1164
+ "viewall",
1165
+ "modifyall",
1166
+ "viewallfields"
1167
+ ],
1168
+ "type": "option"
992
1169
  },
993
- "verbose": {
994
- "char": "v",
995
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
996
- "name": "verbose",
997
- "summary": "Enable verbose output.",
998
- "allowNo": false,
999
- "type": "boolean"
1170
+ "apex-class": {
1171
+ "description": "Checks whether the user can access an Apex class. Use namespace__Name or namespace.Name for a class in a managed package.",
1172
+ "name": "apex-class",
1173
+ "summary": "Name of the Apex class to check access for.",
1174
+ "hasDynamicHelp": false,
1175
+ "multiple": false,
1176
+ "type": "option"
1000
1177
  },
1001
- "exclude": {
1002
- "char": "e",
1003
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Test_*.flow-meta.xml\" to skip certain flows.",
1004
- "name": "exclude",
1005
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
1178
+ "apex-page": {
1179
+ "description": "Checks whether the user can access a Visualforce page. Use namespace__Name for a page in a managed package.",
1180
+ "name": "apex-page",
1181
+ "summary": "Name of the Visualforce page to check access for.",
1006
1182
  "hasDynamicHelp": false,
1007
1183
  "multiple": false,
1008
1184
  "type": "option"
1009
1185
  },
1010
- "concurrency": {
1011
- "char": "c",
1012
- "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
1013
- "name": "concurrency",
1014
- "summary": "Limits the number of files processed concurrently.",
1015
- "default": 10,
1186
+ "custom-permission": {
1187
+ "description": "Checks whether the user has a custom permission. Use namespace__Name for a custom permission in a managed package.",
1188
+ "name": "custom-permission",
1189
+ "summary": "API name of the custom permission to check.",
1190
+ "hasDynamicHelp": false,
1191
+ "multiple": false,
1192
+ "type": "option"
1193
+ },
1194
+ "system-permission": {
1195
+ "description": "Checks a system (user) permission. Use the name of the permission field on the PermissionSet object, with or without the \"Permissions\" prefix, e.g. ModifyAllData, ViewAllData, ApiEnabled, or PermissionsAuthorApex.",
1196
+ "name": "system-permission",
1197
+ "summary": "API name of the system permission to check, e.g. ModifyAllData or ViewSetup.",
1016
1198
  "hasDynamicHelp": false,
1017
1199
  "multiple": false,
1018
1200
  "type": "option"
@@ -1020,56 +1202,58 @@
1020
1202
  },
1021
1203
  "hasDynamicHelp": true,
1022
1204
  "hiddenAliases": [],
1023
- "id": "rflib:logging:flow:instrument",
1205
+ "id": "rflib:debug:userpermissions:check",
1024
1206
  "pluginAlias": "rflib-plugin",
1025
1207
  "pluginName": "rflib-plugin",
1026
1208
  "pluginType": "core",
1027
1209
  "strict": true,
1028
- "summary": "Adds RFLIB logging statements to Salesforce Flows.",
1210
+ "summary": "Check whether a user has a specific permission, and where it comes from.",
1029
1211
  "enableJsonFlag": true,
1030
1212
  "isESM": true,
1031
1213
  "relativePath": [
1032
1214
  "lib",
1033
1215
  "commands",
1034
1216
  "rflib",
1035
- "logging",
1036
- "flow",
1037
- "instrument.js"
1217
+ "debug",
1218
+ "userpermissions",
1219
+ "check.js"
1038
1220
  ],
1039
1221
  "aliasPermutations": [],
1040
1222
  "permutations": [
1041
- "rflib:logging:flow:instrument",
1042
- "logging:rflib:flow:instrument",
1043
- "logging:flow:rflib:instrument",
1044
- "logging:flow:instrument:rflib",
1045
- "rflib:flow:logging:instrument",
1046
- "flow:rflib:logging:instrument",
1047
- "flow:logging:rflib:instrument",
1048
- "flow:logging:instrument:rflib",
1049
- "rflib:flow:instrument:logging",
1050
- "flow:rflib:instrument:logging",
1051
- "flow:instrument:rflib:logging",
1052
- "flow:instrument:logging:rflib",
1053
- "rflib:logging:instrument:flow",
1054
- "logging:rflib:instrument:flow",
1055
- "logging:instrument:rflib:flow",
1056
- "logging:instrument:flow:rflib",
1057
- "rflib:instrument:logging:flow",
1058
- "instrument:rflib:logging:flow",
1059
- "instrument:logging:rflib:flow",
1060
- "instrument:logging:flow:rflib",
1061
- "rflib:instrument:flow:logging",
1062
- "instrument:rflib:flow:logging",
1063
- "instrument:flow:rflib:logging",
1064
- "instrument:flow:logging:rflib"
1223
+ "rflib:debug:userpermissions:check",
1224
+ "debug:rflib:userpermissions:check",
1225
+ "debug:userpermissions:rflib:check",
1226
+ "debug:userpermissions:check:rflib",
1227
+ "rflib:userpermissions:debug:check",
1228
+ "userpermissions:rflib:debug:check",
1229
+ "userpermissions:debug:rflib:check",
1230
+ "userpermissions:debug:check:rflib",
1231
+ "rflib:userpermissions:check:debug",
1232
+ "userpermissions:rflib:check:debug",
1233
+ "userpermissions:check:rflib:debug",
1234
+ "userpermissions:check:debug:rflib",
1235
+ "rflib:debug:check:userpermissions",
1236
+ "debug:rflib:check:userpermissions",
1237
+ "debug:check:rflib:userpermissions",
1238
+ "debug:check:userpermissions:rflib",
1239
+ "rflib:check:debug:userpermissions",
1240
+ "check:rflib:debug:userpermissions",
1241
+ "check:debug:rflib:userpermissions",
1242
+ "check:debug:userpermissions:rflib",
1243
+ "rflib:check:userpermissions:debug",
1244
+ "check:rflib:userpermissions:debug",
1245
+ "check:userpermissions:rflib:debug",
1246
+ "check:userpermissions:debug:rflib"
1065
1247
  ]
1066
1248
  },
1067
- "rflib:logging:lwc:instrument": {
1249
+ "rflib:debug:userpermissions:get": {
1068
1250
  "aliases": [],
1069
1251
  "args": {},
1070
- "description": "Analyzes Lightning Web Component JavaScript files and adds RFLIB logging statements for:\n- Method entry logging with parameter values\n- Error logging in try-catch blocks\n- Error logging in Promise catch handlers\n- Condition logging in if/else blocks\n- Adds logger import if not present\n- Adds logger initialization if not present\n- Replaces console.log and similar method invocations\n- Formats modified files using Prettier (optional)",
1252
+ "description": "Retrieves FLS (Field-Level Security), OLS (Object-Level Security), and Apex class/page permissions for a specific user\nvia the Salesforce REST API. Permissions are aggregated across the user's profile, permission sets, and permission set groups.\n\nUse --sobject-type to narrow FLS or OLS results to a specific SObject.\n\nRequires the RFLIB base package to be installed in the target org and the running user to be assigned the rflib_Ops_Center_Access permission set (or have equivalent read access to the relevant permission objects).\nFor installation instructions, visit: https://github.com/j-fischer/rflib",
1071
1253
  "examples": [
1072
- "- Add logging to all LWC files:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc\n\n- Preview changes:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --dryrun\n\n- Add logging and format code:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --prettier\n\n- Process specific component:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc/myComponent"
1254
+ "Check all permissions for a user:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type ALL",
1255
+ "Check FLS for a specific object:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type FLS --sobject-type Account",
1256
+ "Check Apex access:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type APEX"
1073
1257
  ],
1074
1258
  "flags": {
1075
1259
  "json": {
@@ -1087,120 +1271,99 @@
1087
1271
  "multiple": false,
1088
1272
  "type": "option"
1089
1273
  },
1090
- "sourcepath": {
1091
- "char": "s",
1092
- "description": "Path to the source directory containing Lightning Web Component JavaScript files that should be instrumented with RFLIB logging statements. Aura component files are automatically excluded. The command will:\n- Process all .js files in the directory and subdirectories\n- Skip files in 'aura' directories\n- Add import statement: import { createLogger } from 'c/rflibLogger'\n- Add logger initialization: const logger = createLogger('ComponentName')",
1093
- "name": "sourcepath",
1274
+ "target-org": {
1275
+ "char": "o",
1276
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
1277
+ "name": "target-org",
1278
+ "noCacheDefault": true,
1094
1279
  "required": true,
1095
- "summary": "Directory containing LWC JavaScript files to instrument with logging.",
1096
- "hasDynamicHelp": false,
1280
+ "summary": "Username or alias of the target org.",
1281
+ "hasDynamicHelp": true,
1097
1282
  "multiple": false,
1098
1283
  "type": "option"
1099
1284
  },
1100
- "dryrun": {
1101
- "char": "d",
1102
- "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes. Shows:\n- Files that would be modified\n- Number of processed files\n- Number of modified files\n- Number of formatted files",
1103
- "name": "dryrun",
1104
- "summary": "Preview changes without modifying files.",
1105
- "allowNo": false,
1106
- "type": "boolean"
1107
- },
1108
- "prettier": {
1109
- "char": "p",
1110
- "description": "When enabled, formats the modified JavaScript files using Prettier after adding logging statements. Maintains consistent code style with:\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs",
1111
- "name": "prettier",
1112
- "summary": "Format modified files using Prettier.",
1113
- "allowNo": false,
1114
- "type": "boolean"
1115
- },
1116
- "no-if": {
1117
- "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
1118
- "name": "no-if",
1119
- "summary": "Exclude the instrumentation of if-else statements.",
1120
- "allowNo": false,
1121
- "type": "boolean"
1122
- },
1123
- "skip-instrumented": {
1124
- "description": "When provided, the command will not add log statements to any Apex class that contains the `rflib` import statement.",
1125
- "name": "skip-instrumented",
1126
- "summary": "Skips any files where a logger is already present.",
1127
- "allowNo": false,
1128
- "type": "boolean"
1129
- },
1130
- "verbose": {
1131
- "char": "v",
1132
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
1133
- "name": "verbose",
1134
- "summary": "Enable verbose output.",
1135
- "allowNo": false,
1136
- "type": "boolean"
1285
+ "user-id": {
1286
+ "char": "u",
1287
+ "description": "The Salesforce User ID (15 or 18 characters) of the user whose permissions should be retrieved.",
1288
+ "name": "user-id",
1289
+ "required": true,
1290
+ "summary": "Salesforce User ID (15 or 18 character) to check permissions for.",
1291
+ "hasDynamicHelp": false,
1292
+ "multiple": false,
1293
+ "type": "option"
1137
1294
  },
1138
- "exclude": {
1139
- "char": "e",
1140
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.js\" to skip auto-generated components.",
1141
- "name": "exclude",
1142
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
1295
+ "permission-type": {
1296
+ "char": "t",
1297
+ "description": "Controls which permission types are returned:\n - FLS: Field-Level Security only\n - OLS: Object-Level Security only\n - APEX: Apex class and page access only\n - ALL: All three permission types",
1298
+ "name": "permission-type",
1299
+ "required": true,
1300
+ "summary": "Type of permissions to retrieve: FLS, OLS, APEX, or ALL.",
1143
1301
  "hasDynamicHelp": false,
1144
1302
  "multiple": false,
1303
+ "options": [
1304
+ "FLS",
1305
+ "OLS",
1306
+ "APEX",
1307
+ "ALL"
1308
+ ],
1145
1309
  "type": "option"
1146
1310
  },
1147
- "concurrency": {
1148
- "char": "c",
1149
- "description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
1150
- "name": "concurrency",
1151
- "summary": "Limits the number of files processed concurrently.",
1152
- "default": 10,
1311
+ "sobject-type": {
1312
+ "char": "b",
1313
+ "description": "Filters Field-Level Security or Object-Level Security results to a specific SObject type, e.g. Account, Contact, Opportunity.",
1314
+ "name": "sobject-type",
1315
+ "summary": "Optional SObject API name to filter FLS or OLS results.",
1153
1316
  "hasDynamicHelp": false,
1154
1317
  "multiple": false,
1155
1318
  "type": "option"
1156
1319
  }
1157
1320
  },
1158
- "hasDynamicHelp": false,
1321
+ "hasDynamicHelp": true,
1159
1322
  "hiddenAliases": [],
1160
- "id": "rflib:logging:lwc:instrument",
1323
+ "id": "rflib:debug:userpermissions:get",
1161
1324
  "pluginAlias": "rflib-plugin",
1162
1325
  "pluginName": "rflib-plugin",
1163
1326
  "pluginType": "core",
1164
1327
  "strict": true,
1165
- "summary": "Instrument Lightning Web Components with RFLIB logging statements automatically.",
1328
+ "summary": "Check Salesforce permissions for a user in the target org.",
1166
1329
  "enableJsonFlag": true,
1167
1330
  "isESM": true,
1168
1331
  "relativePath": [
1169
1332
  "lib",
1170
1333
  "commands",
1171
1334
  "rflib",
1172
- "logging",
1173
- "lwc",
1174
- "instrument.js"
1335
+ "debug",
1336
+ "userpermissions",
1337
+ "get.js"
1175
1338
  ],
1176
1339
  "aliasPermutations": [],
1177
1340
  "permutations": [
1178
- "rflib:logging:lwc:instrument",
1179
- "logging:rflib:lwc:instrument",
1180
- "logging:lwc:rflib:instrument",
1181
- "logging:lwc:instrument:rflib",
1182
- "rflib:lwc:logging:instrument",
1183
- "lwc:rflib:logging:instrument",
1184
- "lwc:logging:rflib:instrument",
1185
- "lwc:logging:instrument:rflib",
1186
- "rflib:lwc:instrument:logging",
1187
- "lwc:rflib:instrument:logging",
1188
- "lwc:instrument:rflib:logging",
1189
- "lwc:instrument:logging:rflib",
1190
- "rflib:logging:instrument:lwc",
1191
- "logging:rflib:instrument:lwc",
1192
- "logging:instrument:rflib:lwc",
1193
- "logging:instrument:lwc:rflib",
1194
- "rflib:instrument:logging:lwc",
1195
- "instrument:rflib:logging:lwc",
1196
- "instrument:logging:rflib:lwc",
1197
- "instrument:logging:lwc:rflib",
1198
- "rflib:instrument:lwc:logging",
1199
- "instrument:rflib:lwc:logging",
1200
- "instrument:lwc:rflib:logging",
1201
- "instrument:lwc:logging:rflib"
1341
+ "rflib:debug:userpermissions:get",
1342
+ "debug:rflib:userpermissions:get",
1343
+ "debug:userpermissions:rflib:get",
1344
+ "debug:userpermissions:get:rflib",
1345
+ "rflib:userpermissions:debug:get",
1346
+ "userpermissions:rflib:debug:get",
1347
+ "userpermissions:debug:rflib:get",
1348
+ "userpermissions:debug:get:rflib",
1349
+ "rflib:userpermissions:get:debug",
1350
+ "userpermissions:rflib:get:debug",
1351
+ "userpermissions:get:rflib:debug",
1352
+ "userpermissions:get:debug:rflib",
1353
+ "rflib:debug:get:userpermissions",
1354
+ "debug:rflib:get:userpermissions",
1355
+ "debug:get:rflib:userpermissions",
1356
+ "debug:get:userpermissions:rflib",
1357
+ "rflib:get:debug:userpermissions",
1358
+ "get:rflib:debug:userpermissions",
1359
+ "get:debug:rflib:userpermissions",
1360
+ "get:debug:userpermissions:rflib",
1361
+ "rflib:get:userpermissions:debug",
1362
+ "get:rflib:userpermissions:debug",
1363
+ "get:userpermissions:rflib:debug",
1364
+ "get:userpermissions:debug:rflib"
1202
1365
  ]
1203
1366
  }
1204
1367
  },
1205
- "version": "0.21.10"
1368
+ "version": "0.22.0"
1206
1369
  }