Find Orphan Translation Keys
find_orphan_keysFind translation keys in locale JSON files that are not referenced in Vue/TS source code. Scan a specific layer or all layers to identify unused keys that can be safely removed.
Instructions
Find translation keys that exist in locale JSON files but are not referenced in any Vue/TS source code. Scans a specific layer or all layers. Reports keys that can potentially be removed. Also detects dynamic key patterns and uncertain matches. Scope-aware: each layer is checked only against code of the apps that consume it (summary.scanScope shows each layer's effective scope); keys referenced only from non-consuming apps are reported separately as misplacedUsages, not orphans.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layer | No | Layer name to check for orphan keys (e.g., "root", "app-admin"). If omitted, checks all layers. Call discover to see available layers. | |
| locale | No | Locale code to read translation keys from (e.g., "en", "en-US"). Defaults to the project default locale. | |
| scanDirs | No | Absolute paths to directories to scan for source code usage. Overrides scope-aware scanning: all layers are checked globally against these dirs. Example: ["/home/user/my-app/apps/admin"]. | |
| outputFile | No | Absolute path to write full JSON output. Returns only a compact summary to the caller — use this for large outputs to avoid flooding the conversation context. Example: "/tmp/orphan-keys.json" | |
| projectDir | No | Absolute path to the Nuxt project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: "/home/user/my-app". | |
| excludeDirs | No | Directory names to skip when scanning source files. Example: ["storybook", "__tests__", "node_modules"]. |