@numericoach/gskills-admin-cli 0.1.23 → 0.1.25
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 +30 -1
- package/dist/gskills-admin.js +206 -6
- package/package.json +1 -1
- package/skills/gskills-admin-cli/SKILL.md +50 -0
package/README.md
CHANGED
|
@@ -50,6 +50,17 @@ gskills-admin topics help --output json
|
|
|
50
50
|
|
|
51
51
|
Use the listed `cache.scopes` with `gskills-admin cache invalidate` after create, update, or soft-delete when the end-user view must reflect the change immediately.
|
|
52
52
|
|
|
53
|
+
Large local videos can be uploaded directly to GSkills storage before creating or updating internal knowledge and resources. The CLI asks the app for a signed upload URL, streams the local file directly to GCS, then writes the normal row with the returned URL. Use `--instance` for client-specific content.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
gskills-admin internal-knowledge create --instance dev-numericoach --upload-file ./capsule.mp4 --data '{"title":"Capsule test","language":"fr","isActive":true,"isAIAllowed":false}' --dry-run --output json
|
|
57
|
+
gskills-admin internal-knowledge create --instance dev-numericoach --upload-file ./capsule.mp4 --data '{"title":"Capsule test","language":"fr","isActive":true,"isAIAllowed":false}' --output json
|
|
58
|
+
gskills-admin resources create --instance dev-numericoach --upload-file ./webinar.mp4 --data '{"title":"Webinar test","type":"WEBINAR","language":"fr","isActive":true}' --dry-run --output json
|
|
59
|
+
gskills-admin resources update <resourceId> --upload-file ./webinar-v2.mp4 --data '{}' --output json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Use `--mime-type` when the extension is ambiguous, and `--upload-name` when the stored file name needs a cleaner label.
|
|
63
|
+
|
|
53
64
|
AI translation is available for content that has native AI translation in the editor:
|
|
54
65
|
|
|
55
66
|
Warning: `translate pages` rewrites each translated page from the source page. It is not a diff update. Recreating translated pages this way 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.
|
|
@@ -78,6 +89,7 @@ gskills-admin imported-sheets sync <sheetId> --instance <instanceId> --dry-run -
|
|
|
78
89
|
gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run --output json
|
|
79
90
|
gskills-admin imported-sheets retranslate <sheetId> --instance <instanceId> --from en --to fr,de,es --dry-run --output json
|
|
80
91
|
gskills-admin imported-sheets replace-grid <sheetId> --instance <instanceId> --locale en --data-file ./grid.json --rebuild-columns --dry-run --output json
|
|
92
|
+
gskills-admin imported-sheets patch-cells <sheetId> --instance <instanceId> --data-file ./cell-patches.json --dry-run --output json
|
|
81
93
|
gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run --output json
|
|
82
94
|
gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run --output json
|
|
83
95
|
gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name "Use cases" --dry-run --output json
|
|
@@ -85,7 +97,24 @@ gskills-admin imported-sheets attach-page <sheetId> --instance <instanceId> --pa
|
|
|
85
97
|
gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run --output json
|
|
86
98
|
```
|
|
87
99
|
|
|
88
|
-
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`.
|
|
100
|
+
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`.
|
|
101
|
+
|
|
102
|
+
`patch-cells` accepts a JSON object with a `patches` array:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"patches": [
|
|
107
|
+
{
|
|
108
|
+
"locale": "fr",
|
|
109
|
+
"rowIndex": 12,
|
|
110
|
+
"columnHeader": "Capture_link",
|
|
111
|
+
"rawValue": "https://lh7-qw.googleusercontent.com/docsz/..."
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
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.
|
|
89
118
|
|
|
90
119
|
Operational helpers are available for the admin-only flows agents should not improvise:
|
|
91
120
|
|
package/dist/gskills-admin.js
CHANGED
|
@@ -808,8 +808,10 @@ var resourceHelpRows = () => resources.map((resource) => ({
|
|
|
808
808
|
aliases: resource.aliases.join(", ")
|
|
809
809
|
}));
|
|
810
810
|
// ../../src/cli/commands.ts
|
|
811
|
+
import { createReadStream } from "node:fs";
|
|
811
812
|
import { cp, mkdir as mkdir2, readFile as readFile2, readdir, stat } from "node:fs/promises";
|
|
812
|
-
import { dirname as dirname2, join as join2 } from "node:path";
|
|
813
|
+
import { basename, dirname as dirname2, extname, join as join2, resolve } from "node:path";
|
|
814
|
+
import { homedir as homedir2 } from "node:os";
|
|
813
815
|
import { fileURLToPath } from "node:url";
|
|
814
816
|
var runCommand = async (ctx) => {
|
|
815
817
|
const [group, actionOrResource, maybeAction, ...rest] = ctx.args;
|
|
@@ -821,7 +823,7 @@ var runCommand = async (ctx) => {
|
|
|
821
823
|
return runSkillsCommand(actionOrResource, ctx);
|
|
822
824
|
if (group === "auth")
|
|
823
825
|
return runAuthCommand(actionOrResource, ctx);
|
|
824
|
-
if (group === "resources")
|
|
826
|
+
if (group === "resources" && !actionOrResource)
|
|
825
827
|
return resourceHelpRows();
|
|
826
828
|
if (group === "sync")
|
|
827
829
|
return runSyncCommand(actionOrResource, ctx);
|
|
@@ -949,6 +951,7 @@ var createResource = async (resource, ctx) => {
|
|
|
949
951
|
const instanceField = resource.instanceField === undefined ? "instanceId" : resource.instanceField;
|
|
950
952
|
if (instanceId && instanceField && !instanceField.includes(".") && data[instanceField] === undefined)
|
|
951
953
|
data[instanceField] = instanceId;
|
|
954
|
+
await applyUploadFileData(resource, data, ctx, { id: null, instanceId: getInstanceIdFromData(data) ?? instanceId });
|
|
952
955
|
if (Object.keys(data).length === 0)
|
|
953
956
|
throw new CliError("Missing --data JSON", 2);
|
|
954
957
|
if (hasFlag(ctx, "dry-run"))
|
|
@@ -960,6 +963,7 @@ var createResource = async (resource, ctx) => {
|
|
|
960
963
|
};
|
|
961
964
|
var updateResource = async (resource, id, ctx) => {
|
|
962
965
|
const data = parseJsonObject(getStringFlag(ctx, "data"), "--data");
|
|
966
|
+
await applyUploadFileData(resource, data, ctx, { id, instanceId: getStringFlag(ctx, "instance") ?? getInstanceIdFromData(data) });
|
|
963
967
|
if (Object.keys(data).length === 0)
|
|
964
968
|
throw new CliError("Missing --data JSON", 2);
|
|
965
969
|
if (hasFlag(ctx, "dry-run"))
|
|
@@ -969,6 +973,161 @@ var updateResource = async (resource, id, ctx) => {
|
|
|
969
973
|
body: JSON.stringify({ data })
|
|
970
974
|
});
|
|
971
975
|
};
|
|
976
|
+
var UPLOADABLE_RESOURCE_NAMES = new Set(["internal-knowledge", "resources"]);
|
|
977
|
+
var applyUploadFileData = async (resource, data, ctx, target) => {
|
|
978
|
+
const uploadFilePath = getStringFlag(ctx, "upload-file");
|
|
979
|
+
if (!uploadFilePath)
|
|
980
|
+
return;
|
|
981
|
+
if (!UPLOADABLE_RESOURCE_NAMES.has(resource.name)) {
|
|
982
|
+
throw new CliError(`--upload-file is not supported for ${resource.name}`, 2);
|
|
983
|
+
}
|
|
984
|
+
const upload = await prepareDirectUpload(resource, uploadFilePath, ctx, target);
|
|
985
|
+
if (hasFlag(ctx, "dry-run")) {
|
|
986
|
+
data.__upload = upload;
|
|
987
|
+
applyUploadedMediaData(resource, data, upload);
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
if (!isPreparedSignedUpload(upload)) {
|
|
991
|
+
throw new CliError("Signed upload response was invalid", 1);
|
|
992
|
+
}
|
|
993
|
+
if (!target.id) {
|
|
994
|
+
setUploadInstanceData(resource, data, upload.instanceId);
|
|
995
|
+
}
|
|
996
|
+
await uploadToSignedUrl(upload.signedUrl, upload.filePath, upload.contentType, upload.size);
|
|
997
|
+
applyUploadedMediaData(resource, data, upload);
|
|
998
|
+
};
|
|
999
|
+
var prepareDirectUpload = async (resource, uploadFilePath, ctx, target) => {
|
|
1000
|
+
const filePath = resolveLocalPath(uploadFilePath);
|
|
1001
|
+
const fileStat = await stat(filePath).catch(() => null);
|
|
1002
|
+
if (!fileStat?.isFile()) {
|
|
1003
|
+
throw new CliError(`Upload file not found: ${uploadFilePath}`, 2);
|
|
1004
|
+
}
|
|
1005
|
+
const contentType = getStringFlag(ctx, "mime-type") ?? inferMimeType(filePath);
|
|
1006
|
+
const instanceId = await resolveUploadInstanceId(resource, target);
|
|
1007
|
+
const fileName = getStringFlag(ctx, "upload-name") ?? basename(filePath);
|
|
1008
|
+
if (hasFlag(ctx, "dry-run")) {
|
|
1009
|
+
return {
|
|
1010
|
+
filePath,
|
|
1011
|
+
fileName,
|
|
1012
|
+
contentType,
|
|
1013
|
+
size: fileStat.size,
|
|
1014
|
+
instanceId,
|
|
1015
|
+
directUpload: true
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
const result = await requestApi("/api/cli/uploads/signed-url", {
|
|
1019
|
+
method: "POST",
|
|
1020
|
+
body: JSON.stringify({
|
|
1021
|
+
resource: resource.name,
|
|
1022
|
+
instanceId,
|
|
1023
|
+
fileName,
|
|
1024
|
+
contentType
|
|
1025
|
+
})
|
|
1026
|
+
});
|
|
1027
|
+
if (!isSignedUploadResult(result)) {
|
|
1028
|
+
throw new CliError("Signed upload response was invalid", 1);
|
|
1029
|
+
}
|
|
1030
|
+
return {
|
|
1031
|
+
...result,
|
|
1032
|
+
filePath,
|
|
1033
|
+
contentType,
|
|
1034
|
+
size: fileStat.size,
|
|
1035
|
+
instanceId: result.instanceId
|
|
1036
|
+
};
|
|
1037
|
+
};
|
|
1038
|
+
var resolveUploadInstanceId = async (resource, target) => {
|
|
1039
|
+
if (target.instanceId)
|
|
1040
|
+
return target.instanceId;
|
|
1041
|
+
if (target.id) {
|
|
1042
|
+
const row = await requestApi(`/api/cli/${resource.name}/${target.id}`);
|
|
1043
|
+
const rowInstanceId = getInstanceIdFromData(row);
|
|
1044
|
+
if (rowInstanceId)
|
|
1045
|
+
return rowInstanceId;
|
|
1046
|
+
}
|
|
1047
|
+
const fallback = defaultInstanceId(resource);
|
|
1048
|
+
if (fallback)
|
|
1049
|
+
return fallback;
|
|
1050
|
+
throw new CliError("Missing --instance for upload target", 2);
|
|
1051
|
+
};
|
|
1052
|
+
var applyUploadedMediaData = (resource, data, upload) => {
|
|
1053
|
+
if (!upload.fileUrl)
|
|
1054
|
+
return;
|
|
1055
|
+
if (resource.name === "internal-knowledge") {
|
|
1056
|
+
data.sourceType = "UPLOAD";
|
|
1057
|
+
data.url = upload.fileUrl;
|
|
1058
|
+
data.mimeType = upload.contentType;
|
|
1059
|
+
data.size = upload.size;
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
if (resource.name === "resources") {
|
|
1063
|
+
data.sourceType = "UPLOAD";
|
|
1064
|
+
data.fileUrl = upload.fileUrl;
|
|
1065
|
+
data.linkUrl = upload.fileUrl;
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
var setUploadInstanceData = (resource, data, instanceId) => {
|
|
1069
|
+
const instanceField = resource.instanceField === undefined ? "instanceId" : resource.instanceField;
|
|
1070
|
+
if (instanceField && !instanceField.includes(".")) {
|
|
1071
|
+
data[instanceField] = instanceId;
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
var uploadToSignedUrl = async (signedUrl, filePath, contentType, size) => {
|
|
1075
|
+
const response = await fetch(signedUrl, {
|
|
1076
|
+
method: "PUT",
|
|
1077
|
+
body: createReadStream(filePath),
|
|
1078
|
+
duplex: "half",
|
|
1079
|
+
headers: {
|
|
1080
|
+
"Content-Type": contentType,
|
|
1081
|
+
"Content-Length": String(size)
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
if (!response.ok) {
|
|
1085
|
+
throw new CliError(`Direct upload failed with ${response.status}`, 1);
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
var isSignedUploadResult = (value) => {
|
|
1089
|
+
if (!value || typeof value !== "object")
|
|
1090
|
+
return false;
|
|
1091
|
+
const upload = value;
|
|
1092
|
+
return typeof upload.signedUrl === "string" && typeof upload.fileUrl === "string" && typeof upload.filePath === "string" && typeof upload.contentType === "string" && typeof upload.instanceId === "string";
|
|
1093
|
+
};
|
|
1094
|
+
var isPreparedSignedUpload = (value) => {
|
|
1095
|
+
if (!value || typeof value !== "object")
|
|
1096
|
+
return false;
|
|
1097
|
+
const upload = value;
|
|
1098
|
+
return typeof upload.signedUrl === "string" && typeof upload.fileUrl === "string" && typeof upload.filePath === "string" && typeof upload.contentType === "string" && typeof upload.size === "number" && typeof upload.instanceId === "string";
|
|
1099
|
+
};
|
|
1100
|
+
var getInstanceIdFromData = (value) => {
|
|
1101
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
1102
|
+
return null;
|
|
1103
|
+
const row = value;
|
|
1104
|
+
const instanceId = row.instanceId ?? row.instanceID;
|
|
1105
|
+
return typeof instanceId === "string" && instanceId.length > 0 ? instanceId : null;
|
|
1106
|
+
};
|
|
1107
|
+
var resolveLocalPath = (filePath) => {
|
|
1108
|
+
if (filePath === "~")
|
|
1109
|
+
return homedir2();
|
|
1110
|
+
if (filePath.startsWith("~/"))
|
|
1111
|
+
return join2(homedir2(), filePath.slice(2));
|
|
1112
|
+
return resolve(filePath);
|
|
1113
|
+
};
|
|
1114
|
+
var inferMimeType = (filePath) => {
|
|
1115
|
+
const ext = extname(filePath).toLowerCase();
|
|
1116
|
+
const mimeByExtension = {
|
|
1117
|
+
".mp4": "video/mp4",
|
|
1118
|
+
".m4v": "video/mp4",
|
|
1119
|
+
".mov": "video/quicktime",
|
|
1120
|
+
".webm": "video/webm",
|
|
1121
|
+
".pdf": "application/pdf",
|
|
1122
|
+
".txt": "text/plain",
|
|
1123
|
+
".md": "text/markdown",
|
|
1124
|
+
".html": "text/html",
|
|
1125
|
+
".htm": "text/html",
|
|
1126
|
+
".doc": "application/msword",
|
|
1127
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
1128
|
+
};
|
|
1129
|
+
return mimeByExtension[ext] ?? "application/octet-stream";
|
|
1130
|
+
};
|
|
972
1131
|
var getSoftDeleteData = (resource) => {
|
|
973
1132
|
if (resource.defaultFields.includes("disabled"))
|
|
974
1133
|
return { disabled: true };
|
|
@@ -1609,6 +1768,7 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
|
|
|
1609
1768
|
"translate",
|
|
1610
1769
|
"retranslate",
|
|
1611
1770
|
"replace-grid",
|
|
1771
|
+
"patch-cells",
|
|
1612
1772
|
"vectorize",
|
|
1613
1773
|
"repair-french",
|
|
1614
1774
|
"copy-to",
|
|
@@ -1719,7 +1879,7 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
|
|
|
1719
1879
|
body: JSON.stringify({ instanceId, sourceInput })
|
|
1720
1880
|
});
|
|
1721
1881
|
}
|
|
1722
|
-
if (["create", "update", "sync", "enable-locales", "translate", "retranslate", "replace-grid", "vectorize", "repair-french", "delete"].includes(action)) {
|
|
1882
|
+
if (["create", "update", "sync", "enable-locales", "translate", "retranslate", "replace-grid", "patch-cells", "vectorize", "repair-french", "delete"].includes(action)) {
|
|
1723
1883
|
requireWriteConfirmation("Imported sheet operation writes production data. Add --yes or use --dry-run.", ctx);
|
|
1724
1884
|
}
|
|
1725
1885
|
if (action === "create") {
|
|
@@ -1823,6 +1983,24 @@ var runImportedSheetsCommand = async (action, importedSheetId, ctx) => {
|
|
|
1823
1983
|
body: JSON.stringify(payload)
|
|
1824
1984
|
});
|
|
1825
1985
|
}
|
|
1986
|
+
if (action === "patch-cells") {
|
|
1987
|
+
const data = await parseJsonObjectFlag(ctx, "data", "data-file");
|
|
1988
|
+
if (Object.keys(data).length === 0)
|
|
1989
|
+
throw new CliError("Missing --data or --data-file JSON", 2);
|
|
1990
|
+
const payload = {
|
|
1991
|
+
instanceId,
|
|
1992
|
+
...data,
|
|
1993
|
+
locale: getStringFlag(ctx, "locale") ?? getStringFlag(ctx, "language") ?? data.locale,
|
|
1994
|
+
revectorize: hasFlag(ctx, "revectorize") || Boolean(data.revectorize),
|
|
1995
|
+
skipCache: hasFlag(ctx, "no-cache") || Boolean(data.skipCache),
|
|
1996
|
+
cacheScope: getStringFlag(ctx, "cache-scope") ?? data.cacheScope,
|
|
1997
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1998
|
+
};
|
|
1999
|
+
return requestApi(`/api/cli/imported-sheets/${importedSheetId}/patch-cells`, {
|
|
2000
|
+
method: "POST",
|
|
2001
|
+
body: JSON.stringify(payload)
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
1826
2004
|
if (action === "vectorize") {
|
|
1827
2005
|
const payload = {
|
|
1828
2006
|
instanceId,
|
|
@@ -2207,6 +2385,8 @@ var rootHelp = () => ({
|
|
|
2207
2385
|
"gskills-admin sync repair-source-links --target <instanceId> --dry-run",
|
|
2208
2386
|
"gskills-admin translate pages <id> --to en,es --dry-run",
|
|
2209
2387
|
"gskills-admin imported-sheets create --instance <id> --source <url> --tab <name> --locales fr,en --enable-vectorization --dry-run",
|
|
2388
|
+
`gskills-admin internal-knowledge create --instance <instanceId> --upload-file ./video.mp4 --data '{"title":"...","language":"fr"}' --yes`,
|
|
2389
|
+
`gskills-admin resources create --instance <instanceId> --upload-file ./webinar.mp4 --data '{"title":"...","type":"WEBINAR","language":"fr"}' --yes`,
|
|
2210
2390
|
"gskills-admin internal-knowledge sync-media --since today --languages fr --all-targets --dry-run",
|
|
2211
2391
|
"gskills-admin progress learning-path-quiz-mismatches --instance <instanceId>",
|
|
2212
2392
|
"gskills-admin sessions invalidate --email user@example.com --dry-run",
|
|
@@ -2256,6 +2436,7 @@ var schemaHelp = () => ({
|
|
|
2256
2436
|
{ name: "imported-sheets translate", args: ["id"], required: ["--instance", "--to"], flags: ["--yes", "--dry-run"], writes: true },
|
|
2257
2437
|
{ name: "imported-sheets retranslate", args: ["id"], required: ["--instance", "--to"], flags: ["--from", "--revectorize", "--yes", "--dry-run"], writes: true },
|
|
2258
2438
|
{ name: "imported-sheets replace-grid", args: ["id"], required: ["--instance", "--locale", "--data or --data-file"], flags: ["--rebuild-columns", "--revectorize", "--yes", "--dry-run"], writes: true },
|
|
2439
|
+
{ 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 },
|
|
2259
2440
|
{ name: "imported-sheets vectorize", args: ["id"], required: ["--instance"], flags: ["--locales", "--yes", "--dry-run"], writes: true },
|
|
2260
2441
|
{ name: "imported-sheets repair-french", args: ["id"], required: ["--instance"], flags: ["--locales", "--revectorize", "--yes", "--dry-run"], writes: true },
|
|
2261
2442
|
{ name: "imported-sheets copy-to", args: ["id"], required: ["--instance", "--target or --targets"], flags: ["--display-name", "--replace", "--revectorize", "--yes", "--dry-run"], writes: true },
|
|
@@ -2294,8 +2475,8 @@ var schemaHelp = () => ({
|
|
|
2294
2475
|
...resources.flatMap((resource) => [
|
|
2295
2476
|
{ name: `${resource.name} list`, writes: false, flags: ["--where", "--fields", "--take", "--skip", "--order-by", "--instance", "--dry-run"] },
|
|
2296
2477
|
{ name: `${resource.name} get`, args: ["id"], writes: false },
|
|
2297
|
-
{ name: `${resource.name} create`, flags: ["--data", "--instance", "--dry-run"], writes: true },
|
|
2298
|
-
{ name: `${resource.name} update`, args: ["id"], flags: ["--data", "--dry-run"], writes: true },
|
|
2478
|
+
{ name: `${resource.name} create`, flags: ["--data", "--instance", ...UPLOADABLE_RESOURCE_NAMES.has(resource.name) ? ["--upload-file", "--upload-name", "--mime-type"] : [], "--dry-run"], writes: true },
|
|
2479
|
+
{ name: `${resource.name} update`, args: ["id"], flags: ["--data", "--instance", ...UPLOADABLE_RESOURCE_NAMES.has(resource.name) ? ["--upload-file", "--upload-name", "--mime-type"] : [], "--dry-run"], writes: true },
|
|
2299
2480
|
{ name: `${resource.name} delete`, args: ["id"], flags: ["--force", "--confirm-delete", "--dry-run"], writes: true, destructive: false, softOnly: true }
|
|
2300
2481
|
])
|
|
2301
2482
|
],
|
|
@@ -2400,6 +2581,7 @@ var importedSheetsHelp = () => ({
|
|
|
2400
2581
|
"gskills-admin imported-sheets translate <sheetId> --instance <instanceId> --to en,es --dry-run",
|
|
2401
2582
|
"gskills-admin imported-sheets retranslate <sheetId> --instance <instanceId> --from en --to fr,de,es --dry-run",
|
|
2402
2583
|
"gskills-admin imported-sheets replace-grid <sheetId> --instance <instanceId> --locale en --data-file ./grid.json --rebuild-columns --dry-run",
|
|
2584
|
+
"gskills-admin imported-sheets patch-cells <sheetId> --instance <instanceId> --data-file ./cell-patches.json --dry-run",
|
|
2403
2585
|
"gskills-admin imported-sheets vectorize <sheetId> --instance <instanceId> --locales fr,en --dry-run",
|
|
2404
2586
|
"gskills-admin imported-sheets repair-french <sheetId> --instance <instanceId> --locales es,it --revectorize --dry-run",
|
|
2405
2587
|
"gskills-admin imported-sheets copy-to <sheetId> --instance global --target <instanceId> --display-name 'Use cases' --dry-run",
|
|
@@ -2407,7 +2589,23 @@ var importedSheetsHelp = () => ({
|
|
|
2407
2589
|
"gskills-admin imported-sheets set-source <sheetId> --instance <instanceId> --locale en --source <sheet-url> --tab EN --resync --dry-run",
|
|
2408
2590
|
"gskills-admin imported-sheets delete <sheetId> --instance <instanceId> --force --confirm-delete imported-sheets:<sheetId> --dry-run"
|
|
2409
2591
|
],
|
|
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.",
|
|
2592
|
+
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.",
|
|
2593
|
+
patchCellsDataShape: {
|
|
2594
|
+
patches: [
|
|
2595
|
+
{
|
|
2596
|
+
locale: "fr",
|
|
2597
|
+
rowIndex: 12,
|
|
2598
|
+
columnHeader: "Capture_link",
|
|
2599
|
+
rawValue: "https://lh7-qw.googleusercontent.com/docsz/..."
|
|
2600
|
+
},
|
|
2601
|
+
{
|
|
2602
|
+
locale: "en",
|
|
2603
|
+
rowId: "row_id_from_imported_sheets_get",
|
|
2604
|
+
columnId: "column_id_from_imported_sheets_get",
|
|
2605
|
+
rawValue: null
|
|
2606
|
+
}
|
|
2607
|
+
]
|
|
2608
|
+
},
|
|
2411
2609
|
createDataShape: {
|
|
2412
2610
|
instanceId: "global",
|
|
2413
2611
|
displayName: "Cas d'usage Gemini",
|
|
@@ -2565,6 +2763,8 @@ var resourceHelp = (resource) => ({
|
|
|
2565
2763
|
`gskills-admin ${resource.name} create --data '{"instanceId":"global"}'`,
|
|
2566
2764
|
`gskills-admin ${resource.name} update <id> --data '{"disabled":true}'`,
|
|
2567
2765
|
`gskills-admin ${resource.name} delete <id> --force --confirm-delete ${resource.name}:<id>`,
|
|
2766
|
+
...resource.name === "internal-knowledge" ? [`gskills-admin ${resource.name} create --instance <instanceId> --upload-file ./video.mp4 --data '{"title":"Video","language":"fr","isActive":true}' --dry-run`] : [],
|
|
2767
|
+
...resource.name === "resources" ? [`gskills-admin ${resource.name} create --instance <instanceId> --upload-file ./webinar.mp4 --data '{"title":"Webinar","type":"WEBINAR","language":"fr","isActive":true}' --dry-run`] : [],
|
|
2568
2768
|
...resource.name === "internal-knowledge" ? [`gskills-admin ${resource.name} sync-media --since today --languages fr --all-targets --dry-run`] : [],
|
|
2569
2769
|
...resource.name === "pages" ? [`gskills-admin ${resource.name} backfill-field --field headerColor --all-targets --dry-run`] : []
|
|
2570
2770
|
],
|
package/package.json
CHANGED
|
@@ -69,6 +69,17 @@ gskills-admin cache invalidate --instance <instanceId> --scope pages --yes --out
|
|
|
69
69
|
|
|
70
70
|
CRUD help exposes `cache.scopes` for resources that are known to feed deploy caches. After create, update, or soft-delete, the database can be correct while the end-user view is still stale. Use the narrowest listed scope first. Use `all` only when the changed setting affects many deploy surfaces or when the narrow scope did not clear the visible stale state.
|
|
71
71
|
|
|
72
|
+
Internal knowledge and resources support direct local file uploads through signed GCS URLs. The CLI gets a signed URL from the authenticated app API, streams the local file directly to storage, then writes the normal row with the returned URL. This avoids routing large videos through a Next.js API body.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
gskills-admin internal-knowledge create --instance dev-numericoach --upload-file ./capsule.mp4 --data '{"title":"Capsule test","language":"fr","isActive":true,"isAIAllowed":false}' --dry-run --output json
|
|
76
|
+
gskills-admin internal-knowledge update <knowledgeId> --instance dev-numericoach --upload-file ./capsule-v2.mp4 --data '{}' --dry-run --output json
|
|
77
|
+
gskills-admin resources create --instance dev-numericoach --upload-file ./webinar.mp4 --data '{"title":"Webinar test","type":"WEBINAR","language":"fr","isActive":true}' --dry-run --output json
|
|
78
|
+
gskills-admin resources update <resourceId> --instance dev-numericoach --upload-file ./webinar-v2.mp4 --data '{}' --dry-run --output json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Use `--mime-type` when the extension is ambiguous and `--upload-name` when the stored file name should differ from the local basename. Always pass `--instance` for client-specific content; otherwise content-like creates default to `global`.
|
|
82
|
+
|
|
72
83
|
Delete commands are soft-only. They require both `--force` and an exact confirmation token, then write the safest inactive field available, such as `disabled: true`, `archived: true`, `isActive: false`, or `active: false`. If a resource cannot be safely disabled, the CLI refuses the delete command.
|
|
73
84
|
|
|
74
85
|
```bash
|
|
@@ -124,9 +135,48 @@ These recurring historical DB-only jobs now have CLI paths:
|
|
|
124
135
|
| Force relogin after access/auth data change | `gskills-admin sessions invalidate --email user@example.com --dry-run --output json` |
|
|
125
136
|
| Find content-assistant artifact links | `gskills-admin content-assistant lookup --query "artifact title" --output json` |
|
|
126
137
|
| 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` |
|
|
138
|
+
| 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
139
|
|
|
128
140
|
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
141
|
|
|
142
|
+
## Imported Sheet Cell Updates
|
|
143
|
+
|
|
144
|
+
Use `patch-cells` for focused imported-sheet row-cell updates, especially when a script already has the right target rows from `imported-sheets get`.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
gskills-admin imported-sheets patch-cells <sheetId> --instance global --data-file ./cell-patches.json --dry-run --output json
|
|
148
|
+
gskills-admin imported-sheets patch-cells <sheetId> --instance global --data-file ./cell-patches.json --yes --output json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Patch file shape:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"patches": [
|
|
156
|
+
{
|
|
157
|
+
"locale": "fr",
|
|
158
|
+
"rowIndex": 12,
|
|
159
|
+
"columnHeader": "Capture_link",
|
|
160
|
+
"rawValue": "https://lh7-qw.googleusercontent.com/docsz/..."
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"locale": "en",
|
|
164
|
+
"rowId": "row_id_from_imported_sheets_get",
|
|
165
|
+
"columnId": "column_id_from_imported_sheets_get",
|
|
166
|
+
"rawValue": null
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Rules:
|
|
173
|
+
|
|
174
|
+
- Always dry-run first. The server resolves real locale, row and column and shows before/after samples.
|
|
175
|
+
- 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.
|
|
176
|
+
- By default the command invalidates deploy cache for touched locales. Use `--no-cache` only for internal fields that cannot affect visible deploy pages.
|
|
177
|
+
- Use `--revectorize` only when patched cells are included in vectorization. Media or link-only fixes usually do not need it.
|
|
178
|
+
- Do not write direct DB scripts for repeatable imported-sheet edits. Add a CLI route or use `patch-cells`.
|
|
179
|
+
|
|
130
180
|
## Instance Rules
|
|
131
181
|
|
|
132
182
|
If `--instance` is omitted, content-like resources default to `instanceId = "global"`.
|