@numericoach/gskills-admin-cli 0.1.22 → 0.1.23

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
@@ -76,6 +76,8 @@ gskills-admin imported-sheets resolve --instance <instanceId> --source <sheet-ur
76
76
  gskills-admin imported-sheets create --instance <instanceId> --source <sheet-url> --tab "Cas d'usage" --display-name "Cas d'usage Gemini" --locales fr,en,es --enable-vectorization --vector-headers "Titre,Description,Prompt" --dry-run --output json
77
77
  gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run --output json
78
78
  gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run --output json
79
+ gskills-admin imported-sheets retranslate <sheetId> --instance <instanceId> --from en --to fr,de,es --dry-run --output json
80
+ gskills-admin imported-sheets replace-grid <sheetId> --instance <instanceId> --locale en --data-file ./grid.json --rebuild-columns --dry-run --output json
79
81
  gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run --output json
80
82
  gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run --output json
81
83
  gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name "Use cases" --dry-run --output json
@@ -1607,6 +1607,8 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
1607
1607
  "sync",
1608
1608
  "enable-locales",
1609
1609
  "translate",
1610
+ "retranslate",
1611
+ "replace-grid",
1610
1612
  "vectorize",
1611
1613
  "repair-french",
1612
1614
  "copy-to",
@@ -1717,7 +1719,7 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
1717
1719
  body: JSON.stringify({ instanceId, sourceInput })
1718
1720
  });
1719
1721
  }
1720
- if (["create", "update", "sync", "enable-locales", "translate", "vectorize", "repair-french", "delete"].includes(action)) {
1722
+ if (["create", "update", "sync", "enable-locales", "translate", "retranslate", "replace-grid", "vectorize", "repair-french", "delete"].includes(action)) {
1721
1723
  requireWriteConfirmation("Imported sheet operation writes production data. Add --yes or use --dry-run.", ctx);
1722
1724
  }
1723
1725
  if (action === "create") {
@@ -1778,6 +1780,49 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
1778
1780
  body: JSON.stringify(payload)
1779
1781
  });
1780
1782
  }
1783
+ if (action === "retranslate") {
1784
+ const locales = splitCsv(getStringFlag(ctx, "locales") ?? getStringFlag(ctx, "languages") ?? getStringFlag(ctx, "to"));
1785
+ if (locales.length === 0)
1786
+ throw new CliError("Missing --to", 2);
1787
+ if (locales.some((locale) => locale.toLowerCase() === "all")) {
1788
+ throw new CliError("Do not use all. Pass explicit locales like en,es,pt-BR.", 2);
1789
+ }
1790
+ const payload = {
1791
+ instanceId,
1792
+ locales,
1793
+ sourceLocale: getStringFlag(ctx, "from"),
1794
+ revectorize: hasFlag(ctx, "revectorize"),
1795
+ dryRun: hasFlag(ctx, "dry-run")
1796
+ };
1797
+ if (hasFlag(ctx, "dry-run"))
1798
+ return { operation: "imported-sheets.retranslate", importedSheetId, ...payload };
1799
+ return requestApi(`/api/cli/imported-sheets/${importedSheetId}/retranslate`, {
1800
+ method: "POST",
1801
+ body: JSON.stringify(payload)
1802
+ });
1803
+ }
1804
+ if (action === "replace-grid") {
1805
+ const locale = getStringFlag(ctx, "locale") ?? getStringFlag(ctx, "language");
1806
+ if (!locale)
1807
+ throw new CliError("Missing --locale", 2);
1808
+ const grid = await parseJsonObjectFlag(ctx, "data", "data-file");
1809
+ if (Object.keys(grid).length === 0)
1810
+ throw new CliError("Missing --data or --data-file JSON", 2);
1811
+ const payload = {
1812
+ instanceId,
1813
+ locale,
1814
+ grid,
1815
+ rebuildSharedColumns: hasFlag(ctx, "rebuild-columns"),
1816
+ revectorize: hasFlag(ctx, "revectorize"),
1817
+ dryRun: hasFlag(ctx, "dry-run")
1818
+ };
1819
+ if (hasFlag(ctx, "dry-run"))
1820
+ return { operation: "imported-sheets.replace-grid", importedSheetId, ...payload };
1821
+ return requestApi(`/api/cli/imported-sheets/${importedSheetId}/replace-grid`, {
1822
+ method: "POST",
1823
+ body: JSON.stringify(payload)
1824
+ });
1825
+ }
1781
1826
  if (action === "vectorize") {
1782
1827
  const payload = {
1783
1828
  instanceId,
@@ -2209,6 +2254,8 @@ var schemaHelp = () => ({
2209
2254
  { name: "imported-sheets sync", args: ["id"], required: ["--instance"], flags: ["--locales", "--yes", "--dry-run"], writes: true },
2210
2255
  { name: "imported-sheets enable-locales", args: ["id"], required: ["--instance", "--locales"], flags: ["--yes", "--dry-run"], writes: true },
2211
2256
  { name: "imported-sheets translate", args: ["id"], required: ["--instance", "--to"], flags: ["--yes", "--dry-run"], writes: true },
2257
+ { name: "imported-sheets retranslate", args: ["id"], required: ["--instance", "--to"], flags: ["--from", "--revectorize", "--yes", "--dry-run"], writes: true },
2258
+ { name: "imported-sheets replace-grid", args: ["id"], required: ["--instance", "--locale", "--data or --data-file"], flags: ["--rebuild-columns", "--revectorize", "--yes", "--dry-run"], writes: true },
2212
2259
  { name: "imported-sheets vectorize", args: ["id"], required: ["--instance"], flags: ["--locales", "--yes", "--dry-run"], writes: true },
2213
2260
  { name: "imported-sheets repair-french", args: ["id"], required: ["--instance"], flags: ["--locales", "--revectorize", "--yes", "--dry-run"], writes: true },
2214
2261
  { name: "imported-sheets copy-to", args: ["id"], required: ["--instance", "--target or --targets"], flags: ["--display-name", "--replace", "--revectorize", "--yes", "--dry-run"], writes: true },
@@ -2351,6 +2398,8 @@ var importedSheetsHelp = () => ({
2351
2398
  "gskills-admin imported-sheets update <sheetId> --instance <instanceId> --data-file ./settings.json --dry-run",
2352
2399
  "gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run",
2353
2400
  "gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run",
2401
+ "gskills-admin imported-sheets retranslate <sheetId> --instance <instanceId> --from en --to fr,de,es --dry-run",
2402
+ "gskills-admin imported-sheets replace-grid <sheetId> --instance <instanceId> --locale en --data-file ./grid.json --rebuild-columns --dry-run",
2354
2403
  "gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run",
2355
2404
  "gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run",
2356
2405
  "gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name 'Use cases' --dry-run",
@@ -2358,7 +2407,7 @@ var importedSheetsHelp = () => ({
2358
2407
  "gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run",
2359
2408
  "gskills-admin imported-sheets delete <sheetId> --instance <instanceId> --force --confirm-delete imported-sheets:<sheetId> --dry-run"
2360
2409
  ],
2361
- writes: "create, update, sync, translate, vectorize, repair-french, copy-to, attach-page, set-source and delete require --yes or --dry-run.",
2410
+ writes: "create, update, sync, translate, retranslate, replace-grid, vectorize, repair-french, copy-to, attach-page, set-source and delete require --yes or --dry-run.",
2362
2411
  createDataShape: {
2363
2412
  instanceId: "global",
2364
2413
  displayName: "Cas d'usage Gemini",
@@ -2379,7 +2428,9 @@ var importedSheetsHelp = () => ({
2379
2428
  useCaseListFlow: [
2380
2429
  "copy-to from global to a client instance with --display-name 'Use cases'",
2381
2430
  "attach-page inserts the importedSheet EditorJS block and invalidates page deploy cache",
2382
- "set-source updates one locale source and can --resync immediately"
2431
+ "set-source updates one locale source and can --resync immediately",
2432
+ "replace-grid writes a locale from an explicit JSON grid when the app OAuth Sheets scope is missing but the sheet was read by a trusted CLI such as gws",
2433
+ "retranslate rebuilds AI_TRANSLATION locales from the stored source rows without reading Google Sheets"
2383
2434
  ]
2384
2435
  });
2385
2436
  var PAGE_TRANSLATION_REWRITE_WARNING = "WARNING: translate pages is a full translated-page rewrite, not a diff update. Rebuilding target pages can lose activity-specific fields, quiz ids, embedded ids, or future custom block data if the translator does not preserve them. Prefer the app diff update flow for pages with activities or custom blocks.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@numericoach/gskills-admin-cli",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin-only CLI for GSkills super-admin operations.",
@@ -258,6 +258,8 @@ gskills-admin imported-sheets resolve --instance <instanceId> --source <sheet-ur
258
258
  gskills-admin imported-sheets create --instance <instanceId> --source <sheet-url> --tab "Cas d'usage" --display-name "Cas d'usage Gemini" --locales fr,en,es --enable-vectorization --vector-headers "Titre,Description,Prompt" --dry-run --output json
259
259
  gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run --output json
260
260
  gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run --output json
261
+ gskills-admin imported-sheets retranslate <sheetId> --instance <instanceId> --from en --to fr,de,es --dry-run --output json
262
+ gskills-admin imported-sheets replace-grid <sheetId> --instance <instanceId> --locale en --data-file ./grid.json --rebuild-columns --dry-run --output json
261
263
  gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run --output json
262
264
  gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run --output json
263
265
  gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name "Use cases" --dry-run --output json