43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/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" |