
erikhellman/willys-agent
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
API interation for Willys.se with a CLI + Claude Code skills
개요
TypeScript library and CLI for the Willys grocery store API. Search for products, browse categories, and manage your shopping cart from the terminal. This installs the willys-cli command globally. Requires Node.js 18+ (for native fetch support). The CLI requires your Willys account credentials (personnummer + password). Provide them in one of two ways: (or a .env file in the working directory): Flags take precedence over environment variables. Quoted values in .env are stripped automatically. Create a CSV file with one operation per line (lines starting with # are ignored): The package also exports a programmatic API:
README
원문 README의 일부입니다. 원문 보기.
willys-cli
TypeScript library and CLI for the Willys grocery store API.
Search for products, browse categories, and manage your shopping cart from the terminal.
Install
npm install -g willys-cli
This installs the willys-cli command globally. Requires Node.js 18+ (for native fetch support).
Credentials
The CLI requires your Willys account credentials (personnummer + password). Provide them in one of two ways:
Environment variables (or a .env file in the working directory):
WILLYS_USERNAME=199001011234
WILLYS_PASSWORD=yourpassword
CLI flags:
willys-cli -u 199001011234 -p yourpassword
Flags take precedence over environment variables. Quoted values in .env are stripped automatically.
CLI Usage
Searching for products
# Search for products (default 10 results)
willys-cli search mjölk
# Search with more results (auto-paginates)
willys-cli search "ekologisk mjölk" 30
Browsing categories
# List all categories (up to 3 levels deep)
willys-cli categories
# Browse products in a specific category
willys-cli browse frukt-och-gront/frukt/citrusfrukt
# Browse with pagination (page number, 0-indexed)
willys-cli browse frukt-och-gront/frukt/citrusfrukt 2
Managing your cart
# View cart contents
willys-cli cart
# Add a product (by product code, with optional quantity)
willys-cli add 101233933_ST 2
# Remove a product
willys-cli remove 101233933_ST
# Clear the entire cart
willys-cli clear
Batch operations
Create a CSV file with one operation per line (lines starting with # are ignored):
# Weekly shopping list
add,101233933_ST,2
add,101205823_ST,1
cart
remove,101205823_ST
clear
Run it:
willys-cli -i shopping-list.csv
Help
willys-cli -h
willys-cli --help
Library Usage
The package also exports a programmatic API:
import { WillysApi } from "willys-cli";
const api = new WillysApi();
await api.login("199001011234", "yourpassword");
// Search products
const results = await api.search("mjölk");
console.log(results.results[0].name);
// Manage cart
await api.addToCart([{ code: "101233933_ST", qty: 2 }]);
const cart = await api.getCart();
console.log(cart.totalPrice);
await api.logout();
API Methods
| Method | Description |
|---|---|
login(username, password) |
Authenticate and start a session (returns Customer) |
logout() |
End the session |
getCustomer() |
Get current user profile |
search(query, page?, size?) |
Search products (default page 0, size 30) |
getCategories(storeId?) |
Get the full category tree |
browseCategory(path, page?, size?) |
List products in a category |
getCart() |
Get current cart contents |
추천 도구
다른 키워드를 입력하거나 필터를 제거해 보세요.
설치
npx skillfish add erikhellman/willys-agent