Skip to content

fix(install): guard directory enumeration so -WhatIf no longer throws - #24

Merged
raandree merged 1 commit into
raandree:mainfrom
sosterwinter:fix/whatif-itemnotfound
Aug 27, 2026
Merged

raandree merged 1 commit into
raandree:mainfrom
sosterwinter:fix/whatif-itemnotfound

Conversation

@sosterwinter

Copy link
Copy Markdown
Contributor

Summary

Install-CopilotAtelier -WhatIf aborted with a terminating
ItemNotFoundException ("Cannot find path '...\CopilotAtelier' because it does
not exist"). The legacy-directory sweep enumerated the canonical target
unconditionally, but under -WhatIf the target tree is never created
(New-Item/Copy-Item honour ShouldProcess and are skipped), so the
enumeration hit a path that did not exist.

Fix

Run the sweep only when the target exists, matching how the rest of the function
already guards optional paths with Test-Path.

Tests

Added a regression test asserting -WhatIf neither throws nor creates the
canonical target. Full Install-CopilotAtelier suite: 26 passed, 0 failed.

Fixes #23

@raandree
raandree merged commit de4b251 into raandree:main Aug 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Install-CopilotAtelier -WhatIf throws ItemNotFoundException and violates the -WhatIf contract

2 participants