Files
lyxy-document/openspec/specs/skill-packaging/spec.md
lanyuanxiaoyao 58093e0877 feat: 添加 skill 打包脚本 build.py
新增 build.py 实现 skill 自动化打包:
- 一键完成 skill/SKILL.md 和 scripts/ 打包到 build/
- 时间戳版本号格式 YYYYMMDD_HHMMSS
- 仅复制 .py 文件,避免创建空目录
- 添加 skill-packaging spec 文档
2026-03-09 01:37:36 +08:00

55 lines
2.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.
## Purpose
提供自动化的 skill 打包能力,将 skill/SKILL.md 和 scripts/ 目录打包到 build/ 目录,便于 skill 分发。
## Requirements
### Requirement: build.py 一键打包
系统 SHALL 提供 build.py 脚本,运行后完成 skill 的完整打包流程。
#### Scenario: 运行 build.py 成功
- **WHEN** 用户执行 `uv run python build.py`
- **THEN** 脚本完成所有打包步骤并输出成功信息
### Requirement: 构建目录清理重建
系统 SHALL 在每次构建前删除整个 build 目录,然后重建空的 build 目录。
#### Scenario: 删除并重建 build 目录
- **WHEN** 构建开始
- **THEN** 脚本删除整个 build 目录(如有),然后创建新的空 build 目录
### Requirement: SKILL.md 复制
系统 SHALL 将 skill/SKILL.md 直接复制到 build/SKILL.md不保留 skill 这一级目录。
#### Scenario: SKILL.md 成功复制
- **WHEN** 构建执行
- **THEN** build/SKILL.md 文件存在且内容与 skill/SKILL.md 一致
### Requirement: scripts 目录复制
系统 SHALL 将 scripts/ 目录完整复制到 build/scripts/,保持目录结构。
#### Scenario: scripts 目录结构保留
- **WHEN** 构建执行
- **THEN** build/scripts/ 下的子目录结构与原 scripts/ 一致
### Requirement: 仅复制 Python 文件
系统 SHALL 只复制 .py 扩展名的文件,其他文件类型自然被过滤。
#### Scenario: 只保留 py 文件
- **WHEN** 原目录包含多种文件类型
- **THEN** build/scripts/ 中只存在 .py 文件
### Requirement: 时间戳版本号
系统 SHALL 生成 YYYYMMDD_HHMMSS 格式的时间戳作为构建版本标识。
#### Scenario: 时间戳格式正确
- **WHEN** 构建在 2025年3月9日 14点30分22秒执行
- **THEN** 生成的版本号为 20250309_143022
### Requirement: 输出构建信息
系统 SHALL 在构建完成后打印版本号和构建结果信息。
#### Scenario: 显示构建信息
- **WHEN** 构建成功完成
- **THEN** 控制台输出版本号和构建文件清单