Description
Running npm run lint:ps (or npm run lint:all) in a fresh devcontainer or clone fails with:
Write-Error: PSScriptAnalyzer failed: Could not find a part of the path '/workspaces/hve-core/logs/psscriptanalyzer-results.json'.
Root Cause
Invoke-PSScriptAnalyzer.ps1 writes results to logs/psscriptanalyzer-results.json and logs/psscriptanalyzer-summary.json, but never ensures the logs/ directory exists before writing. The logs/ directory is gitignored, so it is not present after a fresh clone or codespace creation.
Neither the devcontainer lifecycle scripts (on-create.sh, post-create.sh) nor the linting script itself create the directory.
Reproduction
- Open hve-core in a fresh codespace or devcontainer
- Run
npm run lint:ps
- Observe the path error
Suggested Fix
Either:
- In
Invoke-PSScriptAnalyzer.ps1: Add New-Item -ItemType Directory -Force -Path (Split-Path $OutputPath) before writing results (defensive, self-contained fix).
- In
post-create.sh: Add mkdir -p logs so the directory exists after container setup.
- Both: Apply option 1 for robustness and option 2 for consistency.
Workaround
Affected Scripts
Environment
- DevContainer on Ubuntu 24.04
- PowerShell 7.5.4
- Node.js 24.x
Description
Running
npm run lint:ps(ornpm run lint:all) in a fresh devcontainer or clone fails with:Root Cause
Invoke-PSScriptAnalyzer.ps1writes results tologs/psscriptanalyzer-results.jsonandlogs/psscriptanalyzer-summary.json, but never ensures thelogs/directory exists before writing. Thelogs/directory is gitignored, so it is not present after a fresh clone or codespace creation.Neither the devcontainer lifecycle scripts (
on-create.sh,post-create.sh) nor the linting script itself create the directory.Reproduction
npm run lint:psSuggested Fix
Either:
Invoke-PSScriptAnalyzer.ps1: AddNew-Item -ItemType Directory -Force -Path (Split-Path $OutputPath)before writing results (defensive, self-contained fix).post-create.sh: Addmkdir -p logsso the directory exists after container setup.Workaround
Affected Scripts
scripts/linting/Invoke-PSScriptAnalyzer.ps1(lines 123-124)Environment