Files
sap-cli-skill/docs/RELEASING.md
T
吴让宇 a903278427
CI / test (3.10) (push) Waiting to run
CI / test (3.11) (push) Waiting to run
CI / test (3.12) (push) Waiting to run
chore: 更新文档内写死的工具目录路径
工具源目录由 D:\Gitee 迁移至 D:\Gitea,同步修正规则文件与文档中的路径引用。
2026-09-16 01:10:01 +08:00

98 lines
4.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 开发与发布
## 本仓是唯一来源(2026-09-11 起)
`sap-cli-skill` 同时是**技能分发包**与**工具源码仓**,也是 SAP 相关实机操作的运行版。
`sap-cli` 源码仓已**归档**(只读留档),不再接受改动。
```
sap-cli-skill/
├── SKILL.md ← 技能文档(手工维护,AI Agent 使用指南)
├── INSTALL.md ← 完整安装指南(手工维护)
├── README.md ← 项目说明
├── VERSION ← 版本号(须与 assets/sapcli/__version__ 一致)
├── assets/ ← 工具源码与打包元数据(Python 包根)
│ ├── sapcli/ ← 工具源码
│ ├── main.py
│ ├── pyproject.toml ← 版本动态取自 sapcli.__version__
│ ├── requirements.txt
│ └── config.ini.example
├── references/ ← 规则正本(sap-tool-constraints / abap-coding-rules / error-handling
├── tests/ ← 单元测试与 E2E 夹具
├── log/ ← 错误知识库(LLM-WIKI 格式,md 入库)
├── docs/ ← 开发文档、ADT 原理文档
├── openspec/ ← SDD 规格
├── scripts/setup.py ← 安装脚本
├── .claude/rules/ ← 规则副本(供 Claude Code,须与 references/ 一致)
└── .github/workflows/ ← CI
```
> 目录语义说明:`assets/` 是**技能包**的载荷目录(Hermes / Claude Code 技能约定),
> 因此工具源码放在其中而非仓库根。安装与调用都指向 `assets/`。
## 日常开发
```bash
cd D:/Gitea/sap-cli-skill
# 装依赖(editable
pip install -e "./assets[dev]"
# 跑全量测试(692 例)
python -m unittest discover -s tests -p "test_*.py"
# 只跑单元测试(更快)
python -m unittest discover -s tests/unit -t .
```
改代码 → 改文档(需要时)→ 跑测试 → 提交。**未绿不提交。**
## 版本与发布
版本号权威源是 `assets/sapcli/__init__.py``__version__`
1.`assets/sapcli/__init__.py``__version__`
2. 同步 `VERSION` 文件(`test_repo_guards.py` 会断言二者一致,忘了会红)
3. 提交并打 tag
```bash
git add -A && git commit -m "chore: bump to vX.Y.Z"
git tag -a vX.Y.Z -m "sap-cli vX.Y.Z"
git push origin HEAD && git push origin vX.Y.Z
```
发布即推送本仓。Hermes 侧无需拷贝——`profiles/*/skills/productivity/sap-cli`
是指向本仓的 junction,专家下一轮即读到新内容。
## 规则文件:两处副本必须一致
`references/*.md` 是**正本**(随技能分发给专家、被 `SKILL.md` 引用);
`.claude/rules/*.md` 是供 Claude Code 读取的**副本**。
两者内容必须一致,由 `tests/unit/test_repo_guards.py` 的
`TestRuleCopiesInSync` 断言。改规则时**两处都要改**,只改一处测试会红。
## 两道守卫(提交前必过)
`tests/unit/test_repo_guards.py` 守住几类「静默失效」:
| 守卫 | 防的问题 |
|------|----------|
| SKILL.md 记录 parser **全部** CLI 命令 | 文档与代码脱节(曾只写 9 个而实际 31 个) |
| 铁律 1–5 是**真实小节标题** | 子串检查被正文交叉引用蒙过 |
| 示例不得出现 `--path ./src` | 违反铁律 5 的目录结构 |
| `references/` 规则齐备且含关键规则 | 规则静默丢失 |
| `VERSION` == `sapcli.__version__` == README 版本 | 版本漂移(曾 2.3.0 vs 2.5.1 |
| `.claude/rules/` == `references/` | 规则副本漂移 |
## 已废弃的做法(勿再使用)
- **`pack_skill.py` / `skill-src/SKILL.md.tmpl` 打包流程**——已随 sap-cli 归档。
现在 `SKILL.md` 是手工维护的正本,**没有构建步骤**,也就没有「构建覆盖手改」的风险。
不要再引入「模板渲染 → 覆盖仓库文档」这类机制。
- **`D:/Codespace/SAP-CLI-SKILL`**——早期开发副本,与分发仓同远端,2026-09-11 已删除。
- **向 `D:/Gitea/sap-cli` 提交改动**——已归档。
## Gitee 远程
https://gitee.com/markwury168/sap-cli-skill.git