This guide explains how to develop and contribute to the COPS framework.
-
User Installation (~/.cops)
- For managing your own configuration
- Production environment
- Stable release version
-
Development Installation (~/projects/cops)
- For framework development
- Testing environment
- Working copy for changes
# 1. Fork the repository
# Visit: https://github.com/shaneholloman/cops
# 2. Clone your fork (NOT to ~/.cops)
git clone https://github.com/your-username/cops.git ~/projects/cops
cd ~/projects/cops
# 3. Review documentation
code docs/dev/architecture/core-concepts.md
code docs/dev/guides/testing.md
# 4. Make and test changes
./analyze.sh # Verify shell standards
./cops.sh # Test changes (updates ~/.cops).
├── lib/ # Core modules
│ ├── main.sh # Core orchestration
│ ├── config.sh # Configuration handling
│ ├── checks.sh # System validation
│ ├── preferences.sh # Preferences management
│ ├── preferences-discovery.sh # Preferences utilities
│ ├── restore.sh # Backup and restore
│ ├── install.sh # Package installation
│ ├── validate.sh # Configuration validation
│ ├── setup.sh # Environment setup
│ ├── output.sh # Logging utilities
│ ├── aliases.sh # Shell aliases
│ └── brewbundle.sh # Homebrew integration
│
├── config/ # Default configurations
│ ├── git/ # Git configuration
│ ├── vim/ # Vim configuration
│ └── zsh/ # Shell configuration
│
├── docs/ # Documentation
│ ├── user/ # User guides
│ ├── dev/ # Developer docs
│ │ ├── architecture/ # System design
│ │ ├── guides/ # Development guides
│ │ └── briefs/ # Development briefs
│ └── reference/ # Reference docs
│
├── backups/ # Backup storage
│ ├── preferences/ # System preferences
│ ├── shell/ # Shell configurations
│ └── git/ # Git configurations
│
└── cops.sh # Main entry point- Follow Shell Standards
- Maximum 300 lines per module
- Comprehensive error handling
- Input validation
- Clear documentation
-
Safety Features
- Master switch in config.yaml
- Automatic backups
- Validation checks
- Error handling
- Recovery procedures
-
Testing
- Unit tests
- Integration tests
- Safety tests
- Performance tests
- Recovery tests
-
Documentation
- Code comments
- Function documentation
- Usage examples
- Error scenarios
-
Review Documentation
-
Implementation Steps
- Create development brief
- Add master switch
- Implement core functionality
- Add safety features
- Write tests
- Update documentation
# Review project status
code docs/reference/project-status.md
# Check development briefs
code docs/dev/briefs/
# Create new brief for feature
code docs/dev/briefs/feature-name-brief.md# Verify shell standards
./analyze.sh
# Run tests
./cops.sh --test
# Test specific functionality
./cops.sh --dry-run --restore preferences com.apple.finder# Full system test
./analyze.sh
./cops.sh --test
# Verify in production
cd ~/.cops
./cops.sh# Update relevant docs
code docs/dev/briefs/feature-name-brief.md
code docs/reference/project-status.md- One feature per module
- Clear function names
- Consistent style
- Proper error handling
- Validate all input
- Create backups
- Use dry-run mode
- Handle errors gracefully
- Test before commit
- Cover edge cases
- Verify rollbacks
- Check error handling
- Keep briefs current
- Document changes
- Update examples
- Maintain changelog
- Create development brief
- Add master switch to config.yaml
- Create module in lib/
- Implement safety features
- Add tests
- Update documentation
- Review current implementation
- Create backup functionality
- Make changes incrementally
- Test thoroughly
- Update documentation
- Run shell analysis
- Execute unit tests
- Perform integration tests
- Test in production
- Create feature branch
- Make focused commits
- Update documentation
- Submit pull request
-
Review Documentation
-
Check Development Briefs
- Recent changes
- Implementation details
- Design decisions
-
Create Issues
- Clear description
- Steps to reproduce
- Expected behavior