From 95c7131fbcaeb69f7dcbbde7e8f71e2b38886337 Mon Sep 17 00:00:00 2001 From: Franz Alarcon Date: Wed, 8 Jul 2026 23:14:45 +0200 Subject: [PATCH] fix(setup): copy lib/ into opencode runtime root The \create_opencode_runtime_root\ function (used by \./setup --host opencode\) links/copies bin/, browse/, design/, ETHOS.md, and several other files into the opencode install root, but does not include lib/. As a result, any \.ts\ script in bin/ that imports from \../lib/...\ (e.g. gstack-gbrain-detect, gstack-decision-*, gstack-redact, gstack-telemetry-log, gstack-memory-ingest, etc.) fails on opencode hosts with errors like: error: Cannot find module '../lib/gbrain-local-status' from '...gstack-gbrain-detect.ts' This patch mirrors the existing bin/ block to also link/copy lib/, and adds lib/ to the mkdir list so the directory is created on a clean install. Tested on Windows + Git Bash by extracting the function and running it on a synthetic install root: lib/ is created and contains gbrain-local-status.ts plus the other 15 lib/*.ts files. The existing bin/ and ETHOS.md paths still work. --- setup | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup b/setup index 275236cd3..9e77f143e 100755 --- a/setup +++ b/setup @@ -866,7 +866,7 @@ create_opencode_runtime_root() { rm -rf "$opencode_gstack" fi - mkdir -p "$opencode_gstack" "$opencode_gstack/browse" "$opencode_gstack/design" "$opencode_gstack/gstack-upgrade" "$opencode_gstack/review" "$opencode_gstack/qa" "$opencode_gstack/plan-devex-review" + mkdir -p "$opencode_gstack" "$opencode_gstack/browse" "$opencode_gstack/design" "$opencode_gstack/gstack-upgrade" "$opencode_gstack/lib" "$opencode_gstack/review" "$opencode_gstack/qa" "$opencode_gstack/plan-devex-review" if [ -f "$opencode_dir/gstack/SKILL.md" ]; then _link_or_copy "$opencode_dir/gstack/SKILL.md" "$opencode_gstack/SKILL.md" @@ -874,6 +874,9 @@ create_opencode_runtime_root() { if [ -d "$gstack_dir/bin" ]; then _link_or_copy "$gstack_dir/bin" "$opencode_gstack/bin" fi + if [ -d "$gstack_dir/lib" ]; then + _link_or_copy "$gstack_dir/lib" "$opencode_gstack/lib" + fi if [ -d "$gstack_dir/browse/dist" ]; then _link_or_copy "$gstack_dir/browse/dist" "$opencode_gstack/browse/dist" fi