wetaca-cli 0.2.0 → 0.2.2

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.
Files changed (4) hide show
  1. package/docs/GUIA.md +118 -118
  2. package/package.json +7 -3
  3. package/src/commands.js +700 -700
  4. package/src/lib.js +371 -371
package/docs/GUIA.md CHANGED
@@ -1,118 +1,118 @@
1
- # wetaca-cli Guide
2
-
3
- Verified against a real account (Nov 2026). Reads = no risk. Actions = ask for confirmation.
4
- The ids and addresses in the examples are fictional.
5
-
6
- ## 1. Query (read-only, no risk)
7
-
8
- ```bash
9
- wetaca me # your account: subscription, wallet
10
- wetaca suggestion show # THE STAR: next week's menu by profile,
11
- # delivery window, address and total price
12
- wetaca suggestion show --format pretty
13
- wetaca deliveries next # suggestion + pending orders + pending payments
14
- wetaca orders list --limit 10 # order history (id, reference, date, amount, invoice)
15
- wetaca orders show 1234567 # order detail: dishes, address, time slot
16
- wetaca orders list --limit 3 --format jsonl # one JSON line per order (ideal for jq/scripts)
17
- wetaca addresses list
18
- wetaca vouchers list
19
- wetaca wallet
20
- ```
21
-
22
- With `jq`:
23
- ```bash
24
- wetaca suggestion show | jq '.deliveryWindow' # when your turn is
25
- wetaca suggestion show | jq '.profiles[0].products[].name' # which dishes are due
26
- wetaca orders list | jq 'map(select(.state=="PAYMENT_CONFIRMED"))' # paid only
27
- ```
28
-
29
- ## 2. Actions (real effects; they ask for confirmation or --yes)
30
-
31
- ### Skip next week
32
- ```bash
33
- wetaca suggestion pause # asks y/N in the terminal
34
- wetaca suggestion pause --yes # no prompt (scripts/agents)
35
- wetaca suggestion resume # undo
36
- ```
37
- The `validUntil` of `suggestion show` is the deadline: after that date and time it can no longer be edited.
38
-
39
- ### Change the tuppers in the week's menu
40
- ```bash
41
- # 1. look up the ids: productId (the dishes) and profileSuggestionId (your week's menu)
42
- wetaca suggestion show | jq '.profiles[0] | {profileSuggestionId, products: [.products[] | {id, name, quantity}]}'
43
-
44
- # 2. simulate the change (--set "productId:quantity,productId:quantity"; quantity 0 = remove)
45
- wetaca suggestion edit --profile-suggestion <PROFILE_SUGGESTION_ID> --set "124:2" --dry-run
46
-
47
- # 3. execute
48
- wetaca suggestion edit --profile-suggestion <PROFILE_SUGGESTION_ID> --set "124:2" --yes
49
- ```
50
-
51
- ### Vacation pause
52
- ```bash
53
- wetaca subscription pause --weeks 2 --yes # pauses for 2 weeks
54
- wetaca subscription resume # reactivates
55
- wetaca subscription show # current status
56
- ```
57
-
58
- ### View the week's menu and choose dishes
59
- ```bash
60
- wetaca menu list # 43 dishes with id, category and price
61
- wetaca menu list | jq '.dishes[] | select(.category.slug=="entrantes") | {id, name}'
62
- wetaca dish show lasana-de-pavo-y-pesto # ingredients, allergens, description
63
- ```
64
-
65
- ### Change the delivery time slot
66
- ```bash
67
- wetaca deliveries options # available slots (the current one shows isCurrent)
68
- wetaca deliveries set-option 117 --dry-run # simulate
69
- wetaca deliveries set-option 117 --yes # applies to subscription + next week
70
- ```
71
-
72
- ### Profiles
73
- ```bash
74
- wetaca profiles list
75
- wetaca profiles pause <id|name> --dry-run # pauses only that profile
76
- ```
77
-
78
- ### Change the delivery address
79
- ```bash
80
- # simulation of the exact plan (nothing is touched)
81
- wetaca addresses save --street "Calle Ejemplo" --number 1 --floor 2A --zipcode 18006 --city Granada --dry-run
82
-
83
- # execute (asks for confirmation; --yes for scripts): creates the address and assigns it to the
84
- # subscription and to next week, keeping the current delivery slot
85
- wetaca addresses save --street "Calle Ejemplo" --number 1 --floor 2A --zipcode 18006 --city Granada --yes
86
- ```
87
- First name, last name, phone and notes are inherited from your current address unless you pass
88
- --firstname/--lastname/--phone/--notes. Verify afterwards with `wetaca addresses list`.
89
-
90
- ### Cancel a confirmed order
91
- ```bash
92
- wetaca orders cancel 1234567 --dry-run # see what it would do
93
- wetaca orders cancel 1234567 --yes # cancel (refunds the amount)
94
- ```
95
-
96
- ## 3. Automate with AI agents
97
-
98
- Agents (Hermes, Claude, a cron job...) must start with:
99
- ```
100
- wetaca skills get wetaca-usage
101
- ```
102
- That embedded guide always matches the installed version and describes the contract:
103
- JSON on stdout, JSON errors with `--error-format json`, stable exit codes
104
- (0 ok · 2 usage/confirmation · 3 auth · 4 network · 5 not found · 6 API · 7 drift),
105
- `--no-input` + `--yes` for non-interactive, `--dry-run` to simulate.
106
-
107
- Golden rule for agents: read a lot, write little, and show a summary before `--yes`.
108
-
109
- Automation ideas (cron):
110
- - Every Thursday: `suggestion show` → summary via Telegram → you reply with changes → agent applies them with `--yes`.
111
- - Every Wednesday: if `suggestion show | jq -r .validUntil` is close and `skip=false`, send a reminder to decide on pausing.
112
- - Invoice alert: `orders list` → if a new order appears compared to the last check, notify.
113
-
114
- ## 4. Session
115
-
116
- - Status: `wetaca auth status` · Refresh: `wetaca auth login --cookies cookies.txt` (export with Cookie-Editor) or `--refresh-token <COOKIE>` (F12 → Application → Cookies → `refresh-token`; lasts ~120 days and the CLI renews the token itself). Alternative: `wetaca auth login --token <TOKEN> --clipboard` (expires in ~1h).
117
- - The token lives in `~/.config/wetaca-cli/credentials.json` (0600) and the rest of the settings in `config.json`; `WETACA_TOKEN` overrides it (CI).
118
- - If the API rejects it (exit 3), redo the extraction with DevTools (docs/cli-spec.md §6).
1
+ # wetaca-cli Guide
2
+
3
+ Verified against a real account (Nov 2026). Reads = no risk. Actions = ask for confirmation.
4
+ The ids and addresses in the examples are fictional.
5
+
6
+ ## 1. Query (read-only, no risk)
7
+
8
+ ```bash
9
+ wetaca me # your account: subscription, wallet
10
+ wetaca suggestion show # THE STAR: next week's menu by profile,
11
+ # delivery window, address and total price
12
+ wetaca suggestion show --format pretty
13
+ wetaca deliveries next # suggestion + pending orders + pending payments
14
+ wetaca orders list --limit 10 # order history (id, reference, date, amount, invoice)
15
+ wetaca orders show 1234567 # order detail: dishes, address, time slot
16
+ wetaca orders list --limit 3 --format jsonl # one JSON line per order (ideal for jq/scripts)
17
+ wetaca addresses list
18
+ wetaca vouchers list
19
+ wetaca wallet
20
+ ```
21
+
22
+ With `jq`:
23
+ ```bash
24
+ wetaca suggestion show | jq '.deliveryWindow' # when your turn is
25
+ wetaca suggestion show | jq '.profiles[0].products[].name' # which dishes are due
26
+ wetaca orders list | jq 'map(select(.state=="PAYMENT_CONFIRMED"))' # paid only
27
+ ```
28
+
29
+ ## 2. Actions (real effects; they ask for confirmation or --yes)
30
+
31
+ ### Skip next week
32
+ ```bash
33
+ wetaca suggestion pause # asks y/N in the terminal
34
+ wetaca suggestion pause --yes # no prompt (scripts/agents)
35
+ wetaca suggestion resume # undo
36
+ ```
37
+ The `validUntil` of `suggestion show` is the deadline: after that date and time it can no longer be edited.
38
+
39
+ ### Change the tuppers in the week's menu
40
+ ```bash
41
+ # 1. look up the ids: productId (the dishes) and profileSuggestionId (your week's menu)
42
+ wetaca suggestion show | jq '.profiles[0] | {profileSuggestionId, products: [.products[] | {id, name, quantity}]}'
43
+
44
+ # 2. simulate the change (--set "productId:quantity,productId:quantity"; quantity 0 = remove)
45
+ wetaca suggestion edit --profile-suggestion <PROFILE_SUGGESTION_ID> --set "124:2" --dry-run
46
+
47
+ # 3. execute
48
+ wetaca suggestion edit --profile-suggestion <PROFILE_SUGGESTION_ID> --set "124:2" --yes
49
+ ```
50
+
51
+ ### Vacation pause
52
+ ```bash
53
+ wetaca subscription pause --weeks 2 --yes # pauses for 2 weeks
54
+ wetaca subscription resume # reactivates
55
+ wetaca subscription show # current status
56
+ ```
57
+
58
+ ### View the week's menu and choose dishes
59
+ ```bash
60
+ wetaca menu list # 43 dishes with id, category and price
61
+ wetaca menu list | jq '.dishes[] | select(.category.slug=="entrantes") | {id, name}'
62
+ wetaca dish show lasana-de-pavo-y-pesto # ingredients, allergens, description
63
+ ```
64
+
65
+ ### Change the delivery time slot
66
+ ```bash
67
+ wetaca deliveries options # available slots (the current one shows isCurrent)
68
+ wetaca deliveries set-option 117 --dry-run # simulate
69
+ wetaca deliveries set-option 117 --yes # applies to subscription + next week
70
+ ```
71
+
72
+ ### Profiles
73
+ ```bash
74
+ wetaca profiles list
75
+ wetaca profiles pause <id|name> --dry-run # pauses only that profile
76
+ ```
77
+
78
+ ### Change the delivery address
79
+ ```bash
80
+ # simulation of the exact plan (nothing is touched)
81
+ wetaca addresses save --street "Calle Ejemplo" --number 1 --floor 2A --zipcode 18006 --city Granada --dry-run
82
+
83
+ # execute (asks for confirmation; --yes for scripts): creates the address and assigns it to the
84
+ # subscription and to next week, keeping the current delivery slot
85
+ wetaca addresses save --street "Calle Ejemplo" --number 1 --floor 2A --zipcode 18006 --city Granada --yes
86
+ ```
87
+ First name, last name, phone and notes are inherited from your current address unless you pass
88
+ --firstname/--lastname/--phone/--notes. Verify afterwards with `wetaca addresses list`.
89
+
90
+ ### Cancel a confirmed order
91
+ ```bash
92
+ wetaca orders cancel 1234567 --dry-run # see what it would do
93
+ wetaca orders cancel 1234567 --yes # cancel (refunds the amount)
94
+ ```
95
+
96
+ ## 3. Automate with AI agents
97
+
98
+ Agents (Hermes, Claude, a cron job...) must start with:
99
+ ```
100
+ wetaca skills get wetaca-usage
101
+ ```
102
+ That embedded guide always matches the installed version and describes the contract:
103
+ JSON on stdout, JSON errors with `--error-format json`, stable exit codes
104
+ (0 ok · 2 usage/confirmation · 3 auth · 4 network · 5 not found · 6 API · 7 drift),
105
+ `--no-input` + `--yes` for non-interactive, `--dry-run` to simulate.
106
+
107
+ Golden rule for agents: read a lot, write little, and show a summary before `--yes`.
108
+
109
+ Automation ideas (cron):
110
+ - Every Thursday: `suggestion show` → summary via Telegram → you reply with changes → agent applies them with `--yes`.
111
+ - Every Wednesday: if `suggestion show | jq -r .validUntil` is close and `skip=false`, send a reminder to decide on pausing.
112
+ - Invoice alert: `orders list` → if a new order appears compared to the last check, notify.
113
+
114
+ ## 4. Session
115
+
116
+ - Status: `wetaca auth status` · Refresh: `wetaca auth login --cookies cookies.txt` (export with Cookie-Editor) or `--refresh-token <COOKIE>` (F12 → Application → Cookies → `refresh-token`; lasts ~120 days and the CLI renews the token itself). Alternative: `wetaca auth login --token <TOKEN> --clipboard` (expires in ~1h).
117
+ - The token lives in `~/.config/wetaca-cli/credentials.json` (0600) and the rest of the settings in `config.json`; `WETACA_TOKEN` overrides it (CI).
118
+ - If the API rejects it (exit 3), redo the extraction with DevTools (docs/cli-spec.md §6).
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "wetaca-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Gestiona tu Wetaca desde el terminal: suscripción, menú semanal, entregas y pedidos. Pensado para personas y para agentes IA.",
5
5
  "type": "module",
6
- "bin": { "wetaca": "bin/wetaca.js" },
6
+ "bin": {
7
+ "wetaca": "bin/wetaca.js"
8
+ },
7
9
  "files": [
8
10
  "bin",
9
11
  "src",
@@ -35,6 +37,8 @@
35
37
  "type": "git",
36
38
  "url": "https://github.com/gorgueugr/wetaca-cli.git"
37
39
  },
38
- "engines": { "node": ">=18" },
40
+ "engines": {
41
+ "node": ">=18"
42
+ },
39
43
  "license": "MIT"
40
44
  }