MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / install

Function install

astrbot/cli/commands/cmd_plug.py:156–187  ·  view source on GitHub ↗

Install a plugin

(name: str | None, local_path: Path | None, proxy: str | None)

Source from the content-addressed store, hash-verified

154)
155@click.option("--proxy", help="Proxy server address")
156def install(name: str | None, local_path: Path | None, proxy: str | None) -> None:
157 """Install a plugin"""
158 base_path = _get_data_path()
159 plug_path = base_path / "plugins"
160
161 if local_path is not None:
162 install_local_plugin(local_path, plug_path, editable=True)
163 return
164
165 if name is None:
166 raise click.ClickException("Missing plugin name or local plugin path")
167
168 local_name_path = Path(name).expanduser()
169 if local_name_path.exists() and local_name_path.is_dir():
170 install_local_plugin(local_name_path, plug_path, editable=False)
171 return
172
173 plugins = build_plug_list(base_path / "plugins")
174
175 plugin = next(
176 (
177 p
178 for p in plugins
179 if p["name"] == name and p["status"] == PluginStatus.NOT_INSTALLED
180 ),
181 None,
182 )
183
184 if not plugin:
185 raise click.ClickException(f"Plugin {name} not found or already installed")
186
187 manage_plugin(plugin, plug_path, is_update=False, proxy=proxy)
188
189
190@plug.command()

Callers

nothing calls this directly

Calls 4

_get_data_pathFunction · 0.85
install_local_pluginFunction · 0.85
build_plug_listFunction · 0.85
manage_pluginFunction · 0.85

Tested by

no test coverage detected