Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches: ["**"]
pull_request:
branches: ["**"]

jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Install Pester
shell: pwsh
run: |
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -Scope CurrentUser -SkipPublisherCheck

- name: Run Pester tests
shell: pwsh
run: |
$config = New-PesterConfiguration
$config.Run.Path = './tests'
$config.Run.Exit = $true
$config.TestResult.Enabled = $true
$config.TestResult.OutputPath = 'TestResults.xml'
$config.TestResult.OutputFormat = 'NUnitXml'
$config.Output.Verbosity = 'Detailed'
Invoke-Pester -Configuration $config

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: pester-results
path: TestResults.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ secrets/
# Profile backups
*PROFILE_BACKUP*

# Toolkit update stamp
.last-update-check

# OS files
.DS_Store
Thumbs.db
Expand Down
127 changes: 79 additions & 48 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,83 +30,78 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme

1. **Fork the repository**
2. **Create a new branch** from `main`:
```powershell
```powershell
git checkout -b feature/your-feature-name
```
```
3. **Make your changes**:
- Follow the existing code style
- Add comments for complex logic
- Update documentation if needed
- Follow the existing code style
- Add comments for complex logic
- Update documentation if needed
4. **Test your changes**:
- Test on a clean Windows machine if possible
- Ensure backward compatibility
- Test on a clean Windows machine if possible
- Ensure backward compatibility
5. **Commit your changes**:
```powershell
```powershell
git commit -m "Add feature: your feature description"
```
```
6. **Push to your fork**:
```powershell
```powershell
git push origin feature/your-feature-name
```
```
7. **Open a Pull Request** with a clear title and description

## Coding Standards

### PowerShell Script Guidelines

1. **Use meaningful variable names**
```powershell
```powershell
# Good
$serverHostname = "example.com"

# Bad
$s = "example.com"
```

```
2. **Include comment-based help** for all scripts
```powershell
```powershell
<#
.SYNOPSIS
Brief description

.DESCRIPTION
Detailed description

.PARAMETER Name
Parameter description

.EXAMPLE
script.ps1 -Name "test"
#>
```

```
3. **Use approved verbs** for function names
- Get-, Set-, New-, Remove-, Add-, etc.
- Check: `Get-Verb`

- Get-, Set-, New-, Remove-, Add-, etc.
- Check: `Get-Verb`
4. **Handle errors gracefully**
```powershell
```powershell
try {
# Your code
} catch {
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
exit 1
}
```

```
5. **Support common parameters** when appropriate
```powershell
```powershell
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$Name
)
```

```
6. **Provide meaningful output**
- Use colored output for better UX
- Support `-AsJson` for programmatic use where appropriate
- Show progress for long-running operations
- Use colored output for better UX
- Support `-AsJson` for programmatic use where appropriate
- Show progress for long-running operations

### Configuration

Expand All @@ -131,9 +126,32 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme

## Testing

While we don't have automated tests yet, please:
Tests are written with [Pester 5](https://pester.dev/) in the `tests/` directory. Run the full suite with:

```powershell
.\Invoke-Tests.ps1
```

This installs Pester 5+ if needed and runs all tests with detailed output. Tests also run automatically via GitHub Actions CI on every push and pull request.

When adding new commands, please add corresponding test coverage. Tests should use the Pester 5 `BeforeAll` pattern:

```powershell
BeforeAll {
$repoRoot = Split-Path -Parent (Split-Path -Parent $PSCommandPath)
Import-Module (Join-Path $repoRoot "PowerShellDevToolkit") -Force
}

Describe "Your-Command" {
It "Should do something" {
# test code
}
}
```

Also test manually:

1. **Test your changes manually** on Windows 10 and 11
1. **Test your changes** on Windows 10 and 11
2. **Test with PowerShell 5.1 and 7+**
3. **Test without WSL** (fallback scenarios)
4. **Test with missing dependencies** (graceful degradation)
Expand All @@ -142,20 +160,32 @@ While we don't have automated tests yet, please:

```
powershell-dev-toolkit/
├── README.md # Main documentation
├── config.example.json # Configuration template
├── Setup-Environment.ps1 # Setup script
├── Get-ScriptConfig.ps1 # Config loader
├── Connect-SSH.ps1 # SSH scripts
├── Connect-SSHTunnel.ps1
├── Get-*.ps1 # Get/retrieve commands
├── Invoke-*.ps1 # Action commands
├── Start-*.ps1 # Start/launch commands
├── Watch-*.ps1 # Monitor commands
├── New-*.ps1 # Create/generate commands
└── creds/ # Credentials (gitignored)
├── PowerShellDevToolkit/ # The PS module
│ ├── PowerShellDevToolkit.psd1 # Module manifest (version, exports)
│ ├── PowerShellDevToolkit.psm1 # Root module (auto-loader, aliases)
│ ├── Public/ # Exported functions (one per file)
│ │ ├── Connect-SSH.ps1
│ │ ├── Get-GitQuick.ps1
│ │ └── ...
│ └── Private/ # Internal helpers (not exported)
│ └── Get-ScriptConfig.ps1
├── tests/ # Pester tests
├── docs/ # Documentation
├── config.example.json # Configuration template
├── Setup-Environment.ps1 # Bootstrap / installer
├── README.md
├── LICENSE
└── creds/ # Credentials (gitignored)
```

### Adding a new command

1. Create `PowerShellDevToolkit\Public\Verb-Noun.ps1` with a `function Verb-Noun { ... }` wrapper
2. Add the function name to `FunctionsToExport` in `PowerShellDevToolkit.psd1`
3. Optionally add a short alias in `PowerShellDevToolkit.psm1` and `AliasesToExport` in the `.psd1`
4. Add a test file `tests\Verb-Noun.Tests.ps1`
5. Update `Show-Help` in `Public\Show-Help.ps1` with the new command reference

## Commit Messages

Use clear and meaningful commit messages:
Expand All @@ -169,6 +199,7 @@ Use clear and meaningful commit messages:
- **chore**: Maintenance tasks

Examples:

```
feat: add support for SQLServer tunneling
fix: resolve credential loading on PowerShell 7
Expand All @@ -186,4 +217,4 @@ Be respectful and constructive. We're all here to learn and help each other.

---

Thank you for contributing! 🚀
Thank you for contributing! 🚀
26 changes: 26 additions & 0 deletions Invoke-Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#Requires -Version 5.1
<#
.SYNOPSIS
Runs the full Pester test suite for PowerShellDevToolkit.
.DESCRIPTION
Installs Pester 5+ if not present, then runs all tests under .\tests\
with detailed output. Exit code mirrors the Pester result (0 = pass).
.EXAMPLE
.\Invoke-Tests.ps1
#>

$ErrorActionPreference = 'Stop'

if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge '5.0' })) {
Write-Host "Pester 5+ not found. Installing from PSGallery..." -ForegroundColor Yellow
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -Scope CurrentUser -SkipPublisherCheck
}

Import-Module Pester -MinimumVersion 5.0.0

$config = New-PesterConfiguration
$config.Run.Path = Join-Path $PSScriptRoot 'tests'
$config.Run.Exit = $true
$config.Output.Verbosity = 'Detailed'

Invoke-Pester -Configuration $config
104 changes: 104 additions & 0 deletions PowerShellDevToolkit/PowerShellDevToolkit.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
@{
RootModule = 'PowerShellDevToolkit.psm1'
ModuleVersion = '1.2.0'
GUID = '882e07c2-69ad-46e6-aea6-07adb025f6b3'
Author = 'PowerShell Dev Toolkit Contributors'
CompanyName = 'Community'
Copyright = '(c) 2025 PowerShell Dev Toolkit Contributors. All rights reserved.'
Description = 'A comprehensive collection of PowerShell productivity tools for Windows developers. SSH tunneling, project management, AI integration, dev servers, and more.'

PowerShellVersion = '5.1'

FunctionsToExport = @(
# Original commands
'Connect-SSH'
'Connect-SSHTunnel'
'Copy-ToClipboard'
'Find-InProject'
'Get-GitQuick'
'Get-PortProcess'
'Get-ProjectContext'
'Get-ProjectInfo'
'Get-ServiceStatus'
'Invoke-Artisan'
'Invoke-QuickRequest'
'New-AIRules'
'Set-ProjectEnv'
'Show-Help'
'Show-RecentCommands'
'Start-DevServer'
'Watch-LogFile'
# File & editor commands
'Edit-File'
'Edit-Profile'
'Edit-Hosts'
'Use-NppForGit'
'Set-FileTimestamp'
'Open-Item'
# Directory commands
'Get-DirectoryListing'
'New-DirectoryAndEnter'
'Set-TempLocation'
# Utility commands
'Get-CommandLocation'
'Invoke-Elevated'
'Add-Path'
'Invoke-ProfileReload'
# Network commands
'Get-IPAddress'
'Clear-DNSCache'
# Toolkit management
'Update-Toolkit'
'Test-ToolkitUpdate'
)

CmdletsToExport = @()
VariablesToExport = @()

AliasesToExport = @(
# Original aliases
'cssh'
'tunnel'
'tssh'
'gs'
'serve'
'port'
'search'
'tail'
'context'
'proj'
'art'
'http'
'useenv'
'services'
'clip'
'ai-rules'
'rc'
'helpme'
# File & editor aliases
'e'
'npp'
'touch'
'open'
# Directory aliases
'll'
'mkcd'
'temp'
# Utility aliases
'which'
'sudo'
'reload'
'grep'
# Network aliases
'ip'
'Flush-DNS'
)

PrivateData = @{
PSData = @{
Tags = @('Windows', 'Developer', 'Productivity', 'SSH', 'DevTools')
LicenseUri = 'https://github.com/joshuaevan/powershell-dev-toolkit/blob/main/LICENSE'
ProjectUri = 'https://github.com/joshuaevan/powershell-dev-toolkit'
}
}
}
Loading
Loading