This repository was archived by the owner on Apr 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·161 lines (132 loc) · 4.81 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·161 lines (132 loc) · 4.81 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env bash
# Interactive setup for health-engine
# Creates config.yaml, installs dependencies, and verifies everything works.
set -e
BOLD='\033[1m'
DIM='\033[2m'
GREEN='\033[32m'
CYAN='\033[36m'
YELLOW='\033[33m'
RESET='\033[0m'
echo ""
echo -e "${BOLD} health-engine setup${RESET}"
echo -e "${DIM} ─────────────────────────────────────${RESET}"
echo ""
# ── Step 1: Python check ──
if ! command -v python3 &>/dev/null; then
echo -e "${YELLOW} Python 3 not found. Install it first:${RESET}"
echo " brew install python3 (macOS)"
echo " sudo apt install python3 (Linux)"
exit 1
fi
PY_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
echo -e " Python: ${GREEN}${PY_VERSION}${RESET}"
# ── Step 2: Install dependencies ──
echo ""
echo -e "${BOLD} Installing dependencies...${RESET}"
python3 -m pip install -e . -q 2>&1 | tail -1
read -p " Install Garmin integration? (y/n) [y]: " GARMIN_INSTALL
GARMIN_INSTALL=${GARMIN_INSTALL:-y}
if [[ "$GARMIN_INSTALL" =~ ^[Yy] ]]; then
python3 -m pip install -e ".[garmin]" -q 2>&1 | tail -1
echo -e " Garmin: ${GREEN}installed${RESET}"
fi
# ── Step 3: Create config.yaml ──
echo ""
if [ -f config.yaml ]; then
read -p " config.yaml already exists. Overwrite? (y/n) [n]: " OVERWRITE
OVERWRITE=${OVERWRITE:-n}
if [[ ! "$OVERWRITE" =~ ^[Yy] ]]; then
echo " Keeping existing config.yaml"
SKIP_CONFIG=true
fi
fi
if [ "$SKIP_CONFIG" != "true" ]; then
echo -e "${BOLD} Let's set up your profile.${RESET}"
echo ""
read -p " Your age: " AGE
AGE=${AGE:-35}
read -p " Sex (M/F): " SEX
SEX=${SEX:-M}
echo ""
echo -e "${DIM} Targets are optional — press Enter to skip any.${RESET}"
read -p " Target weight (lbs): " TARGET_WEIGHT
read -p " Daily protein target (g): " TARGET_PROTEIN
read -p " Training day calories: " CAL_TRAINING
read -p " Rest day calories: " CAL_REST
GARMIN_EMAIL=""
GARMIN_PASSWORD=""
if [[ "$GARMIN_INSTALL" =~ ^[Yy] ]]; then
echo ""
echo -e "${DIM} Garmin credentials (stored in config.yaml, which is gitignored).${RESET}"
echo -e "${DIM} You can also set GARMIN_EMAIL/GARMIN_PASSWORD env vars instead.${RESET}"
read -p " Garmin email (or Enter to skip): " GARMIN_EMAIL
if [ -n "$GARMIN_EMAIL" ]; then
read -s -p " Garmin password: " GARMIN_PASSWORD
echo ""
fi
fi
cat > config.yaml <<EOF
# health-engine config — $(date +%Y-%m-%d)
# This file is gitignored. Your data stays local.
profile:
age: ${AGE}
sex: ${SEX}
targets:
weight_lbs: ${TARGET_WEIGHT:-""}
protein_g: ${TARGET_PROTEIN:-""}
calories_training: ${CAL_TRAINING:-""}
calories_rest: ${CAL_REST:-""}
garmin:
email: "${GARMIN_EMAIL}"
password: "${GARMIN_PASSWORD}"
token_dir: ~/.config/health-engine/garmin-tokens
data_dir: ./data
exercise_name_map:
barbell deadlift: deadlift
sumo deadlift: deadlift
deadlift: deadlift
barbell bench press: bench_press
dumbbell bench press: bench_press
bench press: bench_press
barbell back squat: squat
back squat: squat
belt squat: squat
squat: squat
barbell squat: squat
insights:
thresholds_file: engine/insights/rules.yaml
EOF
echo -e " ${GREEN}config.yaml created${RESET}"
fi
# ── Step 4: Create data directory ──
mkdir -p data
echo -e " ${GREEN}data/ directory ready${RESET}"
# ── Step 5: Verify ──
echo ""
echo -e "${BOLD} Verifying installation...${RESET}"
python3 -c "from engine.scoring.engine import score_profile; print(' ✓ Scoring engine')"
python3 -c "from engine.insights.engine import generate_insights; print(' ✓ Insights engine')"
python3 -c "from engine.tracking.weight import rolling_average; print(' ✓ Tracking utilities')"
if [[ "$GARMIN_INSTALL" =~ ^[Yy] ]]; then
python3 -c "from engine.integrations.garmin import GarminClient; print(' ✓ Garmin integration')"
fi
TEST_RESULT=$(python3 -m pytest tests/ -q 2>&1 | tail -1)
echo " ✓ Tests: $TEST_RESULT"
# ── Done ──
echo ""
echo -e "${BOLD}${GREEN} Setup complete!${RESET}"
echo ""
echo -e " ${CYAN}Try these next:${RESET}"
echo ""
echo " python3 cli.py score # Score your profile (gaps only)"
echo " python3 cli.py score --profile tests/fixtures/sample_profile.json # Score sample data"
echo " python3 cli.py status # Check what data you have"
if [[ "$GARMIN_INSTALL" =~ ^[Yy] ]] && [ -n "$GARMIN_EMAIL" ]; then
echo " python3 cli.py pull garmin # Pull your Garmin data"
echo " python3 cli.py insights # Generate insights from Garmin data"
fi
echo ""
echo -e " ${DIM}Using Claude Code? Just open this directory and ask Claude anything.${RESET}"
echo -e " ${DIM}The CLAUDE.md file gives it full project context.${RESET}"
echo ""