zcode-app-cli 3.11.2-24 → 3.12.3-26

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 (39) hide show
  1. package/README.md +35 -8
  2. package/bin/zcode.js +265 -133
  3. package/docs/CONFIGURATION.md +387 -0
  4. package/docs/CONFIGURATION.zh-CN.md +324 -0
  5. package/docs/PROVIDER_CONFIG.md +271 -0
  6. package/docs/PROVIDER_CONFIG.zh-CN.md +245 -0
  7. package/package.json +15 -6
  8. package/provider.example.json +151 -0
  9. package/{config.example.json → setting.example.json} +0 -47
  10. package/vendor/cli-config.cjs +161 -0
  11. package/vendor/extraction.json +17 -4
  12. package/vendor/node_modules/@zcode/tui/dist/index.js +495 -1095
  13. package/vendor/packages/browser-use-plugin/dist/mcp/server.js +35543 -34422
  14. package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +2 -2
  15. package/vendor/packages/document-skills-plugin/package.json +4 -4
  16. package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +34 -0
  17. package/vendor/packages/document-skills-plugin/skills/docx/references/docx-js-advanced.md +9 -0
  18. package/vendor/packages/document-skills-plugin/skills/docx/routes/edit.md +11 -0
  19. package/vendor/packages/document-skills-plugin/skills/docx/routes/format.md +7 -0
  20. package/vendor/packages/document-skills-plugin/skills/docx/routes/read.md +7 -0
  21. package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +10 -1
  22. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +19 -4
  23. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/env_check.sh +6 -2
  24. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup.md +12 -3
  25. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_mac_linux.sh +9 -3
  26. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_windows.ps1 +8 -3
  27. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +30 -6
  28. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +9 -3
  29. package/vendor/packages/document-skills-plugin/skills/pptx/SKILL.md +33 -0
  30. package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup.md +29 -4
  31. package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_mac_linux.sh +8 -3
  32. package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_windows.ps1 +8 -3
  33. package/vendor/packages/document-skills-plugin/skills/xlsx/quality/pipeline.md +9 -0
  34. package/vendor/packages/document-skills-plugin/skills/xlsx/setup.sh +8 -3
  35. package/vendor/packages/document-skills-plugin/skills/xlsx/xlsx.py +15 -1
  36. package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/scripts/restore-conversation.mjs +13 -8
  37. package/vendor/provider/zcode-builtin.json +6296 -0
  38. package/vendor/zcode.cjs +1159 -840
  39. package/zcode-runtime.lock.json +3 -3
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-skills",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
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.",
@@ -22,4 +22,4 @@
22
22
  "timeoutMs": 90000
23
23
  }
24
24
  }
25
- }
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.4",
4
+ "version": "0.1.5",
5
5
  "private": true,
6
- "description": "Built-in DOCX and PDF document production skills published as an official ZCode plugin.",
7
- "license": "SEE LICENSE IN skills/docx/LICENSE.txt"
8
- }
6
+ "license": "SEE LICENSE IN skills/docx/LICENSE.txt",
7
+ "description": "Built-in DOCX and PDF document production skills published as an official ZCode plugin."
8
+ }
@@ -204,6 +204,40 @@ See `references/chart-templates.md`.
204
204
  - **defusedxml**: Secure XML parsing
205
205
  - **python-docx**: Simple comment operations
206
206
 
207
+ ### 🔴 HARD REQUIREMENT — LibreOffice is missing
208
+
209
+ Any step that calls `libreoffice`/`soffice` (`.doc` → `.docx`, DOCX → PDF, visual verification)
210
+ depends on LibreOffice.
211
+
212
+ **If LibreOffice is not installed, you MUST install it. This is not a choice.**
213
+
214
+ **FORBIDDEN — do not do any of these:**
215
+ - ❌ Using Microsoft Word, WPS Office, Pages, or any other program already on the user's machine
216
+ *instead of* installing LibreOffice.
217
+ - ❌ Deciding on the user's behalf that the download is "too large", "too slow", or "not worth it".
218
+ **The package being large is NOT a reason to skip the install.** It is expected to be large.
219
+ - ❌ Asking the user "should I use Word instead to save time?" — that is the same violation dressed
220
+ up as a question. Do not offer the substitution.
221
+ - ❌ Silently degrading (skipping the PDF check, skipping visual verification) to avoid installing.
222
+
223
+ **REQUIRED sequence — no steps skipped, in this order:**
224
+
225
+ 1. **Explain the necessity to the user.** LibreOffice is the conversion engine that preserves the
226
+ document's styles, layout, fonts, and page breaks faithfully — no other tool reproduces the same
227
+ output, so substituting it degrades fidelity.
228
+ 2. **Tell them the download is large** (roughly several hundred MB) and may take a while. This is
229
+ information for the user, **not** a decision point for you — state it and proceed to install.
230
+ 3. **Install it now:**
231
+ - macOS: `brew install --cask libreoffice`
232
+ - Linux (Debian/Ubuntu): `sudo apt install libreoffice-core`
233
+ - Windows: `winget install TheDocumentFoundation.LibreOffice`
234
+ 4. **Only after that install has actually been attempted AND failed** may you use software already
235
+ on the user's machine (Word, WPS, Pages). Report the install failure and what you switched to,
236
+ and warn that output fidelity may differ.
237
+
238
+ > **The gate is simple: no install attempt = no substitute program.** If you have not run the
239
+ > install command and seen it fail, using Word/WPS/Pages/Keynote is a violation of this skill.
240
+
207
241
  ## Final response citations
208
242
 
209
243
  Place `::zcode-file-citation{...}` inline in prose, not in a trailing list. Use `purpose="source"` for Q&A/no-op and `purpose="output"` for create/edit.
@@ -231,6 +231,15 @@ const doc = new Document({
231
231
 
232
232
  ## Converting DOCX to PDF
233
233
 
234
+ > 🔴 **LibreOffice not installed? You MUST install it — do not substitute.** Using Word/WPS *instead
235
+ > of* installing is forbidden, and a large download is **not** a reason to skip it. Required: explain
236
+ > the necessity to the user (it preserves styles, layout, fonts and pagination faithfully), say the
237
+ > package is large, then install it (`brew install --cask libreoffice` /
238
+ > `sudo apt install libreoffice-core` / `winget install TheDocumentFoundation.LibreOffice`). Only
239
+ > after an install attempt has **failed** may you use another program. **No install attempt = no
240
+ > substitute program.** Note this is separate from the TOC rule below, which is about field
241
+ > recalculation, not about avoiding LibreOffice.
242
+
234
243
  ```bash
235
244
  # Using LibreOffice (headless)
236
245
  libreoffice --headless --convert-to pdf output.docx
@@ -19,6 +19,13 @@
19
19
  libreoffice --headless --convert-to docx input.doc
20
20
  ```
21
21
 
22
+ > 🔴 **If `libreoffice` is not installed, you MUST install it — do not substitute.** Using Word, WPS,
23
+ > or Pages *instead of* installing is forbidden, and a large download is **not** a reason to skip it.
24
+ > Required: explain the necessity to the user (only engine that converts legacy `.doc` while
25
+ > preserving styles and layout), tell them the package is large, then install it. Only after an
26
+ > install attempt has actually **failed** may you use another program. **No install attempt = no
27
+ > substitute program.** See the HARD REQUIREMENT block in `SKILL.md`.
28
+
22
29
  ## Step 1: Unpack
23
30
 
24
31
  ```bash
@@ -69,6 +76,10 @@ pandoc output.docx -t plain -o /dev/stdout | head -50
69
76
  libreoffice --headless --convert-to pdf output.docx
70
77
  ```
71
78
 
79
+ > 🔴 **LibreOffice missing? You MUST install it — do not substitute.** Explain its necessity, say the
80
+ > package is large (not a reason to skip), then install. Word/WPS is permitted **only** after an
81
+ > install attempt has failed. **No install attempt = no substitute program.** See `SKILL.md`.
82
+
72
83
  ---
73
84
 
74
85
  ## Template Matching Workflow
@@ -118,3 +118,10 @@ After formatting changes:
118
118
  1. Open in LibreOffice or convert to PDF for visual check
119
119
  2. Extract text with pandoc to ensure content unchanged
120
120
  3. Compare file sizes (formatting-only changes shouldn't dramatically change size)
121
+
122
+ > 🔴 **If LibreOffice is not installed, you MUST install it — do not verify with whatever Office suite
123
+ > the user happens to have.** That substitution is forbidden, and a large download is **not** a reason
124
+ > to skip the install. Required: explain the necessity (faithful rendering of styles and pagination),
125
+ > say the package is large, then install it. Only after an install attempt has **failed** may you
126
+ > verify with Word/WPS, and you must say so. **No install attempt = no substitute program.**
127
+ > See `SKILL.md`.
@@ -79,6 +79,13 @@ pdftoppm -png -r 200 input.pdf page
79
79
 
80
80
  **Best for**: Visual layout analysis, comparing formatting, generating previews, when user asks "what does it look like".
81
81
 
82
+ > 🔴 **This route needs LibreOffice — if it is missing you MUST install it, not substitute it.**
83
+ > Using Word/WPS/Pages to make the preview *instead of* installing is forbidden, and a large download
84
+ > is **not** a reason to skip. Required: explain the necessity (it renders the document exactly as
85
+ > laid out, which is the whole point of a visual check), say the package is large, then install. Only
86
+ > after an install attempt has **failed** may you use another program, and you must say so.
87
+ > **No install attempt = no substitute program.** See `SKILL.md`.
88
+
82
89
  ## Method 4: python-docx Reading
83
90
 
84
91
  ```python
@@ -687,7 +687,7 @@ palette.cascade --title "..." --format reportlab # Ready-to-paste Repo
687
687
  | Report | ReportLab + pypdf | **ReportLab cover (`cover_render.py`)** | ❌ (tofu □) | Manual pagination |
688
688
  | Creative | Playwright *(optional)* | html2pdf-next.js (pdf-lib for post-processing) | ✅ native | ✅ any size |
689
689
  | Academic | Tectonic *(optional)* + pypdf | **ReportLab cover (`cover_render.py`)** | ❌ (dropped) | Template-dependent |
690
- | Process | pikepdf, pdfplumber | LibreOffice (soffice) *(optional)* | N/A | N/A |
690
+ | Process | pikepdf, pdfplumber | LibreOffice (soffice) *(install on demand — not substitutable)* | N/A | N/A |
691
691
 
692
692
  > **Cover System (V4.0)**: Report and Academic covers are rendered with **ReportLab** via
693
693
  > `scripts/cover_render.py` (templates 01–05 report, 06–08 academic dark, 09 institutional) and
@@ -698,6 +698,15 @@ palette.cascade --title "..." --format reportlab # Ready-to-paste Repo
698
698
  > **Optional engines**: Playwright/Chromium (Creative/poster/HTML→PDF) and Tectonic (Academic/LaTeX)
699
699
  > are optional — probe first and ask the user before installing (large downloads / long waits).
700
700
  >
701
+ > **LibreOffice (Office→PDF) is different — you MUST install it, not substitute it.** Using Word,
702
+ > WPS, Keynote or Pages *instead of* installing is forbidden, and a large download is **not** a reason
703
+ > to skip it. Required: explain the necessity to the user (only engine that preserves
704
+ > themes/layouts/master slides faithfully), say the package is large, then install it
705
+ > (`brew install --cask libreoffice` / `sudo apt install libreoffice-core` /
706
+ > `winget install TheDocumentFoundation.LibreOffice`). Another program is permitted **only after** an
707
+ > install attempt has actually failed. **No install attempt = no substitute program.**
708
+ > See `briefs/process.md` for the full procedure.
709
+ >
701
710
  > **Fallback**: If Report brief content has emoji → reroute to Creative.
702
711
 
703
712
  ---
@@ -2,7 +2,22 @@
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.
5
+ > 🟡 **Playwright preflight (optional engine).** **Playwright/Chromium** (HTML→PDF `convert.html`, xlsx/pptx→HTML fallback) is genuinely optional: do NOT auto-install it — use the **AskUserQuestion** tool to warn about the install/download time and get confirmation first. See `briefs/creative.md` top for the pattern.
6
+ >
7
+ > **LibreOffice/soffice (Office→PDF) is NOT in that category** — do not treat it as an optional engine you may route around. See the hard requirement immediately below.
8
+ >
9
+ > 🔴 **HARD REQUIREMENT — LibreOffice is missing.** Office→PDF (`convert.office`, `soffice`) and the 5-step DOCX pipeline depend on LibreOffice. **If it is not installed, you MUST install it. This is not a choice.**
10
+ >
11
+ > **FORBIDDEN:** ❌ using Microsoft Word/Excel/PowerPoint, WPS Office, Keynote, Pages, or any other program already on the user's machine *instead of* installing LibreOffice. ❌ Deciding for the user that the download is "too large"/"too slow" — **the package being large is NOT a reason to skip the install**; it is expected to be large. ❌ Asking "should I use Word instead to save time?" — that is the same violation dressed up as a question. ❌ Jumping straight to the python-pptx/python-docx + HTML + Playwright fallback to avoid installing.
12
+ >
13
+ > **REQUIRED sequence, no steps skipped:**
14
+ >
15
+ > 1. **Explain the necessity to the user.** LibreOffice is the conversion engine that preserves themes, layouts, master slides, fonts, and pagination faithfully; other tools produce visibly lower-fidelity PDFs.
16
+ > 2. **Tell them the download is large** (several hundred MB) and may take a while — this is information for the user, **not** a decision point for you. State it and proceed.
17
+ > 3. **Install it now:** macOS `brew install --cask libreoffice`; Linux (Debian/Ubuntu) `sudo apt install libreoffice-core`; Windows `winget install TheDocumentFoundation.LibreOffice`.
18
+ > 4. **Only after that install has actually been attempted AND failed** may you use software already on the user's machine, or the Playwright fallback route. Report the install failure and that fidelity will be lower.
19
+ >
20
+ > **The gate is simple: no install attempt = no substitute program.** If you have not run the install command and seen it fail, reaching for Word/WPS/Keynote is a violation of this skill.
6
21
 
7
22
 
8
23
  ---
@@ -238,11 +253,11 @@ soffice --headless --convert-to pdf --outdir ./output input.docx
238
253
  - Large files (>50MB) may take 1-2 min; set reasonable timeout
239
254
  - soffice HTML→PDF is inferior to Playwright for complex CSS
240
255
 
241
- **Priority**: Always prefer soffice for Office→PDF (preserves themes, layouts, master slides). Only fall back to python-pptx/python-docx + HTML + Playwright if soffice is unavailable — fidelity will be lower.
256
+ **Priority**: Always use soffice for Office→PDF (preserves themes, layouts, master slides). If soffice is not installed, **you MUST install it** — follow the **HARD REQUIREMENT** block at the top of this brief: explain the necessity to the user, tell them the package is large (not a reason to skip), then install. The user's local Word/WPS/Keynote and the python-pptx/python-docx + HTML + Playwright route are permitted **only after an install attempt has actually failed** — fidelity will be lower, and you must say so. **No install attempt = no substitute program.**
242
257
 
243
- ### Fallback: Spreadsheet → PDF without LibreOffice
258
+ ### Fallback (post-install-failure only): Spreadsheet → PDF without LibreOffice
244
259
 
245
- Use openpyxl + HTML + Playwright. Let data shape drive layout:
260
+ Use this **only** when the LibreOffice install attempt has failed. Use openpyxl + HTML + Playwright. Let data shape drive layout:
246
261
 
247
262
  | Factor | Decision |
248
263
  |--------|----------|
@@ -11,6 +11,10 @@ QUIET=false; [ "${1:-}" = "--quiet" ] && QUIET=true
11
11
  FAIL=0
12
12
  check() { local desc="$1"; shift; if ! "$@" &>/dev/null; then $QUIET || echo "MISSING (core): $desc"; FAIL=1; fi; }
13
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; }
14
+ # LibreOffice is install-on-demand like the others, but it is NOT substitutable: when an
15
+ # Office→PDF route needs it and it is absent, the model must explain + warn + install, never
16
+ # silently switch to the user's local Office/WPS.
17
+ required_on_demand() { local desc="$1"; shift; if "$@" &>/dev/null; then $QUIET || echo "on-demand OK: $desc"; else $QUIET || echo "on-demand MISSING: $desc — if a route needs it you MUST install it, not substitute it. FORBIDDEN: using Word/WPS/Keynote/Pages instead; a large download is NOT a reason to skip. REQUIRED: explain the necessity to the user, say the package is large, then INSTALL. No install attempt = no substitute program."; fi; }
14
18
 
15
19
  # ── Resolve PDF_SKILL_DIR & FONT_DIR ──
16
20
  _ENV_CHECK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
@@ -49,8 +53,8 @@ else
49
53
  $QUIET || echo "optional MISSING: tectonic (LaTeX/Academic; install on demand)"
50
54
  fi
51
55
 
52
- # ── OPTIONAL: Office→PDF (LibreOffice/soffice) ──
53
- optional "libreoffice (soffice)" command -v soffice
56
+ # ── ON-DEMAND but NOT substitutable: Office→PDF (LibreOffice/soffice) ──
57
+ required_on_demand "libreoffice (soffice)" command -v soffice
54
58
 
55
59
  $QUIET || echo "PDF_SKILL_DIR=$PDF_SKILL_DIR"
56
60
  $QUIET || echo "FONT_DIR=$FONT_DIR"
@@ -54,13 +54,21 @@ Run the platform-appropriate setup script:
54
54
  | Optional | playwright (npm) | HTML-to-PDF for Creative pipeline |
55
55
  | Optional | Chromium (via Playwright) | Headless rendering (large download) |
56
56
  | Optional | tectonic | LaTeX/Academic PDF compilation |
57
- | Optional | LibreOffice | Office-to-PDF conversion |
57
+ | On demand (not substitutable) | LibreOffice | Office-to-PDF conversion — install it; do not swap in local Office/WPS |
58
58
 
59
59
  > **Covers no longer need Playwright.** All Report/Academic covers render with ReportLab
60
60
  > (`scripts/cover_render.py`). Playwright/Chromium is required **only** for the Creative/poster
61
61
  > pipeline and some HTML→PDF conversions; Tectonic **only** for the Academic/LaTeX route.
62
62
  > Install these optional engines **on demand, after asking the user** (they involve large
63
63
  > downloads / long first-run waits) — do not install them up front.
64
+ >
65
+ > **Once an Office→PDF task is requested, LibreOffice MUST be installed — not substituted.** Using
66
+ > the user's already-installed Word/WPS/Keynote/Pages *instead of* installing it is **forbidden**, and
67
+ > the package being large (several hundred MB) is **not** a reason to skip the install. Required:
68
+ > explain the necessity to the user (only engine that preserves themes, layouts, master slides and
69
+ > pagination faithfully), tell them the download is large, then install it with the platform command
70
+ > below. Another program is permitted **only after** an install attempt has actually failed, and that
71
+ > failure must be reported to the user. **No install attempt = no substitute program.**
64
72
 
65
73
  ### Manual Install by Platform
66
74
 
@@ -78,7 +86,7 @@ npm install -g playwright@1.50.0 && npx playwright install chromium
78
86
 
79
87
  # ── Optional: Academic/LaTeX (install on demand — downloads packages on first run) ──
80
88
  brew install tectonic
81
- # ── Optional: Office-to-PDF ──
89
+ # ── On demand, not substitutable: Office-to-PDF ──
82
90
  brew install --cask libreoffice
83
91
  ```
84
92
 
@@ -95,7 +103,7 @@ npm install -g playwright@1.50.0 && npx playwright install chromium && npx playw
95
103
 
96
104
  # ── Optional: Academic/LaTeX (install on demand) ──
97
105
  conda install -c conda-forge tectonic # use Tsinghua mirror: conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
98
- # ── Optional: Office-to-PDF ──
106
+ # ── On demand, not substitutable: Office-to-PDF ──
99
107
  sudo apt install libreoffice-core
100
108
  ```
101
109
 
@@ -110,6 +118,7 @@ npm install -g playwright@1.50.0
110
118
  npx playwright install chromium
111
119
  # optional:
112
120
  scoop install tectonic # LaTeX
121
+ # on demand, not substitutable:
113
122
  winget install TheDocumentFoundation.LibreOffice # Office-to-PDF
114
123
  ```
115
124
 
@@ -232,17 +232,23 @@ else
232
232
  fi
233
233
  echo ""
234
234
 
235
- # ── Step 2h: LibreOffice (optional) ──
236
- echo "--- [8/10] LibreOffice (optional, Office→PDF) ---"
235
+ # ── Step 2h: LibreOffice (install-on-demand, NOT substitutable) ──
236
+ echo "--- [8/10] LibreOffice (Office→PDF) ---"
237
237
  if command -v soffice &>/dev/null; then
238
238
  LO_VER=$(soffice --version 2>/dev/null | head -1)
239
239
  ok "libreoffice ($LO_VER)"
240
240
  else
241
- warn "libreoffice not installed (needed only for .docx/.xlsx→PDF conversion)"
241
+ warn "libreoffice not installed — REQUIRED for any .docx/.xlsx/.pptx→PDF task"
242
+ info "You MUST install it. FORBIDDEN: using Word/WPS/Keynote/Pages instead of"
243
+ info "installing. A large download is NOT a reason to skip -- it is expected to be"
244
+ info "large. REQUIRED: explain the necessity to the user, say the package is large,"
245
+ info "THEN install it."
242
246
  case "$PLATFORM" in
243
247
  mac) info "Install: brew install --cask libreoffice" ;;
244
248
  linux) info "Install: sudo apt install libreoffice-core" ;;
245
249
  esac
250
+ info "Another program is allowed ONLY after an install attempt has FAILED. Report it."
251
+ info "No install attempt = no substitute program."
246
252
  fi
247
253
  echo ""
248
254
 
@@ -220,17 +220,22 @@ try {
220
220
  }
221
221
  Write-Host ""
222
222
 
223
- # ── Step 2g: LibreOffice (optional) ──
224
- Write-Host "--- [7/9] LibreOffice (optional, Office->PDF conversion) ---"
223
+ # ── Step 2g: LibreOffice (install-on-demand, NOT substitutable) ──
224
+ Write-Host "--- [7/9] LibreOffice (Office->PDF conversion) ---"
225
225
  $SofficePath = "C:\Program Files\LibreOffice\program\soffice.exe"
226
226
  if (Test-Path $SofficePath) {
227
227
  Write-Ok "libreoffice found"
228
228
  } elseif (Get-Command soffice -ErrorAction SilentlyContinue) {
229
229
  Write-Ok "libreoffice (in PATH)"
230
230
  } else {
231
- Write-Warn "libreoffice not installed (needed only for .docx/.xlsx -> PDF conversion)"
231
+ Write-Warn "libreoffice not installed - REQUIRED for any .docx/.xlsx/.pptx -> PDF task"
232
+ Write-Info "You MUST install it. FORBIDDEN: using Word/WPS/Keynote/Pages instead of"
233
+ Write-Info "installing. A large download is NOT a reason to skip - it is expected to be large."
234
+ Write-Info "REQUIRED: explain the necessity to the user, say the package is large, THEN install."
232
235
  Write-Info "Install: winget install TheDocumentFoundation.LibreOffice"
233
236
  Write-Info " or: https://www.libreoffice.org/download/"
237
+ Write-Info "Another program is allowed ONLY after an install attempt has FAILED. Report it."
238
+ Write-Info "No install attempt = no substitute program."
234
239
  }
235
240
  Write-Host ""
236
241
 
@@ -409,12 +409,19 @@ def env_check(argv: list):
409
409
  # Human-readable output
410
410
  rc = 0
411
411
 
412
- def show(name: str, status: tuple[str, str], optional: bool = False):
412
+ def show(name: str, status: tuple[str, str], optional: bool = False,
413
+ on_demand_required: bool = False):
413
414
  nonlocal rc
414
415
  s, d = status
415
416
  if s == "ok":
416
417
  detail = f" ({d})" if d else ""
417
418
  print(f" \u2713 {name}{detail}")
419
+ elif on_demand_required:
420
+ print(f" \u25cb {name} (not installed \u2014 MUST be installed, not substituted)")
421
+ print(f" \u2192 FORBIDDEN: using Word/WPS/Keynote/Pages instead of installing it.")
422
+ print(f" A large download is NOT a reason to skip it.")
423
+ print(f" REQUIRED: explain the necessity to the user, tell them the package is")
424
+ print(f" large, then INSTALL it. No install attempt = no substitute program.")
418
425
  elif optional:
419
426
  print(f" \u25cb {name} (optional, not installed \u2014 install on demand)")
420
427
  else:
@@ -442,15 +449,18 @@ def env_check(argv: list):
442
449
  if s_pw_py[0] == "ok":
443
450
  print(f" (playwright-python: {s_pw_py[1]})")
444
451
 
445
- print("\n--- Optional: other ---")
446
- show("libreoffice", s_lo, optional=True)
452
+ print("\n--- On demand: other ---")
453
+ show("libreoffice", s_lo, on_demand_required=True)
447
454
  show("tectonic", s_tec, optional=True)
448
455
 
449
456
  print("\n=== Install Commands (optional engines \u2014 install only when a route needs them, with the user's OK) ===")
450
457
  print(" Core Python: pip install reportlab pypdf PyMuPDF pikepdf pdfplumber")
451
458
  print(" Node.js: brew install node (macOS) / apt install nodejs (Ubuntu)")
452
459
  print(" Playwright: npm install -g playwright && npx playwright install chromium # large download, minutes")
453
- print(" LibreOffice: brew install --cask libreoffice (macOS)")
460
+ print(" LibreOffice: brew install --cask libreoffice (macOS) / sudo apt install libreoffice-core (Linux)")
461
+ print(" ↳ MUST be installed, never substituted. Using Word/WPS/Keynote instead")
462
+ print(" is forbidden; a large download is NOT a reason to skip it. Explain the")
463
+ print(" necessity to the user, then install. No install attempt = no substitute.")
454
464
  print(" Tectonic: curl -fsSL https://drop-sh.fullyjustified.net | sh # downloads LaTeX packages on first run")
455
465
  raise SystemExit(rc)
456
466
 
@@ -1819,8 +1829,22 @@ def convert_office(argv: list):
1819
1829
  if binary is None:
1820
1830
  Output.error(
1821
1831
  "DependencyMissing",
1822
- "LibreOffice not found",
1823
- hint="Please install LibreOffice: https://www.libreoffice.org/download/",
1832
+ "LibreOffice not found — you MUST install it, not substitute it",
1833
+ hint=(
1834
+ "FORBIDDEN: using Word / WPS / Keynote / Pages / any program already on this "
1835
+ "machine INSTEAD of installing LibreOffice. FORBIDDEN: deciding the download is "
1836
+ "too large to bother with — being large is NOT a reason to skip it. FORBIDDEN: "
1837
+ "asking the user whether to use Word instead. "
1838
+ "REQUIRED, in order: (1) explain to the user that LibreOffice is the engine that "
1839
+ "preserves themes, layouts, master slides, fonts and pagination faithfully; "
1840
+ "(2) tell them the package is large (several hundred MB) and may take a while — "
1841
+ "this is information for them, not a decision point for you; "
1842
+ "(3) install it NOW: macOS 'brew install --cask libreoffice'; "
1843
+ "Debian/Ubuntu 'sudo apt install libreoffice-core'; "
1844
+ "Windows 'winget install TheDocumentFoundation.LibreOffice'. "
1845
+ "ONLY after that install has been attempted AND failed may you use another "
1846
+ "program — report the failure. No install attempt = no substitute program."
1847
+ ),
1824
1848
  )
1825
1849
 
1826
1850
  target_dir = Path(out_path).parent if out_path else src.parent
@@ -220,18 +220,24 @@ else
220
220
  esac
221
221
  fi
222
222
 
223
- # ── 8. LibreOffice (optional, for Office→PDF conversion) ──
223
+ # ── 8. LibreOffice (install-on-demand, NOT substitutable) ──
224
224
  echo ""
225
- echo "--- LibreOffice (optional, Office→PDF) ---"
225
+ echo "--- LibreOffice (Office→PDF) ---"
226
226
  if command -v soffice &>/dev/null; then
227
227
  LO_VER=$(soffice --version 2>/dev/null | head -1)
228
228
  ok "libreoffice ($LO_VER)"
229
229
  else
230
- warn "libreoffice not installed (needed only for .docx/.xlsx→PDF conversion)"
230
+ warn "libreoffice not installed — REQUIRED for any .docx/.xlsx/.pptx→PDF task"
231
+ info "You MUST install it. FORBIDDEN: using Word/WPS/Keynote/Pages instead of"
232
+ info "installing. A large download is NOT a reason to skip -- it is expected to be"
233
+ info "large. REQUIRED: explain the necessity to the user, say the package is large,"
234
+ info "THEN install it."
231
235
  case "$OS" in
232
236
  Darwin) info "Install: brew install --cask libreoffice" ;;
233
237
  Linux) info "Install: sudo apt install libreoffice-core (Debian/Ubuntu)" ;;
234
238
  esac
239
+ info "Another program is allowed ONLY after an install attempt has FAILED. Report it."
240
+ info "No install attempt = no substitute program."
235
241
  fi
236
242
 
237
243
  # ── 9. CJK Fonts ──
@@ -642,4 +642,37 @@ Required dependencies (should already be installed):
642
642
  - **Poppler**: `sudo apt-get install poppler-utils` (pdftoppm)
643
643
  - **defusedxml**: `pip install defusedxml` (secure XML parsing)
644
644
 
645
+ ### 🔴 HARD REQUIREMENT — LibreOffice is missing
646
+
647
+ Every PPTX → PDF conversion and every rendered preview/thumbnail step depends on LibreOffice.
648
+
649
+ **If LibreOffice is not installed, you MUST install it. This is not a choice.**
650
+
651
+ **FORBIDDEN — do not do any of these:**
652
+ - ❌ Using Keynote, Microsoft PowerPoint, WPS Office, or any other program already on the user's
653
+ machine *instead of* installing LibreOffice.
654
+ - ❌ Deciding on the user's behalf that the download is "too large", "too slow", or "not worth it".
655
+ **The package being large is NOT a reason to skip the install.** It is expected to be large.
656
+ - ❌ Asking the user "should I use Keynote/PowerPoint instead to save time?" — that is the same
657
+ violation dressed up as a question. Do not offer the substitution.
658
+ - ❌ Silently degrading (shipping the deck without the render check) to avoid installing.
659
+
660
+ **REQUIRED sequence — no steps skipped, in this order:**
661
+
662
+ 1. **Explain the necessity to the user.** LibreOffice is what renders the deck's real layout —
663
+ master slides, themes, placeholder geometry — so it is the only way to verify slides actually
664
+ fit before delivery. Substituting it means shipping an unverified deck.
665
+ 2. **Tell them the download is large** (roughly several hundred MB) and may take a while. This is
666
+ information for the user, **not** a decision point for you — state it and proceed to install.
667
+ 3. **Install it now:**
668
+ - macOS: `brew install --cask libreoffice`
669
+ - Linux (Debian/Ubuntu): `sudo apt-get install libreoffice`
670
+ - Windows: `winget install TheDocumentFoundation.LibreOffice`
671
+ 4. **Only after that install has actually been attempted AND failed** may you use software already
672
+ on the user's machine (Keynote, PowerPoint, WPS). Report the install failure and what you
673
+ switched to, and warn that the rendering may differ from this skill's normal checks.
674
+
675
+ > **The gate is simple: no install attempt = no substitute program.** If you have not run the
676
+ > install command and seen it fail, using Keynote/PowerPoint/WPS is a violation of this skill.
677
+
645
678
  ---
@@ -46,7 +46,7 @@ Run the platform-appropriate setup script:
46
46
  | Runtime | Python 3 + pip | Spreadsheet generation and processing |
47
47
  | Python pkg | openpyxl | Read/write .xlsx files |
48
48
  | Python pkg | XlsxWriter | High-performance .xlsx creation |
49
- | Optional | LibreOffice | .xlsx-to-PDF and .csv-to-.xlsx conversion |
49
+ | On demand (not substitutable) | LibreOffice | recalc, .xlsx-to-PDF, .csv-to-.xlsx — install it; do not swap in local Excel/WPS |
50
50
  | Font | CJK fonts (pre-installed in /usr/share/fonts) | Chinese text in spreadsheets |
51
51
 
52
52
  ### Manual Install by Platform
@@ -56,7 +56,7 @@ Run the platform-appropriate setup script:
56
56
  ```bash
57
57
  brew install python3
58
58
  python3 -m pip install openpyxl XlsxWriter
59
- brew install --cask libreoffice # optional
59
+ brew install --cask libreoffice # on demand (not substitutable)
60
60
  ```
61
61
 
62
62
  #### Linux (Debian/Ubuntu)
@@ -64,7 +64,7 @@ brew install --cask libreoffice # optional
64
64
  ```bash
65
65
  sudo apt install python3 python3-pip
66
66
  python3 -m pip install openpyxl XlsxWriter
67
- sudo apt install libreoffice-core # optional
67
+ sudo apt install libreoffice-core # on demand (not substitutable)
68
68
  ```
69
69
 
70
70
  #### Windows (PowerShell)
@@ -72,13 +72,38 @@ sudo apt install libreoffice-core # optional
72
72
  ```powershell
73
73
  winget install Python.Python.3.11
74
74
  python -m pip install openpyxl XlsxWriter
75
- winget install TheDocumentFoundation.LibreOffice # optional
75
+ winget install TheDocumentFoundation.LibreOffice # on demand (not substitutable)
76
76
  ```
77
77
 
78
78
  Alternative Windows package managers:
79
79
  - `choco install python3`
80
80
  - `scoop install python`
81
81
 
82
+ > 🔴 **HARD REQUIREMENT.** LibreOffice is "on demand" only in the sense that it is installed when a
83
+ > task needs it. Once a task does need it (formula recalculation via `recalc`, .xlsx→PDF, .csv→.xlsx),
84
+ > **you MUST install it. This is not a choice.**
85
+ >
86
+ > **FORBIDDEN:**
87
+ > - ❌ Using Microsoft Excel, WPS Office, Numbers, or any other program already on the user's machine
88
+ > *instead of* installing LibreOffice.
89
+ > - ❌ Deciding on the user's behalf that the download is "too large" or "too slow".
90
+ > **The package being large is NOT a reason to skip the install** — it is expected to be large.
91
+ > - ❌ Asking "should I just use Excel instead to save time?" — same violation, phrased as a question.
92
+ > - ❌ Skipping recalculation/verification altogether to avoid installing.
93
+ >
94
+ > **REQUIRED sequence, no steps skipped:**
95
+ >
96
+ > 1. **Explain the necessity to the user.** LibreOffice is the engine that recalculates formulas and
97
+ > renders the workbook faithfully — without it, formula results cannot be verified and PDF output
98
+ > loses layout fidelity.
99
+ > 2. **Tell them the download is large** (several hundred MB) and may take a while — information for
100
+ > the user, **not** a decision point for you. State it and proceed.
101
+ > 3. **Install it now** using the platform command above.
102
+ > 4. **Only after that install has actually been attempted AND failed** may you use software already
103
+ > on the user's machine (Excel, WPS, Numbers). Report the failure and which checks were skipped.
104
+ >
105
+ > **The gate is simple: no install attempt = no substitute program.**
106
+
82
107
  ---
83
108
 
84
109
  ## Step 3: Font Verification
@@ -137,17 +137,22 @@ if [ ${#MISSING_PY[@]} -gt 0 ]; then
137
137
  fi
138
138
  echo ""
139
139
 
140
- # ── Step 2d: LibreOffice (optional) ──
141
- echo "--- [4/6] LibreOffice (optional, format conversion) ---"
140
+ # ── Step 2d: LibreOffice (install-on-demand, NOT substitutable) ──
141
+ echo "--- [4/6] LibreOffice (format conversion + formula recalc) ---"
142
142
  if command -v soffice &>/dev/null; then
143
143
  LO_VER=$(soffice --version 2>/dev/null | head -1)
144
144
  ok "libreoffice ($LO_VER)"
145
145
  else
146
- warn "libreoffice not installed (needed only for .xlsx→PDF or .csv→.xlsx conversion)"
146
+ warn "libreoffice not installed — REQUIRED for recalc, .xlsx→PDF, .csv→.xlsx"
147
+ info "You MUST install it. FORBIDDEN: using Excel/WPS/Numbers instead of installing,"
148
+ info "or skipping recalculation. A large download is NOT a reason to skip. REQUIRED:"
149
+ info "explain the necessity to the user, say the package is large, THEN install it."
147
150
  case "$PLATFORM" in
148
151
  mac) info "Install: brew install --cask libreoffice" ;;
149
152
  linux) info "Install: sudo apt install libreoffice-core" ;;
150
153
  esac
154
+ info "Another program is allowed ONLY after an install attempt has FAILED. Report it."
155
+ info "No install attempt = no substitute program."
151
156
  fi
152
157
  echo ""
153
158
 
@@ -134,17 +134,22 @@ if ($PyCmd) {
134
134
  }
135
135
  Write-Host ""
136
136
 
137
- # ── Step 2c: LibreOffice (optional) ──
138
- Write-Host "--- [3/5] LibreOffice (optional, format conversion) ---"
137
+ # ── Step 2c: LibreOffice (install-on-demand, NOT substitutable) ──
138
+ Write-Host "--- [3/5] LibreOffice (format conversion + formula recalc) ---"
139
139
  $SofficePath = "C:\Program Files\LibreOffice\program\soffice.exe"
140
140
  if (Test-Path $SofficePath) {
141
141
  Write-Ok "libreoffice found"
142
142
  } elseif (Get-Command soffice -ErrorAction SilentlyContinue) {
143
143
  Write-Ok "libreoffice (in PATH)"
144
144
  } else {
145
- Write-Warn "libreoffice not installed (needed only for .xlsx -> PDF or .csv -> .xlsx conversion)"
145
+ Write-Warn "libreoffice not installed - REQUIRED for recalc, .xlsx -> PDF, .csv -> .xlsx"
146
+ Write-Info "You MUST install it. FORBIDDEN: using Excel/WPS/Numbers instead of installing,"
147
+ Write-Info "or skipping recalculation. A large download is NOT a reason to skip. REQUIRED:"
148
+ Write-Info "explain the necessity to the user, say the package is large, THEN install it."
146
149
  Write-Info "Install: winget install TheDocumentFoundation.LibreOffice"
147
150
  Write-Info " or: https://www.libreoffice.org/download/"
151
+ Write-Info "Another program is allowed ONLY after an install attempt has FAILED. Report it."
152
+ Write-Info "No install attempt = no substitute program."
148
153
  }
149
154
  Write-Host ""
150
155
 
@@ -18,6 +18,15 @@ All commands: `python3 "$XLSX_SKILL_DIR/xlsx.py" <command> [arguments]`
18
18
  | `chart-verify <file>` | Verify embedded charts have data | Builder (self-check) |
19
19
  | `validate <file>` | Structural validation (release gate) | Inspector |
20
20
 
21
+ > 🔴 **`recalc` needs LibreOffice — if it is missing you MUST install it, not substitute it.**
22
+ > Forbidden: skipping recalculation, or handing the workbook to the user's Excel/WPS/Numbers *instead
23
+ > of* installing. A large download is **not** a reason to skip. Required: explain the necessity (it is
24
+ > what actually recalculates the formulas so errors surface), say the package is large, then install
25
+ > it (`brew install --cask libreoffice` / `sudo apt install libreoffice-core` /
26
+ > `winget install TheDocumentFoundation.LibreOffice`). Only after an install attempt has **failed**
27
+ > may you use another program, and you must report which verification steps were skipped.
28
+ > **No install attempt = no substitute program.** See `env_setup/setup.md`.
29
+
21
30
  ---
22
31
 
23
32
  ## Role 1: Blueprint Architect