zcode-app-cli 3.8.1-15 → 3.9.2-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 +109 -47
- package/config.example.json +14 -0
- package/package.json +2 -2
- package/vendor/extraction.json +131 -5
- package/vendor/node_modules/@zcode/tui/dist/index.js +52 -4
- package/vendor/packages/browser-use-plugin/.zcode-plugin/plugin.json +1 -1
- package/vendor/packages/browser-use-plugin/dist/mcp/server.js +12862 -10414
- package/vendor/packages/browser-use-plugin/docs/api.json +5 -0
- package/vendor/packages/browser-use-plugin/docs/overview.md +3 -0
- package/vendor/packages/browser-use-plugin/package.json +1 -1
- package/vendor/packages/browser-use-plugin/scripts/browser-client.mjs +63 -7
- package/vendor/packages/browser-use-plugin/skills/control-browser/SKILL.md +4 -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 +149 -180
- 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 +68048 -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 +172 -0
- package/vendor/zcode.cjs +748 -740
- 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
|
@@ -51,6 +51,7 @@ Commands:
|
|
|
51
51
|
|
|
52
52
|
from __future__ import annotations
|
|
53
53
|
|
|
54
|
+
import glob
|
|
54
55
|
import html
|
|
55
56
|
import json
|
|
56
57
|
import os
|
|
@@ -195,11 +196,63 @@ def _probe_python_module(mod_name: str) -> tuple[str, str]:
|
|
|
195
196
|
return ("missing", "")
|
|
196
197
|
|
|
197
198
|
|
|
199
|
+
def _find_node() -> str | None:
|
|
200
|
+
"""Locate a node binary, PATH first then common install locations.
|
|
201
|
+
|
|
202
|
+
Node is often installed outside PATH (official tarball unpacked into
|
|
203
|
+
~/.local, nvm/volta/fnm version dirs, a per-user Windows install), and a
|
|
204
|
+
`export PATH=...` from an earlier shell does not survive. Searching those
|
|
205
|
+
locations keeps us from reinstalling something that is already present.
|
|
206
|
+
"""
|
|
207
|
+
found = shutil.which("node")
|
|
208
|
+
if found:
|
|
209
|
+
return found
|
|
210
|
+
|
|
211
|
+
home = Path.home()
|
|
212
|
+
if os.name == "nt":
|
|
213
|
+
patterns = [
|
|
214
|
+
r"C:\Program Files\nodejs\node.exe",
|
|
215
|
+
r"C:\Program Files (x86)\nodejs\node.exe",
|
|
216
|
+
str(home / "AppData" / "Local" / "Programs" / "nodejs" / "node.exe"),
|
|
217
|
+
str(home / "AppData" / "Roaming" / "nvm" / "*" / "node.exe"),
|
|
218
|
+
str(home / "scoop" / "apps" / "nodejs" / "current" / "node.exe"),
|
|
219
|
+
str(home / ".volta" / "bin" / "node.exe"),
|
|
220
|
+
]
|
|
221
|
+
else:
|
|
222
|
+
patterns = [
|
|
223
|
+
str(home / ".local" / "*" / "bin" / "node"), # official tarball unpacked
|
|
224
|
+
str(home / ".local" / "bin" / "node"),
|
|
225
|
+
str(home / ".nvm" / "versions" / "node" / "*" / "bin" / "node"),
|
|
226
|
+
str(home / ".fnm" / "node-versions" / "*" / "installation" / "bin" / "node"),
|
|
227
|
+
str(home / ".volta" / "bin" / "node"),
|
|
228
|
+
str(home / "n" / "bin" / "node"),
|
|
229
|
+
"/opt/homebrew/bin/node",
|
|
230
|
+
"/usr/local/bin/node",
|
|
231
|
+
"/usr/bin/node",
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
for pattern in patterns:
|
|
235
|
+
# reverse: prefer the highest version when a glob matches several
|
|
236
|
+
for candidate in sorted(glob.glob(pattern), reverse=True):
|
|
237
|
+
if os.path.isfile(candidate) and os.access(candidate, os.X_OK):
|
|
238
|
+
return candidate
|
|
239
|
+
return None
|
|
240
|
+
|
|
241
|
+
|
|
198
242
|
def _probe_node() -> tuple[str, str]:
|
|
199
|
-
|
|
200
|
-
if
|
|
201
|
-
|
|
202
|
-
|
|
243
|
+
node = _find_node()
|
|
244
|
+
if not node:
|
|
245
|
+
return ("missing", "")
|
|
246
|
+
try:
|
|
247
|
+
result = subprocess.run(
|
|
248
|
+
[node, "--version"], capture_output=True, text=True, timeout=10
|
|
249
|
+
)
|
|
250
|
+
ver = (result.stdout.strip() or result.stderr.strip()).lstrip("v")
|
|
251
|
+
except Exception:
|
|
252
|
+
ver = ""
|
|
253
|
+
# Surface the resolved path when it is not on PATH, so callers know to use it.
|
|
254
|
+
detail = ver if shutil.which("node") else f"{ver} at {node}" if ver else node
|
|
255
|
+
return ("ok", detail)
|
|
203
256
|
|
|
204
257
|
|
|
205
258
|
def _probe_python() -> tuple[str, str]:
|
|
@@ -241,29 +294,52 @@ def _probe_tectonic() -> tuple[str, str]:
|
|
|
241
294
|
return ("missing", "")
|
|
242
295
|
|
|
243
296
|
|
|
297
|
+
def _find_npm() -> str | None:
|
|
298
|
+
"""Locate npm, PATH first then next to the resolved node binary."""
|
|
299
|
+
found = shutil.which("npm")
|
|
300
|
+
if found:
|
|
301
|
+
return found
|
|
302
|
+
node = _find_node()
|
|
303
|
+
if not node:
|
|
304
|
+
return None
|
|
305
|
+
for name in (["npm.cmd", "npm"] if os.name == "nt" else ["npm"]):
|
|
306
|
+
candidate = Path(node).parent / name
|
|
307
|
+
if candidate.exists():
|
|
308
|
+
return str(candidate)
|
|
309
|
+
return None
|
|
310
|
+
|
|
311
|
+
|
|
244
312
|
def _probe_playwright_npm() -> tuple[str, str]:
|
|
245
313
|
"""Check if playwright npm package is installed."""
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
)
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
314
|
+
node = _find_node()
|
|
315
|
+
if node:
|
|
316
|
+
# Try the caller's cwd first, then node's own install dir — installing
|
|
317
|
+
# node privately and then running `npm install playwright` in that same
|
|
318
|
+
# directory is a common pattern, and node resolves require() from cwd.
|
|
319
|
+
for cwd in (None, str(Path(node).parent.parent)):
|
|
320
|
+
try:
|
|
321
|
+
result = subprocess.run(
|
|
322
|
+
[node, "-e", "console.log(require('playwright/package.json').version)"],
|
|
323
|
+
capture_output=True, text=True, timeout=10, cwd=cwd
|
|
324
|
+
)
|
|
325
|
+
if result.returncode == 0 and result.stdout.strip():
|
|
326
|
+
return ("ok", result.stdout.strip())
|
|
327
|
+
except Exception:
|
|
328
|
+
pass
|
|
255
329
|
# Try global
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
330
|
+
npm = _find_npm()
|
|
331
|
+
if npm:
|
|
332
|
+
try:
|
|
333
|
+
result = subprocess.run(
|
|
334
|
+
[npm, "list", "-g", "playwright", "--depth=0"],
|
|
335
|
+
capture_output=True, text=True, timeout=15
|
|
336
|
+
)
|
|
337
|
+
import re as _re
|
|
338
|
+
m = _re.search(r"playwright@(\S+)", result.stdout)
|
|
339
|
+
if m:
|
|
340
|
+
return ("ok", m.group(1))
|
|
341
|
+
except Exception:
|
|
342
|
+
pass
|
|
267
343
|
return ("missing", "")
|
|
268
344
|
|
|
269
345
|
|
|
@@ -293,32 +369,38 @@ def env_check(argv: list):
|
|
|
293
369
|
s_py = _probe_python()
|
|
294
370
|
s_pike = _probe_python_module("pikepdf")
|
|
295
371
|
s_plumb = _probe_python_module("pdfplumber")
|
|
372
|
+
s_pypdf = _probe_python_module("pypdf")
|
|
373
|
+
s_rl = _probe_python_module("reportlab")
|
|
374
|
+
s_fitz = _probe_python_module("fitz")
|
|
296
375
|
s_lo = _probe_libreoffice()
|
|
297
376
|
s_tec = _probe_tectonic()
|
|
298
377
|
s_pw_py = _probe_python_module("playwright")
|
|
299
378
|
|
|
300
379
|
if use_json:
|
|
301
380
|
report = {
|
|
302
|
-
"
|
|
303
|
-
"node": s_node[0], "node_version": s_node[1],
|
|
304
|
-
"playwright": s_pw[0], "playwright_version": s_pw[1],
|
|
305
|
-
"chromium": s_cr[0], "chromium_detail": s_cr[1],
|
|
306
|
-
},
|
|
307
|
-
"process_route": {
|
|
381
|
+
"core": { # required for the default ReportLab + processing routes
|
|
308
382
|
"python3": s_py[0], "python3_version": s_py[1],
|
|
383
|
+
"reportlab": s_rl[0], "reportlab_version": s_rl[1],
|
|
384
|
+
"pypdf": s_pypdf[0], "pypdf_version": s_pypdf[1],
|
|
385
|
+
"PyMuPDF": s_fitz[0], "PyMuPDF_version": s_fitz[1],
|
|
309
386
|
"pikepdf": s_pike[0], "pikepdf_version": s_pike[1],
|
|
310
387
|
"pdfplumber": s_plumb[0], "pdfplumber_version": s_plumb[1],
|
|
388
|
+
},
|
|
389
|
+
"optional_html_route": { # Creative / poster / HTML->PDF \u2014 install on demand
|
|
390
|
+
"node": s_node[0], "node_version": s_node[1],
|
|
391
|
+
"playwright": s_pw[0], "playwright_version": s_pw[1],
|
|
392
|
+
"chromium": s_cr[0], "chromium_detail": s_cr[1],
|
|
311
393
|
"playwright_python": s_pw_py[0], "playwright_python_version": s_pw_py[1],
|
|
312
394
|
},
|
|
313
|
-
"
|
|
395
|
+
"optional_other": {
|
|
314
396
|
"libreoffice": s_lo[0],
|
|
315
397
|
"tectonic": s_tec[0],
|
|
316
398
|
},
|
|
317
399
|
}
|
|
318
400
|
sys.stdout.write(json.dumps(report, ensure_ascii=False, indent=2) + "\n")
|
|
319
|
-
#
|
|
401
|
+
# Exit code reflects CORE only; optional engines never fail the check.
|
|
320
402
|
rc = 0
|
|
321
|
-
for v in [
|
|
403
|
+
for v in [s_py, s_rl, s_pypdf, s_fitz, s_pike, s_plumb]:
|
|
322
404
|
if v[0] != "ok":
|
|
323
405
|
rc = 2
|
|
324
406
|
break
|
|
@@ -334,45 +416,57 @@ def env_check(argv: list):
|
|
|
334
416
|
detail = f" ({d})" if d else ""
|
|
335
417
|
print(f" \u2713 {name}{detail}")
|
|
336
418
|
elif optional:
|
|
337
|
-
print(f" \u25cb {name} (optional, not installed)")
|
|
419
|
+
print(f" \u25cb {name} (optional, not installed \u2014 install on demand)")
|
|
338
420
|
else:
|
|
339
421
|
print(f" \u2717 {name} (missing)")
|
|
340
422
|
rc = 2
|
|
341
423
|
|
|
342
424
|
print("=== PDF Skill Environment ===\n")
|
|
343
|
-
print("---
|
|
344
|
-
show("node", s_node)
|
|
345
|
-
show("playwright", s_pw)
|
|
346
|
-
show("chromium", s_cr)
|
|
347
|
-
|
|
348
|
-
print("\n--- Process Route ---")
|
|
425
|
+
print("--- Core (required: ReportLab + processing routes) ---")
|
|
349
426
|
show("python3", s_py)
|
|
427
|
+
show("reportlab", s_rl)
|
|
428
|
+
show("pypdf", s_pypdf)
|
|
429
|
+
show("PyMuPDF", s_fitz)
|
|
350
430
|
show("pikepdf", s_pike)
|
|
351
431
|
show("pdfplumber", s_plumb)
|
|
432
|
+
|
|
433
|
+
print("\n--- Optional: HTML route (Creative / poster / HTML\u2192PDF) ---")
|
|
434
|
+
show("node", s_node, optional=True)
|
|
435
|
+
if s_node[0] == "ok" and not shutil.which("node"):
|
|
436
|
+
_node_abs = _find_node()
|
|
437
|
+
print(f" \u26a0 node is NOT on PATH \u2014 a bare `node ...` will fail.")
|
|
438
|
+
print(f" Invoke it by absolute path, e.g.:")
|
|
439
|
+
print(f' "{_node_abs}" "$PDF_SKILL_DIR/scripts/html2poster.js" poster.html -o poster.pdf')
|
|
440
|
+
show("playwright", s_pw, optional=True)
|
|
441
|
+
show("chromium", s_cr, optional=True)
|
|
352
442
|
if s_pw_py[0] == "ok":
|
|
353
443
|
print(f" (playwright-python: {s_pw_py[1]})")
|
|
354
444
|
|
|
355
|
-
print("\n--- Optional ---")
|
|
445
|
+
print("\n--- Optional: other ---")
|
|
356
446
|
show("libreoffice", s_lo, optional=True)
|
|
357
447
|
show("tectonic", s_tec, optional=True)
|
|
358
448
|
|
|
359
|
-
print("\n=== Install Commands ===")
|
|
449
|
+
print("\n=== Install Commands (optional engines \u2014 install only when a route needs them, with the user's OK) ===")
|
|
450
|
+
print(" Core Python: pip install reportlab pypdf PyMuPDF pikepdf pdfplumber")
|
|
360
451
|
print(" Node.js: brew install node (macOS) / apt install nodejs (Ubuntu)")
|
|
361
|
-
print(" Playwright: npm install -g playwright && npx playwright install chromium")
|
|
362
|
-
print(" Python: brew install python3 (macOS) / apt install python3 (Ubuntu)")
|
|
363
|
-
print(" pikepdf: pip install pikepdf pdfplumber --user")
|
|
452
|
+
print(" Playwright: npm install -g playwright && npx playwright install chromium # large download, minutes")
|
|
364
453
|
print(" LibreOffice: brew install --cask libreoffice (macOS)")
|
|
365
|
-
print(" Tectonic: curl -fsSL https://drop-sh.fullyjustified.net | sh")
|
|
454
|
+
print(" Tectonic: curl -fsSL https://drop-sh.fullyjustified.net | sh # downloads LaTeX packages on first run")
|
|
366
455
|
raise SystemExit(rc)
|
|
367
456
|
|
|
368
457
|
|
|
369
458
|
@cmd("env.fix")
|
|
370
459
|
def env_fix(argv: list):
|
|
371
|
-
"""Auto-install missing Python dependencies.
|
|
460
|
+
"""Auto-install missing CORE Python dependencies only.
|
|
461
|
+
Browser engines (Playwright/Chromium) and LaTeX (Tectonic) are OPTIONAL and are
|
|
462
|
+
NEVER auto-installed here — install them on demand, with the user's confirmation,
|
|
463
|
+
only when a route needs them (they involve large downloads / long waits)."""
|
|
372
464
|
modules = {
|
|
465
|
+
"reportlab": "reportlab",
|
|
466
|
+
"pypdf": "pypdf",
|
|
467
|
+
"fitz": "PyMuPDF",
|
|
373
468
|
"pikepdf": "pikepdf",
|
|
374
469
|
"pdfplumber": "pdfplumber",
|
|
375
|
-
"pypdf": "pypdf",
|
|
376
470
|
"pdf2image": "pdf2image",
|
|
377
471
|
"PIL": "Pillow",
|
|
378
472
|
}
|
|
@@ -1765,7 +1859,7 @@ def convert_html(argv: list):
|
|
|
1765
1859
|
if not js_path.exists():
|
|
1766
1860
|
Output.error("DependencyMissing", "html2pdf.js not found in scripts directory")
|
|
1767
1861
|
|
|
1768
|
-
node_path =
|
|
1862
|
+
node_path = _find_node()
|
|
1769
1863
|
if not node_path:
|
|
1770
1864
|
Output.error("DependencyMissing", "node not found in PATH")
|
|
1771
1865
|
|
|
@@ -1968,7 +2062,7 @@ def convert_blueprint(argv: list):
|
|
|
1968
2062
|
# 4. Call html2pdf.js to render PDF
|
|
1969
2063
|
print("📄 [2/2] Rendering HTML to High-Res PDF via Playwright...", flush=True)
|
|
1970
2064
|
js_script = _SCRIPT_DIR / "html2pdf.js"
|
|
1971
|
-
node_path =
|
|
2065
|
+
node_path = _find_node()
|
|
1972
2066
|
if not node_path:
|
|
1973
2067
|
Output.error("DependencyMissing", "node not found in PATH")
|
|
1974
2068
|
|
|
@@ -2955,3 +3049,4 @@ def main():
|
|
|
2955
3049
|
|
|
2956
3050
|
if __name__ == "__main__":
|
|
2957
3051
|
main()
|
|
3052
|
+
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# name: pdf-setup
|
|
4
4
|
# author: Z.AI
|
|
5
5
|
# version: "1.0"
|
|
6
|
-
# description: Environment setup for the PDF skill. Checks and
|
|
6
|
+
# description: Environment setup for the PDF skill. Checks/installs CORE deps (Python + ReportLab/pypdf/PyMuPDF/pikepdf/pdfplumber + CJK font). Playwright/Chromium and Tectonic are OPTIONAL — install on demand.
|
|
7
7
|
# ---
|
|
8
8
|
#
|
|
9
9
|
# Installs only dependencies required by the PDF skill.
|
|
@@ -122,46 +122,48 @@ if [ ${#MISSING_PY[@]} -gt 0 ]; then
|
|
|
122
122
|
fi
|
|
123
123
|
fi
|
|
124
124
|
|
|
125
|
-
# ── 4. Node.js ──
|
|
125
|
+
# ── 4. Node.js (OPTIONAL — Creative/HTML pipeline only) ──
|
|
126
126
|
echo ""
|
|
127
|
-
echo "--- Node.js ---"
|
|
127
|
+
echo "--- Node.js (optional: Creative/HTML pipeline) ---"
|
|
128
128
|
if command -v node &>/dev/null; then
|
|
129
129
|
NODE_VER=$(node --version)
|
|
130
130
|
ok "node ($NODE_VER)"
|
|
131
131
|
else
|
|
132
|
-
|
|
132
|
+
warn "node not found (optional — only needed for the Creative/poster/HTML→PDF route)"
|
|
133
133
|
case "$OS" in
|
|
134
|
-
Darwin) info "Install: brew install node" ;;
|
|
135
|
-
Linux) info "Install: curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -"
|
|
136
|
-
info "
|
|
137
|
-
*) info "Install: https://nodejs.org/" ;;
|
|
134
|
+
Darwin) info "Install on demand: brew install node" ;;
|
|
135
|
+
Linux) info "Install on demand: curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -"
|
|
136
|
+
info " sudo apt install -y nodejs" ;;
|
|
137
|
+
*) info "Install on demand: https://nodejs.org/" ;;
|
|
138
138
|
esac
|
|
139
139
|
fi
|
|
140
140
|
|
|
141
|
-
# ── 5. npm ──
|
|
141
|
+
# ── 5. npm (OPTIONAL) ──
|
|
142
142
|
echo ""
|
|
143
|
-
echo "--- npm ---"
|
|
143
|
+
echo "--- npm (optional) ---"
|
|
144
144
|
if command -v npm &>/dev/null; then
|
|
145
145
|
NPM_VER=$(npm --version 2>/dev/null)
|
|
146
146
|
ok "npm ($NPM_VER)"
|
|
147
147
|
else
|
|
148
|
-
|
|
148
|
+
warn "npm not found (optional — bundled with Node.js)"
|
|
149
149
|
case "$OS" in
|
|
150
|
-
Darwin) info "Install: brew install node (includes npm)" ;;
|
|
151
|
-
Linux) info "Install: comes with nodejs" ;;
|
|
152
|
-
*) info "Install: https://nodejs.org/" ;;
|
|
150
|
+
Darwin) info "Install on demand: brew install node (includes npm)" ;;
|
|
151
|
+
Linux) info "Install on demand: comes with nodejs" ;;
|
|
152
|
+
*) info "Install on demand: https://nodejs.org/" ;;
|
|
153
153
|
esac
|
|
154
154
|
fi
|
|
155
155
|
|
|
156
|
-
# ── 6. Playwright + Chromium ──
|
|
156
|
+
# ── 6. Playwright + Chromium (OPTIONAL — Creative/HTML pipeline only) ──
|
|
157
157
|
echo ""
|
|
158
|
-
echo "--- Playwright (HTML→PDF engine) ---"
|
|
158
|
+
echo "--- Playwright + Chromium (optional: HTML→PDF engine) ---"
|
|
159
|
+
info "Optional. Covers now render with ReportLab; Playwright is only for Creative/poster/HTML→PDF."
|
|
160
|
+
info "Install on demand, with the user's confirmation (large download / long first-run wait)."
|
|
159
161
|
if node -e "require('playwright')" 2>/dev/null; then
|
|
160
162
|
PW_VER=$(node -e "console.log(require('playwright/package.json').version)" 2>/dev/null)
|
|
161
163
|
ok "playwright ($PW_VER)"
|
|
162
164
|
else
|
|
163
|
-
|
|
164
|
-
info "Install: npm install -g playwright"
|
|
165
|
+
warn "playwright not installed (optional)"
|
|
166
|
+
info "Install on demand: npm install -g playwright"
|
|
165
167
|
fi
|
|
166
168
|
|
|
167
169
|
# Check Chromium
|
|
@@ -174,10 +176,10 @@ if ls "$PW_CACHE"/chromium-* &>/dev/null 2>&1; then
|
|
|
174
176
|
CR_DIR=$(ls -d "$PW_CACHE"/chromium-* 2>/dev/null | tail -1)
|
|
175
177
|
ok "chromium ($(basename "$CR_DIR"))"
|
|
176
178
|
else
|
|
177
|
-
|
|
178
|
-
info "Install: npx playwright install chromium"
|
|
179
|
+
warn "chromium not installed (optional)"
|
|
180
|
+
info "Install on demand: npx playwright install chromium"
|
|
179
181
|
if [ "$OS" = "Linux" ]; then
|
|
180
|
-
info "
|
|
182
|
+
info " npx playwright install-deps (system libs, needs sudo)"
|
|
181
183
|
fi
|
|
182
184
|
fi
|
|
183
185
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Background is the canvas behind the canvas. It should be felt, not seen.
|
|
4
4
|
|
|
5
|
-
> **⚠️
|
|
5
|
+
> **⚠️ V4.0 Note:** Report/Academic covers are now rendered with **ReportLab** (`scripts/cover_render.py`) — so the ReportLab Python examples below are **directly applicable** (coordinates, ratios, opacity values, `canvas` calls). For the **Creative** route (HTML), translate them to equivalent CSS `background`, `linear-gradient`, `radial-gradient`, `transform`, `clip-path`. The design intent and constraints (opacity limits, layer order, WCAG contrast) apply regardless of rendering engine. Background decoration is **optional** — templates 01–09 already define their own Layer-1 backgrounds.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|