Skip to content

koodfandan/xianyu-buyer-cli

Repository files navigation

Xianyu Buyer CLI

CI Version License

Windows-first CLI for second-hand phone buyers on Xianyu.

It helps you:

  • describe what you want in natural language
  • filter and rank listings
  • compare candidates
  • subscribe to out-of-stock needs
  • poll for new matching listings
  • review notifications before contacting a seller

Xianyu Buyer CLI Overview

Why This Project

  • Start with a vague request such as 我想买一台手机.
  • Turn that into concrete filters, presets, and ranked routes.
  • Keep a low-risk local workflow instead of jumping straight into aggressive live automation.
  • Re-check the market later and surface new matching listings through local notifications.

Quick Demo

npm install
npm.cmd run start -- init
npm.cmd run start -- want "我想买一台自用的 iPhone 15"
npm.cmd run start -- want continue "预算 4500 128G 国行 电池 90+"
npm.cmd run start -- find "iPhone 15" --preset self-use
npm.cmd run start -- want subscribe "iPhone 15 预算 4500 128G 国行 电池 90+"
npm.cmd run start -- watch poll --id 1
npm.cmd run start -- notify summary --unread

Demo Screens

Natural-language search

Natural-language buyer flow

Subscription and notifications

Subscription and notification flow

Core Flows

1. Natural-language buying

Use want when you are not ready to write exact filters yet.

npm.cmd run start -- want "我想买一台手机"
npm.cmd run start -- want continue "预算 4500 128G 国行"

2. Ranked search

Use the route that matches your priority:

  • find: trust first
  • cheap: value first
  • latest: freshness first
npm.cmd run start -- find "iPhone 15" --preset self-use
npm.cmd run start -- cheap "iPhone 15" --preset deal-hunt
npm.cmd run start -- latest "iPhone 15" --preset just-listed

3. Reminder flow

Use this when nothing suitable is available yet.

npm.cmd run start -- want subscribe "iPhone 15 预算 4500 128G 国行 电池 90+"
npm.cmd run start -- watch poll --id 1
npm.cmd run start -- notify list --unread --top 3
npm.cmd run start -- notify show 1

Status

This project is ready for GitHub publishing as a local-first buyer tool.

Stable paths:

  • sample
  • manual
  • safe profile
  • local reminders via watch and notify

Experimental paths:

  • real live source
  • any session-based or cookie-based access

Requirements

  • Windows PowerShell
  • Node.js 24+

Install

npm install
npm.cmd run start -- init

Quick Start

npm.cmd run start -- want "我想买一台手机"
npm.cmd run start -- want continue "预算 4500 128G 国行 电池 90+"
npm.cmd run start -- find "iPhone 15" --preset self-use
npm.cmd run start -- cheap "iPhone 15" --preset deal-hunt
npm.cmd run start -- latest "iPhone 15" --preset just-listed
npm.cmd run start -- assess ip15-128-black-a

Main Commands

Buyer entry

npm.cmd run start -- want "我想买一台 iPhone 15"
npm.cmd run start -- want continue "预算 4500 128G 国行"
npm.cmd run start -- want last
npm.cmd run start -- want clear

Search and ranking

npm.cmd run start -- find "iPhone 15"
npm.cmd run start -- cheap "iPhone 15"
npm.cmd run start -- latest "iPhone 15"
npm.cmd run start -- compare ip15-128-black-a ip15-128-blue-b ip15-128-black-risk

Presets

npm.cmd run start -- preset list
npm.cmd run start -- preset show self-use
npm.cmd run start -- preset validate self-use "iPhone 15"
npm.cmd run start -- preset save black-self-use --from self-use --color 黑色 --capacity 128G

Built-in preset aliases:

  • self-use
  • deal-hunt
  • just-listed
  • gift-ready

Shortlist

npm.cmd run start -- save ip15-128-black-a
npm.cmd run start -- shortlist list
npm.cmd run start -- shortlist note ip15-128-black-a "优先联系"

Low-Risk Reminder Flow

Use this when nothing suitable is available right now but you want to know once a matching listing appears.

npm.cmd run start -- want subscribe "iPhone 15 预算 4500 128G 国行 电池 90+"
npm.cmd run start -- watch poll --id 1
npm.cmd run start -- notify summary --unread
npm.cmd run start -- notify list --unread --top 3
npm.cmd run start -- notify show 1
npm.cmd run start -- notify read 1

You can also create a watch directly:

npm.cmd run start -- watch add "iPhone 15" --max-price 4500 --capacity 128G --version 国行 --battery 90+

Useful Filters

  • --capacity 128G
  • --version 国行
  • --color 黑色
  • --repair-history none
  • --battery 90+
  • --accessories full
  • --price-level 偏低
  • --recommendation 优先联系
  • --risk-level high
  • --max-risk-level medium
  • --face-to-face
  • --hours 24

Source Modes

npm.cmd run start -- source show
npm.cmd run start -- source check
npm.cmd run start -- source use sample
npm.cmd run start -- source use manual
npm.cmd run start -- source use real

Notes:

  • sample works out of the box
  • manual loads a local JSON catalog
  • real is for parser and transport experiments

Runtime Profiles

npm.cmd run start -- profile show
npm.cmd run start -- profile use safe
npm.cmd run start -- profile use live-readonly
npm.cmd run start -- profile use session-experimental

Recommended default:

  • safe

Project Layout

src/
  adapters/
  lib/
  normalizers/
  renderers/
  rules/
  services/
data/
test/
docs/

Runtime files are stored in .xianyu-cli/ and are ignored by Git.

Test

npm.cmd test

GitHub Release

After authenticating gh, you can finalize the public GitHub presentation with:

gh auth login
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\finalize-github-release.ps1

npm Publish Prep

This repo is also prepared for npm packaging.

npm.cmd run pack:dry-run

Publish notes are in NPM_PUBLISHING.md.

Safety Notes

  • This repo is designed first as a local analysis tool.
  • Do not treat real live mode as a finished production integration.
  • Do not use a primary Xianyu account for aggressive automated polling.
  • Prefer safe profile and low-frequency polling.

About

Windows-first CLI for Xianyu buyers to find, assess, and track second-hand phone listings.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors