feat: Update AI_AGENT.md with enhanced code structure details and new component descriptions

This commit is contained in:
sHa
2025-12-26 23:16:32 +00:00
parent 1453b753d0
commit 3d13b8ba19

View File

@@ -27,12 +27,13 @@ Key features:
## Code Structure ## Code Structure
- `main.py`: Main application entry point - `main.py`: Main application entry point with argument parsing
- `pyproject.toml`: Project configuration and dependencies - `pyproject.toml`: Project configuration and dependencies (version 0.2.0)
- `README.md`: User documentation - `README.md`: User documentation
- `ToDo.md`: Development task tracking
- `AI_AGENT.md`: This file - `AI_AGENT.md`: This file
- `renamer/`: Main package - `renamer/`: Main package
- `app.py`: Main Textual application class - `app.py`: Main Textual application class with tree management and file operations
- `extractor.py`: MediaExtractor class coordinating multiple extractors - `extractor.py`: MediaExtractor class coordinating multiple extractors
- `extractors/`: Individual extractor classes - `extractors/`: Individual extractor classes
- `mediainfo_extractor.py`: PyMediaInfo-based extraction - `mediainfo_extractor.py`: PyMediaInfo-based extraction
@@ -41,15 +42,19 @@ Key features:
- `fileinfo_extractor.py`: Basic file information - `fileinfo_extractor.py`: Basic file information
- `formatters/`: Data formatting classes - `formatters/`: Data formatting classes
- `media_formatter.py`: Main formatter coordinating display - `media_formatter.py`: Main formatter coordinating display
- `proposed_name_formatter.py`: Generates rename suggestions
- `track_formatter.py`: Track information formatting - `track_formatter.py`: Track information formatting
- `size_formatter.py`: File size formatting - `size_formatter.py`: File size formatting
- `date_formatter.py`: Timestamp formatting - `date_formatter.py`: Timestamp formatting
- `duration_formatter.py`: Duration formatting - `duration_formatter.py`: Duration formatting
- `resolution_formatter.py`: Resolution formatting - `resolution_formatter.py`: Resolution formatting
- `text_formatter.py`: Text styling utilities - `text_formatter.py`: Text styling utilities
- `constants.py`: Application constants - `extension_formatter.py`: File extension formatting
- `screens.py`: Additional UI screens - `helper_formatter.py`: Helper formatting utilities
- `test/`: Unit tests - `special_info_formatter.py`: Special edition information
- `constants.py`: Application constants (supported media types)
- `screens.py`: Additional UI screens (OpenScreen, HelpScreen, RenameConfirmScreen)
- `test/`: Unit tests for extractors
## Instructions for AI Agents ## Instructions for AI Agents
@@ -65,20 +70,26 @@ Key features:
### Development Workflow ### Development Workflow
1. Read the current code and understand the architecture 1. Read the current code and understand the architecture
2. Check the TODO list for pending tasks 2. Check the ToDo.md for pending tasks
3. Implement features incrementally 3. Implement features incrementally
4. Test changes by running the app with `uv run python main.py [directory]` 4. Test changes by running the app with `uv run python main.py [directory]`
5. Update tests as needed 5. Update tests as needed
6. Ensure backward compatibility 6. Ensure backward compatibility
7. Update documentation (README.md, ToDo.md) when adding features
### Key Components ### Key Components
- `RenamerApp`: Main application class inheriting from Textual's App - `RenamerApp`: Main application class inheriting from Textual's App
- `MediaTree`: Custom Tree widget with file-specific styling - Manages the tree view and file operations
- Handles keyboard navigation and commands
- Coordinates metadata extraction and display
- Implements efficient tree updates for renamed files
- `MediaTree`: Custom Tree widget with file-specific styling (inherited from Textual Tree)
- `MediaExtractor`: Coordinates multiple specialized extractors - `MediaExtractor`: Coordinates multiple specialized extractors
- `MediaFormatter`: Formats extracted data for TUI display - `MediaFormatter`: Formats extracted data for TUI display
- Various extractor classes for different data sources - Various extractor classes for different data sources
- Various formatter classes for different data types - Various formatter classes for different data types
- Screen classes for different UI states
### Extractor Architecture ### Extractor Architecture
@@ -92,20 +103,31 @@ Extractors are responsible for gathering raw data from different sources:
Formatters are responsible for converting raw data into display strings: Formatters are responsible for converting raw data into display strings:
- Each formatter provides static methods like `format_*()` - Each formatter provides static methods like `format_*()`
- The `MediaFormatter` coordinates formatters and applies them based on data types - The `MediaFormatter` coordinates formatters and applies them based on data types
- `ProposedNameFormatter` generates intelligent rename suggestions
- Formatters handle text styling, color coding, and human-readable representations - Formatters handle text styling, color coding, and human-readable representations
### Screen Architecture
The app uses multiple screens for different operations:
- `OpenScreen`: Directory selection with input validation
- `HelpScreen`: Comprehensive help with key bindings
- `RenameConfirmScreen`: File rename confirmation with error handling
### Future Enhancements ### Future Enhancements
- File renaming functionality - Metadata editing capabilities
- Batch operations - Batch rename operations
- Advanced metadata editing - Configuration file support
- Plugin system for different media types - Plugin system for custom extractors/formatters
- Advanced search and filtering
- Undo/redo functionality
### Testing ### Testing
- Run the app with `uv run python main.py [directory]` - Run the app with `uv run python main.py [directory]`
- Test navigation, selection, and display - Test navigation, selection, and display
- Verify metadata extraction accuracy - Verify metadata extraction accuracy
- Test file renaming functionality
- Check for any errors or edge cases - Check for any errors or edge cases
- Run unit tests with `uv run pytest` - Run unit tests with `uv run pytest`
@@ -116,5 +138,7 @@ Formatters are responsible for converting raw data into display strings:
- Ensure the app runs without errors - Ensure the app runs without errors
- Follow the existing code patterns - Follow the existing code patterns
- Update tests for new functionality - Update tests for new functionality
- Update ToDo.md when completing tasks
- Update version numbers appropriately
This document should be updated as the project evolves. This document should be updated as the project evolves.