@customyai/cli 0.11.0 → 0.14.0

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.
@@ -31,6 +31,20 @@ var CATALOG_DOC_VERSION = "catalog@1";
31
31
  var CATALOG_RESERVED_KEYS = ["constructor", "toString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"];
32
32
  var isReservedCatalogKey = (key) => CATALOG_RESERVED_KEYS.includes(key);
33
33
  var CATALOG_KEY = /^(?!(?:constructor|toString|valueOf|hasOwnProperty|isPrototypeOf|propertyIsEnumerable|toLocaleString)$)[a-z][A-Za-z0-9]*(\.[a-z][A-Za-z0-9-]*)*$/;
34
+ function catalogKeyHint(key) {
35
+ const pattern = "patr\xF3n: segmentos separados por puntos; el primero [a-z][A-Za-z0-9]*, los dem\xE1s [a-z][A-Za-z0-9-]*, m\xE1x. 120 caracteres (ej. \xABcheckout.title\xBB, \xABplan.freeTrial\xBB, \xABnav.sign-in\xBB)";
36
+ let why = "no cumple la forma de una clave";
37
+ if (key.length === 0) why = "est\xE1 vac\xEDa";
38
+ else if (key.length > 120) why = `mide ${key.length} caracteres (m\xE1x. 120)`;
39
+ else if (key.includes("_")) why = `no admite el guion bajo \xAB_\xBB: separa con puntos y usa camelCase (p. ej. \xAB${key.replace(/_+([a-zA-Z0-9])/g, (_m, c) => c.toUpperCase()).replace(/_/g, "")}\xBB)`;
40
+ else if (/\s/.test(key)) why = "no admite espacios";
41
+ else if (/^[A-Z]/.test(key) || /\.[A-Z]/.test(key)) why = "cada segmento empieza por min\xFAscula (p. ej. \xABcheckout.title\xBB, no \xABCheckout.Title\xBB)";
42
+ else if (/^\d/.test(key) || /\.\d/.test(key)) why = "cada segmento empieza por una letra, no por una cifra";
43
+ else if (/^\.|\.$|\.\./.test(key)) why = "no admite puntos al principio, al final ni dos seguidos";
44
+ else if (/^[a-z][A-Za-z0-9]*-/.test(key.split(".")[0] ?? "")) why = "el primer segmento no admite guion (los siguientes s\xED)";
45
+ else if (/[^A-Za-z0-9.-]/.test(key)) why = "solo admite letras, cifras, puntos y guiones";
46
+ return `${why}; ${pattern}`;
47
+ }
34
48
  var CATALOG_NAMESPACE = /^[a-z][a-z0-9-]{1,31}$/;
35
49
  var CATALOG_LOCALE = /^[a-z]{2,3}(-[A-Za-z0-9]{2,8}){0,2}$/;
36
50
  var CATALOG_SYNTAXES = ["icu1", "mf2"];
@@ -193,7 +207,7 @@ function validateCatalogUnsafe(input, options) {
193
207
  continue;
194
208
  }
195
209
  if (key.length > CATALOG_MAX_KEY_LENGTH || !CATALOG_KEY.test(key)) {
196
- issues.push({ path: `messages.${key}`, code: "invalid-key", message: "clave no v\xE1lida (min\xFAscula inicial, segmentos con puntos, sin espacios)" });
210
+ issues.push({ path: `messages.${key}`, code: "invalid-key", message: `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${catalogKeyHint(key)}` });
197
211
  continue;
198
212
  }
199
213
  const a = analyzeMessage(doc.messages[key]);
@@ -231,5 +245,6 @@ exports.CATALOG_LOCALE = CATALOG_LOCALE;
231
245
  exports.CATALOG_NAMESPACE = CATALOG_NAMESPACE;
232
246
  exports.TRANSLATION_PLAN_LIMITS = TRANSLATION_PLAN_LIMITS;
233
247
  exports.analyzeMessage = analyzeMessage;
248
+ exports.catalogKeyHint = catalogKeyHint;
234
249
  exports.parityReport = parityReport;
235
250
  exports.validateCatalog = validateCatalog;
package/dist/index.cjs CHANGED
@@ -1,67 +1,67 @@
1
1
  'use strict';
2
2
 
3
- var chunkVKMVRAMV_cjs = require('./chunk-VKMVRAMV.cjs');
4
- require('./chunk-2A6WFLXS.cjs');
3
+ var chunkF7DBJYTA_cjs = require('./chunk-F7DBJYTA.cjs');
4
+ require('./chunk-VUQSQ5YY.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "EXPERIENCE_EXIT_CODES", {
9
9
  enumerable: true,
10
- get: function () { return chunkVKMVRAMV_cjs.EXPERIENCE_EXIT; }
10
+ get: function () { return chunkF7DBJYTA_cjs.EXPERIENCE_EXIT; }
11
11
  });
12
12
  Object.defineProperty(exports, "EXPERIMENTS_EXIT_CODES", {
13
13
  enumerable: true,
14
- get: function () { return chunkVKMVRAMV_cjs.EXPERIMENTS_EXIT; }
14
+ get: function () { return chunkF7DBJYTA_cjs.EXPERIMENTS_EXIT; }
15
15
  });
16
16
  Object.defineProperty(exports, "PROVISIONING_EXIT_CODES", {
17
17
  enumerable: true,
18
- get: function () { return chunkVKMVRAMV_cjs.EXIT; }
18
+ get: function () { return chunkF7DBJYTA_cjs.EXIT; }
19
19
  });
20
20
  Object.defineProperty(exports, "SyncError", {
21
21
  enumerable: true,
22
- get: function () { return chunkVKMVRAMV_cjs.SyncError; }
22
+ get: function () { return chunkF7DBJYTA_cjs.SyncError; }
23
23
  });
24
24
  Object.defineProperty(exports, "WHATSAPP_EXIT_CODES", {
25
25
  enumerable: true,
26
- get: function () { return chunkVKMVRAMV_cjs.WHATSAPP_EXIT; }
26
+ get: function () { return chunkF7DBJYTA_cjs.WHATSAPP_EXIT; }
27
27
  });
28
28
  Object.defineProperty(exports, "generateAppTypes", {
29
29
  enumerable: true,
30
- get: function () { return chunkVKMVRAMV_cjs.generateAppTypes; }
30
+ get: function () { return chunkF7DBJYTA_cjs.generateAppTypes; }
31
31
  });
32
32
  Object.defineProperty(exports, "runCli", {
33
33
  enumerable: true,
34
- get: function () { return chunkVKMVRAMV_cjs.runCli; }
34
+ get: function () { return chunkF7DBJYTA_cjs.runCli; }
35
35
  });
36
36
  Object.defineProperty(exports, "runExperienceCli", {
37
37
  enumerable: true,
38
- get: function () { return chunkVKMVRAMV_cjs.runExperienceCli; }
38
+ get: function () { return chunkF7DBJYTA_cjs.runExperienceCli; }
39
39
  });
40
40
  Object.defineProperty(exports, "runExperimentsCli", {
41
41
  enumerable: true,
42
- get: function () { return chunkVKMVRAMV_cjs.runExperimentsCli; }
42
+ get: function () { return chunkF7DBJYTA_cjs.runExperimentsCli; }
43
43
  });
44
44
  Object.defineProperty(exports, "runProvisioningCli", {
45
45
  enumerable: true,
46
- get: function () { return chunkVKMVRAMV_cjs.runProvisioningCli; }
46
+ get: function () { return chunkF7DBJYTA_cjs.runProvisioningCli; }
47
47
  });
48
48
  Object.defineProperty(exports, "runWhatsAppCli", {
49
49
  enumerable: true,
50
- get: function () { return chunkVKMVRAMV_cjs.runWhatsAppCli; }
50
+ get: function () { return chunkF7DBJYTA_cjs.runWhatsAppCli; }
51
51
  });
52
52
  Object.defineProperty(exports, "schemaToType", {
53
53
  enumerable: true,
54
- get: function () { return chunkVKMVRAMV_cjs.schemaToType; }
54
+ get: function () { return chunkF7DBJYTA_cjs.schemaToType; }
55
55
  });
56
56
  Object.defineProperty(exports, "serializeCatalog", {
57
57
  enumerable: true,
58
- get: function () { return chunkVKMVRAMV_cjs.serializeCatalog; }
58
+ get: function () { return chunkF7DBJYTA_cjs.serializeCatalog; }
59
59
  });
60
60
  Object.defineProperty(exports, "syncApp", {
61
61
  enumerable: true,
62
- get: function () { return chunkVKMVRAMV_cjs.syncApp; }
62
+ get: function () { return chunkF7DBJYTA_cjs.syncApp; }
63
63
  });
64
64
  Object.defineProperty(exports, "validateManifest", {
65
65
  enumerable: true,
66
- get: function () { return chunkVKMVRAMV_cjs.validateManifest; }
66
+ get: function () { return chunkF7DBJYTA_cjs.validateManifest; }
67
67
  });
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { EXPERIENCE_EXIT as EXPERIENCE_EXIT_CODES, EXPERIMENTS_EXIT as EXPERIMENTS_EXIT_CODES, EXIT as PROVISIONING_EXIT_CODES, SyncError, WHATSAPP_EXIT as WHATSAPP_EXIT_CODES, generateAppTypes, runCli, runExperienceCli, runExperimentsCli, runProvisioningCli, runWhatsAppCli, schemaToType, serializeCatalog, syncApp, validateManifest } from './chunk-VA4VPLZ4.mjs';
2
- import './chunk-QKIF4C5R.mjs';
1
+ export { EXPERIENCE_EXIT as EXPERIENCE_EXIT_CODES, EXPERIMENTS_EXIT as EXPERIMENTS_EXIT_CODES, EXIT as PROVISIONING_EXIT_CODES, SyncError, WHATSAPP_EXIT as WHATSAPP_EXIT_CODES, generateAppTypes, runCli, runExperienceCli, runExperimentsCli, runProvisioningCli, runWhatsAppCli, schemaToType, serializeCatalog, syncApp, validateManifest } from './chunk-GD2FZPDE.mjs';
2
+ import './chunk-CCF7M44T.mjs';
@@ -1,5 +1,5 @@
1
1
  import { utf8ByteLength, I18nToolsError, compareCodeUnits } from './chunk-BYMLRMNS.mjs';
2
- import { CATALOG_KEY } from './chunk-QKIF4C5R.mjs';
2
+ import { CATALOG_KEY, catalogKeyHint } from './chunk-CCF7M44T.mjs';
3
3
 
4
4
  // src/vendor/i18n-tools/json.ts
5
5
  var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -19,7 +19,7 @@ function parseFlatJson(input, options = {}) {
19
19
  const descriptions = [];
20
20
  const seen = /* @__PURE__ */ new Set();
21
21
  const add = (key, value) => {
22
- if (strict && !CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
22
+ if (strict && !CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${catalogKeyHint(key)}`);
23
23
  if (seen.has(key)) throw new I18nToolsError("duplicate-key", `clave repetida \xAB${key}\xBB (tras aplanar)`);
24
24
  seen.add(key);
25
25
  if (typeof value === "string") {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMFJL3NO5_cjs = require('./chunk-MFJL3NO5.cjs');
4
- var chunk2A6WFLXS_cjs = require('./chunk-2A6WFLXS.cjs');
4
+ var chunkVUQSQ5YY_cjs = require('./chunk-VUQSQ5YY.cjs');
5
5
 
6
6
  // src/vendor/i18n-tools/json.ts
7
7
  var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -21,7 +21,7 @@ function parseFlatJson(input, options = {}) {
21
21
  const descriptions = [];
22
22
  const seen = /* @__PURE__ */ new Set();
23
23
  const add = (key, value) => {
24
- if (strict && !chunk2A6WFLXS_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
24
+ if (strict && !chunkVUQSQ5YY_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${chunkVUQSQ5YY_cjs.catalogKeyHint(key)}`);
25
25
  if (seen.has(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("duplicate-key", `clave repetida \xAB${key}\xBB (tras aplanar)`);
26
26
  seen.add(key);
27
27
  if (typeof value === "string") {
@@ -1,5 +1,5 @@
1
1
  import { utf8ByteLength, I18nToolsError, compareCodeUnits } from './chunk-BYMLRMNS.mjs';
2
- import { CATALOG_LOCALE, CATALOG_DOC_VERSION, CATALOG_KEY, CATALOG_NAMESPACE } from './chunk-QKIF4C5R.mjs';
2
+ import { CATALOG_LOCALE, CATALOG_DOC_VERSION, CATALOG_KEY, catalogKeyHint, CATALOG_NAMESPACE } from './chunk-CCF7M44T.mjs';
3
3
  import { pluralCategories, parseIcu, unparseIcu } from './chunk-3M6ZLCSN.mjs';
4
4
 
5
5
  // src/vendor/i18n-tools/po.ts
@@ -307,7 +307,7 @@ function catalogToPo(options) {
307
307
  }
308
308
  const entries = [];
309
309
  for (const key of Object.keys(source.messages).sort(compareCodeUnits)) {
310
- if (!CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
310
+ if (!CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${catalogKeyHint(key)}`);
311
311
  const src = source.messages[key] ?? "";
312
312
  const trg = target?.messages[key];
313
313
  const ctx = options.contexts?.[key];
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMFJL3NO5_cjs = require('./chunk-MFJL3NO5.cjs');
4
- var chunk2A6WFLXS_cjs = require('./chunk-2A6WFLXS.cjs');
4
+ var chunkVUQSQ5YY_cjs = require('./chunk-VUQSQ5YY.cjs');
5
5
  var chunkABK4QQWW_cjs = require('./chunk-ABK4QQWW.cjs');
6
6
 
7
7
  // src/vendor/i18n-tools/po.ts
@@ -288,7 +288,7 @@ function catalogToPo(options) {
288
288
  const { source, target } = options;
289
289
  if (target && target.namespace !== source.namespace) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", "origen y destino son de espacios de nombres distintos");
290
290
  const trgLocale = target?.locale ?? options.targetLocale ?? null;
291
- if (trgLocale !== null && !chunk2A6WFLXS_cjs.CATALOG_LOCALE.test(trgLocale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de destino no v\xE1lido \xAB${trgLocale}\xBB`);
291
+ if (trgLocale !== null && !chunkVUQSQ5YY_cjs.CATALOG_LOCALE.test(trgLocale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de destino no v\xE1lido \xAB${trgLocale}\xBB`);
292
292
  const gettext = options.pluralMode === "gettext";
293
293
  const trgCats = trgLocale ? chunkABK4QQWW_cjs.pluralCategories(trgLocale) : null;
294
294
  const headers = [
@@ -298,7 +298,7 @@ function catalogToPo(options) {
298
298
  if (trgLocale) headers.push({ name: "Language", value: trgLocale });
299
299
  headers.push(
300
300
  { name: "X-Source-Language", value: source.locale },
301
- { name: "X-Customy-Catalog", value: chunk2A6WFLXS_cjs.CATALOG_DOC_VERSION },
301
+ { name: "X-Customy-Catalog", value: chunkVUQSQ5YY_cjs.CATALOG_DOC_VERSION },
302
302
  { name: "X-Customy-Namespace", value: source.namespace },
303
303
  { name: "X-Customy-Syntax", value: source.syntax }
304
304
  );
@@ -309,7 +309,7 @@ function catalogToPo(options) {
309
309
  }
310
310
  const entries = [];
311
311
  for (const key of Object.keys(source.messages).sort(chunkMFJL3NO5_cjs.compareCodeUnits)) {
312
- if (!chunk2A6WFLXS_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
312
+ if (!chunkVUQSQ5YY_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${chunkVUQSQ5YY_cjs.catalogKeyHint(key)}`);
313
313
  const src = source.messages[key] ?? "";
314
314
  const trg = target?.messages[key];
315
315
  const ctx = options.contexts?.[key];
@@ -349,11 +349,11 @@ function catalogToPo(options) {
349
349
  }
350
350
  function poToCatalogs(po, options = {}) {
351
351
  const namespace = options.namespace ?? poHeader(po, "X-Customy-Namespace");
352
- if (!namespace || !chunk2A6WFLXS_cjs.CATALOG_NAMESPACE.test(namespace)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", "falta un espacio de nombres v\xE1lido (X-Customy-Namespace u options.namespace)");
352
+ if (!namespace || !chunkVUQSQ5YY_cjs.CATALOG_NAMESPACE.test(namespace)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", "falta un espacio de nombres v\xE1lido (X-Customy-Namespace u options.namespace)");
353
353
  const sourceLocale = options.sourceLocale ?? poHeader(po, "X-Source-Language");
354
- if (!sourceLocale || !chunk2A6WFLXS_cjs.CATALOG_LOCALE.test(sourceLocale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", "falta el idioma de origen (X-Source-Language u options.sourceLocale)");
354
+ if (!sourceLocale || !chunkVUQSQ5YY_cjs.CATALOG_LOCALE.test(sourceLocale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", "falta el idioma de origen (X-Source-Language u options.sourceLocale)");
355
355
  const targetLocale = options.targetLocale ?? poHeader(po, "Language");
356
- if (targetLocale && !chunk2A6WFLXS_cjs.CATALOG_LOCALE.test(targetLocale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de destino no v\xE1lido \xAB${targetLocale}\xBB`);
356
+ if (targetLocale && !chunkVUQSQ5YY_cjs.CATALOG_LOCALE.test(targetLocale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de destino no v\xE1lido \xAB${targetLocale}\xBB`);
357
357
  const syntaxHeader = options.syntax ?? poHeader(po, "X-Customy-Syntax") ?? "icu1";
358
358
  if (syntaxHeader !== "icu1" && syntaxHeader !== "mf2") throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", `sintaxis desconocida \xAB${syntaxHeader}\xBB`);
359
359
  const catsHeader = poHeader(po, "X-Customy-Plural-Categories");
@@ -366,7 +366,7 @@ function poToCatalogs(po, options = {}) {
366
366
  };
367
367
  for (const e of po.entries) {
368
368
  if (e.obsolete) continue;
369
- if (e.msgctxt === null || !chunk2A6WFLXS_cjs.CATALOG_KEY.test(e.msgctxt)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `la entrada \xAB${e.msgid.slice(0, 40)}\xBB no trae una clave v\xE1lida en msgctxt`);
369
+ if (e.msgctxt === null || !chunkVUQSQ5YY_cjs.CATALOG_KEY.test(e.msgctxt)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `la entrada \xAB${e.msgid.slice(0, 40)}\xBB no trae una clave v\xE1lida en msgctxt`);
370
370
  const key = e.msgctxt;
371
371
  const varLine = e.extractedComments.find((c) => c.startsWith(PLURAL_VAR));
372
372
  const ctxLines = e.extractedComments.filter((c) => !c.startsWith(PLURAL_VAR));
@@ -381,8 +381,8 @@ function poToCatalogs(po, options = {}) {
381
381
  if (s !== "") put(targetMessages, key, s);
382
382
  }
383
383
  }
384
- const source = { version: chunk2A6WFLXS_cjs.CATALOG_DOC_VERSION, namespace, locale: sourceLocale, syntax: syntaxHeader, messages: sourceMessages };
385
- const target = targetLocale ? { version: chunk2A6WFLXS_cjs.CATALOG_DOC_VERSION, namespace, locale: targetLocale, syntax: syntaxHeader, messages: targetMessages } : null;
384
+ const source = { version: chunkVUQSQ5YY_cjs.CATALOG_DOC_VERSION, namespace, locale: sourceLocale, syntax: syntaxHeader, messages: sourceMessages };
385
+ const target = targetLocale ? { version: chunkVUQSQ5YY_cjs.CATALOG_DOC_VERSION, namespace, locale: targetLocale, syntax: syntaxHeader, messages: targetMessages } : null;
386
386
  return { source, target, contexts };
387
387
  }
388
388
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMFJL3NO5_cjs = require('./chunk-MFJL3NO5.cjs');
4
- var chunk2A6WFLXS_cjs = require('./chunk-2A6WFLXS.cjs');
4
+ var chunkVUQSQ5YY_cjs = require('./chunk-VUQSQ5YY.cjs');
5
5
  var chunkABK4QQWW_cjs = require('./chunk-ABK4QQWW.cjs');
6
6
 
7
7
  // src/vendor/i18n-tools/quality.ts
@@ -111,8 +111,8 @@ function checkTranslation(source, target, options, key) {
111
111
  if (source !== "") emit("empty-target", "la traducci\xF3n est\xE1 vac\xEDa");
112
112
  return findings;
113
113
  }
114
- const srcAnalysis = chunk2A6WFLXS_cjs.analyzeMessage(source);
115
- const trgAnalysis = chunk2A6WFLXS_cjs.analyzeMessage(target);
114
+ const srcAnalysis = chunkVUQSQ5YY_cjs.analyzeMessage(source);
115
+ const trgAnalysis = chunkVUQSQ5YY_cjs.analyzeMessage(target);
116
116
  if (!srcAnalysis.ok) emit("source-invalid", `el mensaje de origen no es ICU v\xE1lido: ${srcAnalysis.error ?? ""}`);
117
117
  if (!trgAnalysis.ok && (srcAnalysis.ok || trgAnalysis.error !== srcAnalysis.error)) emit("invalid-message", `la traducci\xF3n no es un mensaje ICU v\xE1lido: ${trgAnalysis.error ?? ""}`, { error: trgAnalysis.error ?? "" });
118
118
  if (srcAnalysis.ok && trgAnalysis.ok) {
@@ -1,5 +1,5 @@
1
1
  import { compareCodeUnits } from './chunk-BYMLRMNS.mjs';
2
- import { analyzeMessage } from './chunk-QKIF4C5R.mjs';
2
+ import { analyzeMessage } from './chunk-CCF7M44T.mjs';
3
3
  import { collectComplex, pluralCategories, plainText } from './chunk-3M6ZLCSN.mjs';
4
4
 
5
5
  // src/vendor/i18n-tools/quality.ts
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMFJL3NO5_cjs = require('./chunk-MFJL3NO5.cjs');
4
- var chunk2A6WFLXS_cjs = require('./chunk-2A6WFLXS.cjs');
4
+ var chunkVUQSQ5YY_cjs = require('./chunk-VUQSQ5YY.cjs');
5
5
  var chunkABK4QQWW_cjs = require('./chunk-ABK4QQWW.cjs');
6
6
 
7
7
  // src/vendor/i18n-tools/xml.ts
@@ -345,9 +345,9 @@ function encodeInline(tokens, ids, side) {
345
345
  }
346
346
  function exportXliff(options) {
347
347
  const { source, target } = options;
348
- if (!chunk2A6WFLXS_cjs.CATALOG_LOCALE.test(source.locale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de origen no v\xE1lido \xAB${source.locale}\xBB`);
348
+ if (!chunkVUQSQ5YY_cjs.CATALOG_LOCALE.test(source.locale)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de origen no v\xE1lido \xAB${source.locale}\xBB`);
349
349
  const trgLang = target?.locale ?? options.targetLocale ?? null;
350
- if (trgLang !== null && !chunk2A6WFLXS_cjs.CATALOG_LOCALE.test(trgLang)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de destino no v\xE1lido \xAB${trgLang}\xBB`);
350
+ if (trgLang !== null && !chunkVUQSQ5YY_cjs.CATALOG_LOCALE.test(trgLang)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `idioma de destino no v\xE1lido \xAB${trgLang}\xBB`);
351
351
  if (target && target.namespace !== source.namespace) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", "origen y destino son de espacios de nombres distintos");
352
352
  const dnt = new Set(options.doNotTranslate ?? []);
353
353
  const keys = Object.keys(source.messages).sort(chunkMFJL3NO5_cjs.compareCodeUnits);
@@ -355,9 +355,13 @@ function exportXliff(options) {
355
355
  out.push('<?xml version="1.0" encoding="UTF-8"?>');
356
356
  out.push(`<xliff xmlns="${XLIFF_NS}" version="2.1" srcLang="${escapeXmlAttr(source.locale)}"${trgLang ? ` trgLang="${escapeXmlAttr(trgLang)}"` : ""}>`);
357
357
  out.push(` <file id="f1" original="${escapeXmlAttr(source.namespace)}">`);
358
- out.push(` <notes><note category="${SYNTAX_NOTE}">${escapeXmlText(source.syntax)}</note></notes>`);
358
+ const fileNotes = Object.keys(options.fileNotes ?? {}).sort(chunkMFJL3NO5_cjs.compareCodeUnits).map((c) => {
359
+ if (!/^customy:[a-z0-9-]+$/.test(c) || c === SYNTAX_NOTE) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", `categor\xEDa de nota de archivo no v\xE1lida \xAB${c}\xBB`);
360
+ return `<note category="${c}">${escapeXmlText(options.fileNotes[c])}</note>`;
361
+ });
362
+ out.push(` <notes><note category="${SYNTAX_NOTE}">${escapeXmlText(source.syntax)}</note>${fileNotes.join("")}</notes>`);
359
363
  for (const key of keys) {
360
- if (!chunk2A6WFLXS_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
364
+ if (!chunkVUQSQ5YY_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${chunkVUQSQ5YY_cjs.catalogKeyHint(key)}`);
361
365
  const src = source.messages[key] ?? "";
362
366
  const trg = target ? target.messages[key] : void 0;
363
367
  const ids = new InlineIds();
@@ -416,18 +420,21 @@ function importXliff(input, options = {}) {
416
420
  const version = root.attrs["version"];
417
421
  if (version !== "2.1" && version !== "2.0") throw new chunkMFJL3NO5_cjs.I18nToolsError("unsupported-version", `solo se admite XLIFF 2.0/2.1 (version=${version ?? "ausente"})`);
418
422
  const srcLang = root.attrs["srcLang"];
419
- if (!srcLang || !chunk2A6WFLXS_cjs.CATALOG_LOCALE.test(srcLang)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `srcLang no v\xE1lido \xAB${srcLang ?? ""}\xBB`);
423
+ if (!srcLang || !chunkVUQSQ5YY_cjs.CATALOG_LOCALE.test(srcLang)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `srcLang no v\xE1lido \xAB${srcLang ?? ""}\xBB`);
420
424
  const trgLang = root.attrs["trgLang"] ?? null;
421
- if (trgLang !== null && !chunk2A6WFLXS_cjs.CATALOG_LOCALE.test(trgLang)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `trgLang no v\xE1lido \xAB${trgLang}\xBB`);
425
+ if (trgLang !== null && !chunkVUQSQ5YY_cjs.CATALOG_LOCALE.test(trgLang)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-locale", `trgLang no v\xE1lido \xAB${trgLang}\xBB`);
422
426
  const files = kids(root, "file");
423
427
  if (files.length !== 1) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-xliff", `se espera exactamente un <file> (hay ${files.length})`);
424
428
  const file = files[0];
425
429
  const original = file.attrs["original"];
426
- const namespace = original && chunk2A6WFLXS_cjs.CATALOG_NAMESPACE.test(original) ? original : options.namespace;
427
- if (!namespace || !chunk2A6WFLXS_cjs.CATALOG_NAMESPACE.test(namespace)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", "falta un espacio de nombres v\xE1lido (file/@original o options.namespace)");
430
+ const namespace = original && chunkVUQSQ5YY_cjs.CATALOG_NAMESPACE.test(original) ? original : options.namespace;
431
+ if (!namespace || !chunkVUQSQ5YY_cjs.CATALOG_NAMESPACE.test(namespace)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-input", "falta un espacio de nombres v\xE1lido (file/@original o options.namespace)");
428
432
  let syntax = "icu1";
433
+ const fileNotes = {};
429
434
  for (const notes of kids(file, "notes")) {
430
435
  for (const note of kids(notes, "note")) {
436
+ const cat = note.attrs["category"];
437
+ if (cat && cat !== SYNTAX_NOTE && /^customy:[a-z0-9-]+$/.test(cat)) fileNotes[cat] = elementText(note).trim();
431
438
  if (note.attrs["category"] === SYNTAX_NOTE) {
432
439
  const value = elementText(note).trim();
433
440
  if (value !== "icu1" && value !== "mf2") throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-xliff", `sintaxis desconocida \xAB${value}\xBB`);
@@ -449,7 +456,7 @@ function importXliff(input, options = {}) {
449
456
  for (const u of order) {
450
457
  const key = u.attrs["id"];
451
458
  if (!key) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-xliff", "<unit> sin id");
452
- if (strict && !chunk2A6WFLXS_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
459
+ if (strict && !chunkVUQSQ5YY_cjs.CATALOG_KEY.test(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${chunkVUQSQ5YY_cjs.catalogKeyHint(key)}`);
453
460
  if (seen.has(key)) throw new chunkMFJL3NO5_cjs.I18nToolsError("duplicate-key", `clave repetida \xAB${key}\xBB`);
454
461
  seen.add(key);
455
462
  const data = /* @__PURE__ */ new Map();
@@ -495,7 +502,7 @@ function importXliff(input, options = {}) {
495
502
  if (!sawTarget || target === "" && state === "initial") target = null;
496
503
  units.push({ key, source, target, state, context, notes, translate: u.attrs["translate"] !== "no" });
497
504
  }
498
- return { srcLang, trgLang, namespace, syntax, units };
505
+ return { srcLang, trgLang, namespace, syntax, units, ...Object.keys(fileNotes).length > 0 ? { fileNotes } : {} };
499
506
  }
500
507
  function xliffToCatalogs(doc) {
501
508
  const sourceMessages = {};
@@ -506,8 +513,8 @@ function xliffToCatalogs(doc) {
506
513
  states[u.key] = u.state;
507
514
  if (u.target !== null) targetMessages[u.key] = u.target;
508
515
  }
509
- const source = { version: chunk2A6WFLXS_cjs.CATALOG_DOC_VERSION, namespace: doc.namespace, locale: doc.srcLang, syntax: doc.syntax, messages: sourceMessages };
510
- const target = doc.trgLang ? { version: chunk2A6WFLXS_cjs.CATALOG_DOC_VERSION, namespace: doc.namespace, locale: doc.trgLang, syntax: doc.syntax, messages: targetMessages } : null;
516
+ const source = { version: chunkVUQSQ5YY_cjs.CATALOG_DOC_VERSION, namespace: doc.namespace, locale: doc.srcLang, syntax: doc.syntax, messages: sourceMessages };
517
+ const target = doc.trgLang ? { version: chunkVUQSQ5YY_cjs.CATALOG_DOC_VERSION, namespace: doc.namespace, locale: doc.trgLang, syntax: doc.syntax, messages: targetMessages } : null;
511
518
  return { source, target, states };
512
519
  }
513
520
 
@@ -1,5 +1,5 @@
1
1
  import { I18nToolsError, compareCodeUnits, utf8ByteLength } from './chunk-BYMLRMNS.mjs';
2
- import { CATALOG_LOCALE, CATALOG_KEY, CATALOG_NAMESPACE, CATALOG_DOC_VERSION } from './chunk-QKIF4C5R.mjs';
2
+ import { CATALOG_LOCALE, CATALOG_KEY, catalogKeyHint, CATALOG_NAMESPACE, CATALOG_DOC_VERSION } from './chunk-CCF7M44T.mjs';
3
3
  import { tokenizeIcu } from './chunk-3M6ZLCSN.mjs';
4
4
 
5
5
  // src/vendor/i18n-tools/xml.ts
@@ -353,9 +353,13 @@ function exportXliff(options) {
353
353
  out.push('<?xml version="1.0" encoding="UTF-8"?>');
354
354
  out.push(`<xliff xmlns="${XLIFF_NS}" version="2.1" srcLang="${escapeXmlAttr(source.locale)}"${trgLang ? ` trgLang="${escapeXmlAttr(trgLang)}"` : ""}>`);
355
355
  out.push(` <file id="f1" original="${escapeXmlAttr(source.namespace)}">`);
356
- out.push(` <notes><note category="${SYNTAX_NOTE}">${escapeXmlText(source.syntax)}</note></notes>`);
356
+ const fileNotes = Object.keys(options.fileNotes ?? {}).sort(compareCodeUnits).map((c) => {
357
+ if (!/^customy:[a-z0-9-]+$/.test(c) || c === SYNTAX_NOTE) throw new I18nToolsError("invalid-input", `categor\xEDa de nota de archivo no v\xE1lida \xAB${c}\xBB`);
358
+ return `<note category="${c}">${escapeXmlText(options.fileNotes[c])}</note>`;
359
+ });
360
+ out.push(` <notes><note category="${SYNTAX_NOTE}">${escapeXmlText(source.syntax)}</note>${fileNotes.join("")}</notes>`);
357
361
  for (const key of keys) {
358
- if (!CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
362
+ if (!CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${catalogKeyHint(key)}`);
359
363
  const src = source.messages[key] ?? "";
360
364
  const trg = target ? target.messages[key] : void 0;
361
365
  const ids = new InlineIds();
@@ -424,8 +428,11 @@ function importXliff(input, options = {}) {
424
428
  const namespace = original && CATALOG_NAMESPACE.test(original) ? original : options.namespace;
425
429
  if (!namespace || !CATALOG_NAMESPACE.test(namespace)) throw new I18nToolsError("invalid-input", "falta un espacio de nombres v\xE1lido (file/@original o options.namespace)");
426
430
  let syntax = "icu1";
431
+ const fileNotes = {};
427
432
  for (const notes of kids(file, "notes")) {
428
433
  for (const note of kids(notes, "note")) {
434
+ const cat = note.attrs["category"];
435
+ if (cat && cat !== SYNTAX_NOTE && /^customy:[a-z0-9-]+$/.test(cat)) fileNotes[cat] = elementText(note).trim();
429
436
  if (note.attrs["category"] === SYNTAX_NOTE) {
430
437
  const value = elementText(note).trim();
431
438
  if (value !== "icu1" && value !== "mf2") throw new I18nToolsError("invalid-xliff", `sintaxis desconocida \xAB${value}\xBB`);
@@ -447,7 +454,7 @@ function importXliff(input, options = {}) {
447
454
  for (const u of order) {
448
455
  const key = u.attrs["id"];
449
456
  if (!key) throw new I18nToolsError("invalid-xliff", "<unit> sin id");
450
- if (strict && !CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key}\xBB`);
457
+ if (strict && !CATALOG_KEY.test(key)) throw new I18nToolsError("invalid-key", `clave no v\xE1lida \xAB${key.slice(0, 60)}\xBB: ${catalogKeyHint(key)}`);
451
458
  if (seen.has(key)) throw new I18nToolsError("duplicate-key", `clave repetida \xAB${key}\xBB`);
452
459
  seen.add(key);
453
460
  const data = /* @__PURE__ */ new Map();
@@ -493,7 +500,7 @@ function importXliff(input, options = {}) {
493
500
  if (!sawTarget || target === "" && state === "initial") target = null;
494
501
  units.push({ key, source, target, state, context, notes, translate: u.attrs["translate"] !== "no" });
495
502
  }
496
- return { srcLang, trgLang, namespace, syntax, units };
503
+ return { srcLang, trgLang, namespace, syntax, units, ...Object.keys(fileNotes).length > 0 ? { fileNotes } : {} };
497
504
  }
498
505
  function xliffToCatalogs(doc) {
499
506
  const sourceMessages = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customyai/cli",
3
- "version": "0.11.0",
3
+ "version": "0.14.0",
4
4
  "description": "Customy CLI: validate, type and sync customy.app.json (customy apps ...), provision TEST users (customy users | audit | policy | whoami), operate Customy WhatsApp (customy whatsapp numbers | send | messages | templates | findings | webhooks | broadcasts | flows) and manage Customy Experience translation catalogs and releases (customy experience pull | push | export | import | status | signing | ...). Also usable as a library.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Customy <hello@customy.ai>",