1688-cli 0.1.27 → 0.1.28

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 CHANGED
@@ -199,6 +199,33 @@ To get the cartId reliably in a pipeline:
199
199
  id=$(1688 cart add <offerId> --sku <skuId> --qty 1 | jq -r '.added.cartId')
200
200
  ```
201
201
 
202
+ ## Output flags (every command)
203
+
204
+ In addition to `BB1688_JSON=1`, every command accepts:
205
+
206
+ ```
207
+ --json Force JSON output even in a TTY.
208
+ --pretty Indent JSON by 2 spaces.
209
+ --get <path> Print one field by dot-path. Scalar → raw line,
210
+ object/array → JSON. Wildcards stream one element per line.
211
+ Syntax: field.sub, arr[N].field, arr[*].field
212
+ --pick <paths> Comma-separated dot-paths → emit a JSON object with each
213
+ path as a key. Useful for trimming output for downstream agents.
214
+ ```
215
+
216
+ Examples:
217
+ ```bash
218
+ 1688 offer X --get supplier.name # 深圳... (raw)
219
+ 1688 offer X --get supplier # {"name":"...","loginId":"..."}
220
+ 1688 offer X --get 'skus[*].price' # 49 \n 68 \n 98.75 ...
221
+ 1688 offer X --pick price,supplier.name # {"price":1.25,"supplier.name":"..."}
222
+ 1688 offer X --json --pretty # full payload, indented
223
+ ```
224
+
225
+ When `--get`/`--pick` is given, the human renderer is skipped; the resolved
226
+ value(s) go to stdout. The full payload still flows through when neither
227
+ flag is set, so existing `| jq` pipelines keep working.
228
+
202
229
  ## Discovery
203
230
 
204
231
  Run `1688 --help` and `1688 <command> --help` for the latest flags.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.28] - 2026-05-13
7
+
8
+ ### Documentation
9
+ - README: document the `--json` / `--pretty` / `--get` / `--pick` flags in
10
+ the "JSON for agents" section with copy-pasteable examples.
11
+ - AGENTS.md: add an "Output flags" section so agents can discover the
12
+ zero-`jq` workflows.
13
+
6
14
  ## [0.1.27] - 2026-05-13
7
15
 
8
16
  ### Added
package/README.md CHANGED
@@ -249,7 +249,31 @@ Every command auto-switches to JSON when stdout is piped:
249
249
  1688 search 雨伞 | jq '.offers[0:5]'
250
250
  ```
251
251
 
252
- Force JSON on a TTY:
252
+ ### Built-in JSON flags (no `jq` required)
253
+
254
+ Every command supports four output-shaping flags. Useful on Windows or any
255
+ environment where `jq` isn't installed — and for agents that want concise
256
+ output without parsing the full payload.
257
+
258
+ ```bash
259
+ 1688 offer <id> --json # force JSON even in a TTY
260
+ 1688 offer <id> --json --pretty # JSON with 2-space indent
261
+
262
+ 1688 offer <id> --get supplier.name # one scalar field, raw line
263
+ 1688 offer <id> --get supplier # sub-object as JSON
264
+ 1688 offer <id> --get 'skus[0].skuId' # array index
265
+ 1688 offer <id> --get 'skus[*].price' # wildcard — one line per element
266
+
267
+ 1688 offer <id> --pick price,supplier.name,'skus[0].skuId'
268
+ # {"price":1.25,"supplier.name":"...","skus[0].skuId":"..."}
269
+ ```
270
+
271
+ Path syntax: `field.sub`, `arr[N].field`, `arr[*].field`. Wildcards stream
272
+ one line per element; scalars print as a raw line (no quotes), objects and
273
+ arrays as JSON. The full payload still goes through when no `--get`/`--pick`
274
+ is given, so existing `| jq` pipelines keep working unchanged.
275
+
276
+ Force JSON in a TTY (alternative to `--json`):
253
277
 
254
278
  ```bash
255
279
  BB1688_JSON=1 1688 doctor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "1688-cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "1688.com CLI for humans, Codex, and Claude Code. Sourcing (search / image-search / offer / inquire) and orders (list / detail / logistics / seller chat).",
5
5
  "license": "MIT",
6
6
  "author": "nobodyjack",