trainbud 0.5.0 → 0.5.2

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.
Files changed (152) hide show
  1. package/.env.example +11 -11
  2. package/CHANGELOG.md +757 -675
  3. package/QUICKSTART.md +185 -182
  4. package/README.md +329 -322
  5. package/dist/appDb.d.ts +40 -1
  6. package/dist/appDb.js +120 -51
  7. package/dist/cli.js +47 -0
  8. package/dist/dashboard.js +820 -820
  9. package/dist/dashboardCharts.js +42 -42
  10. package/dist/deviceTokens.d.ts +29 -0
  11. package/dist/deviceTokens.js +49 -0
  12. package/dist/history/context.js +35 -35
  13. package/dist/history/schema.js +66 -66
  14. package/dist/httpServer.js +64 -1
  15. package/dist/pairApi.js +11 -2
  16. package/dist/promptApi.js +5 -5
  17. package/dist/usage.js +17 -17
  18. package/package.json +82 -77
  19. package/dist/appDb.d.ts.map +0 -1
  20. package/dist/appDb.js.map +0 -1
  21. package/dist/check.d.ts.map +0 -1
  22. package/dist/check.js.map +0 -1
  23. package/dist/cli.d.ts.map +0 -1
  24. package/dist/cli.js.map +0 -1
  25. package/dist/config.d.ts.map +0 -1
  26. package/dist/config.js.map +0 -1
  27. package/dist/dashboard.d.ts.map +0 -1
  28. package/dist/dashboard.js.map +0 -1
  29. package/dist/dashboardCharts.d.ts.map +0 -1
  30. package/dist/dashboardCharts.js.map +0 -1
  31. package/dist/dashboardData.d.ts.map +0 -1
  32. package/dist/dashboardData.js.map +0 -1
  33. package/dist/detect/baseline.d.ts.map +0 -1
  34. package/dist/detect/baseline.js.map +0 -1
  35. package/dist/detect/countdown.d.ts.map +0 -1
  36. package/dist/detect/countdown.js.map +0 -1
  37. package/dist/detect/detectors.d.ts.map +0 -1
  38. package/dist/detect/detectors.js.map +0 -1
  39. package/dist/detect/findings.d.ts.map +0 -1
  40. package/dist/detect/findings.js.map +0 -1
  41. package/dist/detect/forecast.d.ts.map +0 -1
  42. package/dist/detect/forecast.js.map +0 -1
  43. package/dist/detect/index.d.ts.map +0 -1
  44. package/dist/detect/index.js.map +0 -1
  45. package/dist/detect/sleepQuality.d.ts.map +0 -1
  46. package/dist/detect/sleepQuality.js.map +0 -1
  47. package/dist/detect/trimp.d.ts.map +0 -1
  48. package/dist/detect/trimp.js.map +0 -1
  49. package/dist/detect/week.d.ts.map +0 -1
  50. package/dist/detect/week.js.map +0 -1
  51. package/dist/garmin/auth.d.ts.map +0 -1
  52. package/dist/garmin/auth.js.map +0 -1
  53. package/dist/garmin/cache.d.ts.map +0 -1
  54. package/dist/garmin/cache.js.map +0 -1
  55. package/dist/garmin/client.d.ts.map +0 -1
  56. package/dist/garmin/client.js.map +0 -1
  57. package/dist/garmin/daily.d.ts.map +0 -1
  58. package/dist/garmin/daily.js.map +0 -1
  59. package/dist/garmin/garminApiTypes.d.ts.map +0 -1
  60. package/dist/garmin/garminApiTypes.js.map +0 -1
  61. package/dist/garmin/garminConnect.d.ts.map +0 -1
  62. package/dist/garmin/garminConnect.js.map +0 -1
  63. package/dist/garmin/partial.d.ts.map +0 -1
  64. package/dist/garmin/partial.js.map +0 -1
  65. package/dist/garmin/rawApi.d.ts.map +0 -1
  66. package/dist/garmin/rawApi.js.map +0 -1
  67. package/dist/garmin/types.d.ts.map +0 -1
  68. package/dist/garmin/types.js.map +0 -1
  69. package/dist/history/capture.d.ts.map +0 -1
  70. package/dist/history/capture.js.map +0 -1
  71. package/dist/history/context.d.ts.map +0 -1
  72. package/dist/history/context.js.map +0 -1
  73. package/dist/history/fallback.d.ts.map +0 -1
  74. package/dist/history/fallback.js.map +0 -1
  75. package/dist/history/ingest.d.ts.map +0 -1
  76. package/dist/history/ingest.js.map +0 -1
  77. package/dist/history/scheduler.d.ts.map +0 -1
  78. package/dist/history/scheduler.js.map +0 -1
  79. package/dist/history/schema.d.ts.map +0 -1
  80. package/dist/history/schema.js.map +0 -1
  81. package/dist/history/store.d.ts.map +0 -1
  82. package/dist/history/store.js.map +0 -1
  83. package/dist/httpServer.d.ts.map +0 -1
  84. package/dist/httpServer.js.map +0 -1
  85. package/dist/index.d.ts.map +0 -1
  86. package/dist/index.js.map +0 -1
  87. package/dist/mcpConfig.d.ts.map +0 -1
  88. package/dist/mcpConfig.js.map +0 -1
  89. package/dist/pairApi.d.ts.map +0 -1
  90. package/dist/pairApi.js.map +0 -1
  91. package/dist/paths.d.ts.map +0 -1
  92. package/dist/paths.js.map +0 -1
  93. package/dist/profile.d.ts.map +0 -1
  94. package/dist/profile.js.map +0 -1
  95. package/dist/promptApi.d.ts.map +0 -1
  96. package/dist/promptApi.js.map +0 -1
  97. package/dist/promptSuggestions.d.ts.map +0 -1
  98. package/dist/promptSuggestions.js.map +0 -1
  99. package/dist/selfTest.d.ts.map +0 -1
  100. package/dist/selfTest.js.map +0 -1
  101. package/dist/server.d.ts.map +0 -1
  102. package/dist/server.js.map +0 -1
  103. package/dist/setup.d.ts.map +0 -1
  104. package/dist/setup.js.map +0 -1
  105. package/dist/toolErrors.d.ts.map +0 -1
  106. package/dist/toolErrors.js.map +0 -1
  107. package/dist/tools/activities.d.ts.map +0 -1
  108. package/dist/tools/activities.js.map +0 -1
  109. package/dist/tools/bodyComposition.d.ts.map +0 -1
  110. package/dist/tools/bodyComposition.js.map +0 -1
  111. package/dist/tools/context.d.ts.map +0 -1
  112. package/dist/tools/context.js.map +0 -1
  113. package/dist/tools/findings.d.ts.map +0 -1
  114. package/dist/tools/findings.js.map +0 -1
  115. package/dist/tools/heartRate.d.ts.map +0 -1
  116. package/dist/tools/heartRate.js.map +0 -1
  117. package/dist/tools/index.d.ts.map +0 -1
  118. package/dist/tools/index.js.map +0 -1
  119. package/dist/tools/payloads.d.ts.map +0 -1
  120. package/dist/tools/payloads.js.map +0 -1
  121. package/dist/tools/recovery.d.ts.map +0 -1
  122. package/dist/tools/recovery.js.map +0 -1
  123. package/dist/tools/sleep.d.ts.map +0 -1
  124. package/dist/tools/sleep.js.map +0 -1
  125. package/dist/tools/stress.d.ts.map +0 -1
  126. package/dist/tools/stress.js.map +0 -1
  127. package/dist/tools/trainingInsights.d.ts.map +0 -1
  128. package/dist/tools/trainingInsights.js.map +0 -1
  129. package/dist/tools/types.d.ts.map +0 -1
  130. package/dist/tools/types.js.map +0 -1
  131. package/dist/tools/vo2Max.d.ts.map +0 -1
  132. package/dist/tools/vo2Max.js.map +0 -1
  133. package/dist/tools/week.d.ts.map +0 -1
  134. package/dist/tools/week.js.map +0 -1
  135. package/dist/usage.d.ts.map +0 -1
  136. package/dist/usage.js.map +0 -1
  137. package/dist/utils/batch.d.ts.map +0 -1
  138. package/dist/utils/batch.js.map +0 -1
  139. package/dist/utils/helpers.d.ts.map +0 -1
  140. package/dist/utils/helpers.js.map +0 -1
  141. package/dist/utils/jsonFile.d.ts.map +0 -1
  142. package/dist/utils/jsonFile.js.map +0 -1
  143. package/dist/utils/logger.d.ts.map +0 -1
  144. package/dist/utils/logger.js.map +0 -1
  145. package/dist/utils/secretFile.d.ts.map +0 -1
  146. package/dist/utils/secretFile.js.map +0 -1
  147. package/dist/utils/stdio.d.ts.map +0 -1
  148. package/dist/utils/stdio.js.map +0 -1
  149. package/dist/version.d.ts.map +0 -1
  150. package/dist/version.js.map +0 -1
  151. package/dist/watchApi.d.ts.map +0 -1
  152. package/dist/watchApi.js.map +0 -1
package/QUICKSTART.md CHANGED
@@ -1,182 +1,185 @@
1
- # Quickstart
2
-
3
- Get TrainBud running in about 5 minutes.
4
-
5
- ## Prerequisites
6
-
7
- - Node.js 20 or newer ([`.nvmrc`](./.nvmrc) included)
8
- - A Garmin Connect account with synced device data
9
- - Garmin Connect **MFA disabled** (the underlying library does not support MFA yet)
10
-
11
- ## Recommended: one-command setup
12
-
13
- ```bash
14
- git clone https://github.com/Zsadigzade/trainbud.git
15
- cd trainbud
16
- npm install
17
- npm run build
18
- npm link # puts `trainbud` on your PATH
19
- trainbud setup
20
- ```
21
-
22
- > `npm link` is what makes the bare `trainbud` command work. Without it every
23
- > `trainbud ...` line below is "command not found", because TrainBud is not on
24
- > the npm registryso `trainbud` does **not** work either, and would run
25
- > whatever gets published under that name in future. If you would rather not
26
- > link, every command works as `node dist/index.js <command>` from the repo root.
27
- > Undo with `npm unlink -g trainbud`.
28
-
29
- The setup wizard will:
30
-
31
- 1. Ask for your Garmin Connect email and password
32
- 2. Save credentials to `.env`
33
- 3. Authenticate with Garmin Connect
34
- 4. Detect Cursor and Claude Desktop on your machine
35
- 5. Offer to add TrainBud to your MCP client config automatically
36
- 6. Optionally run a live API check against all 9 tools
37
-
38
- After setup, **restart your MCP client completely** (Cursor or Claude Desktop), then ask:
39
-
40
- - "What did I do today?"
41
- - "How's my sleep been this week?"
42
- - "Am I recovered enough to train hard?"
43
-
44
- ### Claude Code: plugin or slash commands
45
-
46
- **Plugin (recommended)** — skills + MCP in one install:
47
-
48
- ```bash
49
- /plugin marketplace add Zsadigzade/trainbud
50
- /plugin install trainbud@trainbud
51
- ```
52
-
53
- Then `/trainbud:trainbud-setup` and `/trainbud:trainbud`.
54
-
55
- **In-repo skills** if you cloned the repo and run `claude` here:
56
-
57
- 1. `/trainbud-setup` — guided install + MCP config + live check
58
- 2. Restart MCP client
59
- 3. `/trainbud` ask any fitness question
60
-
61
- See [`plugin/README.md`](./plugin/README.md) for plugin details.
62
-
63
- ## Verify without an MCP client
64
-
65
- After setup, you can confirm Garmin Connect access directly:
66
-
67
- ```bash
68
- trainbud check
69
- ```
70
-
71
- Example output:
72
-
73
- ```text
74
- TrainBud live check
75
-
76
- get_latest_activity Activity: Morning Run, Distance: 5.2 km, Start: ...
77
- get_activities_range 3 activities found
78
- get_sleep_data 7 nights retrieved
79
- get_heart_rate_trends ✓ 30-day trend loaded
80
- get_recovery_status Score: 72 (Ready to train)
81
- get_body_composition ✗ No body composition data found for the last 30 days.
82
- get_stress_levels 7-day stress trend loaded
83
- get_vo2_max_trends ✓ 30-day VO2 max trend loaded
84
- get_training_insights ✓ Weekly summary generated
85
-
86
- All 9 checks passed. TrainBud is ready to use.
87
- ```
88
-
89
- ## Manual setup (alternative)
90
-
91
- If you prefer to configure files yourself:
92
-
93
- ### 1. Install
94
-
95
- ```bash
96
- git clone https://github.com/Zsadigzade/trainbud.git
97
- cd trainbud
98
- npm install
99
- ```
100
-
101
- ### 2. Configure credentials
102
-
103
- ```bash
104
- cp .env.example .env
105
- ```
106
-
107
- Edit `.env`:
108
-
109
- ```env
110
- GARMIN_EMAIL=your@email.com
111
- GARMIN_PASSWORD=yourpassword
112
- ```
113
-
114
- ### 3. Build and authenticate
115
-
116
- ```bash
117
- npm run build
118
- trainbud auth
119
- ```
120
-
121
- You should see: `Garmin authentication successful. Session saved.`
122
-
123
- ### 4. Connect to Cursor or Claude Desktop
124
-
125
- **Cursor:** `%USERPROFILE%\.cursor\mcp.json` (Windows) or `~/.cursor/mcp.json` (macOS/Linux)
126
-
127
- **Claude Desktop (Windows):** `%APPDATA%\Claude\claude_desktop_config.json`
128
- **Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
129
-
130
- ```json
131
- {
132
- "mcpServers": {
133
- "trainbud": {
134
- "command": "node",
135
- "args": ["C:/path/to/trainbud/dist/index.js", "start"],
136
- "env": {
137
- "GARMIN_EMAIL": "your@email.com",
138
- "GARMIN_PASSWORD": "yourpassword"
139
- }
140
- }
141
- }
142
- }
143
- ```
144
-
145
- Restart your MCP client.
146
-
147
- ## Web AI (claude.ai, ChatGPT)
148
-
149
- For web AI platforms that require remote MCP connectors:
150
-
151
- ```bash
152
- trainbud serve
153
- ```
154
-
155
- Then expose via HTTPS tunnel and add to claude.ai Connectors. Full guide: [docs/WEB-MCP.md](./docs/WEB-MCP.md)
156
-
157
- ## Useful commands
158
-
159
- ```bash
160
- trainbud setup # Interactive first-time setup (recommended)
161
- trainbud serve # Remote HTTP MCP for web AI connectors
162
- trainbud check # Live diagnostics against all tools
163
- trainbud status # Check session + cache
164
- trainbud cache clear # Force fresh data fetch
165
- trainbud auth # Re-login if session expired
166
- trainbud start # Start MCP server manually (stdio)
167
- ```
168
-
169
- ## Troubleshooting setup
170
-
171
- | Issue | Fix |
172
- |-------|-----|
173
- | Authentication failed | Verify email/password; disable MFA at connect.garmin.com |
174
- | MCP client doesn't see tools | Restart the client completely (not just reload window) |
175
- | Stale data | Run `trainbud cache clear` |
176
- | `dist/index.js` not found | Run `npm run build` |
177
-
178
- ## Next steps
179
-
180
- - [README.md](./README.md) — full reference
181
- - [examples/prompts.md](./examples/prompts.md) — sample questions
182
- - [docs/VAULT.md](./docs/VAULT.md) — architecture, branding, and design notes (Obsidian vault)
1
+ # Quickstart
2
+
3
+ Get TrainBud running in about 5 minutes.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js 20 or newer ([`.nvmrc`](./.nvmrc) included)
8
+ - A Garmin Connect account with synced device data
9
+ - Garmin Connect **MFA disabled** (the underlying library does not support MFA yet)
10
+
11
+ ## Recommended: one-command setup
12
+
13
+ ```bash
14
+ npx trainbud setup
15
+ ```
16
+
17
+ To keep `trainbud` on your PATH instead of typing `npx` every time:
18
+
19
+ ```bash
20
+ npm install -g trainbud
21
+ trainbud setup
22
+ ```
23
+
24
+ Every command below works either way as `trainbud <command>` if you installed
25
+ globally, or as `npx trainbud <command>` if you did not.
26
+
27
+ The setup wizard will:
28
+
29
+ 1. Ask for your Garmin Connect email and password
30
+ 2. Save credentials to `.env`
31
+ 3. Authenticate with Garmin Connect
32
+ 4. Detect Cursor and Claude Desktop on your machine
33
+ 5. Offer to add TrainBud to your MCP client config automatically
34
+ 6. Optionally run a live API check against every tool
35
+
36
+ After setup, **restart your MCP client completely** (Cursor or Claude Desktop), then ask:
37
+
38
+ - "What did I do today?"
39
+ - "How's my sleep been this week?"
40
+ - "Am I recovered enough to train hard?"
41
+
42
+ ### Claude Code: plugin or slash commands
43
+
44
+ **Plugin (recommended)** skills + MCP in one install:
45
+
46
+ ```bash
47
+ /plugin marketplace add Zsadigzade/trainbud
48
+ /plugin install trainbud@trainbud
49
+ ```
50
+
51
+ Then `/trainbud:trainbud-setup` and `/trainbud:trainbud`.
52
+
53
+ **In-repo skills** — if you cloned the repo and run `claude` here:
54
+
55
+ 1. `/trainbud-setup`guided install + MCP config + live check
56
+ 2. Restart MCP client
57
+ 3. `/trainbud` — ask any fitness question
58
+
59
+ See [`plugin/README.md`](./plugin/README.md) for plugin details.
60
+
61
+ ## Verify without an MCP client
62
+
63
+ After setup, you can confirm Garmin Connect access directly:
64
+
65
+ ```bash
66
+ trainbud check
67
+ ```
68
+
69
+ Example output:
70
+
71
+ ```text
72
+ TrainBud live check
73
+
74
+ get_latest_activity ✓ Activity: Morning Run, Distance: 5.2 km, Start: ...
75
+ get_activities_range ✓ 3 activities found
76
+ get_sleep_data 7 nights retrieved
77
+ get_heart_rate_trends 30-day trend loaded
78
+ get_recovery_status Score: 72 (Ready to train)
79
+ get_body_composition ✗ No body composition data found for the last 30 days.
80
+ get_stress_levels 7-day stress trend loaded
81
+ get_vo2_max_trends ✓ 30-day VO2 max trend loaded
82
+ get_training_insights Weekly summary generated
83
+
84
+ All 9 checks passed. TrainBud is ready to use.
85
+ ```
86
+
87
+ ## Manual setup, or running from source
88
+
89
+ If you prefer to configure files yourself, or you want to run an unreleased
90
+ commit:
91
+
92
+ ### 1. Install
93
+
94
+ ```bash
95
+ git clone https://github.com/Zsadigzade/trainbud.git
96
+ cd trainbud
97
+ npm install
98
+ npm link # puts `trainbud` on your PATH; undo with `npm unlink -g trainbud`
99
+ ```
100
+
101
+ Without `npm link`, every `trainbud <command>` from a clone is
102
+ `node dist/index.js <command>` run from the repo root.
103
+
104
+ ### 2. Configure credentials
105
+
106
+ ```bash
107
+ cp .env.example .env
108
+ ```
109
+
110
+ Edit `.env`:
111
+
112
+ ```env
113
+ GARMIN_EMAIL=your@email.com
114
+ GARMIN_PASSWORD=yourpassword
115
+ ```
116
+
117
+ ### 3. Build and authenticate
118
+
119
+ ```bash
120
+ npm run build
121
+ trainbud auth
122
+ ```
123
+
124
+ You should see: `Garmin authentication successful. Session saved.`
125
+
126
+ ### 4. Connect to Cursor or Claude Desktop
127
+
128
+ **Cursor:** `%USERPROFILE%\.cursor\mcp.json` (Windows) or `~/.cursor/mcp.json` (macOS/Linux)
129
+
130
+ **Claude Desktop (Windows):** `%APPDATA%\Claude\claude_desktop_config.json`
131
+ **Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
132
+
133
+ ```json
134
+ {
135
+ "mcpServers": {
136
+ "trainbud": {
137
+ "command": "node",
138
+ "args": ["C:/path/to/trainbud/dist/index.js", "start"],
139
+ "env": {
140
+ "GARMIN_EMAIL": "your@email.com",
141
+ "GARMIN_PASSWORD": "yourpassword"
142
+ }
143
+ }
144
+ }
145
+ }
146
+ ```
147
+
148
+ Restart your MCP client.
149
+
150
+ ## Web AI (claude.ai, ChatGPT)
151
+
152
+ For web AI platforms that require remote MCP connectors:
153
+
154
+ ```bash
155
+ trainbud serve
156
+ ```
157
+
158
+ Then expose via HTTPS tunnel and add to claude.ai Connectors. Full guide: [docs/WEB-MCP.md](./docs/WEB-MCP.md)
159
+
160
+ ## Useful commands
161
+
162
+ ```bash
163
+ trainbud setup # Interactive first-time setup (recommended)
164
+ trainbud serve # Remote HTTP MCP for web AI connectors
165
+ trainbud check # Live diagnostics against all tools
166
+ trainbud status # Check session + cache
167
+ trainbud cache clear # Force fresh data fetch
168
+ trainbud auth # Re-login if session expired
169
+ trainbud start # Start MCP server manually (stdio)
170
+ ```
171
+
172
+ ## Troubleshooting setup
173
+
174
+ | Issue | Fix |
175
+ |-------|-----|
176
+ | Authentication failed | Verify email/password; disable MFA at connect.garmin.com |
177
+ | MCP client doesn't see tools | Restart the client completely (not just reload window) |
178
+ | Stale data | Run `trainbud cache clear` |
179
+ | `dist/index.js` not found | Run `npm run build` |
180
+
181
+ ## Next steps
182
+
183
+ - [README.md](./README.md) — full reference
184
+ - [examples/prompts.md](./examples/prompts.md) — sample questions
185
+ - [docs/VAULT.md](./docs/VAULT.md) — architecture, branding, and design notes (Obsidian vault)