A powerful, cross-platform PowerShell profile that enhances your terminal experience with AI integration, mathematical functions, advanced utilities, and beautiful customizable prompts.
- 🎨 Customizable Prompt: 11 different color schemes including dynamic themes
- 🤖 AI Integration: Google Gemini chat with terminal-optimized responses
- 💬 Smart Commit Messages: AI-powered commit message suggestions based on staged changes
- 🧮 Mathematical Functions: Complete set of trigonometric and mathematical operations
- 🐍 Smart Pip Wrappers: Intelligent warnings for global package installations
- 🐙 GitHub Copilot: Built-in command suggestions and explanations
- 🔒 Secure Storage: Cross-platform encrypted API key management
- 📁 Smart File Operations: Directory trees with .gitignore support
- ⚙️ JSON Configuration: Persistent settings with easy customization
- 🌍 Cross-Platform: Works seamlessly on Windows, Linux, and macOS
- PowerShell 7+ (cross-platform support)
- OpenSSL (for Linux/macOS Gemini integration)
- GitHub CLI (optional, for Copilot features)
-
Clone or download this profile to your PowerShell directory:
Windows:
# Check your profile path $PROFILE # Usually: C:\Users\<YourName>\Documents\PowerShell\
Linux/macOS:
# Create directory if it doesn't exist mkdir -p ~/.config/powershell # Profile path: ~/.config/powershell/Microsoft.PowerShell_profile.ps1
-
Copy the profile file to your PowerShell directory as
Microsoft.PowerShell_profile.ps1 -
Reload your PowerShell session:
. $PROFILE
-
Configure your settings (optional):
- The profile will create
powershell.config.jsonautomatically - Edit this file to customize your experience
- The profile will create
# Get weather information
Get-Weather "Madrid"
# Show directory tree
tree
# Copy current path to clipboard
cpwd
# Get your public IP
Get-PublicIP
# Show disk space
Get-DiskSpace
# Smart pip installations (with global warnings)
pip install package-name # Shows warning if not in venv
pip install package-name --global # Skips warning# Start Gemini chat (English)
gemini "how to find large files in PowerShell"
# Suggest commit message based on staged changes
sgcm # or Invoke-SuggestCommitMessage
# Analyzes staged changes and previous commits to generate a commit message
# Use with custom options
Invoke-SuggestCommitMessage -CommitCount 50 -Model "gemini-2.5-flash"
Invoke-SuggestCommitMessage -Force # Auto-commit without prompting
Invoke-SuggestCommitMessage -AdditionalInstructions "Use conventional commits format"
# GitHub Copilot suggestions
ghcs "compress a folder"
# GitHub Copilot explanations
ghce "Get-ChildItem -Recurse | Where-Object {$_.Length -gt 100MB}"# Use mathematical constants
$PI
$E
# Calculate trigonometric functions
Get-Sin 1.5708 # π/2
Get-Cos 0 # 1
Get-Sqrt 16 # 4
Get-Pow 2 3 # 8The profile includes intelligent wrappers for pip and pip3 commands that warn you when installing packages globally outside of a virtual environment:
# Installing globally will show a warning
pip install requests
# Output:
# ⚠️ WARNING: Installing packages globally (not in virtual environment).
# Recommended: python -m venv venv then activate it.
# Or use: pip install requests --global
#
# Press Enter to continue or Ctrl+C to cancel.
# Skip warning with --global flag
pip install requests --global
# In a virtual environment, works normally (no warning)
python -m venv myenv
.\myenv\Scripts\Activate.ps1 # Windows
pip install requests # No warning shownFeatures:
⚠️ Smart warnings: Only warns forinstallcommands when not in a virtual environment- 🔍 Environment detection: Automatically detects
venvandcondaenvironments - 🛠️ Cross-platform: Works on Windows, Linux, and macOS
- 🚫 Skip warnings: Use
--globalflag to bypass warnings - 🔧 Transparent: All other pip commands work exactly as normal
- 🎯 Independent:
pipandpip3work independently with their respective binaries
The wrapper detects virtual environments by checking:
$env:VIRTUAL_ENV(standard Python virtual environments)$env:CONDA_DEFAULT_ENV(Conda environments)
Available color schemes:
Default,Blue,Green,Cyan,Red,Magenta,Yellow,GrayRandom,Asturias,Spain,Hackerman
# Change color scheme
Set-PromptColorScheme -ColorScheme "Hackerman"
# Or edit powershell.config.json:
{
"Microsoft.PowerShell.Profile:PromptColorScheme": "Hackerman"
}The profile uses a JSON configuration file (powershell.config.json) for settings:
{
"Microsoft.PowerShell.Profile:PromptColorScheme": "Default",
"Microsoft.PowerShell.Profile:DefaultPrompt": false,
"Microsoft.PowerShell.Profile:AskCreateCodeFolder": true,
"Microsoft.PowerShell.Profile:CodeFolderName": "Code",
"Microsoft.PowerShell.Profile:EnableRandomTitle": false
}| Setting | Description | Default |
|---|---|---|
PromptColorScheme |
Color scheme for the prompt | "Default" |
DefaultPrompt |
Use standard PowerShell prompt | false |
AskCreateCodeFolder |
Prompt to create Code folder | true |
CodeFolderName |
Name of the code directory | "Code" |
EnableRandomTitle |
Enable randomized window titles | false |
The profile includes cross-platform secure storage for API keys:
# Store API key securely
Set-SecureApiKey -ApiKey "your-gemini-api-key" -KeyName "GeminiAPI"
# Retrieve stored key
$apiKey = Get-SecureApiKey -KeyName "GeminiAPI"Storage Methods:
- Windows: DPAPI (Data Protection API)
- Linux/macOS: OpenSSL encryption with user-specific keys
The profile includes automatic risk analysis for PowerShell code:
# Test code for potential risks
Test-PowerShellCodeRisk "Remove-Item C:\Important -Force"
# Returns: $true (risky operation detected)
# Execute code safely with confirmation
Invoke-SafePowerShellCode "Get-Process | Stop-Process"
# Prompts for confirmation on risky operations# Show directory tree with .gitignore support
Show-DirectoryTree -Path "C:\Projects" -IncludeFiles -RespectGitIgnore
# Get file contents recursively (respecting .gitignore)
Get-ContentRecursiveIgnore -Path "C:\Projects" -UseMarkdownFence $trueThe profile includes an intelligent commit message generator using Gemini AI:
# Basic usage - analyzes staged changes and suggests a commit message
sgcm
# or
Invoke-SuggestCommitMessage
# Customize the number of previous commits to analyze (default: 100)
Invoke-SuggestCommitMessage -CommitCount 50
# Use a specific Gemini model
Invoke-SuggestCommitMessage -Model "gemini-2.5-flash"
# Auto-commit without prompting for confirmation
Invoke-SuggestCommitMessage -Force
# Add specific instructions for the commit message
Invoke-SuggestCommitMessage -AdditionalInstructions "Use conventional commits format with emoji"
# Load instructions from a file
Invoke-SuggestCommitMessage -InstructionsFile "commit-guidelines.txt"
# Show detailed progress information
Invoke-SuggestCommitMessage -Verbose
# Get just the message for use in scripts/automation
$commitMsg = Invoke-SuggestCommitMessage -ReturnOnlyFeatures:
- 🔍 Analyzes staged changes: Examines git diff to understand modifications
- 📚 Learns from history: Reviews previous commits to match style and language
- 🌐 Language detection: Generates messages in the same language as your commit history
- 🎯 Smart formatting: Matches existing commit message patterns and conventions
- ⚡ Quick workflow: Choose to commit immediately or copy to clipboard
- 🎨 Customizable: Supports additional instructions and different AI models
- 📋 Shows staged files: Displays files to be committed before taking action
- 🔬 Verbose mode: Detailed progress tracking with -Verbose parameter
- 🔄 Message refinement: Provide feedback to regenerate the message with AI
- 🤖 Scriptable: Use -ReturnOnly for integration with other tools
Workflow:
- Stage your changes:
git add . - Run:
sgcm - Review the AI-generated commit message
- Choose action:
- Type
committo commit with the message - Press Enter to copy to clipboard
- Type feedback to refine the message (e.g., "make it shorter", "add emoji")
- Type
- PowerShell 7+ on Windows, Linux, or macOS
For AI Features:
- Google Gemini API key
- Internet connection
- Linux/macOS: OpenSSL
# Ubuntu/Debian sudo apt-get install openssl # macOS (usually pre-installed) brew install openssl # Arch Linux sudo pacman -S openssl
For GitHub Copilot:
- GitHub Copilot subscription
- GitHub CLI: Download here
- GitHub Copilot CLI extension:
gh extension install github/gh-copilot
Get-UserSettings- Load configuration from JSONSave-UserSettings- Save configuration to JSONSet-PromptColorScheme- Configure prompt colorsPrompt- Custom prompt function
Set-PWDClipboard(cpwd) - Copy current directory to clipboardGet-PublicIP- Retrieve public IP addressGet-DiskSpace- Display drive space informationGet-Weather- Get weather for locationGet-ChtShHelp- Query cht.sh for command helpStop-ProcessConstantly- Continuously stop a process
Show-DirectoryTree(tree) - Display directory treeGet-ContentRecursiveIgnore- Get file contents with ignore patterns
- Trigonometric:
Get-Sin,Get-Cos,Get-Tan,Get-Asin,Get-Acos,Get-Atan,Get-Atan2 - Power/Root:
Get-Sqrt,Get-Pow,Get-Exp - Logarithmic:
Get-Log,Get-Log10 - Rounding:
Get-Round,Get-Ceiling,Get-Floor,Get-Truncate - Utility:
Get-Abs,Get-Max,Get-Min,Get-Sign
Invoke-GeminiChat(gemini) - Google Gemini AI chatInvoke-SuggestCommitMessage(sgcm) - AI-powered commit message suggestionsFormat-GeminiText- Process Gemini formatting commandsTest-PowerShellCodeRisk- Analyze code for security risksInvoke-SafePowerShellCode- Execute code with safety checks
ghcs- GitHub Copilot Suggest (command suggestions)ghce- GitHub Copilot Explain (command explanations)
| Alias | Command | Description |
|---|---|---|
vim |
nvim |
Neovim editor |
vi |
vim |
Vim editor |
cpwd |
Set-PWDClipboard |
Copy working directory |
tree |
Show-DirectoryTree |
Directory tree display |
gemini |
Invoke-GeminiChat |
AI chat |
sgcm |
Invoke-SuggestCommitMessage |
AI commit message suggestions |
wrh |
Write-Host |
Write to host |
Contributions are welcome! Here's how you can help:
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Clone the repository
- Make your changes to
Microsoft.PowerShell_profile.ps1 - Test with:
. $PROFILE - Update documentation if needed
- Follow PowerShell best practices
- Add documentation for new functions
- Test on multiple platforms when possible
- Update the README for new features
- Installation Script: Automated cross-platform installation
- Modular System: Optional modules for different feature sets
- Core Profile (basic functionality)
- AI Integration Module
- Mathematics Module
- GitHub Module
- Development Tools Module
- Security Module
- Enhanced Terminal Integration: Better terminal-specific features
- Cloud Synchronization: Settings sync across machines
- Package Manager Integration: Direct tool installation
- Additional AI Providers: OpenAI, Claude, etc.
- Advanced Security: Code sandboxing and ML-based risk analysis
Need help? Here are your options:
- 📝 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📧 Email: Contact maintainer
This project is licensed under the MIT License - see the LICENSE file for details.
- PowerShell Team: For creating an amazing cross-platform shell
- Google: For the Gemini AI API
- GitHub: For Copilot integration
- Community: For feedback and contributions
🟢 Active Development - This project is actively maintained and new features are being added regularly.
⭐ Star this repo • 🍴 Fork it • 📝 Report an issue
Made with ❤️ by Adrián Cancio