Skip to content

Commit

Permalink
new parmz
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Oct 20, 2024
1 parent 39dd235 commit b2de519
Showing 1 changed file with 74 additions and 2 deletions.
76 changes: 74 additions & 2 deletions .aider/prompts/fix-parms.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ foreach ($test in $tests) {
Write-Host "Processing $test"
aider --message "$prompt" --file $test.FullName --model azure/gpt-4o-mini --no-stream
}
#>
----------------
$tests = Get-ChildItem -Path /workspace/tests -Filter *.Tests.ps1
Expand All @@ -40,4 +42,74 @@ foreach ($test in $tests) {
continue
}
aider --message "$prompt" --file $test.FullName --model azure/gpt-4o-mini --no-stream
}
}
#>

param (
[int]$First = 1000,
[int]$Skip = 0
)
# Full prompt path
if (-not (Get-Module dbatools.library -ListAvailable)) {
Write-Warning "dbatools.library not found, installing"
Install-Module dbatools.library -Scope CurrentUser -Force
}
Import-Module /workspace/dbatools.psm1

$promptTemplate = '
Required parameters for this command:
--PARMZ--
AND HaveParameter tests must be structured exactly like this:
$params = @(
"parameter1",
"parameter2",
"etc"
)
It "has the required parameter: <_>" -ForEach $params {
$CommandUnderTest | Should -HaveParameter $PSItem
}
NO OTHER CHANGES SHOULD BE MADE TO THE TEST FILE'

$commands = Get-Command -Module dbatools -Type Function, Cmdlet | Select-Object -First $First -Skip $Skip
$commonParameters = [System.Management.Automation.PSCmdlet]::CommonParameters

foreach ($command in $commands) {
$cmdName = $command.Name
$filename = "/workspace/tests/$cmdName.Tests.ps1"

if (-not (Test-Path $filename)) {
Write-Warning "No tests found for $cmdName"
Write-Warning "$filename not found"
continue
}

$parameters = $command.Parameters.Values | Where-Object Name -notin $commonParameters

$parameters = $parameters.Name -join ", "
$cmdPrompt = $promptTemplate -replace "--PARMZ--", $parameters

# Run Aider in non-interactive mode with auto-confirmation
aider --message "$cmdPrompt" --file $filename --yes-always --no-stream --model azure/gpt-4o-mini
}
# <_>
# It "has the required parameter: <$_>" -ForEach $params { # 2
# It "has the required parameter: $_" # 25
# It "has all the required parameters" -ForEach $requiredParameters {
# Copy-DbaDbViewData.Tests.ps1: $params | ForEach-Object {
# It "has the required parameter: SqlInstance" -ForEach $params { 7
# It "has the required parameter: $_" -ForEach $params {
# It "has the required parameter: $_" -ForEach $params {
# It "has the required parameter: SqlInstance" -ForEach $params {
# It "has the required parameter: $_" -ForEach $params {
# It "has the required parameter: $_" -ForEach $params {
# It "has the required parameter: $_" -ForEach $params {

<#
BeforeDiscovery {
[object[]]$params = (Get-Command Copy-DbaDatabase).Parameters.Keys | Where-Object { $_ -notin ('whatif', 'confirm') }
}
#>

0 comments on commit b2de519

Please sign in to comment.