6.7 KiB
6.7 KiB
name, description
| name | description |
|---|---|
| xiaohongshu-publish-note | Execute XiaoHongShu (小红书) image-note publishing workflow in the creator platform: open publish center, switch to 图文 mode, prepare images, upload images, fill title/body/topics, configure settings, and validate pre-publish state. Use when the user asks to 发布图文, 发笔记, or automate web publishing steps before final submit. Prefer user-provided image paths; if no image paths are provided, generate images via gemini-image-web and consume manifest target paths for upload. Support configurable publish modes (`safe_mode` and `live_mode`). |
Xiaohongshu Publish Note
Workflow
- Confirm account is logged in and creator center is reachable.
- Open creator publish page and switch to 图文 publishing mode.
- Prepare image inputs: use user-provided paths first, otherwise generate via gemini-image-web.
- Upload images and wait for editor panel readiness.
- Fill title/body/topics and required settings.
- Validate preview and publish controls.
- Execute publish behavior according to publish mode.
- Save publish evidence and return summary.
Shared Session Policy
- Reuse a single Playwright CLI session across all web-automation skills:
export PLAYWRIGHT_SHARED_SESSION=codex-shared
- Use
/Users/xd/java/xhs/tools/pwas the only Playwright CLI entrypoint. - Do not pass
--sessiondirectly in skill-specific commands.
1) Enter Creator Publish Page
- From web homepage, click left sidebar
发布. - Expect new tab:
https://creator.xiaohongshu.com/publish/publish?.... - Switch to the new tab before continuing.
2) Switch To 图文 Mode
- Click
上传图文tab. - If tab click fails due viewport/position issues:
- Resize viewport to desktop (for example 1440x1000).
- Re-snapshot and retry with latest refs.
- Use
上传图片area visibility as the final switch-success signal. - Do not treat tab text click success as completion by itself.
3) Prepare Images
- Prefer user-provided absolute file paths when available.
- If user did not provide image paths:
- Generate images from the article topic/content using
gemini-image-web. - Read the generated manifest JSON and extract
files[*].target_path. - Use manifest-derived paths as upload input.
- Generate images from the article topic/content using
- Ensure at least 1 valid image path exists before entering upload.
Manifest linkage rules:
- Trust manifest
status=okandcollected_count>=1before upload. - If manifest status is not ok, stop and return image-preparation failure.
- Avoid guessing latest files by timestamp when manifest is available.
4) Upload Images
- Click
上传图片to open file chooser. - Upload absolute file paths from Step 3.
- After upload, verify editor state:
图片编辑- image counter like
1/18 - title and body input areas.
5) Fill Core Content
- Fill title textbox (
填写标题会有更多赞哦). - Fill body contenteditable area.
- Insert topics (mandatory):
- Click recommended topic chips, and/or
- Use
话题button for manual insertion. - Validate final topic count from actual editor content, not click count.
- Ensure total topic count is >= 5 before proceeding.
- Verify body counter and preview panel update.
Topic counting rule:
- Count inserted topic tokens in正文内容(例如
#话题)。 - If token count < 5, continue inserting until count >= 5.
- If repeated insertion still fails to reach 5, block final publish.
6) Configure Settings
- Do not add location.
- Review content settings:
原创声明公开可见定时发布- other toggles as needed by request.
- Ignore geolocation prompts/errors and keep location empty.
7) Validate Pre-Publish State
- Confirm right-side preview reflects title/body/topics.
- Confirm topic count is >= 5.
- Confirm no location tag is present in preview.
- Confirm uploaded image count is >= 1.
- Confirm bottom actions are visible:
暂存离开发布
- Publish hard gate (must all pass):
- image count >= 1
- topic count >= 5
- location is empty
- Default safety behavior:
- Do not click final
发布unless user explicitly asks for real submission now.
- Do not click final
8) Publish Mode
safe_mode(default):- Run full workflow and hard-gate checks.
- Never click final
发布.
live_mode:- Require explicit user intent for real posting in current turn.
- Click final
发布only after hard-gate checks pass.
9) Failure Handling (Layered Retries)
- Image preparation failure:
- If user paths are invalid, ask for corrected absolute paths.
- If gemini generation fails, stop publish flow and return failure reason.
- Manifest linkage failure:
- If manifest missing/invalid/empty, retry reading once.
- If still invalid, stop and return manifest failure.
- Upload failure:
- If upload area blocks or file chooser fails, re-snapshot and retry once.
- If still failing, stop and report upload failure.
- Topic insertion failure:
- Retry insertion via alternate path (chip -> manual topic button).
- If topic count stays < 5, block final publish.
- UI interaction failure:
- On stale refs/click interception/modal cover, wait briefly, re-snapshot, retry once.
- Publish action failure:
- If publish click fails, re-snapshot and retry click once.
- If success page still not reached, return publish-step failure.
- Publish gate failure:
- If any hard gate fails, do not click
发布; return blocking conditions.
- If any hard gate fails, do not click
10) Reliability Rules
- Re-snapshot after:
- tab switches
- upload completion
- dropdown/modal open/close
- On click interception or stale refs:
- wait briefly
- refresh snapshot
- retry with updated refs.
11) Save Publish Evidence
- On successful live publish:
- Wait for success indicator (for example
发布成功). - Capture success screenshot to:
/Users/xd/java/xhs/output/playwright/xhs-publish-success-<YYYYMMDD-HHMMSS>.png
- Record:
- publish time
- title
- uploaded image path list
- screenshot path
- Wait for success indicator (for example
12) Return Report
Return a compact execution summary:
- uploaded files count
- title/body/topic/location status
- settings changed
- publish mode used (
safe_modeorlive_mode) - whether final publish was intentionally skipped or executed
- evidence info when published (success marker, screenshot path, publish time)
Boundaries
- Do not post misleading or spam content.
- Do not publish real content without clear user confirmation in current turn.
- Do not modify unrelated account settings.
- Never add location information.
- Never proceed to final publish when topic count is < 5.
- Never proceed to final publish when uploaded image count is < 1.
- Never proceed to final publish when location is non-empty.
- Default to
safe_modeunless user clearly requests real posting now.