Thank you for your interest in contributing to PSBinaryModule! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
- .NET 8.0 SDK or later
- PowerShell 7.4 or later (or Windows PowerShell 5.1+)
- Git
- Visual Studio Code (recommended) or Visual Studio
-
Fork and Clone
git clone https://github.com/yourusername/PSBinaryModule.git cd PSBinaryModule -
Open in Dev Container (recommended)
- Open the project in VS Code
- Click "Reopen in Container" when prompted
- Wait for the container to build and dependencies to install
-
Or Setup Locally
# Install build dependencies Install-PSResource -Name InvokeBuild, Pester -TrustRepository -AcceptLicense # Restore .NET dependencies dotnet restore
# Build the module
Invoke-Build
# Build and run tests
Invoke-Build -Task Build, Test
# Clean build artifacts
Invoke-Build -Task Clean# Run all C# tests
dotnet test
# Run tests with coverage
dotnet test --collect "XPlat Code Coverage"
# Run specific test
dotnet test --filter "FullyQualifiedName~GetBinaryModuleMetadataCommandTests"# Run all integration tests
Invoke-Pester -Path ./tests/Integration
# Run specific test
Invoke-Pester -Path ./tests/Integration -Tag Integration- Follow the EditorConfig settings
- Use meaningful variable and method names
- Add XML documentation to all public APIs
- Keep methods focused and single-purpose
- Maintain test coverage above 80%
// Good
[Cmdlet(VerbsCommon.Get, "Example")]
[OutputType(typeof(string))]
public class GetExampleCommand : PSCmdlet
{
/// <summary>
/// <para type="description">The name parameter description.</para>
/// </summary>
[Parameter(Mandatory = true)]
public string Name { get; set; }
protected override void ProcessRecord()
{
WriteObject($"Hello, {Name}!");
}
}# Good
Describe 'Get-Example' {
It 'Should return greeting' {
$result = Get-Example -Name 'World'
$result | Should -Be 'Hello, World!'
}
}-
Create the Cmdlet Class
// src/Commands/YourCommand.cs using System.Management.Automation; namespace PSBinaryModule.Commands { [Cmdlet(VerbsCommon.Get, "YourFeature")] public class GetYourFeatureCommand : PSCmdlet { // Implementation } }
-
Add Unit Tests
// tests/PSBinaryModule.Tests/Commands/YourCommandTests.cs public class GetYourFeatureCommandTests { [Fact] public void TestYourFeature() { // Test implementation } }
-
Update Module Manifest
# src/PSBinaryModule.psd1 CmdletsToExport = @( 'Get-SystemLocale', 'Get-YourFeature' # Add your cmdlet )
-
Add Integration Tests
# tests/Integration/Module.Integration.Tests.ps1 Context 'Get-YourFeature' { It 'Should work correctly' { # Test implementation } }
feature/description- New featuresbugfix/description- Bug fixeshotfix/description- Critical fixesdocs/description- Documentation updates
Use conventional commit format:
type(scope): subject
body
footer
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code refactoringperf: Performance improvementschore: Maintenance tasks
Example:
feat(cmdlets): add Get-Example cmdlet
Added new cmdlet to retrieve example data with support for
pipeline input and custom formatting.
Closes #123
-
Create a Branch
git checkout -b feature/my-new-feature
-
Make Changes
- Write code
- Add tests
- Update documentation
-
Run Tests
Invoke-Build -Task Test
-
Commit Changes
git add . git commit -m "feat: add new feature"
-
Push to Fork
git push origin feature/my-new-feature
-
Create Pull Request
- Go to GitHub
- Click "New Pull Request"
- Fill out the template
- Wait for CI checks to pass
- Request review
- Fill out the PR template completely
- Ensure all CI checks pass
- Maintain or improve test coverage
- Update documentation as needed
- Keep PRs focused and reasonably sized
- Respond to review feedback promptly
Releases are automated via GitHub Actions:
- Merge PR to
mainbranch - GitVersion determines the version
- CI builds and tests the module
- GitHub release is created
- Module is published to PowerShell Gallery
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Review existing issues and PRs before creating new ones
By contributing, you agree that your contributions will be licensed under the MIT License.