# draw-io Scripts Utility scripts for working with `.drawio` diagram files in the cxp-bu-order-ms project. ## Requirements - Python 3.8+ - No external dependencies (uses standard library only: `xml.etree.ElementTree`, `argparse`, `json`, `sys`, `pathlib`) ## Scripts ### `validate-drawio.py` Validates the XML structure of a `.drawio` file against required constraints. **Usage** ```bash python scripts/validate-drawio.py ``` **Examples** ```bash # Validate a single file python scripts/validate-drawio.py docs/architecture.drawio # Validate all drawio files in a directory for f in docs/**/*.drawio; do python scripts/validate-drawio.py "$f"; done ``` **Checks performed** | Check | Description | |-------|-------------| | Root cells | Verifies id="0" and id="1" cells are present in every diagram page | | Unique IDs | All `mxCell` id values are unique within a diagram | | Edge connectivity | Every edge has valid `source` and `target` attributes pointing to existing cells | | Geometry | Every vertex cell has an `mxGeometry` child element | | Parent chain | Every cell's `parent` attribute references an existing cell id | | XML well-formedness | File is valid XML | **Exit codes** - `0` — Validation passed - `1` — One or more validation errors found (errors printed to stdout) --- ### `add-shape.py` Adds a new shape (vertex cell) to an existing `.drawio` diagram file. **Usage** ```bash python scripts/add-shape.py