Aitools
🧠 PowerShell wrapper for AI coding assistants with batch processing, persistent config, and Pester v4→v5 migration automation
Install / Use
/learn @potatoqualitee/AitoolsQuality Score
Category
Development & EngineeringSupported Platforms
README
aitools
<img align="left" src="https://raw.githubusercontent.com/potatoqualitee/aitools/main/logo.png" alt="aitools logo" width="96">Batch-process your code with AI CLI editors.
aitools is a PowerShell module that wraps AI coding assistants like Claude Code, Aider, Gemini CLI, and GitHub Copilot CLI. It automates code refactoring, migrations, and documentation tasks by making these AI tools scriptable through PowerShell.
<br clear="left"/>What is aitools?
aitools wraps agentic CLI tools - AI assistants that actually read, understand, and rewrite your code - and makes them scriptable through PowerShell. Every run starts fresh with no conversation drift, just consistent output.
In 30 seconds:
# Install the module
Install-Module aitools
# Install Claude
Install-AITool -Name Claude
# Migrate all your Pester tests from v4 to v5
Get-ChildItem tests\*.Tests.ps1 | Update-PesterTest
aitools handles the AI coordination, file I/O, and change tracking while giving you PowerShell's predictability.
Why I built this
Each AI CLI has different flags, installation steps, and quirks. Processing 100 files means clicking through each one in an IDE or writing shell scripts that break when the CLI changes. I built a wrapper and figured I'd share it.
What it does:
- One consistent interface across multiple AI CLIs
- Simple batch operations: pipe files in, get results out
- Handles installation, updates, and configuration
- Tracks changes for review before committing
Each file is processed in a fresh session, which means consistent output without conversation drift. Parallel processing, automatic retry logic, and the ability to skip already-modified files make it practical for large-scale operations.
Getting started
Requirements
- PowerShell 3+ or later
- Windows, Linux, or macOS
Install aitools
Install-Module aitools -Scope CurrentUser
Install AI tools
Pick the AI assistant you want:
# Install one
Install-AITool -Name Claude
# Install a specific version
Install-AITool -Name Claude -Version 2.0.52
# Install a specific version and auto-remove other versions
Install-AITool -Name Aider -Version 0.45.0 -UninstallOtherVersions
# Or several tools
Install-AITool -Name Gemini, Aider
# Or all of them
Install-AITool -Name All
Installation Scope (Linux)
By default, tools install to user-local directories (CurrentUser scope) without requiring elevated privileges. On Linux, you can optionally install system-wide:
# User-local installation (default, no sudo required)
Install-AITool -Name Aider -Scope CurrentUser
# System-wide installation (requires sudo on Linux)
Install-AITool -Name Gemini -Scope LocalMachine
When using -Scope LocalMachine on Linux:
- You'll be prompted for your sudo password if needed
- Prerequisites (Node.js, pipx) are installed via apt-get
- Tools are available to all users on the system
On macOS, Homebrew handles installations without requiring sudo, so both scopes work without elevated privileges.
Set your default
Set-AIToolDefault -Tool Claude
Now any aitools command will use Claude unless you specify otherwise.
Quick examples
Migrate test frameworks
Get-ChildItem ./tests/*.Tests.ps1 | Update-PesterTest
Updates your Pester v4 tests to v5 syntax, handling BeforeAll/AfterAll blocks, Context/Describe changes, and parameter validation.
Add documentation
Get-ChildItem ./public/*.ps1 |
Invoke-AITool -Prompt "Add complete comment-based help with 3 examples"
Enforce code style
Get-ChildItem *.ps1 -Recurse |
Invoke-AITool -Prompt "Apply One True Brace Style formatting"
Compare multiple AI tools
Invoke-AITool -Path ./script.ps1 -Prompt "Optimize this" -Tool All
Runs the same task through all installed AI tools and compares results.
Choosing the right tool
# Complex refactoring: Claude for deep understanding
Get-ChildItem src\*.ps1 | Invoke-AITool -Tool Claude -Prompt ./prompts/refactor-dependency-injection.md
# Large-scale refactoring: Gemini for massive context (entire codebase awareness)
Get-ChildItem src\*.ps1 | Invoke-AITool -Tool Gemini -Prompt ./prompts/modernize-ps7.md
# Quick metadata fixes: Copilot for speed
Get-ChildItem recipes\*.md | Invoke-AITool -Tool Copilot -Prompt ./prompts/fix-recipe-metadata.md
# T-SQL case sensitivity: Copilot for fast processing
Get-ChildItem sql\*.sql | Invoke-AITool -Tool Copilot -Prompt "Convert all keywords to uppercase"
# Blog updates: Copilot for rapid content corrections
Get-ChildItem blog\*.md | Invoke-AITool -Tool Copilot -Prompt ./prompts/update-blog-links.md
Supported AI Tools
| Tool | Best For | Pricing | Status | | --- | --- | --- | --- | | Claude | Complex refactoring, architectural changes | Subscription | ✅ Supported | | Gemini CLI | Massive context (1M tokens), multimodal | Free + paid | ✅ Supported | | Copilot | Fast tasks, blog updates, GitHub workflow | Free + paid | ✅ Supported | | Aider | Reliable diffs, fast iteration | Free + paid | ✅ Supported | | Codex CLI | Fast processing, vision support | Subscription | ✅ Supported | | Cursor AI | IDE integration | Free + paid | ✅ Supported | | Ollama | Offline use, completely free | Free | ✅ Supported | | PSOpenAI | Image/video/audio generation | Pay-per-use | ✅ Supported |
Which one to use
- Claude excels at complex refactoring and architectural changes where deep code understanding is critical, but can struggle with files over 400 lines
- Gemini 3 handles complex refactoring with a massive 1 million-token context window, allowing you to process entire large codebases in one session. Strong at multimodal understanding (code, images, video, audio) and offers a generous free tier
- Copilot shines for fast, focused tasks like blog updates, T-SQL case conversion, metadata fixes, or quick content corrections
- Ollama runs completely offline with no API costs
Note: PSOpenAI is a PowerShell module wrapper (not a CLI), providing capabilities that agentic tools don't yet support like image editing, video generation, and text-to-speech.
Tool Name Change: As of v1.0.5,
ClaudeCodehas been renamed toClaudeandGitHubCopilottoCopilotfor simplicity. The old names still work as aliases for backward compatibility.
How it differs from API wrappers
Most of aitools wraps agentic CLI tools - AI assistants that read, understand, and rewrite code - but it also includes PSOpenAI for image/video/audio generation and editing.
| API Wrappers (like PSOpenAI) | Agentic CLI Tools (like Claude Code) | | ---------------------------------------- | -------------------------------------------- | | Send prompts, receive text/media | Open files, understand code, make edits | | You handle file I/O and context | Built-in file management and context | | Great for generating new content | Great for refactoring existing code | | Excels at image/video/audio generation | Specialized for code editing workflows |
PSOpenAI support is included for image editing and generation capabilities that CLI tools don't yet provide.
How it works
The three-step process
Every aitools operation follows the same pattern:
- Input - Provide files and a prompt
- Processing - AI reads, understands, and edits
- Review - You see diffs and decide to keep or discard
This mirrors manual code review but scales to hundreds of files.
Prompts and context
You can provide:
- Inline prompts: Quick instructions right in the command
- Prompt files: Reusable
.mdfiles with detailed instructions - Context files: Reference docs, style guides, API specifications
Example with all three:
$params = @{
Path = "./src/*.ps1"
PromptFilePath = "./prompts/api-migration.md"
ContextFilePath = @(
"./docs/new-api-spec.md",
"./docs/style-guide.md"
)
Tool = "Claude"
}
Invoke-AITool @params
The AI reads the prompt for what to do, the context for how to do it, and processes each file accordingly.
Real-World Examples
Case Study: Modernizing a Windows Module
The BurntToast module wraps Windows notification APIs. When Microsoft updated from Windows 10 to Windows 11 APIs, the module needed refactoring across multiple files.
$params = @{
Path = "./burnttoast/*.ps1"
PromptFilePath = "./prompts/api-upgrade.md"
ContextFilePath = @(
"./docs/windows11-toast-sdk.md",
"./docs/styleguide.md"
)
Tool = "Claude"
}
Invoke-AITool @params
This handled namespace changes, XML property renames, and layout differences, automatically refactoring the entire module.
Case Study: Updating dbatools.io Blog
The dbatools.io blog needed systematic updates to fix broken links, deprecated commands, outdated screenshots, and stale Twitter embeds. This required judgment, not mechanical find-replace.
Requirements:
- Fix broken links but preserve historical context
- Remove Twitter/X embeds while keeping meaning
- Convert PowerShell screenshots to Hugo shortcodes
- Update deprecated command names
- Consider splatting for readability (but not blindly)
- Maintain author voice and histori
