Skip to content

Support PleaseWork Task Arguments - #49

Merged
RiverHeart merged 8 commits into
mainfrom
YetMorePleaseWork
Aug 31, 2026
Merged

Support PleaseWork Task Arguments#49
RiverHeart merged 8 commits into
mainfrom
YetMorePleaseWork

Conversation

@RiverHeart

@RiverHeart RiverHeart commented Aug 16, 2026

Copy link
Copy Markdown
Owner

For the record, it was my idea to use Resolve-ParamBlock to populate dynamicparam with the runtime parameters from the scriptblock so while I may have had copilot do the implementation, not gonna let anyone say I didn't contribute to this. Personally, I think it was a rather clever idea even if I'm not clever enough to take it across the finish line myself :/

TODO: There seems to be an issue running lint/test tasks within VSCode. Unclear why but can't merge this just yet.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the PleaseWork PowerShell task runner to support passing task-specific named arguments by exposing each task’s param() block as dynamic parameters on Invoke-PleaseWork (aka please). It also refactors argument completion into a dedicated exported function and improves failure-output capture during task execution.

Changes:

  • Add dynamic parameter binding from TaskFile task param() blocks (including aliases/validation) and forward bound args only to the requested task.
  • Introduce Complete-PleaseWorkTask as the argument completer implementation (and export it).
  • Update execution/output behavior and docs (e.g., $ChangedFiles now absolute; output before failure is preserved).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/modules/PleaseWork/Tests/Public/Invoke-PleaseWork.tests.ps1 Adds coverage for task param binding and completion; updates expectations for output + $ChangedFiles shape.
src/modules/PleaseWork/Tests/Private/PleaseWork.Module.tests.ps1 Updates export expectations to include Complete-PleaseWorkTask.
src/modules/PleaseWork/Tests/Private/Invoke-PleaseWorkTask.tests.ps1 Adds coverage for isolated named-argument binding in task module scope.
src/modules/PleaseWork/taskfile.ps1 Adjusts module tasks: adds dependency ordering, changes lint behavior, adds install task.
src/modules/PleaseWork/src/Public/Invoke-PleaseWork.ps1 Implements dynamic task parameters and forwards bound task args only to the requested task.
src/modules/PleaseWork/src/Public/Complete-PleaseWorkTask.ps1 New exported completer function for task name completion (including native help).
src/modules/PleaseWork/src/Private/Resolve-ParamBlock.ps1 Rebuilds attributes from AST constants to support alias/validation metadata in dynamic parameters.
src/modules/PleaseWork/src/Private/Invoke-PleaseWorkTask.ps1 Changes invocation wrapper to preserve output before failure and support named splatting.
src/modules/PleaseWork/src/Private/Get-TaskDeclaration.ps1 Captures task ParameterAsts for dynamic param generation without executing the TaskFile.
src/modules/PleaseWork/README.md Documents task parameter support and clarifies $ChangedFiles/$LASTEXITCODE behavior.
src/modules/PleaseWork/PleaseWork.psd1 Updates exported functions list (adds Complete-PleaseWorkTask).
src/modules/GrabBag/Public/Resolve-ParamBlock.ps1 Adds namespace imports (supporting updated typing/style).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +49 to +55
$TaskFilePath = Resolve-TaskFilePath -Path $BoundTaskFile
$TaskDeclarations = @(Get-TaskFileDeclaration -Path $TaskFilePath)
$SelectedTaskName = if ([string]::IsNullOrEmpty($BoundTaskName)) {
$TaskDeclarations[0].Name
} else {
$BoundTaskName
}
Comment on lines 24 to +29
[Parameter()]
[ValidateNotNullOrEmpty()]
[string] $TaskFile,

[Parameter(ParameterSetName='Run')]
[switch] $PassThru,

[Parameter(ParameterSetName='Run',ValueFromRemainingArguments)]
[object[]] $RemainingArguments
[switch] $PassThru
@RiverHeart
RiverHeart merged commit d1855f6 into main Aug 31, 2026
1 check passed
@RiverHeart
RiverHeart deleted the YetMorePleaseWork branch August 31, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants