60 lines
2.2 KiB
Markdown
60 lines
2.2 KiB
Markdown
# 构建与安装
|
||
|
||
## 安装(用户)
|
||
|
||
```bash
|
||
claude plugin marketplace add https://git.pchuan.top/cc-tools/notify.git
|
||
claude plugin install claude-code-notify@claude-code-notify
|
||
```
|
||
|
||
重启 Claude Code 后生效。插件的 `hooks/hooks.json` 指向 `${CLAUDE_PLUGIN_ROOT}/scripts/notify.cmd`,首次触发钩子时该脚本会从 Release 下载单文件 `notify.exe` 到 `bin/`,之后常驻。
|
||
|
||
引导脚本(`scripts/notify.cmd`、`scripts/notify.sh`)顶部的 `DOWNLOAD_URL` 决定从哪拉取 exe;下载用临时文件 + 原子改名 + mkdir 锁,并发触发不会重复下载。
|
||
|
||
## 从源码构建(开发)
|
||
|
||
框架依赖型,依赖已安装的 .NET 10 运行时:
|
||
|
||
```bash
|
||
cd Notify
|
||
dotnet build -c Release
|
||
# 产物:Notify/bin/Release/net10.0-windows/notify.exe + 同目录依赖 DLL
|
||
```
|
||
|
||
exe 必须和这些 DLL 在一起(.NET 从 exe 所在目录加载依赖)。
|
||
|
||
## 发布单文件(维护者)
|
||
|
||
NativeAOT 静态链接 Skia / HarfBuzz / ANGLE,产出**单个无依赖 exe**。原生链接需要 MSVC 工具链。
|
||
|
||
```bash
|
||
# 从 "Developer Command Prompt for VS" 运行,或用脚本(自动用 vswhere 配 vcvars)
|
||
scripts\build.bat
|
||
# 产物:bin\notify.exe(单文件,~40MB)
|
||
```
|
||
|
||
然后把它作为 Release 资产发布,并确保引导脚本的 `DOWNLOAD_URL` 指向它:
|
||
|
||
```bash
|
||
gh release create v0.1.0 bin/notify.exe
|
||
```
|
||
|
||
> AOT 配置在 `Notify/Notify.csproj`(`PublishAot` 条件块 + `CoreUtils.*.Static` 静态库包 + 发布后清理)。源生成 COM / UIAutomation 与静态渲染需真机运行验证,详见 [interop.md](interop.md)。
|
||
|
||
## 不接 Claude 的手动烟雾测试
|
||
|
||
```bash
|
||
notify host & # 起 Host(托盘出现)
|
||
echo {"session_id":"x","prompt":"hi"} | notify save
|
||
echo {"session_id":"x"} | notify notify # 弹窗
|
||
```
|
||
|
||
## 排错
|
||
|
||
| 现象 | 处理 |
|
||
|------|------|
|
||
| 首次触发慢 1~2 秒 | 首次会下载 exe + Host 冷启动(一次性),之后常驻、瞬时 |
|
||
| 没弹窗 | 先用手动烟雾测试确认程序本身正常;看托盘有没有图标 |
|
||
| 弹双份 | 同时装了原版 Rust 插件,删除其一 |
|
||
| 停止 Host | 托盘右键 → 退出,或 `taskkill /F /IM notify.exe` |
|