@iasiv5/dsh-skills 1.0.0 → 1.0.2

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.
Files changed (37) hide show
  1. package/locale/en.json +6 -0
  2. package/locale/zh.json +6 -0
  3. package/package.json +4 -2
  4. package/skills/answer-me-with-html/SKILL.md +4 -2
  5. package/skills/answer-me-with-html/scripts/am.mjs +627 -192
  6. package/skills/guizang-ppt-skill/README.en.md +10 -8
  7. package/skills/guizang-ppt-skill/README.md +10 -8
  8. package/skills/guizang-ppt-skill/SKILL.md +20 -16
  9. package/skills/guizang-ppt-skill/assets/template-swiss.html +1068 -456
  10. package/skills/guizang-ppt-skill/assets/template.html +991 -225
  11. package/skills/guizang-ppt-skill/references/checklist.md +5 -4
  12. package/skills/guizang-ppt-skill/references/components.md +9 -5
  13. package/skills/guizang-ppt-skill/references/gz-components.md +289 -0
  14. package/skills/guizang-ppt-skill/references/layouts-swiss.md +17 -17
  15. package/skills/guizang-ppt-skill/references/layouts.md +1 -1
  16. package/skills/guizang-ppt-skill/references/themes-swiss.md +57 -86
  17. package/skills/guizang-ppt-skill/references/themes.md +65 -63
  18. package/skills/guizang-ppt-skill/scripts/gz-theme.mjs +434 -0
  19. package/skills/guizang-social-card-skill/HANDOFF.md +19 -1
  20. package/skills/guizang-social-card-skill/README.en.md +20 -7
  21. package/skills/guizang-social-card-skill/README.md +20 -7
  22. package/skills/guizang-social-card-skill/SKILL.md +7 -5
  23. package/skills/guizang-social-card-skill/assets/template-editorial-card.html +954 -126
  24. package/skills/guizang-social-card-skill/assets/template-swiss-card.html +588 -84
  25. package/skills/guizang-social-card-skill/package-lock.json +90 -1
  26. package/skills/guizang-social-card-skill/package.json +7 -4
  27. package/skills/guizang-social-card-skill/references/background-systems.md +7 -15
  28. package/skills/guizang-social-card-skill/references/components.md +16 -10
  29. package/skills/guizang-social-card-skill/references/gz-components.md +289 -0
  30. package/skills/guizang-social-card-skill/references/layout-recipes.md +1 -1
  31. package/skills/guizang-social-card-skill/references/production-workflow.md +10 -12
  32. package/skills/guizang-social-card-skill/references/style-system.md +1 -1
  33. package/skills/guizang-social-card-skill/references/theme-presets.md +59 -111
  34. package/skills/guizang-social-card-skill/scripts/gz-fonts.mjs +654 -0
  35. package/skills/guizang-social-card-skill/scripts/gz-theme.mjs +434 -0
  36. package/skills/guizang-social-card-skill/scripts/render.mjs +92 -0
  37. package/skills/guizang-social-card-skill/validate-social-deck.mjs +11 -6
@@ -69,7 +69,7 @@ Turn these three game clips into a triple Live Photo collage with Swiss-style gu
69
69
  - 🧰 **Screenshot beautification assets**: 9 real-texture WebP backgrounds (5 Editorial / 4 Swiss), paired with `.frame-shot` / `.device-browser` / `.device-phone` utilities
70
70
  - 🗺 **Map component**: MapLibre + OSM real tiles, multi-pin + connectors, made for travel guides
71
71
  - ✅ **Validator**: `validate-social-deck.mjs` auto-detects overflow, type cap violations, 4-band density gaps, and footer collisions
72
- - 📄 **Single-file HTML + Playwright rendering**: no frontend build pipeline; `node render.mjs` outputs PNG directly
72
+ - 📄 **Single-file HTML + Playwright rendering**: no frontend build pipeline; `node scripts/render.mjs` outputs PNG directly
73
73
 
74
74
  ## Live Photo effects and layouts
75
75
 
@@ -198,10 +198,10 @@ Once installed, Claude Code auto-detects the skill. Trigger phrases:
198
198
  The skill is a structured workflow. The agent walks through 7 steps:
199
199
 
200
200
  1. **Intake** — capture 4 things: target platform / style / source content / user images. When no images are available, present A/B/C once (shoot your own / AI generate / source online); don't re-pitch
201
- 2. **Style & Theme** — pick Editorial or Swiss, then pick one of 10 theme presets. Custom hex values are not allowed
201
+ 2. **Style & Theme** — pick Editorial or Swiss, then pick one of 10 theme presets. No hand-written hex values; brand colors go through constrained generation
202
202
  3. **Layout Selection** — pick / paste / adapt copy from the 28 layout skeletons. 16 Editorial / 12 Swiss
203
203
  4. **Asset Prep** — source images (Unsplash / Pexels / Flickr CC / Wallhaven / direct search), download locally + write `SOURCES.md`; ask whether to credit sources
204
- 5. **Compose & Render** — copy seed template → replace `<!-- POSTERS_HERE -->` → `node render.mjs`
204
+ 5. **Compose & Render** — copy seed template → replace `<!-- POSTERS_HERE -->` → `node scripts/render.mjs <task-dir>`
205
205
  6. **Deliver & Review** — show PNGs first, ask "look at them yourself, or want me to run the validator?" — does not auto-validate
206
206
  7. **Iterate** — apply user feedback, tweak inline styles or swap layouts / images, re-render
207
207
 
@@ -231,7 +231,7 @@ node validate-social-deck.mjs path/to/task-dir
231
231
 
232
232
  ## Theme presets
233
233
 
234
- Pick from [`references/theme-presets.md`](./references/theme-presets.md). **Custom hex values are not allowed** — protecting the aesthetic matters more than freedom of choice.
234
+ Pick from [`references/theme-presets.md`](./references/theme-presets.md). **Don't write hex values by hand** — protecting the aesthetic matters more than freedom of choice. Every theme's text, rule and small accent-text colors are derived with the same contrast rules (WCAG + APCA).
235
235
 
236
236
  ### Editorial (6)
237
237
 
@@ -253,7 +253,20 @@ Pick from [`references/theme-presets.md`](./references/theme-presets.md). **Cust
253
253
  | 🟢 **Lemon Green** | `#C5E803` | Eco, health, Gen Z, green brands |
254
254
  | 🟠 **Safety Orange** | `#FF6B35` | Alerts, news, industrial, energetic themes |
255
255
 
256
- To switch themes, just replace the `<section class="poster" data-theme="...">` attribute on the seed template; all CSS resolves through `var(--...)`.
256
+ To switch themes, set the theme id on the seed template's first line, `<html data-theme="…">`. All themes are built into the template; the old Swiss `data-accent="…"` attribute still works.
257
+
258
+ When the user gives a brand or logo color, run `node scripts/gz-theme.mjs brand "#FF2442" --family magazine` (`--family swiss` for Swiss) and paste the printed theme into the page. The script pulls the color into the lightness and chroma range the style allows and refuses it if it cannot meet the readability floors — fall back to a preset then.
259
+
260
+ ## Rendering
261
+
262
+ Install dependencies once in the skill folder:
263
+
264
+ ```bash
265
+ npm install
266
+ node scripts/render.mjs path/to/task-dir
267
+ ```
268
+
269
+ The renderer subsets and embeds the fonts the page actually uses (downloading them to a local cache the first time), waits for the frozen background and icons, screenshots every card at its board size to `output/<id>.png`, and checks the sizes. Locally registered commercial fonts (`node scripts/gz-fonts.mjs add …`) are embedded too and never uploaded.
257
270
 
258
271
  ## Directory
259
272
 
@@ -325,7 +338,7 @@ guizang-social-card-skill/
325
338
  ## FAQ
326
339
 
327
340
  **Can I batch-export images?**
328
- Yes. A task directory's `index.html` can hold multiple `.poster` sections; `node render.mjs` screenshots each one. A 3-9 card Xiaohongshu set is the common case.
341
+ Yes. A task directory's `index.html` can hold multiple `.poster` sections; `node scripts/render.mjs` screenshots each one. A 3-9 card Xiaohongshu set is the common case.
329
342
 
330
343
  **Why are custom colors disallowed?**
331
344
  Same reason as the PPT skill — the skill's core value is stable output. Free color picking breaks visual cohesion. Pick from the 10 presets only.
@@ -351,7 +364,7 @@ Bugs, layout issues, new layout requests — Issues and PRs welcome. Priorities
351
364
 
352
365
  - When editing seed templates, also update `references/components.md`'s correspondence table (sizes / spacing / weights)
353
366
  - When adding layouts, add the full recipe to `references/layout-recipes.md` (copy caps + minimum density)
354
- - When adding theme colors, also update the seed template's `[data-theme="..."]` block + `references/theme-presets.md`
367
+ - Themes, type sizes, fonts and background effects come from a shared design system: the template's `GZ:FONTS` / `GZ:TOKENS` / `GZ:EFFECTS` blocks, the `GZ:THEMES` block in `theme-presets.md`, `scripts/gz-*.mjs` and `scripts/render.mjs` are generated — don't edit them by hand; open an issue for new theme colors or type changes
355
368
  - When adding Swiss rules, also update the matching rule in `validate-social-deck.mjs`
356
369
  - Mistakes you've hit go into `references/qa-checklist.md`
357
370
  - Tests and demos live under `local-tests/` — do not pollute the skill root
@@ -69,7 +69,7 @@ npx skills add https://github.com/op7418/guizang-social-card-skill --skill guiza
69
69
  - 🧰 **截图美化资产**:9 张 WebP 真实材质背景(Editorial 5 / Swiss 4),配套 `.frame-shot` / `.device-browser` / `.device-phone` 工具类
70
70
  - 🗺 **地图组件**:MapLibre + OSM 真实瓦片,支持多 pin + 连线,适合旅行攻略
71
71
  - ✅ **校验脚本**:`validate-social-deck.mjs` 自动检测溢出、字号上限、4 横带密度、footer 碰撞
72
- - 📄 **单文件 HTML + Playwright 渲染**:不需要前端构建链,`node render.mjs` 直接出 PNG
72
+ - 📄 **单文件 HTML + Playwright 渲染**:不需要前端构建链,`node scripts/render.mjs` 直接出 PNG
73
73
 
74
74
  ## Live Photo 效果与版式
75
75
 
@@ -198,10 +198,10 @@ git clone https://github.com/op7418/guizang-social-card-skill.git ~/.claude/skil
198
198
  Skill 本身是结构化工作流,Agent 会按 7 步走:
199
199
 
200
200
  1. **Intake** — 抓 4 件事:目标平台 / 风格 / 内容素材 / 用户图。无图时一次性给 A/B/C 三选(自己拍图 / AI 生图 / 网络取图),不二次劝导
201
- 2. **Style & Theme** — 选 Editorial 还是 Swiss,再从 10 套预设里选主题色。不允许自定义 hex
201
+ 2. **Style & Theme** — 选 Editorial 还是 Swiss,再从 10 套预设里选主题色。不允许随手写 hex,品牌色走受约束生成
202
202
  3. **Layout Selection** — 根据内容结构从 28 个版式骨架里挑、粘、改文案。Editorial 16 个 / Swiss 12 个
203
203
  4. **Asset Prep** — 取图(Unsplash / Pexels / Flickr CC / Wallhaven / 直接搜索),落本地 + 写 `SOURCES.md`;问用户要不要标来源
204
- 5. **Compose & Render** — 拷种子模板 → 替换 `<!-- POSTERS_HERE -->` → `node render.mjs`
204
+ 5. **Compose & Render** — 拷种子模板 → 替换 `<!-- POSTERS_HERE -->` → `node scripts/render.mjs <任务目录>`
205
205
  6. **Deliver & Review** — 先把 PNG 给用户看,询问"你自己看还是我先帮你跑 validator",默认不自动核查
206
206
  7. **Iterate** — 用户提反馈,改 inline 样式或 swap 版式 / 替图,重渲
207
207
 
@@ -231,7 +231,7 @@ node validate-social-deck.mjs path/to/task-dir
231
231
 
232
232
  ## 主题色预设
233
233
 
234
- 从 [`references/theme-presets.md`](./references/theme-presets.md) 里选一套——**不允许自定义 hex 值**,保护美学比给自由更重要。
234
+ 从 [`references/theme-presets.md`](./references/theme-presets.md) 里选一套——**不允许随手写 hex 值**,保护美学比给自由更重要。所有主题的文字色、线条色和强调色小字都按同一套对比度规则(WCAG + APCA)算出来。
235
235
 
236
236
  ### Editorial 6 套
237
237
 
@@ -253,7 +253,20 @@ node validate-social-deck.mjs path/to/task-dir
253
253
  | 🟢 **柠檬绿 Lemon Green** | `#C5E803` | 生态、健康、Z 世代、绿色品牌 |
254
254
  | 🟠 **安全橙 Safety Orange** | `#FF6B35` | 警示、新闻、工业、活力主题 |
255
255
 
256
- 切主题只需替换种子模板的 `<section class="poster" data-theme="...">` 属性,所有 CSS 走 `var(--...)`。
256
+ 切主题只需把种子模板第一行 `<html data-theme="…">` 改成主题 id,全部主题都已内置在模板里。瑞士风旧的 `data-accent="…"` 写法仍然有效。
257
+
258
+ 用户给了品牌色或 logo 主色时,运行 `node scripts/gz-theme.mjs brand "#FF2442" --family magazine`(瑞士风用 `--family swiss`),把输出的主题贴进页面。脚本会把品牌色收进这套风格允许的明度和彩度范围,达不到可读性要求就拒绝,这时回到预设。
259
+
260
+ ## 出图
261
+
262
+ 第一次使用先在 skill 目录装依赖:
263
+
264
+ ```bash
265
+ npm install
266
+ node scripts/render.mjs path/to/task-dir
267
+ ```
268
+
269
+ 渲染脚本会按页面实际用到的字把字体子集化内置进 HTML(首次会下载字体到本机缓存),等背景定格、图标就绪后,按画板原尺寸把每张卡片截成 `output/<id>.png`,并核对尺寸。本机登记的商业字体(`node scripts/gz-fonts.mjs add …`)也会内置,不会上传。
257
270
 
258
271
  ## 目录结构
259
272
 
@@ -324,7 +337,7 @@ guizang-social-card-skill/
324
337
  ## FAQ
325
338
 
326
339
  **可以批量出图吗?**
327
- 可以。一个 task 目录下的 `index.html` 包含多个 `.poster`,`node render.mjs` 会逐个截 PNG。一次出小红书 3-9 张组图很常见。
340
+ 可以。一个 task 目录下的 `index.html` 包含多个 `.poster`,`node scripts/render.mjs` 会逐个截 PNG。一次出小红书 3-9 张组图很常见。
328
341
 
329
342
  **为什么不允许自定义颜色?**
330
343
  和 PPT skill 同样的理由——这个 Skill 的核心价值是稳定产出。自由选色会破坏整体风格,只允许从 10 套预设里挑。
@@ -350,7 +363,7 @@ Bug、排版问题、新版式需求——欢迎开 Issue 或 PR。改动请优
350
363
 
351
364
  - 改种子模板时,同步更新 `references/components.md` 的对照表(字号 / 字距 / 字重)
352
365
  - 新增版式时,在 `references/layout-recipes.md` 加完整 recipe(文案上限 + minimum density)
353
- - 新增主题色时,同步更新种子模板的 `[data-theme="..."]` 块 + `references/theme-presets.md`
366
+ - 主题、字号、字体和背景特效来自共享设计系统,模板里 `GZ:FONTS` / `GZ:TOKENS` / `GZ:EFFECTS` 区块、`theme-presets.md` 的 `GZ:THEMES` 区块和 `scripts/gz-*.mjs`、`scripts/render.mjs` 是生成的,不要手改;新主题色或字号调整请提 Issue
354
367
  - 新增 Swiss 规则时,同步更新 `validate-social-deck.mjs` 的对应规则
355
368
  - 踩过的坑写到 `references/qa-checklist.md`
356
369
  - 测试与 demo 一律放在 `local-tests/` 下,不要污染 skill 根目录
@@ -192,10 +192,12 @@ Do not write HTML from scratch. Pick one seed template based on the style mode c
192
192
 
193
193
  The seed already wires up: font loading, theme tokens, all three poster sizes (`.poster.xhs` / `.poster.square` / `.poster.wide`), the pair-preview frame, grain/background layers, and all class definitions referenced by the layout recipes.
194
194
 
195
- Set the theme/accent on the `<html>` element:
195
+ Set the palette with `data-theme` on the `<html>` element (all palettes are inlined in the template's `GZ:TOKENS` block — never edit that block or write hex values in posters; see `references/theme-presets.md` for the semantic colour variables):
196
196
 
197
197
  - Editorial: `<html data-theme="ink-classic | indigo-porcelain | forest-ink | kraft-paper | dune | midnight-ink">`.
198
- - Swiss: `<html data-accent="ikb | lemon-yellow | lemon-green | safety-orange">`.
198
+ - Swiss: `<html data-theme="ikb | lemon | lemon-green | safety-orange">` (the old `data-accent="… | lemon-yellow | …"` still works).
199
+ - The user gave a brand or logo colour: run `node <SKILL_ROOT>/scripts/gz-theme.mjs brand "#4D6BFE" --family magazine` (or `--family swiss`), paste the printed `[data-theme="brand"]{…}` at the end of the page `<style>`, and set `data-theme="brand"`. Never use the raw colour; if the script refuses, fall back to a preset.
200
+ - Chinese text is never italic (Chinese fonts have no italic glyphs; the browser slants them artificially). Italic belongs to Latin text set in Playfair Display (`.h-sub`, `em` inside an English line).
199
201
 
200
202
  Replace the single placeholder poster after `<!-- POSTERS_HERE -->` with one `<section class="poster ...">` block per page, each carrying the HTML skeleton from a chosen Layout Recipe (M01-M16 for Editorial, S01-S12 for Swiss). Never load the wrong template's class system: Editorial recipes assume serif display + ledger/marginalia/pipeline-v; Swiss recipes assume Inter + card-fills + matrix/h-bar/kpi-tower. Mixing them silently breaks the layout.
201
203
 
@@ -206,9 +208,9 @@ Default implementation pattern:
206
208
  - Create a task folder under `local-tests/<slug>/` by default, or inside the user-requested output folder. Never put generated task folders, rendered images, MOV files, `.pvt` packages, or downloaded sources in the skill root next to `SKILL.md`.
207
209
  - Put source images in `assets/`.
208
210
  - Start from the seed template copied in Step 4.5, not a blank file. Prefer changing only the `<!-- POSTERS_HERE -->` region page-to-page. If a task needs custom layout CSS, add one clearly named task-scoped block in the copied file and keep semantic defaults reset (`figure { margin:0; }`, no browser-default spacing surprises).
209
- - Use Playwright or a browser screenshot tool to export each `.poster` or `.cover` node.
210
- - Save rendered images in `output/`.
211
- - Verify dimensions and inspect the rendered PNGs.
211
+ - Install dependencies once in the skill root: `npm install` (Playwright for rendering and validation, subset-font for font embedding).
212
+ - Render with `node <SKILL_ROOT>/scripts/render.mjs <task-dir>`. It embeds the fonts the page actually uses (offline, repeatable), waits for the frozen background and icons, writes `output/<poster-id>.png` plus the pair preview, and fails if an image is not its board size. User-registered local fonts (`node <SKILL_ROOT>/scripts/gz-fonts.mjs add …`) are embedded too and never leave the machine.
213
+ - Inspect the rendered PNGs.
212
214
  - Keep `node validate-social-deck.mjs <task-dir>` available for auto-check passes. It checks overflow (R1), footer collision (R2), Swiss bold display (R3), minimum font size (R4), 4-band density (R5), `.h-xl` line caps (R6), browser-default figure margin drift (R7), visual bounds / bottom whitespace (R8), and title-to-content gaps (R9). Exit code 1 on any FAIL — fix before final delivery when auto-check is requested. WARN is advisory but read it.
213
215
 
214
216
  Live Photo branch: