# Changelog

All notable changes to glance-cli will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.2] - 2026-01-02

### 🔧 Fixed: Cache Corruption Issues
- **Critical Fix**: Resolved cache corruption causing garbled/binary artifacts in cached content
  - Fixed double nuclear cleaning that was corrupting cached data on read operations
  - Implemented proper UTF-8 encoding with error handling using TextDecoder
  - Reduced overly aggressive text sanitization that destroyed content structure
  - Added validation to prevent empty/corrupted content from being cached
  - Enhanced error recovery for corrupted cache entries with automatic cleanup

### Technical Details
- Modified cache system to only apply sanitization on write, not read operations
- Added proper encoding detection and UTF-8 conversion with fallback handling
- Improved binary artifact detection to avoid false positives from normal content
- Enhanced cache validation with better error messages and recovery mechanisms
- Fixed memory corruption issues that were causing truncated Ollama responses

### Performance Improvements
- Faster cache operations with reduced processing overhead
- Better memory management for large cached content
- Improved reliability of cache reads across all AI providers

## [0.9.1] - 2026-01-02

### 🧾 MAJOR: AI-Powered Smart Formatting for Full Content
- **Revolutionary Feature**: `--full` mode now uses AI to intelligently format messy content!
  - Automatically organizes blog posts, articles, and complex layouts
  - Preserves ALL original content while making it beautifully readable
  - Perfect structure for both reading and voice synthesis
  - Works with any website layout - no more CSS selector limitations!

### Enhanced
- **Smart Content Recognition**: AI identifies titles, dates, reading times, social links
- **Intelligent Spacing**: Proper paragraph breaks and section separation
- **Article Organization**: Blog posts formatted with metadata (dates, reading times)
- **Link Structure**: Navigation and social media links properly organized
- **Fallback System**: Smart formatting with graceful fallback to raw content

### Performance
- **English Content**: `🧾 Applying smart formatting...` (~3-6 seconds)
- **Multilingual**: Combined translation + formatting for non-English languages
- **Zero Content Loss**: Every piece of original information preserved

### Examples
```bash
# Before: messy wall of text
# After: beautifully structured, readable content
glance https://complex-blog.com --full --read

# Works perfectly with voice synthesis
glance https://personal-website.com --full --voice nova --read

# Multilingual with smart formatting
glance https://messy-site.com --full -l fr --read
```

### Technical Details
- Added `format` option to SummarizeOptions interface
- Created intelligent formatting prompts with content understanding
- Enhanced CLI to apply smart formatting for English content
- Improved error handling with multiple fallback levels

## [0.9.0] - 2026-01-02

### 🌍 MAJOR: Multilingual Full Content Support
- **Breakthrough Feature**: `--full` mode now supports translation to any language!
  - Read entire English articles in French: `glance https://blog.com/post --full -l fr --read`
  - Read French content in English: `glance https://lemonde.fr/article --full -l en --read`
  - Perfect for language learning, accessibility, and international content consumption
  - Preserves original formatting and structure while translating

### Added
- **Translation Engine**: Dedicated translation prompts for accurate, structure-preserving translations
- **Language Detection**: Automatic translation when non-English language specified with `--full`
- **Voice Integration**: Translated full content works seamlessly with voice synthesis
- **Smart Fallback**: Falls back to original content if translation fails

### Improved
- **Text Formatting**: Enhanced paragraph structure preservation in full content mode
- **Performance**: Optimized content extraction to reduce excessive newlines
- **User Experience**: Clear progress indicators ("🌍 Translating full content...")

### Examples
```bash
# Translate Sam Altman's blog to French and listen
glance https://blog.samaltman.com/post --full -l fr --read

# Read Spanish news in English with voice
glance https://elpais.com/news --full -l en --voice nova --read

# Export French content as English markdown
glance https://lemonde.fr/tech --full -l en --export article.md
```

## [0.8.9] - 2026-01-02

### Added
- **Full Content Mode**: New `--full` flag to read entire articles without summarization
  - Perfect for when you want to listen to complete blog posts or documentation
  - Works seamlessly with voice synthesis (`--read`) and audio export (`--audio-output`)
  - Maintains all formatting and structure from original content
  - Example: `glance https://blog.com/article --full --read`

### Improved
- **Content Display**: Shows "📖 Full Content" label when using --full mode
- **Voice Integration**: Full content can be read aloud or saved as audio files
- **Export Options**: Full content can be exported to markdown, JSON, or other formats

### Technical Details
- Added isFullContent flag to formatter options
- Enhanced CLI to skip AI processing when --full is specified
- Optimized performance for full content delivery

## [0.8.8] - 2026-01-02

### Fixed
- **Voice System Improvements**: Fixed voice listing to show only working voices with proper language mapping
- **Text Cleaner Optimization**: Made text cleaning less aggressive to prevent legitimate content removal
- **Cache System**: Resolved overly aggressive cleaning of cache-related terms and content
- **--prefer-quality Flag**: Fixed issue where flag wasn't affecting automatic model selection
- **Voice Validation**: Improved voice name/ID validation and error messages

### Improved
- **Voice Listing**: Clean, organized display by language (🇺🇸 English, 🇫🇷 French, 🇪🇸 Spanish, 🇭🇹 Haitian Creole)
- **Error Messages**: More specific and helpful voice synthesis error messages
- **Text Processing**: Smarter cleaning that preserves paragraph structure and legitimate content
- **Model Selection**: --prefer-quality now correctly prioritizes OpenAI/Gemini over Ollama

### Technical Details
- Enhanced voice mapping system to show only available voices in user's ElevenLabs account
- Refined binary artifact detection to avoid false positives from ANSI color codes
- Improved cache system stability with better error handling
- More conservative text cleaning patterns to preserve legitimate content

## [0.8.7] - 2026-01-02

### Fixed
- **Smart Text Cleaning**: Resolved aggressive text cleaning that was destroying paragraph structure
- **Paragraph Formatting**: Restored beautiful paragraph breaks and section formatting from v0.8.3
- **Binary Artifact Detection**: Fixed false positives from ANSI color codes in formatted output
- **AI Response Processing**: Preserves natural paragraph structure in AI-generated summaries
- **Terminal Output**: Smart sanitization that only applies nuclear cleaning when actual artifacts detected
- Perfect balance: Maintains v0.8.6 security features while restoring v0.8.3 formatting beauty

### Technical Details
- Modified `sanitizeOutputForTerminal()` to ignore ANSI escape sequences in artifact detection
- Updated summarizer functions to preserve paragraph structure in clean AI responses
- Implemented conditional cleaning: nuclear mode only for actual binary artifacts
- Smart cleaning preserves newlines, sections, and natural content flow

## [0.8.6] - 2026-01-02

### Fixed
- **NUCLEAR Text Cleaning**: Implemented ultimate solution for ALL binary artifacts
- Created dedicated text-cleaner module with nuclear-level sanitization
- Applied aggressive cleaning at EVERY stage: AI responses, cache, formatter, and output
- Fixed cache system corruption that was storing/retrieving binary artifacts
- Added emergency text cleaning mode for severely corrupted content
- Implemented binary artifact detection with real-time alerts
- Ensures 100% clean output with zero memory addresses, pointers, or system artifacts
- Completely eliminated all forms of text corruption while preserving formatting

## [0.8.5] - 2026-01-02

### Fixed
- **Text Encoding**: Completely fixed garbled text output issues
- Added comprehensive charset detection and handling in content fetcher
- Implemented multi-layer text sanitization to eliminate binary artifacts
- Enhanced encoding artifact cleanup throughout the processing pipeline
- Added final output sanitization while preserving colors and emojis
- Fixed Windows-1252 to UTF-8 encoding corruption patterns
- Ensured production-ready text handling for all content types

## [0.8.3] - 2026-01-02

### Fixed
- Added shebang to CLI for proper execution
- Fixed Bun/Node.js compatibility issues
- Added compatibility layer for cross-runtime support

## [0.8.2] - 2026-01-02

### Changed
- Added Bun as preferred installation method in documentation
- Updated CLI imports for better compatibility

### Fixed
- Removed development files from distribution

## [0.8.1] - 2026-01-02

### Changed
- Streamlined README for better npm presentation
- Minor documentation improvements

## [0.8.0] - 2026-01-02

### Added
- 🎙️ **Multilingual voice output** with ElevenLabs integration and local TTS fallback
- 🧠 **Intelligent language-specific voice selection** (French voices for French content, etc.)
- 🔍 **Smart service detection** with automatic free-first fallback (Ollama → OpenAI → Gemini)
- 🆓 **Cost-conscious architecture** - uses 100% free services by default
- 📊 **Service status reporting** with `--check-services` command
- 🎯 **Voice management** with `--list-voices` and language-aware selection
- 💰 **Cost control flags**: `--free-only`, `--prefer-quality`
- 🔊 **Audio export** to MP3/WAV files with `--audio-output`
- 🌍 **Enhanced multilingual support** with native pronunciation

### Changed
- Service priority now favors free options (Ollama first, then premium APIs)
- Voice synthesis automatically adapts to content language
- CLI help updated with multilingual examples and cost-conscious workflows

### Fixed
- @google/genai dependency version corrected to ^1.34.0
- Voice synthesis error handling and graceful fallbacks

## [0.7.0] - 2026-01-01

### Added
- Expert-level prompt engineering for 10x better AI results
- Production-grade error handling with retry logic
- Intelligent caching with TTL, compression, and LRU eviction
- Rich content extraction with 20+ metadata fields
- Multiple output formats (HTML, plain text, Markdown, JSON)
- Cache statistics and management commands
- Comprehensive input validation
- Timeout protection for all network operations

### Changed
- Improved content selection algorithm with scoring
- Enhanced metadata extraction (author, dates, reading time)
- Better text formatting preservation
- Optimized cache key generation (deterministic, SHA-256)

### Fixed
- Memory leaks in Puppeteer cleanup
- Resource exhaustion from unbounded cache growth
- Non-atomic writes causing corruption
- Generic error messages replaced with actionable hints

## [0.6.0] - 2025-12-15

### Added
- Initial release
- Basic web fetching and summarization
- Support for OpenAI, Gemini, and Ollama
- Simple caching
- Screenshot capability
- Export to Markdown and JSON

[0.8.0]: https://github.com/jkenley/glance-cli/releases/tag/v0.8.0
[0.7.0]: https://github.com/jkenley/glance-cli/releases/tag/v0.7.0
[0.6.0]: https://github.com/jkenley/glance-cli/releases/tag/v0.6.0