Skip to main content

rp usages

rp usages walks your working tree, detects RedPennon SDK call sites, captures the variable key argument, and prints every reference. It is side-effect-free — it never posts anything. The GitHub Action runs it with --format json and uploads the result.

rp usages
rp usages --format json -o usages.json

How matching works

The scanner looks for SDK call sites and captures the key — it does not need a list of your keys. The defaults cover the real SDK shapes:

LanguageDetected calls
Nodeclient.variable('key'), client.variableValue('key', …), batch client.variables([...])
Goclient.Variable(ctx, "key", …), client.VariableValue(ctx, "key", …)
Pythonclient.variable('key'), client.variable_value('key'), batch client.variables([...])

Batch calls carry several keys in one call, so the array form is captured as multiple keys, not one. Captured keys that don't exist in the project are still reported; --only-unused cross-checks them against rp keys.

Flags

FlagDescription
--format console|jsonOutput format. console (default) is human-readable; json is machine-parseable.
-o, --output <file>Write output to a file.
--include <glob>Restrict the scan to matching files (repeatable).
--exclude <glob>Skip matching files (repeatable).
--client-name <name>Treat <name> as an SDK client variable in addition to the defaults.
--match-pattern ext=<regex>Add a custom pattern for files with extension ext (exactly one capture group = the key).
--var-alias <from>=<to>Rewrite a captured key before reporting.
--show-regexPrint the effective patterns and exit.
--only-unusedList only captured keys that are not in the project (needs API access).
--no-apiScan without contacting the API (no credentials needed).
--headlessMachine-parseable output for CI.

Repository config — .redpennon/config.yml

Run rp repo init to scaffold it. The CLI merges these settings with the built-in defaults.

# .redpennon/config.yml
clientNames:
- client
- featureClient
variableAliases:
old-key: new-key
matchPatterns:
ts: "client\\.variable\\(['\"]([\\w-]+)['\"]\\)"
includeFiles:
- "src/**/*.{ts,tsx,js,go,py}"
excludeFiles:
- "**/*.test.*"
- "**/node_modules/**"
KeyMeaning
clientNamesVariable names treated as SDK clients.
variableAliasesMap a scanned key to a canonical key.
matchPatternsPer-extension regex; exactly one capture group, which is the variable key.
includeFiles / excludeFilesGlobs that bound the scan.