Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions Pull-SDLC.ai.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2713,8 +2713,43 @@ Describe 'Output stream assignment (issue #194)' {
# Must be a genuine Write-Information record, NOT Write-Host (which tags PSHOST).
$commitRec.Tags | Should -Not -Contain 'PSHOST'

$appliedRec = $streamInfo | Where-Object { "$($_.MessageData)" -match 'Applied 2 ops' } | Select-Object -First 1
$appliedRec | Should -Not -BeNullOrEmpty
$appliedRec.Tags | Should -Not -Contain 'PSHOST'
}
$appliedRec = $streamInfo | Where-Object { "$($_.MessageData)" -match 'Applied 2 ops' } | Select-Object -First 1
$appliedRec | Should -Not -BeNullOrEmpty
$appliedRec.Tags | Should -Not -Contain 'PSHOST'
}

# --- Regression #196: blank-line separators dropped by the stream refactor ---

It 'emits a blank-line separator immediately before the -WhatIf footer' {
$fx = New-DiffReplayFixture -Root $script:streamRoot `
-Seed { New-Item -ItemType Directory -Path .github/agents -Force | Out-Null; 'one' | Out-File -Encoding utf8 .github/agents/a.md -NoNewline } `
-Tweak { 'TWO' | Out-File -Encoding utf8 .github/agents/a.md -NoNewline }
Set-SdlcSyncState -RepoRoot $fx.Consumer -Remote 'sdlc.ai' -Ref 'main' -Commit $fx.AnchorSha
Push-Location $fx.Consumer
try { git add .sdlc-ai-sync.json; git commit -q -m 'seed state' } finally { Pop-Location }

$rc = Invoke-PullSDLC -RepoRoot $fx.Consumer -RemoteName 'sdlc.ai' -NoFetch -WhatIf -InformationVariable streamInfo 6>$null
$rc | Should -Be 0

$msgs = @($streamInfo | ForEach-Object { "$($_.MessageData)" })
$idx = [array]::IndexOf($msgs, '-WhatIf specified; no changes written.')
$idx | Should -BeGreaterThan 0
$msgs[$idx - 1] | Should -Be ''
}

It 'emits a blank-line separator immediately before the up-to-date footer' {
$fx = New-DiffReplayFixture -Root $script:streamRoot `
-Seed { 'same' | Out-File -Encoding utf8 CLAUDE.md -NoNewline }
Set-SdlcSyncState -RepoRoot $fx.Consumer -Remote 'sdlc.ai' -Ref 'main' -Commit $fx.UpstreamHead
Push-Location $fx.Consumer
try { git add .sdlc-ai-sync.json; git commit -q -m 'seed state' } finally { Pop-Location }

$rc = Invoke-PullSDLC -RepoRoot $fx.Consumer -RemoteName 'sdlc.ai' -NoFetch -InformationVariable streamInfo 6>$null
$rc | Should -Be 0

$msgs = @($streamInfo | ForEach-Object { "$($_.MessageData)" })
$idx = [array]::IndexOf($msgs, 'Already up to date.')
$idx | Should -BeGreaterThan 0
$msgs[$idx - 1] | Should -Be ''
}
}
2 changes: 2 additions & 0 deletions Pull-SDLC.ai.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2107,11 +2107,13 @@ function Invoke-PullSDLC {
Write-PlannedOpsPreview -Ops $ops -AnchorLabel $anchorLabel -UpstreamLabel $upstreamLabel

if ($WhatIfPreference) {
Write-Information ''
Write-Information '-WhatIf specified; no changes written.'
return 0
}

if ($ops.Count -eq 0) {
Write-Information ''
Write-Information 'Already up to date.'
}
else {
Expand Down
Loading