计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
medium【效率与协作】Read and publish on Medium (medium.com) with the user's own login cookies (BYOC) — list their posts with clap/response stats, inspect one post, and publish a new story. Use when the user mentions Medium, "my Medium posts", reading their post stats (claps/reads), or publishing a story to Medium.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Drives the user's real Medium account through the same internal web API the
site uses (Medium retired its public write API in 2023), authenticated by the
login cookie they captured with the ACE extension. No browser, no third-party
deps — just urllib.
The connector injects the cookie jar as an env var:
MEDIUM_COOKIES — a JSON array of cookies (sid, uid, xsrf). Secret —
never echo or print it. The CLI echoes the xsrf cookie as the
x-xsrf-token header on writes for you. If the captured jar has no xsrf
cookie (common), the CLI mints one automatically before writing, so publishes
no longer fail with "Missing xsrf token".The skill ships scripts/medium.py — self-contained, stdlib only.
# $SKILL_DIR can point at another skill loaded this turn — anchor on our own
# script, and re-run this at the top of every Bash block (fresh shell each time).
MED="$SKILL_DIR/scripts/medium.py"; [ -f "$MED" ] || MED=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/medium.py' 2>/dev/null | head -1)
[ -f "$MED" ] || { echo "medium script not found (SKILL_DIR=$SKILL_DIR)" >&2; exit 1; }
python3 "$MED" whoami # who is logged in
python3 "$MED" articles --limit 20 # my posts + clap/response stats
python3 "$MED" article <post-id> # one post's details
MED="$SKILL_DIR/scripts/medium.py"; [ -f "$MED" ] || MED=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/medium.py' 2>/dev/null | head -1)
python3 "$MED" whoami
# → {"user_id": "...", "name": "...", "username": "..."}
On an auth error the cookie is expired — have the user reconnect at https://studio.acedata.cloud/console/connectors. Do not loop-retry.
--confirm)publish writes to the user's real account. Content is Markdown (converted
to Medium paragraph blocks: #/##→heading, ###→sub-heading, >→quote,
```→code, -/*→bullet list, 1.→numbered list, tables→aligned
code block). Inline bold, italic, code, and [links](url) render as
real Medium formatting (clickable links included). Bare https://… URLs in text
are auto-linked too (URLs inside code spans are left untouched).
Without a trailing --confirm it dry-runs. --confirm is honored only as the
last argument. Always show the dry-run, get an explicit "yes", then re-run.
MED="$SKILL_DIR/scripts/medium.py"; [ -f "$MED" ] || MED=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/medium.py' 2>/dev/null | head -1)
python3 "$MED" publish --title "Title" --content-file a.md # dry-run
python3 "$MED" publish --title "Title" --content-file a.md --draft-only --confirm # private draft
python3 "$MED" publish --title "Title" --content-file a.md --confirm # PUBLIC story
Publishing is Medium's multi-step editor flow (new-story → write deltas →
publish). --draft-only stops at the draft (visible only at the user's
/me/stories/drafts). Default to --draft-only unless the user asked to go live.
publish automatically uploads each external markdown image () to
Medium and inserts it as a real image block — Medium has no markdown-image
syntax, so this is the only way images render. Pass --no-rehost-images to
degrade images to link-only paragraphs. An image that fails to upload falls back
to a link paragraph (never blocks the post).
header: value bullets.MEDIUM_COOKIES — it is full account access.After you successfully publish and obtain the live result URL, call the built-in
publish_artifact tool ONCE so the user can track this deliverable in My Outputs:
publish_artifact(kind="article", channel="medium", title="<title>", url="<the REAL returned URL>", status="delivered")
Use the real returned URL — never fabricate one. Call it once per published item,
only after delivery is confirmed; skip it (or use status="failed") if publishing failed.
See _shared/artifacts.md.