From 207db6d29116e3d3015a897dbd8c127f8d318c75 Mon Sep 17 00:00:00 2001 From: Copilot Date: Sat, 16 May 2026 14:33:42 -0700 Subject: [PATCH] fix(sync): include sync-tooling files in $script:UpstreamManagedPaths Adds Pull-SDLC.ai.ps1, Pull-SDLC.ai.Tests.ps1, Cleanup-Worktree.ps1, and sync-manifest.json to the upstream-managed path list so the diff-replay sync picks them up. Without this, the script self-updates on every run (via Invoke-SelfRefresh) but the new bytes are never committed by the sync mechanism -- consumers see a persistent `M Pull-SDLC.ai.ps1` in `git status` and must hand-craft a chore(sync) commit each time upstream advances. Same gap surfaced repeatedly in consumer repos (e.g. MarkMichaelis/CodiwomplerSocialMedia#326, #331). sync-manifest.json already listed these paths as the intended managed set; this brings the hardcoded constant in line with the manifest. A full refactor to read sync-manifest.json at runtime (single source of truth) is left for a follow-up. Tests (Pester): - New `Describe 'Test-IsUpstreamManagedPath'` block asserts the four added paths return $true, that always-local README.md still trumps managed, and that unrelated repo files return $false. - Existing 66 tests continue to pass. Closes #112 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Pull-SDLC.ai.Tests.ps1 | 30 ++++++++++++++++++++++++++++++ Pull-SDLC.ai.ps1 | 6 +++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Pull-SDLC.ai.Tests.ps1 b/Pull-SDLC.ai.Tests.ps1 index feca55f..3bf8c62 100644 --- a/Pull-SDLC.ai.Tests.ps1 +++ b/Pull-SDLC.ai.Tests.ps1 @@ -64,6 +64,36 @@ Describe 'Resolve-AlwaysLocalConflicts (removed)' { } } +Describe 'Test-IsUpstreamManagedPath -- self-managing sync tooling (#112)' { + It 'returns $true for Pull-SDLC.ai.ps1' { + Test-IsUpstreamManagedPath -Path 'Pull-SDLC.ai.ps1' | Should -BeTrue + } + + It 'returns $true for Pull-SDLC.ai.Tests.ps1' { + Test-IsUpstreamManagedPath -Path 'Pull-SDLC.ai.Tests.ps1' | Should -BeTrue + } + + It 'returns $true for Cleanup-Worktree.ps1' { + Test-IsUpstreamManagedPath -Path 'Cleanup-Worktree.ps1' | Should -BeTrue + } + + It 'returns $true for sync-manifest.json' { + Test-IsUpstreamManagedPath -Path 'sync-manifest.json' | Should -BeTrue + } + + It 'returns $true for CLAUDE.md (existing baseline preserved)' { + Test-IsUpstreamManagedPath -Path 'CLAUDE.md' | Should -BeTrue + } + + It 'still returns $false for always-local README.md (always-local trumps managed)' { + Test-IsUpstreamManagedPath -Path 'README.md' | Should -BeFalse + } + + It 'returns $false for an unrelated repo file' { + Test-IsUpstreamManagedPath -Path 'src/Foo.cs' | Should -BeFalse + } +} + Describe 'Invoke-TemplateScaffold' { BeforeEach { $script:src = Join-Path $TestDrive 'src' diff --git a/Pull-SDLC.ai.ps1 b/Pull-SDLC.ai.ps1 index 5a04345..3a90977 100644 --- a/Pull-SDLC.ai.ps1 +++ b/Pull-SDLC.ai.ps1 @@ -92,7 +92,11 @@ $script:UpstreamManagedPaths = @( '.github/copilot-instructions.md', '.github/agents/', '.github/skills/', - '.github/instructions/' + '.github/instructions/', + 'Pull-SDLC.ai.ps1', + 'Pull-SDLC.ai.Tests.ps1', + 'Cleanup-Worktree.ps1', + 'sync-manifest.json' ) # Paths that are inherently consumer-owned. Always-local trumps managed-paths