avocavo 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/CHANGELOG.md +61 -0
- package/README.md +131 -0
- package/bin/avocavo.js +701 -0
- package/lib/api.js +258 -0
- package/lib/auth-supabase.js +718 -0
- package/lib/auth.js +484 -0
- package/lib/formatters.js +256 -0
- package/lib/keys.js +263 -0
- package/package.json +73 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the Avocavo CLI will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2025-01-30
|
|
6
|
+
|
|
7
|
+
### 🎉 Initial Release
|
|
8
|
+
- Complete rewrite for security and reliability
|
|
9
|
+
- Clean package name: `avocavo` (replacing deprecated `avocavo-nutrition-cli`)
|
|
10
|
+
|
|
11
|
+
### ✨ Features
|
|
12
|
+
- Secure OAuth authentication with browser flow
|
|
13
|
+
- USDA nutrition database integration
|
|
14
|
+
- Batch ingredient analysis
|
|
15
|
+
- Multiple output formats (table, JSON)
|
|
16
|
+
- System keychain credential storage
|
|
17
|
+
|
|
18
|
+
### 🔒 Security Improvements
|
|
19
|
+
- **SSL Verification**: All HTTPS connections now verify certificates
|
|
20
|
+
- **Secure Credentials**: No plaintext credential storage
|
|
21
|
+
- **Updated Dependencies**: All dependencies updated to latest secure versions
|
|
22
|
+
- **Input Sanitization**: All user inputs properly sanitized
|
|
23
|
+
|
|
24
|
+
### 🚀 Performance
|
|
25
|
+
- Faster API responses with connection pooling
|
|
26
|
+
- Improved error handling and retry logic
|
|
27
|
+
- Better progress indicators for long operations
|
|
28
|
+
|
|
29
|
+
### 📦 Dependencies
|
|
30
|
+
- Node.js >= 16.0.0 (updated from 14.0.0)
|
|
31
|
+
- Updated all major dependencies to latest versions
|
|
32
|
+
- Removed vulnerable dependencies
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Migration from avocavo-nutrition-cli
|
|
37
|
+
|
|
38
|
+
This package replaces the deprecated `avocavo-nutrition-cli` which contained security vulnerabilities:
|
|
39
|
+
|
|
40
|
+
### Security Issues Fixed:
|
|
41
|
+
- ❌ SSL verification disabled (`verify: false`)
|
|
42
|
+
- ❌ Plaintext credential storage fallback
|
|
43
|
+
- ❌ Vulnerable form-data dependency
|
|
44
|
+
- ❌ Missing input sanitization
|
|
45
|
+
|
|
46
|
+
### Migration Steps:
|
|
47
|
+
```bash
|
|
48
|
+
# 1. Remove old package
|
|
49
|
+
npm uninstall -g avocavo-nutrition-cli
|
|
50
|
+
|
|
51
|
+
# 2. Install new secure package
|
|
52
|
+
npm install -g avocavo
|
|
53
|
+
|
|
54
|
+
# 3. Login again (secure OAuth flow)
|
|
55
|
+
avocavo login
|
|
56
|
+
|
|
57
|
+
# 4. Same commands work!
|
|
58
|
+
avocavo analyze "1 cup rice"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
All command syntax remains identical - only the package name and security have been updated.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# 🥑 Avocavo CLI
|
|
2
|
+
|
|
3
|
+
> Nutrition analysis made simple. Get accurate USDA nutrition data with secure authentication.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
npm install -g avocavo
|
|
10
|
+
|
|
11
|
+
# Login to your account
|
|
12
|
+
avocavo login
|
|
13
|
+
|
|
14
|
+
# Analyze a single ingredient
|
|
15
|
+
avocavo analyze "1 cup rice"
|
|
16
|
+
|
|
17
|
+
# Analyze a recipe
|
|
18
|
+
avocavo recipe "2 eggs, 1 cup flour, 1 cup milk"
|
|
19
|
+
|
|
20
|
+
# Get help
|
|
21
|
+
avocavo --help
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## ✨ Features
|
|
25
|
+
|
|
26
|
+
- 🔐 **Secure Authentication** - Uses system keychain for credential storage
|
|
27
|
+
- 🥗 **USDA Database** - Access to comprehensive nutrition data
|
|
28
|
+
- 🧮 **Batch Analysis** - Analyze multiple ingredients at once
|
|
29
|
+
- 📊 **Rich Output** - Beautiful tables and JSON formats
|
|
30
|
+
- 🔒 **SSL Security** - All connections use verified HTTPS
|
|
31
|
+
|
|
32
|
+
## 📦 Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g avocavo
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Requirements:**
|
|
39
|
+
- Node.js >= 16.0.0
|
|
40
|
+
- npm >= 7.0.0
|
|
41
|
+
|
|
42
|
+
## 🔐 Authentication
|
|
43
|
+
|
|
44
|
+
1. **Sign up** at [nutrition.avocavo.app](https://nutrition.avocavo.app)
|
|
45
|
+
2. **Login** via CLI:
|
|
46
|
+
```bash
|
|
47
|
+
avocavo login
|
|
48
|
+
```
|
|
49
|
+
3. Your credentials are stored securely in your system keychain
|
|
50
|
+
|
|
51
|
+
## 📖 Commands
|
|
52
|
+
|
|
53
|
+
### `avocavo login`
|
|
54
|
+
Authenticate with your Avocavo account via secure OAuth.
|
|
55
|
+
|
|
56
|
+
### `avocavo analyze <ingredient>`
|
|
57
|
+
Analyze a single ingredient:
|
|
58
|
+
```bash
|
|
59
|
+
avocavo analyze "1 cup brown rice"
|
|
60
|
+
avocavo analyze "200g chicken breast"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### `avocavo recipe <ingredients>`
|
|
64
|
+
Analyze multiple ingredients as a recipe:
|
|
65
|
+
```bash
|
|
66
|
+
avocavo recipe "2 eggs, 1 cup flour, 1/2 cup milk"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### `avocavo batch <file>`
|
|
70
|
+
Analyze ingredients from a file:
|
|
71
|
+
```bash
|
|
72
|
+
avocavo batch ingredients.txt
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### `avocavo whoami`
|
|
76
|
+
Show current authenticated user.
|
|
77
|
+
|
|
78
|
+
### `avocavo logout`
|
|
79
|
+
Remove stored credentials.
|
|
80
|
+
|
|
81
|
+
## 🔒 Security
|
|
82
|
+
|
|
83
|
+
- **SSL Verification**: All API calls use verified HTTPS connections
|
|
84
|
+
- **Secure Storage**: Credentials stored in system keychain (not plaintext)
|
|
85
|
+
- **OAuth Flow**: Secure browser-based authentication
|
|
86
|
+
- **No Hardcoded Secrets**: All sensitive data handled securely
|
|
87
|
+
|
|
88
|
+
## 📊 Output Formats
|
|
89
|
+
|
|
90
|
+
### Table Format (default)
|
|
91
|
+
```
|
|
92
|
+
┌─────────────────┬──────────┬─────────┬──────────┬─────────┐
|
|
93
|
+
│ Nutrient │ Amount │ Unit │ Per 100g │ % DV │
|
|
94
|
+
├─────────────────┼──────────┼─────────┼──────────┼─────────┤
|
|
95
|
+
│ Calories │ 365 │ kcal │ 365 │ 18.3% │
|
|
96
|
+
│ Protein │ 7.1 │ g │ 7.1 │ 14.2% │
|
|
97
|
+
└─────────────────┴──────────┴─────────┴──────────┴─────────┘
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### JSON Format
|
|
101
|
+
```bash
|
|
102
|
+
avocavo analyze "1 cup rice" --json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 🆘 Support
|
|
106
|
+
|
|
107
|
+
- **Documentation**: [nutrition.avocavo.app/docs](https://nutrition.avocavo.app/docs)
|
|
108
|
+
- **Issues**: [GitHub Issues](https://github.com/avocavo/avocavo-cli/issues)
|
|
109
|
+
- **Email**: api-support@avocavo.com
|
|
110
|
+
|
|
111
|
+
## 📄 License
|
|
112
|
+
|
|
113
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
**🔄 Migrating from avocavo-nutrition-cli?**
|
|
118
|
+
|
|
119
|
+
The old package has been deprecated due to security vulnerabilities. Migration is simple:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Remove old package
|
|
123
|
+
npm uninstall -g avocavo-nutrition-cli
|
|
124
|
+
|
|
125
|
+
# Install new secure package
|
|
126
|
+
npm install -g avocavo
|
|
127
|
+
|
|
128
|
+
# Same commands work!
|
|
129
|
+
avocavo login
|
|
130
|
+
avocavo analyze "1 cup rice"
|
|
131
|
+
```
|