Skip to content

Add Get-Help help to every public function - #16

Merged
HalRiveria merged 11 commits into
mainfrom
docs/comment-based-help
Oct 28, 2026
Merged

HalRiveria merged 11 commits into
mainfrom
docs/comment-based-help

Conversation

@HalRiveria-Bot

Copy link
Copy Markdown
Collaborator

What was wrong. Each public function was documented only in plain comments at the top of its definition, so Get-Help showed just its syntax. The README told people to read the file instead.

What changed. All 21 public functions now have comment-based help:

  • a synopsis and description;
  • every parameter, with its default;
  • what it returns;
  • examples for the main entry points.

It's written as # .SYNOPSIS-style line comments, matching the file's existing comment style. Notes meant for maintainers stay as plain comments after the help block. The README now points to Get-Help <function> -Full.

The set of public functions is the 21 the README documents. Internal helpers (Invoke-PkProcessDispatchCore, Resolve-PkEncoding and so on) are left without help.

Testing. A new harness assertion checks that every public function has a real synopsis and a description for each of its parameters, via Get-Help. It caught one block the help parser rejected outright: a line starting with .NET reads as an unknown help keyword. 218 assertions pass on Windows PowerShell 5.1 and PowerShell 7.6. It merges cleanly with #13 and #15.

🤖 Generated with Claude Code

HalRiveria and others added 2 commits October 28, 2026 05:16
Invoke-PkProcessWithTimeout (overrun or abort) and the dispatcher's
force-stop after an abort called Process.Kill(), which ends only the
program itself. Anything it started kept running, holding its output
open, until the script exited. They now use Stop-PkProcessTree, like
the batch timeout already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each public function's comment block was plain comments, so Get-Help
showed only its syntax and the README said to read the file instead.
All 21 public functions now have comment-based help: a synopsis,
description, every parameter with its default, what it returns, and an
example for the main ones. Notes meant for maintainers stay as plain
comments after the help.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HalRiveria and others added 2 commits October 28, 2026 06:10
When a script dot-sourced the kit and was run from a prompt
(.\script.ps1 or & script), the kit's functions existed only in that
script's scope. A .GetNewClosure() block can only see global functions,
so Invoke-PkProcessBatch - whose internal callbacks are closures -
failed every command ("Start-PkProcess is not recognized"), and so did
any caller closure that called a kit function. Under powershell -File it
worked, which is how every test ran, so this went unnoticed since v1.0.

The kit now also defines each of its functions globally when loaded.
README: notes the global functions, and that a closure can't call the
script's own functions when run from a prompt unless they're global.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HalRiveria and others added 7 commits October 28, 2026 12:25
The export walked every function in the file the kit's code sits in, so
a script that pasted the kit in had its own functions made global, and
one defined after the kit caused a 'Cannot find path' error at load
(fatal under strict mode). The loop also ran in the caller's scope,
overwriting and removing two of its variables. It now only exports
Pk-named functions and Initialize-ParallelKit, from a child scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The force-stop after an abort ran taskkill once per job, waiting for each
before the next, which added seconds with many programs still running.
Stop-PkProcessTree now takes several processes and kills all their trees
in one taskkill call; the dispatcher's force-stop and teardown paths use
that through Stop-PkJobProcesses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cessTree

Brings in the process-tree kill changes and the global functions so the
help describes the behaviour they add: Stop-PkProcessTree takes several
programs, and Invoke-PkProcessWithTimeout / the dispatcher's force-stop
kill a program's children too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…artly fails

With several PIDs, taskkill exits non-zero if any one was already gone
(it exited a moment before, or was taken by another listed tree), even
though it killed the rest, so the call returned $false. It now counts
the call as having killed them if any listed process is gone afterwards.
The race itself can't be set up on demand in the harness; a new
assertion covers a parent and its child passed together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HalRiveria
HalRiveria merged commit 0bb338e into main Oct 28, 2026
2 checks passed
@HalRiveria
HalRiveria deleted the docs/comment-based-help branch October 28, 2026 16:54
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