@numericoach/gskills-admin-cli 0.1.20 → 0.1.22
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 +19 -0
- package/dist/gskills-admin.js +399 -0
- package/package.json +1 -1
- package/skills/gskills-admin-cli/SKILL.md +39 -3
package/README.md
CHANGED
|
@@ -68,6 +68,23 @@ gskills-admin translate knowledge-video <knowledgeId> --from en --to es --yes --
|
|
|
68
68
|
Supported kinds are `pages`, `quizzes`, `topics`, `badges`, `menus`, `menu-sections`, `internal-knowledge`, `knowledge-video`, `learning-paths`, and `chromebook-exercises`.
|
|
69
69
|
Target languages must be explicit. `--to all` is rejected.
|
|
70
70
|
|
|
71
|
+
Imported Google Sheets have their own command family:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
gskills-admin imported-sheets list --instance <instanceId> --output json
|
|
75
|
+
gskills-admin imported-sheets resolve --instance <instanceId> --source <sheet-url> --output json
|
|
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
|
+
gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run --output json
|
|
78
|
+
gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run --output json
|
|
79
|
+
gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run --output json
|
|
80
|
+
gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run --output json
|
|
81
|
+
gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name "Use cases" --dry-run --output json
|
|
82
|
+
gskills-admin imported-sheets attach-page <sheetId> --instance <instanceId> --page <pageId> --locale fr --dry-run --output json
|
|
83
|
+
gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run --output json
|
|
84
|
+
```
|
|
85
|
+
|
|
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`.
|
|
87
|
+
|
|
71
88
|
Operational helpers are available for the admin-only flows agents should not improvise:
|
|
72
89
|
|
|
73
90
|
```bash
|
|
@@ -102,6 +119,8 @@ Feedback reply bodies are file-based on purpose. Production replies are multi-li
|
|
|
102
119
|
|
|
103
120
|
The direct-DB replacement commands cover the recurring historical gaps: email-to-feedback import, quiz/course progress repair, source-link repair, page metadata backfill, content-assistant artifact lookup, and JWT session invalidation. Reads stay read-only. Writes require `--dry-run` or `--yes` and log through the app API.
|
|
104
121
|
|
|
122
|
+
Agents can combine the CLI with local code. Use CLI JSON output inside shell loops, `jq`, Bun, Node, or TypeScript helpers for batching, joins, comparisons, retries, and reports. If a small local tool is missing, install or invoke it when useful. Keep production access through the authenticated CLI, not direct DB URLs.
|
|
123
|
+
|
|
105
124
|
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`.
|
|
106
125
|
|
|
107
126
|
## Agent skill
|
package/dist/gskills-admin.js
CHANGED
|
@@ -611,6 +611,57 @@ var resources = [
|
|
|
611
611
|
dangerousDelete: true,
|
|
612
612
|
cacheScopes: ["pages", "pages-knowledge"]
|
|
613
613
|
},
|
|
614
|
+
{
|
|
615
|
+
name: "imported-sheets",
|
|
616
|
+
delegate: "importedSheet",
|
|
617
|
+
label: "Imported sheets",
|
|
618
|
+
aliases: ["imported-sheet", "sheets-imported", "google-sheets-imports"],
|
|
619
|
+
defaultFields: ["id", "displayName", "spreadsheetTitle", "selectedTabName", "instanceId", "status", "multilangMode", "defaultLocale", "enabledLocales", "enableVectorization", "lastSyncedAt", "updatedAt"],
|
|
620
|
+
dangerousDelete: true,
|
|
621
|
+
cacheScopes: ["pages-knowledge"]
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: "imported-sheet-columns",
|
|
625
|
+
delegate: "importedSheetColumn",
|
|
626
|
+
label: "Imported sheet columns",
|
|
627
|
+
aliases: ["imported-sheet-column", "sheet-columns"],
|
|
628
|
+
defaultFields: ["id", "importedSheetId", "position", "displayOrder", "headerName", "inferredType", "isVisible", "isFilterable", "includeInVectorization", "displayType", "showLabel", "updatedAt"],
|
|
629
|
+
instanceField: null,
|
|
630
|
+
cacheScopes: ["pages-knowledge"]
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
name: "imported-sheet-variants",
|
|
634
|
+
delegate: "importedSheetVariant",
|
|
635
|
+
label: "Imported sheet variants",
|
|
636
|
+
aliases: ["imported-sheet-variant", "sheet-variants"],
|
|
637
|
+
defaultFields: ["id", "importedSheetId", "locale", "isDefault", "status", "googleSpreadsheetId", "selectedTabName", "lastSyncedAt", "updatedAt"],
|
|
638
|
+
instanceField: null,
|
|
639
|
+
cacheScopes: ["pages-knowledge"]
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
name: "imported-sheet-rows",
|
|
643
|
+
delegate: "importedSheetRow",
|
|
644
|
+
label: "Imported sheet rows",
|
|
645
|
+
aliases: ["imported-sheet-row", "sheet-rows"],
|
|
646
|
+
defaultFields: ["id", "variantId", "rowIndex", "updatedAt"],
|
|
647
|
+
instanceField: null
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
name: "imported-sheet-cells",
|
|
651
|
+
delegate: "importedSheetCell",
|
|
652
|
+
label: "Imported sheet cells",
|
|
653
|
+
aliases: ["imported-sheet-cell", "sheet-cells"],
|
|
654
|
+
defaultFields: ["id", "rowId", "columnId", "rawValue", "normalizedValue", "updatedAt"],
|
|
655
|
+
instanceField: null
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: "imported-sheet-sync-runs",
|
|
659
|
+
delegate: "importedSheetSyncRun",
|
|
660
|
+
label: "Imported sheet sync runs",
|
|
661
|
+
aliases: ["imported-sheet-sync-run", "sheet-sync-runs"],
|
|
662
|
+
defaultFields: ["id", "importedSheetId", "variantId", "locale", "status", "rowsImported", "errorMessage", "startedAt", "finishedAt"],
|
|
663
|
+
instanceField: null
|
|
664
|
+
},
|
|
614
665
|
{
|
|
615
666
|
name: "feature-flags",
|
|
616
667
|
delegate: "featureFlagAssignment",
|
|
@@ -778,6 +829,8 @@ var runCommand = async (ctx) => {
|
|
|
778
829
|
return runCacheCommand(actionOrResource, ctx);
|
|
779
830
|
if (group === "translate")
|
|
780
831
|
return runTranslateCommand(actionOrResource, maybeAction, ctx);
|
|
832
|
+
if (group === "imported-sheets" || group === "imported-sheet")
|
|
833
|
+
return runImportedSheetsCommand(actionOrResource, maybeAction, ctx);
|
|
781
834
|
if (group === "feedback")
|
|
782
835
|
return runFeedbackCommand(actionOrResource, maybeAction, ctx);
|
|
783
836
|
if (group === "progress")
|
|
@@ -1540,6 +1593,242 @@ var runTranslateCommand = async (kind, id, ctx) => {
|
|
|
1540
1593
|
});
|
|
1541
1594
|
return addTranslatePagesWarning(kind, mode, result);
|
|
1542
1595
|
};
|
|
1596
|
+
var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
|
|
1597
|
+
if (!action || action === "help")
|
|
1598
|
+
return importedSheetsHelp();
|
|
1599
|
+
const instanceId = getStringFlag(ctx, "instance");
|
|
1600
|
+
const needsInstance = [
|
|
1601
|
+
"list",
|
|
1602
|
+
"get",
|
|
1603
|
+
"locales",
|
|
1604
|
+
"resolve",
|
|
1605
|
+
"create",
|
|
1606
|
+
"update",
|
|
1607
|
+
"sync",
|
|
1608
|
+
"enable-locales",
|
|
1609
|
+
"translate",
|
|
1610
|
+
"vectorize",
|
|
1611
|
+
"repair-french",
|
|
1612
|
+
"copy-to",
|
|
1613
|
+
"attach-page",
|
|
1614
|
+
"set-source",
|
|
1615
|
+
"delete",
|
|
1616
|
+
"runs"
|
|
1617
|
+
].includes(action);
|
|
1618
|
+
if (needsInstance && !instanceId)
|
|
1619
|
+
throw new CliError("Missing --instance", 2);
|
|
1620
|
+
if (action === "list") {
|
|
1621
|
+
return requestApi(`/api/cli/imported-sheets?instanceId=${encodeURIComponent(instanceId)}`);
|
|
1622
|
+
}
|
|
1623
|
+
if (action === "get") {
|
|
1624
|
+
if (!importedSheetId)
|
|
1625
|
+
throw new CliError("Missing imported sheet id", 2);
|
|
1626
|
+
const searchParams = importedSheetSearchParams(ctx);
|
|
1627
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}?${searchParams.toString()}`);
|
|
1628
|
+
}
|
|
1629
|
+
if (action === "locales") {
|
|
1630
|
+
if (!importedSheetId)
|
|
1631
|
+
throw new CliError("Missing imported sheet id", 2);
|
|
1632
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/locales?instanceId=${encodeURIComponent(instanceId)}`);
|
|
1633
|
+
}
|
|
1634
|
+
if (action === "copy-to") {
|
|
1635
|
+
requireWriteConfirmation("Imported sheet operation writes production data. Add --yes or use --dry-run.", ctx);
|
|
1636
|
+
if (!importedSheetId)
|
|
1637
|
+
throw new CliError("Missing imported sheet id", 2);
|
|
1638
|
+
const targetInstanceIds = getTargetInstanceIds(ctx);
|
|
1639
|
+
if (targetInstanceIds.length === 0)
|
|
1640
|
+
throw new CliError("Missing --target or --targets", 2);
|
|
1641
|
+
const payload = {
|
|
1642
|
+
sourceInstanceId: instanceId,
|
|
1643
|
+
targetInstanceIds,
|
|
1644
|
+
displayName: getStringFlag(ctx, "display-name"),
|
|
1645
|
+
replace: hasFlag(ctx, "replace"),
|
|
1646
|
+
revectorize: hasFlag(ctx, "revectorize"),
|
|
1647
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1648
|
+
};
|
|
1649
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1650
|
+
return { operation: "imported-sheets.copy-to", importedSheetId, ...payload };
|
|
1651
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/copy-to`, {
|
|
1652
|
+
method: "POST",
|
|
1653
|
+
body: JSON.stringify(payload)
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
if (action === "attach-page") {
|
|
1657
|
+
requireWriteConfirmation("Imported sheet operation writes production data. Add --yes or use --dry-run.", ctx);
|
|
1658
|
+
if (!importedSheetId)
|
|
1659
|
+
throw new CliError("Missing imported sheet id", 2);
|
|
1660
|
+
const pageId = getStringFlag(ctx, "page");
|
|
1661
|
+
if (!pageId)
|
|
1662
|
+
throw new CliError("Missing --page", 2);
|
|
1663
|
+
const payload = {
|
|
1664
|
+
instanceId,
|
|
1665
|
+
pageId,
|
|
1666
|
+
locale: getStringFlag(ctx, "locale") ?? getStringFlag(ctx, "language") ?? "fr",
|
|
1667
|
+
position: getStringFlag(ctx, "position") ?? "end",
|
|
1668
|
+
replaceExisting: hasFlag(ctx, "replace-existing"),
|
|
1669
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1670
|
+
};
|
|
1671
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1672
|
+
return { operation: "imported-sheets.attach-page", importedSheetId, ...payload };
|
|
1673
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/attach-page`, {
|
|
1674
|
+
method: "POST",
|
|
1675
|
+
body: JSON.stringify(payload)
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
if (action === "set-source") {
|
|
1679
|
+
requireWriteConfirmation("Imported sheet operation writes production data. Add --yes or use --dry-run.", ctx);
|
|
1680
|
+
if (!importedSheetId)
|
|
1681
|
+
throw new CliError("Missing imported sheet id", 2);
|
|
1682
|
+
const locale = getStringFlag(ctx, "locale") ?? getStringFlag(ctx, "language");
|
|
1683
|
+
const sourceInput = getStringFlag(ctx, "source");
|
|
1684
|
+
const tabName = getStringFlag(ctx, "tab");
|
|
1685
|
+
if (!locale)
|
|
1686
|
+
throw new CliError("Missing --locale", 2);
|
|
1687
|
+
if (!sourceInput)
|
|
1688
|
+
throw new CliError("Missing --source", 2);
|
|
1689
|
+
if (!tabName)
|
|
1690
|
+
throw new CliError("Missing --tab", 2);
|
|
1691
|
+
const payload = {
|
|
1692
|
+
instanceId,
|
|
1693
|
+
locale,
|
|
1694
|
+
sourceInput,
|
|
1695
|
+
tabName,
|
|
1696
|
+
resync: hasFlag(ctx, "resync"),
|
|
1697
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1698
|
+
};
|
|
1699
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1700
|
+
return { operation: "imported-sheets.set-source", importedSheetId, ...payload };
|
|
1701
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/source`, {
|
|
1702
|
+
method: "POST",
|
|
1703
|
+
body: JSON.stringify(payload)
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
if (action === "runs") {
|
|
1707
|
+
const searchParams = importedSheetSearchParams(ctx);
|
|
1708
|
+
searchParams.set("take", String(getNumberFlag(ctx, "take") ?? 10));
|
|
1709
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId ?? "all"}/runs?${searchParams.toString()}`);
|
|
1710
|
+
}
|
|
1711
|
+
if (action === "resolve") {
|
|
1712
|
+
const sourceInput = getStringFlag(ctx, "source");
|
|
1713
|
+
if (!sourceInput)
|
|
1714
|
+
throw new CliError("Missing --source", 2);
|
|
1715
|
+
return requestApi("/api/cli/imported-sheets/resolve", {
|
|
1716
|
+
method: "POST",
|
|
1717
|
+
body: JSON.stringify({ instanceId, sourceInput })
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
if (["create", "update", "sync", "enable-locales", "translate", "vectorize", "repair-french", "delete"].includes(action)) {
|
|
1721
|
+
requireWriteConfirmation("Imported sheet operation writes production data. Add --yes or use --dry-run.", ctx);
|
|
1722
|
+
}
|
|
1723
|
+
if (action === "create") {
|
|
1724
|
+
const payload = await importedSheetCreatePayload(ctx);
|
|
1725
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1726
|
+
return { dryRun: true, operation: "imported-sheets.create", payload };
|
|
1727
|
+
return requestApi("/api/cli/imported-sheets", {
|
|
1728
|
+
method: "POST",
|
|
1729
|
+
body: JSON.stringify(payload)
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
if (!importedSheetId)
|
|
1733
|
+
throw new CliError("Missing imported sheet id", 2);
|
|
1734
|
+
if (action === "update") {
|
|
1735
|
+
const payload = {
|
|
1736
|
+
instanceId,
|
|
1737
|
+
data: await parseJsonObjectFlag(ctx, "data", "data-file"),
|
|
1738
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1739
|
+
};
|
|
1740
|
+
if (Object.keys(payload.data).length === 0)
|
|
1741
|
+
throw new CliError("Missing --data or --data-file JSON", 2);
|
|
1742
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1743
|
+
return { operation: "imported-sheets.update", importedSheetId, ...payload };
|
|
1744
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}`, {
|
|
1745
|
+
method: "PATCH",
|
|
1746
|
+
body: JSON.stringify(payload)
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
if (action === "sync") {
|
|
1750
|
+
const payload = {
|
|
1751
|
+
instanceId,
|
|
1752
|
+
locales: splitCsv(getStringFlag(ctx, "locales") ?? getStringFlag(ctx, "languages")),
|
|
1753
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1754
|
+
};
|
|
1755
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1756
|
+
return { operation: "imported-sheets.sync", importedSheetId, ...payload };
|
|
1757
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/sync`, {
|
|
1758
|
+
method: "POST",
|
|
1759
|
+
body: JSON.stringify(payload)
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
if (action === "enable-locales" || action === "translate") {
|
|
1763
|
+
const locales = splitCsv(getStringFlag(ctx, "locales") ?? getStringFlag(ctx, "languages") ?? getStringFlag(ctx, "to"));
|
|
1764
|
+
if (locales.length === 0)
|
|
1765
|
+
throw new CliError(`Missing ${action === "translate" ? "--to" : "--locales"}`, 2);
|
|
1766
|
+
if (locales.some((locale) => locale.toLowerCase() === "all")) {
|
|
1767
|
+
throw new CliError("Do not use all. Pass explicit locales like en,es,pt-BR.", 2);
|
|
1768
|
+
}
|
|
1769
|
+
const payload = {
|
|
1770
|
+
instanceId,
|
|
1771
|
+
locales,
|
|
1772
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1773
|
+
};
|
|
1774
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1775
|
+
return { operation: `imported-sheets.${action}`, importedSheetId, ...payload };
|
|
1776
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/translate`, {
|
|
1777
|
+
method: "POST",
|
|
1778
|
+
body: JSON.stringify(payload)
|
|
1779
|
+
});
|
|
1780
|
+
}
|
|
1781
|
+
if (action === "vectorize") {
|
|
1782
|
+
const payload = {
|
|
1783
|
+
instanceId,
|
|
1784
|
+
locales: splitCsv(getStringFlag(ctx, "locales") ?? getStringFlag(ctx, "languages")),
|
|
1785
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1786
|
+
};
|
|
1787
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1788
|
+
return { operation: "imported-sheets.vectorize", importedSheetId, ...payload };
|
|
1789
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/vectorize`, {
|
|
1790
|
+
method: "POST",
|
|
1791
|
+
body: JSON.stringify(payload)
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
if (action === "repair-french") {
|
|
1795
|
+
const payload = {
|
|
1796
|
+
instanceId,
|
|
1797
|
+
locales: splitCsv(getStringFlag(ctx, "locales") ?? getStringFlag(ctx, "languages")),
|
|
1798
|
+
revectorize: hasFlag(ctx, "revectorize"),
|
|
1799
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1800
|
+
};
|
|
1801
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1802
|
+
return { operation: "imported-sheets.repair-french", importedSheetId, ...payload };
|
|
1803
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/repair-french`, {
|
|
1804
|
+
method: "POST",
|
|
1805
|
+
body: JSON.stringify(payload)
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
if (action === "delete") {
|
|
1809
|
+
const expectedConfirmation = `imported-sheets:${importedSheetId}`;
|
|
1810
|
+
if (!hasFlag(ctx, "force"))
|
|
1811
|
+
throw new CliError("Imported sheet delete requires --force", 2);
|
|
1812
|
+
if (getStringFlag(ctx, "confirm-delete") !== expectedConfirmation) {
|
|
1813
|
+
throw new CliError(`Imported sheet delete requires --confirm-delete ${expectedConfirmation}`, 2, {
|
|
1814
|
+
requiredConfirmation: expectedConfirmation,
|
|
1815
|
+
warning: "This permanently deletes the imported sheet, variants, rows and cells."
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
const payload = {
|
|
1819
|
+
instanceId,
|
|
1820
|
+
confirmation: expectedConfirmation,
|
|
1821
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1822
|
+
};
|
|
1823
|
+
if (hasFlag(ctx, "dry-run"))
|
|
1824
|
+
return { operation: "imported-sheets.delete", importedSheetId, ...payload };
|
|
1825
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}`, {
|
|
1826
|
+
method: "DELETE",
|
|
1827
|
+
body: JSON.stringify(payload)
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
throw new CliError(`Unknown imported-sheets command "${action}"`, 2);
|
|
1831
|
+
};
|
|
1543
1832
|
var syncLogs = (ctx) => {
|
|
1544
1833
|
const searchParams = new URLSearchParams;
|
|
1545
1834
|
const targetInstanceId = getStringFlag(ctx, "target") ?? getStringFlag(ctx, "instance");
|
|
@@ -1719,6 +2008,54 @@ var progressSearchParams = (ctx) => {
|
|
|
1719
2008
|
searchParams.set("limit", limit);
|
|
1720
2009
|
return searchParams;
|
|
1721
2010
|
};
|
|
2011
|
+
var importedSheetSearchParams = (ctx) => {
|
|
2012
|
+
const searchParams = new URLSearchParams;
|
|
2013
|
+
const instanceId = getStringFlag(ctx, "instance");
|
|
2014
|
+
const locale = getStringFlag(ctx, "locale") ?? getStringFlag(ctx, "language");
|
|
2015
|
+
const page = getStringFlag(ctx, "page");
|
|
2016
|
+
const pageSize = getStringFlag(ctx, "page-size");
|
|
2017
|
+
if (instanceId)
|
|
2018
|
+
searchParams.set("instanceId", instanceId);
|
|
2019
|
+
if (locale)
|
|
2020
|
+
searchParams.set("locale", locale);
|
|
2021
|
+
if (page)
|
|
2022
|
+
searchParams.set("page", page);
|
|
2023
|
+
if (pageSize)
|
|
2024
|
+
searchParams.set("pageSize", pageSize);
|
|
2025
|
+
return searchParams;
|
|
2026
|
+
};
|
|
2027
|
+
var importedSheetCreatePayload = async (ctx) => {
|
|
2028
|
+
const data = await parseJsonObjectFlag(ctx, "data", "data-file");
|
|
2029
|
+
if (Object.keys(data).length > 0) {
|
|
2030
|
+
return {
|
|
2031
|
+
...data,
|
|
2032
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
const instanceId = getStringFlag(ctx, "instance");
|
|
2036
|
+
const sourceInput = getStringFlag(ctx, "source");
|
|
2037
|
+
const tabName = getStringFlag(ctx, "tab");
|
|
2038
|
+
if (!instanceId)
|
|
2039
|
+
throw new CliError("Missing --instance", 2);
|
|
2040
|
+
if (!sourceInput)
|
|
2041
|
+
throw new CliError("Missing --source", 2);
|
|
2042
|
+
if (!tabName)
|
|
2043
|
+
throw new CliError("Missing --tab", 2);
|
|
2044
|
+
return {
|
|
2045
|
+
instanceId,
|
|
2046
|
+
displayName: getStringFlag(ctx, "display-name"),
|
|
2047
|
+
enabledLocales: splitCsv(getStringFlag(ctx, "locales") ?? getStringFlag(ctx, "languages") ?? "fr"),
|
|
2048
|
+
multilangMode: getStringFlag(ctx, "mode") ?? "AI_TRANSLATION",
|
|
2049
|
+
defaultLocaleSource: {
|
|
2050
|
+
locale: getStringFlag(ctx, "default-locale") ?? "fr",
|
|
2051
|
+
sourceInput,
|
|
2052
|
+
tabName
|
|
2053
|
+
},
|
|
2054
|
+
enableVectorization: hasFlag(ctx, "enable-vectorization"),
|
|
2055
|
+
vectorHeaders: splitCsv(getStringFlag(ctx, "vector-headers") ?? getStringFlag(ctx, "vector-columns")),
|
|
2056
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
2057
|
+
};
|
|
2058
|
+
};
|
|
1722
2059
|
var splitCsv = (value) => value ? value.split(",").map((item) => item.trim()).filter(Boolean) : [];
|
|
1723
2060
|
var setWhereValue = (where, fieldPath, value) => {
|
|
1724
2061
|
const parts = fieldPath.split(".").map((part) => part.trim()).filter(Boolean);
|
|
@@ -1807,6 +2144,11 @@ var getNumberFlag = (ctx, name) => {
|
|
|
1807
2144
|
throw new CliError(`--${name} must be a number`, 2);
|
|
1808
2145
|
return number;
|
|
1809
2146
|
};
|
|
2147
|
+
var requireWriteConfirmation = (message, ctx) => {
|
|
2148
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
2149
|
+
throw new CliError(message, 2);
|
|
2150
|
+
}
|
|
2151
|
+
};
|
|
1810
2152
|
var rootHelp = () => ({
|
|
1811
2153
|
name: "gskills-admin",
|
|
1812
2154
|
description: "Super admin CLI for GSkills operations through authenticated API routes",
|
|
@@ -1819,6 +2161,7 @@ var rootHelp = () => ({
|
|
|
1819
2161
|
"gskills-admin sync run --target <instanceId> --only pages,quizzes --yes",
|
|
1820
2162
|
"gskills-admin sync repair-source-links --target <instanceId> --dry-run",
|
|
1821
2163
|
"gskills-admin translate pages <id> --to en,es --dry-run",
|
|
2164
|
+
"gskills-admin imported-sheets create --instance <id> --source <url> --tab <name> --locales fr,en --enable-vectorization --dry-run",
|
|
1822
2165
|
"gskills-admin internal-knowledge sync-media --since today --languages fr --all-targets --dry-run",
|
|
1823
2166
|
"gskills-admin progress learning-path-quiz-mismatches --instance <instanceId>",
|
|
1824
2167
|
"gskills-admin sessions invalidate --email user@example.com --dry-run",
|
|
@@ -1856,6 +2199,22 @@ var schemaHelp = () => ({
|
|
|
1856
2199
|
{ name: "cache scopes", writes: false },
|
|
1857
2200
|
{ name: "cache invalidate", required: ["--instance"], flags: ["--scope", "--languages", "--yes", "--dry-run"], writes: true },
|
|
1858
2201
|
{ name: "translate", args: ["kind", "id?"], required: ["--to"], flags: ["--ids", "--all", "--instance", "--from", "--where", "--take", "--mode", "--source-history", "--yes", "--dry-run"], writes: true },
|
|
2202
|
+
{ name: "imported-sheets list", required: ["--instance"], writes: false },
|
|
2203
|
+
{ name: "imported-sheets get", args: ["id"], required: ["--instance"], flags: ["--locale", "--page", "--page-size"], writes: false },
|
|
2204
|
+
{ name: "imported-sheets locales", args: ["id"], required: ["--instance"], writes: false },
|
|
2205
|
+
{ name: "imported-sheets runs", args: ["id?"], required: ["--instance"], flags: ["--take"], writes: false },
|
|
2206
|
+
{ name: "imported-sheets resolve", required: ["--instance", "--source"], writes: false },
|
|
2207
|
+
{ name: "imported-sheets create", required: ["--instance", "--source", "--tab"], flags: ["--display-name", "--locales", "--mode", "--enable-vectorization", "--vector-headers", "--data", "--data-file", "--yes", "--dry-run"], writes: true },
|
|
2208
|
+
{ name: "imported-sheets update", args: ["id"], required: ["--instance", "--data or --data-file"], flags: ["--yes", "--dry-run"], writes: true },
|
|
2209
|
+
{ name: "imported-sheets sync", args: ["id"], required: ["--instance"], flags: ["--locales", "--yes", "--dry-run"], writes: true },
|
|
2210
|
+
{ name: "imported-sheets enable-locales", args: ["id"], required: ["--instance", "--locales"], flags: ["--yes", "--dry-run"], writes: true },
|
|
2211
|
+
{ name: "imported-sheets translate", args: ["id"], required: ["--instance", "--to"], flags: ["--yes", "--dry-run"], writes: true },
|
|
2212
|
+
{ name: "imported-sheets vectorize", args: ["id"], required: ["--instance"], flags: ["--locales", "--yes", "--dry-run"], writes: true },
|
|
2213
|
+
{ name: "imported-sheets repair-french", args: ["id"], required: ["--instance"], flags: ["--locales", "--revectorize", "--yes", "--dry-run"], writes: true },
|
|
2214
|
+
{ name: "imported-sheets copy-to", args: ["id"], required: ["--instance", "--target or --targets"], flags: ["--display-name", "--replace", "--revectorize", "--yes", "--dry-run"], writes: true },
|
|
2215
|
+
{ name: "imported-sheets attach-page", args: ["id"], required: ["--instance", "--page"], flags: ["--locale", "--position", "--replace-existing", "--yes", "--dry-run"], writes: true },
|
|
2216
|
+
{ name: "imported-sheets set-source", args: ["id"], required: ["--instance", "--locale", "--source", "--tab"], flags: ["--resync", "--yes", "--dry-run"], writes: true },
|
|
2217
|
+
{ name: "imported-sheets delete", args: ["id"], required: ["--instance", "--force", "--confirm-delete"], flags: ["--yes", "--dry-run"], writes: true, destructive: true },
|
|
1859
2218
|
{ name: "internal-knowledge sync-media", flags: ["--source", "--target", "--targets", "--all-targets", "--languages", "--since", "--updated-after", "--fields", "--mime", "--source-type", "--include-disabled", "--include-archived", "--no-cache", "--yes", "--dry-run"], writes: true },
|
|
1860
2219
|
{ name: "pages backfill-field", required: ["--field", "--target or --targets or --all-targets"], flags: ["--source", "--languages", "--no-cache", "--yes", "--dry-run"], writes: true },
|
|
1861
2220
|
{ name: "feedback inspect", args: ["feedbackId or URL"], writes: false },
|
|
@@ -1983,6 +2342,46 @@ var translateHelp = () => ({
|
|
|
1983
2342
|
patchMode: "For pages, --mode patch uses source page history to update changed translatable text while preserving target non-text block data such as activity ids, quiz ids, embedded ids, files, and future custom fields. It updates existing translations only and fails when no previous source history exists.",
|
|
1984
2343
|
note: "Uses the same AI translation helpers as the editors. Dry-run plans the write without calling AI. Pass explicit target languages. --to all is intentionally rejected."
|
|
1985
2344
|
});
|
|
2345
|
+
var importedSheetsHelp = () => ({
|
|
2346
|
+
usage: [
|
|
2347
|
+
"gskills-admin imported-sheets list --instance <instanceId>",
|
|
2348
|
+
"gskills-admin imported-sheets get <sheetId> --instance <instanceId> --locale en --page-size 100",
|
|
2349
|
+
"gskills-admin imported-sheets resolve --instance <instanceId> --source <sheet-url>",
|
|
2350
|
+
"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",
|
|
2351
|
+
"gskills-admin imported-sheets update <sheetId> --instance <instanceId> --data-file ./settings.json --dry-run",
|
|
2352
|
+
"gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run",
|
|
2353
|
+
"gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run",
|
|
2354
|
+
"gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run",
|
|
2355
|
+
"gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run",
|
|
2356
|
+
"gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name 'Use cases' --dry-run",
|
|
2357
|
+
"gskills-admin imported-sheets attach-page <sheetId> --instance <instanceId> --page <pageId> --locale fr --dry-run",
|
|
2358
|
+
"gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run",
|
|
2359
|
+
"gskills-admin imported-sheets delete <sheetId> --instance <instanceId> --force --confirm-delete imported-sheets:<sheetId> --dry-run"
|
|
2360
|
+
],
|
|
2361
|
+
writes: "create, update, sync, translate, vectorize, repair-french, copy-to, attach-page, set-source and delete require --yes or --dry-run.",
|
|
2362
|
+
createDataShape: {
|
|
2363
|
+
instanceId: "global",
|
|
2364
|
+
displayName: "Cas d'usage Gemini",
|
|
2365
|
+
enabledLocales: ["fr", "en", "es"],
|
|
2366
|
+
multilangMode: "AI_TRANSLATION",
|
|
2367
|
+
defaultLocaleSource: { locale: "fr", sourceInput: "https://docs.google.com/spreadsheets/d/...", tabName: "FR" },
|
|
2368
|
+
localeSources: [{ locale: "en", sourceInput: "https://docs.google.com/spreadsheets/d/...", tabName: "EN" }],
|
|
2369
|
+
enableVectorization: true,
|
|
2370
|
+
vectorHeaders: ["Titre", "Description", "Prompt"]
|
|
2371
|
+
},
|
|
2372
|
+
updateDataShape: {
|
|
2373
|
+
displayName: "Cas d'usage Gemini",
|
|
2374
|
+
viewMode: "LINE",
|
|
2375
|
+
enableVectorization: true,
|
|
2376
|
+
columns: [{ id: "column_id", isVisible: true, includeInVectorization: true, displayType: "TITLE", showLabel: false, displayOrder: 0 }],
|
|
2377
|
+
vectorHeaders: ["Titre", "Description", "Prompt"]
|
|
2378
|
+
},
|
|
2379
|
+
useCaseListFlow: [
|
|
2380
|
+
"copy-to from global to a client instance with --display-name 'Use cases'",
|
|
2381
|
+
"attach-page inserts the importedSheet EditorJS block and invalidates page deploy cache",
|
|
2382
|
+
"set-source updates one locale source and can --resync immediately"
|
|
2383
|
+
]
|
|
2384
|
+
});
|
|
1986
2385
|
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.";
|
|
1987
2386
|
var addTranslatePagesWarning = (kind, mode, result) => {
|
|
1988
2387
|
if (kind !== "pages" && kind !== "page")
|
package/package.json
CHANGED
|
@@ -88,9 +88,20 @@ Good pattern:
|
|
|
88
88
|
|
|
89
89
|
1. Use `gskills-admin schema`, resource reads, and specialized commands first.
|
|
90
90
|
2. If the operation needs custom logic, inspect the app code and add or use an authenticated CLI API route.
|
|
91
|
-
3.
|
|
92
|
-
4.
|
|
93
|
-
5.
|
|
91
|
+
3. Combine CLI calls with local code when the operation needs loops, joins, batching, parsing, retries, comparisons, or reports.
|
|
92
|
+
4. Keep the write path behind `--dry-run` and `--yes`.
|
|
93
|
+
5. Log admin-visible writes and invalidate deploy cache when the data affects visible content.
|
|
94
|
+
6. Publish the CLI and bundled skills when a recurring DB-only workaround becomes a normal operation.
|
|
95
|
+
|
|
96
|
+
Good CLI plus code examples:
|
|
97
|
+
|
|
98
|
+
- call `gskills-admin ... --output json` from a shell loop, `jq`, Bun, Node, or TypeScript helper
|
|
99
|
+
- turn CLI JSON into a target list, then call another CLI command per target
|
|
100
|
+
- run a dry-run loop first, inspect the aggregate, then run the same loop with `--yes`
|
|
101
|
+
- use app code to understand domain logic, then expose the actual write behind a CLI route
|
|
102
|
+
- write temporary local scripts for orchestration, but keep repeatable behavior in the CLI or a skill
|
|
103
|
+
|
|
104
|
+
If the local environment is missing a small tool needed for the loop, the agent may install or invoke it, for example `jq`, shell utilities, `bunx`, or a small npm package. Prefer temporary/local tooling over asking for direct DB access. Do not install heavyweight or risky tools without a reason, and never use a tool install as a shortcut around auth, `--dry-run`, `--yes`, admin logs, or cache invalidation.
|
|
94
105
|
|
|
95
106
|
Do not ask an agent for `DATABASE_URL` and do not write a one-off direct DB script when the same job will happen again. Code is still useful, but it should live behind the CLI or a reusable app helper.
|
|
96
107
|
|
|
@@ -235,6 +246,31 @@ For internal knowledge videos, use `knowledge-video`. It queues the same native
|
|
|
235
246
|
|
|
236
247
|
After visible content translation, read the cache hint in the response and invalidate the narrow scope before checking the deploy UI.
|
|
237
248
|
|
|
249
|
+
## Imported Sheets
|
|
250
|
+
|
|
251
|
+
Use `imported-sheets` for imported Google Sheets such as Gemini use-case catalogs.
|
|
252
|
+
|
|
253
|
+
Common flows:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
gskills-admin imported-sheets list --instance <instanceId> --output json
|
|
257
|
+
gskills-admin imported-sheets resolve --instance <instanceId> --source <sheet-url> --output json
|
|
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
|
+
gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run --output json
|
|
260
|
+
gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run --output json
|
|
261
|
+
gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run --output json
|
|
262
|
+
gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run --output json
|
|
263
|
+
gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name "Use cases" --dry-run --output json
|
|
264
|
+
gskills-admin imported-sheets attach-page <sheetId> --instance <instanceId> --page <pageId> --locale fr --dry-run --output json
|
|
265
|
+
gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run --output json
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Create supports either flags or `--data-file`. Use `--data-file` for `SHEET_PER_LANGUAGE` because locale sources are easier to audit as JSON.
|
|
269
|
+
|
|
270
|
+
For the Gemini use-case list plugin flow, copy the global sheet to the client instance with `--display-name "Use cases"`, attach it to a page if the customer needs a page embed, then use `set-source --resync` when a locale tab has to be replaced.
|
|
271
|
+
|
|
272
|
+
Dry-run first. Imported sheet writes can create rows, variants, cells, sync runs, translations, embeddings, page blocks, deploy cache bumps, or permanent deletes depending on the command.
|
|
273
|
+
|
|
238
274
|
## Sync
|
|
239
275
|
|
|
240
276
|
Global is the source by default.
|