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.
- package/bin/zcode.js +92 -47
- package/package.json +2 -2
- package/vendor/extraction.json +131 -5
- package/vendor/node_modules/@zcode/tui/dist/index.js +35 -4
- package/vendor/packages/browser-use-plugin/.zcode-plugin/plugin.json +1 -1
- package/vendor/packages/browser-use-plugin/dist/mcp/server.js +12880 -10408
- package/vendor/packages/browser-use-plugin/package.json +1 -1
- package/vendor/packages/document-skills-plugin/.mcp.json +13 -0
- package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +19 -6
- package/vendor/packages/document-skills-plugin/package.json +3 -3
- package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +6 -2
- package/vendor/packages/document-skills-plugin/skills/docx/env_setup/env_check.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/docx/env_setup/setup_mac_linux.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/docx/setup.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +39 -20
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/academic.md +39 -47
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/creative.md +11 -3
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/poster.md +3 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +3 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/report.md +41 -62
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/env_check.sh +23 -15
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup.md +37 -19
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_mac_linux.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_windows.ps1 +17 -19
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/cover_render.py +487 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2poster.js +43 -11
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +145 -50
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +23 -21
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover-backgrounds.md +1 -1
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover.md +139 -1347
- package/vendor/packages/document-skills-plugin/skills/pptx/LICENSE.txt +13 -0
- package/vendor/packages/document-skills-plugin/skills/pptx/SKILL.md +146 -179
- package/vendor/packages/document-skills-plugin/skills/xlsx/SKILL.md +6 -2
- package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/env_check.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_mac_linux.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/xlsx/setup.sh +0 -0
- package/vendor/packages/zcode-cua-plugin/.zcode-plugin/plugin.json +19 -0
- package/vendor/packages/zcode-cua-plugin/dist/mcp/server.js +68498 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/color.cjs +1596 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/index.cjs +1 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/package.json +58 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +221 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +1 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/package.json +42 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/versions.json +30 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/LICENSE +191 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/package.json +46 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/LICENSE +201 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/elf.js +39 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/process.js +24 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/package.json +44 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/LICENSE +15 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/bin/semver.js +191 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/comparator.js +143 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/index.js +7 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/range.js +557 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/semver.js +333 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/clean.js +8 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/cmp.js +54 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/coerce.js +62 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-build.js +9 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-loose.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare.js +7 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/diff.js +60 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/eq.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gt.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gte.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/inc.js +21 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lt.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lte.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/major.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/minor.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/neq.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/parse.js +18 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/patch.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/prerelease.js +8 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rcompare.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rsort.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/satisfies.js +12 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/sort.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/valid.js +8 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/index.js +91 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/constants.js +37 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/debug.js +11 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/identifiers.js +29 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/lrucache.js +42 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/parse-options.js +17 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/re.js +223 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/package.json +78 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/preload.js +4 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/range.bnf +16 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/gtr.js +6 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/intersects.js +9 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/ltr.js +6 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-version.js +63 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/outside.js +82 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/simplify.js +49 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/subset.js +249 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/to-comparators.js +10 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/valid.js +13 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/LICENSE +191 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/build.js +38 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/check.js +14 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/channel.js +177 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/colour.js +195 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/composite.js +212 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/constructor.js +499 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/index.js +16 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/input.js +809 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/is.js +143 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/libvips.js +207 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/operation.js +1016 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/output.js +1666 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/resize.js +595 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/sharp.js +121 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/utility.js +291 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/package.json +202 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/binding.gyp +298 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.cc +1130 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.h +402 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.cc +346 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.h +90 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.cc +499 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.h +137 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.cc +1814 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.h +408 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/sharp.cc +43 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.cc +186 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.h +62 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.cc +288 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.h +22 -0
- package/vendor/packages/zcode-cua-plugin/package.json +31 -0
- package/vendor/packages/zcode-cua-plugin/scripts/build-mcp.mjs +58 -0
- package/vendor/packages/zcode-cua-plugin/scripts/bump-zcode-cua-producer.mjs +291 -0
- package/vendor/packages/zcode-cua-plugin/scripts/check-cua-baseline.mjs +155 -0
- package/vendor/packages/zcode-cua-plugin/scripts/check-version-coherence.mjs +478 -0
- package/vendor/packages/zcode-cua-plugin/scripts/sync-cache.mjs +100 -0
- package/vendor/packages/zcode-cua-plugin/scripts/sync-skill-from-zcode-cua.mjs +115 -0
- package/vendor/packages/zcode-cua-plugin/skills/zcode-computer-use/SKILL.md +129 -0
- package/vendor/zcode.cjs +752 -743
- package/zcode-runtime.lock.json +3 -3
- package/vendor/packages/document-skills-plugin/skills/pptx/assets/font_list.txt +0 -80
- package/vendor/packages/document-skills-plugin/skills/pptx/scripts/general_judge.py +0 -529
|
@@ -21,7 +21,7 @@ Structured documents via ReportLab: reports, proposals, contracts, white papers,
|
|
|
21
21
|
1. BRIEF → Confirm document type, audience, page count, outline
|
|
22
22
|
2. DESIGN → Run `pdf.py palette.generate --title "..."` → copy-paste output into script
|
|
23
23
|
3. EDIT → Content transformation (extract data, define typographic roles)
|
|
24
|
-
4. COVER → Read typesetting/cover.md → render
|
|
24
|
+
4. COVER → Read typesetting/cover.md → render ReportLab cover via scripts/cover_render.py (default ON for reports ≥ 3 pages; skip only for resumes/letters/memos/forms)
|
|
25
25
|
5. BUILD → Write ReportLab code (fonts → styles → content → tables → charts)
|
|
26
26
|
6. PREFLIGHT → code.sanitize → execute → meta.brand → font.check → toc.check → pages.clean → pdf_qa.py
|
|
27
27
|
7. DELIVER → Merge cover + body → final PDF
|
|
@@ -383,22 +383,16 @@ ReportLab pushes the **entire block** to the next page, leaving the current page
|
|
|
383
383
|
* Between H1 sections: `Spacer(1, 24)` (~2 lines)
|
|
384
384
|
* NEVER use `Spacer(1, X)` where X > 24, except for H1 major breaks or cover page elements
|
|
385
385
|
|
|
386
|
-
### Cover Page:
|
|
386
|
+
### Cover Page: ReportLab Cover Engine
|
|
387
387
|
|
|
388
|
-
**⚠️ Report route covers are
|
|
388
|
+
**⚠️ Report route covers are generated with ReportLab** via `scripts/cover_render.py`, using the template system defined in `typesetting/cover.md` (templates **01–05** for the Report route). Pure Python — **no HTML/Playwright/Chromium required.**
|
|
389
389
|
|
|
390
390
|
**Pipeline (Report route):**
|
|
391
|
-
1. Generate **body PDF** via ReportLab (start with TOC or content
|
|
392
|
-
2. Generate **cover
|
|
393
|
-
3. **
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
node "$PDF_SKILL_DIR/scripts/cover_validate.js" cover.html
|
|
397
|
-
```
|
|
398
|
-
5. Render cover HTML → single-page PDF via Playwright (`html2poster.js`) — **NOT `html2pdf-next.js`** (which converts absolute→static and destroys cover layout)
|
|
399
|
-
6. **Merge: insert cover as page 0** of body PDF using pypdf → output single final PDF
|
|
400
|
-
|
|
401
|
-
> **Why not ReportLab covers?** ReportLab is excellent for structured content (tables, paragraphs, flowables) but painful for visual design (geometric accents, precise absolute positioning, web fonts). HTML/CSS handles these natively. One cover system, one visual standard, zero inconsistency.
|
|
391
|
+
1. Generate **body PDF** via ReportLab (start with TOC or content — **no cover in story[]**).
|
|
392
|
+
2. Generate the **cover PDF** with `cover_render.py` (pick a template 01–05 per `typesetting/cover.md` Part 2; pass content + palette).
|
|
393
|
+
3. **Merge: insert cover as page 1** of the body PDF using pypdf → single final PDF.
|
|
394
|
+
|
|
395
|
+
> **Why ReportLab covers now?** The cover engine reproduces the previous HTML designs in pure ReportLab, so the Report route no longer depends on Playwright/Chromium. Fonts are auto-detected from the host machine and chosen by cover style (see `cover.md` Part 3). One cover engine, one visual standard.
|
|
402
396
|
|
|
403
397
|
**⚠️ Cover page is DEFAULT ON for all Report-route documents ≥ 3 pages.**
|
|
404
398
|
|
|
@@ -437,33 +431,31 @@ doc.build(story)
|
|
|
437
431
|
# Output: body.pdf (no cover)
|
|
438
432
|
```
|
|
439
433
|
|
|
440
|
-
#### Step 2: Generate Cover PDF via
|
|
434
|
+
#### Step 2: Generate Cover PDF via cover_render.py
|
|
441
435
|
|
|
442
436
|
```bash
|
|
443
|
-
#
|
|
444
|
-
|
|
445
|
-
# convert absolute→static and destroy the layout. html2poster.js preserves it.
|
|
446
|
-
node "$PDF_SKILL_DIR/scripts/html2poster.js" cover.html --output cover.pdf --width 794px
|
|
437
|
+
# Pick a template 01-05 per typesetting/cover.md Part 2. Content via JSON.
|
|
438
|
+
python3 "$PDF_SKILL_DIR/scripts/cover_render.py" 03 --out cover.pdf --content cover_content.json
|
|
447
439
|
```
|
|
448
440
|
|
|
449
441
|
Or from Python:
|
|
450
442
|
```python
|
|
451
|
-
import
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
"""
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
443
|
+
import sys, os
|
|
444
|
+
sys.path.insert(0, os.path.join(PDF_SKILL_DIR, "scripts"))
|
|
445
|
+
from cover_render import render_cover, detect_fonts
|
|
446
|
+
|
|
447
|
+
fonts = detect_fonts() # host-detected, style-driven; raises if no embeddable CJK font
|
|
448
|
+
content = {
|
|
449
|
+
"kicker": "2025 年度可持续发展报告 · ANNUAL ESG REPORT",
|
|
450
|
+
"hero": "青松环境科技", # entity/company name = Hero
|
|
451
|
+
"summary": "本报告系统披露……", # 2-4 lines; auto-fill if omitted
|
|
452
|
+
"meta": "发布单位:青松环境科技集团 · 2026 年 3 月",
|
|
453
|
+
"footer": "QINGSONG GREENTECH · DOC 2026-ESG-001",
|
|
454
|
+
"year": "2026", "word": "REPORT",
|
|
455
|
+
}
|
|
456
|
+
# palette: map pdf.py palette.cascade --format json into these keys
|
|
457
|
+
palette = {"primary": "#1e3a5f", "text": "#1a1a2e", "muted": "#6b7280", "bg": "#ffffff"}
|
|
458
|
+
render_cover("03", content, "cover.pdf", palette=palette, fonts=fonts)
|
|
467
459
|
```
|
|
468
460
|
|
|
469
461
|
**Insertion script (single output PDF):**
|
|
@@ -497,35 +489,28 @@ def insert_cover(cover_pdf, body_pdf, output_pdf):
|
|
|
497
489
|
writer.write(f)
|
|
498
490
|
```
|
|
499
491
|
|
|
500
|
-
> **⚠️ Size
|
|
501
|
-
|
|
502
|
-
**Cover HTML template reference**: See `typesetting/cover.md` for the complete 7-Layout System with variants, typography scale, and bounding box rules.
|
|
492
|
+
> **⚠️ Size note:** `cover_render.py` outputs an exact A4 page (595.28×841.89pt), so it merges cleanly with the ReportLab body. `normalize_page_to_a4()` remains a harmless safety check. **Do not use PIL Image.save('x.pdf')** for any PDF conversion — DPI mapping causes severe size errors.
|
|
503
493
|
|
|
504
|
-
**→ Full cover spec: `typesetting/cover.md`**
|
|
494
|
+
**→ Full cover spec: `typesetting/cover.md`** — read it before designing any cover (templates 01–09, selection matrix, font strategy).
|
|
505
495
|
|
|
506
|
-
**Cover design rules (summary
|
|
507
|
-
-
|
|
508
|
-
-
|
|
509
|
-
-
|
|
510
|
-
-
|
|
511
|
-
- Primary color used only for text, lines, geometric accents - never as large-area background
|
|
512
|
-
- Sophistication = whitespace + typography + restrained geometric accents
|
|
496
|
+
**Cover design rules (summary — see cover.md for details):**
|
|
497
|
+
- Rendered by `scripts/cover_render.py` on an A4 canvas (bottom-left origin).
|
|
498
|
+
- Fonts are **auto-detected from the host** and chosen by cover style (sans for 01–05, serif for 06–09). CFF fonts (PingFang/Hiragino/Noto CJK) are skipped; missing heavy weights use faux-bold. See `cover.md` Part 3.
|
|
499
|
+
- **Background must be white or very light** for report templates 01–05; primary color only for text/lines/accents, never a large-area fill (academic 06–08 are dark by design).
|
|
500
|
+
- Sophistication = whitespace + typography + restrained geometric accents.
|
|
513
501
|
|
|
514
|
-
**Cover Constitution (
|
|
515
|
-
- **Pick a
|
|
516
|
-
- **
|
|
517
|
-
- **
|
|
518
|
-
- **
|
|
519
|
-
- **
|
|
520
|
-
- **Bounding Box spatial dispersion**: Group elements into 2-3 bounding boxes at opposite regions (e.g., top-left + bottom-right). Never cluster everything into middle 40%.
|
|
521
|
-
- **Safe Zone**: 12% top/bottom, 14% left/right padding on cover pages.
|
|
522
|
-
- **No body text on cover**: Cover = title + subtitle + date + optional geometric decoration. All content goes to page 2+.
|
|
502
|
+
**Cover Constitution (templates 01–09):**
|
|
503
|
+
- **Pick a template (01–05 for Report)** from `typesetting/cover.md` Part 2 matching the document intent. No global default — every selection is a deliberate design decision. Template **05** (Solid Sidebar) for government/bidding/proposal.
|
|
504
|
+
- **Typography Scale**: Hero ≈ 45–66pt, Meta ≥ 16pt (never below 14pt). Tiny text = FAIL.
|
|
505
|
+
- **Data binding**: Hero = entity/company name (largest, heaviest); Kicker = report type/subtitle (small). Never reverse.
|
|
506
|
+
- **Mandatory Summary** block (2–4 lines) — the engine auto-fills if omitted.
|
|
507
|
+
- **Content only** — cover = kicker + hero + summary + meta (+ optional footer). All body content goes to page 2+.
|
|
523
508
|
|
|
524
509
|
### ⚠️ Cover Page Isolation Rule (MANDATORY)
|
|
525
510
|
|
|
526
511
|
**The cover page must ALWAYS be on its own page.** Cover content and subsequent content (TOC, body text, etc.) must NEVER appear on the same page. This is a hard rule.
|
|
527
512
|
|
|
528
|
-
- **Report route (
|
|
513
|
+
- **Report route (ReportLab cover)**: The cover is a separate `cover_render.py` PDF inserted as page 1 via pypdf — isolation is inherent in the merge pipeline
|
|
529
514
|
- **Creative route**: Cover is part of the same HTML document but on its own `<section>` with page-break - isolation is handled by CSS
|
|
530
515
|
|
|
531
516
|
If a generated PDF shows cover + TOC on the same page, it is a **critical bug** - regenerate immediately.
|
|
@@ -1627,12 +1612,6 @@ callout.setStyle(TableStyle([
|
|
|
1627
1612
|
story.append(KeepTogether(callout))
|
|
1628
1613
|
```
|
|
1629
1614
|
|
|
1630
|
-
### Cover Pages (HTML/Playwright)
|
|
1631
|
-
When the cover routes through Playwright:
|
|
1632
|
-
- Use `Delta_Widget` components for KPIs and metrics.
|
|
1633
|
-
- Use `Process_List` components for workflows and timelines.
|
|
1634
|
-
- Use `Sidenote_Block` components (in `tufte_report` archetype) for citations and supplementary data.
|
|
1635
|
-
- For data-heavy pages, add `data_points` arrays to any component - the engine renders them as content-aware background curves.
|
|
1636
1615
|
|
|
1637
1616
|
---
|
|
1638
1617
|
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Lightweight environment check for PDF skill.
|
|
3
|
-
# Exit 0 = all OK, exit 1 = missing
|
|
3
|
+
# Exit 0 = all CORE deps OK, exit 1 = missing CORE dependency.
|
|
4
|
+
# Playwright/Chromium (Creative/HTML pipeline) and Tectonic (Academic/LaTeX) are
|
|
5
|
+
# OPTIONAL — reported as INFO, never cause a non-zero exit. Install them on demand
|
|
6
|
+
# (with the user's confirmation) only when a route actually needs them.
|
|
4
7
|
# Also resolves and exports PDF_SKILL_DIR and FONT_DIR.
|
|
5
8
|
# Usage: source env_check.sh (preferred, exports vars to caller)
|
|
6
9
|
# or: bash env_check.sh [--quiet]
|
|
7
10
|
QUIET=false; [ "${1:-}" = "--quiet" ] && QUIET=true
|
|
8
11
|
FAIL=0
|
|
9
|
-
check() { local desc="$1"; shift; if ! "$@" &>/dev/null; then $QUIET || echo "MISSING: $desc"; FAIL=1; fi; }
|
|
12
|
+
check() { local desc="$1"; shift; if ! "$@" &>/dev/null; then $QUIET || echo "MISSING (core): $desc"; FAIL=1; fi; }
|
|
13
|
+
optional() { local desc="$1"; shift; if "$@" &>/dev/null; then $QUIET || echo "optional OK: $desc"; else $QUIET || echo "optional MISSING: $desc (install on demand)"; fi; }
|
|
10
14
|
|
|
11
15
|
# ── Resolve PDF_SKILL_DIR & FONT_DIR ──
|
|
12
16
|
_ENV_CHECK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
@@ -20,30 +24,34 @@ else
|
|
|
20
24
|
fi
|
|
21
25
|
export FONT_DIR
|
|
22
26
|
|
|
27
|
+
# ── CORE (required): Python + ReportLab/pypdf toolchain + CJK font ──
|
|
23
28
|
check "python3" command -v python3
|
|
24
|
-
check "node" command -v node
|
|
25
29
|
check "pikepdf" python3 -c "import pikepdf"
|
|
26
30
|
check "pdfplumber" python3 -c "import pdfplumber"
|
|
27
31
|
check "pypdf" python3 -c "import pypdf"
|
|
28
32
|
check "reportlab" python3 -c "import reportlab"
|
|
29
33
|
check "PyMuPDF" python3 -c "import fitz"
|
|
30
|
-
check "playwright" node -e "require('playwright')"
|
|
31
34
|
|
|
32
|
-
#
|
|
33
|
-
if
|
|
34
|
-
:
|
|
35
|
-
|
|
36
|
-
: # system tectonic OK
|
|
37
|
-
else
|
|
38
|
-
$QUIET || echo "MISSING: tectonic (needed for LaTeX/Academic PDFs)"
|
|
39
|
-
FAIL=1
|
|
35
|
+
# Font check: verify an embeddable CJK font is available (SimHei/Noto/WenQuanYi/Songti…)
|
|
36
|
+
if command -v fc-list &>/dev/null; then
|
|
37
|
+
fc-list :lang=zh 2>/dev/null | grep -qi "noto\|simhei\|simsun\|songti\|heiti\|wenquanyi\|yahei\|kai" \
|
|
38
|
+
|| { $QUIET || echo "MISSING (core): CJK font"; FAIL=1; }
|
|
40
39
|
fi
|
|
41
40
|
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
# ── OPTIONAL: Creative/HTML pipeline (Node + Playwright + Chromium) ──
|
|
42
|
+
optional "node" command -v node
|
|
43
|
+
optional "playwright (npm)" node -e "require('playwright')"
|
|
44
|
+
|
|
45
|
+
# ── OPTIONAL: Academic/LaTeX pipeline (Tectonic) ──
|
|
46
|
+
if [ -x "$PDF_SKILL_DIR/scripts/tectonic" ] || command -v tectonic &>/dev/null; then
|
|
47
|
+
$QUIET || echo "optional OK: tectonic"
|
|
48
|
+
else
|
|
49
|
+
$QUIET || echo "optional MISSING: tectonic (LaTeX/Academic; install on demand)"
|
|
45
50
|
fi
|
|
46
51
|
|
|
52
|
+
# ── OPTIONAL: Office→PDF (LibreOffice/soffice) ──
|
|
53
|
+
optional "libreoffice (soffice)" command -v soffice
|
|
54
|
+
|
|
47
55
|
$QUIET || echo "PDF_SKILL_DIR=$PDF_SKILL_DIR"
|
|
48
56
|
$QUIET || echo "FONT_DIR=$FONT_DIR"
|
|
49
57
|
return $FAIL 2>/dev/null || exit $FAIL
|
|
@@ -43,42 +43,60 @@ Run the platform-appropriate setup script:
|
|
|
43
43
|
|
|
44
44
|
| Category | Package | Purpose |
|
|
45
45
|
|----------|---------|---------|
|
|
46
|
-
| Runtime | Python 3 + pip | PDF generation and processing |
|
|
47
|
-
|
|
|
48
|
-
| Python pkg |
|
|
49
|
-
| Python pkg |
|
|
50
|
-
| Python pkg |
|
|
51
|
-
| Python pkg |
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
46
|
+
| **Core** Runtime | Python 3 + pip | PDF generation and processing |
|
|
47
|
+
| **Core** Python pkg | reportlab | Report/cover pipeline PDF generation |
|
|
48
|
+
| **Core** Python pkg | pypdf | PDF reading/writing/merge |
|
|
49
|
+
| **Core** Python pkg | PyMuPDF (fitz) | Fast PDF rendering and extraction |
|
|
50
|
+
| **Core** Python pkg | pikepdf | PDF manipulation (merge/split/encrypt) |
|
|
51
|
+
| **Core** Python pkg | pdfplumber | Text/table extraction |
|
|
52
|
+
| **Core** Font | CJK fonts (TrueType: SimHei/Noto/WenQuanYi/Songti…) | Chinese text + covers |
|
|
53
|
+
| Optional | Node.js + npm | Only for the Creative/HTML pipeline |
|
|
54
|
+
| Optional | playwright (npm) | HTML-to-PDF for Creative pipeline |
|
|
55
|
+
| Optional | Chromium (via Playwright) | Headless rendering (large download) |
|
|
55
56
|
| Optional | tectonic | LaTeX/Academic PDF compilation |
|
|
56
57
|
| Optional | LibreOffice | Office-to-PDF conversion |
|
|
57
|
-
|
|
58
|
+
|
|
59
|
+
> **Covers no longer need Playwright.** All Report/Academic covers render with ReportLab
|
|
60
|
+
> (`scripts/cover_render.py`). Playwright/Chromium is required **only** for the Creative/poster
|
|
61
|
+
> pipeline and some HTML→PDF conversions; Tectonic **only** for the Academic/LaTeX route.
|
|
62
|
+
> Install these optional engines **on demand, after asking the user** (they involve large
|
|
63
|
+
> downloads / long first-run waits) — do not install them up front.
|
|
58
64
|
|
|
59
65
|
### Manual Install by Platform
|
|
60
66
|
|
|
61
67
|
#### macOS
|
|
62
68
|
|
|
63
69
|
```bash
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
# ── Core (always) ──
|
|
71
|
+
brew install python3
|
|
72
|
+
python3 -m pip install reportlab pypdf PyMuPDF pikepdf pdfplumber
|
|
73
|
+
|
|
74
|
+
# ── Optional: Creative/HTML pipeline (install on demand, with user's OK — large Chromium download) ──
|
|
75
|
+
brew install node
|
|
66
76
|
npm install -g playwright@1.50.0 && npx playwright install chromium
|
|
67
77
|
# Pinned to 1.50.0 — npmmirror has Chromium rev 1155 for this version
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
|
|
79
|
+
# ── Optional: Academic/LaTeX (install on demand — downloads packages on first run) ──
|
|
80
|
+
brew install tectonic
|
|
81
|
+
# ── Optional: Office-to-PDF ──
|
|
82
|
+
brew install --cask libreoffice
|
|
70
83
|
```
|
|
71
84
|
|
|
72
85
|
#### Linux (Debian/Ubuntu)
|
|
73
86
|
|
|
74
87
|
```bash
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
# ── Core (always) ──
|
|
89
|
+
sudo apt install python3 python3-pip
|
|
90
|
+
python3 -m pip install reportlab pypdf PyMuPDF pikepdf pdfplumber
|
|
91
|
+
|
|
92
|
+
# ── Optional: Creative/HTML pipeline (install on demand, with user's OK) ──
|
|
93
|
+
sudo apt install nodejs npm
|
|
77
94
|
npm install -g playwright@1.50.0 && npx playwright install chromium && npx playwright install-deps
|
|
78
|
-
|
|
79
|
-
#
|
|
95
|
+
|
|
96
|
+
# ── Optional: Academic/LaTeX (install on demand) ──
|
|
80
97
|
conda install -c conda-forge tectonic # use Tsinghua mirror: conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
|
|
81
|
-
|
|
98
|
+
# ── Optional: Office-to-PDF ──
|
|
99
|
+
sudo apt install libreoffice-core
|
|
82
100
|
```
|
|
83
101
|
|
|
84
102
|
#### Windows (PowerShell)
|
|
File without changes
|
|
@@ -147,22 +147,21 @@ if ($PyCmd) {
|
|
|
147
147
|
}
|
|
148
148
|
Write-Host ""
|
|
149
149
|
|
|
150
|
-
# ── Step 2d: Node.js + npm ──
|
|
151
|
-
Write-Host "--- [4/9] Node.js + npm ---"
|
|
150
|
+
# ── Step 2d: Node.js + npm (OPTIONAL — Creative/HTML pipeline only) ──
|
|
151
|
+
Write-Host "--- [4/9] Node.js + npm (optional: Creative/HTML pipeline) ---"
|
|
152
152
|
try {
|
|
153
153
|
$nodeVer = & node --version 2>&1
|
|
154
154
|
if ($LASTEXITCODE -eq 0) {
|
|
155
155
|
Write-Ok "node ($nodeVer)"
|
|
156
156
|
} else { throw "no node" }
|
|
157
157
|
} catch {
|
|
158
|
-
Write-
|
|
159
|
-
Write-Info "Install
|
|
160
|
-
Write-Info "Install
|
|
161
|
-
Write-Info "Install
|
|
158
|
+
Write-Warn "node not found (optional — only for the Creative/poster/HTML->PDF route)"
|
|
159
|
+
Write-Info "Install on demand 1: winget install OpenJS.NodeJS.LTS"
|
|
160
|
+
Write-Info "Install on demand 2: https://nodejs.org/"
|
|
161
|
+
Write-Info "Install on demand 3: choco install nodejs-lts"
|
|
162
162
|
if ($global:UseCN) {
|
|
163
163
|
Write-Info "China alt: https://npmmirror.com/mirrors/node/"
|
|
164
164
|
}
|
|
165
|
-
$Errors++
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
try {
|
|
@@ -171,13 +170,14 @@ try {
|
|
|
171
170
|
Write-Ok "npm ($npmVer)"
|
|
172
171
|
} else { throw "no npm" }
|
|
173
172
|
} catch {
|
|
174
|
-
Write-
|
|
175
|
-
$Errors++
|
|
173
|
+
Write-Warn "npm not found (optional — installed with Node.js)"
|
|
176
174
|
}
|
|
177
175
|
Write-Host ""
|
|
178
176
|
|
|
179
|
-
# ── Step 2e: Playwright + Chromium ──
|
|
180
|
-
Write-Host "--- [5/9] Playwright + Chromium ---"
|
|
177
|
+
# ── Step 2e: Playwright + Chromium (OPTIONAL — Creative/HTML pipeline only) ──
|
|
178
|
+
Write-Host "--- [5/9] Playwright + Chromium (optional: HTML->PDF engine) ---"
|
|
179
|
+
Write-Info "Optional. Covers now render with ReportLab; Playwright is only for Creative/poster/HTML->PDF."
|
|
180
|
+
Write-Info "Install on demand, with the user's confirmation (large download / long first-run wait)."
|
|
181
181
|
try {
|
|
182
182
|
$null = & node -e "require('playwright')" 2>&1
|
|
183
183
|
if ($LASTEXITCODE -eq 0) {
|
|
@@ -185,26 +185,24 @@ try {
|
|
|
185
185
|
Write-Ok "playwright ($pwVer)"
|
|
186
186
|
} else { throw "no pw" }
|
|
187
187
|
} catch {
|
|
188
|
-
Write-
|
|
188
|
+
Write-Warn "playwright not installed (optional)"
|
|
189
189
|
if ($global:UseCN) {
|
|
190
|
-
Write-Info "Install: npm install -g playwright@1.50.0 $($NpmMirrorArgs -join ' ')"
|
|
190
|
+
Write-Info "Install on demand: npm install -g playwright@1.50.0 $($NpmMirrorArgs -join ' ')"
|
|
191
191
|
} else {
|
|
192
|
-
Write-Info "Install: npm install -g playwright@1.50.0"
|
|
192
|
+
Write-Info "Install on demand: npm install -g playwright@1.50.0"
|
|
193
193
|
}
|
|
194
|
-
$Errors++
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
$PwCache = Join-Path $env:LOCALAPPDATA "ms-playwright"
|
|
198
197
|
if (Test-Path "$PwCache\chromium-*") {
|
|
199
198
|
Write-Ok "chromium installed"
|
|
200
199
|
} else {
|
|
201
|
-
Write-
|
|
200
|
+
Write-Warn "chromium not installed (optional)"
|
|
202
201
|
if ($global:UseCN) {
|
|
203
|
-
Write-Info "Install: `$env:PLAYWRIGHT_DOWNLOAD_HOST='$PlaywrightHost'; npx playwright install chromium"
|
|
202
|
+
Write-Info "Install on demand: `$env:PLAYWRIGHT_DOWNLOAD_HOST='$PlaywrightHost'; npx playwright install chromium"
|
|
204
203
|
} else {
|
|
205
|
-
Write-Info "Install: npx playwright install chromium"
|
|
204
|
+
Write-Info "Install on demand: npx playwright install chromium"
|
|
206
205
|
}
|
|
207
|
-
$Errors++
|
|
208
206
|
}
|
|
209
207
|
Write-Host ""
|
|
210
208
|
|