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.
This commit is contained in:
Franz Alarcon 2026-07-08 23:14:45 +02:00
parent 11de390be1
commit 95c7131fbc
1 changed files with 4 additions and 1 deletions

5
setup
View File

@ -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