ai-hero-cli 0.0.25 → 0.0.26

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 +27 -12
  2. package/package.json +1 -1
package/bin.cjs CHANGED
@@ -51999,8 +51999,8 @@ var require_main = __commonJS({
51999
51999
  const shortPaths = [];
52000
52000
  for (const filePath of optionPaths) {
52001
52001
  try {
52002
- const relative2 = path11.relative(process.cwd(), filePath);
52003
- shortPaths.push(relative2);
52002
+ const relative3 = path11.relative(process.cwd(), filePath);
52003
+ shortPaths.push(relative3);
52004
52004
  } catch (e) {
52005
52005
  if (debug3) {
52006
52006
  _debug(`Failed to load ${filePath} ${e.message}`);
@@ -83495,7 +83495,7 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
83495
83495
  const command2 = Command_exports.make(
83496
83496
  "pnpm",
83497
83497
  "tsx",
83498
- "--env-file",
83498
+ `--env-file`,
83499
83499
  envFilePath,
83500
83500
  mainFile
83501
83501
  ).pipe(
@@ -83699,6 +83699,9 @@ var logReadmeFile = Effect_exports.fn("logReadmeFile")(
83699
83699
  );
83700
83700
  }
83701
83701
  );
83702
+ var normalizeExerciseNumber = (str) => {
83703
+ return str.replace(/\b0+(\d)/g, "$1");
83704
+ };
83702
83705
  var chooseLessonAndRunIt = (opts) => Effect_exports.gen(function* () {
83703
83706
  const lessonService = yield* LessonParserService;
83704
83707
  const lessons = yield* lessonService.getLessonsFromRepo(
@@ -83717,11 +83720,12 @@ var chooseLessonAndRunIt = (opts) => Effect_exports.gen(function* () {
83717
83720
  description: lesson.name
83718
83721
  })),
83719
83722
  suggest: async (input, choices) => {
83720
- return choices.filter(
83721
- (choice6) => `${choice6.title}-${choice6.description}`.includes(
83722
- input
83723
- )
83724
- );
83723
+ const normalizedInput = normalizeExerciseNumber(input);
83724
+ return choices.filter((choice6) => {
83725
+ const searchText = `${choice6.title}-${choice6.description}`;
83726
+ const normalizedSearchText = normalizeExerciseNumber(searchText);
83727
+ return searchText.includes(input) || normalizedSearchText.includes(normalizedInput);
83728
+ });
83725
83729
  }
83726
83730
  }
83727
83731
  ])
@@ -83762,11 +83766,15 @@ var exercise = Command_exports2.make(
83762
83766
  },
83763
83767
  ({ cwd, debug: debug3, envFilePath, lesson, root, simple: simple3 }) => {
83764
83768
  return Effect_exports.gen(function* () {
83769
+ const resolvedEnvFilePath = path4__namespace.relative(
83770
+ cwd,
83771
+ envFilePath
83772
+ );
83765
83773
  if (Option_exports.isSome(lesson)) {
83766
83774
  return yield* runLesson({
83767
83775
  lesson: lesson.value,
83768
83776
  root,
83769
- envFilePath,
83777
+ envFilePath: resolvedEnvFilePath,
83770
83778
  cwd,
83771
83779
  forceSubfolderIndex: void 0,
83772
83780
  simple: simple3
@@ -83778,7 +83786,7 @@ var exercise = Command_exports2.make(
83778
83786
  }
83779
83787
  return yield* chooseLessonAndRunIt({
83780
83788
  root,
83781
- envFilePath,
83789
+ envFilePath: resolvedEnvFilePath,
83782
83790
  cwd,
83783
83791
  simple: simple3
83784
83792
  }).pipe(
@@ -83876,7 +83884,7 @@ var runLessonSimple = (opts) => Effect_exports.gen(function* () {
83876
83884
  util.styleText("bold", `Running ${lesson} ${subfolder}...`)
83877
83885
  );
83878
83886
  ChildProcess.execSync(
83879
- `pnpm tsx --env-file "${envFilePath}" "${mainFile}"`,
83887
+ `pnpm tsx --env-file="${envFilePath}" "${mainFile}"`,
83880
83888
  {
83881
83889
  stdio: "inherit",
83882
83890
  cwd
@@ -84214,6 +84222,12 @@ var lint = Command_exports2.make(
84214
84222
  ".gitkeep file found in the exercise."
84215
84223
  );
84216
84224
  }
84225
+ if (files.some((file6) => file6.includes("speaker-notes.md"))) {
84226
+ errorTracker.addError(
84227
+ lesson,
84228
+ "speaker-notes.md file found in the exercise. This should not be exposed to users."
84229
+ );
84230
+ }
84217
84231
  }
84218
84232
  const readmeContents = allReadmeContents.join("\n");
84219
84233
  const referenceLessons = lessons.filter(
@@ -84519,7 +84533,8 @@ var upgradePackages = Command_exports2.make(
84519
84533
  "ai@latest",
84520
84534
  "@ai-sdk/*@latest",
84521
84535
  "ai-hero-cli@latest",
84522
- "evalite@latest"
84536
+ "evalite@latest",
84537
+ "vitest@latest"
84523
84538
  ).pipe(
84524
84539
  verbose ? Command_exports.stdout("inherit") : Command_exports.stdout("pipe"),
84525
84540
  verbose ? Command_exports.stderr("inherit") : Command_exports.stderr("pipe"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-hero-cli",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "type": "module",
5
5
  "description": "The CLI used to run exercises for the AI Hero course",
6
6
  "bin": "bin.cjs",