# G-096 Tracked zig tcl buildsuite (suite_tcl90) with recovered TCLSH_PIPEREPL kit-repl capability Status: proposed Scope: src/buildsuites/ (suite_tcl90 new; samplesuite1 sketch reconciliation; VCS ignore flip), src/buildsuites/_build/ (untracked build/source area via existing _build globs), .gitignore + .fossil-settings/ignore-glob, src/scriptapps/bin/ (getzig scriptset rename), bin/ (regenerated punk-getzig wrapper twins, old names retired, AGENTS.md naming policy), bin/tools/ (untracked zig toolchains, existing), TEMP_REFERENCE/2024zig (read-only recovery origin) Goal: src/buildsuites gains its first real, VCS-tracked suite (suite_tcl90) that reproducibly builds the Tcl 9.0 windows runtime from clean sources using only project-managed tooling - a punk-getzig wrapper fetching a pinned zig into untracked bin/tools, with all transient checkouts and outputs under untracked src/buildsuites/_build - and the 2024 TCLSH_PIPEREPL tclMain patch is recovered into the suite in tracked form and rebased onto current Tcl 9 sources, so a suite-built runtime can return to a standard interactive repl after a kit-style main.tcl completes with unconsumed piped input buffered rather than eval'd, while stock behaviour is preserved whenever the env gate is unset. Acceptance: from a clean checkout plus a punk-getzig-fetched pinned zig, the suite builds tclsh90s/tclsh90szip from a fresh core-9-0-branch checkout under src/buildsuites/_build with recipe-generated tclUuid.h and tclsh.exe.manifest (no hand-placed files) and the result reports the expected patchlevel; the recovered patch set (piperepl plus the companion tclZipfs/tclCmdIL patches and a notes doc) is tracked in the suite; a piperepl-patched build with TCLSH_PIPEREPL unset behaves identically to the unpatched build on a tty/piped/script-arg matrix, and with TCLSH_PIPEREPL=1 a script setting ::tclsh(dorepl) 1 lands in a live interactive console repl after piped-input eof with the unconsumed input available in ::tclsh(inputbuffer); src/buildsuites is tracked in both VCSes with only _build content ignored and the samplesuite1 vendorbuild-prefix residue reconciled (vendorbuild concept retired); bin/AGENTS.md documents the utility naming policy (punk- prefix for punkshell-own utilities; exceptions: external-tool wrappers such as dtplite/sdx/kettle, and getpunk as the intended future cross-platform entry point) and the getzig scriptset and its bin wrapper twins (getzig.cmd/getzig.ps1) are renamed to punk-getzig with the old names removed and references updated. ## Context - src/buildsuites (2026-07-10 sketch: samplesuite1 with a Tcl-script-style download_and_build.config carrying SOURCEDOWNLOAD/CONFIGSTART records) is blanket-ignored in BOTH VCSes today (.gitignore `/src/buildsuites`, .fossil-settings/ignore-glob `src/buildsuites`) - deliberately untracked while the sketch was non-final. User decision 2026-07-20: buildsuites is the home for build source-pull/recipe declarations ("it was essentially for this purpose"); this goal makes suite content tracked. - Untracked build/source area: src/buildsuites/_build (user 2026-07-20: "seems neater to keep it all under src/buildsuites/_build"). Already covered by the existing _build ignore globs in both VCSes (git `**/_build/`; fossil `_build` + `*/_build`) - no new ignore rules needed for it. The sketch's `/vendorbuild/` buildprefix and the root `/vendorbuilds/` ignore entries are retired in its favour. - The TCLSH_PIPEREPL patch (Aug 2024; c:/buildtcl/2024zig/build_tcl90/patch/ tclMain.c.piperepl.patch + tclMain_piperepl.c, snapshot under git-ignored TEMP_REFERENCE/2024zig) enables returning to a standard C-level tcl repl after a kit main.tcl - not possible with unmodified sources (user 2026-07-20). Semantics: gated by the TCLSH_PIPEREPL env var (unset/0 = stock behaviour); publishes ::tclsh(istty) plus linked ::tclsh(dorepl)/::tclsh(evalinput); unconsumed piped input accumulates in ::tclsh(inputbuffer) rather than being eval'd (unless evalinput is set - protects arbitrary piped data from accidental eval); on stdin eof with dorepl set, stdin reopens from the console (CONIN$ on windows, /dev/tty elsewhere) giving a live standard repl. Companion patches in the same folder: tclZipfs.patch, tclCmdIL.patch (unexamined). None of these files are VCS-tracked anywhere - recovery into the suite is the durability fix. - Recipe baseline: the validated build provenance in goals/G-076-tcl9-deadconsole-fix-adoption.md (2026-07-20 entries) - build90.zig / build905.zig with zig 0.14.0-dev.2074, the fresh-checkout generated-file preconditions (tclUuid.h from manifest.uuid; tclsh.exe.manifest from its .in with @TCL_WIN_VERSION@/@MACHINE@), and the 9.0.5+ mingw_unicode_entry_point requirement (upstream removed TCL_BROKEN_MAINARGS from win/tclAppInit.c). - getzig today: scriptset src/scriptapps/bin/getzig.{bash,ps1} + getzig_wrap.toml, wrapped by punk::mix::commandset::scriptwrap::multishell into bin/getzig.cmd (tracked) with a bin/getzig.ps1 twin. The twin is a deliberate polyglot-launchability artifact - windows users may start from cmd.exe or powershell - not residue. Fetches zig into bin/tools (untracked via the existing bin/* globs) with minisign signature material, sourcing ziglang.org, community-mirrors.txt and the punkbin gitea mirror. bin/tools currently holds zig 0.15.1/0.15.2/0.16.0-dev toolchains; the known-good recipe used a manual C:/zig install (0.14.0-dev.2074). - Toolchain policy (user 2026-07-20, recorded in G-076 and agent memory): zig is the only build mechanism approved to become part of the punkshell project; msys/mingw and MS toolchains are test/validation only (MS last resort). ## Approach - suite_tcl90 tracked layout: the zig recipe (build905.zig lineage, parameterized for suite paths), patches/ (piperepl + tclZipfs + tclCmdIL + a notes doc carrying the semantics summary and rebase history), suite README. Transient content under src/buildsuites/_build// (source checkouts, build prefixes/outputs); fossil clones stay in the shared ~/.fossils. - The recipe generates tclUuid.h and tclsh.exe.manifest itself (wrapfiletofile-style steps) so fresh checkouts build with no hand-placed files. - Pin an exact zig version retrievable via punk-getzig (punkbin can host the pinned zip); migrating the recipe from 0.14.0-dev.2074 to the pinned version is in-scope (zig build API churn), with the validated exact-combo build as fallback per the duplicate-first policy. - Naming policy: punk- (hyphenated) prefix approved by user 2026-07-20 over bare punk concatenation - readable, groups in listings, distinct from the punk*.exe shell-kit namespace. Applied here to getzig (touched anyway); the sweep of the remaining punkshell-own utilities is G-097. - Suite config format stays pragmatic (zig/script files); toml-based suite declarations remain a G-005-era decision - buildsuites structure beyond what this goal claims is still non-final. ## Alternatives considered - `/vendorbuild/` as the untracked build area (samplesuite1 sketch + `/vendorbuilds/` ignores) - retired 2026-07-20 in favour of src/buildsuites/_build: one area adjacent to the suites, already ignore-covered in both VCSes. - Upstreaming the piperepl capability instead of carrying a patch - not precluded as a future path; tracked in-suite recovery is the durability baseline either way and is required regardless while nothing upstream provides it. - Folding the bin-wide utility rename sweep into this goal - split to G-097 to keep this acceptance verifiable and let the sweep wait for a suitable time (user 2026-07-20). ## Notes - Related goals: G-005 (zig build infrastructure - this suite is its first concrete increment), G-018 (zig plain tclsh kits), G-006 (prebuilt artifact download consent; punkbin mirror overlap), G-004 (no committed binaries - untracked bin/tools and _build align), G-076 (verification-runtime provenance this recipe formalizes), G-038 (punkshell-level piped session continuity - the punk-repl analogue of piperepl), G-060 (qemu cross-platform matrix - see G-097 notes on the windows-sandbox experiments), G-089 (scriptlib in kits; the scriptapps/bin deployment surface). - getpunk (naming-policy exception): intended future single-download cross-platform starting point - run in a new folder, the folder becomes the repo automatically; needs smarts to pull the repo and then update itself safely without snagging on the now-dirty repo (user 2026-07-20). The polyglot .cmd/.ps1 twin mechanism serves that cmd.exe-or-powershell first-contact story and may need review in that light; candidate goal when picked up. - The G-076 kill-procedure runtime (zig-out905 under c:/buildtcl/2024zig) predates this suite; once suite_tcl90 reproduces it, the ad-hoc c:/buildtcl/2024zig builds become historical reference only.