openfoodfacts-cli
v0.2.1
Published
Command-line interface for the OpenFoodFacts API, ready for AI agents
Maintainers
Readme
openfoodfacts-cli
Command-line interface for the OpenFoodFacts API, ready for AI agents.
Installation
npm install -g openfoodfacts-cliInstall as AI Agent Skill
npx skills add https://github.com/emmekappa/openfoodfacts-cliUsage
Global options
| Flag | Description | Default |
|------|-------------|---------|
| --lang <code> | 2-letter ISO 639-1 language code for category names (e.g. en, it, fr). Validated against supported codes. | en |
| --no-color | Disable colored output and emoji. Also respects the NO_COLOR env variable. | — |
List supported languages
off languagesSearch for products
off search <query>Options:
| Flag | Description | Default |
|------|-------------|---------|
| --page <number> | Page number (starts at 1) | 1 |
| --page-size <number> | Results per page | 10 |
| --sort-by <field> | Sort by field (prefix with - for descending) | — |
| --no-truncate | Show full column values without truncation | — |
Examples:
off search nutella
off search "organic chocolate" --page-size 5
off search pasta --page 2
off --lang it search nutella
off search nutella --no-truncateGet a product by barcode
Returns product details in a vertical label/value format (no truncation).
off get <ean>Examples:
off get 3017620422003
off --lang fr get 3017620422003Sample output:
Barcode 3017620422003
Name Nutella
Brand Ferrero
Categories Spreads, Chocolate spreads, Hazelnut spreads
Nutriscore E
Energy (kcal/100g) 539
Fat (g/100g) 30.9
Carbs (g/100g) 57.5
Proteins (g/100g) 6.3
Salt (g/100g) 0.1Development
Prerequisites
- Bun runtime
Setup
bun installRun locally
bun run src/cli.ts search nutellaDependencies
- openfoodfacts-nodejs — Official JavaScript SDK for OpenFoodFacts
- Commander.js — CLI framework
