refactor: 本仓升为唯一源(原 sap-cli 源码仓归档)

方向反转:此前 SKILL.md 是「模板渲染产物」、sap-cli 是源;现 sap-cli 归档,
sap-cli-skill 承接开发与分发,SKILL.md 回归手工维护的正本。

迁移(来自 sap-cli,共 104 文件):
- tests/           692 例测试(15 个文件的内联 sys.path 改指 assets/)
- openspec/        SDD 规格与归档变更(42 文件)
- docs/            开发文档与 ADT 原理(含 dev/CLAUDE.md、AGENTS.md)
- .claude/         rules 副本 + settings.json(供 Claude Code)
- .github/ .hermes/ .pre-commit-config.yaml .editorconfig CLAUDE.md
- scripts/ 保持仅 setup.py(pack_skill.py 已随旧仓归档,不迁)

修复(迁移暴露的真实缺陷):
- assets/pyproject.toml 的 build-backend 写作 `setuptools.backends._legacy:_Backend`,
  该模块在 setuptools 中不存在 → `pip install -e` 从来装不上。改为 build_meta。
  实测:临时 venv 安装成功,sap-cli --help 正常列出 31 个命令
- pyproject readme 指向不存在的 assets/README.md(editable 安装会失败)→ 改内联文本
- pyproject urls 改指 sap-cli-skill

机制调整:
- .github/workflows/ci.yml 适配 assets/ 布局;顶部注明该工作流仅 GitHub 执行,
  本仓在 Gitee 不会自动跑
- pre-commit 增本地测试门禁(Gitee 上真正生效的那道)
- .gitignore 合并旧仓完整规则(保留 log/ 下 md 知识库入库,只忽略运行日志)
- 大文件上限 100KB→1MB(架构图 512KB)

守卫测试 tests/unit/test_repo_guards.py(10 → 18 例):
- SKILL.md 须记录 parser 全部 CLI 命令 / 铁律 1-5 须为真实小节标题 / 示例不得违反铁律 5
- references/ 规则齐备;.claude/rules 与 references 必须一致(实测抓到一次真实漂移)
- VERSION == sapcli.__version__ == README 版本
- 仓内不得再出现 pack_skill.py / skill-src(防废弃流程回潮)

698 tests OK;editable 安装与 CLI 入口经临时 venv 实测通过。
docs/RELEASING.md 重写为单源开发流程。
This commit is contained in:
吴让宇
2026-09-11 00:40:15 +08:00
parent e786742bcb
commit c5905a5b1e
104 changed files with 20744 additions and 10 deletions
+47
View File
@@ -0,0 +1,47 @@
# Configuration Management Specification
## Purpose
定义 sap-cli 的配置管理功能行为,包括配置查看、设置和多 profile 管理。
## Requirements
### Requirement: Configuration Display
系统 SHALL 显示当前的 SAP 连接配置。
#### Scenario: Show current config
- **WHEN** 用户执行 config show 命令
- **THEN** 系统显示当前生效的配置项(主机、客户端、用户名),密码以掩码显示
### Requirement: Configuration Setting
系统 SHALL 支持通过命令行设置配置项。
#### Scenario: Set config value
- **WHEN** 用户执行 config set 命令并指定键和值
- **THEN** 系统将配置值保存到配置文件中
### Requirement: Multi-Profile Management
系统 SHALL 支持多 SAP 系统配置 profile。
#### Scenario: List profiles
- **WHEN** 用户执行 config list 命令
- **THEN** 系统显示所有已配置的 profile 列表
#### Scenario: Use specific profile
- **WHEN** 用户通过 --profile 参数指定 profile
- **THEN** 系统使用该 profile 的配置连接对应的 SAP 系统
### Requirement: Secure Password Storage
系统 SHALL 支持通过系统密钥环安全存储 SAP 密码。
#### Scenario: Save password to keyring
- **WHEN** 用户配置密码存储选项
- **THEN** 密码保存到操作系统密钥环而非明文配置文件
#### Scenario: Load password from keyring
- **WHEN** 配置文件中未指定密码但密钥环中存在
- **THEN** 系统从密钥环读取密码