forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-local.sh
More file actions
executable file
·51 lines (40 loc) · 1.29 KB
/
run-local.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# OpenCode Local Development Runner
set -e
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Get the directory of this script
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Check if bun is installed
if ! command -v bun &> /dev/null; then
echo -e "${RED}Error: bun is not installed${NC}"
echo "Install bun with: curl -fsSL https://bun.sh/install | bash"
exit 1
fi
# Check if go is installed
if ! command -v go &> /dev/null; then
echo -e "${RED}Error: go is not installed${NC}"
exit 1
fi
# Save current directory
CURRENT_DIR="$(pwd)"
# Change to the project directory temporarily for dependency check
cd "$SCRIPT_DIR"
# Install dependencies if needed
if [ ! -d "node_modules" ]; then
echo -e "${BLUE}Installing dependencies...${NC}"
bun install
fi
# Return to the original directory
cd "$CURRENT_DIR"
# Start opencode directly (it handles both server and TUI internally)
echo -e "${GREEN}Starting opencode...${NC}"
echo -e "${BLUE}Press Ctrl+C to exit${NC}"
echo -e "${BLUE}Press Shift+Tab to toggle planning mode${NC}"
echo ""
# Run opencode directly - it starts both server and TUI internally
# Use absolute path to run from current directory
exec bun run "$SCRIPT_DIR/packages/opencode/src/index.ts" "$@"