PowerShell模块管理器

一个结构化方法,用于管理PowerShell配置文件,支持模块化组件的轻松定制、加载和维护。

  • by emilwojcik93
  • PowerShell
  • 本地部署
  • 更新于
在 GitHub 查看 emilwojcik93/powershell-profile-manager

使用说明

PowerShell配置文件管理器

使用模块化组件管理PowerShell配置文件的结构化方法,便于定制、加载和维护。

🚀 快速开始

安装

# Install the profile manager using ScriptBlock approach
powershell.exe -ExecutionPolicy Bypass -Command "&([ScriptBlock]::Create((irm https://raw.githubusercontent.com/emilwojcik93/powershell-profile-manager/main/scripts/deploy/install.ps1))) -VerboseLogging -Force"

基本用法

# Load all modules
. $PROFILE

# Check loaded modules
Get-ProfileModules

# Unload specific module
Unload-ProfileModule VideoCompressor

# Reload specific module
Reload-ProfileModule VideoCompressor

📁 存储库结构

powershell-profile-manager/
├── README.md                    # This file
├── CONTRIBUTING.md              # Contribution guidelines
├── Microsoft.PowerShell_profile.ps1  # Main profile loader
├── scripts/                     # PowerShell scripts
│   ├── build/                   # Build and packaging scripts
│   ├── deploy/                  # Installation and deployment scripts
│   │   ├── install.ps1          # Installation script
│   │   ├── uninstall.ps1        # Uninstallation script
│   │   └── release.ps1          # Release preparation script
│   ├── test/                    # Testing and validation scripts
│   └── tools/                   # Utility and helper scripts
├── modules/                     # Module directory
│   ├── VideoCompressor/         # Video compression module
│   │   ├── VideoCompressor.psm1
│   │   ├── VideoCompressor.psd1
│   │   └── README.md
│   ├── PowerShellMCP/           # MCP Server for Cursor IDE
│   │   ├── PowerShellMCP.psm1
│   │   ├── PowerShellMCP.psd1
│   │   └── README.md
│   └── ExampleModule/           # Example module template
│       ├── ExampleModule.psm1
│       ├── ExampleModule.psd1
│       └── README.md
├── docs/                        # Documentation
│   ├── installation.md          # Installation guide
│   ├── module-development.md    # Module development guide
│   ├── troubleshooting.md       # Troubleshooting guide
│   ├── configuration.md         # Configuration guide
│   └── examples/                # Usage examples
└── .github/workflows/           # CI/CD workflows
    ├── release.yml              # Release automation
    └── test.yml                 # Testing automation

🎯 特性

  • 模块化设计:每个功能都是一个单独的模块
  • 易于管理:单独加载/卸载模块
  • 错误处理:妥善处理缺失或损坏的模块
  • 自动安装:自动设置和配置
  • 清洁卸载:完全删除并恢复轮廓
  • 文档:每个模块的综合文档
  • 发布管理:自动发布准备
  • 后台代理:通过Cursor代理进行持续监控和自动修复

📦 可用模块

视频压缩器

使用云存储平台的最佳设置压缩视频文件。

Compress-Video "MyVideo.mp4" -CompressionMode Quality

PowerShellMCP

用于Cursor IDE集成的MCP服务器,通过AI代理实现安全的PowerShell命令执行。

Start-PowerShellMCPServer
Get-PowerShellMCPStatus

示例模块

模板模块,显示创建新模块的最佳实践。

🔧 模块管理

加载模块

# Load all modules (default behavior)
. $PROFILE

# Load specific module
Load-ProfileModule VideoCompressor

卸载模块

# Unload specific module
Unload-ProfileModule VideoCompressor

# Unload all modules
Unload-AllProfileModules

模块状态

# List all available modules
Get-ProfileModules

# Check module status
Get-ProfileModuleStatus VideoCompressor

🛠️ 发展

创建新模块

  1. 复制 ExampleModule 目录
  2. 重命名文件并更新内容
  3. 将模块添加到 $PROFILE 配置
  4. 测试和记录

看 贡献.md 详细指南。

模块结构

每个模块应遵循以下结构:

ModuleName/
├── ModuleName.psm1      # Main module file
├── ModuleName.psd1      # Module manifest
└── README.md            # Module documentation

📚 文档

🤝 贡献

我们欢迎捐款!请看 贡献.md 作为指导方针。

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🆘 支持

  • 为bug或功能请求创建问题
  • 检查 故障排除指南
  • 查看中的模块特定文档 docs/modules/