UNPKG

hackages

Version:

CLI tool for learning software development concepts through test-driven development

335 lines (232 loc) โ€ข 10.7 kB
# Hackages CLI > ๐ŸŽฏ Learn software development concepts through test-driven development Hackages is an interactive CLI tool that helps developers learn new concepts by generating personalized coding exercises using AI-powered test-driven development. ## โœจ Features - ๐Ÿค– **AI-Powered Exercise Generation** - Creates custom learning exercises based on your goals - ๐Ÿงช **Test-Driven Learning** - Learn by making tests pass, not by reading tutorials - ๐ŸŽฏ **Personalized Content** - Adapts to your skill level and preferred programming language - ๐Ÿ” **Smart Technology Detection** - Automatically detects technology from your learning goal - โœ… **Technology Confirmation** - Always confirms your technology choice for clarity - ๐Ÿ“‹ **Smart Code Review** - Get feedback on your implementations - โšก **Interactive CLI** - Modern interface with arrow key navigation - ๐Ÿ”„ **Iterative Learning** - Run tests and get feedback in a continuous loop - ๐Ÿ“ฆ **Repository Templates** - Clones technology-specific templates with proper project structure - ๐ŸŽ‰ **Onboarding Experience** - New users get a guided introduction with 3 simple options ## ๐Ÿš€ Installation Install globally via npm: ```bash npm install -g hackages ``` or ```bash npx hackages ``` ## ๐Ÿ“– Quick Start ### For New Users (First Time) After installation, simply run: ```bash hackages ``` You'll see a welcoming introduction explaining what Hackages is about, followed by 3 simple options: 1. **JavaScript Array Methods** - Learn how to use map, filter, and reduce 2. **TypeScript Functions** - Learn function types and interfaces 3. **Surprise Me!** - Let Hackages pick something fun for you Choose one and get your first exercise instantly - no authentication required! **Example Onboarding Flow:** ```bash $ hackages ๐ŸŽ‰ Welcome to Hackages! ๐ŸŽ‰ ================================================== ๐Ÿš€ Learn software development through hands-on coding challenges ๐Ÿงช Write code, run tests, get instant review and feedback ๐ŸŽฏ Master concepts by doing, not just reading ================================================== โœจ What you'll get: โ€ข A coding challenge with clear instructions โ€ข Test cases that guide your implementation โ€ข AI-powered feedback on your code โ€ข A fun, interactive learning experience ๐ŸŽฏ Ready to try? Pick one: ? Choose your first exercise: โ€บ 1. JavaScript Array Methods ๐ŸŽ‰ Great choice! You'll be learning: JavaScript Array Methods ๐Ÿ”„ Generating your first exercise... ๐ŸŽ‰ Your first exercise is ready! ================================================== ๐Ÿ“ Files created: โœ“ tests/exercise.spec.js (Your test cases) โœ“ src/exercise.js (Your implementation file) ๐Ÿš€ Next steps: 1. Read the instructions and test file to understand what to implement 2. Open src/exercise.js and start coding 3. Run 'npx hackages test' to validate your implementation 4. Run 'npx hackages review' to get feedback on your code ๐Ÿ’ก Want to continue learning? Run 'npx hackages' again to create more exercises and track your progress! ``` ### For Returning Users If you've used Hackages before and are logged in, you'll get the full personalized experience with custom learning goals and progress tracking. ### Available Commands ```bash # Start learning (default) - creates new exercise hackages # Continue working on existing exercise (interactive mode) hackages continue # Run tests for your current exercise hackages test # Get code review and feedback hackages review # Login with GitHub account hackages login # Logout from your account hackages logout # Show help hackages --help ``` ## ๐ŸŽฎ How It Works ### 1. Start Learning Run `hackages` and answer a few questions: - What concept do you want to learn? (e.g., "JavaScript arrays", "recursion", "async/await") - Confirm your technology choice (even if detected from your goal) - What's your skill level? (Beginner/Intermediate/Advanced) - What's your motivation? - How much time do you have? - Login with GitHub account (automatic after goal collection) ### 2. Repository Template Cloning Hackages automatically detects your preferred technology and clones the appropriate template repository: - **TypeScript**: `git@github.com:hackages/ts-template.git` (SSH) or `https://github.com/hackages/ts-template.git` (HTTPS) - **JavaScript**: `git@github.com:hackages/js-template.git` (SSH) or `https://github.com/hackages/js-template.git` (HTTPS) - **GoLang**: `git@github.com:hackages/go-template.git` (SSH) or `https://github.com/hackages/go-template.git` (HTTPS) - **Python**: `git@github.com:hackages/python-template.git` (SSH) or `https://github.com/hackages/python-template.git` (HTTPS) The system detects your Git protocol preference (SSH vs HTTPS) and uses the appropriate URL. ### 3. Exercise Files Hackages creates exercise files in the cloned repository: - `tests/exercise-1.spec.ts` - Test cases that define what to build - `src/exercise-1.ts` - Empty implementation file for you to code - `instructions/exercise-1.mdx` - Detailed instructions and learning objectives ### 4. Test-Driven Development 1. Navigate to your exercise directory: `cd <exercise-name>` 2. Read the instructions and tests files to understand requirements 3. Write code to make tests pass 4. Run `npx hackages test` to check your progress 5. Get feedback with `npx hackages review` ### 5. Continue Learning Use `hackages continue` to access the interactive menu: - **๐Ÿงช Run Tests**: Validate your implementation - **๐Ÿ“‹ Code Review**: Get feedback and suggestions - **๐Ÿš€ Next Learning**: Continue with recommended learning steps (appears after code review) - **๐Ÿ‘‹ Exit**: End your learning session The "Next Learning" option only appears if you have previous feedback from a code review, and it shows up to 3 AI-recommended learning steps plus an option to write your own goal. ## ๐ŸŽฏ Example Learning Session ```bash $ hackages ๐ŸŽฏ Hackages Lab ================================================== โœ” ๐Ÿ’ก What software development concept would you like to learn today? โ€บ TypeScript map function โœ… Detected language: TypeScript โœ” ๐Ÿ› ๏ธ Please confirm your technology choice: โ€บ TypeScript (Your selection) โœ” ๐Ÿ“Š Select your skill level: โ€บ Beginner ๐Ÿ” You'll be logging in with your GitHub account to track your progress. Press Enter to continue... ๐Ÿ“ฅ Cloning TypeScript template repository... โœ… Repository template cloned to: typescript-map-function ๐ŸŽ‰ Your learning exercise is ready! ๐Ÿ“ Repository cloned: โœ“ typescript-map-function/ (Your exercise directory) โœ“ typescript-map-function/tests/exercise-1.spec.ts (Your test cases) โœ“ typescript-map-function/src/exercise-1.ts (Your implementation file) โœ“ typescript-map-function/instructions/exercise-1.mdx (Exercise instructions) ๐Ÿš€ Next steps: 1. cd typescript-map-function (navigate to your exercise directory) 2. Read the instructions and test file to understand what to implement 3. Open src/exercise-1.ts and start coding 4. Run 'npx hackages test' to validate your implementation 5. Run 'npx hackages review' to get feedback on your code $ cd typescript-map-function $ npx hackages test ๐Ÿงช Running tests... ๐Ÿ“ Running tests in: typescript-map-function โŒ 2 tests failed $ hackages review ๐Ÿ“‹ Code Review ================================================== ๐Ÿ“ Files to be reviewed: โœ“ exercise-1.ts โœ“ utils.ts Great start! Here's some feedback... ๐ŸŽ‰ Code review completed! ๐Ÿ“ Feedback saved to: feedback/exercise-1.mdx ๐ŸŒ HTML page generated: feedback-exercise-1.html ๐Ÿ’ก Opening feedback page in browser... ================================================== ๐Ÿš€ Continue Your Learning Journey ================================================== Choose your next learning step: 1. Explore Different Number Types 2. Learn About Function Overloading 3. Error Handling 4. Generic Functions 5. Advanced TypeScript Features 6. Write your next learning goal ๐Ÿ”„ Generating your next exercise... ๐ŸŽ‰ Your next exercise is ready! ๐Ÿ“ Next exercise created: โœ“ tests/exercise-2.spec.ts (Your test cases) โœ“ src/exercise-2.ts (Your implementation file) โœ“ instructions/exercise-2.mdx (Exercise instructions) ``` ## ๐Ÿ“‹ Smart Code Review Get feedback on your implementations with multiple output formats: - **Multi-File Review**: Reviews all files in the `src/` directory automatically - **Terminal Display**: Beautiful formatted feedback in the terminal - **Template Storage**: Feedback saved to `feedback/exercise-1.mdx` in your exercise directory - **HTML Page**: Beautiful web page generated as `feedback-exercise-1.html` - **Backup Storage**: Feedback also saved to `~/.hackages/` for safekeeping - **Learning Continuation**: Hackages suggests next learning steps and generates the next exercise ## ๐Ÿ› ๏ธ Supported Technologies - **JavaScript** - Full support with Vitest - **TypeScript** - Full support with type checking - **Python** - Coming soon - **Java** - Coming soon ## ๐Ÿ“ฆ Repository Templates Hackages uses technology-specific repository templates that provide: - **Proper project structure** with `src/` and `tests/` directories - **Pre-configured testing framework** (Vitest for JS/TS) - **TypeScript configuration** (for TypeScript projects) - **Package.json** with necessary dependencies - **Git ignore files** and other project setup ### Template Repositories - **TypeScript**: [hackages/ts-template](https://github.com/hackages/ts-template) - **JavaScript**: [hackages/js-template](https://github.com/hackages/js-template) The system automatically detects your Git protocol preference: - **SSH**: Uses `git@github.com:hackages/<template>.git` - **HTTPS**: Uses `https://github.com/hackages/<template>.git` ## โš™๏ธ Requirements - Node.js 18+ - npm or yarn - Git (for repository cloning) - [Anthropic API Key](https://console.anthropic.com/) (for AI features) - GitHub account (for authentication) ### Authentication Hackages uses GitHub OAuth for user authentication: ```bash # Login with GitHub (opens browser) hackages login # Check if you're logged in hackages --help # Shows your username if logged in # Logout hackages logout ``` This enables personalized learning experiences and progress tracking. ## ๐ŸŽจ CLI Interface Hackages features a modern CLI interface with: - ๐ŸŽฏ Arrow key navigation (like Vitest) - ๐ŸŽจ Colored output and clear formatting - ๐Ÿ“ Interactive prompts with validation - โšก Fast and responsive design ## ๐Ÿ“„ License ยฉ [Hackages](https://hackages.com) --- **Happy Learning! ๐Ÿš€** _Built with โค๏ธ by the Hackages team_ ---