@learnpack/learnpack 5.0.21 → 5.0.23
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 +11 -11
- package/lib/commands/init.js +69 -33
- package/lib/utils/audit.d.ts +1 -1
- package/lib/utils/audit.js +67 -89
- package/lib/utils/rigoActions.d.ts +28 -1
- package/lib/utils/rigoActions.js +80 -26
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/init.ts +97 -44
- package/src/commands/translate.ts +0 -1
- package/src/utils/audit.ts +372 -393
- package/src/utils/rigoActions.ts +137 -34
package/src/utils/rigoActions.ts
CHANGED
@@ -4,52 +4,39 @@ import Console from "../utils/console"
|
|
4
4
|
|
5
5
|
const RIGOBOT_HOST = "https://rigobot.herokuapp.com"
|
6
6
|
|
7
|
-
export const getExercisesNames = async (token: string, inputs: object) => {
|
8
|
-
const response = await axios.post(
|
9
|
-
`${RIGOBOT_HOST}/v1/prompting/completion/60/`,
|
10
|
-
{
|
11
|
-
inputs: inputs,
|
12
|
-
include_purpose_objective: false,
|
13
|
-
execute_async: false,
|
14
|
-
},
|
15
|
-
{
|
16
|
-
headers: {
|
17
|
-
"Content-Type": "application/json",
|
18
|
-
Authorization: "Token " + token,
|
19
|
-
},
|
20
|
-
}
|
21
|
-
)
|
22
|
-
|
23
|
-
return response.data
|
24
|
-
}
|
25
|
-
|
26
7
|
type TCreateReadmeInputs = {
|
27
8
|
title: string
|
28
9
|
output_lang: string
|
29
10
|
list_of_exercises: string
|
30
11
|
tutorial_description: string
|
12
|
+
include_quiz: string
|
13
|
+
lesson_description: string
|
31
14
|
}
|
32
15
|
|
33
16
|
export const createReadme = async (
|
34
17
|
token: string,
|
35
18
|
inputs: TCreateReadmeInputs
|
36
19
|
) => {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
{
|
45
|
-
headers: {
|
46
|
-
"Content-Type": "application/json",
|
47
|
-
Authorization: "Token " + token,
|
20
|
+
try {
|
21
|
+
const response = await axios.post(
|
22
|
+
`${RIGOBOT_HOST}/v1/prompting/completion/423/`,
|
23
|
+
{
|
24
|
+
inputs,
|
25
|
+
include_purpose_objective: false,
|
26
|
+
execute_async: false,
|
48
27
|
},
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
28
|
+
{
|
29
|
+
headers: {
|
30
|
+
"Content-Type": "application/json",
|
31
|
+
Authorization: "Token " + token,
|
32
|
+
},
|
33
|
+
}
|
34
|
+
)
|
35
|
+
return response.data
|
36
|
+
} catch (error) {
|
37
|
+
console.error(error)
|
38
|
+
return null
|
39
|
+
}
|
53
40
|
}
|
54
41
|
|
55
42
|
export const hasCreatorPermission = async (token: string) => {
|
@@ -172,3 +159,119 @@ export const generateCourseIntroduction = async (
|
|
172
159
|
|
173
160
|
return response.data
|
174
161
|
}
|
162
|
+
|
163
|
+
type TInteractiveCreationInputs = {
|
164
|
+
courseInfo: string
|
165
|
+
prevInteractions: string
|
166
|
+
}
|
167
|
+
export const interactiveCreation = async (
|
168
|
+
token: string,
|
169
|
+
inputs: TInteractiveCreationInputs
|
170
|
+
) => {
|
171
|
+
const response = await axios.post(
|
172
|
+
`${RIGOBOT_HOST}/v1/prompting/completion/390/`,
|
173
|
+
{
|
174
|
+
inputs: inputs,
|
175
|
+
include_purpose_objective: false,
|
176
|
+
execute_async: false,
|
177
|
+
},
|
178
|
+
{
|
179
|
+
headers: {
|
180
|
+
"Content-Type": "application/json",
|
181
|
+
Authorization: "Token " + token,
|
182
|
+
},
|
183
|
+
}
|
184
|
+
)
|
185
|
+
|
186
|
+
return response.data
|
187
|
+
}
|
188
|
+
|
189
|
+
type TCreateCodeFileInputs = {
|
190
|
+
readme: string
|
191
|
+
}
|
192
|
+
|
193
|
+
export const createCodeFile = async (
|
194
|
+
token: string,
|
195
|
+
inputs: TCreateCodeFileInputs
|
196
|
+
) => {
|
197
|
+
const response = await axios.post(
|
198
|
+
`${RIGOBOT_HOST}/v1/prompting/completion/456/`,
|
199
|
+
{
|
200
|
+
inputs: inputs,
|
201
|
+
include_purpose_objective: false,
|
202
|
+
execute_async: false,
|
203
|
+
},
|
204
|
+
{
|
205
|
+
headers: {
|
206
|
+
"Content-Type": "application/json",
|
207
|
+
Authorization: "Token " + token,
|
208
|
+
},
|
209
|
+
}
|
210
|
+
)
|
211
|
+
|
212
|
+
return response.data
|
213
|
+
}
|
214
|
+
|
215
|
+
type TCreateCodingReadmeInputs = {
|
216
|
+
tutorial_description: string
|
217
|
+
list_of_exercises: string
|
218
|
+
output_lang: string
|
219
|
+
title: string
|
220
|
+
lesson_description: string
|
221
|
+
}
|
222
|
+
export const createCodingReadme = async (
|
223
|
+
token: string,
|
224
|
+
inputs: TCreateCodingReadmeInputs
|
225
|
+
) => {
|
226
|
+
const response = await axios.post(
|
227
|
+
`${RIGOBOT_HOST}/v1/prompting/completion/489/`,
|
228
|
+
{ inputs, include_purpose_objective: false, execute_async: false },
|
229
|
+
{
|
230
|
+
headers: {
|
231
|
+
"Content-Type": "application/json",
|
232
|
+
Authorization: "Token " + token,
|
233
|
+
},
|
234
|
+
}
|
235
|
+
)
|
236
|
+
|
237
|
+
return response.data
|
238
|
+
}
|
239
|
+
|
240
|
+
type TReadmeCreatorInputs = {
|
241
|
+
tutorial_description: string
|
242
|
+
list_of_exercises: string
|
243
|
+
output_lang: string
|
244
|
+
title: string
|
245
|
+
lesson_description: string
|
246
|
+
kind: string
|
247
|
+
}
|
248
|
+
|
249
|
+
export const readmeCreator = async (
|
250
|
+
token: string,
|
251
|
+
inputs: TReadmeCreatorInputs
|
252
|
+
) => {
|
253
|
+
if (inputs.kind === "quiz" || inputs.kind === "read") {
|
254
|
+
const createReadmeInputs: TCreateReadmeInputs = {
|
255
|
+
title: inputs.title,
|
256
|
+
output_lang: inputs.output_lang,
|
257
|
+
list_of_exercises: inputs.list_of_exercises,
|
258
|
+
tutorial_description: inputs.tutorial_description,
|
259
|
+
include_quiz: inputs.kind === "quiz" ? "true" : "false",
|
260
|
+
lesson_description: inputs.lesson_description,
|
261
|
+
}
|
262
|
+
return createReadme(token, createReadmeInputs)
|
263
|
+
}
|
264
|
+
|
265
|
+
if (inputs.kind === "code") {
|
266
|
+
return createCodingReadme(token, {
|
267
|
+
title: inputs.title,
|
268
|
+
output_lang: inputs.output_lang,
|
269
|
+
list_of_exercises: inputs.list_of_exercises,
|
270
|
+
tutorial_description: inputs.tutorial_description,
|
271
|
+
lesson_description: inputs.lesson_description,
|
272
|
+
})
|
273
|
+
}
|
274
|
+
|
275
|
+
throw new Error("Invalid kind of lesson")
|
276
|
+
|
277
|
+
}
|