1688-cli 0.1.13 → 0.1.15

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/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
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.15] - 2026-05-13
7
+
8
+ ### Fixed
9
+ - Auto-clean stale `.lock.lock` directory when no daemon is alive. Previously,
10
+ killing a `--headed` flow with Ctrl+C left a lock that blocked every
11
+ subsequent command with `LOCK_BUSY` until manually `rm -rf`'d. The probe
12
+ is safe: if a daemon process actually holds the lock, the original
13
+ "Another 1688 command is running" error is preserved.
14
+
15
+ ## [0.1.14] - 2026-05-13
16
+
17
+ ### Changed
18
+ - Description in `package.json` and the GitHub repo "About" updated to reflect
19
+ the actual core flow (sourcing + orders) instead of niche shortcuts.
20
+
6
21
  ## [0.1.13] - 2026-05-13
7
22
 
8
23
  ### Added
package/README.md CHANGED
@@ -6,9 +6,14 @@
6
6
  [![node](https://img.shields.io/node/v/1688-cli.svg)](https://nodejs.org/)
7
7
 
8
8
  **1688.com CLI for humans, Codex, and Claude Code.**
9
- Search, browse, cart, place orders, track logistics, and talk to sellers — all
10
- from your terminal. Outputs human text on a TTY and JSON when piped, so AI
11
- agents can drive it without parsing.
9
+
10
+ Two core flows from the terminal:
11
+
12
+ - **Sourcing** — search / image-search / product detail / pre-sale inquiry
13
+ - **Orders** — list / detail / logistics tracking / post-sale chat with sellers
14
+
15
+ Outputs human text on a TTY and JSON when piped, so AI agents can drive it
16
+ without parsing.
12
17
 
13
18
  ```bash
14
19
  npm i -g 1688-cli
@@ -44,6 +49,14 @@ agent's tooling. `1688-cli` is a single command:
44
49
  in your terminal pretty-prints.
45
50
  - **Designed for AI agents.** See [AGENTS.md](./AGENTS.md) for the contract.
46
51
 
52
+ ### Not in scope
53
+
54
+ This is not a marketing / scraping tool for bulk-listing the whole site, and
55
+ not a checkout automation farm. It mirrors what a buyer does manually: pick
56
+ a product, ask the seller a question, place an order, track shipping. Place
57
+ order (`checkout confirm`) is gated behind TTY prompts or an explicit
58
+ `--agent` flag so agents can't move money silently.
59
+
47
60
  ---
48
61
 
49
62
  ## Install
@@ -1,23 +1,51 @@
1
1
  import fs from 'node:fs/promises';
2
+ import path from 'node:path';
2
3
  import lockfile from 'proper-lockfile';
3
- import { lockFile, ensureRoot } from './paths.js';
4
+ import { lockFile, ensureRoot, root } from './paths.js';
4
5
  import { CliError } from '../io/errors.js';
5
6
  export async function acquireLock() {
6
7
  await ensureRoot();
7
8
  // proper-lockfile requires the target file to exist
8
9
  await fs.writeFile(lockFile(), '', { flag: 'a' });
10
+ const lockOpts = { retries: 0, stale: 5 * 60 * 1000 };
9
11
  try {
10
- const release = await lockfile.lock(lockFile(), {
11
- retries: 0,
12
- stale: 5 * 60 * 1000,
13
- });
14
- return release;
12
+ return await lockfile.lock(lockFile(), lockOpts);
15
13
  }
16
14
  catch (e) {
17
- if (e.code === 'ELOCKED') {
15
+ if (e.code !== 'ELOCKED')
16
+ throw e;
17
+ // Lock is held. Probe whether it's a real holder (daemon alive) or
18
+ // a stale dir left over by an abruptly-killed process (Ctrl+C in
19
+ // --headed flow, SIGKILL on the daemon, etc.). If no daemon is running,
20
+ // we can safely clean up and retry — the dead process can't be using it.
21
+ if (await daemonIsAlive()) {
18
22
  throw new CliError(5, 'LOCK_BUSY', 'Another 1688 command is running. Close it and retry.');
19
23
  }
20
- throw e;
24
+ await fs.rm(lockFile() + '.lock', { recursive: true, force: true });
25
+ try {
26
+ return await lockfile.lock(lockFile(), lockOpts);
27
+ }
28
+ catch {
29
+ throw new CliError(5, 'LOCK_BUSY', 'Another 1688 command is running. Close it and retry.');
30
+ }
31
+ }
32
+ }
33
+ async function daemonIsAlive() {
34
+ const pidFile = path.join(root(), 'daemon.pid');
35
+ try {
36
+ const pid = parseInt((await fs.readFile(pidFile, 'utf8')).trim(), 10);
37
+ if (!Number.isFinite(pid) || pid <= 0)
38
+ return false;
39
+ try {
40
+ process.kill(pid, 0); // signal 0 = existence check, no signal sent
41
+ return true;
42
+ }
43
+ catch {
44
+ return false;
45
+ }
46
+ }
47
+ catch {
48
+ return false;
21
49
  }
22
50
  }
23
51
  //# sourceMappingURL=lock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/session/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,UAAU,EAAE,CAAC;IACnB,oDAAoD;IACpD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;YAC9C,OAAO,EAAE,CAAC;YACV,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;SACrB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAK,CAAuB,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAChD,MAAM,IAAI,QAAQ,CAChB,CAAC,EACD,WAAW,EACX,sDAAsD,CACvD,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/session/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B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AK,UAAU,aAAa;IAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;IAChD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QACpD,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,6CAA6C;YACnE,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "1688-cli",
3
- "version": "0.1.13",
4
- "description": "1688.com CLI for humans, Codex, and Claude Code search, cart, orders, logistics, seller IM, fake-shipping detection.",
3
+ "version": "0.1.15",
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",
7
7
  "homepage": "https://github.com/superjack2050/1688-cli#readme",