tcss-cli 1.0.0

Command-line interface for TCSS (Thematic CSS) compiler
Documentation
# Verbose and Debug Modes Implementation

## Overview

This document describes the implementation of verbose (`-v, --verbose`) and debug (`--debug`) modes in the TCSS CLI.

## Implementation Summary

### Files Created

1. **`tcss-cli/src/output.rs`** (150 lines)
   - Global verbosity level management using atomic operations
   - Output utility functions for different message types
   - Verbose and debug mode detection
   - Formatted output with colors and icons

2. **`tcss-cli/tests/verbose_debug_tests.rs`** (150 lines)
   - Unit tests for output module
   - Integration tests with compile and check commands
   - Tests for all verbosity levels

3. **`tcss-cli/docs/VERBOSE_DEBUG_MODES.md`** (250 lines)
   - Comprehensive user documentation
   - Usage examples for all commands
   - Output examples for each mode
   - Use cases and tips

4. **`tcss-cli/examples/verbose_debug_demo.sh`** (150 lines)
   - Executable demonstration script
   - Shows all verbosity modes in action
   - Includes build instructions

### Files Modified

1. **`tcss-cli/src/main.rs`**
   - Added `mod output` declaration
   - Initialized output system with verbosity settings
   - Enhanced mode information display

2. **`tcss-cli/src/lib.rs`**
   - Exported `output` module for testing

3. **`tcss-cli/src/commands/compile.rs`**
   - Integrated output module
   - Added timing information
   - Added debug output for compilation phases
   - Added file size reporting

4. **`tcss-cli/src/commands/watch.rs`**
   - Integrated output module
   - Added debug output for file watching
   - Enhanced change detection messages

5. **`tcss-cli/src/commands/init.rs`**
   - Integrated output module
   - Added verbose output for directory creation
   - Added debug output for project initialization

6. **`tcss-cli/src/commands/check.rs`**
   - Integrated output module
   - Added timing information
   - Added debug output for error details

7. **`tcss-cli/README.md`**
   - Added Verbose Mode section
   - Added Debug Mode section
   - Enhanced Global Options documentation
   - Added usage examples

## Features Implemented

### Output Module (`output.rs`)

#### Global State Management
```rust
static VERBOSITY: AtomicU8 = AtomicU8::new(0);
static DEBUG_MODE: AtomicBool = AtomicBool::new(false);
```

#### Initialization
```rust
pub fn init(verbose: bool, debug: bool)
```

#### Output Functions

**Always Visible:**
- `success(message)` - Green checkmark with message
- `error(message)` - Red X with message
- `warning(message)` - Yellow warning with message
- `info(message)` - Blue info with message

**Verbose Mode Only:**
- `verbose(message)` - Gray arrow with message
- `timing(operation, duration_ms)` - Timing information
- `file_size(path, size_bytes)` - File size information
- `separator()` - Visual separator line

**Debug Mode Only:**
- `debug(message)` - Magenta DEBUG prefix
- `debug_value(label, value)` - Debug variable display

**Formatting:**
- `header(message)` - Bold header with underline
- `subheader(message)` - Subheader with underline
- `step(step, total, message)` - Step indicator

### Compile Command Enhancements

**Normal Mode:**
```
✓ Compiled styles.tcss → styles.css
```

**Verbose Mode:**
```
→ Compiling: styles.tcss
✓ Compiled styles.tcss → styles.css
📄 styles.css - 1.23 KB
⏱ Compilation took 45ms
```

**Debug Mode:**
```
DEBUG: Input file = "styles.tcss"
DEBUG: Minify = false
DEBUG: Reading input file...
DEBUG: Read 256 bytes from input file
DEBUG: Starting compilation...
DEBUG: Phase 1: Tokenization
DEBUG: Generated 42 tokens
DEBUG: Phase 2: Parsing
DEBUG: Parsed 8 AST nodes
DEBUG: Phase 3: CSS Generation
DEBUG: Generated 1234 bytes of CSS
✓ Compiled styles.tcss → styles.css
📄 styles.css - 1.23 KB
⏱ Compilation took 45ms
```

### Watch Command Enhancements

**Verbose Mode:**
- Shows file watcher initialization
- Shows "Watching for changes..." message
- Shows detailed change detection

**Debug Mode:**
- Shows watch mode type
- Shows file watcher setup details
- Shows detailed file change information

### Init Command Enhancements

**Verbose Mode:**
- Shows each directory created
- Shows each file created

**Debug Mode:**
- Shows project configuration
- Shows detailed creation steps

### Check Command Enhancements

**Verbose Mode:**
- Shows each file being checked
- Shows timing information

**Debug Mode:**
- Shows file count
- Shows detailed error information
- Shows error statistics

## Testing

### Unit Tests
- `test_output_initialization()` - Tests output system initialization
- `test_output_functions()` - Tests all output functions
- `test_verbose_mode_output()` - Tests verbose-specific output
- `test_debug_mode_output()` - Tests debug-specific output
- `test_output_formatting()` - Tests formatting functions

### Integration Tests
- `test_compile_with_verbose()` - Tests compile in verbose mode
- `test_compile_with_debug()` - Tests compile in debug mode
- `test_check_with_verbose()` - Tests check in verbose mode
- `test_check_with_debug()` - Tests check in debug mode

## Usage Examples

### Compile
```bash
tcss compile styles.tcss --verbose
tcss compile styles.tcss --debug
```

### Watch
```bash
tcss watch src/ --verbose
tcss watch src/ --debug
```

### Init
```bash
tcss init my-project --verbose
tcss init my-project --debug
```

### Check
```bash
tcss check styles.tcss --verbose
tcss check styles.tcss --debug
```

## Benefits

1. **User-Friendly**
   - Clear, colored output
   - Helpful icons and formatting
   - Progressive disclosure of information

2. **Developer-Friendly**
   - Detailed debugging information
   - Timing and performance data
   - Internal state visibility

3. **Well-Tested**
   - Comprehensive unit tests
   - Integration tests with real commands
   - Demo script for manual testing

4. **Well-Documented**
   - User documentation (VERBOSE_DEBUG_MODES.md)
   - Implementation documentation (this file)
   - README updates
   - Inline code comments

## Statistics

```
Files Created:      4
Files Modified:     7
Lines Added:        ~700
Test Cases:         10+
Documentation:      ~400 lines
```

## Future Enhancements

1. **Environment Variables**
   - `TCSS_VERBOSE=1` for default verbose mode
   - `TCSS_DEBUG=1` for default debug mode

2. **Log Levels**
   - Multiple verbosity levels (0-3)
   - Configurable output detail

3. **Log Files**
   - Option to write debug output to file
   - Structured logging format

4. **Performance Profiling**
   - Detailed timing for each phase
   - Memory usage tracking
   - Performance reports

## Conclusion

The verbose and debug modes provide a comprehensive output system that helps users understand what TCSS is doing and makes it easier to debug issues. The implementation is clean, well-tested, and well-documented, making it easy to maintain and extend in the future.