Browse Source
rename_command accepts a new leading option '-punkargs
<list-of-definitionlists>' attaching punk::args doc blocks to the
rename's stack record - e.g documenting a subcommand the override adds,
with space-form ids such as {::package epoch}. Each element is one
definitionlist exactly as given to punk::args::define (the same shape as
a PUNKARGS variable element).
Lifecycle: docs attach only when the rename lands (aborted renames
return early) and are LIVE while the record is on the stack. The detach
hook sits at remove_rename's doomed-record site - pop_rename,
remove_renamer and restore_original all funnel through it - so every
removal path removes the docs with the record.
Works whether or not punk::args is loaded at rename time: deflists are
mirrored in a new ::commandstack::stackdocs namespace registered inert
into ::punk::args::register::NAMESPACES at module load (punk::args need
not be present - the early-boot renames precede it), so a later-loading
punk::args picks them up lazily; when punk::args is already present they
are ALSO defined immediately (a namespace already consumed into
loaded_packages never lazy-loads later appends; redefinition is
idempotent). Detach removes one mirror occurrence per deflist and
undefines via punk::args::undefine_deflist (deflist-keyed - commandstack
never parses ids; never-defined deflists skip silently). Supported
shape: one live record per doc id (same-id declarations in two records
shadow; removing either removes the doc).
The record carries the deflists under a trailing 'punkargs' key - the
append-only key-order contract is preserved (token idx 0-1, renamer idx
2-3). The leading-option parse is generalised: -renamer/-punkargs in
either order, both leading-only, non-dash word ends option scanning so
misplaced options raise the pointed error. stackdocs state follows the
0.7.1 reload contract (info-exists guarded; registration idempotent
across re-source). commandstack::help and the rename_command argdoc
document the mechanism; the In-tree users line gains punk::libunknown
(the increment-2 migration).
commandstack.test: 5 new pins (docs live with the record incl key-order
assertions, all four removal paths detach, the pre-punk::args pending
path in a bare child that loads punk::args afterwards and lazily
consumes the registered mirror, reload contract on mirror + single
registration, option positions in either order + pointed misplacement) +
2 existing G-160 message pins updated to the generalised
usage/misplacement wording (behaviour contracts unchanged). Suite 46/46.
src/tests/modules/AGENTS.md commandstack bullet updated; goal Progress
entry added. Project 0.63.0 -> 0.64.0 + CHANGELOG.
Suites: commandstack 46/46; full modules tree 1351 total / 1340 pass /
11 constraint-skipped / 0 fail (zig-built tclsh90s 9.0.5);
testbody_lint 1704 clean; goals_lint clean (80 active-index / 96
archived); make.tcl projectversion consistency OK.
Claude-Session: https://claude.ai/code/session_01QgaxV27VZkmEec7oNbEVFc
Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.com
master
7 changed files with 336 additions and 21 deletions
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue