The Dev PowerShell Utility has been refactored into a modular structure for better maintainability and organization.
src/
├── dev.ps1 # Main entry point - loads all modules and dispatches commands
├── core/ # Core functionality
│ ├── Helpers.ps1 # Helper functions (Search-Folder, ConvertTo-Hashtable)
│ └── Config.ps1 # Configuration management (Get-DevConfig, Get-DevRoots, etc.)
└── commands/ # Command implementations
├── Open.ps1 # Invoke-DevOpen - Opens folders in VSCode/Explorer
├── Create.ps1 # Invoke-DevCreate - Creates new projects
├── Remove.ps1 # Invoke-DevRemove - Removes folders
├── List.ps1 # Invoke-DevList - Lists folders by category
├── Git.ps1 # Git commands (pull, release, local-release, status, init)
└── Set.ps1 # Invoke-DevSet - Configuration settings- Imports all core and command modules
- Defines the main
devfunction - Dispatches commands to appropriate handlers
- Maintains the help text and command-line interface
Search-Folder: Searches for folders recursivelyConvertTo-Hashtable: Converts PSObjects to hashtables
Get-DevConfig: Loads user configuration (code/explorer preferences)Get-DevRoots: Loads root paths from roots.jsonSave-DevRoots: Saves root paths to roots.jsonGet-DevLicenses: Loads or downloads license templates
Each command is implemented as a separate function in its own file:
- Open.ps1:
Invoke-DevOpen- Opens project folders - Create.ps1:
Invoke-DevCreate- Creates new projects - Remove.ps1:
Invoke-DevRemove- Removes folders - List.ps1:
Invoke-DevList- Lists folders by category - Git.ps1: Git-related commands
Invoke-DevPull- Clone or pull repositoriesInvoke-DevRelease- Commit and push changesInvoke-DevLocalRelease- Commit without pushingInvoke-DevStatus- Show git statusInvoke-DevInit- Initialize new repository
- Set.ps1:
Invoke-DevSet- Manage configuration settings
- Maintainability: Each command is isolated in its own file
- Readability: Easier to find and understand specific functionality
- Extensibility: Simple to add new commands or modify existing ones
- Testing: Individual modules can be tested independently
- Debugging: Issues can be isolated to specific modules
To add a new command:
- Create a new file in
src/commands/(e.g.,MyCommand.ps1) - Implement your command function (e.g.,
Invoke-DevMyCommand) - Export the function:
Export-ModuleMember -Function Invoke-DevMyCommand - Import the module in
src/dev.ps1:. "$ScriptDir\commands\MyCommand.ps1" - Add a switch case in the
devfunction to dispatch to your command - Update the help text with usage information
- Navigate to the appropriate file in
src/commands/ - Make your changes to the function
- Test the command:
. .\src\dev.ps1then usedev <command> - No changes to other files needed unless you're changing the interface
Both Chocolatey and Inno Setup installers have been updated to:
- Include the entire
srcdirectory structure - Reference
src\dev.ps1as the main entry point - Preserve the modular structure in the installation directory
- Files are installed to Chocolatey's tools directory
- Profile is updated to source
src\dev.ps1
- Files are installed to Program Files
- Profile is updated to source
{app}\src\dev.ps1
The modular structure maintains full backward compatibility:
- Same command-line interface
- Same configuration file locations
- Same behavior for all commands
- Only the internal organization has changed