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.
Files changed (154) hide show
  1. package/bin/zcode.js +109 -47
  2. package/config.example.json +14 -0
  3. package/package.json +2 -2
  4. package/vendor/extraction.json +131 -5
  5. package/vendor/node_modules/@zcode/tui/dist/index.js +52 -4
  6. package/vendor/packages/browser-use-plugin/.zcode-plugin/plugin.json +1 -1
  7. package/vendor/packages/browser-use-plugin/dist/mcp/server.js +12862 -10414
  8. package/vendor/packages/browser-use-plugin/docs/api.json +5 -0
  9. package/vendor/packages/browser-use-plugin/docs/overview.md +3 -0
  10. package/vendor/packages/browser-use-plugin/package.json +1 -1
  11. package/vendor/packages/browser-use-plugin/scripts/browser-client.mjs +63 -7
  12. package/vendor/packages/browser-use-plugin/skills/control-browser/SKILL.md +4 -1
  13. package/vendor/packages/document-skills-plugin/.mcp.json +13 -0
  14. package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +19 -6
  15. package/vendor/packages/document-skills-plugin/package.json +3 -3
  16. package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +6 -2
  17. package/vendor/packages/document-skills-plugin/skills/docx/env_setup/env_check.sh +0 -0
  18. package/vendor/packages/document-skills-plugin/skills/docx/env_setup/setup_mac_linux.sh +0 -0
  19. package/vendor/packages/document-skills-plugin/skills/docx/setup.sh +0 -0
  20. package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +39 -20
  21. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/academic.md +39 -47
  22. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/creative.md +11 -3
  23. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/poster.md +3 -0
  24. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +3 -0
  25. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/report.md +41 -62
  26. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/env_check.sh +23 -15
  27. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup.md +37 -19
  28. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_mac_linux.sh +0 -0
  29. package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_windows.ps1 +17 -19
  30. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/cover_render.py +487 -0
  31. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2poster.js +43 -11
  32. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +145 -50
  33. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +23 -21
  34. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover-backgrounds.md +1 -1
  35. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover.md +139 -1347
  36. package/vendor/packages/document-skills-plugin/skills/pptx/LICENSE.txt +13 -0
  37. package/vendor/packages/document-skills-plugin/skills/pptx/SKILL.md +149 -180
  38. package/vendor/packages/document-skills-plugin/skills/xlsx/SKILL.md +6 -2
  39. package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/env_check.sh +0 -0
  40. package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_mac_linux.sh +0 -0
  41. package/vendor/packages/document-skills-plugin/skills/xlsx/setup.sh +0 -0
  42. package/vendor/packages/zcode-cua-plugin/.zcode-plugin/plugin.json +19 -0
  43. package/vendor/packages/zcode-cua-plugin/dist/mcp/server.js +68048 -0
  44. package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/color.cjs +1596 -0
  45. package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/index.cjs +1 -0
  46. package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/package.json +58 -0
  47. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +221 -0
  48. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +1 -0
  49. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  50. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/package.json +42 -0
  51. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/versions.json +30 -0
  52. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/LICENSE +191 -0
  53. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  54. package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/package.json +46 -0
  55. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/LICENSE +201 -0
  56. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/detect-libc.js +313 -0
  57. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/elf.js +39 -0
  58. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/filesystem.js +51 -0
  59. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/process.js +24 -0
  60. package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/package.json +44 -0
  61. package/vendor/packages/zcode-cua-plugin/node_modules/semver/LICENSE +15 -0
  62. package/vendor/packages/zcode-cua-plugin/node_modules/semver/bin/semver.js +191 -0
  63. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/comparator.js +143 -0
  64. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/index.js +7 -0
  65. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/range.js +557 -0
  66. package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/semver.js +333 -0
  67. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/clean.js +8 -0
  68. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/cmp.js +54 -0
  69. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/coerce.js +62 -0
  70. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-build.js +9 -0
  71. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-loose.js +5 -0
  72. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare.js +7 -0
  73. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/diff.js +60 -0
  74. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/eq.js +5 -0
  75. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gt.js +5 -0
  76. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gte.js +5 -0
  77. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/inc.js +21 -0
  78. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lt.js +5 -0
  79. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lte.js +5 -0
  80. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/major.js +5 -0
  81. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/minor.js +5 -0
  82. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/neq.js +5 -0
  83. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/parse.js +18 -0
  84. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/patch.js +5 -0
  85. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/prerelease.js +8 -0
  86. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rcompare.js +5 -0
  87. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rsort.js +5 -0
  88. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/satisfies.js +12 -0
  89. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/sort.js +5 -0
  90. package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/valid.js +8 -0
  91. package/vendor/packages/zcode-cua-plugin/node_modules/semver/index.js +91 -0
  92. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/constants.js +37 -0
  93. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/debug.js +11 -0
  94. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/identifiers.js +29 -0
  95. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/lrucache.js +42 -0
  96. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/parse-options.js +17 -0
  97. package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/re.js +223 -0
  98. package/vendor/packages/zcode-cua-plugin/node_modules/semver/package.json +78 -0
  99. package/vendor/packages/zcode-cua-plugin/node_modules/semver/preload.js +4 -0
  100. package/vendor/packages/zcode-cua-plugin/node_modules/semver/range.bnf +16 -0
  101. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/gtr.js +6 -0
  102. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/intersects.js +9 -0
  103. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/ltr.js +6 -0
  104. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/max-satisfying.js +27 -0
  105. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-satisfying.js +26 -0
  106. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-version.js +63 -0
  107. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/outside.js +82 -0
  108. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/simplify.js +49 -0
  109. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/subset.js +249 -0
  110. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/to-comparators.js +10 -0
  111. package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/valid.js +13 -0
  112. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/LICENSE +191 -0
  113. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/build.js +38 -0
  114. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/check.js +14 -0
  115. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/channel.js +177 -0
  116. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/colour.js +195 -0
  117. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/composite.js +212 -0
  118. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/constructor.js +499 -0
  119. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/index.js +16 -0
  120. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/input.js +809 -0
  121. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/is.js +143 -0
  122. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/libvips.js +207 -0
  123. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/operation.js +1016 -0
  124. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/output.js +1666 -0
  125. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/resize.js +595 -0
  126. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/sharp.js +121 -0
  127. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/utility.js +291 -0
  128. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/package.json +202 -0
  129. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/binding.gyp +298 -0
  130. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.cc +1130 -0
  131. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.h +402 -0
  132. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.cc +346 -0
  133. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.h +90 -0
  134. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.cc +499 -0
  135. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.h +137 -0
  136. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.cc +1814 -0
  137. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.h +408 -0
  138. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/sharp.cc +43 -0
  139. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.cc +186 -0
  140. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.h +62 -0
  141. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.cc +288 -0
  142. package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.h +22 -0
  143. package/vendor/packages/zcode-cua-plugin/package.json +31 -0
  144. package/vendor/packages/zcode-cua-plugin/scripts/build-mcp.mjs +58 -0
  145. package/vendor/packages/zcode-cua-plugin/scripts/bump-zcode-cua-producer.mjs +291 -0
  146. package/vendor/packages/zcode-cua-plugin/scripts/check-cua-baseline.mjs +155 -0
  147. package/vendor/packages/zcode-cua-plugin/scripts/check-version-coherence.mjs +478 -0
  148. package/vendor/packages/zcode-cua-plugin/scripts/sync-cache.mjs +100 -0
  149. package/vendor/packages/zcode-cua-plugin/scripts/sync-skill-from-zcode-cua.mjs +115 -0
  150. package/vendor/packages/zcode-cua-plugin/skills/zcode-computer-use/SKILL.md +172 -0
  151. package/vendor/zcode.cjs +748 -740
  152. package/zcode-runtime.lock.json +3 -3
  153. package/vendor/packages/document-skills-plugin/skills/pptx/assets/font_list.txt +0 -80
  154. package/vendor/packages/document-skills-plugin/skills/pptx/scripts/general_judge.py +0 -529
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "appVersion": "3.8.1",
3
+ "appVersion": "3.9.2",
4
4
  "platform": "linux",
5
5
  "arch": "x64",
6
- "url": "https://cdn-zcode.z.ai/zcode/electron/releases/3.8.1/linux-x64/ZCode-3.8.1-linux-x64.deb",
7
- "sha512": "iewB8VqMNFByReFlWdbbbec5h05aldHhMC1/3rwELvz9lCcBkRHW7iF5K2hYsVVceh/Ii9ipTSdPeIG8tbNH5A=="
6
+ "url": "https://cdn-zcode.z.ai/zcode/electron/releases/3.9.2/linux-x64/ZCode-3.9.2-linux-x64.deb",
7
+ "sha512": "WYe2n1emUfKQYb3RKBxwUzoyjtd/HsFfx8DoSSBclkhz0ojl3el5VyZ9FP2B0XY7kZa/O8dcETU761+P+v2kfg=="
8
8
  }
@@ -1,80 +0,0 @@
1
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-Regular.ttf
2
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-Bold.ttf
3
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-Italic.ttf
4
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-BoldItalic.ttf
5
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-Light.ttf
6
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-LightItalic.ttf
7
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-ExtraLight.ttf
8
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-ExtraLightItalic.ttf
9
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-SemiBold.ttf
10
- /usr/share/fonts/truetype/chinese/SarasaMonoSC-SemiBoldItalic.ttf
11
- /usr/share/fonts/truetype/chinese/NotoSansSC[wght].ttf
12
- /usr/share/fonts/truetype/chinese/NotoSansSC-Thin.ttf
13
- /usr/share/fonts/truetype/chinese/NotoSansSC-ExtraLight.ttf
14
- /usr/share/fonts/truetype/chinese/NotoSansSC-Light.ttf
15
- /usr/share/fonts/truetype/chinese/NotoSansSC-Regular.ttf
16
- /usr/share/fonts/truetype/chinese/NotoSansSC-Medium.ttf
17
- /usr/share/fonts/truetype/chinese/NotoSansSC-SemiBold.ttf
18
- /usr/share/fonts/truetype/chinese/NotoSansSC-Bold.ttf
19
- /usr/share/fonts/truetype/chinese/NotoSansSC-ExtraBold.ttf
20
- /usr/share/fonts/truetype/chinese/NotoSansSC-Black.ttf
21
- /usr/share/fonts/truetype/chinese/LiberationSans-Regular.ttf
22
- /usr/share/fonts/truetype/chinese/LiberationMono-Regular.ttf
23
- /usr/share/fonts/truetype/chinese/LiberationSerif-Regular.ttf
24
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-VariableFont_wght.ttf
25
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-ExtraLight.ttf
26
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-Light.ttf
27
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-Regular.ttf
28
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-Medium.ttf
29
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-SemiBold.ttf
30
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-Bold.ttf
31
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-ExtraBold.ttf
32
- /usr/share/fonts/truetype/noto-serif-sc/NotoSerifSC-Black.ttf
33
- /usr/share/fonts/truetype/lxgw-wenkai/LXGWWenKai-Regular.ttf
34
- /usr/share/fonts/truetype/lxgw-wenkai/LXGWWenKai-Medium.ttf
35
- /usr/share/fonts/truetype/lxgw-wenkai/LXGWWenKai-Light.ttf
36
- /usr/share/fonts/truetype/lxgw-wenkai/LXGWWenKaiMono-Regular.ttf
37
- /usr/share/fonts/truetype/lxgw-wenkai/LXGWWenKaiMono-Medium.ttf
38
- /usr/share/fonts/truetype/lxgw-wenkai/LXGWWenKaiMono-Light.ttf
39
- /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc
40
- /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
41
- /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
42
- /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
43
- /usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf
44
- /usr/share/fonts/truetype/dejavu/DejaVuSansMono-Oblique.ttf
45
- /usr/share/fonts/truetype/dejavu/DejaVuSansMono-BoldOblique.ttf
46
- /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf
47
- /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf
48
- /usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf
49
- /usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf
50
- /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf
51
- /usr/share/fonts/truetype/liberation/LiberationSans-BoldItalic.ttf
52
- /usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf
53
- /usr/share/fonts/truetype/liberation/LiberationSerif-Bold.ttf
54
- /usr/share/fonts/truetype/liberation/LiberationSerif-Italic.ttf
55
- /usr/share/fonts/truetype/liberation/LiberationSerif-BoldItalic.ttf
56
- /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf
57
- /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf
58
- /usr/share/fonts/truetype/liberation/LiberationMono-Italic.ttf
59
- /usr/share/fonts/truetype/liberation/LiberationMono-BoldItalic.ttf
60
- /usr/share/fonts/truetype/english/Tinos-Regular.ttf
61
- /usr/share/fonts/truetype/english/Tinos-Bold.ttf
62
- /usr/share/fonts/truetype/english/Tinos-Italic.ttf
63
- /usr/share/fonts/truetype/english/Tinos-BoldItalic.ttf
64
- /usr/share/fonts/truetype/english/Carlito-Regular.ttf
65
- /usr/share/fonts/truetype/english/Carlito-Bold.ttf
66
- /usr/share/fonts/truetype/english/Carlito-Italic.ttf
67
- /usr/share/fonts/truetype/english/Carlito-BoldItalic.ttf
68
- /usr/share/fonts/truetype/freefont/FreeSans.ttf
69
- /usr/share/fonts/truetype/freefont/FreeSansBold.ttf
70
- /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
71
- /usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf
72
- /usr/share/fonts/truetype/freefont/FreeSerif.ttf
73
- /usr/share/fonts/truetype/freefont/FreeSerifBold.ttf
74
- /usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf
75
- /usr/share/fonts/truetype/freefont/FreeSerifBoldItalic.ttf
76
- /usr/share/fonts/truetype/freefont/FreeMono.ttf
77
- /usr/share/fonts/truetype/freefont/FreeMonoBold.ttf
78
- /usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf
79
- /usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf
80
- /usr/share/fonts/truetype/libreoffice/opens___.ttf
@@ -1,529 +0,0 @@
1
- #!/usr/bin/env python3
2
- """general_judge: render a pptx and report rule-based defects.
3
-
4
- Every finding is a definite defect for ANY pptx — no thresholds, no taste:
5
- render_mismatch visible slide count != pdf page count, or pdf pages != pngs
6
- garbled rendered text contains U+FFFD replacement characters
7
- text_off_canvas a text-bearing shape extends outside the slide bounds
8
- text_collision two rendered words print on the same pixels (exempt:
9
- watermark-scale size gap, faux-bold/shadow double draw)
10
- text_occluded a text shape is ≥70% covered by a later-drawn opaque
11
- solid-fill shape — the reader cannot see the text
12
- text_overflow a rendered word escapes every text-capable container —
13
- text spilled outside the shape meant to hold it
14
- (auto-grow shapes, tables, wrap=none boxes exempt)
15
- broken_image picture with a missing/external/zero-byte image part
16
- placeholder template placeholder text survived into the render
17
- ("lorem ipsum" / "Click to add")
18
-
19
- Exit codes: 0 = clean, 1 = findings, 2 = cannot judge (render/deps failed).
20
- Rotated shapes are excluded from geometry checks (bbox would be wrong).
21
- """
22
- import argparse
23
- import json
24
- import re
25
- import subprocess
26
- import sys
27
- import tempfile
28
- from pathlib import Path
29
-
30
- import xml.etree.ElementTree as ET
31
-
32
- EMU_IN = 914400
33
- OFF_TOL_IN = 0.02 # off-canvas tolerance
34
- PLACEHOLDER = re.compile(r"\blorem ipsum\b|\bClick to add\b", re.I)
35
-
36
- A = "http://schemas.openxmlformats.org/drawingml/2006/main"
37
-
38
-
39
- def die(msg):
40
- print(f"cannot judge: {msg}", file=sys.stderr)
41
- sys.exit(2)
42
-
43
-
44
- # ---------------------------------------------------------------- rendering
45
-
46
- def render(pptx: Path, outdir: Path, dpi: int):
47
- outdir.mkdir(parents=True, exist_ok=True)
48
- try:
49
- proc = subprocess.run(
50
- ["soffice", "--headless", "--convert-to", "pdf", str(pptx),
51
- "--outdir", str(outdir)],
52
- capture_output=True, text=True, timeout=600)
53
- except FileNotFoundError:
54
- die("soffice not found")
55
- except subprocess.TimeoutExpired:
56
- die("soffice timed out")
57
- pdf = outdir / (pptx.stem + ".pdf")
58
- if proc.returncode != 0 or not pdf.is_file():
59
- die(f"soffice conversion failed: {proc.stderr.strip() or 'no output'}")
60
- slides = outdir / "slides"
61
- slides.mkdir(exist_ok=True)
62
- for old in slides.glob("slide*.png"):
63
- old.unlink()
64
- try:
65
- subprocess.run(
66
- ["pdftoppm", "-png", "-r", str(dpi), str(pdf), str(slides / "slide")],
67
- check=True, timeout=600)
68
- except (FileNotFoundError, subprocess.CalledProcessError,
69
- subprocess.TimeoutExpired) as exc:
70
- die(f"pdftoppm failed: {exc}")
71
- return pdf, slides
72
-
73
-
74
- def pdf_page_count(pdf: Path) -> int:
75
- try:
76
- info = subprocess.run(["pdfinfo", str(pdf)],
77
- capture_output=True, text=True, check=True).stdout
78
- except (FileNotFoundError, subprocess.CalledProcessError) as exc:
79
- die(f"pdfinfo failed: {exc}")
80
- return int(re.search(r"Pages:\s+(\d+)", info).group(1))
81
-
82
-
83
- # ---------------------------------------------------------------- pdf text
84
-
85
- def el_is(el, name):
86
- return el.tag.split("}")[-1] == name
87
-
88
-
89
- def pdf_text_findings(pdf: Path, want, add, containers=None):
90
- try:
91
- xml = subprocess.run(["pdftotext", "-bbox-layout", str(pdf), "-"],
92
- capture_output=True, text=True, check=True).stdout
93
- except (FileNotFoundError, subprocess.CalledProcessError) as exc:
94
- die(f"pdftotext failed: {exc}")
95
- pages = [el for el in ET.fromstring(xml).iter() if el_is(el, "page")]
96
- for pno, page in enumerate(pages, 1):
97
- if pno not in want:
98
- continue
99
- words = []
100
- for ln in (el for el in page.iter() if el_is(el, "line")):
101
- txt = " ".join((w.text or "") for w in ln if el_is(w, "word")).strip()
102
- if not txt:
103
- continue
104
- if "�" in txt:
105
- add(pno, "garbled", "U+FFFD replacement char in rendered text",
106
- txt)
107
- if PLACEHOLDER.search(txt):
108
- add(pno, "placeholder", "template placeholder text rendered",
109
- txt)
110
- for w in ln:
111
- if not el_is(w, "word") or not (w.text or "").strip():
112
- continue
113
- try:
114
- box = tuple(float(w.get(k)) for k in
115
- ("xMin", "yMin", "xMax", "yMax"))
116
- except (TypeError, ValueError):
117
- continue
118
- words.append((box, w.text.strip()))
119
- collision_findings(pno, words, add)
120
- if containers is not None:
121
- per_page, slide_w, slide_h = containers
122
- try:
123
- pw, ph = float(page.get("width")), float(page.get("height"))
124
- except (TypeError, ValueError):
125
- continue
126
- if pno <= len(per_page) and pw > 0 and ph > 0:
127
- overflow_findings(pno, words,
128
- (per_page[pno - 1], slide_w, slide_h),
129
- pw, ph, add)
130
-
131
-
132
- def collision_findings(pno, words, add):
133
- """Two words printed on the same pixels — a definite defect. Exempt:
134
- watermark-scale size gap (>=3x height), faux-bold/shadow double draw
135
- (same text at a near-identical position). Adjacent-line/kerning bbox
136
- touches are filtered by requiring the overlap to be a substantial part
137
- of a character in BOTH axes (>55% of line height vertically, >50% of
138
- the smaller height horizontally)."""
139
- words = sorted(words, key=lambda w: w[0][1])
140
- reported = set()
141
- for i, ((ax0, ay0, ax1, ay1), atxt) in enumerate(words):
142
- ah = ay1 - ay0
143
- if ah <= 0:
144
- continue
145
- for j in range(i + 1, len(words)):
146
- (bx0, by0, bx1, by1), btxt = words[j]
147
- if by0 >= ay1: # sorted by yMin: nothing below can overlap
148
- break
149
- bh = by1 - by0
150
- if bh <= 0 or i in reported or j in reported:
151
- continue
152
- mh = min(ah, bh)
153
- oy = min(ay1, by1) - max(ay0, by0)
154
- ox = min(ax1, bx1) - max(ax0, bx0)
155
- if oy <= 0.55 * mh or ox <= 0.5 * mh:
156
- continue
157
- if max(ah, bh) >= 3 * mh: # watermark-scale size gap
158
- continue
159
- if (atxt == btxt and abs(ax0 - bx0) <= 1.5
160
- and abs(ay0 - by0) <= 1.5): # faux-bold/shadow draw
161
- continue
162
- reported.update((i, j))
163
- add(pno, "text_collision",
164
- f"rendered words overlap at ({ax0:.0f},{ay0:.0f})pt",
165
- f"{atxt!r} × {btxt!r}")
166
-
167
-
168
- # ------------------------------------------------------------- overflow
169
-
170
- def _text_container(sh, l, t, w, h):
171
- """(box, grow_v, grow_h) when the shape can emit rendered text.
172
- grow_v: LibreOffice re-flows the height (spAutoFit shapes, tables) so
173
- the declared bottom is not a boundary. grow_h: wrap='none' text sizes
174
- itself horizontally from its anchor box by design."""
175
- import math
176
- from pptx.enum.text import MSO_AUTO_SIZE
177
- if getattr(sh, "rotation", 0):
178
- # AABB can't be trusted under rotation — use the circumscribed box
179
- # (over-generous container only ever hides findings, never invents)
180
- r = math.hypot(w, h) / 2
181
- cx, cy = l + w / 2, t + h / 2
182
- l, t, w, h = cx - r, cy - r, 2 * r, 2 * r
183
- grow_v = grow_h = False
184
- if getattr(sh, "has_table", False):
185
- grow_v = True
186
- elif sh.element.tag.split("}")[-1] == "graphicFrame":
187
- pass # chart / SmartArt: clipped to the frame
188
- else:
189
- try:
190
- if not sh.has_text_frame:
191
- return None
192
- tf = sh.text_frame
193
- grow_v = tf.auto_size == MSO_AUTO_SIZE.SHAPE_TO_FIT_TEXT
194
- grow_h = tf.word_wrap is False
195
- except Exception:
196
- return None
197
- return ((l, t, l + w, t + h), grow_v, grow_h)
198
-
199
-
200
- def _walk_containers(shapes, tf, out, inherited=False):
201
- """Collect text containers in slide space. Returns False when a rotated
202
- group is met — its children's geometry is unknowable, caller must skip
203
- the slide rather than risk false positives. Layout/master shapes
204
- (inherited=True) only count when they actually render text on the
205
- slide: footer/slide-number/date placeholders, or ordinary shapes that
206
- carry text. Title/body placeholder prompt boxes never render — and
207
- their huge frames would swallow every real overflow."""
208
- from pptx.enum.shapes import PP_PLACEHOLDER
209
- fx, fy, sx, sy = tf
210
- for sh in shapes:
211
- if sh.shape_type == 6: # GROUP
212
- xfrm = None
213
- for child in sh.element:
214
- if child.tag.split("}")[-1] == "grpSpPr":
215
- xfrm = child.find(f"{{{A}}}xfrm")
216
- break
217
- if xfrm is not None and int(xfrm.get("rot", "0")):
218
- return False
219
- child_tf = _group_child_transform(sh.element, tf)
220
- if child_tf is not None:
221
- if not _walk_containers(sh.shapes, child_tf, out, inherited):
222
- return False
223
- continue
224
- if sh.left is None or sh.width is None:
225
- continue
226
- if inherited:
227
- if sh.is_placeholder:
228
- if sh.placeholder_format.type not in (
229
- PP_PLACEHOLDER.FOOTER, PP_PLACEHOLDER.SLIDE_NUMBER,
230
- PP_PLACEHOLDER.DATE):
231
- continue
232
- elif not shape_text(sh):
233
- continue
234
- c = _text_container(sh, fx + sh.left * sx, fy + sh.top * sy,
235
- sh.width * sx, sh.height * sy)
236
- if c is not None:
237
- out.append(c)
238
- return True
239
-
240
-
241
- def slide_containers(prs):
242
- """Per visible slide (pdf page order): list of text containers in EMU,
243
- or None when the slide must be skipped. Layout and master shapes are
244
- included — slide-number/footer text renders from them."""
245
- result = []
246
- for slide in prs.slides:
247
- if slide.element.get("show") == "0":
248
- continue
249
- boxes = []
250
- ok = _walk_containers(slide.shapes, (0.0, 0.0, 1.0, 1.0), boxes)
251
- for inherited in (slide.slide_layout.shapes,
252
- slide.slide_layout.slide_master.shapes):
253
- ok = _walk_containers(inherited, (0.0, 0.0, 1.0, 1.0), boxes,
254
- inherited=True) and ok
255
- result.append(boxes if ok else None)
256
- return result
257
-
258
-
259
- def overflow_findings(pno, words, containers, page_w, page_h, add):
260
- """A rendered word that escapes EVERY text container is text spilled
261
- outside whatever shape was meant to hold it (typically past a card's
262
- bottom edge). Threshold max(8pt, 0.6×word height) absorbs renderer
263
- metric drift, italic overhang and hanging bullets."""
264
- boxes, slide_w, slide_h = containers
265
- if boxes is None or not boxes or not words:
266
- return
267
- sx, sy = page_w / slide_w, page_h / slide_h # EMU -> pt
268
- pt_boxes = [((l * sx, t * sy, r * sx, b * sy), gv, gh)
269
- for (l, t, r, b), gv, gh in boxes]
270
- escaped = []
271
- for (x0, y0, x1, y1), txt in words:
272
- h = y1 - y0
273
- if h <= 0:
274
- continue
275
- thr = max(8.0, 0.6 * h)
276
- best = None
277
- for (cl, ct, cr, cb), grow_v, grow_h in pt_boxes:
278
- excess = max(0.0,
279
- ct - y0,
280
- 0.0 if grow_v else y1 - cb,
281
- 0.0 if grow_h else max(cl - x0, x1 - cr))
282
- if best is None or excess < best:
283
- best = excess
284
- if best == 0.0:
285
- break
286
- if best is not None and best > thr:
287
- escaped.append((best, txt))
288
- if escaped:
289
- escaped.sort(reverse=True)
290
- sample = "; ".join(f"{t!r} by {e:.0f}pt" for e, t in escaped[:3])
291
- add(pno, "text_overflow",
292
- f"{len(escaped)} word(s) render outside every text container",
293
- sample)
294
-
295
-
296
- # ---------------------------------------------------------------- pptx side
297
-
298
- def _group_child_transform(grp_el, outer):
299
- """Compose slide-space transform for children of a group shape.
300
-
301
- outer maps this group's parent-space EMU to slide space as
302
- (fx, fy, sx, sy): slide_x = fx + x * sx. Children live in the group's
303
- child space defined by chOff/chExt; the group's off/ext are parent-space.
304
- """
305
- xfrm = None
306
- for child in grp_el:
307
- if child.tag.split("}")[-1] == "grpSpPr": # p: on slides, a: in dgm
308
- xfrm = child.find(f"{{{A}}}xfrm")
309
- break
310
- if xfrm is None:
311
- return None
312
- def _pt(tag):
313
- el = xfrm.find(f"{{{A}}}{tag}")
314
- if el is None:
315
- return None
316
- return int(el.get("x", el.get("cx", 0))), int(el.get("y", el.get("cy", 0)))
317
- off, ext, ch_off, ch_ext = _pt("off"), _pt("ext"), _pt("chOff"), _pt("chExt")
318
- if not all((off, ext, ch_off, ch_ext)) or 0 in ch_ext:
319
- return None
320
- fx, fy, sx, sy = outer
321
- gx, gy = fx + off[0] * sx, fy + off[1] * sy # group origin, slide space
322
- ksx = sx * ext[0] / ch_ext[0]
323
- ksy = sy * ext[1] / ch_ext[1]
324
- return (gx - ch_off[0] * ksx, gy - ch_off[1] * ksy, ksx, ksy)
325
-
326
-
327
- def flatten(shapes, tf=(0.0, 0.0, 1.0, 1.0)):
328
- """Yield (shape, l, t, w, h) in slide-space EMU, recursing into groups."""
329
- fx, fy, sx, sy = tf
330
- for sh in shapes:
331
- if sh.shape_type == 6: # GROUP
332
- child_tf = _group_child_transform(sh.element, tf)
333
- if child_tf is not None:
334
- yield from flatten(sh.shapes, child_tf)
335
- continue
336
- if sh.left is None or sh.width is None:
337
- continue
338
- if getattr(sh, "rotation", 0): # bbox wrong under rotation
339
- continue
340
- yield (sh, fx + sh.left * sx, fy + sh.top * sy,
341
- sh.width * sx, sh.height * sy)
342
-
343
-
344
- def shape_text(sh):
345
- try:
346
- if sh.has_text_frame:
347
- return sh.text_frame.text.strip()
348
- except Exception:
349
- pass
350
- return ""
351
-
352
-
353
- def is_opaque_solid(sh):
354
- """True when the shape paints an opaque solid rectangle of fill —
355
- the only case where 'it covers the text below' is certain. Pictures,
356
- gradients, pattern fills and anything carrying alpha are skipped
357
- rather than guessed at; connectors/lines never fill their bbox."""
358
- if sh.element.tag.split("}")[-1] == "cxnSp":
359
- return False
360
- try:
361
- from pptx.enum.dml import MSO_FILL
362
- if sh.fill.type != MSO_FILL.SOLID:
363
- return False
364
- except (AttributeError, TypeError, NotImplementedError):
365
- return False
366
- sp_pr = getattr(sh.element, "spPr", None)
367
- if sp_pr is not None:
368
- for alpha in sp_pr.iter(f"{{{A}}}alpha"):
369
- if int(alpha.get("val", "100000")) < 100000:
370
- return False
371
- for tag in ("alphaMod", "alphaModFix"):
372
- if next(sp_pr.iter(f"{{{A}}}{tag}"), None) is not None:
373
- return False
374
- return True
375
-
376
-
377
- def occlusion_findings(sno, placed, add):
378
- """placed: [(shape, l, t, w, h)] in document order == z-order. A text
379
- shape whose bbox is >=70% covered by a single LATER opaque solid-fill
380
- shape is text the reader cannot see — text meant to sit on a card is
381
- always drawn after the card, never before."""
382
- for i, (sh, l, t, w, h) in enumerate(placed):
383
- if w <= 0 or h <= 0:
384
- continue
385
- txt = shape_text(sh)
386
- if not txt:
387
- continue
388
- area = w * h
389
- for csh, cl, ct, cw, ch in placed[i + 1:]:
390
- ox = min(l + w, cl + cw) - max(l, cl)
391
- oy = min(t + h, ct + ch) - max(t, ct)
392
- if ox <= 0 or oy <= 0 or ox * oy < 0.70 * area:
393
- continue
394
- if not is_opaque_solid(csh):
395
- continue
396
- add(sno, "text_occluded",
397
- f"text shape is {ox * oy / area:.0%} covered by "
398
- f"later-drawn opaque shape {csh.name!r}",
399
- f"{sh.name}: {txt[:40]}")
400
- break
401
-
402
-
403
- def pptx_findings(prs, want, add):
404
- from pptx.enum.shapes import MSO_SHAPE_TYPE
405
- W, H = prs.slide_width, prs.slide_height
406
- tol = int(OFF_TOL_IN * EMU_IN)
407
- for sno, slide in enumerate(prs.slides, 1):
408
- if sno not in want:
409
- continue
410
- placed = list(flatten(slide.shapes))
411
- for sh, l, t, w, h in placed:
412
- over = max(-l, -t, l + w - W, t + h - H)
413
- if over > tol and shape_text(sh):
414
- add(sno, "text_off_canvas",
415
- f"text shape extends {over / EMU_IN:.2f}in outside the slide",
416
- sh.name)
417
- if sh.shape_type == MSO_SHAPE_TYPE.PICTURE:
418
- try:
419
- blob = sh.image.blob
420
- except Exception as exc:
421
- add(sno, "broken_image",
422
- f"image part unresolvable ({type(exc).__name__})",
423
- sh.name)
424
- continue
425
- if not blob:
426
- add(sno, "broken_image", "zero-byte image part", sh.name)
427
- occlusion_findings(sno, placed, add)
428
-
429
-
430
- def visible_slide_count(prs) -> int:
431
- """Slides soffice will render: skip slides marked show="0"."""
432
- return sum(1 for s in prs.slides if s.element.get("show") != "0")
433
-
434
-
435
- # ------------------------------------------------------------------- main
436
-
437
- def parse_pages(spec, n):
438
- if not spec:
439
- return set(range(1, n + 1))
440
- out = set()
441
- for part in spec.split(","):
442
- a, _, b = part.partition("-")
443
- out.update(range(int(a), int(b or a) + 1))
444
- return out
445
-
446
-
447
- def main():
448
- ap = argparse.ArgumentParser(description=__doc__)
449
- ap.add_argument("pptx")
450
- ap.add_argument("--outdir", default=None,
451
- help="render output dir (pdf + slides/*.png); default: "
452
- "/tmp/pptx_judge/<deck-stem> — QA intermediates, "
453
- "not a deliverable")
454
- ap.add_argument("--dpi", type=int, default=150)
455
- ap.add_argument("--pages", default="",
456
- help="restrict finding emission, e.g. 3-6 or 1,2,9 "
457
- "(render always covers the whole deck)")
458
- ap.add_argument("--no-render", action="store_true",
459
- help="reuse existing pdf/pngs in outdir")
460
- ap.add_argument("--json", action="store_true",
461
- help="machine-readable JSON output")
462
- args = ap.parse_args()
463
-
464
- try:
465
- from pptx import Presentation
466
- except ImportError:
467
- die("python-pptx not installed")
468
- pptx_path = Path(args.pptx)
469
- if not pptx_path.is_file():
470
- die(f"file not found: {pptx_path}")
471
- outdir = (Path(args.outdir) if args.outdir
472
- else Path(tempfile.gettempdir()) / "pptx_judge" / pptx_path.stem)
473
-
474
- if args.no_render:
475
- pdf = outdir / (pptx_path.stem + ".pdf")
476
- slides_dir = outdir / "slides"
477
- if not pdf.is_file():
478
- die(f"--no-render but {pdf} missing")
479
- else:
480
- pdf, slides_dir = render(pptx_path, outdir, args.dpi)
481
-
482
- prs = Presentation(str(pptx_path))
483
- n_slides = len(prs.slides)
484
- n_visible = visible_slide_count(prs)
485
- n_pdf = pdf_page_count(pdf)
486
- pngs = sorted(slides_dir.glob("slide-*.png"))
487
-
488
- want = parse_pages(args.pages, n_slides)
489
- findings = []
490
-
491
- def add(page, rule, detail, ref):
492
- loc = f"slide {page}" if page else "deck"
493
- findings.append({"rule": rule, "location": loc,
494
- "detail": f"{detail} ({str(ref)[:80]})"})
495
-
496
- if n_visible != n_pdf:
497
- add(0, "render_mismatch",
498
- f"pptx has {n_visible} visible slides, pdf has {n_pdf} pages",
499
- pdf.name)
500
- if len(pngs) != n_pdf:
501
- add(0, "render_mismatch",
502
- f"pdf has {n_pdf} pages, {len(pngs)} pngs rendered", slides_dir)
503
- for p in pngs:
504
- if p.stat().st_size == 0:
505
- add(0, "render_mismatch", "zero-byte png", p.name)
506
-
507
- pdf_text_findings(pdf, want, add,
508
- (slide_containers(prs), prs.slide_width,
509
- prs.slide_height))
510
- pptx_findings(prs, want, add)
511
- findings.sort(key=lambda f: (f["location"], f["rule"]))
512
-
513
- if args.json:
514
- json.dump({"file": str(pptx_path), "clean": not findings,
515
- "findings": findings},
516
- sys.stdout, ensure_ascii=False, indent=1)
517
- print()
518
- else:
519
- print(f"deck: {pptx_path} ({n_slides} slides, "
520
- f"{len(pngs)} pngs under {slides_dir})")
521
- for f in findings:
522
- print(f" {f['rule']} {f['location']}: {f['detail']}")
523
- print(f"judge: {len(findings)} finding(s)" if findings
524
- else "judge: clean")
525
- sys.exit(1 if findings else 0)
526
-
527
-
528
- if __name__ == "__main__":
529
- main()