@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.
Files changed (127) hide show
  1. package/lib/commands/publish.js +2 -2
  2. package/lib/commands/serve.d.ts +0 -17
  3. package/lib/commands/serve.js +252 -147
  4. package/lib/creatorDist/assets/{index-DnthLsvb.js → index-D6pmbMe9.js} +14030 -13903
  5. package/lib/creatorDist/assets/index-zrPponAn.css +1701 -0
  6. package/lib/creatorDist/index.html +2 -2
  7. package/lib/models/creator.d.ts +1 -1
  8. package/lib/services/ingest/adapters/gcsCourseStorage.d.ts +13 -0
  9. package/lib/services/ingest/adapters/gcsCourseStorage.js +58 -0
  10. package/lib/services/ingest/adapters/rigoUserTokenAuth.d.ts +15 -0
  11. package/lib/services/ingest/adapters/rigoUserTokenAuth.js +46 -0
  12. package/lib/services/ingest/adapters/rigobotPackageRegistry.d.ts +7 -0
  13. package/lib/services/ingest/adapters/rigobotPackageRegistry.js +119 -0
  14. package/lib/services/ingest/core/buildIngestConfig.d.ts +27 -0
  15. package/lib/services/ingest/core/buildIngestConfig.js +40 -0
  16. package/lib/services/ingest/core/buildInitialSyllabus.d.ts +24 -0
  17. package/lib/services/ingest/core/buildInitialSyllabus.js +104 -0
  18. package/lib/services/ingest/core/buildSidebar.d.ts +13 -0
  19. package/lib/services/ingest/core/buildSidebar.js +28 -0
  20. package/lib/services/ingest/core/coursePaths.d.ts +31 -0
  21. package/lib/services/ingest/core/coursePaths.js +50 -0
  22. package/lib/services/ingest/core/ingestCoursePackage.d.ts +52 -0
  23. package/lib/services/ingest/core/ingestCoursePackage.js +217 -0
  24. package/lib/services/ingest/core/normalizeLearnJson.d.ts +25 -0
  25. package/lib/services/ingest/core/normalizeLearnJson.js +29 -0
  26. package/lib/services/ingest/core/pairLessons.d.ts +29 -0
  27. package/lib/services/ingest/core/pairLessons.js +102 -0
  28. package/lib/services/ingest/core/planWrites.d.ts +44 -0
  29. package/lib/services/ingest/core/planWrites.js +59 -0
  30. package/lib/services/ingest/core/resolveSlug.d.ts +53 -0
  31. package/lib/services/ingest/core/resolveSlug.js +93 -0
  32. package/lib/services/ingest/core/types.d.ts +53 -0
  33. package/lib/services/ingest/core/types.js +2 -0
  34. package/lib/services/ingest/core/validatePackage.d.ts +38 -0
  35. package/lib/services/ingest/core/validatePackage.js +97 -0
  36. package/lib/services/ingest/createIngestService.d.ts +34 -0
  37. package/lib/services/ingest/createIngestService.js +38 -0
  38. package/lib/services/ingest/errors.d.ts +22 -0
  39. package/lib/services/ingest/errors.js +34 -0
  40. package/lib/services/ingest/http/errorMapping.d.ts +8 -0
  41. package/lib/services/ingest/http/errorMapping.js +40 -0
  42. package/lib/services/ingest/http/router.d.ts +32 -0
  43. package/lib/services/ingest/http/router.js +124 -0
  44. package/lib/services/ingest/http/zipPackageReader.d.ts +26 -0
  45. package/lib/services/ingest/http/zipPackageReader.js +62 -0
  46. package/lib/services/ingest/ports/courseStorage.d.ts +25 -0
  47. package/lib/services/ingest/ports/courseStorage.js +2 -0
  48. package/lib/services/ingest/ports/packageRegistry.d.ts +58 -0
  49. package/lib/services/ingest/ports/packageRegistry.js +2 -0
  50. package/lib/services/ingest/ports/requestAuthenticator.d.ts +25 -0
  51. package/lib/services/ingest/ports/requestAuthenticator.js +2 -0
  52. package/lib/ui/static/og-image.png +0 -0
  53. package/lib/utils/branding.d.ts +43 -0
  54. package/lib/utils/branding.js +75 -0
  55. package/lib/utils/coursePackage/bucketIo.d.ts +23 -0
  56. package/lib/utils/coursePackage/bucketIo.js +36 -0
  57. package/lib/utils/coursePackage/learnJson.d.ts +26 -0
  58. package/lib/utils/coursePackage/learnJson.js +36 -0
  59. package/lib/utils/coursePackage/sidebar.d.ts +15 -0
  60. package/lib/utils/coursePackage/sidebar.js +26 -0
  61. package/lib/utils/creatorSocket.js +15 -21
  62. package/lib/utils/gcpCredentials.d.ts +18 -0
  63. package/lib/utils/gcpCredentials.js +27 -0
  64. package/lib/utils/rigoActions.d.ts +16 -0
  65. package/lib/utils/rigoActions.js +102 -1
  66. package/lib/utils/socketRegistry.d.ts +46 -0
  67. package/lib/utils/socketRegistry.js +83 -0
  68. package/package.json +2 -2
  69. package/src/commands/publish.ts +2 -3
  70. package/src/commands/serve.ts +297 -136
  71. package/src/creator/README.md +63 -51
  72. package/src/creator/package-lock.json +1188 -8
  73. package/src/creator/package.json +5 -1
  74. package/src/creator/src/App.tsx +120 -54
  75. package/src/creator/src/components/FileUploader.tsx +1 -12
  76. package/src/creator/src/components/NotificationListener.tsx +1 -8
  77. package/src/creator/src/components/syllabus/SyllabusEditor.tsx +101 -36
  78. package/src/creator/src/locales/en.json +8 -0
  79. package/src/creator/src/locales/es.json +8 -0
  80. package/src/creator/src/utils/completionResult.test.ts +144 -0
  81. package/src/creator/src/utils/completionResult.ts +154 -0
  82. package/src/creator/src/utils/constants.ts +17 -4
  83. package/src/creator/src/utils/socket.test.ts +113 -0
  84. package/src/creator/src/utils/socket.ts +60 -37
  85. package/src/creator/src/utils/store.ts +84 -67
  86. package/src/creator/src/utils/useCompletionWatchdog.test.ts +99 -0
  87. package/src/creator/src/utils/useCompletionWatchdog.ts +37 -0
  88. package/src/creator/vitest.config.ts +16 -0
  89. package/src/creatorDist/assets/{index-DnthLsvb.js → index-D6pmbMe9.js} +14030 -13903
  90. package/src/creatorDist/assets/index-zrPponAn.css +1701 -0
  91. package/src/creatorDist/index.html +2 -2
  92. package/src/models/creator.ts +1 -1
  93. package/src/services/ingest/adapters/gcsCourseStorage.ts +70 -0
  94. package/src/services/ingest/adapters/rigoUserTokenAuth.ts +65 -0
  95. package/src/services/ingest/adapters/rigobotPackageRegistry.ts +161 -0
  96. package/src/services/ingest/core/buildIngestConfig.ts +51 -0
  97. package/src/services/ingest/core/buildInitialSyllabus.ts +122 -0
  98. package/src/services/ingest/core/buildSidebar.ts +32 -0
  99. package/src/services/ingest/core/coursePaths.ts +59 -0
  100. package/src/services/ingest/core/ingestCoursePackage.ts +343 -0
  101. package/src/services/ingest/core/normalizeLearnJson.ts +47 -0
  102. package/src/services/ingest/core/pairLessons.ts +132 -0
  103. package/src/services/ingest/core/planWrites.ts +91 -0
  104. package/src/services/ingest/core/resolveSlug.ts +119 -0
  105. package/src/services/ingest/core/types.ts +57 -0
  106. package/src/services/ingest/core/validatePackage.ts +132 -0
  107. package/src/services/ingest/createIngestService.ts +66 -0
  108. package/src/services/ingest/errors.ts +45 -0
  109. package/src/services/ingest/http/errorMapping.ts +49 -0
  110. package/src/services/ingest/http/router.ts +156 -0
  111. package/src/services/ingest/http/zipPackageReader.ts +81 -0
  112. package/src/services/ingest/ports/courseStorage.ts +25 -0
  113. package/src/services/ingest/ports/packageRegistry.ts +60 -0
  114. package/src/services/ingest/ports/requestAuthenticator.ts +28 -0
  115. package/src/ui/_app/app.js +825 -825
  116. package/src/ui/app.tar.gz +0 -0
  117. package/src/ui/static/og-image.png +0 -0
  118. package/src/utils/branding.ts +78 -0
  119. package/src/utils/coursePackage/bucketIo.ts +46 -0
  120. package/src/utils/coursePackage/learnJson.ts +37 -0
  121. package/src/utils/coursePackage/sidebar.ts +28 -0
  122. package/src/utils/creatorSocket.ts +16 -22
  123. package/src/utils/gcpCredentials.ts +38 -0
  124. package/src/utils/rigoActions.ts +163 -0
  125. package/src/utils/socketRegistry.ts +85 -0
  126. package/lib/creatorDist/assets/index-CjddKHB_.css +0 -1
  127. package/src/creatorDist/assets/index-CjddKHB_.css +0 -1
@@ -1,54 +1,66 @@
1
- # React + TypeScript + Vite
2
-
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
-
5
- Currently, two official plugins are available:
6
-
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
-
10
- ## Expanding the ESLint configuration
11
-
12
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13
-
14
- ```js
15
- export default tseslint.config({
16
- extends: [
17
- // Remove ...tseslint.configs.recommended and replace with this
18
- ...tseslint.configs.recommendedTypeChecked,
19
- // Alternatively, use this for stricter rules
20
- ...tseslint.configs.strictTypeChecked,
21
- // Optionally, add this for stylistic rules
22
- ...tseslint.configs.stylisticTypeChecked,
23
- ],
24
- languageOptions: {
25
- // other options...
26
- parserOptions: {
27
- project: ["./tsconfig.node.json", "./tsconfig.app.json"],
28
- tsconfigRootDir: import.meta.dirname,
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
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
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.