@preapexis/piexis 0.1.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/.github/workflows/npm-publish.yml +63 -0
- package/AGENTS.md +58 -0
- package/PERMISSION_MODES_PLAN.md +279 -0
- package/README.md +207 -0
- package/WHAT_YOU_GET.md +153 -0
- package/eval/README.md +72 -0
- package/eval/permission-cases.json +28 -0
- package/eval/permissions.mjs +103 -0
- package/extensions/ask-question.ts +111 -0
- package/extensions/background-tasks.ts +433 -0
- package/extensions/background-worker.ts +50 -0
- package/extensions/glob.ts +32 -0
- package/extensions/mode.ts +397 -0
- package/extensions/ui.ts +134 -0
- package/lib/bash-approvals.ts +113 -0
- package/lib/bash-policy.ts +164 -0
- package/lib/mode-policy.ts +174 -0
- package/lib/path-policy.ts +182 -0
- package/lib/permission-classifier.ts +128 -0
- package/lib/permission-config.ts +91 -0
- package/lib/permission-denials.ts +32 -0
- package/lib/permission-intent.ts +128 -0
- package/lib/permission-taxonomy.ts +15 -0
- package/lib/task-broker.ts +65 -0
- package/lib/task-checkout.ts +39 -0
- package/lib/task-git.ts +44 -0
- package/lib/task-patch.ts +106 -0
- package/lib/task-permissions.ts +51 -0
- package/lib/task-report.ts +62 -0
- package/lib/task-worktree-policy.ts +56 -0
- package/package.json +51 -0
- package/prompts/commit.md +7 -0
- package/prompts/init.md +66 -0
- package/prompts/summary.md +14 -0
- package/skills/claude-api/LICENSE.txt +202 -0
- package/skills/claude-api/SKILL.md +572 -0
- package/skills/claude-api/csharp/claude-api/README.md +362 -0
- package/skills/claude-api/csharp/claude-api/batches.md +14 -0
- package/skills/claude-api/csharp/claude-api/files-api.md +25 -0
- package/skills/claude-api/csharp/claude-api/streaming.md +28 -0
- package/skills/claude-api/csharp/claude-api/tool-use.md +164 -0
- package/skills/claude-api/curl/examples.md +256 -0
- package/skills/claude-api/curl/managed-agents.md +371 -0
- package/skills/claude-api/go/claude-api/README.md +188 -0
- package/skills/claude-api/go/claude-api/files-api.md +23 -0
- package/skills/claude-api/go/claude-api/streaming.md +43 -0
- package/skills/claude-api/go/claude-api/tool-use.md +220 -0
- package/skills/claude-api/go/managed-agents/README.md +564 -0
- package/skills/claude-api/java/claude-api/README.md +238 -0
- package/skills/claude-api/java/claude-api/files-api.md +27 -0
- package/skills/claude-api/java/claude-api/streaming.md +24 -0
- package/skills/claude-api/java/claude-api/tool-use.md +228 -0
- package/skills/claude-api/java/managed-agents/README.md +443 -0
- package/skills/claude-api/php/claude-api/README.md +174 -0
- package/skills/claude-api/php/claude-api/batches.md +15 -0
- package/skills/claude-api/php/claude-api/files-api.md +13 -0
- package/skills/claude-api/php/claude-api/streaming.md +27 -0
- package/skills/claude-api/php/claude-api/tool-use.md +253 -0
- package/skills/claude-api/php/managed-agents/README.md +443 -0
- package/skills/claude-api/python/claude-api/README.md +565 -0
- package/skills/claude-api/python/claude-api/batches.md +198 -0
- package/skills/claude-api/python/claude-api/files-api.md +170 -0
- package/skills/claude-api/python/claude-api/sdk-upgrade.md +286 -0
- package/skills/claude-api/python/claude-api/streaming.md +179 -0
- package/skills/claude-api/python/claude-api/tool-use.md +627 -0
- package/skills/claude-api/python/managed-agents/README.md +335 -0
- package/skills/claude-api/ruby/claude-api/README.md +134 -0
- package/skills/claude-api/ruby/claude-api/streaming.md +16 -0
- package/skills/claude-api/ruby/claude-api/tool-use.md +41 -0
- package/skills/claude-api/ruby/managed-agents/README.md +394 -0
- package/skills/claude-api/shared/admin-api.md +179 -0
- package/skills/claude-api/shared/agent-design.md +101 -0
- package/skills/claude-api/shared/anthropic-cli.md +269 -0
- package/skills/claude-api/shared/claude-platform-on-aws.md +59 -0
- package/skills/claude-api/shared/cost-optimization.md +233 -0
- package/skills/claude-api/shared/error-codes.md +262 -0
- package/skills/claude-api/shared/live-sources.md +166 -0
- package/skills/claude-api/shared/managed-agents-api-reference.md +455 -0
- package/skills/claude-api/shared/managed-agents-client-patterns.md +220 -0
- package/skills/claude-api/shared/managed-agents-core.md +359 -0
- package/skills/claude-api/shared/managed-agents-environments.md +226 -0
- package/skills/claude-api/shared/managed-agents-events.md +290 -0
- package/skills/claude-api/shared/managed-agents-memory.md +201 -0
- package/skills/claude-api/shared/managed-agents-multiagent.md +260 -0
- package/skills/claude-api/shared/managed-agents-onboarding.md +82 -0
- package/skills/claude-api/shared/managed-agents-outcomes.md +108 -0
- package/skills/claude-api/shared/managed-agents-overview.md +77 -0
- package/skills/claude-api/shared/managed-agents-scheduled-deployments.md +156 -0
- package/skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +282 -0
- package/skills/claude-api/shared/managed-agents-tools.md +504 -0
- package/skills/claude-api/shared/managed-agents-webhooks.md +143 -0
- package/skills/claude-api/shared/model-migration.md +1872 -0
- package/skills/claude-api/shared/models.md +142 -0
- package/skills/claude-api/shared/platform-availability.md +53 -0
- package/skills/claude-api/shared/prompt-audit.md +223 -0
- package/skills/claude-api/shared/prompt-caching.md +292 -0
- package/skills/claude-api/shared/token-counting.md +56 -0
- package/skills/claude-api/shared/tool-use-concepts.md +526 -0
- package/skills/claude-api/typescript/claude-api/README.md +405 -0
- package/skills/claude-api/typescript/claude-api/batches.md +106 -0
- package/skills/claude-api/typescript/claude-api/files-api.md +98 -0
- package/skills/claude-api/typescript/claude-api/streaming.md +178 -0
- package/skills/claude-api/typescript/claude-api/tool-use.md +586 -0
- package/skills/claude-api/typescript/managed-agents/README.md +359 -0
- package/skills/code-review/SKILL.md +34 -0
- package/skills/code-review/agents/openai.yaml +3 -0
- package/skills/codebase-design/DEEPENING.md +37 -0
- package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/skills/codebase-design/SKILL.md +40 -0
- package/skills/diagnosing-bugs/SKILL.md +38 -0
- package/skills/diagnosing-bugs/agents/openai.yaml +3 -0
- package/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +44 -0
- package/skills/docx/LICENSE.txt +30 -0
- package/skills/docx/SKILL.md +93 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/accept_changes.py +135 -0
- package/skills/docx/scripts/comment.py +368 -0
- package/skills/docx/scripts/merge_runs.py +310 -0
- package/skills/docx/scripts/office/helpers/__init__.py +111 -0
- package/skills/docx/scripts/office/helpers/pptx_chart.py +170 -0
- package/skills/docx/scripts/office/helpers/pptx_slide.py +60 -0
- package/skills/docx/scripts/office/helpers/pptx_theme.py +114 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/scripts/office/soffice.py +192 -0
- package/skills/docx/scripts/office/validate.py +173 -0
- package/skills/docx/scripts/office/validators/__init__.py +15 -0
- package/skills/docx/scripts/office/validators/base.py +875 -0
- package/skills/docx/scripts/office/validators/docx.py +466 -0
- package/skills/docx/scripts/office/validators/pptx.py +441 -0
- package/skills/docx/scripts/office/validators/redlining.py +299 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/frontend-design/LICENSE.txt +177 -0
- package/skills/frontend-design/SKILL.md +27 -0
- package/skills/grilling/SKILL.md +41 -0
- package/skills/lean-build/SKILL.md +22 -0
- package/skills/lean-build/agents/openai.yaml +4 -0
- package/skills/mcp-builder/LICENSE.txt +202 -0
- package/skills/mcp-builder/SKILL.md +235 -0
- package/skills/mcp-builder/reference/evaluation.md +602 -0
- package/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/skills/mcp-builder/scripts/connections.py +151 -0
- package/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/skills/migration/SKILL.md +17 -0
- package/skills/migration/agents/openai.yaml +4 -0
- package/skills/pdf/LICENSE.txt +30 -0
- package/skills/pdf/SKILL.md +27 -0
- package/skills/pdf/forms.md +294 -0
- package/skills/pdf/reference.md +612 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +65 -0
- package/skills/pdf/scripts/check_fillable_fields.py +11 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
- package/skills/pdf/scripts/create_validation_image.py +37 -0
- package/skills/pdf/scripts/extract_form_field_info.py +122 -0
- package/skills/pdf/scripts/extract_form_structure.py +115 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +98 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/skills/pptx/LICENSE.txt +30 -0
- package/skills/pptx/SKILL.md +240 -0
- package/skills/pptx/scripts/__init__.py +0 -0
- package/skills/pptx/scripts/add_slide.py +367 -0
- package/skills/pptx/scripts/clean.py +309 -0
- package/skills/pptx/scripts/office/helpers/__init__.py +111 -0
- package/skills/pptx/scripts/office/helpers/pptx_chart.py +170 -0
- package/skills/pptx/scripts/office/helpers/pptx_slide.py +60 -0
- package/skills/pptx/scripts/office/helpers/pptx_theme.py +114 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/scripts/office/soffice.py +192 -0
- package/skills/pptx/scripts/office/validate.py +173 -0
- package/skills/pptx/scripts/office/validators/__init__.py +15 -0
- package/skills/pptx/scripts/office/validators/base.py +875 -0
- package/skills/pptx/scripts/office/validators/docx.py +466 -0
- package/skills/pptx/scripts/office/validators/pptx.py +441 -0
- package/skills/pptx/scripts/office/validators/redlining.py +299 -0
- package/skills/pptx/scripts/thumbnail.py +311 -0
- package/skills/safe-refactor/SKILL.md +16 -0
- package/skills/safe-refactor/agents/openai.yaml +4 -0
- package/skills/tdd/SKILL.md +18 -0
- package/skills/tdd/agents/openai.yaml +3 -0
- package/skills/tdd/mocking.md +59 -0
- package/skills/tdd/tests.md +77 -0
- package/skills/verify-and-stop/SKILL.md +16 -0
- package/skills/verify-and-stop/agents/openai.yaml +4 -0
- package/skills/webapp-testing/LICENSE.txt +202 -0
- package/skills/webapp-testing/SKILL.md +96 -0
- package/skills/webapp-testing/examples/console_logging.py +35 -0
- package/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/skills/webapp-testing/scripts/with_server.py +106 -0
- package/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/skills/writing-for-agents/SKILL.md +28 -0
- package/skills/writing-for-agents/agents/openai.yaml +3 -0
- package/skills/xlsx/LICENSE.txt +30 -0
- package/skills/xlsx/SKILL.md +101 -0
- package/skills/xlsx/scripts/office/helpers/__init__.py +111 -0
- package/skills/xlsx/scripts/office/helpers/pptx_chart.py +170 -0
- package/skills/xlsx/scripts/office/helpers/pptx_slide.py +60 -0
- package/skills/xlsx/scripts/office/helpers/pptx_theme.py +114 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/xlsx/scripts/office/soffice.py +192 -0
- package/skills/xlsx/scripts/office/validate.py +173 -0
- package/skills/xlsx/scripts/office/validators/__init__.py +15 -0
- package/skills/xlsx/scripts/office/validators/base.py +875 -0
- package/skills/xlsx/scripts/office/validators/docx.py +466 -0
- package/skills/xlsx/scripts/office/validators/pptx.py +441 -0
- package/skills/xlsx/scripts/office/validators/redlining.py +299 -0
- package/skills/xlsx/scripts/recalc.py +308 -0
- package/skills-lock.json +359 -0
- package/tests/auto-permissions.test.mjs +315 -0
- package/tests/background-tasks.test.mjs +27 -0
- package/tests/background-worker.test.mjs +60 -0
- package/tests/bash-permissions.test.mjs +276 -0
- package/tests/glob.test.mjs +31 -0
- package/tests/mode.test.mjs +62 -0
- package/tests/permission-evaluation.test.mjs +70 -0
- package/tests/permission-foundation.test.mjs +194 -0
- package/tests/permission-policy.test.mjs +158 -0
- package/tests/runtime/README.md +51 -0
- package/tests/runtime/harness.mjs +190 -0
- package/tests/runtime/permissions.test.mjs +192 -0
- package/tests/runtime/tui.test.mjs +60 -0
- package/tests/skills-routing.test.mjs +51 -0
- package/tests/task-integration.test.mjs +324 -0
- package/tests/task-permissions.test.mjs +178 -0
- package/tests/task-worktree-policy.test.mjs +53 -0
- package/themes/orange.json +82 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:s="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2018/wordml/cex" targetNamespace="http://schemas.microsoft.com/office/word/2018/wordml/cex">
|
|
2
|
+
<xsd:import id="w16" namespace="http://schemas.microsoft.com/office/word/2018/wordml" schemaLocation="wml-2018.xsd"/>
|
|
3
|
+
<xsd:import id="w" namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" schemaLocation="../ISO-IEC29500-4_2016/wml.xsd"/>
|
|
4
|
+
<xsd:import id="s" namespace="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" schemaLocation="../ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd"/>
|
|
5
|
+
<xsd:complexType name="CT_CommentsExtensible">
|
|
6
|
+
<xsd:sequence>
|
|
7
|
+
<xsd:element name="commentExtensible" type="CT_CommentExtensible" minOccurs="0" maxOccurs="unbounded"/>
|
|
8
|
+
<xsd:element name="extLst" type="w16:CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
|
|
9
|
+
</xsd:sequence>
|
|
10
|
+
</xsd:complexType>
|
|
11
|
+
<xsd:complexType name="CT_CommentExtensible">
|
|
12
|
+
<xsd:sequence>
|
|
13
|
+
<xsd:element name="extLst" type="w16:CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
|
|
14
|
+
</xsd:sequence>
|
|
15
|
+
<xsd:attribute name="durableId" type="w:ST_LongHexNumber" use="required"/>
|
|
16
|
+
<xsd:attribute name="dateUtc" type="w:ST_DateTime" use="optional"/>
|
|
17
|
+
<xsd:attribute name="intelligentPlaceholder" type="s:ST_OnOff" use="optional"/>
|
|
18
|
+
</xsd:complexType>
|
|
19
|
+
<xsd:element name="commentsExtensible" type="CT_CommentsExtensible"/>
|
|
20
|
+
</xsd:schema>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w12="http://schemas.openxmlformats.org/wordprocessingml/2006/main" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2016/wordml/cid" targetNamespace="http://schemas.microsoft.com/office/word/2016/wordml/cid">
|
|
2
|
+
<xsd:import id="w12" namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" schemaLocation="../ISO-IEC29500-4_2016/wml.xsd"/>
|
|
3
|
+
<xsd:complexType name="CT_CommentsIds">
|
|
4
|
+
<xsd:sequence>
|
|
5
|
+
<xsd:element name="commentId" type="CT_CommentId" minOccurs="0" maxOccurs="unbounded"/>
|
|
6
|
+
</xsd:sequence>
|
|
7
|
+
</xsd:complexType>
|
|
8
|
+
<xsd:complexType name="CT_CommentId">
|
|
9
|
+
<xsd:attribute name="paraId" type="w12:ST_LongHexNumber" use="required"/>
|
|
10
|
+
<xsd:attribute name="durableId" type="w12:ST_LongHexNumber" use="required"/>
|
|
11
|
+
</xsd:complexType>
|
|
12
|
+
<xsd:element name="commentsIds" type="CT_CommentsIds"/>
|
|
13
|
+
</xsd:schema>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w12="http://schemas.openxmlformats.org/wordprocessingml/2006/main" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" targetNamespace="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash">
|
|
2
|
+
<xsd:import id="w12" namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" schemaLocation="../ISO-IEC29500-4_2016/wml.xsd"/>
|
|
3
|
+
<xsd:attribute name="storeItemChecksum" type="w12:ST_String"/>
|
|
4
|
+
</xsd:schema>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w12="http://schemas.openxmlformats.org/wordprocessingml/2006/main" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2015/wordml/symex" targetNamespace="http://schemas.microsoft.com/office/word/2015/wordml/symex">
|
|
2
|
+
<xsd:import id="w12" namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" schemaLocation="../ISO-IEC29500-4_2016/wml.xsd"/>
|
|
3
|
+
<xsd:complexType name="CT_SymEx">
|
|
4
|
+
<xsd:attribute name="font" type="w12:ST_String"/>
|
|
5
|
+
<xsd:attribute name="char" type="w12:ST_LongHexNumber"/>
|
|
6
|
+
</xsd:complexType>
|
|
7
|
+
<xsd:element name="symEx" type="CT_SymEx"/>
|
|
8
|
+
</xsd:schema>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Helper for running LibreOffice (soffice) in environments where AF_UNIX
|
|
3
|
+
sockets may be blocked (e.g., sandboxed VMs). Detects the restriction
|
|
4
|
+
at runtime and applies an LD_PRELOAD shim if needed.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
from office.soffice import run_soffice
|
|
8
|
+
|
|
9
|
+
result = run_soffice(["--headless", "--convert-to", "pdf", "input.docx"])
|
|
10
|
+
|
|
11
|
+
Call soffice through run_soffice, not through subprocess with get_soffice_env():
|
|
12
|
+
the env dict carries the shim but names no user profile, and a non-root sandbox
|
|
13
|
+
cannot bootstrap the default one -- soffice aborts with "User installation could
|
|
14
|
+
not be completed" and converts nothing. get_soffice_env() stays public for the
|
|
15
|
+
callers that build their own argv (they must pass -env:UserInstallation too).
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import contextlib
|
|
19
|
+
import os
|
|
20
|
+
import socket
|
|
21
|
+
import subprocess
|
|
22
|
+
import tempfile
|
|
23
|
+
from collections.abc import Iterable
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_soffice_env() -> dict:
|
|
28
|
+
env = os.environ.copy()
|
|
29
|
+
env["SAL_USE_VCLPLUGIN"] = "svp"
|
|
30
|
+
|
|
31
|
+
if _needs_shim():
|
|
32
|
+
shim = _ensure_shim()
|
|
33
|
+
env["LD_PRELOAD"] = str(shim)
|
|
34
|
+
|
|
35
|
+
return env
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def run_soffice(args: Iterable[str], **kwargs) -> subprocess.CompletedProcess:
|
|
39
|
+
args = list(args)
|
|
40
|
+
with contextlib.ExitStack() as stack:
|
|
41
|
+
if not any(str(a).startswith("-env:UserInstallation") for a in args):
|
|
42
|
+
profile = stack.enter_context(
|
|
43
|
+
tempfile.TemporaryDirectory(prefix="lo_profile_", ignore_cleanup_errors=True)
|
|
44
|
+
)
|
|
45
|
+
args = [f"-env:UserInstallation={Path(profile).as_uri()}"] + args
|
|
46
|
+
return subprocess.run(["soffice"] + args, env=get_soffice_env(), **kwargs)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
_SHIM_SO = Path(tempfile.gettempdir()) / "lo_socket_shim.so"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _needs_shim() -> bool:
|
|
54
|
+
try:
|
|
55
|
+
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
56
|
+
s.close()
|
|
57
|
+
return False
|
|
58
|
+
except OSError:
|
|
59
|
+
return True
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _ensure_shim() -> Path:
|
|
63
|
+
if _SHIM_SO.exists():
|
|
64
|
+
return _SHIM_SO
|
|
65
|
+
|
|
66
|
+
src = Path(tempfile.gettempdir()) / "lo_socket_shim.c"
|
|
67
|
+
src.write_text(_SHIM_SOURCE)
|
|
68
|
+
subprocess.run(
|
|
69
|
+
["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"],
|
|
70
|
+
check=True,
|
|
71
|
+
capture_output=True,
|
|
72
|
+
)
|
|
73
|
+
src.unlink()
|
|
74
|
+
return _SHIM_SO
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
_SHIM_SOURCE = r"""
|
|
79
|
+
#define _GNU_SOURCE
|
|
80
|
+
#include <dlfcn.h>
|
|
81
|
+
#include <errno.h>
|
|
82
|
+
#include <signal.h>
|
|
83
|
+
#include <stdio.h>
|
|
84
|
+
#include <stdlib.h>
|
|
85
|
+
#include <sys/socket.h>
|
|
86
|
+
#include <unistd.h>
|
|
87
|
+
|
|
88
|
+
static int (*real_socket)(int, int, int);
|
|
89
|
+
static int (*real_socketpair)(int, int, int, int[2]);
|
|
90
|
+
static int (*real_listen)(int, int);
|
|
91
|
+
static int (*real_accept)(int, struct sockaddr *, socklen_t *);
|
|
92
|
+
static int (*real_close)(int);
|
|
93
|
+
static int (*real_read)(int, void *, size_t);
|
|
94
|
+
|
|
95
|
+
/* Per-FD bookkeeping (FDs >= 1024 are passed through unshimmed). */
|
|
96
|
+
static int is_shimmed[1024];
|
|
97
|
+
static int peer_of[1024];
|
|
98
|
+
static int wake_r[1024]; /* accept() blocks reading this */
|
|
99
|
+
static int wake_w[1024]; /* close() writes to this */
|
|
100
|
+
static int listener_fd = -1; /* FD that received listen() */
|
|
101
|
+
|
|
102
|
+
__attribute__((constructor))
|
|
103
|
+
static void init(void) {
|
|
104
|
+
real_socket = dlsym(RTLD_NEXT, "socket");
|
|
105
|
+
real_socketpair = dlsym(RTLD_NEXT, "socketpair");
|
|
106
|
+
real_listen = dlsym(RTLD_NEXT, "listen");
|
|
107
|
+
real_accept = dlsym(RTLD_NEXT, "accept");
|
|
108
|
+
real_close = dlsym(RTLD_NEXT, "close");
|
|
109
|
+
real_read = dlsym(RTLD_NEXT, "read");
|
|
110
|
+
for (int i = 0; i < 1024; i++) {
|
|
111
|
+
peer_of[i] = -1;
|
|
112
|
+
wake_r[i] = -1;
|
|
113
|
+
wake_w[i] = -1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ---- socket ---------------------------------------------------------- */
|
|
118
|
+
int socket(int domain, int type, int protocol) {
|
|
119
|
+
if (domain == AF_UNIX) {
|
|
120
|
+
int fd = real_socket(domain, type, protocol);
|
|
121
|
+
if (fd >= 0) return fd;
|
|
122
|
+
/* socket(AF_UNIX) blocked – fall back to socketpair(). */
|
|
123
|
+
int sv[2];
|
|
124
|
+
if (real_socketpair(domain, type, protocol, sv) == 0) {
|
|
125
|
+
if (sv[0] >= 0 && sv[0] < 1024) {
|
|
126
|
+
is_shimmed[sv[0]] = 1;
|
|
127
|
+
peer_of[sv[0]] = sv[1];
|
|
128
|
+
int wp[2];
|
|
129
|
+
if (pipe(wp) == 0) {
|
|
130
|
+
wake_r[sv[0]] = wp[0];
|
|
131
|
+
wake_w[sv[0]] = wp[1];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return sv[0];
|
|
135
|
+
}
|
|
136
|
+
errno = EPERM;
|
|
137
|
+
return -1;
|
|
138
|
+
}
|
|
139
|
+
return real_socket(domain, type, protocol);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* ---- listen ---------------------------------------------------------- */
|
|
143
|
+
int listen(int sockfd, int backlog) {
|
|
144
|
+
if (sockfd >= 0 && sockfd < 1024 && is_shimmed[sockfd]) {
|
|
145
|
+
listener_fd = sockfd;
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
return real_listen(sockfd, backlog);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* ---- accept ---------------------------------------------------------- */
|
|
152
|
+
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
|
|
153
|
+
if (sockfd >= 0 && sockfd < 1024 && is_shimmed[sockfd]) {
|
|
154
|
+
/* Block until close() writes to the wake pipe. */
|
|
155
|
+
if (wake_r[sockfd] >= 0) {
|
|
156
|
+
char buf;
|
|
157
|
+
real_read(wake_r[sockfd], &buf, 1);
|
|
158
|
+
}
|
|
159
|
+
errno = ECONNABORTED;
|
|
160
|
+
return -1;
|
|
161
|
+
}
|
|
162
|
+
return real_accept(sockfd, addr, addrlen);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* ---- close ----------------------------------------------------------- */
|
|
166
|
+
int close(int fd) {
|
|
167
|
+
if (fd >= 0 && fd < 1024 && is_shimmed[fd]) {
|
|
168
|
+
int was_listener = (fd == listener_fd);
|
|
169
|
+
is_shimmed[fd] = 0;
|
|
170
|
+
|
|
171
|
+
if (wake_w[fd] >= 0) { /* unblock accept() */
|
|
172
|
+
char c = 0;
|
|
173
|
+
write(wake_w[fd], &c, 1);
|
|
174
|
+
real_close(wake_w[fd]);
|
|
175
|
+
wake_w[fd] = -1;
|
|
176
|
+
}
|
|
177
|
+
if (wake_r[fd] >= 0) { real_close(wake_r[fd]); wake_r[fd] = -1; }
|
|
178
|
+
if (peer_of[fd] >= 0) { real_close(peer_of[fd]); peer_of[fd] = -1; }
|
|
179
|
+
|
|
180
|
+
if (was_listener)
|
|
181
|
+
_exit(0); /* conversion done – exit */
|
|
182
|
+
}
|
|
183
|
+
return real_close(fd);
|
|
184
|
+
}
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
if __name__ == "__main__":
|
|
190
|
+
import sys
|
|
191
|
+
result = run_soffice(sys.argv[1:])
|
|
192
|
+
sys.exit(result.returncode)
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Command line tool to validate Office document XML files against XSD schemas and tracked changes.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python validate.py <path> [--original <original_file>] [--auto-repair] [--author NAME]
|
|
6
|
+
|
|
7
|
+
The first argument can be either:
|
|
8
|
+
- An unpacked directory containing the Office document XML files
|
|
9
|
+
- A packed Office file (.docx/.pptx/.xlsx or .dotx/.potx/.xltx template) which will be unpacked to a temp directory
|
|
10
|
+
|
|
11
|
+
Auto-repair fixes:
|
|
12
|
+
- paraId/durableId values that exceed OOXML limits
|
|
13
|
+
- Missing xml:space="preserve" on w:t elements with whitespace
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import argparse
|
|
17
|
+
import sys
|
|
18
|
+
import tempfile
|
|
19
|
+
import zipfile
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
import defusedxml.ElementTree as ET
|
|
23
|
+
from defusedxml.common import DefusedXmlException
|
|
24
|
+
|
|
25
|
+
from helpers import OOXML_FAMILY, rezip, safe_extract
|
|
26
|
+
from validators import DOCXSchemaValidator, PPTXSchemaValidator, RedliningValidator
|
|
27
|
+
|
|
28
|
+
WORD_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _fail(message: str):
|
|
32
|
+
print(f"Error: {message}", file=sys.stderr)
|
|
33
|
+
sys.exit(2)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _has_tracked_changes(unpacked_dir: Path) -> bool:
|
|
37
|
+
document = unpacked_dir / "word" / "document.xml"
|
|
38
|
+
if not document.is_file():
|
|
39
|
+
return False
|
|
40
|
+
try:
|
|
41
|
+
root = ET.parse(document).getroot()
|
|
42
|
+
except (ET.ParseError, DefusedXmlException):
|
|
43
|
+
return False
|
|
44
|
+
tracked = {f"{{{WORD_NS}}}ins", f"{{{WORD_NS}}}del"}
|
|
45
|
+
return any(elem.tag in tracked for elem in root.iter())
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def main():
|
|
49
|
+
parser = argparse.ArgumentParser(description="Validate Office document XML files")
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
"path",
|
|
52
|
+
help="Path to unpacked directory or packed Office file (.docx/.pptx/.xlsx or .dotx/.potx/.xltx)",
|
|
53
|
+
)
|
|
54
|
+
parser.add_argument(
|
|
55
|
+
"--original",
|
|
56
|
+
required=False,
|
|
57
|
+
default=None,
|
|
58
|
+
help="Path to original file (.docx/.pptx/.xlsx or .dotx/.potx/.xltx). If omitted, all XSD errors are reported and redlining validation is skipped.",
|
|
59
|
+
)
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
"-v",
|
|
62
|
+
"--verbose",
|
|
63
|
+
action="store_true",
|
|
64
|
+
help="Enable verbose output",
|
|
65
|
+
)
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"--auto-repair",
|
|
68
|
+
action="store_true",
|
|
69
|
+
help="Automatically repair common issues (hex IDs, whitespace preservation). "
|
|
70
|
+
"Modifies the input in place: repairs to a packed file are written back to it.",
|
|
71
|
+
)
|
|
72
|
+
parser.add_argument(
|
|
73
|
+
"--author",
|
|
74
|
+
default=None,
|
|
75
|
+
help="The name you are redlining under. Passing it turns on the "
|
|
76
|
+
"tracked-change check: any text differing from --original without a "
|
|
77
|
+
"<w:ins>/<w:del> recording it is reported. Untracked edits carry no "
|
|
78
|
+
"author, so the check covers them whoever made them — the name marks "
|
|
79
|
+
"the run as redlining work and is not used to filter. Requires "
|
|
80
|
+
"--original; docx only.",
|
|
81
|
+
)
|
|
82
|
+
args = parser.parse_args()
|
|
83
|
+
|
|
84
|
+
if args.author is not None and not args.original:
|
|
85
|
+
_fail("--author requires --original")
|
|
86
|
+
|
|
87
|
+
path = Path(args.path)
|
|
88
|
+
if not path.exists():
|
|
89
|
+
_fail(f"{path} does not exist")
|
|
90
|
+
|
|
91
|
+
original_file = None
|
|
92
|
+
if args.original:
|
|
93
|
+
original_file = Path(args.original)
|
|
94
|
+
if not original_file.is_file():
|
|
95
|
+
_fail(f"{original_file} is not a file")
|
|
96
|
+
if original_file.suffix.lower() not in OOXML_FAMILY:
|
|
97
|
+
_fail(f"{original_file} must be one of: {', '.join(sorted(OOXML_FAMILY))}")
|
|
98
|
+
|
|
99
|
+
family = OOXML_FAMILY.get((original_file or path).suffix.lower())
|
|
100
|
+
if family is None:
|
|
101
|
+
_fail(
|
|
102
|
+
f"Cannot determine file type from {path}. Use --original or provide one of: {', '.join(sorted(OOXML_FAMILY))}."
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
if args.author is not None and family != "docx":
|
|
106
|
+
_fail(f"--author only applies to docx files, not {family}")
|
|
107
|
+
|
|
108
|
+
packed_file = None
|
|
109
|
+
temp_dir_ctx = None
|
|
110
|
+
if path.is_file() and path.suffix.lower() in OOXML_FAMILY:
|
|
111
|
+
packed_file = path
|
|
112
|
+
temp_dir_ctx = tempfile.TemporaryDirectory()
|
|
113
|
+
unpacked_dir = Path(temp_dir_ctx.name)
|
|
114
|
+
try:
|
|
115
|
+
with zipfile.ZipFile(path, "r") as zf:
|
|
116
|
+
safe_extract(zf, unpacked_dir)
|
|
117
|
+
except (zipfile.BadZipFile, ValueError, OSError) as e:
|
|
118
|
+
_fail(f"cannot unpack {path}: {e}")
|
|
119
|
+
else:
|
|
120
|
+
if not path.is_dir():
|
|
121
|
+
_fail(f"{path} is not a directory or Office file")
|
|
122
|
+
unpacked_dir = path
|
|
123
|
+
|
|
124
|
+
match family:
|
|
125
|
+
case "docx":
|
|
126
|
+
validators = [
|
|
127
|
+
DOCXSchemaValidator(unpacked_dir, original_file, verbose=args.verbose),
|
|
128
|
+
]
|
|
129
|
+
if args.author is not None:
|
|
130
|
+
validators.append(
|
|
131
|
+
RedliningValidator(unpacked_dir, original_file, verbose=args.verbose)
|
|
132
|
+
)
|
|
133
|
+
elif original_file and _has_tracked_changes(unpacked_dir):
|
|
134
|
+
print(
|
|
135
|
+
"Note: this document has tracked changes; they were not "
|
|
136
|
+
"checked against the original (pass --author to check)."
|
|
137
|
+
)
|
|
138
|
+
case "pptx":
|
|
139
|
+
validators = [
|
|
140
|
+
PPTXSchemaValidator(unpacked_dir, original_file, verbose=args.verbose),
|
|
141
|
+
]
|
|
142
|
+
case "xlsx":
|
|
143
|
+
exts = ", ".join(k for k, v in sorted(OOXML_FAMILY.items()) if v == "xlsx")
|
|
144
|
+
print(
|
|
145
|
+
f"No XSD schema validation is performed for xlsx-family files ({exts}). "
|
|
146
|
+
"For formula-error checking, use scripts/recalc.py instead."
|
|
147
|
+
)
|
|
148
|
+
sys.exit(0)
|
|
149
|
+
case _:
|
|
150
|
+
print(f"Error: Validation not supported for file type {family}")
|
|
151
|
+
sys.exit(1)
|
|
152
|
+
|
|
153
|
+
if args.auto_repair:
|
|
154
|
+
total_repairs = sum(v.repair() for v in validators)
|
|
155
|
+
if total_repairs:
|
|
156
|
+
print(f"Auto-repaired {total_repairs} issue(s)")
|
|
157
|
+
if packed_file is not None:
|
|
158
|
+
rezip(unpacked_dir, packed_file)
|
|
159
|
+
print(f"Wrote repaired file to {packed_file}")
|
|
160
|
+
|
|
161
|
+
success = all([v.validate() for v in validators])
|
|
162
|
+
|
|
163
|
+
if temp_dir_ctx is not None:
|
|
164
|
+
temp_dir_ctx.cleanup()
|
|
165
|
+
|
|
166
|
+
if success:
|
|
167
|
+
print("All validations PASSED!")
|
|
168
|
+
|
|
169
|
+
sys.exit(0 if success else 1)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if __name__ == "__main__":
|
|
173
|
+
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Validation modules for Word document processing.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .base import BaseSchemaValidator
|
|
6
|
+
from .docx import DOCXSchemaValidator
|
|
7
|
+
from .pptx import PPTXSchemaValidator
|
|
8
|
+
from .redlining import RedliningValidator
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"BaseSchemaValidator",
|
|
12
|
+
"DOCXSchemaValidator",
|
|
13
|
+
"PPTXSchemaValidator",
|
|
14
|
+
"RedliningValidator",
|
|
15
|
+
]
|