@papert-code/papert-code 0.3.95 → 0.3.96
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/README.md +13 -0
- package/dist/chunks/{chunk-Q5TJEKUL.js → chunk-HSYOWGEB.js} +1 -1
- package/dist/chunks/{chunk-KDPC3L34.js → chunk-IK4ISYCE.js} +4 -4
- package/dist/chunks/{chunk-JATIVKZP.js → chunk-KBPFDUTA.js} +55 -10
- package/dist/chunks/{chunk-DQ32BMUI.js → chunk-TNDQXJLA.js} +924 -335
- package/dist/chunks/{gemini-SUVKHYG5.js → gemini-MVJNXCFF.js} +3910 -1535
- package/dist/chunks/{openaiContentGenerator-P6VRBRRB.js → openaiContentGenerator-GTG5MK5E.js} +2 -2
- package/dist/chunks/{papertContentGenerator-E64QQV3K.js → papertContentGenerator-Q5TTXUE6.js} +3 -3
- package/dist/chunks/{server-N2U4FF55.js → server-6D3KYATG.js} +7 -1
- package/dist/cli.js +5 -4
- package/dist/sandbox-macos-permissive-proxied.sb +1 -1
- package/dist/sandbox-macos-restrictive-proxied.sb +1 -1
- package/dist/skills/algorithmic-art/SKILL.md +405 -0
- package/dist/skills/algorithmic-art/templates/generator_template.js +223 -0
- package/dist/skills/algorithmic-art/templates/viewer.html +599 -0
- package/dist/skills/brand-guidelines/SKILL.md +73 -0
- package/dist/skills/canvas-design/SKILL.md +130 -0
- package/dist/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/dist/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/dist/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/dist/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/dist/skills/doc-coauthoring/SKILL.md +375 -0
- package/dist/skills/docx/SKILL.md +481 -0
- package/dist/skills/docx/scripts/__init__.py +1 -0
- package/dist/skills/docx/scripts/accept_changes.py +135 -0
- package/dist/skills/docx/scripts/comment.py +318 -0
- package/dist/skills/docx/scripts/office/helpers/__init__.py +0 -0
- package/dist/skills/docx/scripts/office/helpers/merge_runs.py +199 -0
- package/dist/skills/docx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/dist/skills/docx/scripts/office/pack.py +159 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/dist/skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/dist/skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/dist/skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/dist/skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/dist/skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/dist/skills/docx/scripts/office/soffice.py +183 -0
- package/dist/skills/docx/scripts/office/unpack.py +132 -0
- package/dist/skills/docx/scripts/office/validate.py +111 -0
- package/dist/skills/docx/scripts/office/validators/__init__.py +15 -0
- package/dist/skills/docx/scripts/office/validators/base.py +847 -0
- package/dist/skills/docx/scripts/office/validators/docx.py +446 -0
- package/dist/skills/docx/scripts/office/validators/pptx.py +275 -0
- package/dist/skills/docx/scripts/office/validators/redlining.py +247 -0
- package/dist/skills/docx/scripts/templates/comments.xml +3 -0
- package/dist/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/dist/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/dist/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/dist/skills/docx/scripts/templates/people.xml +3 -0
- package/dist/skills/frontend-design/SKILL.md +42 -0
- package/dist/skills/internal-comms/SKILL.md +32 -0
- package/dist/skills/internal-comms/examples/3p-updates.md +47 -0
- package/dist/skills/internal-comms/examples/company-newsletter.md +65 -0
- package/dist/skills/internal-comms/examples/faq-answers.md +30 -0
- package/dist/skills/internal-comms/examples/general-comms.md +16 -0
- package/dist/skills/mcp-builder/SKILL.md +236 -0
- package/dist/skills/mcp-builder/reference/evaluation.md +602 -0
- package/dist/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/dist/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/dist/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/dist/skills/mcp-builder/scripts/connections.py +151 -0
- package/dist/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/dist/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/dist/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/dist/skills/papert-code/SKILL.md +561 -0
- package/dist/skills/pdf/SKILL.md +314 -0
- package/dist/skills/pdf/forms.md +294 -0
- package/dist/skills/pdf/reference.md +612 -0
- package/dist/skills/pdf/scripts/check_bounding_boxes.py +65 -0
- package/dist/skills/pdf/scripts/check_fillable_fields.py +11 -0
- package/dist/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
- package/dist/skills/pdf/scripts/create_validation_image.py +37 -0
- package/dist/skills/pdf/scripts/extract_form_field_info.py +122 -0
- package/dist/skills/pdf/scripts/extract_form_structure.py +115 -0
- package/dist/skills/pdf/scripts/fill_fillable_fields.py +98 -0
- package/dist/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/dist/skills/pptx/SKILL.md +232 -0
- package/dist/skills/pptx/editing.md +205 -0
- package/dist/skills/pptx/pptxgenjs.md +420 -0
- package/dist/skills/pptx/scripts/__init__.py +0 -0
- package/dist/skills/pptx/scripts/add_slide.py +195 -0
- package/dist/skills/pptx/scripts/clean.py +286 -0
- package/dist/skills/pptx/scripts/office/helpers/__init__.py +0 -0
- package/dist/skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
- package/dist/skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/dist/skills/pptx/scripts/office/pack.py +159 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/dist/skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/dist/skills/pptx/scripts/office/soffice.py +183 -0
- package/dist/skills/pptx/scripts/office/unpack.py +132 -0
- package/dist/skills/pptx/scripts/office/validate.py +111 -0
- package/dist/skills/pptx/scripts/office/validators/__init__.py +15 -0
- package/dist/skills/pptx/scripts/office/validators/base.py +847 -0
- package/dist/skills/pptx/scripts/office/validators/docx.py +446 -0
- package/dist/skills/pptx/scripts/office/validators/pptx.py +275 -0
- package/dist/skills/pptx/scripts/office/validators/redlining.py +247 -0
- package/dist/skills/pptx/scripts/thumbnail.py +289 -0
- package/dist/skills/skill-creator/SKILL.md +357 -0
- package/dist/skills/skill-creator/references/output-patterns.md +82 -0
- package/dist/skills/skill-creator/references/workflows.md +28 -0
- package/dist/skills/skill-creator/scripts/init_skill.py +303 -0
- package/dist/skills/skill-creator/scripts/package_skill.py +110 -0
- package/dist/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/dist/skills/slack-gif-creator/SKILL.md +254 -0
- package/dist/skills/slack-gif-creator/core/easing.py +234 -0
- package/dist/skills/slack-gif-creator/core/frame_composer.py +176 -0
- package/dist/skills/slack-gif-creator/core/gif_builder.py +269 -0
- package/dist/skills/slack-gif-creator/core/validators.py +136 -0
- package/dist/skills/slack-gif-creator/requirements.txt +4 -0
- package/dist/skills/theme-factory/SKILL.md +59 -0
- package/dist/skills/theme-factory/theme-showcase.pdf +0 -0
- package/dist/skills/theme-factory/themes/arctic-frost.md +19 -0
- package/dist/skills/theme-factory/themes/botanical-garden.md +19 -0
- package/dist/skills/theme-factory/themes/desert-rose.md +19 -0
- package/dist/skills/theme-factory/themes/forest-canopy.md +19 -0
- package/dist/skills/theme-factory/themes/golden-hour.md +19 -0
- package/dist/skills/theme-factory/themes/midnight-galaxy.md +19 -0
- package/dist/skills/theme-factory/themes/modern-minimalist.md +19 -0
- package/dist/skills/theme-factory/themes/ocean-depths.md +19 -0
- package/dist/skills/theme-factory/themes/sunset-boulevard.md +19 -0
- package/dist/skills/theme-factory/themes/tech-innovation.md +19 -0
- package/dist/skills/web-artifacts-builder/SKILL.md +74 -0
- package/dist/skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/dist/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -0
- package/dist/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/dist/skills/webapp-testing/SKILL.md +96 -0
- package/dist/skills/webapp-testing/examples/console_logging.py +35 -0
- package/dist/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/dist/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/dist/skills/webapp-testing/scripts/with_server.py +106 -0
- package/dist/skills/xlsx/SKILL.md +292 -0
- package/dist/skills/xlsx/scripts/office/helpers/__init__.py +0 -0
- package/dist/skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
- package/dist/skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/dist/skills/xlsx/scripts/office/pack.py +159 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/dist/skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/dist/skills/xlsx/scripts/office/soffice.py +183 -0
- package/dist/skills/xlsx/scripts/office/unpack.py +132 -0
- package/dist/skills/xlsx/scripts/office/validate.py +111 -0
- package/dist/skills/xlsx/scripts/office/validators/__init__.py +15 -0
- package/dist/skills/xlsx/scripts/office/validators/base.py +847 -0
- package/dist/skills/xlsx/scripts/office/validators/docx.py +446 -0
- package/dist/skills/xlsx/scripts/office/validators/pptx.py +275 -0
- package/dist/skills/xlsx/scripts/office/validators/redlining.py +247 -0
- package/dist/skills/xlsx/scripts/recalc.py +184 -0
- package/package.json +5 -4
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Start one or more servers, wait for them to be ready, run a command, then clean up.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
# Single server
|
|
7
|
+
python scripts/with_server.py --server "npm run dev" --port 5173 -- python automation.py
|
|
8
|
+
python scripts/with_server.py --server "npm start" --port 3000 -- python test.py
|
|
9
|
+
|
|
10
|
+
# Multiple servers
|
|
11
|
+
python scripts/with_server.py \
|
|
12
|
+
--server "cd backend && python server.py" --port 3000 \
|
|
13
|
+
--server "cd frontend && npm run dev" --port 5173 \
|
|
14
|
+
-- python test.py
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import subprocess
|
|
18
|
+
import socket
|
|
19
|
+
import time
|
|
20
|
+
import sys
|
|
21
|
+
import argparse
|
|
22
|
+
|
|
23
|
+
def is_server_ready(port, timeout=30):
|
|
24
|
+
"""Wait for server to be ready by polling the port."""
|
|
25
|
+
start_time = time.time()
|
|
26
|
+
while time.time() - start_time < timeout:
|
|
27
|
+
try:
|
|
28
|
+
with socket.create_connection(('localhost', port), timeout=1):
|
|
29
|
+
return True
|
|
30
|
+
except (socket.error, ConnectionRefusedError):
|
|
31
|
+
time.sleep(0.5)
|
|
32
|
+
return False
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def main():
|
|
36
|
+
parser = argparse.ArgumentParser(description='Run command with one or more servers')
|
|
37
|
+
parser.add_argument('--server', action='append', dest='servers', required=True, help='Server command (can be repeated)')
|
|
38
|
+
parser.add_argument('--port', action='append', dest='ports', type=int, required=True, help='Port for each server (must match --server count)')
|
|
39
|
+
parser.add_argument('--timeout', type=int, default=30, help='Timeout in seconds per server (default: 30)')
|
|
40
|
+
parser.add_argument('command', nargs=argparse.REMAINDER, help='Command to run after server(s) ready')
|
|
41
|
+
|
|
42
|
+
args = parser.parse_args()
|
|
43
|
+
|
|
44
|
+
# Remove the '--' separator if present
|
|
45
|
+
if args.command and args.command[0] == '--':
|
|
46
|
+
args.command = args.command[1:]
|
|
47
|
+
|
|
48
|
+
if not args.command:
|
|
49
|
+
print("Error: No command specified to run")
|
|
50
|
+
sys.exit(1)
|
|
51
|
+
|
|
52
|
+
# Parse server configurations
|
|
53
|
+
if len(args.servers) != len(args.ports):
|
|
54
|
+
print("Error: Number of --server and --port arguments must match")
|
|
55
|
+
sys.exit(1)
|
|
56
|
+
|
|
57
|
+
servers = []
|
|
58
|
+
for cmd, port in zip(args.servers, args.ports):
|
|
59
|
+
servers.append({'cmd': cmd, 'port': port})
|
|
60
|
+
|
|
61
|
+
server_processes = []
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
# Start all servers
|
|
65
|
+
for i, server in enumerate(servers):
|
|
66
|
+
print(f"Starting server {i+1}/{len(servers)}: {server['cmd']}")
|
|
67
|
+
|
|
68
|
+
# Use shell=True to support commands with cd and &&
|
|
69
|
+
process = subprocess.Popen(
|
|
70
|
+
server['cmd'],
|
|
71
|
+
shell=True,
|
|
72
|
+
stdout=subprocess.PIPE,
|
|
73
|
+
stderr=subprocess.PIPE
|
|
74
|
+
)
|
|
75
|
+
server_processes.append(process)
|
|
76
|
+
|
|
77
|
+
# Wait for this server to be ready
|
|
78
|
+
print(f"Waiting for server on port {server['port']}...")
|
|
79
|
+
if not is_server_ready(server['port'], timeout=args.timeout):
|
|
80
|
+
raise RuntimeError(f"Server failed to start on port {server['port']} within {args.timeout}s")
|
|
81
|
+
|
|
82
|
+
print(f"Server ready on port {server['port']}")
|
|
83
|
+
|
|
84
|
+
print(f"\nAll {len(servers)} server(s) ready")
|
|
85
|
+
|
|
86
|
+
# Run the command
|
|
87
|
+
print(f"Running: {' '.join(args.command)}\n")
|
|
88
|
+
result = subprocess.run(args.command)
|
|
89
|
+
sys.exit(result.returncode)
|
|
90
|
+
|
|
91
|
+
finally:
|
|
92
|
+
# Clean up all servers
|
|
93
|
+
print(f"\nStopping {len(server_processes)} server(s)...")
|
|
94
|
+
for i, process in enumerate(server_processes):
|
|
95
|
+
try:
|
|
96
|
+
process.terminate()
|
|
97
|
+
process.wait(timeout=5)
|
|
98
|
+
except subprocess.TimeoutExpired:
|
|
99
|
+
process.kill()
|
|
100
|
+
process.wait()
|
|
101
|
+
print(f"Server {i+1} stopped")
|
|
102
|
+
print("All servers stopped")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
if __name__ == '__main__':
|
|
106
|
+
main()
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xlsx
|
|
3
|
+
description: "Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \"the xlsx in my downloads\") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved."
|
|
4
|
+
license: Proprietary. LICENSE.txt has complete terms
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Requirements for Outputs
|
|
8
|
+
|
|
9
|
+
## All Excel files
|
|
10
|
+
|
|
11
|
+
### Professional Font
|
|
12
|
+
- Use a consistent, professional font (e.g., Arial, Times New Roman) for all deliverables unless otherwise instructed by the user
|
|
13
|
+
|
|
14
|
+
### Zero Formula Errors
|
|
15
|
+
- Every Excel model MUST be delivered with ZERO formula errors (#REF!, #DIV/0!, #VALUE!, #N/A, #NAME?)
|
|
16
|
+
|
|
17
|
+
### Preserve Existing Templates (when updating templates)
|
|
18
|
+
- Study and EXACTLY match existing format, style, and conventions when modifying files
|
|
19
|
+
- Never impose standardized formatting on files with established patterns
|
|
20
|
+
- Existing template conventions ALWAYS override these guidelines
|
|
21
|
+
|
|
22
|
+
## Financial models
|
|
23
|
+
|
|
24
|
+
### Color Coding Standards
|
|
25
|
+
Unless otherwise stated by the user or existing template
|
|
26
|
+
|
|
27
|
+
#### Industry-Standard Color Conventions
|
|
28
|
+
- **Blue text (RGB: 0,0,255)**: Hardcoded inputs, and numbers users will change for scenarios
|
|
29
|
+
- **Black text (RGB: 0,0,0)**: ALL formulas and calculations
|
|
30
|
+
- **Green text (RGB: 0,128,0)**: Links pulling from other worksheets within same workbook
|
|
31
|
+
- **Red text (RGB: 255,0,0)**: External links to other files
|
|
32
|
+
- **Yellow background (RGB: 255,255,0)**: Key assumptions needing attention or cells that need to be updated
|
|
33
|
+
|
|
34
|
+
### Number Formatting Standards
|
|
35
|
+
|
|
36
|
+
#### Required Format Rules
|
|
37
|
+
- **Years**: Format as text strings (e.g., "2024" not "2,024")
|
|
38
|
+
- **Currency**: Use $#,##0 format; ALWAYS specify units in headers ("Revenue ($mm)")
|
|
39
|
+
- **Zeros**: Use number formatting to make all zeros "-", including percentages (e.g., "$#,##0;($#,##0);-")
|
|
40
|
+
- **Percentages**: Default to 0.0% format (one decimal)
|
|
41
|
+
- **Multiples**: Format as 0.0x for valuation multiples (EV/EBITDA, P/E)
|
|
42
|
+
- **Negative numbers**: Use parentheses (123) not minus -123
|
|
43
|
+
|
|
44
|
+
### Formula Construction Rules
|
|
45
|
+
|
|
46
|
+
#### Assumptions Placement
|
|
47
|
+
- Place ALL assumptions (growth rates, margins, multiples, etc.) in separate assumption cells
|
|
48
|
+
- Use cell references instead of hardcoded values in formulas
|
|
49
|
+
- Example: Use =B5*(1+$B$6) instead of =B5*1.05
|
|
50
|
+
|
|
51
|
+
#### Formula Error Prevention
|
|
52
|
+
- Verify all cell references are correct
|
|
53
|
+
- Check for off-by-one errors in ranges
|
|
54
|
+
- Ensure consistent formulas across all projection periods
|
|
55
|
+
- Test with edge cases (zero values, negative numbers)
|
|
56
|
+
- Verify no unintended circular references
|
|
57
|
+
|
|
58
|
+
#### Documentation Requirements for Hardcodes
|
|
59
|
+
- Comment or in cells beside (if end of table). Format: "Source: [System/Document], [Date], [Specific Reference], [URL if applicable]"
|
|
60
|
+
- Examples:
|
|
61
|
+
- "Source: Company 10-K, FY2024, Page 45, Revenue Note, [SEC EDGAR URL]"
|
|
62
|
+
- "Source: Company 10-Q, Q2 2025, Exhibit 99.1, [SEC EDGAR URL]"
|
|
63
|
+
- "Source: Bloomberg Terminal, 8/15/2025, AAPL US Equity"
|
|
64
|
+
- "Source: FactSet, 8/20/2025, Consensus Estimates Screen"
|
|
65
|
+
|
|
66
|
+
# XLSX creation, editing, and analysis
|
|
67
|
+
|
|
68
|
+
## Overview
|
|
69
|
+
|
|
70
|
+
A user may ask you to create, edit, or analyze the contents of an .xlsx file. You have different tools and workflows available for different tasks.
|
|
71
|
+
|
|
72
|
+
## Important Requirements
|
|
73
|
+
|
|
74
|
+
**LibreOffice Required for Formula Recalculation**: You can assume LibreOffice is installed for recalculating formula values using the `scripts/recalc.py` script. The script automatically configures LibreOffice on first run, including in sandboxed environments where Unix sockets are restricted (handled by `scripts/office/soffice.py`)
|
|
75
|
+
|
|
76
|
+
## Reading and analyzing data
|
|
77
|
+
|
|
78
|
+
### Data analysis with pandas
|
|
79
|
+
For data analysis, visualization, and basic operations, use **pandas** which provides powerful data manipulation capabilities:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import pandas as pd
|
|
83
|
+
|
|
84
|
+
# Read Excel
|
|
85
|
+
df = pd.read_excel('file.xlsx') # Default: first sheet
|
|
86
|
+
all_sheets = pd.read_excel('file.xlsx', sheet_name=None) # All sheets as dict
|
|
87
|
+
|
|
88
|
+
# Analyze
|
|
89
|
+
df.head() # Preview data
|
|
90
|
+
df.info() # Column info
|
|
91
|
+
df.describe() # Statistics
|
|
92
|
+
|
|
93
|
+
# Write Excel
|
|
94
|
+
df.to_excel('output.xlsx', index=False)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Excel File Workflows
|
|
98
|
+
|
|
99
|
+
## CRITICAL: Use Formulas, Not Hardcoded Values
|
|
100
|
+
|
|
101
|
+
**Always use Excel formulas instead of calculating values in Python and hardcoding them.** This ensures the spreadsheet remains dynamic and updateable.
|
|
102
|
+
|
|
103
|
+
### ❌ WRONG - Hardcoding Calculated Values
|
|
104
|
+
```python
|
|
105
|
+
# Bad: Calculating in Python and hardcoding result
|
|
106
|
+
total = df['Sales'].sum()
|
|
107
|
+
sheet['B10'] = total # Hardcodes 5000
|
|
108
|
+
|
|
109
|
+
# Bad: Computing growth rate in Python
|
|
110
|
+
growth = (df.iloc[-1]['Revenue'] - df.iloc[0]['Revenue']) / df.iloc[0]['Revenue']
|
|
111
|
+
sheet['C5'] = growth # Hardcodes 0.15
|
|
112
|
+
|
|
113
|
+
# Bad: Python calculation for average
|
|
114
|
+
avg = sum(values) / len(values)
|
|
115
|
+
sheet['D20'] = avg # Hardcodes 42.5
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### ✅ CORRECT - Using Excel Formulas
|
|
119
|
+
```python
|
|
120
|
+
# Good: Let Excel calculate the sum
|
|
121
|
+
sheet['B10'] = '=SUM(B2:B9)'
|
|
122
|
+
|
|
123
|
+
# Good: Growth rate as Excel formula
|
|
124
|
+
sheet['C5'] = '=(C4-C2)/C2'
|
|
125
|
+
|
|
126
|
+
# Good: Average using Excel function
|
|
127
|
+
sheet['D20'] = '=AVERAGE(D2:D19)'
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This applies to ALL calculations - totals, percentages, ratios, differences, etc. The spreadsheet should be able to recalculate when source data changes.
|
|
131
|
+
|
|
132
|
+
## Common Workflow
|
|
133
|
+
1. **Choose tool**: pandas for data, openpyxl for formulas/formatting
|
|
134
|
+
2. **Create/Load**: Create new workbook or load existing file
|
|
135
|
+
3. **Modify**: Add/edit data, formulas, and formatting
|
|
136
|
+
4. **Save**: Write to file
|
|
137
|
+
5. **Recalculate formulas (MANDATORY IF USING FORMULAS)**: Use the scripts/recalc.py script
|
|
138
|
+
```bash
|
|
139
|
+
python scripts/recalc.py output.xlsx
|
|
140
|
+
```
|
|
141
|
+
6. **Verify and fix any errors**:
|
|
142
|
+
- The script returns JSON with error details
|
|
143
|
+
- If `status` is `errors_found`, check `error_summary` for specific error types and locations
|
|
144
|
+
- Fix the identified errors and recalculate again
|
|
145
|
+
- Common errors to fix:
|
|
146
|
+
- `#REF!`: Invalid cell references
|
|
147
|
+
- `#DIV/0!`: Division by zero
|
|
148
|
+
- `#VALUE!`: Wrong data type in formula
|
|
149
|
+
- `#NAME?`: Unrecognized formula name
|
|
150
|
+
|
|
151
|
+
### Creating new Excel files
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
# Using openpyxl for formulas and formatting
|
|
155
|
+
from openpyxl import Workbook
|
|
156
|
+
from openpyxl.styles import Font, PatternFill, Alignment
|
|
157
|
+
|
|
158
|
+
wb = Workbook()
|
|
159
|
+
sheet = wb.active
|
|
160
|
+
|
|
161
|
+
# Add data
|
|
162
|
+
sheet['A1'] = 'Hello'
|
|
163
|
+
sheet['B1'] = 'World'
|
|
164
|
+
sheet.append(['Row', 'of', 'data'])
|
|
165
|
+
|
|
166
|
+
# Add formula
|
|
167
|
+
sheet['B2'] = '=SUM(A1:A10)'
|
|
168
|
+
|
|
169
|
+
# Formatting
|
|
170
|
+
sheet['A1'].font = Font(bold=True, color='FF0000')
|
|
171
|
+
sheet['A1'].fill = PatternFill('solid', start_color='FFFF00')
|
|
172
|
+
sheet['A1'].alignment = Alignment(horizontal='center')
|
|
173
|
+
|
|
174
|
+
# Column width
|
|
175
|
+
sheet.column_dimensions['A'].width = 20
|
|
176
|
+
|
|
177
|
+
wb.save('output.xlsx')
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Editing existing Excel files
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
# Using openpyxl to preserve formulas and formatting
|
|
184
|
+
from openpyxl import load_workbook
|
|
185
|
+
|
|
186
|
+
# Load existing file
|
|
187
|
+
wb = load_workbook('existing.xlsx')
|
|
188
|
+
sheet = wb.active # or wb['SheetName'] for specific sheet
|
|
189
|
+
|
|
190
|
+
# Working with multiple sheets
|
|
191
|
+
for sheet_name in wb.sheetnames:
|
|
192
|
+
sheet = wb[sheet_name]
|
|
193
|
+
print(f"Sheet: {sheet_name}")
|
|
194
|
+
|
|
195
|
+
# Modify cells
|
|
196
|
+
sheet['A1'] = 'New Value'
|
|
197
|
+
sheet.insert_rows(2) # Insert row at position 2
|
|
198
|
+
sheet.delete_cols(3) # Delete column 3
|
|
199
|
+
|
|
200
|
+
# Add new sheet
|
|
201
|
+
new_sheet = wb.create_sheet('NewSheet')
|
|
202
|
+
new_sheet['A1'] = 'Data'
|
|
203
|
+
|
|
204
|
+
wb.save('modified.xlsx')
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Recalculating formulas
|
|
208
|
+
|
|
209
|
+
Excel files created or modified by openpyxl contain formulas as strings but not calculated values. Use the provided `scripts/recalc.py` script to recalculate formulas:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
python scripts/recalc.py <excel_file> [timeout_seconds]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Example:
|
|
216
|
+
```bash
|
|
217
|
+
python scripts/recalc.py output.xlsx 30
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The script:
|
|
221
|
+
- Automatically sets up LibreOffice macro on first run
|
|
222
|
+
- Recalculates all formulas in all sheets
|
|
223
|
+
- Scans ALL cells for Excel errors (#REF!, #DIV/0!, etc.)
|
|
224
|
+
- Returns JSON with detailed error locations and counts
|
|
225
|
+
- Works on both Linux and macOS
|
|
226
|
+
|
|
227
|
+
## Formula Verification Checklist
|
|
228
|
+
|
|
229
|
+
Quick checks to ensure formulas work correctly:
|
|
230
|
+
|
|
231
|
+
### Essential Verification
|
|
232
|
+
- [ ] **Test 2-3 sample references**: Verify they pull correct values before building full model
|
|
233
|
+
- [ ] **Column mapping**: Confirm Excel columns match (e.g., column 64 = BL, not BK)
|
|
234
|
+
- [ ] **Row offset**: Remember Excel rows are 1-indexed (DataFrame row 5 = Excel row 6)
|
|
235
|
+
|
|
236
|
+
### Common Pitfalls
|
|
237
|
+
- [ ] **NaN handling**: Check for null values with `pd.notna()`
|
|
238
|
+
- [ ] **Far-right columns**: FY data often in columns 50+
|
|
239
|
+
- [ ] **Multiple matches**: Search all occurrences, not just first
|
|
240
|
+
- [ ] **Division by zero**: Check denominators before using `/` in formulas (#DIV/0!)
|
|
241
|
+
- [ ] **Wrong references**: Verify all cell references point to intended cells (#REF!)
|
|
242
|
+
- [ ] **Cross-sheet references**: Use correct format (Sheet1!A1) for linking sheets
|
|
243
|
+
|
|
244
|
+
### Formula Testing Strategy
|
|
245
|
+
- [ ] **Start small**: Test formulas on 2-3 cells before applying broadly
|
|
246
|
+
- [ ] **Verify dependencies**: Check all cells referenced in formulas exist
|
|
247
|
+
- [ ] **Test edge cases**: Include zero, negative, and very large values
|
|
248
|
+
|
|
249
|
+
### Interpreting scripts/recalc.py Output
|
|
250
|
+
The script returns JSON with error details:
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"status": "success", // or "errors_found"
|
|
254
|
+
"total_errors": 0, // Total error count
|
|
255
|
+
"total_formulas": 42, // Number of formulas in file
|
|
256
|
+
"error_summary": { // Only present if errors found
|
|
257
|
+
"#REF!": {
|
|
258
|
+
"count": 2,
|
|
259
|
+
"locations": ["Sheet1!B5", "Sheet1!C10"]
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Best Practices
|
|
266
|
+
|
|
267
|
+
### Library Selection
|
|
268
|
+
- **pandas**: Best for data analysis, bulk operations, and simple data export
|
|
269
|
+
- **openpyxl**: Best for complex formatting, formulas, and Excel-specific features
|
|
270
|
+
|
|
271
|
+
### Working with openpyxl
|
|
272
|
+
- Cell indices are 1-based (row=1, column=1 refers to cell A1)
|
|
273
|
+
- Use `data_only=True` to read calculated values: `load_workbook('file.xlsx', data_only=True)`
|
|
274
|
+
- **Warning**: If opened with `data_only=True` and saved, formulas are replaced with values and permanently lost
|
|
275
|
+
- For large files: Use `read_only=True` for reading or `write_only=True` for writing
|
|
276
|
+
- Formulas are preserved but not evaluated - use scripts/recalc.py to update values
|
|
277
|
+
|
|
278
|
+
### Working with pandas
|
|
279
|
+
- Specify data types to avoid inference issues: `pd.read_excel('file.xlsx', dtype={'id': str})`
|
|
280
|
+
- For large files, read specific columns: `pd.read_excel('file.xlsx', usecols=['A', 'C', 'E'])`
|
|
281
|
+
- Handle dates properly: `pd.read_excel('file.xlsx', parse_dates=['date_column'])`
|
|
282
|
+
|
|
283
|
+
## Code Style Guidelines
|
|
284
|
+
**IMPORTANT**: When generating Python code for Excel operations:
|
|
285
|
+
- Write minimal, concise Python code without unnecessary comments
|
|
286
|
+
- Avoid verbose variable names and redundant operations
|
|
287
|
+
- Avoid unnecessary print statements
|
|
288
|
+
|
|
289
|
+
**For Excel files themselves**:
|
|
290
|
+
- Add comments to cells with complex formulas or important assumptions
|
|
291
|
+
- Document data sources for hardcoded values
|
|
292
|
+
- Include notes for key calculations and model sections
|
|
File without changes
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""Merge adjacent runs with identical formatting in DOCX.
|
|
2
|
+
|
|
3
|
+
Merges adjacent <w:r> elements that have identical <w:rPr> properties.
|
|
4
|
+
Works on runs in paragraphs and inside tracked changes (<w:ins>, <w:del>).
|
|
5
|
+
|
|
6
|
+
Also:
|
|
7
|
+
- Removes rsid attributes from runs (revision metadata that doesn't affect rendering)
|
|
8
|
+
- Removes proofErr elements (spell/grammar markers that block merging)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
import defusedxml.minidom
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def merge_runs(input_dir: str) -> tuple[int, str]:
|
|
17
|
+
doc_xml = Path(input_dir) / "word" / "document.xml"
|
|
18
|
+
|
|
19
|
+
if not doc_xml.exists():
|
|
20
|
+
return 0, f"Error: {doc_xml} not found"
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
dom = defusedxml.minidom.parseString(doc_xml.read_text(encoding="utf-8"))
|
|
24
|
+
root = dom.documentElement
|
|
25
|
+
|
|
26
|
+
_remove_elements(root, "proofErr")
|
|
27
|
+
_strip_run_rsid_attrs(root)
|
|
28
|
+
|
|
29
|
+
containers = {run.parentNode for run in _find_elements(root, "r")}
|
|
30
|
+
|
|
31
|
+
merge_count = 0
|
|
32
|
+
for container in containers:
|
|
33
|
+
merge_count += _merge_runs_in(container)
|
|
34
|
+
|
|
35
|
+
doc_xml.write_bytes(dom.toxml(encoding="UTF-8"))
|
|
36
|
+
return merge_count, f"Merged {merge_count} runs"
|
|
37
|
+
|
|
38
|
+
except Exception as e:
|
|
39
|
+
return 0, f"Error: {e}"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _find_elements(root, tag: str) -> list:
|
|
45
|
+
results = []
|
|
46
|
+
|
|
47
|
+
def traverse(node):
|
|
48
|
+
if node.nodeType == node.ELEMENT_NODE:
|
|
49
|
+
name = node.localName or node.tagName
|
|
50
|
+
if name == tag or name.endswith(f":{tag}"):
|
|
51
|
+
results.append(node)
|
|
52
|
+
for child in node.childNodes:
|
|
53
|
+
traverse(child)
|
|
54
|
+
|
|
55
|
+
traverse(root)
|
|
56
|
+
return results
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _get_child(parent, tag: str):
|
|
60
|
+
for child in parent.childNodes:
|
|
61
|
+
if child.nodeType == child.ELEMENT_NODE:
|
|
62
|
+
name = child.localName or child.tagName
|
|
63
|
+
if name == tag or name.endswith(f":{tag}"):
|
|
64
|
+
return child
|
|
65
|
+
return None
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _get_children(parent, tag: str) -> list:
|
|
69
|
+
results = []
|
|
70
|
+
for child in parent.childNodes:
|
|
71
|
+
if child.nodeType == child.ELEMENT_NODE:
|
|
72
|
+
name = child.localName or child.tagName
|
|
73
|
+
if name == tag or name.endswith(f":{tag}"):
|
|
74
|
+
results.append(child)
|
|
75
|
+
return results
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _is_adjacent(elem1, elem2) -> bool:
|
|
79
|
+
node = elem1.nextSibling
|
|
80
|
+
while node:
|
|
81
|
+
if node == elem2:
|
|
82
|
+
return True
|
|
83
|
+
if node.nodeType == node.ELEMENT_NODE:
|
|
84
|
+
return False
|
|
85
|
+
if node.nodeType == node.TEXT_NODE and node.data.strip():
|
|
86
|
+
return False
|
|
87
|
+
node = node.nextSibling
|
|
88
|
+
return False
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _remove_elements(root, tag: str):
|
|
94
|
+
for elem in _find_elements(root, tag):
|
|
95
|
+
if elem.parentNode:
|
|
96
|
+
elem.parentNode.removeChild(elem)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _strip_run_rsid_attrs(root):
|
|
100
|
+
for run in _find_elements(root, "r"):
|
|
101
|
+
for attr in list(run.attributes.values()):
|
|
102
|
+
if "rsid" in attr.name.lower():
|
|
103
|
+
run.removeAttribute(attr.name)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _merge_runs_in(container) -> int:
|
|
109
|
+
merge_count = 0
|
|
110
|
+
run = _first_child_run(container)
|
|
111
|
+
|
|
112
|
+
while run:
|
|
113
|
+
while True:
|
|
114
|
+
next_elem = _next_element_sibling(run)
|
|
115
|
+
if next_elem and _is_run(next_elem) and _can_merge(run, next_elem):
|
|
116
|
+
_merge_run_content(run, next_elem)
|
|
117
|
+
container.removeChild(next_elem)
|
|
118
|
+
merge_count += 1
|
|
119
|
+
else:
|
|
120
|
+
break
|
|
121
|
+
|
|
122
|
+
_consolidate_text(run)
|
|
123
|
+
run = _next_sibling_run(run)
|
|
124
|
+
|
|
125
|
+
return merge_count
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _first_child_run(container):
|
|
129
|
+
for child in container.childNodes:
|
|
130
|
+
if child.nodeType == child.ELEMENT_NODE and _is_run(child):
|
|
131
|
+
return child
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def _next_element_sibling(node):
|
|
136
|
+
sibling = node.nextSibling
|
|
137
|
+
while sibling:
|
|
138
|
+
if sibling.nodeType == sibling.ELEMENT_NODE:
|
|
139
|
+
return sibling
|
|
140
|
+
sibling = sibling.nextSibling
|
|
141
|
+
return None
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _next_sibling_run(node):
|
|
145
|
+
sibling = node.nextSibling
|
|
146
|
+
while sibling:
|
|
147
|
+
if sibling.nodeType == sibling.ELEMENT_NODE:
|
|
148
|
+
if _is_run(sibling):
|
|
149
|
+
return sibling
|
|
150
|
+
sibling = sibling.nextSibling
|
|
151
|
+
return None
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _is_run(node) -> bool:
|
|
155
|
+
name = node.localName or node.tagName
|
|
156
|
+
return name == "r" or name.endswith(":r")
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _can_merge(run1, run2) -> bool:
|
|
160
|
+
rpr1 = _get_child(run1, "rPr")
|
|
161
|
+
rpr2 = _get_child(run2, "rPr")
|
|
162
|
+
|
|
163
|
+
if (rpr1 is None) != (rpr2 is None):
|
|
164
|
+
return False
|
|
165
|
+
if rpr1 is None:
|
|
166
|
+
return True
|
|
167
|
+
return rpr1.toxml() == rpr2.toxml()
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _merge_run_content(target, source):
|
|
171
|
+
for child in list(source.childNodes):
|
|
172
|
+
if child.nodeType == child.ELEMENT_NODE:
|
|
173
|
+
name = child.localName or child.tagName
|
|
174
|
+
if name != "rPr" and not name.endswith(":rPr"):
|
|
175
|
+
target.appendChild(child)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _consolidate_text(run):
|
|
179
|
+
t_elements = _get_children(run, "t")
|
|
180
|
+
|
|
181
|
+
for i in range(len(t_elements) - 1, 0, -1):
|
|
182
|
+
curr, prev = t_elements[i], t_elements[i - 1]
|
|
183
|
+
|
|
184
|
+
if _is_adjacent(prev, curr):
|
|
185
|
+
prev_text = prev.firstChild.data if prev.firstChild else ""
|
|
186
|
+
curr_text = curr.firstChild.data if curr.firstChild else ""
|
|
187
|
+
merged = prev_text + curr_text
|
|
188
|
+
|
|
189
|
+
if prev.firstChild:
|
|
190
|
+
prev.firstChild.data = merged
|
|
191
|
+
else:
|
|
192
|
+
prev.appendChild(run.ownerDocument.createTextNode(merged))
|
|
193
|
+
|
|
194
|
+
if merged.startswith(" ") or merged.endswith(" "):
|
|
195
|
+
prev.setAttribute("xml:space", "preserve")
|
|
196
|
+
elif prev.hasAttribute("xml:space"):
|
|
197
|
+
prev.removeAttribute("xml:space")
|
|
198
|
+
|
|
199
|
+
run.removeChild(curr)
|