@numericoach/gskills-admin-cli 0.1.10 → 0.1.12

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
@@ -47,6 +47,18 @@ gskills-admin topics help --output json
47
47
 
48
48
  Use the listed `cache.scopes` with `gskills-admin cache invalidate` after create, update, or delete when the end-user view must reflect the change immediately.
49
49
 
50
+ AI translation is available for content that has native AI translation in the editor:
51
+
52
+ ```bash
53
+ gskills-admin translate pages <pageId> --to en,es --dry-run --output json
54
+ gskills-admin translate pages --ids <pageId,pageId> --from fr --to en --dry-run --output json
55
+ gskills-admin translate pages --all --instance global --from fr --to en --take 100 --dry-run --output json
56
+ gskills-admin translate quizzes <quizId> --to en --yes --output json
57
+ gskills-admin translate knowledge-video <knowledgeId> --from en --to es --yes --output json
58
+ ```
59
+
60
+ Supported kinds are `pages`, `quizzes`, `topics`, `badges`, `menus`, `menu-sections`, `internal-knowledge`, `knowledge-video`, `learning-paths`, and `chromebook-exercises`.
61
+
50
62
  Operational helpers are available for the admin-only flows agents should not improvise:
51
63
 
52
64
  ```bash
@@ -62,7 +74,7 @@ gskills-admin ambassadors label --instance <instanceId> --language fr --output j
62
74
 
63
75
  Feedback reply bodies are file-based on purpose. Production replies are multi-line, and `send-reply` rejects inline body text to avoid shell parsing surprises.
64
76
 
65
- Raw project and analytics data can be read or adjusted through resources such as `project-data`, `ticket-sla-rules`, `analytics`, `quiz-attempts`, `user-paths`, `chromebook-progress`, `user-badges`, `user-learning-paths`, and `user-learning-path-item-completions`.
77
+ Raw project and analytics data can be read or adjusted through resources such as `project-data`, `ticket-sla-rules`, `learning-path-items`, `learning-path-groups`, `quiz-questions`, `quiz-options`, `analytics`, `quiz-attempts`, `user-paths`, `chromebook-progress`, `user-badges`, `user-learning-paths`, and `user-learning-path-item-completions`.
66
78
 
67
79
  ## Agent skill
68
80
 
@@ -381,6 +381,26 @@ var resources = [
381
381
  dangerousDelete: true,
382
382
  cacheScopes: ["pages", "pages-knowledge"]
383
383
  },
384
+ {
385
+ name: "learning-path-items",
386
+ delegate: "learningPathItem",
387
+ label: "Learning path items",
388
+ aliases: ["learning-path-item", "path-items", "path-item"],
389
+ defaultFields: ["id", "learningPathId", "type", "order", "groupId", "pageId", "resourceId", "knowledgeId", "quizId", "estimatedTimeInMinutes", "sourceItemId"],
390
+ instanceField: null,
391
+ dangerousDelete: true,
392
+ cacheScopes: ["pages", "pages-knowledge"]
393
+ },
394
+ {
395
+ name: "learning-path-groups",
396
+ delegate: "learningPathGroup",
397
+ label: "Learning path groups",
398
+ aliases: ["learning-path-group", "path-groups", "path-group"],
399
+ defaultFields: ["id", "learningPathId", "title", "description", "order", "sourceGroupId", "updatedAt"],
400
+ instanceField: null,
401
+ dangerousDelete: true,
402
+ cacheScopes: ["pages", "pages-knowledge"]
403
+ },
384
404
  {
385
405
  name: "changelogs",
386
406
  delegate: "changelog",
@@ -469,6 +489,26 @@ var resources = [
469
489
  dangerousDelete: true,
470
490
  cacheScopes: ["pages", "pages-knowledge"]
471
491
  },
492
+ {
493
+ name: "quiz-questions",
494
+ delegate: "question",
495
+ label: "Quiz questions",
496
+ aliases: ["quiz-question", "questions", "question"],
497
+ defaultFields: ["id", "quizId", "text", "type", "language", "order", "points", "parentId", "updatedAt"],
498
+ instanceField: null,
499
+ dangerousDelete: true,
500
+ cacheScopes: ["pages", "pages-knowledge"]
501
+ },
502
+ {
503
+ name: "quiz-options",
504
+ delegate: "option",
505
+ label: "Quiz options",
506
+ aliases: ["quiz-option", "options", "option"],
507
+ defaultFields: ["id", "questionId", "text", "language", "isCorrect", "order", "explanation", "parentId", "updatedAt"],
508
+ instanceField: null,
509
+ dangerousDelete: true,
510
+ cacheScopes: ["pages", "pages-knowledge"]
511
+ },
472
512
  {
473
513
  name: "badges",
474
514
  delegate: "badge",
@@ -736,6 +776,8 @@ var runCommand = async (ctx) => {
736
776
  return runSyncCommand(actionOrResource, ctx);
737
777
  if (group === "cache")
738
778
  return runCacheCommand(actionOrResource, ctx);
779
+ if (group === "translate")
780
+ return runTranslateCommand(actionOrResource, maybeAction, ctx);
739
781
  if (group === "feedback")
740
782
  return runFeedbackCommand(actionOrResource, maybeAction, ctx);
741
783
  if (group === "access")
@@ -1197,6 +1239,37 @@ var runCacheCommand = async (action, ctx) => {
1197
1239
  body: JSON.stringify(payload)
1198
1240
  });
1199
1241
  };
1242
+ var runTranslateCommand = async (kind, id, ctx) => {
1243
+ if (!kind || kind === "help")
1244
+ return translateHelp();
1245
+ const ids = splitCsv(getStringFlag(ctx, "ids"));
1246
+ const all = hasFlag(ctx, "all");
1247
+ if (!id && ids.length === 0 && !all)
1248
+ throw new CliError("Missing source content id, --ids, or --all", 2);
1249
+ if (all && (id || ids.length > 0))
1250
+ throw new CliError("Use either an id/--ids or --all, not both", 2);
1251
+ const targetLanguages = splitCsv(getStringFlag(ctx, "to") ?? getStringFlag(ctx, "languages"));
1252
+ if (targetLanguages.length === 0)
1253
+ throw new CliError("Missing --to", 2);
1254
+ if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
1255
+ throw new CliError("AI translation writes content. Add --yes or use --dry-run.", 2);
1256
+ }
1257
+ return requestApi(`/api/cli/translate/${kind}`, {
1258
+ method: "POST",
1259
+ body: JSON.stringify({
1260
+ id,
1261
+ ids,
1262
+ all,
1263
+ where: parseJsonObject(getStringFlag(ctx, "where"), "--where"),
1264
+ instanceId: getStringFlag(ctx, "instance"),
1265
+ take: getNumberFlag(ctx, "take"),
1266
+ targetLanguages,
1267
+ sourceLanguage: getStringFlag(ctx, "from") ?? getStringFlag(ctx, "source-language"),
1268
+ mode: getStringFlag(ctx, "mode") ?? "upsert",
1269
+ dryRun: hasFlag(ctx, "dry-run")
1270
+ })
1271
+ });
1272
+ };
1200
1273
  var syncLogs = (ctx) => {
1201
1274
  const searchParams = new URLSearchParams;
1202
1275
  const targetInstanceId = getStringFlag(ctx, "target") ?? getStringFlag(ctx, "instance");
@@ -1436,7 +1509,8 @@ var rootHelp = () => ({
1436
1509
  "gskills-admin auth whoami",
1437
1510
  "gskills-admin pages list",
1438
1511
  `gskills-admin pages update <id> --data '{"disabled":true}'`,
1439
- "gskills-admin sync run --target <instanceId> --only pages,quizzes --yes"
1512
+ "gskills-admin sync run --target <instanceId> --only pages,quizzes --yes",
1513
+ "gskills-admin translate pages <id> --to en,es --dry-run"
1440
1514
  ],
1441
1515
  resources: resources.map((resource) => resource.name),
1442
1516
  output: "Use --output json, --output jsonl, --output table, or --output markdown. Piped output defaults to JSON.",
@@ -1468,6 +1542,7 @@ var schemaHelp = () => ({
1468
1542
  { name: "sync presets", writes: false },
1469
1543
  { name: "cache scopes", writes: false },
1470
1544
  { name: "cache invalidate", required: ["--instance"], flags: ["--scope", "--languages", "--yes", "--dry-run"], writes: true },
1545
+ { name: "translate", args: ["kind", "id?"], required: ["--to"], flags: ["--ids", "--all", "--instance", "--from", "--where", "--take", "--mode", "--yes", "--dry-run"], writes: true },
1471
1546
  { name: "feedback claim", args: ["feedbackId"], flags: ["--dry-run"], writes: true },
1472
1547
  { name: "feedback send-claim", args: ["feedbackId"], flags: ["--recipient-email", "--recipient-name", "--cc", "--subject", "--body", "--yes", "--dry-run"], writes: true },
1473
1548
  { name: "feedback send-reply", args: ["feedbackId"], flags: ["--subject", "--subject-file", "--body-file", "--translated-subject", "--translated-subject-file", "--translated-body-file", "--user-language", "--current-language", "--yes", "--dry-run"], writes: true },
@@ -1547,6 +1622,37 @@ var cacheHelp = () => ({
1547
1622
  scopes: ["all", "pages", "pages-knowledge", "menu-bundle", "applications"],
1548
1623
  note: "Uses the same deploy-cache version bump system as the super-admin content settings screen."
1549
1624
  });
1625
+ var translateHelp = () => ({
1626
+ usage: [
1627
+ "gskills-admin translate pages <pageId> --to en,es --dry-run",
1628
+ "gskills-admin translate pages --ids <pageId,pageId> --to en --dry-run",
1629
+ "gskills-admin translate pages --all --instance global --from fr --to en --take 100 --dry-run",
1630
+ "gskills-admin translate quizzes <quizId> --to en --yes",
1631
+ "gskills-admin translate topics <topicId> --to en --yes",
1632
+ "gskills-admin translate badges <badgeId> --to en --yes",
1633
+ "gskills-admin translate menus <menuItemId> --to en --yes",
1634
+ "gskills-admin translate menu-sections <menuSectionId> --to en --yes",
1635
+ "gskills-admin translate internal-knowledge <knowledgeId> --to en --yes",
1636
+ "gskills-admin translate knowledge-video <knowledgeId> --from en --to es --yes",
1637
+ "gskills-admin translate learning-paths <pathId> --to en --yes",
1638
+ "gskills-admin translate chromebook-exercises <exerciseId> --to en --yes"
1639
+ ],
1640
+ contentKinds: [
1641
+ "pages",
1642
+ "quizzes",
1643
+ "topics",
1644
+ "badges",
1645
+ "menus",
1646
+ "menu-sections",
1647
+ "internal-knowledge",
1648
+ "knowledge-video",
1649
+ "learning-paths",
1650
+ "chromebook-exercises"
1651
+ ],
1652
+ modes: ["upsert", "create", "update"],
1653
+ selection: "Pass one id, --ids for several source rows, or --all with optional --instance, --from, --where and --take.",
1654
+ note: "Uses the same AI translation helpers as the editors. Dry-run plans the write without calling AI."
1655
+ });
1550
1656
  var feedbackHelp = () => ({
1551
1657
  usage: [
1552
1658
  "gskills-admin feedback send-reply <feedbackId> --subject 'GSkills - ...' --body-file ./reply.fr.txt --dry-run",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@numericoach/gskills-admin-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin-only CLI for GSkills super-admin operations.",
@@ -145,6 +145,41 @@ gskills-admin pages create --data @page.json --output json
145
145
 
146
146
  If the CLI version does not support `@file` JSON yet, inline compact JSON or use a small repo script that calls the authenticated API. Do not switch to raw DB access for convenience.
147
147
 
148
+ ## AI Translation
149
+
150
+ Use `translate` when content already has AI translation in its editor and the same operation is needed from the CLI.
151
+
152
+ Supported content kinds:
153
+
154
+ - `pages`
155
+ - `quizzes`
156
+ - `topics`
157
+ - `badges`
158
+ - `menus`
159
+ - `menu-sections`
160
+ - `internal-knowledge`
161
+ - `knowledge-video`
162
+ - `learning-paths`
163
+ - `chromebook-exercises`
164
+
165
+ Selection can be one source row, several source rows, or all matching rows:
166
+
167
+ ```bash
168
+ gskills-admin translate pages <pageId> --to en,es --dry-run --output json
169
+ gskills-admin translate pages --ids <pageId,pageId> --from fr --to en --dry-run --output json
170
+ gskills-admin translate pages --all --instance global --from fr --to en --take 100 --dry-run --output json
171
+ gskills-admin translate quizzes <quizId> --to en --yes --output json
172
+ gskills-admin translate knowledge-video <knowledgeId> --from en --to es --yes --output json
173
+ ```
174
+
175
+ Always dry-run first. Dry-run lists planned rows and target languages without calling AI or writing data. Real runs require `--yes`.
176
+
177
+ For quizzes, the CLI mirrors the quiz thematic through `categoryId` across translations.
178
+
179
+ For internal knowledge videos, use `knowledge-video`. It queues the same native video localization workflow as the editor, so it creates a localization job instead of copying the original media.
180
+
181
+ After visible content translation, read the cache hint in the response and invalidate the narrow scope before checking the deploy UI.
182
+
148
183
  ## Sync
149
184
 
150
185
  Global is the source by default.