@learnpack/learnpack 5.0.128 → 5.0.132
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 +13 -13
- package/lib/commands/serve.d.ts +51 -0
- package/lib/commands/serve.js +145 -2
- package/lib/utils/creatorUtilities.d.ts +1 -0
- package/lib/utils/creatorUtilities.js +17 -16
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/serve.ts +301 -4
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +11 -54
- package/src/utils/cloudStorage.ts +24 -24
- package/src/utils/creatorUtilities.ts +499 -499
package/README.md
CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @learnpack/learnpack
|
|
21
21
|
$ learnpack COMMAND
|
22
22
|
running command...
|
23
23
|
$ learnpack (-v|--version|version)
|
24
|
-
@learnpack/learnpack/5.0.
|
24
|
+
@learnpack/learnpack/5.0.132 win32-x64 node-v22.15.0
|
25
25
|
$ learnpack --help [COMMAND]
|
26
26
|
USAGE
|
27
27
|
$ learnpack COMMAND
|
@@ -80,7 +80,7 @@ DESCRIPTION
|
|
80
80
|
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
81
81
|
```
|
82
82
|
|
83
|
-
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
83
|
+
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\audit.ts)_
|
84
84
|
|
85
85
|
## `learnpack breakToken`
|
86
86
|
|
@@ -95,7 +95,7 @@ OPTIONS
|
|
95
95
|
-y, --yes Skip all prompts and initialize an empty project
|
96
96
|
```
|
97
97
|
|
98
|
-
_See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
98
|
+
_See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\breakToken.ts)_
|
99
99
|
|
100
100
|
## `learnpack clean`
|
101
101
|
|
@@ -110,7 +110,7 @@ DESCRIPTION
|
|
110
110
|
Extra documentation goes here
|
111
111
|
```
|
112
112
|
|
113
|
-
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
113
|
+
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\clean.ts)_
|
114
114
|
|
115
115
|
## `learnpack download [PACKAGE]`
|
116
116
|
|
@@ -128,7 +128,7 @@ DESCRIPTION
|
|
128
128
|
Extra documentation goes here
|
129
129
|
```
|
130
130
|
|
131
|
-
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
131
|
+
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\download.ts)_
|
132
132
|
|
133
133
|
## `learnpack help [COMMAND]`
|
134
134
|
|
@@ -160,7 +160,7 @@ OPTIONS
|
|
160
160
|
-y, --yes Skip all prompts and initialize an empty project
|
161
161
|
```
|
162
162
|
|
163
|
-
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
163
|
+
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\init.ts)_
|
164
164
|
|
165
165
|
## `learnpack login [PACKAGE]`
|
166
166
|
|
@@ -178,7 +178,7 @@ DESCRIPTION
|
|
178
178
|
Extra documentation goes here
|
179
179
|
```
|
180
180
|
|
181
|
-
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
181
|
+
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\login.ts)_
|
182
182
|
|
183
183
|
## `learnpack logout [PACKAGE]`
|
184
184
|
|
@@ -196,7 +196,7 @@ DESCRIPTION
|
|
196
196
|
Extra documentation goes here
|
197
197
|
```
|
198
198
|
|
199
|
-
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
199
|
+
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\logout.ts)_
|
200
200
|
|
201
201
|
## `learnpack plugins`
|
202
202
|
|
@@ -328,7 +328,7 @@ OPTIONS
|
|
328
328
|
-s, --strict strict mode
|
329
329
|
```
|
330
330
|
|
331
|
-
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
331
|
+
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\publish.ts)_
|
332
332
|
|
333
333
|
## `learnpack serve`
|
334
334
|
|
@@ -345,7 +345,7 @@ OPTIONS
|
|
345
345
|
-y, --yes Skip all prompts and initialize an empty project
|
346
346
|
```
|
347
347
|
|
348
|
-
_See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
348
|
+
_See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\serve.ts)_
|
349
349
|
|
350
350
|
## `learnpack start`
|
351
351
|
|
@@ -367,7 +367,7 @@ OPTIONS
|
|
367
367
|
-y, --yes Skip all prompts and initialize an empty project
|
368
368
|
```
|
369
369
|
|
370
|
-
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
370
|
+
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\start.ts)_
|
371
371
|
|
372
372
|
## `learnpack test [EXERCISESLUG]`
|
373
373
|
|
@@ -384,7 +384,7 @@ OPTIONS
|
|
384
384
|
-y, --yes Skip all prompts and initialize an empty project
|
385
385
|
```
|
386
386
|
|
387
|
-
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
387
|
+
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\test.ts)_
|
388
388
|
|
389
389
|
## `learnpack translate`
|
390
390
|
|
@@ -398,7 +398,7 @@ OPTIONS
|
|
398
398
|
-y, --yes Skip all prompts and initialize an empty project
|
399
399
|
```
|
400
400
|
|
401
|
-
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
401
|
+
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.132/src\commands\translate.ts)_
|
402
402
|
<!-- commandsstop -->
|
403
403
|
|
404
404
|
> > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
|
package/lib/commands/serve.d.ts
CHANGED
@@ -1,7 +1,58 @@
|
|
1
1
|
import SessionCommand from "../utils/SessionCommand";
|
2
|
+
import { Bucket } from "@google-cloud/storage";
|
3
|
+
export declare const createLearnJson: (courseInfo: FormState) => {
|
4
|
+
slug: string;
|
5
|
+
title: {
|
6
|
+
us: string;
|
7
|
+
};
|
8
|
+
technologies: string[];
|
9
|
+
difficulty: string;
|
10
|
+
description: {
|
11
|
+
us: string;
|
12
|
+
};
|
13
|
+
grading: string;
|
14
|
+
telemetry: {
|
15
|
+
batch: string;
|
16
|
+
};
|
17
|
+
preview: string;
|
18
|
+
};
|
19
|
+
export declare const processImage: (bucket: Bucket, tutorialDir: string, url: string, description: string, rigoToken: string) => Promise<boolean>;
|
20
|
+
export declare function processExercise(bucket: Bucket, rigoToken: string, steps: Lesson[], packageContext: string, exercise: Lesson, exercisesDir: string): Promise<string>;
|
21
|
+
interface Lesson {
|
22
|
+
id: string;
|
23
|
+
uid: string;
|
24
|
+
title: string;
|
25
|
+
type: "READ" | "CODE" | "QUIZ";
|
26
|
+
description: string;
|
27
|
+
duration?: number;
|
28
|
+
}
|
29
|
+
interface ParsedLink {
|
30
|
+
url: string;
|
31
|
+
title?: string;
|
32
|
+
text?: string;
|
33
|
+
transcript?: string;
|
34
|
+
description?: string;
|
35
|
+
author?: string;
|
36
|
+
duration?: number;
|
37
|
+
thumbnail?: string;
|
38
|
+
}
|
39
|
+
type FormState = {
|
40
|
+
description: string;
|
41
|
+
duration: number;
|
42
|
+
targetAudience: string;
|
43
|
+
hasContentIndex: boolean;
|
44
|
+
contentIndex: string;
|
45
|
+
sources: ParsedLink[];
|
46
|
+
isCompleted: boolean;
|
47
|
+
variables: string[];
|
48
|
+
currentStep: string;
|
49
|
+
title: string;
|
50
|
+
technologies?: string[];
|
51
|
+
};
|
2
52
|
export default class ServeCommand extends SessionCommand {
|
3
53
|
static description: string;
|
4
54
|
static flags: any;
|
5
55
|
init(): Promise<void>;
|
6
56
|
run(): Promise<void>;
|
7
57
|
}
|
58
|
+
export {};
|
package/lib/commands/serve.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.processImage = exports.createLearnJson = void 0;
|
4
|
+
exports.processExercise = processExercise;
|
3
5
|
const command_1 = require("@oclif/command");
|
4
6
|
// import * as ytdl from "ytdl-core"
|
5
7
|
const youtube_transcript_1 = require("youtube-transcript");
|
@@ -17,14 +19,128 @@ const file_1 = require("../managers/file");
|
|
17
19
|
const fs = require("fs");
|
18
20
|
const rigoActions_1 = require("../utils/rigoActions");
|
19
21
|
const dotenv = require("dotenv");
|
22
|
+
const creatorUtilities_1 = require("../utils/creatorUtilities");
|
20
23
|
// import { handleAssetCreation } from "./publish"
|
21
24
|
const axios_1 = require("axios");
|
22
25
|
const FormData = require("form-data");
|
23
26
|
const api_1 = require("../utils/api");
|
24
27
|
const misc_1 = require("../utils/misc");
|
25
28
|
const configBuilder_1 = require("../utils/configBuilder");
|
26
|
-
|
29
|
+
const creatorUtilities_2 = require("../utils/creatorUtilities");
|
27
30
|
const frontMatter = require("front-matter");
|
31
|
+
dotenv.config();
|
32
|
+
const createLearnJson = (courseInfo) => {
|
33
|
+
console.log("courseInfo to create learn json", courseInfo);
|
34
|
+
const learnJson = {
|
35
|
+
slug: (0, creatorUtilities_2.slugify)(courseInfo.title),
|
36
|
+
title: {
|
37
|
+
us: courseInfo.title,
|
38
|
+
},
|
39
|
+
technologies: courseInfo.technologies || [],
|
40
|
+
difficulty: "beginner",
|
41
|
+
description: {
|
42
|
+
us: courseInfo.description,
|
43
|
+
},
|
44
|
+
grading: "isolated",
|
45
|
+
telemetry: {
|
46
|
+
batch: "https://breathecode.herokuapp.com/v1/assignment/me/telemetry",
|
47
|
+
},
|
48
|
+
preview: "preview.png",
|
49
|
+
};
|
50
|
+
return learnJson;
|
51
|
+
};
|
52
|
+
exports.createLearnJson = createLearnJson;
|
53
|
+
const uploadFileToBucket = async (bucket, file, path) => {
|
54
|
+
const fileRef = bucket.file(path);
|
55
|
+
await fileRef.save(file);
|
56
|
+
};
|
57
|
+
const uploadImageToBucket = async (bucket, url, path) => {
|
58
|
+
const response = await fetch(url);
|
59
|
+
if (!response.ok) {
|
60
|
+
throw new Error(`Failed to download image: ${response.statusText}`);
|
61
|
+
}
|
62
|
+
const contentType = response.headers.get("content-type") || "application/octet-stream";
|
63
|
+
const buffer = await response.arrayBuffer();
|
64
|
+
const fileRef = bucket.file(path);
|
65
|
+
await fileRef.save(Buffer.from(buffer), {
|
66
|
+
resumable: false,
|
67
|
+
contentType,
|
68
|
+
});
|
69
|
+
};
|
70
|
+
const PARAMS = {
|
71
|
+
expected_grade_level: "7",
|
72
|
+
max_fkgl: 9,
|
73
|
+
max_words: 200,
|
74
|
+
max_rewrite_attempts: 2,
|
75
|
+
max_title_length: 50,
|
76
|
+
};
|
77
|
+
const processImage = async (bucket, tutorialDir, url, description, rigoToken) => {
|
78
|
+
try {
|
79
|
+
const filename = (0, creatorUtilities_1.getFilenameFromUrl)(url);
|
80
|
+
const imagePath = `${tutorialDir}/.learn/assets/${filename}`;
|
81
|
+
console.log("🖼️ Generating image", imagePath);
|
82
|
+
const res = await (0, rigoActions_1.generateImage)(rigoToken, { prompt: description });
|
83
|
+
await uploadImageToBucket(bucket, res.image_url, imagePath);
|
84
|
+
console.log("✅ Image", imagePath, "generated successfully!");
|
85
|
+
return true;
|
86
|
+
}
|
87
|
+
catch (_a) {
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
};
|
91
|
+
exports.processImage = processImage;
|
92
|
+
async function processExercise(bucket, rigoToken, steps, packageContext, exercise, exercisesDir) {
|
93
|
+
// const tid = toast.loading("Generating lesson...")
|
94
|
+
const exSlug = (0, creatorUtilities_2.slugify)(exercise.id + "-" + exercise.title);
|
95
|
+
const readmeFilename = "README.md";
|
96
|
+
const targetDir = `${exercisesDir}/${exSlug}`;
|
97
|
+
console.log("✍🏻 Generating lesson", exercise.id, exercise.title);
|
98
|
+
const isGeneratingText = `The lesson ${exercise.id} - ${exercise.title} is being generated by Rigobot, wait a sec!
|
99
|
+
|
100
|
+
\`\`\`loader slug="${exSlug}"
|
101
|
+
# This lesson is being generated by Rigobot, wait a sec!
|
102
|
+
\`\`\`
|
103
|
+
`;
|
104
|
+
await uploadFileToBucket(bucket, isGeneratingText, `${targetDir}/${readmeFilename}`);
|
105
|
+
const readme = await (0, rigoActions_1.readmeCreator)(rigoToken, {
|
106
|
+
title: `${exercise.id} - ${exercise.title}`,
|
107
|
+
output_lang: "en",
|
108
|
+
list_of_exercises: JSON.stringify(steps),
|
109
|
+
tutorial_description: packageContext,
|
110
|
+
lesson_description: exercise.description,
|
111
|
+
kind: exercise.type.toLowerCase(),
|
112
|
+
});
|
113
|
+
const duration = exercise.duration;
|
114
|
+
let attempts = 0;
|
115
|
+
let readability = (0, creatorUtilities_2.checkReadability)(readme.parsed.content, 200, duration || 1);
|
116
|
+
while (readability.fkglResult.fkgl > PARAMS.max_fkgl &&
|
117
|
+
attempts < PARAMS.max_rewrite_attempts) {
|
118
|
+
console.log("🔄 The lesson", exercise.id, exercise.title, "has a readability score of", readability.fkglResult.fkgl);
|
119
|
+
// eslint-disable-next-line
|
120
|
+
const reducedReadme = await (0, rigoActions_1.makeReadmeReadable)(rigoToken, {
|
121
|
+
lesson: readability.body,
|
122
|
+
number_of_words: readability.minutes.toString(),
|
123
|
+
expected_number_words: PARAMS.max_words.toString(),
|
124
|
+
fkgl_results: JSON.stringify(readability.fkglResult),
|
125
|
+
expected_grade_level: PARAMS.expected_grade_level,
|
126
|
+
});
|
127
|
+
if (!reducedReadme)
|
128
|
+
break;
|
129
|
+
readability = (0, creatorUtilities_2.checkReadability)(reducedReadme.parsed.content, PARAMS.max_words, duration || 1);
|
130
|
+
attempts++;
|
131
|
+
}
|
132
|
+
console.log(`✅ After ${attempts} attempts, the lesson ${exercise.title} has a readability score of ${readability.fkglResult.fkgl} using FKGL. And it has ${readability.minutes.toFixed(2)} minutes of reading time.`);
|
133
|
+
await uploadFileToBucket(bucket, readability.newMarkdown, `${targetDir}/${readmeFilename}`);
|
134
|
+
if (exercise.type.toLowerCase() === "code") {
|
135
|
+
console.log("🔍 Creating code file for", exercise.title);
|
136
|
+
const codeFile = await (0, rigoActions_1.createCodeFile)(rigoToken, {
|
137
|
+
readme: readability.newMarkdown,
|
138
|
+
tutorial_info: packageContext,
|
139
|
+
});
|
140
|
+
await uploadFileToBucket(bucket, codeFile.parsed.content, `${targetDir}/index.${codeFile.parsed.extension.replace(".", "")}`);
|
141
|
+
}
|
142
|
+
return readability.newMarkdown;
|
143
|
+
}
|
28
144
|
const fixPreviewUrl = (slug, previewUrl) => {
|
29
145
|
if (!previewUrl) {
|
30
146
|
return null;
|
@@ -105,7 +221,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
105
221
|
});
|
106
222
|
stream.end(buffer);
|
107
223
|
});
|
108
|
-
app.post("/upload-image", express.json({ limit:
|
224
|
+
app.post("/upload-image", express.json({ limit: 20000000 }), async (req, res) => {
|
109
225
|
const { image_url, destination } = req.body;
|
110
226
|
if (!image_url || !destination) {
|
111
227
|
return res
|
@@ -326,6 +442,33 @@ class ServeCommand extends SessionCommand_1.default {
|
|
326
442
|
const file = path.join(distPath, "assets", req.params.file);
|
327
443
|
res.sendFile(file);
|
328
444
|
});
|
445
|
+
app.post("/actions/create-course", async (req, res) => {
|
446
|
+
console.log("POST /actions/create-course");
|
447
|
+
const { syllabus } = req.body;
|
448
|
+
const rigoToken = req.header("x-rigo-token");
|
449
|
+
const bcToken = req.header("x-breathecode-token");
|
450
|
+
if (!rigoToken || !bcToken) {
|
451
|
+
return res.status(400).json({ error: "Missing tokens" });
|
452
|
+
}
|
453
|
+
const tutorialDir = "courses/" + (0, creatorUtilities_2.slugify)(syllabus.courseInfo.title);
|
454
|
+
const learnJson = (0, exports.createLearnJson)(syllabus.courseInfo);
|
455
|
+
await uploadFileToBucket(bucket, JSON.stringify(learnJson), `courses/${(0, creatorUtilities_2.slugify)(syllabus.courseInfo.title)}/learn.json`);
|
456
|
+
const lessonsPromises = syllabus.lessons.map(lesson => processExercise(bucket, rigoToken, syllabus.lessons, JSON.stringify(syllabus.courseInfo), lesson, tutorialDir + "/exercises"));
|
457
|
+
const readmeContents = await Promise.all(lessonsPromises);
|
458
|
+
let imagesArray = [];
|
459
|
+
for (const content of readmeContents) {
|
460
|
+
imagesArray = [...imagesArray, ...(0, creatorUtilities_1.extractImagesFromMarkdown)(content)];
|
461
|
+
}
|
462
|
+
console.log("📷 Generating images...");
|
463
|
+
const imagePromises = imagesArray.map(async (image) => {
|
464
|
+
return (0, exports.processImage)(bucket, tutorialDir, image.url, image.alt, rigoToken);
|
465
|
+
});
|
466
|
+
await Promise.all(imagePromises);
|
467
|
+
return res.json({
|
468
|
+
message: "Course created",
|
469
|
+
slug: (0, creatorUtilities_2.slugify)(syllabus.courseInfo.title),
|
470
|
+
});
|
471
|
+
});
|
329
472
|
app.post("/actions/publish/:slug", async (req, res) => {
|
330
473
|
try {
|
331
474
|
const { slug } = req.params;
|
@@ -25,6 +25,7 @@ export declare function checkReadability(markdown: string, wordsPerMinute?: numb
|
|
25
25
|
body: string;
|
26
26
|
fkglResult: TFKGLResult;
|
27
27
|
};
|
28
|
+
export declare const slugify: (text: string) => string;
|
28
29
|
export declare const getExInfo: (title: string) => {
|
29
30
|
exNumber: string;
|
30
31
|
kind: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.appendAIRules = exports.appendContentIndex = exports.saveTranslatedReadme = exports.makePackageInfo = exports.getExInfo = exports.estimateReadingTime = void 0;
|
3
|
+
exports.appendAIRules = exports.appendContentIndex = exports.saveTranslatedReadme = exports.makePackageInfo = exports.getExInfo = exports.slugify = exports.estimateReadingTime = void 0;
|
4
4
|
exports.checkReadability = checkReadability;
|
5
5
|
exports.extractImagesFromMarkdown = extractImagesFromMarkdown;
|
6
6
|
exports.getFilenameFromUrl = getFilenameFromUrl;
|
@@ -93,6 +93,7 @@ const slugify = (text) => {
|
|
93
93
|
.replace(/\s+/g, "-")
|
94
94
|
.replace(/[^\w-]+/g, "");
|
95
95
|
};
|
96
|
+
exports.slugify = slugify;
|
96
97
|
const getExInfo = (title) => {
|
97
98
|
// Example title: '1.0 - Introduction to AI [READ: Small introduction to important concepts such as AI, machine learning, and their applications]'
|
98
99
|
let [exNumber, exTitle] = title.split(" - ");
|
@@ -103,7 +104,7 @@ const getExInfo = (title) => {
|
|
103
104
|
exNumber = exNumber.trim();
|
104
105
|
// Clean title
|
105
106
|
exTitle = exTitle.replace((kindMatch === null || kindMatch === void 0 ? void 0 : kindMatch[0]) || "", "").trim();
|
106
|
-
exTitle = slugify(exTitle);
|
107
|
+
exTitle = (0, exports.slugify)(exTitle);
|
107
108
|
return {
|
108
109
|
exNumber,
|
109
110
|
kind,
|
@@ -330,13 +331,13 @@ function countSentences(text) {
|
|
330
331
|
function howManyDifficultParagraphs(paragraphs, maxFKGL) {
|
331
332
|
return paragraphs.filter(paragraph => paragraph.fkgl > maxFKGL).length;
|
332
333
|
}
|
333
|
-
const example_content = `Write or paste your table of content below this line, each topic should be defined on a new line, here is an example:
|
334
|
-
|
335
|
-
Introduction to AI: Explain what is AI and its applications
|
336
|
-
Introduction to Machine Learning: Explain what is machine learning and its applications
|
337
|
-
What is an AI Model: Explain what is an AI model and its applications
|
338
|
-
How to use an AI Model: Different APIs, local models, etc.
|
339
|
-
How to build an AI Model: Fine-tuning, data collection, cleaning and more.
|
334
|
+
const example_content = `Write or paste your table of content below this line, each topic should be defined on a new line, here is an example:
|
335
|
+
|
336
|
+
Introduction to AI: Explain what is AI and its applications
|
337
|
+
Introduction to Machine Learning: Explain what is machine learning and its applications
|
338
|
+
What is an AI Model: Explain what is an AI model and its applications
|
339
|
+
How to use an AI Model: Different APIs, local models, etc.
|
340
|
+
How to build an AI Model: Fine-tuning, data collection, cleaning and more.
|
340
341
|
`;
|
341
342
|
const appendContentIndex = async () => {
|
342
343
|
const choices = await prompts([
|
@@ -366,13 +367,13 @@ const appendContentIndex = async () => {
|
|
366
367
|
return null;
|
367
368
|
};
|
368
369
|
exports.appendContentIndex = appendContentIndex;
|
369
|
-
const example_airules = `
|
370
|
-
Write with an engaging tone, use simple words and avoid complex sentences.
|
371
|
-
Write in first person, as if you are talking to the reader.
|
372
|
-
Add mental maps to help the reader understand the content.
|
373
|
-
Add diagrams to help the reader understand the content.
|
374
|
-
No code exercises required
|
375
|
-
|
370
|
+
const example_airules = `
|
371
|
+
Write with an engaging tone, use simple words and avoid complex sentences.
|
372
|
+
Write in first person, as if you are talking to the reader.
|
373
|
+
Add mental maps to help the reader understand the content.
|
374
|
+
Add diagrams to help the reader understand the content.
|
375
|
+
No code exercises required
|
376
|
+
|
376
377
|
`;
|
377
378
|
const appendAIRules = async () => {
|
378
379
|
const choices = await prompts([
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.132","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false}},"args":[]},"breakToken":{"id":"breakToken","description":"Break the token","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Runs a small server to build tutorials","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]},"translate":{"id":"translate","description":"List all the lessons, the user is able of select many of them to translate to the given languages","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@learnpack/learnpack",
|
3
3
|
"description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
|
4
|
-
"version": "5.0.
|
4
|
+
"version": "5.0.132",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|