@tiens.nguyen/gu-cli 1.0.903 → 1.0.905

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 (188) hide show
  1. package/NOTICE +18 -0
  2. package/gu-repl.mjs +1 -1
  3. package/package.json +3 -2
  4. package/skills/core/deep-research/SKILL.md +51 -0
  5. package/skills/core/docx/LICENSE.txt +202 -0
  6. package/skills/core/docx/SKILL.md +97 -0
  7. package/skills/core/docx/scripts/__init__.py +1 -0
  8. package/skills/core/docx/scripts/accept_changes.py +135 -0
  9. package/skills/core/docx/scripts/comment.py +368 -0
  10. package/skills/core/docx/scripts/merge_runs.py +310 -0
  11. package/skills/core/docx/scripts/office/helpers/__init__.py +121 -0
  12. package/skills/core/docx/scripts/office/helpers/pptx_chart.py +283 -0
  13. package/skills/core/docx/scripts/office/helpers/pptx_slide.py +100 -0
  14. package/skills/core/docx/scripts/office/helpers/pptx_theme.py +114 -0
  15. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  16. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  17. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  18. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  19. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  20. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  21. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  22. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  23. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  24. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  25. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  26. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  27. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  28. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  29. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  30. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  31. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  32. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  33. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  34. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  35. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  36. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  37. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  38. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  39. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  40. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  41. package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  42. package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  43. package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  44. package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  45. package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  46. package/skills/core/docx/scripts/office/schemas/mce/mc.xsd +75 -0
  47. package/skills/core/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  48. package/skills/core/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  49. package/skills/core/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  50. package/skills/core/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  51. package/skills/core/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  52. package/skills/core/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  53. package/skills/core/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  54. package/skills/core/docx/scripts/office/soffice.py +192 -0
  55. package/skills/core/docx/scripts/office/validate.py +210 -0
  56. package/skills/core/docx/scripts/office/validators/__init__.py +15 -0
  57. package/skills/core/docx/scripts/office/validators/base.py +874 -0
  58. package/skills/core/docx/scripts/office/validators/docx.py +519 -0
  59. package/skills/core/docx/scripts/office/validators/pptx.py +549 -0
  60. package/skills/core/docx/scripts/office/validators/redlining.py +461 -0
  61. package/skills/core/docx/scripts/templates/comments.xml +3 -0
  62. package/skills/core/docx/scripts/templates/commentsExtended.xml +3 -0
  63. package/skills/core/docx/scripts/templates/commentsExtensible.xml +3 -0
  64. package/skills/core/docx/scripts/templates/commentsIds.xml +3 -0
  65. package/skills/core/docx/scripts/templates/people.xml +3 -0
  66. package/skills/core/pdf/FORMS.md +294 -0
  67. package/skills/core/pdf/LICENSE.txt +202 -0
  68. package/skills/core/pdf/REFERENCE.md +613 -0
  69. package/skills/core/pdf/SKILL.md +314 -0
  70. package/skills/core/pdf/scripts/check_bounding_boxes.py +65 -0
  71. package/skills/core/pdf/scripts/check_fillable_fields.py +11 -0
  72. package/skills/core/pdf/scripts/convert_pdf_to_images.py +33 -0
  73. package/skills/core/pdf/scripts/create_validation_image.py +37 -0
  74. package/skills/core/pdf/scripts/extract_form_field_info.py +122 -0
  75. package/skills/core/pdf/scripts/extract_form_structure.py +115 -0
  76. package/skills/core/pdf/scripts/fill_fillable_fields.py +98 -0
  77. package/skills/core/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
  78. package/skills/core/pptx/LICENSE.txt +202 -0
  79. package/skills/core/pptx/SKILL.md +275 -0
  80. package/skills/core/pptx/scripts/__init__.py +0 -0
  81. package/skills/core/pptx/scripts/add_slide.py +463 -0
  82. package/skills/core/pptx/scripts/apply_theme.js +107 -0
  83. package/skills/core/pptx/scripts/clean.py +309 -0
  84. package/skills/core/pptx/scripts/office/helpers/__init__.py +121 -0
  85. package/skills/core/pptx/scripts/office/helpers/pptx_chart.py +283 -0
  86. package/skills/core/pptx/scripts/office/helpers/pptx_slide.py +100 -0
  87. package/skills/core/pptx/scripts/office/helpers/pptx_theme.py +114 -0
  88. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  89. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  90. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  91. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  92. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  93. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  94. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  95. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  96. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  97. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  98. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  99. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  100. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  101. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  102. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  103. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  104. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  105. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  106. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  107. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  108. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  109. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  110. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  111. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  112. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  113. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  114. package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  115. package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  116. package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  117. package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  118. package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  119. package/skills/core/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
  120. package/skills/core/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  121. package/skills/core/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  122. package/skills/core/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  123. package/skills/core/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  124. package/skills/core/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  125. package/skills/core/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  126. package/skills/core/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  127. package/skills/core/pptx/scripts/office/soffice.py +192 -0
  128. package/skills/core/pptx/scripts/office/validate.py +210 -0
  129. package/skills/core/pptx/scripts/office/validators/__init__.py +15 -0
  130. package/skills/core/pptx/scripts/office/validators/base.py +874 -0
  131. package/skills/core/pptx/scripts/office/validators/docx.py +519 -0
  132. package/skills/core/pptx/scripts/office/validators/pptx.py +549 -0
  133. package/skills/core/pptx/scripts/office/validators/redlining.py +461 -0
  134. package/skills/core/pptx/scripts/slide_text.py +132 -0
  135. package/skills/core/pptx/scripts/thumbnail.py +311 -0
  136. package/skills/core/xlsx/LICENSE.txt +202 -0
  137. package/skills/core/xlsx/SKILL.md +99 -0
  138. package/skills/core/xlsx/scripts/office/helpers/__init__.py +121 -0
  139. package/skills/core/xlsx/scripts/office/helpers/pptx_chart.py +283 -0
  140. package/skills/core/xlsx/scripts/office/helpers/pptx_slide.py +100 -0
  141. package/skills/core/xlsx/scripts/office/helpers/pptx_theme.py +114 -0
  142. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  143. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  144. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  145. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  146. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  147. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  148. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  149. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  150. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  151. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  152. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  153. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  154. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  155. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  156. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  157. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  158. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  159. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  160. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  161. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  162. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  163. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  164. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  165. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  166. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  167. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  168. package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  169. package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  170. package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  171. package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  172. package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  173. package/skills/core/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
  174. package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  175. package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  176. package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  177. package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  178. package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  179. package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  180. package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  181. package/skills/core/xlsx/scripts/office/soffice.py +192 -0
  182. package/skills/core/xlsx/scripts/office/validate.py +210 -0
  183. package/skills/core/xlsx/scripts/office/validators/__init__.py +15 -0
  184. package/skills/core/xlsx/scripts/office/validators/base.py +874 -0
  185. package/skills/core/xlsx/scripts/office/validators/docx.py +519 -0
  186. package/skills/core/xlsx/scripts/office/validators/pptx.py +549 -0
  187. package/skills/core/xlsx/scripts/office/validators/redlining.py +461 -0
  188. package/skills/core/xlsx/scripts/recalc.py +456 -0
package/NOTICE ADDED
@@ -0,0 +1,18 @@
1
+ gu (gonext-local-worker)
2
+ Copyright (c) 2026 Tien Nguyen Song
3
+
4
+ Everything in this package is licensed under the MIT License (see LICENSE),
5
+ EXCEPT the following third-party files:
6
+
7
+ skills/core/docx/
8
+ skills/core/pdf/
9
+ skills/core/pptx/
10
+ skills/core/xlsx/
11
+ Copyright (c) Anthropic, PBC.
12
+ Licensed under the Apache License, Version 2.0; the full terms are in
13
+ LICENSE.txt inside each of these folders.
14
+ docx and pptx were modified for gu in 2026 (tool names and install notes);
15
+ each modified SKILL.md says so at the top. pdf and xlsx are unmodified.
16
+
17
+ skills/core/deep-research/ and skills/core/gu-session-memory-orchestration/
18
+ are gu's own work and are MIT licensed.
package/gu-repl.mjs CHANGED
@@ -14740,7 +14740,7 @@ async function main() {
14740
14740
  // #325: say whose they are when this folder uses Claude Code's — even when there are none.
14741
14741
  const claudes = readSkillSource(process.cwd()) === "claude";
14742
14742
  if (bits.length || claudes) {
14743
- statusRows.push(lbl("skills") + dim((claudes ? "Claude's: " : "") + (bits.join(" · ") || "no skills or MCP servers") + (claudes ? " (/switch-skill · /mcp)" : " (/help · /mcp)")));
14743
+ statusRows.push(lbl("skills") + dim((bits.join(" · ") || "no skills or MCP servers") + (claudes ? " (/switch-skill · /mcp)" : " (/help · /mcp)")));
14744
14744
  }
14745
14745
  } catch {
14746
14746
  /* a broken file is reported below; the banner is not the place to fail */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gu-cli",
3
- "version": "1.0.903",
3
+ "version": "1.0.905",
4
4
  "description": "gu: the coding agent in your terminal. It reads your repo, makes the change and runs the tests, with your own models (Ollama or any OpenAI-compatible provider). Free installs keep the agent, its API and its database on your machine. macOS, Linux and Windows.",
5
5
  "keywords": [
6
6
  "ai",
@@ -19,7 +19,7 @@
19
19
  "bugs": {
20
20
  "url": "https://gucli.com/support"
21
21
  },
22
- "license": "MIT",
22
+ "license": "(MIT AND Apache-2.0)",
23
23
  "author": "Tien Nguyen Song",
24
24
  "type": "module",
25
25
  "bin": {
@@ -149,6 +149,7 @@
149
149
  "update-verify.mjs",
150
150
  "skills.mjs",
151
151
  "skills/",
152
+ "NOTICE",
152
153
  "skill-source.mjs",
153
154
  "skills-copy.mjs",
154
155
  "skill-package.mjs",
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: deep-research
3
+ description: Research a topic across several sources and write a cited report: comparing options or vendors, market or trend overviews, literature or policy reviews. Not for a single fact.
4
+ license: MIT (part of gu)
5
+ ---
6
+
7
+ # Deep research in gu
8
+
9
+ You research and write the report yourself, with gu's own tools. The budget is about
10
+ **10 `web_search`/`fetch_url` calls in total**, so plan before you search.
11
+
12
+ ## 1. Settle the question
13
+ - Ask the user ONE follow-up only if the answer would change the research: an ambiguous name or
14
+ acronym, a missing region or jurisdiction, an unclear time frame. Otherwise state your reading
15
+ of the question in one line and go on.
16
+ - Pick a title: 3-6 words, sentence case, letters/numbers/spaces only, in the user's language
17
+ (e.g. `EU AI Act startup obligations`). If `research_notes/` already has that title, add a word
18
+ that says what is new, or a number (`... 2`). Never write into an earlier folder.
19
+
20
+ ## 2. Make the folders
21
+ `create_folder("research_notes/<title>")` and `create_folder("reports")` in the CURRENT workspace.
22
+ Quote these paths in any shell command (the title has spaces).
23
+
24
+ ## 3. Plan 3-5 subtopics
25
+ Split the question into parts that do not overlap and together cover it — by facet (price,
26
+ features, support), by entity (each vendor), or by region. Save the plan with
27
+ `mcp__local_memory_sqlite__save_progress` so the work can be resumed if the turn is cut off.
28
+ Give each subtopic 1-3 calls of the budget.
29
+
30
+ ## 4. Research each subtopic
31
+ - `web_search` with a specific query (names, year, a figure) — it already reads the top pages, so
32
+ `fetch_url` only a page you need in full (a pricing table, a report, a statute).
33
+ - Prefer primary sources: official sites, filings, regulators, papers, vendor docs. Note the date
34
+ of every figure; flag anything older than about 2 years.
35
+ - Right after each subtopic, write `research_notes/<title>/<subtopic>.md` with `create_file`:
36
+ bullet facts with numbers, each ending with `[source title](url), date`. Record conflicts
37
+ between sources instead of picking one silently, and list what you could not find.
38
+ - Do not repeat a query. When the budget is spent, stop searching and write with what you have.
39
+
40
+ ## 5. Write the report
41
+ Write `reports/<title>.md` from the notes (re-read them with `read_text_file`):
42
+ 1. `# <title>`, then a **Summary**: 3-6 sentences that answer the question directly.
43
+ 2. One section per subtopic. Lead with the finding, then the evidence. Use a table when you
44
+ compare 3+ items on the same attributes.
45
+ 3. **Caveats**: gaps, conflicting sources, dated figures.
46
+ 4. **Sources**: numbered list of every URL used; cite in the text as `[1]`, `[2]`.
47
+ Write prose, not bullet dumps. Every number needs a citation. Never invent a source or a figure.
48
+
49
+ ## 6. Deliver
50
+ Give the user the report path and a 3-5 sentence summary of the findings. If they asked for a
51
+ PDF, `create_pdf(path="reports/<title>.md", title="<title>")`; for a Word file use the `docx` skill.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: docx
3
+ description: "Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx) or Word templates (.dotx). Triggers include: any mention of Microsoft Word Documents, such as 'Word doc', 'word document', '.docx', '.dotx', 'microsoft doc'. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, 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 deliverable as a Word or .docx file (to download, email or print), use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or coding unrelated to document generation."
4
+ license: Complete terms in LICENSE.txt
5
+ ---
6
+
7
+ # DOCX creation, editing, and analysis
8
+
9
+ > Modified for gu, 2026: adapted to gu's tools (`run_command`) and install notes. Original © Anthropic, PBC, Apache License 2.0 — see LICENSE.txt.
10
+
11
+ Run the scripts below with `run_command` from this skill's folder. They need Python 3 with the libraries named at the end of this file, plus LibreOffice for conversions; install what is missing (for example `pip install --user python-docx`, `brew install --cask libreoffice`) before you start.
12
+
13
+ A `.docx` is a ZIP archive of XML files. Choose your approach by task:
14
+
15
+ | Task | Approach |
16
+ |---|---|
17
+ | **Create** a new document | Write a `docx` (npm) script — see gotchas below |
18
+ | **Edit** an existing document | `unzip` → edit `word/document.xml` → `zip` (docx-js cannot open existing files) |
19
+ | **Read** content | `pandoc -t markdown file.docx` |
20
+
21
+ > Script paths below are relative to this skill's directory.
22
+
23
+ ## Creating with docx-js — gotchas
24
+
25
+ `docx` is preinstalled — do not run `npm install` first; write the script and `require('docx')` directly. Only if that require fails: `npm install docx`. The model knows the API; these are the footguns:
26
+
27
+ - **Page size defaults to A4.** For US Letter set `page: { size: { width: 12240, height: 15840 } }` (DXA; 1440 = 1″).
28
+ - **Landscape:** pass portrait dimensions and `orientation: PageOrientation.LANDSCAPE` — docx-js swaps width/height internally.
29
+ - **Tables need dual widths:** set `columnWidths` on the table AND `width` on every cell, both in `WidthType.DXA` (PERCENTAGE breaks in Google Docs). Column widths must sum to the table width.
30
+ - **Table shading:** use `ShadingType.CLEAR`, never `SOLID` (renders black).
31
+ - **Lists:** never insert `•` literally; use a `numbering` config with `LevelFormat.BULLET`.
32
+ - **`ImageRun` requires `type:`** (`"png"`, `"jpg"`, …).
33
+ - **`PageBreak` must be inside a `Paragraph`.**
34
+ - **Never use `\n`** — use separate `Paragraph` elements.
35
+ - **Headings:** style every level you use (`title`, `heading1`, `heading2`…) in `styles.default`: `heading1: { run: { font: "Arial", size: 32, bold: true }, paragraph: { spacing: { before: 240, after: 120 }, keepNext: true } }`. Every level needs its own font (even with a document default), `before` and `after` (even if 0) and `keepNext`: the built-in styles set none of them.
36
+ - **TOC:** headings must use built-in `HeadingLevel.*`; custom heading styles need `outlineLevel` set or they won't appear.
37
+ - **Don't use a table as a horizontal rule** — use a paragraph bottom border instead.
38
+ - **Dot-leader / right-aligned-on-same-line:** use `PositionalTab` (`alignment: PositionalTabAlignment.RIGHT`, `leader: PositionalTabLeader.DOT`) inside a `TextRun`, not literal `.` or space padding.
39
+
40
+ ## Verify the output
41
+
42
+ After writing a `.docx`, render it and look at it:
43
+
44
+ ```bash
45
+ zip -d output.docx '*/' >/dev/null || true # drop the ZIP's folder entries: Word has refused a file that has them when opened through a cloud co-editing service
46
+ python scripts/office/soffice.py --headless --convert-to pdf output.docx
47
+ pdftoppm -jpeg -r 100 output.pdf page
48
+ ls page-*.jpg # then Read the images
49
+ ```
50
+
51
+ `pdftoppm` zero-pads page numbers to the width of the page count (`page-01.jpg`…`page-12.jpg`).
52
+
53
+ ## Editing existing documents
54
+
55
+ Legacy `.doc` files must be converted first: `python scripts/office/soffice.py --headless --convert-to docx file.doc`.
56
+
57
+ ```bash
58
+ unzip -q doc.docx -d unpacked/
59
+ find unpacked -type l -delete # strip symlink entries — docx from external parties is untrusted
60
+ python scripts/merge_runs.py unpacked/ # coalesce fragmented runs so text is findable
61
+ # edit unpacked/word/document.xml in place — do NOT reformat or pretty-print
62
+ (cd unpacked && rm -f ../out.docx && zip -XrD ../out.docx .)
63
+ python scripts/office/validate.py out.docx --original doc.docx # XSD checks; --auto-repair fixes common issues
64
+ # redlining? add --author "<the name you redlined under>" to check every edit is tracked
65
+ ```
66
+
67
+ Word splits text across many `<w:r>` runs (revision ids, spell-check markers), so a phrase you can see in the document often doesn't exist as a contiguous string in the XML. `merge_runs.py` merges adjacent identically-formatted runs in `word/document.xml` without changing content or rendering; it also accepts a `.docx` directly (`python scripts/merge_runs.py doc.docx -o merged.docx`).
68
+
69
+ **Tracked changes:** when redlining, validate with `--author "<the name you redlined under>"` (needs `--original`) — it reports any text you changed without a `<w:ins>`/`<w:del>` around it, which is easy to do by accident and invisible in the accepted view. Wrap runs in `<w:ins>`/`<w:del>` with `w:id`, `w:author`, `w:date` attributes. Inside `<w:del>`, the text element is `<w:delText>`, not `<w:t>`. A deleted paragraph mark (`<w:pPr><w:rPr><w:del w:id=".." w:author=".." w:date=".."/></w:rPr></w:pPr>`) means "merge this paragraph into the next" — so deleting a paragraph outright is that plus a `<w:del>` around every run. The `<w:del/>` must come before the rPr's other children; their order is schema-enforced.
70
+
71
+ To produce a clean copy with all tracked changes accepted: `python scripts/accept_changes.py in.docx out.docx`.
72
+
73
+ Accepting a deleted paragraph mark should join that paragraph to the one below it, so a paragraph whose runs are *all* deleted vanishes. Word does this; `accept_changes.py` and `pandoc --track-changes=accept` don't always. Both fail the same way — they strip the deleted text but leave the emptied paragraph behind, which reads as a stray empty bullet when it was auto-numbered:
74
+
75
+ - `pandoc --track-changes=accept` never joins the paragraphs.
76
+ - `accept_changes.py` (LibreOffice) joins them correctly, except when the deleted paragraph is followed by an empty spacer paragraph.
77
+
78
+ An empty bullet in either view is an artifact of that view, not a defect in the document. Check paragraph deletions in the XML.
79
+
80
+ ## Comments
81
+
82
+ Comments require six cross-linked files. Use the helper — directory mode when you'll also be editing `document.xml` (saves an unzip/rezip cycle), `.docx`-direct mode otherwise:
83
+
84
+ ```bash
85
+ # Against an already-unpacked directory (preferred when also placing markers)
86
+ python scripts/comment.py unpacked/ "Fees & expenses cap is too low"
87
+ python scripts/comment.py unpacked/ "Agreed" --parent 0
88
+
89
+ # Against a .docx directly
90
+ python scripts/comment.py contract.docx "This cap is too low" -o annotated.docx
91
+ ```
92
+
93
+ The script writes `comments.xml`, `commentsExtended.xml`, `commentsIds.xml`, `commentsExtensible.xml`, the relationships, and the content-type overrides. Comment IDs are auto-assigned. It then prints the `<w:commentRangeStart>`/`<w:commentRangeEnd>`/`<w:commentReference>` snippet to add to `word/document.xml` so the comment anchors to specific text — until you place those markers, the comment exists but is not visible.
94
+
95
+ ## Dependencies
96
+
97
+ `docx` (npm, preinstalled — install only if `require('docx')` fails) · `pandoc` · LibreOffice (`soffice`) · `pdftoppm` (Poppler)
@@ -0,0 +1,135 @@
1
+ """Accept all tracked changes in a DOCX file using LibreOffice.
2
+
3
+ Requires LibreOffice (soffice) to be installed.
4
+ """
5
+
6
+ import argparse
7
+ import logging
8
+ import shutil
9
+ import subprocess
10
+ from pathlib import Path
11
+
12
+ from office.soffice import get_soffice_env
13
+
14
+ logger = logging.getLogger(__name__)
15
+
16
+ LIBREOFFICE_PROFILE = "/tmp/libreoffice_docx_profile"
17
+ MACRO_DIR = f"{LIBREOFFICE_PROFILE}/user/basic/Standard"
18
+
19
+ ACCEPT_CHANGES_MACRO = """<?xml version="1.0" encoding="UTF-8"?>
20
+ <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
21
+ <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">
22
+ Sub AcceptAllTrackedChanges()
23
+ Dim document As Object
24
+ Dim dispatcher As Object
25
+
26
+ document = ThisComponent.CurrentController.Frame
27
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
28
+
29
+ dispatcher.executeDispatch(document, ".uno:AcceptAllTrackedChanges", "", 0, Array())
30
+ ThisComponent.store()
31
+ ThisComponent.close(True)
32
+ End Sub
33
+ </script:module>"""
34
+
35
+
36
+ def accept_changes(
37
+ input_file: str,
38
+ output_file: str,
39
+ ) -> tuple[None, str]:
40
+ input_path = Path(input_file)
41
+ output_path = Path(output_file)
42
+
43
+ if not input_path.exists():
44
+ return None, f"Error: Input file not found: {input_file}"
45
+
46
+ if not input_path.suffix.lower() == ".docx":
47
+ return None, f"Error: Input file is not a DOCX file: {input_file}"
48
+
49
+ try:
50
+ output_path.parent.mkdir(parents=True, exist_ok=True)
51
+ shutil.copy2(input_path, output_path)
52
+ except Exception as e:
53
+ return None, f"Error: Failed to copy input file to output location: {e}"
54
+
55
+ if not _setup_libreoffice_macro():
56
+ return None, "Error: Failed to setup LibreOffice macro"
57
+
58
+ cmd = [
59
+ "soffice",
60
+ "--headless",
61
+ f"-env:UserInstallation=file://{LIBREOFFICE_PROFILE}",
62
+ "--norestore",
63
+ "vnd.sun.star.script:Standard.Module1.AcceptAllTrackedChanges?language=Basic&location=application",
64
+ str(output_path.absolute()),
65
+ ]
66
+
67
+ try:
68
+ result = subprocess.run(
69
+ cmd,
70
+ capture_output=True,
71
+ text=True,
72
+ timeout=30,
73
+ check=False,
74
+ env=get_soffice_env(),
75
+ )
76
+ except subprocess.TimeoutExpired:
77
+ return (
78
+ None,
79
+ f"Successfully accepted all tracked changes: {input_file} -> {output_file}",
80
+ )
81
+
82
+ if result.returncode != 0:
83
+ return None, f"Error: LibreOffice failed: {result.stderr}"
84
+
85
+ return (
86
+ None,
87
+ f"Successfully accepted all tracked changes: {input_file} -> {output_file}",
88
+ )
89
+
90
+
91
+ def _setup_libreoffice_macro() -> bool:
92
+ macro_dir = Path(MACRO_DIR)
93
+ macro_file = macro_dir / "Module1.xba"
94
+
95
+ if macro_file.exists() and "AcceptAllTrackedChanges" in macro_file.read_text():
96
+ return True
97
+
98
+ if not macro_dir.exists():
99
+ subprocess.run(
100
+ [
101
+ "soffice",
102
+ "--headless",
103
+ f"-env:UserInstallation=file://{LIBREOFFICE_PROFILE}",
104
+ "--terminate_after_init",
105
+ ],
106
+ capture_output=True,
107
+ timeout=10,
108
+ check=False,
109
+ env=get_soffice_env(),
110
+ )
111
+ macro_dir.mkdir(parents=True, exist_ok=True)
112
+
113
+ try:
114
+ macro_file.write_text(ACCEPT_CHANGES_MACRO)
115
+ return True
116
+ except Exception as e:
117
+ logger.warning(f"Failed to setup LibreOffice macro: {e}")
118
+ return False
119
+
120
+
121
+ if __name__ == "__main__":
122
+ parser = argparse.ArgumentParser(
123
+ description="Accept all tracked changes in a DOCX file"
124
+ )
125
+ parser.add_argument("input_file", help="Input DOCX file with tracked changes")
126
+ parser.add_argument(
127
+ "output_file", help="Output DOCX file (clean, no tracked changes)"
128
+ )
129
+ args = parser.parse_args()
130
+
131
+ _, message = accept_changes(args.input_file, args.output_file)
132
+ print(message)
133
+
134
+ if "Error" in message:
135
+ raise SystemExit(1)