feat(skill): add feishu-cli-html-box skill with animated-flowchart recipe#162
feat(skill): add feishu-cli-html-box skill with animated-flowchart recipe#162flyinghanger wants to merge 3 commits into
Conversation
…cipe Embed a self-contained single-file HTML into a Feishu Docx as an HTML Box widget (block_type=14 code block + block_type=40 add_ons widget with the HTML prefilled into add_ons.record). All API calls go through `feishu-cli api` under a single identity so the new doc and inserted blocks share an editable owner. Includes the animated-flowchart recipe: a zero-dependency generator that turns structured nodes/edges/timeline JSON into an auto-playing SVG topology HTML, plus pattern schema and a sample. - scripts/publish_html_box.py: general publisher (feishu-cli backend, --dry-run) - scripts/animate_diagram.py: animated-flowchart HTML generator - references/animated-flowchart.md, references/pattern-schema.md: recipe docs - examples/supervisor.json: sample multi-agent orchestration pattern - register the skill in README.md and CLAUDE.md skill lists Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79829f57dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| DOC=$(feishu-cli api POST /open-apis/docx/v1/documents --as user \ | ||
| --data '{"title":"我的 HTML Box"}' --jq '.data.document.document_id') |
There was a problem hiding this comment.
Strip JSON quotes from jq command substitutions
When someone follows this manual flow, DOC is assigned the JSON-rendered string including quotes because feishu-cli api --jq is routed through the JSON renderer in cmd/api.go rather than a raw-output mode. The next request path will therefore contain documents/"doc..."/blocks/... and fail; the same quoting issue applies to the later BLOCK=$(...) and BOX=$(...) examples, so these snippets need an explicit unquoting step or another way to emit raw scalar values.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch — confirmed and fixed in 317b3c6.
feishu-cli api --jq renders scalars as JSON (quoted), so DOC=$(... --jq '.data.document.document_id') yielded "token" and broke the next path. Appended | tr -d '"' to the DOC / BLOCK / BOX extractions and documented the gotcha. The bundled publish_html_box.py is unaffected (it parses the full response via json.loads, not --jq).
…l-box manual flow `feishu-cli api --jq` routes through the JSON renderer, so a scalar string result is emitted with surrounding quotes (e.g. "EnAw..."). The manual HTML Box flow assigned such values to shell vars and interpolated them into request paths, producing documents/"EnAw.../... and 404s. Append `| tr -d '"'` to the DOC / BLOCK / BOX extractions and document the gotcha. The bundled publish_html_box.py is unaffected — it parses the full response with json.loads rather than --jq. Addresses Codex review feedback on PR riba2534#162. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
新增
feishu-cli-html-box技能:把一份自包含的单文件 HTML 嵌入飞书云文档,渲染成 HTML Box(妙笔网页 / Magic Page)沙箱 iframe。block_type=14+code.style.language=24的 HTML 代码块,再插block_type=40+add_ons.component_type_id="blk_6900429af84180025ce76527"的 HTML Box widget,并把 HTML 直接预填进add_ons.record(渲染源),默认灌完删掉源代码块只留 iframe。feishu-cli api透传:建文档与插块用同一--as身份(默认user),避免建文档身份与插块身份不一致导致无编辑权限。nodes/edges/timelineJSON 转成自动播放的 SVG 拓扑动画 HTML(节点/连线高亮、消息 token 流动、进度点、固定浅色主题、响应式无内滚动条)。文件
scripts/publish_html_box.py:通用发布脚本(feishu-cli 后端,支持--dry-run/--keep-source/--doc-token/--as)。scripts/animate_diagram.py:animated-flowchart 生成器(pattern JSON → 自包含动画 HTML)。references/animated-flowchart.md+references/pattern-schema.md:recipe 工作流与输入 schema。examples/supervisor.json:多 Agent 编排动画示例。Test plan
python3 -m py_compile两个脚本通过animate_diagram.py --pattern examples/supervisor.json生成 22KB 自包含 HTML(<!doctype html>开头,无外部依赖)publish_html_box.py --dry-run输出三步调用顺序正确(建文档 → code block(14/lang=24) → html box(40, record 字符串化))go build通过,确认feishu-cli api与feishu-cli doc create命令存在feishu-cli auth login后跑publish_html_box.py --title ...验证文档内 HTML Box 正常渲染Made with Cursor