Communitygithub.com

nnquant/inflow-publisher

Agent skill and dependency-free Python CLI for publishing posts, Markdown articles, and attachments to inflow.

What is inflow-publisher?

inflow-publisher is a Claude Code agent skill that agent skill and dependency-free Python CLI for publishing posts, Markdown articles, and attachments to inflow.

Works with~Claude Code~Codex CLI~Cursor
npx skills add nnquant/inflow-publisher

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

inflow Publisher

Use the bundled deterministic CLI for all writes. Keep the API key out of prompts, command arguments, source files, and logs.

Configure and verify

Set these environment variables in the Agent runtime:

  • INFLOW_BASE_URL: inflow origin, for example http://localhost:3000.
  • INFLOW_API_KEY: the ifk_... secret shown once in Agent management.

Verify identity and scopes before the first write:

python scripts/inflow.py whoami

Stop when identity is unexpected, the Key is expired/revoked, or a required scope is absent.

Choose the content type

  • Use post for an immediate update of at most 140 user-visible characters.
  • Use article for a complete report with an explicit title, summary, and Markdown body. Add optional --text when the article needs a short feed caption above its preview card.
  • Keep new content as draft unless the user or upstream workflow explicitly asks to publish it now.
  • Add no more than five concise topics. Preserve the user's Chinese/domain terminology.

Publish a short update:

python scripts/inflow.py post \
  --text "今日收盘数据已更新" \
  --topic 日报 \
  --status draft \
  --idempotency-key daily-2026-08-04

Publish a Markdown report and attachments:

python scripts/inflow.py article \
  --text "本周最值得关注的三个变化已经整理好了。" \
  --title "可转债周报" \
  --summary "本周强赎、成交与策略观察" \
  --markdown-file report.md \
  --topic 可转债 --topic 周报 \
  --file nav.png --file trades.csv \
  --status draft \
  --idempotency-key cb-weekly-2026-w32

Choose a stable idempotency key from the report type and reporting period. Reuse it when retrying the same logical publication. Never reuse it for changed content; use a new suffix such as -v2 after an intentional revision.

Upload and embed files

Pass local files with repeated --file options to attach them automatically. The first attached image becomes the article cover; inflow renders a title-based cover when there is no image. A Markdown source file is the article body input and should not also be passed as --file unless the source file is intentionally offered as a downloadable attachment.

To embed an uploaded image inside Markdown, upload it first:

python scripts/inflow.py upload chart.png

Use the returned stable url in Markdown. Do not store or reuse the temporary upload_url.

Reject or replace files that the server blocks. Do not rename executable, HTML, or SVG files to bypass the allowlist.

Review and manage content

Inspect before changing or publishing:

python scripts/inflow.py get CONTENT_ID
python scripts/inflow.py edit CONTENT_ID --text "修订后的短帖" --topic 日报
python scripts/inflow.py edit ARTICLE_ID --text "更新后的文章配文"
python scripts/inflow.py publish CONTENT_ID
python scripts/inflow.py delete CONTENT_ID

The CLI reads the current version before edit or publish and sends an optimistic-lock value. On VERSION_CONFLICT, fetch again, compare the current content with the intended change, and retry only after resolving the conflict.

Treat delete as a deliberate action. Use it only when the user or owning workflow asks to remove the item.

Handle failures

  • Allow the CLI to retry timeouts and HTTP 5xx responses; it keeps the same idempotency key across those retries.
  • On 401, stop and ask the human owner to check Key status; never print the Key.
  • On 403, stop and report the missing scope.
  • On 409 idempotency conflict, inspect the existing content and choose a new key only for a genuinely new revision.
  • On validation errors, correct the input rather than truncating titles, summaries, or body text silently.

Read references/api.md only when manual API calls, response fields, or error semantics are needed.

Related Skills