1688-cli 0.1.23 → 0.1.25
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/AGENTS.md +125 -39
- package/CHANGELOG.md +58 -0
- package/README.md +141 -64
- package/dist/cli.js +13 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/cart-add.js +224 -133
- package/dist/commands/cart-add.js.map +1 -1
- package/dist/commands/cart-list.js +22 -3
- package/dist/commands/cart-list.js.map +1 -1
- package/dist/commands/cart-remove.js +5 -0
- package/dist/commands/cart-remove.js.map +1 -1
- package/dist/commands/image-search.js +44 -11
- package/dist/commands/image-search.js.map +1 -1
- package/dist/commands/offer.js +376 -26
- package/dist/commands/offer.js.map +1 -1
- package/dist/commands/order-list.js +29 -0
- package/dist/commands/order-list.js.map +1 -1
- package/dist/commands/order-logistics.js +10 -0
- package/dist/commands/order-logistics.js.map +1 -1
- package/dist/commands/search.js +216 -52
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/seller-messages.js +515 -16
- package/dist/commands/seller-messages.js.map +1 -1
- package/dist/commands/similar.js +123 -0
- package/dist/commands/similar.js.map +1 -0
- package/dist/session/dispatch.js +1 -0
- package/dist/session/dispatch.js.map +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -4,59 +4,101 @@ When the user asks anything about 1688 sourcing, products, orders, or
|
|
|
4
4
|
logistics, use the `1688` CLI. It outputs JSON automatically when stdout
|
|
5
5
|
is piped, so `1688 <cmd> | jq` works.
|
|
6
6
|
|
|
7
|
-
## Current commands
|
|
7
|
+
## Current commands
|
|
8
|
+
|
|
9
|
+
Organized by buyer journey: sourcing → inquiry → cart → checkout → tracking → post-sale.
|
|
8
10
|
|
|
9
11
|
```
|
|
10
|
-
|
|
11
|
-
1688
|
|
12
|
-
1688
|
|
13
|
-
1688
|
|
14
|
-
1688 search
|
|
15
|
-
1688
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
1688
|
|
20
|
-
1688
|
|
21
|
-
1688
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
1688
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
1688
|
|
34
|
-
1688
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
12
|
+
# Sourcing
|
|
13
|
+
1688 search <keyword> Keyword search; --max N to limit.
|
|
14
|
+
1688 search --headed Open window once if a slider verification appears.
|
|
15
|
+
1688 similar <offerId> "找同款" — similar offers from other suppliers, sorted by price.
|
|
16
|
+
1688 image-search <pathOrUrl> Search by image (local .jpg/.png/.webp file or http(s) URL).
|
|
17
|
+
1688 offer <offerId> Full product detail: title, priceTiers, SKUs, attributes,
|
|
18
|
+
packageInfo, supplier (loginId/memberId/province/city).
|
|
19
|
+
|
|
20
|
+
# Pre-sale inquiry (seller IM, scoped by offerId)
|
|
21
|
+
1688 seller inquire <offerId> <message> Send product link + question to the supplier.
|
|
22
|
+
1688 seller messages --offer <offerId> Read replies in this offer's conversation.
|
|
23
|
+
1688 seller messages --offer <offerId> --watch [--interval N]
|
|
24
|
+
Live-tail new replies (line-delimited JSON when piped).
|
|
25
|
+
Long-running; min interval 10 s, default 30 s.
|
|
26
|
+
|
|
27
|
+
# Cart
|
|
28
|
+
1688 cart list List items in 1688 cart (采购车).
|
|
29
|
+
1688 cart add <offerId> --sku <skuId> --qty N
|
|
30
|
+
Add SKU to cart (~6 s, mtop hijack). Returns
|
|
31
|
+
{added: CartItem, isNewRow, addedQuantity}.
|
|
32
|
+
1688 cart remove <cartId> Remove one cart row (~12 s, UI replay).
|
|
33
|
+
|
|
34
|
+
# Checkout
|
|
35
|
+
1688 checkout prepare <cartId>... Preview total/address/items (NO order placement).
|
|
36
|
+
1688 checkout confirm <cartId>... PLACE order — TTY+prompt by default.
|
|
37
|
+
1688 checkout confirm <cartId>... --agent Agent mode: no prompt, daemon-OK.
|
|
38
|
+
MUST be preceded by `prepare` shown to the user AND
|
|
39
|
+
explicit user authorization in the current turn.
|
|
40
|
+
|
|
41
|
+
# Order tracking
|
|
42
|
+
1688 order list List buyer orders; --status, --page, --page-size flags.
|
|
43
|
+
Each order has actions[] (buyer ops + URLs), services[]
|
|
44
|
+
(insurance/refund), badges[].
|
|
45
|
+
1688 order list --status waitbuyerreceive Filter to "awaiting delivery".
|
|
46
|
+
1688 order get <orderId> One order by ID (--max-scan-pages N, --status hint).
|
|
47
|
+
1688 order logistics <orderId> Tracking number + trace (mailNo, carrier, remark).
|
|
48
|
+
1688 shipped <orderId> Order detail + logistics merged into one call.
|
|
49
|
+
1688 stuck [--days N] Paid but not shipped > N days (default 3).
|
|
50
|
+
1688 fake-shipped [--days N] [--debug] Marked shipped but courier never collected (虚假发货).
|
|
51
|
+
1688 seller-history <sellerName> All orders from a seller + avg ship days + on-time rate.
|
|
52
|
+
|
|
53
|
+
# Post-sale chat (seller IM, scoped by orderId)
|
|
54
|
+
1688 seller chat <orderId|loginId> <message>
|
|
55
|
+
Send to seller. With orderId, auto-attaches the order card.
|
|
56
|
+
1688 seller chat <orderId> <message> --no-card
|
|
57
|
+
Follow-up reply, no card.
|
|
58
|
+
1688 seller messages <orderId> Read replies in this order's conversation.
|
|
59
|
+
1688 seller messages <orderId> --watch Live-tail (same as the --offer form above).
|
|
60
|
+
|
|
61
|
+
# Account & daemon
|
|
62
|
+
1688 login Show QR code; user scans with phone.
|
|
63
|
+
1688 login --headed Use a real browser window instead (fallback).
|
|
64
|
+
1688 login --force Re-login even if a session exists.
|
|
65
|
+
1688 logout [--yes] Log out (prompts unless --yes).
|
|
66
|
+
1688 whoami [--verify] Print current account; exit 3 if not logged in.
|
|
67
|
+
1688 doctor [--no-launch] Diagnose environment + session state.
|
|
68
|
+
1688 daemon start | stop | status | reload Manage the background daemon.
|
|
69
|
+
1688 serve Run the daemon in the foreground.
|
|
40
70
|
```
|
|
41
71
|
|
|
42
72
|
## Daemon (recommended for agent use)
|
|
43
73
|
|
|
44
|
-
When the daemon is running,
|
|
45
|
-
|
|
74
|
+
When the daemon is running, commands route through it and share a single
|
|
75
|
+
Chromium context. Benefits:
|
|
46
76
|
- ~2-3 seconds saved per command (no Chrome cold start)
|
|
47
|
-
-
|
|
48
|
-
- Built-in inter-command
|
|
77
|
+
- One continuous logged-in session across commands
|
|
78
|
+
- Built-in inter-command jitter (1.2-3 s)
|
|
49
79
|
|
|
50
80
|
The agent should call `1688 daemon start` once at the beginning of a session
|
|
51
81
|
that involves multiple 1688 commands. The daemon auto-stops after 30 minutes
|
|
52
|
-
of inactivity.
|
|
82
|
+
of inactivity. Run `1688 daemon reload` after the package updates to pick up
|
|
83
|
+
new code.
|
|
53
84
|
|
|
54
|
-
`login`, `logout`, `doctor` stay inline; they
|
|
85
|
+
`login`, `logout`, `doctor` stay inline; they need interactive UI or browser
|
|
55
86
|
windows. If the daemon is running and you need to `login --force`, stop the
|
|
56
87
|
daemon first.
|
|
57
88
|
|
|
58
|
-
|
|
59
|
-
|
|
89
|
+
## Watch mode (long-running streams)
|
|
90
|
+
|
|
91
|
+
`1688 seller messages ... --watch` is a long-running command. It:
|
|
92
|
+
- Prints `Baseline: <conversation> — N messages in history` to stderr on start
|
|
93
|
+
- Emits one line of JSON to stdout per **newly-arrived** message (history is
|
|
94
|
+
not re-emitted)
|
|
95
|
+
- Dedup is by server-side `messageId`
|
|
96
|
+
- Default interval 30 s, minimum 10 s, override with `--interval <seconds>`
|
|
97
|
+
- Exits cleanly on SIGINT (Ctrl+C)
|
|
98
|
+
|
|
99
|
+
For agent loops, pipe stdout into a `while read line` and parse each line as
|
|
100
|
+
its own JSON object. Do not assume the process will exit — it is meant to
|
|
101
|
+
stay alive.
|
|
60
102
|
|
|
61
103
|
## Exit codes
|
|
62
104
|
|
|
@@ -113,6 +155,50 @@ daemon first.
|
|
|
113
155
|
{"loggedIn": false}
|
|
114
156
|
```
|
|
115
157
|
|
|
158
|
+
## Key JSON shapes
|
|
159
|
+
|
|
160
|
+
### `seller messages` result
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
{
|
|
164
|
+
conversation: string,
|
|
165
|
+
total: number,
|
|
166
|
+
messages: Array<{
|
|
167
|
+
sender: string,
|
|
168
|
+
time: string | null, // "YYYY-MM-DD HH:MM:SS" in +08:00
|
|
169
|
+
isMine: boolean,
|
|
170
|
+
content: string,
|
|
171
|
+
read: boolean,
|
|
172
|
+
kind: "text" | "offerCard" | "orderCard" | "autoReply"
|
|
173
|
+
| "assessment" | "image" | "other",
|
|
174
|
+
card?: { title: string|null, price: string|null,
|
|
175
|
+
image: string|null, url: string|null },
|
|
176
|
+
messageId?: string, // present when sourced from WS
|
|
177
|
+
}>,
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`--watch` mode emits per-message instead:
|
|
182
|
+
```ts
|
|
183
|
+
{ conversation: string, message: <one item from messages[] above> }
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### `cart add` result
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
{
|
|
190
|
+
ok: boolean,
|
|
191
|
+
added: CartItem, // see `cart list` JSON for full shape
|
|
192
|
+
isNewRow: boolean, // true=new cartId, false=merged into existing row
|
|
193
|
+
addedQuantity: number, // delta this call added (== args.quantity for new row)
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
To get the cartId reliably in a pipeline:
|
|
198
|
+
```bash
|
|
199
|
+
id=$(1688 cart add <offerId> --sku <skuId> --qty 1 | jq -r '.added.cartId')
|
|
200
|
+
```
|
|
201
|
+
|
|
116
202
|
## Discovery
|
|
117
203
|
|
|
118
204
|
Run `1688 --help` and `1688 <command> --help` for the latest flags.
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,64 @@
|
|
|
3
3
|
All notable changes to this project are documented here.
|
|
4
4
|
This project follows [Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [0.1.25] - 2026-05-13
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- **`1688 similar <offerId>`** — find similar offers ("找同款") via the
|
|
10
|
+
shared search mtop endpoint. Sorted by price, useful for comparing
|
|
11
|
+
suppliers of the same product.
|
|
12
|
+
- **`1688 seller messages --watch [--interval <s>]`** — live-tail a
|
|
13
|
+
conversation. Polls and emits only newly-arrived messages as
|
|
14
|
+
line-delimited JSON when stdout is piped. Dedup is by server-side
|
|
15
|
+
`messageId`. Default interval 30 s, minimum 10 s.
|
|
16
|
+
- `seller messages` results now include richer `kind` subtypes:
|
|
17
|
+
`text` / `offerCard` / `orderCard` / `autoReply` / `assessment` /
|
|
18
|
+
`image` / `other`, plus a stable `messageId`. Offer/order cards expose
|
|
19
|
+
`card.url`, and offer cards are enriched with `card.title` / `.price` /
|
|
20
|
+
`.image` from the IM client's hydrated card.
|
|
21
|
+
- `cart add` JSON response now includes `isNewRow` (bool) and
|
|
22
|
+
`addedQuantity` (number). Pipelines can pick up the new cartId reliably
|
|
23
|
+
even when the SKU is merged into an existing row.
|
|
24
|
+
- `offer` returns a much richer payload: `priceTiers[]`, `attributes[]`,
|
|
25
|
+
`packageInfo[]`, `images[]`, `saleCount`, `categoryId`, and a fuller
|
|
26
|
+
`supplier` (loginId, memberId, province, city). SKU variants gain
|
|
27
|
+
`multiPrice`, `saleCount`, and `image`.
|
|
28
|
+
- `order list` returns `actions[]` (buyer-side ops with jump URLs),
|
|
29
|
+
`services[]` (insurance / refund metadata with payer), `badges[]`,
|
|
30
|
+
`originalAmount`, `discountAmount`, `adjustment`, and `bizType`.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- **`cart add` now uses mtop hijack (Route B)** instead of full UI replay.
|
|
34
|
+
Wall time is similar (~6 s) but works uniformly across single-attr and
|
|
35
|
+
multi-attr SKU layouts, including dropdown-style selectors and hidden
|
|
36
|
+
rows that previously broke the UI path.
|
|
37
|
+
- **`seller messages` now uses WebSocket / LWP protocol interception
|
|
38
|
+
(Route C)** instead of DOM scraping. Server-truth timestamps
|
|
39
|
+
(millisecond `createAt`), stable `messageId`, and URL extraction from
|
|
40
|
+
offer/order cards. DOM scraping is retained as a fallback when no
|
|
41
|
+
WebSocket frames are captured.
|
|
42
|
+
- `image-search` reuses the search mtop interception path; shared parser
|
|
43
|
+
helpers (`parseMtopJsonp`, `mapOffer`, `SEARCH_MTOP_API`) are now
|
|
44
|
+
exported from `search.ts` for `similar` to consume too.
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- `cart list` returned `amount: 2` for items priced over ¥1,000 because
|
|
48
|
+
`parseFloat("2,094.00")` stops at the thousand-separator comma. Now
|
|
49
|
+
uses the integer-cent fields (`unitPriceCent`, `amountCent`) when
|
|
50
|
+
present, with a comma-stripping string parser as fallback.
|
|
51
|
+
- `cart add` could return the wrong `cartId` when the same SKU was
|
|
52
|
+
already in the cart (the server merges into the existing row). Now
|
|
53
|
+
snapshots the cart before/after and diffs to find the affected row,
|
|
54
|
+
exposing whether it was a new row or a merge plus the delta quantity.
|
|
55
|
+
|
|
56
|
+
## [0.1.24] - 2026-05-13
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
- `BB1688_PROBE=1` output was silent when stdout was piped because `info()`
|
|
60
|
+
is suppressed under JSON mode. The probe now writes directly to stderr,
|
|
61
|
+
and prints `[probe] active` on start so you can confirm it's running.
|
|
62
|
+
- Broader JSON markers (`window.runParams`, `"offerList"`, `"offerId":`).
|
|
63
|
+
|
|
6
64
|
## [0.1.23] - 2026-05-13
|
|
7
65
|
|
|
8
66
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
# 1688-cli
|
|
1
|
+
# 1688-cli: Alibaba 1688.com CLI - Product Search, Inquiry, Cart, Checkout, Order Tracking & Seller Chat for AI Agents & Humans
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/1688-cli)
|
|
4
4
|
[](https://www.npmjs.com/package/1688-cli)
|
|
5
5
|
[](./LICENSE)
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Command-line tool for Alibaba 1688.com wholesale: keyword & image search,
|
|
9
|
+
supplier inquiry, cart, checkout, order tracking, and seller chat. Outputs
|
|
10
|
+
JSON when piped (for Codex / Claude Code / other AI agents) and pretty TTY
|
|
11
|
+
text for humans.
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
The 6 things you can do from the terminal:
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
- **
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
1. **Sourcing** — search / similar / image-search / product detail
|
|
16
|
+
2. **Pre-sale inquiry** — ask the supplier, watch replies live
|
|
17
|
+
3. **Cart** — collect SKUs (with diff-based add confirmation)
|
|
18
|
+
4. **Checkout** — preview + place the order
|
|
19
|
+
5. **Order tracking** — list / detail / logistics / overdue detection
|
|
20
|
+
6. **Post-sale chat** — chase shipment, read replies as JSON stream
|
|
17
21
|
|
|
18
22
|
```bash
|
|
19
23
|
npm i -g 1688-cli
|
|
@@ -21,12 +25,16 @@ npm i -g 1688-cli
|
|
|
21
25
|
|
|
22
26
|
# Sourcing
|
|
23
27
|
1688 search "佛龛柜" --max 10 # keyword search
|
|
28
|
+
1688 similar 628196518518 --max 10 # find similar offers, sorted by price
|
|
24
29
|
1688 image-search ./sample.jpg # search by image
|
|
25
30
|
1688 offer 628196518518 # product detail
|
|
31
|
+
|
|
32
|
+
# Pre-sale inquiry (with live watch for AI agents)
|
|
26
33
|
1688 seller inquire 628196518518 "支持定制 logo 吗?" # ask seller
|
|
27
|
-
1688 seller messages --offer 628196518518 # read
|
|
34
|
+
1688 seller messages --offer 628196518518 # one-shot read
|
|
35
|
+
1688 seller messages --offer 628196518518 --watch # live-tail new replies (JSON when piped)
|
|
28
36
|
|
|
29
|
-
#
|
|
37
|
+
# Order tracking & post-sale chat
|
|
30
38
|
1688 order list --status waitsellersend # list orders
|
|
31
39
|
1688 order get <orderId> # one order detail
|
|
32
40
|
1688 order logistics <orderId> # tracking + trace
|
|
@@ -42,8 +50,8 @@ Existing 1688 automation options are heavy: Selenium glue you maintain, browser
|
|
|
42
50
|
extensions you can't pipe into a shell, MCP servers that fight with your
|
|
43
51
|
agent's tooling. `1688-cli` is a single command:
|
|
44
52
|
|
|
45
|
-
- **Real Chrome under the hood** (`channel:'chrome'`
|
|
46
|
-
|
|
53
|
+
- **Real Chrome under the hood** (`channel:'chrome'`). Same browser you'd
|
|
54
|
+
use manually — your session is real, not a synthetic Chromium.
|
|
47
55
|
- **Persistent profile** at `~/.1688/`. One login lasts for weeks.
|
|
48
56
|
- **Long-running daemon** — first command warms the browser, subsequent
|
|
49
57
|
commands reuse it (no relaunch per call).
|
|
@@ -77,90 +85,160 @@ npm i -g 1688-cli
|
|
|
77
85
|
|
|
78
86
|
## Commands
|
|
79
87
|
|
|
80
|
-
|
|
88
|
+
Organized by the buyer journey: discover → ask → decide → buy → track →
|
|
89
|
+
follow up.
|
|
90
|
+
|
|
91
|
+
### 1. Sourcing — find the right supplier
|
|
81
92
|
|
|
82
93
|
```bash
|
|
83
|
-
1688
|
|
84
|
-
1688
|
|
85
|
-
1688
|
|
86
|
-
1688
|
|
87
|
-
1688
|
|
88
|
-
1688 doctor # environment check
|
|
94
|
+
1688 search 机械键盘 --max 20 # keyword search
|
|
95
|
+
1688 similar 628196518518 --max 20 # "找同款" — same product, other suppliers, sorted by price
|
|
96
|
+
1688 image-search ./shoe.jpg # search by local image
|
|
97
|
+
1688 image-search https://.../img.png # search by http(s) URL
|
|
98
|
+
1688 offer 628196518518 # product detail (priceTiers, attributes, packageInfo, SKUs)
|
|
89
99
|
```
|
|
90
100
|
|
|
91
|
-
###
|
|
101
|
+
### 2. Pre-sale inquiry — ask the supplier
|
|
102
|
+
|
|
103
|
+
> Uses the same `seller messages` / `seller chat` tooling as §6, scoped by
|
|
104
|
+
> `--offer <offerId>` instead of an orderId.
|
|
92
105
|
|
|
93
106
|
```bash
|
|
94
|
-
1688
|
|
107
|
+
1688 seller inquire 628196518518 "支持定制 logo 吗?" # send a product link + question
|
|
108
|
+
1688 seller messages --offer 628196518518 # read replies (one-shot)
|
|
109
|
+
1688 seller messages --offer 628196518518 --since 2026-05-13T10:00:00+08:00
|
|
110
|
+
1688 seller messages --offer 628196518518 --watch --interval 30 # live-tail new replies
|
|
95
111
|
```
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
**Watch mode** prints only newly-arrived messages as line-delimited JSON
|
|
114
|
+
when stdout is piped — pipe into any agent. Dedup is by server-side
|
|
115
|
+
`messageId`. Min interval 10 s.
|
|
116
|
+
|
|
117
|
+
### 3. Cart — collect SKUs
|
|
98
118
|
|
|
99
119
|
```bash
|
|
100
|
-
1688
|
|
101
|
-
1688
|
|
102
|
-
1688
|
|
103
|
-
1688 offer 628196518518 # product detail
|
|
120
|
+
1688 cart list
|
|
121
|
+
1688 cart add <offerId> --sku <skuId> --qty 2
|
|
122
|
+
1688 cart remove <cartId>
|
|
104
123
|
```
|
|
105
124
|
|
|
106
|
-
|
|
125
|
+
`cart add` returns `{added: CartItem, isNewRow, addedQuantity}` so pipelines
|
|
126
|
+
can pick up the new cartId reliably even when the same SKU is already in cart
|
|
127
|
+
(server merges into the existing row in that case):
|
|
107
128
|
|
|
108
129
|
```bash
|
|
109
|
-
1688
|
|
110
|
-
1688
|
|
111
|
-
1688 order list --status waitbuyerreceive # shipped, awaiting delivery
|
|
112
|
-
1688 order get <orderId>
|
|
113
|
-
1688 order logistics <orderId> # tracking number + trace
|
|
114
|
-
1688 order get <orderId> --status waitbuyerreceive # speeds up scan on heavy accounts
|
|
130
|
+
id=$(1688 cart add 628196518518 --sku 6070845665229 --qty 1 | jq -r '.added.cartId')
|
|
131
|
+
1688 cart remove "$id"
|
|
115
132
|
```
|
|
116
133
|
|
|
117
|
-
###
|
|
134
|
+
### 4. Checkout — place the order
|
|
118
135
|
|
|
119
136
|
```bash
|
|
120
|
-
1688
|
|
121
|
-
1688
|
|
122
|
-
1688
|
|
137
|
+
1688 checkout prepare <cartIds...> # preview total/address/items — safe, read-only
|
|
138
|
+
1688 checkout confirm <cartIds...> # default: TTY prompt y/N
|
|
139
|
+
1688 checkout confirm <cartIds...> -y # skip prompt (TTY still required)
|
|
140
|
+
1688 checkout confirm <cartIds...> --agent # AI-agent mode: no prompts (explicit autonomy opt-in)
|
|
123
141
|
```
|
|
124
142
|
|
|
125
|
-
###
|
|
143
|
+
### 5. Order tracking — follow the shipment
|
|
126
144
|
|
|
127
145
|
```bash
|
|
128
|
-
1688
|
|
129
|
-
1688
|
|
130
|
-
1688
|
|
131
|
-
1688
|
|
146
|
+
1688 order list # all statuses (with actions, services, badges)
|
|
147
|
+
1688 order list --status waitsellersend # paid, awaiting shipment
|
|
148
|
+
1688 order list --status waitbuyerreceive # shipped, awaiting delivery
|
|
149
|
+
1688 order get <orderId> # one order detail
|
|
150
|
+
1688 order logistics <orderId> # tracking number + trace
|
|
151
|
+
1688 order get <orderId> --status waitbuyerreceive # narrow the scan on heavy accounts
|
|
152
|
+
|
|
153
|
+
# Convenience views
|
|
154
|
+
1688 shipped <orderId> # order detail + logistics merged
|
|
155
|
+
1688 stuck --days 3 # paid but not shipped > N days
|
|
156
|
+
1688 fake-shipped --days 1 # marked shipped but courier never collected (虚假发货)
|
|
157
|
+
1688 fake-shipped --debug # show each candidate's status + remark
|
|
158
|
+
1688 seller-history <sellerName> # all orders + avg ship days + on-time rate
|
|
132
159
|
```
|
|
133
160
|
|
|
134
|
-
###
|
|
161
|
+
### 6. Post-sale chat — chase delivery / claims
|
|
135
162
|
|
|
136
|
-
|
|
137
|
-
|
|
163
|
+
> Same tooling as §2, scoped by `<orderId>` so messages auto-attach the
|
|
164
|
+
> order card and replies thread under the right conversation.
|
|
138
165
|
|
|
139
166
|
```bash
|
|
140
|
-
# Pre-sale
|
|
141
|
-
1688 seller inquire 628196518518 "支持定制 logo 吗?" # send
|
|
142
|
-
1688 seller messages --offer 628196518518 # read replies
|
|
143
|
-
1688 seller messages --offer 628196518518 --since 2026-05-13T10:00:00+08:00
|
|
144
|
-
|
|
145
|
-
# Post-sale
|
|
146
167
|
1688 seller chat <orderId> "麻烦尽快发货谢谢" # send (auto-attaches order card)
|
|
147
168
|
1688 seller chat <orderId> "请问什么时候发货" --no-card # follow-up, no card
|
|
148
169
|
1688 seller messages <orderId> # read replies
|
|
149
170
|
1688 seller messages <orderId> --limit 50 --since 2026-05-01T00:00:00+08:00
|
|
171
|
+
1688 seller messages <orderId> --watch # live-tail
|
|
150
172
|
```
|
|
151
173
|
|
|
152
|
-
###
|
|
174
|
+
### Account & daemon
|
|
153
175
|
|
|
154
176
|
```bash
|
|
155
|
-
1688
|
|
156
|
-
1688
|
|
157
|
-
1688
|
|
158
|
-
1688
|
|
159
|
-
1688
|
|
177
|
+
1688 login # scan QR; auto-starts daemon
|
|
178
|
+
1688 login --headed # open real window (fallback for risk control)
|
|
179
|
+
1688 login --force # re-login even if cached
|
|
180
|
+
1688 logout # clear cookies
|
|
181
|
+
1688 whoami # current nick + memberId
|
|
182
|
+
1688 doctor # environment check
|
|
183
|
+
|
|
184
|
+
1688 daemon start | stop | status | reload
|
|
160
185
|
```
|
|
161
186
|
|
|
162
187
|
---
|
|
163
188
|
|
|
189
|
+
## FAQ
|
|
190
|
+
|
|
191
|
+
### Compared to alternatives
|
|
192
|
+
|
|
193
|
+
#### How does 1688-cli compare to MCP servers and Selenium scripts?
|
|
194
|
+
|
|
195
|
+
1688-cli runs as a regular shell command, not an MCP server. Agents call it
|
|
196
|
+
via `child_process` or shell pipes instead of the MCP protocol — easier to
|
|
197
|
+
compose with `jq`, `xargs`, and CI scripts. Compared to writing low-level
|
|
198
|
+
browser automation directly, 1688-cli ships with structured JSON output,
|
|
199
|
+
session persistence, and a daemon for warm context, so you don't reinvent
|
|
200
|
+
that per project.
|
|
201
|
+
|
|
202
|
+
#### Does 1688 have an official API I should use instead?
|
|
203
|
+
|
|
204
|
+
Alibaba offers a 1688 Open API at `open.1688.com`, but it's gated to
|
|
205
|
+
enterprise ISV partners with a sales contract and per-app authorization.
|
|
206
|
+
Individual buyers, small businesses, and AI agents typically can't get
|
|
207
|
+
access. 1688-cli uses your normal logged-in buyer account via a one-time
|
|
208
|
+
QR scan, mirroring what you can do manually in a browser — no developer
|
|
209
|
+
keys required.
|
|
210
|
+
|
|
211
|
+
### Account & verification
|
|
212
|
+
|
|
213
|
+
#### Does this tool require any 1688 developer account or API keys?
|
|
214
|
+
|
|
215
|
+
No. Login is a one-time QR scan with your normal 1688 mobile app — the
|
|
216
|
+
same flow as logging into 1688 on a fresh browser. The session is stored
|
|
217
|
+
in your local profile (`~/.1688/profiles/default/`) and reused across
|
|
218
|
+
commands, so you only re-scan when 1688 invalidates it.
|
|
219
|
+
|
|
220
|
+
#### What happens if 1688 shows a verification challenge (滑块)?
|
|
221
|
+
|
|
222
|
+
1688 occasionally shows a slider verification on unfamiliar sessions or
|
|
223
|
+
after long inactivity — the same one you'd see when logging in from a new
|
|
224
|
+
device manually. If a command fails because of this, run it once with
|
|
225
|
+
`--headed` (e.g. `1688 search 雨伞 --headed`); a real window opens, you
|
|
226
|
+
drag the slider yourself, and the verified session is reused for
|
|
227
|
+
subsequent commands. There is no automated solver — it's the same manual
|
|
228
|
+
step a person would take.
|
|
229
|
+
|
|
230
|
+
#### Is it safe to use? Will my account get rate-limited?
|
|
231
|
+
|
|
232
|
+
The tool drives your own logged-in browser session and only performs
|
|
233
|
+
actions you'd do manually — search, read order details, send chat
|
|
234
|
+
messages, place an order you confirmed. Use it at human pace (the default
|
|
235
|
+
`--watch` interval is 30 seconds, minimum 10) for one of your own
|
|
236
|
+
accounts. Aggressive automation, high-frequency scraping, or running it
|
|
237
|
+
across many accounts is outside the tool's design and increases the
|
|
238
|
+
chance of triggering 1688's risk controls.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
164
242
|
## JSON for agents
|
|
165
243
|
|
|
166
244
|
Every command auto-switches to JSON when stdout is piped:
|
|
@@ -181,22 +259,21 @@ BB1688_JSON=1 1688 doctor
|
|
|
181
259
|
|
|
182
260
|
## Risk control
|
|
183
261
|
|
|
184
|
-
1688
|
|
185
|
-
`1688-cli` already uses real Chrome + stealth + a persistent profile, and the
|
|
186
|
-
`search` command warms up `s.1688.com` before every request. If you still hit
|
|
187
|
-
a slider, solve it once with `--headed`:
|
|
262
|
+
If 1688 shows a slider verification (滑块), solve it once with `--headed`:
|
|
188
263
|
|
|
189
264
|
```bash
|
|
190
|
-
1688 search 雨伞 --headed # window opens; drag the slider
|
|
191
|
-
1688 search 雨伞 # subsequent
|
|
265
|
+
1688 search 雨伞 --headed # window opens; drag the slider yourself
|
|
266
|
+
1688 search 雨伞 # subsequent calls reuse the verified session
|
|
192
267
|
```
|
|
193
268
|
|
|
269
|
+
See also the FAQ entry on [verification challenges](#what-happens-if-1688-shows-a-verification-challenge-滑块).
|
|
270
|
+
|
|
194
271
|
---
|
|
195
272
|
|
|
196
273
|
## Files & directories
|
|
197
274
|
|
|
198
275
|
```
|
|
199
|
-
~/.1688/profiles/default/ Chromium profile (cookies, IndexedDB,
|
|
276
|
+
~/.1688/profiles/default/ Chromium profile (cookies, IndexedDB, session state)
|
|
200
277
|
~/.1688/state.json cached identity (nick / memberId / timestamps)
|
|
201
278
|
~/.1688/daemon.sock daemon Unix socket
|
|
202
279
|
~/.1688/daemon.pid daemon PID
|
package/dist/cli.js
CHANGED
|
@@ -58,6 +58,17 @@ program
|
|
|
58
58
|
const { run } = await import('./commands/offer.js');
|
|
59
59
|
await run({ ...opts, offerId });
|
|
60
60
|
});
|
|
61
|
+
program
|
|
62
|
+
.command('similar')
|
|
63
|
+
.description('Find similar / 找同款 offers for a given offerId (compare suppliers, sorted by price)')
|
|
64
|
+
.argument('<offerId>', 'Offer ID (digits)')
|
|
65
|
+
.option('--max <n>', 'Maximum number of similar offers', '20')
|
|
66
|
+
.option('--profile <name>', 'Profile name (default: default)')
|
|
67
|
+
.option('--headed', 'Open a window (fallback for risk control)')
|
|
68
|
+
.action(async (offerId, opts) => {
|
|
69
|
+
const { run } = await import('./commands/similar.js');
|
|
70
|
+
await run({ ...opts, offerId });
|
|
71
|
+
});
|
|
61
72
|
const seller = program
|
|
62
73
|
.command('seller')
|
|
63
74
|
.description('Seller communication (旺旺 IM)');
|
|
@@ -80,6 +91,8 @@ seller
|
|
|
80
91
|
.option('--offer <offerId>', 'Read pre-sale inquiry replies for this offerId')
|
|
81
92
|
.option('--limit <n>', 'Max messages to return (default 20, max 200)', '20')
|
|
82
93
|
.option('--since <iso>', 'Only show messages after this ISO timestamp (e.g. 2026-05-12T16:44:00+08:00)')
|
|
94
|
+
.option('--watch', 'Poll continuously and print new messages as they arrive')
|
|
95
|
+
.option('--interval <seconds>', 'Polling interval in seconds for --watch (default 30, min 10)', '30')
|
|
83
96
|
.option('--profile <name>', 'Profile name (default: default)')
|
|
84
97
|
.option('--headed', 'Open a window (debug visibility)')
|
|
85
98
|
.action(async (target, opts) => {
|