[1.0.0-alpha1] Upgrade to psake 5.0.0 with task caching and LLM output#117
[1.0.0-alpha1] Upgrade to psake 5.0.0 with task caching and LLM output#117HeyItsGilbert wants to merge 3 commits intomainfrom
Conversation
Breaking changes: - Minimum PowerShell raised from 3.0 to 5.1 - psake dependency raised from 4.9.0 to 5.0.0 - Invoke-psake now returns PsakeBuildResult (replaces $psake.build_success) New features: - Content-addressed task caching via Inputs/Outputs on cacheable tasks (StageFiles, Analyze, Pester, GenerateMarkdown, GenerateMAML, GenerateUpdatableHelp) - LLM-optimized test output mode ($PSBPreference.Test.OutputMode = 'LLM') emits structured JSON with only failure details - External PesterConfiguration file support via $PSBPreference.Test.PesterConfigurationPath - Direct PesterConfiguration object passthrough via -Configuration parameter - Format-PSBuildResult function for Human/JSON/GitHubActions build result formatting - All psakeFile.ps1 tasks rewritten to declarative hashtable syntax - Invoke-Build IB.tasks.ps1 updated with matching Inputs/Outputs caching - Windows PowerShell 5.1 CI matrix entry added Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated the GitHub Actions workflow to specify 'main' branch for push events, enabled fail-fast strategy, and added a separate job for testing with PowerShell on Windows. Signed-off-by: Gilbert Sanchez <me@gilbertsanchez.com>
Signed-off-by: Gilbert Sanchez <me@gilbertsanchez.com>
| name: Test | ||
| runs-on: windows-latest | ||
| strategy: | ||
| fail-fast: true | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Test | ||
| shell: powershell | ||
| env: | ||
| DEBUG: ${{ runner.debug == '1' }} | ||
| run: | | ||
| if($env:DEBUG -eq 'true' -or $env:DEBUG -eq '1') { | ||
| $DebugPreference = 'Continue' | ||
| } | ||
| ./build.ps1 -Task Test -Bootstrap |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
To fix the problem, explicitly declare the GITHUB_TOKEN permissions in the workflow using the permissions key, granting only the minimal scopes required. Since these jobs just check out code and run tests/build via build.ps1 and do not interact with issues, pull requests, or modify repository contents, they can typically operate with contents: read only.
The best way to fix this without changing existing functionality is to add a top-level permissions block to .github/workflows/test.yml (so it applies to all jobs) with contents: read. This documents the workflow’s intent and ensures least-privilege defaults if org or repo settings change later. Concretely, insert:
permissions:
contents: readbetween the on: block and the jobs: block (i.e., after line 6 and before line 7). No additional imports or methods are needed, as this is purely a YAML configuration change within the workflow file.
| @@ -4,6 +4,8 @@ | ||
| branches: [ main ] | ||
| pull_request: | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| test: | ||
| name: Test |
Summary
PsakeBuildResultoutputOutputModesetting (Detailed/Minimal/LLM) whereLLMmode emits structured JSON with only failure details, suppressing verbose console noise$PSBPreference.Test.PesterConfigurationPathloads a.psd1as the base config with explicit overrides layered on topStageFiles,Analyze,Pester,GenerateMarkdown,GenerateMAML,GenerateUpdatableHelpall declareInputs/Outputsfor incremental build skippingFormat-PSBuildResult— new public function formattingPsakeBuildResultfor Human, JSON, or GitHubActions consumersIB.tasks.ps1updated with matchingInputs/Outputscaching and new Pester parameter passthroughBreaking Changes
./build.ps1 -Bootstrapwill installInvoke-psakereturnsPsakeBuildResultobject$psake.build_successwith$result.SuccessNew
$PSBPreferenceKeysBuild.EnableTaskCaching$trueTest.OutputMode'Detailed'Detailed/Minimal/LLMoutput modesTest.PesterConfigurationPath$null.psd1PesterConfigurationFiles Changed (20)
New files (5):
ConvertTo-PSBuildLLMOutput.ps1,Format-PSBuildResult.ps1,LLMOutput.tests.ps1,PesterConfig.tests.ps1,FormatBuildResult.tests.ps1Major rewrites (1):
PowerShellBuild/psakeFile.ps1— all 16 tasks converted to declarative hashtable syntax withInputs/OutputscachingModified (14): manifest, requirements, build.ps1, root psakeFile, build.properties, Test-PSBuildPester, IB.tasks, Messages.psd1, PowerShellBuild.psm1, CI workflow, CHANGELOG, CLAUDE.md, Manifest.tests, TestModule psakeFile
Known Risks
PreConditionin declarative syntax — psake 5.0.0's hashtableTasksyntax support forPreConditionkey is inferred from the commit, not confirmed by docs. If it fails, mitigation is to move precondition logic into guard clauses at the top ofActionscriptblocks.$psake.context.Peek().Tasks.Keys— used by the?task; may need updating if psake 5.0.0 changes this internal API.Test plan
./build.ps1 -Bootstrapinstalls psake 5.0.0 successfully./build.ps1 -Task Buildcompiles with declarative task syntax./build.ps1 -Task Testpasses all existing + new tests./build.ps1 -Task Buildskips cached tasksPesterConfigurationPathloads external configFormat-PSBuildResult -Format JSONproduces valid structured output🤖 Generated with Claude Code