@tutorflow/cli 0.2.0 → 0.3.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 +220 -15
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/agent.d.ts +3 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +123 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/module.d.ts +3 -0
- package/dist/commands/module.d.ts.map +1 -0
- package/dist/commands/module.js +108 -0
- package/dist/commands/module.js.map +1 -0
- package/dist/commands/platform.d.ts +3 -0
- package/dist/commands/platform.d.ts.map +1 -0
- package/dist/commands/platform.js +36 -0
- package/dist/commands/platform.js.map +1 -0
- package/dist/commands/test.d.ts +3 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +119 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ Then anywhere on the system:
|
|
|
25
25
|
```bash
|
|
26
26
|
tutorflow --version
|
|
27
27
|
tutorflow auth login
|
|
28
|
+
tutorflow agent register --name "My Agent Workspace" --slug my-agent-workspace --email me@example.com
|
|
29
|
+
tutorflow --json platform manifest
|
|
28
30
|
tutorflow slide create "My first deck"
|
|
29
31
|
```
|
|
30
32
|
|
|
@@ -64,33 +66,36 @@ pnpm dev -- <command> [options]
|
|
|
64
66
|
|
|
65
67
|
## Releasing
|
|
66
68
|
|
|
67
|
-
Releases are
|
|
69
|
+
Releases are automated by GitHub Actions on pushes to `master` / `main`.
|
|
70
|
+
Auth uses **npm OIDC Trusted Publishing** — no `NPM_TOKEN` secret in CI.
|
|
68
71
|
|
|
69
72
|
```bash
|
|
70
73
|
git checkout master
|
|
71
74
|
git pull
|
|
72
75
|
|
|
73
|
-
npm version patch
|
|
74
|
-
git push origin master
|
|
76
|
+
npm version patch --no-git-tag-version # 0.3.0 → 0.3.1 (or minor / major)
|
|
77
|
+
git push origin master # Release workflow publishes if that version is not on npm yet
|
|
75
78
|
```
|
|
76
79
|
|
|
77
|
-
The [`Release` workflow](.github/workflows/release.yml)
|
|
80
|
+
The [`Release` workflow](.github/workflows/release.yml):
|
|
78
81
|
|
|
79
|
-
1.
|
|
80
|
-
2.
|
|
81
|
-
3. `
|
|
82
|
-
4.
|
|
82
|
+
1. Reads `package.json` name and version
|
|
83
|
+
2. Skips npm publish if that exact version already exists
|
|
84
|
+
3. Runs `pnpm typecheck` + `pnpm build` + `pnpm test`
|
|
85
|
+
4. Publishes new versions with `npm publish --access public` (auth via OIDC)
|
|
86
|
+
5. Creates a GitHub Release only for `v*.*.*` tag pushes
|
|
83
87
|
|
|
84
88
|
For full setup (npm org, Trusted Publisher config) see [RELEASING.md](RELEASING.md).
|
|
85
89
|
|
|
86
90
|
### Pre-release / beta
|
|
87
91
|
|
|
88
92
|
```bash
|
|
89
|
-
npm version prerelease --preid=beta
|
|
90
|
-
git push origin master
|
|
93
|
+
npm version prerelease --preid=beta --no-git-tag-version # 0.3.1 → 0.3.2-beta.0
|
|
94
|
+
git push origin master
|
|
91
95
|
```
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
Pre-release versions publish to a dist-tag derived from the prerelease id
|
|
98
|
+
(`0.3.1-beta.0` publishes with `--tag beta`).
|
|
94
99
|
|
|
95
100
|
## ⚠️ Caveats & gotchas
|
|
96
101
|
|
|
@@ -103,7 +108,7 @@ These tripped us up during initial setup. Read before changing release infrastru
|
|
|
103
108
|
|
|
104
109
|
### npm Trusted Publishing (OIDC)
|
|
105
110
|
|
|
106
|
-
- **npm CLI must be 11.5.1+** for OIDC auth. Node
|
|
111
|
+
- **npm CLI must be 11.5.1+** for OIDC auth. npm also requires a modern Node 22 runtime for trusted publishing, so the workflow uses Node 22.x and invokes `pnpm dlx npm@latest ...` for registry checks and publish. Do not replace that with the runner's bundled npm unless you verify its version supports OIDC trusted publishing.
|
|
107
112
|
- The Trusted Publisher binding at [npmjs.com/package/@tutorflow/cli/access](https://www.npmjs.com/package/@tutorflow/cli/access) hardcodes:
|
|
108
113
|
- GitHub org: `tutorflow-io`
|
|
109
114
|
- Repo: `cli`
|
|
@@ -119,8 +124,7 @@ These tripped us up during initial setup. Read before changing release infrastru
|
|
|
119
124
|
|
|
120
125
|
### Node + tooling
|
|
121
126
|
|
|
122
|
-
- **Vitest 4.x requires Node 20+** (uses `node:util.styleText`).
|
|
123
|
-
- `actions/setup-node@v4` and friends emit Node 20 deprecation warnings. They'll be force-upgraded to Node 24 on June 2, 2026.
|
|
127
|
+
- **Vitest 4.x requires Node 20+** (uses `node:util.styleText`). CI tests Node 20 and Node 22, while release publishing runs on Node 22 for npm OIDC. The runtime CLI itself still supports Node 18 (declared in `package.json#engines`).
|
|
124
128
|
|
|
125
129
|
### Tarball hygiene
|
|
126
130
|
|
|
@@ -203,6 +207,13 @@ The error JSON includes a stable `code`: `EAUTH`, `EINVAL`, `ENOINTERACTIVE`, `E
|
|
|
203
207
|
Commands that have required input expose every prompt as a flag:
|
|
204
208
|
|
|
205
209
|
```bash
|
|
210
|
+
# self-register a platform workspace and save the returned API key
|
|
211
|
+
tutorflow --json agent register \
|
|
212
|
+
--name "Agent Workspace" \
|
|
213
|
+
--slug agent-workspace \
|
|
214
|
+
--email agent@example.com \
|
|
215
|
+
--agent-identity "codex"
|
|
216
|
+
|
|
206
217
|
# slide / video / course create — accept positional [prompt]
|
|
207
218
|
tutorflow --json slide create "Photosynthesis" -n 12 -l en
|
|
208
219
|
tutorflow --json video create "Newton's laws" -s 6 -r 16:9 -d 90
|
|
@@ -287,6 +298,104 @@ tutorflow config set <key> <value> # update one key
|
|
|
287
298
|
All resource commands require authentication. Without an API key they print:
|
|
288
299
|
`✗ Not authenticated. Run "tutorflow auth login" first.`
|
|
289
300
|
|
|
301
|
+
### `tutorflow agent`
|
|
302
|
+
|
|
303
|
+
Manage the agent-facing TutorFlow Platform account flow.
|
|
304
|
+
|
|
305
|
+
#### `agent register`
|
|
306
|
+
|
|
307
|
+
Public self-service registration. Creates a platform workspace through
|
|
308
|
+
`POST /v1/platform/agent/register`, returns the one-time API key, and saves it
|
|
309
|
+
to `~/.tutorflow/config.json` by default so the next CLI command can run
|
|
310
|
+
without a separate `auth login`.
|
|
311
|
+
|
|
312
|
+
| Option | Type | Default | Description |
|
|
313
|
+
| ------------------------------ | -------- | ------- | -------------------------------------------- |
|
|
314
|
+
| `--name <name>` | `string` | — | Workspace display name |
|
|
315
|
+
| `--slug <slug>` | `string` | — | Unique lowercase slug |
|
|
316
|
+
| `--email <email>` | `string` | none | Contact email for verification and billing |
|
|
317
|
+
| `--agent-identity <identity>` | `string` | none | Optional agent identity string |
|
|
318
|
+
| `--no-save` | boolean | false | Print the API key but do not persist it |
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
tutorflow --json agent register \
|
|
322
|
+
--name "Agent Workspace" \
|
|
323
|
+
--slug agent-workspace \
|
|
324
|
+
--email agent@example.com \
|
|
325
|
+
--agent-identity "codex"
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### `agent account`
|
|
329
|
+
|
|
330
|
+
GET `/v1/platform/agent/account`. Shows workspace status, credit balance,
|
|
331
|
+
email verification state, rate limits, and `restrictedActions`.
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
tutorflow --json agent account
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
#### `agent billing status`
|
|
338
|
+
|
|
339
|
+
GET `/v1/platform/agent/billing/status`. Shows payment-method state, credit
|
|
340
|
+
balance, billing mode, email verification state, and `restrictedActions`.
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
tutorflow --json agent billing status
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
#### `agent billing session`
|
|
347
|
+
|
|
348
|
+
POST `/v1/platform/agent/billing/session`. Returns a TutorFlow-hosted checkout
|
|
349
|
+
URL that an agent should forward to a human operator.
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
tutorflow --json agent billing session
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### `agent verify-email resend`
|
|
356
|
+
|
|
357
|
+
POST `/v1/platform/agent/verify-email/resend`. Resends the workspace email
|
|
358
|
+
verification message using the active API key.
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
tutorflow --json agent verify-email resend
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
#### `agent checkout info`
|
|
365
|
+
|
|
366
|
+
GET `/v1/platform/agent/checkout?token=<token>`. Reads workspace info for a
|
|
367
|
+
TutorFlow checkout token returned through the hosted billing-session flow.
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
tutorflow --json agent checkout info --token checkout_123
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
#### `agent checkout create`
|
|
374
|
+
|
|
375
|
+
POST `/v1/platform/agent/checkout`. Creates a Stripe Checkout URL from a
|
|
376
|
+
TutorFlow checkout token and amount. This is normally called by the hosted
|
|
377
|
+
checkout page; CLI support exists for complete automation and testing.
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
tutorflow --json agent checkout create --token checkout_123 --amount-usd 25
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### `tutorflow platform`
|
|
384
|
+
|
|
385
|
+
Inspect public discovery metadata and validate the active Platform API key.
|
|
386
|
+
|
|
387
|
+
| Subcommand | Endpoint | Auth |
|
|
388
|
+
| ---------- | -------- | ---- |
|
|
389
|
+
| `manifest` | `GET /v1/platform/.well-known/agent.json` | none |
|
|
390
|
+
| `pricing` | `GET /v1/platform/pricing-catalog` | none |
|
|
391
|
+
| `health` | `GET /v1/platform/health` | Platform API key |
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
tutorflow --json platform manifest
|
|
395
|
+
tutorflow --json platform pricing
|
|
396
|
+
tutorflow --json platform health
|
|
397
|
+
```
|
|
398
|
+
|
|
290
399
|
### `tutorflow slide`
|
|
291
400
|
|
|
292
401
|
Create and manage slide decks.
|
|
@@ -428,6 +537,98 @@ Opens the course preview URL in the browser.
|
|
|
428
537
|
|
|
429
538
|
---
|
|
430
539
|
|
|
540
|
+
### `tutorflow module`
|
|
541
|
+
|
|
542
|
+
Create and manage standalone lesson modules.
|
|
543
|
+
|
|
544
|
+
#### `module create [prompt]`
|
|
545
|
+
|
|
546
|
+
POST `/v1/platform/modules`. Generates one classroom-compatible standalone
|
|
547
|
+
lesson. `--idempotency-key` is sent as the `Idempotency-Key` header so agents
|
|
548
|
+
can safely retry a create call.
|
|
549
|
+
|
|
550
|
+
| Argument / Option | Type | Default | Description |
|
|
551
|
+
| ------------------------------ | --------------------- | -------- | -------------------------------- |
|
|
552
|
+
| `[prompt]` | `string` (positional) | — | Lesson/module prompt |
|
|
553
|
+
| `--title <title>` | `string` | none | Override generated title |
|
|
554
|
+
| `--description <description>` | `string` | none | Override generated description |
|
|
555
|
+
| `--target <target>` | `string` | none | Target learner audience |
|
|
556
|
+
| `--type <type>` | `string` | `lesson` | Module type |
|
|
557
|
+
| `--locale <locale>` | `string` | `en` | Locale code |
|
|
558
|
+
| `--language <language>` | `string` | `en` | Language code |
|
|
559
|
+
| `--slug <slug>` | `string` | none | Optional slug |
|
|
560
|
+
| `--private` | boolean | false | Set `isPublic: false` |
|
|
561
|
+
| `--no-quiz` | boolean | false | Set `hasQuiz: false` |
|
|
562
|
+
| `--idempotency-key <key>` | `string` | none | Safe retry key |
|
|
563
|
+
|
|
564
|
+
```bash
|
|
565
|
+
tutorflow --json module create "Fractions for 5th grade" \
|
|
566
|
+
--title "Fractions" \
|
|
567
|
+
--target "5th grade" \
|
|
568
|
+
--no-quiz \
|
|
569
|
+
--idempotency-key lesson-001
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
#### `module list`
|
|
573
|
+
|
|
574
|
+
GET `/v1/platform/modules?limit=<n>&offset=<n>[&search=<q>]`.
|
|
575
|
+
|
|
576
|
+
```bash
|
|
577
|
+
tutorflow --json module list --limit 20 --offset 0 --search fractions
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
#### `module get <id>` / `module open <id>`
|
|
581
|
+
|
|
582
|
+
Fetch a module by ID or open its `publicUrl`.
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
### `tutorflow test`
|
|
587
|
+
|
|
588
|
+
Create and manage generated assessments.
|
|
589
|
+
|
|
590
|
+
#### `test create [prompt]`
|
|
591
|
+
|
|
592
|
+
POST `/v1/platform/tests`. Generates a test/assessment. `--idempotency-key` is
|
|
593
|
+
sent as the `Idempotency-Key` header.
|
|
594
|
+
|
|
595
|
+
| Argument / Option | Type | Default | Description |
|
|
596
|
+
| ------------------------- | --------------------- | ---------- | ------------------------------ |
|
|
597
|
+
| `[prompt]` | `string` (positional) | — | Test generation prompt |
|
|
598
|
+
| `--title <title>` | `string` | none | Override generated title |
|
|
599
|
+
| `--description <text>` | `string` | none | Override generated description |
|
|
600
|
+
| `-l, --language <lang>` | `string` | `en` | Language code |
|
|
601
|
+
| `--level <level>` | `string` | none | Difficulty level |
|
|
602
|
+
| `--subject <subject>` | `string` | none | Subject area |
|
|
603
|
+
| `-n, --items <number>` | `string -> int` | none | Target item count |
|
|
604
|
+
| `--time-limit <minutes>` | `string -> int` | none | Time limit in minutes |
|
|
605
|
+
| `--classroom-id <id>` | `string` | none | Classroom ID |
|
|
606
|
+
| `--tier <tier>` | `string` | `standard` | Pricing tier |
|
|
607
|
+
| `--mode <mode>` | `string` | `sync` | `sync` or `async` |
|
|
608
|
+
| `--idempotency-key <key>` | `string` | none | Safe retry key |
|
|
609
|
+
|
|
610
|
+
```bash
|
|
611
|
+
tutorflow --json test create "Algebra quiz" \
|
|
612
|
+
--title "Algebra Basics" \
|
|
613
|
+
--items 8 \
|
|
614
|
+
--time-limit 30 \
|
|
615
|
+
--idempotency-key test-001
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
#### `test list`
|
|
619
|
+
|
|
620
|
+
GET `/v1/platform/tests?limit=<n>&offset=<n>[&status=<s>]`.
|
|
621
|
+
|
|
622
|
+
```bash
|
|
623
|
+
tutorflow --json test list --limit 20 --status READY
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
#### `test get <id>` / `test open <id>` / `test edit-token <id>`
|
|
627
|
+
|
|
628
|
+
Fetch a test, open its preview URL, or generate a fresh edit token.
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
431
632
|
### `tutorflow evaluate`
|
|
432
633
|
|
|
433
634
|
Evaluates a single student response. Fully interactive; only the type can be passed as a flag.
|
|
@@ -502,7 +703,7 @@ class ApiClient {
|
|
|
502
703
|
├── vitest.config.ts
|
|
503
704
|
├── .github/workflows/
|
|
504
705
|
│ ├── ci.yml # typecheck + build + test on PRs and master
|
|
505
|
-
│ └── release.yml # OIDC publish on
|
|
706
|
+
│ └── release.yml # OIDC publish on master/main pushes when version is new
|
|
506
707
|
├── RELEASING.md # full release procedure + Trusted Publisher setup
|
|
507
708
|
└── src/
|
|
508
709
|
├── index.ts # commander entrypoint, registers all commands
|
|
@@ -512,11 +713,15 @@ class ApiClient {
|
|
|
512
713
|
├── config.test.ts
|
|
513
714
|
├── types.ts # API response interfaces (SlideResource, etc.)
|
|
514
715
|
├── commands/
|
|
716
|
+
│ ├── agent.ts # register / account / billing / email verification
|
|
515
717
|
│ ├── auth.ts # login / logout / whoami
|
|
516
718
|
│ ├── config.ts # get / set
|
|
517
719
|
│ ├── course.ts # create / list / open
|
|
518
720
|
│ ├── evaluate.ts # interactive evaluation
|
|
721
|
+
│ ├── module.ts # standalone lesson modules
|
|
722
|
+
│ ├── platform.ts # discovery / pricing / health
|
|
519
723
|
│ ├── slide.ts # create / list / open
|
|
724
|
+
│ ├── test.ts # generated assessments
|
|
520
725
|
│ └── video.ts # create / list / open
|
|
521
726
|
└── utils/
|
|
522
727
|
├── output.ts # formatTable, formatJson
|
package/dist/client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class ApiClient {
|
|
|
12
12
|
* "not authenticated" path.
|
|
13
13
|
*/
|
|
14
14
|
static createAuthenticated(): Promise<ApiClient>;
|
|
15
|
-
request<T>(method: string, endpoint: string, body?: Record<string, unknown>): Promise<T>;
|
|
15
|
+
request<T>(method: string, endpoint: string, body?: Record<string, unknown>, headers?: Record<string, string>): Promise<T>;
|
|
16
16
|
setApiKey(apiKey: string): void;
|
|
17
17
|
setBaseUrl(baseUrl: string): void;
|
|
18
18
|
}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAqBD,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,CAAC,EAAE,aAAa;WAIrB,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC;IAIzC;;;;OAIG;WACU,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC;IAWhD,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAqBD,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,CAAC,EAAE,aAAa;WAIrB,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC;IAIzC;;;;OAIG;WACU,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC;IAWhD,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC;IAwCb,SAAS,CAAC,MAAM,EAAE,MAAM;IAIxB,UAAU,CAAC,OAAO,EAAE,MAAM;CAG3B"}
|
package/dist/client.js
CHANGED
|
@@ -39,13 +39,14 @@ class ApiClient {
|
|
|
39
39
|
}
|
|
40
40
|
return new ApiClient(config);
|
|
41
41
|
}
|
|
42
|
-
async request(method, endpoint, body) {
|
|
42
|
+
async request(method, endpoint, body, headers) {
|
|
43
43
|
const url = `${this.config.baseUrl}${endpoint}`;
|
|
44
44
|
const init = {
|
|
45
45
|
method,
|
|
46
46
|
headers: {
|
|
47
47
|
'Content-Type': 'application/json',
|
|
48
48
|
'X-API-Key': this.config.apiKey,
|
|
49
|
+
...headers,
|
|
49
50
|
},
|
|
50
51
|
};
|
|
51
52
|
if (body)
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,mCAAyC;AACzC,qCAAsC;AACtC,6CAA2C;AAO3C,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD;;;;;;;GAOG;AACH,KAAK,UAAU,aAAa;IAC1B,MAAM,UAAU,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,UAAU,CAAC,MAAM,IAAI,EAAE;QAChE,OAAO,EACL,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,UAAU,CAAC,OAAO,IAAI,gBAAgB;KAC3E,CAAC;AACJ,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,EAAE,IAAI,EAAE,UAAU,EAAE,CACrB,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,IAAI,GAAY,IAAI,CAAC;QACzB,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,kCAAkC;QACpC,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,kBAAQ,CAChB,aAAa,QAAQ,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EACzF,EAAE,IAAI,EAAE,SAAS,QAAQ,CAAC,MAAM,EAAE,EAAE,CACrC,CAAC;QACJ,CAAC;QAED,OAAO,IAAS,CAAC;IACnB,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IAC9B,CAAC;IAED,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAChC,CAAC;CACF;AA/ED,8BA+EC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBpC,wBAAgB,YAAY,IAAI,OAAO,CAiKtC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentCommand = agentCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const prompts_1 = require("@clack/prompts");
|
|
6
|
+
const client_1 = require("../client");
|
|
7
|
+
const config_1 = require("../config");
|
|
8
|
+
const output_1 = require("../utils/output");
|
|
9
|
+
const runtime_1 = require("../utils/runtime");
|
|
10
|
+
const DEFAULT_BASE_URL = 'https://api.tutorflow.io';
|
|
11
|
+
function agentCommand() {
|
|
12
|
+
const agent = new commander_1.Command('agent').description('Manage TutorFlow agent platform account');
|
|
13
|
+
agent
|
|
14
|
+
.command('register')
|
|
15
|
+
.description('Self-register a TutorFlow Platform workspace and receive an API key')
|
|
16
|
+
.option('--name <name>', 'Workspace display name')
|
|
17
|
+
.option('--slug <slug>', 'Unique workspace slug')
|
|
18
|
+
.option('--email <email>', 'Contact email for the workspace')
|
|
19
|
+
.option('--agent-identity <identity>', 'Optional agent identity string')
|
|
20
|
+
.option('--no-save', 'Do not save the returned API key to ~/.tutorflow/config.json')
|
|
21
|
+
.action((0, runtime_1.command)(async (options) => {
|
|
22
|
+
const name = await requiredOptionOrPrompt(options.name, 'Workspace display name:', '--name <name>');
|
|
23
|
+
const slug = await requiredOptionOrPrompt(options.slug, 'Workspace slug:', '--slug <slug>');
|
|
24
|
+
const baseUrl = await resolveBaseUrl();
|
|
25
|
+
const client = await client_1.ApiClient.create();
|
|
26
|
+
const body = {
|
|
27
|
+
name,
|
|
28
|
+
slug,
|
|
29
|
+
email: options.email,
|
|
30
|
+
agentIdentity: options.agentIdentity,
|
|
31
|
+
};
|
|
32
|
+
Object.keys(body).forEach((key) => {
|
|
33
|
+
if (body[key] === undefined || body[key] === '')
|
|
34
|
+
delete body[key];
|
|
35
|
+
});
|
|
36
|
+
const response = await client.request('POST', '/v1/platform/agent/register', body);
|
|
37
|
+
if (options.save !== false) {
|
|
38
|
+
await (0, config_1.updateConfig)({ apiKey: response.apiKey, baseUrl });
|
|
39
|
+
}
|
|
40
|
+
(0, output_1.printResult)(response);
|
|
41
|
+
}));
|
|
42
|
+
agent
|
|
43
|
+
.command('account')
|
|
44
|
+
.description('Show the authenticated agent account')
|
|
45
|
+
.action((0, runtime_1.command)(async () => {
|
|
46
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
47
|
+
const response = await client.request('GET', '/v1/platform/agent/account');
|
|
48
|
+
(0, output_1.printResult)(response);
|
|
49
|
+
}));
|
|
50
|
+
const billing = new commander_1.Command('billing').description('Manage agent billing');
|
|
51
|
+
billing
|
|
52
|
+
.command('status')
|
|
53
|
+
.description('Show billing status and currently restricted actions')
|
|
54
|
+
.action((0, runtime_1.command)(async () => {
|
|
55
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
56
|
+
const response = await client.request('GET', '/v1/platform/agent/billing/status');
|
|
57
|
+
(0, output_1.printResult)(response);
|
|
58
|
+
}));
|
|
59
|
+
billing
|
|
60
|
+
.command('session')
|
|
61
|
+
.description('Create a TutorFlow-hosted checkout session URL')
|
|
62
|
+
.action((0, runtime_1.command)(async () => {
|
|
63
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
64
|
+
const response = await client.request('POST', '/v1/platform/agent/billing/session');
|
|
65
|
+
(0, output_1.printResult)(response);
|
|
66
|
+
}));
|
|
67
|
+
agent.addCommand(billing);
|
|
68
|
+
const checkout = new commander_1.Command('checkout').description('Use public checkout token endpoints');
|
|
69
|
+
checkout
|
|
70
|
+
.command('info')
|
|
71
|
+
.description('Read workspace info for a TutorFlow checkout token')
|
|
72
|
+
.requiredOption('--token <token>', 'Checkout token from agent billing session URL')
|
|
73
|
+
.action((0, runtime_1.command)(async (options) => {
|
|
74
|
+
const client = await client_1.ApiClient.create();
|
|
75
|
+
const qs = new URLSearchParams({ token: options.token });
|
|
76
|
+
const response = await client.request('GET', `/v1/platform/agent/checkout?${qs.toString()}`);
|
|
77
|
+
(0, output_1.printResult)(response);
|
|
78
|
+
}));
|
|
79
|
+
checkout
|
|
80
|
+
.command('create')
|
|
81
|
+
.description('Create a Stripe Checkout URL from a TutorFlow checkout token')
|
|
82
|
+
.requiredOption('--token <token>', 'Checkout token from agent billing session URL')
|
|
83
|
+
.requiredOption('--amount-usd <amount>', 'Top-up amount in USD')
|
|
84
|
+
.action((0, runtime_1.command)(async (options) => {
|
|
85
|
+
const amountUsd = Number.parseFloat(options.amountUsd);
|
|
86
|
+
if (!Number.isFinite(amountUsd)) {
|
|
87
|
+
throw new runtime_1.CliError('--amount-usd must be a number', {
|
|
88
|
+
code: 'EINVAL',
|
|
89
|
+
exitCode: 2,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const client = await client_1.ApiClient.create();
|
|
93
|
+
const response = await client.request('POST', '/v1/platform/agent/checkout', { token: options.token, amountUsd });
|
|
94
|
+
(0, output_1.printResult)(response);
|
|
95
|
+
}));
|
|
96
|
+
agent.addCommand(checkout);
|
|
97
|
+
const verifyEmail = new commander_1.Command('verify-email').description('Manage agent email verification');
|
|
98
|
+
verifyEmail
|
|
99
|
+
.command('resend')
|
|
100
|
+
.description('Resend the platform email verification message')
|
|
101
|
+
.action((0, runtime_1.command)(async () => {
|
|
102
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
103
|
+
const response = await client.request('POST', '/v1/platform/agent/verify-email/resend');
|
|
104
|
+
(0, output_1.printResult)(response);
|
|
105
|
+
}));
|
|
106
|
+
agent.addCommand(verifyEmail);
|
|
107
|
+
return agent;
|
|
108
|
+
}
|
|
109
|
+
async function requiredOptionOrPrompt(value, message, flagHint) {
|
|
110
|
+
if (value?.trim())
|
|
111
|
+
return value.trim();
|
|
112
|
+
(0, runtime_1.requireInteractive)(`Pass ${flagHint}.`);
|
|
113
|
+
const result = await (0, prompts_1.text)({ message });
|
|
114
|
+
if (!result || typeof result === 'symbol') {
|
|
115
|
+
throw new runtime_1.CliError('Cancelled', { code: 'ECANCELLED', exitCode: 130 });
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
async function resolveBaseUrl() {
|
|
120
|
+
const fileConfig = await (0, config_1.readConfig)();
|
|
121
|
+
return process.env.TUTORFLOW_BASE_URL ?? fileConfig.baseUrl ?? DEFAULT_BASE_URL;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":";;AAuBA,oCAiKC;AAxLD,yCAAoC;AACpC,4CAAsC;AACtC,sCAAsC;AACtC,sCAAqD;AACrD,4CAA8C;AAC9C,8CAAyE;AAQzE,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAUpD,SAAgB,YAAY;IAC1B,MAAM,KAAK,GAAG,IAAI,mBAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,yCAAyC,CAAC,CAAC;IAE1F,KAAK;SACF,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC;SACjD,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC;SAChD,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC;SAC5D,MAAM,CAAC,6BAA6B,EAAE,gCAAgC,CAAC;SACvE,MAAM,CAAC,WAAW,EAAE,8DAA8D,CAAC;SACnF,MAAM,CACL,IAAA,iBAAO,EAAC,KAAK,EAAE,OAA6B,EAAE,EAAE;QAC9C,MAAM,IAAI,GAAG,MAAM,sBAAsB,CACvC,OAAO,CAAC,IAAI,EACZ,yBAAyB,EACzB,eAAe,CAChB,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,sBAAsB,CACvC,OAAO,CAAC,IAAI,EACZ,iBAAiB,EACjB,eAAe,CAChB,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,cAAc,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,kBAAS,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,IAAI,GAA4B;YACpC,IAAI;YACJ,IAAI;YACJ,KAAK,EAAE,OAAO,CAA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C;QACF,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;IACxB,CAAC,CAAC,CACH,CAAC;IAEJ,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,KAAK,UAAU,sBAAsB,CACnC,KAAyB,EACzB,OAAe,EACf,QAAgB;IAEhB,IAAI,KAAK,EAAE,IAAI,EAAE;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;IAEvC,IAAA,4BAAkB,EAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,IAAA,cAAI,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,kBAAQ,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,cAAc;IAC3B,MAAM,UAAU,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;IACtC,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,UAAU,CAAC,OAAO,IAAI,gBAAgB,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/commands/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BpC,wBAAgB,aAAa,IAAI,OAAO,CAsGvC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.moduleCommand = moduleCommand;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const prompts_1 = require("@clack/prompts");
|
|
9
|
+
const open_1 = __importDefault(require("open"));
|
|
10
|
+
const client_1 = require("../client");
|
|
11
|
+
const output_1 = require("../utils/output");
|
|
12
|
+
const runtime_1 = require("../utils/runtime");
|
|
13
|
+
function moduleCommand() {
|
|
14
|
+
const module = new commander_1.Command('module').description('Manage standalone lesson modules');
|
|
15
|
+
module
|
|
16
|
+
.command('create')
|
|
17
|
+
.argument('[prompt]', 'Prompt describing the standalone lesson module')
|
|
18
|
+
.option('--title <title>', 'Override generated title')
|
|
19
|
+
.option('--description <description>', 'Override generated description')
|
|
20
|
+
.option('--target <target>', 'Target learner audience')
|
|
21
|
+
.option('--type <type>', 'Module type', 'lesson')
|
|
22
|
+
.option('--locale <locale>', 'Locale code', 'en')
|
|
23
|
+
.option('--language <language>', 'Language code', 'en')
|
|
24
|
+
.option('--slug <slug>', 'Optional module slug')
|
|
25
|
+
.option('--private', 'Create as non-public')
|
|
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,
|
|
37
|
+
type: options.type,
|
|
38
|
+
locale: options.locale,
|
|
39
|
+
language: options.language,
|
|
40
|
+
slug: options.slug,
|
|
41
|
+
isPublic: options.private ? false : true,
|
|
42
|
+
hasQuiz: options.quiz,
|
|
43
|
+
}), idempotencyHeaders(options.idempotencyKey));
|
|
44
|
+
(0, output_1.printResult)(response);
|
|
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
|
+
}));
|
|
88
|
+
return module;
|
|
89
|
+
}
|
|
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
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/commands/module.ts"],"names":[],"mappings":";;;;;AA4BA,sCAsGC;AAlID,yCAAoC;AACpC,4CAAsC;AACtC,gDAAwB;AACxB,sCAAsC;AACtC,4CAA2D;AAC3D,8CAAwF;AAuBxF,SAAgB,aAAa;IAC3B,MAAM,MAAM,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,kCAAkC,CAAC,CAAC;IAErF,MAAM;SACH,OAAO,CAAC,QAAQ,CAAC;SACjB,QAAQ,CAAC,UAAU,EAAE,gDAAgD,CAAC;SACtE,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;SACrD,MAAM,CAA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M,MAAM,GAAG,MAAM,IAAA,cAAI,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,kBAAQ,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,KAA8B;IAC7C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC,CACjF,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAuB;IACjD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +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,CA2CzC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.platformCommand = platformCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const client_1 = require("../client");
|
|
6
|
+
const output_1 = require("../utils/output");
|
|
7
|
+
const runtime_1 = require("../utils/runtime");
|
|
8
|
+
function platformCommand() {
|
|
9
|
+
const platform = new commander_1.Command('platform').description('Inspect TutorFlow Platform metadata');
|
|
10
|
+
platform
|
|
11
|
+
.command('manifest')
|
|
12
|
+
.description('Read the public agent discovery manifest')
|
|
13
|
+
.action((0, runtime_1.command)(async () => {
|
|
14
|
+
const client = await client_1.ApiClient.create();
|
|
15
|
+
const response = await client.request('GET', '/v1/platform/.well-known/agent.json');
|
|
16
|
+
(0, output_1.printResult)(response);
|
|
17
|
+
}));
|
|
18
|
+
platform
|
|
19
|
+
.command('pricing')
|
|
20
|
+
.description('Read the public platform pricing catalog')
|
|
21
|
+
.action((0, runtime_1.command)(async () => {
|
|
22
|
+
const client = await client_1.ApiClient.create();
|
|
23
|
+
const response = await client.request('GET', '/v1/platform/pricing-catalog');
|
|
24
|
+
(0, output_1.printResult)(response);
|
|
25
|
+
}));
|
|
26
|
+
platform
|
|
27
|
+
.command('health')
|
|
28
|
+
.description('Check the active Platform API key')
|
|
29
|
+
.action((0, runtime_1.command)(async () => {
|
|
30
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
31
|
+
const response = await client.request('GET', '/v1/platform/health');
|
|
32
|
+
(0, output_1.printResult)(response);
|
|
33
|
+
}));
|
|
34
|
+
return platform;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/commands/platform.ts"],"names":[],"mappings":";;AAKA,0CA2CC;AAhDD,yCAAoC;AACpC,sCAAsC;AACtC,4CAA8C;AAC9C,8CAA2C;AAE3C,SAAgB,eAAe;IAC7B,MAAM,QAAQ,GAAG,IAAI,mBAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IAE5F,QAAQ;SACL,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,0CAA0C,CAAC;SACvD,MAAM,CACL,IAAA,iBAAO,EAAC,KAAK,IAAI,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,kBAAS,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,KAAK,EACL,qCAAqC,CACtC,CAAC;QACF,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;IACxB,CAAC,CAAC,CACH,CAAC;IAEJ,QAAQ;SACL,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,0CAA0C,CAAC;SACvD,MAAM,CACL,IAAA,iBAAO,EAAC,KAAK,IAAI,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,kBAAS,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAY,KAAK,EAAE,8BAA8B,CAAC,CAAC;QACxF,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;IACxB,CAAC,CAAC,CACH,CAAC;IAEJ,QAAQ;SACL,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,mCAAmC,CAAC;SAChD,MAAM,CACL,IAAA,iBAAO,EAAC,KAAK,IAAI,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,kBAAS,CAAC,mBAAmB,EAAE,CAAC;QACrD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,KAAK,EACL,qBAAqB,CACtB,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":"test.d.ts","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,wBAAgB,WAAW,IAAI,OAAO,CAuHrC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.testCommand = testCommand;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const prompts_1 = require("@clack/prompts");
|
|
9
|
+
const open_1 = __importDefault(require("open"));
|
|
10
|
+
const client_1 = require("../client");
|
|
11
|
+
const output_1 = require("../utils/output");
|
|
12
|
+
const runtime_1 = require("../utils/runtime");
|
|
13
|
+
function testCommand() {
|
|
14
|
+
const test = new commander_1.Command('test').description('Manage generated tests');
|
|
15
|
+
test
|
|
16
|
+
.command('create')
|
|
17
|
+
.argument('[prompt]', 'Prompt describing the test to generate')
|
|
18
|
+
.option('--title <title>', 'Override generated title')
|
|
19
|
+
.option('--description <description>', 'Override generated description')
|
|
20
|
+
.option('-l, --language <language>', 'Language code', 'en')
|
|
21
|
+
.option('--level <level>', 'Difficulty level')
|
|
22
|
+
.option('--subject <subject>', 'Subject area')
|
|
23
|
+
.option('-n, --items <number>', 'Target number of test items')
|
|
24
|
+
.option('--time-limit <minutes>', 'Time limit in minutes')
|
|
25
|
+
.option('--classroom-id <id>', 'Classroom ID to create the test in')
|
|
26
|
+
.option('--tier <tier>', 'Pricing tier', 'standard')
|
|
27
|
+
.option('--mode <mode>', 'Execution mode: sync or async', 'sync')
|
|
28
|
+
.option('--idempotency-key <key>', 'Idempotency key for safe retries')
|
|
29
|
+
.option('--open', 'Open the preview URL in a browser when done (TTY only)')
|
|
30
|
+
.action((0, runtime_1.command)(async (prompt, options) => {
|
|
31
|
+
const testPrompt = await promptOrThrow(prompt, 'Describe the test to generate:', 'Pass a prompt argument: tutorflow test create "Algebra quiz"');
|
|
32
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
33
|
+
const response = await client.request('POST', '/v1/platform/tests', compact({
|
|
34
|
+
prompt: testPrompt,
|
|
35
|
+
title: options.title,
|
|
36
|
+
description: options.description,
|
|
37
|
+
language: options.language,
|
|
38
|
+
level: options.level,
|
|
39
|
+
subject: options.subject,
|
|
40
|
+
itemCount: options.items ? parseInt(options.items, 10) : undefined,
|
|
41
|
+
timeLimit: options.timeLimit ? parseInt(options.timeLimit, 10) : undefined,
|
|
42
|
+
classroomId: options.classroomId,
|
|
43
|
+
tier: options.tier,
|
|
44
|
+
mode: options.mode,
|
|
45
|
+
}), idempotencyHeaders(options.idempotencyKey));
|
|
46
|
+
(0, output_1.printResult)(response);
|
|
47
|
+
if (options.open && response.previewUrl && (0, runtime_1.isInteractive)()) {
|
|
48
|
+
await (0, open_1.default)(response.previewUrl);
|
|
49
|
+
(0, output_1.printStatus)('Opening in browser...', 'success');
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
test
|
|
53
|
+
.command('list')
|
|
54
|
+
.option('-l, --limit <number>', 'Number of results', '20')
|
|
55
|
+
.option('-o, --offset <number>', 'Number of rows to skip', '0')
|
|
56
|
+
.option('-s, --status <status>', 'Filter by status')
|
|
57
|
+
.action((0, runtime_1.command)(async (options) => {
|
|
58
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
59
|
+
const qs = new URLSearchParams({ limit: options.limit, offset: options.offset });
|
|
60
|
+
if (options.status)
|
|
61
|
+
qs.set('status', options.status);
|
|
62
|
+
const response = await client.request('GET', `/v1/platform/tests?${qs.toString()}`);
|
|
63
|
+
(0, output_1.printResult)(response);
|
|
64
|
+
}));
|
|
65
|
+
test
|
|
66
|
+
.command('get <id>')
|
|
67
|
+
.description('Fetch a single test by ID')
|
|
68
|
+
.action((0, runtime_1.command)(async (id) => {
|
|
69
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
70
|
+
const response = await client.request('GET', `/v1/platform/tests/${id}`);
|
|
71
|
+
(0, output_1.printResult)(response);
|
|
72
|
+
}));
|
|
73
|
+
test
|
|
74
|
+
.command('edit-token <id>')
|
|
75
|
+
.description('Generate a fresh edit token for a test')
|
|
76
|
+
.action((0, runtime_1.command)(async (id) => {
|
|
77
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
78
|
+
const response = await client.request('POST', `/v1/platform/tests/${id}/edit-token`);
|
|
79
|
+
(0, output_1.printResult)(response);
|
|
80
|
+
}));
|
|
81
|
+
test
|
|
82
|
+
.command('open <id>')
|
|
83
|
+
.description('Open a test preview URL in the browser')
|
|
84
|
+
.action((0, runtime_1.command)(async (id) => {
|
|
85
|
+
const client = await client_1.ApiClient.createAuthenticated();
|
|
86
|
+
const response = await client.request('GET', `/v1/platform/tests/${id}`);
|
|
87
|
+
const url = response.previewUrl ?? response.publicUrl;
|
|
88
|
+
if (!url) {
|
|
89
|
+
throw new runtime_1.CliError('No preview URL available for this test', {
|
|
90
|
+
code: 'ENOPREVIEW',
|
|
91
|
+
exitCode: 1,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if ((0, runtime_1.isInteractive)())
|
|
95
|
+
await (0, open_1.default)(url);
|
|
96
|
+
(0, output_1.printResult)({ previewUrl: url });
|
|
97
|
+
(0, output_1.printStatus)('Opening in browser...', 'success');
|
|
98
|
+
}));
|
|
99
|
+
return test;
|
|
100
|
+
}
|
|
101
|
+
async function promptOrThrow(value, message, hint) {
|
|
102
|
+
if (value?.trim())
|
|
103
|
+
return value.trim();
|
|
104
|
+
(0, runtime_1.requireInteractive)(hint);
|
|
105
|
+
const result = await (0, prompts_1.text)({ message });
|
|
106
|
+
if (!result || typeof result === 'symbol') {
|
|
107
|
+
throw new runtime_1.CliError('Cancelled', { code: 'ECANCELLED', exitCode: 130 });
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
function compact(input) {
|
|
112
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined && value !== ''));
|
|
113
|
+
}
|
|
114
|
+
function idempotencyHeaders(key) {
|
|
115
|
+
if (!key)
|
|
116
|
+
return undefined;
|
|
117
|
+
return { 'Idempotency-Key': key };
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"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,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,KAA8B;IAC7C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC,CACjF,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAuB;IACjD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC;AACpC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,10 @@ const video_1 = require("./commands/video");
|
|
|
8
8
|
const course_1 = require("./commands/course");
|
|
9
9
|
const evaluate_1 = require("./commands/evaluate");
|
|
10
10
|
const config_1 = require("./commands/config");
|
|
11
|
+
const agent_1 = require("./commands/agent");
|
|
12
|
+
const module_1 = require("./commands/module");
|
|
13
|
+
const test_1 = require("./commands/test");
|
|
14
|
+
const platform_1 = require("./commands/platform");
|
|
11
15
|
const runtime_1 = require("./utils/runtime");
|
|
12
16
|
const package_json_1 = require("../package.json");
|
|
13
17
|
commander_1.program
|
|
@@ -29,6 +33,10 @@ commander_1.program.addCommand((0, video_1.videoCommand)());
|
|
|
29
33
|
commander_1.program.addCommand((0, course_1.courseCommand)());
|
|
30
34
|
commander_1.program.addCommand((0, evaluate_1.evaluateCommand)());
|
|
31
35
|
commander_1.program.addCommand((0, config_1.configCommand)());
|
|
36
|
+
commander_1.program.addCommand((0, agent_1.agentCommand)());
|
|
37
|
+
commander_1.program.addCommand((0, module_1.moduleCommand)());
|
|
38
|
+
commander_1.program.addCommand((0, test_1.testCommand)());
|
|
39
|
+
commander_1.program.addCommand((0, platform_1.platformCommand)());
|
|
32
40
|
commander_1.program.parseAsync(process.argv).catch(() => {
|
|
33
41
|
// commander already prints its own errors; keep this as a safety net.
|
|
34
42
|
process.exit(1);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,0CAA8C;AAC9C,4CAAgD;AAChD,4CAAgD;AAChD,8CAAkD;AAClD,kDAAsD;AACtD,8CAAkD;AAClD,6CAA4D;AAC5D,kDAA0C;AAE1C,mBAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,uDAAuD,CAAC;KACpE,OAAO,CAAC,sBAAO,CAAC;KAChB,MAAM,CAAC,QAAQ,EAAE,2DAA2D,CAAC;KAC7E,MAAM,CAAC,SAAS,EAAE,iDAAiD,CAAC;KACpE,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE;IACzB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACxB,IAAI,IAAI,CAAC,IAAI;QAAE,IAAA,qBAAW,EAAC,IAAI,CAAC,CAAC;IACjC,IAAI,IAAI,CAAC,KAAK;QAAE,IAAA,sBAAY,EAAC,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEL,mBAAO,CAAC,UAAU,CAAC,IAAA,kBAAW,GAAE,CAAC,CAAC;AAClC,mBAAO,CAAC,UAAU,CAAC,IAAA,oBAAY,GAAE,CAAC,CAAC;AACnC,mBAAO,CAAC,UAAU,CAAC,IAAA,oBAAY,GAAE,CAAC,CAAC;AACnC,mBAAO,CAAC,UAAU,CAAC,IAAA,sBAAa,GAAE,CAAC,CAAC;AACpC,mBAAO,CAAC,UAAU,CAAC,IAAA,0BAAe,GAAE,CAAC,CAAC;AACtC,mBAAO,CAAC,UAAU,CAAC,IAAA,sBAAa,GAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","s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AAU,CAAC,IAAA,kBAAW,GAAE,CAAC,CAAC;AAClC,mBAAO,CAAC,UAAU,CAAC,IAAA,0BAAe,GAAE,CAAC,CAAC;AAEtC,mBAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;IAC1C,sEAAsE;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,mBAAO,CAAC,UAAU,EAAE,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -31,4 +31,79 @@ export interface EvaluationResponse {
|
|
|
31
31
|
[key: string]: unknown;
|
|
32
32
|
}
|
|
33
33
|
export type EvaluationType = 'exact' | 'rubric' | 'open-ended';
|
|
34
|
+
export interface AgentRegisterResponse {
|
|
35
|
+
organizationId: string;
|
|
36
|
+
apiKey: string;
|
|
37
|
+
keyPrefix: string;
|
|
38
|
+
trialCredits: number;
|
|
39
|
+
message: string;
|
|
40
|
+
requiresEmailVerification: boolean;
|
|
41
|
+
verifyEmailResendEndpoint: string;
|
|
42
|
+
nextSteps: {
|
|
43
|
+
createSlide: string;
|
|
44
|
+
createVideo: string;
|
|
45
|
+
accountInfo: string;
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
};
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
export interface AgentAccountResponse {
|
|
51
|
+
organizationId: string;
|
|
52
|
+
name: string;
|
|
53
|
+
slug: string;
|
|
54
|
+
status: string;
|
|
55
|
+
creditBalance: number;
|
|
56
|
+
rateLimitPerMinute: number;
|
|
57
|
+
isEmailVerified: boolean;
|
|
58
|
+
restrictedActions: string[];
|
|
59
|
+
createdAt: string;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
export interface AgentBillingSessionResponse {
|
|
63
|
+
url: string;
|
|
64
|
+
sessionId: string;
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
export interface AgentBillingStatusResponse {
|
|
68
|
+
hasPaymentMethod: boolean;
|
|
69
|
+
cardBrand: string | null;
|
|
70
|
+
cardLast4: string | null;
|
|
71
|
+
creditBalance: number;
|
|
72
|
+
billingMode: string;
|
|
73
|
+
isEmailVerified: boolean;
|
|
74
|
+
restrictedActions: string[];
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
}
|
|
77
|
+
export interface ModuleResource {
|
|
78
|
+
id: string;
|
|
79
|
+
title?: string | null;
|
|
80
|
+
description?: string | null;
|
|
81
|
+
type?: string;
|
|
82
|
+
status?: string | null;
|
|
83
|
+
publicUrl?: string | null;
|
|
84
|
+
shareToken?: string;
|
|
85
|
+
createdAt?: string;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
}
|
|
88
|
+
export interface ModuleListResponse {
|
|
89
|
+
items: ModuleResource[];
|
|
90
|
+
total: number;
|
|
91
|
+
[key: string]: unknown;
|
|
92
|
+
}
|
|
93
|
+
export interface TestResource {
|
|
94
|
+
id: string;
|
|
95
|
+
status: string;
|
|
96
|
+
title?: string | null;
|
|
97
|
+
description?: string | null;
|
|
98
|
+
itemCount?: number | null;
|
|
99
|
+
previewUrl?: string | null;
|
|
100
|
+
publicUrl?: string | null;
|
|
101
|
+
createdAt?: string;
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
export interface TestListResponse {
|
|
105
|
+
items: TestResource[];
|
|
106
|
+
total: number;
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
}
|
|
34
109
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"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AC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tutorflow/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "TutorFlow CLI - agent-friendly tool for creating AI-powered educational content (slides, videos, courses) and evaluating student responses. Supports --json output, env-var auth, and non-interactive use.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tutorflow",
|