diff --git a/CHANGELOG.md b/CHANGELOG.md index ac5c41e7..39d8672c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The latest `## [X.Y.Z]` header must match the `version` field in `punkproject.to Entries are newest-first; one bullet per notable change. See the root `AGENTS.md` "Project Versioning" section for the bump policy. +## [0.12.36] - 2026-07-14 + +- punk::ns 0.8.0: removed the leftover global command aliases `nscommands1` and `nscommands2` (user direction; flagged as removal candidates in the 0.7.0 hygiene pass). Both were undocumented pipeline-based development iterations superseded by the `nscommands` proc; `nscommands1` was broken (referenced nonexistent commands) and errored on first use. Patch-level project bump despite command removal: neither was part of the documented user-facing shell contract. + ## [0.12.35] - 2026-07-14 - punk::ansi 0.1.3 (documentation-only): grepstr's -return summarydict help corrected - the summary dict's linemap key is always present (the old text claimed it appeared only with -n; the always-present behaviour is pinned in ansi/grepstr.test). This was the doc/behaviour reconciliation deferred from the grepstr characterization wave to the punk::ns hygiene pass. diff --git a/punkproject.toml b/punkproject.toml index e1049934..0b4292f8 100644 --- a/punkproject.toml +++ b/punkproject.toml @@ -1,4 +1,4 @@ [project] name = "punkshell" -version = "0.12.35" +version = "0.12.36" license = "BSD-2-Clause" diff --git a/src/modules/punk/ns-999999.0a1.0.tm b/src/modules/punk/ns-999999.0a1.0.tm index 0cd682b2..84d74883 100644 --- a/src/modules/punk/ns-999999.0a1.0.tm +++ b/src/modules/punk/ns-999999.0a1.0.tm @@ -3484,146 +3484,12 @@ y" {return quirkykeyscript} } return $nsdict_list } - #Must be no ansi when only single arg used. - #review - ansi codes will be very confusing in some scenarios! + #2026-07-14 Agent-Updated: removed the superseded pipeline-based command aliases nscommands1 and + #nscommands2 (user direction 2026-07-14; flagged as removal candidates in the 0.7.0 hygiene pass). + #The plain proc nscommands below is the live implementation (adds weird-namespace handling); + #nscommands1 was broken - it referenced nonexistent commands (nsthis2, inspect at global scope). + #Recoverable via git history. #todo - only output color when requested (how?) or via repltelemetry ? - #2026-07-14 Agent-Generated: nscommands2 and nscommands1 below are earlier pipeline-based iterations - #superseded by the plain proc nscommands (which adds weird-namespace handling). No callers exist in - #the repo; nscommands1 additionally references nonexistent commands (nsthis2, inspect at global scope) - #and errors on first use. Removal candidates - retained pending user decision since they register - #global command aliases and serve as pipeline-syntax examples. - interp alias {} nscommands2 {} .= ,'ok'@0.= { - #Note: namespace argument to apply doesn't accept namespace segments with leading colon - so pipelines won't work fully in dodgily-named namespaces such as :::x - #inspect -label namespace_current [namespace current] - #inspect -label info_procs [info procs] - - ::set commandns [::namespace current] - ::set commandlist [::list] - #color code multiple args? - not very practical if many ns args supplied, but then... common case will only be 1 or 2 anyway - #colors can be stripped by caller with ansistrip - but we'll make the default case easier by using no ansi codes if a single arg is passed - ::set colors [::list none cyan yellow green] - ::set ci 0 ;#colourindex - ::set do_raw 0 - ::if {[::set posn [::lsearch $searchlist -raw]] >= 0} { - #::set searchlist [::lreplace $searchlist $posn $posn] - ::ledit searchlist $posn $posn - ::set do_raw 1 - } - ::if {![::llength $searchlist]} { - ::lappend searchlist * - } - ::foreach search $searchlist { - ::if {$ci > [::llength $colors]-1} { - ::set ci 0 - } - #by using pipeswitch instead of pipeswitchc - we give the ability* for the switch script block to affect vars in the calling scope - # (*not a desirable feature from a functional point of view - but useful for debugging, and also potentially faster ) - ::if {$ci == 0 || $do_raw} { - ::set col "" - ::set rst "" - } else { - ::set col [a+ [::lindex $colors $ci] bold] - ::set rst [a+] - } - ::incr ci ;#colourindex - #inspect -label search $search - - ::if {![::llength $search]} { - ::set base $commandns - ::set what "*" - } else { - ::if {[::string match ::* $search]} { - ::set base [::punk::ns::nsprefix $search] - ::set what [::punk::ns::nstail $search] - } else { - ::set base $commandns - ::set what $search - } - } - - ::set all_ns_commands [::info commands [::punk::ns::nsjoin $base $what]] - #important not to call tcl::namespace::eval (or punk::ns::nseval) on non-existant base - or it will be created - ::if {![::tcl::namespace::exists $base]} { - ::continue - } - - if 0 { - #NOTE - matched commands will return commands from global ns due to 'namespace eval' - also any commands from namespaces in the 'namespace path' list - #We don't simply do info commands ${base}::$what because it misses some oddly named things (JMN 2023 - like what?) - #this was to support weird namespaces with leading/trailing colons - not an important usecase for the cost - ::set matchedcommands [::pipeswitch { - ::pipecase \ - caseresult.= ::list $base $what |,basens/0,g/1> {tcl::namespace::eval $basens [::list ::info commands $g]} - }] - #lappend commandlist {*}[@@ok/result= $matchedcommands] - #need to pull result from matchedcommands dict - #set cmd_tails [@@ok/result= $matchedcommands |> {::lmap v $data {punk::ns::nstail $v}}] - ::set cmd_tails [::lmap v [::dict get $matchedcommands ok result] {::punk::ns::nstail $v}] - ::set all_ns_tails [::lmap v $all_ns_commands {::punk::ns::nstail $v}] - ::foreach c $cmd_tails { - ::if {$c in $all_ns_tails} { - ::if {$do_raw} { - ::lappend commandlist [::list $c $c] - } else { - ::lappend commandlist [::list $c $col[::list $c]$rst] - } - } - } - } else { - - ::set all_ns_tails [::lmap v $all_ns_commands {::punk::ns::nstail $v}] - foreach c $all_ns_tails { - ::if {$do_raw} { - ::lappend commandlist [::list $c $c] - } else { - ::lappend commandlist [::list $c $col[::list $c]$rst] - } - } - } - } - ::list ok [::list result $commandlist] - #unless we always return trailing \n - it's impossible to represent a list containing only the empty string using \n (cannot disambiguate between empty list and/or list of 2 empty strings) - #we use the convention that a result of just \n represents a list of just the empty string - as we don't require duplicates anyway - so it shouldn't mean two empty strings. - } |data@@ok/result> ::lsort -index 0 |> {::lmap v $data {::lindex $v 1}} |> {::if {![::llength $data]} {::return {}} else {::return [::join $data \n]\n}} \ - 1.= {expr {[string length [string map [list * "" ? ""] $data]] == [string length $data]}} |> { - #uplevel 1 [list info commands ${input}::*] - info commands ${input}::* - } - - #pipecase1 ns has one or more of glob chars * or ? - pipecase \ - caseresult= $ns |input> { - #uplevel 1 [list info commands ${input}] - info commands ${input} - } - } - } |data@@ok/result> {lmap v $data {punk::ns::nstail $v}} |> lsort |> {join $data \n} >> base: ...') that polluted nscommands stdout on the weird-namespace path (same treatment as the 0.1.1 trace-puts cleanup). #0.7.0 - comment/doc hygiene pass (no change to shipped behaviour; minor bump for removed unused procs). Dead code removed (recoverable via git history): the fully commented-out predecessor help command 'arginfo' (~930 lines, replaced by cmdhelp), the superseded/deprecated name-primitive twins nsparts1/nsprefix1/nsprefix_orig/nstail1/nstail_orig (never exported, no callers; NOT drop-in equivalents - they collapse colon runs of 5+ differently, divergence pinned in tests ns/nsprimitives.test git history), obsolete nsglob_as_re1, empty stubs ns_relative_to_location/ns_absolute_to_location, obsolete internal::_pkguse_vars, an 'if 0' block in nstree_list, unused interp_aliases assignment in get_ns_dicts, and assorted commented-out code remnants. Stale docs corrected: nsprefix comment (:::a prefix is :: not ::a), nsglob_as_re 'should be fixed' note (fix has long been in place - * matches an inner single colon), cmdhelp typos, corp -syntax truncated help sentence, nstree_list empty PUNKARGS help fields filled. Flagged (comment only): get_nslist red-strike/masked alias display branches appear unreachable (see nslist.test fixture findings), nscommands1/nscommands2 pipeline aliases are superseded removal candidates (nscommands1 errors on use - references nonexistent nsthis2), cmdtrace stdout/stderr noise deferred to proposed G-085, test_switch* marked as live cmdtrace test fixtures. All inserted/updated comments carry 2026-07-14 Agent marks. #0.6.0 - cmdtrace gains -pause (default 1 - existing interactive behaviour unchanged): -pause 0 bypasses the 'paused - hit enter key to continue' askuser in _cmdtrace_leave so cmdtrace can run non-interactively/scripted and the returned marked-up body report captured (gate: namespace variable _cmdtrace_pause). cmdtrace argdoc: the nested-switch traced-linenumber caveat now cites the upstream Tcl ticket (core.tcl-lang.org tktview 5d5b1052280c976ea3d4, reported by the developer) and records the characterized pattern (2026-07-14, punk-free minimal repro identical on 8.6.17/8.7a6/9.0.3): a nested single-block switch arm body reports lines shifted by (switch command's line within its containing script - 1) exactly when the arm's index into the split pattern/body list lands on a literal word of the switch command (options/--/block); dynamic-word or out-of-range indices report correctly arm-relative - so which arms mismark varies with the option words used, matching the ticket's observation. New testsuite ns/cmdtrace.test (pause flag, flat-switch and 2-word-nested correct-mark guards, upstream mismark GAP pins gated on have_tclcoredocs since cmdtrace's arm-offset correction needs the ::switch argdoc).