54bf41efd6
Il DOCX prodotto dalla versione precedente emetteva i div Tielogic
(`<div class="cover">`, `<div class="info-col">`, `<div class="acceptance">`,
`<div class="status-card">`) come testo grezzo: Pandoc non sa
interpretare il CSS-flavoured HTML del PDF e li copia letteralmente
nel documento Word. Anche le tabelle `<table class="financial">`
finivano spezzate cella per cella.
Il fix introduce un preprocessor dedicato che riscrive tutta la
HTML Tielogic-flavoured in Markdown nativo prima di passare il
documento a Pandoc.
- docx_preprocessor.py: nuovo modulo basato su BeautifulSoup. Strippa
frontmatter e <style>, poi rewrite di:
* <div class="cover"> → titoli H1/H2, paragrafi, tabella pipe
2-col FORNITORE/CLIENTE, validità in italic, \newpage finale
* <table class="financial"> → tabella pipe Markdown con riga
total-row in **bold**
* <div class="acceptance"> → heading H2 + intro + tabella pipe
con riga firma `_____________________` + luogo/data
* <div class="status-card"> → paragrafo "**name** — descrizione"
* <span class="badge ..."> → testo **bold**
* <div class="page-break"> → \newpage Pandoc-friendly
- docx_renderer.py: deferisce tutto il preprocessing al nuovo modulo
(più compatto, niente regex sparse).
- pyproject.toml + uv.lock: aggiunta dipendenza beautifulsoup4>=4.12.
- 8 nuovi test unit per il preprocessor (cover, tabelle, badge,
acceptance, idempotenza, niente div residui, badge standalone).
Adattati i test esistenti agli import dal nuovo modulo. 101 verde.
Smoke E2E via MCP: l'offerta TieMeasureFlow esce in DOCX leggibile
con tabelle Word native, heading colorati Tielogic e firme in tabella.
44 lines
940 B
TOML
44 lines
940 B
TOML
[project]
|
|
name = "mcp-docugen"
|
|
version = "0.1.0"
|
|
description = "MCP server for document generation from Markdown templates via OpenRouter"
|
|
requires-python = ">=3.11"
|
|
dependencies = [
|
|
"mcp>=1.2",
|
|
"fastapi>=0.115",
|
|
"uvicorn[standard]>=0.34",
|
|
"pydantic>=2.0",
|
|
"pydantic-settings>=2.0",
|
|
"httpx>=0.27",
|
|
"aiosqlite>=0.20",
|
|
"aiofiles>=24.0",
|
|
"pyyaml>=6.0",
|
|
"pillow>=11.0",
|
|
"python-multipart>=0.0.9",
|
|
"playwright>=1.48",
|
|
"markdown-it-py[plugins]>=3.0",
|
|
"beautifulsoup4>=4.12",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.0",
|
|
"pytest-asyncio>=0.24",
|
|
"respx>=0.21",
|
|
"pytest-cov>=5.0",
|
|
]
|
|
|
|
[project.scripts]
|
|
mcp-docugen = "mcp_docugen.main:run"
|
|
|
|
[tool.coverage.run]
|
|
source = ["src/mcp_docugen"]
|
|
omit = ["src/mcp_docugen/main.py"]
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/mcp_docugen"]
|