@betterness/cli 1.0.0 → 1.1.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/CLI_REFERENCE.md +493 -0
- package/README.md +198 -0
- package/dist/index.js +45 -7
- package/package.json +6 -6
package/CLI_REFERENCE.md
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
# Betterness CLI Reference
|
|
2
|
+
|
|
3
|
+
> Auto-generated from command definitions — do not edit manually.
|
|
4
|
+
> Run `npm run docs` in `modules/betterness-cli` to regenerate.
|
|
5
|
+
|
|
6
|
+
Version: 0.1.0
|
|
7
|
+
|
|
8
|
+
## Global Options
|
|
9
|
+
|
|
10
|
+
These options apply to all commands:
|
|
11
|
+
|
|
12
|
+
| Option | Description |
|
|
13
|
+
|--------|-------------|
|
|
14
|
+
| `-V, --version` | output the version number |
|
|
15
|
+
| `--api-key <key>` | API key (overrides env and stored credentials) |
|
|
16
|
+
| `--json` | Output as JSON |
|
|
17
|
+
| `--markdown` | Output as Markdown |
|
|
18
|
+
| `--quiet` | Suppress output (exit code only) |
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
- **[auth](#auth)** — Manage authentication
|
|
23
|
+
- `auth login` — Save API key for authentication
|
|
24
|
+
- `auth logout` — Remove stored credentials
|
|
25
|
+
- `auth whoami` — Show the currently authenticated user
|
|
26
|
+
- **[profile](#profile)** — User profile information
|
|
27
|
+
- `profile get` — Retrieve current user profile (name, email, phone, gender, DOB, address)
|
|
28
|
+
- `profile update` — Update profile information (only provided fields are changed)
|
|
29
|
+
- **[biomarkers](#biomarkers)** — Biomarker lab results and LOINC codes
|
|
30
|
+
- `biomarkers search` — Search and filter biomarker lab results
|
|
31
|
+
- `biomarkers loinc-codes` — List all available LOINC codes for biomarker identification
|
|
32
|
+
- **[biological-age](#biological-age)** — Biological age calculations and history
|
|
33
|
+
- `biological-age get` — Get biological age history with biomarker values
|
|
34
|
+
- **[activity](#activity)** — Activity and workout data from connected wearables
|
|
35
|
+
- `activity get` — Retrieve activity and workout data (steps, distance, calories, VO2 max, workouts)
|
|
36
|
+
- **[sleep](#sleep)** — Sleep data from connected wearables
|
|
37
|
+
- `sleep get` — Retrieve nightly sleep data (time in bed, total sleep, sleep stage breakdown)
|
|
38
|
+
- `sleep stages` — Retrieve minute-by-minute sleep stage transitions (Deep, Core, REM, Awake)
|
|
39
|
+
- **[vitals](#vitals)** — Vital signs from connected wearables
|
|
40
|
+
- `vitals get` — Retrieve vital signs (heart rate, HRV, blood pressure, SpO2, glucose, respiratory rate)
|
|
41
|
+
- **[body-composition](#body-composition)** — Body composition data from connected wearables
|
|
42
|
+
- `body-composition get` — Retrieve body composition (weight, body fat %, muscle mass, BMI, waist circumference)
|
|
43
|
+
- **[connected-devices](#connected-devices)** — Health device integrations and wearable connections
|
|
44
|
+
- `connected-devices list` — List all connected health devices and wearables
|
|
45
|
+
- `connected-devices available` — List health device integrations the user can connect (not currently active)
|
|
46
|
+
- `connected-devices link` — Generate connection link for a web-based health device integration
|
|
47
|
+
- `connected-devices apple-health-code` — Generate connection code for Apple HealthKit via Junction app
|
|
48
|
+
- `connected-devices disconnect` — Disconnect a health device integration
|
|
49
|
+
- **[lab-tests](#lab-tests)** — Available lab tests for ordering
|
|
50
|
+
- `lab-tests list` — List available lab tests with prices and included markers
|
|
51
|
+
- **[lab-records](#lab-records)** — Lab records — uploaded results and purchased test orders
|
|
52
|
+
- `lab-records list` — List lab records (both uploaded results and lab orders)
|
|
53
|
+
- `lab-records detail` — Get full detail of a lab record by external ID
|
|
54
|
+
- **[lab-orders](#lab-orders)** — Lab order management — scheduling, appointments, and service centers
|
|
55
|
+
- `lab-orders initialize` — Initialize a lab order for processing (order must be in Paid status)
|
|
56
|
+
- `lab-orders service-centers` — Search lab service centers near a ZIP code
|
|
57
|
+
- `lab-orders slots` — Get available appointment time slots at a service center
|
|
58
|
+
- `lab-orders book` — Book a blood draw appointment at a service center
|
|
59
|
+
- `lab-orders reschedule` — Reschedule an existing blood draw appointment
|
|
60
|
+
- `lab-orders cancel` — Cancel a blood draw appointment (run without --reason-id to see available reasons)
|
|
61
|
+
- **[lab-results](#lab-results)** — Lab result management — approve, update biomarkers, update metadata
|
|
62
|
+
- `lab-results update-status` — Update lab result status (APPROVE, ROLLBACK, or REPROCESS)
|
|
63
|
+
- `lab-results update-biomarker` — Update or delete a biomarker value within an uploaded lab result
|
|
64
|
+
- `lab-results update-metadata` — Update metadata of an uploaded lab result (patient info and test details)
|
|
65
|
+
- `lab-results upload` — Upload a lab result PDF for processing
|
|
66
|
+
- **[purchases](#purchases)** — Lab test purchases and payment methods
|
|
67
|
+
- `purchases payment-methods` — List saved payment methods (credit/debit cards)
|
|
68
|
+
- `purchases buy` — Purchase a lab test using a saved payment method
|
|
69
|
+
- `purchases checkout` — Generate a Stripe Checkout payment link for a lab test (for users without saved cards)
|
|
70
|
+
- **[smart-listings](#smart-listings)** — Search and browse wellness providers (SmartListings)
|
|
71
|
+
- `smart-listings search` — Search SmartListings by name, description, tags, or location
|
|
72
|
+
- `smart-listings detail` — Get full details of a SmartListing by ID
|
|
73
|
+
- **[workflow](#workflow)** — Composite commands that aggregate data from multiple endpoints
|
|
74
|
+
- `workflow daily-brief` — Daily health summary — profile, biological age, biomarkers, devices
|
|
75
|
+
- `workflow next-actions` — Recommended next actions based on biomarkers and health data
|
|
76
|
+
- **[schema](#schema)** — Discover available commands, options, and response formats
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## auth
|
|
81
|
+
|
|
82
|
+
Manage authentication
|
|
83
|
+
|
|
84
|
+
### `betterness auth login`
|
|
85
|
+
|
|
86
|
+
Save API key for authentication
|
|
87
|
+
|
|
88
|
+
| Option | Description |
|
|
89
|
+
|--------|-------------|
|
|
90
|
+
| `--key <apiKey>` | API key to save (if not provided, will prompt) |
|
|
91
|
+
|
|
92
|
+
### `betterness auth logout`
|
|
93
|
+
|
|
94
|
+
Remove stored credentials
|
|
95
|
+
|
|
96
|
+
### `betterness auth whoami`
|
|
97
|
+
|
|
98
|
+
Show the currently authenticated user
|
|
99
|
+
|
|
100
|
+
## profile
|
|
101
|
+
|
|
102
|
+
User profile information
|
|
103
|
+
|
|
104
|
+
### `betterness profile get`
|
|
105
|
+
|
|
106
|
+
Retrieve current user profile (name, email, phone, gender, DOB, address)
|
|
107
|
+
|
|
108
|
+
### `betterness profile update`
|
|
109
|
+
|
|
110
|
+
Update profile information (only provided fields are changed)
|
|
111
|
+
|
|
112
|
+
| Option | Description |
|
|
113
|
+
|--------|-------------|
|
|
114
|
+
| `--first-name <name>` | First name |
|
|
115
|
+
| `--last-name <name>` | Last name |
|
|
116
|
+
| `--phone <number>` | Phone number without dial code |
|
|
117
|
+
| `--phone-dial-code <code>` | Phone dial code (e.g. +1, +44) |
|
|
118
|
+
| `--gender <value>` | Gender: MALE, FEMALE, OTHER, or PREF_NOT |
|
|
119
|
+
| `--birth-date <YYYY-MM-DD>` | Date of birth |
|
|
120
|
+
| `--address <street>` | Home street address |
|
|
121
|
+
| `--city <city>` | City |
|
|
122
|
+
| `--state <state>` | State or province |
|
|
123
|
+
| `--zip-code <zip>` | ZIP or postal code |
|
|
124
|
+
| `--country <code>` | Country (e.g. US, GB) |
|
|
125
|
+
| `--dry-run` | Preview changes without applying |
|
|
126
|
+
|
|
127
|
+
## biomarkers
|
|
128
|
+
|
|
129
|
+
Biomarker lab results and LOINC codes
|
|
130
|
+
|
|
131
|
+
### `betterness biomarkers search`
|
|
132
|
+
|
|
133
|
+
Search and filter biomarker lab results
|
|
134
|
+
|
|
135
|
+
| Option | Description |
|
|
136
|
+
|--------|-------------|
|
|
137
|
+
| `--name <text>` | Filter by biomarker name |
|
|
138
|
+
| `--loinc-code <code>` | Filter by LOINC code |
|
|
139
|
+
| `--start-date <YYYY-MM-DD>` | Start date (ISO-8601) |
|
|
140
|
+
| `--end-date <YYYY-MM-DD>` | End date (ISO-8601) |
|
|
141
|
+
| `--categories <list>` | Comma-separated category filter |
|
|
142
|
+
| `--range <type>` | Range filter: OPTIMAL, AVERAGE, OUT_OF_RANGE, UNKNOWN |
|
|
143
|
+
| `--limit <n>` | Maximum number of results (default: `20`) |
|
|
144
|
+
|
|
145
|
+
### `betterness biomarkers loinc-codes`
|
|
146
|
+
|
|
147
|
+
List all available LOINC codes for biomarker identification
|
|
148
|
+
|
|
149
|
+
## biological-age
|
|
150
|
+
|
|
151
|
+
Biological age calculations and history
|
|
152
|
+
|
|
153
|
+
### `betterness biological-age get`
|
|
154
|
+
|
|
155
|
+
Get biological age history with biomarker values
|
|
156
|
+
|
|
157
|
+
| Option | Description |
|
|
158
|
+
|--------|-------------|
|
|
159
|
+
| `--limit <n>` | Maximum number of results (default: `10`) |
|
|
160
|
+
|
|
161
|
+
## activity
|
|
162
|
+
|
|
163
|
+
Activity and workout data from connected wearables
|
|
164
|
+
|
|
165
|
+
### `betterness activity get`
|
|
166
|
+
|
|
167
|
+
Retrieve activity and workout data (steps, distance, calories, VO2 max, workouts)
|
|
168
|
+
|
|
169
|
+
| Option | Description |
|
|
170
|
+
|--------|-------------|
|
|
171
|
+
| `--from <YYYY-MM-DD>` | Start date (default: `2026-03-13`) |
|
|
172
|
+
| `--to <YYYY-MM-DD>` | End date |
|
|
173
|
+
| `--timezone <tz>` | IANA timezone (default: `America/Mendoza`) |
|
|
174
|
+
|
|
175
|
+
## sleep
|
|
176
|
+
|
|
177
|
+
Sleep data from connected wearables
|
|
178
|
+
|
|
179
|
+
### `betterness sleep get`
|
|
180
|
+
|
|
181
|
+
Retrieve nightly sleep data (time in bed, total sleep, sleep stage breakdown)
|
|
182
|
+
|
|
183
|
+
| Option | Description |
|
|
184
|
+
|--------|-------------|
|
|
185
|
+
| `--from <YYYY-MM-DD>` | Start date (default: `2026-03-13`) |
|
|
186
|
+
| `--to <YYYY-MM-DD>` | End date |
|
|
187
|
+
| `--timezone <tz>` | IANA timezone (default: `America/Mendoza`) |
|
|
188
|
+
|
|
189
|
+
### `betterness sleep stages`
|
|
190
|
+
|
|
191
|
+
Retrieve minute-by-minute sleep stage transitions (Deep, Core, REM, Awake)
|
|
192
|
+
|
|
193
|
+
| Option | Description |
|
|
194
|
+
|--------|-------------|
|
|
195
|
+
| `--from <YYYY-MM-DD>` | Start date (default: `2026-03-13`) |
|
|
196
|
+
| `--to <YYYY-MM-DD>` | End date |
|
|
197
|
+
| `--timezone <tz>` | IANA timezone (default: `America/Mendoza`) |
|
|
198
|
+
|
|
199
|
+
## vitals
|
|
200
|
+
|
|
201
|
+
Vital signs from connected wearables
|
|
202
|
+
|
|
203
|
+
### `betterness vitals get`
|
|
204
|
+
|
|
205
|
+
Retrieve vital signs (heart rate, HRV, blood pressure, SpO2, glucose, respiratory rate)
|
|
206
|
+
|
|
207
|
+
| Option | Description |
|
|
208
|
+
|--------|-------------|
|
|
209
|
+
| `--from <YYYY-MM-DD>` | Start date (default: `2026-03-13`) |
|
|
210
|
+
| `--to <YYYY-MM-DD>` | End date |
|
|
211
|
+
| `--timezone <tz>` | IANA timezone (default: `America/Mendoza`) |
|
|
212
|
+
|
|
213
|
+
## body-composition
|
|
214
|
+
|
|
215
|
+
Body composition data from connected wearables
|
|
216
|
+
|
|
217
|
+
### `betterness body-composition get`
|
|
218
|
+
|
|
219
|
+
Retrieve body composition (weight, body fat %, muscle mass, BMI, waist circumference)
|
|
220
|
+
|
|
221
|
+
| Option | Description |
|
|
222
|
+
|--------|-------------|
|
|
223
|
+
| `--from <YYYY-MM-DD>` | Start date (default: `2026-03-13`) |
|
|
224
|
+
| `--to <YYYY-MM-DD>` | End date |
|
|
225
|
+
| `--timezone <tz>` | IANA timezone (default: `America/Mendoza`) |
|
|
226
|
+
|
|
227
|
+
## connected-devices
|
|
228
|
+
|
|
229
|
+
Health device integrations and wearable connections
|
|
230
|
+
|
|
231
|
+
### `betterness connected-devices list`
|
|
232
|
+
|
|
233
|
+
List all connected health devices and wearables
|
|
234
|
+
|
|
235
|
+
### `betterness connected-devices available`
|
|
236
|
+
|
|
237
|
+
List health device integrations the user can connect (not currently active)
|
|
238
|
+
|
|
239
|
+
### `betterness connected-devices link`
|
|
240
|
+
|
|
241
|
+
Generate connection link for a web-based health device integration
|
|
242
|
+
|
|
243
|
+
| Option | Description |
|
|
244
|
+
|--------|-------------|
|
|
245
|
+
| `--integration-key <key>` | Integration provider (GARMIN, OURA, WITHINGS, PELOTON, WAHOO, EIGHT_SLEEP) **(required)** |
|
|
246
|
+
|
|
247
|
+
### `betterness connected-devices apple-health-code`
|
|
248
|
+
|
|
249
|
+
Generate connection code for Apple HealthKit via Junction app
|
|
250
|
+
|
|
251
|
+
### `betterness connected-devices disconnect`
|
|
252
|
+
|
|
253
|
+
Disconnect a health device integration
|
|
254
|
+
|
|
255
|
+
| Option | Description |
|
|
256
|
+
|--------|-------------|
|
|
257
|
+
| `--integration-key <key>` | Integration provider to disconnect **(required)** |
|
|
258
|
+
| `--dry-run` | Preview the disconnection without executing |
|
|
259
|
+
|
|
260
|
+
## lab-tests
|
|
261
|
+
|
|
262
|
+
Available lab tests for ordering
|
|
263
|
+
|
|
264
|
+
### `betterness lab-tests list`
|
|
265
|
+
|
|
266
|
+
List available lab tests with prices and included markers
|
|
267
|
+
|
|
268
|
+
| Option | Description |
|
|
269
|
+
|--------|-------------|
|
|
270
|
+
| `--query <text>` | Search by name or description |
|
|
271
|
+
| `--popular` | Only show popular tests |
|
|
272
|
+
| `--loinc-slug <slug>` | Filter by LOINC slug |
|
|
273
|
+
|
|
274
|
+
## lab-records
|
|
275
|
+
|
|
276
|
+
Lab records — uploaded results and purchased test orders
|
|
277
|
+
|
|
278
|
+
### `betterness lab-records list`
|
|
279
|
+
|
|
280
|
+
List lab records (both uploaded results and lab orders)
|
|
281
|
+
|
|
282
|
+
| Option | Description |
|
|
283
|
+
|--------|-------------|
|
|
284
|
+
| `--limit <n>` | Results per page (default: `20`) |
|
|
285
|
+
| `--page <n>` | Page number (zero-based) (default: `0`) |
|
|
286
|
+
|
|
287
|
+
### `betterness lab-records detail`
|
|
288
|
+
|
|
289
|
+
Get full detail of a lab record by external ID
|
|
290
|
+
|
|
291
|
+
| Option | Description |
|
|
292
|
+
|--------|-------------|
|
|
293
|
+
| `--record-id <id>` | Lab record external ID **(required)** |
|
|
294
|
+
|
|
295
|
+
## lab-orders
|
|
296
|
+
|
|
297
|
+
Lab order management — scheduling, appointments, and service centers
|
|
298
|
+
|
|
299
|
+
### `betterness lab-orders initialize`
|
|
300
|
+
|
|
301
|
+
Initialize a lab order for processing (order must be in Paid status)
|
|
302
|
+
|
|
303
|
+
| Option | Description |
|
|
304
|
+
|--------|-------------|
|
|
305
|
+
| `--order-id <id>` | Lab order external ID **(required)** |
|
|
306
|
+
| `--dry-run` | Preview the action without executing |
|
|
307
|
+
|
|
308
|
+
### `betterness lab-orders service-centers`
|
|
309
|
+
|
|
310
|
+
Search lab service centers near a ZIP code
|
|
311
|
+
|
|
312
|
+
| Option | Description |
|
|
313
|
+
|--------|-------------|
|
|
314
|
+
| `--zip-code <zip>` | ZIP code to search near **(required)** |
|
|
315
|
+
| `--order-id <id>` | Lab order external ID **(required)** |
|
|
316
|
+
| `--limit <n>` | Maximum results (default: `6`) |
|
|
317
|
+
| `--offset <n>` | Pagination offset (default: `0`) |
|
|
318
|
+
|
|
319
|
+
### `betterness lab-orders slots`
|
|
320
|
+
|
|
321
|
+
Get available appointment time slots at a service center
|
|
322
|
+
|
|
323
|
+
| Option | Description |
|
|
324
|
+
|--------|-------------|
|
|
325
|
+
| `--site-code <code>` | Service center site code **(required)** |
|
|
326
|
+
| `--order-id <id>` | Lab order external ID **(required)** |
|
|
327
|
+
| `--timezone <tz>` | IANA timezone **(required)** |
|
|
328
|
+
| `--start-date <YYYY-MM-DD>` | Start date for slot search |
|
|
329
|
+
| `--range-days <n>` | Number of days to search (default: `7`) |
|
|
330
|
+
|
|
331
|
+
### `betterness lab-orders book`
|
|
332
|
+
|
|
333
|
+
Book a blood draw appointment at a service center
|
|
334
|
+
|
|
335
|
+
| Option | Description |
|
|
336
|
+
|--------|-------------|
|
|
337
|
+
| `--order-id <id>` | Lab order external ID **(required)** |
|
|
338
|
+
| `--booking-key <key>` | Booking key from slots command **(required)** |
|
|
339
|
+
| `--timezone <tz>` | IANA timezone **(required)** |
|
|
340
|
+
| `--dry-run` | Preview the booking without executing |
|
|
341
|
+
|
|
342
|
+
### `betterness lab-orders reschedule`
|
|
343
|
+
|
|
344
|
+
Reschedule an existing blood draw appointment
|
|
345
|
+
|
|
346
|
+
| Option | Description |
|
|
347
|
+
|--------|-------------|
|
|
348
|
+
| `--order-id <id>` | Lab order external ID **(required)** |
|
|
349
|
+
| `--booking-key <key>` | New booking key from slots command **(required)** |
|
|
350
|
+
| `--timezone <tz>` | IANA timezone **(required)** |
|
|
351
|
+
| `--dry-run` | Preview the reschedule without executing |
|
|
352
|
+
|
|
353
|
+
### `betterness lab-orders cancel`
|
|
354
|
+
|
|
355
|
+
Cancel a blood draw appointment (run without --reason-id to see available reasons)
|
|
356
|
+
|
|
357
|
+
| Option | Description |
|
|
358
|
+
|--------|-------------|
|
|
359
|
+
| `--order-id <id>` | Lab order external ID **(required)** |
|
|
360
|
+
| `--reason-id <id>` | Cancellation reason ID |
|
|
361
|
+
| `--dry-run` | Preview the cancellation without executing |
|
|
362
|
+
|
|
363
|
+
## lab-results
|
|
364
|
+
|
|
365
|
+
Lab result management — approve, update biomarkers, update metadata
|
|
366
|
+
|
|
367
|
+
### `betterness lab-results update-status`
|
|
368
|
+
|
|
369
|
+
Update lab result status (APPROVE, ROLLBACK, or REPROCESS)
|
|
370
|
+
|
|
371
|
+
| Option | Description |
|
|
372
|
+
|--------|-------------|
|
|
373
|
+
| `--result-id <id>` | Lab result external ID **(required)** |
|
|
374
|
+
| `--action <action>` | Action: APPROVE, ROLLBACK, or REPROCESS **(required)** |
|
|
375
|
+
|
|
376
|
+
### `betterness lab-results update-biomarker`
|
|
377
|
+
|
|
378
|
+
Update or delete a biomarker value within an uploaded lab result
|
|
379
|
+
|
|
380
|
+
| Option | Description |
|
|
381
|
+
|--------|-------------|
|
|
382
|
+
| `--biomarker-id <id>` | Biomarker external ID **(required)** |
|
|
383
|
+
| `--action <action>` | Set to DELETE to remove the biomarker |
|
|
384
|
+
| `--name <name>` | Biomarker name |
|
|
385
|
+
| `--result <value>` | Biomarker value (e.g. '5.2', '120') |
|
|
386
|
+
| `--unit <unit>` | Unit (e.g. 'mg/dL', 'ng/mL') |
|
|
387
|
+
| `--min-range <n>` | Minimum range value |
|
|
388
|
+
| `--max-range <n>` | Maximum range value |
|
|
389
|
+
|
|
390
|
+
### `betterness lab-results update-metadata`
|
|
391
|
+
|
|
392
|
+
Update metadata of an uploaded lab result (patient info and test details)
|
|
393
|
+
|
|
394
|
+
| Option | Description |
|
|
395
|
+
|--------|-------------|
|
|
396
|
+
| `--result-id <id>` | Lab result external ID **(required)** |
|
|
397
|
+
| `--patient-name <name>` | Patient name |
|
|
398
|
+
| `--patient-sex <sex>` | Patient sex: MALE or FEMALE |
|
|
399
|
+
| `--dob <date>` | Date of birth |
|
|
400
|
+
| `--lab-name <name>` | Lab name |
|
|
401
|
+
| `--ordering-physician <name>` | Ordering physician |
|
|
402
|
+
| `--date-collected <date>` | Date collected (ISO-8601) |
|
|
403
|
+
| `--fasting` | Mark as fasting test |
|
|
404
|
+
|
|
405
|
+
### `betterness lab-results upload`
|
|
406
|
+
|
|
407
|
+
Upload a lab result PDF for processing
|
|
408
|
+
|
|
409
|
+
| Option | Description |
|
|
410
|
+
|--------|-------------|
|
|
411
|
+
| `--file <path>` | Path to the PDF file **(required)** |
|
|
412
|
+
|
|
413
|
+
## purchases
|
|
414
|
+
|
|
415
|
+
Lab test purchases and payment methods
|
|
416
|
+
|
|
417
|
+
### `betterness purchases payment-methods`
|
|
418
|
+
|
|
419
|
+
List saved payment methods (credit/debit cards)
|
|
420
|
+
|
|
421
|
+
### `betterness purchases buy`
|
|
422
|
+
|
|
423
|
+
Purchase a lab test using a saved payment method
|
|
424
|
+
|
|
425
|
+
| Option | Description |
|
|
426
|
+
|--------|-------------|
|
|
427
|
+
| `--test-key <key>` | Lab test object key **(required)** |
|
|
428
|
+
| `--payment-method-id <id>` | Payment method external ID **(required)** |
|
|
429
|
+
| `--promo-code <code>` | Promotion code |
|
|
430
|
+
| `--dry-run` | Preview what would be purchased without executing |
|
|
431
|
+
|
|
432
|
+
### `betterness purchases checkout`
|
|
433
|
+
|
|
434
|
+
Generate a Stripe Checkout payment link for a lab test (for users without saved cards)
|
|
435
|
+
|
|
436
|
+
| Option | Description |
|
|
437
|
+
|--------|-------------|
|
|
438
|
+
| `--test-key <key>` | Lab test object key **(required)** |
|
|
439
|
+
| `--success-url <url>` | URL to redirect after successful payment **(required)** |
|
|
440
|
+
| `--cancel-url <url>` | URL to redirect if checkout is cancelled **(required)** |
|
|
441
|
+
| `--promo-code <code>` | Promotion code |
|
|
442
|
+
| `--dry-run` | Preview the checkout request without executing |
|
|
443
|
+
|
|
444
|
+
## smart-listings
|
|
445
|
+
|
|
446
|
+
Search and browse wellness providers (SmartListings)
|
|
447
|
+
|
|
448
|
+
### `betterness smart-listings search`
|
|
449
|
+
|
|
450
|
+
Search SmartListings by name, description, tags, or location
|
|
451
|
+
|
|
452
|
+
| Option | Description |
|
|
453
|
+
|--------|-------------|
|
|
454
|
+
| `--query <text>` | Text search query |
|
|
455
|
+
| `--lat <n>` | Latitude for proximity search |
|
|
456
|
+
| `--lng <n>` | Longitude for proximity search |
|
|
457
|
+
| `--radius <km>` | Radius in km (1, 2, 5, 10, 20) |
|
|
458
|
+
| `--following` | Only show followed providers |
|
|
459
|
+
| `--limit <n>` | Results per page (default: `10`) |
|
|
460
|
+
| `--page <n>` | Page number (zero-based) (default: `0`) |
|
|
461
|
+
|
|
462
|
+
### `betterness smart-listings detail`
|
|
463
|
+
|
|
464
|
+
Get full details of a SmartListing by ID
|
|
465
|
+
|
|
466
|
+
| Option | Description |
|
|
467
|
+
|--------|-------------|
|
|
468
|
+
| `--id <externalId>` | SmartListing external ID **(required)** |
|
|
469
|
+
|
|
470
|
+
## workflow
|
|
471
|
+
|
|
472
|
+
Composite commands that aggregate data from multiple endpoints
|
|
473
|
+
|
|
474
|
+
### `betterness workflow daily-brief`
|
|
475
|
+
|
|
476
|
+
Daily health summary — profile, biological age, biomarkers, devices
|
|
477
|
+
|
|
478
|
+
| Option | Description |
|
|
479
|
+
|--------|-------------|
|
|
480
|
+
| `--biomarker-limit <n>` | Maximum biomarkers to fetch (default: `20`) |
|
|
481
|
+
|
|
482
|
+
### `betterness workflow next-actions`
|
|
483
|
+
|
|
484
|
+
Recommended next actions based on biomarkers and health data
|
|
485
|
+
|
|
486
|
+
| Option | Description |
|
|
487
|
+
|--------|-------------|
|
|
488
|
+
| `--biomarker-limit <n>` | Maximum biomarkers to analyze (default: `50`) |
|
|
489
|
+
|
|
490
|
+
### `betterness schema`
|
|
491
|
+
|
|
492
|
+
Discover available commands, options, and response formats
|
|
493
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# @betterness/cli
|
|
2
|
+
|
|
3
|
+
Terminal interface for the [Betterness](https://betterness.com) health & wellness platform. Access your biomarkers, lab results, wearable data, and more from the command line — or let AI agents work with your health data programmatically.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @betterness/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Node.js 20+.
|
|
12
|
+
|
|
13
|
+
## Authentication
|
|
14
|
+
|
|
15
|
+
Get your API key from either:
|
|
16
|
+
|
|
17
|
+
- [app.betti.bot/settings/betterness-mcp](https://app.betti.bot/settings/betterness-mcp)
|
|
18
|
+
- [betterness.ai/mcp/keys](https://www.betterness.ai/mcp/keys)
|
|
19
|
+
|
|
20
|
+
The same key works for both the CLI and the [Betterness MCP server](https://www.betterness.ai/mcp).
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
betterness auth login --key bk_your_api_key
|
|
24
|
+
betterness auth whoami # verify
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You can also set the `BETTERNESS_API_KEY` environment variable instead of storing credentials.
|
|
28
|
+
|
|
29
|
+
Priority: `--api-key` flag > `BETTERNESS_API_KEY` env var > stored credentials.
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Your profile
|
|
35
|
+
betterness profile get
|
|
36
|
+
|
|
37
|
+
# Daily health summary
|
|
38
|
+
betterness workflow daily-brief
|
|
39
|
+
|
|
40
|
+
# Recent biomarker results
|
|
41
|
+
betterness biomarkers search --limit 10
|
|
42
|
+
|
|
43
|
+
# Activity from your wearable
|
|
44
|
+
betterness activity get --from 2025-01-01
|
|
45
|
+
|
|
46
|
+
# Recommended next actions
|
|
47
|
+
betterness workflow next-actions
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Output Formats
|
|
51
|
+
|
|
52
|
+
Every command supports three output modes via global flags:
|
|
53
|
+
|
|
54
|
+
| Flag | Format | Use case |
|
|
55
|
+
|------|--------|----------|
|
|
56
|
+
| *(default)* | Formatted table | Human reading |
|
|
57
|
+
| `--json` | JSON | Scripting, piping to `jq` |
|
|
58
|
+
| `--markdown` | Markdown | AI agents, documentation |
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
betterness biomarkers search --json | jq '.[] | .name'
|
|
62
|
+
betterness profile get --markdown
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Commands
|
|
66
|
+
|
|
67
|
+
### Profile
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
betterness profile get # View profile
|
|
71
|
+
betterness profile update --city "New York" --state NY # Update fields
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Biomarkers & Biological Age
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
betterness biomarkers search # All recent results
|
|
78
|
+
betterness biomarkers search --name cholesterol # Filter by name
|
|
79
|
+
betterness biomarkers search --range OUT_OF_RANGE # Out-of-range only
|
|
80
|
+
betterness biomarkers loinc-codes # Available LOINC codes
|
|
81
|
+
betterness biological-age get # Age calculation history
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Wearable Data
|
|
85
|
+
|
|
86
|
+
Requires a connected device (Apple Health, Garmin, Oura, Withings, etc.).
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
betterness activity get --from 2025-01-01 --to 2025-01-31
|
|
90
|
+
betterness sleep get --from 2025-01-01
|
|
91
|
+
betterness sleep stages --from 2025-01-01
|
|
92
|
+
betterness vitals get --from 2025-01-01
|
|
93
|
+
betterness body-composition get --from 2025-01-01
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Connected Devices
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
betterness connected-devices list # Active connections
|
|
100
|
+
betterness connected-devices available # Available integrations
|
|
101
|
+
betterness connected-devices link --integration-key GARMIN
|
|
102
|
+
betterness connected-devices apple-health-code # Apple HealthKit code
|
|
103
|
+
betterness connected-devices disconnect --integration-key OURA
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Lab Tests & Orders
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Browse and purchase
|
|
110
|
+
betterness lab-tests list --popular
|
|
111
|
+
betterness purchases buy --test-key <key> --payment-method-id <id>
|
|
112
|
+
betterness purchases checkout --test-key <key> --success-url <url> --cancel-url <url>
|
|
113
|
+
|
|
114
|
+
# Manage orders
|
|
115
|
+
betterness lab-orders initialize --order-id <id>
|
|
116
|
+
betterness lab-orders service-centers --zip-code 10001 --order-id <id>
|
|
117
|
+
betterness lab-orders slots --site-code <code> --order-id <id> --timezone America/New_York
|
|
118
|
+
betterness lab-orders book --order-id <id> --booking-key <key> --timezone America/New_York
|
|
119
|
+
|
|
120
|
+
# Upload results
|
|
121
|
+
betterness lab-results upload --file ./bloodwork.pdf
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Lab Records & Results
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
betterness lab-records list
|
|
128
|
+
betterness lab-records detail --record-id <id>
|
|
129
|
+
betterness lab-results update-status --result-id <id> --action APPROVE
|
|
130
|
+
betterness lab-results update-biomarker --biomarker-id <id> --result 5.2 --unit "mg/dL"
|
|
131
|
+
betterness lab-results update-metadata --result-id <id> --patient-name "Jane Doe"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Smart Listings (Wellness Providers)
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
betterness smart-listings search --query "yoga" --lat 40.7 --lng -74.0 --radius 10
|
|
138
|
+
betterness smart-listings detail --id <externalId>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Workflow (Composite Commands)
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
betterness workflow daily-brief # Full health snapshot
|
|
145
|
+
betterness workflow next-actions # AI-driven recommendations
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Schema Discovery
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
betterness schema # All commands, options, and response formats as JSON
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Useful for AI agents to discover capabilities at runtime.
|
|
155
|
+
|
|
156
|
+
## Agent & MCP Integration
|
|
157
|
+
|
|
158
|
+
The CLI is designed to be consumed by AI agents. Key features:
|
|
159
|
+
|
|
160
|
+
- `--json` output for structured data parsing
|
|
161
|
+
- `--markdown` output optimized for LLM context windows
|
|
162
|
+
- `betterness schema` for runtime capability discovery
|
|
163
|
+
- `--quiet` mode for exit-code-only checks
|
|
164
|
+
- `--dry-run` on destructive commands for safe planning
|
|
165
|
+
|
|
166
|
+
### Skills
|
|
167
|
+
|
|
168
|
+
Agent skills teach your AI coding agent the Betterness API surface — endpoints, schemas, and workflows — so it can build integrations without guessing. Available in the [betterness-cli](https://github.com/Betterness/betterness-cli) repo under `.agents/skills/`:
|
|
169
|
+
|
|
170
|
+
| Skill | Description |
|
|
171
|
+
|-------|-------------|
|
|
172
|
+
| [biomarkers-api](https://github.com/Betterness/betterness-cli/tree/main/.agents/skills/biomarkers-api) | Biomarkers, lab tests, lab orders, health records, biological age, purchases, Stripe flows |
|
|
173
|
+
| [perks-api](https://github.com/Betterness/betterness-cli/tree/main/.agents/skills/perks-api) | Perks management, browsing, partner profiles, collaboration workflow |
|
|
174
|
+
|
|
175
|
+
#### Installing skills
|
|
176
|
+
|
|
177
|
+
Install all skills into your agent with a single command (auto-detects Claude Code, Codex, Cursor, Windsurf, Cline, OpenClaw, and [40+ more](https://github.com/vercel-labs/skills)):
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npx skills add https://github.com/Betterness/betterness-cli
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Or install a specific skill:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npx skills add https://github.com/Betterness/betterness-cli --skill biomarkers-api
|
|
187
|
+
npx skills add https://github.com/Betterness/betterness-cli --skill perks-api
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Each skill folder contains a `SKILL.md` (activation rules and patterns) and a `references/` directory with full API specs.
|
|
191
|
+
|
|
192
|
+
## Full CLI Reference
|
|
193
|
+
|
|
194
|
+
See [CLI_REFERENCE.md](https://github.com/Betterness/betterness-cli/blob/main/CLI_REFERENCE.md) for the complete list of commands, options, and descriptions.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
Proprietary.
|
package/dist/index.js
CHANGED
|
@@ -92,10 +92,10 @@ var ApiClient = class {
|
|
|
92
92
|
constructor(options = {}) {
|
|
93
93
|
const credentials = resolveCredentials(options.apiKey);
|
|
94
94
|
this.apiKey = credentials.apiKey;
|
|
95
|
-
const apiUrl =
|
|
95
|
+
const apiUrl = "https://api.betterness.com";
|
|
96
96
|
if (!apiUrl) {
|
|
97
97
|
throw new CliError(
|
|
98
|
-
"No API URL configured.
|
|
98
|
+
"No API URL configured. This is a build error \u2014 BETTERNESS_API_URL should be baked in at build time.",
|
|
99
99
|
"CONFIG_MISSING"
|
|
100
100
|
);
|
|
101
101
|
}
|
|
@@ -125,7 +125,7 @@ var ApiClient = class {
|
|
|
125
125
|
headers: {
|
|
126
126
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
127
127
|
"Content-Type": "application/json",
|
|
128
|
-
"User-Agent":
|
|
128
|
+
"User-Agent": `betterness-cli/${"1.1.0"}`,
|
|
129
129
|
"Accept": "application/json"
|
|
130
130
|
},
|
|
131
131
|
body: body ? JSON.stringify(body) : void 0,
|
|
@@ -189,7 +189,7 @@ var ApiClient = class {
|
|
|
189
189
|
method: "POST",
|
|
190
190
|
headers: {
|
|
191
191
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
192
|
-
"User-Agent":
|
|
192
|
+
"User-Agent": `betterness-cli/${"1.1.0"}`,
|
|
193
193
|
"Accept": "application/json"
|
|
194
194
|
},
|
|
195
195
|
body: formData,
|
|
@@ -1341,10 +1341,10 @@ function registerLabResultsCommands(program2) {
|
|
|
1341
1341
|
});
|
|
1342
1342
|
labResults.command("upload").description("Upload a lab result PDF for processing").requiredOption("--file <path>", "Path to the PDF file").action(async (opts, cmd) => {
|
|
1343
1343
|
try {
|
|
1344
|
-
const { existsSync:
|
|
1344
|
+
const { existsSync: existsSync3 } = await import("fs");
|
|
1345
1345
|
const { resolve } = await import("path");
|
|
1346
1346
|
const filePath = resolve(opts.file);
|
|
1347
|
-
if (!
|
|
1347
|
+
if (!existsSync3(filePath)) {
|
|
1348
1348
|
console.error(`File not found: ${filePath}`);
|
|
1349
1349
|
process.exit(1);
|
|
1350
1350
|
}
|
|
@@ -1806,10 +1806,47 @@ function registerSchemaCommand(program2) {
|
|
|
1806
1806
|
});
|
|
1807
1807
|
}
|
|
1808
1808
|
|
|
1809
|
+
// src/commands/debug.ts
|
|
1810
|
+
import { homedir as homedir2 } from "os";
|
|
1811
|
+
import { join as join2 } from "path";
|
|
1812
|
+
import { existsSync as existsSync2 } from "fs";
|
|
1813
|
+
function registerDebugCommands(program2) {
|
|
1814
|
+
const debug = program2.command("debug", { hidden: true }).description("Internal debug utilities");
|
|
1815
|
+
debug.command("config").description("Show resolved configuration").action((_, cmd) => {
|
|
1816
|
+
const credentialsPath = join2(homedir2(), ".betterness", "credentials.json");
|
|
1817
|
+
const stored = loadCredentials();
|
|
1818
|
+
const envKey = process.env.BETTERNESS_API_KEY;
|
|
1819
|
+
const parentOpts = cmd.optsWithGlobals();
|
|
1820
|
+
const authSource = parentOpts.apiKey ? "--api-key flag" : envKey ? "BETTERNESS_API_KEY env" : stored ? "~/.betterness/credentials.json" : "none";
|
|
1821
|
+
const config = {
|
|
1822
|
+
version: "1.1.0",
|
|
1823
|
+
apiUrl: "https://api.betterness.com",
|
|
1824
|
+
authSource,
|
|
1825
|
+
credentialsFile: credentialsPath,
|
|
1826
|
+
credentialsExists: String(existsSync2(credentialsPath))
|
|
1827
|
+
};
|
|
1828
|
+
if (stored?.email) {
|
|
1829
|
+
config.storedEmail = stored.email;
|
|
1830
|
+
}
|
|
1831
|
+
if (stored?.savedAt) {
|
|
1832
|
+
config.credentialsSavedAt = stored.savedAt;
|
|
1833
|
+
}
|
|
1834
|
+
const parentFormat = parentOpts.json ? "json" : parentOpts.markdown ? "markdown" : "table";
|
|
1835
|
+
if (parentFormat === "json") {
|
|
1836
|
+
console.log(JSON.stringify(config, null, 2));
|
|
1837
|
+
} else {
|
|
1838
|
+
const maxKey = Math.max(...Object.keys(config).map((k) => k.length));
|
|
1839
|
+
for (const [key, value] of Object.entries(config)) {
|
|
1840
|
+
console.log(`${key.padEnd(maxKey)} ${value}`);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1809
1846
|
// src/program.ts
|
|
1810
1847
|
function createProgram() {
|
|
1811
1848
|
const program2 = new Command();
|
|
1812
|
-
program2.name("betterness").description("Betterness CLI - Agent-first terminal interface for the Betterness platform").version("
|
|
1849
|
+
program2.name("betterness").description("Betterness CLI - Agent-first terminal interface for the Betterness platform").version("1.1.0").option("--api-key <key>", "API key (overrides env and stored credentials)").option("--json", "Output as JSON").option("--markdown", "Output as Markdown").option("--quiet", "Suppress output (exit code only)");
|
|
1813
1850
|
registerAuthCommands(program2);
|
|
1814
1851
|
registerProfileCommands(program2);
|
|
1815
1852
|
registerBiomarkersCommands(program2);
|
|
@@ -1827,6 +1864,7 @@ function createProgram() {
|
|
|
1827
1864
|
registerSmartListingsCommands(program2);
|
|
1828
1865
|
registerWorkflowCommands(program2);
|
|
1829
1866
|
registerSchemaCommand(program2);
|
|
1867
|
+
registerDebugCommands(program2);
|
|
1830
1868
|
return program2;
|
|
1831
1869
|
}
|
|
1832
1870
|
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betterness/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Betterness CLI - Agent-first terminal interface for the Betterness platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"betterness": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist/"
|
|
10
|
+
"dist/",
|
|
11
|
+
"README.md",
|
|
12
|
+
"CLI_REFERENCE.md"
|
|
11
13
|
],
|
|
12
14
|
"publishConfig": {
|
|
13
15
|
"access": "public"
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
|
-
"dev": "
|
|
17
|
-
"dev:watch": "tsup --watch",
|
|
18
|
+
"dev": "npm run build && ln -sf $(pwd)/dist/index.js /usr/local/bin/bttr && chmod +x /usr/local/bin/bttr",
|
|
18
19
|
"build": "tsup",
|
|
19
20
|
"lint": "eslint src/",
|
|
20
21
|
"typecheck": "tsc --noEmit",
|
|
21
22
|
"test": "vitest run",
|
|
22
|
-
"test:watch": "vitest",
|
|
23
23
|
"docs": "tsx scripts/generate-docs.ts",
|
|
24
|
-
"prepublishOnly": "npm run build"
|
|
24
|
+
"prepublishOnly": "NODE_ENV=production npm run build"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=20.0.0"
|