wetaca-cli 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +93 -2
- package/bin/wetaca.js +248 -0
- package/docs/GUIA.md +118 -0
- package/docs/agent-guide.md +71 -0
- package/docs/api-operations/wetaca_bundle__Doc0.graphql +40 -0
- package/docs/api-operations/wetaca_bundle__Doc1.graphql +14 -0
- package/docs/api-operations/wetaca_bundle__Doc10.graphql +45 -0
- package/docs/api-operations/wetaca_bundle__Doc11.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__Doc2.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__Doc3.graphql +39 -0
- package/docs/api-operations/wetaca_bundle__Doc4.graphql +36 -0
- package/docs/api-operations/wetaca_bundle__Doc5.graphql +40 -0
- package/docs/api-operations/wetaca_bundle__Doc6.graphql +33 -0
- package/docs/api-operations/wetaca_bundle__Doc7.graphql +48 -0
- package/docs/api-operations/wetaca_bundle__Doc8.graphql +92 -0
- package/docs/api-operations/wetaca_bundle__Doc9.graphql +95 -0
- package/docs/api-operations/wetaca_bundle__SaveWeeklySurveyStep.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__StartWeeklySurvey.graphql +33 -0
- package/docs/api-operations/wetaca_bundle__SubmitWeeklySurvey.graphql +16 -0
- package/docs/api-operations/wetaca_bundle__SubscriptionDeliveryChangePriceQueryV2.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__SuggestionDeliveryChangePriceQueryV2.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__activateSubscriptionAccount.graphql +45 -0
- package/docs/api-operations/wetaca_bundle__activeReferredReward.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__addProductsToProfileWhitelist.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__addProductsToSubscriptionProfileBlacklist.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__addProfileToSubscriptionAccount.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__addRecurrenceVoucherToCustomer.graphql +23 -0
- package/docs/api-operations/wetaca_bundle__addSubscriptionProfileSuggestionOverwrites.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__addresses.graphql +17 -0
- package/docs/api-operations/wetaca_bundle__addressesInManager.graphql +17 -0
- package/docs/api-operations/wetaca_bundle__allRecommenderIngredients.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__appendNewPaymentSubscriptionMethod.graphql +8 -0
- package/docs/api-operations/wetaca_bundle__applyOrderVoucher.graphql +33 -0
- package/docs/api-operations/wetaca_bundle__articleQuery.graphql +22 -0
- package/docs/api-operations/wetaca_bundle__articlesByCategoryQuery.graphql +13 -0
- package/docs/api-operations/wetaca_bundle__assignNextSuggestionVoucher.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__authorizePaypalTokenGenerationPaymentIntention.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__authorizeRedsysAppApplePayPayment.graphql +16 -0
- package/docs/api-operations/wetaca_bundle__authorizeRedsysAppGooglePayPayment.graphql +16 -0
- package/docs/api-operations/wetaca_bundle__authorizeRedsysApplePayPayment.graphql +16 -0
- package/docs/api-operations/wetaca_bundle__authorizeRedsysGooglePayPayment.graphql +16 -0
- package/docs/api-operations/wetaca_bundle__authorizeRedsysPaymentIntention.graphql +17 -0
- package/docs/api-operations/wetaca_bundle__bypassSMSValidationConfigQuery.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__calculateNextProfileSuggestions.graphql +31 -0
- package/docs/api-operations/wetaca_bundle__cancelConfirmedOrder.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__cancelSubscriptionAccount.graphql +45 -0
- package/docs/api-operations/wetaca_bundle__categoriesQuery.graphql +15 -0
- package/docs/api-operations/wetaca_bundle__changeOptionsQuery.graphql +21 -0
- package/docs/api-operations/wetaca_bundle__changeOrderDelivery.graphql +27 -0
- package/docs/api-operations/wetaca_bundle__changePasswordInProfile.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__changeSubscriptionOptInMode.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__changeSubscriptionPaymentPaymentMethodsEdit.graphql +8 -0
- package/docs/api-operations/wetaca_bundle__computeConfirmedOrderModificationPriceSummary.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__confirmDeliveryReschedule.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__confirmedOrderEditContext.graphql +95 -0
- package/docs/api-operations/wetaca_bundle__currentRecurrenceVouchers.graphql +23 -0
- package/docs/api-operations/wetaca_bundle__customer.graphql +11 -0
- package/docs/api-operations/wetaca_bundle__customerBillingAddresses.graphql +18 -0
- package/docs/api-operations/wetaca_bundle__customerFF.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__customerFeatureFlagBySlug.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__customerFeatureFlagForAnalytics.graphql +8 -0
- package/docs/api-operations/wetaca_bundle__customerHasReferralVouchers.graphql +11 -0
- package/docs/api-operations/wetaca_bundle__customerPaymentMethods.graphql +23 -0
- package/docs/api-operations/wetaca_bundle__customerVouchers.graphql +224 -0
- package/docs/api-operations/wetaca_bundle__customerWalletScheduledDeposits.graphql +15 -0
- package/docs/api-operations/wetaca_bundle__customerWithSegment.graphql +61 -0
- package/docs/api-operations/wetaca_bundle__deleteCustomerAccount.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__deleteCustomerScheduledDeposit.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__deliveryOptionsByZipcode.graphql +27 -0
- package/docs/api-operations/wetaca_bundle__deliveryRescheduleWithAvailability.graphql +53 -0
- package/docs/api-operations/wetaca_bundle__dish.graphql +39 -0
- package/docs/api-operations/wetaca_bundle__editAccountBillingAddress.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__editDeliveryAccountInfo.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__editProfileSuggestionMenu.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__editSubscriptionDelivery.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__editSubscriptionProfileAllergens.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__editSubscriptionProfileDislikes.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__editSubscriptionProfileMenu.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__editSubscriptionProfileMenuAndNutrition.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__editSubscriptionProfileSpicy.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__editSubscriptionTastesProfile.graphql +38 -0
- package/docs/api-operations/wetaca_bundle__editSuggestionDelivery.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__featuredArticlesQuery.graphql +16 -0
- package/docs/api-operations/wetaca_bundle__getChargingSuggestionMetadata.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__getDeliveryConfigurationMaxQuantities.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__getDeliveryConfigurationProductAvailability.graphql +13 -0
- package/docs/api-operations/wetaca_bundle__getDeliveryConfigurationProductAvailabilityWithExceptions.graphql +28 -0
- package/docs/api-operations/wetaca_bundle__getSubscriptionAccountDeliveryConfigurationProductAvailability.graphql +38 -0
- package/docs/api-operations/wetaca_bundle__getUseGoogleSocialLoginInIosAppConfiguration.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__getWeeklySurveyConfig.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__giftCardsConfiguration.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__globalConfigurations.graphql +10 -0
- package/docs/api-operations/wetaca_bundle__initNewRedsysPaymentIntention.graphql +10 -0
- package/docs/api-operations/wetaca_bundle__initPaypalTokenGenerationPaymentIntention.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__initializePaymentProcessEvent.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__isNextSuggestionSkiped.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__landingTemplateCollectionQuery.graphql +157 -0
- package/docs/api-operations/wetaca_bundle__landingTemplateFloatingBarQuery.graphql +8 -0
- package/docs/api-operations/wetaca_bundle__lastUsedOrderOptions.graphql +34 -0
- package/docs/api-operations/wetaca_bundle__linkGoogleAccountByPassword.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__linkGoogleAccountBySMS.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__linkGoogleAccountPhone.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__linkPhoneNumberToAccount.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__markSuggestionAsViewedInEditableState.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__menuProductIds.graphql +8 -0
- package/docs/api-operations/wetaca_bundle__modifyConfirmedOrderProducts.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__mostRecentZipCode.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__myDetailsAccountWithProfiles.graphql +506 -0
- package/docs/api-operations/wetaca_bundle__newBlogLeadMutation.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__nextDeliveries.graphql +190 -0
- package/docs/api-operations/wetaca_bundle__nextSubscriptionStartOfChargeTimeQuery.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__nextSuggestion.graphql +231 -0
- package/docs/api-operations/wetaca_bundle__nextSuggestionAddVoucherPage.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__nextSuggestionIdAndVoucher.graphql +8 -0
- package/docs/api-operations/wetaca_bundle__nextSuggestionVoucherAndPrice.graphql +10 -0
- package/docs/api-operations/wetaca_bundle__orderDetails.graphql +124 -0
- package/docs/api-operations/wetaca_bundle__pauseProfile.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__pauseResumeProfile.graphql +56 -0
- package/docs/api-operations/wetaca_bundle__pauseSubscriptionQuery.graphql +17 -0
- package/docs/api-operations/wetaca_bundle__pauseSuggestion.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__pauseSuggestionProfile.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__paySubscriptionPendingOrderWithPaymentMethod.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__payTransactionalOrder.graphql +39 -0
- package/docs/api-operations/wetaca_bundle__pendingDeliveryOrders.graphql +473 -0
- package/docs/api-operations/wetaca_bundle__pendingPaymentOrderById.graphql +63 -0
- package/docs/api-operations/wetaca_bundle__pendingTransactionalDeliveryOrders.graphql +80 -0
- package/docs/api-operations/wetaca_bundle__previousDeliveries.graphql +33 -0
- package/docs/api-operations/wetaca_bundle__profileHasEditTastes.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__profileSuggestionBySuggestionId.graphql +190 -0
- package/docs/api-operations/wetaca_bundle__profileSuggestionWithProfileById.graphql +142 -0
- package/docs/api-operations/wetaca_bundle__purchaseGiftCard.graphql +10 -0
- package/docs/api-operations/wetaca_bundle__rechargeCustomerWalletWithPaymentMethod.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__recommendedArticlesQuery.graphql +20 -0
- package/docs/api-operations/wetaca_bundle__recommenderIngredientsByNames.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__recoverPassword.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__recurrenceNextAssociatedVoucher.graphql +23 -0
- package/docs/api-operations/wetaca_bundle__redeemGiftCard.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__referralConfig.graphql +61 -0
- package/docs/api-operations/wetaca_bundle__registerLogout.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__registerPaymentProcessEvent.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__removeAddress.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__removeAddressInManager.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__removeCreditCard.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__removeCustomerBillingAddress.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__removeProfileWithSuggestions.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__requestDeliveryRescheduleSupport.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__resetPassword.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__resumeSuggestion.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__resumeSuggestionProfile.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__salesPlanCategory.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__saveAddress.graphql +13 -0
- package/docs/api-operations/wetaca_bundle__saveCustomerBillingAddress.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__saveSubscriptionShoppingCart.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__scheduleNewCustomerWalletRecharges.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__segmentBySlug.graphql +75 -0
- package/docs/api-operations/wetaca_bundle__segmentMenu.graphql +89 -0
- package/docs/api-operations/wetaca_bundle__sessionTokenByPassword.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__sessionTokenBySms.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__setPasswordInProfile.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__shoppingCart.graphql +18 -0
- package/docs/api-operations/wetaca_bundle__signUp.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__signUpWithGoogle.graphql +15 -0
- package/docs/api-operations/wetaca_bundle__someProfileHasEditTastes.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__subscribeCustomer.graphql +11 -0
- package/docs/api-operations/wetaca_bundle__subscribeToReactivationUrlVoucher.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__subscribeToVoucherAddVoucherPage.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__subscriberAccountStatus.graphql +8 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAccountByCustomerWithPayments.graphql +10 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAccountChangePricing.graphql +92 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAccountIntentPricing.graphql +156 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAccountIntentPricingForMenu.graphql +134 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAccountIntentPricingFunnelCart.graphql +26 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAccountIntentPricingVoucher.graphql +9 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAccountProductsSubscriptionPricing.graphql +26 -0
- package/docs/api-operations/wetaca_bundle__subscriptionAvailability.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__subscriptionIntentMenuProductsPricing.graphql +26 -0
- package/docs/api-operations/wetaca_bundle__subscriptionMenuWithWelcomeVoucherQuery.graphql +66 -0
- package/docs/api-operations/wetaca_bundle__subscriptionSegmentMenu.graphql +48 -0
- package/docs/api-operations/wetaca_bundle__subscriptionVoucher.graphql +27 -0
- package/docs/api-operations/wetaca_bundle__subscriptionWelcomeVoucher.graphql +10 -0
- package/docs/api-operations/wetaca_bundle__suggestioMenuProductsPricing.graphql +26 -0
- package/docs/api-operations/wetaca_bundle__suggestionById.graphql +52 -0
- package/docs/api-operations/wetaca_bundle__suggestionByIdData.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__suggestionChangePricing.graphql +122 -0
- package/docs/api-operations/wetaca_bundle__syncFeatureFlags.graphql +7 -0
- package/docs/api-operations/wetaca_bundle__tokenIsValid.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__totalOrdersSummaryByCustomer.graphql +21 -0
- package/docs/api-operations/wetaca_bundle__trackInternalEvent.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__trackInternalGEvent.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__trackInternalLPEvent.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__trackLoginInternalEvent.graphql +5 -0
- package/docs/api-operations/wetaca_bundle__transactionalSegmentMenu.graphql +47 -0
- package/docs/api-operations/wetaca_bundle__updateSubscriptionProfileCharacter.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__updateSubscriptionProfileName.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__updateUserProfile.graphql +10 -0
- package/docs/api-operations/wetaca_bundle__useCaptchaConfig.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__userSessionSubscription.graphql +20 -0
- package/docs/api-operations/wetaca_bundle__validateSegment.graphql +19 -0
- package/docs/api-operations/wetaca_bundle__validateSubscriptionIntent.graphql +6 -0
- package/docs/api-operations/wetaca_bundle__voucherCustomDisplay.graphql +22 -0
- package/docs/api-operations/wetaca_bundle__walletBalance.graphql +3 -0
- package/docs/api-operations/wetaca_bundle__walletOperations.graphql +11 -0
- package/docs/cli-spec.md +113 -0
- package/package.json +38 -4
- package/src/commands.js +700 -0
- package/src/guide.js +73 -0
- package/src/lib.js +371 -0
- package/src/queries.js +235 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jorge Soler Padial
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# wetaca-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Manage your **Wetaca** from the terminal: subscription, weekly menu, deliveries and orders. Designed for people **and for AI agents**.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
wetaca suggestion show --format pretty
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
id: 68f21a...
|
|
11
|
+
skip: false
|
|
12
|
+
validUntil: Thu 30 Oct 23:59
|
|
13
|
+
week: { week: 45, year: 2026 }
|
|
14
|
+
pricingEur: { toPay: €42.30, shipping: €0.00 }
|
|
15
|
+
profiles: 2 (Profile 1, Profile 2)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- **Everything you do on the web**: view next week's menu per profile, swap tuppers, skip a week, pause the subscription, view past deliveries, cancel an order, vouchers and wallet.
|
|
19
|
+
- **Built for scripts and AI agents**: JSON by default, stable exit codes, JSON error wrapper, `--dry-run`, and an embedded usage guide (`wetaca skills get wetaca-usage`).
|
|
20
|
+
- A single dependency-free Node package. Requires Node ≥ 18.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
npm install -g wetaca-cli # from npm
|
|
26
|
+
wetaca doctor
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or from the repo: `npm install -g .`
|
|
30
|
+
|
|
31
|
+
## Get started
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
wetaca auth login --refresh-token <COOKIE> # refresh-token cookie from wetaca.com (lasts ~120 days)
|
|
35
|
+
wetaca auth login # prompts for the refresh-token (hidden); also accepts a session JWT
|
|
36
|
+
wetaca me --format pretty
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The refresh-token is stored in `%USERPROFILE%\.config\wetaca-cli\credentials.json` (or `$XDG_CONFIG_HOME/wetaca-cli`), with restrictive permissions (your user only); the remaining settings live in `config.json`. In CI: `WETACA_TOKEN` or `WETACA_REFRESH_TOKEN`.
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
# what's on this week?
|
|
45
|
+
wetaca suggestion show --format pretty
|
|
46
|
+
|
|
47
|
+
# skip next week (asks for confirmation)
|
|
48
|
+
wetaca suggestion pause
|
|
49
|
+
|
|
50
|
+
# swap the menu's tuppers (dry-run first, then --yes)
|
|
51
|
+
wetaca suggestion edit --profile-suggestion ID --set "productId:2,productIdB:1" --dry-run
|
|
52
|
+
wetaca suggestion edit --profile-suggestion ID --set "productId:2,productIdB:1" --yes
|
|
53
|
+
|
|
54
|
+
# pause for holidays
|
|
55
|
+
wetaca subscription pause --weeks 2 --yes
|
|
56
|
+
wetaca subscription resume
|
|
57
|
+
|
|
58
|
+
# orders
|
|
59
|
+
wetaca deliveries next
|
|
60
|
+
wetaca orders cancel 12345 --dry-run
|
|
61
|
+
wetaca orders cancel 12345 --yes
|
|
62
|
+
|
|
63
|
+
# for AI agents
|
|
64
|
+
wetaca skills get wetaca-usage
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
| doc | |
|
|
70
|
+
|---|---|
|
|
71
|
+
| [Specification](docs/cli-spec.md) | every command, flag, exit code and GraphQL operation |
|
|
72
|
+
| [Extracted operations](docs/api-operations/) | the ~190 GraphQL documents from Wetaca's website |
|
|
73
|
+
| [Agent guide](docs/agent-guide.md) | `wetaca skills get wetaca-usage` |
|
|
74
|
+
|
|
75
|
+
## Good to know
|
|
76
|
+
|
|
77
|
+
- **Not affiliated with Wetaca.** Independent project, not related to Wetaca. It uses the `api.wetaca.com` GraphQL API (the same one as the website and the app). Wetaca may change it; if it does, the CLI exits with code 7 (`contract_drift`).
|
|
78
|
+
- **Your session stays local.** The refresh-token is stored only on your disk (separate file, restrictive permissions) and only travels to Wetaca.
|
|
79
|
+
- **Nothing without confirmation.** Operations with real effects (`suggestion pause/edit`, `subscription pause`, `orders cancel`) show a summary and ask for confirmation; without a terminal they require `--yes`.
|
|
80
|
+
- **Does not touch payments.** Cards and pending payments are managed on wetaca.com.
|
|
81
|
+
- Be kind: this CLI makes few requests, one per command.
|
|
82
|
+
|
|
83
|
+
## Credits & inspiration
|
|
84
|
+
|
|
85
|
+
This project is based on the design and experience of other CLIs of the same kind:
|
|
86
|
+
|
|
87
|
+
- [booksy-cli](https://github.com/GodGMN/booksy-cli) — Booksy management from the terminal; the origin of the contract wetaca-cli follows (JSON by default, stable exit codes, `--dry-run`, an AI-agent guide, cookie-based session with a separate credentials file).
|
|
88
|
+
- [wallapop-cli](https://github.com/Microck/wallapop-cli) — Wallapop management from the terminal; the reference for long-lived cookie login and importing browser cookie exports (`--cookies`).
|
|
89
|
+
|
|
90
|
+
Built with [Hermes Agent](https://github.com/NousResearch/hermes-agent) (Nous Research).
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT.
|
package/bin/wetaca.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// wetaca-cli — entry point: arg parsing, dispatch, help, error handling.
|
|
3
|
+
import { CliError, EXIT, printError, loadConfig, configPath, VERSION } from '../src/lib.js';
|
|
4
|
+
import * as C from '../src/commands.js';
|
|
5
|
+
import { GUIDE } from '../src/guide.js';
|
|
6
|
+
|
|
7
|
+
const HELP = `wetaca-cli ${VERSION} — your Wetaca from the terminal.
|
|
8
|
+
|
|
9
|
+
USAGE
|
|
10
|
+
wetaca [global flags] <noun> <verb> [args] [flags]
|
|
11
|
+
|
|
12
|
+
COMMANDS
|
|
13
|
+
auth login [--refresh-token COOKIE | --cookies FILE | --cookies-stdin | --token T [--clipboard]] | status | logout
|
|
14
|
+
auth login imports the refresh-token cookie from wetaca.com (F12 -> Application -> Cookies;
|
|
15
|
+
lasts ~120 days) and RENEWS the session token automatically when it expires.
|
|
16
|
+
The password is never asked for or stored.
|
|
17
|
+
--cookies FILE accepts browser exports: Netscape cookies.txt, Cookie-Editor/
|
|
18
|
+
EditThisCookie JSON, a Cookie: header, or the bare value; only cookies from
|
|
19
|
+
wetaca.com are read.
|
|
20
|
+
login --token: paste the session token straight from wetaca.com (expires ~1h)
|
|
21
|
+
me show account summary
|
|
22
|
+
subscription show | pause [--weeks N] | resume
|
|
23
|
+
suggestion show | pause | resume | edit --profile-suggestion ID --set "id:qty,..."
|
|
24
|
+
deliveries next | options | set-option <id> pending deliveries and orders / available slots / change slot
|
|
25
|
+
menu list [--zipcode ZIP] weekly menu (dish ids for suggestion edit)
|
|
26
|
+
dish show <slug> dish detail
|
|
27
|
+
profiles list | pause <id|name> | resume <id|name>
|
|
28
|
+
orders list [--limit N] | show <id> | cancel <id> [--dry-run]
|
|
29
|
+
addresses list | save --street S --number N [--floor F] --zipcode ZIP --city CITY
|
|
30
|
+
save: changes your delivery address (subscription + next week);
|
|
31
|
+
optional --notes --firstname --lastname --phone (inherit the current ones by default)
|
|
32
|
+
--dry-run shows the exact plan before executing
|
|
33
|
+
remove <id>: deletes an unused address
|
|
34
|
+
vouchers list
|
|
35
|
+
wallet show
|
|
36
|
+
config path | list | get <k> | set <k> <v>
|
|
37
|
+
doctor diagnostics (node, network, session)
|
|
38
|
+
skills get wetaca-usage AI-agent guide (embedded)
|
|
39
|
+
completion bash | zsh | fish autocompletion script
|
|
40
|
+
|
|
41
|
+
GLOBAL FLAGS
|
|
42
|
+
--format json|jsonl|pretty output (default json)
|
|
43
|
+
--error-format text|json errors on stderr (default text)
|
|
44
|
+
--profile NAME session profile (env WETACA_PROFILE)
|
|
45
|
+
--yes confirm without asking
|
|
46
|
+
--no-input never prompt; mutations require --yes
|
|
47
|
+
--dry-run show what would be done, no effects
|
|
48
|
+
--debug one line per HTTP request on stderr
|
|
49
|
+
--no-color disable color (also NO_COLOR)
|
|
50
|
+
|
|
51
|
+
Top-level aliases: \`me\`, \`doctor\`. Without a session: \`wetaca auth login\`.
|
|
52
|
+
Docs: docs/cli-spec.md. Not affiliated with Wetaca; uses the wetaca.com web API.
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const COMPLETION = {
|
|
56
|
+
bash: `_wetaca() {
|
|
57
|
+
local cur prev nouns="auth me subscription suggestion deliveries orders addresses vouchers wallet config doctor skills completion"
|
|
58
|
+
COMPREPLY=()
|
|
59
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
60
|
+
if [ "$COMP_CWORD" -eq 1 ]; then COMPREPLY=( $(compgen -W "$nouns" -- "$cur") ); fi
|
|
61
|
+
return 0
|
|
62
|
+
}
|
|
63
|
+
complete -F _wetaca wetaca`,
|
|
64
|
+
zsh: `#compdef wetaca
|
|
65
|
+
_wetaca() { _alternative 'args:command:(auth me subscription suggestion deliveries orders addresses vouchers wallet config doctor skills completion)' }
|
|
66
|
+
_wetaca "$@"`,
|
|
67
|
+
fish: `complete -c wetaca -n '__fish_use_subcommand' -a 'auth me subscription suggestion deliveries orders addresses vouchers wallet config doctor skills completion'`,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// ---------- flag parsing ----------
|
|
71
|
+
const BOOL_FLAGS = new Set(['yes', 'no-input', 'dry-run', 'debug', 'no-color', 'help', 'version', 'clipboard', 'cookies-stdin']);
|
|
72
|
+
const VALUE_FLAGS = new Set(['format', 'error-format', 'profile', 'token', 'refresh-token', 'cookies',
|
|
73
|
+
'weeks', 'feedback', 'set', 'limit', 'offset', 'suggestion', 'profile-suggestion', 'resume', 'code', 'state',
|
|
74
|
+
'street', 'number', 'floor', 'zipcode', 'city', 'notes', 'firstname', 'lastname', 'phone']);
|
|
75
|
+
|
|
76
|
+
function parseArgs(argv) {
|
|
77
|
+
const flags = {}, positional = [];
|
|
78
|
+
for (let i = 0; i < argv.length; i++) {
|
|
79
|
+
const a = argv[i];
|
|
80
|
+
if (a === '--') { positional.push(...argv.slice(i + 1)); break; }
|
|
81
|
+
if (a.startsWith('--')) {
|
|
82
|
+
const eq = a.indexOf('=');
|
|
83
|
+
const key = eq === -1 ? a.slice(2) : a.slice(2, eq);
|
|
84
|
+
let val = eq === -1 ? undefined : a.slice(eq + 1);
|
|
85
|
+
if (val === undefined) {
|
|
86
|
+
if (!BOOL_FLAGS.has(key) && VALUE_FLAGS.has(key) && i + 1 < argv.length && !argv[i + 1].startsWith('--')) {
|
|
87
|
+
val = argv[++i];
|
|
88
|
+
} else {
|
|
89
|
+
val = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
flags[key] = val;
|
|
93
|
+
} else if (a.startsWith('-') && a.length === 2) {
|
|
94
|
+
flags[a.slice(1)] = true;
|
|
95
|
+
} else {
|
|
96
|
+
positional.push(a);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { flags, positional };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function normalizeFlags(flags) {
|
|
103
|
+
const out = {};
|
|
104
|
+
for (const [k, v] of Object.entries(flags)) {
|
|
105
|
+
if (BOOL_FLAGS.has(k)) out[k] = v === true || v === 'true';
|
|
106
|
+
else out[k] = v === true ? true : String(v);
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ---------- dispatch ----------
|
|
112
|
+
function makeCtx(flags) {
|
|
113
|
+
const cfg = loadConfig();
|
|
114
|
+
return {
|
|
115
|
+
profile: flags.profile || process.env.WETACA_PROFILE || cfg.defaultProfile || 'default',
|
|
116
|
+
format: flags.format || (process.env.WETACA_FORMAT === 'pretty' ? 'pretty' : 'json'),
|
|
117
|
+
jsonl: flags.format === 'jsonl',
|
|
118
|
+
errorFormat: flags['error-format'] || (process.env.WETACA_ERROR_FORMAT === 'json' ? 'json' : 'text'),
|
|
119
|
+
yes: flags.yes === true,
|
|
120
|
+
noInput: flags['no-input'] === true || process.env.WETACA_NO_INPUT === '1',
|
|
121
|
+
dryRun: flags['dry-run'] === true,
|
|
122
|
+
debug: flags.debug === true,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function main() {
|
|
127
|
+
const { flags: rawFlags, positional } = parseArgs(process.argv.slice(2));
|
|
128
|
+
const flags = normalizeFlags(rawFlags);
|
|
129
|
+
const ctx = makeCtx(flags);
|
|
130
|
+
|
|
131
|
+
if (flags.version) { console.log(VERSION); return 0; }
|
|
132
|
+
if (flags.help || positional.length === 0 || positional[0] === 'help') {
|
|
133
|
+
process.stdout.write(HELP);
|
|
134
|
+
return 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const [noun, verb, ...args] = positional;
|
|
138
|
+
let result;
|
|
139
|
+
|
|
140
|
+
switch (noun) {
|
|
141
|
+
case 'auth':
|
|
142
|
+
if (verb === 'login') result = await C.authLogin(args, flags, ctx);
|
|
143
|
+
else if (verb === 'status') result = await C.authStatus(args, flags, ctx);
|
|
144
|
+
else if (verb === 'logout') result = await C.authLogout(args, flags, ctx);
|
|
145
|
+
else throw usageUnknown(noun, verb);
|
|
146
|
+
break;
|
|
147
|
+
case 'me':
|
|
148
|
+
if (verb === 'show' || verb === undefined) result = await C.meShow(args, flags, ctx);
|
|
149
|
+
else throw usageUnknown(noun, verb);
|
|
150
|
+
break;
|
|
151
|
+
case 'subscription':
|
|
152
|
+
if (verb === 'show') result = await C.subShow(args, flags, ctx);
|
|
153
|
+
else if (verb === 'pause') result = await C.subPause(args, flags, ctx);
|
|
154
|
+
else if (verb === 'resume') result = await C.subResume(args, flags, ctx);
|
|
155
|
+
else throw usageUnknown(noun, verb);
|
|
156
|
+
break;
|
|
157
|
+
case 'suggestion':
|
|
158
|
+
if (verb === 'show') result = await C.sugShow(args, flags, ctx);
|
|
159
|
+
else if (verb === 'pause') result = await C.sugPause(args, flags, ctx);
|
|
160
|
+
else if (verb === 'resume') result = await C.sugResume(args, flags, ctx);
|
|
161
|
+
else if (verb === 'edit') result = await C.sugEdit(args, flags, ctx);
|
|
162
|
+
else throw usageUnknown(noun, verb);
|
|
163
|
+
break;
|
|
164
|
+
case 'deliveries':
|
|
165
|
+
if (verb === 'next' || verb === undefined) result = await C.deliveriesNext(args, flags, ctx);
|
|
166
|
+
else if (verb === 'options') result = await C.delivOptions(args, flags, ctx);
|
|
167
|
+
else if (verb === 'set-option') result = await C.delivSetOption(args, flags, ctx);
|
|
168
|
+
else throw usageUnknown(noun, verb);
|
|
169
|
+
break;
|
|
170
|
+
case 'menu':
|
|
171
|
+
if (verb === 'list' || verb === undefined) result = await C.menuList(args, flags, ctx);
|
|
172
|
+
else throw usageUnknown(noun, verb);
|
|
173
|
+
break;
|
|
174
|
+
case 'dish':
|
|
175
|
+
if (verb === 'show' || verb === undefined) result = await C.dishShow(args, flags, ctx);
|
|
176
|
+
else throw usageUnknown(noun, verb);
|
|
177
|
+
break;
|
|
178
|
+
case 'profiles':
|
|
179
|
+
if (verb === 'list' || verb === undefined) result = await C.profilesList(args, flags, ctx);
|
|
180
|
+
else if (verb === 'pause') result = await C.profilesPause(args, flags, ctx);
|
|
181
|
+
else if (verb === 'resume') result = await C.profilesResume(args, flags, ctx);
|
|
182
|
+
else throw usageUnknown(noun, verb);
|
|
183
|
+
break;
|
|
184
|
+
case 'orders':
|
|
185
|
+
if (verb === 'list') result = await C.ordersList(args, flags, ctx);
|
|
186
|
+
else if (verb === 'show') result = await C.ordersShow(args, flags, ctx);
|
|
187
|
+
else if (verb === 'cancel') result = await C.ordersCancel(args, flags, ctx);
|
|
188
|
+
else throw usageUnknown(noun, verb);
|
|
189
|
+
break;
|
|
190
|
+
case 'addresses':
|
|
191
|
+
if (verb === 'list') result = await C.addrList(args, flags, ctx);
|
|
192
|
+
else if (verb === 'save') result = await C.addrSave(args, flags, ctx);
|
|
193
|
+
else if (verb === 'remove') result = await C.addrRemove(args, flags, ctx);
|
|
194
|
+
else throw usageUnknown(noun, verb);
|
|
195
|
+
break;
|
|
196
|
+
case 'vouchers':
|
|
197
|
+
if (verb === 'list') result = await C.vouchersList(args, flags, ctx);
|
|
198
|
+
else throw usageUnknown(noun, verb);
|
|
199
|
+
break;
|
|
200
|
+
case 'wallet':
|
|
201
|
+
if (verb === 'show' || verb === undefined) result = await C.walletShow(args, flags, ctx);
|
|
202
|
+
else throw usageUnknown(noun, verb);
|
|
203
|
+
break;
|
|
204
|
+
case 'config':
|
|
205
|
+
result = await C.configCmd(verb, args, flags, ctx);
|
|
206
|
+
break;
|
|
207
|
+
case 'doctor':
|
|
208
|
+
result = await C.doctor(args, flags, ctx);
|
|
209
|
+
break;
|
|
210
|
+
case 'skills':
|
|
211
|
+
if (verb === 'get' && args[0] === 'wetaca-usage') { process.stdout.write(GUIDE); return 0; }
|
|
212
|
+
if (verb === 'list') { result = { skills: [{ id: 'wetaca-usage', description: 'AI-agent usage guide' }] }; break; }
|
|
213
|
+
throw new CliError(EXIT.USAGE, "skills get expects 'wetaca-usage'.");
|
|
214
|
+
case 'completion': {
|
|
215
|
+
const s = COMPLETION[verb];
|
|
216
|
+
if (!s) throw new CliError(EXIT.USAGE, 'completion expects: bash | zsh | fish');
|
|
217
|
+
process.stdout.write(s + '\n');
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
default:
|
|
221
|
+
throw new CliError(EXIT.USAGE, `Sustantivo desconocido '${noun}'.`, { suggested_commands: ['wetaca --help'] });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (result !== undefined && result !== null) {
|
|
225
|
+
const { emit } = await import('../src/lib.js');
|
|
226
|
+
emit(result, ctx);
|
|
227
|
+
}
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function usageUnknown(noun, verb) {
|
|
232
|
+
return new CliError(EXIT.USAGE, `Verbo desconocido: ${noun} ${verb}.`, { suggested_commands: [`wetaca ${noun} --help`, 'wetaca --help'] });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
main()
|
|
236
|
+
.then((code) => { process.exitCode = code ?? 0; })
|
|
237
|
+
.catch((err) => {
|
|
238
|
+
const { flags } = parseArgs(process.argv.slice(2));
|
|
239
|
+
const errorFormat = flags['error-format'] === 'json' ? 'json' : 'text';
|
|
240
|
+
const debug = flags.debug === true;
|
|
241
|
+
if (err instanceof CliError) {
|
|
242
|
+
printError(err, errorFormat, debug);
|
|
243
|
+
process.exitCode = err.exitCode;
|
|
244
|
+
} else {
|
|
245
|
+
printError(new CliError(EXIT.UNEXPECTED, err.message, { reason: 'unexpected', details: { stack: err.stack } }), errorFormat, debug);
|
|
246
|
+
process.exitCode = EXIT.UNEXPECTED;
|
|
247
|
+
}
|
|
248
|
+
});
|
package/docs/GUIA.md
ADDED
|
@@ -0,0 +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).
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# wetaca-cli — guía para agentes IA
|
|
2
|
+
|
|
3
|
+
Gestiona la cuenta de Wetaca (suscripción de comida semanal) del usuario desde el terminal.
|
|
4
|
+
Todo comando devuelve JSON en stdout por defecto; los errores van a stderr.
|
|
5
|
+
|
|
6
|
+
## Antes de empezar
|
|
7
|
+
|
|
8
|
+
1. Ejecuta `wetaca doctor` para verificar node, conectividad y sesión.
|
|
9
|
+
2. `wetaca auth status` dice si hay sesión válida. Si no la hay:
|
|
10
|
+
- `wetaca auth login --cookies cookies.txt` (export con la extensión Cookie-Editor sobre wetaca.com logueado) o `--refresh-token COOKIE` (cookie de wetaca.com, dura ~120 días; el CLI renueva el token solo). Sin contraseña.
|
|
11
|
+
- `wetaca auth login --token T` o `--token --clipboard`: token copiado de la cabecera
|
|
12
|
+
`authorization: Bearer …` de cualquier petición a api.wetaca.com en las DevTools del
|
|
13
|
+
usuario (F12 → Network). Es la vía si su cuenta entra con Google.
|
|
14
|
+
No pidas al usuario la contraseña de Google ni automatices su navegador para el login.
|
|
15
|
+
|
|
16
|
+
## Contrato de salida
|
|
17
|
+
|
|
18
|
+
- stdout: JSON (`--format pretty` para humanos, `jsonl` para listas línea a línea).
|
|
19
|
+
- `--error-format json`: envoltorio de error { error: { code, category, reason, retryable, message, suggested_commands } }.
|
|
20
|
+
- Exit codes estables: 0 ok · 1 inesperado · 2 uso/validación/confirmación denegada · 3 auth ·
|
|
21
|
+
4 red · 5 no encontrado · 6 la API rechazó la operación · 7 deriva de contrato (schema cambiado).
|
|
22
|
+
- `reason: "auth_required"` → nada que reintentar; el usuario debe hacer login.
|
|
23
|
+
- `reason: "contract_drift"` → no reinventes la query; abre issue en el repo.
|
|
24
|
+
|
|
25
|
+
## Reglas para operaciones con efectos reales
|
|
26
|
+
|
|
27
|
+
1. Nada cambia la cuenta sin confirmación: sin terminal, exige `--yes`. Pasa `--yes` SOLO cuando
|
|
28
|
+
el usuario pidió exactamente esa operación y vio el resumen.
|
|
29
|
+
2. Usa `--dry-run` en `suggestion edit` y `orders cancel` para mostrar qué se enviaría, antes de pedir confirmación.
|
|
30
|
+
3. `suggestion pause` salta la entrega de la semana próxima (la semana ya cobrada NO se toca).
|
|
31
|
+
`subscription pause --weeks N` pausa la suscripción N semanas (cancelación temporal);
|
|
32
|
+
`subscription resume` la reactiva.
|
|
33
|
+
4. `orders cancel <id>` cancela un pedido confirmado y devuelve el importe. Ids: `deliveries next`
|
|
34
|
+
(pedidos pendientes) y `orders list` (histórico).
|
|
35
|
+
5. Nunca gestiones pagos: wetaca-cli no toca tarjetas ni pagos pendientes de Redsys/PayPal.
|
|
36
|
+
Si `nextPaymentPendingOrder` no es null, dilo al usuario y que lo pague en wetaca.com.
|
|
37
|
+
|
|
38
|
+
## Comandos
|
|
39
|
+
|
|
40
|
+
wetaca auth login [--refresh-token COOKIE | --token T] | status | logout
|
|
41
|
+
wetaca me resumen: cliente + suscripción + cartera
|
|
42
|
+
wetaca subscription show | pause [--weeks N] [--feedback S] | resume
|
|
43
|
+
wetaca suggestion show menú de la semana próxima por perfil, precios, ventana de entrega
|
|
44
|
+
wetaca suggestion pause | resume saltar / reactivar la semana próxima
|
|
45
|
+
wetaca suggestion edit --profile-suggestion ID --set "productId:cant,..." [--dry-run]
|
|
46
|
+
wetaca deliveries next sugerencias y pedidos pendientes (ids para orders/cancel)
|
|
47
|
+
wetaca orders list [--limit N] | show <id> | cancel <id> [--dry-run]
|
|
48
|
+
wetaca menu list platos de la semana (ids para suggestion edit)
|
|
49
|
+
wetaca dish show <slug> detalle/ingredientes de un plato
|
|
50
|
+
wetaca deliveries options franjas de entrega disponibles para tu CP
|
|
51
|
+
wetaca deliveries set-option <id> --dry-run cambia la franja (revisa y repite con --yes)
|
|
52
|
+
wetaca profiles list tus perfiles y su menú
|
|
53
|
+
wetaca profiles pause <id|nombre> pausa un perfil (dry-run antes)
|
|
54
|
+
wetaca addresses list
|
|
55
|
+
wetaca addresses save --street C --number N [--floor F] --zipcode CP --city CIUDAD --dry-run
|
|
56
|
+
(revisa el plan; repite con --yes; opcional --notes --firstname --lastname --phone)
|
|
57
|
+
wetaca addresses remove <id> borra una dirección no en uso
|
|
58
|
+
wetaca vouchers list
|
|
59
|
+
wetaca wallet
|
|
60
|
+
wetaca config path | list | get <k> | set <k> <v>
|
|
61
|
+
wetaca doctor
|
|
62
|
+
wetaca skills get wetaca-usage esta guía
|
|
63
|
+
|
|
64
|
+
## Flujos típicos
|
|
65
|
+
|
|
66
|
+
- "¿Qué toca esta semana?": `wetaca suggestion show --format pretty`
|
|
67
|
+
- "Esta semana no quiero arroz": `suggestion show` → localiza el plato y su `productSuggestionId`
|
|
68
|
+
(`profileSuggestionId`) y `productId` → `suggestion edit --profile-suggestion ID --set "..." --dry-run`
|
|
69
|
+
→ muestra el plan → confirma → ejecuta con `--yes`.
|
|
70
|
+
- "Vacaciones dos semanas": `subscription pause --weeks 2` (resumen → --yes) y luego `subscription resume`.
|
|
71
|
+
- "Cancela el pedido de mañana": `deliveries next` → `orders cancel <id>`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
fragment MyDetailsMenuSuggestion on SuggestionWithProfilesGraph {
|
|
2
|
+
_id
|
|
3
|
+
skip
|
|
4
|
+
profileSuggestions {
|
|
5
|
+
_id
|
|
6
|
+
skip
|
|
7
|
+
products {
|
|
8
|
+
id
|
|
9
|
+
quantity
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
delivery {
|
|
13
|
+
option {
|
|
14
|
+
id
|
|
15
|
+
start
|
|
16
|
+
end
|
|
17
|
+
price
|
|
18
|
+
customizedPrice
|
|
19
|
+
custom
|
|
20
|
+
exception {
|
|
21
|
+
start
|
|
22
|
+
end
|
|
23
|
+
from {
|
|
24
|
+
year
|
|
25
|
+
month
|
|
26
|
+
dayOfMonth
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
suggestionPricing {
|
|
32
|
+
salesPlan {
|
|
33
|
+
minProfilesPriceValidation {
|
|
34
|
+
minPrice
|
|
35
|
+
result
|
|
36
|
+
remainingAmount
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
fragment SuggestionEditDelivery on SuggestionGraph {
|
|
2
|
+
id
|
|
3
|
+
deliveryConfigurationId
|
|
4
|
+
delivery {
|
|
5
|
+
option {
|
|
6
|
+
id
|
|
7
|
+
start
|
|
8
|
+
end
|
|
9
|
+
price
|
|
10
|
+
customizedPrice
|
|
11
|
+
custom
|
|
12
|
+
exception {
|
|
13
|
+
start
|
|
14
|
+
end
|
|
15
|
+
from {
|
|
16
|
+
year
|
|
17
|
+
month
|
|
18
|
+
dayOfMonth
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
configurationDate {
|
|
22
|
+
start
|
|
23
|
+
end
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
address {
|
|
27
|
+
id
|
|
28
|
+
firstname
|
|
29
|
+
lastname
|
|
30
|
+
street
|
|
31
|
+
number
|
|
32
|
+
zipcode
|
|
33
|
+
city
|
|
34
|
+
phone
|
|
35
|
+
floor
|
|
36
|
+
notes
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
suggestionPricing {
|
|
40
|
+
shipping
|
|
41
|
+
}
|
|
42
|
+
menuMetadata {
|
|
43
|
+
dateFrom
|
|
44
|
+
}
|
|
45
|
+
}
|