|
| 1 | +# Contributing to PowerShell Dev Toolkit |
| 2 | + |
| 3 | +First off, thank you for considering contributing to PowerShell Dev Toolkit! 🎉 |
| 4 | + |
| 5 | +## How Can I Contribute? |
| 6 | + |
| 7 | +### Reporting Bugs |
| 8 | + |
| 9 | +Before creating bug reports, please check the existing issues to avoid duplicates. When you create a bug report, include as many details as possible: |
| 10 | + |
| 11 | +- **Use a clear and descriptive title** |
| 12 | +- **Describe the exact steps to reproduce the problem** |
| 13 | +- **Provide specific examples** |
| 14 | +- **Describe the behavior you observed and what you expected** |
| 15 | +- **Include PowerShell version** (`$PSVersionTable.PSVersion`) |
| 16 | +- **Include Windows version** |
| 17 | +- **Include relevant logs or error messages** |
| 18 | + |
| 19 | +### Suggesting Enhancements |
| 20 | + |
| 21 | +Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include: |
| 22 | + |
| 23 | +- **Use a clear and descriptive title** |
| 24 | +- **Provide a step-by-step description of the suggested enhancement** |
| 25 | +- **Provide specific examples to demonstrate the steps** |
| 26 | +- **Describe the current behavior and explain which behavior you expected to see** |
| 27 | +- **Explain why this enhancement would be useful** |
| 28 | + |
| 29 | +### Pull Requests |
| 30 | + |
| 31 | +1. **Fork the repository** |
| 32 | +2. **Create a new branch** from `main`: |
| 33 | + ```powershell |
| 34 | + git checkout -b feature/your-feature-name |
| 35 | + ``` |
| 36 | +3. **Make your changes**: |
| 37 | + - Follow the existing code style |
| 38 | + - Add comments for complex logic |
| 39 | + - Update documentation if needed |
| 40 | +4. **Test your changes**: |
| 41 | + - Test on a clean Windows machine if possible |
| 42 | + - Ensure backward compatibility |
| 43 | +5. **Commit your changes**: |
| 44 | + ```powershell |
| 45 | + git commit -m "Add feature: your feature description" |
| 46 | + ``` |
| 47 | +6. **Push to your fork**: |
| 48 | + ```powershell |
| 49 | + git push origin feature/your-feature-name |
| 50 | + ``` |
| 51 | +7. **Open a Pull Request** with a clear title and description |
| 52 | + |
| 53 | +## Coding Standards |
| 54 | + |
| 55 | +### PowerShell Script Guidelines |
| 56 | + |
| 57 | +1. **Use meaningful variable names** |
| 58 | + ```powershell |
| 59 | + # Good |
| 60 | + $serverHostname = "example.com" |
| 61 | + |
| 62 | + # Bad |
| 63 | + $s = "example.com" |
| 64 | + ``` |
| 65 | + |
| 66 | +2. **Include comment-based help** for all scripts |
| 67 | + ```powershell |
| 68 | + <# |
| 69 | + .SYNOPSIS |
| 70 | + Brief description |
| 71 | + |
| 72 | + .DESCRIPTION |
| 73 | + Detailed description |
| 74 | + |
| 75 | + .PARAMETER Name |
| 76 | + Parameter description |
| 77 | + |
| 78 | + .EXAMPLE |
| 79 | + script.ps1 -Name "test" |
| 80 | + #> |
| 81 | + ``` |
| 82 | + |
| 83 | +3. **Use approved verbs** for function names |
| 84 | + - Get-, Set-, New-, Remove-, Add-, etc. |
| 85 | + - Check: `Get-Verb` |
| 86 | + |
| 87 | +4. **Handle errors gracefully** |
| 88 | + ```powershell |
| 89 | + try { |
| 90 | + # Your code |
| 91 | + } catch { |
| 92 | + Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red |
| 93 | + exit 1 |
| 94 | + } |
| 95 | + ``` |
| 96 | + |
| 97 | +5. **Support common parameters** when appropriate |
| 98 | + ```powershell |
| 99 | + [CmdletBinding()] |
| 100 | + param( |
| 101 | + [Parameter(Mandatory=$true)] |
| 102 | + [string]$Name |
| 103 | + ) |
| 104 | + ``` |
| 105 | + |
| 106 | +6. **Provide meaningful output** |
| 107 | + - Use colored output for better UX |
| 108 | + - Support `-AsJson` for programmatic use where appropriate |
| 109 | + - Show progress for long-running operations |
| 110 | + |
| 111 | +### Configuration |
| 112 | + |
| 113 | +- **Never hardcode user-specific information** |
| 114 | +- **Use `config.json` for user settings** |
| 115 | +- **Provide sensible defaults** |
| 116 | +- **Document all configuration options** in `config.example.json` |
| 117 | + |
| 118 | +### Security |
| 119 | + |
| 120 | +- **Never commit credentials** or sensitive data |
| 121 | +- **Use encrypted credential storage** (Export-Clixml) |
| 122 | +- **Always validate user input** |
| 123 | +- **Use secure connections** (SSH, HTTPS) |
| 124 | + |
| 125 | +## Documentation |
| 126 | + |
| 127 | +- Update `README.md` if you add new features |
| 128 | +- Add examples to help text |
| 129 | +- Document configuration options |
| 130 | +- Update `helpme.ps1` for new commands |
| 131 | + |
| 132 | +## Testing |
| 133 | + |
| 134 | +While we don't have automated tests yet, please: |
| 135 | + |
| 136 | +1. **Test your changes manually** on Windows 10 and 11 |
| 137 | +2. **Test with PowerShell 5.1 and 7+** |
| 138 | +3. **Test without WSL** (fallback scenarios) |
| 139 | +4. **Test with missing dependencies** (graceful degradation) |
| 140 | + |
| 141 | +## Project Structure |
| 142 | + |
| 143 | +``` |
| 144 | +powershell-dev-toolkit/ |
| 145 | +├── README.md # Main documentation |
| 146 | +├── config.example.json # Configuration template |
| 147 | +├── Setup-Environment.ps1 # Setup script |
| 148 | +├── Get-ScriptConfig.ps1 # Config loader |
| 149 | +├── Connect-SSH.ps1 # SSH scripts |
| 150 | +├── Connect-SSHTunnel.ps1 |
| 151 | +├── Get-*.ps1 # Get/retrieve commands |
| 152 | +├── Invoke-*.ps1 # Action commands |
| 153 | +├── Start-*.ps1 # Start/launch commands |
| 154 | +├── Watch-*.ps1 # Monitor commands |
| 155 | +├── New-*.ps1 # Create/generate commands |
| 156 | +└── creds/ # Credentials (gitignored) |
| 157 | +``` |
| 158 | + |
| 159 | +## Commit Messages |
| 160 | + |
| 161 | +Use clear and meaningful commit messages: |
| 162 | + |
| 163 | +- **feat**: New feature |
| 164 | +- **fix**: Bug fix |
| 165 | +- **docs**: Documentation changes |
| 166 | +- **style**: Code style changes (formatting) |
| 167 | +- **refactor**: Code refactoring |
| 168 | +- **test**: Adding tests |
| 169 | +- **chore**: Maintenance tasks |
| 170 | + |
| 171 | +Examples: |
| 172 | +``` |
| 173 | +feat: add support for SQLServer tunneling |
| 174 | +fix: resolve credential loading on PowerShell 7 |
| 175 | +docs: update SSH setup instructions |
| 176 | +refactor: simplify server configuration logic |
| 177 | +``` |
| 178 | + |
| 179 | +## Questions? |
| 180 | + |
| 181 | +Feel free to open an issue with the `question` label if you need clarification on anything. |
| 182 | + |
| 183 | +## Code of Conduct |
| 184 | + |
| 185 | +Be respectful and constructive. We're all here to learn and help each other. |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +Thank you for contributing! 🚀 |
0 commit comments