docagent-cli 0.0.35__py3-none-any.whl
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.
- docagent_cli/__init__.py +36 -0
- docagent_cli/__main__.py +6 -0
- docagent_cli/_ask_user_types.py +90 -0
- docagent_cli/_cli_context.py +27 -0
- docagent_cli/_debug.py +52 -0
- docagent_cli/_env_vars.py +56 -0
- docagent_cli/_server_config.py +352 -0
- docagent_cli/_session_stats.py +114 -0
- docagent_cli/_testing_models.py +144 -0
- docagent_cli/_version.py +17 -0
- docagent_cli/agent.py +1193 -0
- docagent_cli/app.py +4979 -0
- docagent_cli/app.tcss +283 -0
- docagent_cli/ask_user.py +301 -0
- docagent_cli/built_in_skills/__init__.py +5 -0
- docagent_cli/built_in_skills/doc-coauthoring/SKILL.md +375 -0
- docagent_cli/built_in_skills/docx/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/docx/SKILL.md +590 -0
- docagent_cli/built_in_skills/docx/scripts/__init__.py +1 -0
- docagent_cli/built_in_skills/docx/scripts/accept_changes.py +135 -0
- docagent_cli/built_in_skills/docx/scripts/comment.py +318 -0
- docagent_cli/built_in_skills/docx/scripts/office/helpers/__init__.py +0 -0
- docagent_cli/built_in_skills/docx/scripts/office/helpers/merge_runs.py +199 -0
- docagent_cli/built_in_skills/docx/scripts/office/helpers/simplify_redlines.py +197 -0
- docagent_cli/built_in_skills/docx/scripts/office/pack.py +159 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- docagent_cli/built_in_skills/docx/scripts/office/soffice.py +183 -0
- docagent_cli/built_in_skills/docx/scripts/office/unpack.py +132 -0
- docagent_cli/built_in_skills/docx/scripts/office/validate.py +111 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/__init__.py +15 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/base.py +847 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/docx.py +446 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/pptx.py +275 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/redlining.py +247 -0
- docagent_cli/built_in_skills/docx/scripts/templates/comments.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/commentsExtended.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/commentsIds.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/people.xml +3 -0
- docagent_cli/built_in_skills/pdf/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/pdf/SKILL.md +314 -0
- docagent_cli/built_in_skills/pdf/forms.md +294 -0
- docagent_cli/built_in_skills/pdf/reference.md +612 -0
- docagent_cli/built_in_skills/pdf/scripts/check_bounding_boxes.py +65 -0
- docagent_cli/built_in_skills/pdf/scripts/check_fillable_fields.py +11 -0
- docagent_cli/built_in_skills/pdf/scripts/convert_pdf_to_images.py +33 -0
- docagent_cli/built_in_skills/pdf/scripts/create_validation_image.py +37 -0
- docagent_cli/built_in_skills/pdf/scripts/extract_form_field_info.py +122 -0
- docagent_cli/built_in_skills/pdf/scripts/extract_form_structure.py +115 -0
- docagent_cli/built_in_skills/pdf/scripts/fill_fillable_fields.py +98 -0
- docagent_cli/built_in_skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- docagent_cli/built_in_skills/pptx/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/pptx/SKILL.md +232 -0
- docagent_cli/built_in_skills/pptx/editing.md +205 -0
- docagent_cli/built_in_skills/pptx/pptxgenjs.md +420 -0
- docagent_cli/built_in_skills/pptx/scripts/__init__.py +0 -0
- docagent_cli/built_in_skills/pptx/scripts/add_slide.py +195 -0
- docagent_cli/built_in_skills/pptx/scripts/clean.py +286 -0
- docagent_cli/built_in_skills/pptx/scripts/office/helpers/__init__.py +0 -0
- docagent_cli/built_in_skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
- docagent_cli/built_in_skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
- docagent_cli/built_in_skills/pptx/scripts/office/pack.py +159 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- docagent_cli/built_in_skills/pptx/scripts/office/soffice.py +183 -0
- docagent_cli/built_in_skills/pptx/scripts/office/unpack.py +132 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validate.py +111 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/__init__.py +15 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/base.py +847 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/docx.py +446 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/pptx.py +275 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/redlining.py +247 -0
- docagent_cli/built_in_skills/pptx/scripts/thumbnail.py +289 -0
- docagent_cli/built_in_skills/remember/SKILL.md +118 -0
- docagent_cli/built_in_skills/skill-creator/LICENSE.txt +202 -0
- docagent_cli/built_in_skills/skill-creator/SKILL.md +485 -0
- docagent_cli/built_in_skills/skill-creator/agents/analyzer.md +274 -0
- docagent_cli/built_in_skills/skill-creator/agents/comparator.md +202 -0
- docagent_cli/built_in_skills/skill-creator/agents/grader.md +223 -0
- docagent_cli/built_in_skills/skill-creator/assets/eval_review.html +146 -0
- docagent_cli/built_in_skills/skill-creator/eval-viewer/generate_review.py +471 -0
- docagent_cli/built_in_skills/skill-creator/eval-viewer/viewer.html +1325 -0
- docagent_cli/built_in_skills/skill-creator/references/schemas.md +430 -0
- docagent_cli/built_in_skills/skill-creator/scripts/__init__.py +0 -0
- docagent_cli/built_in_skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- docagent_cli/built_in_skills/skill-creator/scripts/generate_report.py +326 -0
- docagent_cli/built_in_skills/skill-creator/scripts/improve_description.py +247 -0
- docagent_cli/built_in_skills/skill-creator/scripts/package_skill.py +136 -0
- docagent_cli/built_in_skills/skill-creator/scripts/quick_validate.py +103 -0
- docagent_cli/built_in_skills/skill-creator/scripts/run_eval.py +310 -0
- docagent_cli/built_in_skills/skill-creator/scripts/run_loop.py +328 -0
- docagent_cli/built_in_skills/skill-creator/scripts/utils.py +47 -0
- docagent_cli/built_in_skills/theme-factory/LICENSE.txt +202 -0
- docagent_cli/built_in_skills/theme-factory/SKILL.md +59 -0
- docagent_cli/built_in_skills/theme-factory/theme-showcase.pdf +0 -0
- docagent_cli/built_in_skills/theme-factory/themes/arctic-frost.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/botanical-garden.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/desert-rose.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/forest-canopy.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/golden-hour.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/midnight-galaxy.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/modern-minimalist.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/ocean-depths.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/sunset-boulevard.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/tech-innovation.md +19 -0
- docagent_cli/built_in_skills/xlsx/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/xlsx/SKILL.md +292 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/helpers/__init__.py +0 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/pack.py +159 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/soffice.py +183 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/unpack.py +132 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validate.py +111 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/__init__.py +15 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/base.py +847 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/docx.py +446 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/pptx.py +275 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/redlining.py +247 -0
- docagent_cli/built_in_skills/xlsx/scripts/recalc.py +184 -0
- docagent_cli/clipboard.py +128 -0
- docagent_cli/command_registry.py +284 -0
- docagent_cli/config.py +2418 -0
- docagent_cli/configurable_model.py +162 -0
- docagent_cli/default_agent_prompt.md +12 -0
- docagent_cli/editor.py +142 -0
- docagent_cli/file_ops.py +473 -0
- docagent_cli/formatting.py +28 -0
- docagent_cli/hooks.py +206 -0
- docagent_cli/input.py +787 -0
- docagent_cli/integrations/__init__.py +1 -0
- docagent_cli/integrations/sandbox_factory.py +873 -0
- docagent_cli/integrations/sandbox_provider.py +71 -0
- docagent_cli/local_context.py +718 -0
- docagent_cli/main.py +1641 -0
- docagent_cli/mcp_tools.py +707 -0
- docagent_cli/mcp_trust.py +168 -0
- docagent_cli/media_utils.py +478 -0
- docagent_cli/model_config.py +1620 -0
- docagent_cli/non_interactive.py +948 -0
- docagent_cli/offload.py +371 -0
- docagent_cli/output.py +69 -0
- docagent_cli/project_utils.py +188 -0
- docagent_cli/py.typed +0 -0
- docagent_cli/remote_client.py +515 -0
- docagent_cli/server.py +520 -0
- docagent_cli/server_graph.py +196 -0
- docagent_cli/server_manager.py +365 -0
- docagent_cli/sessions.py +1262 -0
- docagent_cli/skills/__init__.py +18 -0
- docagent_cli/skills/commands.py +1090 -0
- docagent_cli/skills/load.py +192 -0
- docagent_cli/subagents.py +173 -0
- docagent_cli/system_prompt.md +247 -0
- docagent_cli/textual_adapter.py +1352 -0
- docagent_cli/theme.py +842 -0
- docagent_cli/token_state.py +31 -0
- docagent_cli/tool_display.py +298 -0
- docagent_cli/tools.py +236 -0
- docagent_cli/ui.py +420 -0
- docagent_cli/unicode_security.py +516 -0
- docagent_cli/update_check.py +454 -0
- docagent_cli/widgets/__init__.py +9 -0
- docagent_cli/widgets/_links.py +63 -0
- docagent_cli/widgets/approval.py +442 -0
- docagent_cli/widgets/ask_user.py +398 -0
- docagent_cli/widgets/autocomplete.py +691 -0
- docagent_cli/widgets/chat_input.py +1827 -0
- docagent_cli/widgets/diff.py +248 -0
- docagent_cli/widgets/history.py +188 -0
- docagent_cli/widgets/loading.py +177 -0
- docagent_cli/widgets/mcp_viewer.py +362 -0
- docagent_cli/widgets/message_store.py +675 -0
- docagent_cli/widgets/messages.py +1751 -0
- docagent_cli/widgets/model_selector.py +964 -0
- docagent_cli/widgets/status.py +372 -0
- docagent_cli/widgets/theme_selector.py +164 -0
- docagent_cli/widgets/thread_selector.py +1905 -0
- docagent_cli/widgets/tool_renderers.py +148 -0
- docagent_cli/widgets/tool_widgets.py +274 -0
- docagent_cli/widgets/welcome.py +339 -0
- docagent_cli-0.0.35.data/data/docagent_cli/default_agent_prompt.md +12 -0
- docagent_cli-0.0.35.dist-info/METADATA +200 -0
- docagent_cli-0.0.35.dist-info/RECORD +300 -0
- docagent_cli-0.0.35.dist-info/WHEEL +4 -0
- docagent_cli-0.0.35.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""Tool renderers for approval widgets - registry pattern."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import difflib
|
|
6
|
+
from typing import TYPE_CHECKING, Any
|
|
7
|
+
|
|
8
|
+
from docagent_cli.widgets.tool_widgets import (
|
|
9
|
+
EditFileApprovalWidget,
|
|
10
|
+
GenericApprovalWidget,
|
|
11
|
+
WriteFileApprovalWidget,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from docagent_cli.widgets.tool_widgets import ToolApprovalWidget
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ToolRenderer:
|
|
19
|
+
"""Strategy for building a tool's HITL approval widget.
|
|
20
|
+
|
|
21
|
+
Each renderer maps a tool name to a `(widget_class, data)` pair that
|
|
22
|
+
controls what the user sees in the approval box. Tools not registered
|
|
23
|
+
in `_RENDERER_REGISTRY` fall through to the default, which dumps all
|
|
24
|
+
args as `key: value` lines via `GenericApprovalWidget`.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
@staticmethod
|
|
28
|
+
def get_approval_widget(
|
|
29
|
+
tool_args: dict[str, Any],
|
|
30
|
+
) -> tuple[type[ToolApprovalWidget], dict[str, Any]]:
|
|
31
|
+
"""Get the approval widget class and data for this tool.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
tool_args: The tool arguments from action_request
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
Tuple of (widget_class, data_dict)
|
|
38
|
+
"""
|
|
39
|
+
return GenericApprovalWidget, tool_args
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class WriteFileRenderer(ToolRenderer):
|
|
43
|
+
"""Renderer for write_file tool - shows full file content."""
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
def get_approval_widget( # noqa: D102 # Protocol method — docstring on base class
|
|
47
|
+
tool_args: dict[str, Any],
|
|
48
|
+
) -> tuple[type[ToolApprovalWidget], dict[str, Any]]:
|
|
49
|
+
# Extract file extension for syntax highlighting
|
|
50
|
+
file_path = tool_args.get("file_path", "")
|
|
51
|
+
content = tool_args.get("content", "")
|
|
52
|
+
|
|
53
|
+
# Get file extension
|
|
54
|
+
file_extension = "text"
|
|
55
|
+
if "." in file_path:
|
|
56
|
+
file_extension = file_path.rsplit(".", 1)[-1]
|
|
57
|
+
|
|
58
|
+
data = {
|
|
59
|
+
"file_path": file_path,
|
|
60
|
+
"content": content,
|
|
61
|
+
"file_extension": file_extension,
|
|
62
|
+
}
|
|
63
|
+
return WriteFileApprovalWidget, data
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class TaskRenderer(ToolRenderer):
|
|
67
|
+
"""Renderer for task tool — interrupt description provides full context."""
|
|
68
|
+
|
|
69
|
+
@staticmethod
|
|
70
|
+
def get_approval_widget( # noqa: D102 # Protocol method — docstring on base class
|
|
71
|
+
tool_args: dict[str, Any], # noqa: ARG004 # Unused; interrupt description already formats task args
|
|
72
|
+
) -> tuple[type[ToolApprovalWidget], dict[str, Any]]:
|
|
73
|
+
return GenericApprovalWidget, {}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class EditFileRenderer(ToolRenderer):
|
|
77
|
+
"""Renderer for edit_file tool - shows unified diff."""
|
|
78
|
+
|
|
79
|
+
@staticmethod
|
|
80
|
+
def get_approval_widget( # noqa: D102 # Protocol method — docstring on base class
|
|
81
|
+
tool_args: dict[str, Any],
|
|
82
|
+
) -> tuple[type[ToolApprovalWidget], dict[str, Any]]:
|
|
83
|
+
file_path = tool_args.get("file_path", "")
|
|
84
|
+
old_string = tool_args.get("old_string", "")
|
|
85
|
+
new_string = tool_args.get("new_string", "")
|
|
86
|
+
|
|
87
|
+
# Generate unified diff
|
|
88
|
+
diff_lines = EditFileRenderer._generate_diff(old_string, new_string)
|
|
89
|
+
|
|
90
|
+
data = {
|
|
91
|
+
"file_path": file_path,
|
|
92
|
+
"diff_lines": diff_lines,
|
|
93
|
+
"old_string": old_string,
|
|
94
|
+
"new_string": new_string,
|
|
95
|
+
}
|
|
96
|
+
return EditFileApprovalWidget, data
|
|
97
|
+
|
|
98
|
+
@staticmethod
|
|
99
|
+
def _generate_diff(old_string: str, new_string: str) -> list[str]:
|
|
100
|
+
"""Generate unified diff lines from old and new strings.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
List of diff lines without the file headers.
|
|
104
|
+
"""
|
|
105
|
+
if not old_string and not new_string:
|
|
106
|
+
return []
|
|
107
|
+
|
|
108
|
+
old_lines = old_string.split("\n") if old_string else []
|
|
109
|
+
new_lines = new_string.split("\n") if new_string else []
|
|
110
|
+
|
|
111
|
+
# Generate unified diff
|
|
112
|
+
diff = difflib.unified_diff(
|
|
113
|
+
old_lines,
|
|
114
|
+
new_lines,
|
|
115
|
+
fromfile="before",
|
|
116
|
+
tofile="after",
|
|
117
|
+
lineterm="",
|
|
118
|
+
n=3, # Context lines
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# Skip the first two header lines (--- and +++)
|
|
122
|
+
diff_list = list(diff)
|
|
123
|
+
return diff_list[2:] if len(diff_list) > 2 else diff_list # noqa: PLR2004 # Column count threshold
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
_RENDERER_REGISTRY: dict[str, type[ToolRenderer]] = {
|
|
127
|
+
"task": TaskRenderer,
|
|
128
|
+
"write_file": WriteFileRenderer,
|
|
129
|
+
"edit_file": EditFileRenderer,
|
|
130
|
+
}
|
|
131
|
+
"""Registry mapping tool names to renderers
|
|
132
|
+
|
|
133
|
+
Note: bash/shell/execute use minimal approval (no renderer) — see
|
|
134
|
+
ApprovalMenu._MINIMAL_TOOLS
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def get_renderer(tool_name: str) -> ToolRenderer:
|
|
139
|
+
"""Get the renderer for a tool by name.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
tool_name: The name of the tool
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
The appropriate ToolRenderer instance
|
|
146
|
+
"""
|
|
147
|
+
renderer_class = _RENDERER_REGISTRY.get(tool_name, ToolRenderer)
|
|
148
|
+
return renderer_class()
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"""Tool-specific approval widgets for HITL display."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any
|
|
6
|
+
|
|
7
|
+
from textual.containers import Vertical
|
|
8
|
+
from textual.content import Content
|
|
9
|
+
from textual.widgets import Markdown, Static
|
|
10
|
+
|
|
11
|
+
from docagent_cli import theme
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from textual.app import ComposeResult
|
|
15
|
+
|
|
16
|
+
# Constants for display limits
|
|
17
|
+
_MAX_VALUE_LEN = 200
|
|
18
|
+
_MAX_LINES = 30
|
|
19
|
+
_MAX_DIFF_LINES = 50
|
|
20
|
+
_MAX_PREVIEW_LINES = 20
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _format_stats(additions: int, deletions: int) -> Content:
|
|
24
|
+
"""Format addition/deletion stats as styled Content.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
additions: Number of added lines.
|
|
28
|
+
deletions: Number of removed lines.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
Styled Content showing additions and deletions.
|
|
32
|
+
"""
|
|
33
|
+
colors = theme.get_theme_colors()
|
|
34
|
+
parts: list[str | tuple[str, str] | Content] = []
|
|
35
|
+
if additions:
|
|
36
|
+
parts.append((f"+{additions}", colors.success))
|
|
37
|
+
if deletions:
|
|
38
|
+
if parts:
|
|
39
|
+
parts.append(" ")
|
|
40
|
+
parts.append((f"-{deletions}", colors.error))
|
|
41
|
+
return Content.assemble(*parts) if parts else Content("")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _file_header(
|
|
45
|
+
file_path: str, additions: int = 0, deletions: int = 0
|
|
46
|
+
) -> ComposeResult:
|
|
47
|
+
"""Yield the `File:` path header with optional `+N -M` stats.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
file_path: Path to the file being modified.
|
|
51
|
+
additions: Number of added lines.
|
|
52
|
+
deletions: Number of removed lines.
|
|
53
|
+
|
|
54
|
+
Yields:
|
|
55
|
+
Static widgets for the file path header and a spacer line.
|
|
56
|
+
"""
|
|
57
|
+
stats = _format_stats(additions, deletions)
|
|
58
|
+
yield Static(
|
|
59
|
+
Content.assemble(
|
|
60
|
+
Content.from_markup("[bold cyan]File:[/bold cyan] $path ", path=file_path),
|
|
61
|
+
stats,
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
yield Static("")
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _count_diff_stats(
|
|
68
|
+
diff_lines: list[str], old_string: str, new_string: str
|
|
69
|
+
) -> tuple[int, int]:
|
|
70
|
+
"""Count additions and deletions from diff data.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
diff_lines: Unified diff output lines.
|
|
74
|
+
old_string: Original text being replaced (fallback when no diff).
|
|
75
|
+
new_string: Replacement text (fallback when no diff).
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Tuple of (additions count, deletions count).
|
|
79
|
+
"""
|
|
80
|
+
if diff_lines:
|
|
81
|
+
additions = sum(
|
|
82
|
+
1
|
|
83
|
+
for line in diff_lines
|
|
84
|
+
if line.startswith("+") and not line.startswith("+++")
|
|
85
|
+
)
|
|
86
|
+
deletions = sum(
|
|
87
|
+
1
|
|
88
|
+
for line in diff_lines
|
|
89
|
+
if line.startswith("-") and not line.startswith("---")
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
additions = new_string.count("\n") + 1 if new_string else 0
|
|
93
|
+
deletions = old_string.count("\n") + 1 if old_string else 0
|
|
94
|
+
return additions, deletions
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class ToolApprovalWidget(Vertical):
|
|
98
|
+
"""Base class for tool approval widgets."""
|
|
99
|
+
|
|
100
|
+
def __init__(self, data: dict[str, Any]) -> None:
|
|
101
|
+
"""Initialize the tool approval widget with data."""
|
|
102
|
+
super().__init__(classes="tool-approval-widget")
|
|
103
|
+
self.data = data
|
|
104
|
+
|
|
105
|
+
def compose(self) -> ComposeResult: # noqa: PLR6301 # Textual widget method convention
|
|
106
|
+
"""Default compose - override in subclasses.
|
|
107
|
+
|
|
108
|
+
Yields:
|
|
109
|
+
Static widget with placeholder message.
|
|
110
|
+
"""
|
|
111
|
+
yield Static("Tool details not available", classes="approval-description")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class GenericApprovalWidget(ToolApprovalWidget):
|
|
115
|
+
"""Generic approval widget for unknown tools."""
|
|
116
|
+
|
|
117
|
+
def compose(self) -> ComposeResult:
|
|
118
|
+
"""Compose the generic tool display.
|
|
119
|
+
|
|
120
|
+
Yields:
|
|
121
|
+
Static widgets displaying each key-value pair from tool data.
|
|
122
|
+
"""
|
|
123
|
+
for key, value in self.data.items():
|
|
124
|
+
if value is None:
|
|
125
|
+
continue
|
|
126
|
+
value_str = str(value)
|
|
127
|
+
if len(value_str) > _MAX_VALUE_LEN:
|
|
128
|
+
hidden = len(value_str) - _MAX_VALUE_LEN
|
|
129
|
+
value_str = value_str[:_MAX_VALUE_LEN] + f"... ({hidden} more chars)"
|
|
130
|
+
yield Static(
|
|
131
|
+
f"{key}: {value_str}", markup=False, classes="approval-description"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class WriteFileApprovalWidget(ToolApprovalWidget):
|
|
136
|
+
"""Approval widget for write_file - shows file content with syntax highlighting."""
|
|
137
|
+
|
|
138
|
+
def compose(self) -> ComposeResult:
|
|
139
|
+
"""Compose the file content display with syntax highlighting.
|
|
140
|
+
|
|
141
|
+
Yields:
|
|
142
|
+
Widgets displaying file path header and syntax-highlighted content.
|
|
143
|
+
"""
|
|
144
|
+
file_path = self.data.get("file_path", "")
|
|
145
|
+
content = self.data.get("content", "")
|
|
146
|
+
file_extension = self.data.get("file_extension", "text")
|
|
147
|
+
|
|
148
|
+
# Content with syntax highlighting via Markdown code block
|
|
149
|
+
lines = content.split("\n")
|
|
150
|
+
total_lines = len(lines)
|
|
151
|
+
|
|
152
|
+
# File header with line count
|
|
153
|
+
yield from _file_header(file_path, additions=total_lines if content else 0)
|
|
154
|
+
|
|
155
|
+
if total_lines > _MAX_LINES:
|
|
156
|
+
# Truncate for display
|
|
157
|
+
shown_lines = lines[:_MAX_LINES]
|
|
158
|
+
remaining = total_lines - _MAX_LINES
|
|
159
|
+
truncated_content = (
|
|
160
|
+
"\n".join(shown_lines) + f"\n... ({remaining} more lines)"
|
|
161
|
+
)
|
|
162
|
+
yield Markdown(f"```{file_extension}\n{truncated_content}\n```")
|
|
163
|
+
else:
|
|
164
|
+
yield Markdown(f"```{file_extension}\n{content}\n```")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class EditFileApprovalWidget(ToolApprovalWidget):
|
|
168
|
+
"""Approval widget for edit_file - shows clean diff with colors."""
|
|
169
|
+
|
|
170
|
+
def compose(self) -> ComposeResult:
|
|
171
|
+
"""Compose the diff display with colored additions and deletions.
|
|
172
|
+
|
|
173
|
+
Yields:
|
|
174
|
+
Widgets displaying file path, stats, and colored diff lines.
|
|
175
|
+
"""
|
|
176
|
+
file_path = self.data.get("file_path", "")
|
|
177
|
+
diff_lines = self.data.get("diff_lines", [])
|
|
178
|
+
old_string = self.data.get("old_string", "")
|
|
179
|
+
new_string = self.data.get("new_string", "")
|
|
180
|
+
|
|
181
|
+
additions, deletions = _count_diff_stats(diff_lines, old_string, new_string)
|
|
182
|
+
yield from _file_header(file_path, additions, deletions)
|
|
183
|
+
|
|
184
|
+
if not diff_lines and not old_string and not new_string:
|
|
185
|
+
yield Static("No changes to display", classes="approval-description")
|
|
186
|
+
elif diff_lines:
|
|
187
|
+
# Render content
|
|
188
|
+
yield from self._render_diff_lines_only(diff_lines)
|
|
189
|
+
else:
|
|
190
|
+
yield from self._render_strings_only(old_string, new_string)
|
|
191
|
+
|
|
192
|
+
def _render_diff_lines_only(self, diff_lines: list[str]) -> ComposeResult:
|
|
193
|
+
"""Render unified diff lines without returning stats.
|
|
194
|
+
|
|
195
|
+
Yields:
|
|
196
|
+
Static widgets for each diff line with appropriate styling.
|
|
197
|
+
"""
|
|
198
|
+
lines_shown = 0
|
|
199
|
+
|
|
200
|
+
for line in diff_lines:
|
|
201
|
+
if lines_shown >= _MAX_DIFF_LINES:
|
|
202
|
+
yield Static(
|
|
203
|
+
Content.styled(
|
|
204
|
+
f"... ({len(diff_lines) - lines_shown} more lines)", "dim"
|
|
205
|
+
)
|
|
206
|
+
)
|
|
207
|
+
break
|
|
208
|
+
|
|
209
|
+
if line.startswith(("@@", "---", "+++")):
|
|
210
|
+
continue
|
|
211
|
+
|
|
212
|
+
widget = self._render_diff_line(line)
|
|
213
|
+
if widget:
|
|
214
|
+
yield widget
|
|
215
|
+
lines_shown += 1
|
|
216
|
+
|
|
217
|
+
def _render_strings_only(self, old_string: str, new_string: str) -> ComposeResult:
|
|
218
|
+
"""Render old/new strings without returning stats.
|
|
219
|
+
|
|
220
|
+
Yields:
|
|
221
|
+
Static widgets showing removed and added content with styling.
|
|
222
|
+
"""
|
|
223
|
+
colors = theme.get_theme_colors()
|
|
224
|
+
if old_string:
|
|
225
|
+
yield Static(Content.styled("Removing:", f"bold {colors.error}"))
|
|
226
|
+
yield from self._render_string_lines(old_string, is_addition=False)
|
|
227
|
+
yield Static("")
|
|
228
|
+
|
|
229
|
+
if new_string:
|
|
230
|
+
yield Static(Content.styled("Adding:", f"bold {colors.success}"))
|
|
231
|
+
yield from self._render_string_lines(new_string, is_addition=True)
|
|
232
|
+
|
|
233
|
+
@staticmethod
|
|
234
|
+
def _render_diff_line(line: str) -> Static | None:
|
|
235
|
+
"""Render a single diff line with appropriate styling.
|
|
236
|
+
|
|
237
|
+
Returns:
|
|
238
|
+
Static widget with styled diff line, or None for empty/skipped lines.
|
|
239
|
+
"""
|
|
240
|
+
raw = line[1:] if len(line) > 1 else ""
|
|
241
|
+
|
|
242
|
+
if line.startswith("-"):
|
|
243
|
+
return Static(
|
|
244
|
+
Content.from_markup("- $text", text=raw), classes="diff-removed"
|
|
245
|
+
)
|
|
246
|
+
if line.startswith("+"):
|
|
247
|
+
return Static(
|
|
248
|
+
Content.from_markup("+ $text", text=raw), classes="diff-added"
|
|
249
|
+
)
|
|
250
|
+
if line.startswith(" "):
|
|
251
|
+
return Static(
|
|
252
|
+
Content.from_markup(" $text", text=raw), classes="diff-context"
|
|
253
|
+
)
|
|
254
|
+
if line.strip():
|
|
255
|
+
return Static(line, markup=False)
|
|
256
|
+
return None
|
|
257
|
+
|
|
258
|
+
@staticmethod
|
|
259
|
+
def _render_string_lines(text: str, *, is_addition: bool) -> ComposeResult:
|
|
260
|
+
"""Render lines from a string with appropriate styling.
|
|
261
|
+
|
|
262
|
+
Yields:
|
|
263
|
+
Static widgets for each line with addition or deletion styling.
|
|
264
|
+
"""
|
|
265
|
+
lines = text.split("\n")
|
|
266
|
+
sign = "+" if is_addition else "-"
|
|
267
|
+
cls = "diff-added" if is_addition else "diff-removed"
|
|
268
|
+
|
|
269
|
+
for line in lines[:_MAX_PREVIEW_LINES]:
|
|
270
|
+
yield Static(Content.from_markup(f"{sign} $text", text=line), classes=cls)
|
|
271
|
+
|
|
272
|
+
if len(lines) > _MAX_PREVIEW_LINES:
|
|
273
|
+
remaining = len(lines) - _MAX_PREVIEW_LINES
|
|
274
|
+
yield Static(Content.styled(f"... ({remaining} more lines)", "dim"))
|