Skip to content

feat(skill): add feishu-cli-html-box skill with animated-flowchart recipe#162

Open
flyinghanger wants to merge 3 commits into
riba2534:mainfrom
flyinghanger:feat/html-box-skill
Open

feat(skill): add feishu-cli-html-box skill with animated-flowchart recipe#162
flyinghanger wants to merge 3 commits into
riba2534:mainfrom
flyinghanger:feat/html-box-skill

Conversation

@flyinghanger

@flyinghanger flyinghanger commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

新增 feishu-cli-html-box 技能:把一份自包含的单文件 HTML 嵌入飞书云文档,渲染成 HTML Box(妙笔网页 / Magic Page)沙箱 iframe。

image
  • 嵌入机制:先插 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),避免建文档身份与插块身份不一致导致无编辑权限。
  • 内置 recipe:animated-flowchart:零依赖生成器,把结构化 nodes/edges/timeline JSON 转成自动播放的 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 编排动画示例。
  • README.md / CLAUDE.md 技能清单登记。

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 apifeishu-cli doc create 命令存在
  • 隐私扫描:无内部域名 / 邮箱 / token
  • 真机:feishu-cli auth login 后跑 publish_html_box.py --title ... 验证文档内 HTML Box 正常渲染

Made with Cursor

…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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread skills/feishu-cli-html-box/SKILL.md Outdated
Comment on lines +75 to +76
DOC=$(feishu-cli api POST /open-apis/docx/v1/documents --as user \
--data '{"title":"我的 HTML Box"}' --jq '.data.document.document_id')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

flyinghanger and others added 2 commits June 5, 2026 10:04
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant