autoglot 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -28,24 +28,47 @@ autoglot translates JSON message catalogs with Claude. Edit your source locale,
28
28
 
29
29
  ## Quickstart
30
30
 
31
- Run this in your app directory and choose your target locales.
31
+ ### Quickstart — CLI (no GitHub)
32
+
33
+ With Node.js 20 or newer, create an empty directory and preview German translations. The preview needs no Git repository, GitHub account, or API key.
32
34
 
33
35
  ```bash
34
- npx autoglot init
36
+ mkdir autoglot-demo
37
+ cd autoglot-demo
38
+ npx --yes autoglot@0.4.3 init --locales=de
39
+ npx --yes autoglot@0.4.3 --dry-run
35
40
  ```
36
41
 
37
- Review the generated files, install the suggested i18n library, and add `ANTHROPIC_API_KEY` to your GitHub repository secrets. Edit `messages/en.json` and push your branch. For a local preview of the translation plan, run `npx autoglot --dry-run`.
42
+ `init` creates the English and German JSON catalogs and `translate.config.json`. It also generates a GitHub workflow file that you can ignore for local use. The dry run exits with status `0` and includes these lines for the fresh starter catalog.
38
43
 
39
- ### Non-interactive setup
44
+ ```text
45
+ [translate] de → 3 keys (dry-run)
46
+ [translate] Tokens: 0 in / 0 out
47
+ ```
40
48
 
41
- Autoglot 0.4.0 adds unattended setup. From your app directory, pass a comma-separated list of target locales.
49
+ To check whether translations are up to date, run this separately.
42
50
 
43
51
  ```bash
44
- npx --yes autoglot@0.4.2 init --locales=de,pt-BR
45
- npx --yes autoglot@0.4.2 --dry-run
52
+ npx --yes autoglot@0.4.3 --check
46
53
  ```
47
54
 
48
- Setup creates the missing files and skips paths that already exist. The dry run lists the keys to translate for `de` and `pt-BR` without an API key. Add `--install` to opt into installing the runtime libraries. If that install fails, unattended setup exits with an error after printing the retry command.
55
+ On this fresh catalog, the check prints `Locales needing updates: de` and exits with status `1` because the German translations are pending. Both commands leave the catalogs and lock file untouched.
56
+
57
+ #### Generate translations
58
+
59
+ When you're ready to translate, edit `messages/en.json`, set `ANTHROPIC_API_KEY` in your environment, and run the CLI without a preview flag. This sends requests to Anthropic and can incur API charges.
60
+
61
+ ```bash
62
+ npx --yes autoglot@0.4.3
63
+ ```
64
+
65
+ For a dry run with existing catalogs, see the [basic example](https://github.com/ffcabbar/autoglot/tree/main/examples/basic).
66
+
67
+ ### Set up an existing app
68
+
69
+ Run `npx autoglot init` in your app directory and choose your target locales. To set them without prompts, use `npx --yes autoglot@0.4.3 init --locales=de,pt-BR`. Setup creates missing files and skips existing paths. Add `--install` to install the suggested runtime libraries. If that install fails, unattended setup exits with an error after printing the retry command.
70
+
71
+ For GitHub automation, add `ANTHROPIC_API_KEY` to your repository secrets before pushing changes to the source catalog.
49
72
 
50
73
  ### Supported frameworks
51
74
 
@@ -154,16 +177,6 @@ jobs:
154
177
 
155
178
  The action detects pull_request events automatically and pushes translations to the PR's source branch. If you forget the `ref:` line, autoglot prints an error explaining how to fix it instead of silently doing the wrong thing.
156
179
 
157
- ## Quickstart — CLI (no GitHub)
158
-
159
- ```bash
160
- npm install -D autoglot
161
- npx autoglot --dry-run
162
- npx autoglot # Set ANTHROPIC_API_KEY in your environment first
163
- ```
164
-
165
- Works in any CI (GitLab, CircleCI, Jenkins) or on your laptop.
166
-
167
180
  ## vs. the alternatives
168
181
 
169
182
  | | **autoglot** | Languine | Lokalise / Crowdin / Phrase | i18n-ai-translate |
@@ -342,7 +355,7 @@ Issues, PRs, and bug reports welcome. The codebase is intentionally tiny:
342
355
  git clone https://github.com/ffcabbar/autoglot
343
356
  cd autoglot
344
357
  npm test # offline
345
- cd examples/basic && node ../../bin/translate.mjs --dry-run
358
+ cd examples/basic && node ../../bin/cli.mjs --dry-run
346
359
  ```
347
360
 
348
361
  ## Sponsor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoglot",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "AI-powered i18n translation bot. Diff your en.json on every push, translate only what changed, commit the JSON files back. MIT alternative to Languine, Lokalise, and Crowdin.",
5
5
  "type": "module",
6
6
  "bin": {