feat: add version tracking and update mechanism

- Add VERSION file (1.2.0)
- SKILL.md Step 1: auto-check for updates on each run
- SKILL.md: add "更新" auxiliary function (git pull)
- README: install via git clone instead of cp/ln
- build_openclaw.py: include VERSION in dist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wangzhuc 2026-03-30 15:20:22 +08:00
parent 1e4a74f930
commit f1e9c084d9
4 changed files with 24 additions and 8 deletions

View file

@ -122,19 +122,21 @@ python3 toolkit/cli.py themes
## 安装 ## 安装
**Claude Code**
```bash ```bash
git clone https://github.com/oaker-io/wewrite.git git clone --depth 1 https://github.com/oaker-io/wewrite.git ~/.claude/skills/wewrite
cd wewrite cd ~/.claude/skills/wewrite && pip install -r requirements.txt
pip install -r requirements.txt
``` ```
### 挂载为 Skill **OpenClaw**
**Claude Code**`cp -r wewrite ~/.claude/skills/wewrite` ```bash
git clone --depth 1 https://github.com/oaker-io/wewrite.git ~/.openclaw/skills/wewrite
cd ~/.openclaw/skills/wewrite && pip install -r requirements.txt
```
**OpenClaw**`ln -s /path/to/wewrite/dist/openclaw ~/.openclaw/skills/wewrite` 安装后 skill 会在每次运行时自动检查新版本。有更新时说"更新"即可升级。
> `dist/openclaw/` 是自动构建的 OpenClaw 兼容版工具名、路径变量已转换push to main 时 CI 自动更新。
### 配置(可选) ### 配置(可选)

View file

@ -53,6 +53,7 @@ allowed-tools:
- 读取 `writing-config.yaml`(如存在),检查是否有 AI 特征参数emotional_arc: flat、paragraph_rhythm: structured、closing_style: summary - 读取 `writing-config.yaml`(如存在),检查是否有 AI 特征参数emotional_arc: flat、paragraph_rhythm: structured、closing_style: summary
- 读取 `history.yaml` 最近 5 篇,检查 persona 使用和 WebSearch 降级情况 - 读取 `history.yaml` 最近 5 篇,检查 persona 使用和 WebSearch 降级情况
4. 综合输出自然语言报告 + 按优先级排序的改进建议 4. 综合输出自然语言报告 + 按优先级排序的改进建议
- 用户说"更新"/"更新 WeWrite"/"升级" → 在 `{skill_dir}` 执行 `git pull origin main`,完成后告知版本变化
--- ---
@ -73,6 +74,17 @@ python3 -c "import markdown, bs4, cssutils, requests, yaml, pygments, PIL" 2>&1
| `wechat.appid` + `secret` | 静默 | 设 `skip_publish = true` | | `wechat.appid` + `secret` | 静默 | 设 `skip_publish = true` |
| `image.api_key` | 静默 | 设 `skip_image_gen = true` | | `image.api_key` | 静默 | 设 `skip_image_gen = true` |
**1a-2. 版本检查**(静默通过或提醒):
```bash
cd {skill_dir} && git fetch origin main --quiet 2>/dev/null
```
比对本地 `{skill_dir}/VERSION` 与远程 `git show origin/main:VERSION`
- 相同 → 静默通过
- 不同 → 提示用户:"WeWrite 有新版本可用(当前 X → 最新 Y说「更新」即可升级。"**不阻断流程**,继续 Step 1b
- git 不可用(无 .git 目录或 fetch 失败)→ 静默跳过
**1b. 加载风格** **1b. 加载风格**
``` ```

1
VERSION Normal file
View file

@ -0,0 +1 @@
1.2.0

View file

@ -23,6 +23,7 @@ COPY_FILES = [
"config.example.yaml", "config.example.yaml",
"style.example.yaml", "style.example.yaml",
"writing-config.example.yaml", "writing-config.example.yaml",
"VERSION",
] ]
# Frontmatter keys to strip (OpenClaw ignores allowed-tools) # Frontmatter keys to strip (OpenClaw ignores allowed-tools)