-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathzero
More file actions
executable file
·145 lines (116 loc) · 3.32 KB
/
zero
File metadata and controls
executable file
·145 lines (116 loc) · 3.32 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/env bash
set -e
# Parse command line arguments
agent_mode=false
auto_yes=false
for arg in "$@"; do
case $arg in
--agent)
agent_mode=true
shift
;;
-y|--yes)
auto_yes=true
shift
;;
esac
done
interactive_only() {
if ! $agent_mode; then
"$@"
fi
}
onboarding_pass=true
# region: Onboarding checks
if [ ! -f "mise.local.toml" ]; then
cat > mise.local.toml << EOF
# Local mise configuration
# This file is gitignored and can contain tools and environment variables
# that you personally need for local development.
[tools]
# Add your local tools here. Example:
# dive = "latest"
[env]
# Add your local environment variables here. Example:
# EXAMPLE_VAR = "value"
EOF
echo "✅ Created mise.local.toml file"
fi
if [ -f "mise.worktree.local.toml" ]; then
echo "ℹ️ Found mise.worktree.local.toml. Running zero with MISE_ENV=worktree."
export MISE_ENV=worktree
fi
check_command() {
local cmd=$1
local instructions=$2
if ! command -v "$cmd" &> /dev/null; then
onboarding_pass=false
echo "## \`$cmd\` not found:"
echo "$instructions" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
echo
fi
}
# Install mise automatically in agent mode
if $agent_mode && ! command -v mise &> /dev/null; then
echo "⏳ Installing mise..."
curl -fsSL https://mise.run | sh
export PATH="$HOME/.local/bin:$PATH"
mise trust
else
check_command "mise" "
Install it from here: https://mise.jdx.dev/
- Make sure to update your .zprofile (zsh), .profile (bash), ...
- Additionaly enable completions for better DX: https://mise.jdx.dev/installing-mise.html#autocompletion
"
fi
if ! $agent_mode; then
check_command "docker" "
Install it from here: https://www.docker.com/
"
fi
if [ $onboarding_pass = "false" ]; then
echo "❌ Onboarding checks failed. Please fix the issues above and rerun this script."
exit 1
fi
# endregion: Onboarding checks
echo -e "\n⏳ Installing tools"
mise install
echo -e "\n⏳ Installing dependencies"
mise run install
echo -e "\n⏳ Setting up API keys and secrets"
interactive_only mise run zero:github
interactive_only mise run zero:openrouter
interactive_only mise run zero:workos
interactive_only mise run zero:melange
interactive_only mise run zero:fly
mise run zero:encryption
mise run zero:tls
echo -e "\n⏳ Building internal SDK"
mise run build:internal-sdk
echo -e "\n⏳ Updating VS Code and Cursor editor settings"
mise run install:vscode
echo -e "\n⏳ Setting up hooks"
interactive_only mise run zero:hk
interactive_only mise run zero:claude
echo -e "\n⏳ Cleaning up stale processes and Temporal state"
interactive_only mise run zero:cleanup
echo "✅ Cleaned up stale state"
echo -e "\n⏳ Starting infra"
interactive_only mise infra:start
echo -e "\n⏳ Running migrations"
mise run zero:migrations
mise db:migrate
mise clickhouse:migrate
interactive_only mise zero:summary
echo -e "\n✅ All set up!"
if $auto_yes; then
exec mise run start
elif ! $agent_mode; then
echo "Want me to start the server and dashboard (\`mise run start\`)?"
echo -n "[y/N] "
read -r answer
answer=$(echo "$answer" | tr '[:upper:]' '[:lower:]')
if [ "$answer" = "y" ]; then
exec mise run start
fi
fi