Remove Orphan Keys
remove_orphan_keysIdentify translation keys not referenced in source code and remove them from all locale files, with a dry run first.
Instructions
Find orphan keys (not referenced in source code) and remove them from all locale files. Always does a dry run first. Scope-aware like find_orphan_keys: each layer is checked against its consuming apps (summary.scanScope), and keys referenced only from non-consuming apps are reported as misplacedUsages and never removed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layer | No | Layer name to clean up (e.g., "root", "app-admin"). If omitted, cleans all layers. Call discover to discover available layers. | |
| dryRun | No | When true (default), only reports what would be removed without deleting anything. Set to false to permanently delete orphan keys. | |
| locale | No | Locale code to read translation keys from for orphan detection (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/cleanup-unused.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"]. |