zcode-app-cli 3.8.1-15 → 3.9.1-16

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 (149) hide show
  1. package/bin/zcode.js +92 -47
  2. package/package.json +2 -2
  3. package/vendor/extraction.json +131 -5
  4. package/vendor/node_modules/@zcode/tui/dist/index.js +35 -4
  5. package/vendor/packages/browser-use-plugin/.zcode-plugin/plugin.json +1 -1
  6. package/vendor/packages/browser-use-plugin/dist/mcp/server.js +12880 -10408
  7. package/vendor/packages/browser-use-plugin/package.json +1 -1
  8. package/vendor/packages/document-skills-plugin/.mcp.json +13 -0
  9. package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +19 -6
  10. package/vendor/packages/document-skills-plugin/package.json +3 -3
  11. package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +6 -2
  12. package/vendor/packages/document-skills-plugin/skills/docx/env_setup/env_check.sh +0 -0
  13. package/vendor/packages/document-skills-plugin/skills/docx/env_setup/setup_mac_linux.sh +0 -0
  14. package/vendor/packages/document-skills-plugin/skills/docx/setup.sh +0 -0
  15. package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +39 -20
  16. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/academic.md +39 -47
  17. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/creative.md +11 -3
  18. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/poster.md +3 -0
  19. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +3 -0
  20. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/report.md +41 -62
  21. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/env_check.sh +23 -15
  22. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup.md +37 -19
  23. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_mac_linux.sh +0 -0
  24. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_windows.ps1 +17 -19
  25. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/cover_render.py +487 -0
  26. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2poster.js +43 -11
  27. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +145 -50
  28. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +23 -21
  29. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover-backgrounds.md +1 -1
  30. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover.md +139 -1347
  31. package/vendor/packages/document-skills-plugin/skills/pptx/LICENSE.txt +13 -0
  32. package/vendor/packages/document-skills-plugin/skills/pptx/SKILL.md +146 -179
  33. package/vendor/packages/document-skills-plugin/skills/xlsx/SKILL.md +6 -2
  34. package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/env_check.sh +0 -0
  35. package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_mac_linux.sh +0 -0
  36. package/vendor/packages/document-skills-plugin/skills/xlsx/setup.sh +0 -0
  37. package/vendor/packages/zcode-cua-plugin/.zcode-plugin/plugin.json +19 -0
  38. package/vendor/packages/zcode-cua-plugin/dist/mcp/server.js +68498 -0
  39. package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/color.cjs +1596 -0
  40. package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/index.cjs +1 -0
  41. package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/package.json +58 -0
  42. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +221 -0
  43. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +1 -0
  44. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  45. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/package.json +42 -0
  46. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/versions.json +30 -0
  47. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/LICENSE +191 -0
  48. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  49. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/package.json +46 -0
  50. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/LICENSE +201 -0
  51. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/detect-libc.js +313 -0
  52. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/elf.js +39 -0
  53. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/filesystem.js +51 -0
  54. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/process.js +24 -0
  55. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/package.json +44 -0
  56. package/vendor/packages/zcode-cua-plugin/node_modules/semver/LICENSE +15 -0
  57. package/vendor/packages/zcode-cua-plugin/node_modules/semver/bin/semver.js +191 -0
  58. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/comparator.js +143 -0
  59. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/index.js +7 -0
  60. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/range.js +557 -0
  61. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/semver.js +333 -0
  62. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/clean.js +8 -0
  63. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/cmp.js +54 -0
  64. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/coerce.js +62 -0
  65. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-build.js +9 -0
  66. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-loose.js +5 -0
  67. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare.js +7 -0
  68. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/diff.js +60 -0
  69. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/eq.js +5 -0
  70. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gt.js +5 -0
  71. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gte.js +5 -0
  72. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/inc.js +21 -0
  73. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lt.js +5 -0
  74. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lte.js +5 -0
  75. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/major.js +5 -0
  76. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/minor.js +5 -0
  77. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/neq.js +5 -0
  78. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/parse.js +18 -0
  79. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/patch.js +5 -0
  80. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/prerelease.js +8 -0
  81. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rcompare.js +5 -0
  82. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rsort.js +5 -0
  83. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/satisfies.js +12 -0
  84. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/sort.js +5 -0
  85. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/valid.js +8 -0
  86. package/vendor/packages/zcode-cua-plugin/node_modules/semver/index.js +91 -0
  87. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/constants.js +37 -0
  88. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/debug.js +11 -0
  89. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/identifiers.js +29 -0
  90. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/lrucache.js +42 -0
  91. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/parse-options.js +17 -0
  92. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/re.js +223 -0
  93. package/vendor/packages/zcode-cua-plugin/node_modules/semver/package.json +78 -0
  94. package/vendor/packages/zcode-cua-plugin/node_modules/semver/preload.js +4 -0
  95. package/vendor/packages/zcode-cua-plugin/node_modules/semver/range.bnf +16 -0
  96. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/gtr.js +6 -0
  97. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/intersects.js +9 -0
  98. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/ltr.js +6 -0
  99. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/max-satisfying.js +27 -0
  100. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-satisfying.js +26 -0
  101. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-version.js +63 -0
  102. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/outside.js +82 -0
  103. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/simplify.js +49 -0
  104. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/subset.js +249 -0
  105. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/to-comparators.js +10 -0
  106. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/valid.js +13 -0
  107. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/LICENSE +191 -0
  108. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/build.js +38 -0
  109. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/check.js +14 -0
  110. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/channel.js +177 -0
  111. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/colour.js +195 -0
  112. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/composite.js +212 -0
  113. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/constructor.js +499 -0
  114. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/index.js +16 -0
  115. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/input.js +809 -0
  116. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/is.js +143 -0
  117. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/libvips.js +207 -0
  118. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/operation.js +1016 -0
  119. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/output.js +1666 -0
  120. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/resize.js +595 -0
  121. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/sharp.js +121 -0
  122. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/utility.js +291 -0
  123. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/package.json +202 -0
  124. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/binding.gyp +298 -0
  125. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.cc +1130 -0
  126. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.h +402 -0
  127. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.cc +346 -0
  128. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.h +90 -0
  129. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.cc +499 -0
  130. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.h +137 -0
  131. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.cc +1814 -0
  132. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.h +408 -0
  133. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/sharp.cc +43 -0
  134. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.cc +186 -0
  135. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.h +62 -0
  136. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.cc +288 -0
  137. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.h +22 -0
  138. package/vendor/packages/zcode-cua-plugin/package.json +31 -0
  139. package/vendor/packages/zcode-cua-plugin/scripts/build-mcp.mjs +58 -0
  140. package/vendor/packages/zcode-cua-plugin/scripts/bump-zcode-cua-producer.mjs +291 -0
  141. package/vendor/packages/zcode-cua-plugin/scripts/check-cua-baseline.mjs +155 -0
  142. package/vendor/packages/zcode-cua-plugin/scripts/check-version-coherence.mjs +478 -0
  143. package/vendor/packages/zcode-cua-plugin/scripts/sync-cache.mjs +100 -0
  144. package/vendor/packages/zcode-cua-plugin/scripts/sync-skill-from-zcode-cua.mjs +115 -0
  145. package/vendor/packages/zcode-cua-plugin/skills/zcode-computer-use/SKILL.md +129 -0
  146. package/vendor/zcode.cjs +752 -743
  147. package/zcode-runtime.lock.json +3 -3
  148. package/vendor/packages/document-skills-plugin/skills/pptx/assets/font_list.txt +0 -80
  149. package/vendor/packages/document-skills-plugin/skills/pptx/scripts/general_judge.py +0 -529
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@zcode/browser-use-plugin",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "private": true,
6
6
  "description": "作为官方 ZCode 内置插件发布的 Browser Use skill、client runtime 与无状态 node_repl MCP server。",
7
7
  "license": "MIT",
@@ -0,0 +1,13 @@
1
+ {
2
+ "mcpServers": {
3
+ "image_search": {
4
+ "type": "http",
5
+ "url": "${ZCODE_BASE_URL}/api/v1/mcp/server/image_search",
6
+ "auth": {
7
+ "type": "zcode_official",
8
+ "provider": "jwt_token"
9
+ },
10
+ "timeoutMs": 90000
11
+ }
12
+ }
13
+ }
@@ -1,12 +1,25 @@
1
1
  {
2
2
  "name": "document-skills",
3
- "version": "0.1.0",
4
- "description": "Built-in DOCX, PDF, PPTX, and XLSX document production skills for ZCode.",
3
+ "version": "0.1.1",
4
+ "description": "Built-in DOCX and PDF document production skills, published as an official ZCode plugin.",
5
5
  "description_i18n": {
6
6
  "en": "Document production skills for DOCX, PDF, PPTX, and XLSX.",
7
7
  "zh-CN": "面向 DOCX、PDF、PPTX 和 XLSX 的文档制作技能。"
8
8
  },
9
- "author": { "name": "Z.ai" },
10
- "license": "Proprietary",
11
- "skills": "skills"
12
- }
9
+ "author": {
10
+ "name": "Z.ai"
11
+ },
12
+ "license": "SEE LICENSE IN skills/docx/LICENSE.txt",
13
+ "skills": "skills",
14
+ "mcpServers": {
15
+ "image_search": {
16
+ "type": "http",
17
+ "url": "${ZCODE_BASE_URL}/api/v1/mcp/server/image_search",
18
+ "auth": {
19
+ "type": "zcode_official",
20
+ "provider": "jwt_token"
21
+ },
22
+ "timeoutMs": 90000
23
+ }
24
+ }
25
+ }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@zcode/document-skills-plugin",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "private": true,
6
6
  "license": "SEE LICENSE IN skills/docx/LICENSE.txt",
7
- "description": "Built-in DOCX, PDF, PPTX, and XLSX document production skills published as an official ZCode plugin."
8
- }
7
+ "description": "Built-in DOCX and PDF document production skills published as an official ZCode plugin."
8
+ }
@@ -2,7 +2,7 @@
2
2
  name: docx
3
3
  metadata:
4
4
  author: Z.AI
5
- version: "1.0"
5
+ version: "1.1"
6
6
  description: "Complete DOCX document creation, editing, and analysis capabilities with support for revisions, comments, formatting preservation, and text extraction. Use for creating new documents, modifying content, handling revisions, adding comments, or other professional Word document tasks."
7
7
  license: Proprietary. LICENSE.txt has complete terms
8
8
  ---
@@ -15,6 +15,10 @@ license: Proprietary. LICENSE.txt has complete terms
15
15
  bash "$SKILL_DIR/setup.sh" # Interactive environment check + install
16
16
  ```
17
17
 
18
+ > **Local-font-first.** Inspect fonts available in the user's local environment and prefer a suitable
19
+ > installed font. Use bundled or downloaded fonts only as fallbacks; do not install fonts without the
20
+ > user's confirmation.
21
+
18
22
  ## Overview
19
23
 
20
24
  A .docx file is a ZIP archive containing XML files. This skill provides tools for creating, editing, reading, and reviewing Word documents.
@@ -244,4 +248,4 @@ If IDs are not exact, stop at `slide_number`; never guess or cite intermediates
244
248
  ::zcode-file-citation{path="/abs/path/book.xlsx" purpose="source" artifact_kind="workbook" sheet="Revenue Model" range="C27"}
245
249
  ```
246
250
 
247
- Never cite intermediates unless asked.
251
+ Never cite intermediates unless asked.
@@ -2,7 +2,7 @@
2
2
  name: pdf
3
3
  metadata:
4
4
  author: Z.AI
5
- version: "1.0"
5
+ version: "1.1"
6
6
  description: >
7
7
  Professional PDF toolkit covering four production workflows: reports, creative visuals,
8
8
  academic LaTeX, and existing PDF processing. Routes automatically by document type and
@@ -18,9 +18,20 @@ license: Proprietary. LICENSE.txt has complete terms
18
18
  ```bash
19
19
  bash "$PDF_SKILL_DIR/scripts/setup.sh" # Interactive environment check + install
20
20
  python3 "$PDF_SKILL_DIR/scripts/pdf.py" env.check # Detailed dependency status (JSON: add -j)
21
- python3 "$PDF_SKILL_DIR/scripts/pdf.py" env.fix # Auto-install missing Python packages
21
+ python3 "$PDF_SKILL_DIR/scripts/pdf.py" env.fix # Auto-install missing CORE Python packages
22
22
  ```
23
23
 
24
+ > **Core vs optional.** Only the **core** deps are needed up front: Python 3 + `reportlab`, `pypdf`,
25
+ > `PyMuPDF`, `pikepdf`, `pdfplumber`, and a TrueType CJK font. These cover the Report route and all
26
+ > covers (rendered with ReportLab). **Playwright/Chromium** (Creative/poster/HTML→PDF) and **Tectonic**
27
+ > (Academic/LaTeX) are **optional** — do NOT install them at first run. Install them **on demand, and
28
+ > only after asking the user** (they are large downloads / long first-run waits). See the per-route
29
+ > preflight blocks in `briefs/creative.md`, `briefs/poster.md`, `briefs/process.md`, `briefs/academic.md`.
30
+
31
+ > **Local-font-first.** Inspect fonts available in the user's local environment and prefer a suitable
32
+ > installed font. Use bundled or downloaded fonts only as fallbacks; do not install fonts without the
33
+ > user's confirmation.
34
+
24
35
  ## Triage
25
36
 
26
37
  Determine task weight to control how much context to load:
@@ -171,7 +182,7 @@ These are referenced by multiple briefs. **Do not load upfront** - each brief te
171
182
  | Asset | Path | Used By | Purpose |
172
183
  |-------|------|---------|---------|
173
184
  | Palette & Typography | `typesetting/palette.md` | Report, Creative | Color system, font rules, anti-patterns, spacing |
174
- | Cover Layout System V2.1 | `typesetting/cover.md` | **Report + Creative + Academic** | 7 industrial-grade templates with absolute anchor grid, Z-index layers, typography weight system, mandatory Summary Block, code-level safety (5 checks), base unit `U = W*0.05`. **Unified HTML/Playwright cover system for all routes.** |
185
+ | Cover Engine V4.0 | `typesetting/cover.md` | **Report + Academic** | 9 ReportLab templates (01–05 report/light, 06–08 academic/dark, 09 institutional), absolute anchor grid, layer order, typography weight system, mandatory Summary block, host-detected style-driven fonts. **Pure ReportLab via `scripts/cover_render.py` — no HTML/Playwright.** (Creative composes its cover inside its own HTML.) |
175
186
  | Chart Styling & Anti-Stacking | `typesetting/charts.md` | Report, Creative, Academic | Chart defaults, collision prevention, axis/grid/legend rules |
176
187
  | Overflow Prevention | `typesetting/overflow.md` | Report, Creative, Academic | Bounding box system, text/image/table overflow prevention, fallback strategies |
177
188
  | **Fill Engine (Anti-Void)** | `typesetting/fill-engine.md` | **Report, Creative, Academic** | **Anti-Void Engine V2.0: font floor enforcement, fill ratio calculation, paragraph inflation, component elevation, Y-axis golden-ratio anchoring** |
@@ -310,8 +321,8 @@ See `briefs/academic.md` Scenario B for TikZ templates (simple diagrams only).
310
321
  | Scenario | Correct Method | Forbidden |
311
322
  |----------|---------------|-----------|
312
323
  | Creative pipeline (single/multi-page) | `page.pdf()` via `convert.blueprint` or `html2pdf-next.js` | `page.screenshot()` → image → wrap as PDF |
313
- | Report cover (HTML/Playwright) | `page.pdf()` → merge via pypdf | Screenshot cover → embed as image |
314
- | Academic cover | `page.pdf()` → merge via pypdf | Screenshot → `\includegraphics` for cover |
324
+ | Report cover (ReportLab) | `cover_render.py` → merge via pypdf | Screenshot cover → embed as image |
325
+ | Academic cover (ReportLab) | `cover_render.py` → merge via pypdf | Screenshot → `\includegraphics` for cover |
315
326
  | Full-page posters/infographics | `html2poster.js` (auto overflow:hidden + height measurement + `page.pdf()`) | Any raster pipeline for the final output |
316
327
 
317
328
  **Why:** `page.pdf()` produces vector text + vector shapes. Text remains selectable, sharp at any zoom, and file size is smaller. Screenshot-based PDFs are raster images - blurry when zoomed, unsearchable, and 3-5× larger.
@@ -331,7 +342,7 @@ There are **two dedicated scripts** for HTML→PDF. Choose based on document typ
331
342
  | Document type | Script | Reason |
332
343
  |---------------|--------|--------|
333
344
  | **Posters, infographics, long-image single-page designs** | `html2poster.js` | Auto overflow:hidden, auto height measurement, zero margin, single-page output |
334
- | **Cover pages (Report/Academic route)** | `html2poster.js` | Covers are single-page fixed layouts with absolute positioning — same nature as posters. `html2pdf-next.js` would convert absolute→static and destroy the layout |
345
+ | **Cover pages (Report/Academic route)** | *(none — use ReportLab)* | Covers now render with `scripts/cover_render.py` (pure ReportLab). Do NOT use HTML for Report/Academic covers. |
335
346
  | **Multi-page documents, reports, academic papers, resumes** | `html2pdf-next.js` | A4/custom pagination, 20mm margin fallback, cover adaptation, pdf-lib metadata |
336
347
  | **Creative pipeline (Blueprint → HTML → PDF)** | `html2pdf-next.js` via `convert.blueprint` | Called internally by design_engine pipeline |
337
348
 
@@ -371,7 +382,7 @@ Common issues with hand-written Python `page.pdf()` (the dedicated scripts handl
371
382
 
372
383
  **Iron rule: Posters and cover pages use `html2poster.js`, multi-page documents use `html2pdf-next.js`. Do not write hand-written Python Playwright scripts.**
373
384
 
374
- > **⚠️ Cover page gotcha:** Cover HTML uses `position: absolute` for layout. `html2pdf-next.js` pre-render hooks convert absolute-positioned elements to `static` flow (to prevent multi-page overlap), which **destroys** cover layouts. Always use `html2poster.js` for cover pages.
385
+ > **⚠️ Cover page note:** Report/Academic covers are rendered with ReportLab (`scripts/cover_render.py`), NOT HTML — so this gotcha no longer applies to them. It remains relevant only if you hand-author a full-page fixed HTML layout (rare): such a layout uses `position: absolute`, which `html2pdf-next.js` would convert to `static` flow and break — use `html2poster.js` for that case.
375
386
 
376
387
  ### No overflow:hidden on Fixed-Size Pages (html2pdf-next.js only)
377
388
 
@@ -673,12 +684,19 @@ palette.cascade --title "..." --format reportlab # Ready-to-paste Repo
673
684
 
674
685
  | Brief | Primary Tool | Secondary | Emoji Support | Custom Page Size |
675
686
  |-------|-------------|-----------|---------------|-----------------|
676
- | Report | ReportLab + pypdf | **Playwright (cover)** | ❌ (tofu □) | Manual pagination |
677
- | Creative | Playwright | html2pdf-next.js (pdf-lib for post-processing) | ✅ native | ✅ any size |
678
- | Academic | Tectonic + pypdf | **Playwright (cover)** | ❌ (dropped) | Template-dependent |
679
- | Process | pikepdf, pdfplumber | LibreOffice (soffice) | N/A | N/A |
680
-
681
- > **Unified Cover System**: All routes generate covers via HTML/Playwright. Report uses Templates 01–07, Academic uses Templates 08–10 (dark backgrounds, scholarly typography), Creative generates cover + body in one HTML document. Cover PDFs are merged with body PDFs via pypdf.
687
+ | Report | ReportLab + pypdf | **ReportLab cover (`cover_render.py`)** | ❌ (tofu □) | Manual pagination |
688
+ | Creative | Playwright *(optional)* | html2pdf-next.js (pdf-lib for post-processing) | ✅ native | ✅ any size |
689
+ | Academic | Tectonic *(optional)* + pypdf | **ReportLab cover (`cover_render.py`)** | ❌ (dropped) | Template-dependent |
690
+ | Process | pikepdf, pdfplumber | LibreOffice (soffice) *(optional)* | N/A | N/A |
691
+
692
+ > **Cover System (V4.0)**: Report and Academic covers are rendered with **ReportLab** via
693
+ > `scripts/cover_render.py` (templates 01–05 report, 06–08 academic dark, 09 institutional) and
694
+ > merged as page 1 via pypdf — **no HTML/Playwright/Chromium**. Creative composes its cover inside
695
+ > its own HTML document. Fonts are auto-detected from the host and chosen by cover style (see
696
+ > `typesetting/cover.md` Part 3).
697
+ >
698
+ > **Optional engines**: Playwright/Chromium (Creative/poster/HTML→PDF) and Tectonic (Academic/LaTeX)
699
+ > are optional — probe first and ask the user before installing (large downloads / long waits).
682
700
  >
683
701
  > **Fallback**: If Report brief content has emoji → reroute to Creative.
684
702
 
@@ -701,7 +719,7 @@ configs/
701
719
  fonts.md ← Font stacks per pipeline (Creative/Report/Academic)
702
720
  typesetting/
703
721
  palette.md ← Color system + typography + anti-patterns + spacing
704
- cover.md ← Cover page layout system (7 layouts × 2-3 variants) + typography scale + color rules
722
+ cover.md ← ReportLab cover engine V4.0 (templates 01–09) + selection matrix + font strategy + color rules
705
723
  cover-backgrounds.md ← Cover background rendering rules + transparency constraints
706
724
  charts.md ← Chart styling + anti-stacking rules + axis/grid/legend treatment
707
725
  overflow.md ← Bounding box system, text/image/table overflow prevention
@@ -711,13 +729,14 @@ typesetting/
711
729
  fill-engine.md ← Adaptive anti-void layout engine V2.0
712
730
  scripts/
713
731
  pdf.py ← CLI tool (30 subcommands)
732
+ cover_render.py ← ReportLab cover engine (templates 01–09, host font detection). Report/Academic covers.
714
733
  pdf_qa.py ← PDF quality checker (metadata, fonts, overflow, margins, tables, formulas)
715
734
  design_engine.py ← Generative SVG + palette engine (palette/svg/compile/derive/audit)
716
735
  poster_validate.py ← HTML/PDF validator
717
736
  toc_validate.py ← TOC validator
718
737
  html2pdf-next.js ← Playwright + pdf-lib HTML→PDF converter for documents (no Paged.js)
719
738
  html2poster.js ← Playwright HTML→PDF converter for posters/single-page (auto overflow:hidden, dynamic height)
720
- cover_validate.js ← Cover-ONLY overlap detection (text vs decorative lines). Do NOT run on posters or documents — only on cover HTML in Report/Academic pipelines.
739
+ cover_validate.js ← (legacy) HTML cover overlap detection — NOT used by the ReportLab cover engine; kept only for hand-authored HTML covers.
721
740
  references/
722
741
  resume-altacv.tex ← AltaCV dual-column resume template (creative/tech)
723
742
  resume-academic.tex ← Academic CV template (PhD/academic)
@@ -819,7 +838,7 @@ Run `pdf_qa.py` after generating a PDF. It auto-detects: metadata completeness,
819
838
  ### Cover V2 (cover.md)
820
839
 
821
840
  - [ ] **Evaluate whether a cover is needed**: Reports, proposals, analysis, white papers, manuals ≥ 3 pages → **always add cover (default ON)**. Skip cover ONLY for: resumes, CVs, letters, memos, forms, checklists, invoices, internal notes, or documents ≤ 2 pages
822
- - [ ] **Single PDF output**: Cover is merged into the final PDF as page 1. **Report/Academic**: cover generated via HTML/Playwright → merged as page 0 via pypdf. **Creative**: cover is part of the same HTML document. NEVER deliver a separate cover file
841
+ - [ ] **Single PDF output**: Cover is merged into the final PDF as page 1. **Report/Academic**: cover rendered by `cover_render.py` (ReportLab) → merged as page 1 via pypdf. **Creative**: cover is part of the same HTML document. NEVER deliver a separate cover file
823
842
  - [ ] **Page isolation**: Cover NEVER shares a page with TOC or body content. **Report/Academic**: inherent via pypdf merge (separate PDFs). **Creative**: CSS page-break ensures isolation
824
843
  - [ ] **Absolute Anchor Grid**: All elements use percentage Y-anchors (Part 0, A0.1). NO flow-based layout
825
844
  - [ ] **Z-Index Layers**: Render in strict order: Layer 0 (bg fill) → Layer 1 (decorative, CLIPPED) → Layer 2 (structure lines) → Layer 3 (text)
@@ -829,7 +848,7 @@ Run `pdf_qa.py` after generating a PDF. It auto-detects: metadata completeness,
829
848
  - [ ] **Background watermark complete** 🆕: All background layer watermark text (year, document type, sidebar text) must be 100% visible within page bounds - auto-shrink font if needed, NEVER clip/truncate
830
849
  - [ ] **Data binding correct** 🆕: Hero Title = company/entity name (biggest, heaviest text); Kicker = report type/subtitle (small decorative text). NEVER reverse this mapping
831
850
  - [ ] **Fill Engine applied** 🆕: Font floor enforced (body ≥ 14pt single-col / 12pt dual-col, H1 ≥ 32pt, H2 ≥ 24pt, H3 ≥ 18pt); Fill Ratio calculated; inflation triggered when < 65%; Y-axis golden-ratio anchor when < 40%
832
- - [ ] **Selected one of 7+4 templates**: General templates 01–07 + Academic templates 08–10 + Institutional template 11. Autonomously select the best-fit template by analyzing document intent (Calm/Tension/Energy/Authority/Warmth) and document type per Part 2 Intent × Type matrix. Thesis proposals/dissertations/institutional submissions → **default Template 11**. No global default - every selection must be a deliberate design decision
851
+ - [ ] **Selected one of templates 01–09**: Report templates 01–05 (light) + Academic 06–08 (dark) + Institutional 09. Autonomously select the best-fit template by analyzing document intent (Calm/Tension/Energy/Authority/Warmth) and document type per Part 2 Intent × Type matrix. Thesis proposals/dissertations/institutional submissions → **default Template 09**. No global default - every selection must be a deliberate design decision
833
852
  - [ ] **Typography weight hierarchy**: Hero 45-65pt Heavy, Meta 20-22pt Regular, Kicker/Footer 16pt with 3pt letter-spacing + 60% opacity, Summary 16-18pt Regular
834
853
  - [ ] **Base spacing unit**: `U = W * 0.05` - all spacing should be multiples of U
835
854
  - [ ] **Bounding box via absolute anchors**: Each block anchored to fixed Y%, grows only within its own zone, never pushes adjacent blocks
@@ -842,7 +861,7 @@ Run `pdf_qa.py` after generating a PDF. It auto-detects: metadata completeness,
842
861
  - [ ] **Line-to-text minimum gap** �F: Decorative lines (Layer 2) must be at least `U` (= `W * 0.05`) away from any text content
843
862
  - [ ] **No dark/gradient backgrounds**: No dark fills, no gradients, no high-saturation schemes
844
863
  - [ ] **Hard width enforcement**: Text wraps vertically at zone boundary, NEVER bleeds horizontally past assigned width
845
- - [ ] **🚫 NEVER use ReportLab for covers** — ALL covers (Report, Creative, Academic) are generated via HTML/Playwright. See cover.md for the 10-template system. If you catch yourself writing `canvas.setFillColor()` + `canvas.rect()` for a cover background, STOP — switch to HTML/Playwright.
864
+ - [ ] **✅ Report/Academic covers use ReportLab** — render via `scripts/cover_render.py` (templates 01–09) and merge as page 1 via pypdf. Do NOT build Report/Academic covers with HTML/Playwright. (Creative composes its cover inside its own HTML document.) Pick a template per `typesetting/cover.md` Part 2; pass a palette from `palette.cascade`.
846
865
  - [ ] **Line-length alignment (S3.7)**: Vertical lines match text block height (± 1U); horizontal lines ≥ widest text element width (never shorter than text)
847
866
  - [ ] **Vertical balance (S3.8)**: No >40% dead whitespace at bottom; sparse content uses centered distribution; CJK titles 15-20% larger than Latin equivalent
848
867
  - [ ] **Percentage positioning safety (S3.9)**: Every element with `top: XX%` must have a containing block with deterministic height (`height: 100%`, `inset: 0`, or `top+bottom` pair). Wrappers without explicit height + percentage-positioned children = overlap bug. Prefer px values over percentages
@@ -897,7 +916,7 @@ Run `pdf_qa.py` after generating a PDF. It auto-detects: metadata completeness,
897
916
  - [ ] **Decorative elements ≤ 3 per page**: Maximum 3 decorative/non-functional visual elements per page (lines, shapes, icons, patterns). Cover page exempt
898
917
  - [ ] **No gratuitous icons/emoji in headers**: Section headers should use typography hierarchy (size, weight, color) for emphasis — NOT emoji, icons, or decorative bullets unless the user explicitly requested them
899
918
  - [ ] **No rainbow/multi-color schemes**: Stick to the single-family palette system. If you find yourself using 4+ distinct hue families in one document, STOP and simplify
900
- - [ ] **No decorative borders on body pages**: Body content pages must NOT have decorative borders, corner ornaments, or page frames. Clean margins only. (Cover page Template 11 border is the sole exception)
919
+ - [ ] **No decorative borders on body pages**: Body content pages must NOT have decorative borders, corner ornaments, or page frames. Clean margins only. (Cover template 09 border is the sole exception)
901
920
  - [ ] **No texture/pattern backgrounds on body pages**: Body pages use solid white or ultra-light tinted backgrounds only. No dot grids, crosshatch, diagonal lines, or any pattern fills
902
921
  - [ ] **Whitespace is design**: Empty space between elements is intentional and valuable. Do NOT fill every gap with decorative elements, horizontal rules, or filler content
903
922
  - [ ] **Typography over decoration**: Create visual hierarchy through font size, weight, spacing, and color — not through adding more visual elements. If a design looks busy, REMOVE elements rather than rearranging them
@@ -962,4 +981,4 @@ If IDs are not exact, stop at `slide_number`; never guess or cite intermediates
962
981
  ::zcode-file-citation{path="/abs/path/book.xlsx" purpose="source" artifact_kind="workbook" sheet="Revenue Model" range="C27"}
963
982
  ```
964
983
 
965
- Never cite intermediates unless asked.
984
+ Never cite intermediates unless asked.
@@ -45,12 +45,11 @@ Confirm with the user:
45
45
  ### Phase 2 - SETUP
46
46
 
47
47
  **Title Page (Cover) Rules:**
48
- - **Academic route covers are generated via HTML/Playwright**, using Templates 08-11 from `typesetting/cover.md`. Templates 08-10 replicate LaTeX title page aesthetics (dark backgrounds, serif titles, symmetric layouts) in HTML/CSS. **Template 11 (Institutional)** is for thesis proposals, dissertations, and formal institutional submissions (white bg + black border frame).
49
- - **Pipeline:** Generate body PDF via Tectonic (no title page in `.tex`) → Generate cover HTML (Template 08/09/10/11) → Playwright `page.pdf()` → Merge cover as page 0 via pypdf
50
- - **Template selection:** For thesis proposals (开题报告), dissertations (毕业论文), and institutional submissions → **default to Template 11**. For research papers, preprints, journal submissions → Templates 08-10.
48
+ - **Academic route covers are generated with ReportLab** via `scripts/cover_render.py`, using templates **06–09** from `typesetting/cover.md`. Templates 06–08 replicate LaTeX title-page aesthetics (dark backgrounds, serif titles, symmetric layouts). **Template 09 (Institutional)** is for thesis proposals, dissertations, and formal institutional submissions (white bg + black border frame). Pure Python — **no HTML/Playwright/Chromium required.**
49
+ - **Pipeline:** Generate body PDF via Tectonic (no title page in `.tex`) → Generate cover PDF via `cover_render.py` (template 06/07/08/09) → Merge cover as page 1 via pypdf.
50
+ - **Template selection:** thesis proposals (开题报告), dissertations (毕业论文), institutional submissions → **default to Template 09**. arXiv/preprint → **06**; IEEE/ACM/English thesis → **07**; CJK journal / thesis with keywords → **08**.
51
51
  - **NEVER use `\maketitle`** - it produces ugly default output with cramped spacing
52
- - **NEVER use `\begin{titlepage}...\end{titlepage}`** - the cover is generated separately via HTML/Playwright
53
- - **NEVER use LaTeX TikZ overlay for full-page covers** - TikZ `current page` coordinates are unreliable with `margin=0pt`, causing backgrounds to not fill the page (right/bottom white edges). HTML/CSS full-bleed is pixel-exact.
52
+ - **NEVER use `\begin{titlepage}...\end{titlepage}`** - the cover is generated separately via ReportLab
54
53
  - Title page is OPTIONAL - skip it for short documents (≤ 2 pages), letters, memos, or when content scanning is priority
55
54
  - **`\tableofcontents` must be the FIRST page** of the body PDF (after merge, it becomes page 2)
56
55
  - If no TOC, content starts on page 1 of the body PDF
@@ -59,41 +58,30 @@ Confirm with the user:
59
58
  ```
60
59
  1. Write .tex WITHOUT any title page
61
60
  2. Run poster_validate.py check-tex on .tex file - fix table overflow / image width ERRORs
62
- 3. Compile with tectonic → body.pdf
63
- 4. Write cover HTML using Template 08/09/10/11 from typesetting/cover.md (Template 11 for thesis proposals/dissertations)
64
- 5. Run poster_validate.py check-html on cover HTML - fix any ERRORs
65
- 6. Run cover_validate.js on cover HTML - fix any text-line overlaps
66
- 7. Render cover HTML → PDF via Playwright (`html2poster.js`) — **NOT `html2pdf-next.js`** (which converts absolute→static and destroys cover layout)
67
- 8. Merge: insert cover as page 0 of body PDF via pypdf
61
+ 3. Compile with tectonic → body.pdf (see §Tectonic preflight — ask before installing)
62
+ 4. Render cover PDF via cover_render.py (template 06/07/08/09) from typesetting/cover.md
63
+ 5. Merge: insert cover as page 1 of body PDF via pypdf
68
64
  ```
69
65
 
70
- **Cover HTML → PDF rendering:**
66
+ **Cover rendering:**
71
67
  ```bash
72
- # ALWAYS use html2poster.js for cover rendering (NOT html2pdf-next.js)
73
- # Cover pages use position:absolute layout — html2pdf-next.js pre-render hooks
74
- # convert absolute→static and destroy the layout. html2poster.js preserves it.
75
- node "$PDF_SKILL_DIR/scripts/html2poster.js" cover.html --output cover.pdf --width 794px
68
+ python3 "$PDF_SKILL_DIR/scripts/cover_render.py" 07 --out cover.pdf --content cover_content.json
76
69
  ```
77
-
78
70
  Or from Python:
79
71
  ```python
80
- import subprocess, os
81
-
82
- def render_cover(html_path, pdf_path):
83
- """
84
- Render HTML cover to PDF via html2poster.js.
85
-
86
- ⚠️ ALWAYS use html2poster.js for covers (NOT html2pdf-next.js).
87
- Cover HTML uses position:absolute for layout. html2pdf-next.js pre-render
88
- hooks convert absolute→static to prevent multi-page overlap, which
89
- destroys cover layouts. html2poster.js preserves absolute positioning.
90
- """
91
- scripts_dir = os.path.join(PDF_SKILL_DIR, 'scripts') # PDF_SKILL_DIR from SKILL.md § Script Path Setup
92
- subprocess.run([
93
- 'node', os.path.join(scripts_dir, 'html2poster.js'),
94
- html_path, '--output', pdf_path,
95
- '--width', '794px',
96
- ], check=True)
72
+ import sys, os
73
+ sys.path.insert(0, os.path.join(PDF_SKILL_DIR, "scripts"))
74
+ from cover_render import render_cover, detect_fonts
75
+ content = {
76
+ "label": "博士学位论文 · DOCTORAL DISSERTATION",
77
+ "title": "……", # serif title (auto-wrap, ≤ 3 lines)
78
+ "subtitle": "……",
79
+ "authors": "……", "institution": "……",
80
+ "keywords_lines": ["……", "……"], # template 08 only
81
+ "footer_left": "……", "footer_right": "2026 年 3 月",
82
+ }
83
+ # Template 09 (institutional) uses: institution, doc_type, title, fields=[[label,value],...], date
84
+ render_cover("07", content, "cover.pdf", fonts=detect_fonts())
97
85
  ```
98
86
 
99
87
  **Merge cover + body:**
@@ -122,9 +110,9 @@ with open('final.pdf', 'wb') as f:
122
110
  writer.write(f)
123
111
  ```
124
112
 
125
- **→ Full cover templates: see §PART 4.5 in `typesetting/cover.md` (Templates 08-10).**
113
+ **→ Full cover templates: see PART 1 in `typesetting/cover.md` (templates 06–09).**
126
114
 
127
- > **⚠️ Why HTML/Playwright covers?** LaTeX TikZ `remember picture, overlay` with `margin=0pt` frequently fails to fill the page (right/bottom edges show white). HTML/CSS with `@page { margin: 0 }` and full-bleed background is pixel-exact, with zero ambiguity. This also unifies all three routes (Report, Creative, Academic) under one cover system.
115
+ > **⚠️ Why a separate ReportLab cover (not `\begin{titlepage}`)?** LaTeX TikZ `remember picture, overlay` with `margin=0pt` frequently fails to fill the page (right/bottom edges show white). `cover_render.py` outputs an exact-A4, full-bleed cover in pure Python — pixel-exact and dependency-free — merged as page 1 via pypdf.
128
116
 
129
117
  Write the preamble. Start from this foundation and customise per document:
130
118
 
@@ -172,7 +160,7 @@ Write the preamble. Start from this foundation and customise per document:
172
160
  - **🔴 Quotation marks (English):** NEVER use straight quotes `"..."`。English text must use LaTeX curly quotes: ` ``left quote'' ` for double, `` `single' `` for single. Straight `"` in LaTeX means right double quote only.
173
161
  - **🔴 Quotation marks (Chinese — CRITICAL):** Chinese quoted text like "北漂" MUST use Unicode smart quotes "…" (U+201C/U+201D) directly in the `.tex` source. **NEVER use ASCII `"` for Chinese quotes** — LaTeX interprets `"` as a right double quote (`"`), so `"北漂"` renders as `"北漂"` (two right quotes, no left quote). The correct LaTeX source is: `"北漂"` (literal Unicode characters). `\usepackage{csquotes}` is a safety net but does NOT fix raw ASCII `"` in Chinese text.
174
162
  - **Scope:** This rule applies ONLY to Chinese-language body text. Do NOT replace `"` in English paragraphs (use ` ``...'' ` instead), `verbatim`/`lstlisting`/`minted` environments, `\texttt{}`/`\verb||`/`\url{}`/`\href{}{}` arguments, or BibTeX `.bib` field values.
175
- - **🔴 Title page isolation:** Cover is generated via HTML/Playwright and merged as page 0 via pypdf - isolation is inherent in the merge pipeline. `\tableofcontents` should be the first page of the `.tex` body. Verify: does TOC start on the page immediately after the cover in the merged PDF?
163
+ - **🔴 Title page isolation:** Cover is generated via ReportLab (`cover_render.py`) and merged as page 1 via pypdf - isolation is inherent in the merge pipeline. `\tableofcontents` should be the first page of the `.tex` body. Verify: does TOC start on the page immediately after the cover in the merged PDF?
176
164
  - **🔴 TOC requires a cover page:** Unless the user explicitly requests no cover, if the document has `\tableofcontents`, it MUST have a cover page. Structure: Cover (page 1) → TOC (page 2) → Content (page 3+). Do not generate a TOC without a preceding cover page. This rule is consistent with `briefs/report.md`.
177
165
 
178
166
  **When no style is specified**, apply a measured, high-craft system:
@@ -483,6 +471,13 @@ This has been studied\cite{smith2023}. % → studied^[1]
483
471
 
484
472
  ### Phase 4 - COMPILE
485
473
 
474
+ > ### 🟡 Tectonic preflight — ASK BEFORE INSTALLING (MANDATORY)
475
+ > The LaTeX engine (Tectonic) is an **optional** dependency and may not be installed. Before compiling:
476
+ > 1. Probe it: `python3 "$PDF_SKILL_DIR/scripts/pdf.py" env.check` (look at the `tectonic` line), or check for a `tectonic` binary on PATH / in `scripts/`.
477
+ > 2. **If Tectonic is missing, do NOT auto-install.** Use the **AskUserQuestion** tool to ask whether to install it, and warn clearly: *installing Tectonic and downloading the LaTeX package/font set on first run can take several minutes to tens of minutes depending on network.*
478
+ > 3. Only after the user confirms, install it (see `env_setup/setup.md` → optional Tectonic), then compile.
479
+ > 4. If the user declines, offer the **Report route (ReportLab)** as a no-LaTeX alternative for non-math documents, or stop.
480
+
486
481
  ```bash
487
482
  python3 "$PDF_SKILL_DIR/scripts/pdf.py" convert.latex main.tex --runs 2
488
483
  ```
@@ -547,7 +542,7 @@ When the document has **more than 3 non-trivial equations** (matrices, aligned s
547
542
 
548
543
  % ═══════════════════════════════════════════════════════
549
544
  % NO TITLE PAGE IN .tex - Cover is generated separately
550
- % via HTML/Playwright and merged as page 0.
545
+ % via ReportLab (cover_render.py) and merged as page 1.
551
546
  % Body PDF starts directly with TOC or content.
552
547
  % ═══════════════════════════════════════════════════════
553
548
 
@@ -1012,20 +1007,17 @@ After installing, verify: `tectonic --version`. The `_find_tectonic()` function
1012
1007
 
1013
1008
  ---
1014
1009
 
1015
- > **⚠️ Legacy Note:** Academic covers previously used ReportLab canvas API (cover_recipe_A/B/C/D/L). This approach is **fully deprecated**. All academic covers now use HTML/Playwright Templates 08-11 (see `typesetting/cover.md` and the pipeline at line 58-118 of this file). Do NOT write ReportLab cover code.
1010
+ > **⚠️ Legacy Note:** Academic covers previously used the ReportLab canvas *recipe* API (cover_recipe_A/B/C/D/L) and, later, HTML/Playwright templates. Both are **deprecated**. Academic covers now use the ReportLab **cover engine** `scripts/cover_render.py` (templates 06–09; see `typesetting/cover.md` and the pipeline near the top of this file). Do NOT hand-write cover canvas code or cover HTML.
1016
1011
 
1017
1012
  ### ⚠️ Post-Cover Generation Checks (Mandatory)
1018
1013
 
1019
- After generating the cover HTML and before converting to PDF, run `poster_validate.py check-html`; after generating the cover PDF, run `pdf_qa.py`:
1014
+ Render the cover with `cover_render.py`, merge as page 1, then run `pdf_qa.py` on the merged PDF:
1020
1015
 
1021
1016
  ```bash
1022
- # Step 1: HTML check
1023
- python3 "$PDF_SKILL_DIR/scripts/poster_validate.py" check-html cover.html
1024
- # Step 2: Cover overlap check
1025
- node "$PDF_SKILL_DIR/scripts/cover_validate.js" cover.html
1026
- # Step 3: Convert to PDF
1027
- node "$PDF_SKILL_DIR/scripts/html2poster.js" cover.html --output cover.pdf --width 794px
1028
- # Step 4: PDF check
1017
+ # Step 1: Render cover (template 06/07/08/09) — pure ReportLab, no HTML
1018
+ python3 "$PDF_SKILL_DIR/scripts/cover_render.py" 07 --out cover.pdf --content cover_content.json
1019
+ # Step 2: Merge cover as page 1 of the Tectonic body (see the pypdf snippet near the top of this file)
1020
+ # Step 3: PDF check on the merged file
1029
1021
  python3 "$PDF_SKILL_DIR/scripts/pdf_qa.py" final.pdf --skip-cover --formulas
1030
1022
 
1031
1023
  # MANDATORY: Post-generation pipeline
@@ -1,5 +1,12 @@
1
1
  # Brief: Creative Production (Art Director Blueprint Mode)
2
2
 
3
+ > ### 🟡 Playwright/Chromium preflight — ASK BEFORE INSTALLING **OR FALLING BACK** (MANDATORY)
4
+ > The Creative pipeline renders via **Playwright + Chromium**, which are **optional** dependencies and may not be installed. Before generating any HTML→PDF output (`convert.blueprint`, `html2pdf-next.js`, `html2poster.js`):
5
+ > 1. Probe them: `python3 "$PDF_SKILL_DIR/scripts/pdf.py" env.check` (look at the `playwright` / `chromium` lines).
6
+ > 2. **If Playwright or Chromium is missing, do NOT auto-install — and do NOT work around it on your own.** Use the **AskUserQuestion** tool to ask whether to install, and warn clearly: *installing Playwright and downloading the Chromium browser can take several minutes and ~150–300 MB; on a slow network it may take much longer.* Finding a no-install workaround does not excuse skipping this question — using a system Chrome/Chromium (`--headless --print-to-pdf` or an `executablePath` override), hand-writing a renderer, or quietly switching to ReportLab are all forbidden before the user has decided.
7
+ > 3. Only after the user confirms, install (see `env_setup/setup.md` → optional Playwright/Chromium), then render.
8
+ > 4. **Only after the user declines**: for a text/report-style document, offer the **Report route (ReportLab, no browser)** instead; for a genuinely visual design (poster/infographic with emoji), explain it cannot proceed without Chromium and stop.
9
+
3
10
  **Core Paradigm Shift**: You are NO LONGER a frontend developer writing HTML/CSS. You are an elite Art Director and Editorial Designer.
4
11
 
5
12
  Because LLMs lack spatial awareness and struggle to maintain perfectly nested, complex CSS over thousands of tokens, you are strictly forbidden from outputting raw HTML/CSS/Python.
@@ -176,7 +183,7 @@ Key rules for Creative pipeline charts:
176
183
 
177
184
  For each page in your JSON, you must declare an `archetype`. This tells `design_engine.py` how to arrange the components you provided.
178
185
 
179
- - `"cover_hero"`: Cover page. **Must follow `typesetting/cover.md` 7-template system** - pick Layout 1-7 based on document tone. See "Cover Page Constitution" below for iron rules.
186
+ - `"cover_hero"`: Cover page. Draw inspiration from the cover **designs** in `typesetting/cover.md` (templates 01–09) for layout intent, but **compose it in HTML with Creative components** (the Creative route builds its cover inside the same HTML document — it does NOT call the ReportLab cover engine, which is for the Report/Academic routes). See "Cover Page Constitution" below for iron rules.
180
187
  - `"split_vertical"`: Page split strictly 50/50 vertically. Left side image/svg, right side Glass_Canvas.
181
188
  - `"editorial_flow"`: Top-down reading experience. Centered columns, generous margins. Use for main content.
182
189
  - `"scattered_canvas"`: No grid. Elements placed via absolute positioning based on spatial weights.
@@ -623,7 +630,8 @@ Study these examples to understand how to translate raw requests into perfect bl
623
630
  ## Pre-Flight Checklist (Self-Correction before generating output)
624
631
 
625
632
  Before you output the JSON block, verify:
626
- 0. **🚨 VECTOR OUTPUT IRON RULE:** The final PDF MUST be generated via `page.pdf()` / `convert.blueprint` - NEVER `page.screenshot()` → image → wrap as PDF. Screenshot PDFs are blurry raster images. `page.pdf()` produces vector text that stays sharp at any zoom level.
633
+ 0a. **🚨 PLAYWRIGHT/CHROMIUM PREFLIGHT:** Did I run `env.check`? If `node`/`playwright`/`chromium` were not all ✓, did I ask the user via AskUserQuestion instead of picking a fallback myself? See the preflight at the top of this file.
634
+ 0b. **🚨 VECTOR OUTPUT IRON RULE:** The final PDF MUST be generated via `page.pdf()` / `convert.blueprint` - NEVER `page.screenshot()` → image → wrap as PDF. Screenshot PDFs are blurry raster images. `page.pdf()` produces vector text that stays sharp at any zoom level.
627
635
  1. **Did I write ANY HTML or CSS?** If yes, delete it. Only output JSON.
628
636
  2. **Is any `Glass_Canvas` markdown content too long?** Count the words. Over 150? Summarize it or push to the next page.
629
637
  3. **Is the JSON perfectly formatted?** Missing commas or unescaped quotes will crash the `design_engine.py` parser.
@@ -767,4 +775,4 @@ node "$PDF_SKILL_DIR/scripts/html2pdf-next.js" input.html --output output.pdf --
767
775
  ```
768
776
  - **ERROR** items (e.g. `OVERFLOW_HIDDEN_CONTAINER`, `FONT_NO_FALLBACK`) → must fix before PDF generation. Use `--fix --output <file>.html` for auto-repair.
769
777
  - **WARNING** items (e.g. `FIXED_SIZE_NO_SCREEN_ADAPT`, `SCREEN_ADAPT_NO_SCALE`, `COLOR_CONTRAST`) → review and fix where appropriate.
770
- - This catches the most common bypass HTML bugs: `overflow:hidden` on containers, missing `@media screen` auto-scale for fixed-size pages, font-family without generic fallback, low contrast text, etc.
778
+ - This catches the most common bypass HTML bugs: `overflow:hidden` on containers, missing `@media screen` auto-scale for fixed-size pages, font-family without generic fallback, low contrast text, etc.
@@ -1,5 +1,8 @@
1
1
  # Poster Scene Rules — Creative Pipeline (Poster-Specific Constraints)
2
2
 
3
+ > 🟡 **Playwright/Chromium preflight applies here too.** Posters render via Playwright/Chromium (optional deps). Before rendering, probe availability and — if missing — use **AskUserQuestion** to warn about the long install/download and get confirmation before installing. See `briefs/creative.md` top for the full preflight.
4
+
5
+
3
6
  > When poster / 海报 / 传单 / flyer / 宣传页 keywords are detected, load these rules on top of `creative.md`.
4
7
  > These rules take priority over `creative.md` generic rules; in case of conflict, this file prevails.
5
8
  >
@@ -2,6 +2,9 @@
2
2
 
3
3
  Work with existing PDFs: extract, merge, split, fill forms, convert formats, or **reformat** with a new design. Usually a Light triage path — except reformat, which escalates to Standard.
4
4
 
5
+ > 🟡 **Optional-engine preflight.** Some paths here use optional engines: **Playwright/Chromium** (HTML→PDF `convert.html`, xlsx/pptx→HTML fallback) and **LibreOffice/soffice** (Office→PDF). If a needed engine is missing, do NOT auto-install — use the **AskUserQuestion** tool to warn about the install/download time and get confirmation first. See `briefs/creative.md` top for the Playwright preflight pattern.
6
+
7
+
5
8
  ---
6
9
 
7
10
  ## Decision Tree