Updating My Blog Using Codex Wrapper aitools

Updating My Blog Using Codex Wrapper aitools

Table of Contents

Introduction

aitools is a PowerShell module that lets you automate code refactoring, migrations, and documentation tasks using AI coding assistants like Claude Code, Aider, Gemini CLI, and GitHub Copilot CLI. Essentially, it’s a wrapper for agentic CLI tools, that are able to read, understand, and modify codebases. Put it all together, and you have a way to batch process your code in a repeatable way through Powershell.

Why use aitools?

As per Chrissy’s README, the main issue with AI coding assistants isn’t their capability — it’s their interface. Each CLI has different flags, installation steps, and quirks. So a wrapper like aitools abstracts away those differences and provides a consistent interface to work with multiple AI coding assistants. It took me all of about 10 minutes to get it installed and the prompt adjusted to meet my needs before I was able to let it loose on my blog and the results were impressive.

Setting it up

Setting it up is as easy as running two commands:

# Install the module
Install-Module aitools

# Install Claude Code
Install-AITool -Name ClaudeCode

Note that I had to get a Claude Pro account to use Claude Code, as the free tier does not support it.

Prepping my prompt

Chrissy has provided a great example prompt, it has clear instructions on what is expected, all I have done is customised for my expectations, made some pointers around how to address image links and some specifics on what I want to done with front matter. I then need to pick my AI tool of choice and run a command over my blog folder:

# set claude as default tool
Set-AIToolDefault -Tool ClaudeCode

# use refresh prompt to update blog posts
Get-ChildItem content/blog/*.md -recurse | Invoke-AITool -Prompt .\prompts\refresh.md

Alterations to the prompt

I did make a few alterations to the prompt to make sure that it was signposted to a few nuances around build structure vs local file structure. For example, I wanted to make sure it understood that hugo flattens the static folder, so relative paths need to omit the static folder in the path. I have also started to include my blog posts and images within a directory structure that matches the blog post name, so I needed to make sure it understood that relative paths between blog posts needed to go up one level. Beyond that, I cut out a little bit of the specific instructions on PowerShell because I don’t have anywhere near the level of PowerShell code in my blog as Chrissy’s. Finally, just set some expectations around categories used.

The outcome?

I ran the command across my entire blog, over 198 posts, I can’t give you the full output but wow, it is pretty remarkable. Here’s the output from a single file that passed the test:

FileName  : redgate-sql-provision-first-look-part1.md
FullPath  : /Users/justin/Code/site-blog/content/blog/2019/redgate-sql-provision-first-look-part1.md
Tool      : ClaudeCode
Model     : Default
Result    : ## Audit Complete

            **No changes needed - post is already in good shape.**                                                      

            ### Audit Results:                                                                                          
            1. **Links**: All 4 external links are valid and accessible:
               - GitHub AdventureWorks sample database ✓
               - Redgate Data Masker documentation ✓
               - Redgate SQL Clone PowerShell cmdlet reference ✓
               - Author's GitHub community-stuff repository ✓                  
            2. **Frontmatter**: The category "data" is valid according to the allowed categories list.
            3. **Code Examples**: No PowerShell or code examples present in this post - it's primarily explanatory text with screenshots and references.                                                                                     
            4. **Images**: All image references (002.webp through 013.webp) use relative paths appropriate for local post folder images. No remote images found.
            5. **Content**: No Twitter/X embeds, no broken references, no "coming soon" language, and no security or technical accuracy issues found.
            6. **Historical Context**: The post is a 2019 review of Redgate SQL Provision and is appropriately dated. All version-specific references are accurate for the time period.                                                                                               
            The post is well-maintained and requires no updates.                                                        
                                                                                                                        
StartTime : 06/11/2025 21:53:16                                                                                         
EndTime   : 06/11/2025 21:53:59                                                                                         
Duration  : 00:00:42                                                                                                    
Success   : True   

Observe that it took 42 seconds to process a full blog post! So this might take a bit of time to process them all, but to give you an idea of some of the things it has corrected, here are some specific changes it has made:

* Link Update: Updated the Microsoft Docs URL from `docs.microsoft.com` to `learn.microsoft.com` (line 37)
- Old: `https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7`
- New: `https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7`
* Security Note: Added a security warning at the end of the post about the risks of using `Invoke-Expression` with remote content (line 49)
* Fixed spacing/grammar issues (line 14):     
- Added missing space after "wedding later this year.I also""year. I also"                            
- Added missing space after "associate.We hadn't""associate. We hadn't"
* Fixed broken URL in figure caption (line 34):                                                        
- Removed malformed URL `https://www.damianbarr.com/latest/https/we-are-not-all-in-the-same-boat`      
* Fixed broken link:                                                                                   
- Removed hyperlink to `https://sqlbits.com/information/event20/Advanced_T-SQL_Querying_and_Query_Tuning/trainingdetails` (404 error)
- Kept the training name in plain text since it's historical context    
* Updated broken Unraid documentation link from:                                                       
- `https://wiki.unraid.net/UnRAID_6/Configuring_Apple_Time_Machine#Guide:_Setting_up_a_Time_Machine_Share_on_your_Unraid_Server`
- to: `https://docs.unraid.net/unraid-os/using-unraid-to/manage-storage/apple-time-machine/`             
    The old wiki URL returns a 301 redirect as Unraid has moved their documentation to a new platform.       
* Updated Terminal command context - Added clarification that the `TMShowUnsupportedNetworkVolumes` command "may need" to be run on 
older macOS versions, and noted that "modern macOS versions (Ventura 13.x and later) have improved SMB support and may not require this 
step." This provides more accurate guidance while preserving the historical context of the original post.

Some changes were routine enough, but the level of change was unexpected. It has made some grammatical fixes and formatting fixes, it has responded to redirect responses by correcting the URLs, where a 404 was received it fixed up the wording so that it the posts continue to make sense. It even went as far as adding a security note about using Invoke-Expression with remote content!

There have been a few unwanted changes, for example it looked at the url https://www.damianbarr.com/latest/https/we-are-not-all-in-the-same-boat and thought it was malformed so removed it. As you can see, there is nothing wrong with the url so clearly you need to assess what changes have been made, but overall I am really impressed.

I did hit my quota limit on Claude Code but it had made it’s way through the majority of my posts. So I switched to Gemini CLI to finish off the remaining posts with this command:

Get-ChildItem content/blog/drafts/*.md -recurse | Invoke-AITool -Prompt .\prompts\refresh.md -Tool Gemini

Wrapping up

This is such a time saver, and is really easy to set up and use. Having this wrapper allows for me to build prompts in a central location and then apply them across different repositories as needed whilst also giving me the flexibility to choose different AI coding assistants as needed. Very cool, go check it out!

References

Comments

#mtfbwy