|
| 1 | +# Contributing Guide |
| 2 | + |
| 3 | +Thank you for considering contributing to the VS Code Copilot Resource Sync Scripts project! 🎉 |
| 4 | + |
| 5 | +## How to Contribute |
| 6 | + |
| 7 | +### Reporting Bugs |
| 8 | + |
| 9 | +If you find a bug, please create an issue with: |
| 10 | +- Clear description of the problem |
| 11 | +- Steps to reproduce |
| 12 | +- Expected vs actual behavior |
| 13 | +- PowerShell version (`$PSVersionTable.PSVersion`) |
| 14 | +- Windows version |
| 15 | +- Relevant log files from `$HOME\.awesome-copilot\logs\` |
| 16 | + |
| 17 | +### Suggesting Enhancements |
| 18 | + |
| 19 | +Feature requests are welcome! Please include: |
| 20 | +- Clear use case description |
| 21 | +- Why this feature would be useful |
| 22 | +- Proposed implementation (if you have ideas) |
| 23 | + |
| 24 | +### Pull Requests |
| 25 | + |
| 26 | +1. **Fork the repository** |
| 27 | +2. **Create a feature branch** from `main`: |
| 28 | + ```powershell |
| 29 | + git checkout -b feature/your-feature-name |
| 30 | + ``` |
| 31 | + |
| 32 | +3. **Make your changes**: |
| 33 | + - Follow existing code style |
| 34 | + - Add comments for complex logic |
| 35 | + - Use meaningful variable names |
| 36 | + - Test thoroughly on your system |
| 37 | + |
| 38 | +4. **Update documentation**: |
| 39 | + - Update README.md if adding new features |
| 40 | + - Update CHANGELOG.md with your changes |
| 41 | + - Add inline comments for complex code |
| 42 | + |
| 43 | +5. **Test your changes**: |
| 44 | + ```powershell |
| 45 | + # Test individual scripts |
| 46 | + .\sync-awesome-copilot.ps1 |
| 47 | + .\combine-and-publish-prompts.ps1 |
| 48 | + |
| 49 | + # Test scheduled task installation |
| 50 | + .\install-scheduled-task.ps1 -Interval "1h" |
| 51 | + Start-ScheduledTask -TaskName "AwesomeCopilotSync" |
| 52 | + |
| 53 | + # Verify logs |
| 54 | + Get-Content "$HOME\.awesome-copilot\logs\sync-*.log" -Tail 20 |
| 55 | + ``` |
| 56 | + |
| 57 | +6. **Commit with clear messages**: |
| 58 | + ```powershell |
| 59 | + git commit -m "Add feature: description of what you added" |
| 60 | + ``` |
| 61 | + |
| 62 | +7. **Push and create PR**: |
| 63 | + ```powershell |
| 64 | + git push origin feature/your-feature-name |
| 65 | + ``` |
| 66 | + |
| 67 | +## Code Style Guidelines |
| 68 | + |
| 69 | +### PowerShell Best Practices |
| 70 | + |
| 71 | +- **Use approved verbs**: `Get-`, `Set-`, `New-`, `Remove-`, etc. |
| 72 | +- **PascalCase for functions**: `Invoke-MyFunction` |
| 73 | +- **Verbose parameter names**: Prefer clarity over brevity |
| 74 | +- **Comment complex logic**: Explain the "why", not the "what" |
| 75 | +- **Error handling**: Use `try/catch` for external operations |
| 76 | +- **Logging**: Use `Write-Host` with color coding for status messages |
| 77 | + |
| 78 | +### Example: |
| 79 | + |
| 80 | +```powershell |
| 81 | +function Get-ResourceFiles { |
| 82 | + <# |
| 83 | + .SYNOPSIS |
| 84 | + Retrieves resource files from a directory. |
| 85 | + |
| 86 | + .PARAMETER Path |
| 87 | + The directory path to search. |
| 88 | + |
| 89 | + .PARAMETER Type |
| 90 | + The type of resource to filter (chatmode, instruction, prompt). |
| 91 | + #> |
| 92 | + param( |
| 93 | + [Parameter(Mandatory)] |
| 94 | + [string]$Path, |
| 95 | + |
| 96 | + [ValidateSet('chatmode', 'instruction', 'prompt')] |
| 97 | + [string]$Type |
| 98 | + ) |
| 99 | + |
| 100 | + try { |
| 101 | + $pattern = "*.$Type.md" |
| 102 | + Get-ChildItem -Path $Path -Filter $pattern -File |
| 103 | + } |
| 104 | + catch { |
| 105 | + Write-Host "[ERROR] Failed to get resource files: $_" -ForegroundColor Red |
| 106 | + throw |
| 107 | + } |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +### Portable Paths |
| 112 | + |
| 113 | +Always use environment variables for paths: |
| 114 | + |
| 115 | +```powershell |
| 116 | +# ✅ GOOD |
| 117 | +$cacheDir = Join-Path $HOME '.awesome-copilot' |
| 118 | +$profileDir = Join-Path $env:APPDATA 'Code\User' |
| 119 | +
|
| 120 | +# ❌ BAD - Don't hardcode user paths |
| 121 | +$cacheDir = 'C:\Users\Someone\.awesome-copilot' |
| 122 | +``` |
| 123 | + |
| 124 | +### Security |
| 125 | + |
| 126 | +- Never commit credentials or tokens |
| 127 | +- Use environment variables for sensitive data |
| 128 | +- Validate all user inputs |
| 129 | +- Use `-WhatIf` support for destructive operations |
| 130 | + |
| 131 | +## Testing Checklist |
| 132 | + |
| 133 | +Before submitting a PR, verify: |
| 134 | + |
| 135 | +- [ ] Scripts run without errors |
| 136 | +- [ ] No hardcoded personal paths |
| 137 | +- [ ] Portable paths using `$HOME` and `$env:APPDATA` |
| 138 | +- [ ] Logging works correctly |
| 139 | +- [ ] Error handling covers edge cases |
| 140 | +- [ ] Scheduled task integration works |
| 141 | +- [ ] No breaking changes to existing functionality |
| 142 | +- [ ] Documentation updated |
| 143 | +- [ ] CHANGELOG.md updated |
| 144 | + |
| 145 | +## Questions? |
| 146 | + |
| 147 | +Feel free to: |
| 148 | +- Open an issue for discussion |
| 149 | +- Ask questions in pull request comments |
| 150 | +- Reach out to maintainers |
| 151 | + |
| 152 | +## Code of Conduct |
| 153 | + |
| 154 | +Be respectful, constructive, and collaborative. We're all here to make this project better! 🚀 |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +**Thank you for contributing!** ❤️ |
0 commit comments