fitvete-food-cli 1.6.0 → 1.7.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/README.md +11 -0
- package/index.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -133,3 +133,14 @@ The CLI never uploads an image larger than 5 MB.
|
|
|
133
133
|
## License
|
|
134
134
|
|
|
135
135
|
MIT
|
|
136
|
+
|
|
137
|
+
## Semantic discovery
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
fitvete-food search-foods "soybean curd" --mode semantic --number 5
|
|
141
|
+
fitvete-food foods-search "fermented milk" --mode hybrid
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Semantic retrieval covers generic reference foods; packaged products retain lexical
|
|
145
|
+
and barcode lookup. Nutrient coverage explicitly distinguishes reported values
|
|
146
|
+
from unknown values. No minimum number of measured nutrients is guaranteed.
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { readFile, stat } from "node:fs/promises";
|
|
21
21
|
import { basename } from "node:path";
|
|
22
22
|
|
|
23
|
-
const VERSION = "1.
|
|
23
|
+
const VERSION = "1.7.0";
|
|
24
24
|
const DEFAULT_BASE = "https://auth.fitvete.com/functions/v1/food-api";
|
|
25
25
|
|
|
26
26
|
// ---- command registry (drives dispatch, --help, and the agent tool manifest) ----
|
|
@@ -29,7 +29,7 @@ const COMMANDS = {
|
|
|
29
29
|
food: {summary:"Retrieve a reference or private food by UUID.",usage:"food <id>",args:[{name:"id",type:"string",required:true,description:"Food UUID."}],options:[],path:(a)=>`/v1/foods/${enc(a[0])}`},
|
|
30
30
|
"create-food": {summary:"Save private per-100g food nutrition.",usage:"create-food '<JSON>'",args:[{name:"food",type:"string",required:true,description:"JSON name, nutrition_basis=100g and complete calorie/macro values."}],options:[],path:()=>"/v1/foods",jsonBody:(a)=>parseJSONArgument(a[0])},
|
|
31
31
|
log: {summary:"Log grams of a reference or private food.",usage:"log '<JSON>'",args:[{name:"log",type:"string",required:true,description:"JSON food_id, grams and optional logged_at."}],options:[],path:()=>"/v1/logs",jsonBody:(a)=>parseJSONArgument(a[0])},
|
|
32
|
-
"foods-search": {summary:"Search through the foods resource alias.",usage:"foods-search <query...>",args:[{name:"query",type:"string",required:true,description:"Food name."}],options:[{name:"number",type:"integer",description:"1–25 results."}],path:(a,o)=>`/v1/foods/search?query=${enc(a.join(" "))}${o.number ? `&number=${o.number}` : ""}`},
|
|
32
|
+
"foods-search": {summary:"Search through the foods resource alias.",usage:"foods-search <query...> [--mode hybrid|semantic|lexical]",args:[{name:"query",type:"string",required:true,description:"Food name."}],options:[{name:"number",type:"integer",description:"1–25 results."},{name:"mode",type:"string",description:"hybrid (default), semantic, or lexical."}],path:(a,o)=>`/v1/foods/search?query=${enc(a.join(" "))}${o.number ? `&number=${o.number}` : ""}${o.mode ? `&mode=${enc(o.mode)}` : ""}`},
|
|
33
33
|
scan: {
|
|
34
34
|
summary: "Read your private saved scan.", usage: "scan <id>", args: [{name: "id", type: "string", required: true, description: "Scan UUID."}], options: [], path: (a) => `/v1/scans/${enc(a[0])}`,
|
|
35
35
|
},
|
|
@@ -43,13 +43,13 @@ const COMMANDS = {
|
|
|
43
43
|
},
|
|
44
44
|
"search-foods": {
|
|
45
45
|
summary: "Search foods by name; returns calories, macros, and confidence.",
|
|
46
|
-
usage: "search-foods <query...> [--number N]",
|
|
46
|
+
usage: "search-foods <query...> [--number N] [--mode hybrid|semantic|lexical]",
|
|
47
47
|
args: [{ name: "query", type: "string", required: true, description: "Food name, e.g. chicken." }],
|
|
48
|
-
options: [{ name: "number", type: "integer", description: "Max results, 1-25 (default 10)." }],
|
|
49
|
-
path: (a, o) => `/v1/search-foods?query=${enc(a.join(" "))}${o.number ? `&number=${o.number}` : ""}`,
|
|
48
|
+
options: [{ name: "number", type: "integer", description: "Max results, 1-25 (default 10)." }, {name:"mode",type:"string",description:"hybrid (default), semantic, or lexical."}],
|
|
49
|
+
path: (a, o) => `/v1/search-foods?query=${enc(a.join(" "))}${o.number ? `&number=${o.number}` : ""}${o.mode ? `&mode=${enc(o.mode)}` : ""}`,
|
|
50
50
|
},
|
|
51
51
|
compute: {
|
|
52
|
-
summary: "
|
|
52
|
+
summary: "Macros and available source-reported nutrients for an ingredient list.",
|
|
53
53
|
usage: 'compute <ingredient...> e.g. compute "1 cup rice" "2 eggs"',
|
|
54
54
|
args: [{ name: "ingredients", type: "string", required: true, description: "One or more ingredients (each a separate arg)." }],
|
|
55
55
|
options: [],
|