minimal-agent 0.1.0

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 (317) hide show
  1. package/LICENSE +148 -0
  2. package/README.md +287 -0
  3. package/dist/main.js +4140 -0
  4. package/package.json +66 -0
  5. package/skills/algorithmic-art/LICENSE.txt +202 -0
  6. package/skills/algorithmic-art/SKILL.md +405 -0
  7. package/skills/algorithmic-art/templates/generator_template.js +223 -0
  8. package/skills/algorithmic-art/templates/viewer.html +599 -0
  9. package/skills/batch/SKILL.md +39 -0
  10. package/skills/canvas-design/LICENSE.txt +202 -0
  11. package/skills/canvas-design/SKILL.md +130 -0
  12. package/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  13. package/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  14. package/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  15. package/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
  16. package/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  17. package/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
  18. package/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
  19. package/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  20. package/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  21. package/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  22. package/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  23. package/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  24. package/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  25. package/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  26. package/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
  27. package/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
  28. package/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
  29. package/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
  30. package/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
  31. package/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
  32. package/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
  33. package/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
  34. package/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
  35. package/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  36. package/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  37. package/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  38. package/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  39. package/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  40. package/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  41. package/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  42. package/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  43. package/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  44. package/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  45. package/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  46. package/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  47. package/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  48. package/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  49. package/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
  50. package/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
  51. package/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  52. package/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  53. package/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  54. package/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
  55. package/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
  56. package/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
  57. package/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  58. package/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  59. package/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
  60. package/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  61. package/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
  62. package/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  63. package/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
  64. package/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
  65. package/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
  66. package/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
  67. package/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  68. package/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  69. package/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
  70. package/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  71. package/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
  72. package/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  73. package/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
  74. package/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
  75. package/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  76. package/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  77. package/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
  78. package/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  79. package/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
  80. package/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  81. package/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  82. package/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
  83. package/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
  84. package/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  85. package/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
  86. package/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
  87. package/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  88. package/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
  89. package/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
  90. package/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
  91. package/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  92. package/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  93. package/skills/commit/SKILL.md +46 -0
  94. package/skills/compact/SKILL.md +27 -0
  95. package/skills/config/SKILL.md +94 -0
  96. package/skills/diff/SKILL.md +30 -0
  97. package/skills/docx/LICENSE.txt +30 -0
  98. package/skills/docx/SKILL.md +660 -0
  99. package/skills/docx/scripts/__init__.py +1 -0
  100. package/skills/docx/scripts/accept_changes.py +135 -0
  101. package/skills/docx/scripts/comment.py +318 -0
  102. package/skills/docx/scripts/convert_to_docx.py +140 -0
  103. package/skills/docx/scripts/office/__init__.py +1 -0
  104. package/skills/docx/scripts/office/helpers/__init__.py +0 -0
  105. package/skills/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
  106. package/skills/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
  107. package/skills/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
  108. package/skills/docx/scripts/office/helpers/merge_runs.py +199 -0
  109. package/skills/docx/scripts/office/helpers/simplify_redlines.py +197 -0
  110. package/skills/docx/scripts/office/pack.py +159 -0
  111. package/skills/docx/scripts/office/schemas/__init__.py +1 -0
  112. package/skills/docx/scripts/office/soffice.py +183 -0
  113. package/skills/docx/scripts/office/unpack.py +132 -0
  114. package/skills/docx/scripts/office/validate.py +111 -0
  115. package/skills/docx/scripts/office/validators/__init__.py +15 -0
  116. package/skills/docx/scripts/office/validators/__pycache__/__init__.cpython-314.pyc +0 -0
  117. package/skills/docx/scripts/office/validators/__pycache__/base.cpython-314.pyc +0 -0
  118. package/skills/docx/scripts/office/validators/__pycache__/docx.cpython-314.pyc +0 -0
  119. package/skills/docx/scripts/office/validators/__pycache__/pptx.cpython-314.pyc +0 -0
  120. package/skills/docx/scripts/office/validators/__pycache__/redlining.cpython-314.pyc +0 -0
  121. package/skills/docx/scripts/office/validators/base.py +847 -0
  122. package/skills/docx/scripts/office/validators/docx.py +446 -0
  123. package/skills/docx/scripts/office/validators/pptx.py +275 -0
  124. package/skills/docx/scripts/office/validators/redlining.py +247 -0
  125. package/skills/docx/scripts/templates/comments.xml +3 -0
  126. package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  127. package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  128. package/skills/docx/scripts/templates/commentsIds.xml +3 -0
  129. package/skills/docx/scripts/templates/people.xml +3 -0
  130. package/skills/frontend-design/LICENSE.txt +177 -0
  131. package/skills/frontend-design/SKILL.md +42 -0
  132. package/skills/init/SKILL.md +238 -0
  133. package/skills/init/evals/evals.json +28 -0
  134. package/skills/mcp-builder/LICENSE.txt +202 -0
  135. package/skills/mcp-builder/SKILL.md +236 -0
  136. package/skills/mcp-builder/reference/evaluation.md +602 -0
  137. package/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  138. package/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  139. package/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  140. package/skills/mcp-builder/scripts/connections.py +151 -0
  141. package/skills/mcp-builder/scripts/evaluation.py +373 -0
  142. package/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  143. package/skills/mcp-builder/scripts/requirements.txt +2 -0
  144. package/skills/pdf/LICENSE.txt +30 -0
  145. package/skills/pdf/SKILL.md +314 -0
  146. package/skills/pdf/forms.md +294 -0
  147. package/skills/pdf/reference.md +612 -0
  148. package/skills/pdf/scripts/check_bounding_boxes.py +65 -0
  149. package/skills/pdf/scripts/check_fillable_fields.py +11 -0
  150. package/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
  151. package/skills/pdf/scripts/create_validation_image.py +37 -0
  152. package/skills/pdf/scripts/extract_form_field_info.py +122 -0
  153. package/skills/pdf/scripts/extract_form_structure.py +115 -0
  154. package/skills/pdf/scripts/fill_fillable_fields.py +98 -0
  155. package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
  156. package/skills/pptx/LICENSE.txt +30 -0
  157. package/skills/pptx/SKILL.md +232 -0
  158. package/skills/pptx/editing.md +205 -0
  159. package/skills/pptx/pptxgenjs.md +420 -0
  160. package/skills/pptx/scripts/__init__.py +0 -0
  161. package/skills/pptx/scripts/add_slide.py +195 -0
  162. package/skills/pptx/scripts/clean.py +286 -0
  163. package/skills/pptx/scripts/office/helpers/__init__.py +0 -0
  164. package/skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
  165. package/skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
  166. package/skills/pptx/scripts/office/pack.py +159 -0
  167. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  168. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  169. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  170. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  171. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  172. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  173. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  174. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  175. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  176. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  177. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  178. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  179. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  180. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  181. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  182. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  183. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  184. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  185. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  186. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  187. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  188. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  189. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  190. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  191. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  192. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  193. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  194. package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/ECMA-376_3rd_edition.zip +1 -0
  195. package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/README.md +1 -0
  196. package/skills/pptx/scripts/office/schemas/mce/mce-core.xsd +1 -0
  197. package/skills/pptx/scripts/office/schemas/mce/mce-override.xsd +1 -0
  198. package/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  199. package/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  200. package/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  201. package/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  202. package/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  203. package/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  204. package/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  205. package/skills/pptx/scripts/office/soffice.py +183 -0
  206. package/skills/pptx/scripts/office/unpack.py +132 -0
  207. package/skills/pptx/scripts/office/validate.py +111 -0
  208. package/skills/pptx/scripts/office/validators/__init__.py +15 -0
  209. package/skills/pptx/scripts/office/validators/base.py +847 -0
  210. package/skills/pptx/scripts/office/validators/docx.py +446 -0
  211. package/skills/pptx/scripts/office/validators/pptx.py +275 -0
  212. package/skills/pptx/scripts/office/validators/redlining.py +247 -0
  213. package/skills/pptx/scripts/thumbnail.py +289 -0
  214. package/skills/simplify/SKILL.md +52 -0
  215. package/skills/skill-creator/LICENSE.txt +202 -0
  216. package/skills/skill-creator/SKILL.md +485 -0
  217. package/skills/skill-creator/agents/analyzer.md +274 -0
  218. package/skills/skill-creator/agents/comparator.md +202 -0
  219. package/skills/skill-creator/agents/grader.md +223 -0
  220. package/skills/skill-creator/assets/eval_review.html +146 -0
  221. package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  222. package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  223. package/skills/skill-creator/references/schemas.md +430 -0
  224. package/skills/skill-creator/scripts/__init__.py +0 -0
  225. package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  226. package/skills/skill-creator/scripts/generate_report.py +326 -0
  227. package/skills/skill-creator/scripts/improve_description.py +247 -0
  228. package/skills/skill-creator/scripts/package_skill.py +136 -0
  229. package/skills/skill-creator/scripts/quick_validate.py +103 -0
  230. package/skills/skill-creator/scripts/run_eval.py +310 -0
  231. package/skills/skill-creator/scripts/run_loop.py +328 -0
  232. package/skills/skill-creator/scripts/utils.py +47 -0
  233. package/skills/theme-factory/LICENSE.txt +202 -0
  234. package/skills/theme-factory/SKILL.md +59 -0
  235. package/skills/theme-factory/theme-showcase.pdf +0 -0
  236. package/skills/theme-factory/themes/arctic-frost.md +19 -0
  237. package/skills/theme-factory/themes/botanical-garden.md +19 -0
  238. package/skills/theme-factory/themes/desert-rose.md +19 -0
  239. package/skills/theme-factory/themes/forest-canopy.md +19 -0
  240. package/skills/theme-factory/themes/golden-hour.md +19 -0
  241. package/skills/theme-factory/themes/midnight-galaxy.md +19 -0
  242. package/skills/theme-factory/themes/modern-minimalist.md +19 -0
  243. package/skills/theme-factory/themes/ocean-depths.md +19 -0
  244. package/skills/theme-factory/themes/sunset-boulevard.md +19 -0
  245. package/skills/theme-factory/themes/tech-innovation.md +19 -0
  246. package/skills/web-artifacts-builder/LICENSE.txt +202 -0
  247. package/skills/web-artifacts-builder/SKILL.md +79 -0
  248. package/skills/web-artifacts-builder/scripts/bundle-artifact.sh +53 -0
  249. package/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -0
  250. package/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  251. package/skills/webapp-testing/LICENSE.txt +202 -0
  252. package/skills/webapp-testing/SKILL.md +96 -0
  253. package/skills/webapp-testing/examples/console_logging.py +35 -0
  254. package/skills/webapp-testing/examples/element_discovery.py +40 -0
  255. package/skills/webapp-testing/examples/static_html_automation.py +33 -0
  256. package/skills/webapp-testing/scripts/with_server.py +106 -0
  257. package/skills/xlsx/LICENSE.txt +30 -0
  258. package/skills/xlsx/SKILL.md +292 -0
  259. package/skills/xlsx/scripts/office/helpers/__init__.py +0 -0
  260. package/skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
  261. package/skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
  262. package/skills/xlsx/scripts/office/pack.py +159 -0
  263. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  264. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  265. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  266. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  267. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  268. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  269. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  270. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  271. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  272. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  273. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  274. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  275. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  276. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  277. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  278. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  279. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  280. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  281. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  282. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  283. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  284. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  285. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  286. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  287. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  288. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  289. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  290. package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/ECMA-376_3rd_edition.zip +1 -0
  291. package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/README.md +1 -0
  292. package/skills/xlsx/scripts/office/schemas/mce/mce-core.xsd +1 -0
  293. package/skills/xlsx/scripts/office/schemas/mce/mce-override.xsd +1 -0
  294. package/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  295. package/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  296. package/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  297. package/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  298. package/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  299. package/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  300. package/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  301. package/skills/xlsx/scripts/office/soffice.py +183 -0
  302. package/skills/xlsx/scripts/office/unpack.py +132 -0
  303. package/skills/xlsx/scripts/office/validate.py +111 -0
  304. package/skills/xlsx/scripts/office/validators/__init__.py +15 -0
  305. package/skills/xlsx/scripts/office/validators/base.py +847 -0
  306. package/skills/xlsx/scripts/office/validators/docx.py +446 -0
  307. package/skills/xlsx/scripts/office/validators/pptx.py +275 -0
  308. package/skills/xlsx/scripts/office/validators/redlining.py +247 -0
  309. package/skills/xlsx/scripts/recalc.py +184 -0
  310. package/vendor/ripgrep/COPYING +3 -0
  311. package/vendor/ripgrep/README.md +34 -0
  312. package/vendor/ripgrep/arm64-darwin/rg +0 -0
  313. package/vendor/ripgrep/arm64-linux/rg +0 -0
  314. package/vendor/ripgrep/arm64-win32/rg.exe +0 -0
  315. package/vendor/ripgrep/x64-darwin/rg +0 -0
  316. package/vendor/ripgrep/x64-linux/rg +0 -0
  317. package/vendor/ripgrep/x64-win32/rg.exe +0 -0
@@ -0,0 +1,660 @@
1
+ ---
2
+ name: docx
3
+ description: "Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation."
4
+ license: Proprietary. LICENSE.txt has complete terms
5
+ ---
6
+
7
+ # DOCX creation, editing, and analysis
8
+
9
+ ## Overview
10
+
11
+ A .docx file is a ZIP archive containing XML files.
12
+
13
+ ## Quick Reference
14
+
15
+ | Task | Approach |
16
+ |------|----------|
17
+ | Read/analyze content | `pandoc` or unpack for raw XML |
18
+ | Create new document | Use `docx-js` - see Creating New Documents below |
19
+ | Edit existing document | Unpack → edit XML → repack - see Editing Existing Documents below |
20
+
21
+ ### Converting .doc to .docx
22
+
23
+ Legacy `.doc` files must be converted before editing:
24
+
25
+ ```bash
26
+ python scripts/office/soffice.py --headless --convert-to docx document.doc
27
+ ```
28
+
29
+ ### Converting Markdown to Word
30
+
31
+ For simple Markdown-to-Word conversion, `pandoc` is the recommended approach:
32
+
33
+ ```bash
34
+ pandoc input.md -f markdown -t docx -o output.docx
35
+ ```
36
+
37
+ **Advantages of pandoc:**
38
+ - Native support for Markdown tables → Word tables
39
+ - Preserves headings (h1-h6), lists, code blocks, blockquotes
40
+ - Handles emoji and special characters well
41
+ - Fast and reliable
42
+
43
+ **For converting to PDF:**
44
+ ```bash
45
+ # Convert docx to PDF using LibreOffice (requires --headless mode)
46
+ python scripts/office/soffice.py --headless --convert-to pdf document.docx
47
+ ```
48
+
49
+ **For better formatting control**, use a custom reference document:
50
+ ```bash
51
+ pandoc input.md -f markdown -t docx -o output.docx --reference-doc=custom-style.docx
52
+ ```
53
+
54
+ **Limitations to be aware of:**
55
+ - Complex markdown tables (with pipes in cells) may not parse correctly
56
+ - If pandoc fails to convert tables, fallback to docx-js
57
+ - Always verify the output document opens correctly
58
+
59
+ **ASCII Table to Word Table** (when pandoc has issues):
60
+
61
+ If your Markdown uses ASCII-style table borders (e.g., `+---+` separators), preprocess the table to remove the separator lines before pandoc conversion:
62
+ ```bash
63
+ # Preprocess: remove table separator lines (lines containing only -, |, +)
64
+ sed '/^[[:space:]]*[-|+-]*[[:space:]]*$/d' input.md | pandoc -f markdown -t docx -o output.docx
65
+ ```
66
+
67
+ Or handle it in Python:
68
+ ```python
69
+ import re
70
+
71
+ def remove_table_separators(md_content):
72
+ # Remove ASCII table separator lines like: |---|, +----+
73
+ lines = md_content.split('\n')
74
+ cleaned = []
75
+ for line in lines:
76
+ # Skip lines that are just table separators (---, |---|, +----+)
77
+ stripped = line.strip()
78
+ if stripped and all(c in '-|+' for c in stripped):
79
+ continue
80
+ cleaned.append(line)
81
+ return '\n'.join(cleaned)
82
+
83
+ with open('input.md', 'r') as f:
84
+ content = remove_table_separators(f.read())
85
+ with open('cleaned.md', 'w') as f:
86
+ f.write(content)
87
+ ```
88
+
89
+ **Alternative: python-docx** (for programmatic control):
90
+ ```python
91
+ from docx import Document
92
+ from docx.shared import Pt, RGBColor
93
+
94
+ doc = Document()
95
+ # Add content programmatically with full control over formatting
96
+ doc.save("output.docx")
97
+ ```
98
+
99
+ ### Reading Content
100
+
101
+ ```bash
102
+ # Text extraction with tracked changes
103
+ pandoc --track-changes=all document.docx -o output.md
104
+
105
+ # Raw XML access
106
+ python scripts/office/unpack.py document.docx unpacked/
107
+ ```
108
+
109
+ ### Converting to Images
110
+
111
+ ```bash
112
+ python scripts/office/soffice.py --headless --convert-to pdf document.docx
113
+ pdftoppm -jpeg -r 150 document.pdf page
114
+ ```
115
+
116
+ ### Accepting Tracked Changes
117
+
118
+ To produce a clean document with all tracked changes accepted (requires LibreOffice):
119
+
120
+ ```bash
121
+ python scripts/accept_changes.py input.docx output.docx
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Creating New Documents
127
+
128
+ Generate .docx files with JavaScript, then validate. Install: `npm install -g docx`
129
+
130
+ ### Setup
131
+ ```javascript
132
+ const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun,
133
+ Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink,
134
+ InternalHyperlink, Bookmark, FootnoteReferenceRun, PositionalTab,
135
+ PositionalTabAlignment, PositionalTabRelativeTo, PositionalTabLeader,
136
+ TabStopType, TabStopPosition, Column, SectionType,
137
+ TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType,
138
+ VerticalAlign, PageNumber, PageBreak } = require('docx');
139
+
140
+ const doc = new Document({ sections: [{ children: [/* content */] }] });
141
+ Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer));
142
+ ```
143
+
144
+ ### Validation
145
+ After creating the file, validate it. If validation fails, unpack, fix the XML, and repack.
146
+ ```bash
147
+ python scripts/office/validate.py doc.docx
148
+ ```
149
+
150
+ ### Page Size
151
+
152
+ ```javascript
153
+ // CRITICAL: docx-js defaults to A4, not US Letter
154
+ // Always set page size explicitly for consistent results
155
+ sections: [{
156
+ properties: {
157
+ page: {
158
+ size: {
159
+ width: 12240, // 8.5 inches in DXA
160
+ height: 15840 // 11 inches in DXA
161
+ },
162
+ margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } // 1 inch margins
163
+ }
164
+ },
165
+ children: [/* content */]
166
+ }]
167
+ ```
168
+
169
+ **Common page sizes (DXA units, 1440 DXA = 1 inch):**
170
+
171
+ | Paper | Width | Height | Content Width (1" margins) |
172
+ |-------|-------|--------|---------------------------|
173
+ | US Letter | 12,240 | 15,840 | 9,360 |
174
+ | A4 (default) | 11,906 | 16,838 | 9,026 |
175
+
176
+ **Landscape orientation:** docx-js swaps width/height internally, so pass portrait dimensions and let it handle the swap:
177
+ ```javascript
178
+ size: {
179
+ width: 12240, // Pass SHORT edge as width
180
+ height: 15840, // Pass LONG edge as height
181
+ orientation: PageOrientation.LANDSCAPE // docx-js swaps them in the XML
182
+ },
183
+ // Content width = 15840 - left margin - right margin (uses the long edge)
184
+ ```
185
+
186
+ ### Styles (Override Built-in Headings)
187
+
188
+ Use Arial as the default font (universally supported). Keep titles black for readability.
189
+
190
+ ```javascript
191
+ const doc = new Document({
192
+ styles: {
193
+ default: { document: { run: { font: "Arial", size: 24 } } }, // 12pt default
194
+ paragraphStyles: [
195
+ // IMPORTANT: Use exact IDs to override built-in styles
196
+ { id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
197
+ run: { size: 32, bold: true, font: "Arial" },
198
+ paragraph: { spacing: { before: 240, after: 240 }, outlineLevel: 0 } }, // outlineLevel required for TOC
199
+ { id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
200
+ run: { size: 28, bold: true, font: "Arial" },
201
+ paragraph: { spacing: { before: 180, after: 180 }, outlineLevel: 1 } },
202
+ ]
203
+ },
204
+ sections: [{
205
+ children: [
206
+ new Paragraph({ heading: HeadingLevel.HEADING_1, children: [new TextRun("Title")] }),
207
+ ]
208
+ }]
209
+ });
210
+ ```
211
+
212
+ ### Lists (NEVER use unicode bullets)
213
+
214
+ ```javascript
215
+ // ❌ WRONG - never manually insert bullet characters
216
+ new Paragraph({ children: [new TextRun("• Item")] }) // BAD
217
+ new Paragraph({ children: [new TextRun("\u2022 Item")] }) // BAD
218
+
219
+ // ✅ CORRECT - use numbering config with LevelFormat.BULLET
220
+ const doc = new Document({
221
+ numbering: {
222
+ config: [
223
+ { reference: "bullets",
224
+ levels: [{ level: 0, format: LevelFormat.BULLET, text: "•", alignment: AlignmentType.LEFT,
225
+ style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },
226
+ { reference: "numbers",
227
+ levels: [{ level: 0, format: LevelFormat.DECIMAL, text: "%1.", alignment: AlignmentType.LEFT,
228
+ style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },
229
+ ]
230
+ },
231
+ sections: [{
232
+ children: [
233
+ new Paragraph({ numbering: { reference: "bullets", level: 0 },
234
+ children: [new TextRun("Bullet item")] }),
235
+ new Paragraph({ numbering: { reference: "numbers", level: 0 },
236
+ children: [new TextRun("Numbered item")] }),
237
+ ]
238
+ }]
239
+ });
240
+
241
+ // ⚠️ Each reference creates INDEPENDENT numbering
242
+ // Same reference = continues (1,2,3 then 4,5,6)
243
+ // Different reference = restarts (1,2,3 then 1,2,3)
244
+ ```
245
+
246
+ ### Tables
247
+
248
+ **CRITICAL: Tables need dual widths** - set both `columnWidths` on the table AND `width` on each cell. Without both, tables render incorrectly on some platforms.
249
+
250
+ ```javascript
251
+ // CRITICAL: Always set table width for consistent rendering
252
+ // CRITICAL: Use ShadingType.CLEAR (not SOLID) to prevent black backgrounds
253
+ const border = { style: BorderStyle.SINGLE, size: 1, color: "CCCCCC" };
254
+ const borders = { top: border, bottom: border, left: border, right: border };
255
+
256
+ new Table({
257
+ width: { size: 9360, type: WidthType.DXA }, // Always use DXA (percentages break in Google Docs)
258
+ columnWidths: [4680, 4680], // Must sum to table width (DXA: 1440 = 1 inch)
259
+ rows: [
260
+ new TableRow({
261
+ children: [
262
+ new TableCell({
263
+ borders,
264
+ width: { size: 4680, type: WidthType.DXA }, // Also set on each cell
265
+ shading: { fill: "D5E8F0", type: ShadingType.CLEAR }, // CLEAR not SOLID
266
+ margins: { top: 80, bottom: 80, left: 120, right: 120 }, // Cell padding (internal, not added to width)
267
+ children: [new Paragraph({ children: [new TextRun("Cell")] })]
268
+ })
269
+ ]
270
+ })
271
+ ]
272
+ })
273
+ ```
274
+
275
+ **Table width calculation:**
276
+
277
+ Always use `WidthType.DXA` — `WidthType.PERCENTAGE` breaks in Google Docs.
278
+
279
+ ```javascript
280
+ // Table width = sum of columnWidths = content width
281
+ // US Letter with 1" margins: 12240 - 2880 = 9360 DXA
282
+ width: { size: 9360, type: WidthType.DXA },
283
+ columnWidths: [7000, 2360] // Must sum to table width
284
+ ```
285
+
286
+ **Width rules:**
287
+ - **Always use `WidthType.DXA`** — never `WidthType.PERCENTAGE` (incompatible with Google Docs)
288
+ - Table width must equal the sum of `columnWidths`
289
+ - Cell `width` must match corresponding `columnWidth`
290
+ - Cell `margins` are internal padding - they reduce content area, not add to cell width
291
+ - For full-width tables: use content width (page width minus left and right margins)
292
+
293
+ ### Images
294
+
295
+ ```javascript
296
+ // CRITICAL: type parameter is REQUIRED
297
+ new Paragraph({
298
+ children: [new ImageRun({
299
+ type: "png", // Required: png, jpg, jpeg, gif, bmp, svg
300
+ data: fs.readFileSync("image.png"),
301
+ transformation: { width: 200, height: 150 },
302
+ altText: { title: "Title", description: "Desc", name: "Name" } // All three required
303
+ })]
304
+ })
305
+ ```
306
+
307
+ ### Page Breaks
308
+
309
+ ```javascript
310
+ // CRITICAL: PageBreak must be inside a Paragraph
311
+ new Paragraph({ children: [new PageBreak()] })
312
+
313
+ // Or use pageBreakBefore
314
+ new Paragraph({ pageBreakBefore: true, children: [new TextRun("New page")] })
315
+ ```
316
+
317
+ ### Hyperlinks
318
+
319
+ ```javascript
320
+ // External link
321
+ new Paragraph({
322
+ children: [new ExternalHyperlink({
323
+ children: [new TextRun({ text: "Click here", style: "Hyperlink" })],
324
+ link: "https://example.com",
325
+ })]
326
+ })
327
+
328
+ // Internal link (bookmark + reference)
329
+ // 1. Create bookmark at destination
330
+ new Paragraph({ heading: HeadingLevel.HEADING_1, children: [
331
+ new Bookmark({ id: "chapter1", children: [new TextRun("Chapter 1")] }),
332
+ ]})
333
+ // 2. Link to it
334
+ new Paragraph({ children: [new InternalHyperlink({
335
+ children: [new TextRun({ text: "See Chapter 1", style: "Hyperlink" })],
336
+ anchor: "chapter1",
337
+ })]})
338
+ ```
339
+
340
+ ### Footnotes
341
+
342
+ ```javascript
343
+ const doc = new Document({
344
+ footnotes: {
345
+ 1: { children: [new Paragraph("Source: Annual Report 2024")] },
346
+ 2: { children: [new Paragraph("See appendix for methodology")] },
347
+ },
348
+ sections: [{
349
+ children: [new Paragraph({
350
+ children: [
351
+ new TextRun("Revenue grew 15%"),
352
+ new FootnoteReferenceRun(1),
353
+ new TextRun(" using adjusted metrics"),
354
+ new FootnoteReferenceRun(2),
355
+ ],
356
+ })]
357
+ }]
358
+ });
359
+ ```
360
+
361
+ ### Tab Stops
362
+
363
+ ```javascript
364
+ // Right-align text on same line (e.g., date opposite a title)
365
+ new Paragraph({
366
+ children: [
367
+ new TextRun("Company Name"),
368
+ new TextRun("\tJanuary 2025"),
369
+ ],
370
+ tabStops: [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }],
371
+ })
372
+
373
+ // Dot leader (e.g., TOC-style)
374
+ new Paragraph({
375
+ children: [
376
+ new TextRun("Introduction"),
377
+ new TextRun({ children: [
378
+ new PositionalTab({
379
+ alignment: PositionalTabAlignment.RIGHT,
380
+ relativeTo: PositionalTabRelativeTo.MARGIN,
381
+ leader: PositionalTabLeader.DOT,
382
+ }),
383
+ "3",
384
+ ]}),
385
+ ],
386
+ })
387
+ ```
388
+
389
+ ### Multi-Column Layouts
390
+
391
+ ```javascript
392
+ // Equal-width columns
393
+ sections: [{
394
+ properties: {
395
+ column: {
396
+ count: 2, // number of columns
397
+ space: 720, // gap between columns in DXA (720 = 0.5 inch)
398
+ equalWidth: true,
399
+ separate: true, // vertical line between columns
400
+ },
401
+ },
402
+ children: [/* content flows naturally across columns */]
403
+ }]
404
+
405
+ // Custom-width columns (equalWidth must be false)
406
+ sections: [{
407
+ properties: {
408
+ column: {
409
+ equalWidth: false,
410
+ children: [
411
+ new Column({ width: 5400, space: 720 }),
412
+ new Column({ width: 3240 }),
413
+ ],
414
+ },
415
+ },
416
+ children: [/* content */]
417
+ }]
418
+ ```
419
+
420
+ Force a column break with a new section using `type: SectionType.NEXT_COLUMN`.
421
+
422
+ ### Table of Contents
423
+
424
+ ```javascript
425
+ // CRITICAL: Headings must use HeadingLevel ONLY - no custom styles
426
+ new TableOfContents("Table of Contents", { hyperlink: true, headingStyleRange: "1-3" })
427
+ ```
428
+
429
+ ### Headers/Footers
430
+
431
+ ```javascript
432
+ sections: [{
433
+ properties: {
434
+ page: { margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } } // 1440 = 1 inch
435
+ },
436
+ headers: {
437
+ default: new Header({ children: [new Paragraph({ children: [new TextRun("Header")] })] })
438
+ },
439
+ footers: {
440
+ default: new Footer({ children: [new Paragraph({
441
+ children: [new TextRun("Page "), new TextRun({ children: [PageNumber.CURRENT] })]
442
+ })] })
443
+ },
444
+ children: [/* content */]
445
+ }]
446
+ ```
447
+
448
+ ### Critical Rules for docx-js
449
+
450
+ - **Set page size explicitly** - docx-js defaults to A4; use US Letter (12240 x 15840 DXA) for US documents
451
+ - **Landscape: pass portrait dimensions** - docx-js swaps width/height internally; pass short edge as `width`, long edge as `height`, and set `orientation: PageOrientation.LANDSCAPE`
452
+ - **Never use `\n`** - use separate Paragraph elements
453
+ - **Never use unicode bullets** - use `LevelFormat.BULLET` with numbering config
454
+ - **PageBreak must be in Paragraph** - standalone creates invalid XML
455
+ - **ImageRun requires `type`** - always specify png/jpg/etc
456
+ - **Always set table `width` with DXA** - never use `WidthType.PERCENTAGE` (breaks in Google Docs)
457
+ - **Tables need dual widths** - `columnWidths` array AND cell `width`, both must match
458
+ - **Table width = sum of columnWidths** - for DXA, ensure they add up exactly
459
+ - **Always add cell margins** - use `margins: { top: 80, bottom: 80, left: 120, right: 120 }` for readable padding
460
+ - **Use `ShadingType.CLEAR`** - never SOLID for table shading
461
+ - **Never use tables as dividers/rules** - cells have minimum height and render as empty boxes (including in headers/footers); use `border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: "2E75B6", space: 1 } }` on a Paragraph instead. For two-column footers, use tab stops (see Tab Stops section), not tables
462
+ - **TOC requires HeadingLevel only** - no custom styles on heading paragraphs
463
+ - **Override built-in styles** - use exact IDs: "Heading1", "Heading2", etc.
464
+ - **Include `outlineLevel`** - required for TOC (0 for H1, 1 for H2, etc.)
465
+
466
+ ---
467
+
468
+ ## Editing Existing Documents
469
+
470
+ **Follow all 3 steps in order.**
471
+
472
+ ### Step 1: Unpack
473
+ ```bash
474
+ python scripts/office/unpack.py document.docx unpacked/
475
+ ```
476
+ Extracts XML, pretty-prints, merges adjacent runs, and converts smart quotes to XML entities (`“` etc.) so they survive editing. Use `--merge-runs false` to skip run merging.
477
+
478
+ ### Step 2: Edit XML
479
+
480
+ Edit files in `unpacked/word/`. See XML Reference below for patterns.
481
+
482
+ **Use "Claude" as the author** for tracked changes and comments, unless the user explicitly requests use of a different name.
483
+
484
+ **Use the Edit tool directly for string replacement. Do not write Python scripts.** Scripts introduce unnecessary complexity. The Edit tool shows exactly what is being replaced.
485
+
486
+ **CRITICAL: Use smart quotes for new content.** When adding text with apostrophes or quotes, use XML entities to produce smart quotes:
487
+ ```xml
488
+ <!-- Use these entities for professional typography -->
489
+ <w:t>Here&#x2019;s a quote: &#x201C;Hello&#x201D;</w:t>
490
+ ```
491
+ | Entity | Character |
492
+ |--------|-----------|
493
+ | `&#x2018;` | ‘ (left single) |
494
+ | `&#x2019;` | ’ (right single / apostrophe) |
495
+ | `&#x201C;` | “ (left double) |
496
+ | `&#x201D;` | ” (right double) |
497
+
498
+ **Adding comments:** Use `comment.py` to handle boilerplate across multiple XML files (text must be pre-escaped XML):
499
+ ```bash
500
+ python scripts/comment.py unpacked/ 0 "Comment text with &amp; and &#x2019;"
501
+ python scripts/comment.py unpacked/ 1 "Reply text" --parent 0 # reply to comment 0
502
+ python scripts/comment.py unpacked/ 0 "Text" --author "Custom Author" # custom author name
503
+ ```
504
+ Then add markers to document.xml (see Comments in XML Reference).
505
+
506
+ ### Step 3: Pack
507
+ ```bash
508
+ python scripts/office/pack.py unpacked/ output.docx --original document.docx
509
+ ```
510
+ Validates with auto-repair, condenses XML, and creates DOCX. Use `--validate false` to skip.
511
+
512
+ **Auto-repair will fix:**
513
+ - `durableId` >= 0x7FFFFFFF (regenerates valid ID)
514
+ - Missing `xml:space="preserve"` on `<w:t>` with whitespace
515
+
516
+ **Auto-repair won't fix:**
517
+ - Malformed XML, invalid element nesting, missing relationships, schema violations
518
+
519
+ ### Common Pitfalls
520
+
521
+ - **Replace entire `<w:r>` elements**: When adding tracked changes, replace the whole `<w:r>...</w:r>` block with `<w:del>...<w:ins>...` as siblings. Don't inject tracked change tags inside a run.
522
+ - **Preserve `<w:rPr>` formatting**: Copy the original run's `<w:rPr>` block into your tracked change runs to maintain bold, font size, etc.
523
+
524
+ ---
525
+
526
+ ## XML Reference
527
+
528
+ ### Schema Compliance
529
+
530
+ - **Element order in `<w:pPr>`**: `<w:pStyle>`, `<w:numPr>`, `<w:spacing>`, `<w:ind>`, `<w:jc>`, `<w:rPr>` last
531
+ - **Whitespace**: Add `xml:space="preserve"` to `<w:t>` with leading/trailing spaces
532
+ - **RSIDs**: Must be 8-digit hex (e.g., `00AB1234`)
533
+
534
+ ### Tracked Changes
535
+
536
+ **Insertion:**
537
+ ```xml
538
+ <w:ins w:id="1" w:author="Claude" w:date="2025-01-01T00:00:00Z">
539
+ <w:r><w:t>inserted text</w:t></w:r>
540
+ </w:ins>
541
+ ```
542
+
543
+ **Deletion:**
544
+ ```xml
545
+ <w:del w:id="2" w:author="Claude" w:date="2025-01-01T00:00:00Z">
546
+ <w:r><w:delText>deleted text</w:delText></w:r>
547
+ </w:del>
548
+ ```
549
+
550
+ **Inside `<w:del>`**: Use `<w:delText>` instead of `<w:t>`, and `<w:delInstrText>` instead of `<w:instrText>`.
551
+
552
+ **Minimal edits** - only mark what changes:
553
+ ```xml
554
+ <!-- Change "30 days" to "60 days" -->
555
+ <w:r><w:t>The term is </w:t></w:r>
556
+ <w:del w:id="1" w:author="Claude" w:date="...">
557
+ <w:r><w:delText>30</w:delText></w:r>
558
+ </w:del>
559
+ <w:ins w:id="2" w:author="Claude" w:date="...">
560
+ <w:r><w:t>60</w:t></w:r>
561
+ </w:ins>
562
+ <w:r><w:t> days.</w:t></w:r>
563
+ ```
564
+
565
+ **Deleting entire paragraphs/list items** - when removing ALL content from a paragraph, also mark the paragraph mark as deleted so it merges with the next paragraph. Add `<w:del/>` inside `<w:pPr><w:rPr>`:
566
+ ```xml
567
+ <w:p>
568
+ <w:pPr>
569
+ <w:numPr>...</w:numPr> <!-- list numbering if present -->
570
+ <w:rPr>
571
+ <w:del w:id="1" w:author="Claude" w:date="2025-01-01T00:00:00Z"/>
572
+ </w:rPr>
573
+ </w:pPr>
574
+ <w:del w:id="2" w:author="Claude" w:date="2025-01-01T00:00:00Z">
575
+ <w:r><w:delText>Entire paragraph content being deleted...</w:delText></w:r>
576
+ </w:del>
577
+ </w:p>
578
+ ```
579
+ Without the `<w:del/>` in `<w:pPr><w:rPr>`, accepting changes leaves an empty paragraph/list item.
580
+
581
+ **Rejecting another author's insertion** - nest deletion inside their insertion:
582
+ ```xml
583
+ <w:ins w:author="Jane" w:id="5">
584
+ <w:del w:author="Claude" w:id="10">
585
+ <w:r><w:delText>their inserted text</w:delText></w:r>
586
+ </w:del>
587
+ </w:ins>
588
+ ```
589
+
590
+ **Restoring another author's deletion** - add insertion after (don't modify their deletion):
591
+ ```xml
592
+ <w:del w:author="Jane" w:id="5">
593
+ <w:r><w:delText>deleted text</w:delText></w:r>
594
+ </w:del>
595
+ <w:ins w:author="Claude" w:id="10">
596
+ <w:r><w:t>deleted text</w:t></w:r>
597
+ </w:ins>
598
+ ```
599
+
600
+ ### Comments
601
+
602
+ After running `comment.py` (see Step 2), add markers to document.xml. For replies, use `--parent` flag and nest markers inside the parent's.
603
+
604
+ **CRITICAL: `<w:commentRangeStart>` and `<w:commentRangeEnd>` are siblings of `<w:r>`, never inside `<w:r>`.**
605
+
606
+ ```xml
607
+ <!-- Comment markers are direct children of w:p, never inside w:r -->
608
+ <w:commentRangeStart w:id="0"/>
609
+ <w:del w:id="1" w:author="Claude" w:date="2025-01-01T00:00:00Z">
610
+ <w:r><w:delText>deleted</w:delText></w:r>
611
+ </w:del>
612
+ <w:r><w:t> more text</w:t></w:r>
613
+ <w:commentRangeEnd w:id="0"/>
614
+ <w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="0"/></w:r>
615
+
616
+ <!-- Comment 0 with reply 1 nested inside -->
617
+ <w:commentRangeStart w:id="0"/>
618
+ <w:commentRangeStart w:id="1"/>
619
+ <w:r><w:t>text</w:t></w:r>
620
+ <w:commentRangeEnd w:id="1"/>
621
+ <w:commentRangeEnd w:id="0"/>
622
+ <w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="0"/></w:r>
623
+ <w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="1"/></w:r>
624
+ ```
625
+
626
+ ### Images
627
+
628
+ 1. Add image file to `word/media/`
629
+ 2. Add relationship to `word/_rels/document.xml.rels`:
630
+ ```xml
631
+ <Relationship Id="rId5" Type=".../image" Target="media/image1.png"/>
632
+ ```
633
+ 3. Add content type to `[Content_Types].xml`:
634
+ ```xml
635
+ <Default Extension="png" ContentType="image/png"/>
636
+ ```
637
+ 4. Reference in document.xml:
638
+ ```xml
639
+ <w:drawing>
640
+ <wp:inline>
641
+ <wp:extent cx="914400" cy="914400"/> <!-- EMUs: 914400 = 1 inch -->
642
+ <a:graphic>
643
+ <a:graphicData uri=".../picture">
644
+ <pic:pic>
645
+ <pic:blipFill><a:blip r:embed="rId5"/></pic:blipFill>
646
+ </pic:pic>
647
+ </a:graphicData>
648
+ </a:graphic>
649
+ </wp:inline>
650
+ </w:drawing>
651
+ ```
652
+
653
+ ---
654
+
655
+ ## Dependencies
656
+
657
+ - **pandoc**: Text extraction
658
+ - **docx**: `npm install -g docx` (new documents)
659
+ - **LibreOffice**: PDF conversion (auto-configured for sandboxed environments via `scripts/office/soffice.py`; **must use --headless mode for server/CI environments**)
660
+ - **Poppler**: `pdftoppm` for images
@@ -0,0 +1 @@
1
+