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:
| Language | Detected calls |
|---|---|
| Node | client.variable('key'), client.variableValue('key', …), batch client.variables([...]) |
| Go | client.Variable(ctx, "key", …), client.VariableValue(ctx, "key", …) |
| Python | client.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
| Flag | Description |
|---|---|
--format console|json | Output 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-regex | Print the effective patterns and exit. |
--only-unused | List only captured keys that are not in the project (needs API access). |
--no-api | Scan without contacting the API (no credentials needed). |
--headless | Machine-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/**"
| Key | Meaning |
|---|---|
clientNames | Variable names treated as SDK clients. |
variableAliases | Map a scanned key to a canonical key. |
matchPatterns | Per-extension regex; exactly one capture group, which is the variable key. |
includeFiles / excludeFiles | Globs that bound the scan. |