Skip to content

Conversation

@Soulter
Copy link
Member

@Soulter Soulter commented Dec 26, 2025

fixes: #4202

Modifications / 改动点

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果


Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Summary by Sourcery

将内置插件从旧的 packages 目录迁移到 astrbot/builtin_stars 包中,并相应更新核心引用。

增强内容:

  • 更新插件管理器的路径和模块前缀,使其从 astrbot.builtin_stars 而不是 packages 中加载内置插件。
  • 调整与插件相关的日志、唤醒检查以及 LLM 工具上下文处理逻辑,以适配新的内置插件包路径。
  • 收紧类型检查器的配置,从 pyproject.toml 中的包含源路径里移除 packages

文档:

  • 更新内部 Copilot 使用说明,记录内置插件的新位置 astrbot/builtin_stars/
Original summary in English

Summary by Sourcery

Move built-in plugins from the legacy packages directory into the astrbot/builtin_stars package and update core references accordingly.

Enhancements:

  • Update plugin manager paths and module prefixes to load built-in plugins from astrbot.builtin_stars instead of packages.
  • Adjust plugin-related logging, wake-up checks, and LLM tool context handling to align with the new built-in plugin package path.
  • Tighten type-checker configuration by dropping packages from the included source paths in pyproject.toml.

Documentation:

  • Revise internal Copilot instructions to document the new astrbot/builtin_stars/ location for built-in plugins.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Dec 26, 2025
@dosubot dosubot bot added the area:core The bug / feature is about astrbot's core, backend label Dec 26, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我发现了 1 个问题,并且给出了一些整体性的反馈:

  • _get_plugin_modules 中留下的 print(plugins) 看起来是调试遗留代码,应该移除或改成合适的日志记录,以避免在生产环境中向 stdout 输出多余的噪声。
  • is_plugin_path 中,直接在规范化后的路径里检查字面子串 "astrbot/builtin_stars/",在 Windows 上以及不同路径结构下可能会比较脆弱;建议使用 os.path.sep,结合 norm_path.split(os.path.sep) 里的成员检查,或者基于 Path 的检查方式,以提升可移植性和健壮性。
面向 AI Agents 的提示
Please address the comments from this code review:

## Overall Comments
- `_get_plugin_modules` 中留下的 `print(plugins)` 看起来是调试遗留代码,应该移除或改成合适的日志记录,以避免在生产环境中向 stdout 输出多余的噪声。
-`is_plugin_path` 中,直接在规范化后的路径里检查字面子串 `"astrbot/builtin_stars/"`,在 Windows 上以及不同路径结构下可能会比较脆弱;建议使用 `os.path.sep`,结合 `norm_path.split(os.path.sep)` 里的成员检查,或者基于 `Path` 的检查方式,以提升可移植性和健壮性。

## Individual Comments

### Comment 1
<location> `astrbot/core/star/star_manager.py:164` </location>
<code_context>
             for p in _p:
                 p["reserved"] = True
             plugins.extend(_p)
+        print(plugins)
         return plugins

</code_context>

<issue_to_address>
**issue:** 使用结构化日志来移除或替换裸 `print` 语句。

`_get_plugin_modules` 中的这句 `print(plugins)` 会在每次插件发现时执行,并产生嘈杂且不可配置的输出。如果不再需要,请将其删除;如果仍然需要这些信息,请通过项目的日志记录器,并使用合适的日志级别(例如 debug)来输出。
</issue_to_address>

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The print(plugins) left in _get_plugin_modules looks like a debugging artifact and should be removed or replaced with proper logging to avoid noisy stdout in production.
  • In is_plugin_path, checking for the literal substring "astrbot/builtin_stars/" in a normalized path may be brittle on Windows and with varying path layouts; consider using os.path.sep and in norm_path.split(os.path.sep) or Path-based checks for portability and robustness.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `print(plugins)` left in `_get_plugin_modules` looks like a debugging artifact and should be removed or replaced with proper logging to avoid noisy stdout in production.
- In `is_plugin_path`, checking for the literal substring `"astrbot/builtin_stars/"` in a normalized path may be brittle on Windows and with varying path layouts; consider using `os.path.sep` and `in norm_path.split(os.path.sep)` or `Path`-based checks for portability and robustness.

## Individual Comments

### Comment 1
<location> `astrbot/core/star/star_manager.py:164` </location>
<code_context>
             for p in _p:
                 p["reserved"] = True
             plugins.extend(_p)
+        print(plugins)
         return plugins

</code_context>

<issue_to_address>
**issue:** Remove or replace the raw print statement with structured logging.

This `print(plugins)` in `_get_plugin_modules` runs on every discovery and adds noisy, unconfigurable output. Please remove it, or route it through the project logger at an appropriate level (e.g., debug) if you still need this information.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

for p in _p:
p["reserved"] = True
plugins.extend(_p)
print(plugins)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: 使用结构化日志来移除或替换裸 print 语句。

_get_plugin_modules 中的这句 print(plugins) 会在每次插件发现时执行,并产生嘈杂且不可配置的输出。如果不再需要,请将其删除;如果仍然需要这些信息,请通过项目的日志记录器,并使用合适的日志级别(例如 debug)来输出。

Original comment in English

issue: Remove or replace the raw print statement with structured logging.

This print(plugins) in _get_plugin_modules runs on every discovery and adds noisy, unconfigurable output. Please remove it, or route it through the project logger at an appropriate level (e.g., debug) if you still need this information.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 26, 2025
@Soulter Soulter merged commit 5255388 into master Dec 26, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 使用 uv 部署 astrbot 时,丢失系统内置插件

3 participants