1"""Readme model implementation.
2
3Implements:
4- :any:`/specs/spec_model_mapping` §2.4 for Readme entity mapping
5- :any:`/specs/spec_readme_extraction` for content processing
6"""
7
8from typing import Any, Dict, List, Optional
9from pydantic import BaseModel, Field, field_validator
10from datetime import datetime
11import re
12from pathlib import Path
13
14from .readme_extract import ReadmeExtract
15
16
[docs]
17class Readme(BaseModel):
18 """Readme model with content and metadata.
19
20 Implements:
21 * :any:`/specs/spec_model_mapping` §2.4, mapping raw content to structured fields
22 * :any:`/specs/spec_readme_extraction` §2-3, handling:
23
24 * Content extraction (§2)
25 * Metadata parsing (§3)
26
27 """
28
29 project_id: int
30 content: str = Field(..., description="First real paragraph (verbatim excerpt)")
31 todo: str | None = Field(None, description="TODO sections (verbatim excerpts)")
32 full_content: str = Field(..., description="Complete raw content")
33 extra: ReadmeExtract = Field(
34 ..., description="All interpreted/extracted information"
35 )
36 ref: str = "main"
37 path: str = "README.md"
38
39 model_config = {"extra": "ignore"}
40
41
42__all__ = ["Readme"]