forked from fletchgqc/agentbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·79 lines (66 loc) · 2.8 KB
/
entrypoint.sh
File metadata and controls
executable file
·79 lines (66 loc) · 2.8 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
export PATH="$HOME/.opencode/bin:$HOME/.local/bin:$PATH"
if [ -s "$HOME/.nvm/nvm.sh" ]; then
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
fi
if [ -f "$HOME/.sdkman/bin/sdkman-init.sh" ]; then
source "$HOME/.sdkman/bin/sdkman-init.sh"
fi
if [ -n "$PROJECT_DIR" ] && [ ! -d "$PROJECT_DIR/.venv" ] && [ -f "$PROJECT_DIR/requirements.txt" -o -f "$PROJECT_DIR/pyproject.toml" -o -f "$PROJECT_DIR/setup.py" ]; then
echo "🐍 Python project detected, creating virtual environment..."
cd "$PROJECT_DIR"
uv venv .venv
echo "✅ Virtual environment created at .venv/"
echo " Activate with: source .venv/bin/activate"
fi
if [ -d "/home/agent/.ssh" ]; then
chmod 700 /home/agent/.ssh 2>/dev/null || true
chmod 600 /home/agent/.ssh/* 2>/dev/null || true
chmod 644 /home/agent/.ssh/*.pub 2>/dev/null || true
chmod 644 /home/agent/.ssh/authorized_keys 2>/dev/null || true
chmod 644 /home/agent/.ssh/known_hosts 2>/dev/null || true
echo "✅ SSH directory permissions configured"
fi
if [ -d "/tmp/host_direnv_allow" ]; then
mkdir -p /home/agent/.local/share/direnv/allow
cp /tmp/host_direnv_allow/* /home/agent/.local/share/direnv/allow/ 2>/dev/null && \
echo "✅ Direnv approvals copied from host"
fi
if [ -f "/tmp/host_gitconfig" ]; then
cp /tmp/host_gitconfig /home/agent/.gitconfig
else
cat > /home/agent/.gitconfig << 'EOF'
[user]
email = agent@agentbox
name = AI Agent (AgentBox)
[init]
defaultBranch = main
EOF
echo "ℹ️ Using default git identity (agent@agentbox). Configure ~/.gitconfig on host to customize."
fi
if [ -n "$PROJECT_DIR" ] && { [ -f "$PROJECT_DIR/.mcp.json" ] || [ -f "$PROJECT_DIR/mcp.json" ]; }; then
echo "🔌 MCP configuration detected. To enable MCP servers, see AgentBox documentation."
fi
export TERM=xterm-256color
# Handle terminal size
if [ -t 0 ]; then
eval $(resize 2>/dev/null || true)
fi
if [ -t 0 ] && [ -t 1 ]; then
echo "🤖 AgentBox Development Environment"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📁 Project Directory: ${PROJECT_DIR:-unknown}"
echo "🐍 Python: $(python3 --version 2>&1 | cut -d' ' -f2) (uv available)"
echo "🟢 Node.js: $(node --version 2>/dev/null || echo 'not found')"
echo "☕ Java: $(java -version 2>&1 | head -1 | cut -d'"' -f2 || echo 'not found')"
if [ "$TOOL" = "opencode" ]; then
echo "🤖 OpenCode: $(opencode --version 2>/dev/null || echo 'not found - check installation')"
else
echo "🤖 Claude CLI: $(claude --version 2>/dev/null || echo 'not found - check installation')"
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
fi
exec "$@"