Metadata-Version: 2.4
Name: tg-bot-plugin-buildkit
Version: 0.1.0
Summary: 基于共享合同核心构建并校验 TG-BOT 插件 bundle。
Author: Fire Dragons
License: MIT
Requires-Python: >=3.11
Requires-Dist: tg-bot-plugin-contract-core==0.1.1
Provides-Extra: dev
Requires-Dist: pytest>=8.3.0; extra == 'dev'
Description-Content-Type: text/markdown

# tg-bot-plugin-buildkit

`tg-bot-plugin-buildkit` 是面向 TG-BOT 单插件仓库的可复用构建与校验 CLI。

它封装共享 `tg-bot-plugin-contract-core` 包，并提供：

- `build`
- `inspect`
- `verify`
- `validate --mode same-profile`
- `validate --mode target-profile`
- `benchmark`
- `install-local --dev-unsigned`

## 本地开发

该包的正式发布形态固定依赖已发布的 `tg-bot-plugin-contract-core==0.1.1`。

如果需要在未发布改动上进行本地多仓联调，CLI 仍可通过以下环境变量解析兄弟仓源码：

- `TG_BOT_PLUGIN_CONTRACT_CORE_SRC=/path/to/tg-bot-plugin-contract-core/src`

这条桥接路径只作为开发态回退，不再是正式 CI / release 的 canonical 依赖方式。

## CI / 发布

- 仓库 CI 会执行：
  - `pytest`
  - wheel / sdist 构建
  - Docker builder 镜像构建 smoke test
- `tag push v*` 会额外执行：
  - `tag == project.version` 校验
  - PyPI 发布
  - GHCR builder 镜像发布
  - GitHub Release 附件上传
- 可复用 workflow `release-plugin.yml` 用于单插件仓库正式发版，固定执行：
  - `tag == manifest.plugin_version` 校验
  - `build`
  - `inspect`
  - `verify`
  - `validate --mode same-profile`
  - `validate --mode target-profile`
  - 可复现性 smoke check
  - bundle 产物上传 / Release asset 发布

## 使用方式

```bash
python -m tg_bot_plugin_buildkit.cli build --source-dir ./plugin
python -m tg_bot_plugin_buildkit.cli inspect --bundle ./dist/plugins/demo/demo-1.2.3-cpython-3.13-linux-x86_64-gnu.tgpkg
python -m tg_bot_plugin_buildkit.cli verify --bundle ./dist/plugins/demo/demo-1.2.3-cpython-3.13-linux-x86_64-gnu.tgpkg
python -m tg_bot_plugin_buildkit.cli validate --mode same-profile --bundle ./dist/plugins/demo/demo-1.2.3-cpython-3.13-linux-x86_64-gnu.tgpkg
python -m tg_bot_plugin_buildkit.cli install-local --bundle ./dist/plugins/demo/demo-1.2.3-cpython-3.13-linux-x86_64-gnu.tgpkg --plugin-root ./plugins --dev-unsigned
```

`build` 默认会排除 Git/CI/测试/虚拟环境与 `dist` 等仓库控制或生成目录，避免把仓库元数据和旧 bundle 再次打进新的 `.tgpkg`。
