@localess/cli 3.0.6-dev.20260502214443 → 3.0.6-dev.20260512074100

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 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 | Description |
52
- |------|-------------|
51
+ | Flag | Description |
52
+ |-------------------------|-------------------------------------------------------------|
53
53
  | `-o, --origin <origin>` | Localess instance URL (e.g., `https://my-localess.web.app`) |
54
- | `-s, --space <space>` | Space ID (found in Localess Space settings) |
55
- | `-t, --token <token>` | API token (input is masked for security) |
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 | Description |
80
- |----------|-------------|
79
+ | Variable | Description |
80
+ |-------------------|-----------------------|
81
81
  | `LOCALESS_ORIGIN` | Localess instance URL |
82
- | `LOCALESS_SPACE` | Space ID |
83
- | `LOCALESS_TOKEN` | API token |
82
+ | `LOCALESS_SPACE` | Space ID |
83
+ | `LOCALESS_TOKEN` | API token |
84
84
 
85
85
  ---
86
86
 
@@ -108,24 +108,24 @@ localess translations push <locale> --path <file> [options]
108
108
 
109
109
  **Arguments:**
110
110
 
111
- | Argument | Description |
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 | 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` or `update-existing` |
122
- | `--dry-run` | `false` | Preview changes without applying them |
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` or `update-existing` |
122
+ | `--dry-run` | `false` | Preview changes without applying them |
123
123
 
124
124
  **Update Strategies:**
125
125
 
126
- | Type | Description |
127
- |------|-------------|
128
- | `add-missing` | Adds translations for keys that do not yet exist in Localess |
126
+ | Type | Description |
127
+ |-------------------|--------------------------------------------------------------|
128
+ | `add-missing` | Adds translations for keys that do not yet exist in Localess |
129
129
  | `update-existing` | Updates translations for keys that already exist in Localess |
130
130
 
131
131
  **File Formats:**
@@ -174,16 +174,16 @@ localess translations pull <locale> --path <file> [options]
174
174
 
175
175
  **Arguments:**
176
176
 
177
- | Argument | Description |
178
- |----------|-------------|
177
+ | Argument | Description |
178
+ |------------|------------------------------------------------|
179
179
  | `<locale>` | ISO 639-1 locale code (e.g., `en`, `de`, `fr`) |
180
180
 
181
181
  **Options:**
182
182
 
183
- | Flag | Default | Description |
184
- |------|---------|-------------|
185
- | `-p, --path <path>` | *(required)* | Output file path |
186
- | `-f, --format <format>` | `flat` | File format: `flat` or `nested` |
183
+ | Flag | Default | Description |
184
+ |-------------------------|--------------|---------------------------------|
185
+ | `-p, --path <path>` | *(required)* | Output file path |
186
+ | `-f, --format <format>` | `flat` | File format: `flat` or `nested` |
187
187
 
188
188
  **Examples:**
189
189
 
@@ -209,8 +209,8 @@ localess types generate [--path <output_path>]
209
209
 
210
210
  **Options:**
211
211
 
212
- | Flag | Default | Description |
213
- |------|---------|-------------|
212
+ | Flag | Default | Description |
213
+ |---------------------|---------------------------|---------------------------------------------------------|
214
214
  | `-p, --path <path>` | `.localess/localess.d.ts` | Path to write the generated TypeScript definitions file |
215
215
 
216
216
  > **Note:** Your API token must have **Development Tools** permission enabled in Localess Space settings.
@@ -240,10 +240,10 @@ const content = await client.getContentBySlug<Page>('home', { locale: 'en' });
240
240
 
241
241
  ## Stored Files
242
242
 
243
- | File | Description |
244
- |------|-------------|
245
- | `.localess/credentials.json` | Stored login credentials (created by `localess login`) |
246
- | `.localess/localess.d.ts` | Generated TypeScript definitions (created by `localess types generate`) |
243
+ | File | Description |
244
+ |------------------------------|-------------------------------------------------------------------------|
245
+ | `.localess/credentials.json` | Stored login credentials (created by `localess login`) |
246
+ | `.localess/localess.d.ts` | Generated TypeScript definitions (created by `localess types generate`) |
247
247
 
248
248
  > It is recommended to add `.localess/credentials.json` to your `.gitignore` to avoid committing sensitive credentials.
249
249
 
package/SKILL.md CHANGED
@@ -105,18 +105,18 @@ 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 | Description |
115
- |-------------------------|-----------------|-------------------------------------------------------|
116
- | `-p, --path <path>` | required | Path to the translations JSON file |
114
+ | Flag | Default | Description |
115
+ |-------------------------|-----------------|-----------------------------------------------------------|
116
+ | `-p, --path <path>` | required | Path to the translations JSON file |
117
117
  | `-f, --format <format>` | `flat` | File format: `flat` only (**nested not yet implemented**) |
118
- | `-t, --type <type>` | `add-missing` | Update strategy: `add-missing` or `update-existing` |
119
- | `--dry-run` | `false` | Preview changes without applying them |
118
+ | `-t, --type <type>` | `add-missing` | Update strategy: `add-missing` or `update-existing` |
119
+ | `--dry-run` | `false` | Preview changes without applying them |
120
120
 
121
121
  **Update Strategies:**
122
122
 
@@ -163,8 +163,8 @@ localess translations pull <locale> --path <file> [options]
163
163
 
164
164
  **Arguments:**
165
165
 
166
- | Argument | Description |
167
- |------------|-------------------------------------|
166
+ | Argument | Description |
167
+ |------------|------------------------------------|
168
168
  | `<locale>` | ISO 639-1 locale code: `en`, `de`… |
169
169
 
170
170
  **Options:**
@@ -196,9 +196,9 @@ localess types generate [--path <output>]
196
196
 
197
197
  **Options:**
198
198
 
199
- | Flag | Default | Description |
200
- |---------------------|-------------------------------|-------------------------------|
201
- | `-p, --path <path>` | `.localess/localess.d.ts` | Output file path |
199
+ | Flag | Default | Description |
200
+ |---------------------|---------------------------|------------------|
201
+ | `-p, --path <path>` | `.localess/localess.d.ts` | Output file path |
202
202
 
203
203
  > **Prerequisite:** The API token must have the **Development Tools** permission in Localess Space settings.
204
204
 
@@ -344,10 +344,10 @@ If you want to commit generated types while still ignoring credentials, you can
344
344
 
345
345
  ## Files Written by the CLI
346
346
 
347
- | File | Created by | Permissions | Purpose |
348
- |-------------------------------|-----------------------------|----------------|--------------------------------|
349
- | `.localess/credentials.json` | `localess login` | `0o600` (owner only) | Persisted auth credentials |
350
- | `.localess/localess.d.ts` | `localess types generate` | Standard | Generated TypeScript types |
347
+ | File | Created by | Permissions | Purpose |
348
+ |------------------------------|---------------------------|----------------------|----------------------------|
349
+ | `.localess/credentials.json` | `localess login` | `0o600` (owner only) | Persisted auth credentials |
350
+ | `.localess/localess.d.ts` | `localess types generate` | Standard | Generated TypeScript types |
351
351
 
352
352
  ---
353
353
 
package/dist/client.d.ts CHANGED
@@ -24,8 +24,13 @@ export type LocalessClientOptions = {
24
24
  */
25
25
  debug?: boolean;
26
26
  /**
27
- * Cache TTL (time to live) for API responses. Default is 5 minutes (300000 ms).
28
- * Set to false to disable caching.
27
+ * Cache TTL (time to live) in **seconds** for API responses.
28
+ *
29
+ * - `undefined` — use default in-memory TTL cache with 5 minutes TTL (default)
30
+ * - `number` — use in-memory TTL cache with the given TTL in seconds
31
+ * - `false` — disable caching entirely (always fetches fresh data)
32
+ *
33
+ * @default 300 (5 minutes)
29
34
  */
30
35
  cacheTTL?: number | false;
31
36
  /**
package/dist/index.mjs CHANGED
@@ -87,81 +87,81 @@ function S(e) {
87
87
  "X-Localess-Agent": "Localess-CLI-Client",
88
88
  "X-Localess-Agent-Version": "0.9.0"
89
89
  }
90
- }, r = e.cacheTTL === !1 ? new p() : new m(e.cacheTTL);
90
+ }, r = typeof e.cacheTTL == "number" ? e.cacheTTL * 1e3 : void 0, i = e.cacheTTL === !1 ? new p() : new m(r);
91
91
  return {
92
92
  async getSpace() {
93
93
  e.debug && console.log(b, "getSpace()");
94
- let i = `${t}/api/v1/spaces/${e.spaceId}?token=${e.token}`;
95
- if (e.debug && console.log(b, "getSpace fetch url : ", i), r.has(i)) return e.debug && console.log(b, "getSpace cache hit"), r.get(i);
94
+ let r = `${t}/api/v1/spaces/${e.spaceId}?token=${e.token}`;
95
+ if (e.debug && console.log(b, "getSpace fetch url : ", r), i.has(r)) return e.debug && console.log(b, "getSpace cache hit"), i.get(r);
96
96
  try {
97
- let t = await x(i, n, e.retryCount, e.retryDelay, e.debug);
97
+ let t = await x(r, n, e.retryCount, e.retryDelay, e.debug);
98
98
  e.debug && console.log(b, "getSpace status : ", t.status);
99
99
  let a = await t.json();
100
- return r.set(i, a), a;
100
+ return i.set(r, a), a;
101
101
  } catch (e) {
102
102
  return console.error(b, "getSpace error : ", e), {};
103
103
  }
104
104
  },
105
- async getLinks(i) {
106
- e.debug && console.log(b, "getLinks() params : ", JSON.stringify(i));
105
+ async getLinks(r) {
106
+ e.debug && console.log(b, "getLinks() params : ", JSON.stringify(r));
107
107
  let a = "";
108
- i?.kind && (a = `&kind=${i.kind}`);
108
+ r?.kind && (a = `&kind=${r.kind}`);
109
109
  let o = "";
110
- i?.parentSlug && (o = `&parentSlug=${i.parentSlug}`);
110
+ r?.parentSlug && (o = `&parentSlug=${r.parentSlug}`);
111
111
  let s = "";
112
- i?.excludeChildren && (s = `&excludeChildren=${i.excludeChildren}`);
112
+ r?.excludeChildren && (s = `&excludeChildren=${r.excludeChildren}`);
113
113
  let c = `${t}/api/v1/spaces/${e.spaceId}/links?token=${e.token}${a}${o}${s}`;
114
- if (e.debug && console.log(b, "getLinks fetch url : ", c), r.has(c)) return e.debug && console.log(b, "getLinks cache hit"), r.get(c);
114
+ if (e.debug && console.log(b, "getLinks fetch url : ", c), i.has(c)) return e.debug && console.log(b, "getLinks cache hit"), i.get(c);
115
115
  try {
116
116
  let t = await x(c, n, e.retryCount, e.retryDelay, e.debug);
117
117
  e.debug && console.log(b, "getLinks status : ", t.status);
118
- let i = await t.json();
119
- return r.set(c, i), i;
118
+ let r = await t.json();
119
+ return i.set(c, r), r;
120
120
  } catch (e) {
121
121
  return console.error(b, "getLinks error : ", e), {};
122
122
  }
123
123
  },
124
- async getContentBySlug(i, a) {
125
- e.debug && (console.log(b, "getContentBySlug() slug : ", i), console.log(b, "getContentBySlug() params : ", JSON.stringify(a)));
124
+ async getContentBySlug(r, a) {
125
+ e.debug && (console.log(b, "getContentBySlug() slug : ", r), console.log(b, "getContentBySlug() params : ", JSON.stringify(a)));
126
126
  let o = "";
127
127
  e?.version && e.version == "draft" && (o = `&version=${e.version}`), a?.version && a.version == "draft" && (o = `&version=${a.version}`);
128
- let s = a?.locale ? `&locale=${a.locale}` : "", c = a?.resolveReference ? `&resolveReference=${a.resolveReference}` : "", l = a?.resolveLink ? `&resolveLink=${a.resolveLink}` : "", u = `${t}/api/v1/spaces/${e.spaceId}/contents/slugs/${i}?token=${e.token}${o}${s}${c}${l}`;
129
- if (e.debug && console.log(b, "getContentBySlug fetch url : ", u), r.has(u)) return e.debug && console.log(b, "getContentBySlug cache hit"), r.get(u);
128
+ let s = a?.locale ? `&locale=${a.locale}` : "", c = a?.resolveReference ? `&resolveReference=${a.resolveReference}` : "", l = a?.resolveLink ? `&resolveLink=${a.resolveLink}` : "", u = `${t}/api/v1/spaces/${e.spaceId}/contents/slugs/${r}?token=${e.token}${o}${s}${c}${l}`;
129
+ if (e.debug && console.log(b, "getContentBySlug fetch url : ", u), i.has(u)) return e.debug && console.log(b, "getContentBySlug cache hit"), i.get(u);
130
130
  try {
131
131
  let t = await x(u, n, e.retryCount, e.retryDelay, e.debug);
132
132
  e.debug && console.log(b, "getContentBySlug status : ", t.status);
133
- let i = await t.json();
134
- return r.set(u, i), i;
133
+ let r = await t.json();
134
+ return i.set(u, r), r;
135
135
  } catch (e) {
136
136
  return console.error(b, "getContentBySlug error : ", e), {};
137
137
  }
138
138
  },
139
- async getContentById(i, a) {
140
- e.debug && (console.log(b, "getContentById() id : ", i), console.log(b, "getContentById() params : ", JSON.stringify(a)));
139
+ async getContentById(r, a) {
140
+ e.debug && (console.log(b, "getContentById() id : ", r), console.log(b, "getContentById() params : ", JSON.stringify(a)));
141
141
  let o = "";
142
142
  e?.version && e.version == "draft" && (o = `&version=${e.version}`), a?.version && a.version == "draft" && (o = `&version=${a.version}`);
143
- let s = a?.locale ? `&locale=${a.locale}` : "", c = a?.resolveReference ? `&resolveReference=${a.resolveReference}` : "", l = a?.resolveLink ? `&resolveLink=${a.resolveLink}` : "", u = `${t}/api/v1/spaces/${e.spaceId}/contents/${i}?token=${e.token}${o}${s}${c}${l}`;
144
- if (e.debug && console.log(b, "getContentById fetch url : ", u), r.has(u)) return e.debug && console.log(b, "getContentById cache hit"), r.get(u);
143
+ let s = a?.locale ? `&locale=${a.locale}` : "", c = a?.resolveReference ? `&resolveReference=${a.resolveReference}` : "", l = a?.resolveLink ? `&resolveLink=${a.resolveLink}` : "", u = `${t}/api/v1/spaces/${e.spaceId}/contents/${r}?token=${e.token}${o}${s}${c}${l}`;
144
+ if (e.debug && console.log(b, "getContentById fetch url : ", u), i.has(u)) return e.debug && console.log(b, "getContentById cache hit"), i.get(u);
145
145
  try {
146
146
  let t = await x(u, n, e.retryCount, e.retryDelay, e.debug);
147
147
  e.debug && console.log(b, "getContentById status : ", t.status);
148
- let i = await t.json();
149
- return r.set(u, i), i;
148
+ let r = await t.json();
149
+ return i.set(u, r), r;
150
150
  } catch (e) {
151
151
  return console.error(b, "getContentById error : ", e), {};
152
152
  }
153
153
  },
154
- async getTranslations(i, a) {
155
- e.debug && (console.log(b, "getTranslations() locale : ", i), console.log(b, "getTranslations() params : ", JSON.stringify(a)));
154
+ async getTranslations(r, a) {
155
+ e.debug && (console.log(b, "getTranslations() locale : ", r), console.log(b, "getTranslations() params : ", JSON.stringify(a)));
156
156
  let o = "";
157
157
  e?.version && e.version == "draft" && (o = `&version=${e.version}`), a?.version && a.version == "draft" && (o = `&version=${a.version}`);
158
- let s = `${t}/api/v1/spaces/${e.spaceId}/translations/${i}?token=${e.token}${o}`;
159
- if (e.debug && console.log(b, "getTranslations fetch url : ", s), r.has(s)) return e.debug && console.log(b, "getTranslations cache hit"), r.get(s);
158
+ let s = `${t}/api/v1/spaces/${e.spaceId}/translations/${r}?token=${e.token}${o}`;
159
+ if (e.debug && console.log(b, "getTranslations fetch url : ", s), i.has(s)) return e.debug && console.log(b, "getTranslations cache hit"), i.get(s);
160
160
  try {
161
161
  let t = await x(s, n, e.retryCount, e.retryDelay, e.debug);
162
162
  e.debug && console.log(b, "getTranslations status : ", t.status);
163
- let i = await t.json();
164
- return r.set(s, i), i;
163
+ let r = await t.json();
164
+ return i.set(s, r), r;
165
165
  } catch (e) {
166
166
  return console.error(b, "getTranslations error : ", e), {};
167
167
  }
@@ -191,26 +191,26 @@ function S(e) {
191
191
  },
192
192
  async getOpenApi() {
193
193
  e.debug && console.log(b, "getOpenApi()");
194
- let i = `${t}/api/v1/spaces/${e.spaceId}/open-api?token=${e.token}`;
195
- if (e.debug && console.log(b, "getOpenApi fetch url : ", i), r.has(i)) return e.debug && console.log(b, "getOpenApi cache hit"), r.get(i);
194
+ let r = `${t}/api/v1/spaces/${e.spaceId}/open-api?token=${e.token}`;
195
+ if (e.debug && console.log(b, "getOpenApi fetch url : ", r), i.has(r)) return e.debug && console.log(b, "getOpenApi cache hit"), i.get(r);
196
196
  try {
197
- let t = await x(i, n, e.retryCount, e.retryDelay, e.debug);
197
+ let t = await x(r, n, e.retryCount, e.retryDelay, e.debug);
198
198
  e.debug && console.log(b, "getOpenApi status : ", t.status);
199
199
  let a = await t.json();
200
- return r.set(i, a), a;
200
+ return i.set(r, a), a;
201
201
  } catch (e) {
202
202
  return console.error(b, "getOpenApi error : ", e), {};
203
203
  }
204
204
  },
205
205
  async getSchemas() {
206
206
  e.debug && console.log(b, "getSchemas()");
207
- let i = `${t}/api/v1/spaces/${e.spaceId}/schemas?token=${e.token}`;
208
- if (e.debug && console.log(b, "getSchemas fetch url : ", i), r.has(i)) return e.debug && console.log(b, "getSchemas cache hit"), r.get(i);
207
+ let r = `${t}/api/v1/spaces/${e.spaceId}/schemas?token=${e.token}`;
208
+ if (e.debug && console.log(b, "getSchemas fetch url : ", r), i.has(r)) return e.debug && console.log(b, "getSchemas cache hit"), i.get(r);
209
209
  try {
210
- let t = await x(i, n, e.retryCount, e.retryDelay, e.debug);
210
+ let t = await x(r, n, e.retryCount, e.retryDelay, e.debug);
211
211
  e.debug && console.log(b, "getSchemas status : ", t.status);
212
212
  let a = await t.json();
213
- return r.set(i, a), a;
213
+ return i.set(r, a), a;
214
214
  } catch (e) {
215
215
  return console.error(b, "getSchemas error : ", e), {};
216
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/cli",
3
- "version": "3.0.6-dev.20260502214443",
3
+ "version": "3.0.6-dev.20260512074100",
4
4
  "description": "Localess Command Line.",
5
5
  "keywords": [
6
6
  "localess",