@quaso-i18n/cli 0.0.0-stage → 1.0.0-rc.1
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.
- package/LICENSE +45 -0
- package/README.md +79 -2
- package/package.json +29 -4
- package/quaso.mjs +8615 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 The Quaso contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Bundled dependency: js-yaml
|
|
24
|
+
|
|
25
|
+
(The MIT License)
|
|
26
|
+
|
|
27
|
+
Copyright (C) 2011-2015 by Vitaly Puzrin
|
|
28
|
+
|
|
29
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
30
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
31
|
+
in the Software without restriction, including without limitation the rights
|
|
32
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
33
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
34
|
+
furnished to do so, subject to the following conditions:
|
|
35
|
+
|
|
36
|
+
The above copyright notice and this permission notice shall be included in
|
|
37
|
+
all copies or substantial portions of the Software.
|
|
38
|
+
|
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
40
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
41
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
42
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
43
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
44
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
45
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,80 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @quaso-i18n/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The command line of Quaso, open-source localization for i18next JSON files. It uploads your source
|
|
4
|
+
files to your team's Quaso instance, writes the translations back into your repository, shows
|
|
5
|
+
progress, holds a release back when translations are missing, and imports the translations you
|
|
6
|
+
already have. It never asks anything, prints JSON with `--json`, and its exit codes say what
|
|
7
|
+
happened, so it works the same on a laptop, in CI and for AI agents.
|
|
8
|
+
|
|
9
|
+
It runs on Node 22 or later and Deno 2.9 or later: one file, no dependencies.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install --save-dev @quaso-i18n/cli # then: npx quaso …
|
|
13
|
+
deno run -A npm:@quaso-i18n/cli status # or with Deno, from npm
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Connecting
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
export QUASO_HOSTNAME=translate.yourgame.com # https is assumed; http://localhost:8000 works too
|
|
20
|
+
export QUASO_API_KEY=qso_… # read scope: download, status; upload scope: upload, import
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The API key only ever comes from the environment. `"hostname"` in the config file is a fallback for
|
|
24
|
+
`QUASO_HOSTNAME`.
|
|
25
|
+
|
|
26
|
+
## The config file
|
|
27
|
+
|
|
28
|
+
`quaso.config.json`, in the current folder or the nearest parent (`quaso init` writes one):
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"sourceLanguage": "en",
|
|
33
|
+
"languages": ["de", "fr", "pl", "ja", "zh-Hans"],
|
|
34
|
+
"languageMapping": { "zh-Hans": "zh-CN" },
|
|
35
|
+
"files": [{ "source": "src/locales/en/**/*.json", "translation": "src/locales/{lang}/{path}" }],
|
|
36
|
+
"limits": [{ "file": "store.json", "key": "title", "maxLength": 30 }]
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`{lang}` is the language as your game names it (after `languageMapping`); `{path}` is the source
|
|
41
|
+
file's path below the folder where the glob starts.
|
|
42
|
+
|
|
43
|
+
## Commands
|
|
44
|
+
|
|
45
|
+
| Command | Does | Options |
|
|
46
|
+
| ----------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
47
|
+
| `quaso init` | writes a starter `quaso.config.json`, and never overwrites one | `--languages` (required), `--source`, `--files`, `--translation` |
|
|
48
|
+
| `quaso upload` | sends the source files and reports what was added, changed and removed | `--dry-run`, `--file`, `--rename old=new`, `--wait` |
|
|
49
|
+
| `quaso download` | writes every language's files, skipping files that haven't changed | `--dry-run`, `--language`, `--file`, `--prune` |
|
|
50
|
+
| `quaso translate` | asks the instance's LLM to translate untranslated strings, and waits for it | `--language`, `--file`, `--retranslate`, `--instruction`, `--model`, `--no-wait`, `--dry-run` |
|
|
51
|
+
| `quaso status` | shows progress per language: untranslated, green, blue, outdated, pending, QA | `--language`, `--fail-on untranslated` (or `outdated`, `green`) |
|
|
52
|
+
| `quaso import` | imports existing translation files | `--as green` or `--as blue`, `--language`, `--file`, `--overwrite`, `--keep-identical`, `--dry-run` |
|
|
53
|
+
| `quaso version`, `quaso help` | print the version, or the help of a command | |
|
|
54
|
+
|
|
55
|
+
Every command takes `--json` (one JSON document on stdout, with a `schemaVersion`), `--cwd <dir>`,
|
|
56
|
+
`--config <path>` and `--help`. Results go to stdout, progress and errors to stderr; colours only in
|
|
57
|
+
a terminal, and never with `NO_COLOR`.
|
|
58
|
+
|
|
59
|
+
## Exit codes
|
|
60
|
+
|
|
61
|
+
| Code | Meaning |
|
|
62
|
+
| ---- | ---------------------------------------------------------------------- |
|
|
63
|
+
| 0 | success |
|
|
64
|
+
| 1 | unexpected error |
|
|
65
|
+
| 2 | bad usage or invalid config |
|
|
66
|
+
| 3 | authentication or permission problem (missing API key, wrong scope) |
|
|
67
|
+
| 4 | network error or server unavailable (safe to retry) |
|
|
68
|
+
| 5 | invalid source file (JSON syntax, duplicate key) |
|
|
69
|
+
| 6 | finished, but some items were refused or failed; the output lists them |
|
|
70
|
+
| 7 | the `status --fail-on` condition is met |
|
|
71
|
+
|
|
72
|
+
## Safety
|
|
73
|
+
|
|
74
|
+
The CLI computes every output path itself from the config and the languages it asked for, and
|
|
75
|
+
refuses to write a source file, the source language, a file a `source` glob would find, or anything
|
|
76
|
+
outside the folder of `quaso.config.json`. It only sends files from inside that folder, never
|
|
77
|
+
through a symbolic link that leads out of it. It never starts other programs and never runs git.
|
|
78
|
+
|
|
79
|
+
The full guide, with every option, JSON output, CI and AI agents, is `docs/cli.md` in the Quaso
|
|
80
|
+
repository.
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quaso-i18n/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"description": "The command line of Quaso, localization for i18next JSON files: upload, download, status and import, from a laptop, from CI and for AI agents",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"quaso": "quaso.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"quaso.mjs",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"i18next",
|
|
20
|
+
"localization",
|
|
21
|
+
"translation",
|
|
22
|
+
"i18n",
|
|
23
|
+
"cli",
|
|
24
|
+
"quaso"
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/explodi/quaso.git",
|
|
29
|
+
"directory": "packages/cli"
|
|
30
|
+
}
|
|
31
|
+
}
|