docs(skills): AGENTS.md 平台中立化,国内网络换源抽到技能根目录一份

This commit is contained in:
2026-11-11 19:38:21 +08:00
parent 10bf2f554b
commit d03d8ba95b
7 changed files with 45 additions and 19 deletions
+5
View File
@@ -289,6 +289,10 @@ health 只作为「端口上有服务但不是本启动器拉起的」兜底提
(报什么错、敲什么),不写背景、不提服务器。起点是 `env-local` 提示词的一句话:技能失败就读
`"$(dirname "$AGENT_SKILLS_DEPS")/<技能>/AGENTS.md"`。装完不需要重启,旧进程不影响。
分两层写,避免四份重复漂移:技能目录的 `AGENTS.md` 只写该技能特有的(缺哪个包、缺什么系统库);
网络类的(pip / npm / GitHub / brew 换源)全局只需要一份,放在技能根目录
`"$(dirname "$AGENT_SKILLS_DEPS")/AGENTS.md"`,各技能的清单末尾指过去。
代价明写:`office` 的命令入口在本地不在 PATH 上,按次 `PATH="$SK/scripts:$PATH" office ...` 即可
(这是它 `AGENTS.md` 的第一条)。
@@ -299,6 +303,7 @@ health 只作为「端口上有服务但不是本启动器拉起的」兜底提
| `office` 封装层 ENOENT | 本技能 `AGENTS.md` 绝对路径 |
| `x2pdf` 缺包 / 无渲染后端 | 同上 |
| `image-process` 缺中文字体 | 同上(并提示传 `font`) |
| 网络类(pip / npm / GitHub / brew) | 由技能清单指到技能根目录的 `AGENTS.md`(只有一份) |
唯一保留的环境相关代码是 `x2pdf` 的 `find_soffice()`:`brew install --cask libreoffice` 后
`soffice` 不在 PATH(在 app bundle 内),不探这几个默认位置,“装 LibreOffice 即可”就是假的。
+12
View File
@@ -0,0 +1,12 @@
# 技能排错:国内网络
各技能自己的 `AGENTS.md` 只写它特有的问题;凡是网络类的(直连超时、装包失败、下载卡住),按这里换源,
别反复重试或长时间干等:
- pip:加 `-i https://pypi.tuna.tsinghua.edu.cn/simple`
- npm:加 `--registry=https://registry.npmmirror.com`
- GitHub 下载:地址前加 `https://gh-proxy.com/`(备用 `https://ghfast.top/`)
- brew:换清华/中科大镜像,或让用户自己装
- 缺运行时/系统包用本机包管理器(`apt` / `dnf` / `pacman` / `brew` / `winget`);需要密码时先问用户
本文件不被 core 读取,只在技能报错信息里被间接指向。
+2 -1
View File
@@ -20,12 +20,13 @@
```
skills/
├── AGENTS.md # 技能排错与国内网络换源(可选参考;core 不读)
└── <skill-name>/
├── SKILL.md # 技能描述文件(必须)
├── run.py # 技能主入口(Python 脚本,推荐)或 run.sh
├── requirements.txt # Python 依赖(可选,若需要第三方包)
├── install.sh # 系统级依赖安装脚本(可选,如 apt-get)
├── AGENTS.md # 本机排错命令(可选;core 不读,只在技能报错信息里被指向)
├── AGENTS.md # 该技能的排错命令(可选;core 不读,只在报错信息里被指向)
└── ... # 其他技能相关文件(如字体、模板等)
```
+4 -2
View File
@@ -1,9 +1,11 @@
# document-photo-to-pdf
`ModuleNotFoundError`(`numpy` / `PIL` / `fitz`)
`ModuleNotFoundError`(`numpy` / `PIL` / `fitz`):把依赖装进 `$AGENT_SKILLS_DEPS`
```sh
python3 -m pip install --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/document-photo-to-pdf/requirements.txt"
```
`fitz` 是 `pymupdf` 的 import 名。`pypdfium2` 不用装。
`fitz` 是 `pymupdf` 的 import 名,`pypdfium2` 不用装。没有 `python3` 先装运行时(Windows 上解释器常是 `python` / `py`)。
网络慢或装不上(pip / GitHub 等):见技能根目录的 `AGENTS.md`。
+6 -4
View File
@@ -1,15 +1,17 @@
# image-process
`ModuleNotFoundError: No module named 'PIL'`
`ModuleNotFoundError: No module named 'PIL'`:把依赖装进 `$AGENT_SKILLS_DEPS`
```sh
python3 -m pip install --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/image-process/requirements.txt"
```
`中文水印缺少字体`:传 `font` 参数
`中文水印缺少字体`:传 `font` 参数,指向本机任意中文字体文件(ttf/ttc)
```json
{"action":"watermark","input":"a.jpg","text":"机密","font":"/System/Library/Fonts/Hiragino Sans GB.ttc"}
{"action":"watermark","input":"a.jpg","text":"机密","font":"<本机中文字体路径>"}
```
字体:macOS `/System/Library/Fonts/Hiragino Sans GB.ttc`;Linux `/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc`;Windows `C:\Windows\Fonts\msyh.ttc`。
找字体:Linux `fc-list :lang=zh`;macOS `ls /System/Library/Fonts`;Windows `C:\Windows\Fonts\msyh*`。
网络慢或装不上(pip / GitHub 等):见技能根目录的 `AGENTS.md`。
+8 -5
View File
@@ -1,18 +1,21 @@
# office
`office: command not found`
`office: command not found`:用技能自带入口
```sh
PATH="$(dirname "$AGENT_SKILLS_DEPS")/office/scripts:$PATH" office help
```
`office.core binary missing`
`office.core binary missing`:按本机平台下载对应资产到 `bin/officecli`(Windows 存成 `bin/officecli.exe`),再 `chmod +x`
```sh
SK="$(dirname "$AGENT_SKILLS_DEPS")/office"
curl -fL --progress-bar -o "$SK/bin/officecli" \
https://github.com/iOfficeAI/OfficeCLI/releases/latest/download/officecli-mac-x64
curl -fL -o "$SK/bin/officecli" \
https://github.com/iOfficeAI/OfficeCLI/releases/latest/download/officecli-<平台>-<架构>
chmod +x "$SK/bin/officecli"
```
资产按 `uname -sm` 选:`officecli-mac-x64` / `officecli-mac-arm64` / `officecli-linux-x64` / `officecli-linux-arm64`。下载慢就在地址前加 `https://gh-proxy.com/`。
资产名是 `{mac,linux,win}-{x64,arm64}`,如 `officecli-mac-arm64`、`officecli-linux-x64`、`officecli-win-x64.exe`;
musl 系统(Alpine)用 `officecli-linux-alpine-{x64,arm64}`。`uname -sm` 可判断平台与架构。
网络慢或装不上(GitHub 下载 / brew 等):见技能根目录的 `AGENTS.md`。
+8 -7
View File
@@ -1,17 +1,18 @@
# x2pdf
`ModuleNotFoundError`(文本类报 `markdown`,或提示 WeasyPrint 不可用)
`ModuleNotFoundError`(`markdown`)或提示 WeasyPrint 不可用:把依赖装进 `$AGENT_SKILLS_DEPS`
```sh
python3 -m pip install --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/x2pdf/requirements.txt"
```
WeasyPrint 还要系统库:macOS `brew install pango`。
WeasyPrint 还要系统库 pango/cairo:Linux `apt install libpango-1.0-0 libpangocairo-1.0-0 libcairo2`;
macOS `brew install pango`;Windows 装不起来就跳过——有 LibreOffice 时文本类会自动回落。
Office 类(docx/xlsx/pptx)报「未找到 LibreOffice」
Office 类(docx/xlsx/pptx)报「未找到 LibreOffice」:装一个 LibreOffice
(Linux `apt install libreoffice`;macOS `brew install --cask libreoffice`;
Windows `winget install TheDocumentFoundation.LibreOffice`)。
```sh
brew install --cask libreoffice
```
装了 LibreOffice 后文本类也能用(回落路径,`page` 的边距/页码与部分 CSS 不生效),此时不必装 pango。
装了 LibreOffice 后文本类也能用(自动回落,`page` 的边距/页码与部分 CSS 不生效),此时不必装 pango。
网络慢或装不上(pip / brew / winget 等):见技能根目录的 `AGENTS.md`。