Skip to content

Commit a0d05af

Browse files
committed
remote _write_requirements
1 parent 36036f6 commit a0d05af

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/mcp_agent/cli/commands/init.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@ def _copy_pkg_tree(pkg_rel: str, dst: Path, force: bool) -> int:
8282
Returns 1 on success, 0 on failure.
8383
"""
8484
try:
85-
root = (
86-
resources.files("mcp_agent.data")
87-
.joinpath("examples")
88-
.joinpath(pkg_rel)
89-
)
85+
root = resources.files("mcp_agent.data").joinpath("examples").joinpath(pkg_rel)
9086
except Exception:
9187
return 0
9288
if not root.exists():
@@ -116,7 +112,9 @@ def init(
116112
ctx: typer.Context,
117113
dir: Path = typer.Option(Path("."), "--dir", "-d", help="Target directory"),
118114
template: str = typer.Option("basic", "--template", "-t", help="Template to use"),
119-
quickstart: str = typer.Option(None, "--quickstart", help="Quickstart mode: copy example without config files"),
115+
quickstart: str = typer.Option(
116+
None, "--quickstart", help="Quickstart mode: copy example without config files"
117+
),
120118
force: bool = typer.Option(False, "--force", "-f", help="Overwrite existing files"),
121119
no_gitignore: bool = typer.Option(
122120
False, "--no-gitignore", help="Skip creating .gitignore"
@@ -172,7 +170,10 @@ def init(
172170
"mcp-basic-agent": ("mcp_basic_agent", "basic/mcp_basic_agent"),
173171
"token-counter": ("token_counter", "basic/token_counter"),
174172
"agent-factory": ("agent_factory", "basic/agent_factory"),
175-
"reference-agent-server": ("reference_agent_server", "mcp_agent_server/reference"),
173+
"reference-agent-server": (
174+
"reference_agent_server",
175+
"mcp_agent_server/reference",
176+
),
176177
"elicitation": ("elicitation", "mcp_agent_server/elicitation"),
177178
"sampling": ("sampling", "mcp_agent_server/sampling"),
178179
"notifications": ("notifications", "mcp_agent_server/notifications"),
@@ -187,7 +188,9 @@ def init(
187188

188189
# Templates table
189190
console.print("[bold cyan]Templates:[/bold cyan]")
190-
console.print("[dim]Creates minimal project structure with config files[/dim]\n")
191+
console.print(
192+
"[dim]Creates minimal project structure with config files[/dim]\n"
193+
)
191194
table1 = Table(show_header=True, header_style="cyan")
192195
table1.add_column("Template", style="green")
193196
table1.add_column("Description")
@@ -233,7 +236,9 @@ def init(
233236
if copied:
234237
console.print(f"Copied {copied} set(s) to {dst}")
235238
else:
236-
console.print(f"[yellow]Could not copy '{quickstart}' - destination may already exist[/yellow]")
239+
console.print(
240+
f"[yellow]Could not copy '{quickstart}' - destination may already exist[/yellow]"
241+
)
237242
console.print("Use --force to overwrite")
238243

239244
return
@@ -285,15 +290,19 @@ def init(
285290
copied = _copy_pkg_tree(pkg_rel, dst, force)
286291

287292
if copied:
288-
console.print(f"\n[green]✅ Successfully copied example '{template}'![/green]")
293+
console.print(
294+
f"\n[green]✅ Successfully copied example '{template}'![/green]"
295+
)
289296
console.print(f"Created: [cyan]{dst}[/cyan]\n")
290297
console.print("[bold]Next steps:[/bold]")
291298
console.print(f"1. cd [cyan]{dst}[/cyan]")
292299
console.print("2. Review the README for instructions")
293300
console.print("3. Add your API keys to config/secrets files if needed")
294301
else:
295302
console.print(f"[yellow]Example '{template}' could not be copied[/yellow]")
296-
console.print("The destination may already exist. Use --force to overwrite.")
303+
console.print(
304+
"The destination may already exist. Use --force to overwrite."
305+
)
297306

298307
return
299308

@@ -355,13 +364,6 @@ def init(
355364
if created:
356365
files_created.append(created)
357366

358-
# Add basic requirements.txt
359-
requirements_content = _load_template("requirements.txt")
360-
if requirements_content:
361-
created = _write_requirements(dir, requirements_content, force)
362-
if created:
363-
files_created.append(created)
364-
365367
elif template == "token":
366368
token_path = dir / "token_example.py"
367369
token_content = _load_template("token_counter.py")

0 commit comments

Comments
 (0)