docs: document create-svglide shortcut

This commit is contained in:
songtianyi.theo
2026-07-09 02:46:38 +08:00
parent 7072a3259c
commit 48562e339c
2 changed files with 92 additions and 1 deletions

View File

@@ -15,7 +15,8 @@ metadata:
| 用户需求 | 优先动作 | 关键文档 / 命令 |
|----------|----------|-----------------|
| 新建 PPT | 先规划 `slide_plan.json`,再按复杂度选择一步或两步创建 | `planning-layer.md``visual-planning.md``asset-planning.md``slides +create` |
| 本地生成或校验 SVG Slides / SVGlide 产物 | 先读 `references/svg-slides/README.md`,生成 local publish-ready bundle发布层另走 `+create-svglide` 后续计划 | `references/svg-slides/README.md``scripts/validate_svg_deck.mjs``scripts/svg_slides_bundle.mjs` |
| 本地生成或校验 SVG Slides / SVGlide 产物 | 先读 `references/svg-slides/README.md`,生成 local publish-ready bundle已有 publish-ready manifest 时用 `slides +create-svglide` 发布 | `references/svg-slides/README.md``lark-slides-create-svglide.md``scripts/validate_svg_deck.mjs``scripts/svg_slides_bundle.mjs` |
| 发布已有 SVGlide manifest | 只做发布:读取 manifest、校验 receipt/hash/root、本地图片上传并改写 href然后逐页提交 raw SVG | `slides +create-svglide --manifest manifest.json --as user``lark-slides-create-svglide.md` |
| 已有 PPT 大幅改写 | 多页整页重建用 `+replace-pages`,单页局部编辑用 `+replace-slide` | `xml_presentations.get``lark-slides-replace-pages.md``lark-slides-edit-workflows.md` |
| 编辑单个标题、文本块、图片或局部元素 | 优先块级替换/插入,不改页序 | `slides +replace-slide``lark-slides-replace-slide.md` |
| 读取或分析已有 PPT | 解析 slides/wiki token回读全文或单页 XML保存 `xml_presentation_id``slide_id``revision_id` | `xml_presentations.get``xml_presentation.slide.get` |
@@ -79,6 +80,7 @@ lark-cli auth login --domain slides
按需再读:
- 创建:[`lark-slides-create.md`](references/lark-slides-create.md)
- 发布已有 SVGlide manifest[`lark-slides-create-svglide.md`](references/lark-slides-create-svglide.md)
- 编辑:[`lark-slides-edit-workflows.md`](references/lark-slides-edit-workflows.md)、[`lark-slides-replace-slide.md`](references/lark-slides-replace-slide.md)、[`lark-slides-replace-pages.md`](references/lark-slides-replace-pages.md)
- 截图:[`lark-slides-screenshot.md`](references/lark-slides-screenshot.md)
- 图片:[`lark-slides-media-upload.md`](references/lark-slides-media-upload.md)

View File

@@ -0,0 +1,89 @@
# slides +create-svglide
`slides +create-svglide` publishes an existing SVGlide bundle to Lark Slides.
It is a publisher, not a generator.
Use it only after the SVG Slides local generation/validation layer has produced a publish-ready manifest and page files.
## What It Owns
- Read `svglide.manifest.v1`.
- Validate `protocol == "svg-slides.v1"`, `publish_ready == true`, `receipts.validate_svg_deck.totalErrors == 0`, page order, page count, 960x540 size, local file paths, and `pages[].sha256`.
- Verify each page is still raw SVG by re-reading the file, checking sha256, checking the XML root with an XML decoder, and rejecting Slides XML/SXSD/HTML/raster/data URL fallback.
- Upload local SVG image resources and rewrite `<image href>` / `<image xlink:href>` values to Slides media `file_token`s before submitting each raw SVG page.
- Create the presentation shell.
- Submit each page payload in manifest order.
- Return `xml_presentation_id`, URL, slide IDs, page mapping, source/submitted page hashes, and image upload/rewrite receipts.
## What It Does Not Own
- Research, outline, or content planning.
- SVG/SVGlide authoring.
- Preview, visual QA, or repair loops.
- Readback as the default success criterion.
- PPE routing or Whistle setup.
- Remote image fetching, image generation, or FileMetaMap shaping.
## Manifest
Minimum shape:
```json
{
"version": "svglide.manifest.v1",
"protocol": "svg-slides.v1",
"title": "Deck title",
"size": { "width": 960, "height": 540 },
"publish_ready": true,
"published": false,
"pages": [
{ "id": "page-001", "index": 1, "file": "slides/page-001.svg", "sha256": "..." }
],
"receipts": {
"validate_svg_deck": "receipts/validate_svg_deck.json"
}
}
```
All page files and receipt paths are relative to the manifest directory. Absolute paths and `..` paths are rejected. Unknown manifest fields are ignored for forward compatibility. `published` is bundle state and is not used as a blocker by `+create-svglide`.
Local SVG image hrefs are resolved inside the manifest/run root, uploaded to the created presentation, and rewritten to returned media tokens before page submission. Remote URLs, data URLs, fragment hrefs, unresolved paths, `@path` placeholders, and paths escaping the root are rejected.
## Usage
Dry-run first:
```bash
lark-cli slides +create-svglide \
--as user \
--manifest manifest.json \
--dry-run
```
Publish:
```bash
lark-cli slides +create-svglide \
--as user \
--manifest manifest.json \
--title "Optional title override"
```
Expected output includes:
- `xml_presentation_id`
- `url`
- `slides_added`
- `slide_ids`
- `pages[].source_sha256`
- `pages[].submitted_sha256`
- `images_uploaded`
- `image_rewrites`
## Failure Handling
The command validates local bundle state and local image paths before creating the presentation. If image upload fails after presentation creation, the error hint includes the created presentation ID and says no pages were added.
If adding a later page fails, the command does not roll back the created presentation. The error hint includes presentation ID, failed page ordinal, page ID, and the number of pages already added.
If the backend rejects raw SVG in `slide.content`, stop. Do not fall back to screenshots, HTML, generated XML, or rasterized pages inside this shortcut.