rflib-plugin 0.23.3 → 0.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/oclif.manifest.json +956 -956
  2. package/package.json +1 -1
@@ -93,12 +93,14 @@
93
93
  "upgrade:packages:rflib"
94
94
  ]
95
95
  },
96
- "rflib:logging:apex:instrument": {
96
+ "rflib:debug:applicationevents:get": {
97
97
  "aliases": [],
98
98
  "args": {},
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.",
99
+ "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",
100
100
  "examples": [
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"
101
+ "Get all application events from the default org:\n$ sf rflib debug applicationevents get --target-org myOrg",
102
+ "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",
103
+ "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"
102
104
  ],
103
105
  "flags": {
104
106
  "json": {
@@ -116,133 +118,116 @@
116
118
  "multiple": false,
117
119
  "type": "option"
118
120
  },
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",
121
+ "target-org": {
122
+ "char": "o",
123
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
124
+ "name": "target-org",
125
+ "noCacheDefault": true,
123
126
  "required": true,
124
- "summary": "Directory containing Apex classes to instrument with logging.",
125
- "hasDynamicHelp": false,
127
+ "summary": "Username or alias of the target org.",
128
+ "hasDynamicHelp": true,
126
129
  "multiple": false,
127
130
  "type": "option"
128
131
  },
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"
132
+ "event-name": {
133
+ "char": "e",
134
+ "description": "Filter Application Events by their Event_Name__c field. Use the % character as a wildcard for partial matches, for example \"order-%\".",
135
+ "name": "event-name",
136
+ "summary": "Filter by event name. Use % as a wildcard.",
137
+ "hasDynamicHelp": false,
138
+ "multiple": false,
139
+ "type": "option"
158
140
  },
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"
141
+ "start-date": {
142
+ "char": "s",
143
+ "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.",
144
+ "name": "start-date",
145
+ "summary": "Filter events on or after this ISO 8601 date.",
146
+ "hasDynamicHelp": false,
147
+ "multiple": false,
148
+ "type": "option"
165
149
  },
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"
150
+ "end-date": {
151
+ "char": "d",
152
+ "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.",
153
+ "name": "end-date",
154
+ "summary": "Filter events on or before this ISO 8601 date.",
155
+ "hasDynamicHelp": false,
156
+ "multiple": false,
157
+ "type": "option"
173
158
  },
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.",
159
+ "related-record-id": {
160
+ "char": "r",
161
+ "description": "Only return events associated with this specific record ID.",
162
+ "name": "related-record-id",
163
+ "summary": "Filter by Related_Record_ID__c (exact match).",
179
164
  "hasDynamicHelp": false,
180
165
  "multiple": false,
181
166
  "type": "option"
182
167
  },
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,
168
+ "record-limit": {
169
+ "char": "l",
170
+ "description": "Controls how many Application Event records are returned. Defaults to 200. Maximum allowed value is 2000.",
171
+ "name": "record-limit",
172
+ "summary": "Maximum number of records to return (default 200, max 2000).",
189
173
  "hasDynamicHelp": false,
190
174
  "multiple": false,
191
175
  "type": "option"
192
176
  }
193
177
  },
194
- "hasDynamicHelp": false,
178
+ "hasDynamicHelp": true,
195
179
  "hiddenAliases": [],
196
- "id": "rflib:logging:apex:instrument",
180
+ "id": "rflib:debug:applicationevents:get",
197
181
  "pluginAlias": "rflib-plugin",
198
182
  "pluginName": "rflib-plugin",
199
183
  "pluginType": "core",
200
184
  "strict": true,
201
- "summary": "Instrument Apex classes with RFLIB logging statements automatically.",
185
+ "summary": "Query RFLIB Application Events from a Salesforce org.",
202
186
  "enableJsonFlag": true,
203
187
  "isESM": true,
204
188
  "relativePath": [
205
189
  "lib",
206
190
  "commands",
207
191
  "rflib",
208
- "logging",
209
- "apex",
210
- "instrument.js"
192
+ "debug",
193
+ "applicationevents",
194
+ "get.js"
211
195
  ],
212
196
  "aliasPermutations": [],
213
197
  "permutations": [
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"
198
+ "rflib:debug:applicationevents:get",
199
+ "debug:rflib:applicationevents:get",
200
+ "debug:applicationevents:rflib:get",
201
+ "debug:applicationevents:get:rflib",
202
+ "rflib:applicationevents:debug:get",
203
+ "applicationevents:rflib:debug:get",
204
+ "applicationevents:debug:rflib:get",
205
+ "applicationevents:debug:get:rflib",
206
+ "rflib:applicationevents:get:debug",
207
+ "applicationevents:rflib:get:debug",
208
+ "applicationevents:get:rflib:debug",
209
+ "applicationevents:get:debug:rflib",
210
+ "rflib:debug:get:applicationevents",
211
+ "debug:rflib:get:applicationevents",
212
+ "debug:get:rflib:applicationevents",
213
+ "debug:get:applicationevents:rflib",
214
+ "rflib:get:debug:applicationevents",
215
+ "get:rflib:debug:applicationevents",
216
+ "get:debug:rflib:applicationevents",
217
+ "get:debug:applicationevents:rflib",
218
+ "rflib:get:applicationevents:debug",
219
+ "get:rflib:applicationevents:debug",
220
+ "get:applicationevents:rflib:debug",
221
+ "get:applicationevents:debug:rflib"
238
222
  ]
239
223
  },
240
- "rflib:logging:aura:instrument": {
224
+ "rflib:debug:logarchives:get": {
241
225
  "aliases": [],
242
226
  "args": {},
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",
227
+ "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",
244
228
  "examples": [
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"
229
+ "Get log archives from the last 24 hours:\n$ sf rflib debug logarchives get --target-org myOrg",
230
+ "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"
246
231
  ],
247
232
  "flags": {
248
233
  "json": {
@@ -260,129 +245,88 @@
260
245
  "multiple": false,
261
246
  "type": "option"
262
247
  },
263
- "sourcepath": {
264
- "char": "s",
265
- "description": "Path to the source directory containing Aura components that should be instrumented with RFLIB logging statements. The command will:\n- Scan for 'aura' directories recursively\n- Process all Aura components found\n- Add <c:rflibLoggerCmp> to component files\n- Add logging statements to JavaScript files\n- Initialize logger in methods using component.find()",
266
- "name": "sourcepath",
248
+ "target-org": {
249
+ "char": "o",
250
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
251
+ "name": "target-org",
252
+ "noCacheDefault": true,
267
253
  "required": true,
268
- "summary": "Directory containing Aura components to instrument with logging.",
269
- "hasDynamicHelp": false,
254
+ "summary": "Username or alias of the target org.",
255
+ "hasDynamicHelp": true,
270
256
  "multiple": false,
271
257
  "type": "option"
272
258
  },
273
- "dryrun": {
274
- "char": "d",
275
- "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes. Shows:\n- Files that would be modified\n- Number of processed files\n- Number of modified files\n- Number of formatted files",
276
- "name": "dryrun",
277
- "summary": "Preview changes without modifying files.",
278
- "allowNo": false,
279
- "type": "boolean"
280
- },
281
- "prettier": {
282
- "char": "p",
283
- "description": "When enabled, formats the modified JavaScript files using Prettier after adding logging statements. Maintains consistent code style with:\n- 120 character line width\n- 4 space indentation\n- Single quotes for strings\n- No tabs\n- No trailing commas",
284
- "name": "prettier",
285
- "summary": "Format modified files using Prettier.",
286
- "allowNo": false,
287
- "type": "boolean"
288
- },
289
- "no-if": {
290
- "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
291
- "name": "no-if",
292
- "summary": "Exclude the instrumentation of if-else statements.",
293
- "allowNo": false,
294
- "type": "boolean"
295
- },
296
- "skip-instrumented": {
297
- "description": "When provided, the command will not add log statements to any Aura component that contains the `` component.",
298
- "name": "skip-instrumented",
299
- "summary": "Skips any files where a logger is already present.",
300
- "allowNo": false,
301
- "type": "boolean"
302
- },
303
- "verbose": {
304
- "char": "v",
305
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
306
- "name": "verbose",
307
- "summary": "Enable verbose output.",
308
- "allowNo": false,
309
- "type": "boolean"
310
- },
311
- "exclude": {
312
- "char": "e",
313
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cmp\" to skip auto-generated components.",
314
- "name": "exclude",
315
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
259
+ "start-date": {
260
+ "char": "s",
261
+ "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.",
262
+ "name": "start-date",
263
+ "summary": "Start of the date range in ISO 8601 format. Defaults to 24 hours ago.",
316
264
  "hasDynamicHelp": false,
317
265
  "multiple": false,
318
266
  "type": "option"
319
267
  },
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,
268
+ "end-date": {
269
+ "char": "d",
270
+ "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.",
271
+ "name": "end-date",
272
+ "summary": "End of the date range in ISO 8601 format. Defaults to now.",
326
273
  "hasDynamicHelp": false,
327
274
  "multiple": false,
328
275
  "type": "option"
329
276
  }
330
277
  },
331
- "hasDynamicHelp": false,
278
+ "hasDynamicHelp": true,
332
279
  "hiddenAliases": [],
333
- "id": "rflib:logging:aura:instrument",
280
+ "id": "rflib:debug:logarchives:get",
334
281
  "pluginAlias": "rflib-plugin",
335
282
  "pluginName": "rflib-plugin",
336
283
  "pluginType": "core",
337
284
  "strict": true,
338
- "summary": "Instrument Aura Components with RFLIB logging statements automatically.",
285
+ "summary": "Query RFLIB log archives from a Salesforce org.",
339
286
  "enableJsonFlag": true,
340
287
  "isESM": true,
341
288
  "relativePath": [
342
289
  "lib",
343
290
  "commands",
344
291
  "rflib",
345
- "logging",
346
- "aura",
347
- "instrument.js"
292
+ "debug",
293
+ "logarchives",
294
+ "get.js"
348
295
  ],
349
296
  "aliasPermutations": [],
350
297
  "permutations": [
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"
298
+ "rflib:debug:logarchives:get",
299
+ "debug:rflib:logarchives:get",
300
+ "debug:logarchives:rflib:get",
301
+ "debug:logarchives:get:rflib",
302
+ "rflib:logarchives:debug:get",
303
+ "logarchives:rflib:debug:get",
304
+ "logarchives:debug:rflib:get",
305
+ "logarchives:debug:get:rflib",
306
+ "rflib:logarchives:get:debug",
307
+ "logarchives:rflib:get:debug",
308
+ "logarchives:get:rflib:debug",
309
+ "logarchives:get:debug:rflib",
310
+ "rflib:debug:get:logarchives",
311
+ "debug:rflib:get:logarchives",
312
+ "debug:get:rflib:logarchives",
313
+ "debug:get:logarchives:rflib",
314
+ "rflib:get:debug:logarchives",
315
+ "get:rflib:debug:logarchives",
316
+ "get:debug:rflib:logarchives",
317
+ "get:debug:logarchives:rflib",
318
+ "rflib:get:logarchives:debug",
319
+ "get:rflib:logarchives:debug",
320
+ "get:logarchives:rflib:debug",
321
+ "get:logarchives:debug:rflib"
375
322
  ]
376
323
  },
377
- "rflib:logging:flow:instrument": {
324
+ "rflib:debug:loggersettings:get": {
378
325
  "aliases": [],
379
326
  "args": {},
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.",
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",
381
328
  "examples": [
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"
329
+ "Read all logger settings from the target org:\n$ sf rflib debug loggersettings get --target-org myOrg"
386
330
  ],
387
331
  "flags": {
388
332
  "json": {
@@ -402,7 +346,7 @@
402
346
  },
403
347
  "target-org": {
404
348
  "char": "o",
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.",
349
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
406
350
  "name": "target-org",
407
351
  "noCacheDefault": true,
408
352
  "required": true,
@@ -410,119 +354,61 @@
410
354
  "hasDynamicHelp": true,
411
355
  "multiple": false,
412
356
  "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"
472
357
  }
473
358
  },
474
359
  "hasDynamicHelp": true,
475
360
  "hiddenAliases": [],
476
- "id": "rflib:logging:flow:instrument",
361
+ "id": "rflib:debug:loggersettings:get",
477
362
  "pluginAlias": "rflib-plugin",
478
363
  "pluginName": "rflib-plugin",
479
364
  "pluginType": "core",
480
365
  "strict": true,
481
- "summary": "Adds RFLIB logging statements to Salesforce Flows.",
366
+ "summary": "Read all RFLIB Logger Settings from a Salesforce org.",
482
367
  "enableJsonFlag": true,
483
368
  "isESM": true,
484
369
  "relativePath": [
485
370
  "lib",
486
371
  "commands",
487
372
  "rflib",
488
- "logging",
489
- "flow",
490
- "instrument.js"
373
+ "debug",
374
+ "loggersettings",
375
+ "get.js"
491
376
  ],
492
377
  "aliasPermutations": [],
493
378
  "permutations": [
494
- "rflib:logging:flow:instrument",
495
- "logging:rflib:flow:instrument",
496
- "logging:flow:rflib:instrument",
497
- "logging:flow:instrument:rflib",
498
- "rflib:flow:logging:instrument",
499
- "flow:rflib:logging:instrument",
500
- "flow:logging:rflib:instrument",
501
- "flow:logging:instrument:rflib",
502
- "rflib:flow:instrument:logging",
503
- "flow:rflib:instrument:logging",
504
- "flow:instrument:rflib:logging",
505
- "flow:instrument:logging:rflib",
506
- "rflib:logging:instrument:flow",
507
- "logging:rflib:instrument:flow",
508
- "logging:instrument:rflib:flow",
509
- "logging:instrument:flow:rflib",
510
- "rflib:instrument:logging:flow",
511
- "instrument:rflib:logging:flow",
512
- "instrument:logging:rflib:flow",
513
- "instrument:logging:flow:rflib",
514
- "rflib:instrument:flow:logging",
515
- "instrument:rflib:flow:logging",
516
- "instrument:flow:rflib:logging",
517
- "instrument:flow:logging:rflib"
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"
518
403
  ]
519
404
  },
520
- "rflib:logging:lwc:instrument": {
405
+ "rflib:debug:loggersettings:update": {
521
406
  "aliases": [],
522
407
  "args": {},
523
- "description": "Analyzes Lightning Web Component JavaScript files and adds RFLIB logging statements for:\n- Method entry logging with parameter values\n- Error logging in try-catch blocks\n- Error logging in Promise catch handlers\n- Condition logging in if/else blocks\n- Adds logger import if not present\n- Adds logger initialization if not present\n- Replaces console.log and similar method invocations\n- Formats modified files using Prettier (optional)",
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",
524
409
  "examples": [
525
- "- Add logging to all LWC files:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc\n\n- Preview changes:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --dryrun\n\n- Add logging and format code:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --prettier\n\n- Process specific component:\n$ sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc/myComponent"
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"
526
412
  ],
527
413
  "flags": {
528
414
  "json": {
@@ -540,128 +426,109 @@
540
426
  "multiple": false,
541
427
  "type": "option"
542
428
  },
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",
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,
547
434
  "required": true,
548
- "summary": "Directory containing LWC JavaScript files to instrument with logging.",
549
- "hasDynamicHelp": false,
435
+ "summary": "Username or alias of the target org.",
436
+ "hasDynamicHelp": true,
550
437
  "multiple": false,
551
438
  "type": "option"
552
439
  },
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"
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",
444
+ "required": true,
445
+ "summary": "API name of the rflib_Logger_Settings__c field to update.",
446
+ "hasDynamicHelp": false,
447
+ "multiple": false,
448
+ "type": "option"
582
449
  },
583
- "verbose": {
450
+ "field-value": {
584
451
  "char": "v",
585
- "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
586
- "name": "verbose",
587
- "summary": "Enable verbose output.",
588
- "allowNo": false,
589
- "type": "boolean"
590
- },
591
- "exclude": {
592
- "char": "e",
593
- "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.js\" to skip auto-generated components.",
594
- "name": "exclude",
595
- "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
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.",
596
456
  "hasDynamicHelp": false,
597
457
  "multiple": false,
598
458
  "type": "option"
599
459
  },
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,
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.",
606
474
  "hasDynamicHelp": false,
607
475
  "multiple": false,
608
476
  "type": "option"
609
477
  }
610
478
  },
611
- "hasDynamicHelp": false,
479
+ "hasDynamicHelp": true,
612
480
  "hiddenAliases": [],
613
- "id": "rflib:logging:lwc:instrument",
481
+ "id": "rflib:debug:loggersettings:update",
614
482
  "pluginAlias": "rflib-plugin",
615
483
  "pluginName": "rflib-plugin",
616
484
  "pluginType": "core",
617
485
  "strict": true,
618
- "summary": "Instrument Lightning Web Components with RFLIB logging statements automatically.",
486
+ "summary": "Create or update an RFLIB Logger Setting in a Salesforce org.",
619
487
  "enableJsonFlag": true,
620
488
  "isESM": true,
621
489
  "relativePath": [
622
490
  "lib",
623
491
  "commands",
624
492
  "rflib",
625
- "logging",
626
- "lwc",
627
- "instrument.js"
493
+ "debug",
494
+ "loggersettings",
495
+ "update.js"
628
496
  ],
629
497
  "aliasPermutations": [],
630
498
  "permutations": [
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"
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"
655
523
  ]
656
524
  },
657
- "rflib:debug:applicationevents:get": {
525
+ "rflib:debug:recordaccess:get": {
658
526
  "aliases": [],
659
527
  "args": {},
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",
528
+ "description": "Answers questions such as \"Why can't this user see this record?\". For each record, the command returns the user's access from UserRecordAccess (read, edit, delete, transfer, and full access), which includes sharing: the org-wide default, the role hierarchy, sharing rules, teams, and manual shares.\n\nThe result also contains the user's object permissions on each record's object, and notes that tell apart missing object permissions from missing sharing. Use userpermissions check to find out which profile or permission set grants an object permission.\n\nYou can check up to 200 records at a time.\n\nThe command only reads standard objects, so the RFLIB package doesn't need to be installed.",
661
529
  "examples": [
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"
530
+ "Check a user's access to a record:\n$ sf rflib debug recordaccess get --target-org myOrg --user jane@example.com --record-id 001XXXXXXXXXXXXXXX",
531
+ "Check several records at once:\n$ sf rflib debug recordaccess get --target-org myOrg --user 0057000000XXXXXX --record-id 001XXXXXXXXXXXXXXX --record-id 006XXXXXXXXXXXXXXX"
665
532
  ],
666
533
  "flags": {
667
534
  "json": {
@@ -681,7 +548,7 @@
681
548
  },
682
549
  "target-org": {
683
550
  "char": "o",
684
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
551
+ "description": "The username or alias of the Salesforce org that contains the records.",
685
552
  "name": "target-org",
686
553
  "noCacheDefault": true,
687
554
  "required": true,
@@ -690,60 +557,35 @@
690
557
  "multiple": false,
691
558
  "type": "option"
692
559
  },
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.",
698
- "hasDynamicHelp": false,
699
- "multiple": false,
700
- "type": "option"
701
- },
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.",
707
- "hasDynamicHelp": false,
708
- "multiple": false,
709
- "type": "option"
710
- },
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.",
560
+ "user": {
561
+ "char": "u",
562
+ "description": "The Salesforce User ID (15 or 18 characters) or the username of the user whose record access should be checked.",
563
+ "name": "user",
564
+ "required": true,
565
+ "summary": "User ID (15 or 18 characters) or username of the user to check.",
716
566
  "hasDynamicHelp": false,
717
567
  "multiple": false,
718
568
  "type": "option"
719
569
  },
720
- "related-record-id": {
570
+ "record-id": {
721
571
  "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).",
572
+ "description": "The 15 or 18 character ID of a record to check. Specify --record-id up to 200 times.",
573
+ "name": "record-id",
574
+ "required": true,
575
+ "summary": "ID of a record to check. Specify the flag multiple times to check several records.",
734
576
  "hasDynamicHelp": false,
735
- "multiple": false,
577
+ "multiple": true,
736
578
  "type": "option"
737
579
  }
738
580
  },
739
581
  "hasDynamicHelp": true,
740
582
  "hiddenAliases": [],
741
- "id": "rflib:debug:applicationevents:get",
583
+ "id": "rflib:debug:recordaccess:get",
742
584
  "pluginAlias": "rflib-plugin",
743
585
  "pluginName": "rflib-plugin",
744
586
  "pluginType": "core",
745
587
  "strict": true,
746
- "summary": "Query RFLIB Application Events from a Salesforce org.",
588
+ "summary": "Check a user's access to specific records, including sharing.",
747
589
  "enableJsonFlag": true,
748
590
  "isESM": true,
749
591
  "relativePath": [
@@ -751,44 +593,47 @@
751
593
  "commands",
752
594
  "rflib",
753
595
  "debug",
754
- "applicationevents",
596
+ "recordaccess",
755
597
  "get.js"
756
598
  ],
757
599
  "aliasPermutations": [],
758
600
  "permutations": [
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"
601
+ "rflib:debug:recordaccess:get",
602
+ "debug:rflib:recordaccess:get",
603
+ "debug:recordaccess:rflib:get",
604
+ "debug:recordaccess:get:rflib",
605
+ "rflib:recordaccess:debug:get",
606
+ "recordaccess:rflib:debug:get",
607
+ "recordaccess:debug:rflib:get",
608
+ "recordaccess:debug:get:rflib",
609
+ "rflib:recordaccess:get:debug",
610
+ "recordaccess:rflib:get:debug",
611
+ "recordaccess:get:rflib:debug",
612
+ "recordaccess:get:debug:rflib",
613
+ "rflib:debug:get:recordaccess",
614
+ "debug:rflib:get:recordaccess",
615
+ "debug:get:rflib:recordaccess",
616
+ "debug:get:recordaccess:rflib",
617
+ "rflib:get:debug:recordaccess",
618
+ "get:rflib:debug:recordaccess",
619
+ "get:debug:rflib:recordaccess",
620
+ "get:debug:recordaccess:rflib",
621
+ "rflib:get:recordaccess:debug",
622
+ "get:rflib:recordaccess:debug",
623
+ "get:recordaccess:rflib:debug",
624
+ "get:recordaccess:debug:rflib"
783
625
  ]
784
626
  },
785
- "rflib:debug:logarchives:get": {
627
+ "rflib:debug:userpermissions:check": {
786
628
  "aliases": [],
787
629
  "args": {},
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",
630
+ "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.",
789
631
  "examples": [
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"
632
+ "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",
633
+ "Check whether a user can delete Opportunity records:\n$ sf rflib debug userpermissions check --target-org myOrg --user 0057000000XXXXXX --object Opportunity --access delete",
634
+ "Check access to an Apex class:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --apex-class OrderController",
635
+ "Check a custom permission:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --custom-permission Approve_Discounts",
636
+ "Check a system permission:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --system-permission ModifyAllData"
792
637
  ],
793
638
  "flags": {
794
639
  "json": {
@@ -808,7 +653,7 @@
808
653
  },
809
654
  "target-org": {
810
655
  "char": "o",
811
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
656
+ "description": "The username or alias of the Salesforce org to check the permission in.",
812
657
  "name": "target-org",
813
658
  "noCacheDefault": true,
814
659
  "required": true,
@@ -817,114 +662,93 @@
817
662
  "multiple": false,
818
663
  "type": "option"
819
664
  },
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.",
665
+ "user": {
666
+ "char": "u",
667
+ "description": "The Salesforce User ID (15 or 18 characters) or the username of the user whose permission should be checked.",
668
+ "name": "user",
669
+ "required": true,
670
+ "summary": "User ID (15 or 18 characters) or username of the user to check.",
825
671
  "hasDynamicHelp": false,
826
672
  "multiple": false,
827
673
  "type": "option"
828
674
  },
829
- "end-date": {
830
- "char": "d",
831
- "description": "Only return log archives created on or before this date. Must be in ISO 8601 format, e.g. 2024-12-31T23:59:59Z. Defaults to the current time if omitted.",
832
- "name": "end-date",
833
- "summary": "End of the date range in ISO 8601 format. Defaults to now.",
675
+ "object": {
676
+ "char": "b",
677
+ "description": "Checks an object permission. Use --access to choose which one; the default is read.",
678
+ "name": "object",
679
+ "summary": "API name of the object to check object permissions for, e.g. Account.",
834
680
  "hasDynamicHelp": false,
835
681
  "multiple": false,
836
682
  "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",
897
- "allowNo": false,
898
- "type": "boolean"
899
683
  },
900
- "flags-dir": {
901
- "helpGroup": "GLOBAL",
902
- "name": "flags-dir",
903
- "summary": "Import flag values from a directory.",
684
+ "field": {
685
+ "char": "f",
686
+ "description": "Checks field-level security for a field. Use --access read (default) or --access edit.",
687
+ "name": "field",
688
+ "summary": "Field to check field-level security for, in the form Object.Field, e.g. Account.AnnualRevenue.",
904
689
  "hasDynamicHelp": false,
905
690
  "multiple": false,
906
691
  "type": "option"
907
692
  },
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,
693
+ "access": {
694
+ "char": "a",
695
+ "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",
696
+ "name": "access",
697
+ "summary": "Access level to check for --object or --field. Default: read.",
698
+ "hasDynamicHelp": false,
699
+ "multiple": false,
700
+ "options": [
701
+ "read",
702
+ "create",
703
+ "edit",
704
+ "delete",
705
+ "viewall",
706
+ "modifyall",
707
+ "viewallfields"
708
+ ],
709
+ "type": "option"
710
+ },
711
+ "apex-class": {
712
+ "description": "Checks whether the user can access an Apex class. Use namespace__Name or namespace.Name for a class in a managed package.",
713
+ "name": "apex-class",
714
+ "summary": "Name of the Apex class to check access for.",
715
+ "hasDynamicHelp": false,
716
+ "multiple": false,
717
+ "type": "option"
718
+ },
719
+ "apex-page": {
720
+ "description": "Checks whether the user can access a Visualforce page. Use namespace__Name for a page in a managed package.",
721
+ "name": "apex-page",
722
+ "summary": "Name of the Visualforce page to check access for.",
723
+ "hasDynamicHelp": false,
724
+ "multiple": false,
725
+ "type": "option"
726
+ },
727
+ "custom-permission": {
728
+ "description": "Checks whether the user has a custom permission. Use namespace__Name for a custom permission in a managed package.",
729
+ "name": "custom-permission",
730
+ "summary": "API name of the custom permission to check.",
731
+ "hasDynamicHelp": false,
732
+ "multiple": false,
733
+ "type": "option"
734
+ },
735
+ "system-permission": {
736
+ "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.",
737
+ "name": "system-permission",
738
+ "summary": "API name of the system permission to check, e.g. ModifyAllData or ViewSetup.",
739
+ "hasDynamicHelp": false,
916
740
  "multiple": false,
917
741
  "type": "option"
918
742
  }
919
743
  },
920
744
  "hasDynamicHelp": true,
921
745
  "hiddenAliases": [],
922
- "id": "rflib:debug:loggersettings:get",
746
+ "id": "rflib:debug:userpermissions:check",
923
747
  "pluginAlias": "rflib-plugin",
924
748
  "pluginName": "rflib-plugin",
925
749
  "pluginType": "core",
926
750
  "strict": true,
927
- "summary": "Read all RFLIB Logger Settings from a Salesforce org.",
751
+ "summary": "Check whether a user has a specific permission, and where it comes from.",
928
752
  "enableJsonFlag": true,
929
753
  "isESM": true,
930
754
  "relativePath": [
@@ -932,44 +756,44 @@
932
756
  "commands",
933
757
  "rflib",
934
758
  "debug",
935
- "loggersettings",
936
- "get.js"
759
+ "userpermissions",
760
+ "check.js"
937
761
  ],
938
762
  "aliasPermutations": [],
939
763
  "permutations": [
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"
764
+ "rflib:debug:userpermissions:check",
765
+ "debug:rflib:userpermissions:check",
766
+ "debug:userpermissions:rflib:check",
767
+ "debug:userpermissions:check:rflib",
768
+ "rflib:userpermissions:debug:check",
769
+ "userpermissions:rflib:debug:check",
770
+ "userpermissions:debug:rflib:check",
771
+ "userpermissions:debug:check:rflib",
772
+ "rflib:userpermissions:check:debug",
773
+ "userpermissions:rflib:check:debug",
774
+ "userpermissions:check:rflib:debug",
775
+ "userpermissions:check:debug:rflib",
776
+ "rflib:debug:check:userpermissions",
777
+ "debug:rflib:check:userpermissions",
778
+ "debug:check:rflib:userpermissions",
779
+ "debug:check:userpermissions:rflib",
780
+ "rflib:check:debug:userpermissions",
781
+ "check:rflib:debug:userpermissions",
782
+ "check:debug:rflib:userpermissions",
783
+ "check:debug:userpermissions:rflib",
784
+ "rflib:check:userpermissions:debug",
785
+ "check:rflib:userpermissions:debug",
786
+ "check:userpermissions:rflib:debug",
787
+ "check:userpermissions:debug:rflib"
964
788
  ]
965
789
  },
966
- "rflib:debug:loggersettings:update": {
790
+ "rflib:debug:userpermissions:compare": {
967
791
  "aliases": [],
968
792
  "args": {},
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",
793
+ "description": "Finds out why something works for one user but not for another. The command combines each user's permissions across their profile, permission sets, and permission set groups, and returns only the permissions that one of the users has and the other doesn't.\n\nUse --permission-type to choose what to compare (default: ALL) and --sobject-type to limit the object and field comparison to one object. ALL compares object and field access, Apex classes, Visualforce pages, custom permissions, and system permissions.\n\nField access only counts where the user also has the matching access on the object. Sharing and record-level access aren't compared.\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.",
970
794
  "examples": [
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"
795
+ "Compare all permissions of two users:\n$ sf rflib debug userpermissions compare --target-org myOrg --user jane@example.com --other-user bob@example.com",
796
+ "Compare object and field access on Account:\n$ sf rflib debug userpermissions compare --target-org myOrg --user jane@example.com --other-user bob@example.com --permission-type FLS --sobject-type Account"
973
797
  ],
974
798
  "flags": {
975
799
  "json": {
@@ -989,7 +813,7 @@
989
813
  },
990
814
  "target-org": {
991
815
  "char": "o",
992
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
816
+ "description": "The username or alias of the Salesforce org to compare the users in.",
993
817
  "name": "target-org",
994
818
  "noCacheDefault": true,
995
819
  "required": true,
@@ -998,40 +822,47 @@
998
822
  "multiple": false,
999
823
  "type": "option"
1000
824
  },
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",
825
+ "user": {
826
+ "char": "u",
827
+ "description": "The first user to compare, typically the user for whom something doesn't work.",
828
+ "name": "user",
1005
829
  "required": true,
1006
- "summary": "API name of the rflib_Logger_Settings__c field to update.",
830
+ "summary": "User ID (15 or 18 characters) or username of the first user.",
1007
831
  "hasDynamicHelp": false,
1008
832
  "multiple": false,
1009
833
  "type": "option"
1010
834
  },
1011
- "field-value": {
1012
- "char": "v",
1013
- "description": "The new value to set on the specified field. For log level fields, valid values are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, NONE.",
1014
- "name": "field-value",
835
+ "other-user": {
836
+ "char": "w",
837
+ "description": "The second user to compare, typically the user for whom it works.",
838
+ "name": "other-user",
1015
839
  "required": true,
1016
- "summary": "New value for the specified field.",
840
+ "summary": "User ID (15 or 18 characters) or username of the second user.",
1017
841
  "hasDynamicHelp": false,
1018
842
  "multiple": false,
1019
843
  "type": "option"
1020
844
  },
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.",
845
+ "permission-type": {
846
+ "char": "t",
847
+ "description": "Controls which permissions are compared:\n - FLS: Field access\n - OLS: Object access\n - APEX: Apex class and Visualforce page access\n - ALL: All of the above, plus custom permissions and system permissions",
848
+ "name": "permission-type",
849
+ "summary": "Permissions to compare: FLS, OLS, APEX, or ALL. Default: ALL.",
850
+ "default": "ALL",
1026
851
  "hasDynamicHelp": false,
1027
852
  "multiple": false,
853
+ "options": [
854
+ "FLS",
855
+ "OLS",
856
+ "APEX",
857
+ "ALL"
858
+ ],
1028
859
  "type": "option"
1029
860
  },
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.",
861
+ "sobject-type": {
862
+ "char": "b",
863
+ "description": "Limits the object and field comparison to one SObject type, e.g. Account. Recommended in large orgs, where the full field comparison can reach the query row limit.",
864
+ "name": "sobject-type",
865
+ "summary": "Optional SObject API name to limit the object and field comparison to.",
1035
866
  "hasDynamicHelp": false,
1036
867
  "multiple": false,
1037
868
  "type": "option"
@@ -1039,12 +870,12 @@
1039
870
  },
1040
871
  "hasDynamicHelp": true,
1041
872
  "hiddenAliases": [],
1042
- "id": "rflib:debug:loggersettings:update",
873
+ "id": "rflib:debug:userpermissions:compare",
1043
874
  "pluginAlias": "rflib-plugin",
1044
875
  "pluginName": "rflib-plugin",
1045
876
  "pluginType": "core",
1046
877
  "strict": true,
1047
- "summary": "Create or update an RFLIB Logger Setting in a Salesforce org.",
878
+ "summary": "Compare the permissions of two users and show only the differences.",
1048
879
  "enableJsonFlag": true,
1049
880
  "isESM": true,
1050
881
  "relativePath": [
@@ -1052,50 +883,52 @@
1052
883
  "commands",
1053
884
  "rflib",
1054
885
  "debug",
1055
- "loggersettings",
1056
- "update.js"
886
+ "userpermissions",
887
+ "compare.js"
1057
888
  ],
1058
889
  "aliasPermutations": [],
1059
890
  "permutations": [
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"
1084
- ]
1085
- },
1086
- "rflib:debug:recordaccess:get": {
1087
- "aliases": [],
1088
- "args": {},
1089
- "description": "Answers questions such as \"Why can't this user see this record?\". For each record, the command returns the user's access from UserRecordAccess (read, edit, delete, transfer, and full access), which includes sharing: the org-wide default, the role hierarchy, sharing rules, teams, and manual shares.\n\nThe result also contains the user's object permissions on each record's object, and notes that tell apart missing object permissions from missing sharing. Use userpermissions check to find out which profile or permission set grants an object permission.\n\nYou can check up to 200 records at a time.\n\nThe command only reads standard objects, so the RFLIB package doesn't need to be installed.",
1090
- "examples": [
1091
- "Check a user's access to a record:\n$ sf rflib debug recordaccess get --target-org myOrg --user jane@example.com --record-id 001XXXXXXXXXXXXXXX",
1092
- "Check several records at once:\n$ sf rflib debug recordaccess get --target-org myOrg --user 0057000000XXXXXX --record-id 001XXXXXXXXXXXXXXX --record-id 006XXXXXXXXXXXXXXX"
1093
- ],
1094
- "flags": {
1095
- "json": {
1096
- "description": "Format output as json.",
1097
- "helpGroup": "GLOBAL",
1098
- "name": "json",
891
+ "rflib:debug:userpermissions:compare",
892
+ "debug:rflib:userpermissions:compare",
893
+ "debug:userpermissions:rflib:compare",
894
+ "debug:userpermissions:compare:rflib",
895
+ "rflib:userpermissions:debug:compare",
896
+ "userpermissions:rflib:debug:compare",
897
+ "userpermissions:debug:rflib:compare",
898
+ "userpermissions:debug:compare:rflib",
899
+ "rflib:userpermissions:compare:debug",
900
+ "userpermissions:rflib:compare:debug",
901
+ "userpermissions:compare:rflib:debug",
902
+ "userpermissions:compare:debug:rflib",
903
+ "rflib:debug:compare:userpermissions",
904
+ "debug:rflib:compare:userpermissions",
905
+ "debug:compare:rflib:userpermissions",
906
+ "debug:compare:userpermissions:rflib",
907
+ "rflib:compare:debug:userpermissions",
908
+ "compare:rflib:debug:userpermissions",
909
+ "compare:debug:rflib:userpermissions",
910
+ "compare:debug:userpermissions:rflib",
911
+ "rflib:compare:userpermissions:debug",
912
+ "compare:rflib:userpermissions:debug",
913
+ "compare:userpermissions:rflib:debug",
914
+ "compare:userpermissions:debug:rflib"
915
+ ]
916
+ },
917
+ "rflib:debug:userpermissions:get": {
918
+ "aliases": [],
919
+ "args": {},
920
+ "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\nUse --effective to get the user's combined permissions instead of the raw permission records: one entry per object with its access levels, one entry per field with read and edit (only where the user also has that access on the object), and the names of the accessible Apex classes and Visualforce pages. With --permission-type ALL, the result also lists the user's custom permissions and system permissions.\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",
921
+ "examples": [
922
+ "Check all permissions for a user:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type ALL",
923
+ "Check FLS for a specific object:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type FLS --sobject-type Account",
924
+ "Check Apex access:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type APEX",
925
+ "Get the combined permissions of a user, including custom and system permissions:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type ALL --effective"
926
+ ],
927
+ "flags": {
928
+ "json": {
929
+ "description": "Format output as json.",
930
+ "helpGroup": "GLOBAL",
931
+ "name": "json",
1099
932
  "allowNo": false,
1100
933
  "type": "boolean"
1101
934
  },
@@ -1109,7 +942,7 @@
1109
942
  },
1110
943
  "target-org": {
1111
944
  "char": "o",
1112
- "description": "The username or alias of the Salesforce org that contains the records.",
945
+ "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
1113
946
  "name": "target-org",
1114
947
  "noCacheDefault": true,
1115
948
  "required": true,
@@ -1118,35 +951,58 @@
1118
951
  "multiple": false,
1119
952
  "type": "option"
1120
953
  },
1121
- "user": {
954
+ "user-id": {
1122
955
  "char": "u",
1123
- "description": "The Salesforce User ID (15 or 18 characters) or the username of the user whose record access should be checked.",
1124
- "name": "user",
956
+ "description": "The Salesforce User ID (15 or 18 characters) of the user whose permissions should be retrieved.",
957
+ "name": "user-id",
1125
958
  "required": true,
1126
- "summary": "User ID (15 or 18 characters) or username of the user to check.",
959
+ "summary": "Salesforce User ID (15 or 18 character) to check permissions for.",
1127
960
  "hasDynamicHelp": false,
1128
961
  "multiple": false,
1129
962
  "type": "option"
1130
963
  },
1131
- "record-id": {
1132
- "char": "r",
1133
- "description": "The 15 or 18 character ID of a record to check. Specify --record-id up to 200 times.",
1134
- "name": "record-id",
964
+ "permission-type": {
965
+ "char": "t",
966
+ "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",
967
+ "name": "permission-type",
1135
968
  "required": true,
1136
- "summary": "ID of a record to check. Specify the flag multiple times to check several records.",
969
+ "summary": "Type of permissions to retrieve: FLS, OLS, APEX, or ALL.",
1137
970
  "hasDynamicHelp": false,
1138
- "multiple": true,
971
+ "multiple": false,
972
+ "options": [
973
+ "FLS",
974
+ "OLS",
975
+ "APEX",
976
+ "ALL"
977
+ ],
978
+ "type": "option"
979
+ },
980
+ "sobject-type": {
981
+ "char": "b",
982
+ "description": "Filters Field-Level Security or Object-Level Security results to a specific SObject type, e.g. Account, Contact, Opportunity.",
983
+ "name": "sobject-type",
984
+ "summary": "Optional SObject API name to filter FLS or OLS results.",
985
+ "hasDynamicHelp": false,
986
+ "multiple": false,
1139
987
  "type": "option"
988
+ },
989
+ "effective": {
990
+ "char": "e",
991
+ "description": "Merges the permissions from the profile, permission sets, and permission set groups. Objects list their access levels (read, create, edit, delete, viewall, modifyall, viewallfields), fields list read and edit, and Apex classes, Visualforce pages, and custom permissions are listed by name. System permissions are included for --permission-type ALL. With --effective, --user-id also accepts a username.",
992
+ "name": "effective",
993
+ "summary": "Return the user's combined permissions instead of the raw permission records.",
994
+ "allowNo": false,
995
+ "type": "boolean"
1140
996
  }
1141
997
  },
1142
998
  "hasDynamicHelp": true,
1143
999
  "hiddenAliases": [],
1144
- "id": "rflib:debug:recordaccess:get",
1000
+ "id": "rflib:debug:userpermissions:get",
1145
1001
  "pluginAlias": "rflib-plugin",
1146
1002
  "pluginName": "rflib-plugin",
1147
1003
  "pluginType": "core",
1148
1004
  "strict": true,
1149
- "summary": "Check a user's access to specific records, including sharing.",
1005
+ "summary": "Check Salesforce permissions for a user in the target org.",
1150
1006
  "enableJsonFlag": true,
1151
1007
  "isESM": true,
1152
1008
  "relativePath": [
@@ -1154,47 +1010,45 @@
1154
1010
  "commands",
1155
1011
  "rflib",
1156
1012
  "debug",
1157
- "recordaccess",
1013
+ "userpermissions",
1158
1014
  "get.js"
1159
1015
  ],
1160
1016
  "aliasPermutations": [],
1161
1017
  "permutations": [
1162
- "rflib:debug:recordaccess:get",
1163
- "debug:rflib:recordaccess:get",
1164
- "debug:recordaccess:rflib:get",
1165
- "debug:recordaccess:get:rflib",
1166
- "rflib:recordaccess:debug:get",
1167
- "recordaccess:rflib:debug:get",
1168
- "recordaccess:debug:rflib:get",
1169
- "recordaccess:debug:get:rflib",
1170
- "rflib:recordaccess:get:debug",
1171
- "recordaccess:rflib:get:debug",
1172
- "recordaccess:get:rflib:debug",
1173
- "recordaccess:get:debug:rflib",
1174
- "rflib:debug:get:recordaccess",
1175
- "debug:rflib:get:recordaccess",
1176
- "debug:get:rflib:recordaccess",
1177
- "debug:get:recordaccess:rflib",
1178
- "rflib:get:debug:recordaccess",
1179
- "get:rflib:debug:recordaccess",
1180
- "get:debug:rflib:recordaccess",
1181
- "get:debug:recordaccess:rflib",
1182
- "rflib:get:recordaccess:debug",
1183
- "get:rflib:recordaccess:debug",
1184
- "get:recordaccess:rflib:debug",
1185
- "get:recordaccess:debug:rflib"
1018
+ "rflib:debug:userpermissions:get",
1019
+ "debug:rflib:userpermissions:get",
1020
+ "debug:userpermissions:rflib:get",
1021
+ "debug:userpermissions:get:rflib",
1022
+ "rflib:userpermissions:debug:get",
1023
+ "userpermissions:rflib:debug:get",
1024
+ "userpermissions:debug:rflib:get",
1025
+ "userpermissions:debug:get:rflib",
1026
+ "rflib:userpermissions:get:debug",
1027
+ "userpermissions:rflib:get:debug",
1028
+ "userpermissions:get:rflib:debug",
1029
+ "userpermissions:get:debug:rflib",
1030
+ "rflib:debug:get:userpermissions",
1031
+ "debug:rflib:get:userpermissions",
1032
+ "debug:get:rflib:userpermissions",
1033
+ "debug:get:userpermissions:rflib",
1034
+ "rflib:get:debug:userpermissions",
1035
+ "get:rflib:debug:userpermissions",
1036
+ "get:debug:rflib:userpermissions",
1037
+ "get:debug:userpermissions:rflib",
1038
+ "rflib:get:userpermissions:debug",
1039
+ "get:rflib:userpermissions:debug",
1040
+ "get:userpermissions:rflib:debug",
1041
+ "get:userpermissions:debug:rflib"
1186
1042
  ]
1187
1043
  },
1188
- "rflib:debug:userpermissions:check": {
1044
+ "rflib:debug:userpermissions:whohas": {
1189
1045
  "aliases": [],
1190
1046
  "args": {},
1191
- "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.",
1047
+ "description": "The reverse of userpermissions check. Answers questions such as \"Who can edit Account.AnnualRevenue?\" or \"Who has Modify All Data?\". The command finds every profile, permission set, and permission set group that grants the permission, and the users who are assigned to them.\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\nThe same permission rules as userpermissions check apply: for field checks, only users who also have the matching access on the object are included, and View All Fields grants Read on all fields. Apex class and Visualforce page checks include access granted by the Author Apex and Customize Application system permissions.\n\nInactive users are excluded unless you specify --include-inactive. The result lists up to --user-limit users; the total count is always returned.\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.",
1192
1048
  "examples": [
1193
- "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",
1194
- "Check whether a user can delete Opportunity records:\n$ sf rflib debug userpermissions check --target-org myOrg --user 0057000000XXXXXX --object Opportunity --access delete",
1195
- "Check access to an Apex class:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --apex-class OrderController",
1196
- "Check a custom permission:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --custom-permission Approve_Discounts",
1197
- "Check a system permission:\n$ sf rflib debug userpermissions check --target-org myOrg --user jane@example.com --system-permission ModifyAllData"
1049
+ "Find the users who can edit a field:\n$ sf rflib debug userpermissions whohas --target-org myOrg --field Account.AnnualRevenue --access edit",
1050
+ "Find the users who have Modify All Data:\n$ sf rflib debug userpermissions whohas --target-org myOrg --system-permission ModifyAllData",
1051
+ "Find the users who can access an Apex class, including inactive users:\n$ sf rflib debug userpermissions whohas --target-org myOrg --apex-class OrderController --include-inactive"
1198
1052
  ],
1199
1053
  "flags": {
1200
1054
  "json": {
@@ -1214,7 +1068,7 @@
1214
1068
  },
1215
1069
  "target-org": {
1216
1070
  "char": "o",
1217
- "description": "The username or alias of the Salesforce org to check the permission in.",
1071
+ "description": "The username or alias of the Salesforce org to search.",
1218
1072
  "name": "target-org",
1219
1073
  "noCacheDefault": true,
1220
1074
  "required": true,
@@ -1223,19 +1077,9 @@
1223
1077
  "multiple": false,
1224
1078
  "type": "option"
1225
1079
  },
1226
- "user": {
1227
- "char": "u",
1228
- "description": "The Salesforce User ID (15 or 18 characters) or the username of the user whose permission should be checked.",
1229
- "name": "user",
1230
- "required": true,
1231
- "summary": "User ID (15 or 18 characters) or username of the user to check.",
1232
- "hasDynamicHelp": false,
1233
- "multiple": false,
1234
- "type": "option"
1235
- },
1236
1080
  "object": {
1237
1081
  "char": "b",
1238
- "description": "Checks an object permission. Use --access to choose which one; the default is read.",
1082
+ "description": "Finds users with an object permission. Use --access to choose which one; the default is read.",
1239
1083
  "name": "object",
1240
1084
  "summary": "API name of the object to check object permissions for, e.g. Account.",
1241
1085
  "hasDynamicHelp": false,
@@ -1244,7 +1088,7 @@
1244
1088
  },
1245
1089
  "field": {
1246
1090
  "char": "f",
1247
- "description": "Checks field-level security for a field. Use --access read (default) or --access edit.",
1091
+ "description": "Finds users with access to a field. Use --access read (default) or --access edit.",
1248
1092
  "name": "field",
1249
1093
  "summary": "Field to check field-level security for, in the form Object.Field, e.g. Account.AnnualRevenue.",
1250
1094
  "hasDynamicHelp": false,
@@ -1270,7 +1114,7 @@
1270
1114
  "type": "option"
1271
1115
  },
1272
1116
  "apex-class": {
1273
- "description": "Checks whether the user can access an Apex class. Use namespace__Name or namespace.Name for a class in a managed package.",
1117
+ "description": "Finds users who can access an Apex class. Use namespace__Name or namespace.Name for a class in a managed package.",
1274
1118
  "name": "apex-class",
1275
1119
  "summary": "Name of the Apex class to check access for.",
1276
1120
  "hasDynamicHelp": false,
@@ -1278,7 +1122,7 @@
1278
1122
  "type": "option"
1279
1123
  },
1280
1124
  "apex-page": {
1281
- "description": "Checks whether the user can access a Visualforce page. Use namespace__Name for a page in a managed package.",
1125
+ "description": "Finds users who can access a Visualforce page. Use namespace__Name for a page in a managed package.",
1282
1126
  "name": "apex-page",
1283
1127
  "summary": "Name of the Visualforce page to check access for.",
1284
1128
  "hasDynamicHelp": false,
@@ -1286,7 +1130,7 @@
1286
1130
  "type": "option"
1287
1131
  },
1288
1132
  "custom-permission": {
1289
- "description": "Checks whether the user has a custom permission. Use namespace__Name for a custom permission in a managed package.",
1133
+ "description": "Finds users who have a custom permission. Use namespace__Name for a custom permission in a managed package.",
1290
1134
  "name": "custom-permission",
1291
1135
  "summary": "API name of the custom permission to check.",
1292
1136
  "hasDynamicHelp": false,
@@ -1294,22 +1138,39 @@
1294
1138
  "type": "option"
1295
1139
  },
1296
1140
  "system-permission": {
1297
- "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.",
1141
+ "description": "Finds users who have a system (user) permission. Use the name of the permission field on the PermissionSet object, with or without the \"Permissions\" prefix.",
1298
1142
  "name": "system-permission",
1299
1143
  "summary": "API name of the system permission to check, e.g. ModifyAllData or ViewSetup.",
1300
1144
  "hasDynamicHelp": false,
1301
1145
  "multiple": false,
1302
1146
  "type": "option"
1147
+ },
1148
+ "include-inactive": {
1149
+ "description": "By default, only active users are returned. Specify this flag to include inactive users as well.",
1150
+ "name": "include-inactive",
1151
+ "summary": "Include inactive users.",
1152
+ "allowNo": false,
1153
+ "type": "boolean"
1154
+ },
1155
+ "user-limit": {
1156
+ "char": "l",
1157
+ "description": "Limits the number of users in the result. The total number of matching users is always returned in userCount.",
1158
+ "name": "user-limit",
1159
+ "summary": "Maximum number of users to return. Default: 200, maximum: 2000.",
1160
+ "default": 200,
1161
+ "hasDynamicHelp": false,
1162
+ "multiple": false,
1163
+ "type": "option"
1303
1164
  }
1304
1165
  },
1305
1166
  "hasDynamicHelp": true,
1306
1167
  "hiddenAliases": [],
1307
- "id": "rflib:debug:userpermissions:check",
1168
+ "id": "rflib:debug:userpermissions:whohas",
1308
1169
  "pluginAlias": "rflib-plugin",
1309
1170
  "pluginName": "rflib-plugin",
1310
1171
  "pluginType": "core",
1311
1172
  "strict": true,
1312
- "summary": "Check whether a user has a specific permission, and where it comes from.",
1173
+ "summary": "Find the users who have a specific permission, and what grants it.",
1313
1174
  "enableJsonFlag": true,
1314
1175
  "isESM": true,
1315
1176
  "relativePath": [
@@ -1318,43 +1179,42 @@
1318
1179
  "rflib",
1319
1180
  "debug",
1320
1181
  "userpermissions",
1321
- "check.js"
1182
+ "whohas.js"
1322
1183
  ],
1323
1184
  "aliasPermutations": [],
1324
1185
  "permutations": [
1325
- "rflib:debug:userpermissions:check",
1326
- "debug:rflib:userpermissions:check",
1327
- "debug:userpermissions:rflib:check",
1328
- "debug:userpermissions:check:rflib",
1329
- "rflib:userpermissions:debug:check",
1330
- "userpermissions:rflib:debug:check",
1331
- "userpermissions:debug:rflib:check",
1332
- "userpermissions:debug:check:rflib",
1333
- "rflib:userpermissions:check:debug",
1334
- "userpermissions:rflib:check:debug",
1335
- "userpermissions:check:rflib:debug",
1336
- "userpermissions:check:debug:rflib",
1337
- "rflib:debug:check:userpermissions",
1338
- "debug:rflib:check:userpermissions",
1339
- "debug:check:rflib:userpermissions",
1340
- "debug:check:userpermissions:rflib",
1341
- "rflib:check:debug:userpermissions",
1342
- "check:rflib:debug:userpermissions",
1343
- "check:debug:rflib:userpermissions",
1344
- "check:debug:userpermissions:rflib",
1345
- "rflib:check:userpermissions:debug",
1346
- "check:rflib:userpermissions:debug",
1347
- "check:userpermissions:rflib:debug",
1348
- "check:userpermissions:debug:rflib"
1186
+ "rflib:debug:userpermissions:whohas",
1187
+ "debug:rflib:userpermissions:whohas",
1188
+ "debug:userpermissions:rflib:whohas",
1189
+ "debug:userpermissions:whohas:rflib",
1190
+ "rflib:userpermissions:debug:whohas",
1191
+ "userpermissions:rflib:debug:whohas",
1192
+ "userpermissions:debug:rflib:whohas",
1193
+ "userpermissions:debug:whohas:rflib",
1194
+ "rflib:userpermissions:whohas:debug",
1195
+ "userpermissions:rflib:whohas:debug",
1196
+ "userpermissions:whohas:rflib:debug",
1197
+ "userpermissions:whohas:debug:rflib",
1198
+ "rflib:debug:whohas:userpermissions",
1199
+ "debug:rflib:whohas:userpermissions",
1200
+ "debug:whohas:rflib:userpermissions",
1201
+ "debug:whohas:userpermissions:rflib",
1202
+ "rflib:whohas:debug:userpermissions",
1203
+ "whohas:rflib:debug:userpermissions",
1204
+ "whohas:debug:rflib:userpermissions",
1205
+ "whohas:debug:userpermissions:rflib",
1206
+ "rflib:whohas:userpermissions:debug",
1207
+ "whohas:rflib:userpermissions:debug",
1208
+ "whohas:userpermissions:rflib:debug",
1209
+ "whohas:userpermissions:debug:rflib"
1349
1210
  ]
1350
1211
  },
1351
- "rflib:debug:userpermissions:compare": {
1212
+ "rflib:logging:apex:instrument": {
1352
1213
  "aliases": [],
1353
1214
  "args": {},
1354
- "description": "Finds out why something works for one user but not for another. The command combines each user's permissions across their profile, permission sets, and permission set groups, and returns only the permissions that one of the users has and the other doesn't.\n\nUse --permission-type to choose what to compare (default: ALL) and --sobject-type to limit the object and field comparison to one object. ALL compares object and field access, Apex classes, Visualforce pages, custom permissions, and system permissions.\n\nField access only counts where the user also has the matching access on the object. Sharing and record-level access aren't compared.\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.",
1215
+ "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.",
1355
1216
  "examples": [
1356
- "Compare all permissions of two users:\n$ sf rflib debug userpermissions compare --target-org myOrg --user jane@example.com --other-user bob@example.com",
1357
- "Compare object and field access on Account:\n$ sf rflib debug userpermissions compare --target-org myOrg --user jane@example.com --other-user bob@example.com --permission-type FLS --sobject-type Account"
1217
+ "- 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"
1358
1218
  ],
1359
1219
  "flags": {
1360
1220
  "json": {
@@ -1372,118 +1232,273 @@
1372
1232
  "multiple": false,
1373
1233
  "type": "option"
1374
1234
  },
1375
- "target-org": {
1376
- "char": "o",
1377
- "description": "The username or alias of the Salesforce org to compare the users in.",
1378
- "name": "target-org",
1379
- "noCacheDefault": true,
1235
+ "sourcepath": {
1236
+ "char": "s",
1237
+ "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.",
1238
+ "name": "sourcepath",
1380
1239
  "required": true,
1381
- "summary": "Username or alias of the target org.",
1382
- "hasDynamicHelp": true,
1240
+ "summary": "Directory containing Apex classes to instrument with logging.",
1241
+ "hasDynamicHelp": false,
1383
1242
  "multiple": false,
1384
1243
  "type": "option"
1385
1244
  },
1386
- "user": {
1387
- "char": "u",
1388
- "description": "The first user to compare, typically the user for whom something doesn't work.",
1389
- "name": "user",
1390
- "required": true,
1391
- "summary": "User ID (15 or 18 characters) or username of the first user.",
1245
+ "dryrun": {
1246
+ "char": "d",
1247
+ "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
1248
+ "name": "dryrun",
1249
+ "summary": "Preview changes without modifying files.",
1250
+ "allowNo": false,
1251
+ "type": "boolean"
1252
+ },
1253
+ "prettier": {
1254
+ "char": "p",
1255
+ "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",
1256
+ "name": "prettier",
1257
+ "summary": "Format modified files using Prettier.",
1258
+ "allowNo": false,
1259
+ "type": "boolean"
1260
+ },
1261
+ "no-if": {
1262
+ "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
1263
+ "name": "no-if",
1264
+ "summary": "Exclude the instrumentation of if-else statements.",
1265
+ "allowNo": false,
1266
+ "type": "boolean"
1267
+ },
1268
+ "no-catch": {
1269
+ "description": "When provided, the command will not add error log statements inside of `catch` blocks.",
1270
+ "name": "no-catch",
1271
+ "summary": "Exclude the instrumentation of catch blocks.",
1272
+ "allowNo": false,
1273
+ "type": "boolean"
1274
+ },
1275
+ "skip-instrumented": {
1276
+ "description": "When provided, the command will not add log statements to any Apex class that contains the `rflib_Logger` reference.",
1277
+ "name": "skip-instrumented",
1278
+ "summary": "Skips any files where a logger is already present.",
1279
+ "allowNo": false,
1280
+ "type": "boolean"
1281
+ },
1282
+ "verbose": {
1283
+ "char": "v",
1284
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
1285
+ "name": "verbose",
1286
+ "summary": "Enable verbose output.",
1287
+ "allowNo": false,
1288
+ "type": "boolean"
1289
+ },
1290
+ "exclude": {
1291
+ "char": "e",
1292
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cls\" to skip auto-generated classes.",
1293
+ "name": "exclude",
1294
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
1392
1295
  "hasDynamicHelp": false,
1393
1296
  "multiple": false,
1394
1297
  "type": "option"
1395
1298
  },
1396
- "other-user": {
1397
- "char": "w",
1398
- "description": "The second user to compare, typically the user for whom it works.",
1399
- "name": "other-user",
1299
+ "concurrency": {
1300
+ "char": "c",
1301
+ "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.",
1302
+ "name": "concurrency",
1303
+ "summary": "Limits the number of files processed concurrently.",
1304
+ "default": 10,
1305
+ "hasDynamicHelp": false,
1306
+ "multiple": false,
1307
+ "type": "option"
1308
+ }
1309
+ },
1310
+ "hasDynamicHelp": false,
1311
+ "hiddenAliases": [],
1312
+ "id": "rflib:logging:apex:instrument",
1313
+ "pluginAlias": "rflib-plugin",
1314
+ "pluginName": "rflib-plugin",
1315
+ "pluginType": "core",
1316
+ "strict": true,
1317
+ "summary": "Instrument Apex classes with RFLIB logging statements automatically.",
1318
+ "enableJsonFlag": true,
1319
+ "isESM": true,
1320
+ "relativePath": [
1321
+ "lib",
1322
+ "commands",
1323
+ "rflib",
1324
+ "logging",
1325
+ "apex",
1326
+ "instrument.js"
1327
+ ],
1328
+ "aliasPermutations": [],
1329
+ "permutations": [
1330
+ "rflib:logging:apex:instrument",
1331
+ "logging:rflib:apex:instrument",
1332
+ "logging:apex:rflib:instrument",
1333
+ "logging:apex:instrument:rflib",
1334
+ "rflib:apex:logging:instrument",
1335
+ "apex:rflib:logging:instrument",
1336
+ "apex:logging:rflib:instrument",
1337
+ "apex:logging:instrument:rflib",
1338
+ "rflib:apex:instrument:logging",
1339
+ "apex:rflib:instrument:logging",
1340
+ "apex:instrument:rflib:logging",
1341
+ "apex:instrument:logging:rflib",
1342
+ "rflib:logging:instrument:apex",
1343
+ "logging:rflib:instrument:apex",
1344
+ "logging:instrument:rflib:apex",
1345
+ "logging:instrument:apex:rflib",
1346
+ "rflib:instrument:logging:apex",
1347
+ "instrument:rflib:logging:apex",
1348
+ "instrument:logging:rflib:apex",
1349
+ "instrument:logging:apex:rflib",
1350
+ "rflib:instrument:apex:logging",
1351
+ "instrument:rflib:apex:logging",
1352
+ "instrument:apex:rflib:logging",
1353
+ "instrument:apex:logging:rflib"
1354
+ ]
1355
+ },
1356
+ "rflib:logging:aura:instrument": {
1357
+ "aliases": [],
1358
+ "args": {},
1359
+ "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",
1360
+ "examples": [
1361
+ "- 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"
1362
+ ],
1363
+ "flags": {
1364
+ "json": {
1365
+ "description": "Format output as json.",
1366
+ "helpGroup": "GLOBAL",
1367
+ "name": "json",
1368
+ "allowNo": false,
1369
+ "type": "boolean"
1370
+ },
1371
+ "flags-dir": {
1372
+ "helpGroup": "GLOBAL",
1373
+ "name": "flags-dir",
1374
+ "summary": "Import flag values from a directory.",
1375
+ "hasDynamicHelp": false,
1376
+ "multiple": false,
1377
+ "type": "option"
1378
+ },
1379
+ "sourcepath": {
1380
+ "char": "s",
1381
+ "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()",
1382
+ "name": "sourcepath",
1400
1383
  "required": true,
1401
- "summary": "User ID (15 or 18 characters) or username of the second user.",
1384
+ "summary": "Directory containing Aura components to instrument with logging.",
1402
1385
  "hasDynamicHelp": false,
1403
1386
  "multiple": false,
1404
1387
  "type": "option"
1405
1388
  },
1406
- "permission-type": {
1407
- "char": "t",
1408
- "description": "Controls which permissions are compared:\n - FLS: Field access\n - OLS: Object access\n - APEX: Apex class and Visualforce page access\n - ALL: All of the above, plus custom permissions and system permissions",
1409
- "name": "permission-type",
1410
- "summary": "Permissions to compare: FLS, OLS, APEX, or ALL. Default: ALL.",
1411
- "default": "ALL",
1389
+ "dryrun": {
1390
+ "char": "d",
1391
+ "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",
1392
+ "name": "dryrun",
1393
+ "summary": "Preview changes without modifying files.",
1394
+ "allowNo": false,
1395
+ "type": "boolean"
1396
+ },
1397
+ "prettier": {
1398
+ "char": "p",
1399
+ "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",
1400
+ "name": "prettier",
1401
+ "summary": "Format modified files using Prettier.",
1402
+ "allowNo": false,
1403
+ "type": "boolean"
1404
+ },
1405
+ "no-if": {
1406
+ "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
1407
+ "name": "no-if",
1408
+ "summary": "Exclude the instrumentation of if-else statements.",
1409
+ "allowNo": false,
1410
+ "type": "boolean"
1411
+ },
1412
+ "skip-instrumented": {
1413
+ "description": "When provided, the command will not add log statements to any Aura component that contains the `` component.",
1414
+ "name": "skip-instrumented",
1415
+ "summary": "Skips any files where a logger is already present.",
1416
+ "allowNo": false,
1417
+ "type": "boolean"
1418
+ },
1419
+ "verbose": {
1420
+ "char": "v",
1421
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
1422
+ "name": "verbose",
1423
+ "summary": "Enable verbose output.",
1424
+ "allowNo": false,
1425
+ "type": "boolean"
1426
+ },
1427
+ "exclude": {
1428
+ "char": "e",
1429
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.cmp\" to skip auto-generated components.",
1430
+ "name": "exclude",
1431
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
1412
1432
  "hasDynamicHelp": false,
1413
1433
  "multiple": false,
1414
- "options": [
1415
- "FLS",
1416
- "OLS",
1417
- "APEX",
1418
- "ALL"
1419
- ],
1420
1434
  "type": "option"
1421
1435
  },
1422
- "sobject-type": {
1423
- "char": "b",
1424
- "description": "Limits the object and field comparison to one SObject type, e.g. Account. Recommended in large orgs, where the full field comparison can reach the query row limit.",
1425
- "name": "sobject-type",
1426
- "summary": "Optional SObject API name to limit the object and field comparison to.",
1436
+ "concurrency": {
1437
+ "char": "c",
1438
+ "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.",
1439
+ "name": "concurrency",
1440
+ "summary": "Limits the number of files processed concurrently.",
1441
+ "default": 10,
1427
1442
  "hasDynamicHelp": false,
1428
1443
  "multiple": false,
1429
1444
  "type": "option"
1430
1445
  }
1431
1446
  },
1432
- "hasDynamicHelp": true,
1447
+ "hasDynamicHelp": false,
1433
1448
  "hiddenAliases": [],
1434
- "id": "rflib:debug:userpermissions:compare",
1449
+ "id": "rflib:logging:aura:instrument",
1435
1450
  "pluginAlias": "rflib-plugin",
1436
1451
  "pluginName": "rflib-plugin",
1437
1452
  "pluginType": "core",
1438
1453
  "strict": true,
1439
- "summary": "Compare the permissions of two users and show only the differences.",
1454
+ "summary": "Instrument Aura Components with RFLIB logging statements automatically.",
1440
1455
  "enableJsonFlag": true,
1441
1456
  "isESM": true,
1442
1457
  "relativePath": [
1443
1458
  "lib",
1444
1459
  "commands",
1445
1460
  "rflib",
1446
- "debug",
1447
- "userpermissions",
1448
- "compare.js"
1461
+ "logging",
1462
+ "aura",
1463
+ "instrument.js"
1449
1464
  ],
1450
1465
  "aliasPermutations": [],
1451
1466
  "permutations": [
1452
- "rflib:debug:userpermissions:compare",
1453
- "debug:rflib:userpermissions:compare",
1454
- "debug:userpermissions:rflib:compare",
1455
- "debug:userpermissions:compare:rflib",
1456
- "rflib:userpermissions:debug:compare",
1457
- "userpermissions:rflib:debug:compare",
1458
- "userpermissions:debug:rflib:compare",
1459
- "userpermissions:debug:compare:rflib",
1460
- "rflib:userpermissions:compare:debug",
1461
- "userpermissions:rflib:compare:debug",
1462
- "userpermissions:compare:rflib:debug",
1463
- "userpermissions:compare:debug:rflib",
1464
- "rflib:debug:compare:userpermissions",
1465
- "debug:rflib:compare:userpermissions",
1466
- "debug:compare:rflib:userpermissions",
1467
- "debug:compare:userpermissions:rflib",
1468
- "rflib:compare:debug:userpermissions",
1469
- "compare:rflib:debug:userpermissions",
1470
- "compare:debug:rflib:userpermissions",
1471
- "compare:debug:userpermissions:rflib",
1472
- "rflib:compare:userpermissions:debug",
1473
- "compare:rflib:userpermissions:debug",
1474
- "compare:userpermissions:rflib:debug",
1475
- "compare:userpermissions:debug:rflib"
1467
+ "rflib:logging:aura:instrument",
1468
+ "logging:rflib:aura:instrument",
1469
+ "logging:aura:rflib:instrument",
1470
+ "logging:aura:instrument:rflib",
1471
+ "rflib:aura:logging:instrument",
1472
+ "aura:rflib:logging:instrument",
1473
+ "aura:logging:rflib:instrument",
1474
+ "aura:logging:instrument:rflib",
1475
+ "rflib:aura:instrument:logging",
1476
+ "aura:rflib:instrument:logging",
1477
+ "aura:instrument:rflib:logging",
1478
+ "aura:instrument:logging:rflib",
1479
+ "rflib:logging:instrument:aura",
1480
+ "logging:rflib:instrument:aura",
1481
+ "logging:instrument:rflib:aura",
1482
+ "logging:instrument:aura:rflib",
1483
+ "rflib:instrument:logging:aura",
1484
+ "instrument:rflib:logging:aura",
1485
+ "instrument:logging:rflib:aura",
1486
+ "instrument:logging:aura:rflib",
1487
+ "rflib:instrument:aura:logging",
1488
+ "instrument:rflib:aura:logging",
1489
+ "instrument:aura:rflib:logging",
1490
+ "instrument:aura:logging:rflib"
1476
1491
  ]
1477
1492
  },
1478
- "rflib:debug:userpermissions:get": {
1493
+ "rflib:logging:flow:instrument": {
1479
1494
  "aliases": [],
1480
1495
  "args": {},
1481
- "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\nUse --effective to get the user's combined permissions instead of the raw permission records: one entry per object with its access levels, one entry per field with read and edit (only where the user also has that access on the object), and the names of the accessible Apex classes and Visualforce pages. With --permission-type ALL, the result also lists the user's custom permissions and system permissions.\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",
1496
+ "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.",
1482
1497
  "examples": [
1483
- "Check all permissions for a user:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type ALL",
1484
- "Check FLS for a specific object:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type FLS --sobject-type Account",
1485
- "Check Apex access:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type APEX",
1486
- "Get the combined permissions of a user, including custom and system permissions:\n$ sf rflib debug userpermissions get --target-org myOrg --user-id 0057000000XXXXXX --permission-type ALL --effective"
1498
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app",
1499
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --dryrun",
1500
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-instrumented",
1501
+ "<%= config.bin %> <%= command.id %> --target-org myOrg --sourcepath force-app --skip-fault-paths"
1487
1502
  ],
1488
1503
  "flags": {
1489
1504
  "json": {
@@ -1503,7 +1518,7 @@
1503
1518
  },
1504
1519
  "target-org": {
1505
1520
  "char": "o",
1506
- "description": "The username or alias of the Salesforce org containing the RFLIB base package.",
1521
+ "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.",
1507
1522
  "name": "target-org",
1508
1523
  "noCacheDefault": true,
1509
1524
  "required": true,
@@ -1512,104 +1527,118 @@
1512
1527
  "multiple": false,
1513
1528
  "type": "option"
1514
1529
  },
1515
- "user-id": {
1516
- "char": "u",
1517
- "description": "The Salesforce User ID (15 or 18 characters) of the user whose permissions should be retrieved.",
1518
- "name": "user-id",
1530
+ "sourcepath": {
1531
+ "char": "s",
1532
+ "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\".",
1533
+ "name": "sourcepath",
1519
1534
  "required": true,
1520
- "summary": "Salesforce User ID (15 or 18 character) to check permissions for.",
1535
+ "summary": "Directory containing Flow files to instrument with logging.",
1521
1536
  "hasDynamicHelp": false,
1522
1537
  "multiple": false,
1523
1538
  "type": "option"
1524
1539
  },
1525
- "permission-type": {
1526
- "char": "t",
1527
- "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",
1528
- "name": "permission-type",
1529
- "required": true,
1530
- "summary": "Type of permissions to retrieve: FLS, OLS, APEX, or ALL.",
1531
- "hasDynamicHelp": false,
1532
- "multiple": false,
1533
- "options": [
1534
- "FLS",
1535
- "OLS",
1536
- "APEX",
1537
- "ALL"
1538
- ],
1539
- "type": "option"
1540
+ "dryrun": {
1541
+ "char": "d",
1542
+ "description": "When enabled, shows which files would be modified without making actual changes. Useful for reviewing the impact before applying changes.",
1543
+ "name": "dryrun",
1544
+ "summary": "Preview changes without modifying files.",
1545
+ "allowNo": false,
1546
+ "type": "boolean"
1540
1547
  },
1541
- "sobject-type": {
1542
- "char": "b",
1543
- "description": "Filters Field-Level Security or Object-Level Security results to a specific SObject type, e.g. Account, Contact, Opportunity.",
1544
- "name": "sobject-type",
1545
- "summary": "Optional SObject API name to filter FLS or OLS results.",
1548
+ "skip-instrumented": {
1549
+ "description": "When provided, the command will not add log statements to any Flows that already contain RFLIB logging actions.",
1550
+ "name": "skip-instrumented",
1551
+ "summary": "Skips any files where a logger is already present.",
1552
+ "allowNo": false,
1553
+ "type": "boolean"
1554
+ },
1555
+ "skip-fault-paths": {
1556
+ "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.",
1557
+ "name": "skip-fault-paths",
1558
+ "summary": "Skips logging errors on fault paths.",
1559
+ "allowNo": false,
1560
+ "type": "boolean"
1561
+ },
1562
+ "verbose": {
1563
+ "char": "v",
1564
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
1565
+ "name": "verbose",
1566
+ "summary": "Enable verbose output.",
1567
+ "allowNo": false,
1568
+ "type": "boolean"
1569
+ },
1570
+ "exclude": {
1571
+ "char": "e",
1572
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Test_*.flow-meta.xml\" to skip certain flows.",
1573
+ "name": "exclude",
1574
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
1546
1575
  "hasDynamicHelp": false,
1547
1576
  "multiple": false,
1548
1577
  "type": "option"
1549
1578
  },
1550
- "effective": {
1551
- "char": "e",
1552
- "description": "Merges the permissions from the profile, permission sets, and permission set groups. Objects list their access levels (read, create, edit, delete, viewall, modifyall, viewallfields), fields list read and edit, and Apex classes, Visualforce pages, and custom permissions are listed by name. System permissions are included for --permission-type ALL. With --effective, --user-id also accepts a username.",
1553
- "name": "effective",
1554
- "summary": "Return the user's combined permissions instead of the raw permission records.",
1555
- "allowNo": false,
1556
- "type": "boolean"
1579
+ "concurrency": {
1580
+ "char": "c",
1581
+ "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.",
1582
+ "name": "concurrency",
1583
+ "summary": "Limits the number of files processed concurrently.",
1584
+ "default": 10,
1585
+ "hasDynamicHelp": false,
1586
+ "multiple": false,
1587
+ "type": "option"
1557
1588
  }
1558
1589
  },
1559
1590
  "hasDynamicHelp": true,
1560
1591
  "hiddenAliases": [],
1561
- "id": "rflib:debug:userpermissions:get",
1592
+ "id": "rflib:logging:flow:instrument",
1562
1593
  "pluginAlias": "rflib-plugin",
1563
1594
  "pluginName": "rflib-plugin",
1564
1595
  "pluginType": "core",
1565
1596
  "strict": true,
1566
- "summary": "Check Salesforce permissions for a user in the target org.",
1597
+ "summary": "Adds RFLIB logging statements to Salesforce Flows.",
1567
1598
  "enableJsonFlag": true,
1568
1599
  "isESM": true,
1569
1600
  "relativePath": [
1570
1601
  "lib",
1571
1602
  "commands",
1572
1603
  "rflib",
1573
- "debug",
1574
- "userpermissions",
1575
- "get.js"
1604
+ "logging",
1605
+ "flow",
1606
+ "instrument.js"
1576
1607
  ],
1577
1608
  "aliasPermutations": [],
1578
1609
  "permutations": [
1579
- "rflib:debug:userpermissions:get",
1580
- "debug:rflib:userpermissions:get",
1581
- "debug:userpermissions:rflib:get",
1582
- "debug:userpermissions:get:rflib",
1583
- "rflib:userpermissions:debug:get",
1584
- "userpermissions:rflib:debug:get",
1585
- "userpermissions:debug:rflib:get",
1586
- "userpermissions:debug:get:rflib",
1587
- "rflib:userpermissions:get:debug",
1588
- "userpermissions:rflib:get:debug",
1589
- "userpermissions:get:rflib:debug",
1590
- "userpermissions:get:debug:rflib",
1591
- "rflib:debug:get:userpermissions",
1592
- "debug:rflib:get:userpermissions",
1593
- "debug:get:rflib:userpermissions",
1594
- "debug:get:userpermissions:rflib",
1595
- "rflib:get:debug:userpermissions",
1596
- "get:rflib:debug:userpermissions",
1597
- "get:debug:rflib:userpermissions",
1598
- "get:debug:userpermissions:rflib",
1599
- "rflib:get:userpermissions:debug",
1600
- "get:rflib:userpermissions:debug",
1601
- "get:userpermissions:rflib:debug",
1602
- "get:userpermissions:debug:rflib"
1610
+ "rflib:logging:flow:instrument",
1611
+ "logging:rflib:flow:instrument",
1612
+ "logging:flow:rflib:instrument",
1613
+ "logging:flow:instrument:rflib",
1614
+ "rflib:flow:logging:instrument",
1615
+ "flow:rflib:logging:instrument",
1616
+ "flow:logging:rflib:instrument",
1617
+ "flow:logging:instrument:rflib",
1618
+ "rflib:flow:instrument:logging",
1619
+ "flow:rflib:instrument:logging",
1620
+ "flow:instrument:rflib:logging",
1621
+ "flow:instrument:logging:rflib",
1622
+ "rflib:logging:instrument:flow",
1623
+ "logging:rflib:instrument:flow",
1624
+ "logging:instrument:rflib:flow",
1625
+ "logging:instrument:flow:rflib",
1626
+ "rflib:instrument:logging:flow",
1627
+ "instrument:rflib:logging:flow",
1628
+ "instrument:logging:rflib:flow",
1629
+ "instrument:logging:flow:rflib",
1630
+ "rflib:instrument:flow:logging",
1631
+ "instrument:rflib:flow:logging",
1632
+ "instrument:flow:rflib:logging",
1633
+ "instrument:flow:logging:rflib"
1603
1634
  ]
1604
1635
  },
1605
- "rflib:debug:userpermissions:whohas": {
1636
+ "rflib:logging:lwc:instrument": {
1606
1637
  "aliases": [],
1607
1638
  "args": {},
1608
- "description": "The reverse of userpermissions check. Answers questions such as \"Who can edit Account.AnnualRevenue?\" or \"Who has Modify All Data?\". The command finds every profile, permission set, and permission set group that grants the permission, and the users who are assigned to them.\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\nThe same permission rules as userpermissions check apply: for field checks, only users who also have the matching access on the object are included, and View All Fields grants Read on all fields. Apex class and Visualforce page checks include access granted by the Author Apex and Customize Application system permissions.\n\nInactive users are excluded unless you specify --include-inactive. The result lists up to --user-limit users; the total count is always returned.\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.",
1639
+ "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)",
1609
1640
  "examples": [
1610
- "Find the users who can edit a field:\n$ sf rflib debug userpermissions whohas --target-org myOrg --field Account.AnnualRevenue --access edit",
1611
- "Find the users who have Modify All Data:\n$ sf rflib debug userpermissions whohas --target-org myOrg --system-permission ModifyAllData",
1612
- "Find the users who can access an Apex class, including inactive users:\n$ sf rflib debug userpermissions whohas --target-org myOrg --apex-class OrderController --include-inactive"
1641
+ "- 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"
1613
1642
  ],
1614
1643
  "flags": {
1615
1644
  "json": {
@@ -1627,149 +1656,120 @@
1627
1656
  "multiple": false,
1628
1657
  "type": "option"
1629
1658
  },
1630
- "target-org": {
1631
- "char": "o",
1632
- "description": "The username or alias of the Salesforce org to search.",
1633
- "name": "target-org",
1634
- "noCacheDefault": true,
1659
+ "sourcepath": {
1660
+ "char": "s",
1661
+ "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')",
1662
+ "name": "sourcepath",
1635
1663
  "required": true,
1636
- "summary": "Username or alias of the target org.",
1637
- "hasDynamicHelp": true,
1638
- "multiple": false,
1639
- "type": "option"
1640
- },
1641
- "object": {
1642
- "char": "b",
1643
- "description": "Finds users with an object permission. Use --access to choose which one; the default is read.",
1644
- "name": "object",
1645
- "summary": "API name of the object to check object permissions for, e.g. Account.",
1664
+ "summary": "Directory containing LWC JavaScript files to instrument with logging.",
1646
1665
  "hasDynamicHelp": false,
1647
1666
  "multiple": false,
1648
1667
  "type": "option"
1649
1668
  },
1650
- "field": {
1651
- "char": "f",
1652
- "description": "Finds users with access to a field. Use --access read (default) or --access edit.",
1653
- "name": "field",
1654
- "summary": "Field to check field-level security for, in the form Object.Field, e.g. Account.AnnualRevenue.",
1655
- "hasDynamicHelp": false,
1656
- "multiple": false,
1657
- "type": "option"
1669
+ "dryrun": {
1670
+ "char": "d",
1671
+ "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",
1672
+ "name": "dryrun",
1673
+ "summary": "Preview changes without modifying files.",
1674
+ "allowNo": false,
1675
+ "type": "boolean"
1658
1676
  },
1659
- "access": {
1660
- "char": "a",
1661
- "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",
1662
- "name": "access",
1663
- "summary": "Access level to check for --object or --field. Default: read.",
1664
- "hasDynamicHelp": false,
1665
- "multiple": false,
1666
- "options": [
1667
- "read",
1668
- "create",
1669
- "edit",
1670
- "delete",
1671
- "viewall",
1672
- "modifyall",
1673
- "viewallfields"
1674
- ],
1675
- "type": "option"
1677
+ "prettier": {
1678
+ "char": "p",
1679
+ "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",
1680
+ "name": "prettier",
1681
+ "summary": "Format modified files using Prettier.",
1682
+ "allowNo": false,
1683
+ "type": "boolean"
1676
1684
  },
1677
- "apex-class": {
1678
- "description": "Finds users who can access an Apex class. Use namespace__Name or namespace.Name for a class in a managed package.",
1679
- "name": "apex-class",
1680
- "summary": "Name of the Apex class to check access for.",
1681
- "hasDynamicHelp": false,
1682
- "multiple": false,
1683
- "type": "option"
1685
+ "no-if": {
1686
+ "description": "When provided, the command will not add log statements inside of `if` and `else` blocks.",
1687
+ "name": "no-if",
1688
+ "summary": "Exclude the instrumentation of if-else statements.",
1689
+ "allowNo": false,
1690
+ "type": "boolean"
1684
1691
  },
1685
- "apex-page": {
1686
- "description": "Finds users who can access a Visualforce page. Use namespace__Name for a page in a managed package.",
1687
- "name": "apex-page",
1688
- "summary": "Name of the Visualforce page to check access for.",
1689
- "hasDynamicHelp": false,
1690
- "multiple": false,
1691
- "type": "option"
1692
+ "skip-instrumented": {
1693
+ "description": "When provided, the command will not add log statements to any Apex class that contains the `rflib` import statement.",
1694
+ "name": "skip-instrumented",
1695
+ "summary": "Skips any files where a logger is already present.",
1696
+ "allowNo": false,
1697
+ "type": "boolean"
1692
1698
  },
1693
- "custom-permission": {
1694
- "description": "Finds users who have a custom permission. Use namespace__Name for a custom permission in a managed package.",
1695
- "name": "custom-permission",
1696
- "summary": "API name of the custom permission to check.",
1697
- "hasDynamicHelp": false,
1698
- "multiple": false,
1699
- "type": "option"
1699
+ "verbose": {
1700
+ "char": "v",
1701
+ "description": "When provided with --dryrun, prints the paths of the files that would be modified.",
1702
+ "name": "verbose",
1703
+ "summary": "Enable verbose output.",
1704
+ "allowNo": false,
1705
+ "type": "boolean"
1700
1706
  },
1701
- "system-permission": {
1702
- "description": "Finds users who have a system (user) permission. Use the name of the permission field on the PermissionSet object, with or without the \"Permissions\" prefix.",
1703
- "name": "system-permission",
1704
- "summary": "API name of the system permission to check, e.g. ModifyAllData or ViewSetup.",
1707
+ "exclude": {
1708
+ "char": "e",
1709
+ "description": "Exclude specific files or directories that match the provided glob pattern. For example, use --exclude \"**/Generated_*.js\" to skip auto-generated components.",
1710
+ "name": "exclude",
1711
+ "summary": "Exclude files or directories from instrumentation based on a glob pattern.",
1705
1712
  "hasDynamicHelp": false,
1706
1713
  "multiple": false,
1707
1714
  "type": "option"
1708
1715
  },
1709
- "include-inactive": {
1710
- "description": "By default, only active users are returned. Specify this flag to include inactive users as well.",
1711
- "name": "include-inactive",
1712
- "summary": "Include inactive users.",
1713
- "allowNo": false,
1714
- "type": "boolean"
1715
- },
1716
- "user-limit": {
1717
- "char": "l",
1718
- "description": "Limits the number of users in the result. The total number of matching users is always returned in userCount.",
1719
- "name": "user-limit",
1720
- "summary": "Maximum number of users to return. Default: 200, maximum: 2000.",
1721
- "default": 200,
1716
+ "concurrency": {
1717
+ "char": "c",
1718
+ "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.",
1719
+ "name": "concurrency",
1720
+ "summary": "Limits the number of files processed concurrently.",
1721
+ "default": 10,
1722
1722
  "hasDynamicHelp": false,
1723
1723
  "multiple": false,
1724
1724
  "type": "option"
1725
1725
  }
1726
1726
  },
1727
- "hasDynamicHelp": true,
1727
+ "hasDynamicHelp": false,
1728
1728
  "hiddenAliases": [],
1729
- "id": "rflib:debug:userpermissions:whohas",
1729
+ "id": "rflib:logging:lwc:instrument",
1730
1730
  "pluginAlias": "rflib-plugin",
1731
1731
  "pluginName": "rflib-plugin",
1732
1732
  "pluginType": "core",
1733
1733
  "strict": true,
1734
- "summary": "Find the users who have a specific permission, and what grants it.",
1734
+ "summary": "Instrument Lightning Web Components with RFLIB logging statements automatically.",
1735
1735
  "enableJsonFlag": true,
1736
1736
  "isESM": true,
1737
1737
  "relativePath": [
1738
1738
  "lib",
1739
1739
  "commands",
1740
1740
  "rflib",
1741
- "debug",
1742
- "userpermissions",
1743
- "whohas.js"
1741
+ "logging",
1742
+ "lwc",
1743
+ "instrument.js"
1744
1744
  ],
1745
1745
  "aliasPermutations": [],
1746
1746
  "permutations": [
1747
- "rflib:debug:userpermissions:whohas",
1748
- "debug:rflib:userpermissions:whohas",
1749
- "debug:userpermissions:rflib:whohas",
1750
- "debug:userpermissions:whohas:rflib",
1751
- "rflib:userpermissions:debug:whohas",
1752
- "userpermissions:rflib:debug:whohas",
1753
- "userpermissions:debug:rflib:whohas",
1754
- "userpermissions:debug:whohas:rflib",
1755
- "rflib:userpermissions:whohas:debug",
1756
- "userpermissions:rflib:whohas:debug",
1757
- "userpermissions:whohas:rflib:debug",
1758
- "userpermissions:whohas:debug:rflib",
1759
- "rflib:debug:whohas:userpermissions",
1760
- "debug:rflib:whohas:userpermissions",
1761
- "debug:whohas:rflib:userpermissions",
1762
- "debug:whohas:userpermissions:rflib",
1763
- "rflib:whohas:debug:userpermissions",
1764
- "whohas:rflib:debug:userpermissions",
1765
- "whohas:debug:rflib:userpermissions",
1766
- "whohas:debug:userpermissions:rflib",
1767
- "rflib:whohas:userpermissions:debug",
1768
- "whohas:rflib:userpermissions:debug",
1769
- "whohas:userpermissions:rflib:debug",
1770
- "whohas:userpermissions:debug:rflib"
1747
+ "rflib:logging:lwc:instrument",
1748
+ "logging:rflib:lwc:instrument",
1749
+ "logging:lwc:rflib:instrument",
1750
+ "logging:lwc:instrument:rflib",
1751
+ "rflib:lwc:logging:instrument",
1752
+ "lwc:rflib:logging:instrument",
1753
+ "lwc:logging:rflib:instrument",
1754
+ "lwc:logging:instrument:rflib",
1755
+ "rflib:lwc:instrument:logging",
1756
+ "lwc:rflib:instrument:logging",
1757
+ "lwc:instrument:rflib:logging",
1758
+ "lwc:instrument:logging:rflib",
1759
+ "rflib:logging:instrument:lwc",
1760
+ "logging:rflib:instrument:lwc",
1761
+ "logging:instrument:rflib:lwc",
1762
+ "logging:instrument:lwc:rflib",
1763
+ "rflib:instrument:logging:lwc",
1764
+ "instrument:rflib:logging:lwc",
1765
+ "instrument:logging:rflib:lwc",
1766
+ "instrument:logging:lwc:rflib",
1767
+ "rflib:instrument:lwc:logging",
1768
+ "instrument:rflib:lwc:logging",
1769
+ "instrument:lwc:rflib:logging",
1770
+ "instrument:lwc:logging:rflib"
1771
1771
  ]
1772
1772
  }
1773
1773
  },
1774
- "version": "0.23.3"
1774
+ "version": "0.23.4"
1775
1775
  }