Skip to content

Commit c9ae6de

Browse files
jrollinclaude
andcommitted
feat: add custom user-provided markdown lessons
Implement support for user-provided markdown lessons loaded from custom directories. Users can now create personalized typing practice content with preserved formatting. Core Features: - Load lessons from ~/.config/typer-cli/custom/ and ./custom/ - YAML front matter support for metadata (title, description) - Manual YAML parser (zero new dependencies) - Automatic title deduplication with (1), (2) suffix - Graceful error handling with stderr warnings - Empty state UI with helpful instructions Implementation: - New module: src/content/custom.rs (350+ lines) - Custom category with Blue color scheme - Preserved formatting (line breaks, spacing, indentation) - Statistics tracking using lesson title as identifier - File size limit (1MB) with validation Testing: - 11 new unit tests (146 total passing) - Zero clippy warnings - Full code formatting compliance Documentation: - Feature docs (requirements.md, design.md, tasks.md) - User guide in README.md with examples - Updated contributor docs and AI context - Complete tasks checklist Files Modified: - New: src/content/custom.rs - New: docs/features/custom-lessons/ (3 files) - Modified: 10 existing files - Updated: .gitignore (ignore /custom directory) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent a58ff89 commit c9ae6de

File tree

14 files changed

+1297
-12
lines changed

14 files changed

+1297
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
/custom

CLAUDE.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ Quick reference for AI assistants working on this project.
1818
**Phase 3.2: Finger Training** - ✅ Completed
1919
**Phase 3.3: Two-Level Menu System** - ✅ Completed
2020
**Phase 3.4: Menu Grouping** - ✅ Completed
21+
**Phase 3.5: Statistics Dashboard** - ✅ Completed
2122
**Phase 3.6: AltGr Modifier Support** - ✅ Completed
23+
**Phase 3.7: Custom Lessons** - ✅ Completed
2224
**Current Focus**: Phase 3+ (Analytics visualization, data export, gamification)
2325

2426
## Dead Code Annotations
2527

26-
The codebase contains **28 intentional `#[allow(dead_code)]` annotations** marking Phase 3+ features that are:
28+
The codebase contains **29 intentional `#[allow(dead_code)]` annotations** marking Phase 3+ features that are:
2729
- Fully tested and ready for future implementation
2830
- Strategic placeholders for planned features (analytics, export, multi-layout support)
2931
- Preserved to avoid reimplementation work
@@ -40,6 +42,7 @@ These are NOT technical debt - they represent well-architected future functional
4042
- Test Utilities (3): Reusable drill generation patterns
4143
- Adaptive Features (2): WeaknessDetector (fully tested, ready for UI)
4244
- Scoring Utilities (1): calculate_accuracy() reference implementation
45+
- Custom Lesson Validation (1): ParseError::InvalidFrontMatter for future strict YAML validation
4346

4447
## Project Overview
4548

@@ -52,7 +55,7 @@ This project uses feature-based documentation. See [docs/README.md](docs/README.
5255
- Steering documents (product, tech, structure)
5356
- Feature documentation organization
5457

55-
**77 lessons** across 5 categories: Adaptive, Finger Training, Key Training, Languages, Code
58+
**77 lessons** across 6 categories: Adaptive, Finger Training, Key Training, Languages, Code, Custom
5659

5760
| Feature | Module | Status |
5861
|---------|--------|--------|
@@ -65,6 +68,7 @@ This project uses feature-based documentation. See [docs/README.md](docs/README.
6568
| Finger Training | `src/content/finger_generator.rs` | ✅ Phase 3.2 |
6669
| Two-Level Menu | `src/content/category.rs`, `app.rs` | ✅ Phase 3.3 |
6770
| Statistics Dashboard | `src/ui/render.rs` | ✅ Phase 3.5 |
71+
| Custom Lessons | `src/content/custom.rs` | ✅ Phase 3.7 |
6872

6973
See [docs/README.md#features-overview](docs/README.md#features-overview) for detailed feature descriptions.
7074

@@ -73,7 +77,7 @@ See [docs/README.md#features-overview](docs/README.md#features-overview) for det
7377
```bash
7478
# Development
7579
cargo run # Launch application
76-
cargo test # Run test suite (129 tests)
80+
cargo test # Run test suite (146 tests)
7781
cargo check # Fast compilation check
7882

7983
# Testing Adaptive Mode
@@ -96,7 +100,7 @@ git push origin v0.2.0 # Push tag to trigger automated release
96100
## CI/CD Workflows
97101

98102
### Continuous Integration
99-
Runs on every push to `main` and all PRs: formatting, linting, tests (129 passing), security audit.
103+
Runs on every push to `main` and all PRs: formatting, linting, tests (146 passing), security audit.
100104

101105
### Release Automation
102106
Triggers on git tag `v*.*.*`:
@@ -130,6 +134,7 @@ src/
130134
│ ├── adaptive_generator.rs # Personalized content
131135
│ ├── bigram_generator.rs # Bigram practice
132136
│ ├── code_generator.rs # Code symbols
137+
│ ├── custom.rs # User-provided markdown lessons
133138
│ ├── finger_generator.rs # Finger-based drills
134139
│ ├── lesson.rs # Lesson types, definitions
135140
│ └── generator.rs # Home row drills
@@ -163,9 +168,9 @@ See [docs/features/session-storage/](docs/features/session-storage/) for complet
163168

164169
## Current Status
165170

166-
**Phase**: 3.5 Complete (Statistics Dashboard)
171+
**Phase**: 3.7 Complete (Custom Lessons)
167172
**Next**: Phase 3+ (Analytics visualization, data export, gamification)
168-
**Tests**: 129 passing
169-
**Lessons**: 77 total
173+
**Tests**: 146 passing
174+
**Lessons**: 77 built-in + user custom lessons
170175

171176
See [docs/README.md#project-status](docs/README.md#project-status) for complete roadmap.

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,58 @@ Session statistics are saved to `~/.config/typer-cli/stats.json`.
178178
The file contains session history and adaptive analytics for personalized training.
179179
See [docs/features/session-storage/](docs/features/session-storage/) for data schema details.
180180

181+
## Custom Lessons
182+
183+
Create your own typing lessons by placing markdown files in `~/.config/typer-cli/custom/` or `./custom/` (current directory).
184+
185+
### Markdown Format
186+
187+
Custom lessons use markdown files with optional YAML front matter:
188+
189+
```markdown
190+
---
191+
title: My Custom Lesson
192+
description: Practice domain-specific vocabulary
193+
---
194+
195+
Your custom content to practice goes here.
196+
Line breaks and spacing are preserved.
197+
Multiple lines are supported.
198+
```
199+
200+
### Features
201+
202+
- **Two locations**: Config directory (`~/.config/typer-cli/custom/`) or current directory (`./custom/`)
203+
- **YAML front matter**: Optional metadata with `title` and `description` fields
204+
- **Title fallback**: If no front matter, filename (without .md) is used as title
205+
- **Preserved formatting**: Line breaks, spacing, and indentation are maintained during practice
206+
- **Automatic deduplication**: Duplicate titles get (1), (2) suffix
207+
- **Statistics tracking**: Session stats saved using lesson title as identifier
208+
- **Error handling**: Invalid files show warnings but don't crash the application
209+
210+
### Example
211+
212+
1. Create `~/.config/typer-cli/custom/git-commands.md`:
213+
```markdown
214+
---
215+
title: Git Commands Practice
216+
description: Common git operations
217+
---
218+
219+
git status
220+
git add .
221+
git commit -m "feat: add feature"
222+
git push origin main
223+
git pull --rebase
224+
git branch -d feature-branch
225+
```
226+
227+
2. Launch Typer CLI and select "Custom" category
228+
3. Choose "Git Commands Practice" from the lesson list
229+
4. Practice with preserved formatting and line breaks
230+
231+
See [docs/features/custom-lessons/](docs/features/custom-lessons/) for complete documentation.
232+
181233
## Development
182234

183235
### Build and Run
@@ -188,7 +240,7 @@ cargo build --release # Build optimized binary
188240

189241
### Tests
190242
```bash
191-
cargo test # Run test suite (129 passing tests)
243+
cargo test # Run test suite (146 passing tests)
192244
```
193245

194246
### Code Quality

docs/README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ Performance analytics dashboard with visual keyboard heatmap.
210210
- Accessible via 's' key from main menu
211211
- Graceful placeholder when no analytics data exists
212212

213+
#### [custom-lessons/](features/custom-lessons/) ✅ COMPLETED
214+
User-provided markdown lessons for personalized typing practice.
215+
216+
**Module**: `src/content/custom.rs`
217+
218+
- Load from `~/.config/typer-cli/custom/` and `./custom/`
219+
- YAML front matter support (title, description)
220+
- Automatic deduplication of titles with (1), (2) suffix
221+
- Preserved formatting (line breaks, spacing, indentation)
222+
- New "Custom" category in menu
223+
- Stats tracking with lesson title as identifier
224+
- Graceful error handling with warning messages
225+
- No external dependencies (uses std library only)
226+
213227
### Future Features (Phase 3+)
214228

215229
- **Enhanced analytics** - Trend graphs, progress charts over time, session history visualization
@@ -283,9 +297,9 @@ Module locations are documented in each feature's design.md:
283297

284298
## Project Status
285299

286-
**Current Phase**: Phase 3.5 Complete (Statistics Dashboard) ✓
300+
**Current Phase**: Phase 3.6 Complete (Custom Lessons) ✓
287301

288-
**Total Tests**: 129 passing
302+
**Total Tests**: 146 passing
289303
- 13 tests: typing-session
290304
- 7 tests: home-row-lessons
291305
- 12 tests: bigram-training
@@ -297,6 +311,8 @@ Module locations are documented in each feature's design.md:
297311
- 2 tests: keyboard-layout
298312
- 3 tests: content generation
299313
- 1 test: data structures
314+
- 11 tests: custom lessons
315+
- 54 tests: other features (trigrams, common words, finger training, etc.)
300316

301317
**Completed Features**:
302318
- Phase 1: Home row Level 1 ✓
@@ -312,6 +328,7 @@ Module locations are documented in each feature's design.md:
312328
- Phase 3.3: Two-level menu system ✓
313329
- Phase 3.4: Menu grouping ✓
314330
- Phase 3.5: Statistics dashboard ✓
331+
- Phase 3.6: Custom lessons ✓
315332

316333
**Total Lessons**: 77 (52 standard + 24 finger training + 1 adaptive)
317334

0 commit comments

Comments
 (0)