@devcycle/cli 6.1.4 → 6.2.1

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.
package/README.md CHANGED
@@ -19,6 +19,8 @@ The CLI can be customized in several ways using command-line args or by creating
19
19
 
20
20
  <!-- toc -->
21
21
  * [Command Topics](#command-topics)
22
+ * [Pattern captures the key including surrounding quotes](#pattern-captures-the-key-including-surrounding-quotes)
23
+ * [Pattern strips quotes, capturing only the content](#pattern-strips-quotes-capturing-only-the-content)
22
24
  <!-- tocstop -->
23
25
 
24
26
  ## MCP Server for AI Assistants
@@ -160,7 +162,7 @@ $ npm install -g @devcycle/cli
160
162
  $ dvc COMMAND
161
163
  running command...
162
164
  $ dvc (--version)
163
- @devcycle/cli/6.1.4 linux-x64 node-v22.20.0
165
+ @devcycle/cli/6.2.1 linux-x64 node-v22.21.1
164
166
  $ dvc --help [COMMAND]
165
167
  USAGE
166
168
  $ dvc COMMAND
@@ -239,12 +241,15 @@ codeInsights:
239
241
  - "dist/*"
240
242
  ```
241
243
 
242
- ### Match Patterns
244
+ ### Match Patterns and Aliases
243
245
 
244
246
  When identifying variable usages in the code, the CLI will identify DevCycle SDK methods by default. To capture
245
- other usages you may define match patterns. Match patterns are defined by file extension, and each pattern should
246
- contain exactly one capture group which matches the key of the variable. Make sure the captured value contains the
247
- entire key parameter (including quotes, if applicable).
247
+ other usages you may define match patterns. Match patterns are defined by file extension.
248
+
249
+ :::note
250
+ Each pattern must include exactly one capture group for the variable key. Capture the entire key value
251
+ (including surrounding quotes if you choose the “with quotes” pattern).
252
+ :::
248
253
 
249
254
  Match patterns can be defined in the configuration file, for example:
250
255
 
@@ -263,10 +268,34 @@ codeInsights:
263
268
  - customVariableGetter\(\s*["']([^"']*)["']
264
269
  ```
265
270
 
271
+ #### Capturing with or without quotes
272
+
273
+ Match patterns can capture variable keys with or without quotes, which affects whether aliases are needed:
274
+
275
+ With quotes:
276
+
277
+ ```yml
278
+ # Pattern captures the key including surrounding quotes
279
+ - dvcClient\.variable\(\s*(["'][^"']*["'])\s*,
280
+ ```
281
+
282
+ - Matches: `dvcClient.variable('my-variable', default)`
283
+ - Captures: `'my-variable'` (with quotes)
284
+
285
+ Without quotes (aliases or generated constants required):
286
+
287
+ ```yml
288
+ # Pattern strips quotes, capturing only the content
289
+ - dvcClient\.variable\(\s*["']([^"']*)["']
290
+ ```
291
+
292
+ - Matches: `dvcClient.variable('my-variable', default)`
293
+ - Captures: `my-variable`
294
+
266
295
  Match patterns can also be passed directly to relevant commands using the `--match-pattern` flag:
267
296
 
268
297
  ```bash
269
- dvc usages --match-pattern ts="customVariableGetter\(\s*[\"']([^\"']*)[\"']" js="customVariableGetter\(\s*[\"']([^\"']*)[\"']"
298
+ dvc usages --match-pattern ts="customVariableGetter\(\s*["']([^"']*)["']" js="customVariableGetter\(\s*["']([^"']*)["']"
270
299
  ```
271
300
 
272
301
  When testing your regex the `--show-regex` flag can be helpful. This will print all patterns used to find matches in your codebase.
@@ -274,3 +303,22 @@ When testing your regex the `--show-regex` flag can be helpful. This will print
274
303
  ```bash
275
304
  dvc usages --show-regex
276
305
  ```
306
+
307
+ #### Custom Wrapper Functions
308
+
309
+ If you use wrapper functions around the SDK, add patterns for them.
310
+
311
+ **Example: Custom wrapper functions**
312
+
313
+ ```yml
314
+ codeInsights:
315
+ matchPatterns:
316
+ ts:
317
+ # Matches: getFeatureFlag('my-variable', defaultValue)
318
+ - getFeatureFlag\(\s*([^,)]*)\s*,
319
+ # Matches: isFeatureEnabled('my-variable')
320
+ - isFeatureEnabled\(\s*([^,)]*)\s*\)
321
+ tsx:
322
+ # Matches: useFeatureFlag('my-variable', defaultValue)
323
+ - useFeatureFlag\(\s*([^,)]*)\s*,
324
+ ```