From aa6dfe753acab01db5f6e3a5768e35cf4ce28b45 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Thu, 23 Jul 2026 18:28:46 +1000 Subject: [PATCH] scriptlib/developer: piperepl manual probes (evalinput, showinput) - tclsh subcommand/patch drivers Assisted-by: harness=opencode; primary-model=openrouter/moonshotai/kimi-k3; api-location=openrouter.ai --- scriptlib/developer/piperepl/evalinput.tcl | 32 ++++++++++++++++++++++ scriptlib/developer/piperepl/showinput.tcl | 21 ++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 scriptlib/developer/piperepl/evalinput.tcl create mode 100644 scriptlib/developer/piperepl/showinput.tcl diff --git a/scriptlib/developer/piperepl/evalinput.tcl b/scriptlib/developer/piperepl/evalinput.tcl new file mode 100644 index 00000000..6c325918 --- /dev/null +++ b/scriptlib/developer/piperepl/evalinput.tcl @@ -0,0 +1,32 @@ + +set exebase [file rootname [file tail [info nameofexecutable]]] + +puts stdout "------------------------" +puts stdout "message from script" +puts stdout "exebase : $exebase" +puts stdout "::tcl_interactive : $::tcl_interactive" +puts stdout "::tclsh(istty) : $::tclsh(istty)" +puts stdout "------------------------" + + +#optionally read part or all of stdin, +#but we don't know how to put data back into stdin - so partial read should only be done if there is a protocol for the data to be read and processed. +#set inputdata [read stdin] + +if {"-noeval" ni $::argv} { + set ::tclsh(evalinput) 1 +} else { + if {"-eat2" in $::argv} { + set eat [read stdin 2] + puts stdout "stdin read: [string length $eat] bytes" + puts stdout $eat + puts stdout "info exist ::tclsh(inputbuffer): [info exists ::tclsh(inputbuffer)]" + } + #set ::tclsh(evalinput) 0 +} +#now that we have set the evalinput flag for PIPEREPL - when we exit this script - the piperepl will read from stdin and evaluate any remaining input as tcl code. +#This means that no matter what we do with ::tclsh(dorepl) - it could be overridden by the script on the input. that's ok. + +if {"-dorepl" in $::argv} { + set ::tclsh(dorepl) 1 +} \ No newline at end of file diff --git a/scriptlib/developer/piperepl/showinput.tcl b/scriptlib/developer/piperepl/showinput.tcl new file mode 100644 index 00000000..0bb2746e --- /dev/null +++ b/scriptlib/developer/piperepl/showinput.tcl @@ -0,0 +1,21 @@ + + +set exebase [file rootname [file tail [info nameofexecutable]]] + +puts stdout "------------------------" +puts stdout "message from script" +puts stdout "exebase : $exebase" +puts stdout "::tcl_interactive : $::tcl_interactive" +puts stdout "::tclsh(istty) : $::tclsh(istty)" +puts stdout "------------------------" + +if {!$::tcl_interactive} { + set data [read stdin] + puts stdout "stdin read: [string length $data] bytes" + puts stdout $data +} + +if {"-dorepl" in $::argv} { + set ::tclsh(dorepl) 1 + set ::tcl_interactive 1 +}