{"_id":"@adobe-addon-i18n/cli","_rev":"2-f948da3f9ac61be2c8605a19bc273268","name":"@adobe-addon-i18n/cli","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@adobe-addon-i18n/cli","version":"0.1.0","_id":"@adobe-addon-i18n/cli@0.1.0","maintainers":[{"name":"keshav.poha","email":"keshav.poha@gmail.com"}],"bin":{"adobe-addon-i18n":"dist/cli.js"},"dist":{"shasum":"5a4c33a7062057b35360b065beb8684382193248","tarball":"https://registry.npmjs.org/@adobe-addon-i18n/cli/-/cli-0.1.0.tgz","fileCount":10,"integrity":"sha512-zRV/mXRrjDV39wPTslwWOQ/PTHl5FLjBVDmXIBNfMPgTS4ySmwZfaeCGinBIT3kwZMilO0LUxZOkBbjbhDfg3w==","signatures":[{"sig":"MEYCIQDGHR9kxlt8vhlxgbVPqE0QXQpwg7VmWUhMd3JER2NGvgIhAObH0jK3Mam61SHKA/i5XGb376y3aD0zhgblTLSmjx9H","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24932},"main":"./dist/cli.js","types":"dist/cli.d.ts","module":"dist/cli.mjs","exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.mjs","require":"./dist/cli.js"}},"gitHead":"f6a1503cb22c8e35668c8f5ee09930fd8299e615","scripts":{"build":"tsup"},"_npmUser":{"name":"keshav.poha","email":"keshav.poha@gmail.com"},"_npmVersion":"10.9.8","description":"A local AST compiler serving as a static analysis daemon to parse React source files, extract keys, and safely merge them into nested JSON dictionaries. Includes a free Translation Engine.","directories":{},"_nodeVersion":"22.22.3","dependencies":{"cac":"^7.0.0","ts-morph":"^28.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cli_0.1.0_1781876701221_0.44470496009103","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@adobe-addon-i18n/cli","version":"0.2.0","main":"./dist/cli.js","publishConfig":{"access":"public"},"module":"dist/cli.mjs","types":"dist/cli.d.ts","bin":{"adobe-addon-i18n":"dist/cli.js"},"exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.mjs","require":"./dist/cli.js"}},"scripts":{"build":"tsup"},"dependencies":{"cac":"^7.0.0","ts-morph":"^28.0.0"},"_id":"@adobe-addon-i18n/cli@0.2.0","gitHead":"242bf0c4f9d6206a50b8c676a8e212829a0c03ee","description":"A local AST compiler that parses your React source files, extracts every `t()` call, and non-destructively syncs the discovered keys into your locale JSON files. Includes a built-in translation engine powered by the Google Translate API.","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-9axIrDYgnsFlCaYH0+L8DLX2Bf9PmpMLFcmCF7rkL3BzkHwPtS8Aoq6Wh06bqGqEA6ULHoDnBoIOH0nIwtDb3A==","shasum":"d8f0d825ccd6d84220309609e2111b97603f7f13","tarball":"https://registry.npmjs.org/@adobe-addon-i18n/cli/-/cli-0.2.0.tgz","fileCount":11,"unpackedSize":61973,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDlwBpnf/2ZOjbRbbplnzbvemwDetswE6TmDLhnXD+qaQIhAJb0XKkx6KrfzE+GLFaQ2Skw7b0j5dAELu5HgRsPpOKj"}]},"_npmUser":{"name":"keshav.poha","email":"keshav.poha@gmail.com"},"directories":{},"maintainers":[{"name":"keshav.poha","email":"keshav.poha@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cli_0.2.0_1781884872949_0.6337897793488199"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-19T13:45:01.041Z","modified":"2026-06-19T16:01:13.263Z","0.1.0":"2026-06-19T13:45:01.360Z","0.2.0":"2026-06-19T16:01:13.128Z"},"description":"A local AST compiler that parses your React source files, extracts every `t()` call, and non-destructively syncs the discovered keys into your locale JSON files. Includes a built-in translation engine powered by the Google Translate API.","maintainers":[{"name":"keshav.poha","email":"keshav.poha@gmail.com"}],"readme":"# @adobe-addon-i18n/cli\n\nA local AST compiler that parses your React source files, extracts every `t()` call, and non-destructively syncs the discovered keys into your locale JSON files. Includes a built-in translation engine powered by the Google Translate API.\n\nRuns entirely on your machine during development — it is never part of the browser bundle.\n\n---\n\n## Installation\n\n```bash\nnpm install --save-dev @adobe-addon-i18n/cli\n```\n\n---\n\n## Commands\n\n### `sync`\n\nScans your source directory for `t()` calls (in files that import `useTranslation`) and appends any new keys into your locale JSON files as empty strings. Existing translations are **never overwritten**.\n\n```bash\nnpx adobe-addon-i18n sync --src ./src --locales ./locales --langs en,fr,de\n```\n\n| Flag | Default | Description |\n|---|---|---|\n| `--src <path>` | `./src` | Source directory to scan for `t()` calls |\n| `--locales <path>` | `./locales` | Directory where locale JSON files are written |\n| `--langs <list>` | `en` | Comma-separated BCP 47 language tags (e.g. `en,fr,zh-Hant`) |\n\n**Language code validation:** All values passed to `--langs` are validated against the BCP 47 format. Invalid codes (e.g. path traversal sequences) are rejected before any files are touched.\n\n**Dynamic keys:** Only static string literals are extracted (e.g. `t('my.key')`). Template literals, function calls, or ternaries used as the key argument (e.g. `` t(`dynamic.${part}`) ``) cannot be statically analysed and will generate a warning. Add those keys to your JSON files manually.\n\n---\n\n### `translate`\n\nScans your locale directory for empty-string values (`\"\"`), uses the source language file as the reference, and fills in translations via the Google Translate API.\n\n```bash\nnpx adobe-addon-i18n translate --src en --locales ./locales\n```\n\n| Flag | Default | Description |\n|---|---|---|\n| `--src <lang>` | `en` | Source language to translate from (BCP 47 tag) |\n| `--locales <path>` | `./locales` | Directory containing your locale JSON files |\n| `--no-translate` | — | Skip all API calls (see Privacy section below) |\n| `--concurrency <n>` | `5` | Max number of parallel translation requests |\n\n---\n\n## ⚠️ Privacy & Terms of Service Notice\n\nThe `translate` command uses the **unofficial** Google Translate scraper endpoint (`client=gtx`). This endpoint is **not part of Google's public API**, has no SLA, and its use may conflict with Google's Terms of Service.\n\n**Your translation key strings are sent to Google's servers in plain text.** This includes any UI copy, error messages, or labels in your application. Do not use the `translate` command if:\n\n- Your strings contain personally identifiable information (PII).\n- Your organisation has data-residency or GDPR obligations.\n- Your CI environment is air-gapped or has restricted outbound network access.\n\nUse the `--no-translate` flag to suppress all network calls:\n\n```bash\nnpx adobe-addon-i18n translate --src en --locales ./locales --no-translate\n```\n\n---\n\n## Security\n\n- **Prototype pollution protection:** Key paths containing `__proto__`, `constructor`, or `prototype` segments are rejected with an error.\n- **Path traversal protection:** Language codes from `--langs` are validated against a strict BCP 47 regex. Constructed file paths are verified to stay within the locales directory before any reads or writes occur.\n- **JSON schema validation:** Locale files that do not contain a plain JSON object (e.g. arrays, bare strings) are rejected with a descriptive error instead of silently corrupting the merge.\n\n---\n\n## `tsconfig.json` Awareness\n\nThe `sync` command automatically looks for a `tsconfig.json` in your current working directory and passes it to the TypeScript compiler. This ensures that path aliases and custom compiler settings from your project are respected during AST parsing.\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md"}