@localess/cli 3.0.6-dev.20260506093132 → 3.0.6-dev.20260512202133
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/README.md +36 -32
- package/SKILL.md +41 -28
- package/dist/index.mjs +5 -1
- package/dist/models/translation.zod.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,11 +48,11 @@ If any option is omitted, the CLI will interactively prompt for the missing valu
|
|
|
48
48
|
|
|
49
49
|
**Options:**
|
|
50
50
|
|
|
51
|
-
| Flag
|
|
52
|
-
|
|
51
|
+
| Flag | Description |
|
|
52
|
+
|-------------------------|-------------------------------------------------------------|
|
|
53
53
|
| `-o, --origin <origin>` | Localess instance URL (e.g., `https://my-localess.web.app`) |
|
|
54
|
-
| `-s, --space <space>`
|
|
55
|
-
| `-t, --token <token>`
|
|
54
|
+
| `-s, --space <space>` | Space ID (found in Localess Space settings) |
|
|
55
|
+
| `-t, --token <token>` | API token (input is masked for security) |
|
|
56
56
|
|
|
57
57
|
**Examples:**
|
|
58
58
|
|
|
@@ -76,11 +76,11 @@ export LOCALESS_TOKEN=MY_API_TOKEN
|
|
|
76
76
|
localess translations pull en --path ./public/locales/en.json
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
| Variable
|
|
80
|
-
|
|
79
|
+
| Variable | Description |
|
|
80
|
+
|-------------------|-----------------------|
|
|
81
81
|
| `LOCALESS_ORIGIN` | Localess instance URL |
|
|
82
|
-
| `LOCALESS_SPACE`
|
|
83
|
-
| `LOCALESS_TOKEN`
|
|
82
|
+
| `LOCALESS_SPACE` | Space ID |
|
|
83
|
+
| `LOCALESS_TOKEN` | API token |
|
|
84
84
|
|
|
85
85
|
---
|
|
86
86
|
|
|
@@ -108,25 +108,26 @@ localess translations push <locale> --path <file> [options]
|
|
|
108
108
|
|
|
109
109
|
**Arguments:**
|
|
110
110
|
|
|
111
|
-
| Argument
|
|
112
|
-
|
|
111
|
+
| Argument | Description |
|
|
112
|
+
|------------|------------------------------------------------|
|
|
113
113
|
| `<locale>` | ISO 639-1 locale code (e.g., `en`, `de`, `fr`) |
|
|
114
114
|
|
|
115
115
|
**Options:**
|
|
116
116
|
|
|
117
|
-
| Flag
|
|
118
|
-
|
|
119
|
-
| `-p, --path <path>`
|
|
120
|
-
| `-f, --format <format>` | `flat`
|
|
121
|
-
| `-t, --type <type>`
|
|
122
|
-
| `--dry-run`
|
|
117
|
+
| Flag | Default | Description |
|
|
118
|
+
|-------------------------|---------------|------------------------------------------------------------------------|
|
|
119
|
+
| `-p, --path <path>` | *(required)* | Path to the JSON translations file |
|
|
120
|
+
| `-f, --format <format>` | `flat` | File format: `flat` or `nested` |
|
|
121
|
+
| `-t, --type <type>` | `add-missing` | Update strategy: `add-missing`, `update-existing`, or `delete-missing` |
|
|
122
|
+
| `--dry-run` | `false` | Preview changes without applying them |
|
|
123
123
|
|
|
124
124
|
**Update Strategies:**
|
|
125
125
|
|
|
126
|
-
| Type
|
|
127
|
-
|
|
128
|
-
| `add-missing`
|
|
129
|
-
| `update-existing` | Updates translations for keys that already exist in Localess
|
|
126
|
+
| Type | Description |
|
|
127
|
+
|-------------------|-------------------------------------------------------------------------------|
|
|
128
|
+
| `add-missing` | Adds translations for keys that do not yet exist in Localess |
|
|
129
|
+
| `update-existing` | Updates translations for keys that already exist in Localess |
|
|
130
|
+
| `delete-missing` | Deletes translations in Localess for keys that are absent from the local file |
|
|
130
131
|
|
|
131
132
|
**File Formats:**
|
|
132
133
|
|
|
@@ -155,6 +156,9 @@ localess translations push en --path ./locales/en.json
|
|
|
155
156
|
# Push with update-existing strategy
|
|
156
157
|
localess translations push en --path ./locales/en.json --type update-existing
|
|
157
158
|
|
|
159
|
+
# Delete keys in Localess absent from the local file
|
|
160
|
+
localess translations push en --path ./locales/en.json --type delete-missing
|
|
161
|
+
|
|
158
162
|
# Preview changes without applying (dry run)
|
|
159
163
|
localess translations push en --path ./locales/en.json --dry-run
|
|
160
164
|
|
|
@@ -174,16 +178,16 @@ localess translations pull <locale> --path <file> [options]
|
|
|
174
178
|
|
|
175
179
|
**Arguments:**
|
|
176
180
|
|
|
177
|
-
| Argument
|
|
178
|
-
|
|
181
|
+
| Argument | Description |
|
|
182
|
+
|------------|------------------------------------------------|
|
|
179
183
|
| `<locale>` | ISO 639-1 locale code (e.g., `en`, `de`, `fr`) |
|
|
180
184
|
|
|
181
185
|
**Options:**
|
|
182
186
|
|
|
183
|
-
| Flag
|
|
184
|
-
|
|
185
|
-
| `-p, --path <path>`
|
|
186
|
-
| `-f, --format <format>` | `flat`
|
|
187
|
+
| Flag | Default | Description |
|
|
188
|
+
|-------------------------|--------------|---------------------------------|
|
|
189
|
+
| `-p, --path <path>` | *(required)* | Output file path |
|
|
190
|
+
| `-f, --format <format>` | `flat` | File format: `flat` or `nested` |
|
|
187
191
|
|
|
188
192
|
**Examples:**
|
|
189
193
|
|
|
@@ -209,8 +213,8 @@ localess types generate [--path <output_path>]
|
|
|
209
213
|
|
|
210
214
|
**Options:**
|
|
211
215
|
|
|
212
|
-
| Flag
|
|
213
|
-
|
|
216
|
+
| Flag | Default | Description |
|
|
217
|
+
|---------------------|---------------------------|---------------------------------------------------------|
|
|
214
218
|
| `-p, --path <path>` | `.localess/localess.d.ts` | Path to write the generated TypeScript definitions file |
|
|
215
219
|
|
|
216
220
|
> **Note:** Your API token must have **Development Tools** permission enabled in Localess Space settings.
|
|
@@ -240,10 +244,10 @@ const content = await client.getContentBySlug<Page>('home', { locale: 'en' });
|
|
|
240
244
|
|
|
241
245
|
## Stored Files
|
|
242
246
|
|
|
243
|
-
| File
|
|
244
|
-
|
|
245
|
-
| `.localess/credentials.json` | Stored login credentials (created by `localess login`)
|
|
246
|
-
| `.localess/localess.d.ts`
|
|
247
|
+
| File | Description |
|
|
248
|
+
|------------------------------|-------------------------------------------------------------------------|
|
|
249
|
+
| `.localess/credentials.json` | Stored login credentials (created by `localess login`) |
|
|
250
|
+
| `.localess/localess.d.ts` | Generated TypeScript definitions (created by `localess types generate`) |
|
|
247
251
|
|
|
248
252
|
> It is recommended to add `.localess/credentials.json` to your `.gitignore` to avoid committing sensitive credentials.
|
|
249
253
|
|
package/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
`@localess/cli` is the **command-line interface** for the Localess headless CMS platform. It enables:
|
|
6
6
|
|
|
7
7
|
- Authenticating with a Localess instance
|
|
8
|
-
- Pushing and pulling translations (flat
|
|
8
|
+
- Pushing and pulling translations (flat and nested JSON formats supported for both push and pull)
|
|
9
9
|
- Generating TypeScript type definitions from the OpenAPI schema
|
|
10
10
|
|
|
11
11
|
**Status:** Early development (v3.0.1). Requires Node.js >= 20.0.0.
|
|
@@ -105,29 +105,30 @@ localess translations push <locale> --path <file> [options]
|
|
|
105
105
|
|
|
106
106
|
**Arguments:**
|
|
107
107
|
|
|
108
|
-
| Argument | Description
|
|
109
|
-
|
|
108
|
+
| Argument | Description |
|
|
109
|
+
|------------|------------------------------------|
|
|
110
110
|
| `<locale>` | ISO 639-1 locale code: `en`, `de`… |
|
|
111
111
|
|
|
112
112
|
**Options:**
|
|
113
113
|
|
|
114
|
-
| Flag | Default
|
|
115
|
-
|
|
116
|
-
| `-p, --path <path>` | required
|
|
117
|
-
| `-f, --format <format>` | `flat`
|
|
118
|
-
| `-t, --type <type>` | `add-missing`
|
|
119
|
-
| `--dry-run` | `false`
|
|
114
|
+
| Flag | Default | Description |
|
|
115
|
+
|-------------------------|---------------|---------------------------------------------------------------------|
|
|
116
|
+
| `-p, --path <path>` | required | Path to the translations JSON file |
|
|
117
|
+
| `-f, --format <format>` | `flat` | File format: `flat` or `nested` |
|
|
118
|
+
| `-t, --type <type>` | `add-missing` | Update strategy: `add-missing`, `update-existing`, `delete-missing` |
|
|
119
|
+
| `--dry-run` | `false` | Preview changes without applying them |
|
|
120
120
|
|
|
121
121
|
**Update Strategies:**
|
|
122
122
|
|
|
123
|
-
| Strategy
|
|
124
|
-
|
|
125
|
-
| `add-missing`
|
|
126
|
-
| `update-existing`
|
|
123
|
+
| Strategy | Behaviour |
|
|
124
|
+
|-------------------|--------------------------------------------------------------------------------|
|
|
125
|
+
| `add-missing` | Only adds keys that don't yet exist in Localess |
|
|
126
|
+
| `update-existing` | Only updates keys that already exist in Localess |
|
|
127
|
+
| `delete-missing` | Deletes keys in Localess that are absent from the local file |
|
|
127
128
|
|
|
128
129
|
**File Formats:**
|
|
129
130
|
|
|
130
|
-
*Flat (default
|
|
131
|
+
*Flat (default):*
|
|
131
132
|
```json
|
|
132
133
|
{
|
|
133
134
|
"common.submit": "Submit",
|
|
@@ -136,7 +137,13 @@ localess translations push <locale> --path <file> [options]
|
|
|
136
137
|
}
|
|
137
138
|
```
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
*Nested (automatically flattened before uploading):*
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"common": { "submit": "Submit" },
|
|
144
|
+
"nav": { "home": "Home" }
|
|
145
|
+
}
|
|
146
|
+
```
|
|
140
147
|
|
|
141
148
|
**Examples:**
|
|
142
149
|
|
|
@@ -147,8 +154,14 @@ localess translations push en --path ./locales/en.json
|
|
|
147
154
|
# Update existing translations (don't add new)
|
|
148
155
|
localess translations push de --path ./locales/de.json --type update-existing
|
|
149
156
|
|
|
157
|
+
# Delete keys in Localess absent from the local file
|
|
158
|
+
localess translations push de --path ./locales/de.json --type delete-missing
|
|
159
|
+
|
|
150
160
|
# Preview changes without applying
|
|
151
161
|
localess translations push fr --path ./locales/fr.json --dry-run
|
|
162
|
+
|
|
163
|
+
# Push nested-format translations
|
|
164
|
+
localess translations push de --path ./locales/de.json --format nested
|
|
152
165
|
```
|
|
153
166
|
|
|
154
167
|
---
|
|
@@ -163,16 +176,16 @@ localess translations pull <locale> --path <file> [options]
|
|
|
163
176
|
|
|
164
177
|
**Arguments:**
|
|
165
178
|
|
|
166
|
-
| Argument | Description
|
|
167
|
-
|
|
179
|
+
| Argument | Description |
|
|
180
|
+
|------------|------------------------------------|
|
|
168
181
|
| `<locale>` | ISO 639-1 locale code: `en`, `de`… |
|
|
169
182
|
|
|
170
183
|
**Options:**
|
|
171
184
|
|
|
172
|
-
| Flag | Default | Description
|
|
173
|
-
|
|
174
|
-
| `-p, --path <path>` | required | Output file path
|
|
175
|
-
| `-f, --format <format>` | `flat` | File format: `flat` or `nested`
|
|
185
|
+
| Flag | Default | Description |
|
|
186
|
+
|-------------------------|-----------|---------------------------------|
|
|
187
|
+
| `-p, --path <path>` | required | Output file path |
|
|
188
|
+
| `-f, --format <format>` | `flat` | File format: `flat` or `nested` |
|
|
176
189
|
|
|
177
190
|
**Examples:**
|
|
178
191
|
|
|
@@ -196,9 +209,9 @@ localess types generate [--path <output>]
|
|
|
196
209
|
|
|
197
210
|
**Options:**
|
|
198
211
|
|
|
199
|
-
| Flag | Default
|
|
200
|
-
|
|
201
|
-
| `-p, --path <path>` | `.localess/localess.d.ts`
|
|
212
|
+
| Flag | Default | Description |
|
|
213
|
+
|---------------------|---------------------------|------------------|
|
|
214
|
+
| `-p, --path <path>` | `.localess/localess.d.ts` | Output file path |
|
|
202
215
|
|
|
203
216
|
> **Prerequisite:** The API token must have the **Development Tools** permission in Localess Space settings.
|
|
204
217
|
|
|
@@ -344,10 +357,10 @@ If you want to commit generated types while still ignoring credentials, you can
|
|
|
344
357
|
|
|
345
358
|
## Files Written by the CLI
|
|
346
359
|
|
|
347
|
-
| File
|
|
348
|
-
|
|
349
|
-
| `.localess/credentials.json`
|
|
350
|
-
| `.localess/localess.d.ts`
|
|
360
|
+
| File | Created by | Permissions | Purpose |
|
|
361
|
+
|------------------------------|---------------------------|----------------------|----------------------------|
|
|
362
|
+
| `.localess/credentials.json` | `localess login` | `0o600` (owner only) | Persisted auth credentials |
|
|
363
|
+
| `.localess/localess.d.ts` | `localess types generate` | Standard | Generated TypeScript types |
|
|
351
364
|
|
|
352
365
|
---
|
|
353
366
|
|
package/dist/index.mjs
CHANGED
|
@@ -359,7 +359,11 @@ var j = new e("login").description("Login to Localess CLI").option("-o, --origin
|
|
|
359
359
|
await w(t.path, JSON.stringify(e, null, 2));
|
|
360
360
|
}
|
|
361
361
|
console.log("Successfully saved translations from Localess");
|
|
362
|
-
}), R = f.record(f.string(), f.string()), z = f.enum([
|
|
362
|
+
}), R = f.record(f.string(), f.string()), z = f.enum([
|
|
363
|
+
"add-missing",
|
|
364
|
+
"update-existing",
|
|
365
|
+
"delete-missing"
|
|
366
|
+
]);
|
|
363
367
|
f.object({
|
|
364
368
|
type: z,
|
|
365
369
|
values: R
|
|
@@ -3,11 +3,13 @@ export declare const zLocaleTranslationsSchema: z.ZodRecord<z.ZodString, z.ZodSt
|
|
|
3
3
|
export declare const zTranslationUpdateTypeSchema: z.ZodEnum<{
|
|
4
4
|
"add-missing": "add-missing";
|
|
5
5
|
"update-existing": "update-existing";
|
|
6
|
+
"delete-missing": "delete-missing";
|
|
6
7
|
}>;
|
|
7
8
|
export declare const zTranslationUpdateSchema: z.ZodObject<{
|
|
8
9
|
type: z.ZodEnum<{
|
|
9
10
|
"add-missing": "add-missing";
|
|
10
11
|
"update-existing": "update-existing";
|
|
12
|
+
"delete-missing": "delete-missing";
|
|
11
13
|
}>;
|
|
12
14
|
values: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
13
15
|
}, z.core.$strip>;
|