@numericoach/gskills-admin-cli 0.1.22 → 0.1.24

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,9 @@ 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
81
+ gskills-admin imported-sheets patch-cells <sheetId> --instance <instanceId> --data-file ./cell-patches.json --dry-run --output json
79
82
  gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run --output json
80
83
  gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run --output json
81
84
  gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name "Use cases" --dry-run --output json
@@ -83,7 +86,24 @@ gskills-admin imported-sheets attach-page <sheetId> --instance <instanceId> --pa
83
86
  gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run --output json
84
87
  ```
85
88
 
86
- Use `sync` to resync the stored rows from Google Sheets and refresh AI-translated variants. Use `translate` to enable or refresh explicit AI locales. Use `vectorize` after enabling vectorization or changing vector columns. Use `copy-to --display-name "Use cases"` for the Gemini use-case list flow, then `attach-page` when the list must be embedded in a normal page. Use `set-source --resync` to swap a locale to another spreadsheet tab and refresh it in one CLI call. All writes require `--dry-run` or `--yes`.
89
+ Use `sync` to resync the stored rows from Google Sheets and refresh AI-translated variants. Use `translate` to enable or refresh explicit AI locales. Use `patch-cells` for focused row-cell updates such as capture links without replacing the whole grid. Use `vectorize` after enabling vectorization or changing vector columns. Use `copy-to --display-name "Use cases"` for the Gemini use-case list flow, then `attach-page` when the list must be embedded in a normal page. Use `set-source --resync` to swap a locale to another spreadsheet tab and refresh it in one CLI call. All writes require `--dry-run` or `--yes`.
90
+
91
+ `patch-cells` accepts a JSON object with a `patches` array:
92
+
93
+ ```json
94
+ {
95
+ "patches": [
96
+ {
97
+ "locale": "fr",
98
+ "rowIndex": 12,
99
+ "columnHeader": "Capture_link",
100
+ "rawValue": "https://lh7-qw.googleusercontent.com/docsz/..."
101
+ }
102
+ ]
103
+ }
104
+ ```
105
+
106
+ Each patch uses `locale`, `rowId` or `rowIndex`, `columnId` or `columnHeader`, and `rawValue`. Dry-runs resolve the real row and column and show before/after samples. Applied patches write through the authenticated app API, log an admin event, and invalidate deploy cache unless `--no-cache` is passed.
87
107
 
88
108
  Operational helpers are available for the admin-only flows agents should not improvise:
89
109
 
@@ -1607,6 +1607,9 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
1607
1607
  "sync",
1608
1608
  "enable-locales",
1609
1609
  "translate",
1610
+ "retranslate",
1611
+ "replace-grid",
1612
+ "patch-cells",
1610
1613
  "vectorize",
1611
1614
  "repair-french",
1612
1615
  "copy-to",
@@ -1717,7 +1720,7 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
1717
1720
  body: JSON.stringify({ instanceId, sourceInput })
1718
1721
  });
1719
1722
  }
1720
- if (["create", "update", "sync", "enable-locales", "translate", "vectorize", "repair-french", "delete"].includes(action)) {
1723
+ if (["create", "update", "sync", "enable-locales", "translate", "retranslate", "replace-grid", "patch-cells", "vectorize", "repair-french", "delete"].includes(action)) {
1721
1724
  requireWriteConfirmation("Imported sheet operation writes production data. Add --yes or use --dry-run.", ctx);
1722
1725
  }
1723
1726
  if (action === "create") {
@@ -1778,6 +1781,67 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
1778
1781
  body: JSON.stringify(payload)
1779
1782
  });
1780
1783
  }
1784
+ if (action === "retranslate") {
1785
+ const locales = splitCsv(getStringFlag(ctx, "locales") ?? getStringFlag(ctx, "languages") ?? getStringFlag(ctx, "to"));
1786
+ if (locales.length === 0)
1787
+ throw new CliError("Missing --to", 2);
1788
+ if (locales.some((locale) => locale.toLowerCase() === "all")) {
1789
+ throw new CliError("Do not use all. Pass explicit locales like en,es,pt-BR.", 2);
1790
+ }
1791
+ const payload = {
1792
+ instanceId,
1793
+ locales,
1794
+ sourceLocale: getStringFlag(ctx, "from"),
1795
+ revectorize: hasFlag(ctx, "revectorize"),
1796
+ dryRun: hasFlag(ctx, "dry-run")
1797
+ };
1798
+ if (hasFlag(ctx, "dry-run"))
1799
+ return { operation: "imported-sheets.retranslate", importedSheetId, ...payload };
1800
+ return requestApi(`/api/cli/imported-sheets/${importedSheetId}/retranslate`, {
1801
+ method: "POST",
1802
+ body: JSON.stringify(payload)
1803
+ });
1804
+ }
1805
+ if (action === "replace-grid") {
1806
+ const locale = getStringFlag(ctx, "locale") ?? getStringFlag(ctx, "language");
1807
+ if (!locale)
1808
+ throw new CliError("Missing --locale", 2);
1809
+ const grid = await parseJsonObjectFlag(ctx, "data", "data-file");
1810
+ if (Object.keys(grid).length === 0)
1811
+ throw new CliError("Missing --data or --data-file JSON", 2);
1812
+ const payload = {
1813
+ instanceId,
1814
+ locale,
1815
+ grid,
1816
+ rebuildSharedColumns: hasFlag(ctx, "rebuild-columns"),
1817
+ revectorize: hasFlag(ctx, "revectorize"),
1818
+ dryRun: hasFlag(ctx, "dry-run")
1819
+ };
1820
+ if (hasFlag(ctx, "dry-run"))
1821
+ return { operation: "imported-sheets.replace-grid", importedSheetId, ...payload };
1822
+ return requestApi(`/api/cli/imported-sheets/${importedSheetId}/replace-grid`, {
1823
+ method: "POST",
1824
+ body: JSON.stringify(payload)
1825
+ });
1826
+ }
1827
+ if (action === "patch-cells") {
1828
+ const data = await parseJsonObjectFlag(ctx, "data", "data-file");
1829
+ if (Object.keys(data).length === 0)
1830
+ throw new CliError("Missing --data or --data-file JSON", 2);
1831
+ const payload = {
1832
+ instanceId,
1833
+ ...data,
1834
+ locale: getStringFlag(ctx, "locale") ?? getStringFlag(ctx, "language") ?? data.locale,
1835
+ revectorize: hasFlag(ctx, "revectorize") || Boolean(data.revectorize),
1836
+ skipCache: hasFlag(ctx, "no-cache") || Boolean(data.skipCache),
1837
+ cacheScope: getStringFlag(ctx, "cache-scope") ?? data.cacheScope,
1838
+ dryRun: hasFlag(ctx, "dry-run")
1839
+ };
1840
+ return requestApi(`/api/cli/imported-sheets/${importedSheetId}/patch-cells`, {
1841
+ method: "POST",
1842
+ body: JSON.stringify(payload)
1843
+ });
1844
+ }
1781
1845
  if (action === "vectorize") {
1782
1846
  const payload = {
1783
1847
  instanceId,
@@ -2209,6 +2273,9 @@ var schemaHelp = () => ({
2209
2273
  { name: "imported-sheets sync", args: ["id"], required: ["--instance"], flags: ["--locales", "--yes", "--dry-run"], writes: true },
2210
2274
  { name: "imported-sheets enable-locales", args: ["id"], required: ["--instance", "--locales"], flags: ["--yes", "--dry-run"], writes: true },
2211
2275
  { name: "imported-sheets translate", args: ["id"], required: ["--instance", "--to"], flags: ["--yes", "--dry-run"], writes: true },
2276
+ { name: "imported-sheets retranslate", args: ["id"], required: ["--instance", "--to"], flags: ["--from", "--revectorize", "--yes", "--dry-run"], writes: true },
2277
+ { name: "imported-sheets replace-grid", args: ["id"], required: ["--instance", "--locale", "--data or --data-file"], flags: ["--rebuild-columns", "--revectorize", "--yes", "--dry-run"], writes: true },
2278
+ { name: "imported-sheets patch-cells", args: ["id"], required: ["--instance", "--data or --data-file"], flags: ["--locale", "--revectorize", "--cache-scope", "--no-cache", "--yes", "--dry-run"], writes: true },
2212
2279
  { name: "imported-sheets vectorize", args: ["id"], required: ["--instance"], flags: ["--locales", "--yes", "--dry-run"], writes: true },
2213
2280
  { name: "imported-sheets repair-french", args: ["id"], required: ["--instance"], flags: ["--locales", "--revectorize", "--yes", "--dry-run"], writes: true },
2214
2281
  { name: "imported-sheets copy-to", args: ["id"], required: ["--instance", "--target or --targets"], flags: ["--display-name", "--replace", "--revectorize", "--yes", "--dry-run"], writes: true },
@@ -2351,6 +2418,9 @@ var importedSheetsHelp = () => ({
2351
2418
  "gskills-admin imported-sheets update <sheetId> --instance <instanceId> --data-file ./settings.json --dry-run",
2352
2419
  "gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run",
2353
2420
  "gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run",
2421
+ "gskills-admin imported-sheets retranslate <sheetId> --instance <instanceId> --from en --to fr,de,es --dry-run",
2422
+ "gskills-admin imported-sheets replace-grid <sheetId> --instance <instanceId> --locale en --data-file ./grid.json --rebuild-columns --dry-run",
2423
+ "gskills-admin imported-sheets patch-cells <sheetId> --instance <instanceId> --data-file ./cell-patches.json --dry-run",
2354
2424
  "gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run",
2355
2425
  "gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run",
2356
2426
  "gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name 'Use cases' --dry-run",
@@ -2358,7 +2428,23 @@ var importedSheetsHelp = () => ({
2358
2428
  "gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run",
2359
2429
  "gskills-admin imported-sheets delete <sheetId> --instance <instanceId> --force --confirm-delete imported-sheets:<sheetId> --dry-run"
2360
2430
  ],
2361
- writes: "create, update, sync, translate, vectorize, repair-french, copy-to, attach-page, set-source and delete require --yes or --dry-run.",
2431
+ writes: "create, update, sync, translate, retranslate, replace-grid, patch-cells, vectorize, repair-french, copy-to, attach-page, set-source and delete require --yes or --dry-run.",
2432
+ patchCellsDataShape: {
2433
+ patches: [
2434
+ {
2435
+ locale: "fr",
2436
+ rowIndex: 12,
2437
+ columnHeader: "Capture_link",
2438
+ rawValue: "https://lh7-qw.googleusercontent.com/docsz/..."
2439
+ },
2440
+ {
2441
+ locale: "en",
2442
+ rowId: "row_id_from_imported_sheets_get",
2443
+ columnId: "column_id_from_imported_sheets_get",
2444
+ rawValue: null
2445
+ }
2446
+ ]
2447
+ },
2362
2448
  createDataShape: {
2363
2449
  instanceId: "global",
2364
2450
  displayName: "Cas d'usage Gemini",
@@ -2379,7 +2465,9 @@ var importedSheetsHelp = () => ({
2379
2465
  useCaseListFlow: [
2380
2466
  "copy-to from global to a client instance with --display-name 'Use cases'",
2381
2467
  "attach-page inserts the importedSheet EditorJS block and invalidates page deploy cache",
2382
- "set-source updates one locale source and can --resync immediately"
2468
+ "set-source updates one locale source and can --resync immediately",
2469
+ "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",
2470
+ "retranslate rebuilds AI_TRANSLATION locales from the stored source rows without reading Google Sheets"
2383
2471
  ]
2384
2472
  });
2385
2473
  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.24",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin-only CLI for GSkills super-admin operations.",
@@ -124,9 +124,48 @@ These recurring historical DB-only jobs now have CLI paths:
124
124
  | Force relogin after access/auth data change | `gskills-admin sessions invalidate --email user@example.com --dry-run --output json` |
125
125
  | Find content-assistant artifact links | `gskills-admin content-assistant lookup --query "artifact title" --output json` |
126
126
  | Admin ingest incomplete sync repair | `gskills-admin admin-ingest repair-state --instance <instanceId> --output json` then `gskills-admin admin-ingest repair --instance <instanceId> --dry-run --output json` |
127
+ | Imported-sheet row-cell repair or media enrichment | `gskills-admin imported-sheets patch-cells <sheetId> --instance <instanceId> --data-file ./cell-patches.json --dry-run --output json` |
127
128
 
128
129
  If a job is not in this table, first try `gskills-admin schema --output json` and resource CRUD. If the route is still missing and the job is recurring, add the CLI route before reaching for direct DB access.
129
130
 
131
+ ## Imported Sheet Cell Updates
132
+
133
+ Use `patch-cells` for focused imported-sheet row-cell updates, especially when a script already has the right target rows from `imported-sheets get`.
134
+
135
+ ```bash
136
+ gskills-admin imported-sheets patch-cells <sheetId> --instance global --data-file ./cell-patches.json --dry-run --output json
137
+ gskills-admin imported-sheets patch-cells <sheetId> --instance global --data-file ./cell-patches.json --yes --output json
138
+ ```
139
+
140
+ Patch file shape:
141
+
142
+ ```json
143
+ {
144
+ "patches": [
145
+ {
146
+ "locale": "fr",
147
+ "rowIndex": 12,
148
+ "columnHeader": "Capture_link",
149
+ "rawValue": "https://lh7-qw.googleusercontent.com/docsz/..."
150
+ },
151
+ {
152
+ "locale": "en",
153
+ "rowId": "row_id_from_imported_sheets_get",
154
+ "columnId": "column_id_from_imported_sheets_get",
155
+ "rawValue": null
156
+ }
157
+ ]
158
+ }
159
+ ```
160
+
161
+ Rules:
162
+
163
+ - Always dry-run first. The server resolves real locale, row and column and shows before/after samples.
164
+ - Prefer `rowId` and `columnId` when they are available from `imported-sheets get`; use `rowIndex` and `columnHeader` only when the row order and headers were just verified.
165
+ - By default the command invalidates deploy cache for touched locales. Use `--no-cache` only for internal fields that cannot affect visible deploy pages.
166
+ - Use `--revectorize` only when patched cells are included in vectorization. Media or link-only fixes usually do not need it.
167
+ - Do not write direct DB scripts for repeatable imported-sheet edits. Add a CLI route or use `patch-cells`.
168
+
130
169
  ## Instance Rules
131
170
 
132
171
  If `--instance` is omitted, content-like resources default to `instanceId = "global"`.
@@ -258,6 +297,8 @@ gskills-admin imported-sheets resolve --instance <instanceId> --source <sheet-ur
258
297
  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
298
  gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run --output json
260
299
  gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run --output json
300
+ gskills-admin imported-sheets retranslate <sheetId> --instance <instanceId> --from en --to fr,de,es --dry-run --output json
301
+ gskills-admin imported-sheets replace-grid <sheetId> --instance <instanceId> --locale en --data-file ./grid.json --rebuild-columns --dry-run --output json
261
302
  gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run --output json
262
303
  gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run --output json
263
304
  gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name "Use cases" --dry-run --output json