refactor(agents): 删除 tools:agent:publish 命令,补全 helper.php 函数覆盖机制,修正多处文档 bug

- 删除 tools:agent:publish 整套(不再兼容多套 IDE,只保留 .agents 目录)
- helper.php 全部 27 个全局函数加 if (!function_exists()) 包裹,项目侧可在 app/common.php 定义同名函数覆盖
- ulthon-file-override-mechanism.md 新增全局函数覆盖章节
- AGENTS.md 删除智能体指导章节,PHP 8+ 改为 8.0+,MySQL 8+ 改为 5.7+
- AGENTS.md 项目结构树补全 tests/、extend/think/、source/ 子项
- README.md PHP 版本统一为 8.0+
- ulthon-base-app-architecture SKILL 路径补 admin/service/ 段
- ulthon-tools-http-call SKILL 补 --page-data 参数
- ulthon-naming-convention 补元数据头
- ulthon-update-workflow 统一 extend/think/ 归类
This commit is contained in:
augushong
2026-07-21 19:35:28 +08:00
parent 4a4155070d
commit 600ee5b085
12 changed files with 261 additions and 484 deletions

View File

@@ -81,6 +81,26 @@ Ulthon Admin 在"类继承覆盖"之外,还提供"文件级覆盖"能力:业
- 覆盖某控制器视图:在 `app/admin/view/<controller>/<action>.html` 放同名文件
- 覆盖 CURD 迁移模板:在 `app/common/command/curd/migrate.tpl` 放同名文件
## 全局函数覆盖
`extend/base/helper.php` 里的所有全局函数都有 `if (!function_exists('xxx'))` 包裹。项目侧如需覆盖某个全局函数的行为(例如修复框架 bug 或调整实现),只需在 `app/common.php``include helper.php` 语句**之前**定义同名函数即可。
加载顺序:`app/common.php` 先执行 → 项目侧函数先定义 → `include helper.php``if (!function_exists())` 检查发现已存在 → 跳过框架版本。
示例:
```php
// app/common.php
function sysconfig($group, $name = null, $default = null) {
// 项目侧自定义实现
return my_custom_logic($group, $name, $default);
}
include App::getRootPath() . '/extend/base/helper.php';
```
注意:该机制是"函数级覆盖",与本文档前述三类"文件级覆盖"是独立机制。helper.php 中已包裹的函数清单见源码(截至当前版本共 27 个:`__url``flow_url``password``xdebug``sysconfig``array_format_key``auth``get_session_admin``read_header_token``json_message``unparse_url``build_upload_url``event_handle_result``event_handle_string``event_view_content``event_view_replace``event_view_replace_js``event_response``app_file_path``array_to_table``format_bytes``parse_bytes``get_store_value``set_store_value``get_site_version_key``format_null_value``ctype_numeric`)。
## 相关文件
- `extend/base/helper.php``app_file_path()` 定义)