Add script for simplified local build
This commit is contained in:
43
build_local.sh
Executable file
43
build_local.sh
Executable file
@@ -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"
|
||||||
Reference in New Issue
Block a user