feat: migrate legacy mcp config
This commit is contained in:
@@ -8,6 +8,7 @@ from .commands import (
|
||||
admin,
|
||||
artifacts,
|
||||
caps,
|
||||
config as config_commands,
|
||||
deployments,
|
||||
docs,
|
||||
drafts,
|
||||
@@ -66,6 +67,7 @@ app.add_typer(sources.app, name="source")
|
||||
app.add_typer(admin.app, name="admin")
|
||||
app.add_typer(docs.app, name="docs")
|
||||
app.add_typer(schema.app, name="schema")
|
||||
app.add_typer(config_commands.app, name="config")
|
||||
app.command("explain")(explain.explain_command)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Annotated
|
||||
|
||||
import typer
|
||||
|
||||
from wf_mcp.broker.config import migrate_broker_config_file
|
||||
|
||||
from wf_cli.io import emit_json
|
||||
|
||||
app = typer.Typer(
|
||||
name="config",
|
||||
help="Inspect and migrate workflow config files.",
|
||||
no_args_is_help=True,
|
||||
)
|
||||
|
||||
|
||||
@app.command("migrate-mcp")
|
||||
def migrate_mcp_config(
|
||||
input_path: Annotated[
|
||||
Path,
|
||||
typer.Argument(help="Legacy wf_mcp.config.json path."),
|
||||
],
|
||||
output_path: Annotated[
|
||||
Path | None,
|
||||
typer.Option("--output", help="Write neutral workflow config JSON here."),
|
||||
] = None,
|
||||
) -> None:
|
||||
"""Convert legacy MCP broker config into neutral workflow config."""
|
||||
config = migrate_broker_config_file(input_path)
|
||||
payload = config.model_dump(mode="json")
|
||||
if output_path is None:
|
||||
emit_json(payload)
|
||||
return
|
||||
output_path.write_text(
|
||||
config.model_dump_json(indent=2),
|
||||
encoding="utf-8",
|
||||
)
|
||||
emit_json({"status": "written", "path": str(output_path)})
|
||||
Reference in New Issue
Block a user