1- """Pydantic schemas for registry items."""
1+ """Pydantic schemas for registry items and configuration ."""
22
33from __future__ import annotations
44
55from typing import Any
66
7- from pydantic import BaseModel
7+ from pydantic import BaseModel , ConfigDict
88
99
1010class RegistryFile (BaseModel ):
11- """A file in a registry item."""
11+ """A file within a registry item."""
1212
1313 path : str
14+ """Source path within the registry item."""
1415 target : str
16+ """Target path where the file will be written."""
1517 content : str = ""
18+ """File content (populated in built registry items)."""
1619 type : str = ""
20+ """Optional file type annotation."""
1721
1822
1923class RegistryDependencies (BaseModel ):
20- """Dependencies for a registry item."""
24+ """Dependencies required by a registry item."""
2125
2226 pip : list [str ] = []
27+ """Python pip packages."""
2328 npm : list [str ] = []
29+ """npm packages."""
2430
2531
2632class RegistryVersionConstraint (BaseModel ):
27- """Version constraints for a registry item ."""
33+ """Version constraints for Mirascope compatibility ."""
2834
2935 minVersion : str | None = None
36+ """Minimum compatible version."""
3037 maxVersion : str | None = None
38+ """Maximum compatible version."""
3139
3240
3341class RegistryItem (BaseModel ):
34- """A registry item."""
42+ """A registry item (tool, agent, prompt, or integration) ."""
3543
3644 name : str
45+ """Unique item name."""
3746 type : str
47+ """Item type (e.g., 'registry:tool', 'registry:agent')."""
3848 title : str = ""
49+ """Human-readable title."""
3950 description : str = ""
51+ """Description of the item."""
4052 version : str = "1.0.0"
53+ """Item version."""
4154 language : str = ""
55+ """Language this item is for (python or typescript)."""
4256 categories : list [str ] = []
57+ """Categories for filtering/searching."""
4358 mirascope : dict [str , RegistryVersionConstraint ] = {}
59+ """Mirascope version constraints by language."""
4460 files : list [RegistryFile ] = []
61+ """Files included in this item."""
4562 dependencies : RegistryDependencies = RegistryDependencies ()
63+ """External dependencies."""
4664 registryDependencies : list [str ] = []
65+ """Other registry items this depends on."""
4766
4867 @classmethod
4968 def from_dict (cls , data : dict [str , Any ]) -> RegistryItem :
@@ -52,23 +71,46 @@ def from_dict(cls, data: dict[str, Any]) -> RegistryItem:
5271
5372
5473class RegistryIndexItem (BaseModel ):
55- """An item in the registry index."""
74+ """An item entry in the registry index."""
5675
5776 name : str
77+ """Item name."""
5878 type : str
79+ """Item type."""
5980 path : str
81+ """Path within the registry."""
6082 description : str = ""
83+ """Optional description."""
6184
6285
6386class RegistryIndex (BaseModel ):
64- """The registry index."""
87+ """The registry index containing all available items ."""
6588
6689 name : str
90+ """Registry name."""
6791 version : str
92+ """Registry version."""
6893 homepage : str = ""
94+ """Registry homepage URL."""
6995 items : list [RegistryIndexItem ] = []
96+ """All items in the registry."""
7097
7198 @classmethod
7299 def from_dict (cls , data : dict [str , Any ]) -> RegistryIndex :
73100 """Create a RegistryIndex from a dictionary."""
74101 return cls .model_validate (data )
102+
103+
104+ class MirascopeConfig (BaseModel ):
105+ """Mirascope project configuration (mirascope.json)."""
106+
107+ model_config = ConfigDict (populate_by_name = True , extra = "allow" )
108+
109+ schema_ : str | None = None
110+ """JSON schema URL."""
111+ language : str = "python"
112+ """Project language (python or typescript)."""
113+ registry : str = "https://mirascope.com/registry"
114+ """Registry URL."""
115+ paths : dict [str , str ] = {}
116+ """Path mappings for item types."""
0 commit comments