@cyber-dash-tech/revela 0.8.8 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,8 +20,8 @@ Enable it for the current session, assign a presentation task, and the agent can
20
20
  - injects a presentation-specific system prompt into your current agent with `/revela enable`
21
21
  - builds that prompt from 3 layers: core skill, active domain, active design
22
22
  - supports workspace document discovery, transparent text extraction for `.pdf`, `.docx`, `.pptx`, and `.xlsx`, and cached embedded-material extraction for those formats
23
- - uses workspace `DECKS.json` as machine-readable deck memory, slide spec, and prewrite readiness state
24
- - blocks premature writes to `decks/*.html` until the active deck is marked structurally ready
23
+ - keeps track of deck context, slide structure, sources, and readiness across the current workspace
24
+ - checks for missing context, weak evidence, and incomplete structure before writing `decks/*.html`
25
25
  - runs fast design compliance checks whenever the agent writes, patches, or edits `decks/*.html`
26
26
  - opens a visual comment editor for existing decks so users can Ctrl/Cmd-click elements and send precise edit requests back to OpenCode
27
27
  - exports finished decks to PDF and editable PPTX
@@ -89,7 +89,7 @@ Enable Revela in the current session:
89
89
  /revela enable
90
90
  ```
91
91
 
92
- Initialize workspace deck memory when starting in a new project:
92
+ Prepare the workspace when starting a new deck project:
93
93
 
94
94
  ```text
95
95
  /revela init
@@ -109,7 +109,7 @@ Then give the agent a deck task:
109
109
  Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main market drivers, use the active design faithfully, and save the result to decks/humanoid-robotics.html.
110
110
  ```
111
111
 
112
- Before the agent writes `decks/humanoid-robotics.html`, it must update `DECKS.json` through the `revela-decks` tool with the active deck, confirmed slide specs, layouts, components, and computed `writeReadiness.status: ready`. You can ask for an explicit readiness check at any time:
112
+ If the task depends on sources, research, or a confirmed slide plan, you can ask Revela to review whether the deck has enough context, structure, and evidence before writing:
113
113
 
114
114
  ```text
115
115
  /revela review
@@ -137,8 +137,8 @@ Disable presentation mode when done:
137
137
  /revela enable enable presentation mode for this session
138
138
  /revela disable disable presentation mode
139
139
 
140
- /revela init initialize or refresh workspace DECKS.json
141
- /revela review review current deck readiness before writing HTML
140
+ /revela init prepare the workspace for a deck project
141
+ /revela review check whether context, structure, and evidence are ready
142
142
  /revela remember <text> save an explicit user/workflow preference
143
143
  /revela edit open visual editor for the only deck in decks/
144
144
 
@@ -178,59 +178,22 @@ The enabled or disabled state is session-level only.
178
178
 
179
179
  ---
180
180
 
181
- ## DECKS.json Memory And Readiness Gate
181
+ ## Recommended Workflow
182
182
 
183
- Revela uses a workspace-root `DECKS.json` file for cross-session continuity and deck production control. It is intended for tools and the LLM, not manual editing.
183
+ Use Revela as a guided deck-production mode:
184
184
 
185
- It has two jobs:
185
+ 1. Enable Revela with `/revela enable`.
186
+ 2. Run `/revela init` when starting in a new project or when the workspace has changed significantly.
187
+ 3. Choose a design or domain if the default style is not right.
188
+ 4. Give the agent a clear deck task: audience, goal, language, number of slides, source requirements, and output path.
189
+ 5. Use `/revela review` before writing if the deck needs research, citations, or a confirmed slide plan.
190
+ 6. Let the agent write the HTML deck under `decks/`.
191
+ 7. Use `/revela edit` for visual comments and targeted revisions.
192
+ 8. Export with `/revela pdf <file>` or `/revela pptx <file>`.
186
193
 
187
- - workspace memory: stable project context, source materials, explicit user preferences, deck history, and open questions
188
- - active deck spec: current deck output path, prerequisites, research plan, per-slide content, layouts, components, evidence, visuals, blockers, and write readiness
194
+ `/revela review` checks for practical readiness problems: unclear audience, missing source material, unfinished research, unsupported claims, weak source trace, incomplete slide structure, missing design/layout information, or lightweight narrative issues such as weak so-what, missing risk/assumption handling, and abrupt transitions. It does not write the final deck.
189
195
 
190
- `DECKS.json` is the source of truth for workspace memory and deck readiness.
191
-
192
- Create or refresh it with:
193
-
194
- ```text
195
- /revela init
196
- ```
197
-
198
- Review the current deck state with:
199
-
200
- ```text
201
- /revela review
202
- ```
203
-
204
- `/revela review` does not write the final HTML deck. It reads and updates `DECKS.json` through the `revela-decks` tool, checks what is missing, and sets `writeReadiness.status` to `ready` only when the deck is ready to generate.
205
-
206
- Minimum readiness conditions:
207
-
208
- - topic, audience, language, visual style/design, and slide plan are decided
209
- - source materials are identified or explicitly deemed unnecessary
210
- - research need is assessed
211
- - needed research findings have been read and reflected in the slide specs
212
- - evidence-sensitive claims have slide-level evidence with useful source trace when available, such as `findingsFile`, `sourcePath`, `location`, `quote`, `url`, or `caveat`
213
- - the user has confirmed the slide plan
214
- - required design layouts and components have been fetched
215
- - every slide has a title, layout, components, and structured content
216
- - no blockers remain
217
-
218
- The plugin enforces this before deck HTML is written. A write or patch touching `decks/*.html` is allowed only when the matching deck in `DECKS.json` passes the readiness gate. Direct writes or patches to `DECKS.json` are blocked; use `revela-decks` instead.
219
-
220
- The gate checks:
221
-
222
- - `writeReadiness.status` is `ready`
223
- - `writeReadiness.blockers` is empty
224
- - the deck `outputPath` exactly matches the target `decks/*.html` path
225
- - all `requiredInputs` booleans are true
226
- - every slide has title, layout, components, and structured content
227
- - every needed research axis is `done`, `read`, or `skipped`
228
-
229
- `/revela review` distinguishes missing evidence from weak source-only evidence. A claim with no evidence remains a blocker; evidence that only names a source is reported as a warning so the agent can add source trace before writing the deck.
230
-
231
- If the gate blocks a write, Revela writes a marker file under `.opencode/revela/blocked-writes/` instead of creating or overwriting the deck HTML. This makes the failure visible to the agent while keeping the real deck file untouched.
232
-
233
- For `apply_patch`, Revela only checks whether the patch touches `decks/*.html`. If not ready, the whole patch is replaced with a blocked marker patch. The `edit` tool is not gated.
196
+ If Revela blocks a deck write, ask the agent to run `/revela review`, resolve the reported gaps, and try again. This protects the deck file from being overwritten before the plan, evidence, and structure are ready.
234
197
 
235
198
  To remember long-term preferences, use:
236
199
 
@@ -238,7 +201,7 @@ To remember long-term preferences, use:
238
201
  /revela remember Prefer concise Chinese consulting-style decks.
239
202
  ```
240
203
 
241
- Do not use `remember` for temporary checklist state; temporary state belongs in the active deck spec in `DECKS.json`.
204
+ Do not use `remember` for temporary checklist state; use it only for durable user or workflow preferences.
242
205
 
243
206
  ---
244
207
 
@@ -607,7 +570,7 @@ The editor opens in your browser. Use `Ctrl`/`Cmd` + click to reference deck ele
607
570
 
608
571
  LLM tool equivalent: `revela-edit` with no target. This lets the agent open the same editor when you say things like “I want to edit the deck”.
609
572
 
610
- `/revela edit` prepares minimal `DECKS.json` state for the existing HTML deck if needed, so the normal deck write gate can still protect `decks/*.html` while allowing targeted edits.
573
+ For existing decks, `/revela edit` prepares whatever minimal project context is needed so targeted edits can still use the normal safety checks.
611
574
 
612
575
  ---
613
576
 
package/README.zh-CN.md CHANGED
@@ -20,8 +20,8 @@ Revela 是一个 [OpenCode](https://opencode.ai) 插件,可以把你当前使
20
20
  - 通过 `/revela enable` 向当前 agent 注入演示文稿专用 system prompt
21
21
  - prompt 由 3 层组成:核心 skill、当前 domain、当前 design
22
22
  - 支持工作区文档扫描,以及 `.pdf`、`.docx`、`.pptx`、`.xlsx` 的透明文本提取和嵌入素材缓存提取
23
- - 使用工作区 `DECKS.json` 保存机器可读的 deck 记忆、逐页规格和写入前 readiness 状态
24
- - active deck 结构化 ready 前,阻止过早写入 `decks/*.html`
23
+ - 在当前工作区持续跟踪 deck 背景、页面结构、来源材料和 readiness
24
+ - 写入 `decks/*.html` 前检查是否缺上下文、证据或结构
25
25
  - agent 每次写入、patch 或 edit `decks/*.html` 时自动执行快速 design compliance 检查
26
26
  - 为已有 deck 打开可视化评论编辑器,用户可以 Ctrl/Cmd + 点击元素,并把精确修改意见发回 OpenCode
27
27
  - 支持导出成 PDF 和可编辑 PPTX
@@ -88,7 +88,7 @@ export { default } from "/absolute/path/to/revela/index.ts";
88
88
  /revela enable
89
89
  ```
90
90
 
91
- 在新项目里可以先初始化工作区 deck 状态:
91
+ 在新项目里可以先准备工作区:
92
92
 
93
93
  ```text
94
94
  /revela init
@@ -108,7 +108,7 @@ export { default } from "/absolute/path/to/revela/index.ts";
108
108
  Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main market drivers, use the active design faithfully, and save the result to decks/humanoid-robotics.html.
109
109
  ```
110
110
 
111
- agent 写入 `decks/humanoid-robotics.html` 之前,它必须通过 `revela-decks` 工具更新 `DECKS.json`:记录 active deck、已确认的逐页规格、layout、component,并由工具计算出 `writeReadiness.status: ready`。你也可以随时显式触发 readiness 检查:
111
+ 如果任务依赖来源材料、调研或已确认的 slide plan,可以先让 Revela 检查上下文、结构和证据是否足够:
112
112
 
113
113
  ```text
114
114
  /revela review
@@ -136,8 +136,8 @@ Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main mar
136
136
  /revela enable 为当前会话启用演示文稿模式
137
137
  /revela disable 关闭演示文稿模式
138
138
 
139
- /revela init 初始化或刷新工作区 DECKS.json
140
- /revela review HTML 前检查当前 deck readiness
139
+ /revela init 为当前 deck 项目准备工作区
140
+ /revela review 检查上下文、结构和证据是否 ready
141
141
  /revela remember <text> 保存明确的用户/工作流偏好
142
142
  /revela edit 打开 decks/ 下唯一 deck 的可视化编辑器
143
143
 
@@ -177,59 +177,22 @@ Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main mar
177
177
 
178
178
  ---
179
179
 
180
- ## DECKS.json 记忆与写入门禁
180
+ ## 推荐使用流程
181
181
 
182
- Revela 使用工作区根目录的 `DECKS.json` 做跨会话记忆和 deck 生产控制。它主要给工具和 LLM 使用,不建议人工直接编辑。
182
+ Revela 当成一个有检查环节的 deck 生产模式:
183
183
 
184
- 它有两个职责:
184
+ 1. 用 `/revela enable` 启用 Revela。
185
+ 2. 新项目或工作区明显变化时,运行 `/revela init`。
186
+ 3. 如果默认风格不合适,先选择 design 或 domain。
187
+ 4. 给 agent 一个清楚的 deck 任务:受众、目标、语言、页数、来源要求和输出路径。
188
+ 5. 如果 deck 需要调研、引用或已确认的 slide plan,写作前先运行 `/revela review`。
189
+ 6. 让 agent 把 HTML deck 写到 `decks/` 下。
190
+ 7. 用 `/revela edit` 做可视化评论和精准修改。
191
+ 8. 用 `/revela pdf <file>` 或 `/revela pptx <file>` 导出。
185
192
 
186
- - 工作区记忆:稳定项目背景、源材料、明确用户偏好、历史 deck 和开放问题
187
- - active deck 规格:当前 deck 输出路径、前置条件、research plan、逐页内容、layout、component、证据、视觉需求、blocker 和 write readiness
193
+ `/revela review` 检查的是实际生产问题:受众是否清楚、是否缺来源材料、调研是否完成、关键 claim 是否有证据、source trace 是否太弱、页面结构是否完整、design/layout 信息是否齐全,以及轻量叙事问题,例如 so-what 不清晰、缺少风险/假设处理或转场突兀。它不会写最终 deck
188
194
 
189
- `DECKS.json` 是工作区记忆和 deck readiness source of truth。
190
-
191
- 创建或刷新:
192
-
193
- ```text
194
- /revela init
195
- ```
196
-
197
- 检查当前 deck 状态:
198
-
199
- ```text
200
- /revela review
201
- ```
202
-
203
- `/revela review` 不会写最终 HTML deck。它通过 `revela-decks` 工具读取并更新 `DECKS.json`,检查缺失项,并且只有在 deck 真的可以生成时才把 `writeReadiness.status` 设为 `ready`。
204
-
205
- 最小 readiness 条件:
206
-
207
- - topic、audience、language、visual style/design 和 slide plan 已确定
208
- - source materials 已识别,或明确不需要源材料
209
- - research need 已评估
210
- - 需要调研时,相关 findings 已读取并反映到逐页规格中
211
- - evidence-sensitive claim 尽量带有逐页 evidence 和可用 source trace,例如 `findingsFile`、`sourcePath`、`location`、`quote`、`url` 或 `caveat`
212
- - 用户已确认 slide plan
213
- - 需要的 design layouts 和 components 已获取
214
- - 每页都有 title、layout、components 和结构化 content
215
- - 没有 unresolved blockers
216
-
217
- 插件会在写 deck HTML 前强制检查这些条件。任何触碰 `decks/*.html` 的 `write` 或 `apply_patch`,只有在 `DECKS.json` 里匹配的 deck 通过 readiness gate 后才允许执行。直接写入或 patch `DECKS.json` 会被阻止;必须使用 `revela-decks` 工具更新状态。
218
-
219
- 门禁会检查:
220
-
221
- - `writeReadiness.status` 是 `ready`
222
- - `writeReadiness.blockers` 为空
223
- - deck `outputPath` 精确匹配目标 `decks/*.html` 路径
224
- - 所有 `requiredInputs` 布尔值都是 true
225
- - 每页都有 title、layout、components 和结构化 content
226
- - 每个 needed research axis 都是 `done`、`read` 或 `skipped`
227
-
228
- `/revela review` 会区分缺失 evidence 和较弱的 source-only evidence。完全没有 evidence 的 claim 仍是 blocker;只写了 source 名称但缺少 source trace 的 evidence 会作为 warning 报告,方便 agent 在写 deck 前补足溯源信息。
229
-
230
- 如果门禁阻止写入,Revela 会在 `.opencode/revela/blocked-writes/` 下写一个 marker 文件,而不是创建或覆盖真实 HTML deck。这样 agent 能看到失败原因,同时真实 deck 文件不会被污染。
231
-
232
- 对 `apply_patch`,Revela 只检查 patch 是否触碰 `decks/*.html`。如果未 ready,整个 patch 会被替换成 blocked marker patch。`edit` 工具不做门禁。
195
+ 如果 Revela 阻止写入 deck,直接让 agent 运行 `/revela review`,根据报告补齐缺口后再写。这样可以避免在计划、证据或结构还不完整时覆盖真实 deck 文件。
233
196
 
234
197
  记住长期偏好请使用:
235
198
 
@@ -237,7 +200,7 @@ Revela 使用工作区根目录的 `DECKS.json` 做跨会话记忆和 deck 生
237
200
  /revela remember 我偏好中文、咨询风格、每页只表达一个核心观点。
238
201
  ```
239
202
 
240
- 不要用 `remember` 保存临时 checklist 状态;临时状态应该保存在 `DECKS.json` 的 active deck spec 中。
203
+ 不要用 `remember` 保存临时 checklist 状态;它只适合保存长期用户偏好或工作流偏好。
241
204
 
242
205
  ---
243
206
 
@@ -572,7 +535,7 @@ Revela 0.8 中 `/revela edit` 不接受 target。如果 `decks/` 下正好有一
572
535
 
573
536
  对应的 LLM tool:`revela-edit`,不需要 target。因此当你说“我要编辑这个 deck”时,agent 也可以主动打开同一个编辑器。
574
537
 
575
- 如果已有 HTML deck 缺少 `DECKS.json` 状态,`/revela edit` 会自动准备最小 deck state,让正常的 `decks/*.html` 写入门禁仍然生效,同时允许后续精准修改。
538
+ 对于已有 HTML deck,`/revela edit` 会自动准备必要的最小项目上下文,让后续精准修改仍然经过正常安全检查。
576
539
 
577
540
  ---
578
541
 
@@ -18,7 +18,7 @@ Goal:
18
18
  - Preserve the deck spec for future sessions: every slide's content, layout, components, evidence, visuals, and production status.
19
19
  - Do not write, patch, or directly edit ${DECKS_STATE_FILE}. Use the \`revela-decks\` tool for all state changes.
20
20
  - Let \`revela-decks\` action \`review\` compute writeReadiness; do not manually set readiness to ready.
21
- - Treat this as an evidence-readiness review, not only a checklist review: unsupported numbers, market sizing, recommendations, competitor comparisons, technical assertions, or investment conclusions should be made visible before writing.
21
+ - Treat this as an evidence and lightweight narrative readiness review, not only a checklist review: unsupported numbers, market sizing, recommendations, competitor comparisons, technical assertions, investment conclusions, weak so-what, missing risk/assumption handling, or abrupt narrative transitions should be made visible before writing.
22
22
  - Treat source trace mapping as part of evidence readiness: when research findings have been read, relevant findings should appear in slide-level \`slides[].evidence[]\` records rather than only in raw research files.
23
23
 
24
24
  Current state:
@@ -35,12 +35,12 @@ Workflow:
35
35
  1. Call \`revela-decks\` with action \`read\` for the current workspace deck.
36
36
  2. If no current deck exists but the conversation contains enough deck context, call \`revela-decks\` action \`upsertDeck\` with goal, outputPath, theme, requiredInputs, and researchPlan. Do not invent or ask for a deck key; the tool uses the workspace folder name internally.
37
37
  3. If \`researchPlan[].status\` is \`done\` or \`read\` and \`researchPlan[].findingsFile\` exists, verify that evidence-sensitive slide claims are backed by compact \`slides[].evidence[]\` records that reference the relevant findings file or source material where known.
38
- 4. If a user-confirmed slide plan is available, call \`revela-decks\` action \`upsertSlides\` with every slide's title, purpose, layout, components, structured content, evidence, visuals, and status.
38
+ 4. If a user-confirmed slide plan is available, call \`revela-decks\` action \`upsertSlides\` with every slide's title, purpose, narrativeRole, layout, components, structured content, evidence, visuals, and status. Use only lightweight narrativeRole values that are clear from the plan: \`context\`, \`tension\`, \`evidence\`, \`recommendation\`, \`risk\`, \`ask\`, \`appendix\`, or \`close\`.
39
39
  5. Prefer evidence records with \`findingsFile\`, \`sourcePath\`, \`location\`, \`quote\`, \`url\`, \`caveat\`, \`extractedTextPath\`, or \`extractedManifestPath\` when those fields are known from research files or extracted workspace materials.
40
40
  6. Do not invent quotes, page references, locations, URLs, caveats, or extraction paths. If source trace is missing, preserve the blocker or warning and report exactly what trace is needed.
41
41
  7. Only set requiredInputs fields true when explicit conversation state, files read, research findings read, selected design, fetched layouts/components, or user confirmation supports them. Do not infer completion.
42
42
  8. Call \`revela-decks\` action \`review\`. The tool computes and writes \`writeReadiness\` plus structured readiness issues for the current workspace deck.
43
- 9. Briefly report whether the deck is ready. If blocked, list the exact blockers returned by the tool. If warnings exist, list them after blockers as residual risks.
43
+ 9. Briefly report whether the deck is ready. If blocked, list the exact blockers returned by the tool. If warnings exist, list them after blockers as residual risks; separate evidence/source warnings from narrative warnings when possible.
44
44
 
45
45
  Minimum conditions for \`ready\`:
46
46
  - Topic, audience, slide count, language, and visual style/design are decided.
@@ -51,6 +51,7 @@ Minimum conditions for \`ready\`:
51
51
  - The user has confirmed the slide plan.
52
52
  - ${DECKS_STATE_FILE} contains per-slide specs with content, layout, components, and evidence where applicable.
53
53
  - Evidence-sensitive slide claims have compact evidence references with source trace where available. Numeric claims and strong recommendations should not be unsupported or source-only when trace exists.
54
+ - Multi-slide decision decks have a practical narrative flow: context/tension before evidence, recommendations after support, risk or assumption handling when recommending action, and a clear so-what or ask at the end. Narrative gaps are normally warnings, not hard blockers.
54
55
  - The needed design layouts and components have been fetched with \`revela-designs read\`.
55
56
  - No unresolved blockers remain.
56
57
 
@@ -58,6 +59,7 @@ Report format:
58
59
  - Start with \`Ready: yes/no\`.
59
60
  - If blocked, list each blocker with slide index/title when the tool provides it, the issue type, and the suggested next action.
60
61
  - If warnings exist but the deck is otherwise ready, say the deck can be written but note the residual risks.
62
+ - Report \`narrative_gap\` warnings as story-structure risks such as weak so-what, missing risk/assumption handling, conclusion before support, missing audience framing, or abrupt transition.
61
63
  - Do not invent evidence or silently downgrade blockers. Use the tool result as authoritative.
62
64
  - When reporting weak evidence, say whether the missing trace is \`findingsFile\`, \`sourcePath\`, \`location\`, \`quote\`, \`url\`, or \`caveat\` if that is clear from the reviewed materials.
63
65
 
@@ -6,6 +6,7 @@ export const DECKS_STATE_FILE = "DECKS.json"
6
6
  export type DeckProductionStatus = "planning" | "blocked" | "ready" | "written"
7
7
  export type SlideProductionStatus = "planned" | "ready" | "written" | "qa_passed" | "qa_failed"
8
8
  export type WriteReadinessStatus = "blocked" | "ready" | "written"
9
+ export type NarrativeRole = "context" | "tension" | "evidence" | "recommendation" | "risk" | "ask" | "appendix" | "close"
9
10
 
10
11
  export interface DecksState {
11
12
  version: 1
@@ -96,6 +97,7 @@ export interface SlideSpec {
96
97
  index: number
97
98
  title: string
98
99
  purpose?: string
100
+ narrativeRole?: NarrativeRole
99
101
  layout: string
100
102
  qa?: boolean
101
103
  components: string[]
@@ -159,6 +161,7 @@ export type ReadinessIssueType =
159
161
  | "missing_evidence"
160
162
  | "weak_evidence"
161
163
  | "source_not_processed"
164
+ | "narrative_gap"
162
165
 
163
166
  export interface ReadinessIssue {
164
167
  type: ReadinessIssueType
@@ -580,6 +583,8 @@ function computeDeckReadinessIssues(deck: DeckSpec, workspace: DecksState["works
580
583
  }
581
584
  }
582
585
 
586
+ issues.push(...computeNarrativeReadinessIssues(deck))
587
+
583
588
  for (const axis of deck.researchPlan) {
584
589
  if (axis.needed && axis.status !== "done" && axis.status !== "read" && axis.status !== "skipped") {
585
590
  issues.push(blockerIssue(
@@ -612,6 +617,89 @@ function computeDeckReadinessIssues(deck: DeckSpec, workspace: DecksState["works
612
617
  return issues
613
618
  }
614
619
 
620
+ function computeNarrativeReadinessIssues(deck: DeckSpec): ReadinessIssue[] {
621
+ const issues: ReadinessIssue[] = []
622
+ const slides = deck.slides.filter((slide) => slide.index > 0).sort((a, b) => a.index - b.index)
623
+ if (slides.length === 0) return issues
624
+
625
+ if (slides.length >= 4 && slides.every((slide) => !slide.narrativeRole)) {
626
+ issues.push(warningIssue(
627
+ "narrative_gap",
628
+ "No slide narrativeRole values are recorded for a multi-slide deck",
629
+ "Add lightweight narrativeRole values such as context, tension, evidence, recommendation, risk, ask, appendix, or close to improve story-structure review.",
630
+ ))
631
+ }
632
+
633
+ if (slides.length >= 4 && deck.audience?.trim() && slides.every(hasWeakNarrativePurpose)) {
634
+ issues.push(warningIssue(
635
+ "narrative_gap",
636
+ `Slide purposes do not clearly frame the story for the audience: ${deck.audience}`,
637
+ "Rewrite slide purpose fields to explain what this audience should understand, believe, decide, or do after each slide.",
638
+ ))
639
+ }
640
+
641
+ const firstRecommendationIndex = slides.findIndex(isRecommendationSlide)
642
+ if (firstRecommendationIndex >= 0) {
643
+ const recommendation = slides[firstRecommendationIndex]
644
+ const priorSlides = slides.slice(0, firstRecommendationIndex)
645
+ const earlyBoundary = Math.max(1, Math.ceil(slides.length * 0.3))
646
+ if (firstRecommendationIndex < earlyBoundary && !priorSlides.some(hasEvidenceOrTensionRole)) {
647
+ issues.push(warningIssue(
648
+ "narrative_gap",
649
+ `Slide ${recommendation.index} presents a recommendation before context, tension, or evidence has been established`,
650
+ "Consider moving the recommendation later or adding preceding context, tension, or evidence slides so the conclusion does not arrive before support.",
651
+ { slideIndex: recommendation.index, slideTitle: recommendation.title },
652
+ ))
653
+ }
654
+
655
+ if (!slides.some(hasRiskOrAssumptionHandling)) {
656
+ issues.push(warningIssue(
657
+ "narrative_gap",
658
+ "Recommendation has no visible risk, assumption, caveat, or tradeoff handling",
659
+ "Add a risk/assumption/tradeoff slide or make the relevant caveats explicit before writing a decision-oriented recommendation deck.",
660
+ { slideIndex: recommendation.index, slideTitle: recommendation.title },
661
+ ))
662
+ }
663
+ }
664
+
665
+ if (slides.length >= 4 && !hasClearEnding(slides)) {
666
+ const last = slides[slides.length - 1]
667
+ issues.push(warningIssue(
668
+ "narrative_gap",
669
+ "Deck may end without a clear so-what, ask, or closing takeaway",
670
+ "Use the final slide or final section to state the decision, action request, recommendation, or closing takeaway explicitly.",
671
+ { slideIndex: last.index, slideTitle: last.title },
672
+ ))
673
+ }
674
+
675
+ const firstAskIndex = slides.findIndex(isAskSlide)
676
+ if (firstAskIndex === 0 && slides.length > 2) {
677
+ const ask = slides[firstAskIndex]
678
+ issues.push(warningIssue(
679
+ "narrative_gap",
680
+ `Slide ${ask.index} asks for action before the deck has established the case`,
681
+ "Consider moving the ask later or opening with context before requesting a decision or action.",
682
+ { slideIndex: ask.index, slideTitle: ask.title },
683
+ ))
684
+ } else if (firstAskIndex > 0) {
685
+ const contextIndex = slides.findIndex((slide) => slide.narrativeRole === "context")
686
+ if (contextIndex >= 0 && contextIndex < firstAskIndex) {
687
+ const bridgeSlides = slides.slice(contextIndex + 1, firstAskIndex)
688
+ if (!bridgeSlides.some((slide) => hasEvidenceOrTensionRole(slide) || isRecommendationSlide(slide))) {
689
+ const ask = slides[firstAskIndex]
690
+ issues.push(warningIssue(
691
+ "narrative_gap",
692
+ `Slide ${ask.index} jumps from context to ask without evidence, tension, or recommendation in between`,
693
+ "Add an evidence, tension, or recommendation bridge before the ask so the narrative transition is easier to follow.",
694
+ { slideIndex: ask.index, slideTitle: ask.title },
695
+ ))
696
+ }
697
+ }
698
+ }
699
+
700
+ return issues
701
+ }
702
+
615
703
  function blockerIssue(type: ReadinessIssueType, message: string, suggestedAction: string, extra: Partial<ReadinessIssue> = {}): ReadinessIssue {
616
704
  return { type, severity: "blocker", message, suggestedAction, ...extra }
617
705
  }
@@ -634,6 +722,46 @@ function findEvidenceSensitiveClaim(slide: SlideSpec): string | undefined {
634
722
  return candidates.find(isEvidenceSensitiveClaim)
635
723
  }
636
724
 
725
+ function isRecommendationSlide(slide: SlideSpec): boolean {
726
+ return slide.narrativeRole === "recommendation" || /\b(recommend(?:ation|ed)?|should|must|go\/?no-go)\b|建议|必须/.test(slideSearchText(slide))
727
+ }
728
+
729
+ function isAskSlide(slide: SlideSpec): boolean {
730
+ return slide.narrativeRole === "ask" || /\b(ask|decision|approve|approval|next step|action required|call to action)\b|请求|决策|批准|下一步|行动/.test(slideSearchText(slide))
731
+ }
732
+
733
+ function hasEvidenceOrTensionRole(slide: SlideSpec): boolean {
734
+ return slide.narrativeRole === "evidence" || slide.narrativeRole === "tension"
735
+ }
736
+
737
+ function hasRiskOrAssumptionHandling(slide: SlideSpec): boolean {
738
+ return slide.narrativeRole === "risk" || /\b(risk|assumption|caveat|trade-?off|constraint|limitation|uncertainty)\b|风险|假设|取舍|限制|不确定|前提/.test(slideSearchText(slide))
739
+ }
740
+
741
+ function hasWeakNarrativePurpose(slide: SlideSpec): boolean {
742
+ const purpose = slide.purpose?.trim().toLowerCase()
743
+ if (!purpose) return true
744
+ return /^(explain|show|introduce|present|describe|overview|clarify)\b/.test(purpose) || /^(说明|展示|介绍|呈现|概述)/.test(purpose)
745
+ }
746
+
747
+ function hasClearEnding(slides: SlideSpec[]): boolean {
748
+ const finalSlides = slides.slice(-2)
749
+ return finalSlides.some((slide) => slide.narrativeRole === "recommendation" || slide.narrativeRole === "ask" || slide.narrativeRole === "close" || /\b(so what|takeaway|recommend(?:ation)?|decision|ask|next step|conclusion|close)\b|结论|建议|决策|请求|下一步|收尾|总结/.test(slideSearchText(slide)))
750
+ }
751
+
752
+ function slideSearchText(slide: SlideSpec): string {
753
+ return [
754
+ slide.title,
755
+ slide.purpose,
756
+ slide.content?.headline,
757
+ ...(slide.content?.body ?? []),
758
+ ...(slide.content?.bullets ?? []),
759
+ ]
760
+ .filter((item): item is string => Boolean(item))
761
+ .join("\n")
762
+ .toLowerCase()
763
+ }
764
+
637
765
  function isEvidenceSensitiveClaim(text: string): boolean {
638
766
  const normalized = text.toLowerCase()
639
767
  return hasNumericClaim(normalized) || EVIDENCE_SENSITIVE_TERMS.some((pattern) => pattern.test(normalized))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyber-dash-tech/revela",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "OpenCode plugin that turns AI into an HTML slide deck generator",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
package/skill/SKILL.md CHANGED
@@ -292,15 +292,17 @@ slide plan to the user **before writing any HTML**.
292
292
 
293
293
  Format the plan as a markdown table:
294
294
 
295
- | # | Title | Content Summary | Layout | Components |
296
- |---|-------|-----------------|--------|------------|
297
- | 1 | Cover | Topic title, subtitle, presenter, date | `cover` | `gradient-text`, `deco-blob`, `accent-line` |
298
- | 2 | Table of Contents | 5 chapter headings | `toc` | `toc-list` |
299
- | 3 | Market Background | Key problem, 3 pain points, $4.2B TAM | `two-col` | `evidence-list`, `card` |
300
- | 4 | Key Metrics | Growth 85%, TAM $12B, NPS 72 | `stats` | `stat-card ×3`, `gradient-text` |
295
+ | # | Title | Narrative Role | Content Summary | Layout | Components |
296
+ |---|-------|----------------|-----------------|--------|------------|
297
+ | 1 | Cover | `context` | Topic title, subtitle, presenter, date | `cover` | `gradient-text`, `deco-blob`, `accent-line` |
298
+ | 2 | Table of Contents | `context` | 5 chapter headings | `toc` | `toc-list` |
299
+ | 3 | Market Background | `tension` | Key problem, 3 pain points, $4.2B TAM | `two-col` | `evidence-list`, `card` |
300
+ | 4 | Key Metrics | `evidence` | Growth 85%, TAM $12B, NPS 72 | `stats` | `stat-card ×3`, `gradient-text` |
301
301
 
302
302
  Rules for filling the table:
303
303
  - **Layout**: use the exact layout name from the Layout Index (e.g. `cover`, `two-col`, `card-grid`, `stats`)
304
+ - **Narrative Role**: use one lightweight role when clear: `context`, `tension`, `evidence`,
305
+ `recommendation`, `risk`, `ask`, `appendix`, or `close`
304
306
  - **Components**: list component names from the Component Index — no CSS details
305
307
  (e.g. `card ×3`, `stat-card`, `evidence-list`, `step-flow`, `quote-block`)
306
308
  - **Content Summary**: 1 sentence of actual content — specific numbers, key points, or
@@ -319,7 +321,7 @@ Then ask:
319
321
 
320
322
  After the user confirms the slide plan, update `DECKS.json` through `revela-decks`:
321
323
  - Call `upsertDeck` to mark completed `requiredInputs` only when explicitly satisfied.
322
- - Call `upsertSlides` with the confirmed per-slide content, layout, components, and evidence.
324
+ - Call `upsertSlides` with the confirmed per-slide content, narrativeRole, layout, components, and evidence.
323
325
  - Keep write readiness blocked until Phase 5 calls `revela-decks review` and the tool returns ready.
324
326
 
325
327
  ---
package/tools/decks.ts CHANGED
@@ -75,6 +75,7 @@ export default tool({
75
75
  index: tool.schema.number().describe("1-based slide index."),
76
76
  title: tool.schema.string().describe("Slide title."),
77
77
  purpose: tool.schema.string().optional().describe("Narrative purpose of this slide."),
78
+ narrativeRole: tool.schema.enum(["context", "tension", "evidence", "recommendation", "risk", "ask", "appendix", "close"]).optional().describe("Lightweight narrative role for review guidance."),
78
79
  layout: tool.schema.string().describe("Design layout name."),
79
80
  qa: tool.schema.boolean().optional().describe("Whether the slide is marked QA-relevant deck metadata."),
80
81
  components: tool.schema.array(tool.schema.string()).describe("Design components used by this slide."),