rflib-plugin 0.21.9 → 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,90 +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:applicationevents:get": {
240
+ "rflib:logging:aura:instrument": {
197
241
  "aliases": [],
198
242
  "args": {},
199
- "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",
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
- "Get all application events from the default org:\n$ sf rflib debug applicationevents get --target-org myOrg",
202
- "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",
203
- "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"
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"
204
246
  ],
205
247
  "flags": {
206
248
  "json": {
@@ -218,115 +260,129 @@
218
260
  "multiple": false,
219
261
  "type": "option"
220
262
  },
221
- "target-org": {
222
- "char": "o",
223
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
224
- "name": "target-org",
225
- "noCacheDefault": true,
226
- "required": true,
227
- "summary": "Username or alias of the target org.",
228
- "hasDynamicHelp": true,
229
- "multiple": false,
230
- "type": "option"
231
- },
232
- "event-name": {
233
- "char": "e",
234
- "description": "Filter Application Events by their Event_Name__c field. Use the % character as a wildcard for partial matches, for example \"order-%\".",
235
- "name": "event-name",
236
- "summary": "Filter by event name. Use % as a wildcard.",
237
- "hasDynamicHelp": false,
238
- "multiple": false,
239
- "type": "option"
240
- },
241
- "start-date": {
263
+ "sourcepath": {
242
264
  "char": "s",
243
- "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.",
244
- "name": "start-date",
245
- "summary": "Filter events on or after this ISO 8601 date.",
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",
267
+ "required": true,
268
+ "summary": "Directory containing Aura components to instrument with logging.",
246
269
  "hasDynamicHelp": false,
247
270
  "multiple": false,
248
271
  "type": "option"
249
272
  },
250
- "end-date": {
273
+ "dryrun": {
251
274
  "char": "d",
252
- "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.",
253
- "name": "end-date",
254
- "summary": "Filter events on or before this ISO 8601 date.",
255
- "hasDynamicHelp": false,
256
- "multiple": false,
257
- "type": "option"
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"
258
280
  },
259
- "related-record-id": {
260
- "char": "r",
261
- "description": "Only return events associated with this specific record ID.",
262
- "name": "related-record-id",
263
- "summary": "Filter by Related_Record_ID__c (exact match).",
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.",
264
316
  "hasDynamicHelp": false,
265
317
  "multiple": false,
266
318
  "type": "option"
267
319
  },
268
- "record-limit": {
269
- "char": "l",
270
- "description": "Controls how many Application Event records are returned. Defaults to 200. Maximum allowed value is 2000.",
271
- "name": "record-limit",
272
- "summary": "Maximum number of records to return (default 200, max 2000).",
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,
273
326
  "hasDynamicHelp": false,
274
327
  "multiple": false,
275
328
  "type": "option"
276
329
  }
277
330
  },
278
- "hasDynamicHelp": true,
331
+ "hasDynamicHelp": false,
279
332
  "hiddenAliases": [],
280
- "id": "rflib:debug:applicationevents:get",
333
+ "id": "rflib:logging:aura:instrument",
281
334
  "pluginAlias": "rflib-plugin",
282
335
  "pluginName": "rflib-plugin",
283
336
  "pluginType": "core",
284
337
  "strict": true,
285
- "summary": "Query RFLIB Application Events from a Salesforce org.",
338
+ "summary": "Instrument Aura Components with RFLIB logging statements automatically.",
286
339
  "enableJsonFlag": true,
287
340
  "isESM": true,
288
341
  "relativePath": [
289
342
  "lib",
290
343
  "commands",
291
344
  "rflib",
292
- "debug",
293
- "applicationevents",
294
- "get.js"
345
+ "logging",
346
+ "aura",
347
+ "instrument.js"
295
348
  ],
296
349
  "aliasPermutations": [],
297
350
  "permutations": [
298
- "rflib:debug:applicationevents:get",
299
- "debug:rflib:applicationevents:get",
300
- "debug:applicationevents:rflib:get",
301
- "debug:applicationevents:get:rflib",
302
- "rflib:applicationevents:debug:get",
303
- "applicationevents:rflib:debug:get",
304
- "applicationevents:debug:rflib:get",
305
- "applicationevents:debug:get:rflib",
306
- "rflib:applicationevents:get:debug",
307
- "applicationevents:rflib:get:debug",
308
- "applicationevents:get:rflib:debug",
309
- "applicationevents:get:debug:rflib",
310
- "rflib:debug:get:applicationevents",
311
- "debug:rflib:get:applicationevents",
312
- "debug:get:rflib:applicationevents",
313
- "debug:get:applicationevents:rflib",
314
- "rflib:get:debug:applicationevents",
315
- "get:rflib:debug:applicationevents",
316
- "get:debug:rflib:applicationevents",
317
- "get:debug:applicationevents:rflib",
318
- "rflib:get:applicationevents:debug",
319
- "get:rflib:applicationevents:debug",
320
- "get:applicationevents:rflib:debug",
321
- "get:applicationevents: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"
322
375
  ]
323
376
  },
324
- "rflib:debug:loggersettings:get": {
377
+ "rflib:logging:flow:instrument": {
325
378
  "aliases": [],
326
379
  "args": {},
327
- "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",
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.",
328
381
  "examples": [
329
- "Read all logger settings from the target org:\n$ sf rflib debug loggersettings get --target-org myOrg"
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"
330
386
  ],
331
387
  "flags": {
332
388
  "json": {
@@ -346,7 +402,7 @@
346
402
  },
347
403
  "target-org": {
348
404
  "char": "o",
349
- "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.",
350
406
  "name": "target-org",
351
407
  "noCacheDefault": true,
352
408
  "required": true,
@@ -354,61 +410,119 @@
354
410
  "hasDynamicHelp": true,
355
411
  "multiple": false,
356
412
  "type": "option"
413
+ },
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",
418
+ "required": true,
419
+ "summary": "Directory containing Flow files to instrument with logging.",
420
+ "hasDynamicHelp": false,
421
+ "multiple": false,
422
+ "type": "option"
423
+ },
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": {
447
+ "char": "v",
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.",
459
+ "hasDynamicHelp": false,
460
+ "multiple": false,
461
+ "type": "option"
462
+ },
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"
357
472
  }
358
473
  },
359
474
  "hasDynamicHelp": true,
360
475
  "hiddenAliases": [],
361
- "id": "rflib:debug:loggersettings:get",
476
+ "id": "rflib:logging:flow:instrument",
362
477
  "pluginAlias": "rflib-plugin",
363
478
  "pluginName": "rflib-plugin",
364
479
  "pluginType": "core",
365
480
  "strict": true,
366
- "summary": "Read all RFLIB Logger Settings from a Salesforce org.",
481
+ "summary": "Adds RFLIB logging statements to Salesforce Flows.",
367
482
  "enableJsonFlag": true,
368
483
  "isESM": true,
369
484
  "relativePath": [
370
485
  "lib",
371
486
  "commands",
372
487
  "rflib",
373
- "debug",
374
- "loggersettings",
375
- "get.js"
488
+ "logging",
489
+ "flow",
490
+ "instrument.js"
376
491
  ],
377
492
  "aliasPermutations": [],
378
493
  "permutations": [
379
- "rflib:debug:loggersettings:get",
380
- "debug:rflib:loggersettings:get",
381
- "debug:loggersettings:rflib:get",
382
- "debug:loggersettings:get:rflib",
383
- "rflib:loggersettings:debug:get",
384
- "loggersettings:rflib:debug:get",
385
- "loggersettings:debug:rflib:get",
386
- "loggersettings:debug:get:rflib",
387
- "rflib:loggersettings:get:debug",
388
- "loggersettings:rflib:get:debug",
389
- "loggersettings:get:rflib:debug",
390
- "loggersettings:get:debug:rflib",
391
- "rflib:debug:get:loggersettings",
392
- "debug:rflib:get:loggersettings",
393
- "debug:get:rflib:loggersettings",
394
- "debug:get:loggersettings:rflib",
395
- "rflib:get:debug:loggersettings",
396
- "get:rflib:debug:loggersettings",
397
- "get:debug:rflib:loggersettings",
398
- "get:debug:loggersettings:rflib",
399
- "rflib:get:loggersettings:debug",
400
- "get:rflib:loggersettings:debug",
401
- "get:loggersettings:rflib:debug",
402
- "get:loggersettings:debug:rflib"
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"
403
518
  ]
404
519
  },
405
- "rflib:debug:loggersettings:update": {
520
+ "rflib:logging:lwc:instrument": {
406
521
  "aliases": [],
407
522
  "args": {},
408
- "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",
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)",
409
524
  "examples": [
410
- "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",
411
- "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"
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"
412
526
  ],
413
527
  "flags": {
414
528
  "json": {
@@ -426,110 +540,128 @@
426
540
  "multiple": false,
427
541
  "type": "option"
428
542
  },
429
- "target-org": {
430
- "char": "o",
431
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
432
- "name": "target-org",
433
- "noCacheDefault": true,
434
- "required": true,
435
- "summary": "Username or alias of the target org.",
436
- "hasDynamicHelp": true,
437
- "multiple": false,
438
- "type": "option"
439
- },
440
- "field-name": {
441
- "char": "f",
442
- "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.",
443
- "name": "field-name",
543
+ "sourcepath": {
544
+ "char": "s",
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",
444
547
  "required": true,
445
- "summary": "API name of the rflib_Logger_Settings__c field to update.",
548
+ "summary": "Directory containing LWC JavaScript files to instrument with logging.",
446
549
  "hasDynamicHelp": false,
447
550
  "multiple": false,
448
551
  "type": "option"
449
552
  },
450
- "field-value": {
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": {
451
584
  "char": "v",
452
- "description": "The new value to set on the specified field. For log level fields, valid values are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, NONE.",
453
- "name": "field-value",
454
- "required": true,
455
- "summary": "New value for the specified field.",
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.",
456
596
  "hasDynamicHelp": false,
457
597
  "multiple": false,
458
598
  "type": "option"
459
599
  },
460
- "record-id": {
461
- "char": "r",
462
- "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).",
463
- "name": "record-id",
464
- "summary": "ID of an existing rflib_Logger_Settings__c record to update.",
465
- "hasDynamicHelp": false,
466
- "multiple": false,
467
- "type": "option"
468
- },
469
- "setup-owner-id": {
470
- "char": "s",
471
- "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\".",
472
- "name": "setup-owner-id",
473
- "summary": "Setup owner ID for creating a new Logger Setting record.",
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,
474
606
  "hasDynamicHelp": false,
475
607
  "multiple": false,
476
608
  "type": "option"
477
609
  }
478
610
  },
479
- "hasDynamicHelp": true,
611
+ "hasDynamicHelp": false,
480
612
  "hiddenAliases": [],
481
- "id": "rflib:debug:loggersettings:update",
613
+ "id": "rflib:logging:lwc:instrument",
482
614
  "pluginAlias": "rflib-plugin",
483
615
  "pluginName": "rflib-plugin",
484
616
  "pluginType": "core",
485
617
  "strict": true,
486
- "summary": "Create or update an RFLIB Logger Setting in a Salesforce org.",
618
+ "summary": "Instrument Lightning Web Components with RFLIB logging statements automatically.",
487
619
  "enableJsonFlag": true,
488
620
  "isESM": true,
489
621
  "relativePath": [
490
622
  "lib",
491
623
  "commands",
492
624
  "rflib",
493
- "debug",
494
- "loggersettings",
495
- "update.js"
625
+ "logging",
626
+ "lwc",
627
+ "instrument.js"
496
628
  ],
497
629
  "aliasPermutations": [],
498
630
  "permutations": [
499
- "rflib:debug:loggersettings:update",
500
- "debug:rflib:loggersettings:update",
501
- "debug:loggersettings:rflib:update",
502
- "debug:loggersettings:update:rflib",
503
- "rflib:loggersettings:debug:update",
504
- "loggersettings:rflib:debug:update",
505
- "loggersettings:debug:rflib:update",
506
- "loggersettings:debug:update:rflib",
507
- "rflib:loggersettings:update:debug",
508
- "loggersettings:rflib:update:debug",
509
- "loggersettings:update:rflib:debug",
510
- "loggersettings:update:debug:rflib",
511
- "rflib:debug:update:loggersettings",
512
- "debug:rflib:update:loggersettings",
513
- "debug:update:rflib:loggersettings",
514
- "debug:update:loggersettings:rflib",
515
- "rflib:update:debug:loggersettings",
516
- "update:rflib:debug:loggersettings",
517
- "update:debug:rflib:loggersettings",
518
- "update:debug:loggersettings:rflib",
519
- "rflib:update:loggersettings:debug",
520
- "update:rflib:loggersettings:debug",
521
- "update:loggersettings:rflib:debug",
522
- "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"
523
655
  ]
524
656
  },
525
- "rflib:debug:userpermissions:get": {
657
+ "rflib:debug:applicationevents:get": {
526
658
  "aliases": [],
527
659
  "args": {},
528
- "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",
529
661
  "examples": [
530
- "Check all permissions for a user:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type ALL",
531
- "Check FLS for a specific object:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type FLS --sobject-type Account",
532
- "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"
533
665
  ],
534
666
  "flags": {
535
667
  "json": {
@@ -558,37 +690,47 @@
558
690
  "multiple": false,
559
691
  "type": "option"
560
692
  },
561
- "user-id": {
562
- "char": "u",
563
- "description": "The Salesforce User ID (15 or 18 characters) of the user whose permissions should be retrieved.",
564
- "name": "user-id",
565
- "required": true,
566
- "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.",
567
698
  "hasDynamicHelp": false,
568
699
  "multiple": false,
569
700
  "type": "option"
570
701
  },
571
- "permission-type": {
572
- "char": "t",
573
- "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",
574
- "name": "permission-type",
575
- "required": true,
576
- "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.",
577
707
  "hasDynamicHelp": false,
578
708
  "multiple": false,
579
- "options": [
580
- "FLS",
581
- "OLS",
582
- "APEX",
583
- "ALL"
584
- ],
585
709
  "type": "option"
586
710
  },
587
- "sobject-type": {
588
- "char": "b",
589
- "description": "Filters Field-Level Security or Object-Level Security results to a specific SObject type, e.g. Account, Contact, Opportunity.",
590
- "name": "sobject-type",
591
- "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).",
592
734
  "hasDynamicHelp": false,
593
735
  "multiple": false,
594
736
  "type": "option"
@@ -596,12 +738,12 @@
596
738
  },
597
739
  "hasDynamicHelp": true,
598
740
  "hiddenAliases": [],
599
- "id": "rflib:debug:userpermissions:get",
741
+ "id": "rflib:debug:applicationevents:get",
600
742
  "pluginAlias": "rflib-plugin",
601
743
  "pluginName": "rflib-plugin",
602
744
  "pluginType": "core",
603
745
  "strict": true,
604
- "summary": "Check Salesforce permissions for a user in the target org.",
746
+ "summary": "Query RFLIB Application Events from a Salesforce org.",
605
747
  "enableJsonFlag": true,
606
748
  "isESM": true,
607
749
  "relativePath": [
@@ -609,43 +751,44 @@
609
751
  "commands",
610
752
  "rflib",
611
753
  "debug",
612
- "userpermissions",
754
+ "applicationevents",
613
755
  "get.js"
614
756
  ],
615
757
  "aliasPermutations": [],
616
758
  "permutations": [
617
- "rflib:debug:userpermissions:get",
618
- "debug:rflib:userpermissions:get",
619
- "debug:userpermissions:rflib:get",
620
- "debug:userpermissions:get:rflib",
621
- "rflib:userpermissions:debug:get",
622
- "userpermissions:rflib:debug:get",
623
- "userpermissions:debug:rflib:get",
624
- "userpermissions:debug:get:rflib",
625
- "rflib:userpermissions:get:debug",
626
- "userpermissions:rflib:get:debug",
627
- "userpermissions:get:rflib:debug",
628
- "userpermissions:get:debug:rflib",
629
- "rflib:debug:get:userpermissions",
630
- "debug:rflib:get:userpermissions",
631
- "debug:get:rflib:userpermissions",
632
- "debug:get:userpermissions:rflib",
633
- "rflib:get:debug:userpermissions",
634
- "get:rflib:debug:userpermissions",
635
- "get:debug:rflib:userpermissions",
636
- "get:debug:userpermissions:rflib",
637
- "rflib:get:userpermissions:debug",
638
- "get:rflib:userpermissions:debug",
639
- "get:userpermissions:rflib:debug",
640
- "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"
641
783
  ]
642
784
  },
643
- "rflib:logging:apex:instrument": {
785
+ "rflib:debug:logarchives:get": {
644
786
  "aliases": [],
645
787
  "args": {},
646
- "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",
647
789
  "examples": [
648
- "- 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"
649
792
  ],
650
793
  "flags": {
651
794
  "json": {
@@ -663,133 +806,170 @@
663
806
  "multiple": false,
664
807
  "type": "option"
665
808
  },
666
- "sourcepath": {
667
- "char": "s",
668
- "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.",
669
- "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,
670
814
  "required": true,
671
- "summary": "Directory containing Apex classes to instrument with logging.",
815
+ "summary": "Username or alias of the target org.",
816
+ "hasDynamicHelp": true,
817
+ "multiple": false,
818
+ "type": "option"
819
+ },
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.",
672
825
  "hasDynamicHelp": false,
673
826
  "multiple": false,
674
827
  "type": "option"
675
828
  },
676
- "dryrun": {
829
+ "end-date": {
677
830
  "char": "d",
678
- "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
679
- "name": "dryrun",
680
- "summary": "Preview changes without modifying files.",
681
- "allowNo": false,
682
- "type": "boolean"
683
- },
684
- "prettier": {
685
- "char": "p",
686
- "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",
687
- "name": "prettier",
688
- "summary": "Format modified files using Prettier.",
689
- "allowNo": false,
690
- "type": "boolean"
691
- },
692
- "no-if": {
693
- "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
694
- "name": "no-if",
695
- "summary": "Exclude the instrumentation of if-else statements.",
696
- "allowNo": false,
697
- "type": "boolean"
698
- },
699
- "no-catch": {
700
- "description": "When provided, the command will not add error log statements inside of `catch` blocks.",
701
- "name": "no-catch",
702
- "summary": "Exclude the instrumentation of catch blocks.",
703
- "allowNo": false,
704
- "type": "boolean"
705
- },
706
- "skip-instrumented": {
707
- "description": "When provided, the command will not add log statements to any Apex class that contains the `rflib_Logger` reference.",
708
- "name": "skip-instrumented",
709
- "summary": "Skips any files where a logger is already present.",
710
- "allowNo": false,
711
- "type": "boolean"
712
- },
713
- "verbose": {
714
- "char": "v",
715
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
716
- "name": "verbose",
717
- "summary": "Enable verbose output.",
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.",
834
+ "hasDynamicHelp": false,
835
+ "multiple": false,
836
+ "type": "option"
837
+ }
838
+ },
839
+ "hasDynamicHelp": true,
840
+ "hiddenAliases": [],
841
+ "id": "rflib:debug:logarchives:get",
842
+ "pluginAlias": "rflib-plugin",
843
+ "pluginName": "rflib-plugin",
844
+ "pluginType": "core",
845
+ "strict": true,
846
+ "summary": "Query RFLIB log archives from a Salesforce org.",
847
+ "enableJsonFlag": true,
848
+ "isESM": true,
849
+ "relativePath": [
850
+ "lib",
851
+ "commands",
852
+ "rflib",
853
+ "debug",
854
+ "logarchives",
855
+ "get.js"
856
+ ],
857
+ "aliasPermutations": [],
858
+ "permutations": [
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"
883
+ ]
884
+ },
885
+ "rflib:debug:loggersettings:get": {
886
+ "aliases": [],
887
+ "args": {},
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",
889
+ "examples": [
890
+ "Read all logger settings from the target org:\n$ sf rflib debug loggersettings get --target-org myOrg"
891
+ ],
892
+ "flags": {
893
+ "json": {
894
+ "description": "Format output as json.",
895
+ "helpGroup": "GLOBAL",
896
+ "name": "json",
718
897
  "allowNo": false,
719
898
  "type": "boolean"
720
899
  },
721
- "exclude": {
722
- "char": "e",
723
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cls\" to skip auto-generated classes.",
724
- "name": "exclude",
725
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
900
+ "flags-dir": {
901
+ "helpGroup": "GLOBAL",
902
+ "name": "flags-dir",
903
+ "summary": "Import flag values from a directory.",
726
904
  "hasDynamicHelp": false,
727
905
  "multiple": false,
728
906
  "type": "option"
729
907
  },
730
- "concurrency": {
731
- "char": "c",
732
- "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.",
733
- "name": "concurrency",
734
- "summary": "Limits the number of files processed concurrently.",
735
- "default": 10,
736
- "hasDynamicHelp": false,
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,
913
+ "required": true,
914
+ "summary": "Username or alias of the target org.",
915
+ "hasDynamicHelp": true,
737
916
  "multiple": false,
738
917
  "type": "option"
739
918
  }
740
919
  },
741
- "hasDynamicHelp": false,
920
+ "hasDynamicHelp": true,
742
921
  "hiddenAliases": [],
743
- "id": "rflib:logging:apex:instrument",
922
+ "id": "rflib:debug:loggersettings:get",
744
923
  "pluginAlias": "rflib-plugin",
745
924
  "pluginName": "rflib-plugin",
746
925
  "pluginType": "core",
747
926
  "strict": true,
748
- "summary": "Instrument Apex classes with RFLIB logging statements automatically.",
927
+ "summary": "Read all RFLIB Logger Settings from a Salesforce org.",
749
928
  "enableJsonFlag": true,
750
929
  "isESM": true,
751
930
  "relativePath": [
752
931
  "lib",
753
932
  "commands",
754
933
  "rflib",
755
- "logging",
756
- "apex",
757
- "instrument.js"
934
+ "debug",
935
+ "loggersettings",
936
+ "get.js"
758
937
  ],
759
938
  "aliasPermutations": [],
760
939
  "permutations": [
761
- "rflib:logging:apex:instrument",
762
- "logging:rflib:apex:instrument",
763
- "logging:apex:rflib:instrument",
764
- "logging:apex:instrument:rflib",
765
- "rflib:apex:logging:instrument",
766
- "apex:rflib:logging:instrument",
767
- "apex:logging:rflib:instrument",
768
- "apex:logging:instrument:rflib",
769
- "rflib:apex:instrument:logging",
770
- "apex:rflib:instrument:logging",
771
- "apex:instrument:rflib:logging",
772
- "apex:instrument:logging:rflib",
773
- "rflib:logging:instrument:apex",
774
- "logging:rflib:instrument:apex",
775
- "logging:instrument:rflib:apex",
776
- "logging:instrument:apex:rflib",
777
- "rflib:instrument:logging:apex",
778
- "instrument:rflib:logging:apex",
779
- "instrument:logging:rflib:apex",
780
- "instrument:logging:apex:rflib",
781
- "rflib:instrument:apex:logging",
782
- "instrument:rflib:apex:logging",
783
- "instrument:apex:rflib:logging",
784
- "instrument:apex: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"
785
964
  ]
786
965
  },
787
- "rflib:logging:aura:instrument": {
966
+ "rflib:debug:loggersettings:update": {
788
967
  "aliases": [],
789
968
  "args": {},
790
- "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",
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",
791
970
  "examples": [
792
- "- 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"
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"
793
973
  ],
794
974
  "flags": {
795
975
  "json": {
@@ -807,129 +987,112 @@
807
987
  "multiple": false,
808
988
  "type": "option"
809
989
  },
810
- "sourcepath": {
811
- "char": "s",
812
- "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()",
813
- "name": "sourcepath",
990
+ "target-org": {
991
+ "char": "o",
992
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
993
+ "name": "target-org",
994
+ "noCacheDefault": true,
814
995
  "required": true,
815
- "summary": "Directory containing Aura components to instrument with logging.",
816
- "hasDynamicHelp": false,
996
+ "summary": "Username or alias of the target org.",
997
+ "hasDynamicHelp": true,
817
998
  "multiple": false,
818
999
  "type": "option"
819
1000
  },
820
- "dryrun": {
821
- "char": "d",
822
- "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",
823
- "name": "dryrun",
824
- "summary": "Preview changes without modifying files.",
825
- "allowNo": false,
826
- "type": "boolean"
827
- },
828
- "prettier": {
829
- "char": "p",
830
- "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",
831
- "name": "prettier",
832
- "summary": "Format modified files using Prettier.",
833
- "allowNo": false,
834
- "type": "boolean"
835
- },
836
- "no-if": {
837
- "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
838
- "name": "no-if",
839
- "summary": "Exclude the instrumentation of if-else statements.",
840
- "allowNo": false,
841
- "type": "boolean"
842
- },
843
- "skip-instrumented": {
844
- "description": "When provided, the command will not add log statements to any Aura component that contains the `` component.",
845
- "name": "skip-instrumented",
846
- "summary": "Skips any files where a logger is already present.",
847
- "allowNo": false,
848
- "type": "boolean"
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.",
1007
+ "hasDynamicHelp": false,
1008
+ "multiple": false,
1009
+ "type": "option"
849
1010
  },
850
- "verbose": {
1011
+ "field-value": {
851
1012
  "char": "v",
852
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
853
- "name": "verbose",
854
- "summary": "Enable verbose output.",
855
- "allowNo": false,
856
- "type": "boolean"
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.",
1017
+ "hasDynamicHelp": false,
1018
+ "multiple": false,
1019
+ "type": "option"
857
1020
  },
858
- "exclude": {
859
- "char": "e",
860
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cmp\" to skip auto-generated components.",
861
- "name": "exclude",
862
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
1021
+ "record-id": {
1022
+ "char": "r",
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.",
863
1026
  "hasDynamicHelp": false,
864
1027
  "multiple": false,
865
1028
  "type": "option"
866
1029
  },
867
- "concurrency": {
868
- "char": "c",
869
- "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.",
870
- "name": "concurrency",
871
- "summary": "Limits the number of files processed concurrently.",
872
- "default": 10,
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"
876
1038
  }
877
1039
  },
878
- "hasDynamicHelp": false,
1040
+ "hasDynamicHelp": true,
879
1041
  "hiddenAliases": [],
880
- "id": "rflib:logging:aura:instrument",
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": "Instrument Aura Components with RFLIB logging statements automatically.",
1047
+ "summary": "Create or update an RFLIB Logger Setting in a Salesforce org.",
886
1048
  "enableJsonFlag": true,
887
1049
  "isESM": true,
888
1050
  "relativePath": [
889
1051
  "lib",
890
1052
  "commands",
891
1053
  "rflib",
892
- "logging",
893
- "aura",
894
- "instrument.js"
1054
+ "debug",
1055
+ "loggersettings",
1056
+ "update.js"
895
1057
  ],
896
1058
  "aliasPermutations": [],
897
1059
  "permutations": [
898
- "rflib:logging:aura:instrument",
899
- "logging:rflib:aura:instrument",
900
- "logging:aura:rflib:instrument",
901
- "logging:aura:instrument:rflib",
902
- "rflib:aura:logging:instrument",
903
- "aura:rflib:logging:instrument",
904
- "aura:logging:rflib:instrument",
905
- "aura:logging:instrument:rflib",
906
- "rflib:aura:instrument:logging",
907
- "aura:rflib:instrument:logging",
908
- "aura:instrument:rflib:logging",
909
- "aura:instrument:logging:rflib",
910
- "rflib:logging:instrument:aura",
911
- "logging:rflib:instrument:aura",
912
- "logging:instrument:rflib:aura",
913
- "logging:instrument:aura:rflib",
914
- "rflib:instrument:logging:aura",
915
- "instrument:rflib:logging:aura",
916
- "instrument:logging:rflib:aura",
917
- "instrument:logging:aura:rflib",
918
- "rflib:instrument:aura:logging",
919
- "instrument:rflib:aura:logging",
920
- "instrument:aura:rflib:logging",
921
- "instrument:aura:logging: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 installed in the target org and skips the fault paths if the org runs an older version or RFLIB is not installed as a package. 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 single read-only Tooling API query for the packages installed in this org. If RFLIB 11.4.0 or later is installed, fault paths are instrumented; if an older version is installed, or RFLIB is not installed as a package, 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.9"
1368
+ "version": "0.22.0"
1206
1369
  }