Skip to content

Commit 75cdda5

Browse files
Run Invoke-DbatoolsFormatter after AI tool execution
Added calls to Invoke-DbatoolsFormatter after AI tool execution in Invoke-AITool, Invoke-AutoFixSingleFile, and Invoke-AutoFixProcess functions. This ensures that files modified by AI tools are automatically formatted. Error handling and verbose logging were included to handle formatter failures gracefully.
1 parent 64520d5 commit 75cdda5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.aitools/aitools.psm1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,16 @@ function Invoke-AITool {
672672
FileName = (Split-Path $singlefile -Leaf)
673673
Results = "$results"
674674
}
675+
676+
# Run Invoke-DbatoolsFormatter after AI tool execution
677+
if (Test-Path $singlefile) {
678+
Write-Verbose "Running Invoke-DbatoolsFormatter on $singlefile"
679+
try {
680+
Invoke-DbatoolsFormatter -Path $singlefile
681+
} catch {
682+
Write-Warning "Invoke-DbatoolsFormatter failed for $singlefile`: $($_.Exception.Message)"
683+
}
684+
}
675685
}
676686

677687
} else {
@@ -758,6 +768,16 @@ function Invoke-AITool {
758768
}
759769

760770
Write-Verbose "Claude Code execution completed successfully"
771+
772+
# Run Invoke-DbatoolsFormatter after AI tool execution
773+
if (Test-Path $singlefile) {
774+
Write-Verbose "Running Invoke-DbatoolsFormatter on $singlefile"
775+
try {
776+
Invoke-DbatoolsFormatter -Path $singlefile
777+
} catch {
778+
Write-Warning "Invoke-DbatoolsFormatter failed for $singlefile`: $($_.Exception.Message)"
779+
}
780+
}
761781
} catch {
762782
Write-Error "Claude Code execution failed: $($_.Exception.Message)"
763783
throw
@@ -1185,6 +1205,16 @@ function Invoke-AutoFixSingleFile {
11851205
# Invoke the AI tool with the focused fix message
11861206
Invoke-AITool @fixParams
11871207

1208+
# Run Invoke-DbatoolsFormatter after AI tool execution in AutoFix
1209+
if (Test-Path $FilePath) {
1210+
Write-Verbose "Running Invoke-DbatoolsFormatter on $FilePath in AutoFix"
1211+
try {
1212+
Invoke-DbatoolsFormatter -Path $FilePath
1213+
} catch {
1214+
Write-Warning "Invoke-DbatoolsFormatter failed for $FilePath in AutoFix: $($_.Exception.Message)"
1215+
}
1216+
}
1217+
11881218
# Add explicit file sync delay to ensure disk writes complete
11891219
Start-Sleep -Milliseconds 500
11901220

@@ -1344,6 +1374,16 @@ function Invoke-AutoFixProcess {
13441374
# Invoke the AI tool with the focused fix message
13451375
Invoke-AITool @aiParams
13461376

1377+
# Run Invoke-DbatoolsFormatter after AI tool execution in AutoFix
1378+
if (Test-Path $FilePath) {
1379+
Write-Verbose "Running Invoke-DbatoolsFormatter on $FilePath in AutoFix"
1380+
try {
1381+
Invoke-DbatoolsFormatter -Path $FilePath
1382+
} catch {
1383+
Write-Warning "Invoke-DbatoolsFormatter failed for $FilePath in AutoFix: $($_.Exception.Message)"
1384+
}
1385+
}
1386+
13471387
# Add explicit file sync delay to ensure disk writes complete
13481388
Start-Sleep -Milliseconds 500
13491389

0 commit comments

Comments
 (0)