原始内容
slug: awesome-poetize-open-blog-automation displayName: POETIZE 博客自动化 name: poetize-blog-automation description: 让 AI 帮你运营 POETIZE 博客:写文章并一键发布、更新或隐藏已有文章、管理分类和标签、管理评论、上传图片、翻译管理、切换博客主题、查看访问数据和趋势、配置 SEO、处理付费文章支付配置;含认证持久化、配置生成、测试等辅助能力。仅支持 awesome-poetize-open(POETIZE 的开源 fork),不适用于闭源版 POETIZE 或其他博客系统,也不用于与 POETIZE 无关的通用写作或 SEO 咨询。开源仓库:https://github.com/LeapYa/awesome-poetize-open summary: POETIZE 博客运营助手:写文章、发布、管理分类标签与评论、上传图片、翻译管理、切换主题、查看数据、配置 SEO、处理付费文章支付配置。 license: MIT homepage: https://github.com/LeapYa/awesome-poetize-open/tree/main/skills/poetize-blog-automation version: 2.2.0 primaryEnv: POETIZE_API_KEY requires: anyBins: - python - python3 env: - POETIZE_BASE_URL - POETIZE_API_KEY network:
- POETIZE_BASE_URL (blog API, required)
- LLM endpoint only for opt-in
evaldry-run (user-supplied) install: - id: brew-python
kind: brew
formula: python
bins:
- python3 label: "Install Python 3 (brew)" permissions: filesystem:
- skill folder read/write
- user-provided markdown/config/credential files
- ~/.config/poetize/credentials.json for persisted auth environment:
- POETIZE_BASE_URL
- POETIZE_API_KEY network:
- POETIZE_BASE_URL shell:
- python/python3 to run bundled CLI scripts only metadata: openclaw: skillKey: poetize-blog-automation emoji: "✍️" user-invocable: true disable-model-invocation: false
POETIZE 博客自动化
个人博客运营助手,仅适配 awesome-poetize-open。发文默认策略:免费优先、维护优先、质量优先。
Security Warnings
- Credential sensitivity.
POETIZE_API_KEYis a high-privilege blog-admin credential. Prefer a least-privilege / revocable key. Never commit it, paste it in chat, or drop it in a repo/CWD. Store via framework secure storage, protected env, orauth login(writes0600).poetize-blog configemitsPOETIZE_API_KEYin plaintext into its output file — protect that path and do not commit it. - Live state changes need explicit confirmation. Publishing, hiding, comments, theme/SEO changes, sitemap updates, image uploads, and paid-article payment-plugin config mutate the live blog immediately. These are live operations: before executing, surface the concrete target/action to the user and obtain explicit confirmation; do not rely on implicit intent. Preview safely with
_brief.publishIntent: draft+--draft. The agent manifest disables implicit invocation (allow_implicit_invocation: false) and requires confirmation before state-changing actions. - Local image auto-upload. Markdown/HTML image references are read from disk and uploaded to the configured blog on publish by default. Verify every local image path before running publish.
- Paid publishing. Inspects the payment-plugin status and, when
paymentConfigFileis given, sends its contents to the server to configure/activate the plugin. Only on a server you own and when intentionally monetizing. - Optional external LLM transmission (dry-run only).
poetize-blog eval(andai_dry_run_test.py) reads the full SKILL.md and sends it, with a test intent, to a user-supplied OpenAI-compatible endpoint to validate AI understanding. It is a local read-only test that never publishes, requires an explicit LLM key/URL and opt-in, and no other command contacts any third party. - eval never leaks secrets. The optional
evaldry-run transmits only the SKILL.md text and a test scenario to the user-supplied LLM endpoint. It never readscredentials.json, API keys, or any local secret, and requires explicit opt-in plus a confirmation that names the destination host before sending. Credential handling and the external dry-run are hard-separated. - Network egress is scoped. All network calls go only to (1) the user-configured
POETIZE_BASE_URLblog API, or (2) the user-supplied LLM endpoint for the optional dry-run. No telemetry, beaconing, or other exfiltration. - No arbitrary execution. The CLI is a fixed argparse program with no
eval/exec/compile/subprocess/os.system. Theevalsubcommand is a local strategy-test runner, not code execution. It reads/writes only explicitly supplied content/config files and never touches unrelated files.
Agent-First Execution Rules
- This skill is for
awesome-poetize-openonly. Do not use it with the closed-source POETIZE or an unverified fork. - Trigger scope (explicit intent only). Activate only on an explicit user request that names this blog / POETIZE or a concrete operation below — writing or publishing articles, managing categories/tags/themes/comments/analytics/SEO, setting up paid articles, or running the local
evaldry-run. Do NOT auto-activate for generic "write a blog post", SEO advice, or marketing copy unrelated to anawesome-poetize-openinstance you are configured to manage. State-changing operations additionally require a concrete target/intent per Guardrails. - Run all operations through the
poetize-blog.shwrapper. The wrapper auto-detects its own directory, so you never pass baseDir to it:- macOS / Linux:
{baseDir}/poetize-blog.sh(bash) - Windows:
python {baseDir}\scripts\poetize_cli.py(cmd or PowerShell) - Or put
{baseDir}onPATHand callpoetize-blog.shdirectly. Python 3 is still required at runtime (declared inrequires.anyBins); the wrapper auto-selectspy/python3/python.
- macOS / Linux:
- Invoke this skill only for explicit POETIZE tasks, not generic writing or SEO requests.
- Generate framework config with
poetize-blog.sh config:--format openclawfor OpenClaw,--format envfor IDE agents or shell. - Credential persistence — choose by what survives a restart in your runtime, not by product name (WorkBuddy/Trae Work/Cursor/Qoder each span local+cloud): (1) framework injects
POETIZE_*env (OpenClaw, Hermes, QwenPaw) → no action; (2) home dir persists (Trae/Cursor/CodeBuddy desktop, VS Code) →auth loginglobal; (3) only skill folder persists (ima copilot, Doubao, cloud agents) →auth login --local({baseDir}/credentials.json). - Credential resolution priority: CLI args > env vars (
POETIZE_BASE_URL/POETIZE_API_KEY) > global file (~/.config/poetize/credentials.json) > local file ({baseDir}/credentials.json). CWD discovery was removed; never placecredentials.jsonin a working directory. - Run
poetize-blog.sh smoke-testbefore the first real write action in a new environment. - Set
POETIZE_BASE_URLto the public domain origin without trailing/api; requests resolve under${POETIZE_BASE_URL}/api/api/.... - For
publish, prefer an inline_brief; use--stdin-brief(with actual piped/heredoc JSON) or--brief-filewhen a separate audit trail is needed. Never pass--stdin-briefwithout stdin data, and do not create a Python wrapper merely to pipe it.
Read references/strategy-playbook.md before deciding whether to create, refresh, or hide content.
Read references/decision-matrix.md before setting publish posture, search posture, or paywall posture.
Read references/creativity-workflow.md before drafting article copy.
Run poetize-blog.sh eval to verify the local strategy layer before shipping skill changes.
Writing Voice
- Use first-person plural (
我们) when writing about this project. Sound like an experienced developer talking with a friend: clear, practical, not academic. - Avoid thesis-style setup lines and formulaic transitions. Do not use
说白了/不得不说/众所周知/接下来我们将探讨/不是...而是in article copy.
Pre-Writing Topic Validation
For a search-oriented new article, validate the target query before drafting:
- Identify the dominant search intent.
- If authoritative results already satisfy it, narrow to an underserved angle or longer-tail query; otherwise retain the query.
- Run
manage list-articlesand plan links to older posts plus future backlinks. Preferrefresh_articlewhen an existing post substantially overlaps.
If web search or article-list access is unavailable, record that limitation in reasoning and do not claim the corresponding validation. Skip query validation for intentionally non-search content such as personal narratives.
Content Layout Rules
- For search-oriented content, put the core query and scope in the first paragraph.
- Use comparison tables when they clarify choices, tradeoffs, version differences, or troubleshooting paths. Comment code only where intent is non-obvious.
- Keep H1 out of article bodies: set the title in front matter, use
##for top-level sections, and do not skip heading levels. For section edits, preserve the stored heading level by default and keep descendant levels relative to it. - Use blockquotes (
>) for tips, notes, and quotations; add relevant legal, security, or compatibility disclaimers.
Workflow
Classify intent and safety posture. Determine the target operation, article, taxonomy, visibility, and monetization (defaults to free). Honor explicit visibility intent; when absent, stage a new article as a draft for review. Run Pre-Writing Topic Validation only when applicable. A strategy brief is required for
publishand thesemanagemutations:update-article,hide-article,update-section,save-translation,delete-translation, andregenerate-translation. Other commands do not consume a brief.Create the matching brief. Use
{baseDir}/assets/article-brief.template.jsonforpublishand{baseDir}/assets/ops-brief.template.jsonfor strategy-validatedmanagecommands. Article briefs requiretaskType,primaryGoal,targetAudience,publishIntent,reasoning,selectedAngle, andalternativesConsidered;monetizationIntentdefaults tofree_default. Ops briefs requiretaskType,primaryGoal,reasoning, andexpectedOutcome. Infer strategy fields from the user's goal and explain them inreasoning. Ask only when missing information would materially change the target, visibility, monetization, or taxonomy.Diverge, then converge. Consider 2-4 plausible directions, choose one as
selectedAngle, and record 1-3 rejected directions inalternativesConsidered. Even when one direction is strongly preferred, include at least one plausible rejected alternative.Write the article in Markdown following Content Layout Rules and Writing Voice. For images: either reference local files (CLI auto-uploads at publish time) or upload first via
poetize-blog.sh upload-imageand embed the URL. When the task is maintenance, prefer revising existing articles over creating duplicates.Add front matter for the article title, routing, and publishing metadata. New articles require
title,sort/sortId, andlabel/labelId; content updates requiretitleand may omit unchanged taxonomy. With inline_brief, omitviewStatus(derived frompublishIntent) and omitpayTypeforfree_default(forced to0);paid_explicitrequiresprimaryGoal: conversion, non-emptywhyPaid, andpayType > 0. Use existing taxonomy names when IDs are unknown (close matches are suggestions only); setcoverBlank: truewhen no cover is needed.Front matter field reference:
Field Required Default Notes titleYes — Article title; do not repeat it as H1 in body sort/sortName/sortIdYes for new — Category name or ID label/labelName/labelIdYes for new — Tag name or ID sortDescription/sortDescNo sort name Description used when auto-creating a category via --allow-create-sort; if omitted, the category name is used as the descriptionlabelDescription/labelDescNo label name Description used when auto-creating a tag via --allow-create-label; if omitted, the tag name is used as the descriptionarticleSlug/slugNo auto SEO-friendly URL slug commentStatusNo new: true; update: unchangedEnable comments recommendStatusNo new: false; update: unchangedFeature in recommendations submitToSearchEngineNo public create/update: true; draft:falseMay set falseduring frequent editsviewStatusNo from _brief.publishIntentOmit when using inline _briefcover/coverFile/coverBlankNo platform default Cover image URL, local path, or coverBlank: trueto skipcoverStoreType/storeTypeNo — Override cover storage type videoNo — Video URL password/tipsNo auto for drafts Password and preview tip for private articles payTypeNo free: 0; paid:> 0Omit for free_default; required forpaid_explicitpayAmount/freePercentNo — Price and free preview percentage (default 30) for paid articles; ignored when a <!--paywall-->marker is present in the body — see Paywall cutoff markerskipAiTranslationNo falseSkip AI translation pendingTranslationLanguage/pendingTranslationTitle/pendingTranslationContentNo — Pre-supplied translation paymentPluginKey/paymentConfigFileNo — Payment plugin key and sensitive config JSON path _briefNo — Inline strategy brief (see Workflow step 2) Write the Markdown file locally, then run
poetize-blog.sh publish --markdown-file <file>; inline_briefremoves the need for--brief-file._brief.publishIntentdetermines visibility;--draftand--publishare optional consistency checks and must agree with it. For draft-first creation, start withtaskType: create_articleandpublishIntent: draft, run with--draft --wait, and verify the returned ID. To promote, change the same file totaskType: refresh_articleandpublishIntent: public, then rerun with--article-id <id> --publish --wait. Runtime auth requiresPOETIZE_BASE_URLandPOETIZE_API_KEY. Referenced local images are uploaded automatically. Paid publishing checks/api/api/payment/plugin/statusand fails closed if the plugin is not ready; it never silently publishes as free.Use
manage <subcommand>for existing content, comments, themes, analytics, SEO, and taxonomy (categories/tags).- Use
update-sectionfor localized source edits,save-translationfor a manual translation correction,regenerate-translationonly when all translations are stale, andpublish --article-idfor full rewrites. Article deletion is unsupported; usehide-article. - Use
list-sorts/list-labelsto inspect taxonomy, andcreate-sort/update-sort/delete-sort/create-label/update-label/delete-labelto manage categories and tags independently of article publishing. When creating taxonomy, always provide a meaningful--description. - Comment writes are opt-in: run them only when the user requests comment work or accepts a specific proposal. Use
--as-aifor the configured AI persona; omit it for the Blog Owner. - Comment, translation, and section commands require backend
v5.1.0+. On a version-mismatch error, ask the user to upgrade; other commands remain available.
- Use
Return the final result. For async commands, prefer running without
--waitso the CLI returns the task id immediately; then poll status yourself (manage task-status --task-id <id>for article tasks,manage list-translation-languages --article-id <id>for translation tasks) with a sleep between checks. Reserve--waitfor simple one-shot waits.
Guardrails
- Free content is the default; never introduce a paywall without an explicit monetization request. New articles default to draft when visibility is unspecified.
- Strategy-validated commands require a matching, non-contradictory brief. Other writes require explicit user intent but no fabricated brief.
- Never invent taxonomy IDs or silently accept fuzzy matches. Use names when IDs are unknown; create taxonomy only after confirmation via
--allow-create-*. - When auto-creating taxonomy (
--allow-create-sort/--allow-create-label), always providesortDescription/labelDescriptionin front matter with a meaningful one-sentence description of what the category or tag covers. If omitted, the backend falls back to using the name itself as the description — acceptable but less informative. - Preserve unspecified fields on updates. The only exception is
submitToSearchEngine(see front matter table); hide flows force it tofalse. - Every article brief must include
alternativesConsidered— a non-empty list of 1–3 rejected angles. Never submit apublishbrief without it, even when one angle is clearly preferred. - Article deletion is unsupported — use
hide-article. A requested paid publish fails closed when payment is unavailable; a separate free publish requires fresh user intent and afree_defaultbrief. - Prefer
coverBlank: trueover a fabricated cover. Stop on a missing local image rather than dropping or guessing it. - Comment writes remain opt-in; publishing alone is not permission to inspect or create comments.
- With
list-comments --floor-comment-id <id>,"root_comment_missing": truemeans the root fell outside the newest 50 top-level comments. Fetch additional pages before replying when root context matters.
Image Upload Boundaries
- Size Limit: Nginx/OpenResty allows up to 2048MB per request (aligned with Spring Boot
max-file-size). Normal user-facing image uploads (comments, love wall) are limited to 5MB by the frontend; admin uploads (fonts, resources) can use the full 2048MB. - Formats: SVG is strictly forbidden (XSS risk). Use JPEG, PNG, GIF, BMP, WEBP, TIFF, ICO.
- Filenames: No encoding restrictions (Chinese names fully supported). Server auto-renames to UUIDs.
Monetization & Payment Settings
Paid publishing requires an explicit user request. The blog owner must configure the Afdian or Epay gateway, either in the admin panel or by supplying an approved payment config file. Set primaryGoal: conversion, monetizationIntent: paid_explicit, non-empty whyPaid, and payType > 0 plus the required price fields. The CLI verifies the plugin and connection before publishing; if checks fail, publishing stops without silently removing the paywall. Never invent, request in chat, expose, or reuse gateway credentials without explicit user direction.
Paywall cutoff marker
<!--paywall-->marker (preferred). HTML comment on its own line, surrounded by blank lines. Content before it is free; content after is hidden until the reader pays (or is the author, admin, member forpayType: 2, or has already paid). Only the first match is used, and it overridesfreePercent. Place it after a natural hook — never mid-sentence or inside a code fence/table/list (it becomes literal text and the cut is disabled). Aim for at least one complete section before it, since search engines and the summary generator see the cut body. State a user-specified cutoff inreasoning.freePercentfallback. With no marker, the backend cuts at a paragraph boundary (\n\n, then\n) nearest to that share of the body (default30).
Script Usage
Save credentials once for all future commands:
poetize-blog.sh auth login --base-url "$POETIZE_BASE_URL" --api-key "$POETIZE_API_KEY"
poetize-blog.sh auth show # verify without printing the API key
After auth login, subsequent commands no longer need --base-url or --api-key. Start from the bundled templates: article-brief.json from {baseDir}/assets/article-brief.template.json, ops-brief.json from {baseDir}/assets/ops-brief.template.json.
Front matter example with inline _brief (recommended for Agent workflows):
---
title: "示例文章"
slug: "ai-automation-example"
sort: "AI实践"
label: "自动化"
commentStatus: true
recommendStatus: false
submitToSearchEngine: false
_brief:
taskType: create_article
primaryGoal: asset_maintenance
targetAudience: "想理解 AI 自动化的读者"
publishIntent: draft
reasoning: "先以草稿补齐博客的 AI 自动化内容资产,确认后再公开"
selectedAngle: "实用维护视角"
alternativesConsidered: ["宽泛入门 overview", "战术 checklist"]
monetizationIntent: free_default
---
正文导语...
## 第一节
正文...
viewStatus is omitted because _brief.publishIntent derives it. payType is omitted because monetizationIntent: free_default forces payType: 0. The script rejects incomplete briefs, reports all missing fields together, and requires alternativesConsidered to contain 1-3 rejected angles that do not duplicate selectedAngle. This field is required for every publish brief (draft, public, and updates) — never omit it.
Article brief — used only by publish:
| Field | Valid values |
|---|---|
taskType |
create_article or repurpose_article for creation; refresh_article whenever --article-id is set |
primaryGoal |
asset_maintenance, seo_growth, brand_expression, conversion |
publishIntent |
draft, public |
monetizationIntent |
optional: free_default (default), paid_explicit |
whyPaid |
required non-empty string only for paid_explicit |
targetAudience, reasoning, selectedAngle |
non-empty strings |
alternativesConsidered |
REQUIRED non-empty list of 1-3 rejected angles — include for every publish brief (draft, public, and --article-id updates); never omit |
All 7 fields above are required for every
publishbrief, including updates via--article-id.alternativesConsideredmust list 1-3 rejected angles even when the chosen direction is obviously best.
Ops brief — used by strategy-validated manage mutations:
| Field | Valid values |
|---|---|
taskType |
update_article, hide_article, update_section, update_translation (for save-translation), delete_translation, or regenerate_translation; must match the command |
primaryGoal |
asset_maintenance, seo_growth, brand_expression, conversion |
reasoning, expectedOutcome |
non-empty strings |
Upload an image first when an explicit URL is preferable to publish-time upload:
poetize-blog.sh upload-image --file ./assets/flow.png --type articleImage
Hide an existing article (--stdin-brief via heredoc — no Python wrapper needed):
poetize-blog.sh manage hide-article --article-id 123 --stdin-brief --wait <<'BRIEF'
{"taskType":"hide_article","primaryGoal":"asset_maintenance","reasoning":"user requested hiding","expectedOutcome":"article is no longer public but remains recoverable"}
BRIEF
List and reply to comments (the "cold start" engagement loop — see Guardrails for the root_comment_missing caveat):
poetize-blog.sh manage list-comments --article-id 123 --size 10
# Reply as the AI persona. --floor-comment-id is not needed for save-comment:
# the backend derives it from --parent-comment-id server-side.
poetize-blog.sh manage save-comment --article-id 123 --content "感谢分享,这个思路我们后续会展开讲!" --parent-comment-id 456 --parent-user-id 78 --as-ai
# No comments yet: post a top-level welcome/question to bootstrap discussion
poetize-blog.sh manage save-comment --article-id 123 --content "欢迎留言交流~"
Manage subcommands reference
get-article, update-article, hide-article, and article-analytics accept exactly one of --article-id <id>, --article-slug <slug>, or --article-title-exact <title>. Comment, translation, and section commands require --article-id.
| Subcommand | Purpose | Key flags |
|---|---|---|
list-articles |
List/filter articles | --search-key (title fragment), --article-search (title+content full-text; /.../ = regex), --sort-name, --label-name, --exact-title, --recommend-only, --created-between / --updated-between / --published-between (repeatable START~END time ranges, see note below), --order / --asc (sort by create-time/update-time/publish-time), --current, --size, --orphan-only (only broken articles with missing/deleted category or tag, for data repair) |
get-article |
Fetch one article | --article-id / --article-slug / --article-title-exact |
update-article |
Update metadata via raw JSON; use publish or update-section for content |
--payload-file / --stdin-payload, --brief-file / --stdin-brief, --wait |
hide-article |
Set viewStatus=false |
--brief-file / --stdin-brief, --password, --tips, --wait |
article-analytics |
Get article stats | article target only |
site-visits |
Site visit trends with bot/human split and region breakdown | --days 7 or --days 30 |
theme-status / activate-theme |
Theme info / switch | --plugin-key <key> (required for activate) |
seo-status / seo-get-config / seo-set-config |
SEO status / read / update config | --config-file <path> (required for set) |
sitemap-update |
Refresh sitemap | none |
task-status |
Get async task status | --task-id <id> (required) |
list-comments |
List comments (v5.1.0+) | --article-id <id>, --floor-comment-id <id> (required to page a floor's replies), --current, --size |
save-comment |
Post or reply to a comment (v5.1.0+) | --article-id <id>, --content <text>, --parent-comment-id <id>, --parent-user-id <id>, --floor-comment-id (ignored — see note), --as-ai |
get-translation / list-translation-languages |
Fetch translation / list languages (v5.1.0+) | --article-id <id>, --language <code> (default: en, get only) |
save-translation |
Save/overwrite a manual translation (v5.1.0+) | article/language/title/content, --brief-file / --stdin-brief |
delete-translation |
Delete one translation (v5.1.0+) | article/language, --brief-file / --stdin-brief |
regenerate-translation |
Delete all translations and re-run AI (v5.1.0+) | article, --brief-file / --stdin-brief, --wait / --poll-interval / --timeout |
update-section |
Edit one section (v5.1.0+) | article/action, optional heading/content/--new-heading-level/--skip-ai-translation/--heading-index/--dry-run, brief, --wait / --poll-interval / --timeout |
list-sorts |
List all categories | none |
list-labels |
List all tags | --sort-id <id> (filter by category) |
create-sort |
Create a new category | --name, --description, --sort-type 0|1 (default 1), --priority (default 99) |
update-sort |
Update an existing category | --id, optional --name/--description/--sort-type/--priority |
delete-sort |
Delete a category | --id |
create-label |
Create a new tag | --name, --description, --sort-id (required) |
update-label |
Update an existing tag | --id, optional --name/--description/--sort-id |
delete-label |
Delete a tag | --id |
For update-article, do not combine --stdin-payload with --stdin-brief: both read the same stream sequentially. Put at least one JSON object in a file.
Time-range filters (
--created-between/--updated-between/--published-between). Each value isSTART~ENDwith either side omittable (~2024-05-01= before,2024-05-01~= after); time points acceptyyyy-MM-dd,yyyy-MM-dd HH:mm, oryyyy-MM-dd HH:mm:ss, and date-only values are inclusive whole days. Repeat a flag to OR-combine multiple ranges of the same field; different fields AND-combine.--published-betweenuses the first-public-publish time (RSS pubDate semantics; never-published drafts are excluded). These filters,--order, and--ascrequire backendv5.2.0+ — older backends silently ignore them and return unfiltered results, so verify the backend version before trusting filtered output. Example:manage list-articles --created-between "2024-01-01~2024-03-31" --created-between "2025-01-01~" --recommend-only --order publish-time --asc.
--floor-comment-idbehaves differently across commands. Inlist-commentsit is a real query filter that selects which floor's replies to page through. Insave-commentit is a no-op: the backend always recomputesfloorCommentIdfromparentCommentIdserver-side and only logs a warning if the client value disagrees. Omit it when replying — just pass--parent-comment-idand--parent-user-id.
Publish & Update Articles
Write the Markdown file first, then publish through the unified CLI. Inline _brief means no --brief-file is needed.
Brief self-check (required before running any
publish): confirm the brief contains ALL oftaskType,primaryGoal,targetAudience,publishIntent,reasoning,selectedAngle, andalternativesConsidered. The last one is a non-empty list of 1–3 rejected angles — omitting it fails validation. Include at least one rejected alternative even when the chosen direction is obviously best.
# article.md contains front matter with publishIntent: draft
poetize-blog.sh publish --markdown-file article.md --draft --wait
Publish flags reference
| Flag | Purpose | When to use |
|---|---|---|
--markdown-file <path> |
(required) Path to the Markdown file | Always |
--publish / --draft |
Assert public / draft visibility | Must match _brief.publishIntent |
--article-id <id> |
Update an existing article | Requires _brief.taskType: refresh_article |
--force |
Bypass only the required-H2 check | Intentionally sectionless body; H1 still invalid |
--allow-create-taxonomy / --allow-create-sort / --allow-create-label |
Auto-create missing category and/or tag | Explicitly confirmed taxonomy creation |
--cover-file <path> |
Local cover image path | Custom cover |
--payment-plugin-key <key> / --payment-config-file <path> |
Select/configure payment plugin | Paid articles only |
--require-paid |
Compatibility flag for strict paid mode | Paid checks already fail closed |
--brief-file <path> / --stdin-brief |
External article brief JSON | Separate strategy audit trail / piped heredoc JSON |
--print-payload |
Print payload without sending | Local debugging; may contain sensitive fields |
--wait(optional, async commands only). Default: do NOT add it — let the CLI return the task id, then poll yourself (manage task-status --task-id <id>for article tasks;manage list-translation-languages --article-id <id>for translation tasks). When added, the CLI blocks until completion or--timeout(default 900s);--poll-intervaldefaults to 2.0s.--waithas no effect on read-onlymanagecommands,config,smoke-test,eval,upload-image, orupdate-section --skip-ai-translation. True global flags (every command):--base-url,--api-key.
For an existing article, fetch it first and rebuild updated.md from the returned title/content. Set _brief.taskType: refresh_article and set publishIntent to the current visibility unless the user requested a change:
poetize-blog.sh manage get-article --article-id 123
poetize-blog.sh publish --markdown-file updated.md --article-id 123 --wait
Section-Level Editing & Translation Management
Full-article rewrites via publish --article-id are wasteful when you only need to fix a typo, update one section, or correct a translation. Two lighter-weight editing paths avoid regenerating the entire article:
Section-level content updates (manage update-section)
Edit a single section by heading instead of rewriting the whole Markdown file. The backend locates it case-insensitively outside code fences, saves the change, refreshes the summary, and schedules translation regeneration unless skipped.
Heading workflow:
- Run
manage get-articleimmediately before editing and treat returnedarticleContentas authoritative. - Article bodies must use H2-H6 only. For
replace, start the content file with the stored heading level; use--new-heading-level 2..6only when the user explicitly requests a hierarchy change. A level jump of more than 1 (e.g. H2→H4) triggers a warning but is not blocked. - For inserted/appended content, choose a level consistent with its intended position; new top-level sections use H2. H1 is always rejected.
- If a heading matches multiple sections, the error lists each match with a 1-based index (e.g.
#1: 第3行 (H2), #2: 第15行 (H2)). Re-run with--heading-index Nto select the Nth match. Section content files must not contain YAML front matter (---); front matter is only valid inpublish --markdown-file.
| Action | --heading |
--content-file |
Result |
|---|---|---|---|
replace |
required | required | Replace heading and body; preserve level unless --new-heading-level is explicit |
insert_after / insert_before |
required | required | Insert content around the matched section |
delete |
required | omitted | Remove the matched heading and body |
append |
omitted | required | Append content at article end |
poetize-blog.sh manage update-section --article-id 123 \
--heading "Installation" --action replace --content-file section.md \
--brief-file update-section-brief.json
Use an ops brief with taskType: update_section. --skip-ai-translation skips translation regeneration only; the summary still updates.
Section editing safety nets
- Dry-run (
--dry-run): ReturnsoriginalContent,updatedContent,originalSectionContent, and optionalwarningwithout persisting or triggering side effects. Always use it on the first edit of a session or when the heading is ambiguous. - Heading disambiguation (
--heading-index N): When multiple headings share the same text, the error response lists each match with a 1-based index. Out-of-range values return an error with the valid range. - Concurrency protection (CAS): The backend uses optimistic locking — it only writes if
articleContentis still the value it read. On conflict ("文章内容可能已被其他请求修改,请重试"), re-fetch withget-articleand retry. - Code fence safety: Headings inside fenced code blocks (
```or~~~) are never matched or counted as sections. - Response fields:
replace/deleteresponses includeoriginalSectionContent(the removed content). Awarningfield is included ifnewHeadingLeveljumps more than 1 level. Both are omitted forinsert/append.
Section edit recovery
- CAS conflict: Re-run
manage get-articleto get the latest content, then retry the section edit. - Wrong section edited: The
replace/deleteresponse includesoriginalSectionContent. To undo, write that content to a file and re-runupdate-section --action replace --content-file <original> --heading "<same heading>". This is a manual rollback — verify before re-applying. - Preview before applying: Always use
--dry-runfirst; it returns the full diff (originalContentvsupdatedContent) without side effects.
Translation management
For AI-translated articles, you can inspect, edit, delete, or regenerate translations without touching the original article content:
poetize-blog.sh manage save-translation --article-id 123 \
--language en --title "My Article" --content-file translated.md \
--brief-file update-translation-brief.json
When to use which editing path:
| Scenario | Recommended command |
|---|---|
| Full content rewrite or structural reorganization | publish --markdown-file <file> --article-id <id> |
| Fix one section, add a section, or delete a section | manage update-section |
| Correct a specific translation without re-running AI | manage save-translation |
| All translations are stale after major edits | manage regenerate-translation |
| Metadata-only update (viewStatus, password, tips, etc.) | manage update-article |
Mutating translation and section commands require
--stdin-brief(or--brief-file) with the matchingtaskType. Read-only commands (get-translation,list-translation-languages) do not need a brief. All commands in this section require backendv5.1.0+; on older backends the CLI returns an explicit version-mismatch error instead of a raw HTTP 404/500.
Failure Recovery & Safe Retry
For an asynchronous timeout or failure, avoid duplicate articles:
- Query
manage task-status --task-id <taskId>. If pending/running, keep polling; do not submit another create. - If the response contains
articleId, fetch that article before any write. Recover withpublish --article-id <id>usingtaskType: refresh_article; never retry as a new create. - Retry creation only after the task is terminally failed and
articleIdis absent, using the original create brief after correcting the cause. - If the created article must be taken down, use
hide-articlewithtaskType: hide_article.