← 提示词库 Meta/muse-agent/skills/artifacts/presentation/references/editing.md 原文 md
🌐 中英双语对照

description: Editing an existing deck in place, from its artifact slug, without rebuilding from scratch.

Slide deck editing / 幻灯片文稿编辑

How to change a deck the user already has, in place, without rebuilding from scratch. You are
given the deck's <artifact-slug> and the change request; work on the existing deck at the
project_dir your build task names. That is ~/workspace/your_files/<artifact-slug>/ for an
ordinary deck, and the goal's own files/ directory for a goal document.

介绍如何就地修改用户已有的演示文稿(deck),而不从头重建。你会拿到文稿的 <artifact-slug> 和修改请求;请在构建任务指定的 project_dir 中处理现有文稿。普通文稿对应 ~/workspace/your_files/<artifact-slug>/,目标文档(goal document)则对应其自身的 files/ 目录。

Load first (always) / 首先加载(始终如此)

The deck's source is per-slide under .src/slides/ (workflow.md step 5). Read only what the
change needs:

文稿的源文件按幻灯片存放在 .src/slides/ 下(workflow.md 第 5 步)。只读取本次修改所需的内容:

On a deck with per-slide source, do not read or edit .src/index.html. It is assembled from
the files above, so reading it costs the whole deck's bytes to change one slide, and an edit there
is discarded by the next assemble. (A legacy deck has no per-slide source, so its index.html is
the only copy of the slides; the rebuild below reads it on purpose.)

对带按页源文件的文稿,不要读取或编辑 .src/index.html。它由上述文件组装而成,读取它意味着为改一张幻灯片付出整份文稿的字节代价,而且对它的修改会在下一次组装时被丢弃。(旧式文稿没有按页源文件,其 index.html 是幻灯片的唯一副本;下文的重建流程会刻意读取它。)

【评论】禁止读取组装产物是典型的上下文窗口成本控制:只操作页级源文件,避免整份文档的字节进入模型上下文。

A deck with no .src/slides/, or one whose .src/slides/ assemble refuses for a reason that
predates your edit
(most often a slide whose <section> id does not match its manifest id, which
the old splitter could produce), has no per-slide source you can edit in place: rebuild it in the current format through workflow.md, keeping the slug and carrying the
project's own material forward so it stays the same deck (deck_plan.md for the arc and slide
list, style_plan.json for the theme and layouts, not re-resolved, .src/media/ for imagery,
and the old index.html for each slide's content). Apply the requested change as part of the
rebuild and say the deck was rebuilt, since that re-authors slides the user did not ask about.
Everything below is for a deck that has per-slide source.

没有 .src/slides/ 的文稿,或其 .src/slides/ 组装因早于本次修改的原因而拒绝执行(最常见是某张幻灯片的 <section> id 与清单 id 不匹配——旧的切分器可能产生这种情况)的文稿,没有可就地编辑的按页源文件:请通过 workflow.md 以当前格式重建,保留 slug 并沿用项目自身素材,使其仍是同一份文稿(deck_plan.md 提供叙事主线与幻灯片清单,style_plan.json 提供主题与布局——不重新解析,.src/media/ 提供图像素材,旧 index.html 提供每页内容)。把请求的修改作为重建的一部分完成,并说明文稿经过了重建,因为重建会重新生成用户并未要求改动的幻灯片。下文所有内容都针对带按页源文件的文稿。

Never author a fresh deck from the brief on an edit; mutate the deck that already exists. When
you rewrite or add a slide body, author it per authoring.md + design-system.md (layout
classes, lockup grid, type scale) exactly as a fresh build, so it matches the surrounding deck.

编辑时绝不要根据简报从零新写一份文稿;只改动已存在的那份。当你重写或新增幻灯片正文时,按照 authoring.md + design-system.md(布局类、lockup 网格、字号阶梯)像全新构建一样撰写,使其与文稿整体风格一致。

Apply the change by intent / 按意图应用修改

Keep the theme unless asked / 除非被要求,否则保留主题

For a content edit (change, shorten, add), do not re-resolve the style plan or touch the
:root block: keep the deck's existing palette and fonts. Only a re-theme request changes the
theme. Silently restyling a content edit is a bug.

对内容类修改(修改、缩短、新增),不要重新解析样式方案,也不要碰 :root 块:保留文稿既有的调色板与字体。只有明确的换主题请求才更改主题。对内容修改暗中改变样式属于缺陷。

【评论】把"内容修改不得附带样式变化"明确判定为缺陷,是为了约束代理不放大用户意图,保证行为可预期。

Re-assemble, re-validate and re-export / 重新组装、重新校验并重新导出

Re-assemble first (workflow.md step 7). Your edit changed the deck's source, so
.src/index.html is stale until assemble_deck.mjs runs, and everything below reads that file:

先重新组装(workflow.md 第 7 步)。你的修改已改变文稿源文件,因此在 assemble_deck.mjs 运行之前 .src/index.html 是过期的,而下文所有步骤都会读取该文件:

SLUG="<artifact-slug>"
# `project_dir` comes from your build task. A goal document is built under
# that goal's `files/` directory, so a hardcoded `your_files` path is wrong.
# `project_dir` comes from your build task. Write its leading `~/` as
# `$JARVIS_HOME/`: the shell leaves a tilde literal inside quotes, so
# `"~/workspace/..."` builds into a directory literally named `~`.
SRC="$JARVIS_HOME/<project_dir from the build task, without its leading ~/>/.src"
bun run "/opt/hatch/skills/artifacts/scripts/embed_deck_fonts.mjs" --slides "$SRC/slides"
bun run "/opt/hatch/skills/artifacts/scripts/assemble_deck.mjs" \
  --slides "$SRC/slides" \
  --out "$SRC/index.html"

The embed step is a no-op unless the deck's fonts or characters changed, so it is cheap on a
content edit and it is what re-fonts a re-theme.

除非文稿的字体或字符发生变化,嵌入步骤是空操作,因此对内容修改而言代价很小;而换主题时正是靠它重新嵌入字体。

Then run the full workflow.md validation loop (steps 8-9) exactly as a fresh build — gate on the
render report (ok, fonts.missing, overflow), read every .src/validate PNG, up to 3
iterations; don't shortcut it to a single pass (a re-theme swaps fonts, so fonts.missing
matters). On every edit here, a re-theme included, drop --require-restraint from the step-8
commands: the probe reads every slide, including ones this edit must leave alone. Fix furniture,
uppercase, and tracking only on the slides you did edit. Drop --require-generated-imagery too,
unless this edit regenerated imagery: an existing sourced or chart-only deck has no sidecar to
satisfy it, so keeping the flag leaves a finished edit no legal move. workflow.md states the
rule. Mention the untouched slides only if you
actually saw those styles there; a deck built under the gate carries none. Each iteration edits the
slide source and re-assembles before re-rendering. Then
re-export only the formats the deck already has (from meta.json outputs) via workflow.md's
promote step (step 10) — not a hardcoded PPTX — and recompute meta.json per step 11. After a
structural edit (shorten/add), also sync the slide list in deck_plan.md and the layout_plan
entries in style_plan.json to the final deck — metadata only, leave the palette and fonts as
they are. The deck keeps its slug and its links.

然后像全新构建一样完整运行 workflow.md 校验循环(第 8-9 步)——以渲染报告(ok、fonts.missing、overflow)为门禁,逐张查看 .src/validate PNG,最多 3 轮迭代;不要捷径化为一轮了事(换主题会更换字体,因此 fonts.missing 很重要)。对这里的每一次编辑(包括换主题),都要从第 8 步命令中去掉 --require-restraint:该探针会读取每一张幻灯片,包括本次编辑必须保持不动的那些。只在你确实编辑过的幻灯片上修整装饰元素、大写与字距。--require-generated-imagery 同样去掉,除非本次编辑重新生成了图像:既有的取材型或纯图表文稿没有可满足该要求的 sidecar,保留该标志会让一次已完成的编辑无合规路径可走。workflow.md 中写明了此规则。只有当你确实在未改动幻灯片上看到那些样式问题时才提及它们;在该门禁下构建的文稿不会带有此类问题。每轮迭代都先编辑幻灯片源文件并重新组装,再重新渲染。然后仅重新导出文稿已有的格式(来自 meta.json 的 outputs),经由 workflow.md 的 promote 步骤(第 10 步)——而不是硬编码的 PPTX——并按第 11 步重算 meta.json。结构性编辑(缩短/新增)之后,还要把 deck_plan.md 中的幻灯片清单和 style_plan.json 中的 layout_plan 条目同步为最终文稿——仅更新元数据,调色板与字体保持不变。文稿保留其 slug 与链接。