diff --git a/packaging/chocolatey/devnav.nuspec b/packaging/chocolatey/devnav.nuspec
index 9534cbc..eba259f 100644
--- a/packaging/chocolatey/devnav.nuspec
+++ b/packaging/chocolatey/devnav.nuspec
@@ -6,6 +6,7 @@
DevNav
JacobOptimiza
JacobOptimiza
+ Copyright (c) 2026 JacobOptimiza
https://github.com/JacobOptimiza/dev-nav/blob/main/LICENSE
https://github.com/JacobOptimiza/dev-nav
false
diff --git a/packaging/chocolatey/tools/chocolateyInstall.ps1 b/packaging/chocolatey/tools/chocolateyInstall.ps1
index c67bd5a..59cda82 100644
--- a/packaging/chocolatey/tools/chocolateyInstall.ps1
+++ b/packaging/chocolatey/tools/chocolateyInstall.ps1
@@ -15,7 +15,8 @@ $assets = @{
}
}
$selected = Get-DevNavAssetSet -Architecture $architecture -Assets $assets
-$packageTools = Join-Path $env:ChocolateyPackageFolder 'tools'
+$packageRoot = Get-ChocolateyPath -PathType 'PackagePath'
+$packageTools = Join-Path $packageRoot 'tools'
$moduleRoot = Join-Path $packageTools 'DevNav'
New-Item -ItemType Directory -Path $moduleRoot -Force | Out-Null
diff --git a/packaging/chocolatey/tools/chocolateyUninstall.ps1 b/packaging/chocolatey/tools/chocolateyUninstall.ps1
index 62cbe67..5dc85fd 100644
--- a/packaging/chocolatey/tools/chocolateyUninstall.ps1
+++ b/packaging/chocolatey/tools/chocolateyUninstall.ps1
@@ -1,3 +1,4 @@
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'DevNavChocolatey.ps1')
-Remove-DevNavMachineModulePath -PackageTools (Join-Path $env:ChocolateyPackageFolder 'tools')
+$packageRoot = Get-ChocolateyPath -PathType 'PackagePath'
+Remove-DevNavMachineModulePath -PackageTools (Join-Path $packageRoot 'tools')
diff --git a/tests/powershell/ChocolateyPackaging.Tests.ps1 b/tests/powershell/ChocolateyPackaging.Tests.ps1
index ab3d5b4..8fe71cf 100644
--- a/tests/powershell/ChocolateyPackaging.Tests.ps1
+++ b/tests/powershell/ChocolateyPackaging.Tests.ps1
@@ -57,6 +57,7 @@ Describe 'Chocolatey package source contract' {
$nuspec = Get-Content (Join-Path $output 'devnav.nuspec') -Raw
$install = Get-Content (Join-Path $output 'tools\chocolateyInstall.ps1') -Raw
$nuspec | Should -Match '9\.8\.7'
+ $nuspec | Should -Match 'Copyright \(c\) 2026 JacobOptimiza'
$install | Should -Match 'releases/download/v9\.8\.7/dev-windows-x86_64\.exe'
$install | Should -Match ('a' * 64)
$install | Should -Not -Match '__[A-Z0-9_]+__'
@@ -72,4 +73,37 @@ Describe 'Chocolatey package source contract' {
}
finally { Remove-Item -LiteralPath $path -Force -ErrorAction SilentlyContinue }
}
+
+ It 'uses the supported package path API and no CPMR0072 private variables' {
+ $root = Join-Path ([IO.Path]::GetTempPath()) ('devnav-choco-contract-' + [guid]::NewGuid().ToString('N'))
+ New-Item -ItemType Directory -Path $root | Out-Null
+ try {
+ $manifest = [ordered]@{
+ schemaVersion = 1
+ version = '9.8.7'
+ artifacts = [ordered]@{
+ 'binary-x64' = @{ file = 'dev-windows-x86_64.exe'; sha256 = ('a' * 64) }
+ 'binary-arm64' = @{ file = 'dev-windows-aarch64.exe'; sha256 = ('b' * 64) }
+ module = @{ file = 'DevNav.psm1'; sha256 = ('c' * 64) }
+ 'module-manifest' = @{ file = 'DevNav.psd1'; sha256 = ('d' * 64) }
+ }
+ }
+ $manifestPath = Join-Path $root 'release-manifest.json'
+ $manifest | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath $manifestPath -Encoding utf8NoBOM
+ $output = Join-Path $root 'package'
+ & $script:materializerPath -Version '9.8.7' -ReleaseManifest $manifestPath -OutputDirectory $output | Out-Null
+ $scripts = Get-ChildItem (Join-Path $output 'tools') -File -Filter '*.ps*' -Recurse |
+ ForEach-Object { Get-Content -LiteralPath $_.FullName -Raw }
+ $scripts -join "`n" | Should -Match 'Get-ChocolateyPath -PathType ''PackagePath'''
+ foreach ($variable in @(
+ 'chocolateyToolsLocation', 'chocolateyBinRoot', 'chocolatey_bin_root',
+ 'chocolateyPackageFolder', 'packageFolder', 'chocolateyChecksum32',
+ 'chocolateyChecksum64', 'chocolateyChecksumType32',
+ 'chocolateyChecksumType64', 'downloadCacheAvailable'
+ )) {
+ $scripts -join "`n" | Should -Not -Match ([regex]::Escape("`$env:$variable"))
+ }
+ }
+ finally { Remove-Item -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue }
+ }
}