@@ -678,6 +678,7 @@ def _render_init_plugin_yaml(
678678 display_name : str ,
679679 desc : str ,
680680 author : str ,
681+ repo : str ,
681682 version : str ,
682683) -> str :
683684 python_version = f"{ sys .version_info .major } .{ sys .version_info .minor } "
@@ -688,6 +689,7 @@ def _render_init_plugin_yaml(
688689 display_name: { display_name }
689690 desc: { desc }
690691 author: { author }
692+ repo: { repo }
691693 version: { version }
692694 runtime:
693695 python: "{ python_version } "
@@ -968,19 +970,21 @@ def _prompt_nonempty_text(prompt: str) -> str:
968970 click .echo ("该字段不能为空,请重新输入。" )
969971
970972
971- def _collect_init_metadata (name : str | None ) -> tuple [str , str , str , str ]:
972- if name is not None :
973- return name , "" , "" , "1.0.0"
973+ def _default_init_repo_name (plugin_name : str ) -> str :
974+ return _normalize_plugin_name (plugin_name )
974975
975- plugin_name = _prompt_nonempty_text ("插件名字" )
976- author = click .prompt ("作者" , type = str , default = "" , show_default = False ).strip ()
976+
977+ def _collect_init_metadata (name : str | None ) -> tuple [str , str , str , str , str ]:
978+ plugin_name = name if name is not None else _prompt_nonempty_text ("插件名字" )
979+ author = _prompt_nonempty_text ("作者" )
980+ repo = _default_init_repo_name (plugin_name )
977981 desc = click .prompt ("描述" , type = str , default = "" , show_default = False ).strip ()
978982 version = click .prompt ("版本" , type = str , default = "1.0.0" , show_default = True ).strip ()
979- return plugin_name , author , desc , version or "1.0.0"
983+ return plugin_name , author , repo , desc , version or "1.0.0"
980984
981985
982986def _init_plugin (name : str | None , agents : tuple [str , ...] = ()) -> None :
983- raw_name , author , desc , version = _collect_init_metadata (name )
987+ raw_name , author , repo , desc , version = _collect_init_metadata (name )
984988 plugin_name = _normalize_plugin_name (raw_name )
985989 target_dir = Path (plugin_name )
986990 if target_dir .exists ():
@@ -995,6 +999,7 @@ def _init_plugin(name: str | None, agents: tuple[str, ...] = ()) -> None:
995999 display_name = display_name ,
9961000 desc = desc ,
9971001 author = author ,
1002+ repo = repo ,
9981003 version = version ,
9991004 ),
10001005 encoding = "utf-8" ,
0 commit comments