跳到正文

宝玉:微信群聊天资料整理

通过本地 wx-cli 读取获准使用的群聊资料,按主题整理讨论、链接和重要信息,保留时间范围与来源。

开源精选知识加工10 个文件26,681 Stars浏览次数 0JimLiu/baoyu-skills MIT版本 1567581
开始使用

下载前阅读 SKILL.md 中的使用条件,并确认所用工具支持对应能力。

输入资料
获准使用的群聊与本地 wx-cli 时间范围与关注主题 阅读本节完整说明
交付内容
主题化阅读摘要 来源链接与重要事项 阅读本节完整说明
环境与依赖
快速验证环境:wx --version 有输出且 wx sessions 返回数据即可继续。任何一步失败,或是首次在新环境运行 → 读 references/setup.md(完整环境检查、wx-cli 命令速查、排障手册),停在第一个失败项并给用户确切的修复命令。绝不自动安装、绝不替用户跑 sudo。 阅读本节完整说明
  1. 获取完整包,保留配套文件的目录结构。
  2. 按照原文准备所需工具、依赖与输入资料。
  3. 阅读对应使用步骤与输入输出说明,在自己的环境中验证结果。

使用提示摘自原文,配套文件保留来源版本;实际运行条件以各包说明为准。

正文

获取原文件

references/setup.md

Load this file when: (a) starting a run in a fresh environment where wx-cli hasn't been verified yet, or (b) any wx command fails.

Prerequisites

Before invoking the workflow, verify the environment. Run these checks in order; stop at the first failure and surface the exact next command the user needs.

  1. wx-cli installed — run wx --version. If missing, tell the user to install it themselves (npm install -g @jackwener/wx-cli or use one of the alternatives at https://github.com/jackwener/wx-cli). Do NOT auto-install — this repo forbids piped/silent installs.
  2. ~/.wx-cli directory owned by the current user — sudo wx init historically chowned this directory to root, which breaks every subsequent non-sudo wx call. Check:
    ls -la ~/.wx-cli/ 2>/dev/null | head -5
    
    If the directory exists but the owner is root (or anything other than $(whoami)), tell the user to repair it themselves:
    sudo chown -R $(whoami) ~/.wx-cli
    sudo rm -f ~/.wx-cli/daemon.pid ~/.wx-cli/daemon.sock
    wx daemon start
    
    The skill should NOT run sudo on the user's behalf.
  3. wx-cli initialized — wx sessions should return data. If it fails with "no keys" / "init required", instruct the user to run wx init while WeChat is running (on macOS, codesign --force --deep --sign - /Applications/WeChat.app first). Prefer non-sudo init; only fall back to sudo wx init if the user's wx-cli version requires it — and warn them that they'll need step 2's chown after.
  4. WeChat 4.x running and logged in — required for the daemon to find data files.

wx-cli quick reference

Command Purpose
wx --version Sanity-check that wx-cli is installed
wx sessions --json List recent sessions; useful for verifying init and finding the user's own wxid
wx contacts --query "<name>" --json Fuzzy-match contacts/groups by display name, remark, or wxid
wx history "<group>" --since DATE --until DATE -n N --json Pull a group's messages within a date range as JSON
wx members "<group>" --json List a group's members (rarely needed; mostly for completeness)
wx stats "<group>" --since DATE wx-cli's built-in stats; we compute our own from wx history JSON so the format matches our digest
wx daemon status / wx daemon stop / wx daemon logs --follow Daemon lifecycle (troubleshooting)

All wx commands accept --json for machine-readable output. Default output is YAML — only use it for human eyeballing during debugging.

Troubleshooting

When a wx command fails, diagnose by the symptom, not by retrying blindly. Common patterns:

Symptom Cause Fix (tell the user to run these — do NOT run sudo for them)
Operation not permitted / Access denied to ~/.wx-cli Sandbox is on Re-run the command with dangerouslyDisableSandbox: true. Persistent fix: /sandbox to allow ~/.wx-cli and the WeChat data dir.
无法写入 /Users/<u>/.wx-cli / Permission denied ~/.wx-cli is owned by root (legacy sudo wx init) sudo chown -R $(whoami) ~/.wx-cli && sudo rm -f ~/.wx-cli/daemon.{pid,sock} && wx daemon start
wx history hangs / times out / returns nothing Daemon is stuck wx daemon stop && rm -f ~/.wx-cli/daemon.{pid,sock} && wx daemon start, then retry
no keys / init required after the daemon was working Keys went stale (WeChat restart, version upgrade) Make sure WeChat is running, then wx init --force (non-sudo first; only sudo if your wx-cli version requires it)
wx contacts returns zero rows for a group you know exists Group is folded into 折叠群 or the daemon hasn't indexed it yet wx sessions --json and search there; if missing, run wx daemon stop && wx daemon start and retry
Messages returned but --since / --until window looks wrong Date string not in YYYY-MM-DD format, or off-by-one timezone Confirm the dates are local-time YYYY-MM-DD. Re-filter the JSON by timestamp locally as a belt-and-suspenders step.
Empty result for a chat that should have activity -n cap too low for a noisy group Raise -n (e.g. to 20000) and re-fetch

Recovery order when nothing makes sense:

  1. Is WeChat running?
  2. Is ~/.wx-cli owned by $(whoami)?
  3. Is the daemon healthy? (wx daemon status)
  4. Restart the daemon (wx daemon stop && wx daemon start)
  5. Last resort: wx init --force (while WeChat is running)

Never auto-retry inside the skill — every failure should produce a clear diagnostic plus the exact command the user needs to run.

CONTACT HAONAN

联系haonan

医疗 AI · 产品与独立开发

刘浩南

关注医疗 AI 从 demo 到真实落地,聚焦产品化、商业化与院内工作流效率提升。

12年医疗产研经验,大湾区头部医疗AI公司前产品总监,独立开发者

医疗 AI 产品化医疗 AI 商业化院内工作流效率
刘浩南的微信联系二维码
微信扫一扫,联系 haonan