ai-hero-cli 0.0.13 → 0.0.14
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/bin.cjs +46 -20
- package/package.json +1 -1
package/bin.cjs
CHANGED
|
@@ -67969,6 +67969,15 @@ var Lesson = class {
|
|
|
67969
67969
|
this.sectionPath = opts.sectionPath;
|
|
67970
67970
|
this.root = opts.root;
|
|
67971
67971
|
}
|
|
67972
|
+
isExplainer() {
|
|
67973
|
+
return this.subfolders().pipe(
|
|
67974
|
+
Effect_exports.map(
|
|
67975
|
+
Array_exports.some((subfolder) => {
|
|
67976
|
+
return subfolder.includes("explainer");
|
|
67977
|
+
})
|
|
67978
|
+
)
|
|
67979
|
+
);
|
|
67980
|
+
}
|
|
67972
67981
|
absolutePath() {
|
|
67973
67982
|
return path4__namespace.resolve(this.root, this.sectionPath, this.path);
|
|
67974
67983
|
}
|
|
@@ -68225,12 +68234,14 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
|
|
|
68225
68234
|
if (nextSubfolder) {
|
|
68226
68235
|
nextExerciseToRun = {
|
|
68227
68236
|
lessonNumber: foundLesson.num,
|
|
68237
|
+
lessonName: foundLesson.name,
|
|
68228
68238
|
subfolderIndex: subfolderIndex + 1,
|
|
68229
68239
|
subfolder: nextSubfolder
|
|
68230
68240
|
};
|
|
68231
68241
|
} else if (nextLesson) {
|
|
68232
68242
|
nextExerciseToRun = {
|
|
68233
68243
|
lessonNumber: nextLesson.num,
|
|
68244
|
+
lessonName: nextLesson.name,
|
|
68234
68245
|
subfolderIndex: 0,
|
|
68235
68246
|
subfolder: (yield* nextLesson.subfolders())[0]
|
|
68236
68247
|
};
|
|
@@ -68241,6 +68252,7 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
|
|
|
68241
68252
|
if (subfolderIndex > 0) {
|
|
68242
68253
|
previousExerciseToRun = {
|
|
68243
68254
|
lessonNumber: foundLesson.num,
|
|
68255
|
+
lessonName: foundLesson.name,
|
|
68244
68256
|
subfolderIndex: subfolderIndex - 1,
|
|
68245
68257
|
subfolder: subfolders[subfolderIndex - 1]
|
|
68246
68258
|
};
|
|
@@ -68249,6 +68261,7 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
|
|
|
68249
68261
|
const previousLessonLastSubfolderIndex = previousLessonSubfolders.length - 1;
|
|
68250
68262
|
previousExerciseToRun = {
|
|
68251
68263
|
lessonNumber: previousLesson.num,
|
|
68264
|
+
lessonName: previousLesson.name,
|
|
68252
68265
|
subfolderIndex: previousLessonLastSubfolderIndex,
|
|
68253
68266
|
subfolder: previousLessonSubfolders[previousLessonLastSubfolderIndex]
|
|
68254
68267
|
};
|
|
@@ -68276,14 +68289,7 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
|
|
|
68276
68289
|
util.styleText("dim", " Press h + enter for more shortcuts\n")
|
|
68277
68290
|
);
|
|
68278
68291
|
if (readmeFile) {
|
|
68279
|
-
yield*
|
|
68280
|
-
`${util.styleText([], "Instructions:")}
|
|
68281
|
-
${util.styleText(
|
|
68282
|
-
"dim",
|
|
68283
|
-
readmeFile
|
|
68284
|
-
)}
|
|
68285
|
-
`
|
|
68286
|
-
);
|
|
68292
|
+
yield* logReadmeFile({ readmeFile });
|
|
68287
68293
|
}
|
|
68288
68294
|
const command2 = Command_exports.make(
|
|
68289
68295
|
"pnpm",
|
|
@@ -68357,26 +68363,38 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
|
|
|
68357
68363
|
cwd
|
|
68358
68364
|
});
|
|
68359
68365
|
}
|
|
68366
|
+
if (foundLesson.isExplainer() && readmeFile) {
|
|
68367
|
+
yield* logReadmeFile({ readmeFile });
|
|
68368
|
+
}
|
|
68369
|
+
const lessonNoun = foundLesson.isExplainer() ? {
|
|
68370
|
+
successMessage: `Explainer executed! Once you've read the readme and understand the code, you can go to the next exercise.`,
|
|
68371
|
+
failureMessage: `Looks like the explainer errored! Want to try again?`,
|
|
68372
|
+
lowercase: "explainer"
|
|
68373
|
+
} : {
|
|
68374
|
+
successMessage: "Exercise complete! What's next?",
|
|
68375
|
+
failureMessage: `Looks like the exercise errored! Want to try again?`,
|
|
68376
|
+
lowercase: "exercise"
|
|
68377
|
+
};
|
|
68360
68378
|
const { choice: choice6 } = yield* runPrompt(
|
|
68361
68379
|
() => (0, import_prompts.default)([
|
|
68362
68380
|
{
|
|
68363
68381
|
type: "select",
|
|
68364
68382
|
name: "choice",
|
|
68365
|
-
message: processOutcome === "exit" ?
|
|
68383
|
+
message: processOutcome === "exit" ? lessonNoun.successMessage : lessonNoun.failureMessage,
|
|
68366
68384
|
choices: [
|
|
68367
68385
|
{
|
|
68368
|
-
title: processOutcome === "failed" ?
|
|
68386
|
+
title: processOutcome === "failed" ? `\u{1F504} Run the ${lessonNoun.lowercase} again` : `\u{1F504} Try the ${lessonNoun.lowercase} again`,
|
|
68369
68387
|
value: "run-again"
|
|
68370
68388
|
},
|
|
68371
68389
|
...nextExerciseToRun ? [
|
|
68372
68390
|
{
|
|
68373
|
-
title: `\u27A1\uFE0F Run the next exercise: ${nextExerciseToRun?.lessonNumber} ${nextExerciseToRun?.subfolder}`,
|
|
68391
|
+
title: `\u27A1\uFE0F Run the next exercise: ${nextExerciseToRun?.lessonNumber}-${nextExerciseToRun?.lessonName} ${nextExerciseToRun?.subfolder}`,
|
|
68374
68392
|
value: "next-exercise"
|
|
68375
68393
|
}
|
|
68376
68394
|
] : [],
|
|
68377
68395
|
...previousExerciseToRun ? [
|
|
68378
68396
|
{
|
|
68379
|
-
title: `\u2B05\uFE0F Run the previous exercise: ${previousExerciseToRun?.lessonNumber} ${previousExerciseToRun?.subfolder}`,
|
|
68397
|
+
title: `\u2B05\uFE0F Run the previous exercise: ${previousExerciseToRun?.lessonNumber}-${previousExerciseToRun?.lessonName} ${previousExerciseToRun?.subfolder}`,
|
|
68380
68398
|
value: "previous-exercise"
|
|
68381
68399
|
}
|
|
68382
68400
|
] : [],
|
|
@@ -68429,6 +68447,18 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
|
|
|
68429
68447
|
});
|
|
68430
68448
|
}
|
|
68431
68449
|
});
|
|
68450
|
+
var logReadmeFile = Effect_exports.fn("logReadmeFile")(
|
|
68451
|
+
function* (opts) {
|
|
68452
|
+
yield* Console_exports.log(
|
|
68453
|
+
`${util.styleText([], "Instructions:")}
|
|
68454
|
+
${util.styleText(
|
|
68455
|
+
"dim",
|
|
68456
|
+
opts.readmeFile
|
|
68457
|
+
)}
|
|
68458
|
+
`
|
|
68459
|
+
);
|
|
68460
|
+
}
|
|
68461
|
+
);
|
|
68432
68462
|
var chooseLessonAndRunIt = (opts) => Effect_exports.gen(function* () {
|
|
68433
68463
|
const lessonService = yield* LessonParserService;
|
|
68434
68464
|
const lessons = yield* lessonService.getLessonsFromRepo(
|
|
@@ -68586,14 +68616,7 @@ var runLessonSimple = (opts) => Effect_exports.gen(function* () {
|
|
|
68586
68616
|
subfolder
|
|
68587
68617
|
});
|
|
68588
68618
|
if (readmeFile) {
|
|
68589
|
-
yield*
|
|
68590
|
-
`${util.styleText([], "Instructions:")}
|
|
68591
|
-
${util.styleText(
|
|
68592
|
-
"dim",
|
|
68593
|
-
readmeFile
|
|
68594
|
-
)}
|
|
68595
|
-
`
|
|
68596
|
-
);
|
|
68619
|
+
yield* logReadmeFile({ readmeFile });
|
|
68597
68620
|
}
|
|
68598
68621
|
yield* Console_exports.log(
|
|
68599
68622
|
util.styleText("bold", `Running ${lesson} ${subfolder}...`)
|
|
@@ -68602,6 +68625,9 @@ var runLessonSimple = (opts) => Effect_exports.gen(function* () {
|
|
|
68602
68625
|
stdio: "inherit",
|
|
68603
68626
|
cwd
|
|
68604
68627
|
});
|
|
68628
|
+
if (foundLesson.isExplainer() && readmeFile) {
|
|
68629
|
+
yield* logReadmeFile({ readmeFile });
|
|
68630
|
+
}
|
|
68605
68631
|
});
|
|
68606
68632
|
var notFound2 = Symbol("notFound");
|
|
68607
68633
|
var getNumberFromPathSegment = (path10) => {
|