garmin-bud 0.2.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/.env.example +11 -0
- package/CHANGELOG.md +56 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +174 -0
- package/README.md +227 -0
- package/dist/appDb.d.ts +32 -0
- package/dist/appDb.d.ts.map +1 -0
- package/dist/appDb.js +131 -0
- package/dist/appDb.js.map +1 -0
- package/dist/check.d.ts +9 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +156 -0
- package/dist/check.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +187 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +108 -0
- package/dist/config.js.map +1 -0
- package/dist/dashboard.d.ts +4 -0
- package/dist/dashboard.d.ts.map +1 -0
- package/dist/dashboard.js +111 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/garmin/auth.d.ts +10 -0
- package/dist/garmin/auth.d.ts.map +1 -0
- package/dist/garmin/auth.js +81 -0
- package/dist/garmin/auth.js.map +1 -0
- package/dist/garmin/cache.d.ts +20 -0
- package/dist/garmin/cache.d.ts.map +1 -0
- package/dist/garmin/cache.js +115 -0
- package/dist/garmin/cache.js.map +1 -0
- package/dist/garmin/client.d.ts +5 -0
- package/dist/garmin/client.d.ts.map +1 -0
- package/dist/garmin/client.js +68 -0
- package/dist/garmin/client.js.map +1 -0
- package/dist/garmin/garminApiTypes.d.ts +70 -0
- package/dist/garmin/garminApiTypes.d.ts.map +1 -0
- package/dist/garmin/garminApiTypes.js +3 -0
- package/dist/garmin/garminApiTypes.js.map +1 -0
- package/dist/garmin/garminConnect.d.ts +17 -0
- package/dist/garmin/garminConnect.d.ts.map +1 -0
- package/dist/garmin/garminConnect.js +5 -0
- package/dist/garmin/garminConnect.js.map +1 -0
- package/dist/garmin/rawApi.d.ts +18 -0
- package/dist/garmin/rawApi.d.ts.map +1 -0
- package/dist/garmin/rawApi.js +53 -0
- package/dist/garmin/rawApi.js.map +1 -0
- package/dist/garmin/types.d.ts +68 -0
- package/dist/garmin/types.d.ts.map +1 -0
- package/dist/garmin/types.js +11 -0
- package/dist/garmin/types.js.map +1 -0
- package/dist/httpServer.d.ts +7 -0
- package/dist/httpServer.d.ts.map +1 -0
- package/dist/httpServer.js +386 -0
- package/dist/httpServer.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/mcpConfig.d.ts +37 -0
- package/dist/mcpConfig.d.ts.map +1 -0
- package/dist/mcpConfig.js +83 -0
- package/dist/mcpConfig.js.map +1 -0
- package/dist/pairApi.d.ts +14 -0
- package/dist/pairApi.d.ts.map +1 -0
- package/dist/pairApi.js +34 -0
- package/dist/pairApi.js.map +1 -0
- package/dist/promptApi.d.ts +13 -0
- package/dist/promptApi.d.ts.map +1 -0
- package/dist/promptApi.js +102 -0
- package/dist/promptApi.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +67 -0
- package/dist/server.js.map +1 -0
- package/dist/setup.d.ts +2 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +194 -0
- package/dist/setup.js.map +1 -0
- package/dist/toolErrors.d.ts +2 -0
- package/dist/toolErrors.d.ts.map +1 -0
- package/dist/toolErrors.js +18 -0
- package/dist/toolErrors.js.map +1 -0
- package/dist/tools/activities.d.ts +11 -0
- package/dist/tools/activities.d.ts.map +1 -0
- package/dist/tools/activities.js +134 -0
- package/dist/tools/activities.js.map +1 -0
- package/dist/tools/bodyComposition.d.ts +7 -0
- package/dist/tools/bodyComposition.d.ts.map +1 -0
- package/dist/tools/bodyComposition.js +97 -0
- package/dist/tools/bodyComposition.js.map +1 -0
- package/dist/tools/heartRate.d.ts +7 -0
- package/dist/tools/heartRate.d.ts.map +1 -0
- package/dist/tools/heartRate.js +88 -0
- package/dist/tools/heartRate.js.map +1 -0
- package/dist/tools/index.d.ts +39 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +77 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/recovery.d.ts +16 -0
- package/dist/tools/recovery.d.ts.map +1 -0
- package/dist/tools/recovery.js +214 -0
- package/dist/tools/recovery.js.map +1 -0
- package/dist/tools/sleep.d.ts +7 -0
- package/dist/tools/sleep.d.ts.map +1 -0
- package/dist/tools/sleep.js +93 -0
- package/dist/tools/sleep.js.map +1 -0
- package/dist/tools/stress.d.ts +7 -0
- package/dist/tools/stress.d.ts.map +1 -0
- package/dist/tools/stress.js +69 -0
- package/dist/tools/stress.js.map +1 -0
- package/dist/tools/trainingInsights.d.ts +7 -0
- package/dist/tools/trainingInsights.d.ts.map +1 -0
- package/dist/tools/trainingInsights.js +61 -0
- package/dist/tools/trainingInsights.js.map +1 -0
- package/dist/tools/types.d.ts +12 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/vo2Max.d.ts +7 -0
- package/dist/tools/vo2Max.d.ts.map +1 -0
- package/dist/tools/vo2Max.js +72 -0
- package/dist/tools/vo2Max.js.map +1 -0
- package/dist/utils/batch.d.ts +2 -0
- package/dist/utils/batch.d.ts.map +1 -0
- package/dist/utils/batch.js +18 -0
- package/dist/utils/batch.js.map +1 -0
- package/dist/utils/helpers.d.ts +19 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +131 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +59 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/dist/watchApi.d.ts +47 -0
- package/dist/watchApi.d.ts.map +1 -0
- package/dist/watchApi.js +222 -0
- package/dist/watchApi.js.map +1 -0
- package/package.json +77 -0
package/.env.example
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
GARMIN_EMAIL=your@email.com
|
|
2
|
+
GARMIN_PASSWORD=yourpassword
|
|
3
|
+
GARMIN_MCP_API_KEY=
|
|
4
|
+
GARMIN_MCP_HOST=127.0.0.1
|
|
5
|
+
GARMIN_MCP_PORT=3847
|
|
6
|
+
GARMIN_SESSION_PATH=.garmin/session.json
|
|
7
|
+
GARMIN_LOG_PATH=.garmin/mcp.log
|
|
8
|
+
GARMIN_CACHE_PATH=.garmin/cache.db
|
|
9
|
+
CACHE_TTL_ACTIVITIES=1800
|
|
10
|
+
CACHE_TTL_SLEEP=7200
|
|
11
|
+
CACHE_TTL_STATS=3600
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.2.0] - 2026-06-26
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **Critical:** Logger no longer writes to stdout — pino-pretty uses stderr; file logging starts only when server starts
|
|
10
|
+
- **Critical:** Credentials validated at server startup, not on first tool call
|
|
11
|
+
- N+1 Garmin API calls batched with concurrency limit (`mapInBatches`, max 6 parallel)
|
|
12
|
+
- Body composition fetches parallelized instead of sequential
|
|
13
|
+
- Activities range queries use shared paginated pool cache (up to 500 activities) with truncation warning
|
|
14
|
+
- Cache keys unified via `buildToolCacheKey()` with stable sorted-param hashing
|
|
15
|
+
- Recovery tool uses yesterday's sleep data with fallback to prior nights
|
|
16
|
+
- Activity date filtering uses consistent Luxon parsing
|
|
17
|
+
- Session path resolved from single `getSessionPath()` in config
|
|
18
|
+
- Version read from `package.json` instead of hardcoded strings
|
|
19
|
+
- `GarminApiError` is now a proper class; auth retry uses `await`
|
|
20
|
+
- Tool errors sanitized before returning to MCP clients
|
|
21
|
+
- SQLite cache closed on SIGTERM/SIGINT/exit
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `src/version.ts`, `src/utils/batch.ts`, `src/garmin/garminApiTypes.ts`, `src/tools/types.ts`
|
|
26
|
+
- `filterActivitiesByRange()`, `sanitizeErrorMessage()`, `getYesterday()` helpers
|
|
27
|
+
- `configureLogger()` for lazy log file initialization
|
|
28
|
+
- `.nvmrc` (Node 20)
|
|
29
|
+
- `.github/workflows/publish.yml` for npm + GitHub Releases on version tags
|
|
30
|
+
- Project knowledge base moved to Obsidian vault (`05-Projects/garmin-bud/`); see `docs/VAULT.md`
|
|
31
|
+
- 11 new tests (32 total): cache key stability, date filtering, recovery scoring, error sanitization
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **Rebranded** from garmin-mcp to **GarminBud** (package `garmin-bud`, CLI `garmin-bud`)
|
|
36
|
+
- README rewritten as product page with disclaimer, badges, and security section
|
|
37
|
+
- Added CONTRIBUTING.md; updated vault docs and examples
|
|
38
|
+
- Removed imports from internal `garmin-connect/dist/` paths
|
|
39
|
+
- Tool registry uses shared `ToolDefinition` interface without unsafe casts
|
|
40
|
+
- `runCacheClear` is synchronous
|
|
41
|
+
|
|
42
|
+
## [0.1.0] - 2026-06-26
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- Initial MCP server exposing 6 Garmin Connect tools
|
|
47
|
+
- Email/password authentication with session persistence (`.garmin/session.json`)
|
|
48
|
+
- SQLite caching layer with configurable TTL per resource type
|
|
49
|
+
- CLI commands: `start`, `auth`, `cache clear`, `status`
|
|
50
|
+
- Unit and integration tests using Node test runner
|
|
51
|
+
- README, QUICKSTART, and example prompts
|
|
52
|
+
|
|
53
|
+
### Notes
|
|
54
|
+
|
|
55
|
+
- Uses unofficial `garmin-connect` npm package (Windows/macOS/Linux compatible)
|
|
56
|
+
- MFA is not yet supported by the underlying library
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zsadigzade
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/QUICKSTART.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Quickstart
|
|
2
|
+
|
|
3
|
+
Get GarminBud 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/garmin-bud.git
|
|
15
|
+
cd garmin-bud
|
|
16
|
+
npm install
|
|
17
|
+
npm run build
|
|
18
|
+
npx garmin-bud setup
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The setup wizard will:
|
|
22
|
+
|
|
23
|
+
1. Ask for your Garmin Connect email and password
|
|
24
|
+
2. Save credentials to `.env`
|
|
25
|
+
3. Authenticate with Garmin Connect
|
|
26
|
+
4. Detect Cursor and Claude Desktop on your machine
|
|
27
|
+
5. Offer to add GarminBud to your MCP client config automatically
|
|
28
|
+
6. Optionally run a live API check against all 9 tools
|
|
29
|
+
|
|
30
|
+
After setup, **restart your MCP client completely** (Cursor or Claude Desktop), then ask:
|
|
31
|
+
|
|
32
|
+
- "What did I do today?"
|
|
33
|
+
- "How's my sleep been this week?"
|
|
34
|
+
- "Am I recovered enough to train hard?"
|
|
35
|
+
|
|
36
|
+
### Claude Code: plugin or slash commands
|
|
37
|
+
|
|
38
|
+
**Plugin (recommended)** — skills + MCP in one install:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
/plugin marketplace add Zsadigzade/garmin-bud
|
|
42
|
+
/plugin install garmin-bud@garmin-bud
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then `/garmin-bud:garmin-bud-setup` and `/garmin-bud:garmin-bud`.
|
|
46
|
+
|
|
47
|
+
**In-repo skills** — if you cloned the repo and run `claude` here:
|
|
48
|
+
|
|
49
|
+
1. `/garmin-bud-setup` — guided install + MCP config + live check
|
|
50
|
+
2. Restart MCP client
|
|
51
|
+
3. `/garmin-bud` — ask any fitness question
|
|
52
|
+
|
|
53
|
+
See [`plugin/README.md`](./plugin/README.md) for plugin details.
|
|
54
|
+
|
|
55
|
+
## Verify without an MCP client
|
|
56
|
+
|
|
57
|
+
After setup, you can confirm Garmin Connect access directly:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
garmin-bud check
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Example output:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
GarminBud live check
|
|
67
|
+
|
|
68
|
+
get_latest_activity ✓ Activity: Morning Run, Distance: 5.2 km, Start: ...
|
|
69
|
+
get_activities_range ✓ 3 activities found
|
|
70
|
+
get_sleep_data ✓ 7 nights retrieved
|
|
71
|
+
get_heart_rate_trends ✓ 30-day trend loaded
|
|
72
|
+
get_recovery_status ✓ Score: 72 (Ready to train)
|
|
73
|
+
get_body_composition ✗ No body composition data found for the last 30 days.
|
|
74
|
+
get_stress_levels ✓ 7-day stress trend loaded
|
|
75
|
+
get_vo2_max_trends ✓ 30-day VO2 max trend loaded
|
|
76
|
+
get_training_insights ✓ Weekly summary generated
|
|
77
|
+
|
|
78
|
+
All 9 checks passed. GarminBud is ready to use.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Manual setup (alternative)
|
|
82
|
+
|
|
83
|
+
If you prefer to configure files yourself:
|
|
84
|
+
|
|
85
|
+
### 1. Install
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/Zsadigzade/garmin-bud.git
|
|
89
|
+
cd garmin-bud
|
|
90
|
+
npm install
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 2. Configure credentials
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cp .env.example .env
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Edit `.env`:
|
|
100
|
+
|
|
101
|
+
```env
|
|
102
|
+
GARMIN_EMAIL=your@email.com
|
|
103
|
+
GARMIN_PASSWORD=yourpassword
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. Build and authenticate
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npm run build
|
|
110
|
+
npx garmin-bud auth
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
You should see: `Garmin authentication successful. Session saved.`
|
|
114
|
+
|
|
115
|
+
### 4. Connect to Cursor or Claude Desktop
|
|
116
|
+
|
|
117
|
+
**Cursor:** `%USERPROFILE%\.cursor\mcp.json` (Windows) or `~/.cursor/mcp.json` (macOS/Linux)
|
|
118
|
+
|
|
119
|
+
**Claude Desktop (Windows):** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
120
|
+
**Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"garmin-bud": {
|
|
126
|
+
"command": "node",
|
|
127
|
+
"args": ["C:/path/to/garmin-bud/dist/index.js", "start"],
|
|
128
|
+
"env": {
|
|
129
|
+
"GARMIN_EMAIL": "your@email.com",
|
|
130
|
+
"GARMIN_PASSWORD": "yourpassword"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Restart your MCP client.
|
|
138
|
+
|
|
139
|
+
## Web AI (claude.ai, ChatGPT)
|
|
140
|
+
|
|
141
|
+
For web AI platforms that require remote MCP connectors:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
garmin-bud serve
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Then expose via HTTPS tunnel and add to claude.ai Connectors. Full guide: [docs/WEB-MCP.md](./docs/WEB-MCP.md)
|
|
148
|
+
|
|
149
|
+
## Useful commands
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
garmin-bud setup # Interactive first-time setup (recommended)
|
|
153
|
+
garmin-bud serve # Remote HTTP MCP for web AI connectors
|
|
154
|
+
garmin-bud check # Live diagnostics against all tools
|
|
155
|
+
garmin-bud status # Check session + cache
|
|
156
|
+
garmin-bud cache clear # Force fresh data fetch
|
|
157
|
+
garmin-bud auth # Re-login if session expired
|
|
158
|
+
garmin-bud start # Start MCP server manually (stdio)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Troubleshooting setup
|
|
162
|
+
|
|
163
|
+
| Issue | Fix |
|
|
164
|
+
|-------|-----|
|
|
165
|
+
| Authentication failed | Verify email/password; disable MFA at connect.garmin.com |
|
|
166
|
+
| MCP client doesn't see tools | Restart the client completely (not just reload window) |
|
|
167
|
+
| Stale data | Run `garmin-bud cache clear` |
|
|
168
|
+
| `dist/index.js` not found | Run `npm run build` |
|
|
169
|
+
|
|
170
|
+
## Next steps
|
|
171
|
+
|
|
172
|
+
- [README.md](./README.md) — full reference
|
|
173
|
+
- [examples/prompts.md](./examples/prompts.md) — sample questions
|
|
174
|
+
- [docs/VAULT.md](./docs/VAULT.md) — architecture, branding, and design notes (Obsidian vault)
|
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# GarminBud
|
|
2
|
+
|
|
3
|
+
**Talk to your Garmin data.**
|
|
4
|
+
|
|
5
|
+
GarminBud is an open-source MCP server that connects your Garmin Connect fitness data to Claude, Cursor, and other AI assistants. Ask about workouts, sleep, heart rate, recovery, and body composition in plain English — privately, on your machine.
|
|
6
|
+
|
|
7
|
+
> **Disclaimer:** GarminBud is an unofficial community project. It is not affiliated with, endorsed by, or sponsored by Garmin Ltd. Garmin Connect is a trademark of Garmin Ltd.
|
|
8
|
+
|
|
9
|
+
[](https://github.com/Zsadigzade/garmin-bud/actions/workflows/ci.yml)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](.nvmrc)
|
|
12
|
+
|
|
13
|
+
## Try it
|
|
14
|
+
|
|
15
|
+
Once connected to your MCP client, ask things like:
|
|
16
|
+
|
|
17
|
+
- *"What did I do today?"*
|
|
18
|
+
- *"How's my sleep been this week?"*
|
|
19
|
+
- *"Am I recovered enough to train hard tomorrow?"*
|
|
20
|
+
- *"Is my resting heart rate trending down?"*
|
|
21
|
+
|
|
22
|
+
See [examples/prompts.md](./examples/prompts.md) for more ideas.
|
|
23
|
+
|
|
24
|
+
## Why GarminBud
|
|
25
|
+
|
|
26
|
+
- **Private** — credentials stay in your local `.env`; data is cached on your machine
|
|
27
|
+
- **Local-first** — SQLite cache, session tokens in `.garmin/`
|
|
28
|
+
- **Works everywhere** — Windows, macOS, Linux (Node.js 20+)
|
|
29
|
+
- **Any MCP client** — Claude Desktop, Cursor, and other stdio-compatible clients
|
|
30
|
+
- **Smart fetching** — batched API calls and automatic re-auth when sessions expire
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git clone https://github.com/Zsadigzade/garmin-bud.git
|
|
36
|
+
cd garmin-bud
|
|
37
|
+
npm install
|
|
38
|
+
npm run build
|
|
39
|
+
npx garmin-bud setup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The setup wizard walks you through credentials, authentication, and connecting Cursor or Claude Desktop — no MCP config editing required.
|
|
43
|
+
|
|
44
|
+
Full walkthrough: [QUICKSTART.md](./QUICKSTART.md)
|
|
45
|
+
|
|
46
|
+
## Claude Code plugin (recommended)
|
|
47
|
+
|
|
48
|
+
Install as a [Claude Code plugin](https://code.claude.com/docs/en/plugins) — skills **and** MCP server in one step:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
/plugin marketplace add Zsadigzade/garmin-bud
|
|
52
|
+
/plugin install garmin-bud@garmin-bud
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Set credentials, then restart Claude Code:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
export GARMIN_EMAIL="your@email.com"
|
|
59
|
+
export GARMIN_PASSWORD="yourpassword"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| Command | What it does |
|
|
63
|
+
|---------|----------------|
|
|
64
|
+
| `/garmin-bud:garmin-bud-setup` | First-time setup and diagnostics |
|
|
65
|
+
| `/garmin-bud:garmin-bud` | Ask about workouts, sleep, recovery, HR, stress, VO2 max |
|
|
66
|
+
|
|
67
|
+
Plugin files live in [`plugin/`](./plugin/). See [`plugin/README.md`](./plugin/README.md).
|
|
68
|
+
|
|
69
|
+
## Claude Code skills (in-repo)
|
|
70
|
+
|
|
71
|
+
This repo also ships project skills in [`.claude/skills/`](./.claude/skills/) for development without installing the plugin:
|
|
72
|
+
|
|
73
|
+
| Command | What it does |
|
|
74
|
+
|---------|----------------|
|
|
75
|
+
| `/garmin-bud-setup` | Install, authenticate, configure MCP, run live check |
|
|
76
|
+
| `/garmin-bud` | Ask about workouts, sleep, recovery, HR, stress, VO2 max |
|
|
77
|
+
|
|
78
|
+
Open the repo in **Claude Code** (`claude` in this directory) — skills load automatically.
|
|
79
|
+
|
|
80
|
+
To use skills in **every** project without the plugin, copy them to `~/.claude/skills/`.
|
|
81
|
+
|
|
82
|
+
After setup, restart your MCP client and try `/garmin-bud` with *"What did I do today?"*
|
|
83
|
+
|
|
84
|
+
## Garmin watch widget (Connect IQ)
|
|
85
|
+
|
|
86
|
+
View recovery, sleep, activity, stress, and VO2 max on your Garmin watch via a Connect IQ widget in [`ciq/`](./ciq/).
|
|
87
|
+
|
|
88
|
+
**Requires:** `garmin-bud serve` running + HTTPS tunnel (same setup as web AI).
|
|
89
|
+
|
|
90
|
+
1. Start the server and tunnel:
|
|
91
|
+
```bash
|
|
92
|
+
garmin-bud serve
|
|
93
|
+
cloudflared tunnel --url http://127.0.0.1:3847
|
|
94
|
+
```
|
|
95
|
+
2. Build and sideload the widget — see [ciq/README.md](./ciq/README.md)
|
|
96
|
+
3. In **Garmin Connect Mobile** → Connect IQ → GarminBud settings, set:
|
|
97
|
+
- **Server URL** — your tunnel URL (e.g. `https://abc.trycloudflare.com`)
|
|
98
|
+
4. Open the widget on your watch — it shows a pairing code. Approve it in the dashboard (`/dashboard?token=YOUR_API_KEY`) to complete setup.
|
|
99
|
+
|
|
100
|
+
Tap the widget to cycle through data cards. The watch calls `GET /api/watch` — a compact JSON summary, not the full MCP protocol.
|
|
101
|
+
|
|
102
|
+
## Connect to Claude Desktop
|
|
103
|
+
|
|
104
|
+
Edit `claude_desktop_config.json`:
|
|
105
|
+
|
|
106
|
+
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
107
|
+
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"garmin-bud": {
|
|
113
|
+
"command": "node",
|
|
114
|
+
"args": ["C:/path/to/garmin-bud/dist/index.js", "start"],
|
|
115
|
+
"env": {
|
|
116
|
+
"GARMIN_EMAIL": "your@email.com",
|
|
117
|
+
"GARMIN_PASSWORD": "yourpassword"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
After `npm link`, you can use the CLI directly:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"garmin-bud": {
|
|
130
|
+
"command": "garmin-bud",
|
|
131
|
+
"args": ["start"]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Restart your MCP client, then start asking questions.
|
|
138
|
+
|
|
139
|
+
## Tools
|
|
140
|
+
|
|
141
|
+
| Tool | What it answers |
|
|
142
|
+
|------|-----------------|
|
|
143
|
+
| `get_latest_activity` | Your most recent workout — distance, pace, HR, elevation |
|
|
144
|
+
| `get_activities_range` | Activities between two dates |
|
|
145
|
+
| `get_sleep_data` | Sleep duration, stages, score, awakenings |
|
|
146
|
+
| `get_heart_rate_trends` | Resting, max, and average HR over time |
|
|
147
|
+
| `get_recovery_status` | Recovery score from HRV, sleep, stress, resting HR |
|
|
148
|
+
| `get_body_composition` | Weight, body fat, and muscle mass trends |
|
|
149
|
+
| `get_stress_levels` | Daily stress averages and trends |
|
|
150
|
+
| `get_vo2_max_trends` | VO2 max fitness trends over time |
|
|
151
|
+
| `get_training_insights` | Combined weekly summary (activities, sleep, recovery, stress) |
|
|
152
|
+
|
|
153
|
+
## CLI
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
garmin-bud setup # Interactive first-time setup (recommended)
|
|
157
|
+
garmin-bud serve # Remote HTTP MCP for web AI (claude.ai, ChatGPT)
|
|
158
|
+
garmin-bud check # Live diagnostics against all tools
|
|
159
|
+
garmin-bud start # Start the MCP server (stdio)
|
|
160
|
+
garmin-bud auth # Force re-authentication
|
|
161
|
+
garmin-bud cache clear # Clear cached data
|
|
162
|
+
garmin-bud status # Show session and cache status
|
|
163
|
+
garmin-bud --version # Print version
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Configuration
|
|
167
|
+
|
|
168
|
+
| Variable | Default | Description |
|
|
169
|
+
|----------|---------|-------------|
|
|
170
|
+
| `GARMIN_EMAIL` | — | Garmin Connect email |
|
|
171
|
+
| `GARMIN_PASSWORD` | — | Garmin Connect password |
|
|
172
|
+
| `GARMIN_SESSION_PATH` | `.garmin/session.json` | Session token storage |
|
|
173
|
+
| `GARMIN_LOG_PATH` | `.garmin/mcp.log` | Log file path |
|
|
174
|
+
| `GARMIN_CACHE_PATH` | `.garmin/cache.db` | SQLite cache database |
|
|
175
|
+
| `CACHE_TTL_ACTIVITIES` | `1800` | Activity cache TTL (seconds) |
|
|
176
|
+
| `CACHE_TTL_SLEEP` | `7200` | Sleep cache TTL (seconds) |
|
|
177
|
+
| `CACHE_TTL_STATS` | `3600` | Stats cache TTL (seconds) |
|
|
178
|
+
| `GARMIN_MCP_API_KEY` | auto-generated | Bearer token for HTTP MCP (`garmin-bud serve`) |
|
|
179
|
+
| `GARMIN_MCP_HOST` | `127.0.0.1` | Bind host for HTTP server |
|
|
180
|
+
| `GARMIN_MCP_PORT` | `3847` | Bind port for HTTP server |
|
|
181
|
+
|
|
182
|
+
## Security & privacy
|
|
183
|
+
|
|
184
|
+
- Credentials live only in your local `.env` file — never sent to a third party
|
|
185
|
+
- Session tokens in `.garmin/session.json` are as sensitive as a password
|
|
186
|
+
- Tool errors are sanitized before reaching the AI client
|
|
187
|
+
- Uses the unofficial [`garmin-connect`](https://www.npmjs.com/package/garmin-connect) npm package (not Garmin's enterprise OAuth API)
|
|
188
|
+
- **MFA is not supported** by the underlying library — disable MFA or use an app-specific password
|
|
189
|
+
|
|
190
|
+
## Troubleshooting
|
|
191
|
+
|
|
192
|
+
| Issue | Fix |
|
|
193
|
+
|-------|-----|
|
|
194
|
+
| Authentication failed | Verify `.env` credentials, run `garmin-bud auth` |
|
|
195
|
+
| MFA enabled on account | Disable MFA or use an app-specific password |
|
|
196
|
+
| Stale data | Run `garmin-bud cache clear` |
|
|
197
|
+
| Rate limited | Wait 60 seconds; cached responses are used when available |
|
|
198
|
+
| No sleep/HR data | Ensure your Garmin device has synced to Garmin Connect |
|
|
199
|
+
| Server won't start | Check that `GARMIN_EMAIL` and `GARMIN_PASSWORD` are set in `.env` |
|
|
200
|
+
|
|
201
|
+
## Development
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm install
|
|
205
|
+
npm run build
|
|
206
|
+
npm test # 33 tests via Node test runner
|
|
207
|
+
npm run lint
|
|
208
|
+
npm run dev # Start with auto-reload
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Use `.nvmrc` with nvm/fnm for Node 20. If your project path contains `#`, use `npm test` instead of `npm run test:vitest`.
|
|
212
|
+
|
|
213
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) and [docs/VAULT.md](./docs/VAULT.md) for architecture and design notes (Obsidian vault, outside this repo).
|
|
214
|
+
|
|
215
|
+
## Roadmap
|
|
216
|
+
|
|
217
|
+
- [x] VO2 max trends
|
|
218
|
+
- [x] Stress levels
|
|
219
|
+
- [x] Training insights
|
|
220
|
+
- [ ] Workout comparison
|
|
221
|
+
- [ ] Docker image
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT — see [LICENSE](./LICENSE).
|
|
226
|
+
|
|
227
|
+
Garmin Connect is a trademark of Garmin Ltd. This project is not affiliated with Garmin Ltd.
|
package/dist/appDb.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PairToken {
|
|
2
|
+
code: string;
|
|
3
|
+
created_at: number;
|
|
4
|
+
expires_at: number;
|
|
5
|
+
approved_at: number | null;
|
|
6
|
+
}
|
|
7
|
+
export interface PromptJob {
|
|
8
|
+
id: string;
|
|
9
|
+
prompt: string;
|
|
10
|
+
status: "pending" | "running" | "done" | "error";
|
|
11
|
+
result: string | null;
|
|
12
|
+
error: string | null;
|
|
13
|
+
created_at: number;
|
|
14
|
+
completed_at: number | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function getSetting(key: string): string | null;
|
|
17
|
+
export declare function setSetting(key: string, value: string): void;
|
|
18
|
+
export declare function deleteSetting(key: string): void;
|
|
19
|
+
export declare function createPairToken(): PairToken;
|
|
20
|
+
export declare function getPairToken(code: string): PairToken | null;
|
|
21
|
+
export declare function approvePairToken(code: string): boolean;
|
|
22
|
+
export declare function deletePairToken(code: string): void;
|
|
23
|
+
export declare function listPendingPairTokens(): PairToken[];
|
|
24
|
+
export declare function createPromptJob(id: string, prompt: string): PromptJob;
|
|
25
|
+
export declare function getPromptJob(id: string): PromptJob | null;
|
|
26
|
+
export declare function updatePromptJob(id: string, update: {
|
|
27
|
+
status: PromptJob["status"];
|
|
28
|
+
result?: string;
|
|
29
|
+
error?: string;
|
|
30
|
+
}): void;
|
|
31
|
+
export declare function closeAppDb(): void;
|
|
32
|
+
//# sourceMappingURL=appDb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appDb.d.ts","sourceRoot":"","sources":["../src/appDb.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MA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B,UAAU,IAAI,IAAI,CAKjC"}
|
package/dist/appDb.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import Database from "better-sqlite3";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { appConfig } from "./config.js";
|
|
5
|
+
// SECTION: App DB — settings, pair tokens, prompt jobs
|
|
6
|
+
const DB_PATH = path.resolve(path.dirname(appConfig.cachePath), "app.db");
|
|
7
|
+
let _db = null;
|
|
8
|
+
function getDb() {
|
|
9
|
+
if (_db)
|
|
10
|
+
return _db;
|
|
11
|
+
fs.mkdirSync(path.dirname(DB_PATH), { recursive: true });
|
|
12
|
+
_db = new Database(DB_PATH);
|
|
13
|
+
_db.exec(`
|
|
14
|
+
CREATE TABLE IF NOT EXISTS settings (
|
|
15
|
+
key TEXT PRIMARY KEY,
|
|
16
|
+
value TEXT NOT NULL
|
|
17
|
+
);
|
|
18
|
+
CREATE TABLE IF NOT EXISTS pair_tokens (
|
|
19
|
+
code TEXT PRIMARY KEY,
|
|
20
|
+
created_at INTEGER NOT NULL,
|
|
21
|
+
expires_at INTEGER NOT NULL,
|
|
22
|
+
approved_at INTEGER
|
|
23
|
+
);
|
|
24
|
+
CREATE TABLE IF NOT EXISTS prompt_jobs (
|
|
25
|
+
id TEXT PRIMARY KEY,
|
|
26
|
+
prompt TEXT NOT NULL,
|
|
27
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
28
|
+
result TEXT,
|
|
29
|
+
error TEXT,
|
|
30
|
+
created_at INTEGER NOT NULL,
|
|
31
|
+
completed_at INTEGER
|
|
32
|
+
);
|
|
33
|
+
`);
|
|
34
|
+
return _db;
|
|
35
|
+
}
|
|
36
|
+
// Settings
|
|
37
|
+
export function getSetting(key) {
|
|
38
|
+
const row = getDb().prepare("SELECT value FROM settings WHERE key = ?").get(key);
|
|
39
|
+
return row?.value ?? null;
|
|
40
|
+
}
|
|
41
|
+
export function setSetting(key, value) {
|
|
42
|
+
getDb()
|
|
43
|
+
.prepare("INSERT INTO settings (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value")
|
|
44
|
+
.run(key, value);
|
|
45
|
+
}
|
|
46
|
+
export function deleteSetting(key) {
|
|
47
|
+
getDb().prepare("DELETE FROM settings WHERE key = ?").run(key);
|
|
48
|
+
}
|
|
49
|
+
// Pair tokens
|
|
50
|
+
const PAIR_TOKEN_TTL_SECONDS = 5 * 60;
|
|
51
|
+
function randomCode() {
|
|
52
|
+
const digits = "0123456789";
|
|
53
|
+
let code = "";
|
|
54
|
+
for (let i = 0; i < 6; i++) {
|
|
55
|
+
code += digits[Math.floor(Math.random() * digits.length)];
|
|
56
|
+
}
|
|
57
|
+
return code;
|
|
58
|
+
}
|
|
59
|
+
export function createPairToken() {
|
|
60
|
+
const db = getDb();
|
|
61
|
+
const now = Math.floor(Date.now() / 1000);
|
|
62
|
+
const expiresAt = now + PAIR_TOKEN_TTL_SECONDS;
|
|
63
|
+
// Clean expired tokens
|
|
64
|
+
db.prepare("DELETE FROM pair_tokens WHERE expires_at < ?").run(now);
|
|
65
|
+
let code = randomCode();
|
|
66
|
+
let attempts = 0;
|
|
67
|
+
while (attempts < 10) {
|
|
68
|
+
const existing = db.prepare("SELECT code FROM pair_tokens WHERE code = ?").get(code);
|
|
69
|
+
if (!existing)
|
|
70
|
+
break;
|
|
71
|
+
code = randomCode();
|
|
72
|
+
attempts++;
|
|
73
|
+
}
|
|
74
|
+
const token = { code, created_at: now, expires_at: expiresAt, approved_at: null };
|
|
75
|
+
db.prepare("INSERT INTO pair_tokens (code, created_at, expires_at, approved_at) VALUES (?, ?, ?, NULL)")
|
|
76
|
+
.run(code, now, expiresAt);
|
|
77
|
+
return token;
|
|
78
|
+
}
|
|
79
|
+
export function getPairToken(code) {
|
|
80
|
+
const row = getDb()
|
|
81
|
+
.prepare("SELECT code, created_at, expires_at, approved_at FROM pair_tokens WHERE code = ?")
|
|
82
|
+
.get(code);
|
|
83
|
+
return row ?? null;
|
|
84
|
+
}
|
|
85
|
+
export function approvePairToken(code) {
|
|
86
|
+
const now = Math.floor(Date.now() / 1000);
|
|
87
|
+
const token = getPairToken(code);
|
|
88
|
+
if (!token || token.expires_at < now)
|
|
89
|
+
return false;
|
|
90
|
+
getDb()
|
|
91
|
+
.prepare("UPDATE pair_tokens SET approved_at = ? WHERE code = ?")
|
|
92
|
+
.run(now, code);
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
export function deletePairToken(code) {
|
|
96
|
+
getDb().prepare("DELETE FROM pair_tokens WHERE code = ?").run(code);
|
|
97
|
+
}
|
|
98
|
+
export function listPendingPairTokens() {
|
|
99
|
+
const now = Math.floor(Date.now() / 1000);
|
|
100
|
+
return getDb()
|
|
101
|
+
.prepare("SELECT code, created_at, expires_at, approved_at FROM pair_tokens WHERE expires_at > ? AND approved_at IS NULL ORDER BY created_at DESC")
|
|
102
|
+
.all(now);
|
|
103
|
+
}
|
|
104
|
+
// Prompt jobs
|
|
105
|
+
export function createPromptJob(id, prompt) {
|
|
106
|
+
const now = Math.floor(Date.now() / 1000);
|
|
107
|
+
const job = { id, prompt, status: "pending", result: null, error: null, created_at: now, completed_at: null };
|
|
108
|
+
getDb()
|
|
109
|
+
.prepare("INSERT INTO prompt_jobs (id, prompt, status, result, error, created_at, completed_at) VALUES (?, ?, 'pending', NULL, NULL, ?, NULL)")
|
|
110
|
+
.run(id, prompt, now);
|
|
111
|
+
return job;
|
|
112
|
+
}
|
|
113
|
+
export function getPromptJob(id) {
|
|
114
|
+
const row = getDb()
|
|
115
|
+
.prepare("SELECT id, prompt, status, result, error, created_at, completed_at FROM prompt_jobs WHERE id = ?")
|
|
116
|
+
.get(id);
|
|
117
|
+
return row ?? null;
|
|
118
|
+
}
|
|
119
|
+
export function updatePromptJob(id, update) {
|
|
120
|
+
const now = Math.floor(Date.now() / 1000);
|
|
121
|
+
getDb()
|
|
122
|
+
.prepare("UPDATE prompt_jobs SET status = ?, result = ?, error = ?, completed_at = ? WHERE id = ?")
|
|
123
|
+
.run(update.status, update.result ?? null, update.error ?? null, update.status === "done" || update.status === "error" ? now : null, id);
|
|
124
|
+
}
|
|
125
|
+
export function closeAppDb() {
|
|
126
|
+
if (_db) {
|
|
127
|
+
_db.close();
|
|
128
|
+
_db = null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=appDb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appDb.js","sourceRoot":"","sources":["../src/appDb.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,uDAAuD;AAEvD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAC1B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,EACjC,QAAQ,CACT,CAAC;AAmBF,IAAI,GAAG,GAA6B,IAAI,CAAC;AAEzC,SAAS,KAAK;IACZ,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IACpB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,GAAG,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5B,GAAG,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;GAoBR,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,WAAW;AAEX,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC,GAAG,CAAC,GAAG,CAElE,CAAC;IACd,OAAO,GAAG,EAAE,KAAK,IAAI,IAAI,CAAC;AAC5B,C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ACN,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,IAAI,GAAG,EAAE,CAAC;QACR,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,GAAG,GAAG,IAAI,CAAC;IACb,CAAC;AACH,CAAC"}
|
package/dist/check.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ToolCheckResult {
|
|
2
|
+
name: string;
|
|
3
|
+
ok: boolean;
|
|
4
|
+
summary: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function runLiveCheck(): Promise<ToolCheckResult[]>;
|
|
7
|
+
export declare function printLiveCheckResults(results: ToolCheckResult[]): void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAYA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AA2ID,wBAAsB,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAc/D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI,CAqBtE"}
|