ai-hero-cli 0.0.20 → 0.0.22

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 (2) hide show
  1. package/bin.cjs +34 -16
  2. package/package.json +1 -1
package/bin.cjs CHANGED
@@ -68601,7 +68601,11 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
68601
68601
  const processOutcome = yield* Effect_exports.raceAll([
68602
68602
  Effect_exports.gen(function* () {
68603
68603
  const proc = yield* Command_exports.start(command2);
68604
- const killWithLogging = () => proc.kill().pipe(
68604
+ const killWithLogging = () => Effect_exports.gen(function* () {
68605
+ if (yield* proc.isRunning) {
68606
+ return yield* proc.kill();
68607
+ }
68608
+ }).pipe(
68605
68609
  Effect_exports.catchAll(
68606
68610
  (e) => Effect_exports.logDebug(
68607
68611
  `Error occurred when killing child process.`,
@@ -68609,35 +68613,26 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
68609
68613
  )
68610
68614
  )
68611
68615
  );
68612
- yield* Effect_exports.addFinalizer(
68613
- () => killWithLogging().pipe(
68614
- Effect_exports.catchAll(
68615
- (e) => Effect_exports.logDebug(
68616
- `Error occurred when killing child process.`,
68617
- e
68618
- )
68619
- )
68620
- )
68621
- );
68622
- const kill = () => killWithLogging().pipe(Effect_exports.runPromise);
68616
+ yield* Effect_exports.addFinalizer(() => killWithLogging());
68617
+ const killAsCallback = () => killWithLogging().pipe(Effect_exports.runPromise);
68623
68618
  yield* Effect_exports.fork(
68624
68619
  Effect_exports.sync(() => {
68625
- process.on("SIGINT", kill);
68620
+ process.on("SIGINT", killAsCallback);
68626
68621
  })
68627
68622
  );
68628
68623
  yield* Effect_exports.fork(
68629
68624
  Effect_exports.sync(() => {
68630
- process.on("SIGTERM", kill);
68625
+ process.on("SIGTERM", killAsCallback);
68631
68626
  })
68632
68627
  );
68633
68628
  yield* Effect_exports.addFinalizer(() => {
68634
68629
  return Effect_exports.sync(
68635
- () => process.removeListener("SIGINT", kill)
68630
+ () => process.removeListener("SIGINT", killAsCallback)
68636
68631
  );
68637
68632
  });
68638
68633
  yield* Effect_exports.addFinalizer(() => {
68639
68634
  return Effect_exports.sync(
68640
- () => process.removeListener("SIGTERM", kill)
68635
+ () => process.removeListener("SIGTERM", killAsCallback)
68641
68636
  );
68642
68637
  });
68643
68638
  const result = yield* proc.exitCode;
@@ -69190,6 +69185,7 @@ var lint = Command_exports2.make(
69190
69185
  return exists4;
69191
69186
  })
69192
69187
  });
69188
+ const allReadmeContents = [];
69193
69189
  const errorTracker = createErrorTracker();
69194
69190
  const lessonParser = yield* LessonParserService;
69195
69191
  const fs = yield* FileSystem_exports.FileSystem;
@@ -69230,6 +69226,7 @@ var lint = Command_exports2.make(
69230
69226
  const readmeContent = yield* fs.readFileString(
69231
69227
  readmePath
69232
69228
  );
69229
+ allReadmeContents.push(readmeContent);
69233
69230
  if (readmeContent.trim().length === 0) {
69234
69231
  errorTracker.addError(
69235
69232
  lesson,
@@ -69294,6 +69291,15 @@ var lint = Command_exports2.make(
69294
69291
  `main.ts file not found in the ${subfolder} folder.`
69295
69292
  );
69296
69293
  }
69294
+ const mainFileContent = yield* fs.readFileString(
69295
+ mainFilePath
69296
+ );
69297
+ if (mainFileContent.trim().length === 0) {
69298
+ errorTracker.addError(
69299
+ lesson,
69300
+ `main.ts file is empty in the ${subfolder} folder.`
69301
+ );
69302
+ }
69297
69303
  }
69298
69304
  const files = yield* lesson.allFiles();
69299
69305
  if (files.some((file6) => file6.includes(".gitkeep"))) {
@@ -69303,6 +69309,18 @@ var lint = Command_exports2.make(
69303
69309
  );
69304
69310
  }
69305
69311
  }
69312
+ const readmeContents = allReadmeContents.join("\n");
69313
+ const referenceLessons = lessons.filter(
69314
+ (lesson) => lesson.sectionName === "reference"
69315
+ );
69316
+ for (const referenceLesson of referenceLessons) {
69317
+ if (!readmeContents.includes(referenceLesson.path)) {
69318
+ errorTracker.addError(
69319
+ referenceLesson,
69320
+ `${referenceLesson.path} is not referenced in any other exercise.`
69321
+ );
69322
+ }
69323
+ }
69306
69324
  yield* errorTracker.log;
69307
69325
  },
69308
69326
  Effect_exports.catchTags({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hero-cli",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "description": "The CLI used to run exercises for the AI Hero course",
6
6
  "bin": "bin.cjs",