SuperAPI AI Directory

xiaolvs-pipeline

General & other

View repository

Updated 10-15 19:53

About this skill

Xiaolvshu One-Click Pipeline

Overview

One-click orchestration of the complete "fetch → ⏸️confirm → graphic-text generation → ⏸️confirm → publish" workflow, sequentially invoking the following 3 sub-skills, pausing at key points to wait for manual confirmation:

  1. fetch-archive — Fetch article content + archive to the "Jarvis" knowledge base
  2. ⏸️ Confirmation point 1 — Output the material outline and chart plan, wait for user confirmation
  3. xiaolvs-image-gen — Fact screening + infographic generation + copywriting
  4. ⏸️ Confirmation point 2 — Display the generated images and copy, wait for user confirmation
  5. xiaolvs-publish — Publish to Xiaohongshu + WeChat Official Account

Final deliverables

  1. <原文标题>.md + <原文标题>_meta.json — Original text archive (named using the original title, not article.md)
  2. "Jarvis" Lexiang knowledge base document copy
  3. infographic.png + chart_1~N.png — Hand-drawn infographic
  4. copywriting.txt — Official Account copy
  5. Xiaohongshu draft + WeChat Official Account draft

Complete workflow

Phase 1: Fetch and archive (fetch-archive)

Input: Article URL or text material provided by the user Output:<项目子目录>/<原文标题>.md、<原文标题>_meta.json, Lexiang knowledge base document

  1. Select the fetch method according to the URL type (see the fetch-archive decision tree for details).The vast majority of web articles contain images; by default use fetch_article.py; only when it is confirmed to be a text-only article may web_fetch
  2. Savethe full original textas <原文标题>.md + <原文标题>_meta.json(named using the original title, not article.md; save the full original text, do not summarize/abstract/rewrite)
  3. Translation of non-Chinese articles(⚠️ cannot be skipped): Detect the language of the original text; if it is not Chinese, translate it into a Chinese-English bilingual format (one paragraph of original text + one paragraph of Chinese translation, without adding separator lines or flag emojis, retaining image references), generating <原文标题>_translated.md. For details, see "Step 3.5: Translation of non-Chinese articles" in fetch-archive SKILL.md
  4. Archive to the Lexiang knowledge base(⚠️ cannot be skipped):
    • Completely archive the fetched original text to the Lexiang knowledge base to ensure material archiving and traceability
    • Configurations such as the target knowledge base, directory structure, and upload method are all defined in the config.json of the fetch-archive skill, and are automatically completed during initialization by the fetch-archive conversational configuration process
    • For specific operation steps (get root node → check/create date directory → deduplicate → upload), see the "Step 2: Save the original text to the Lexiang knowledge base" section of fetch-archive SKILL.md
    • Illustrated articles are converted to PDF and uploaded; plain-text articles are created in online document (page) format
    • After the upload is complete, show the knowledge base document link to the user

⏸️ Confirmation point 1: Material outline confirmation (between Phase 1 → Phase 2)

After the original text is downloaded locally,you must pause and wait for user confirmation, then proceed to the graphic-text generation stage.

Output content:

📋 素材大纲
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【文章主题】一句话概括
【核心论点】3-5 个关键观点(编号列出)
【关键数据】文章中的重要数据/图表/案例
【利益相关】作者/机构的立场与潜在倾向(如有)
【原文出处】完整标题 + URL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 图表规划
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
第 1 张(总览图):<主题描述>
第 2 张(论点1):<主题描述>
第 3 张(论点2):<主题描述>
...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

👉 请确认以上大纲和图表规划是否 OK,或提出修改意见。

Wait for user replyOnly then enter Phase 2. The user can:

  • Confirm → Continue
  • Adjust the number of images/theme division
  • Add/remove core arguments
  • Modify the focus direction

⏸️ Confirmation Point 1.5: Select image style

After the material outline is confirmed,the user must be asked to select an image style, then enter the image-text generation stage.

Use ask_followup_question to present two style options to the user,defaulting to Black Gold Chalk (blackboard-gold):

Style name English ID Visual features Applicable scenarios
Warm Paper Journal warm-sketch Light cream-white paper + brown hand-drawn lines + warm-color accents Knowledge sharing, methodologies, product analysis (friendly and warm)
Black Gold Chalk blackboard-gold Deep black background + gold/copper chalk lines + off-white handwritten text Technical architecture, strategic analysis, industry trends (authoritative and high-end)

After the user selects, pass the selected style to the image-text generation step of Phase 2.

Phase 2: Image-text generation (xiaolvs-image-gen)

Input: The user-confirmed material outline + image plan Output:infographic.png、chart_1~N.png、copywriting.txt、gemini_charts_config.json

  1. Check the Python environment and Chrome CDP authentication (the script automatically starts a separate CDP Chrome, no need to manually close/restart the user's Chrome)
  2. Fact-checking, report the screening results to the user
  3. Write the Gemini prompt and generate the configuration file
  4. Run the generation script to batch-generate infographics
  5. Write the WeChat official account copy, save as copywriting.txt

⏸️ Confirmation Point 2: Image-text review (between Phase 2 → Phase 3)

After all images and text are generated,you must pause and wait for user confirmation, then enter the publishing stage.

⚠️ Strictly prohibited to display image files via read_file . Multiple PNG images are too large in content (each ~10000 lines of base64); reading multiple images at the same time with read_file will cause context overflow and generation to get stuck. You should list the file inventory (name + size) and prompt the user to preview in the IDE or Finder.

Output content:

🎨 图文生成完成,请审阅:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📷 生成的图片(请在 IDE 或 Finder 中预览):
  1. infographic.png (xxxKB) — 总览信息图
  2. chart_1.png (xxxKB) — <主题>
  3. chart_2.png (xxxKB) — <主题>
  ...

📝 文案预览(copywriting.txt):
  <显示 copywriting.txt 完整内容>

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
👉 请确认图片质量和文案内容是否符合预期:
  - 图片:风格、配色、文字是否清晰、内容是否准确
  - 文案:标题、正文、标签是否合适
  - 如需修改某张图,请指出具体问题

Wait for the user's replybefore entering Phase 3. The user can:

  • Confirm all OK → Continue publishing
  • Request regeneration of a certain image
  • Modify the copy content
  • Adjust tags

Phase 3: Publishing (xiaolvs-publish)

Input: User-confirmed image files + copywriting.txt Output: Xiaohongshu draft + WeChat official account draft

  1. Xiaohongshu: Create xhs_publish_config.json → Use --auto(after filling in, still wait for user confirmation before publishing)
  2. WeChat official account: Use --copywriting mode (or --config + copywriting_file)+ --collection parameter + --auto → upload images one by one in order → fill in and save → save draft

User confirmation points: After the Xiaohongshu script is filled in, wait for Enter confirmation; for the WeChat official account, manually publish after checking the draft in the backend


How to use

The user only needs to provide the article URL, for example:

"Help me turn this article into a Xiaolvshu:https://example.com/article"

The pipeline automatically executes 3 phases in sequence, pausing at each key checkpoint to wait for user confirmation.

Quick Reference Commands

# Phase 1: 抓取(付费文章)
python scripts/fetch_article.py <URL> --output-dir <项目子目录>

# Phase 1: 转存「贾维斯」知识库(使用原文标题)
source ~/.codebuddy/skills/lexiang/scripts/init.sh
bash scripts/save_to_lexiang.sh "<项目子目录>/<原文标题>.md" "<乐享知识库URL,从 fetch-archive 的 config.json 中读取>" "<原文标题>"

# ⏸️ 确认点 1:输出素材大纲 + 图表规划,等待用户确认

# Phase 2: 生成信息图
python scripts/gemini_generate_images_browser.py generate \
    --config <项目子目录>/gemini_charts_config.json \
    --output-dir <项目子目录>

# ⏸️ 确认点 2:展示图片和文案,等待用户确认

# Phase 3: 小红书草稿(CDP模式,填写完成后等待用户确认再发布)
python scripts/xhs_publish_playwright.py publish --copywriting <项目子目录>/copywriting.txt --images <项目子目录>/infographic.png <项目子目录>/chart_1.png ... --collection "AI产品经理" --auto --cdp

# Phase 3: 微信公众号草稿(CDP模式)
python scripts/wechat_mp_publish_playwright.py publish \
    --copywriting <项目子目录>/copywriting.txt \
    --images <项目子目录>/infographic.png <项目子目录>/chart_1.png ... \
    --collection AI前沿 \
    --auto --cdp

Pipeline Configuration

Project Subdirectory Naming

Each article project uses a separate subdirectory, with the naming format:The article's English title, with words separated by - and all lowercase. Chinese titles must first be translated into English before conversion.

Do not use dates as the parent directory(such as articles/2026-04-01/); instead, create a subdirectory named after the title directly under articles/ .

Example:

  • articles/ai-powered-customer-discovery/(English title converted directly)
  • articles/the-five-moats-in-ai-era/(Chinese title "当AI可以做一切,剩下的护城河只有这5种" translated then converted)
  • articles/the-fluency-test/

Default Parameters

Parameter Xiaohongshu WeChat Official Account
Collection AI Product Manager AI Frontier
Draft Mode --auto(wait for confirmation after filling in) --auto(upload images one by one, save as draft)
Image Order infographic first infographic first

Interruption Recovery

After the pipeline is interrupted at any Phase, it can continue from the last completed Phase:

  • If <原文标题>.md already exists → skip Phase 1 and start from Phase 2
  • If copywriting.txt and images already exist → skip Phase 1-2 and start from Phase 3
  • Failure of a single Phase does not affect the outputs of completed Phases

Sub-Skill Relationships

xiaolvs-pipeline(编排层)
  ├── fetch-archive(抓取+归档)
  │     ├── scripts/fetch_article.py
  │     └── scripts/save_to_lexiang.sh
  ├── xiaolvs-image-gen(图文生成)
  │     ├── scripts/gemini_generate_images_browser.py
  │     ├── scripts/gemini_generate_images.py
  │     ├── scripts/generate_images.py
  │     └── references/*
  └── xiaolvs-publish(发布)
        ├── scripts/xhs_publish.py
        └── scripts/wechat_mp_publish.py

⚠️ Data Discipline (Highest Priority)

All data in infographics must come strictly from the original text, and must never be mixed with external data sources.

  1. The purpose of fact-checking (Fact-Check) is verification, not replacement: use web_search to verify whether the original text's data is reasonable, but what is ultimately written into the image prompt must be the original text's wording/original text's data, not data found on the external web
  2. It is forbidden to write externally verified data into images: for example, if the original text says "ARR exceeds $100 billion", even if external web data shows otherwise, the image still uses the original text's $100 billion
  3. It is allowed to annotate derivation formulas/assumptions: if the user provides a derivation formula (such as Anthropic ARR × 65% + OpenAI ARR × 50%), the formula may be displayed in the image as an explanation of the data source
  4. Any specific numbers that do not appear in the original text must not be used: for example, "Cursor $2 billion ARR", "GitHub Copilot 37% share", etc. found on the external web must not appear in the image if the original text does not mention them
  5. When the original text's data is found to conflict with the external web: report the discrepancy to the user, and let the user decide whether to correct it; do not replace it on your own

CDP Chrome Management (shared by Phase 2 image generation + Phase 3 publishing)

Differences Between the Two CDP Chrome Instances

Purpose Profile Directory Login State
Gemini Image Generation ~/.gemini_browser/chrome_cdp_profile Google account (Gemini Pro)
Platform publishing (Xiaohongshu + WeChat Official Account) ~/.config/google-chrome-cdp Xiaohongshu + WeChat Official Account

How to Start the Publishing CDP Chrome

# 首次启动(需要手动登录小红书和微信公众号)
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
    --remote-debugging-port=9222 \
    --user-data-dir="$HOME/.config/google-chrome-cdp" &

⚠️ macOS Chrome Restriction: Cannot enable CDP on the default user-data-dir (error DevTools remote debugging requires a non-default data directory), an independent --user-data-dir。

Login State Management

  1. First Use: After launching CDP Chrome, manually open the Xiaohongshu Creator Platform and WeChat Official Account backend to scan the QR code and log in
  2. Login State Persistence: The login state is saved in the ~/.config/google-chrome-cdp/ directory. As long as this directory is not deleted, subsequent reuse requires no re-login
  3. Handling Expired Login State: If the script detects a redirect to the login page, first open the corresponding platform in CDP Chrome and wait for the user to log in again. After confirming a successful login, run the publishing script
  4. Also Save storage_state: After a successful login, use Playwright to export storage_state as a backup:
    • Xiaohongshu:~/.xiaohongshu/storage_state.json
    • WeChat Official Account:~/.wechat_mp/storage_state.json

Pre-Publish Login State Check Flow

# 在执行发布脚本前,先检查 CDP Chrome 是否可连接,平台是否已登录
# 如果未登录,打开登录页面并等待用户扫码,确认成功后再执行发布

Notes

  • Two key confirmation points cannot be skipped: Confirmation Point 1 (material outline) and Confirmation Point 2 (image-text review) must wait for an explicit user reply before continuing
  • Lexiang Knowledge Base archiving cannot be skipped: After fetching the original text in Phase 1,you mustarchive the original text to the Lexiang Knowledge Base. This is the foundation for material archiving and traceability, and must not be skipped just to rush into image-text generation. The target knowledge base and configuration are managed by the fetch-archive skill
  • Save the full original text: What is saved in Phase 1 must be the full original text, not a summary/abstract/rewrite
  • Images must not be lost:web_fetch cannot extract and download images from the page, any article containing images/screenshots/charts must use fetch_article.py. When unsure whether an article contains images, default to using fetch_article.py
  • Name using the original title: Name local files with <原文标题>.md (do not use article.md), and the Lexiang Knowledge Base archive also uses the original title
  • Data source consistency: All data in the images can only come from the original text and must not be mixed with external data from web_search (see "Data Discipline" above for details)
  • Style consistency: All images must use the same STYLE_PREFIX. The prompt for the first overview image should maintain the same degree of font/handwriting emphasis as the subsequent images
  • The pipeline does not skip any user confirmation points, ensuring manual control over content quality
  • For detailed instructions on each Phase, please refer to the SKILL.md of the corresponding sub-skill
  • Before uploading to the Lexiang Knowledge Base, automatically deduplicate by filename + type
  • The WeCom bot trigger scenario uses scripts/wecom_bot_service.py, which can automatically execute the complete pipeline