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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[`README.md`](README.md) and [`AGENTS.md`](AGENTS.md) follow. The *Folder Structure* section now shows the deployed tree and the package layout side by side instead of conflating them, and the *Agent plugin* install path was rewritten: it previously told the reader that "the plugin format does not carry `.instructions.md` files or hooks, so this path gives you agents and skills only", which the migration makes false in the one direction that matters — hooks are exactly the guardrails a plugin-only user was silently missing. It now also names the two things worth knowing before choosing that path: bundled hooks execute locally and should be reviewed, and `rules`/`commands` registration is unconfirmed.

### Fixed

- **`Install-CopilotAtelier -WhatIf` no longer throws** (2026-08-27). A dry run aborted with a terminating `ItemNotFoundException` from `Get-ChildItem: 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 (the `New-Item`/`Copy-Item` calls that build it honour `ShouldProcess` and are skipped), so the enumeration hit a path that did not exist. The sweep now runs only when the target is present, which matches how the rest of the function already guards optional paths with `Test-Path`. Covered by a regression test that asserts `-WhatIf` neither throws nor creates the canonical target.

## [4.0.0] - 2026-08-26

### Added
Expand Down
12 changes: 10 additions & 2 deletions source/Public/Install-CopilotAtelier.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,17 @@ function Install-CopilotAtelier
#>
$legacyDirectoryName = @('Agents', 'Instructions', 'Skills', 'Prompts', 'Hooks', 'Keybindings')

<#
The target tree only exists after the loop above created it. Under
-WhatIf that creation is skipped, so guard the enumeration against a
missing path instead of letting Get-ChildItem throw a terminating error.
#>
$staleDirectory = @(
Get-ChildItem -LiteralPath $path.TargetPath -Directory |
Where-Object -FilterScript { $_.Name -cin $legacyDirectoryName }
if (Test-Path -LiteralPath $path.TargetPath)
{
Get-ChildItem -LiteralPath $path.TargetPath -Directory |
Where-Object -FilterScript { $_.Name -cin $legacyDirectoryName }
}
)

foreach ($directory in $staleDirectory)
Expand Down
27 changes: 27 additions & 0 deletions tests/Unit/Public/Install-CopilotAtelier.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,31 @@ Describe 'Install-CopilotAtelier' -Tag 'Unit' {
Should -Throw -ExpectedMessage "*No customization directory found*"
}
}

Context 'When previewing with -WhatIf' {
It 'Should not throw and should not create the canonical target' {
$whatIfContentPath = Join-Path -Path $TestDrive -ChildPath 'whatif-content'
$whatIfHomePath = Join-Path -Path $TestDrive -ChildPath 'whatif-home'
$whatIfConfigPath = Join-Path -Path $TestDrive -ChildPath 'whatif-config'

Initialize-CustomizationContent -Path $whatIfContentPath

$original = Enter-Sandbox -HomePath $whatIfHomePath -ConfigPath $whatIfConfigPath

try
{
{ Install-CopilotAtelier -ContentPath $whatIfContentPath -SkipCopilotCliEnvironment -WhatIf } |
Should -Not -Throw
}
finally
{
Exit-Sandbox -Original $original
}

# A dry run must not touch the file system.
$targetPath = Join-Path -Path $whatIfHomePath -ChildPath 'CopilotAtelier'

Test-Path -LiteralPath $targetPath | Should -BeFalse
}
}
}
Loading