The foundation of colette needs to handle basic file operations and command-line arguments correctly before implementing the main organization logic.
- Implement argument parsing with getopt_long()
- Required: Input directory path
- Optional: Project initialization (--init/-i)
- Optional: Structure validation (--check/-c)
- Optional: Output directory for ordered symlinks (--as-list/-l)
- Optional: Numeric prefix padding length (--padding/-p, default: 3)
- Add argument validation
- Verify directory existence and permissions
- Check for conflicting flag combinations
- Validate output directory permissions and existence
- Provide helpful error messages for invalid usage
- Implement file reading and writing with proper error handling
- Fix current buffer handling issue in collateFile()
- Add proper error checking for file operations
- Create robust path handling
- Implement safe path construction and validation
- Handle relative and absolute paths correctly
- Manage path length limitations
- Create relative symlink path calculations
- Handle symlink creation with proper error checking
This phase focuses on implementing the main features that make colette useful for document management.
- Implement directory traversal functionality
- Create directory detection system
- Handle nested directory structures
- Implement underscore-prefixed exclusion
- Track visited inodes to prevent symlink cycles
- Generate sequential numbering for ordered output
- Build index file handling
- Parse index files for ordering
- Validate index file contents
- Handle missing index files appropriately
- Generate numeric prefixes based on hierarchical position
- Create project initialization system (-i/--init)
- Scan directories recursively
- Generate new index files
- Update existing index files
- Skip underscore-prefixed items
- Implement symlink-based organization
- Create output directory structure
- Generate sequential file numbering
- Create relative symlinks to source files
- Preserve hierarchy information in symlink names
- Handle updates to existing output directories
- Add collation alternatives
- Implement traditional file concatenation
- Support symlink-based organization
- Allow generation of file manifests for external tools
- Add structure validation (--check/-c)
- Verify project structure completeness
- Check for missing index files
- Validate file accessibility
- Verify symlink targets exist
- Report detailed status information
Robust error handling and informative feedback are crucial for a reliable tool.
- Implement comprehensive error handling
- Add detailed error messages for all failure cases
- Create proper cleanup procedures
- Handle system-level errors gracefully
- Manage symlink-specific error cases
- Add warning system
- Detect potential issues in project structure
- Warn about missing non-required files
- Alert users to invalid or unexpected file types
- Flag broken or circular symlinks
- Create status reporting
- Show progress during organization
- Report statistics about processed files
- Provide detailed check mode output
- List created symlinks and their targets
Features to consider for future versions of colette.
- Add project configuration file support
- Configure output preferences
- Save project-specific settings
- Define custom naming patterns
- Add advanced organization features
- Support custom naming templates
- Allow different numbering schemes
- Implement hierarchical prefix options
- Support metadata-based organization
- Create interactive TUI
- Implement file system navigation
- Add vim-like keybindings
- Enable visual reordering of content
- Preview symlink organization
- Add advanced features
- Implement backup system
- Add version control integration
- Create collaborative features
- Implement robust path handling
- Replace static buffers with dynamic allocation
- Handle arbitrary path lengths
- Support filesystem-specific limitations
- Add proper error reporting for path-related issues- Support different organization schemes
Testing should be ongoing throughout development.
- Create test project structures
- Build sample projects of varying complexity
- Include edge cases and error conditions
- Test with various file types and naming patterns
- Test symlink handling scenarios
- Implement system tests
- Test all command line options
- Verify error handling
- Check edge cases:
- Deep nesting
- Large files
- Missing permissions
- Invalid index files
- Circular symlinks
- Broken symlinks
- Cross-directory symlinks
- Verify POSIX compatibility
- Test on different Unix-like systems
- Verify file handling across platforms
- Check line ending handling
- Validate symlink behavior across systems
- Update argument parsing to remove format requirements
- Implement relative path calculations for symlinks
- Create sequential numbering system
- Build symlink creation functionality
- Test basic organization with sample projects