console object in beagle/js/ — console.log/info/debug → stdout, warn/error → stderr, Node-style multi-arg + %s/%d/%o formatting
The jab JS runtime has NO console global: scripts hand-roll utf8.Encode → io.buf → io.write(fd) for every line, and io.log only writes raw strings/typed arrays to stderr (no formatting, no stdout). Surfaced by SUBS-041, whose worker needed a diagnostic line and found "no console/log global." Add a standard console object as a focused new beagle/js/ binding module (console.cpp + a JABCConsoleInstall() hook), layering over the existing utf8/io write leaves: log/info/debug → stdout (fd 1), warn/error → stderr (fd 2), with Node-like behaviour (multi-arg space-join, %s/%d/%i/%f/%j/%o/%% specifiers, non-string args stringified). Scope: beagle C++ (beagle/js/). See Issues.
utf8/io/buf/abc/uri/…) via per-module JABC*Install() hooks in main.cpp::JABCInstallModules(); there is NO console.io.log writes only strings / typed arrays to stderr — no stdout, no multi-arg, no format specifiers; extension + test scripts hand-roll utf8.Encode → io.buf → io.write(fd).JABC.hpp, INDEX.md): JABC_API_OBJECT registers a fresh global object, JABC_API_FN attaches a native method; each module ships a JABC*Install/Uninstall hook that main calls.console with at least log, info, debug, warn, error (add trace/assert/dir only if cheap). log/info/debug → stdout (fd 1); warn/error → stderr (fd 2).%s %d %i %f %j %o %%; non-string args stringified (JSON-ish for objects, sane fallback for cycles/functions).JABCConsoleInstall() hook in JABCInstallModules(); documented in beagle/js/INDEX.md + API.md.beagle/js/), ABC / JSC house style; REUSE the utf8/io write leaves — do NOT reimplement encoding or raw IO. Keep it ONE focused module; no broad refactor.beagle/js/test/console.js (mirror test/stat.js) asserting each method hits the right fd + the formatting rules, wired into ctest. Don't regress the js test suite.$HOME/todo/JAB-002; do NOT edit the main beagle tree.console.cpp is PURE JS (string literal + JABCExecute, like ansi.cpp/buf.cpp), NOT native JABC_API_FN methods: the format/inspect/specifier logic is far cleaner in JS, and it REUSES the utf8.Encode + io.writeAll leaves verbatim — exactly the "do NOT reimplement encoding or raw IO" constraint. A literal native module would either re-encode (forbidden) or call back into JS awkwardly.JABCConsoleInstall() runs AFTER JABCbufInstall() in main.cpp — console depends on utf8.Encode/io.writeAll/io.stdout/io.stderr, all defined by buf.cpp.format(args) (multi-arg space-join + %s %d %i %f %j %o %O %c %%) + inspect(v) (JSON-ish, [Circular] cycle guard) → utf8.Encode → io.writeAll(fd).io.writeAll leaf so test/console.js can intercept it and assert BOTH the fd and the exact bytes in-process — no child-process/binary-path plumbing.js/test/console.js — intercepts io.writeAll, asserts log/info/debug→1, warn/error→2, %s %d %i %f %j %o %% + multi-arg join + inspect/cycle; wired to ctest (JABCconsole). Verified RED-sensitive (flipping a route fails it).console.cpp (format/inspect + methods) + JABCConsoleInstall; registered in main.cpp; added to CMakeLists (JABC_SRC + add_test + LSAN group).js/INDEX.md (console.cpp section + install-order line) + js/API.md (console section).JABCconsole passes; full JABC* ctest suite 29/29, LSan-clean; OS-level fd split confirmed via jab --eval ... 1>/2>.js/CMakeLists.txt:118 lists JABCulogLib JABCstore in set_tests_properties unconditionally, but their add_test is guarded by if(EXISTS .../../be/test/...). This store-backed worktree has no sibling be/, so configure errors ("Can not find test to add properties to"). Worked around by temporarily dropping the two names to build/verify, then restored line 118 verbatim (only JABCconsole inserted). Worth its OWN ticket (guard the property names too) — flagged for the user, not filed.7d72e138 + merge 2a35dbd1 (30Jun, "JAB-002: console object"); carried into the standalone jab repo (JAB-005 split) as 949f4a2 + merge a0a5c68.~/src/jab (github.com/gritzko/jab): console.cpp, JABCConsoleInstall (main.cpp:180, JABC.hpp:82), ctest JABCconsole, INDEX.md/API.md sections.jab --eval 'console.log("x %d",5)' → stdout x 5; console.error("e %s","y") → stderr e y.console/log global in the jab runtime.