sophhub 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/compact-context/skill.json +20 -0
- package/skills/compact-context/src/SKILL.md +133 -0
- package/skills/compact-context/src/scripts/check.sh +381 -0
- package/skills/compact-context/src/scripts/set-keep-recent.mjs +1337 -0
- package/skills/compact-context/src/scripts/setup.sh +96 -0
- package/skills/feishu-notes-assistant-universal/skill.json +20 -0
- package/skills/feishu-notes-assistant-universal/src/README.md +55 -0
- package/skills/feishu-notes-assistant-universal/src/SKILL.md +159 -0
- package/skills/feishu-notes-assistant-universal/src/bin/linux-amd64/lark-cli-openclaw +0 -0
- package/skills/feishu-notes-assistant-universal/src/bin/linux-arm64/lark-cli-openclaw +0 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/_resolve_lark_cli.py +58 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/openclaw_meeting_minutes.py +462 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/openclaw_notes_crud.py +547 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/openclaw_notes_crud_test.py +181 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/run_meeting_minutes.py +80 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/run_meeting_minutes.sh +5 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/run_note_crud.py +32 -0
- package/skills/feishu-notes-assistant-universal/src/scripts/run_note_crud.sh +5 -0
- package/skills/image-classify/skill.json +5 -5
- package/skills/image-classify/src/SKILL.md +60 -67
- package/skills/image-classify/src/scripts/face_search.py +400 -15
- package/skills/image-classify/src/scripts/send_dm_message.py +332 -0
- package/skills/md2pdf-converter/skill.json +20 -0
- package/skills/md2pdf-converter/src/SKILL.md +244 -0
- package/skills/md2pdf-converter/src/_meta.json +6 -0
- package/skills/md2pdf-converter/src/scripts/generate_emoji_mapping.py +74 -0
- package/skills/md2pdf-converter/src/scripts/md2pdf-local.sh +291 -0
- package/skills/sophnet-bot-client/skill.json +20 -0
- package/skills/sophnet-bot-client/src/SKILL.md +255 -0
- package/skills/sophnet-bot-client/src/pyproject.toml +13 -0
- package/skills/sophnet-bot-client/src/scripts/__init__.py +0 -0
- package/skills/sophnet-bot-client/src/scripts/bot_client_proxy.py +165 -0
- package/skills/sophnet-bot-client/src/scripts/bot_client_safe.sh +29 -0
- package/skills/sophnet-bot-client/src/scripts/bot_client_setup.py +502 -0
- package/skills/sophnet-bot-client/src/tests/__init__.py +0 -0
- package/skills/sophnet-bot-client/src/tests/test_bot_client_proxy.py +255 -0
- package/skills/sophnet-bot-client/src/tests/test_bot_client_setup.py +679 -0
- package/skills/sophnet-bot-client/src/uv.lock +8 -0
- package/skills/sophnet-docx/skill.json +20 -0
- package/skills/sophnet-docx/src/SKILL.md +463 -0
- package/skills/sophnet-docx/src/package-lock.json +208 -0
- package/skills/sophnet-docx/src/package.json +16 -0
- package/skills/sophnet-docx/src/pyproject.toml +11 -0
- package/skills/sophnet-docx/src/scripts/__init__.py +1 -0
- package/skills/sophnet-docx/src/scripts/accept_changes.py +135 -0
- package/skills/sophnet-docx/src/scripts/comment.py +318 -0
- package/skills/sophnet-docx/src/scripts/ensure_uv_env.sh +68 -0
- package/skills/sophnet-docx/src/scripts/office/helpers/__init__.py +0 -0
- package/skills/sophnet-docx/src/scripts/office/helpers/merge_runs.py +199 -0
- package/skills/sophnet-docx/src/scripts/office/helpers/simplify_redlines.py +197 -0
- package/skills/sophnet-docx/src/scripts/office/pack.py +159 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/sophnet-docx/src/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/sophnet-docx/src/scripts/office/soffice.py +183 -0
- package/skills/sophnet-docx/src/scripts/office/unpack.py +132 -0
- package/skills/sophnet-docx/src/scripts/office/validate.py +111 -0
- package/skills/sophnet-docx/src/scripts/office/validators/__init__.py +15 -0
- package/skills/sophnet-docx/src/scripts/office/validators/base.py +847 -0
- package/skills/sophnet-docx/src/scripts/office/validators/docx.py +446 -0
- package/skills/sophnet-docx/src/scripts/office/validators/pptx.py +275 -0
- package/skills/sophnet-docx/src/scripts/office/validators/redlining.py +247 -0
- package/skills/sophnet-docx/src/scripts/templates/comments.xml +3 -0
- package/skills/sophnet-docx/src/scripts/templates/commentsExtended.xml +3 -0
- package/skills/sophnet-docx/src/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/sophnet-docx/src/scripts/templates/commentsIds.xml +3 -0
- package/skills/sophnet-docx/src/scripts/templates/people.xml +3 -0
- package/skills/sophnet-docx/src/scripts/upload_file.sh +96 -0
- package/skills/sophnet-docx/src/uv.lock +320 -0
- package/skills/sophnet-pdf/skill.json +20 -0
- package/skills/sophnet-pdf/src/SKILL.md +413 -0
- package/skills/sophnet-pdf/src/forms.md +297 -0
- package/skills/sophnet-pdf/src/pyproject.toml +14 -0
- package/skills/sophnet-pdf/src/reference.md +612 -0
- package/skills/sophnet-pdf/src/scripts/check_bounding_boxes.py +65 -0
- package/skills/sophnet-pdf/src/scripts/check_fillable_fields.py +11 -0
- package/skills/sophnet-pdf/src/scripts/convert_pdf_to_images.py +33 -0
- package/skills/sophnet-pdf/src/scripts/create_validation_image.py +37 -0
- package/skills/sophnet-pdf/src/scripts/enhance_tutorial.py +558 -0
- package/skills/sophnet-pdf/src/scripts/ensure_uv_env.sh +68 -0
- package/skills/sophnet-pdf/src/scripts/extract_form_field_info.py +122 -0
- package/skills/sophnet-pdf/src/scripts/extract_form_structure.py +115 -0
- package/skills/sophnet-pdf/src/scripts/extract_pdf_content.py +35 -0
- package/skills/sophnet-pdf/src/scripts/fill_fillable_fields.py +98 -0
- package/skills/sophnet-pdf/src/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/skills/sophnet-pdf/src/scripts/upload_file.sh +88 -0
- package/skills/sophnet-pdf/src/uv.lock +537 -0
- package/skills/sophnet-xlsx/skill.json +20 -0
- package/skills/sophnet-xlsx/src/SKILL.md +399 -0
- package/skills/sophnet-xlsx/src/pyproject.toml +11 -0
- package/skills/sophnet-xlsx/src/scripts/ensure_uv_env.sh +68 -0
- package/skills/sophnet-xlsx/src/scripts/office/helpers/__init__.py +0 -0
- package/skills/sophnet-xlsx/src/scripts/office/helpers/merge_runs.py +199 -0
- package/skills/sophnet-xlsx/src/scripts/office/helpers/simplify_redlines.py +197 -0
- package/skills/sophnet-xlsx/src/scripts/office/pack.py +159 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/sophnet-xlsx/src/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/sophnet-xlsx/src/scripts/office/soffice.py +183 -0
- package/skills/sophnet-xlsx/src/scripts/office/unpack.py +132 -0
- package/skills/sophnet-xlsx/src/scripts/office/validate.py +111 -0
- package/skills/sophnet-xlsx/src/scripts/office/validators/__init__.py +15 -0
- package/skills/sophnet-xlsx/src/scripts/office/validators/base.py +847 -0
- package/skills/sophnet-xlsx/src/scripts/office/validators/docx.py +446 -0
- package/skills/sophnet-xlsx/src/scripts/office/validators/pptx.py +275 -0
- package/skills/sophnet-xlsx/src/scripts/office/validators/redlining.py +247 -0
- package/skills/sophnet-xlsx/src/scripts/recalc.py +184 -0
- package/skills/sophnet-xlsx/src/scripts/upload_file.sh +96 -0
- package/skills/sophnet-xlsx/src/uv.lock +319 -0
- package/skills/wechat-article-publisher/skill.json +20 -0
- package/skills/wechat-article-publisher/src/SKILL.md +60 -0
- package/skills/wechat-article-publisher/src/config.json +7 -0
- package/skills/wechat-article-publisher/src/pyproject.toml +12 -0
- package/skills/wechat-article-publisher/src/scripts/publish_wechat.py +825 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sophnet-docx",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"docx": "^9.5.1"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sophnet-docx"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Skill-local runtime dependencies for sophnet-docx"
|
|
5
|
+
requires-python = ">=3.10"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"defusedxml>=0.7.1",
|
|
8
|
+
"lxml>=5.2.0",
|
|
9
|
+
"python-docx>=1.1.0",
|
|
10
|
+
"sophnet-tools>=0.0.1",
|
|
11
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -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)
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"""Add comments to DOCX documents.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
python comment.py unpacked/ 0 "Comment text"
|
|
5
|
+
python comment.py unpacked/ 1 "Reply text" --parent 0
|
|
6
|
+
|
|
7
|
+
Text should be pre-escaped XML (e.g., & for &, ’ for smart quotes).
|
|
8
|
+
|
|
9
|
+
After running, add markers to document.xml:
|
|
10
|
+
<w:commentRangeStart w:id="0"/>
|
|
11
|
+
... commented content ...
|
|
12
|
+
<w:commentRangeEnd w:id="0"/>
|
|
13
|
+
<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="0"/></w:r>
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import argparse
|
|
17
|
+
import random
|
|
18
|
+
import shutil
|
|
19
|
+
import sys
|
|
20
|
+
from datetime import datetime, timezone
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
import defusedxml.minidom
|
|
24
|
+
|
|
25
|
+
TEMPLATE_DIR = Path(__file__).parent / "templates"
|
|
26
|
+
NS = {
|
|
27
|
+
"w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
28
|
+
"w14": "http://schemas.microsoft.com/office/word/2010/wordml",
|
|
29
|
+
"w15": "http://schemas.microsoft.com/office/word/2012/wordml",
|
|
30
|
+
"w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid",
|
|
31
|
+
"w16cex": "http://schemas.microsoft.com/office/word/2018/wordml/cex",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
COMMENT_XML = """\
|
|
35
|
+
<w:comment w:id="{id}" w:author="{author}" w:date="{date}" w:initials="{initials}">
|
|
36
|
+
<w:p w14:paraId="{para_id}" w14:textId="77777777">
|
|
37
|
+
<w:r>
|
|
38
|
+
<w:rPr><w:rStyle w:val="CommentReference"/></w:rPr>
|
|
39
|
+
<w:annotationRef/>
|
|
40
|
+
</w:r>
|
|
41
|
+
<w:r>
|
|
42
|
+
<w:rPr>
|
|
43
|
+
<w:color w:val="000000"/>
|
|
44
|
+
<w:sz w:val="20"/>
|
|
45
|
+
<w:szCs w:val="20"/>
|
|
46
|
+
</w:rPr>
|
|
47
|
+
<w:t>{text}</w:t>
|
|
48
|
+
</w:r>
|
|
49
|
+
</w:p>
|
|
50
|
+
</w:comment>"""
|
|
51
|
+
|
|
52
|
+
COMMENT_MARKER_TEMPLATE = """
|
|
53
|
+
Add to document.xml (markers must be direct children of w:p, never inside w:r):
|
|
54
|
+
<w:commentRangeStart w:id="{cid}"/>
|
|
55
|
+
<w:r>...</w:r>
|
|
56
|
+
<w:commentRangeEnd w:id="{cid}"/>
|
|
57
|
+
<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="{cid}"/></w:r>"""
|
|
58
|
+
|
|
59
|
+
REPLY_MARKER_TEMPLATE = """
|
|
60
|
+
Nest markers inside parent {pid}'s markers (markers must be direct children of w:p, never inside w:r):
|
|
61
|
+
<w:commentRangeStart w:id="{pid}"/><w:commentRangeStart w:id="{cid}"/>
|
|
62
|
+
<w:r>...</w:r>
|
|
63
|
+
<w:commentRangeEnd w:id="{cid}"/><w:commentRangeEnd w:id="{pid}"/>
|
|
64
|
+
<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="{pid}"/></w:r>
|
|
65
|
+
<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="{cid}"/></w:r>"""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _generate_hex_id() -> str:
|
|
69
|
+
return f"{random.randint(0, 0x7FFFFFFE):08X}"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
SMART_QUOTE_ENTITIES = {
|
|
73
|
+
"\u201c": "“",
|
|
74
|
+
"\u201d": "”",
|
|
75
|
+
"\u2018": "‘",
|
|
76
|
+
"\u2019": "’",
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _encode_smart_quotes(text: str) -> str:
|
|
81
|
+
for char, entity in SMART_QUOTE_ENTITIES.items():
|
|
82
|
+
text = text.replace(char, entity)
|
|
83
|
+
return text
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _append_xml(xml_path: Path, root_tag: str, content: str) -> None:
|
|
87
|
+
dom = defusedxml.minidom.parseString(xml_path.read_text(encoding="utf-8"))
|
|
88
|
+
root = dom.getElementsByTagName(root_tag)[0]
|
|
89
|
+
ns_attrs = " ".join(f'xmlns:{k}="{v}"' for k, v in NS.items())
|
|
90
|
+
wrapper_dom = defusedxml.minidom.parseString(f"<root {ns_attrs}>{content}</root>")
|
|
91
|
+
for child in wrapper_dom.documentElement.childNodes:
|
|
92
|
+
if child.nodeType == child.ELEMENT_NODE:
|
|
93
|
+
root.appendChild(dom.importNode(child, True))
|
|
94
|
+
output = _encode_smart_quotes(dom.toxml(encoding="UTF-8").decode("utf-8"))
|
|
95
|
+
xml_path.write_text(output, encoding="utf-8")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _find_para_id(comments_path: Path, comment_id: int) -> str | None:
|
|
99
|
+
dom = defusedxml.minidom.parseString(comments_path.read_text(encoding="utf-8"))
|
|
100
|
+
for c in dom.getElementsByTagName("w:comment"):
|
|
101
|
+
if c.getAttribute("w:id") == str(comment_id):
|
|
102
|
+
for p in c.getElementsByTagName("w:p"):
|
|
103
|
+
if pid := p.getAttribute("w14:paraId"):
|
|
104
|
+
return pid
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _get_next_rid(rels_path: Path) -> int:
|
|
109
|
+
dom = defusedxml.minidom.parseString(rels_path.read_text(encoding="utf-8"))
|
|
110
|
+
max_rid = 0
|
|
111
|
+
for rel in dom.getElementsByTagName("Relationship"):
|
|
112
|
+
rid = rel.getAttribute("Id")
|
|
113
|
+
if rid and rid.startswith("rId"):
|
|
114
|
+
try:
|
|
115
|
+
max_rid = max(max_rid, int(rid[3:]))
|
|
116
|
+
except ValueError:
|
|
117
|
+
pass
|
|
118
|
+
return max_rid + 1
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _has_relationship(rels_path: Path, target: str) -> bool:
|
|
122
|
+
dom = defusedxml.minidom.parseString(rels_path.read_text(encoding="utf-8"))
|
|
123
|
+
for rel in dom.getElementsByTagName("Relationship"):
|
|
124
|
+
if rel.getAttribute("Target") == target:
|
|
125
|
+
return True
|
|
126
|
+
return False
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _has_content_type(ct_path: Path, part_name: str) -> bool:
|
|
130
|
+
dom = defusedxml.minidom.parseString(ct_path.read_text(encoding="utf-8"))
|
|
131
|
+
for override in dom.getElementsByTagName("Override"):
|
|
132
|
+
if override.getAttribute("PartName") == part_name:
|
|
133
|
+
return True
|
|
134
|
+
return False
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _ensure_comment_relationships(unpacked_dir: Path) -> None:
|
|
138
|
+
rels_path = unpacked_dir / "word" / "_rels" / "document.xml.rels"
|
|
139
|
+
if not rels_path.exists():
|
|
140
|
+
return
|
|
141
|
+
|
|
142
|
+
if _has_relationship(rels_path, "comments.xml"):
|
|
143
|
+
return
|
|
144
|
+
|
|
145
|
+
dom = defusedxml.minidom.parseString(rels_path.read_text(encoding="utf-8"))
|
|
146
|
+
root = dom.documentElement
|
|
147
|
+
next_rid = _get_next_rid(rels_path)
|
|
148
|
+
|
|
149
|
+
rels = [
|
|
150
|
+
(
|
|
151
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
|
|
152
|
+
"comments.xml",
|
|
153
|
+
),
|
|
154
|
+
(
|
|
155
|
+
"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",
|
|
156
|
+
"commentsExtended.xml",
|
|
157
|
+
),
|
|
158
|
+
(
|
|
159
|
+
"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",
|
|
160
|
+
"commentsIds.xml",
|
|
161
|
+
),
|
|
162
|
+
(
|
|
163
|
+
"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible",
|
|
164
|
+
"commentsExtensible.xml",
|
|
165
|
+
),
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
for rel_type, target in rels:
|
|
169
|
+
rel = dom.createElement("Relationship")
|
|
170
|
+
rel.setAttribute("Id", f"rId{next_rid}")
|
|
171
|
+
rel.setAttribute("Type", rel_type)
|
|
172
|
+
rel.setAttribute("Target", target)
|
|
173
|
+
root.appendChild(rel)
|
|
174
|
+
next_rid += 1
|
|
175
|
+
|
|
176
|
+
rels_path.write_bytes(dom.toxml(encoding="UTF-8"))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _ensure_comment_content_types(unpacked_dir: Path) -> None:
|
|
180
|
+
ct_path = unpacked_dir / "[Content_Types].xml"
|
|
181
|
+
if not ct_path.exists():
|
|
182
|
+
return
|
|
183
|
+
|
|
184
|
+
if _has_content_type(ct_path, "/word/comments.xml"):
|
|
185
|
+
return
|
|
186
|
+
|
|
187
|
+
dom = defusedxml.minidom.parseString(ct_path.read_text(encoding="utf-8"))
|
|
188
|
+
root = dom.documentElement
|
|
189
|
+
|
|
190
|
+
overrides = [
|
|
191
|
+
(
|
|
192
|
+
"/word/comments.xml",
|
|
193
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
|
|
194
|
+
),
|
|
195
|
+
(
|
|
196
|
+
"/word/commentsExtended.xml",
|
|
197
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",
|
|
198
|
+
),
|
|
199
|
+
(
|
|
200
|
+
"/word/commentsIds.xml",
|
|
201
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",
|
|
202
|
+
),
|
|
203
|
+
(
|
|
204
|
+
"/word/commentsExtensible.xml",
|
|
205
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml",
|
|
206
|
+
),
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
for part_name, content_type in overrides:
|
|
210
|
+
override = dom.createElement("Override")
|
|
211
|
+
override.setAttribute("PartName", part_name)
|
|
212
|
+
override.setAttribute("ContentType", content_type)
|
|
213
|
+
root.appendChild(override)
|
|
214
|
+
|
|
215
|
+
ct_path.write_bytes(dom.toxml(encoding="UTF-8"))
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def add_comment(
|
|
219
|
+
unpacked_dir: str,
|
|
220
|
+
comment_id: int,
|
|
221
|
+
text: str,
|
|
222
|
+
author: str = "Claude",
|
|
223
|
+
initials: str = "C",
|
|
224
|
+
parent_id: int | None = None,
|
|
225
|
+
) -> tuple[str, str]:
|
|
226
|
+
word = Path(unpacked_dir) / "word"
|
|
227
|
+
if not word.exists():
|
|
228
|
+
return "", f"Error: {word} not found"
|
|
229
|
+
|
|
230
|
+
para_id, durable_id = _generate_hex_id(), _generate_hex_id()
|
|
231
|
+
ts = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
232
|
+
|
|
233
|
+
comments = word / "comments.xml"
|
|
234
|
+
first_comment = not comments.exists()
|
|
235
|
+
if first_comment:
|
|
236
|
+
shutil.copy(TEMPLATE_DIR / "comments.xml", comments)
|
|
237
|
+
_ensure_comment_relationships(Path(unpacked_dir))
|
|
238
|
+
_ensure_comment_content_types(Path(unpacked_dir))
|
|
239
|
+
_append_xml(
|
|
240
|
+
comments,
|
|
241
|
+
"w:comments",
|
|
242
|
+
COMMENT_XML.format(
|
|
243
|
+
id=comment_id,
|
|
244
|
+
author=author,
|
|
245
|
+
date=ts,
|
|
246
|
+
initials=initials,
|
|
247
|
+
para_id=para_id,
|
|
248
|
+
text=text,
|
|
249
|
+
),
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
ext = word / "commentsExtended.xml"
|
|
253
|
+
if not ext.exists():
|
|
254
|
+
shutil.copy(TEMPLATE_DIR / "commentsExtended.xml", ext)
|
|
255
|
+
if parent_id is not None:
|
|
256
|
+
parent_para = _find_para_id(comments, parent_id)
|
|
257
|
+
if not parent_para:
|
|
258
|
+
return "", f"Error: Parent comment {parent_id} not found"
|
|
259
|
+
_append_xml(
|
|
260
|
+
ext,
|
|
261
|
+
"w15:commentsEx",
|
|
262
|
+
f'<w15:commentEx w15:paraId="{para_id}" w15:paraIdParent="{parent_para}" w15:done="0"/>',
|
|
263
|
+
)
|
|
264
|
+
else:
|
|
265
|
+
_append_xml(
|
|
266
|
+
ext,
|
|
267
|
+
"w15:commentsEx",
|
|
268
|
+
f'<w15:commentEx w15:paraId="{para_id}" w15:done="0"/>',
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
ids = word / "commentsIds.xml"
|
|
272
|
+
if not ids.exists():
|
|
273
|
+
shutil.copy(TEMPLATE_DIR / "commentsIds.xml", ids)
|
|
274
|
+
_append_xml(
|
|
275
|
+
ids,
|
|
276
|
+
"w16cid:commentsIds",
|
|
277
|
+
f'<w16cid:commentId w16cid:paraId="{para_id}" w16cid:durableId="{durable_id}"/>',
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
extensible = word / "commentsExtensible.xml"
|
|
281
|
+
if not extensible.exists():
|
|
282
|
+
shutil.copy(TEMPLATE_DIR / "commentsExtensible.xml", extensible)
|
|
283
|
+
_append_xml(
|
|
284
|
+
extensible,
|
|
285
|
+
"w16cex:commentsExtensible",
|
|
286
|
+
f'<w16cex:commentExtensible w16cex:durableId="{durable_id}" w16cex:dateUtc="{ts}"/>',
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
action = "reply" if parent_id is not None else "comment"
|
|
290
|
+
return para_id, f"Added {action} {comment_id} (para_id={para_id})"
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
if __name__ == "__main__":
|
|
294
|
+
p = argparse.ArgumentParser(description="Add comments to DOCX documents")
|
|
295
|
+
p.add_argument("unpacked_dir", help="Unpacked DOCX directory")
|
|
296
|
+
p.add_argument("comment_id", type=int, help="Comment ID (must be unique)")
|
|
297
|
+
p.add_argument("text", help="Comment text")
|
|
298
|
+
p.add_argument("--author", default="Claude", help="Author name")
|
|
299
|
+
p.add_argument("--initials", default="C", help="Author initials")
|
|
300
|
+
p.add_argument("--parent", type=int, help="Parent comment ID (for replies)")
|
|
301
|
+
args = p.parse_args()
|
|
302
|
+
|
|
303
|
+
para_id, msg = add_comment(
|
|
304
|
+
args.unpacked_dir,
|
|
305
|
+
args.comment_id,
|
|
306
|
+
args.text,
|
|
307
|
+
args.author,
|
|
308
|
+
args.initials,
|
|
309
|
+
args.parent,
|
|
310
|
+
)
|
|
311
|
+
print(msg)
|
|
312
|
+
if "Error" in msg:
|
|
313
|
+
sys.exit(1)
|
|
314
|
+
cid = args.comment_id
|
|
315
|
+
if args.parent is not None:
|
|
316
|
+
print(REPLY_MARKER_TEMPLATE.format(pid=args.parent, cid=cid))
|
|
317
|
+
else:
|
|
318
|
+
print(COMMENT_MARKER_TEMPLATE.format(cid=cid))
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
6
|
+
VENV_PYTHON="$SKILL_DIR/.venv/bin/python"
|
|
7
|
+
QUIET=false
|
|
8
|
+
FORCE_SYNC=false
|
|
9
|
+
|
|
10
|
+
usage() {
|
|
11
|
+
cat <<'USAGE'
|
|
12
|
+
Usage:
|
|
13
|
+
bash ensure_uv_env.sh [options]
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
--quiet Reduce non-error output.
|
|
17
|
+
--force-sync Force uv sync even when .venv already exists.
|
|
18
|
+
USAGE
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
log() {
|
|
22
|
+
if [[ "$QUIET" != true ]]; then
|
|
23
|
+
echo "$1" >&2
|
|
24
|
+
fi
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
while [[ $# -gt 0 ]]; do
|
|
28
|
+
case "$1" in
|
|
29
|
+
--quiet)
|
|
30
|
+
QUIET=true
|
|
31
|
+
shift
|
|
32
|
+
;;
|
|
33
|
+
--force-sync)
|
|
34
|
+
FORCE_SYNC=true
|
|
35
|
+
shift
|
|
36
|
+
;;
|
|
37
|
+
-h|--help)
|
|
38
|
+
usage
|
|
39
|
+
exit 0
|
|
40
|
+
;;
|
|
41
|
+
*)
|
|
42
|
+
echo "Unknown argument: $1" >&2
|
|
43
|
+
usage
|
|
44
|
+
exit 1
|
|
45
|
+
;;
|
|
46
|
+
esac
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
if ! command -v uv >/dev/null 2>&1; then
|
|
50
|
+
echo "Error: uv is required but not found." >&2
|
|
51
|
+
echo "Install uv first: https://docs.astral.sh/uv/getting-started/installation/" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
need_sync=false
|
|
56
|
+
|
|
57
|
+
if [[ "$FORCE_SYNC" == true || ! -x "$VENV_PYTHON" ]]; then
|
|
58
|
+
need_sync=true
|
|
59
|
+
elif ! "$VENV_PYTHON" -c 'import defusedxml.minidom, lxml.etree' >/dev/null 2>&1; then
|
|
60
|
+
need_sync=true
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if [[ "$need_sync" == true ]]; then
|
|
64
|
+
log "Syncing uv environment at $SKILL_DIR/.venv"
|
|
65
|
+
uv sync --project "$SKILL_DIR" --no-dev
|
|
66
|
+
else
|
|
67
|
+
log "uv environment already ready: $SKILL_DIR/.venv"
|
|
68
|
+
fi
|
|
File without changes
|