feat: Major enhancements - Configurable statusline, AI feedback system, and improved UX#4
feat: Major enhancements - Configurable statusline, AI feedback system, and improved UX#4scotthamilton77 wants to merge 8 commits intoIdo-Levi:mainfrom
Conversation
- Add modular StatuslineBuilder system with configurable components - Implement token usage tracking with context percentage calculation - Add git branch detection with color-coded display - Include cost and duration formatting from session data - Make all statusline components optional via environment variables - Maintain backward compatibility with existing pet functionality - Add comprehensive configuration options and .env.example Features: - 🪙 Token usage with smart K formatting and color coding - ⎇ Git branch display with color coding by branch type - 💰 Session cost tracking with smart currency formatting - ⏱️ Response duration with human-readable time units - 📁 Directory display with truncation - 🤖 Model name display - (◕ᴥ◕) Optional pet display and stats - 💭 Optional pet thoughts and system messages All components can be disabled independently using PET_SHOW_* environment variables. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…move obsolete test-statusline.json
Feature/enhanced statusline
There was a problem hiding this comment.
Pull Request Overview
This PR introduces major enhancements to the Claude Code Tamagotchi with a focus on configurability, AI-powered interactions, and improved user experience. The changes transform the statusline from a monolithic output into a modular, configurable system while adding intelligent feedback capabilities.
- Configurable statusline system with individual component controls and priority-based rendering
- AI feedback system using Groq LLM API for contextual pet reactions and behavior analysis
- Enhanced testing framework with comprehensive unit tests for new functionality
Reviewed Changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/statusline.ts | New utility functions for statusline component formatting and data processing |
| src/utils/config.ts | Enhanced configuration with statusline component controls and validation |
| src/utils/StatuslineBuilder.ts | New modular component architecture for building configurable statuslines |
| src/index.ts | Refactored main entry point to use new statusline builder system |
| src/utils/tests/* | Comprehensive test suite for new statusline and configuration functionality |
| setup.sh | Added new pet-explain command registration |
| docs/* | Updated documentation for new features and configuration options |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| petType: (['dog', 'cat', 'dragon', 'robot'].includes(process.env.PET_TYPE as string) | ||
| ? process.env.PET_TYPE as 'dog' | 'cat' | 'dragon' | 'robot' | ||
| : 'dog'), |
There was a problem hiding this comment.
The pet type validation logic is duplicated. Consider extracting this into a helper function to reduce code duplication and improve maintainability.
| weather: (['sunny', 'rainy', 'snowy', 'cloudy'].includes(process.env.WEATHER as string) | ||
| ? process.env.WEATHER as 'sunny' | 'rainy' | 'snowy' | 'cloudy' | ||
| : 'sunny'), | ||
| season: (['spring', 'summer', 'fall', 'winter'].includes(process.env.SEASON as string) | ||
| ? process.env.SEASON as 'spring' | 'summer' | 'fall' | 'winter' | ||
| : 'spring'), |
There was a problem hiding this comment.
The validation pattern for weather and season values is repetitive. Consider creating a generic validation helper function that takes an array of valid values and returns a validator function to reduce code duplication.
| if (sessionId && sessionId !== 'null') { | ||
| try { | ||
| // Find transcript file in Claude projects directory | ||
| const claudeDir = path.join(process.env.HOME || '~', '.claude', 'projects'); |
There was a problem hiding this comment.
Using '' as a fallback for process.env.HOME is incorrect. The '' character won't be expanded by path.join(). Consider using os.homedir() as the fallback instead.
| try { | ||
| const rendered = component.render(input, petData); | ||
| if (rendered && rendered.trim()) { | ||
| parts.push(rendered.trim()); | ||
| } | ||
| } catch (error) { | ||
| // Silently skip components that fail to render | ||
| if (config.debugMode) { | ||
| console.error(`Failed to render component ${component.id}:`, error); | ||
| } | ||
| } |
There was a problem hiding this comment.
The double trim() call on line 202 and 203 is redundant. Consider storing the trimmed result in a variable to avoid the duplicate operation.
Summary
This PR introduces major enhancements to the Claude Code Tamagotchi, focusing on configurability, AI-powered interactions, and improved user experience.
🌟 Key Features
Enhanced Configurable Statusline System
AI-Powered Feedback System
New Commands & Features
/pet-explaincommand for statusline debugging and analysis🔧 Technical Improvements
📚 Documentation & Setup
./setup.shscript./enable-feedback.sh⚙️ New Environment Variables
Core Controls:
PET_SHOW_PET,PET_SHOW_STATS,PET_SHOW_TOKENS- Component visibilityPET_SHOW_GIT_BRANCH,PET_SHOW_COST,PET_SHOW_DURATION- Additional componentsAI Feedback System:
PET_FEEDBACK_ENABLED- Enable AI-powered observationsPET_GROQ_API_KEY- Groq API key for LLM integrationPET_GROQ_MODEL- Configurable LLM model selectionTest Plan
/pet-explaincommand functionalityBreaking Changes
None - all enhancements are backward compatible with existing configurations.
🤖 Generated with Claude Code