@thebriangao/totem 1.4.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dev.vars.example +5 -0
- package/.dockerignore +5 -0
- package/.env.example +29 -20
- package/CHANGELOG.md +99 -1
- package/CONTRIBUTING.md +48 -116
- package/Dockerfile +46 -12
- package/README.md +172 -498
- package/SECURITY.md +36 -59
- package/TOOLS.md +448 -311
- package/WHOOP.md +497 -2659
- package/assets/brand/SOURCES.md +38 -0
- package/assets/brand/totem.png +0 -0
- package/assets/brand/totem.svg +13 -0
- package/assets/fonts/Manrope-OFL.txt +93 -0
- package/assets/fonts/manrope-latin.woff2 +0 -0
- package/dist/build_info.js +5 -0
- package/dist/build_info.js.map +1 -0
- package/dist/cli/app.js +675 -0
- package/dist/cli/app.js.map +1 -0
- package/dist/cli/auth.js +297 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/auth_flow.js +268 -0
- package/dist/cli/auth_flow.js.map +1 -0
- package/dist/cli/browser_login.js +368 -0
- package/dist/cli/browser_login.js.map +1 -0
- package/dist/cli/clients.js +403 -0
- package/dist/cli/clients.js.map +1 -0
- package/dist/cli/deploy_record.js +96 -0
- package/dist/cli/deploy_record.js.map +1 -0
- package/dist/cli/index.js +39 -575
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/links.js +28 -0
- package/dist/cli/links.js.map +1 -0
- package/dist/cli/logo.js +63 -0
- package/dist/cli/logo.js.map +1 -0
- package/dist/cli/setup.js +1157 -1017
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/spawn.js +80 -0
- package/dist/cli/spawn.js.map +1 -0
- package/dist/cli/sys.js +219 -0
- package/dist/cli/sys.js.map +1 -0
- package/dist/cli/ui.js +712 -463
- package/dist/cli/ui.js.map +1 -1
- package/dist/cli/update.js +425 -282
- package/dist/cli/update.js.map +1 -1
- package/dist/cloudflare/token_store.js +48 -0
- package/dist/cloudflare/token_store.js.map +1 -0
- package/dist/cloudflare/worker.js +155 -0
- package/dist/cloudflare/worker.js.map +1 -0
- package/dist/data/behaviors.js +2733 -617
- package/dist/data/behaviors.js.map +1 -1
- package/dist/data/endpoint_catalog.js +2681 -0
- package/dist/data/endpoint_catalog.js.map +1 -0
- package/dist/data/exercises.js +373 -4859
- package/dist/data/exercises.js.map +1 -1
- package/dist/data/garments.js +19 -0
- package/dist/data/garments.js.map +1 -0
- package/dist/data/sports.js +219 -208
- package/dist/data/sports.js.map +1 -1
- package/dist/lib/activity_list.js +123 -0
- package/dist/lib/activity_list.js.map +1 -0
- package/dist/lib/activity_records.js +195 -0
- package/dist/lib/activity_records.js.map +1 -0
- package/dist/lib/activity_results.js +44 -0
- package/dist/lib/activity_results.js.map +1 -0
- package/dist/lib/activity_types.js +164 -0
- package/dist/lib/activity_types.js.map +1 -0
- package/dist/lib/brand.js +63 -0
- package/dist/lib/brand.js.map +1 -0
- package/dist/lib/clock.js +24 -0
- package/dist/lib/clock.js.map +1 -0
- package/dist/lib/coach_session.js +345 -0
- package/dist/lib/coach_session.js.map +1 -0
- package/dist/lib/concurrency.js.map +1 -1
- package/dist/lib/dates.js +19 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/env_file.js +195 -0
- package/dist/lib/env_file.js.map +1 -0
- package/dist/lib/health_plans_write.js +44 -0
- package/dist/lib/health_plans_write.js.map +1 -0
- package/dist/lib/heart_rate.js +34 -0
- package/dist/lib/heart_rate.js.map +1 -0
- package/dist/lib/highlight.js +81 -0
- package/dist/lib/highlight.js.map +1 -0
- package/dist/lib/install_links.js +47 -0
- package/dist/lib/install_links.js.map +1 -0
- package/dist/lib/instant.js +50 -0
- package/dist/lib/instant.js.map +1 -0
- package/dist/lib/journal_behaviors.js +382 -0
- package/dist/lib/journal_behaviors.js.map +1 -0
- package/dist/lib/lift_catalog.js +218 -0
- package/dist/lib/lift_catalog.js.map +1 -0
- package/dist/lib/lift_history.js +66 -0
- package/dist/lib/lift_history.js.map +1 -0
- package/dist/lib/lift_sets.js +146 -0
- package/dist/lib/lift_sets.js.map +1 -0
- package/dist/lib/lift_tool.js +20 -0
- package/dist/lib/lift_tool.js.map +1 -0
- package/dist/lib/profile_settings.js +101 -0
- package/dist/lib/profile_settings.js.map +1 -0
- package/dist/lib/screen_content.js +44 -0
- package/dist/lib/screen_content.js.map +1 -0
- package/dist/lib/timezone.js +48 -6
- package/dist/lib/timezone.js.map +1 -1
- package/dist/lib/walk.js +6 -1
- package/dist/lib/walk.js.map +1 -1
- package/dist/lib/weight_readings.js +61 -0
- package/dist/lib/weight_readings.js.map +1 -0
- package/dist/projections/activities.js +193 -0
- package/dist/projections/activities.js.map +1 -0
- package/dist/projections/alarm_schedule.js +102 -0
- package/dist/projections/alarm_schedule.js.map +1 -0
- package/dist/projections/coach.js +203 -0
- package/dist/projections/coach.js.map +1 -0
- package/dist/projections/community.js +165 -0
- package/dist/projections/community.js.map +1 -0
- package/dist/projections/health_features.js +167 -0
- package/dist/projections/health_features.js.map +1 -0
- package/dist/projections/hormonal_insights.js +239 -0
- package/dist/projections/hormonal_insights.js.map +1 -0
- package/dist/projections/journal_v2.js +157 -0
- package/dist/projections/journal_v2.js.map +1 -0
- package/dist/projections/lift_cards.js +115 -0
- package/dist/projections/lift_cards.js.map +1 -0
- package/dist/projections/lift_exercise_v2.js +131 -0
- package/dist/projections/lift_exercise_v2.js.map +1 -0
- package/dist/projections/lift_library_v2.js +67 -0
- package/dist/projections/lift_library_v2.js.map +1 -0
- package/dist/projections/lift_sessions.js +211 -0
- package/dist/projections/lift_sessions.js.map +1 -0
- package/dist/projections/memory.js +95 -0
- package/dist/projections/memory.js.map +1 -0
- package/dist/projections/milestones.js +119 -0
- package/dist/projections/milestones.js.map +1 -0
- package/dist/projections/profile_v2.js +150 -0
- package/dist/projections/profile_v2.js.map +1 -0
- package/dist/projections/settings_v2.js +153 -0
- package/dist/projections/settings_v2.js.map +1 -0
- package/dist/projections/sleep.js +4 -21
- package/dist/projections/sleep.js.map +1 -1
- package/dist/projections/v2/calendar.js +43 -0
- package/dist/projections/v2/calendar.js.map +1 -0
- package/dist/projections/v2/core_common.js +86 -0
- package/dist/projections/v2/core_common.js.map +1 -0
- package/dist/projections/v2/core_home.js +136 -0
- package/dist/projections/v2/core_home.js.map +1 -0
- package/dist/projections/v2/core_sleep_need.js +23 -0
- package/dist/projections/v2/core_sleep_need.js.map +1 -0
- package/dist/projections/v2/day.js +92 -0
- package/dist/projections/v2/day.js.map +1 -0
- package/dist/projections/v2/heart_rate.js +54 -0
- package/dist/projections/v2/heart_rate.js.map +1 -0
- package/dist/projections/v2/history.js +140 -0
- package/dist/projections/v2/history.js.map +1 -0
- package/dist/projections/v2/now.js +39 -0
- package/dist/projections/v2/now.js.map +1 -0
- package/dist/projections/v2/recovery.js +77 -0
- package/dist/projections/v2/recovery.js.map +1 -0
- package/dist/projections/v2/sleep.js +218 -0
- package/dist/projections/v2/sleep.js.map +1 -0
- package/dist/projections/v2/strain.js +39 -0
- package/dist/projections/v2/strain.js.map +1 -0
- package/dist/projections/v2/stress.js +92 -0
- package/dist/projections/v2/stress.js.map +1 -0
- package/dist/projections/v2/trend.js +205 -0
- package/dist/projections/v2/trend.js.map +1 -0
- package/dist/projections/weekly_plan.js +66 -0
- package/dist/projections/weekly_plan.js.map +1 -0
- package/dist/projections/weight_readings.js +57 -0
- package/dist/projections/weight_readings.js.map +1 -0
- package/dist/projections/workout.js +37 -15
- package/dist/projections/workout.js.map +1 -1
- package/dist/schemas/activities.js +123 -0
- package/dist/schemas/activities.js.map +1 -0
- package/dist/schemas/alarm_schedule.js +62 -0
- package/dist/schemas/alarm_schedule.js.map +1 -0
- package/dist/schemas/coach.js +76 -8
- package/dist/schemas/coach.js.map +1 -1
- package/dist/schemas/community.js +70 -0
- package/dist/schemas/community.js.map +1 -0
- package/dist/schemas/health.js +36 -0
- package/dist/schemas/health.js.map +1 -0
- package/dist/schemas/hormonal_insights.js +90 -0
- package/dist/schemas/hormonal_insights.js.map +1 -0
- package/dist/schemas/journal.js +4 -0
- package/dist/schemas/journal.js.map +1 -1
- package/dist/schemas/journal_v2.js +106 -0
- package/dist/schemas/journal_v2.js.map +1 -0
- package/dist/schemas/memory.js +42 -0
- package/dist/schemas/memory.js.map +1 -0
- package/dist/schemas/milestones.js +39 -0
- package/dist/schemas/milestones.js.map +1 -0
- package/dist/schemas/profile_v2.js +60 -0
- package/dist/schemas/profile_v2.js.map +1 -0
- package/dist/schemas/settings_v2.js +56 -0
- package/dist/schemas/settings_v2.js.map +1 -0
- package/dist/schemas/sleep.js +8 -1
- package/dist/schemas/sleep.js.map +1 -1
- package/dist/schemas/strength.js +10 -1
- package/dist/schemas/strength.js.map +1 -1
- package/dist/schemas/strength_v2.js +190 -0
- package/dist/schemas/strength_v2.js.map +1 -0
- package/dist/schemas/v2/calendar.js +8 -0
- package/dist/schemas/v2/calendar.js.map +1 -0
- package/dist/schemas/v2/core_common.js +42 -0
- package/dist/schemas/v2/core_common.js.map +1 -0
- package/dist/schemas/v2/day.js +73 -0
- package/dist/schemas/v2/day.js.map +1 -0
- package/dist/schemas/v2/now.js +25 -0
- package/dist/schemas/v2/now.js.map +1 -0
- package/dist/schemas/v2/recovery.js +35 -0
- package/dist/schemas/v2/recovery.js.map +1 -0
- package/dist/schemas/v2/sleep.js +44 -0
- package/dist/schemas/v2/sleep.js.map +1 -0
- package/dist/schemas/v2/strain.js +16 -0
- package/dist/schemas/v2/strain.js.map +1 -0
- package/dist/schemas/v2/stress.js +20 -0
- package/dist/schemas/v2/stress.js.map +1 -0
- package/dist/schemas/v2/trend.js +42 -0
- package/dist/schemas/v2/trend.js.map +1 -0
- package/dist/schemas/weekly_plan.js +31 -0
- package/dist/schemas/weekly_plan.js.map +1 -0
- package/dist/schemas/weight.js +28 -0
- package/dist/schemas/weight.js.map +1 -0
- package/dist/scripts/build_behaviors.js +114 -0
- package/dist/scripts/build_behaviors.js.map +1 -0
- package/dist/scripts/cognito_bootstrap.js +9 -277
- package/dist/scripts/cognito_bootstrap.js.map +1 -1
- package/dist/scripts/gen_activity_catalogs.js +104 -0
- package/dist/scripts/gen_activity_catalogs.js.map +1 -0
- package/dist/server-admin.js +156 -0
- package/dist/server-admin.js.map +1 -0
- package/dist/server-http.js +270 -48
- package/dist/server-http.js.map +1 -1
- package/dist/server.js +136 -23
- package/dist/server.js.map +1 -1
- package/dist/tools/annotations.js +15 -0
- package/dist/tools/annotations.js.map +1 -0
- package/dist/tools/define.js +31 -0
- package/dist/tools/define.js.map +1 -0
- package/dist/tools/register.js +59 -94
- package/dist/tools/register.js.map +1 -1
- package/dist/tools/resources.js +70 -0
- package/dist/tools/resources.js.map +1 -0
- package/dist/tools/slim_schema.js +90 -0
- package/dist/tools/slim_schema.js.map +1 -0
- package/dist/tools/v2/activity_delete.js +63 -17
- package/dist/tools/v2/activity_delete.js.map +1 -1
- package/dist/tools/v2/activity_edit.js +396 -0
- package/dist/tools/v2/activity_edit.js.map +1 -0
- package/dist/tools/v2/activity_log.js +152 -0
- package/dist/tools/v2/activity_log.js.map +1 -0
- package/dist/tools/v2/calendar.js +19 -21
- package/dist/tools/v2/calendar.js.map +1 -1
- package/dist/tools/v2/coach_ask.js +74 -110
- package/dist/tools/v2/coach_ask.js.map +1 -1
- package/dist/tools/v2/coach_history.js +120 -0
- package/dist/tools/v2/coach_history.js.map +1 -0
- package/dist/tools/v2/community.js +124 -0
- package/dist/tools/v2/community.js.map +1 -0
- package/dist/tools/v2/cycle.js +63 -15
- package/dist/tools/v2/cycle.js.map +1 -1
- package/dist/tools/v2/cycle_log.js +289 -32
- package/dist/tools/v2/cycle_log.js.map +1 -1
- package/dist/tools/v2/day.js +126 -24
- package/dist/tools/v2/day.js.map +1 -1
- package/dist/tools/v2/health.js +116 -0
- package/dist/tools/v2/health.js.map +1 -0
- package/dist/tools/v2/hr_zones_set.js +134 -34
- package/dist/tools/v2/hr_zones_set.js.map +1 -1
- package/dist/tools/v2/journal.js +75 -17
- package/dist/tools/v2/journal.js.map +1 -1
- package/dist/tools/v2/journal_log.js +306 -65
- package/dist/tools/v2/journal_log.js.map +1 -1
- package/dist/tools/v2/lift_exercise.js +125 -22
- package/dist/tools/v2/lift_exercise.js.map +1 -1
- package/dist/tools/v2/lift_exercise_set.js +291 -0
- package/dist/tools/v2/lift_exercise_set.js.map +1 -0
- package/dist/tools/v2/lift_library.js +51 -12
- package/dist/tools/v2/lift_library.js.map +1 -1
- package/dist/tools/v2/lift_log.js +309 -72
- package/dist/tools/v2/lift_log.js.map +1 -1
- package/dist/tools/v2/lift_sessions.js +248 -0
- package/dist/tools/v2/lift_sessions.js.map +1 -0
- package/dist/tools/v2/lift_template.js +232 -0
- package/dist/tools/v2/lift_template.js.map +1 -0
- package/dist/tools/v2/memory.js +45 -0
- package/dist/tools/v2/memory.js.map +1 -0
- package/dist/tools/v2/memory_set.js +107 -0
- package/dist/tools/v2/memory_set.js.map +1 -0
- package/dist/tools/v2/milestones.js +50 -0
- package/dist/tools/v2/milestones.js.map +1 -0
- package/dist/tools/v2/now.js +49 -0
- package/dist/tools/v2/now.js.map +1 -0
- package/dist/tools/v2/preferences.js +51 -0
- package/dist/tools/v2/preferences.js.map +1 -0
- package/dist/tools/v2/preferences_set.js +388 -0
- package/dist/tools/v2/preferences_set.js.map +1 -0
- package/dist/tools/v2/profile.js +54 -22
- package/dist/tools/v2/profile.js.map +1 -1
- package/dist/tools/v2/profile_update.js +167 -55
- package/dist/tools/v2/profile_update.js.map +1 -1
- package/dist/tools/v2/raw.js +91 -34
- package/dist/tools/v2/raw.js.map +1 -1
- package/dist/tools/v2/recovery.js +37 -23
- package/dist/tools/v2/recovery.js.map +1 -1
- package/dist/tools/v2/sleep.js +52 -16
- package/dist/tools/v2/sleep.js.map +1 -1
- package/dist/tools/v2/smart_alarm.js +54 -20
- package/dist/tools/v2/smart_alarm.js.map +1 -1
- package/dist/tools/v2/smart_alarm_set.js +264 -86
- package/dist/tools/v2/smart_alarm_set.js.map +1 -1
- package/dist/tools/v2/strain.js +15 -15
- package/dist/tools/v2/strain.js.map +1 -1
- package/dist/tools/v2/stress.js +17 -15
- package/dist/tools/v2/stress.js.map +1 -1
- package/dist/tools/v2/trend.js +56 -20
- package/dist/tools/v2/trend.js.map +1 -1
- package/dist/tools/v2/weekly_plan.js +30 -0
- package/dist/tools/v2/weekly_plan.js.map +1 -0
- package/dist/tools/v2/weekly_plan_set.js +134 -0
- package/dist/tools/v2/weekly_plan_set.js.map +1 -0
- package/dist/tools/v2/weight.js +56 -0
- package/dist/tools/v2/weight.js.map +1 -0
- package/dist/tools/v2/weight_log.js +188 -0
- package/dist/tools/v2/weight_log.js.map +1 -0
- package/dist/tools/v2/workouts.js +159 -25
- package/dist/tools/v2/workouts.js.map +1 -1
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/whoop/bff.js +94 -0
- package/dist/whoop/bff.js.map +1 -0
- package/dist/whoop/client.js +392 -18
- package/dist/whoop/client.js.map +1 -1
- package/dist/whoop/cognito.js +106 -79
- package/dist/whoop/cognito.js.map +1 -1
- package/dist/whoop/connect_page.js +165 -0
- package/dist/whoop/connect_page.js.map +1 -0
- package/dist/whoop/consent_font.js +287 -0
- package/dist/whoop/consent_font.js.map +1 -0
- package/dist/whoop/consent_logos.js +22 -0
- package/dist/whoop/consent_logos.js.map +1 -0
- package/dist/whoop/consent_page.js +291 -0
- package/dist/whoop/consent_page.js.map +1 -0
- package/dist/whoop/constants.js +5 -1
- package/dist/whoop/constants.js.map +1 -1
- package/dist/whoop/device.js +4 -4
- package/dist/whoop/device.js.map +1 -1
- package/dist/whoop/errors.js +85 -4
- package/dist/whoop/errors.js.map +1 -1
- package/dist/whoop/init_timezone.js +57 -17
- package/dist/whoop/init_timezone.js.map +1 -1
- package/dist/whoop/installation.js +15 -10
- package/dist/whoop/installation.js.map +1 -1
- package/dist/whoop/json_out.js +52 -6
- package/dist/whoop/json_out.js.map +1 -1
- package/dist/whoop/oauth_provider.js +81 -78
- package/dist/whoop/oauth_provider.js.map +1 -1
- package/dist/whoop/token_lock.js +331 -0
- package/dist/whoop/token_lock.js.map +1 -0
- package/dist/whoop/token_manager.js +536 -42
- package/dist/whoop/token_manager.js.map +1 -1
- package/dist/whoop/token_store.js +303 -36
- package/dist/whoop/token_store.js.map +1 -1
- package/dist/whoop/units.js +28 -0
- package/dist/whoop/units.js.map +1 -0
- package/package.json +29 -13
- package/scripts/build-mcpb.mjs +72 -0
- package/scripts/embed-consent-font.mjs +34 -0
- package/scripts/readme-media.ts +195 -0
- package/scripts/tools-md.ts +89 -0
- package/scripts/whoop-md.ts +119 -0
- package/src/build_info.ts +4 -0
- package/src/cli/app.ts +696 -0
- package/src/cli/auth.ts +350 -0
- package/src/cli/auth_flow.ts +356 -0
- package/src/cli/browser_login.ts +402 -0
- package/src/cli/clients.ts +467 -0
- package/src/cli/deploy_record.ts +100 -0
- package/src/cli/index.ts +41 -583
- package/src/cli/links.ts +43 -0
- package/src/cli/logo.ts +64 -0
- package/src/cli/setup.ts +1147 -979
- package/src/cli/spawn.ts +88 -0
- package/src/cli/sys.ts +267 -0
- package/src/cli/ui.ts +778 -436
- package/src/cli/update.ts +436 -274
- package/src/cloudflare/runtime.d.ts +27 -0
- package/src/cloudflare/token_store.ts +57 -0
- package/src/cloudflare/worker.ts +174 -0
- package/src/data/behaviors.ts +2760 -622
- package/src/data/endpoint_catalog.ts +2695 -0
- package/src/data/exercises.ts +379 -4861
- package/src/data/garments.ts +28 -0
- package/src/data/sports.ts +239 -211
- package/src/lib/activity_list.ts +150 -0
- package/src/lib/activity_records.ts +213 -0
- package/src/lib/activity_results.ts +51 -0
- package/src/lib/activity_types.ts +176 -0
- package/src/lib/brand.ts +71 -0
- package/src/lib/clock.ts +16 -0
- package/src/lib/coach_session.ts +434 -0
- package/src/lib/dates.ts +18 -0
- package/src/lib/env_file.ts +191 -0
- package/src/lib/health_plans_write.ts +53 -0
- package/src/lib/heart_rate.ts +42 -0
- package/src/lib/highlight.ts +71 -0
- package/src/lib/install_links.ts +61 -0
- package/src/lib/instant.ts +54 -0
- package/src/lib/journal_behaviors.ts +453 -0
- package/src/lib/lift_catalog.ts +258 -0
- package/src/lib/lift_history.ts +75 -0
- package/src/lib/lift_sets.ts +164 -0
- package/src/lib/lift_tool.ts +25 -0
- package/src/lib/profile_settings.ts +102 -0
- package/src/lib/screen_content.ts +40 -0
- package/src/lib/timezone.ts +44 -8
- package/src/lib/walk.ts +4 -1
- package/src/lib/weight_readings.ts +82 -0
- package/src/projections/activities.ts +199 -0
- package/src/projections/alarm_schedule.ts +98 -0
- package/src/projections/coach.ts +218 -0
- package/src/projections/community.ts +187 -0
- package/src/projections/health_features.ts +191 -0
- package/src/projections/hormonal_insights.ts +277 -0
- package/src/projections/journal_v2.ts +173 -0
- package/src/projections/lift_cards.ts +131 -0
- package/src/projections/lift_exercise_v2.ts +147 -0
- package/src/projections/lift_library_v2.ts +77 -0
- package/src/projections/lift_sessions.ts +250 -0
- package/src/projections/memory.ts +100 -0
- package/src/projections/milestones.ts +133 -0
- package/src/projections/profile_v2.ts +166 -0
- package/src/projections/settings_v2.ts +179 -0
- package/src/projections/sleep.ts +7 -21
- package/src/projections/v2/calendar.ts +48 -0
- package/src/projections/v2/core_common.ts +95 -0
- package/src/projections/v2/core_home.ts +177 -0
- package/src/projections/v2/core_sleep_need.ts +37 -0
- package/src/projections/v2/day.ts +162 -0
- package/src/projections/v2/heart_rate.ts +73 -0
- package/src/projections/v2/history.ts +153 -0
- package/src/projections/v2/now.ts +59 -0
- package/src/projections/v2/recovery.ts +120 -0
- package/src/projections/v2/sleep.ts +281 -0
- package/src/projections/v2/strain.ts +63 -0
- package/src/projections/v2/stress.ts +111 -0
- package/src/projections/v2/trend.ts +242 -0
- package/src/projections/weekly_plan.ts +79 -0
- package/src/projections/weight_readings.ts +57 -0
- package/src/projections/workout.ts +36 -17
- package/src/schemas/activities.ts +136 -0
- package/src/schemas/alarm_schedule.ts +70 -0
- package/src/schemas/coach.ts +98 -8
- package/src/schemas/community.ts +77 -0
- package/src/schemas/health.ts +36 -0
- package/src/schemas/hormonal_insights.ts +108 -0
- package/src/schemas/journal.ts +4 -0
- package/src/schemas/journal_v2.ts +112 -0
- package/src/schemas/memory.ts +48 -0
- package/src/schemas/milestones.ts +48 -0
- package/src/schemas/profile_v2.ts +63 -0
- package/src/schemas/settings_v2.ts +63 -0
- package/src/schemas/sleep.ts +9 -1
- package/src/schemas/strength.ts +10 -1
- package/src/schemas/strength_v2.ts +210 -0
- package/src/schemas/v2/calendar.ts +8 -0
- package/src/schemas/v2/core_common.ts +50 -0
- package/src/schemas/v2/day.ts +79 -0
- package/src/schemas/v2/now.ts +25 -0
- package/src/schemas/v2/recovery.ts +38 -0
- package/src/schemas/v2/sleep.ts +46 -0
- package/src/schemas/v2/strain.ts +16 -0
- package/src/schemas/v2/stress.ts +20 -0
- package/src/schemas/v2/trend.ts +45 -0
- package/src/schemas/weekly_plan.ts +36 -0
- package/src/schemas/weight.ts +53 -0
- package/src/scripts/build_behaviors.ts +116 -0
- package/src/scripts/cognito_bootstrap.ts +10 -249
- package/src/scripts/gen_activity_catalogs.ts +121 -0
- package/src/server-admin.ts +171 -0
- package/src/server-http.ts +290 -53
- package/src/server.ts +130 -26
- package/src/tools/annotations.ts +25 -0
- package/src/tools/define.ts +53 -0
- package/src/tools/register.ts +64 -94
- package/src/tools/resources.ts +92 -0
- package/src/tools/slim_schema.ts +102 -0
- package/src/tools/v2/activity_delete.ts +61 -23
- package/src/tools/v2/activity_edit.ts +378 -0
- package/src/tools/v2/activity_log.ts +154 -0
- package/src/tools/v2/calendar.ts +22 -21
- package/src/tools/v2/coach_ask.ts +83 -119
- package/src/tools/v2/coach_history.ts +140 -0
- package/src/tools/v2/community.ts +137 -0
- package/src/tools/v2/cycle.ts +78 -20
- package/src/tools/v2/cycle_log.ts +291 -40
- package/src/tools/v2/day.ts +126 -25
- package/src/tools/v2/health.ts +114 -0
- package/src/tools/v2/hr_zones_set.ts +132 -45
- package/src/tools/v2/journal.ts +78 -23
- package/src/tools/v2/journal_log.ts +321 -69
- package/src/tools/v2/lift_exercise.ts +135 -27
- package/src/tools/v2/lift_exercise_set.ts +272 -0
- package/src/tools/v2/lift_library.ts +57 -21
- package/src/tools/v2/lift_log.ts +325 -83
- package/src/tools/v2/lift_sessions.ts +255 -0
- package/src/tools/v2/lift_template.ts +229 -0
- package/src/tools/v2/memory.ts +54 -0
- package/src/tools/v2/memory_set.ts +110 -0
- package/src/tools/v2/milestones.ts +59 -0
- package/src/tools/v2/now.ts +61 -0
- package/src/tools/v2/preferences.ts +61 -0
- package/src/tools/v2/preferences_set.ts +403 -0
- package/src/tools/v2/profile.ts +56 -26
- package/src/tools/v2/profile_update.ts +151 -60
- package/src/tools/v2/raw.ts +89 -36
- package/src/tools/v2/recovery.ts +44 -25
- package/src/tools/v2/sleep.ts +57 -18
- package/src/tools/v2/smart_alarm.ts +62 -24
- package/src/tools/v2/smart_alarm_set.ts +240 -90
- package/src/tools/v2/strain.ts +19 -16
- package/src/tools/v2/stress.ts +22 -17
- package/src/tools/v2/trend.ts +58 -20
- package/src/tools/v2/weekly_plan.ts +38 -0
- package/src/tools/v2/weekly_plan_set.ts +132 -0
- package/src/tools/v2/weight.ts +61 -0
- package/src/tools/v2/weight_log.ts +193 -0
- package/src/tools/v2/workouts.ts +156 -26
- package/src/version.ts +5 -0
- package/src/whoop/bff.ts +84 -0
- package/src/whoop/client.ts +448 -18
- package/src/whoop/cognito.ts +110 -99
- package/src/whoop/connect_page.ts +183 -0
- package/src/whoop/consent_font.ts +289 -0
- package/src/whoop/consent_logos.ts +24 -0
- package/src/whoop/consent_page.ts +326 -0
- package/src/whoop/constants.ts +5 -1
- package/src/whoop/device.ts +4 -4
- package/src/whoop/errors.ts +89 -4
- package/src/whoop/init_timezone.ts +57 -16
- package/src/whoop/installation.ts +16 -7
- package/src/whoop/json_out.ts +51 -6
- package/src/whoop/oauth_provider.ts +84 -91
- package/src/whoop/token_lock.ts +345 -0
- package/src/whoop/token_manager.ts +580 -53
- package/src/whoop/token_store.ts +341 -32
- package/src/whoop/units.ts +35 -0
- package/wrangler.jsonc +17 -0
- package/assets/banner.svg +0 -38
- package/dist/data/endpoints.js +0 -320
- package/dist/data/endpoints.js.map +0 -1
- package/dist/lib/format.js +0 -22
- package/dist/lib/format.js.map +0 -1
- package/dist/lib/stats.js +0 -32
- package/dist/lib/stats.js.map +0 -1
- package/dist/projections/calendar.js +0 -33
- package/dist/projections/calendar.js.map +0 -1
- package/dist/projections/communities.js +0 -105
- package/dist/projections/communities.js.map +0 -1
- package/dist/projections/cycle.js +0 -81
- package/dist/projections/cycle.js.map +0 -1
- package/dist/projections/hr_zones.js +0 -35
- package/dist/projections/hr_zones.js.map +0 -1
- package/dist/projections/journal.js +0 -56
- package/dist/projections/journal.js.map +0 -1
- package/dist/projections/leaderboard.js +0 -37
- package/dist/projections/leaderboard.js.map +0 -1
- package/dist/projections/lift_exercise.js +0 -22
- package/dist/projections/lift_exercise.js.map +0 -1
- package/dist/projections/lift_history.js +0 -133
- package/dist/projections/lift_history.js.map +0 -1
- package/dist/projections/lift_library.js +0 -71
- package/dist/projections/lift_library.js.map +0 -1
- package/dist/projections/lift_progression.js +0 -138
- package/dist/projections/lift_progression.js.map +0 -1
- package/dist/projections/lift_prs.js +0 -20
- package/dist/projections/lift_prs.js.map +0 -1
- package/dist/projections/live_hr.js +0 -19
- package/dist/projections/live_hr.js.map +0 -1
- package/dist/projections/live_state.js +0 -23
- package/dist/projections/live_state.js.map +0 -1
- package/dist/projections/live_stress.js +0 -11
- package/dist/projections/live_stress.js.map +0 -1
- package/dist/projections/performance_assessment.js +0 -15
- package/dist/projections/performance_assessment.js.map +0 -1
- package/dist/projections/profile.js +0 -59
- package/dist/projections/profile.js.map +0 -1
- package/dist/projections/recovery.js +0 -131
- package/dist/projections/recovery.js.map +0 -1
- package/dist/projections/sleep_need.js +0 -32
- package/dist/projections/sleep_need.js.map +0 -1
- package/dist/projections/smart_alarm.js +0 -45
- package/dist/projections/smart_alarm.js.map +0 -1
- package/dist/projections/strain.js +0 -128
- package/dist/projections/strain.js.map +0 -1
- package/dist/projections/stress.js +0 -86
- package/dist/projections/stress.js.map +0 -1
- package/dist/projections/today.js +0 -129
- package/dist/projections/today.js.map +0 -1
- package/dist/projections/trend.js +0 -149
- package/dist/projections/trend.js.map +0 -1
- package/dist/projections/workouts.js +0 -37
- package/dist/projections/workouts.js.map +0 -1
- package/dist/schemas/calendar.js +0 -12
- package/dist/schemas/calendar.js.map +0 -1
- package/dist/schemas/communities.js +0 -51
- package/dist/schemas/communities.js.map +0 -1
- package/dist/schemas/compare.js +0 -15
- package/dist/schemas/compare.js.map +0 -1
- package/dist/schemas/leaderboard.js +0 -25
- package/dist/schemas/leaderboard.js.map +0 -1
- package/dist/schemas/live.js +0 -26
- package/dist/schemas/live.js.map +0 -1
- package/dist/schemas/performance.js +0 -12
- package/dist/schemas/performance.js.map +0 -1
- package/dist/schemas/profile.js +0 -39
- package/dist/schemas/profile.js.map +0 -1
- package/dist/schemas/recovery.js +0 -27
- package/dist/schemas/recovery.js.map +0 -1
- package/dist/schemas/settings.js +0 -26
- package/dist/schemas/settings.js.map +0 -1
- package/dist/schemas/sleep_need.js +0 -15
- package/dist/schemas/sleep_need.js.map +0 -1
- package/dist/schemas/smart_alarm.js +0 -36
- package/dist/schemas/smart_alarm.js.map +0 -1
- package/dist/schemas/strain.js +0 -24
- package/dist/schemas/strain.js.map +0 -1
- package/dist/schemas/stress.js +0 -16
- package/dist/schemas/stress.js.map +0 -1
- package/dist/schemas/today.js +0 -38
- package/dist/schemas/today.js.map +0 -1
- package/dist/schemas/trend.js +0 -50
- package/dist/schemas/trend.js.map +0 -1
- package/dist/schemas/womens_health.js +0 -23
- package/dist/schemas/womens_health.js.map +0 -1
- package/dist/tools/v2/activity_create.js +0 -64
- package/dist/tools/v2/activity_create.js.map +0 -1
- package/dist/tools/v2/behavior_impact.js +0 -36
- package/dist/tools/v2/behavior_impact.js.map +0 -1
- package/dist/tools/v2/communities.js +0 -60
- package/dist/tools/v2/communities.js.map +0 -1
- package/dist/tools/v2/compare.js +0 -67
- package/dist/tools/v2/compare.js.map +0 -1
- package/dist/tools/v2/endpoints.js +0 -28
- package/dist/tools/v2/endpoints.js.map +0 -1
- package/dist/tools/v2/hidden_metric.js +0 -28
- package/dist/tools/v2/hidden_metric.js.map +0 -1
- package/dist/tools/v2/hr_zones.js +0 -24
- package/dist/tools/v2/hr_zones.js.map +0 -1
- package/dist/tools/v2/journal_autopop.js +0 -19
- package/dist/tools/v2/journal_autopop.js.map +0 -1
- package/dist/tools/v2/journal_catalog.js +0 -44
- package/dist/tools/v2/journal_catalog.js.map +0 -1
- package/dist/tools/v2/leaderboard.js +0 -79
- package/dist/tools/v2/leaderboard.js.map +0 -1
- package/dist/tools/v2/lift_catalog.js +0 -47
- package/dist/tools/v2/lift_catalog.js.map +0 -1
- package/dist/tools/v2/lift_custom_exercise.js +0 -108
- package/dist/tools/v2/lift_custom_exercise.js.map +0 -1
- package/dist/tools/v2/lift_history.js +0 -39
- package/dist/tools/v2/lift_history.js.map +0 -1
- package/dist/tools/v2/lift_progression.js +0 -30
- package/dist/tools/v2/lift_progression.js.map +0 -1
- package/dist/tools/v2/lift_prs.js +0 -21
- package/dist/tools/v2/lift_prs.js.map +0 -1
- package/dist/tools/v2/lift_template_save.js +0 -83
- package/dist/tools/v2/lift_template_save.js.map +0 -1
- package/dist/tools/v2/live_hr.js +0 -21
- package/dist/tools/v2/live_hr.js.map +0 -1
- package/dist/tools/v2/live_state.js +0 -21
- package/dist/tools/v2/live_state.js.map +0 -1
- package/dist/tools/v2/live_stress.js +0 -22
- package/dist/tools/v2/live_stress.js.map +0 -1
- package/dist/tools/v2/performance_assessment.js +0 -38
- package/dist/tools/v2/performance_assessment.js.map +0 -1
- package/dist/tools/v2/sleep_need.js +0 -21
- package/dist/tools/v2/sleep_need.js.map +0 -1
- package/dist/tools/v2/sports_catalog.js +0 -26
- package/dist/tools/v2/sports_catalog.js.map +0 -1
- package/dist/tools/v2/symptom_log.js +0 -72
- package/dist/tools/v2/symptom_log.js.map +0 -1
- package/dist/tools/v2/today.js +0 -30
- package/dist/tools/v2/today.js.map +0 -1
- package/dist/tools/v2/workout.js +0 -23
- package/dist/tools/v2/workout.js.map +0 -1
- package/dist/whoop/build_lift_body.js +0 -67
- package/dist/whoop/build_lift_body.js.map +0 -1
- package/dist/whoop/session_state.js +0 -34
- package/dist/whoop/session_state.js.map +0 -1
- package/dist/whoop/types.js +0 -82
- package/dist/whoop/types.js.map +0 -1
- package/src/data/endpoints.ts +0 -319
- package/src/lib/format.ts +0 -27
- package/src/lib/stats.ts +0 -35
- package/src/projections/calendar.ts +0 -46
- package/src/projections/communities.ts +0 -135
- package/src/projections/cycle.ts +0 -85
- package/src/projections/hr_zones.ts +0 -43
- package/src/projections/journal.ts +0 -55
- package/src/projections/leaderboard.ts +0 -49
- package/src/projections/lift_exercise.ts +0 -29
- package/src/projections/lift_history.ts +0 -140
- package/src/projections/lift_library.ts +0 -70
- package/src/projections/lift_progression.ts +0 -138
- package/src/projections/lift_prs.ts +0 -23
- package/src/projections/live_hr.ts +0 -21
- package/src/projections/live_state.ts +0 -28
- package/src/projections/live_stress.ts +0 -13
- package/src/projections/performance_assessment.ts +0 -19
- package/src/projections/profile.ts +0 -71
- package/src/projections/recovery.ts +0 -133
- package/src/projections/sleep_need.ts +0 -36
- package/src/projections/smart_alarm.ts +0 -70
- package/src/projections/strain.ts +0 -131
- package/src/projections/stress.ts +0 -95
- package/src/projections/today.ts +0 -166
- package/src/projections/trend.ts +0 -149
- package/src/projections/workouts.ts +0 -36
- package/src/schemas/calendar.ts +0 -13
- package/src/schemas/communities.ts +0 -56
- package/src/schemas/compare.ts +0 -17
- package/src/schemas/leaderboard.ts +0 -26
- package/src/schemas/live.ts +0 -31
- package/src/schemas/performance.ts +0 -13
- package/src/schemas/profile.ts +0 -40
- package/src/schemas/recovery.ts +0 -28
- package/src/schemas/settings.ts +0 -30
- package/src/schemas/sleep_need.ts +0 -16
- package/src/schemas/smart_alarm.ts +0 -40
- package/src/schemas/strain.ts +0 -25
- package/src/schemas/stress.ts +0 -17
- package/src/schemas/today.ts +0 -39
- package/src/schemas/trend.ts +0 -53
- package/src/schemas/womens_health.ts +0 -26
- package/src/tools/v2/activity_create.ts +0 -74
- package/src/tools/v2/behavior_impact.ts +0 -39
- package/src/tools/v2/communities.ts +0 -65
- package/src/tools/v2/compare.ts +0 -83
- package/src/tools/v2/endpoints.ts +0 -32
- package/src/tools/v2/hidden_metric.ts +0 -33
- package/src/tools/v2/hr_zones.ts +0 -29
- package/src/tools/v2/journal_autopop.ts +0 -26
- package/src/tools/v2/journal_catalog.ts +0 -48
- package/src/tools/v2/leaderboard.ts +0 -92
- package/src/tools/v2/lift_catalog.ts +0 -48
- package/src/tools/v2/lift_custom_exercise.ts +0 -117
- package/src/tools/v2/lift_history.ts +0 -52
- package/src/tools/v2/lift_progression.ts +0 -34
- package/src/tools/v2/lift_prs.ts +0 -26
- package/src/tools/v2/lift_template_save.ts +0 -89
- package/src/tools/v2/live_hr.ts +0 -26
- package/src/tools/v2/live_state.ts +0 -26
- package/src/tools/v2/live_stress.ts +0 -27
- package/src/tools/v2/performance_assessment.ts +0 -44
- package/src/tools/v2/sleep_need.ts +0 -26
- package/src/tools/v2/sports_catalog.ts +0 -32
- package/src/tools/v2/symptom_log.ts +0 -78
- package/src/tools/v2/today.ts +0 -35
- package/src/tools/v2/workout.ts +0 -28
- package/src/whoop/build_lift_body.ts +0 -84
- package/src/whoop/session_state.ts +0 -41
- package/src/whoop/types.ts +0 -89
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Secrets for totem on Cloudflare (the Deploy to Cloudflare button asks for these).
|
|
2
|
+
# MCP_AUTH_TOKEN: 64 random characters, for example the output of `openssl rand -hex 32`.
|
|
3
|
+
MCP_AUTH_TOKEN=
|
|
4
|
+
# AUTH_PASSWORD: the password you type on totem's sign-in page when a client connects.
|
|
5
|
+
AUTH_PASSWORD=
|
package/.dockerignore
CHANGED
package/.env.example
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
# totem reads this file from the install directory. Everything here is optional.
|
|
2
|
+
#
|
|
3
|
+
# ─── WHOOP login ───────────────────────────────────────────────────────────
|
|
4
|
+
# Run `totem auth`: you log in at whoop.com in a browser window, and totem
|
|
5
|
+
# saves the login to a token file (not this .env). The server refreshes it on
|
|
6
|
+
# its own from then on. No email or password is stored anywhere.
|
|
7
|
+
#
|
|
8
|
+
# Where the token file lives (default ~/.config/totem/tokens.json, or
|
|
9
|
+
# %APPDATA%\totem\tokens.json on Windows; the Docker image uses
|
|
10
|
+
# /data/tokens.json). Only one running totem may refresh a given login, so
|
|
11
|
+
# don't point a local server and a deployment at copies of the same file.
|
|
12
|
+
TOTEM_TOKEN_FILE=
|
|
13
|
+
#
|
|
14
|
+
# How often an idle server refreshes the login anyway, in hours (default 12).
|
|
15
|
+
# It also refreshes whenever less than 10 minutes of access-token life remain.
|
|
16
|
+
TOTEM_KEEPALIVE_HOURS=
|
|
17
|
+
#
|
|
18
|
+
# Browser for `totem auth` (default: the first of Chrome, Chromium, Edge, Brave).
|
|
19
|
+
TOTEM_BROWSER=
|
|
20
|
+
#
|
|
21
|
+
# Upgrading from 1.x: WHOOP_IOS_BEARER_TOKEN / WHOOP_COGNITO_REFRESH_TOKEN are
|
|
22
|
+
# moved into the token file on first start and removed from this file.
|
|
23
|
+
# WHOOP_TOKEN_STORE=memory keeps the login in memory only (local throwaway
|
|
24
|
+
# runs; refused in containers and HTTP deployments).
|
|
11
25
|
|
|
12
|
-
# ─── Generated once on first run
|
|
26
|
+
# ─── Generated once on first run. Do NOT edit. ─────────────────────────────
|
|
13
27
|
# Per-install device id sent as x-whoop-installation-identifier (so requests
|
|
14
|
-
# look like one app install, not a shared constant).
|
|
28
|
+
# look like one app install, not a shared constant). Also kept in the token file.
|
|
15
29
|
WHOOP_INSTALLATION_ID=
|
|
16
30
|
|
|
17
|
-
# ─── Optional: avoids one redundant bootstrap call per session ─────────────
|
|
18
|
-
# Get this from `totem auth` output (or any captured JWT).
|
|
19
|
-
WHOOP_USER_ID=
|
|
20
|
-
|
|
21
31
|
# ─── Timezone for response timestamps ──────────────────────────────────────
|
|
22
32
|
# Whoop returns all timestamps in UTC. The MCP rewrites them with an explicit
|
|
23
33
|
# offset so the AI sees clock-correct local times (e.g.,
|
|
@@ -42,10 +52,9 @@ WHOOP_TIMEZONE=
|
|
|
42
52
|
# MCP_TRANSPORT=http
|
|
43
53
|
# MCP_AUTH_TOKEN=<generate with: openssl rand -hex 32>
|
|
44
54
|
# PORT=3000 # or MCP_HTTP_PORT, default 3000
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
# # WHOOP_INSTALLATION_ID on ephemeral hosts.
|
|
55
|
+
#
|
|
56
|
+
# MCP_AUTH_TOKEN also gates POST /admin/tokens, where `totem auth` pushes the
|
|
57
|
+
# WHOOP login to a deployment.
|
|
49
58
|
#
|
|
50
59
|
# ─── Two ways to authenticate against the HTTP server ──────────────────────
|
|
51
60
|
# 1. Static bearer (MCP_AUTH_TOKEN) — works with Claude Code (--header) and the
|
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,105 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project. Format roughly follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versioning is [SemVer](https://semver.org/).
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [2.0.0] — 2026-11-23
|
|
6
|
+
|
|
7
|
+
v2 is a rebuild against WHOOP's current app API (re-mapped in November 2026), with a new login, a smaller and cheaper tool surface, new hosts and a setup that takes one command.
|
|
8
|
+
|
|
9
|
+
### Upgrading from 1.x
|
|
10
|
+
|
|
11
|
+
- Install with `npm install -g @thebriangao/totem` (a git checkout still works), then run `totem local` or `totem cloud` again.
|
|
12
|
+
- **A git checkout keeps its login:** the old `.env` login is picked up once and moved to `~/.config/totem/tokens.json`. That holds when 1.x's auto-update brings the checkout to 2.0 by itself too, and the apps it set up keep working.
|
|
13
|
+
- **An npm install loses its login:** 1.x kept it in `.env` inside its own package folder, and `npm install -g` replaces that folder, `.env` and deploy record included. If totem says there's no WHOOP login after updating, run `totem auth` once.
|
|
14
|
+
- Tool names changed: 55 tools became 41. An app reads the new list on its own; saved prompts that name old tools need the new names ([TOOLS.md](TOOLS.md)).
|
|
15
|
+
- A server deployed by 1.x on Google Cloud Run keeps working with `totem deploy` and `totem logs`, but `totem cloud` no longer creates new ones.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **Browser login.** `totem auth` opens a fresh browser window on WHOOP's own site; you log in there (two-factor included) and totem reads only WHOOP's session cookies. No password is ever stored or typed into totem. `--paste` takes a refresh-token cookie instead.
|
|
20
|
+
- **One durable login.** The login lives in one 0600 token file (or a server's volume, or Cloudflare Durable Object storage). WHOOP replaces the refresh token on every use, so exactly one process owns a login (a lock decides), refreshes it every 12 hours and before it expires, and saves the new token before using it. `totem auth` pushes a login to a deployment over HTTPS.
|
|
21
|
+
- **Cloudflare Workers** as a host, on the free plan: the same server inside one Durable Object, with an alarm that keeps the login fresh. A Deploy to Cloudflare button, and `totem cloud` deploys it with Wrangler.
|
|
22
|
+
- **totem's own logo and colours** (ice `#B7D3F2`, ink `#141414`), the logo always without a background: on the Connect and consent pages (with a favicon), at the top of the README, as the MCP server's icon in apps that show one, as the Claude Desktop extension's icon, and as the CLI's brand colour.
|
|
23
|
+
- **A Connect page** on every server (`/connect`): Add to Claude, Add to Cursor and Add to VS Code buttons filled in with the server's address, and copy-ready steps for every other app.
|
|
24
|
+
- **`totem connect`** finds the AI apps on this computer and sets each up its own way: its config file, its own command, or a link that opens it filled in. Apps: Claude (claude.ai, Desktop, mobile), Claude Code, ChatGPT desktop and Codex, chatgpt.com, Cursor, VS Code, OpenCode 1 and 2, Antigravity.
|
|
25
|
+
- **A Claude Desktop extension** (`totem.mcpb`, attached to every release) that runs on Claude Desktop's own Node.
|
|
26
|
+
- **A container image** on every release, `ghcr.io/thebriangao/totem`, for the Railway template and any Docker host.
|
|
27
|
+
- **Continuous heart rate and a day table.** `whoop_day` returns heart rate every 10 minutes for a day, or a window down to 6-second steps, and a table of up to 180 days of recovery, HRV, RHR, sleep, strain and more in one call.
|
|
28
|
+
- New tools on the current API: `whoop_now`, `whoop_weight` / `whoop_weight_log` (from #35), `whoop_cycle` / `whoop_cycle_log`, `whoop_weekly_plan` / `whoop_weekly_plan_set`, `whoop_milestones`, `whoop_smart_alarm` / `whoop_smart_alarm_set` (from #39), `whoop_memory` / `whoop_memory_set`, `whoop_community`, and Strength Trainer logging with units, templates and 1RM (from #40 and #49).
|
|
29
|
+
- **Routes from WHOOP's Android app**, shared by @Acetone1 in #5 and checked on a test account first: `whoop_activity_edit` can merge activities (`merge`; WHOOP keeps the earliest and deletes the rest), `whoop_calendar` shows which days have a journal entry (`pillar: "journal"`), and `whoop_smart_alarm` gives the wake window and, for goal modes, the earliest time the strap may buzz.
|
|
30
|
+
- **`whoop_health`** for WHOOP's paid health features. Healthspan was checked on a real account that has it: WHOOP Age, years older or younger than your age, pace of aging, the previous week's numbers, and each contributor (sleep, strain, fitness) with its 6 month and 30 day averages and its impact in years. Still **experimental**, because no account we can test with has them: blood pressure insights, AFib history (by day, with paging), and Advanced Labs (biomarkers with results, tests, one biomarker's history or one test's results and insights). Their locked, empty and not-set-up answers are exact; anything filled in comes back with its UI fields stripped and says `experimental: true`. Read-only on purpose; the consent page now lists it.
|
|
31
|
+
- `whoop_raw` can send PATCH.
|
|
32
|
+
- **The consent page names who is asking and where access goes.** A site is named only by the real address access is sent to, so a link that would send your data elsewhere can't call itself Claude. Deny sends the app a refusal.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **41 tools instead of 55, at a fraction of the tokens.** The tool list an app sends on every turn is 35,907 characters (v1: 45,283 for 55 tools), and a default call answers in about 1.5 KB. Lists come as columnar rows; heavy parts are behind `include`.
|
|
37
|
+
- **Every write previews first** and does nothing until `confirm: true`; `whoop_raw` writes also need `allow_write`, with a denylist that can't be bypassed by an odd path.
|
|
38
|
+
- **The `totem` CLI is redesigned**: plain, in the style of gh and fly (numbered steps, ✓ and ✗ results, aligned facts, a Next list, a spinner with elapsed time), with totem's logo at the top of the big flows and one icy palette used only as decoration, ASCII where Unicode can't be trusted, and every failure ends with the command that fixes it. `totem local` and `totem cloud` ask only what a person must decide.
|
|
39
|
+
- **Hosts:** Fly.io (one 512 MB machine in iad, about $4 a month), Cloudflare (free), Railway (named service, volume through Railway's API when its CLI fails, builds watched to the end) and your own Docker host, which now asks the server's address first, writes it into `deploy.env` as `PUBLIC_URL`, takes addresses like `totem.home` or `localhost:3000` (warning when plain http won't reach web apps), and builds with the version so `/health` reports it.
|
|
40
|
+
- `whoop_preferences` lists the dashboard metric keys you can choose from, so `whoop_preferences_set` no longer spells all 30 out in its schema (it still checks them against what WHOOP offers your account).
|
|
41
|
+
- **totem asks before opening a page in your browser.** The Connect page, claude.ai's connector dialog and the Cloudflare and Fly sign-ins show their link in full first: Enter opens it, `n` leaves it to copy into the browser profile you want. A browser with several profiles opens links in the one used last, which may not be signed in to that account. Railway's sign-in already asks. The WHOOP login keeps its own temporary window.
|
|
42
|
+
- Times in answers are in your WHOOP time zone; times you give may omit seconds or the offset (read on your clock).
|
|
43
|
+
- Every dependency upgraded; `npm audit` clean. Node 24 or newer.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- WHOOP's 401 now refreshes the login and retries once; a stalled response body no longer hangs a request; two different queries can't share a cache entry; reads right after a write are never served from before it.
|
|
48
|
+
- The HTTP server answers 404 for an unknown MCP session so apps start a new one, bounds its sessions, never shows a stack trace to an unauthenticated caller, and shuts down cleanly with clients connected.
|
|
49
|
+
- OAuth: an empty password is never accepted, a refresh can't widen a token's scope, a dead grant answers `invalid_grant`, and a non-URL resource can't mint broken tokens.
|
|
50
|
+
- `totem local` never overwrites an app's config it can't read exactly; it keeps a backup whenever it writes. OpenCode configs with comments are handed to OpenCode's own command.
|
|
51
|
+
- Auto-update carries a PATH that finds npm and the host's CLI, goes back to the starting version when an update doesn't finish, and leaves a checkout on another branch alone.
|
|
52
|
+
- End of input is never taken as an answer (`totem cloud < /dev/null` used to say yes to every deploy); secrets go to hosts over stdin or a private temporary file, never a command line, and are blanked in any host output totem shows.
|
|
53
|
+
- `npm pack` from a clean checkout shipped no `dist/`.
|
|
54
|
+
- Many fixes from live runs on a test account across journal, Strength Trainer, coach, cycle, Smart Alarm, sleep, stress and trends; see the commit history for each.
|
|
55
|
+
|
|
56
|
+
### Thanks
|
|
57
|
+
|
|
58
|
+
To everyone whose pull requests and reports shaped v2, including Vladimir Berestnev, Charles White, Ben Tesser, Selçuk Öztürk, k-vasily, chaotix345 and salmonumbrella; to @Acetone1 for the map of WHOOP's Android routes; and to @TotallyKyle for the 1.5.1 report.
|
|
59
|
+
|
|
60
|
+
## [1.5.1] — 2026-09-08
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
|
|
64
|
+
- **`totem auth` / `totem cloud` appeared to hang forever when the Whoop password contained `#`** ([#27](https://github.com/thebriangao/totem/issues/27), reported with a full root-cause write-up by @TotallyKyle). Two bugs stacked. First, `.env` values were written **unquoted**, and dotenv treats an unquoted `#` as the start of an inline comment: `#hunter2` parsed back as `""` and `abc#def` as `abc`, so a correct password produced a `NotAuthorizedException` that looked like a wrong one. Because the fallback was `process.env.X ?? readEnv(X)`, and `??` does not fall through on `""`, the empty value won. Second, the bootstrap's own masked-input helper wrote its prompt and then called `rl.question("")`; readline's line refresh writes `cursorTo(0)` + `clearScreenDown` **directly to the output stream**, bypassing the no-op'd `_writeToOutput` and erasing the prompt — so the process sat waiting at an invisible prompt.
|
|
65
|
+
- New `src/lib/env_file.ts` is now the single reader/writer for `.env`. It parses with `dotenv.parse` (so reads match what the server sees at boot) and serializes each value in the least-noisy form that round-trips exactly: bare when safe, otherwise `'…'`, `"…"`, or `` `…` `` chosen so the quote character cannot appear in the value. Writes update keys in place, preserve comments and unrelated entries, collapse duplicate assignments, and keep the file `0600`.
|
|
66
|
+
- `src/cli/setup.ts`, `src/scripts/cognito_bootstrap.ts`, and `EnvFileTokenStore` all route through it, so every reader and writer agrees.
|
|
67
|
+
- The bootstrap now uses the CLI's existing raw-mode `promptHidden` (terminal echo off, nothing drawn that can be erased) instead of the local helper, opens a readline per prompt so nothing competes for stdin, and uses `||` rather than `??` so an empty value falls through to a **visible** prompt instead of being accepted.
|
|
68
|
+
- This also covered a latent case: `genPassword` includes `#` in its alphabet, so an auto-generated connector password could hit the same mangling.
|
|
69
|
+
- 30 new tests (`tests/lib/env_file.test.ts`, `tests/whoop/token_store.test.ts`) covering round-trips for `#hunter2`, `abc#def`, edge whitespace, quotes, backslashes and empty values, plus in-place update, comment preservation, duplicate collapse, key deletion, and `0600` mode.
|
|
70
|
+
|
|
71
|
+
## [1.5.0] — 2026-08-28
|
|
72
|
+
|
|
73
|
+
A reliability + efficiency pass, landed as a series of focused PRs (#15–#22, #24) reviewed individually. Tool count 49 → **55**; test suite → **278**.
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- **Six compact / aggregate read tools** (`src/schemas/compact.ts`): `whoop_daily_brief` (section-selectable daily context sharing the `today`/`strain`/`sleep_need` reads), `whoop_activity_now` (fresh live snapshot across the never-cached live endpoints, with per-field freshness metadata), `whoop_trend_pack` (up to 5 metrics in one call), `whoop_lift_overview` (recent strength workouts from a single list request), `whoop_preferences` (journal + notification settings), and `whoop_weekly_plan` (**experimental** — its endpoint shape isn't verified against a live account yet, so output is marked `experimental: true` and may be null-heavy). Each validates its output against a per-tool zod schema, so shape drift raises `WhoopProjectionError` like every other tool.
|
|
78
|
+
- **Bounded in-memory read cache** (`src/whoop/client.ts`): a process-local LRU (≤100 entries / ≤10 MiB) that coalesces identical in-flight GETs and caches only completed, non-`pending` responses under explicit per-endpoint TTLs. Live HR / activity state / stress are never retained; every write invalidates the related tags; nothing is persisted or logged. Current-day TTLs: home 30s; activity + sleep-need 60s; recovery/sleep/trends/lifts/journal 5m; calendar 15m; settings 10m (historical dates cached longer). The current-vs-historical split resolves the day in the user's timezone, not the UTC server date.
|
|
79
|
+
- **Live freshness metadata** on `whoop_live_hr` / `whoop_live_state` / `whoop_live_stress` (`fetched_at`, `source_updated_at`, `source_age_ms`, `completed_cache: "bypassed"`).
|
|
80
|
+
- **Build identity in `/health`** (`{status, build}` + `x-totem-build` header) and a boot log line, for unambiguous deployment verification.
|
|
81
|
+
|
|
82
|
+
### Changed
|
|
83
|
+
|
|
84
|
+
- **Removed the session-scoped catalog gate** (`src/whoop/session_state.ts` deleted). It had become inconsistently applied, and the ID-taking write tools now validate an ID — or an **exact bundled catalog name** — locally before any request fires, which is a stronger and uniform guard. `whoop_activity_create`, `whoop_lift_log`, `whoop_lift_exercise`, `whoop_lift_progression`, `whoop_lift_template_save`, `whoop_journal_log`, and `whoop_symptom_log` no longer have a "call the catalog first" prerequisite.
|
|
85
|
+
- **Stricter local write validation**, reported as structured MCP errors instead of opaque upstream 400s: activity duration (≥1 min), HR-zone order/range/overlap, comparison-metric de-duplication, journal empty-replacement guard (`allow_empty_replace`) and per-behavior value shape, and Smart Alarm clock/day validation. Activity, lift, and sleep write times are sent as canonical UTC (the undocumented create endpoints reject offset-form timestamps).
|
|
86
|
+
- **No-op write detection**: identical profile, HR-zone, hidden-metric, Smart Alarm, and sleep-edit requests now return `{ updated/edited: false, no_change: true }` without mutating the account. (`SmartAlarmSetOut` / `SleepEditOut` / settings receipts gained a `no_change` field; `updated`/`edited` are now `boolean`.)
|
|
87
|
+
- **`whoop_coach_ask`** now polls against a true 30-second wall-clock deadline (was up to ~42s from a fixed iteration count) and guards missing conversation/turn IDs.
|
|
88
|
+
- **Smart Alarm projection** reads the current `alarm_on` / `scheduled_days` response fields with a fallback to the legacy `enabled` / `day_of_week_list` shape; human-friendly clock inputs are normalized.
|
|
89
|
+
- **`whoop_calendar`** drops the redundant second request — it uses the recovery endpoint and only falls back to overview on failure.
|
|
90
|
+
|
|
91
|
+
### Fixed
|
|
92
|
+
|
|
93
|
+
- **Timezone hardening**: an invalid `WHOOP_TIMEZONE` is now validated and falls back to the profile/system zone (previously it could throw mid-tool); `wallClockIso` resolves the offset at the represented local instant (DST-correct); `*_utc` output fields are preserved as literal UTC. `whoop_live_stress` freshness timestamps are anchored to the real date instead of `1970-01-01`.
|
|
94
|
+
- **Auth resilience**: the Cognito auth request now has a timeout; a token-persistence failure (read-only FS) no longer crashes a refresh (keeps the fresh in-memory token); blank/duplicate `WHOOP_INSTALLATION_ID` lines are repaired.
|
|
95
|
+
- Sleep-performance projection consistency and hidden-metric state detection.
|
|
96
|
+
|
|
97
|
+
### Dependencies
|
|
98
|
+
|
|
99
|
+
- `@modelcontextprotocol/sdk` `^1.29.0` → `^1.30.0`.
|
|
100
|
+
|
|
101
|
+
### Not included (deliberately)
|
|
102
|
+
|
|
103
|
+
- **OAuth `resource`-claim enforcement** (RFC 8707 audience binding) stays **log-only**. Flipping it to a hard reject risks 401-ing a valid claude.ai token and bricking the web/mobile connector, so it waits until it can be exercised against a live connector.
|
|
6
104
|
|
|
7
105
|
## [1.4.4] — 2026-06-11
|
|
8
106
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
# Contributing to totem
|
|
2
2
|
|
|
3
|
-
Pull requests welcome. The
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Quick orientation
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
src/
|
|
11
|
-
├── server.ts # MCP entry — branches on MCP_TRANSPORT (stdio default, http opt-in)
|
|
12
|
-
├── server-http.ts # Streamable HTTP transport + bearer-token auth gate (since v1.1.0)
|
|
13
|
-
├── whoop/ # Auth + HTTP-client layer (don't break unless you know what you're doing)
|
|
14
|
-
│ ├── client.ts # Outbound HTTP wrapper, error classification, 30s timeout
|
|
15
|
-
│ ├── cognito.ts # Cognito proxy auth (no AWS SDK, no client secret)
|
|
16
|
-
│ ├── token_manager.ts # Auto-refresh, single-flight, persists via TokenStore
|
|
17
|
-
│ ├── token_store.ts # EnvFileTokenStore + MemoryTokenStore (since v1.1.0)
|
|
18
|
-
│ ├── write_safety.ts # preview() + withPreview() helpers
|
|
19
|
-
│ ├── build_lift_body.ts
|
|
20
|
-
│ ├── session_state.ts # In-memory catalog-gate Set
|
|
21
|
-
│ ├── errors.ts, json_out.ts, constants.ts, types.ts
|
|
22
|
-
├── data/ # Auto-generated catalogs (behaviors, exercises, sports, endpoints)
|
|
23
|
-
├── schemas/ # zod schemas for every tool's output (the contract with Claude)
|
|
24
|
-
├── projections/ # Raw API response → flat domain object (one per tool group)
|
|
25
|
-
├── lib/ # walk / dates / format / stats helpers
|
|
26
|
-
└── tools/
|
|
27
|
-
├── register.ts # Wires every tool to the MCP server
|
|
28
|
-
└── v2/ # 48 tool handlers, one per file
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Every tool follows a three-layer pattern: **schema** (defines the output shape) → **projection** (walks the raw API response into that shape) → **tool** (registers it with the MCP server, validates input args, calls the client, runs the projection, returns).
|
|
32
|
-
|
|
33
|
-
See [README.md → Architecture](README.md#architecture) for the full pattern walkthrough. See [README.md → Remote hosting](README.md#remote-hosting) for the HTTP transport architecture (added in v1.1.0).
|
|
34
|
-
|
|
35
|
-
---
|
|
3
|
+
Pull requests are welcome. The code base is small and the tests run in a few seconds.
|
|
36
4
|
|
|
37
5
|
## Setup
|
|
38
6
|
|
|
@@ -40,110 +8,74 @@ See [README.md → Architecture](README.md#architecture) for the full pattern wa
|
|
|
40
8
|
git clone https://github.com/thebriangao/totem.git
|
|
41
9
|
cd totem
|
|
42
10
|
npm install
|
|
43
|
-
npx tsc && npm link
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
totem auth
|
|
47
|
-
totem test # 233 tests, <2s
|
|
48
|
-
totem typecheck
|
|
49
|
-
totem build
|
|
50
|
-
|
|
51
|
-
# stdio mode (default, for local Claude Desktop / Claude Code):
|
|
52
|
-
totem dev
|
|
53
|
-
|
|
54
|
-
# HTTP mode (for remote hosting via Docker/Fly/etc.):
|
|
55
|
-
MCP_AUTH_TOKEN=$(openssl rand -hex 32) totem dev:http
|
|
56
|
-
curl http://localhost:3000/health # → {"status":"ok"}
|
|
11
|
+
npx tsc && npm link # builds once and puts `totem` on your PATH
|
|
12
|
+
totem auth --local # log in to WHOOP (use a test account if you have one)
|
|
13
|
+
totem test
|
|
57
14
|
```
|
|
58
15
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Adding a new tool
|
|
64
|
-
|
|
65
|
-
Walkthrough lives in [README.md → Adding a new tool](README.md#adding-a-new-tool). Short version:
|
|
16
|
+
`totem test`, `totem typecheck` and `totem dev` run from the source, so there is no rebuild while you work. `totem dev --http` starts the HTTP server (set `MCP_AUTH_TOKEN` to 32+ characters first).
|
|
66
17
|
|
|
67
|
-
|
|
68
|
-
2. Add a zod schema in `src/schemas/`.
|
|
69
|
-
3. Add a projection function in `src/projections/`. Tested against captured fixtures in `tests/fixtures/*.json`.
|
|
70
|
-
4. Add a tool file in `src/tools/v2/` (~30 lines: register with the MCP server, parse args, call client, project, validate, return).
|
|
71
|
-
5. Wire it up in `src/tools/register.ts`.
|
|
72
|
-
6. Add a projection test in `tests/projections/`.
|
|
73
|
-
7. `totem typecheck && totem test && totem build`.
|
|
18
|
+
## How the code is laid out
|
|
74
19
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
2.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- May 2026 deep-dive migration: `src/projections/recovery.ts`, `src/projections/strain.ts`. See [Pattern 2b in the endpoints doc](WHOOP.md).
|
|
95
|
-
- Sport-name filter fix: `src/projections/lift_history.ts` — old `/strength/i` regex matched none of `weightlifting_msk` / `weightlifting` / `powerlifting`.
|
|
20
|
+
```
|
|
21
|
+
src/
|
|
22
|
+
├── server.ts stdio entry (what an app starts on your computer)
|
|
23
|
+
├── server-http.ts HTTP entry: MCP, OAuth sign-in, consent and Connect pages, /admin/tokens
|
|
24
|
+
├── cloudflare/ the same server inside a Durable Object (wrangler.jsonc builds it)
|
|
25
|
+
├── whoop/ WHOOP client and login
|
|
26
|
+
│ ├── client.ts requests, errors, the bounded read cache, 401 refresh-and-retry
|
|
27
|
+
│ ├── token_manager.ts one owner per login, keep-alive, rotation saved before use
|
|
28
|
+
│ ├── token_store.ts the token file (and a memory store for tests)
|
|
29
|
+
│ ├── oauth_provider.ts OAuth 2.1 for apps that connect to a server
|
|
30
|
+
│ └── consent_page.ts, connect_page.ts the two pages a person sees
|
|
31
|
+
├── tools/
|
|
32
|
+
│ ├── register.ts the 41 tools, in order
|
|
33
|
+
│ └── v2/ one file per tool
|
|
34
|
+
├── projections/v2/ WHOOP's responses turned into the compact shapes tools return
|
|
35
|
+
├── lib/ dates, time zones, times as tools take them, install links, helpers
|
|
36
|
+
├── data/ catalogs generated from WHOOP (exercises, behaviours, sports, endpoints)
|
|
37
|
+
└── cli/ the `totem` command: setup flows, connect, auth, update, the UI kit
|
|
38
|
+
```
|
|
96
39
|
|
|
97
|
-
|
|
40
|
+
A tool reads from WHOOP through `WhoopClient`, turns the response into a small shape with a projection, and returns it as compact JSON. A tool that writes returns a preview (`will_execute`) unless it gets `confirm: true`, then reads back what it wrote to check it landed.
|
|
98
41
|
|
|
99
|
-
##
|
|
42
|
+
## Rules the tests hold you to
|
|
100
43
|
|
|
101
|
-
-
|
|
102
|
-
- **
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
- **CI runs the same checks on every PR.** `.github/workflows/ci.yml` runs `tsc --noEmit`, the full `vitest` suite, and a build on each push to `main` and each pull request. Run `totem typecheck && totem test && totem build` locally before opening a PR and it'll pass green — nothing reaches `main` (or a merge) without it.
|
|
44
|
+
- **Token budget.** The whole tool list must stay at or under 36,000 characters (`tests/tools/registry.test.ts`), and a default call at about 1.5 KB (`tests/tools/default_output_budget.test.ts`). Every character in a description is paid on every turn of every conversation.
|
|
45
|
+
- **TOOLS.md is generated.** After changing a tool, run `npx tsx scripts/tools-md.ts > TOOLS.md`.
|
|
46
|
+
- **The CLI's screens are snapshots** (`tests/cli/screens/`). Run the tests with `-u` after a deliberate change and read the diff. Colour must only decorate, lines stay within 80 columns, and there is an ASCII fallback.
|
|
47
|
+
- **No real data in fixtures.** Fixtures come from a test account or are made up. Never commit anything from a real person's account.
|
|
106
48
|
|
|
107
|
-
|
|
49
|
+
## Adding a tool
|
|
108
50
|
|
|
109
|
-
|
|
51
|
+
Think twice: a new tool costs tokens for everyone, and most ideas fit an existing tool as an `include` option or an input.
|
|
110
52
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
53
|
+
1. Find the endpoint (see [WHOOP.md](WHOOP.md); `whoop_raw` lets you call it).
|
|
54
|
+
2. Save a response from a test account under `tests/fixtures/`.
|
|
55
|
+
3. Write the projection in `src/projections/v2/` and its test.
|
|
56
|
+
4. Write the tool in `src/tools/v2/` and add it to `src/tools/register.ts` and the groups in `scripts/tools-md.ts`.
|
|
57
|
+
5. `totem typecheck && totem test`, then regenerate TOOLS.md.
|
|
116
58
|
|
|
117
|
-
|
|
59
|
+
## When WHOOP changes something
|
|
118
60
|
|
|
119
|
-
|
|
61
|
+
A tool starts returning nulls, or a write starts failing. Call the endpoint with `whoop_raw`, save the new response as a fixture, update the projection and its test, and note the change in [WHOOP.md](WHOOP.md).
|
|
120
62
|
|
|
121
|
-
|
|
63
|
+
## Before you open a pull request
|
|
122
64
|
|
|
65
|
+
```bash
|
|
66
|
+
totem typecheck && npx tsc --noEmit -p tsconfig.test.json && totem test
|
|
123
67
|
```
|
|
124
|
-
fix: whoop_recovery + whoop_strain were silently returning all-null
|
|
125
68
|
|
|
126
|
-
|
|
127
|
-
<one paragraph on the fix>
|
|
128
|
-
<verification: live-API check or test result>
|
|
129
|
-
```
|
|
69
|
+
CI runs the same on every pull request. Describe what changed and how you checked it; for a tool, say which account (test or your own) you tried it against.
|
|
130
70
|
|
|
131
|
-
|
|
71
|
+
## Commits
|
|
132
72
|
|
|
133
|
-
|
|
73
|
+
One change per commit, a subject that says what is now true ("whoop_sleep refuses an activity that isn't a sleep"), and a body with what broke, how you found it and how you checked the fix.
|
|
134
74
|
|
|
135
75
|
## Reporting bugs
|
|
136
76
|
|
|
137
|
-
Open an issue with
|
|
138
|
-
- Which tool
|
|
139
|
-
- The exact arguments you called it with
|
|
140
|
-
- The full output (especially if it's all-null or partial)
|
|
141
|
-
- The current state of your account that should be in the output (e.g. "I have 3 workouts on May 23 but `whoop_workouts` returns empty")
|
|
142
|
-
|
|
143
|
-
If you can attach a `whoop_raw` capture of the underlying endpoint, even better.
|
|
144
|
-
|
|
145
|
-
---
|
|
77
|
+
Open an issue with the tool, the exact inputs, what it returned and what you expected. A `whoop_raw` response of the endpoint behind it helps a lot (remove anything personal first).
|
|
146
78
|
|
|
147
79
|
## Code of conduct
|
|
148
80
|
|
|
149
|
-
Be
|
|
81
|
+
Be kind. This is a small project.
|
package/Dockerfile
CHANGED
|
@@ -23,31 +23,65 @@ RUN npx tsc && npm prune --omit=dev
|
|
|
23
23
|
FROM node:24-alpine AS runtime
|
|
24
24
|
WORKDIR /app
|
|
25
25
|
|
|
26
|
-
#
|
|
27
|
-
|
|
26
|
+
# The WHOOP login lives in /data/tokens.json. WHOOP rotates the refresh token on
|
|
27
|
+
# every refresh, so /data must be a volume (Fly [mounts], a Railway volume,
|
|
28
|
+
# `docker run -v totem-data:/data`) or the login is lost on restart.
|
|
29
|
+
#
|
|
30
|
+
# Volumes mount owned by root, so the container starts as root, hands the token
|
|
31
|
+
# directory to the unprivileged `node` user (uid 1000), and drops to it with
|
|
32
|
+
# su-exec before the server starts. The server itself never runs as root.
|
|
33
|
+
#
|
|
34
|
+
# That directory belongs to the server afterwards, so the root step must not
|
|
35
|
+
# follow anything found in it: chown -h changes a symlink itself, never its
|
|
36
|
+
# target, and chmod (which has no -h) is skipped for a symlinked directory.
|
|
37
|
+
# Without this, a link planted at tokens.json would get a root-owned file
|
|
38
|
+
# handed to `node` at the next start. "/" is never touched.
|
|
39
|
+
RUN apk add --no-cache su-exec \
|
|
40
|
+
&& mkdir -p /data && chown node:node /data && chmod 700 /data \
|
|
41
|
+
&& printf '%s\n' \
|
|
42
|
+
'#!/bin/sh' \
|
|
43
|
+
'set -e' \
|
|
44
|
+
'file="${TOTEM_TOKEN_FILE:-/data/tokens.json}"' \
|
|
45
|
+
'dir="$(dirname "$file")"' \
|
|
46
|
+
'if [ "$(id -u)" = "0" ]; then' \
|
|
47
|
+
' mkdir -p "$dir"' \
|
|
48
|
+
' if [ "$dir" != "/" ]; then' \
|
|
49
|
+
' for p in "$dir" "$file" "$file.lock"; do if [ -e "$p" ] || [ -L "$p" ]; then chown -h node:node "$p" || true; fi; done' \
|
|
50
|
+
' if [ ! -L "$dir" ]; then chmod 700 "$dir" 2>/dev/null || true; fi' \
|
|
51
|
+
' fi' \
|
|
52
|
+
' exec su-exec node "$@"' \
|
|
53
|
+
'fi' \
|
|
54
|
+
'exec "$@"' \
|
|
55
|
+
> /usr/local/bin/totem-entrypoint \
|
|
56
|
+
&& chmod 755 /usr/local/bin/totem-entrypoint
|
|
28
57
|
|
|
29
58
|
COPY --chown=node:node --from=builder /app/node_modules ./node_modules
|
|
30
59
|
COPY --chown=node:node --from=builder /app/dist ./dist
|
|
31
60
|
COPY --chown=node:node --from=builder /app/package.json ./
|
|
61
|
+
# The consent page's typeface is compiled into dist/; its licence travels with it.
|
|
62
|
+
COPY --chown=node:node assets/fonts/Manrope-OFL.txt ./assets/fonts/Manrope-OFL.txt
|
|
32
63
|
|
|
33
|
-
#
|
|
34
|
-
# secrets
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
# MCP_AUTH_TOKEN — random secret your MCP client will send
|
|
39
|
-
#
|
|
40
|
-
# (Or just run `totem cloud` — it builds, deploys, and sets all of this.)
|
|
64
|
+
# Runtime settings. Set MCP_AUTH_TOKEN (and optionally AUTH_PASSWORD +
|
|
65
|
+
# PUBLIC_URL) via your host's secrets (`fly secrets set`, Railway variables,
|
|
66
|
+
# docker run -e …). No WHOOP tokens go in the environment: the server starts
|
|
67
|
+
# without a login, and `totem auth` pushes one to POST /admin/tokens, which
|
|
68
|
+
# writes the token file. (Or just run `totem cloud`: it does all of this.)
|
|
41
69
|
#
|
|
42
70
|
# This image forces HTTP transport.
|
|
71
|
+
# The release tag, shown by /health and totem status (set by .github/workflows/image.yml).
|
|
72
|
+
ARG TOTEM_BUILD_ID=
|
|
73
|
+
ENV TOTEM_BUILD_ID=${TOTEM_BUILD_ID}
|
|
43
74
|
ENV MCP_TRANSPORT=http
|
|
44
|
-
ENV
|
|
75
|
+
ENV TOTEM_TOKEN_FILE=/data/tokens.json
|
|
45
76
|
ENV NODE_ENV=production
|
|
46
77
|
ENV PORT=3000
|
|
47
78
|
|
|
48
79
|
EXPOSE 3000
|
|
49
80
|
|
|
81
|
+
# Probe the port the server actually listens on: PORT, else MCP_HTTP_PORT, else
|
|
82
|
+
# 3000 (the same order as resolvePort in src/server-http.ts).
|
|
50
83
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
51
|
-
CMD wget -qO- http://127.0.0.1
|
|
84
|
+
CMD wget -qO- "http://127.0.0.1:${PORT:-${MCP_HTTP_PORT:-3000}}/health" || exit 1
|
|
52
85
|
|
|
86
|
+
ENTRYPOINT ["/usr/local/bin/totem-entrypoint"]
|
|
53
87
|
CMD ["node", "dist/server.js"]
|