fix(scripts): include CIHelpers module + packaging script testability#420
Conversation
- add CIHelpers.psm1 to .vscodeignore whitelist - add copy logic for CIHelpers.psm1 in Package-Extension.ps1 📦 - Generated by Copilot
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #420 +/- ##
==========================================
+ Coverage 75.15% 75.41% +0.26%
==========================================
Files 20 20
Lines 3481 3527 +46
==========================================
+ Hits 2616 2660 +44
- Misses 865 867 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where the VS Code extension package was missing the CIHelpers.psm1 module required by Generate-PrReference.ps1, causing the script to fail when run from the installed extension. The fix ensures the module is included in the extension package and addresses a PowerShell command execution issue with npx.
Changes:
- Added
CIHelpers.psm1to extension package via.vscodeignorewhitelist and copy logic inPackage-Extension.ps1 - Fixed npx execution to use
cmd /cwrapper to bypass PowerShell's argument parsing issues - Added
--yesflag to npx to suppress interactive prompts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
extension/.vscodeignore |
Added whitelist entry for scripts/lib/Modules/CIHelpers.psm1 to include the module in the vsce package |
scripts/extension/Package-Extension.ps1 |
Added copy logic for CIHelpers module, added --yes flag to npx arguments, and wrapped npx calls with cmd /c to prevent PowerShell argument parsing issues |
- add Test-PackagingInputsValid, Get-PackagingDirectorySpec pure functions - add Invoke-VsceCommand, Remove-PackagingArtifacts, Restore-PackageJsonVersion I/O functions - simplify Invoke-PackageExtension orchestration using extracted functions - update test fixtures to include CIHelpers module mock 🔧 - Generated by Copilot
- add 28 tests for 5 extracted functions (Test-PackagingInputsValid, Get-PackagingDirectorySpec, Invoke-VsceCommand, Remove-PackagingArtifacts, Restore-PackageJsonVersion) - fix Restore-PackageJsonVersion null coercion handling with IsNullOrEmpty - remove unused Required field from directory specs - add inline comment for npx --yes flag 🧪 - Generated by Copilot
…ec tests 🐛 - Generated by Copilot
…pec tests - Replace complex Contains+Where+First pattern with direct Should -Match - No behavior change, improves test maintainability 🧹 - Generated by Copilot
katriendg
left a comment
There was a problem hiding this comment.
This is great, thanks for the extensive implementation.
| & cmd @cmdArgs | ||
| } else { | ||
| & $Executable @Arguments |
There was a problem hiding this comment.
The Invoke-VsceCommand function outputs both command stdout/stderr and a return hashtable to the pipeline. When assigned to a variable at line 756, $vsceResult could become an array containing text output plus the hashtable, causing line 762's property access ($vsceResult.Success) to fail.
Consider suppressing command output by redirecting to $null or using Out-Null within the function, or explicitly filtering the return value. The test at line 647-655 shows awareness of this by filtering for hashtable type, but the production code at line 756-762 doesn't apply the same filtering.
| & cmd @cmdArgs | |
| } else { | |
| & $Executable @Arguments | |
| & cmd @cmdArgs *> $null | |
| } else { | |
| & $Executable @Arguments *> $null |
🤖 I have created a release *beep* *boop* --- ## [2.2.0](hve-core-v2.1.0...hve-core-v2.2.0) (2026-02-06) ### ✨ Features * add incident response prompt template ([#386](#386)) ([0adb35c](0adb35c)) * add Skills and VS Code Extension categories to issue/PR templates ([#410](#410)) ([108e160](108e160)) * **hve-core-guidance-instructions:** update guidance artifacts and MCP config ([#402](#402)) ([25b34de](25b34de)) * **security:** add action version consistency validation ([#423](#423)) ([f3bb787](f3bb787)) * **workflows:** add copyright header validation CI workflow ([#429](#429)) ([c53de22](c53de22)) ### 🐛 Bug Fixes * **docs:** add missing Copilot footers, consolidate validation exclusions ([#419](#419)) ([e40f960](e40f960)) * **scripts:** include CIHelpers module + packaging script testability ([#420](#420)) ([da26edf](da26edf)) ### ♻️ Refactoring * migrate inline CI code to CIHelpers module ([#393](#393)) ([adf6a5f](adf6a5f)) ### 🔧 Maintenance * **templates:** align issue templates with conventional commit format ([#427](#427)) ([2d28702](2d28702)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: hve-core-release-please[bot] <254602402+hve-core-release-please[bot]@users.noreply.github.com>
Pull Request
Description
Add
CIHelpers.psm1to the VS Code extension package soGenerate-PrReference.ps1can resolve its module import when run from the installed extension. The script requires this module for Git operations and fails when the module is missing from the package.Initial Bug Fix:
!scripts/lib/Modules/CIHelpers.psm1to.vscodeignorePackage-Extension.ps1to include the module during staging@in@vscode/vsceas splatting operator by wrapping npx calls withcmd /cScope Expansion: Packaging Script Testability
During code review, Copilot identified that the CIHelpers validation could fail silently. Investigation revealed broader testability issues with
Invoke-PackageExtension:Refactoring Changes:
Research document:
.copilot-tracking/research/package-extension-testability.mdRelated Issue(s)
Fixes #400
Type of Change
Select all that apply:
Code & Documentation:
Infrastructure & Configuration:
AI Artifacts:
prompt-builderagent and addressed all feedback.github/instructions/*.instructions.md).github/prompts/*.prompt.md).github/agents/*.agent.md).github/skills/*/SKILL.md)Other:
.ps1,.sh,.py)Testing
hve-core-2.1.0.vsix, 227.14 KB)Checklist
Required Checks
Required Automated Checks
The following validation commands must pass before merging:
npm run lint:mdnpm run spell-checknpm run lint:frontmatternpm run lint:md-linksnpm run lint:psSecurity Considerations
Additional Notes
Root cause of vsce execution fix: PowerShell interprets
@at the start of arguments as splatting syntax. Whennpx @vscode/vscewas invoked via& $executable $args, PowerShell tried to expand@vscodeas a variable. The fix usescmd /cto pass arguments through Windows command processor, bypassing PowerShell's parsing.Testability refactoring rationale: The monolithic
Invoke-PackageExtensionfunction has 13 distinct responsibilities and cyclomatic complexity 18-22, making comprehensive testing difficult. Extracting pure functions for validation and specifications enables unit testing without filesystem mocking.