Skip to content

feat: Major enhancements - Configurable statusline, AI feedback system, and improved UX#4

Open
scotthamilton77 wants to merge 8 commits intoIdo-Levi:mainfrom
scotthamilton77:main
Open

feat: Major enhancements - Configurable statusline, AI feedback system, and improved UX#4
scotthamilton77 wants to merge 8 commits intoIdo-Levi:mainfrom
scotthamilton77:main

Conversation

@scotthamilton77
Copy link
Copy Markdown

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

  • Modular component architecture with individual enable/disable controls
  • Priority-based rendering system with graceful error handling
  • Smart token tracking from Claude Code transcript files
  • Git integration with semantic branch coloring
  • Cost and duration monitoring when available

AI-Powered Feedback System

  • Optional AI system that analyzes Claude Code behavior using Groq LLM API
  • Contextual pet reactions based on coding activity
  • Witty observations about user interactions
  • Mood changes based on Claude's behavior patterns
  • SQLite database for feedback history

New Commands & Features

  • /pet-explain command for statusline debugging and analysis
  • Enhanced animation system with mood-based facial expressions
  • Breathing animations for lifelike appearance
  • Improved thought system with 200+ contextual thoughts

🔧 Technical Improvements

  • Removed hardcoded API keys for better security
  • Comprehensive test coverage for new functionality
  • Improved error handling and logging
  • Enhanced documentation and setup scripts
  • Streamlined configuration through environment variables

📚 Documentation & Setup

  • Detailed setup instructions with ./setup.sh script
  • Comprehensive environment variable documentation
  • AI feedback system setup guide with ./enable-feedback.sh
  • Enhanced CLAUDE.md with architecture overview

⚙️ New Environment Variables

Core Controls:

  • PET_SHOW_PET, PET_SHOW_STATS, PET_SHOW_TOKENS - Component visibility
  • PET_SHOW_GIT_BRANCH, PET_SHOW_COST, PET_SHOW_DURATION - Additional components

AI Feedback System:

  • PET_FEEDBACK_ENABLED - Enable AI-powered observations
  • PET_GROQ_API_KEY - Groq API key for LLM integration
  • PET_GROQ_MODEL - Configurable LLM model selection

Test Plan

  • Enhanced statusline rendering with all components
  • Individual component enable/disable functionality
  • AI feedback system integration (optional)
  • New /pet-explain command functionality
  • Animation system improvements
  • Backward compatibility with existing installations
  • Documentation accuracy and completeness

Breaking Changes

None - all enhancements are backward compatible with existing configurations.

🤖 Generated with Claude Code

scotthamilton77 and others added 8 commits August 31, 2025 09:56
- 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>
@scotthamilton77 scotthamilton77 marked this pull request as ready for review September 7, 2025 17:20
Copilot AI review requested due to automatic review settings September 7, 2025 17:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +125 to +127
petType: (['dog', 'cat', 'dragon', 'robot'].includes(process.env.PET_TYPE as string)
? process.env.PET_TYPE as 'dog' | 'cat' | 'dragon' | 'robot'
: 'dog'),
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pet type validation logic is duplicated. Consider extracting this into a helper function to reduce code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
Comment on lines +137 to +142
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'),
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
if (sessionId && sessionId !== 'null') {
try {
// Find transcript file in Claude projects directory
const claudeDir = path.join(process.env.HOME || '~', '.claude', 'projects');
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +200 to +210
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);
}
}
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double trim() call on line 202 and 203 is redundant. Consider storing the trimmed result in a variable to avoid the duplicate operation.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants