@learnpack/learnpack 5.0.355 → 5.0.358
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/lib/commands/publish.js +2 -2
- package/lib/commands/serve.d.ts +0 -17
- package/lib/commands/serve.js +252 -147
- package/lib/creatorDist/assets/{index-DnthLsvb.js → index-D6pmbMe9.js} +14030 -13903
- package/lib/creatorDist/assets/index-zrPponAn.css +1701 -0
- package/lib/creatorDist/index.html +2 -2
- package/lib/models/creator.d.ts +1 -1
- package/lib/services/ingest/adapters/gcsCourseStorage.d.ts +13 -0
- package/lib/services/ingest/adapters/gcsCourseStorage.js +58 -0
- package/lib/services/ingest/adapters/rigoUserTokenAuth.d.ts +15 -0
- package/lib/services/ingest/adapters/rigoUserTokenAuth.js +46 -0
- package/lib/services/ingest/adapters/rigobotPackageRegistry.d.ts +7 -0
- package/lib/services/ingest/adapters/rigobotPackageRegistry.js +119 -0
- package/lib/services/ingest/core/buildIngestConfig.d.ts +27 -0
- package/lib/services/ingest/core/buildIngestConfig.js +40 -0
- package/lib/services/ingest/core/buildInitialSyllabus.d.ts +24 -0
- package/lib/services/ingest/core/buildInitialSyllabus.js +104 -0
- package/lib/services/ingest/core/buildSidebar.d.ts +13 -0
- package/lib/services/ingest/core/buildSidebar.js +28 -0
- package/lib/services/ingest/core/coursePaths.d.ts +31 -0
- package/lib/services/ingest/core/coursePaths.js +50 -0
- package/lib/services/ingest/core/ingestCoursePackage.d.ts +52 -0
- package/lib/services/ingest/core/ingestCoursePackage.js +217 -0
- package/lib/services/ingest/core/normalizeLearnJson.d.ts +25 -0
- package/lib/services/ingest/core/normalizeLearnJson.js +29 -0
- package/lib/services/ingest/core/pairLessons.d.ts +29 -0
- package/lib/services/ingest/core/pairLessons.js +102 -0
- package/lib/services/ingest/core/planWrites.d.ts +44 -0
- package/lib/services/ingest/core/planWrites.js +59 -0
- package/lib/services/ingest/core/resolveSlug.d.ts +53 -0
- package/lib/services/ingest/core/resolveSlug.js +93 -0
- package/lib/services/ingest/core/types.d.ts +53 -0
- package/lib/services/ingest/core/types.js +2 -0
- package/lib/services/ingest/core/validatePackage.d.ts +38 -0
- package/lib/services/ingest/core/validatePackage.js +97 -0
- package/lib/services/ingest/createIngestService.d.ts +34 -0
- package/lib/services/ingest/createIngestService.js +38 -0
- package/lib/services/ingest/errors.d.ts +22 -0
- package/lib/services/ingest/errors.js +34 -0
- package/lib/services/ingest/http/errorMapping.d.ts +8 -0
- package/lib/services/ingest/http/errorMapping.js +40 -0
- package/lib/services/ingest/http/router.d.ts +32 -0
- package/lib/services/ingest/http/router.js +124 -0
- package/lib/services/ingest/http/zipPackageReader.d.ts +26 -0
- package/lib/services/ingest/http/zipPackageReader.js +62 -0
- package/lib/services/ingest/ports/courseStorage.d.ts +25 -0
- package/lib/services/ingest/ports/courseStorage.js +2 -0
- package/lib/services/ingest/ports/packageRegistry.d.ts +58 -0
- package/lib/services/ingest/ports/packageRegistry.js +2 -0
- package/lib/services/ingest/ports/requestAuthenticator.d.ts +25 -0
- package/lib/services/ingest/ports/requestAuthenticator.js +2 -0
- package/lib/ui/static/og-image.png +0 -0
- package/lib/utils/branding.d.ts +43 -0
- package/lib/utils/branding.js +75 -0
- package/lib/utils/coursePackage/bucketIo.d.ts +23 -0
- package/lib/utils/coursePackage/bucketIo.js +36 -0
- package/lib/utils/coursePackage/learnJson.d.ts +26 -0
- package/lib/utils/coursePackage/learnJson.js +36 -0
- package/lib/utils/coursePackage/sidebar.d.ts +15 -0
- package/lib/utils/coursePackage/sidebar.js +26 -0
- package/lib/utils/creatorSocket.js +15 -21
- package/lib/utils/gcpCredentials.d.ts +18 -0
- package/lib/utils/gcpCredentials.js +27 -0
- package/lib/utils/rigoActions.d.ts +16 -0
- package/lib/utils/rigoActions.js +102 -1
- package/lib/utils/socketRegistry.d.ts +46 -0
- package/lib/utils/socketRegistry.js +83 -0
- package/package.json +2 -2
- package/src/commands/publish.ts +2 -3
- package/src/commands/serve.ts +297 -136
- package/src/creator/README.md +63 -51
- package/src/creator/package-lock.json +1188 -8
- package/src/creator/package.json +5 -1
- package/src/creator/src/App.tsx +120 -54
- package/src/creator/src/components/FileUploader.tsx +1 -12
- package/src/creator/src/components/NotificationListener.tsx +1 -8
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +101 -36
- package/src/creator/src/locales/en.json +8 -0
- package/src/creator/src/locales/es.json +8 -0
- package/src/creator/src/utils/completionResult.test.ts +144 -0
- package/src/creator/src/utils/completionResult.ts +154 -0
- package/src/creator/src/utils/constants.ts +17 -4
- package/src/creator/src/utils/socket.test.ts +113 -0
- package/src/creator/src/utils/socket.ts +60 -37
- package/src/creator/src/utils/store.ts +84 -67
- package/src/creator/src/utils/useCompletionWatchdog.test.ts +99 -0
- package/src/creator/src/utils/useCompletionWatchdog.ts +37 -0
- package/src/creator/vitest.config.ts +16 -0
- package/src/creatorDist/assets/{index-DnthLsvb.js → index-D6pmbMe9.js} +14030 -13903
- package/src/creatorDist/assets/index-zrPponAn.css +1701 -0
- package/src/creatorDist/index.html +2 -2
- package/src/models/creator.ts +1 -1
- package/src/services/ingest/adapters/gcsCourseStorage.ts +70 -0
- package/src/services/ingest/adapters/rigoUserTokenAuth.ts +65 -0
- package/src/services/ingest/adapters/rigobotPackageRegistry.ts +161 -0
- package/src/services/ingest/core/buildIngestConfig.ts +51 -0
- package/src/services/ingest/core/buildInitialSyllabus.ts +122 -0
- package/src/services/ingest/core/buildSidebar.ts +32 -0
- package/src/services/ingest/core/coursePaths.ts +59 -0
- package/src/services/ingest/core/ingestCoursePackage.ts +343 -0
- package/src/services/ingest/core/normalizeLearnJson.ts +47 -0
- package/src/services/ingest/core/pairLessons.ts +132 -0
- package/src/services/ingest/core/planWrites.ts +91 -0
- package/src/services/ingest/core/resolveSlug.ts +119 -0
- package/src/services/ingest/core/types.ts +57 -0
- package/src/services/ingest/core/validatePackage.ts +132 -0
- package/src/services/ingest/createIngestService.ts +66 -0
- package/src/services/ingest/errors.ts +45 -0
- package/src/services/ingest/http/errorMapping.ts +49 -0
- package/src/services/ingest/http/router.ts +156 -0
- package/src/services/ingest/http/zipPackageReader.ts +81 -0
- package/src/services/ingest/ports/courseStorage.ts +25 -0
- package/src/services/ingest/ports/packageRegistry.ts +60 -0
- package/src/services/ingest/ports/requestAuthenticator.ts +28 -0
- package/src/ui/_app/app.js +825 -825
- package/src/ui/app.tar.gz +0 -0
- package/src/ui/static/og-image.png +0 -0
- package/src/utils/branding.ts +78 -0
- package/src/utils/coursePackage/bucketIo.ts +46 -0
- package/src/utils/coursePackage/learnJson.ts +37 -0
- package/src/utils/coursePackage/sidebar.ts +28 -0
- package/src/utils/creatorSocket.ts +16 -22
- package/src/utils/gcpCredentials.ts +38 -0
- package/src/utils/rigoActions.ts +163 -0
- package/src/utils/socketRegistry.ts +85 -0
- package/lib/creatorDist/assets/index-CjddKHB_.css +0 -1
- package/src/creatorDist/assets/index-CjddKHB_.css +0 -1
package/src/creator/README.md
CHANGED
|
@@ -1,54 +1,66 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
# LearnPack Creator
|
|
2
|
+
|
|
3
|
+
The React + Vite app behind the `/creator` routes: the wizard that collects a course
|
|
4
|
+
brief, and the syllabus editor where the user refines the generated outline before the
|
|
5
|
+
course is created.
|
|
6
|
+
|
|
7
|
+
It is a separate TypeScript project from the CLI. The root `tsconfig.json` explicitly
|
|
8
|
+
excludes `src/creator`, and this app is ESM (`"type": "module"`) while the CLI is
|
|
9
|
+
CommonJS. Nothing here is compiled by the CLI build.
|
|
10
|
+
|
|
11
|
+
## ⚠️ Read this before you commit
|
|
12
|
+
|
|
13
|
+
A PR that changes `src/creator/src/**` **must not** include `src/creatorDist/**`.
|
|
14
|
+
|
|
15
|
+
`src/creatorDist/` is the compiled output of this app, committed to git because it is
|
|
16
|
+
what the CLI serves at runtime and ships to npm. It is a **release artifact**: it gets
|
|
17
|
+
rebuilt and committed only in the release commit, by `autoUpload.sh` at the repository
|
|
18
|
+
root.
|
|
19
|
+
|
|
20
|
+
Committing it in a feature PR causes conflicts that cannot be resolved by merging —
|
|
21
|
+
Vite emits content-hashed filenames, so every rebuild rewrites `index.html` and adds a
|
|
22
|
+
differently named asset.
|
|
23
|
+
|
|
24
|
+
Corollary: **merging a creator change does not deploy it.** It ships when someone
|
|
25
|
+
publishes.
|
|
26
|
+
|
|
27
|
+
Full rationale in [`docs/creator-bundle.md`](../../docs/creator-bundle.md).
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
Run these from `src/creator/`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install # this app has its own node_modules; the root install does not cover it
|
|
35
|
+
npm run dev # Vite dev server with HMR
|
|
36
|
+
npm run build # tsc -b && vite build -> ../creatorDist (not committed, see above)
|
|
37
|
+
npm run watch # vite build --watch, for testing against a local CLI server
|
|
38
|
+
npm run test # vitest; this app has its own runner, the root `npm test` does not cover it
|
|
39
|
+
npm run lint # ESLint
|
|
32
40
|
```
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
// eslint.config.js
|
|
38
|
-
import reactX from "eslint-plugin-react-x"
|
|
39
|
-
import reactDom from "eslint-plugin-react-dom"
|
|
40
|
-
|
|
41
|
-
export default tseslint.config({
|
|
42
|
-
plugins: {
|
|
43
|
-
// Add the react-x and react-dom plugins
|
|
44
|
-
"react-x": reactX,
|
|
45
|
-
"react-dom": reactDom,
|
|
46
|
-
},
|
|
47
|
-
rules: {
|
|
48
|
-
// other rules...
|
|
49
|
-
// Enable its recommended typescript rules
|
|
50
|
-
...reactX.configs["recommended-typescript"].rules,
|
|
51
|
-
...reactDom.configs.recommended.rules,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
42
|
+
## Layout
|
|
43
|
+
|
|
54
44
|
```
|
|
45
|
+
src/
|
|
46
|
+
App.tsx wizard: brief -> purpose -> duration -> human check
|
|
47
|
+
components/
|
|
48
|
+
NotificationListener.tsx socket.io subscription to a Rigobot completion webhook
|
|
49
|
+
syllabus/ syllabus editor and its chat sidebar
|
|
50
|
+
utils/
|
|
51
|
+
rigo.ts calls to the Rigobot prompting API
|
|
52
|
+
socket.ts socket.io client wrapper
|
|
53
|
+
store.ts zustand store, persisted to localStorage
|
|
54
|
+
locales/ i18n resources (en, es)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## How generation works
|
|
58
|
+
|
|
59
|
+
Course generation is asynchronous. `publicInteractiveCreation` posts to Rigobot with a
|
|
60
|
+
`webhook_url` pointing at the CLI server (`POST /notifications/:id`), and Rigobot answers
|
|
61
|
+
`201` immediately with a pending job. The CLI relays the eventual webhook over socket.io,
|
|
62
|
+
and `NotificationListener` resolves it in the browser.
|
|
63
|
+
|
|
64
|
+
That means **an HTTP 2xx from Rigobot says nothing about whether generation succeeded**.
|
|
65
|
+
The job can still fail later and arrive over the socket with `status: "ERROR"` and
|
|
66
|
+
`parsed: null`. Any code consuming a notification payload has to handle that.
|