From ed23941b0358ca7b83bba4176355425bfdf60868 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Sat, 1 Aug 2026 23:42:00 +1000 Subject: [PATCH] Build outputs: thin-layout make.tcl sync (help dry-run refinement) Assisted-by: harness=claude; primary-model=claude-opus-5[1m]; api-location=anthropic.com --- .../vendor/punk/project-0.1/src/make.tcl | 90 ++++++++++--------- .../vendor/punk/basic/src/make.tcl | 90 ++++++++++--------- .../vendor/punk/project-0.1/src/make.tcl | 90 ++++++++++--------- 3 files changed, 150 insertions(+), 120 deletions(-) diff --git a/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl b/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl index 4fce9524..a9aa5df2 100644 --- a/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl +++ b/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl @@ -2620,8 +2620,9 @@ proc ::punkboot::punkboot_gethelp {args} { append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n append h " $scriptname help ?subcommand? ?arg ...?" \n append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname -help);" \n - append h " extra words are the subcommand's own command line - a leading action word narrows the multi-form" \n - append h " subcommands (tool, buildsuite) to that action's usage when the tabled help is available" \n \n + append h " extra words are the subcommand's own command line, dry-run through its declaration - an accepted" \n + append h " line shows the matched action's usage (tool, buildsuite), a rejected line that subcommand's own" \n + append h " usage error (tabled help only)" \n \n append h " Flags:" \n append h " -confirm 0|1" \n append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n @@ -3240,13 +3241,15 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO " Show tabled usage for make.tcl as a whole, or for a single subcommand. After the subject, accepts that subcommand's own command line and - shows the usage most specific to it: for the multi-form subcommands - (tool, buildsuite) the leading action word narrows to that action's - single-form usage - 'make.tcl help tool build -test 0 punkzip' shows - the tool build form, as does appending -help to the command line - itself ('make.tcl tool build -test 0 punkzip -help'). Words after - the action are tolerated and ignored; an option-first line shows - the whole subcommand's usage." + dry-runs it through the subcommand's declaration: a line the + subcommand would accept shows the matched action's usage - 'make.tcl + help tool build -test 0 punkzip' shows the tool build form, as does + appending -help to the command line itself ('make.tcl tool build + -test 0 punkzip -help') - while a line it would reject shows the + same usage error the subcommand itself would produce (synopsis plus + per-form reasons, exit 1). A bare action word always renders that + action's usage, even where the real command needs more arguments + ('make.tcl help buildsuite build')." buildsuite " Surface for the defined buildsuites under src/buildsuites (zig-built @@ -3686,10 +3689,10 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO -choices {${[dict keys $SUMMARIES]}} -& -help "Subcommand to show usage for." arg -type any -optional 1 -multiple 1 -help -& - "The subject's own arguments, as they would be typed. For a - multi-form subcommand (tool, buildsuite) a leading action word - narrows to that action's single-form usage; everything after - it is tolerated and ignored." + "The subject's own arguments, as they would be typed. The line + is dry-run through the subject's declaration: an accepted line + shows the matched action's usage (tool, buildsuite), a rejected + line shows the subject's own usage error." } #top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help' variable SUBGROUPS { @@ -3711,12 +3714,12 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO General usage: make.tcl ?flags? 'make.tcl help ?arg ...?' or 'make.tcl - ?arg ...? -help' shows a subcommand's own usage - the words are the - subcommand's own command line, and for the multi-form - tool/buildsuite subcommands a leading action word narrows to that - action's usage. Interactive y/n confirmations can be driven - non-interactively with the -confirm flag declared on the relevant - subcommands.} + ?arg ...? -help' shows a subcommand's own usage - the words are + dry-run through the subcommand's declaration, so an accepted + command line shows the matched action's usage (tool, buildsuite) + and a rejected one shows that subcommand's own usage error. + Interactive y/n confirmations can be driven non-interactively + with the -confirm flag declared on the relevant subcommands.} punk::args::define { @id -id "(script)::punkboot" @cmd -name "make.tcl" -& @@ -3963,30 +3966,37 @@ if {$do_help} { set usage_args [list] if {[llength $help_words]} { #G-143 (refined 2026-08-01): help_words is the subject's own command line - #('make.tcl help tool build -test 0 punkzip'). For a multi-form subject - #the LEADING word selects that action's single-form usage by unambiguous - #prefix - the same literal-leader word punk::args form auto-selection - #keys on at dispatch. Words after it are the user's in-progress - #arguments: tolerated and ignored, never validated here. A flag-shaped - #leading word selects nothing (an option-first line cannot identify a - #form without option-schema knowledge) and the whole subcommand's usage - #renders. A non-flag leading word matching no action of a multi-form - #subject is a pointed punk::args usage error (exit 1) - the same - #reaction dispatch has to that command line - never a plain-help - #fallback. Single-form subjects ignore the words entirely. + #('make.tcl help tool build -test 0 punkzip') and help is a DRY-RUN of + #it: the words parse through the subject's declaration exactly as + #dispatch would parse them (punk::args form auto-selection - literal + #action leaders, choice prefixes). A line the subcommand would accept + #renders the matched form's single-form usage (whole usage for + #single-form subjects); a line it would reject gets the same pointed + #punk::args diagnosis dispatch would give - synopsis plus per-form + #reasons - on stderr with exit 1, never a plain-help fallback. Note + #punk::args' positional model: flag-like words at or after the first + #value position are consumed as values, so such lines still render + #usage cleanly (and declaration-level passthroughs - shell args, + #buildsuite driver args - parse clean by design). + #One carve-out: a BARE action word (or unambiguous prefix) asks about + #that form rather than claiming a runnable line - forms with required + #values ('buildsuite build' needs a suitename) would fail a strict + #dry-run, so a single form-matching word renders the form directly. set form_names [punk::args::forms $usage_id] - set w0 [lindex $help_words 0] - if {[llength $form_names] > 1 && ![string match -* $w0]} { - set fmatch [tcl::prefix::match -error "" $form_names $w0] - if {$fmatch eq ""} { - if {[catch {punk::args::usage -form $w0 $usage_id} usage_err]} { - puts stderr $usage_err - } else { - puts stderr "make.tcl: no action '$w0' for '$help_subject' (actions: $form_names)" - } + set fmatch "" + if {[llength $help_words] == 1 && [llength $form_names] > 1} { + set fmatch [tcl::prefix::match -error "" $form_names [lindex $help_words 0]] + } + if {$fmatch ne ""} { + lappend usage_args -form $fmatch + } else { + if {[catch {punk::args::parse $help_words -errorstyle $::punkboot::errstyle withid $usage_id} argd]} { + puts stderr $argd exit 1 } - lappend usage_args -form $fmatch + if {[llength $form_names] > 1} { + lappend usage_args -form [dict get $argd form] + } } } if {![catch {punk::args::usage {*}$usage_args $usage_id} usage_out]} { diff --git a/src/project_layouts/vendor/punk/basic/src/make.tcl b/src/project_layouts/vendor/punk/basic/src/make.tcl index 4fce9524..a9aa5df2 100644 --- a/src/project_layouts/vendor/punk/basic/src/make.tcl +++ b/src/project_layouts/vendor/punk/basic/src/make.tcl @@ -2620,8 +2620,9 @@ proc ::punkboot::punkboot_gethelp {args} { append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n append h " $scriptname help ?subcommand? ?arg ...?" \n append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname -help);" \n - append h " extra words are the subcommand's own command line - a leading action word narrows the multi-form" \n - append h " subcommands (tool, buildsuite) to that action's usage when the tabled help is available" \n \n + append h " extra words are the subcommand's own command line, dry-run through its declaration - an accepted" \n + append h " line shows the matched action's usage (tool, buildsuite), a rejected line that subcommand's own" \n + append h " usage error (tabled help only)" \n \n append h " Flags:" \n append h " -confirm 0|1" \n append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n @@ -3240,13 +3241,15 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO " Show tabled usage for make.tcl as a whole, or for a single subcommand. After the subject, accepts that subcommand's own command line and - shows the usage most specific to it: for the multi-form subcommands - (tool, buildsuite) the leading action word narrows to that action's - single-form usage - 'make.tcl help tool build -test 0 punkzip' shows - the tool build form, as does appending -help to the command line - itself ('make.tcl tool build -test 0 punkzip -help'). Words after - the action are tolerated and ignored; an option-first line shows - the whole subcommand's usage." + dry-runs it through the subcommand's declaration: a line the + subcommand would accept shows the matched action's usage - 'make.tcl + help tool build -test 0 punkzip' shows the tool build form, as does + appending -help to the command line itself ('make.tcl tool build + -test 0 punkzip -help') - while a line it would reject shows the + same usage error the subcommand itself would produce (synopsis plus + per-form reasons, exit 1). A bare action word always renders that + action's usage, even where the real command needs more arguments + ('make.tcl help buildsuite build')." buildsuite " Surface for the defined buildsuites under src/buildsuites (zig-built @@ -3686,10 +3689,10 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO -choices {${[dict keys $SUMMARIES]}} -& -help "Subcommand to show usage for." arg -type any -optional 1 -multiple 1 -help -& - "The subject's own arguments, as they would be typed. For a - multi-form subcommand (tool, buildsuite) a leading action word - narrows to that action's single-form usage; everything after - it is tolerated and ignored." + "The subject's own arguments, as they would be typed. The line + is dry-run through the subject's declaration: an accepted line + shows the matched action's usage (tool, buildsuite), a rejected + line shows the subject's own usage error." } #top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help' variable SUBGROUPS { @@ -3711,12 +3714,12 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO General usage: make.tcl ?flags? 'make.tcl help ?arg ...?' or 'make.tcl - ?arg ...? -help' shows a subcommand's own usage - the words are the - subcommand's own command line, and for the multi-form - tool/buildsuite subcommands a leading action word narrows to that - action's usage. Interactive y/n confirmations can be driven - non-interactively with the -confirm flag declared on the relevant - subcommands.} + ?arg ...? -help' shows a subcommand's own usage - the words are + dry-run through the subcommand's declaration, so an accepted + command line shows the matched action's usage (tool, buildsuite) + and a rejected one shows that subcommand's own usage error. + Interactive y/n confirmations can be driven non-interactively + with the -confirm flag declared on the relevant subcommands.} punk::args::define { @id -id "(script)::punkboot" @cmd -name "make.tcl" -& @@ -3963,30 +3966,37 @@ if {$do_help} { set usage_args [list] if {[llength $help_words]} { #G-143 (refined 2026-08-01): help_words is the subject's own command line - #('make.tcl help tool build -test 0 punkzip'). For a multi-form subject - #the LEADING word selects that action's single-form usage by unambiguous - #prefix - the same literal-leader word punk::args form auto-selection - #keys on at dispatch. Words after it are the user's in-progress - #arguments: tolerated and ignored, never validated here. A flag-shaped - #leading word selects nothing (an option-first line cannot identify a - #form without option-schema knowledge) and the whole subcommand's usage - #renders. A non-flag leading word matching no action of a multi-form - #subject is a pointed punk::args usage error (exit 1) - the same - #reaction dispatch has to that command line - never a plain-help - #fallback. Single-form subjects ignore the words entirely. + #('make.tcl help tool build -test 0 punkzip') and help is a DRY-RUN of + #it: the words parse through the subject's declaration exactly as + #dispatch would parse them (punk::args form auto-selection - literal + #action leaders, choice prefixes). A line the subcommand would accept + #renders the matched form's single-form usage (whole usage for + #single-form subjects); a line it would reject gets the same pointed + #punk::args diagnosis dispatch would give - synopsis plus per-form + #reasons - on stderr with exit 1, never a plain-help fallback. Note + #punk::args' positional model: flag-like words at or after the first + #value position are consumed as values, so such lines still render + #usage cleanly (and declaration-level passthroughs - shell args, + #buildsuite driver args - parse clean by design). + #One carve-out: a BARE action word (or unambiguous prefix) asks about + #that form rather than claiming a runnable line - forms with required + #values ('buildsuite build' needs a suitename) would fail a strict + #dry-run, so a single form-matching word renders the form directly. set form_names [punk::args::forms $usage_id] - set w0 [lindex $help_words 0] - if {[llength $form_names] > 1 && ![string match -* $w0]} { - set fmatch [tcl::prefix::match -error "" $form_names $w0] - if {$fmatch eq ""} { - if {[catch {punk::args::usage -form $w0 $usage_id} usage_err]} { - puts stderr $usage_err - } else { - puts stderr "make.tcl: no action '$w0' for '$help_subject' (actions: $form_names)" - } + set fmatch "" + if {[llength $help_words] == 1 && [llength $form_names] > 1} { + set fmatch [tcl::prefix::match -error "" $form_names [lindex $help_words 0]] + } + if {$fmatch ne ""} { + lappend usage_args -form $fmatch + } else { + if {[catch {punk::args::parse $help_words -errorstyle $::punkboot::errstyle withid $usage_id} argd]} { + puts stderr $argd exit 1 } - lappend usage_args -form $fmatch + if {[llength $form_names] > 1} { + lappend usage_args -form [dict get $argd form] + } } } if {![catch {punk::args::usage {*}$usage_args $usage_id} usage_out]} { diff --git a/src/project_layouts/vendor/punk/project-0.1/src/make.tcl b/src/project_layouts/vendor/punk/project-0.1/src/make.tcl index 4fce9524..a9aa5df2 100644 --- a/src/project_layouts/vendor/punk/project-0.1/src/make.tcl +++ b/src/project_layouts/vendor/punk/project-0.1/src/make.tcl @@ -2620,8 +2620,9 @@ proc ::punkboot::punkboot_gethelp {args} { append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n append h " $scriptname help ?subcommand? ?arg ...?" \n append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname -help);" \n - append h " extra words are the subcommand's own command line - a leading action word narrows the multi-form" \n - append h " subcommands (tool, buildsuite) to that action's usage when the tabled help is available" \n \n + append h " extra words are the subcommand's own command line, dry-run through its declaration - an accepted" \n + append h " line shows the matched action's usage (tool, buildsuite), a rejected line that subcommand's own" \n + append h " usage error (tabled help only)" \n \n append h " Flags:" \n append h " -confirm 0|1" \n append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n @@ -3240,13 +3241,15 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO " Show tabled usage for make.tcl as a whole, or for a single subcommand. After the subject, accepts that subcommand's own command line and - shows the usage most specific to it: for the multi-form subcommands - (tool, buildsuite) the leading action word narrows to that action's - single-form usage - 'make.tcl help tool build -test 0 punkzip' shows - the tool build form, as does appending -help to the command line - itself ('make.tcl tool build -test 0 punkzip -help'). Words after - the action are tolerated and ignored; an option-first line shows - the whole subcommand's usage." + dry-runs it through the subcommand's declaration: a line the + subcommand would accept shows the matched action's usage - 'make.tcl + help tool build -test 0 punkzip' shows the tool build form, as does + appending -help to the command line itself ('make.tcl tool build + -test 0 punkzip -help') - while a line it would reject shows the + same usage error the subcommand itself would produce (synopsis plus + per-form reasons, exit 1). A bare action word always renders that + action's usage, even where the real command needs more arguments + ('make.tcl help buildsuite build')." buildsuite " Surface for the defined buildsuites under src/buildsuites (zig-built @@ -3686,10 +3689,10 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO -choices {${[dict keys $SUMMARIES]}} -& -help "Subcommand to show usage for." arg -type any -optional 1 -multiple 1 -help -& - "The subject's own arguments, as they would be typed. For a - multi-form subcommand (tool, buildsuite) a leading action word - narrows to that action's single-form usage; everything after - it is tolerated and ignored." + "The subject's own arguments, as they would be typed. The line + is dry-run through the subject's declaration: an accepted line + shows the matched action's usage (tool, buildsuite), a rejected + line shows the subject's own usage error." } #top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help' variable SUBGROUPS { @@ -3711,12 +3714,12 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO General usage: make.tcl ?flags? 'make.tcl help ?arg ...?' or 'make.tcl - ?arg ...? -help' shows a subcommand's own usage - the words are the - subcommand's own command line, and for the multi-form - tool/buildsuite subcommands a leading action word narrows to that - action's usage. Interactive y/n confirmations can be driven - non-interactively with the -confirm flag declared on the relevant - subcommands.} + ?arg ...? -help' shows a subcommand's own usage - the words are + dry-run through the subcommand's declaration, so an accepted + command line shows the matched action's usage (tool, buildsuite) + and a rejected one shows that subcommand's own usage error. + Interactive y/n confirmations can be driven non-interactively + with the -confirm flag declared on the relevant subcommands.} punk::args::define { @id -id "(script)::punkboot" @cmd -name "make.tcl" -& @@ -3963,30 +3966,37 @@ if {$do_help} { set usage_args [list] if {[llength $help_words]} { #G-143 (refined 2026-08-01): help_words is the subject's own command line - #('make.tcl help tool build -test 0 punkzip'). For a multi-form subject - #the LEADING word selects that action's single-form usage by unambiguous - #prefix - the same literal-leader word punk::args form auto-selection - #keys on at dispatch. Words after it are the user's in-progress - #arguments: tolerated and ignored, never validated here. A flag-shaped - #leading word selects nothing (an option-first line cannot identify a - #form without option-schema knowledge) and the whole subcommand's usage - #renders. A non-flag leading word matching no action of a multi-form - #subject is a pointed punk::args usage error (exit 1) - the same - #reaction dispatch has to that command line - never a plain-help - #fallback. Single-form subjects ignore the words entirely. + #('make.tcl help tool build -test 0 punkzip') and help is a DRY-RUN of + #it: the words parse through the subject's declaration exactly as + #dispatch would parse them (punk::args form auto-selection - literal + #action leaders, choice prefixes). A line the subcommand would accept + #renders the matched form's single-form usage (whole usage for + #single-form subjects); a line it would reject gets the same pointed + #punk::args diagnosis dispatch would give - synopsis plus per-form + #reasons - on stderr with exit 1, never a plain-help fallback. Note + #punk::args' positional model: flag-like words at or after the first + #value position are consumed as values, so such lines still render + #usage cleanly (and declaration-level passthroughs - shell args, + #buildsuite driver args - parse clean by design). + #One carve-out: a BARE action word (or unambiguous prefix) asks about + #that form rather than claiming a runnable line - forms with required + #values ('buildsuite build' needs a suitename) would fail a strict + #dry-run, so a single form-matching word renders the form directly. set form_names [punk::args::forms $usage_id] - set w0 [lindex $help_words 0] - if {[llength $form_names] > 1 && ![string match -* $w0]} { - set fmatch [tcl::prefix::match -error "" $form_names $w0] - if {$fmatch eq ""} { - if {[catch {punk::args::usage -form $w0 $usage_id} usage_err]} { - puts stderr $usage_err - } else { - puts stderr "make.tcl: no action '$w0' for '$help_subject' (actions: $form_names)" - } + set fmatch "" + if {[llength $help_words] == 1 && [llength $form_names] > 1} { + set fmatch [tcl::prefix::match -error "" $form_names [lindex $help_words 0]] + } + if {$fmatch ne ""} { + lappend usage_args -form $fmatch + } else { + if {[catch {punk::args::parse $help_words -errorstyle $::punkboot::errstyle withid $usage_id} argd]} { + puts stderr $argd exit 1 } - lappend usage_args -form $fmatch + if {[llength $form_names] > 1} { + lappend usage_args -form [dict get $argd form] + } } } if {![catch {punk::args::usage {*}$usage_args $usage_id} usage_out]} {