databody-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +229 -0
- package/dist/index.js +1252 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 DataBody
|
|
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/README.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# DataBody CLI
|
|
2
|
+
|
|
3
|
+
A command-line interface for [DataBody](https://databody.ai) health and fitness tracking, designed for local LLM tool use. All commands output JSON for easy parsing.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g databody-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run directly:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx databody-cli <command>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Authentication
|
|
18
|
+
|
|
19
|
+
### Browser OAuth (recommended)
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
databody auth login
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Opens your browser for secure OAuth login. Tokens are saved to `~/.databody_token.json`.
|
|
26
|
+
|
|
27
|
+
### Cross-machine auth
|
|
28
|
+
|
|
29
|
+
Authenticate on one machine and transfer the token to another:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Machine A (has your account):
|
|
33
|
+
databody auth login
|
|
34
|
+
databody auth export-token --compact
|
|
35
|
+
# → prints a base64 string
|
|
36
|
+
|
|
37
|
+
# Machine B:
|
|
38
|
+
databody auth import-token <base64_string>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or set a token directly:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
databody auth login --token <access_token> --refresh-token <refresh_token>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Other auth methods
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
databody auth login --password -e user@example.com -p secret # Password grant
|
|
51
|
+
databody auth status # Check auth status
|
|
52
|
+
databody auth logout # Clear tokens
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
databody summary # Today's health summary
|
|
59
|
+
databody today # Today's nutrition logs
|
|
60
|
+
databody chat "What should I eat?" # Chat with AI coach
|
|
61
|
+
databody log breakfast '[{"name":"eggs","calories":140,"protein_grams":12,"carbs_grams":1,"fat_grams":10}]'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Commands
|
|
65
|
+
|
|
66
|
+
### Health
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
databody health summary # Dashboard: macros, goals, workouts, trends
|
|
70
|
+
databody health history --days 90 # Historical health stats
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Nutrition
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
databody nutrition today
|
|
77
|
+
databody nutrition history --start 2026-01-01 --end 2026-01-31
|
|
78
|
+
databody nutrition get <log_id>
|
|
79
|
+
databody nutrition log --meal breakfast --items '[{...}]'
|
|
80
|
+
databody nutrition log --meal lunch --stdin # Read items from stdin
|
|
81
|
+
databody nutrition update <log_id> --meal lunch
|
|
82
|
+
databody nutrition delete <log_id>
|
|
83
|
+
databody nutrition add-item <log_id> --name "toast" --calories 80 --protein 3 --carbs 15 --fat 1
|
|
84
|
+
databody nutrition delete-item <log_id> <item_id>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Food Search
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
databody food search "chicken breast"
|
|
91
|
+
databody food search "yogurt" --source usda --page 2
|
|
92
|
+
databody food details <food_id>
|
|
93
|
+
databody food barcode <barcode>
|
|
94
|
+
databody food favorites
|
|
95
|
+
databody food add-favorite --name "Greek Yogurt" --calories 100 --protein 17 --carbs 6 --fat 1
|
|
96
|
+
databody food remove-favorite <id>
|
|
97
|
+
databody food recents
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Goals
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
databody goals current
|
|
104
|
+
databody goals list
|
|
105
|
+
databody goals create --calories 2000 --protein 180 --carbs 200 --fat 67 --strategy cut
|
|
106
|
+
databody goals update <id> --calories 2200
|
|
107
|
+
databody goals delete <id>
|
|
108
|
+
databody goals calculate <id> # Recalculate from current health data
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Workouts
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
databody workouts recent --limit 20
|
|
115
|
+
databody workouts list --start 2026-01-01 --type running
|
|
116
|
+
databody workouts create --type running --started-at 2026-03-14T08:00:00Z --duration 45 --calories 400
|
|
117
|
+
databody workouts update <id> --calories 450
|
|
118
|
+
databody workouts delete <id>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### AI
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
databody ai chat "What should I eat for dinner?"
|
|
125
|
+
databody ai chat "Plan meals" --thread 5 --household 1
|
|
126
|
+
databody ai suggestions --preferences "low carb"
|
|
127
|
+
databody ai analyze-photo --file /path/to/meal.jpg
|
|
128
|
+
databody ai parse "2 eggs with toast and butter"
|
|
129
|
+
databody ai expand --meal "Stir Fry" --ingredients "chicken,broccoli,rice"
|
|
130
|
+
databody ai greeting
|
|
131
|
+
databody ai token-usage
|
|
132
|
+
databody ai chat-history --thread 5
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Chat Threads
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
databody threads list
|
|
139
|
+
databody threads get <id>
|
|
140
|
+
databody threads create --title "Meal Planning"
|
|
141
|
+
databody threads delete <id>
|
|
142
|
+
databody threads generate-title <id>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Notes
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
databody notes list
|
|
149
|
+
databody notes create "I have a home gym with dumbbells"
|
|
150
|
+
databody notes update <id> "Updated note"
|
|
151
|
+
databody notes delete <id>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Households
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
databody households list
|
|
158
|
+
databody households summary <id> --days 7
|
|
159
|
+
databody households create "Family Name"
|
|
160
|
+
databody households update <id> --name "New Name"
|
|
161
|
+
databody households delete <id>
|
|
162
|
+
databody households members <id>
|
|
163
|
+
databody households remove-member <id> <member_id>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Invites
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
databody invites list <household_id>
|
|
170
|
+
databody invites pending
|
|
171
|
+
databody invites create <household_id> --email "partner@example.com"
|
|
172
|
+
databody invites accept <id>
|
|
173
|
+
databody invites decline <id>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### User Profile
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
databody user profile
|
|
180
|
+
databody user update --name "Nick" --timezone "America/New_York"
|
|
181
|
+
databody user change-password --current "old" --new "new"
|
|
182
|
+
databody user change-email --password "pass" --email "new@example.com"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Output
|
|
186
|
+
|
|
187
|
+
All commands output JSON to stdout. Use `--pretty` for formatted output:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
databody health summary --pretty
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Exit codes:
|
|
194
|
+
- `0` — Success
|
|
195
|
+
- `1` — API or application error
|
|
196
|
+
- `2` — Authentication required
|
|
197
|
+
|
|
198
|
+
## Environment Variables
|
|
199
|
+
|
|
200
|
+
| Variable | Description | Default |
|
|
201
|
+
|----------|-------------|---------|
|
|
202
|
+
| `DATABODY_API_URL` | DataBody API URL | `http://localhost:3000` |
|
|
203
|
+
| `DATABODY_CALLBACK_PORT` | OAuth callback port | `8787` |
|
|
204
|
+
|
|
205
|
+
For production use:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
export DATABODY_API_URL=https://databody.ai
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Development
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
git clone https://github.com/databody-ai/databody-cli.git
|
|
215
|
+
cd databody-cli
|
|
216
|
+
npm install
|
|
217
|
+
npm run build
|
|
218
|
+
npm link # Makes 'databody' available globally
|
|
219
|
+
|
|
220
|
+
npm run dev # Watch mode
|
|
221
|
+
npm run typecheck # Type checking
|
|
222
|
+
npm test # Run tests
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Links
|
|
226
|
+
|
|
227
|
+
- [DataBody App](https://databody.ai)
|
|
228
|
+
- [DataBody MCP Server](https://github.com/databody-ai/databody-mcp)
|
|
229
|
+
- [GitHub Issues](https://github.com/databody-ai/databody-cli/issues)
|