Metadata-Version: 2.4
Name: matrx-content-guard
Version: 0.1.1
Summary: Deterministic HTML/CSS/JS content validation + patch/diff editing engine for the Matrx CMS agent-authoring layer
Project-URL: Homepage, https://github.com/AI-Matrix-Engine/aidream-current
Project-URL: Repository, https://github.com/AI-Matrix-Engine/aidream-current
Author-email: Matrx <admin@aimatrx.com>
Maintainer-email: Matrx <admin@aimatrx.com>
License: MIT
Keywords: cms,content-validation,html-sanitization,matrx,patch-diff
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Python: >=3.13
Requires-Dist: lxml>=5.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: tinycss2>=1.3
Description-Content-Type: text/markdown

# matrx-content-guard

Deterministic HTML/CSS/JS content validation + patch/diff editing for the
Matrx CMS agent-authoring layer. Pure Python, no DB access, no tool-framework
imports — every agent mutation to `html_pages` / `client_*` content flows
through this library before it's written.

See `CONTRACT.md` for the full typed API and `FEATURE.md` for the durable
design notes (parser choice, permissive-first policy rationale, byte-
preservation guarantee).

```python
from matrx_content_guard import validate_content, apply_patch, SearchReplacePatch, SearchReplaceHunk

report = validate_content("<script>alert(1)</script>", "html_page_document")
report.blocked  # False — inline script is a supported feature; only genuinely dangerous constructs block.

result = apply_patch(
    "<h1>Hello</h1>",
    SearchReplacePatch(hunks=[SearchReplaceHunk(search="Hello", replace="Hi")]),
)
result.result  # "<h1>Hi</h1>"
```
