@tutorflow/cli 0.3.1 → 0.5.0
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 +261 -659
- package/dist/client.d.ts +16 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +76 -16
- package/dist/client.js.map +1 -1
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +38 -23
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +20 -12
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/classroom.d.ts +3 -0
- package/dist/commands/classroom.d.ts.map +1 -0
- package/dist/commands/classroom.js +27 -0
- package/dist/commands/classroom.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +4 -4
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/course.d.ts.map +1 -1
- package/dist/commands/course.js +27 -96
- package/dist/commands/course.js.map +1 -1
- package/dist/commands/credits.d.ts +3 -0
- package/dist/commands/credits.d.ts.map +1 -0
- package/dist/commands/credits.js +39 -0
- package/dist/commands/credits.js.map +1 -0
- package/dist/commands/evaluate.d.ts +3 -0
- package/dist/commands/evaluate.d.ts.map +1 -1
- package/dist/commands/evaluate.js +98 -57
- package/dist/commands/evaluate.js.map +1 -1
- package/dist/commands/interactive.d.ts +13 -0
- package/dist/commands/interactive.d.ts.map +1 -0
- package/dist/commands/interactive.js +105 -0
- package/dist/commands/interactive.js.map +1 -0
- package/dist/commands/learner.d.ts +4 -0
- package/dist/commands/learner.d.ts.map +1 -0
- package/dist/commands/learner.js +76 -0
- package/dist/commands/learner.js.map +1 -0
- package/dist/commands/module.d.ts.map +1 -1
- package/dist/commands/module.js +20 -98
- package/dist/commands/module.js.map +1 -1
- package/dist/commands/platform.d.ts.map +1 -1
- package/dist/commands/platform.js +10 -2
- package/dist/commands/platform.js.map +1 -1
- package/dist/commands/run.d.ts +3 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +69 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/slide.d.ts.map +1 -1
- package/dist/commands/slide.js +27 -97
- package/dist/commands/slide.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +40 -106
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/video.d.ts.map +1 -1
- package/dist/commands/video.js +143 -86
- package/dist/commands/video.js.map +1 -1
- package/dist/commands/webhook.d.ts +3 -0
- package/dist/commands/webhook.d.ts.map +1 -0
- package/dist/commands/webhook.js +75 -0
- package/dist/commands/webhook.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -16
- package/dist/config.js.map +1 -1
- package/dist/content/context.d.ts +26 -0
- package/dist/content/context.d.ts.map +1 -0
- package/dist/content/context.js +74 -0
- package/dist/content/context.js.map +1 -0
- package/dist/content/resource.d.ts +66 -0
- package/dist/content/resource.d.ts.map +1 -0
- package/dist/content/resource.js +181 -0
- package/dist/content/resource.js.map +1 -0
- package/dist/content/runs.d.ts +51 -0
- package/dist/content/runs.d.ts.map +1 -0
- package/dist/content/runs.js +171 -0
- package/dist/content/runs.js.map +1 -0
- package/dist/content/sharing.d.ts +24 -0
- package/dist/content/sharing.d.ts.map +1 -0
- package/dist/content/sharing.js +88 -0
- package/dist/content/sharing.js.map +1 -0
- package/dist/index.js +71 -21
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +15 -65
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -4
- package/dist/utils/args.d.ts +15 -0
- package/dist/utils/args.d.ts.map +1 -0
- package/dist/utils/args.js +91 -0
- package/dist/utils/args.js.map +1 -0
- package/dist/utils/keys.d.ts +11 -0
- package/dist/utils/keys.d.ts.map +1 -0
- package/dist/utils/keys.js +29 -0
- package/dist/utils/keys.js.map +1 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +21 -6
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/runtime.d.ts +14 -4
- package/dist/utils/runtime.d.ts.map +1 -1
- package/dist/utils/runtime.js +42 -7
- package/dist/utils/runtime.js.map +1 -1
- package/package.json +4 -3
- package/dist/utils/spinner.d.ts +0 -8
- package/dist/utils/spinner.d.ts.map +0 -1
- package/dist/utils/spinner.js +0 -26
- package/dist/utils/spinner.js.map +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.learnerCommand = learnerCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const output_1 = require("../utils/output");
|
|
6
|
+
const runtime_1 = require("../utils/runtime");
|
|
7
|
+
const args_1 = require("../utils/args");
|
|
8
|
+
const context_1 = require("../content/context");
|
|
9
|
+
/** Learner routes are live-only: test keys answer 403 content_sandbox_unsupported. */
|
|
10
|
+
function learnerCommand() {
|
|
11
|
+
const learner = new commander_1.Command('learner').description('Manage classroom learners (live keys only)');
|
|
12
|
+
const learnerPath = (id, suffix = '') => `/learners/${(0, context_1.segment)(id)}${suffix}`;
|
|
13
|
+
learner
|
|
14
|
+
.command('list')
|
|
15
|
+
.description('List learners of the classroom')
|
|
16
|
+
.option('-l, --limit <number>', 'Items per page', '20')
|
|
17
|
+
.option('--cursor <cursor>', 'meta.nextCursor from the previous page')
|
|
18
|
+
.option('--status <status>', 'Filter by status')
|
|
19
|
+
.option('-q, --query <text>', 'Search by name or email')
|
|
20
|
+
.action((0, runtime_1.command)(async (options) => {
|
|
21
|
+
const limit = (0, args_1.parsePositiveInt)(options.limit, '--limit');
|
|
22
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
23
|
+
const qs = new URLSearchParams({ limit: String(limit) });
|
|
24
|
+
if (options.cursor)
|
|
25
|
+
qs.set('cursor', options.cursor);
|
|
26
|
+
if (options.status)
|
|
27
|
+
qs.set('status', options.status);
|
|
28
|
+
if (options.query)
|
|
29
|
+
qs.set('q', options.query);
|
|
30
|
+
(0, output_1.printResult)(await ctx.client.request('GET', `${(0, context_1.classroomPath)(ctx, '/learners')}?${qs}`));
|
|
31
|
+
}));
|
|
32
|
+
learner
|
|
33
|
+
.command('get <learnerId>')
|
|
34
|
+
.description('Show a learner')
|
|
35
|
+
.action((0, runtime_1.command)(async (id) => {
|
|
36
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
37
|
+
(0, output_1.printResult)(await ctx.client.request('GET', (0, context_1.classroomPath)(ctx, learnerPath(id))));
|
|
38
|
+
}));
|
|
39
|
+
learner
|
|
40
|
+
.command('progress <learnerId>')
|
|
41
|
+
.description("Show a learner's course progress")
|
|
42
|
+
.action((0, runtime_1.command)(async (id) => {
|
|
43
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
44
|
+
(0, output_1.printResult)(await ctx.client.request('GET', (0, context_1.classroomPath)(ctx, learnerPath(id, '/progress'))));
|
|
45
|
+
}));
|
|
46
|
+
learner
|
|
47
|
+
.command('invite')
|
|
48
|
+
.description('Add a learner by email (an organization member joins at once; others get an invitation)')
|
|
49
|
+
.requiredOption('--email <email>', 'Learner email')
|
|
50
|
+
.option('--name <name>', 'Learner name')
|
|
51
|
+
.option('--locale <locale>', 'Locale of the invitation email', 'en')
|
|
52
|
+
.option('--course <courseId>', 'Enroll in this course (repeatable)', args_1.collect, [])
|
|
53
|
+
.option('--test <testId>', 'Assign this test (repeatable)', args_1.collect, [])
|
|
54
|
+
.action((0, runtime_1.command)(async (options) => {
|
|
55
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
56
|
+
(0, output_1.printResult)(await ctx.client.request('POST', (0, context_1.classroomPath)(ctx, '/learners/invitations'), (0, args_1.compact)({
|
|
57
|
+
email: options.email,
|
|
58
|
+
name: options.name,
|
|
59
|
+
locale: options.locale,
|
|
60
|
+
courseIds: options.course.length ? options.course : undefined,
|
|
61
|
+
testIds: options.test.length ? options.test : undefined,
|
|
62
|
+
})));
|
|
63
|
+
}));
|
|
64
|
+
learner
|
|
65
|
+
.command('remove <learnerId>')
|
|
66
|
+
.description('Remove a learner from the classroom')
|
|
67
|
+
.option('-y, --yes', 'Skip the confirmation prompt (required without a TTY)')
|
|
68
|
+
.action((0, runtime_1.command)(async (id, options) => {
|
|
69
|
+
await (0, args_1.confirmOrRequireYes)(options.yes, `Remove learner ${id}?`);
|
|
70
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
71
|
+
await ctx.client.request('DELETE', (0, context_1.classroomPath)(ctx, learnerPath(id)));
|
|
72
|
+
(0, output_1.printResult)({ id, removed: true });
|
|
73
|
+
}));
|
|
74
|
+
return learner;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=learner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learner.js","sourceRoot":"","sources":["../../src/commands/learner.ts"],"names":[],"mappings":";;AAOA,wCAsFC;AA7FD,yCAAoC;AACpC,4CAA8C;AAC9C,8CAA2C;AAC3C,wCAAwF;AACxF,gDAAmF;AAEnF,sFAAsF;AACtF,SAAgB,cAAc;IAC5B,MAAM,OAAO,GAAG,IAAI,mBAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC;IACjG,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE,CAAC,aAAa,IAAA,iBAAO,EAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;IAErF,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,gCAAgC,CAAC;SAC7C,MAAM,CAAC,sBAAsB,EAAE,gBAAgB,EAAE,IAAI,CAAC;SACtD,MAAM,CAAC,mBAAmB,EAAE,wCAAwC,CAAC;SACrE,MAAM,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;SAC/C,MAAM,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;SACvD,MAAM,CACL,IAAA,iBAAO,EAAC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AC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SACxD,CAAC,CACH,CACF,CAAC;IACJ,CAAC,CACF,CACF,CAAC;IAEJ,OAAO;SACJ,OAAO,CAAC,oBAAoB,CAAC;SAC7B,WAAW,CAAC,qCAAqC,CAAC;SAClD,MAAM,CAAC,WAAW,EAAE,uDAAuD,CAAC;SAC5E,MAAM,CACL,IAAA,iBAAO,EAAC,KAAK,EAAE,EAAU,EAAE,OAA0B,EAAE,EAAE;QACvD,MAAM,IAAA,0BAAmB,EAAC,OAAO,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAC;QAChE,MAAM,GAAG,GAAG,MAAM,IAAA,+BAAqB,GAAE,CAAC;QAC1C,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAA,uBAAa,EAAC,GAAG,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxE,IAAA,oBAAW,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC,CACH,CAAC;IAEJ,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/commands/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/commands/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wBAAgB,aAAa,IAAI,OAAO,CA0BvC"}
|
package/dist/commands/module.js
CHANGED
|
@@ -1,108 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.moduleCommand = moduleCommand;
|
|
7
4
|
const commander_1 = require("commander");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const output_1 = require("../utils/output");
|
|
12
|
-
const runtime_1 = require("../utils/runtime");
|
|
5
|
+
const resource_1 = require("../content/resource");
|
|
6
|
+
const sharing_1 = require("../content/sharing");
|
|
7
|
+
const MODULES = { path: 'modules', noun: 'interactive module' };
|
|
13
8
|
function moduleCommand() {
|
|
14
|
-
const module = new commander_1.Command('module').description('
|
|
15
|
-
module
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.option('--no-quiz', 'Disable generated quiz')
|
|
27
|
-
.option('--idempotency-key <key>', 'Idempotency key for safe retries')
|
|
28
|
-
.option('--open', 'Open the public URL in a browser when done (TTY only)')
|
|
29
|
-
.action((0, runtime_1.command)(async (prompt, options) => {
|
|
30
|
-
const modulePrompt = await promptOrThrow(prompt, 'Describe the standalone lesson module:', 'Pass a prompt argument: tutorflow module create "Fractions for 5th grade"');
|
|
31
|
-
const client = await client_1.ApiClient.createAuthenticated();
|
|
32
|
-
const response = await client.request('POST', '/v1/platform/modules', compact({
|
|
33
|
-
prompt: modulePrompt,
|
|
34
|
-
title: options.title,
|
|
35
|
-
description: options.description,
|
|
36
|
-
target: options.target,
|
|
9
|
+
const module = new commander_1.Command('module').description('Generate and manage interactive lesson modules');
|
|
10
|
+
(0, resource_1.addGenerateCommand)(module, {
|
|
11
|
+
...MODULES,
|
|
12
|
+
description: 'Generate an interactive lesson module (3 credits)',
|
|
13
|
+
promptLabel: 'Describe the module',
|
|
14
|
+
example: 'tutorflow module generate "Fractions for 5th grade" --wait',
|
|
15
|
+
configure: (cmd) => cmd
|
|
16
|
+
.option('--type <type>', 'Lesson type, e.g. markdown, ai-tutor, flashcard, coding-lesson (chosen from the topic when omitted)')
|
|
17
|
+
.option('-l, --language <lang>', 'Language code', 'en')
|
|
18
|
+
.option('--reference <text>', 'Reference text the module should be based on'),
|
|
19
|
+
buildBody: (topic, options) => ({
|
|
20
|
+
topic,
|
|
37
21
|
type: options.type,
|
|
38
|
-
locale: options.locale,
|
|
39
22
|
language: options.language,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (options.open && response.publicUrl && (0, runtime_1.isInteractive)()) {
|
|
46
|
-
await (0, open_1.default)(response.publicUrl);
|
|
47
|
-
(0, output_1.printStatus)('Opening in browser...', 'success');
|
|
48
|
-
}
|
|
49
|
-
}));
|
|
50
|
-
module
|
|
51
|
-
.command('list')
|
|
52
|
-
.option('-l, --limit <number>', 'Number of results', '20')
|
|
53
|
-
.option('-o, --offset <number>', 'Number of rows to skip', '0')
|
|
54
|
-
.option('-s, --search <text>', 'Search term')
|
|
55
|
-
.action((0, runtime_1.command)(async (options) => {
|
|
56
|
-
const client = await client_1.ApiClient.createAuthenticated();
|
|
57
|
-
const qs = new URLSearchParams({ limit: options.limit, offset: options.offset });
|
|
58
|
-
if (options.search)
|
|
59
|
-
qs.set('search', options.search);
|
|
60
|
-
const response = await client.request('GET', `/v1/platform/modules?${qs.toString()}`);
|
|
61
|
-
(0, output_1.printResult)(response);
|
|
62
|
-
}));
|
|
63
|
-
module
|
|
64
|
-
.command('get <id>')
|
|
65
|
-
.description('Fetch a single module by ID')
|
|
66
|
-
.action((0, runtime_1.command)(async (id) => {
|
|
67
|
-
const client = await client_1.ApiClient.createAuthenticated();
|
|
68
|
-
const response = await client.request('GET', `/v1/platform/modules/${id}`);
|
|
69
|
-
(0, output_1.printResult)(response);
|
|
70
|
-
}));
|
|
71
|
-
module
|
|
72
|
-
.command('open <id>')
|
|
73
|
-
.description('Open a module public URL in the browser')
|
|
74
|
-
.action((0, runtime_1.command)(async (id) => {
|
|
75
|
-
const client = await client_1.ApiClient.createAuthenticated();
|
|
76
|
-
const response = await client.request('GET', `/v1/platform/modules/${id}`);
|
|
77
|
-
if (!response.publicUrl) {
|
|
78
|
-
throw new runtime_1.CliError('No public URL available for this module', {
|
|
79
|
-
code: 'ENOPREVIEW',
|
|
80
|
-
exitCode: 1,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
if ((0, runtime_1.isInteractive)())
|
|
84
|
-
await (0, open_1.default)(response.publicUrl);
|
|
85
|
-
(0, output_1.printResult)({ publicUrl: response.publicUrl });
|
|
86
|
-
(0, output_1.printStatus)('Opening in browser...', 'success');
|
|
87
|
-
}));
|
|
23
|
+
referenceText: options.reference,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
(0, resource_1.addCrudCommands)(module, MODULES);
|
|
27
|
+
(0, sharing_1.addShareCommands)(module, MODULES, sharing_1.MODULE_SHARING);
|
|
88
28
|
return module;
|
|
89
29
|
}
|
|
90
|
-
async function promptOrThrow(value, message, hint) {
|
|
91
|
-
if (value?.trim())
|
|
92
|
-
return value.trim();
|
|
93
|
-
(0, runtime_1.requireInteractive)(hint);
|
|
94
|
-
const result = await (0, prompts_1.text)({ message });
|
|
95
|
-
if (!result || typeof result === 'symbol') {
|
|
96
|
-
throw new runtime_1.CliError('Cancelled', { code: 'ECANCELLED', exitCode: 130 });
|
|
97
|
-
}
|
|
98
|
-
return result;
|
|
99
|
-
}
|
|
100
|
-
function compact(input) {
|
|
101
|
-
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined && value !== ''));
|
|
102
|
-
}
|
|
103
|
-
function idempotencyHeaders(key) {
|
|
104
|
-
if (!key)
|
|
105
|
-
return undefined;
|
|
106
|
-
return { 'Idempotency-Key': key };
|
|
107
|
-
}
|
|
108
30
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/commands/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/commands/module.ts"],"names":[],"mappings":";;AAYA,sCA0BC;AAtCD,yCAAoC;AACpC,kDAA6F;AAC7F,gDAAsE;AAQtE,MAAM,OAAO,GAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AAE9E,SAAgB,aAAa;IAC3B,MAAM,MAAM,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,gDAAgD,CAAC,CAAC;IAEnG,IAAA,6BAAkB,EAAwB,MAAM,EAAE;QAChD,GAAG,OAAO;QACV,WAAW,EAAE,mDAAmD;QAChE,WAAW,EAAE,qBAAqB;QAClC,OAAO,EAAE,4DAA4D;QACrE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CACjB,GAAG;aACA,MAAM,CACL,eAAe,EACf,qGAAqG,CACtG;aACA,MAAM,CAAC,uBAAuB,EAAE,eAAe,EAAE,IAAI,CAAC;aACtD,MAAM,CAAC,oBAAoB,EAAE,8CAA8C,CAAC;QACjF,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;YAC9B,KAAK;YACL,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,aAAa,EAAE,OAAO,CAAC,SAAS;SACjC,CAAC;KACH,CAAC,CAAC;IACH,IAAA,0BAAe,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAA,0BAAgB,EAAC,MAAM,EAAE,OAAO,EAAE,wBAAc,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/commands/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,eAAe,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/commands/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,eAAe,IAAI,OAAO,CAyDzC"}
|
|
@@ -6,7 +6,7 @@ const client_1 = require("../client");
|
|
|
6
6
|
const output_1 = require("../utils/output");
|
|
7
7
|
const runtime_1 = require("../utils/runtime");
|
|
8
8
|
function platformCommand() {
|
|
9
|
-
const platform = new commander_1.Command('platform').description('
|
|
9
|
+
const platform = new commander_1.Command('platform').description('Agent Platform discovery: manifest, pricing, health, old share links');
|
|
10
10
|
platform
|
|
11
11
|
.command('manifest')
|
|
12
12
|
.description('Read the public agent discovery manifest')
|
|
@@ -25,12 +25,20 @@ function platformCommand() {
|
|
|
25
25
|
}));
|
|
26
26
|
platform
|
|
27
27
|
.command('health')
|
|
28
|
-
.description('Check the
|
|
28
|
+
.description('Check that the API key is accepted')
|
|
29
29
|
.action((0, runtime_1.command)(async () => {
|
|
30
30
|
const client = await client_1.ApiClient.createAuthenticated();
|
|
31
31
|
const response = await client.request('GET', '/v1/platform/health');
|
|
32
32
|
(0, output_1.printResult)(response);
|
|
33
33
|
}));
|
|
34
|
+
platform
|
|
35
|
+
.command('share-redirect <shareToken>')
|
|
36
|
+
.description('Resolve a removed Platform share link to the classroom page that replaced it')
|
|
37
|
+
.action((0, runtime_1.command)(async (shareToken) => {
|
|
38
|
+
const client = await client_1.ApiClient.createPublic();
|
|
39
|
+
const response = await client.request('GET', `/v1/platform/share-redirects/${encodeURIComponent(shareToken)}`);
|
|
40
|
+
(0, output_1.printResult)(response);
|
|
41
|
+
}));
|
|
34
42
|
return platform;
|
|
35
43
|
}
|
|
36
44
|
//# sourceMappingURL=platform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/commands/platform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,CAAC,OAAO,CACnC,KAAK,EACL,qBAAqB,CACtB,CAAC;QACF,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;IACxB,CAAC,CAAC,CACH,CAAC;IAEJ,QAAQ;SACL,OAAO,CAAC,6BAA6B,CAAC;SACtC,WAAW,CAAC,8EAA8E,CAAC;SAC3F,MAAM,CACL,IAAA,iBAAO,EAAC,KAAK,EAAE,UAAkB,EAAE,EAAE;QACnC,MAAM,MAAM,GAAG,MAAM,kBAAS,CAAC,YAAY,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,KAAK,EACL,gCAAgC,kBAAkB,CAAC,UAAU,CAAC,EAAE,CACjE,CAAC;QACF,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;IACxB,CAAC,CAAC,CACH,CAAC;IAEJ,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,UAAU,IAAI,OAAO,CAoEpC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCommand = runCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const output_1 = require("../utils/output");
|
|
6
|
+
const runtime_1 = require("../utils/runtime");
|
|
7
|
+
const args_1 = require("../utils/args");
|
|
8
|
+
const context_1 = require("../content/context");
|
|
9
|
+
const resource_1 = require("../content/resource");
|
|
10
|
+
const runs_1 = require("../content/runs");
|
|
11
|
+
function runCommand() {
|
|
12
|
+
const run = new commander_1.Command('run').description('Follow generation runs (course, slide, test and module generate)');
|
|
13
|
+
run
|
|
14
|
+
.command('list')
|
|
15
|
+
.description('List generation runs of the classroom, newest first')
|
|
16
|
+
.option('--kind <kind>', 'course | slide | test | module')
|
|
17
|
+
.option('--status <status>', 'queued | running | completed | failed')
|
|
18
|
+
.option('-l, --limit <number>', 'Items per page', '20')
|
|
19
|
+
.option('--cursor <cursor>', 'meta.nextCursor from the previous page')
|
|
20
|
+
.action((0, runtime_1.command)(async (options) => {
|
|
21
|
+
const limit = (0, args_1.parsePositiveInt)(options.limit, '--limit');
|
|
22
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
23
|
+
const qs = new URLSearchParams({ limit: String(limit) });
|
|
24
|
+
if (options.kind)
|
|
25
|
+
qs.set('kind', options.kind);
|
|
26
|
+
if (options.status)
|
|
27
|
+
qs.set('status', options.status);
|
|
28
|
+
if (options.cursor)
|
|
29
|
+
qs.set('cursor', options.cursor);
|
|
30
|
+
printRunList(await ctx.client.request('GET', `${(0, context_1.classroomPath)(ctx, '/runs')}?${qs}`));
|
|
31
|
+
}));
|
|
32
|
+
run
|
|
33
|
+
.command('get <runId>')
|
|
34
|
+
.description('Show a generation run')
|
|
35
|
+
.action((0, runtime_1.command)(async (runId) => {
|
|
36
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
37
|
+
(0, output_1.printResult)(await ctx.client.request('GET', (0, context_1.classroomPath)(ctx, `/runs/${(0, context_1.segment)(runId)}`)));
|
|
38
|
+
}));
|
|
39
|
+
(0, resource_1.addWaitOptions)(run.command('wait <runId>').description('Wait for a run to finish, then print it with what it made')).action((0, runtime_1.command)(async (runId, options) => {
|
|
40
|
+
const timeoutSeconds = (0, resource_1.parseTimeout)(options);
|
|
41
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
42
|
+
const finished = await (0, runs_1.waitForRun)(ctx, runId, timeoutSeconds);
|
|
43
|
+
await (0, resource_1.printFinishedRun)(ctx, finished);
|
|
44
|
+
}));
|
|
45
|
+
run
|
|
46
|
+
.command('resume <runId>')
|
|
47
|
+
.description('Resume a failed course run: a new run writes only the unfinished lessons')
|
|
48
|
+
.option('--idempotency-key <key>', 'Idempotency key for safe retries')
|
|
49
|
+
.action((0, runtime_1.command)(async (runId, options) => {
|
|
50
|
+
const ctx = await (0, context_1.resolveContentContext)();
|
|
51
|
+
(0, output_1.printResult)(await ctx.client.request('POST', (0, context_1.classroomPath)(ctx, `/runs/${(0, context_1.segment)(runId)}/resume`), undefined, (0, args_1.idempotencyHeaders)(options.idempotencyKey)));
|
|
52
|
+
}));
|
|
53
|
+
return run;
|
|
54
|
+
}
|
|
55
|
+
function printRunList(page) {
|
|
56
|
+
if ((0, runtime_1.isJsonMode)()) {
|
|
57
|
+
(0, output_1.printResult)(page);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
(0, output_1.printResult)((0, resource_1.rowsOf)(page).map((run) => ({
|
|
61
|
+
'Run ID': run.runId,
|
|
62
|
+
Kind: run.kind ?? '',
|
|
63
|
+
Status: run.status,
|
|
64
|
+
Progress: run.progress?.total ? `${run.progress.completed}/${run.progress.total}` : '',
|
|
65
|
+
Credits: run.creditsCharged ?? '',
|
|
66
|
+
Resource: run.resourceId ?? '',
|
|
67
|
+
})));
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";;AAeA,gCAoEC;AAnFD,yCAAoC;AACpC,4CAA8C;AAC9C,8CAAuD;AACvD,wCAAqE;AACrE,gDAAmF;AACnF,kDAO6B;AAC7B,0CAAiE;AAEjE,SAAgB,UAAU;IACxB,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CACxC,kEAAkE,CACnE,CAAC;IAEF,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,eAAe,EAAE,gCAAgC,CAAC;SACzD,MAAM,CAAC,mBAAmB,EAAE,uCAAuC,CAAC;SACpE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,IAAI,CAAC,CAAC;QAClB,OAAO;IACT,CAAC;IACD,IAAA,oBAAW,EACT,IAAA,iBAAM,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACzB,QAAQ,EAAE,GAAG,CAAC,KAAK;QACnB,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE;QACpB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE;QACtF,OAAO,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE;QACjC,QAAQ,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE;KAC/B,CAAC,CAAC,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.d.ts","sourceRoot":"","sources":["../../src/commands/slide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"slide.d.ts","sourceRoot":"","sources":["../../src/commands/slide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,YAAY,IAAI,OAAO,CA2BtC"}
|
package/dist/commands/slide.js
CHANGED
|
@@ -1,105 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.slideCommand = slideCommand;
|
|
7
4
|
const commander_1 = require("commander");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const runtime_1 = require("../utils/runtime");
|
|
5
|
+
const args_1 = require("../utils/args");
|
|
6
|
+
const resource_1 = require("../content/resource");
|
|
7
|
+
const sharing_1 = require("../content/sharing");
|
|
8
|
+
const SLIDES = { path: 'slides', noun: 'slide deck' };
|
|
13
9
|
function slideCommand() {
|
|
14
|
-
const slide = new commander_1.Command('slide').description('
|
|
15
|
-
slide
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
response = await client.request('POST', '/v1/platform/slides', {
|
|
38
|
-
prompt: slidePrompt,
|
|
39
|
-
slideCount: parseInt(options.count, 10),
|
|
40
|
-
language: options.language,
|
|
41
|
-
theme: options.theme,
|
|
42
|
-
mode: 'sync',
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
finally {
|
|
46
|
-
s?.stop('Done');
|
|
47
|
-
}
|
|
48
|
-
(0, output_1.printResult)(response);
|
|
49
|
-
if (options.open && response.previewUrl && (0, runtime_1.isInteractive)()) {
|
|
50
|
-
const shouldOpen = await (0, prompts_1.confirm)({ message: 'Open in browser?' });
|
|
51
|
-
if (shouldOpen === true)
|
|
52
|
-
await (0, open_1.default)(response.previewUrl);
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
55
|
-
slide
|
|
56
|
-
.command('list')
|
|
57
|
-
.option('-l, --limit <number>', 'Number of results', '10')
|
|
58
|
-
.option('-s, --status <status>', 'Filter by status')
|
|
59
|
-
.action((0, runtime_1.command)(async (options) => {
|
|
60
|
-
const client = await client_1.ApiClient.createAuthenticated();
|
|
61
|
-
const qs = new URLSearchParams({ limit: options.limit });
|
|
62
|
-
if (options.status)
|
|
63
|
-
qs.set('status', options.status);
|
|
64
|
-
const response = await client.request('GET', `/v1/platform/slides?${qs.toString()}`);
|
|
65
|
-
const slides = Array.isArray(response) ? response : response.data ?? response.items ?? [];
|
|
66
|
-
if ((0, runtime_1.isJsonMode)()) {
|
|
67
|
-
(0, output_1.printResult)(slides);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
(0, output_1.printResult)(slides.map((s) => ({
|
|
71
|
-
ID: s.id,
|
|
72
|
-
Title: s.title || 'Untitled',
|
|
73
|
-
Status: s.status,
|
|
74
|
-
Created: new Date(s.createdAt).toLocaleDateString(),
|
|
75
|
-
})));
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
slide
|
|
79
|
-
.command('get <id>')
|
|
80
|
-
.description('Fetch a single slide by ID')
|
|
81
|
-
.action((0, runtime_1.command)(async (id) => {
|
|
82
|
-
const client = await client_1.ApiClient.createAuthenticated();
|
|
83
|
-
const response = await client.request('GET', `/v1/platform/slides/${id}`);
|
|
84
|
-
(0, output_1.printResult)(response);
|
|
85
|
-
}));
|
|
86
|
-
slide
|
|
87
|
-
.command('open <id>')
|
|
88
|
-
.description('Open a slide in the browser')
|
|
89
|
-
.action((0, runtime_1.command)(async (id) => {
|
|
90
|
-
const client = await client_1.ApiClient.createAuthenticated();
|
|
91
|
-
const response = await client.request('GET', `/v1/platform/slides/${id}`);
|
|
92
|
-
if (!response.previewUrl) {
|
|
93
|
-
throw new runtime_1.CliError('No preview URL available for this slide', {
|
|
94
|
-
code: 'ENOPREVIEW',
|
|
95
|
-
exitCode: 1,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if ((0, runtime_1.isInteractive)())
|
|
99
|
-
await (0, open_1.default)(response.previewUrl);
|
|
100
|
-
(0, output_1.printResult)({ previewUrl: response.previewUrl });
|
|
101
|
-
(0, output_1.printStatus)('Opening in browser...', 'success');
|
|
102
|
-
}));
|
|
10
|
+
const slide = new commander_1.Command('slide').description('Generate and manage classroom slide decks');
|
|
11
|
+
(0, resource_1.addGenerateCommand)(slide, {
|
|
12
|
+
...SLIDES,
|
|
13
|
+
description: 'Generate a slide deck with every page (charged per page, like the slide editor)',
|
|
14
|
+
promptLabel: 'Describe the slide deck',
|
|
15
|
+
example: 'tutorflow slide generate "Photosynthesis" --count 8 --wait',
|
|
16
|
+
configure: (cmd) => cmd
|
|
17
|
+
.option('-n, --count <number>', 'Number of slides')
|
|
18
|
+
.option('-l, --language <lang>', 'Language code', 'en')
|
|
19
|
+
.option('-t, --theme <themeId>', 'Slide theme id')
|
|
20
|
+
.option('--instructions <text>', 'Extra instructions for the generator')
|
|
21
|
+
.option('--text-length <length>', 'Text per page: concise | detailed'),
|
|
22
|
+
buildBody: (topic, options) => ({
|
|
23
|
+
topic,
|
|
24
|
+
slideCount: (0, args_1.parsePositiveInt)(options.count, '--count'),
|
|
25
|
+
themeId: options.theme,
|
|
26
|
+
instructions: options.instructions,
|
|
27
|
+
textLength: options.textLength,
|
|
28
|
+
language: options.language,
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
(0, resource_1.addCrudCommands)(slide, SLIDES);
|
|
32
|
+
(0, sharing_1.addShareCommands)(slide, SLIDES, sharing_1.PUBLIC_PRIVATE);
|
|
103
33
|
return slide;
|
|
104
34
|
}
|
|
105
35
|
//# sourceMappingURL=slide.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.js","sourceRoot":"","sources":["../../src/commands/slide.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slide.js","sourceRoot":"","sources":["../../src/commands/slide.ts"],"names":[],"mappings":";;AAeA,oCA2BC;AA1CD,yCAAoC;AACpC,wCAAiD;AACjD,kDAA6F;AAC7F,gDAAsE;AAUtE,MAAM,MAAM,GAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAEpE,SAAgB,YAAY;IAC1B,MAAM,KAAK,GAAG,IAAI,mBAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,2CAA2C,CAAC,CAAC;IAE5F,IAAA,6BAAkB,EAAuB,KAAK,EAAE;QAC9C,GAAG,MAAM;QACT,WAAW,EAAE,iFAAiF;QAC9F,WAAW,EAAE,yBAAyB;QACtC,OAAO,EAAE,4DAA4D;QACrE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CACjB,GAAG;aACA,MAAM,CAAC,sBAAsB,EAAE,kBAAkB,CAAC;aAClD,MAAM,CAAC,uBAAuB,EAAE,eAAe,EAAE,IAAI,CAAC;aACtD,MAAM,CAAC,uBAAuB,EAAE,gBAAgB,CAAC;aACjD,MAAM,CAAC,uBAAuB,EAAE,sCAAsC,CAAC;aACvE,MAAM,CAAC,wBAAwB,EAAE,mCAAmC,CAAC;QAC1E,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;YAC9B,KAAK;YACL,UAAU,EAAE,IAAA,uBAAgB,EAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;YACtD,OAAO,EAAE,OAAO,CAAC,KAAK;YACtB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;KACH,CAAC,CAAC;IACH,IAAA,0BAAe,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAA,0BAAgB,EAAC,KAAK,EAAE,MAAM,EAAE,wBAAc,CAAC,CAAC;IAChD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC,wBAAgB,WAAW,IAAI,OAAO,CAiDrC"}
|