@numericoach/gskills-admin-cli 0.1.2 → 0.1.3
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 +14 -0
- package/dist/gskills-admin.js +428 -3
- package/package.json +1 -1
- package/skills/gskills-admin-cli/SKILL.md +110 -0
package/README.md
CHANGED
|
@@ -38,6 +38,20 @@ gskills-admin cache invalidate --instance <instanceId> --scope pages --languages
|
|
|
38
38
|
gskills-admin cache invalidate --instance <instanceId> --scope menu-bundle --yes --output json
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
Operational helpers are available for the admin-only flows agents should not improvise:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
gskills-admin feedback claim <feedbackId> --dry-run --output json
|
|
45
|
+
gskills-admin feedback send-claim <feedbackId> --recipient-email user@example.com --subject "..." --body "..." --yes --output json
|
|
46
|
+
gskills-admin access grant --user <userId> --type DEFAULT --dry-run --output json
|
|
47
|
+
gskills-admin entities list --instance <instanceId> --output json
|
|
48
|
+
gskills-admin entities set-page-visibility --instance <instanceId> --page <pageId> --entity-ids google-group:team@example.com --dry-run --output json
|
|
49
|
+
gskills-admin org-units-sync google --instance <instanceId> --yes --output json
|
|
50
|
+
gskills-admin ambassadors label --instance <instanceId> --language fr --output json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Raw project and analytics data can be read through resources such as `project-data`, `ticket-sla-rules`, `analytics`, `quiz-attempts`, `user-paths`, `chromebook-progress`, and `user-learning-paths`.
|
|
54
|
+
|
|
41
55
|
## Agent skill
|
|
42
56
|
|
|
43
57
|
Install the bundled skill so AI agents know the auth model, resource map, output modes, sync workflow, and content-authoring standards.
|
package/dist/gskills-admin.js
CHANGED
|
@@ -405,6 +405,33 @@ var resources = [
|
|
|
405
405
|
aliases: ["instance-project-data"],
|
|
406
406
|
defaultFields: ["id", "instanceId", "clientAdminEmail", "clientType", "goLiveAt", "updatedAt"]
|
|
407
407
|
},
|
|
408
|
+
{
|
|
409
|
+
name: "project-contacts",
|
|
410
|
+
delegate: "instanceClientContact",
|
|
411
|
+
label: "Project contacts",
|
|
412
|
+
aliases: ["project-contact", "client-contacts", "additional-contacts"],
|
|
413
|
+
defaultFields: ["id", "instanceProjectDataId", "email", "firstName", "lastName", "jobTitle", "order", "updatedAt"],
|
|
414
|
+
instanceField: null,
|
|
415
|
+
dangerousDelete: true
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "ticket-sla-rules",
|
|
419
|
+
delegate: "instanceTicketSlaRule",
|
|
420
|
+
label: "Ticket SLA rules",
|
|
421
|
+
aliases: ["sla-rules", "ticket-sla-rule"],
|
|
422
|
+
defaultFields: ["id", "instanceProjectDataId", "label", "ackTargetValue", "ackTargetUnit", "resolutionTargetValue", "resolutionTargetUnit", "order", "updatedAt"],
|
|
423
|
+
instanceField: null,
|
|
424
|
+
dangerousDelete: true
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
name: "ticket-sla-contacts",
|
|
428
|
+
delegate: "instanceTicketSlaContact",
|
|
429
|
+
label: "Ticket SLA contacts",
|
|
430
|
+
aliases: ["sla-contacts", "ticket-sla-contact"],
|
|
431
|
+
defaultFields: ["id", "instanceProjectDataId", "email", "firstName", "lastName", "jobTitle", "order", "updatedAt"],
|
|
432
|
+
instanceField: null,
|
|
433
|
+
dangerousDelete: true
|
|
434
|
+
},
|
|
408
435
|
{
|
|
409
436
|
name: "instances",
|
|
410
437
|
delegate: "instance",
|
|
@@ -445,6 +472,41 @@ var resources = [
|
|
|
445
472
|
aliases: ["feedback"],
|
|
446
473
|
defaultFields: ["id", "instanceId", "userId", "type", "status", "priority", "createdAt", "updatedAt"]
|
|
447
474
|
},
|
|
475
|
+
{
|
|
476
|
+
name: "feedback-replies",
|
|
477
|
+
delegate: "feedbackReply",
|
|
478
|
+
label: "Feedback replies",
|
|
479
|
+
aliases: ["feedback-reply", "replies"],
|
|
480
|
+
defaultFields: ["id", "feedbackId", "authorId", "subjectFr", "targetLang", "createdAt"],
|
|
481
|
+
instanceField: null,
|
|
482
|
+
dangerousDelete: true
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "feedback-assignees",
|
|
486
|
+
delegate: "feedbackAssignee",
|
|
487
|
+
label: "Feedback assignees",
|
|
488
|
+
aliases: ["feedback-assignee"],
|
|
489
|
+
defaultFields: ["id", "feedbackId", "userId", "assignedAt"],
|
|
490
|
+
instanceField: null,
|
|
491
|
+
dangerousDelete: true
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: "feedback-claim-notifications",
|
|
495
|
+
delegate: "feedbackClaimNotification",
|
|
496
|
+
label: "Feedback claim notifications",
|
|
497
|
+
aliases: ["claim-notifications", "feedback-emails"],
|
|
498
|
+
defaultFields: ["id", "feedbackId", "authorId", "recipientEmail", "subject", "source", "createdAt"],
|
|
499
|
+
instanceField: null
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
name: "ambassadors",
|
|
503
|
+
delegate: "ambassadorInstance",
|
|
504
|
+
label: "Ambassadors",
|
|
505
|
+
aliases: ["ambassador", "champions", "champion", "experts", "expert"],
|
|
506
|
+
defaultFields: ["id", "userId", "active", "descriptionAmbassador", "contactContent", "createdOn"],
|
|
507
|
+
instanceField: null,
|
|
508
|
+
dangerousDelete: true
|
|
509
|
+
},
|
|
448
510
|
{
|
|
449
511
|
name: "tags",
|
|
450
512
|
delegate: "tag",
|
|
@@ -496,6 +558,48 @@ var resources = [
|
|
|
496
558
|
aliases: ["feature-flag", "flags"],
|
|
497
559
|
defaultFields: ["id", "featureKey", "targetType", "targetId", "active", "variant", "updatedAt"]
|
|
498
560
|
},
|
|
561
|
+
{
|
|
562
|
+
name: "groups",
|
|
563
|
+
delegate: "group",
|
|
564
|
+
label: "Manual groups",
|
|
565
|
+
aliases: ["group", "manual-groups", "manual-group"],
|
|
566
|
+
defaultFields: ["id", "name", "description", "instanceId", "isRevert", "createdAt", "updatedAt"],
|
|
567
|
+
dangerousDelete: true
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
name: "org-units",
|
|
571
|
+
delegate: "orgUnit",
|
|
572
|
+
label: "Org units",
|
|
573
|
+
aliases: ["org-unit", "ou", "ous"],
|
|
574
|
+
defaultFields: ["id", "name", "code", "type", "googleOuId", "parentId", "instanceId", "instanceCountryParentId", "createdAt", "updatedAt"],
|
|
575
|
+
dangerousDelete: true
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "user-org-units",
|
|
579
|
+
delegate: "userOrgUnit",
|
|
580
|
+
label: "User org unit assignments",
|
|
581
|
+
aliases: ["user-org-unit", "ou-memberships"],
|
|
582
|
+
defaultFields: ["userId", "orgUnitId", "primary", "assignedAt"],
|
|
583
|
+
instanceField: null,
|
|
584
|
+
dangerousDelete: true
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: "ou-admin-scopes",
|
|
588
|
+
delegate: "ouAdminOrgUnitScope",
|
|
589
|
+
label: "OU admin scopes",
|
|
590
|
+
aliases: ["ou-admin-scope"],
|
|
591
|
+
defaultFields: ["userId", "orgUnitId", "assignedAt"],
|
|
592
|
+
instanceField: null,
|
|
593
|
+
dangerousDelete: true
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: "entity-rule-configs",
|
|
597
|
+
delegate: "entityRuleConfig",
|
|
598
|
+
label: "Entity restriction rules",
|
|
599
|
+
aliases: ["entity-rules", "content-restriction-rules", "restrictions"],
|
|
600
|
+
defaultFields: ["id", "instanceId", "entityId", "restrictionMode", "categoryIds", "learningPathRestrictionMode", "learningPathIds", "alphaAllPrograms", "alphaProgramIds", "updatedAt"],
|
|
601
|
+
dangerousDelete: true
|
|
602
|
+
},
|
|
499
603
|
{
|
|
500
604
|
name: "users",
|
|
501
605
|
delegate: "user",
|
|
@@ -509,7 +613,64 @@ var resources = [
|
|
|
509
613
|
delegate: "accessPass",
|
|
510
614
|
label: "Access passes",
|
|
511
615
|
aliases: ["access-pass", "passes"],
|
|
512
|
-
defaultFields: ["id", "userId", "
|
|
616
|
+
defaultFields: ["id", "userId", "type", "startAt", "expireAt", "givenAt", "createdAt", "updatedAt"],
|
|
617
|
+
instanceField: "user.instanceID",
|
|
618
|
+
dangerousDelete: true
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
name: "analytics",
|
|
622
|
+
delegate: "analytics",
|
|
623
|
+
label: "Analytics events",
|
|
624
|
+
aliases: ["analytics-events"],
|
|
625
|
+
defaultFields: ["id", "instanceId", "userId", "pageId", "createdAt"]
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: "user-paths",
|
|
629
|
+
delegate: "userPath",
|
|
630
|
+
label: "User course completions",
|
|
631
|
+
aliases: ["user-path", "course-completions"],
|
|
632
|
+
defaultFields: ["id", "userId", "pageId", "isAchieved", "createdAt", "updatedAt"],
|
|
633
|
+
instanceField: null
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
name: "quiz-attempts",
|
|
637
|
+
delegate: "userQuizAttempt",
|
|
638
|
+
label: "Quiz attempts",
|
|
639
|
+
aliases: ["quiz-attempt", "attempts"],
|
|
640
|
+
defaultFields: ["id", "userId", "quizId", "pageId", "score", "percentage", "passed", "isCompleted", "createdAt", "updatedAt"],
|
|
641
|
+
instanceField: null
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "chromebook-progress",
|
|
645
|
+
delegate: "chromebookUserProgress",
|
|
646
|
+
label: "Chromebook progress",
|
|
647
|
+
aliases: ["chromebook-user-progress"],
|
|
648
|
+
defaultFields: ["id", "userId", "exerciseId", "currentStep", "isCompleted", "startedAt", "completedAt", "createdAt", "updatedAt"],
|
|
649
|
+
instanceField: null
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "user-badges",
|
|
653
|
+
delegate: "userBadge",
|
|
654
|
+
label: "User badges",
|
|
655
|
+
aliases: ["user-badge"],
|
|
656
|
+
defaultFields: ["id", "userId", "badgeId", "obtainedAt", "read"],
|
|
657
|
+
instanceField: null
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: "user-learning-paths",
|
|
661
|
+
delegate: "userLearningPath",
|
|
662
|
+
label: "User learning paths",
|
|
663
|
+
aliases: ["user-learning-path"],
|
|
664
|
+
defaultFields: ["id", "userId", "learningPathId", "isCompleted", "startedAt", "completedAt", "createdAt", "updatedAt"],
|
|
665
|
+
instanceField: null
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
name: "user-learning-path-item-completions",
|
|
669
|
+
delegate: "userLearningPathItemCompletion",
|
|
670
|
+
label: "User learning path item completions",
|
|
671
|
+
aliases: ["learning-path-item-completions", "user-learning-path-item-completion"],
|
|
672
|
+
defaultFields: ["id", "userId", "learningPathItemId", "completedAt"],
|
|
673
|
+
instanceField: null
|
|
513
674
|
}
|
|
514
675
|
];
|
|
515
676
|
var findResource = (name) => {
|
|
@@ -548,6 +709,16 @@ var runCommand = async (ctx) => {
|
|
|
548
709
|
return runSyncCommand(actionOrResource, ctx);
|
|
549
710
|
if (group === "cache")
|
|
550
711
|
return runCacheCommand(actionOrResource, ctx);
|
|
712
|
+
if (group === "feedback")
|
|
713
|
+
return runFeedbackCommand(actionOrResource, maybeAction, ctx);
|
|
714
|
+
if (group === "access")
|
|
715
|
+
return runAccessCommand(actionOrResource, ctx);
|
|
716
|
+
if (group === "entities")
|
|
717
|
+
return runEntitiesCommand(actionOrResource, maybeAction, ctx);
|
|
718
|
+
if (group === "org-units-sync")
|
|
719
|
+
return runOrgUnitsSyncCommand(actionOrResource, ctx);
|
|
720
|
+
if (group === "ambassadors" && actionOrResource === "label")
|
|
721
|
+
return runAmbassadorsCommand(actionOrResource, ctx);
|
|
551
722
|
const resource = findResource(group);
|
|
552
723
|
return runResourceCommand(resource, actionOrResource, maybeAction, rest, ctx);
|
|
553
724
|
};
|
|
@@ -612,7 +783,7 @@ var listResource = async (resource, ctx) => {
|
|
|
612
783
|
const instanceId = getStringFlag(ctx, "instance") ?? defaultInstanceId(resource);
|
|
613
784
|
const instanceField = resource.instanceField === undefined ? "instanceId" : resource.instanceField;
|
|
614
785
|
if (instanceId && instanceField)
|
|
615
|
-
where
|
|
786
|
+
setWhereValue(where, instanceField, instanceId);
|
|
616
787
|
searchParams.set("where", JSON.stringify(where));
|
|
617
788
|
searchParams.set("fields", getFields(resource, ctx).join(","));
|
|
618
789
|
searchParams.set("take", String(getNumberFlag(ctx, "take") ?? 25));
|
|
@@ -637,7 +808,7 @@ var createResource = async (resource, ctx) => {
|
|
|
637
808
|
const data = parseJsonObject(getStringFlag(ctx, "data"), "--data");
|
|
638
809
|
const instanceId = getStringFlag(ctx, "instance") ?? defaultInstanceId(resource);
|
|
639
810
|
const instanceField = resource.instanceField === undefined ? "instanceId" : resource.instanceField;
|
|
640
|
-
if (instanceId && instanceField && data[instanceField] === undefined)
|
|
811
|
+
if (instanceId && instanceField && !instanceField.includes(".") && data[instanceField] === undefined)
|
|
641
812
|
data[instanceField] = instanceId;
|
|
642
813
|
if (Object.keys(data).length === 0)
|
|
643
814
|
throw new CliError("Missing --data JSON", 2);
|
|
@@ -695,6 +866,189 @@ var deleteResource = async (resource, id, ctx) => {
|
|
|
695
866
|
})
|
|
696
867
|
});
|
|
697
868
|
};
|
|
869
|
+
var runFeedbackCommand = async (action, feedbackId, ctx) => {
|
|
870
|
+
if (!action || action === "help")
|
|
871
|
+
return feedbackHelp();
|
|
872
|
+
if ((action === "claim" || action === "send-claim") && !feedbackId) {
|
|
873
|
+
throw new CliError("Missing feedback id", 2);
|
|
874
|
+
}
|
|
875
|
+
if (action === "claim") {
|
|
876
|
+
return requestApi("/api/cli/feedback/claim", {
|
|
877
|
+
method: "POST",
|
|
878
|
+
body: JSON.stringify({
|
|
879
|
+
feedbackId,
|
|
880
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
881
|
+
})
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
if (action === "send-claim") {
|
|
885
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
886
|
+
throw new CliError("Sending feedback email requires --yes or --dry-run", 2);
|
|
887
|
+
}
|
|
888
|
+
return requestApi("/api/cli/feedback/send-claim", {
|
|
889
|
+
method: "POST",
|
|
890
|
+
body: JSON.stringify({
|
|
891
|
+
feedbackId,
|
|
892
|
+
recipientEmail: getStringFlag(ctx, "recipient-email"),
|
|
893
|
+
recipientName: getStringFlag(ctx, "recipient-name"),
|
|
894
|
+
ccEmails: splitCsv(getStringFlag(ctx, "cc")),
|
|
895
|
+
subject: getStringFlag(ctx, "subject"),
|
|
896
|
+
body: getStringFlag(ctx, "body"),
|
|
897
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
898
|
+
})
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
throw new CliError(`Unknown feedback command "${action}"`, 2);
|
|
902
|
+
};
|
|
903
|
+
var runAccessCommand = async (action, ctx) => {
|
|
904
|
+
if (!action || action === "help")
|
|
905
|
+
return accessHelp();
|
|
906
|
+
if (action === "grant") {
|
|
907
|
+
const userId = getStringFlag(ctx, "user");
|
|
908
|
+
if (!userId)
|
|
909
|
+
throw new CliError("Missing --user", 2);
|
|
910
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
911
|
+
throw new CliError("Granting access writes production data. Add --yes or use --dry-run.", 2);
|
|
912
|
+
}
|
|
913
|
+
return requestApi("/api/cli/access/grant", {
|
|
914
|
+
method: "POST",
|
|
915
|
+
body: JSON.stringify({
|
|
916
|
+
userId,
|
|
917
|
+
type: getStringFlag(ctx, "type") ?? "DEFAULT",
|
|
918
|
+
startAt: getStringFlag(ctx, "start-at"),
|
|
919
|
+
customDurationDays: getNumberFlag(ctx, "custom-duration-days"),
|
|
920
|
+
preferredLanguage: getStringFlag(ctx, "preferred-language"),
|
|
921
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
922
|
+
})
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
if (action === "revoke-active") {
|
|
926
|
+
const userId = getStringFlag(ctx, "user");
|
|
927
|
+
if (!userId)
|
|
928
|
+
throw new CliError("Missing --user", 2);
|
|
929
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
930
|
+
throw new CliError("Revoking access writes production data. Add --yes or use --dry-run.", 2);
|
|
931
|
+
}
|
|
932
|
+
return requestApi("/api/cli/access/revoke-active", {
|
|
933
|
+
method: "POST",
|
|
934
|
+
body: JSON.stringify({
|
|
935
|
+
userId,
|
|
936
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
937
|
+
})
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
throw new CliError(`Unknown access command "${action}"`, 2);
|
|
941
|
+
};
|
|
942
|
+
var runEntitiesCommand = async (action, entityId, ctx) => {
|
|
943
|
+
if (!action || action === "help")
|
|
944
|
+
return entitiesHelp();
|
|
945
|
+
const instanceId = getStringFlag(ctx, "instance");
|
|
946
|
+
if (["list", "detail", "access-summary", "sync-google-groups", "save-access-rules", "set-restrictions", "set-page-visibility"].includes(action) && !instanceId) {
|
|
947
|
+
throw new CliError("Missing --instance", 2);
|
|
948
|
+
}
|
|
949
|
+
if (action === "list") {
|
|
950
|
+
return requestApi(`/api/cli/entities/list?${entitySearchParams(ctx).toString()}`);
|
|
951
|
+
}
|
|
952
|
+
if (action === "detail") {
|
|
953
|
+
if (!entityId)
|
|
954
|
+
throw new CliError("Missing entity id", 2);
|
|
955
|
+
const searchParams = entitySearchParams(ctx);
|
|
956
|
+
searchParams.set("entityId", entityId);
|
|
957
|
+
return requestApi(`/api/cli/entities/detail?${searchParams.toString()}`);
|
|
958
|
+
}
|
|
959
|
+
if (action === "access-summary") {
|
|
960
|
+
return requestApi(`/api/cli/entities/access-summary?${entitySearchParams(ctx).toString()}`);
|
|
961
|
+
}
|
|
962
|
+
if (action === "sync-google-groups") {
|
|
963
|
+
return requestApi("/api/cli/entities/sync-google-groups", {
|
|
964
|
+
method: "POST",
|
|
965
|
+
body: JSON.stringify({
|
|
966
|
+
instanceId,
|
|
967
|
+
language: getStringFlag(ctx, "language") ?? "en",
|
|
968
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
969
|
+
})
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
if (action === "save-access-rules") {
|
|
973
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
974
|
+
throw new CliError("Changing instance access rules writes production data. Add --yes or use --dry-run.", 2);
|
|
975
|
+
}
|
|
976
|
+
return requestApi("/api/cli/entities/save-access-rules", {
|
|
977
|
+
method: "POST",
|
|
978
|
+
body: JSON.stringify({
|
|
979
|
+
instanceId,
|
|
980
|
+
entityIds: splitCsv(getStringFlag(ctx, "entity-ids")),
|
|
981
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
982
|
+
})
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
if (action === "set-restrictions") {
|
|
986
|
+
const selectedEntityId = entityId ?? getStringFlag(ctx, "entity-id");
|
|
987
|
+
if (!selectedEntityId)
|
|
988
|
+
throw new CliError("Missing entity id", 2);
|
|
989
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
990
|
+
throw new CliError("Changing content restrictions writes production data. Add --yes or use --dry-run.", 2);
|
|
991
|
+
}
|
|
992
|
+
return requestApi("/api/cli/entities/set-restrictions", {
|
|
993
|
+
method: "POST",
|
|
994
|
+
body: JSON.stringify({
|
|
995
|
+
instanceId,
|
|
996
|
+
entityId: selectedEntityId,
|
|
997
|
+
restrictionMode: getStringFlag(ctx, "restriction-mode"),
|
|
998
|
+
categoryIds: splitCsv(getStringFlag(ctx, "category-ids")),
|
|
999
|
+
learningPathRestrictionMode: getStringFlag(ctx, "learning-path-restriction-mode"),
|
|
1000
|
+
learningPathIds: splitCsv(getStringFlag(ctx, "learning-path-ids")),
|
|
1001
|
+
alphaAllPrograms: hasFlag(ctx, "alpha-all-programs"),
|
|
1002
|
+
alphaProgramIds: splitCsv(getStringFlag(ctx, "alpha-program-ids")),
|
|
1003
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1004
|
+
})
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
if (action === "set-page-visibility") {
|
|
1008
|
+
const pageId = getStringFlag(ctx, "page");
|
|
1009
|
+
if (!pageId)
|
|
1010
|
+
throw new CliError("Missing --page", 2);
|
|
1011
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
1012
|
+
throw new CliError("Changing page visibility writes production data. Add --yes or use --dry-run.", 2);
|
|
1013
|
+
}
|
|
1014
|
+
return requestApi("/api/cli/entities/set-page-visibility", {
|
|
1015
|
+
method: "POST",
|
|
1016
|
+
body: JSON.stringify({
|
|
1017
|
+
instanceId,
|
|
1018
|
+
pageId,
|
|
1019
|
+
entityIds: splitCsv(getStringFlag(ctx, "entity-ids")),
|
|
1020
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1021
|
+
})
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
throw new CliError(`Unknown entities command "${action}"`, 2);
|
|
1025
|
+
};
|
|
1026
|
+
var runOrgUnitsSyncCommand = async (action, ctx) => {
|
|
1027
|
+
if (!action || action === "help")
|
|
1028
|
+
return orgUnitsSyncHelp();
|
|
1029
|
+
if (action !== "google")
|
|
1030
|
+
throw new CliError(`Unknown org-units-sync command "${action}"`, 2);
|
|
1031
|
+
const instanceId = getStringFlag(ctx, "instance");
|
|
1032
|
+
if (!instanceId)
|
|
1033
|
+
throw new CliError("Missing --instance", 2);
|
|
1034
|
+
if (!hasFlag(ctx, "yes") && !hasFlag(ctx, "dry-run")) {
|
|
1035
|
+
throw new CliError("Google OU sync writes org-unit and membership data. Add --yes or use --dry-run.", 2);
|
|
1036
|
+
}
|
|
1037
|
+
return requestApi("/api/cli/org-units/sync-google", {
|
|
1038
|
+
method: "POST",
|
|
1039
|
+
body: JSON.stringify({
|
|
1040
|
+
instanceId,
|
|
1041
|
+
dryRun: hasFlag(ctx, "dry-run")
|
|
1042
|
+
})
|
|
1043
|
+
});
|
|
1044
|
+
};
|
|
1045
|
+
var runAmbassadorsCommand = async (_action, ctx) => {
|
|
1046
|
+
const instanceId = getStringFlag(ctx, "instance");
|
|
1047
|
+
if (!instanceId)
|
|
1048
|
+
throw new CliError("Missing --instance", 2);
|
|
1049
|
+
const language = getStringFlag(ctx, "language") ?? "fr";
|
|
1050
|
+
return requestApi(`/api/cli/ambassadors/label?instanceId=${encodeURIComponent(instanceId)}&language=${encodeURIComponent(language)}`);
|
|
1051
|
+
};
|
|
698
1052
|
var runSyncCommand = async (action, ctx) => {
|
|
699
1053
|
if (!action || action === "help")
|
|
700
1054
|
return syncHelp();
|
|
@@ -889,7 +1243,31 @@ var getTargetInstanceIds = (ctx) => {
|
|
|
889
1243
|
]));
|
|
890
1244
|
};
|
|
891
1245
|
var getFields = (resource, ctx) => splitCsv(getStringFlag(ctx, "fields")).length > 0 ? splitCsv(getStringFlag(ctx, "fields")) : resource.defaultFields;
|
|
1246
|
+
var entitySearchParams = (ctx) => {
|
|
1247
|
+
const searchParams = new URLSearchParams;
|
|
1248
|
+
const instanceId = getStringFlag(ctx, "instance");
|
|
1249
|
+
const language = getStringFlag(ctx, "language") ?? "en";
|
|
1250
|
+
if (instanceId)
|
|
1251
|
+
searchParams.set("instanceId", instanceId);
|
|
1252
|
+
if (language)
|
|
1253
|
+
searchParams.set("language", language);
|
|
1254
|
+
return searchParams;
|
|
1255
|
+
};
|
|
892
1256
|
var splitCsv = (value) => value ? value.split(",").map((item) => item.trim()).filter(Boolean) : [];
|
|
1257
|
+
var setWhereValue = (where, fieldPath, value) => {
|
|
1258
|
+
const parts = fieldPath.split(".").map((part) => part.trim()).filter(Boolean);
|
|
1259
|
+
if (parts.length === 0)
|
|
1260
|
+
return;
|
|
1261
|
+
let cursor = where;
|
|
1262
|
+
for (const part of parts.slice(0, -1)) {
|
|
1263
|
+
const existing = cursor[part];
|
|
1264
|
+
if (!existing || typeof existing !== "object" || Array.isArray(existing)) {
|
|
1265
|
+
cursor[part] = {};
|
|
1266
|
+
}
|
|
1267
|
+
cursor = cursor[part];
|
|
1268
|
+
}
|
|
1269
|
+
cursor[parts[parts.length - 1]] = value;
|
|
1270
|
+
};
|
|
893
1271
|
var GLOBAL_DEFAULT_RESOURCES = new Set([
|
|
894
1272
|
"pages",
|
|
895
1273
|
"topics",
|
|
@@ -979,6 +1357,19 @@ var schemaHelp = () => ({
|
|
|
979
1357
|
{ name: "sync presets", writes: false },
|
|
980
1358
|
{ name: "cache scopes", writes: false },
|
|
981
1359
|
{ name: "cache invalidate", required: ["--instance"], flags: ["--scope", "--languages", "--yes", "--dry-run"], writes: true },
|
|
1360
|
+
{ name: "feedback claim", args: ["feedbackId"], flags: ["--dry-run"], writes: true },
|
|
1361
|
+
{ name: "feedback send-claim", args: ["feedbackId"], flags: ["--recipient-email", "--recipient-name", "--cc", "--subject", "--body", "--yes", "--dry-run"], writes: true },
|
|
1362
|
+
{ name: "access grant", required: ["--user"], flags: ["--type", "--start-at", "--custom-duration-days", "--preferred-language", "--yes", "--dry-run"], writes: true },
|
|
1363
|
+
{ name: "access revoke-active", required: ["--user"], flags: ["--yes", "--dry-run"], writes: true },
|
|
1364
|
+
{ name: "entities list", required: ["--instance"], flags: ["--language"], writes: false },
|
|
1365
|
+
{ name: "entities detail", args: ["entityId"], required: ["--instance"], flags: ["--language"], writes: false },
|
|
1366
|
+
{ name: "entities access-summary", required: ["--instance"], writes: false },
|
|
1367
|
+
{ name: "entities sync-google-groups", required: ["--instance"], flags: ["--dry-run"], writes: false },
|
|
1368
|
+
{ name: "entities save-access-rules", required: ["--instance", "--entity-ids"], flags: ["--yes", "--dry-run"], writes: true },
|
|
1369
|
+
{ name: "entities set-restrictions", args: ["entityId"], required: ["--instance"], flags: ["--category-ids", "--learning-path-ids", "--alpha-program-ids", "--alpha-all-programs", "--yes", "--dry-run"], writes: true },
|
|
1370
|
+
{ name: "entities set-page-visibility", required: ["--instance", "--page"], flags: ["--entity-ids", "--yes", "--dry-run"], writes: true },
|
|
1371
|
+
{ name: "org-units-sync google", required: ["--instance"], flags: ["--yes", "--dry-run"], writes: true },
|
|
1372
|
+
{ name: "ambassadors label", required: ["--instance"], flags: ["--language"], writes: false },
|
|
982
1373
|
...resources.flatMap((resource) => [
|
|
983
1374
|
{ name: `${resource.name} list`, writes: false, flags: ["--where", "--fields", "--take", "--skip", "--order-by", "--instance", "--dry-run"] },
|
|
984
1375
|
{ name: `${resource.name} get`, args: ["id"], writes: false },
|
|
@@ -1037,6 +1428,40 @@ var cacheHelp = () => ({
|
|
|
1037
1428
|
scopes: ["all", "pages", "pages-knowledge", "menu-bundle", "applications"],
|
|
1038
1429
|
note: "Uses the same deploy-cache version bump system as the super-admin content settings screen."
|
|
1039
1430
|
});
|
|
1431
|
+
var feedbackHelp = () => ({
|
|
1432
|
+
usage: [
|
|
1433
|
+
"gskills-admin feedback claim <feedbackId> --dry-run",
|
|
1434
|
+
"gskills-admin feedback claim <feedbackId>",
|
|
1435
|
+
"gskills-admin feedback send-claim <feedbackId> --recipient-email user@example.com --subject '...' --body '...' --yes"
|
|
1436
|
+
],
|
|
1437
|
+
note: "Claiming and sending emails use the same SLA recipient rules as the admin feedback UI and log through admin logs."
|
|
1438
|
+
});
|
|
1439
|
+
var accessHelp = () => ({
|
|
1440
|
+
usage: [
|
|
1441
|
+
"gskills-admin access grant --user <userId> --type DEFAULT --dry-run",
|
|
1442
|
+
"gskills-admin access grant --user <userId> --type PASS_90_DAYS --preferred-language fr --yes",
|
|
1443
|
+
"gskills-admin access revoke-active --user <userId> --yes"
|
|
1444
|
+
],
|
|
1445
|
+
types: ["DEFAULT", "PASS_90_DAYS", "PASS_12_MONTHS", "CUSTOM", "UNLIMITED"]
|
|
1446
|
+
});
|
|
1447
|
+
var entitiesHelp = () => ({
|
|
1448
|
+
usage: [
|
|
1449
|
+
"gskills-admin entities list --instance <instanceId>",
|
|
1450
|
+
"gskills-admin entities detail <entityId> --instance <instanceId>",
|
|
1451
|
+
"gskills-admin entities access-summary --instance <instanceId>",
|
|
1452
|
+
"gskills-admin entities save-access-rules --instance <instanceId> --entity-ids manual-group:<id>,org-unit:<id> --dry-run",
|
|
1453
|
+
"gskills-admin entities set-restrictions <entityId> --instance <instanceId> --category-ids <id,id> --learning-path-ids <id,id> --yes",
|
|
1454
|
+
"gskills-admin entities set-page-visibility --instance <instanceId> --page <pageId> --entity-ids google-group:team@example.com --yes"
|
|
1455
|
+
],
|
|
1456
|
+
note: "Entity ids use the shared admin entity format: manual-group:<id>, org-unit:<id>, google-group:<email>."
|
|
1457
|
+
});
|
|
1458
|
+
var orgUnitsSyncHelp = () => ({
|
|
1459
|
+
usage: [
|
|
1460
|
+
"gskills-admin org-units-sync google --instance <instanceId> --dry-run",
|
|
1461
|
+
"gskills-admin org-units-sync google --instance <instanceId> --yes"
|
|
1462
|
+
],
|
|
1463
|
+
note: "Uses the same Google Admin OU sync engine as the instance admin UI."
|
|
1464
|
+
});
|
|
1040
1465
|
var resourceHelp = (resource) => ({
|
|
1041
1466
|
resource: resource.name,
|
|
1042
1467
|
label: resource.label,
|
package/package.json
CHANGED
|
@@ -258,6 +258,116 @@ gskills-admin cache invalidate --instance <instanceId> --scope menu-bundle --yes
|
|
|
258
258
|
gskills-admin cache invalidate --instance <instanceId> --scope all --yes --output json
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
+
## Feedback And SLA Emails
|
|
262
|
+
|
|
263
|
+
Use these commands for feedback claim email flows. They reuse the same SLA contact flags and recipient validation as the admin feedback UI.
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
gskills-admin feedback claim <feedbackId> --dry-run --output json
|
|
267
|
+
gskills-admin feedback claim <feedbackId> --output json
|
|
268
|
+
gskills-admin feedback send-claim <feedbackId> --recipient-email user@example.com --subject "GSkills - Ticket pris en charge" --body "Bonjour..." --dry-run --output json
|
|
269
|
+
gskills-admin feedback send-claim <feedbackId> --recipient-email user@example.com --subject "GSkills - Ticket pris en charge" --body "Bonjour..." --yes --output json
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Rules:
|
|
273
|
+
|
|
274
|
+
- Dry-run claim first to inspect recipient, CC recipients and draft.
|
|
275
|
+
- Send only after the ticket is claimed by the same CLI user.
|
|
276
|
+
- CC recipients must be allowed by instance SLA flags.
|
|
277
|
+
- All claim and email sends are admin-logged with CLI metadata.
|
|
278
|
+
|
|
279
|
+
## Accesses
|
|
280
|
+
|
|
281
|
+
Use `access grant` and `access revoke-active` instead of raw `access-passes` writes when the operation should trigger workflows and admin logs.
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
gskills-admin access grant --user <userId> --type DEFAULT --dry-run --output json
|
|
285
|
+
gskills-admin access grant --user <userId> --type PASS_90_DAYS --preferred-language fr --yes --output json
|
|
286
|
+
gskills-admin access revoke-active --user <userId> --dry-run --output json
|
|
287
|
+
gskills-admin access revoke-active --user <userId> --yes --output json
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Types are `DEFAULT`, `PASS_90_DAYS`, `PASS_12_MONTHS`, `CUSTOM`, and `UNLIMITED`.
|
|
291
|
+
|
|
292
|
+
## Entities And Restrictions
|
|
293
|
+
|
|
294
|
+
Entities are the shared segmentation layer for manual groups, Google groups, and Google Admin OUs.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
gskills-admin entities list --instance <instanceId> --language fr --output json
|
|
298
|
+
gskills-admin entities detail manual-group:<groupId> --instance <instanceId> --language fr --output json
|
|
299
|
+
gskills-admin entities access-summary --instance <instanceId> --output json
|
|
300
|
+
gskills-admin entities sync-google-groups --instance <instanceId> --output json
|
|
301
|
+
gskills-admin org-units-sync google --instance <instanceId> --dry-run --output json
|
|
302
|
+
gskills-admin org-units-sync google --instance <instanceId> --yes --output json
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Entity ids use:
|
|
306
|
+
|
|
307
|
+
- `manual-group:<groupId>`
|
|
308
|
+
- `org-unit:<orgUnitId>`
|
|
309
|
+
- `google-group:<email>`
|
|
310
|
+
|
|
311
|
+
For instance access rules:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
gskills-admin entities save-access-rules --instance <instanceId> --entity-ids manual-group:<id>,org-unit:<id> --dry-run --output json
|
|
315
|
+
gskills-admin entities save-access-rules --instance <instanceId> --entity-ids manual-group:<id>,org-unit:<id> --yes --output json
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
For content restrictions:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
gskills-admin entities set-restrictions manual-group:<id> --instance <instanceId> --category-ids <categoryId,categoryId> --learning-path-ids <pathId,pathId> --dry-run --output json
|
|
322
|
+
gskills-admin entities set-restrictions manual-group:<id> --instance <instanceId> --category-ids <categoryId,categoryId> --learning-path-ids <pathId,pathId> --yes --output json
|
|
323
|
+
gskills-admin entities set-page-visibility --instance <instanceId> --page <pageId> --entity-ids google-group:team@example.com --dry-run --output json
|
|
324
|
+
gskills-admin entities set-page-visibility --instance <instanceId> --page <pageId> --entity-ids google-group:team@example.com --yes --output json
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
These commands update the same underlying shared restriction models as the UI and invalidate the dependent deploy cache scope.
|
|
328
|
+
|
|
329
|
+
## Ambassadors
|
|
330
|
+
|
|
331
|
+
Ambassadors can be shown as ambassadors, experts or champions depending on the instance flag.
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
gskills-admin ambassadors label --instance <instanceId> --language fr --output json
|
|
335
|
+
gskills-admin ambassadors list --where '{"user":{"instanceID":"<instanceId>"}}' --output json
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Use the label command before writing user-facing copy.
|
|
339
|
+
|
|
340
|
+
## Project Data And Analytics
|
|
341
|
+
|
|
342
|
+
Project data resources:
|
|
343
|
+
|
|
344
|
+
- `project-data`
|
|
345
|
+
- `project-contacts`
|
|
346
|
+
- `ticket-sla-rules`
|
|
347
|
+
- `ticket-sla-contacts`
|
|
348
|
+
|
|
349
|
+
Analytics-readable resources:
|
|
350
|
+
|
|
351
|
+
- `analytics`
|
|
352
|
+
- `user-paths`
|
|
353
|
+
- `quiz-attempts`
|
|
354
|
+
- `chromebook-progress`
|
|
355
|
+
- `user-badges`
|
|
356
|
+
- `user-learning-paths`
|
|
357
|
+
- `user-learning-path-item-completions`
|
|
358
|
+
|
|
359
|
+
Examples:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
gskills-admin project-data list --instance <instanceId> --output json
|
|
363
|
+
gskills-admin analytics list --where '{"instanceId":"<instanceId>"}' --take 100 --output json
|
|
364
|
+
gskills-admin quiz-attempts list --where '{"user":{"instanceID":"<instanceId>"}}' --take 100 --output json
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Prefer these read paths for analytics investigation. They are intentionally raw enough to match UI analytics data without giving the agent a DB URL.
|
|
368
|
+
|
|
369
|
+
## Cache Scope Choice
|
|
370
|
+
|
|
261
371
|
Prefer the narrowest scope:
|
|
262
372
|
|
|
263
373
|
- `pages`
|