https://github.com/milldr/crono
CLI for Cronometer automation via Kernel.sh
https://github.com/milldr/crono
Last synced: 4 months ago
JSON representation
CLI for Cronometer automation via Kernel.sh
- Host: GitHub
- URL: https://github.com/milldr/crono
- Owner: milldr
- License: mit
- Created: 2026-02-11T20:46:42.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-02-16T20:33:58.000Z (4 months ago)
- Last Synced: 2026-02-17T03:02:19.316Z (4 months ago)
- Language: TypeScript
- Size: 423 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🍎 crono
[](https://ko-fi.com/milldr)
CLI for Cronometer automation via [Kernel.sh](https://kernel.sh).
Cronometer has no public API, so crono automates the web UI through Kernel.sh browser automation. Log macros from your terminal in seconds.

## Motivation
Cronometer is great for logging food — barcode scanning and manual search cover most meals at home. But when you're eating out or don't have a barcode, the workflow gets clunky: take a photo, ask an AI to estimate the macros, then manually punch those numbers into the app as a quick add.
crono closes that loop. Give your AI agent a skill that knows how to call crono, and it goes from estimating macros to actually logging them — no manual step in between. On top of that, your agent can query your diary, pull export data, and answer questions about your nutrition without you ever opening the app.
## Quickstart
### 1. Install
```bash
npm install -g @milldr/crono
```
### 2. Log in
```bash
crono login
```
You'll be prompted for three things:
- **Kernel API key** — get one at [kernel.sh](https://kernel.sh)
- **Cronometer email** — your Cronometer account email
- **Cronometer password** — stored securely in your system keychain
```
┌ crono login
│
◇ Kernel API key
│ sk-abc...
│
◒ Validating API key...
◇ API key valid.
│
◇ Cronometer email
│ you@example.com
│
◇ Cronometer password
│ ****
│
└ Credentials saved.
```
### 3. Log a meal
```bash
crono quick-add -p 30 -c 100 -f 20 -a 14 -m Dinner -d yesterday
```
```
┌ crono quick-add
│
◒ Logging into Cronometer...
◇ Done.
│
└ Added: 30g protein, 100g carbs, 20g fat, 14g alcohol → Dinner on 2026-02-15
```
## Commands
### `crono login`
Set up or update your Kernel API key and Cronometer credentials. If credentials already exist, pressing Enter keeps the current value.
```bash
crono login
```
### `crono quick-add`
Add a quick macro entry to your Cronometer diary.
```bash
crono quick-add [options]
```
**Options:**
| Flag | Long | Description |
| ---- | --------------- | ------------------------------------------------ |
| `-p` | `--protein ` | Grams of protein |
| `-c` | `--carbs ` | Grams of carbohydrates |
| `-f` | `--fat ` | Grams of fat |
| `-a` | `--alcohol ` | Grams of alcohol |
| `-m` | `--meal ` | Meal category (Breakfast, Lunch, Dinner, Snacks) |
| `-d` | `--date ` | Date (YYYY-MM-DD, yesterday, -1d) |
At least one macro flag (`-p`, `-c`, `-f`, or `-a`) is required.
**Examples:**
```bash
# Log 30g protein
crono quick-add -p 30
# Log full meal macros
crono quick-add -p 30 -c 100 -f 20
# Log to Dinner category
crono quick-add -p 30 -c 50 -f 15 --meal Dinner
# Log to yesterday
crono quick-add -p 30 -d yesterday -m Dinner
# Log alcohol
crono quick-add -a 14 -m Dinner
# Combine everything
crono quick-add -p 30 -c 50 -f 10 -a 14 -d -3d -m Dinner
```
### `crono add custom-food`
Create a custom food in Cronometer with specified macros.
```bash
crono add custom-food [options]
```
**Options:**
| Flag | Long | Description |
| ---- | --------------- | ------------------------------------------- |
| `-p` | `--protein ` | Grams of protein |
| `-c` | `--carbs ` | Grams of carbohydrates |
| `-f` | `--fat ` | Grams of fat |
| | `--log [meal]` | Also log to diary (optionally specify meal) |
At least one macro flag (`-p`, `-c`, or `-f`) is required.
**Examples:**
```bash
# Create a custom food with all macros
crono add custom-food "Wendy's Chicken Sandwich" -p 50 -c 100 -f 50
# Just protein and carbs
crono add custom-food "Post-Workout Shake" -p 40 -c 60
# Create and immediately log to Uncategorized
crono add custom-food "Wendy's Chicken Sandwich" -p 50 -c 100 -f 50 --log
# Create and immediately log to Dinner
crono add custom-food "Wendy's Chicken Sandwich" -p 50 -c 100 -f 50 --log Dinner
```
### `crono log`
Log a saved food to your diary by name. Works with custom foods, custom recipes, and database items.
```bash
crono log [options]
```
**Options:**
| Flag | Long | Description |
| ---- | -------------------- | ------------------------------------------------ |
| `-m` | `--meal ` | Meal category (Breakfast, Lunch, Dinner, Snacks) |
| `-s` | `--servings ` | Number of servings (default: 1) |
**Examples:**
```bash
# Log a custom food
crono log "Wendy's Chicken Sandwich"
# Log to a specific meal
crono log "Wendy's Chicken Sandwich" -m Dinner
# Log multiple servings
crono log "Post-Workout Shake" -s 2 -m Snacks
```
### `crono weight`
Check your weight from Cronometer. Defaults to today if no date or range is specified.
```bash
crono weight [options]
```
**Options:**
| Flag | Long | Description |
| ---- | ----------------- | ----------------------------------------- |
| `-d` | `--date ` | Date (YYYY-MM-DD) |
| `-r` | `--range ` | Range (7d, 30d, or YYYY-MM-DD:YYYY-MM-DD) |
| | `--json` | Output as JSON |
`-d` and `-r` are mutually exclusive.
**Examples:**
```bash
# Today's weight
crono weight
# → 212.5 lbs
# Specific date
crono weight -d 2026-02-05
# Last 7 days
crono weight -r 7d
# → 2026-02-11: 212.5
# → 2026-02-10: 212.7
# → 2026-02-09: 215.5
# → ...
# JSON output for scripting
crono weight --json
# → {"date":"2026-02-11","weight":212.5,"unit":"lbs"}
# Range as JSON
crono weight -r 7d --json
# → [{"date":"2026-02-11","weight":212.5,"unit":"lbs"}, ...]
```
### `crono diary`
View daily nutrition totals (calories, protein, carbs, fat) from Cronometer. Defaults to today if no date or range is specified.
```bash
crono diary [options]
```
**Options:**
| Flag | Long | Description |
| ---- | ----------------- | ----------------------------------------- |
| `-d` | `--date ` | Date (YYYY-MM-DD) |
| `-r` | `--range ` | Range (7d, 30d, or YYYY-MM-DD:YYYY-MM-DD) |
| `-t` | `--targets` | Show macro targets and progress |
| | `--json` | Output as JSON |
`-d` and `-r` are mutually exclusive.
**Examples:**
```bash
# Today's nutrition
crono diary
# → 1847 kcal | P: 168g | C: 142g | F: 58g
# Specific date
crono diary -d 2026-02-05
# Last 7 days
crono diary -r 7d
# → 2026-02-11: 1847 kcal | P: 168g | C: 142g | F: 58g
# → 2026-02-10: 2103 kcal | P: 155g | C: 200g | F: 72g
# → ...
# Show targets and progress
crono diary --targets
# → 2994 kcal (109% of 2746) | P: 239g | C: 311g | F: 95g
# Targets with range (includes averages)
crono diary --targets -r 3d
# → 2026-03-12: 2994 kcal (109% of 2746) | P: 239g | C: 311g | F: 95g
# → 2026-03-11: 2770 kcal (100% of 2759) | P: 238g | C: 273g | F: 88g
# → 2026-03-10: 2678 kcal (97% of 2750) | P: 248g | C: 279g | F: 87g
# → ───
# → Average: 2814 kcal (102% of 2752) | P: 242g | C: 288g | F: 90g
# JSON output for scripting
crono diary --json
# → {"date":"2026-02-11","calories":1847,"protein":168,"carbs":142,"fat":58}
# Range as JSON
crono diary -r 7d --json
# → [{"date":"2026-02-11","calories":1847,"protein":168,"carbs":142,"fat":58}, ...]
```
### `crono export`
Export data directly from Cronometer's API — no browser automation, much faster than `diary` or `weight`.
```bash
crono export [options]
```
**Types:**
| Type | Description |
| ------------ | ----------------------------------- |
| `nutrition` | Daily nutrition totals (macros) |
| `exercises` | Exercise entries with duration/cals |
| `biometrics` | Biometric measurements (weight, BP) |
**Options:**
| Flag | Long | Description |
| ---- | ----------------- | ----------------------------------------- |
| `-d` | `--date ` | Date (YYYY-MM-DD) |
| `-r` | `--range ` | Range (7d, 30d, or YYYY-MM-DD:YYYY-MM-DD) |
| | `--csv` | Output as raw CSV |
| | `--json` | Output as JSON |
`-d` and `-r` are mutually exclusive. `--csv` and `--json` are mutually exclusive.
**Examples:**
```bash
# Today's nutrition
crono export nutrition
# → 1847 kcal | P: 168g | C: 142g | F: 58g
# Last 7 days of nutrition as JSON
crono export nutrition -r 7d --json
# Today's exercises
crono export exercises
# → Running: 30 min, 350 kcal
# Biometrics for last 30 days
crono export biometrics -r 30d
# → 2026-02-11: Weight: 212.5 lbs
# → 2026-02-09: Blood Pressure: 120/80 mmHg
# Raw CSV export
crono export nutrition -r 30d --csv
```
**GWT overrides:** If Cronometer updates break the export, override GWT values in `~/.config/crono/config.json` or via environment variables:
```bash
export CRONO_GWT_PERMUTATION=
export CRONO_GWT_HEADER=
```
## Requirements
- Node.js 18+
- [Kernel.sh](https://kernel.sh) account (for browser automation)
- [Cronometer](https://cronometer.com) account
## Development
```bash
git clone https://github.com/milldr/crono.git
cd crono
npm install
# Run in dev mode
npm run dev -- login
npm run dev -- quick-add -p 30
npm run dev -- weight -r 7d
npm run dev -- diary
# Run tests
npm test
# Build
npm run build
```
## Support
I build and maintain projects like crono in my free time as personal hobbies. They're completely free and always will be. If you find this useful and want to show some support, feel free to buy me a coffee:
[](https://ko-fi.com/milldr)
## License
MIT