@cyber-dash-tech/revela 0.3.0 → 0.4.0
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 +200 -9
- package/README.zh-CN.md +162 -9
- package/designs/summit/DESIGN.md +54 -51
- package/lib/agents/research-prompt.ts +1 -1
- package/lib/document-materials/extract.ts +139 -2
- package/lib/media/batch-save.ts +146 -0
- package/lib/media/download.ts +68 -0
- package/lib/media/save.ts +273 -0
- package/lib/media/types.ts +54 -0
- package/lib/research/image-leads.ts +175 -0
- package/package.json +1 -1
- package/plugin.ts +6 -0
- package/skill/SKILL.md +7 -1
- package/tools/extract-document-materials.ts +2 -2
- package/tools/media-batch-save.ts +25 -0
- package/tools/media-save.ts +40 -0
- package/tools/research-images-list.ts +34 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**English** | [中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@cyber-dash-tech/revela) [](LICENSE) [](https://www.npmjs.com/package/@cyber-dash-tech/revela) [](LICENSE) [](tests/) [](https://opencode.ai) [](https://bun.sh)
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<img src="assets/img/logo.png" alt="Revela" width="800" />
|
|
@@ -19,7 +19,7 @@ Enable it for the current session, assign a presentation task, and the agent can
|
|
|
19
19
|
|
|
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
|
-
- supports workspace document discovery
|
|
22
|
+
- supports workspace document discovery, transparent text extraction for `.pdf`, `.docx`, `.pptx`, and `.xlsx`, and cached embedded-material extraction for those formats
|
|
23
23
|
- runs automatic layout QA whenever the agent writes `decks/*.html`
|
|
24
24
|
- exports finished decks to PDF and editable PPTX
|
|
25
25
|
- switches designs and domains locally with zero LLM cost
|
|
@@ -54,9 +54,13 @@ Restart OpenCode.
|
|
|
54
54
|
|
|
55
55
|
To install globally, add the same entry to `~/.config/opencode/opencode.json`.
|
|
56
56
|
|
|
57
|
+
OpenCode `v1.14.22+` respects `.npmrc` settings during plugin installs, so direct installation through
|
|
58
|
+
the `plugin` field should be the default path.
|
|
59
|
+
|
|
57
60
|
### Local wrapper install
|
|
58
61
|
|
|
59
|
-
Use this when
|
|
62
|
+
Use this when direct plugin install is blocked in your environment, or when you want to run from a
|
|
63
|
+
local checkout during development.
|
|
60
64
|
|
|
61
65
|
```bash
|
|
62
66
|
git clone https://github.com/cyber-dash-tech/revela
|
|
@@ -72,10 +76,6 @@ export { default } from "/absolute/path/to/revela/index.ts";
|
|
|
72
76
|
|
|
73
77
|
If you use the local wrapper route, remove any `@cyber-dash-tech/revela` entry from `opencode.json`, otherwise OpenCode may still try Bun installation.
|
|
74
78
|
|
|
75
|
-
### China mainland note
|
|
76
|
-
|
|
77
|
-
OpenCode's npm plugin installer uses Bun and may ignore npm mirror settings. If direct installation fails, prefer the local wrapper method.
|
|
78
|
-
|
|
79
79
|
---
|
|
80
80
|
|
|
81
81
|
## Quick Start
|
|
@@ -162,6 +162,9 @@ When Revela is enabled, the agent can use:
|
|
|
162
162
|
- `revela-workspace-scan` to discover PDFs, Office files, CSVs, Markdown, and text files in the workspace
|
|
163
163
|
- the `revela-research` subagent for targeted web research
|
|
164
164
|
- `revela-research-save` to write structured findings into `researches/<topic>/`
|
|
165
|
+
- `revela-research-images-list` to extract structured image candidates from `researches/<topic>/*.md`
|
|
166
|
+
- `revela-media-batch-save` to batch-save selected research image leads into workspace assets
|
|
167
|
+
- `revela-media-save` to turn chosen local or remote images into reusable workspace assets under `assets/<topic>/media/`
|
|
165
168
|
|
|
166
169
|
Supported document extraction paths:
|
|
167
170
|
|
|
@@ -179,6 +182,39 @@ This extraction is transparent to the main agent.
|
|
|
179
182
|
|
|
180
183
|
---
|
|
181
184
|
|
|
185
|
+
## Media Assets
|
|
186
|
+
|
|
187
|
+
Research findings can record image leads in `## Images`, but those URLs are still just leads.
|
|
188
|
+
Final slides should reference local workspace assets instead of remote image URLs.
|
|
189
|
+
|
|
190
|
+
Use `revela-media-save` when the agent wants to promote one chosen image into a formal project asset.
|
|
191
|
+
|
|
192
|
+
Current Stage 2 additions:
|
|
193
|
+
|
|
194
|
+
- `revela-research-images-list` parses `## Images` sections into structured candidates
|
|
195
|
+
- the primary agent can review those candidates and select a subset to use
|
|
196
|
+
- `revela-media-batch-save` batch-saves the selected subset into `assets/<topic>/media/`
|
|
197
|
+
- this stage is still text-driven; it does not inspect image pixels or do visual recognition
|
|
198
|
+
|
|
199
|
+
Current Stage 1 behavior:
|
|
200
|
+
|
|
201
|
+
- accepts either `sourcePath` for a workspace-local image or `sourceUrl` for a remote image
|
|
202
|
+
- saves successful results into `assets/<topic>/media/`
|
|
203
|
+
- updates `assets/<topic>/media-manifest.json`
|
|
204
|
+
- records failed attempts with explicit statuses such as `invalid-url` and `cannot-download`
|
|
205
|
+
- lets the agent reference the returned local path directly in final HTML
|
|
206
|
+
|
|
207
|
+
Typical flow:
|
|
208
|
+
|
|
209
|
+
1. `revela-research` writes image leads into `researches/<topic>/*.md`
|
|
210
|
+
2. the primary agent calls `revela-research-images-list` and selects the images worth using
|
|
211
|
+
3. `revela-media-batch-save` or `revela-media-save` downloads or copies them into `assets/<topic>/media/`
|
|
212
|
+
4. the deck uses the returned local paths in `<img src="...">`
|
|
213
|
+
|
|
214
|
+
This keeps final decks stable, offline-friendly, and independent from expiring remote URLs.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
182
218
|
## Layout QA And Compliance
|
|
183
219
|
|
|
184
220
|
Every time the agent writes `decks/*.html`, Revela runs an automatic Puppeteer-based QA pass at `1920x1080`.
|
|
@@ -226,7 +262,18 @@ Repository design examples:
|
|
|
226
262
|
|
|
227
263
|
## Custom Designs
|
|
228
264
|
|
|
229
|
-
A custom design is a folder containing `DESIGN.md
|
|
265
|
+
A custom design is a folder containing `DESIGN.md`. The folder name becomes the install target name
|
|
266
|
+
unless the installer infers another name from the source.
|
|
267
|
+
|
|
268
|
+
Recommended structure:
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
my-design/
|
|
272
|
+
├── DESIGN.md
|
|
273
|
+
└── preview.html optional, but recommended for humans
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
`DESIGN.md` starts with frontmatter metadata:
|
|
230
277
|
|
|
231
278
|
```yaml
|
|
232
279
|
---
|
|
@@ -237,7 +284,124 @@ version: 1.0.0
|
|
|
237
284
|
---
|
|
238
285
|
```
|
|
239
286
|
|
|
240
|
-
|
|
287
|
+
### Minimal working example
|
|
288
|
+
|
|
289
|
+
This is the smallest useful `DESIGN.md` shape. It gives the model a clear visual system, one layout,
|
|
290
|
+
and one reusable component.
|
|
291
|
+
|
|
292
|
+
```md
|
|
293
|
+
---
|
|
294
|
+
name: alpine-brief
|
|
295
|
+
description: Minimal editorial design for strategy decks
|
|
296
|
+
author: you
|
|
297
|
+
version: 1.0.0
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Visual Style
|
|
301
|
+
|
|
302
|
+
Apply this visual style to every slide in the deck.
|
|
303
|
+
|
|
304
|
+
<!-- @design:foundation:start -->
|
|
305
|
+
### Color Palette
|
|
306
|
+
|
|
307
|
+
```css
|
|
308
|
+
:root {
|
|
309
|
+
--bg: #f6f2ea;
|
|
310
|
+
--surface: #fffdf8;
|
|
311
|
+
--text-primary: #1c1a17;
|
|
312
|
+
--text-secondary: #625b52;
|
|
313
|
+
--accent: #8a6a45;
|
|
314
|
+
--line: rgba(28, 26, 23, 0.14);
|
|
315
|
+
--font-display: 'IBM Plex Sans Condensed', 'Inter', sans-serif;
|
|
316
|
+
--font-body: 'Inter', sans-serif;
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Typography
|
|
321
|
+
|
|
322
|
+
- Headings use `--font-display`
|
|
323
|
+
- Body copy uses `--font-body`
|
|
324
|
+
- Keep all sizing in fixed `px` for a `1920x1080` canvas
|
|
325
|
+
|
|
326
|
+
### HTML Structure
|
|
327
|
+
|
|
328
|
+
- Every slide must use `<section class="slide" slide-qa="true|false">`
|
|
329
|
+
- Every slide must contain one `.slide-canvas`
|
|
330
|
+
- Keep all CSS in one `<style>` block and all JS in one `<script>` block
|
|
331
|
+
<!-- @design:foundation:end -->
|
|
332
|
+
|
|
333
|
+
<!-- @design:rules:start -->
|
|
334
|
+
### Composition Rules
|
|
335
|
+
|
|
336
|
+
- Use warm off-white backgrounds and restrained brown accents
|
|
337
|
+
- Prefer narrow text columns and generous whitespace
|
|
338
|
+
- Avoid glow, glassmorphism, neon gradients, and dashboard styling
|
|
339
|
+
<!-- @design:rules:end -->
|
|
340
|
+
|
|
341
|
+
<!-- @design:layouts:start -->
|
|
342
|
+
<!-- @layout:cover:start qa=false -->
|
|
343
|
+
### Cover layout
|
|
344
|
+
|
|
345
|
+
- Centered title stack
|
|
346
|
+
- Small eyebrow at top
|
|
347
|
+
- One thin accent divider under the title
|
|
348
|
+
<!-- @layout:cover:end -->
|
|
349
|
+
|
|
350
|
+
<!-- @layout:two-col:start qa=true -->
|
|
351
|
+
### Two-column layout
|
|
352
|
+
|
|
353
|
+
- Left column for argument, right column for evidence
|
|
354
|
+
- Recommended split: `5 / 7`
|
|
355
|
+
- Keep the left column under `520px` for readable paragraphs
|
|
356
|
+
<!-- @layout:two-col:end -->
|
|
357
|
+
<!-- @design:layouts:end -->
|
|
358
|
+
|
|
359
|
+
<!-- @design:components:start -->
|
|
360
|
+
<!-- @component:stat-card:start -->
|
|
361
|
+
### Stat card (`.stat-card`)
|
|
362
|
+
|
|
363
|
+
```html
|
|
364
|
+
<div class="stat-card">
|
|
365
|
+
<div class="stat-label">Revenue CAGR</div>
|
|
366
|
+
<div class="stat-value">27%</div>
|
|
367
|
+
<div class="stat-note">2024-2028E</div>
|
|
368
|
+
</div>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
```css
|
|
372
|
+
.stat-card {
|
|
373
|
+
border-top: 1px solid var(--line);
|
|
374
|
+
padding-top: 18px;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.stat-label {
|
|
378
|
+
font-size: 12px;
|
|
379
|
+
letter-spacing: 0.12em;
|
|
380
|
+
text-transform: uppercase;
|
|
381
|
+
color: var(--text-secondary);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.stat-value {
|
|
385
|
+
margin-top: 10px;
|
|
386
|
+
font-family: var(--font-display);
|
|
387
|
+
font-size: 72px;
|
|
388
|
+
line-height: 0.95;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.stat-note {
|
|
392
|
+
margin-top: 8px;
|
|
393
|
+
font-size: 16px;
|
|
394
|
+
color: var(--text-secondary);
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
<!-- @component:stat-card:end -->
|
|
398
|
+
<!-- @design:components:end -->
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Marker system
|
|
402
|
+
|
|
403
|
+
For larger designs, use the marker system so Revela can keep the always-on prompt compact and fetch
|
|
404
|
+
details only when needed:
|
|
241
405
|
|
|
242
406
|
```html
|
|
243
407
|
<!-- @design:foundation:start -->
|
|
@@ -265,6 +429,26 @@ Chart rules
|
|
|
265
429
|
<!-- @design:chart-rules:end -->
|
|
266
430
|
```
|
|
267
431
|
|
|
432
|
+
Marker roles:
|
|
433
|
+
|
|
434
|
+
- `@design:foundation`: core tokens, HTML skeleton, CSS foundations, typography, spacing, page framing
|
|
435
|
+
- `@design:rules`: composition rules, dos and don'ts, art direction constraints, interaction rules
|
|
436
|
+
- `@design:layouts`: named layout recipes such as `cover`, `toc`, `two-col`, `data-vis`
|
|
437
|
+
- `@design:components`: reusable building blocks such as `card`, `stat-card`, `quote-block`
|
|
438
|
+
- `@design:chart-rules`: chart-specific rules that are only needed when a slide actually uses charts
|
|
439
|
+
|
|
440
|
+
Layout marker rules:
|
|
441
|
+
|
|
442
|
+
- Use stable, simple names such as `cover`, `two-col`, `stats`, `timeline`
|
|
443
|
+
- Add `qa=true` for dense content layouts and `qa=false` for intentionally sparse structural layouts
|
|
444
|
+
- Write each layout section as a recipe: purpose, recommended structure, preferred ratios, and known constraints
|
|
445
|
+
|
|
446
|
+
Component marker rules:
|
|
447
|
+
|
|
448
|
+
- Include at least one concrete HTML example
|
|
449
|
+
- Include the CSS class names the component depends on
|
|
450
|
+
- Prefer a small vocabulary of reusable class names over many one-off classes
|
|
451
|
+
|
|
268
452
|
Prompt injection behavior:
|
|
269
453
|
|
|
270
454
|
- always injected: `@design:foundation`, `@design:rules`, layout index, component index
|
|
@@ -272,6 +456,13 @@ Prompt injection behavior:
|
|
|
272
456
|
|
|
273
457
|
If a design has no markers, Revela falls back to injecting the full `DESIGN.md` body.
|
|
274
458
|
|
|
459
|
+
### Practical guidance
|
|
460
|
+
|
|
461
|
+
- Put the non-negotiable rules in `foundation` and `rules`; do not hide essential constraints only inside one layout
|
|
462
|
+
- Keep layout names semantically meaningful; they become the vocabulary the model sees in the layout index
|
|
463
|
+
- If your design defines a custom CSS class, document that class inside `DESIGN.md`; QA checks can flag classes not present in the design vocabulary
|
|
464
|
+
- Add `preview.html` when possible so humans can inspect the design before activating it
|
|
465
|
+
|
|
275
466
|
Install a custom design:
|
|
276
467
|
|
|
277
468
|
```text
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | **中文**
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@cyber-dash-tech/revela) [](LICENSE) [](https://www.npmjs.com/package/@cyber-dash-tech/revela) [](LICENSE) [](tests/) [](https://opencode.ai) [](https://bun.sh)
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<img src="assets/img/logo.png" alt="Revela" width="800" />
|
|
@@ -19,7 +19,7 @@ Revela 是一个 [OpenCode](https://opencode.ai) 插件,可以把你当前使
|
|
|
19
19
|
|
|
20
20
|
- 通过 `/revela enable` 向当前 agent 注入演示文稿专用 system prompt
|
|
21
21
|
- prompt 由 3 层组成:核心 skill、当前 domain、当前 design
|
|
22
|
-
- 支持工作区文档扫描,以及 `.pdf`、`.docx`、`.pptx`、`.xlsx`
|
|
22
|
+
- 支持工作区文档扫描,以及 `.pdf`、`.docx`、`.pptx`、`.xlsx` 的透明文本提取和嵌入素材缓存提取
|
|
23
23
|
- agent 每次写入 `decks/*.html` 时自动执行布局 QA
|
|
24
24
|
- 支持导出成 PDF 和可编辑 PPTX
|
|
25
25
|
- design 和 domain 的切换都在本地完成,不消耗 LLM token
|
|
@@ -54,9 +54,12 @@ Revela 是一种工作模式,不是独立 agent。
|
|
|
54
54
|
|
|
55
55
|
如果想全局安装,可以把同样配置写到 `~/.config/opencode/opencode.json`。
|
|
56
56
|
|
|
57
|
+
OpenCode `v1.14.22+` 在插件安装时已经会遵循 `.npmrc` 设置,因此默认应优先使用
|
|
58
|
+
`plugin` 字段直接安装。
|
|
59
|
+
|
|
57
60
|
### 本地 wrapper 安装
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
如果你的环境里直接安装仍然受阻,或者你想在开发时直接运行本地源码仓库,可以使用本地 wrapper。
|
|
60
63
|
|
|
61
64
|
```bash
|
|
62
65
|
git clone https://github.com/cyber-dash-tech/revela
|
|
@@ -72,10 +75,6 @@ export { default } from "/absolute/path/to/revela/index.ts";
|
|
|
72
75
|
|
|
73
76
|
如果使用本地 wrapper,记得把 `opencode.json` 里的 `@cyber-dash-tech/revela` `plugin` 配置删掉,否则 OpenCode 仍可能尝试用 Bun 安装。
|
|
74
77
|
|
|
75
|
-
### 中国大陆网络说明
|
|
76
|
-
|
|
77
|
-
OpenCode 的 npm 插件安装依赖 Bun,而 Bun 可能不会遵循 npm mirror 设置。如果直接安装失败,优先使用上面的本地 wrapper 方案。
|
|
78
|
-
|
|
79
78
|
---
|
|
80
79
|
|
|
81
80
|
## 快速开始
|
|
@@ -226,7 +225,18 @@ Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main mar
|
|
|
226
225
|
|
|
227
226
|
## 自定义 Designs
|
|
228
227
|
|
|
229
|
-
自定义 design
|
|
228
|
+
自定义 design 本质上是一个包含 `DESIGN.md` 的文件夹。目录名通常会成为安装后的 design 名称,
|
|
229
|
+
除非安装器从来源中推断出其他名称。
|
|
230
|
+
|
|
231
|
+
推荐目录结构:
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
my-design/
|
|
235
|
+
├── DESIGN.md
|
|
236
|
+
└── preview.html 可选,但推荐,方便人工预览
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`DESIGN.md` 顶部使用 frontmatter:
|
|
230
240
|
|
|
231
241
|
```yaml
|
|
232
242
|
---
|
|
@@ -237,7 +247,123 @@ version: 1.0.0
|
|
|
237
247
|
---
|
|
238
248
|
```
|
|
239
249
|
|
|
240
|
-
|
|
250
|
+
### 最小可用示例
|
|
251
|
+
|
|
252
|
+
下面是一个最小但可工作的 `DESIGN.md` 结构。它至少给模型提供了明确的视觉系统、一个 layout 和一个可复用 component。
|
|
253
|
+
|
|
254
|
+
```md
|
|
255
|
+
---
|
|
256
|
+
name: alpine-brief
|
|
257
|
+
description: Minimal editorial design for strategy decks
|
|
258
|
+
author: you
|
|
259
|
+
version: 1.0.0
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Visual Style
|
|
263
|
+
|
|
264
|
+
Apply this visual style to every slide in the deck.
|
|
265
|
+
|
|
266
|
+
<!-- @design:foundation:start -->
|
|
267
|
+
### Color Palette
|
|
268
|
+
|
|
269
|
+
```css
|
|
270
|
+
:root {
|
|
271
|
+
--bg: #f6f2ea;
|
|
272
|
+
--surface: #fffdf8;
|
|
273
|
+
--text-primary: #1c1a17;
|
|
274
|
+
--text-secondary: #625b52;
|
|
275
|
+
--accent: #8a6a45;
|
|
276
|
+
--line: rgba(28, 26, 23, 0.14);
|
|
277
|
+
--font-display: 'IBM Plex Sans Condensed', 'Inter', sans-serif;
|
|
278
|
+
--font-body: 'Inter', sans-serif;
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Typography
|
|
283
|
+
|
|
284
|
+
- 标题使用 `--font-display`
|
|
285
|
+
- 正文使用 `--font-body`
|
|
286
|
+
- 所有尺寸都固定为 `px`,基于 `1920x1080` 画布设计
|
|
287
|
+
|
|
288
|
+
### HTML Structure
|
|
289
|
+
|
|
290
|
+
- 每张 slide 都必须使用 `<section class="slide" slide-qa="true|false">`
|
|
291
|
+
- 每张 slide 内都必须有一个 `.slide-canvas`
|
|
292
|
+
- 所有 CSS 放在一个 `<style>` 块里,所有 JS 放在一个 `<script>` 块里
|
|
293
|
+
<!-- @design:foundation:end -->
|
|
294
|
+
|
|
295
|
+
<!-- @design:rules:start -->
|
|
296
|
+
### Composition Rules
|
|
297
|
+
|
|
298
|
+
- 使用偏暖的浅色背景和克制的棕色强调色
|
|
299
|
+
- 文字列保持偏窄,给足留白
|
|
300
|
+
- 避免 glow、glassmorphism、neon gradient 和 dashboard 风格
|
|
301
|
+
<!-- @design:rules:end -->
|
|
302
|
+
|
|
303
|
+
<!-- @design:layouts:start -->
|
|
304
|
+
<!-- @layout:cover:start qa=false -->
|
|
305
|
+
### Cover layout
|
|
306
|
+
|
|
307
|
+
- 居中的标题堆叠
|
|
308
|
+
- 顶部有小号 eyebrow
|
|
309
|
+
- 标题下方有一条细的强调色分隔线
|
|
310
|
+
<!-- @layout:cover:end -->
|
|
311
|
+
|
|
312
|
+
<!-- @layout:two-col:start qa=true -->
|
|
313
|
+
### Two-column layout
|
|
314
|
+
|
|
315
|
+
- 左列负责论点,右列负责证据
|
|
316
|
+
- 推荐比例:`5 / 7`
|
|
317
|
+
- 左列宽度尽量控制在 `520px` 以内,保证段落可读性
|
|
318
|
+
<!-- @layout:two-col:end -->
|
|
319
|
+
<!-- @design:layouts:end -->
|
|
320
|
+
|
|
321
|
+
<!-- @design:components:start -->
|
|
322
|
+
<!-- @component:stat-card:start -->
|
|
323
|
+
### Stat card (`.stat-card`)
|
|
324
|
+
|
|
325
|
+
```html
|
|
326
|
+
<div class="stat-card">
|
|
327
|
+
<div class="stat-label">Revenue CAGR</div>
|
|
328
|
+
<div class="stat-value">27%</div>
|
|
329
|
+
<div class="stat-note">2024-2028E</div>
|
|
330
|
+
</div>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
```css
|
|
334
|
+
.stat-card {
|
|
335
|
+
border-top: 1px solid var(--line);
|
|
336
|
+
padding-top: 18px;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.stat-label {
|
|
340
|
+
font-size: 12px;
|
|
341
|
+
letter-spacing: 0.12em;
|
|
342
|
+
text-transform: uppercase;
|
|
343
|
+
color: var(--text-secondary);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.stat-value {
|
|
347
|
+
margin-top: 10px;
|
|
348
|
+
font-family: var(--font-display);
|
|
349
|
+
font-size: 72px;
|
|
350
|
+
line-height: 0.95;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.stat-note {
|
|
354
|
+
margin-top: 8px;
|
|
355
|
+
font-size: 16px;
|
|
356
|
+
color: var(--text-secondary);
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
<!-- @component:stat-card:end -->
|
|
360
|
+
<!-- @design:components:end -->
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Marker 体系
|
|
364
|
+
|
|
365
|
+
对于较大的 design,建议使用 marker 体系,这样 Revela 可以把常驻 prompt 控制在较小体积,
|
|
366
|
+
只在需要时按需读取 layout / component 细节:
|
|
241
367
|
|
|
242
368
|
```html
|
|
243
369
|
<!-- @design:foundation:start -->
|
|
@@ -265,6 +391,26 @@ Chart rules
|
|
|
265
391
|
<!-- @design:chart-rules:end -->
|
|
266
392
|
```
|
|
267
393
|
|
|
394
|
+
各类 marker 的职责:
|
|
395
|
+
|
|
396
|
+
- `@design:foundation`:设计 token、HTML 骨架、CSS 基础、字体、间距、页面 framing
|
|
397
|
+
- `@design:rules`:构图原则、do / don't、art direction 限制、交互规则
|
|
398
|
+
- `@design:layouts`:具名 layout 配方,例如 `cover`、`toc`、`two-col`、`data-vis`
|
|
399
|
+
- `@design:components`:可复用组件,例如 `card`、`stat-card`、`quote-block`
|
|
400
|
+
- `@design:chart-rules`:只有图表页才需要的图表规范
|
|
401
|
+
|
|
402
|
+
Layout marker 编写建议:
|
|
403
|
+
|
|
404
|
+
- 名称保持稳定、简单,例如 `cover`、`two-col`、`stats`、`timeline`
|
|
405
|
+
- 内容密集型 layout 用 `qa=true`,结构型或刻意稀疏的 layout 用 `qa=false`
|
|
406
|
+
- 每个 layout 都写成配方:用途、推荐结构、推荐比例、已知约束
|
|
407
|
+
|
|
408
|
+
Component marker 编写建议:
|
|
409
|
+
|
|
410
|
+
- 至少提供一个具体 HTML 示例
|
|
411
|
+
- 明确列出组件依赖的 CSS class 名
|
|
412
|
+
- 尽量复用少量稳定 class,不要堆太多一次性 class
|
|
413
|
+
|
|
268
414
|
Prompt 注入规则:
|
|
269
415
|
|
|
270
416
|
- 常驻注入:`@design:foundation`、`@design:rules`、layout index、component index
|
|
@@ -272,6 +418,13 @@ Prompt 注入规则:
|
|
|
272
418
|
|
|
273
419
|
如果 design 没有 marker,Revela 会退回到整份 `DESIGN.md` 全量注入。
|
|
274
420
|
|
|
421
|
+
### 实际编写建议
|
|
422
|
+
|
|
423
|
+
- 把不可妥协的规则放进 `foundation` 和 `rules`,不要只藏在某个 layout 里
|
|
424
|
+
- layout 名称尽量语义化,因为模型在 layout index 里首先看到的就是这些名字
|
|
425
|
+
- 如果定义了自定义 CSS class,记得在 `DESIGN.md` 里写出来;QA 会检查 design 词汇表之外的新 class
|
|
426
|
+
- 如果条件允许,最好同时提供 `preview.html`,方便人工预览和验收
|
|
427
|
+
|
|
275
428
|
安装自定义 design:
|
|
276
429
|
|
|
277
430
|
```text
|