ai-hero-cli 0.0.6 → 0.0.7
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 +134 -0
- package/bin.js +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# AI Hero CLI
|
|
2
|
+
|
|
3
|
+
A command-line interface tool designed to help students navigate and run AI Hero exercises efficiently.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The AI Hero CLI is a specialized tool that makes it easy to:
|
|
8
|
+
|
|
9
|
+
- Browse and select exercises from the AI Hero course
|
|
10
|
+
- Run exercises with proper environment setup
|
|
11
|
+
- Navigate between exercises seamlessly
|
|
12
|
+
- Get exercise instructions and context
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
This CLI is typically pre-installed in AI Hero exercise repositories. If you need to install it manually:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add -D ai-hero-cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Basic Commands
|
|
25
|
+
|
|
26
|
+
#### Run an Exercise
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Run a specific exercise by lesson number
|
|
30
|
+
ai-hero exercise 1
|
|
31
|
+
|
|
32
|
+
# Run a specific exercise with subfolder
|
|
33
|
+
ai-hero exercise 1 --subfolder 2
|
|
34
|
+
|
|
35
|
+
# Browse and select an exercise interactively
|
|
36
|
+
ai-hero exercise
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Command Options
|
|
40
|
+
|
|
41
|
+
- `--root`: Directory to look for lessons (default: current directory)
|
|
42
|
+
- `--env-file`: Path to environment file (default: `.env` in current directory)
|
|
43
|
+
- `--cwd`: Working directory to run the command in (default: current directory)
|
|
44
|
+
|
|
45
|
+
### Interactive Features
|
|
46
|
+
|
|
47
|
+
When running an exercise, the CLI provides an interactive interface with several shortcuts:
|
|
48
|
+
|
|
49
|
+
- **Enter**: Choose a new exercise to run
|
|
50
|
+
- **n**: Go to the next exercise
|
|
51
|
+
- **p**: Go to the previous exercise
|
|
52
|
+
- **q**: Quit the current exercise
|
|
53
|
+
- **h**: Show all available shortcuts
|
|
54
|
+
|
|
55
|
+
### Exercise Navigation
|
|
56
|
+
|
|
57
|
+
The CLI automatically detects the structure of your AI Hero exercises and provides seamless navigation:
|
|
58
|
+
|
|
59
|
+
1. **Exercise Selection**: Use the interactive menu to browse and search through available exercises
|
|
60
|
+
2. **Subfolder Support**: If an exercise has multiple subfolders, you'll be prompted to select one
|
|
61
|
+
3. **Progressive Navigation**: Easily move to the next or previous exercise in the course
|
|
62
|
+
4. **Context Preservation**: The CLI remembers your position and provides relevant navigation options
|
|
63
|
+
|
|
64
|
+
### Exercise Execution
|
|
65
|
+
|
|
66
|
+
When you run an exercise:
|
|
67
|
+
|
|
68
|
+
1. The CLI clears the terminal and displays the exercise information
|
|
69
|
+
2. Shows the exercise instructions (if available in `readme.md`)
|
|
70
|
+
3. Runs the exercise using `pnpm tsx` with your environment variables
|
|
71
|
+
4. Provides interactive controls while the exercise is running
|
|
72
|
+
5. Offers options when the exercise completes or encounters an error
|
|
73
|
+
|
|
74
|
+
### Post-Exercise Options
|
|
75
|
+
|
|
76
|
+
After an exercise completes, you can:
|
|
77
|
+
|
|
78
|
+
- **Run Again**: Retry the current exercise
|
|
79
|
+
- **Next Exercise**: Automatically move to the next exercise in the sequence
|
|
80
|
+
- **Previous Exercise**: Go back to the previous exercise
|
|
81
|
+
- **Choose Exercise**: Browse and select a different exercise
|
|
82
|
+
- **Finish**: Exit the CLI
|
|
83
|
+
|
|
84
|
+
## Internal Commands
|
|
85
|
+
|
|
86
|
+
The CLI also includes internal commands for maintenance:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Upgrade AI SDK packages
|
|
90
|
+
ai-hero internal upgrade
|
|
91
|
+
|
|
92
|
+
# Upgrade with verbose output
|
|
93
|
+
ai-hero internal upgrade --verbose
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## File Structure Expectations
|
|
97
|
+
|
|
98
|
+
The CLI expects your AI Hero exercises to follow this structure:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
exercises/
|
|
102
|
+
├── 1-section-name/
|
|
103
|
+
│ ├── 1-exercise-name/
|
|
104
|
+
│ │ ├── main.ts
|
|
105
|
+
│ │ └── readme.md
|
|
106
|
+
│ └── 2-another-exercise/
|
|
107
|
+
│ ├── main.ts
|
|
108
|
+
│ └── readme.md
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- Each exercise should have a `main.ts` file as the entry point
|
|
112
|
+
- Optional `readme.md` files provide exercise instructions
|
|
113
|
+
- Exercise and section names should start with a number followed by a hyphen
|
|
114
|
+
|
|
115
|
+
## Environment Setup
|
|
116
|
+
|
|
117
|
+
The CLI automatically loads environment variables from:
|
|
118
|
+
|
|
119
|
+
- `.env` file in the current directory (default)
|
|
120
|
+
- Custom env file specified with `--env-file` option
|
|
121
|
+
|
|
122
|
+
Make sure your `.env` file contains any necessary API keys or configuration for the exercises.
|
|
123
|
+
|
|
124
|
+
## Troubleshooting
|
|
125
|
+
|
|
126
|
+
### Getting Help
|
|
127
|
+
|
|
128
|
+
- Use `h` during exercise execution to see available shortcuts
|
|
129
|
+
- Check the exercise's `readme.md` file for specific instructions
|
|
130
|
+
- Ensure all dependencies are installed with `pnpm install`
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
**Note**: This CLI is specifically designed for AI Hero exercises and is not intended for general use outside of the AI Hero course context.
|
package/bin.js
CHANGED
|
@@ -67596,7 +67596,7 @@ var exercise = Command_exports2.make(
|
|
|
67596
67596
|
Options_exports.withDescription(
|
|
67597
67597
|
"The directory to look for lessons"
|
|
67598
67598
|
),
|
|
67599
|
-
Options_exports.withDefault(process.cwd())
|
|
67599
|
+
Options_exports.withDefault(path4.join(process.cwd(), "exercises"))
|
|
67600
67600
|
),
|
|
67601
67601
|
envFilePath: Options_exports.text("env-file").pipe(
|
|
67602
67602
|
Options_exports.withDescription(
|