@@ -105,7 +105,9 @@ def get_package_directory(path: Path) -> Path:
105
105
return src_dir .parent
106
106
107
107
108
- def copy_template (path : Path , name : str , version : str = "0.1.0" ) -> None :
108
+ def copy_template (
109
+ path : Path , name : str , description : str , version : str = "0.1.0"
110
+ ) -> None :
109
111
"""Copy template files into src/<project_name>"""
110
112
template_dir = Path (__file__ ).parent / "template"
111
113
@@ -116,18 +118,24 @@ def copy_template(path: Path, name: str, version: str = "0.1.0") -> None:
116
118
env = Environment (loader = FileSystemLoader (str (template_dir )))
117
119
118
120
files = [
119
- ("__init__.py.jinja2" , "__init__.py" ),
120
- ("server.py.jinja2" , "server.py" ),
121
+ ("__init__.py.jinja2" , "__init__.py" , target_dir ),
122
+ ("server.py.jinja2" , "server.py" , target_dir ),
123
+ ("README.md.jinja2" , "README.md" , path ),
121
124
]
122
125
123
- template_vars = {"server_name" : name , "server_version" : version }
126
+ template_vars = {
127
+ "server_name" : name ,
128
+ "server_version" : version ,
129
+ "server_description" : description ,
130
+ "server_directory" : str (path .resolve ()),
131
+ }
124
132
125
133
try :
126
- for template_file , output_file in files :
134
+ for template_file , output_file , output_dir in files :
127
135
template = env .get_template (template_file )
128
136
rendered = template .render (** template_vars )
129
137
130
- out_path = target_dir / output_file
138
+ out_path = output_dir / output_file
131
139
out_path .write_text (rendered )
132
140
133
141
except Exception as e :
@@ -136,7 +144,7 @@ def copy_template(path: Path, name: str, version: str = "0.1.0") -> None:
136
144
137
145
138
146
def create_project (
139
- path : Path , name : str , version : str , use_claude : bool = True
147
+ path : Path , name : str , description : str , version : str , use_claude : bool = True
140
148
) -> None :
141
149
"""Create a new project using uv"""
142
150
path .mkdir (parents = True , exist_ok = True )
@@ -158,7 +166,7 @@ def create_project(
158
166
click .echo ("❌ Error: Failed to add mcp dependency." , err = True )
159
167
sys .exit (1 )
160
168
161
- copy_template (path , name , version )
169
+ copy_template (path , name , description , version )
162
170
163
171
# Check if Claude.app is available
164
172
if (
@@ -313,7 +321,7 @@ def main(
313
321
click .echo ("❌ Error: Invalid path. Project creation aborted." , err = True )
314
322
return 1
315
323
316
- create_project (project_path , name , version , claudeapp )
324
+ create_project (project_path , name , description , version , claudeapp )
317
325
update_pyproject_settings (project_path , version , description )
318
326
319
327
return 0
0 commit comments