Aqr-K dd4ae3e8d5 refactor(plugin): 移除已无调用者的物理分身源码改写器 (#6683)
物理分身是早期实现:复制整个插件目录,再用字符串替换改写副本源码里的类名、
plugin_config_prefix 和联邦构建产物。虚拟实例接管后,分身不再复制目录,
由装载器改写类身份、按实例 ID 隔离配置与数据,这套改写器随之失去调用者。

求证依据(全仓 git grep,覆盖 app/、tests/、scripts/、docs/、skills/):

- PluginPackageManager.clone() 无任何生产调用者。分身的唯一生产路径是
  POST /api/v1/plugin/clone/{plugin_id} -> PluginManager.clone_plugin()
  -> PluginCloneService.clone(),后者只写 PluginInstance 记录与隔离配置,
  不碰包适配器。clone() 也没有经 PluginSystemServices 暴露出去。
- clone() 的四个私有实现 _modify_plugin_files / _modify_python_file /
  _modify_federation_files / _rename_federation_assets,消费者只有 clone()
  自身与 PluginSystemServices 的同名透传。
- PluginSystemServices 的四个透传,消费者只有 PluginManager 的 _modify_* shim。
- PluginManager 的四个 shim 无任何调用者。动态可达性已单独排查:
  全仓没有 getattr/字符串反射指向这些名字;app/runtime/compat/manifest.py
  不登记它们的别名(只有 app.core.plugin -> 本模块的模块级映射);
  app/sdk/ 不再导出;PluginManager 与 PluginPackageManager 都没有
  __getattr__ 兜底,属性不存在即 AttributeError;官方插件基线
  official-plugin-baseline.json 零命中。
- @observe_compat_facade("PluginManager") 只包装类上已存在的方法,
  不会凭空合成属性,因此 shim 删除后 enforce_facade 再也匹配不到
  notices.py 里那四条 key,登记随之成为不可达数据,一并删除。

替代路径:这四条弃用声明当初承诺的替代目标是
get_plugin_system().package._modify_*(),那是一次「门面搬到适配器」的
重定位登记,本次连同能力一起下线;分身能力本身的替代路径是虚拟实例
PluginCloneService.clone(),它已在生产链路上,见
docs/v2-to-v3-overview.md §3.6「不复制插件源码,也能保持各实例配置隔离」。
既有磁盘上的旧物理分身不受影响:卸载路径读取 is_clone 属性并调用
remove_plugin_package() 的逻辑原样保留,只是不再产生新的物理分身。

这是对已公告弃用 API(DeprecationStage.SILENT,since v3.0.0)的正式移除。

连带改动:
- package.py 的 import re 仅服务于 _modify_python_file,同步移除;模块
  docstring 去掉「分身处理」。
- system.py 的 typing.cast 仅服务于被删透传,同步移除。
- tests/test_plugin_package_manager.py::test_clone_rewrites_python_and_federation_assets
  是这套改写器的唯一测试,且只覆盖已无调用者的路径,随实现一并删除。
  (删的是测试函数不是测试文件,tests/run.py 的分片装箱不变。)
- mypy 低水位随实现下降:app/runtime/extensions/plugin/manager.py 的
  assignment 8->4(四个 shim 的 version/icon 参数 str = None)、
  no-untyped-def 12->11(_rename_federation_assets 缺返回标注),
  fixture 与 docs/refactor/optimization-checklist.md 的全量 mypy 计数
  9,371 -> 9,366 同步更新。依赖、复杂度、ruff、并发等其余基线无变化。

Co-authored-by: jxxghp <jxxghp@gmail.com>
2026-09-14 07:19:46 +08:00
…
…
…
…
…
…
…
…

MoviePilot

简体中文 | English

GitHub Repo stars GitHub forks GitHub contributors GitHub repo size GitHub issues Docker Pulls Docker Pulls V2 Docker Pulls V3 Platform

Redesigned from parts of NAStool, with a stronger focus on core automation scenarios while reducing issues and making the project easier to extend and maintain.

For learning and personal communication only. Please do not promote this project on platforms in mainland China.

Release channel: https://t.me/moviepilot_channel

Key Features

  • Focuses on the core media automation flow: subscriptions, search, downloads, file organization, scraping, media server refresh, and notifications.
  • Uses a separated backend/frontend architecture: FastAPI for the backend and Vue 3 for the frontend.
  • Connects download clients, media servers, metadata providers, message channels, plugins, workflows, and AI Agent capabilities.
  • For feature details, screenshots, and product entry points, see https://movie-pilot.org

Installation and Usage

Docker is the recommended deployment model. V3 uses the dedicated jxxghp/moviepilot-v3 image; V2 and legacy images keep their existing names. Compose examples, environment variables, volume mappings, and upgrade notes are maintained in the official wiki:

MoviePilot can also be installed and managed from source with the local CLI:

curl -fsSL https://raw.githubusercontent.com/jxxghp/MoviePilot/v3/scripts/bootstrap-local.sh | bash

After installation, use the moviepilot command for initialization, service management, updates, and configuration. See docs/cli.md for the full command reference.

Agent

  1. MoviePilot includes a built-in AI Agent. After model configuration, it can call system tools through natural language to help with search, subscriptions, downloads, organization, diagnostics, and other management tasks.

  2. Other agents can import the repository skills/ directory to gain MoviePilot operation capabilities. Environments that support the skills CLI can use:

    npx skills add https://github.com/jxxghp/MoviePilot
    

    Built-in skills live in skills/. For custom skill authoring, see skills/create-moviepilot-skill/SKILL.md.

  3. Other MCP clients can call MoviePilot tools through /api/v1/mcp. Authentication, client configuration, and tool APIs are documented in docs/mcp-api.md.

Development

Before contributing, read the repository rules and local environment guide, keep changes focused, and validate them before opening a PR. Useful entry points:

Disclaimer

  • This software is for learning and personal communication only. It must not be used for commercial purposes or illegal activities. The software does not know how users choose to use it, and all responsibility rests with the user.
  • The source code is open source and derived from other open-source code. If someone removes the relevant restrictions and redistributes or publishes modified versions that lead to liability events, the publisher of those modifications bears full responsibility. Public releases that bypass or alter the user authentication mechanism are not recommended.
  • This project does not accept donations and has not published any donation page anywhere. The software itself is free of charge and does not provide paid services. Please verify information carefully to avoid being misled.

Contributors

Description
No description provided
Readme GPL-3.0 139 MiB
Languages
Python 99.4%
Shell 0.4%
Dockerfile 0.2%