BBS:      TELESC.NET.BR
Assunto:  src/syncterm/run_wren.shsrc/syncterm/Manual.txt Wren.adoc src/syncterm
De:       Deuc¨
Data:     Tue, 5 May 2026 21:19:42 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/b469dbeb1af56e3c9bf40760
Added Files:
	src/syncterm/run_wren.sh
Modified Files:
	src/syncterm/Manual.txt Wren.adoc src/syncterm/scripts/syncterm.wren wrentest.wren src/syncterm/syncterm.c syncterm.man.in wren_bind.c wren_bind_conn.c wren_bind_conn.h wren_host.c wren_host.h
Log Message:
SyncTERM: -W flag for command-line Wren script load + harness

Adds a way to compile / execute a Wren script under SyncTERM headlessly,
useful for CI / pre-commit gating and for ad-hoc developer tests.

  -W           New CLI flag.  Stores the path via
                     wren_host_set_launch_script(); wren_host_init runs
                     load_one_script() on it after the embedded + user
                     auto-load chain has finished, so its imports
                     resolve against the full surface.  Skips the load
                     when wrenHasModule() reports the filename-derived
                     module already loaded -- common when the file is
                     symlinked into the user-dir scripts/ tree or
                     pulled in by an `import` from another module
                     (e.g. auto/connected/runtests.wren importing
                     "wrentest").  Compile / runtime errors print
                     "[wren] ..." to stderr via the existing errorFn.

  Host.launchScript  Returns the -W path (or null) so a script that's
                     also embedded for normal Alt+key dispatch can
                     detect command-line invocation and run itself
                     immediately, without relying on coincidental
                     signals like the BBS URL.  wrentest.wren uses
                     this to fire WrenTest.run() when invoked via -W
                     while leaving Alt+T behavior unchanged.

  Host.print(s)      Write a string + newline to actual stdout (and
                     fflush).  Distinct from System.print(s), which
                     is captured by the Wren console log buffer.
                     Intended for scripts run under -W that need to
                     report progress / results to the launching shell.

  run_wren.sh        Tiny harness modeled after run_termtest.sh.  Takes
                     a Wren script path; invokes the gmake-default
                     debug binary (clang.freebsd.amd64.exe.debug/
                     syncterm) with -iS -S -Q -W