From 6835f9084c626abce05e93086e69bf1118ff2c59 Mon Sep 17 00:00:00 2001 From: Arpad Krejczinger Date: Thu, 11 Sep 2025 20:49:03 +0200 Subject: [PATCH] Add script for simplified local build --- build_local.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 build_local.sh diff --git a/build_local.sh b/build_local.sh new file mode 100755 index 00000000..b9e4b59a --- /dev/null +++ b/build_local.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +echo "Building opencode locally..." + +# Get the absolute paths +REPO_ROOT="$(cd "$(dirname "$0")" && pwd)" +TUI_DIR="$REPO_ROOT/packages/tui" +SERVER_DIR="$REPO_ROOT/packages/opencode" +TUI_BINARY_PATH="$TUI_DIR/cmd/opencode/dist/tui" + +echo "Repository root: $REPO_ROOT" + +# Build the TUI binary +echo "Building TUI binary..." +cd "$TUI_DIR" +go build -o cmd/opencode/dist/tui cmd/opencode/main.go +echo "✓ TUI built: $TUI_BINARY_PATH" + +# Build the server CLI with embedded TUI path +echo "Building server CLI..." +cd "$SERVER_DIR" +bun build \ + --define OPENCODE_TUI_PATH="'$TUI_BINARY_PATH'" \ + --define OPENCODE_VERSION="'0.7.2'" \ + --compile \ + --target=bun-linux-x64 \ + --outfile=opencode-cli \ + ./src/index.ts + +echo "✓ Server CLI built: $SERVER_DIR/opencode-cli" + +echo "" +echo "Build complete!" +echo "" +echo "To run opencode from anywhere:" +echo " $SERVER_DIR/opencode-cli" +echo "" +echo "To run from a specific directory:" +echo " $SERVER_DIR/opencode-cli /path/to/your/project" +echo "" +echo "To run headless server only:" +echo " $SERVER_DIR/opencode-cli serve" \ No newline at end of file