Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,4 @@ name: Plugin tests
on: [push, pull_request, workflow_dispatch]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: plugin
- uses: astral-sh/setup-uv@v5
with:
version: "0.12.13"
- uses: actions/checkout@v4
with:
repository: lendevs/LenBot
ref: 078d91e0a69948755f6b81dec89aab15842a9fae
path: host-source
- run: uv python install 3.13
- run: uv venv --python 3.13
- run: uv pip install ./host-source pytest pytest-asyncio
- name: Install declared plugin dependencies
run: |
uv run --no-project --python .venv/bin/python python -c 'import pathlib,tomllib; data=tomllib.loads(pathlib.Path("plugin/plugin.toml").read_text()); pathlib.Path("plugin-requirements.txt").write_text("\n".join(data.get("dependencies", [])))'
uv pip install --requirements plugin-requirements.txt
- run: uv run --no-project --python ../.venv/bin/python python -m pytest -q --confcutdir=tests
working-directory: plugin
- name: Check runtime ZIP resources
run: uv run --no-project --python ../.venv/bin/python python scripts/package.py "$RUNNER_TEMP/plugin.zip"
working-directory: plugin
uses: lendevs/LenBot/.github/workflows/plugin-ci.yml@master
16 changes: 2 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,5 @@ on:
permissions:
contents: write
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "0.12.13"
- run: uv python install 3.13
- name: Package plugin
run: uv run --no-project --python 3.13 python scripts/package.py "plugin-${GITHUB_REF_NAME}.zip"
- name: Publish ZIP
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" "plugin-${GITHUB_REF_NAME}.zip" --verify-tag --notes-file CHANGELOG.md
release:
uses: lendevs/LenBot/.github/workflows/plugin-release.yml@master
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 1.1.0

适配 LenBot 首版 0.2.0 的插件接口 1:显式工具简介、参数说明、按需共享指南与 JSON 结果。使用新增接口的版本需要包含插件生态改造的最终 0.2.0 基线;早期同版本开发提交不支持。
需要 LenBot 0.2.0 起的插件接口 1(从 `len_bot.plugin` 导入)。插件名、配置和业务数据不变,无需数据迁移。

保留原插件名、配置和业务数据,无需数据迁移。与旧宿主共同回退时须使用原插件版本。当前为未发行开发版本;只提交源码,不创建版本标签或 Release。

模板保留查询和后台发送两个工具,增加按业务能力合并与严格 action 分支的作者说明;本次仍是开发改动,未创建标签或 Release。
- 模板保留查询(`counter_read`)和后台发送(`counter_card`)两个工具,并说明怎样按业务能力合并工具、用严格的 `action` 分支组织相关操作。
- CI 和发行改用 LenBot 提供的可复用工作流。
- 工具带显式简介和参数说明,相关用法写在按需加载的共享指南里,结果返回 JSON。
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Counts are stored per group and survive source updates.
uv run --no-sync pytest -q tests
```

Tests use the host's `PluginTest` harness to simulate messages and configuration, so LenBot does not need to run. CI installs the host version pinned in `.github/workflows/ci.yml`; update it when you move to a newer host.
Tests use the host's `PluginTest` harness to simulate messages and configuration, so LenBot does not need to run. CI calls LenBot's reusable workflow, which tests and packages the plugin against host `master` by default; pass `host_ref` in `.github/workflows/ci.yml` to pin a host version.

## Releasing

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
uv run --no-sync pytest -q tests
```

测试用宿主提供的 `PluginTest` 模拟消息和配置,不用启动 LenBot。CI 会安装 `.github/workflows/ci.yml` 里固定的宿主版本再跑测试,升级宿主时改这个版本。
测试用宿主提供的 `PluginTest` 模拟消息和配置,不用启动 LenBot。CI 调用 LenBot 提供的可复用工作流,默认用宿主 `master` 跑测试和打包检查;需要固定宿主版本时在 `.github/workflows/ci.yml` 里传 `host_ref`。

## 发布

Expand All @@ -45,9 +45,9 @@ uv run --no-sync pytest -q tests

工具采用接口 1 的显式简介、Field 参数说明与 `prompts/tools.md` 共享指南,返回原生 JSON 或文本。用 `PluginTest.preview_tools()` 查看模型说明、参数与可用性;模型服务默认关闭,真实发送仍单独核对。兼容和更新事项见 [CHANGELOG](CHANGELOG.md)。

CI 固定到包含当前插件接口的宿主开发提交;本次未创建版本标签或 Release。catalog-entry.json 只记录开发安装来源,未公开插件不加入主目录。
CI 调用 LenBot 的可复用工作流,跟随宿主 master 测试;本次未创建版本标签或 Release。catalog-entry.json 只记录开发安装来源,未公开插件不加入主目录。

本机生成 ZIP:`uv run --no-project --python 3.13 python scripts/package.py /tmp/plugin.zip`。打包取 Git 已跟踪的运行源码和资源,新增文件需先加入 Git;不会收录本机环境、测试或配置。
本机生成 ZIP(LenBot 仓库与本仓库放在同一目录下):`uv run --no-project --python 3.13 python ../LenBot/scripts/package_plugin.py . /tmp/plugin.zip`。打包取 Git 已跟踪的运行源码和资源,新增文件需先加入 Git;不会收录本机环境、测试或配置。

## 工具数量与能力边界

Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""A copyable plugin using only the public interface."""

from len_bot.next.plugin import Invocation, Plugin, command, fullmatch, tool
from len_bot.plugin import Invocation, Plugin, command, fullmatch, tool


class Counter(Plugin):
Expand Down
24 changes: 0 additions & 24 deletions scripts/package.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from len_bot.next.plugin_testing import PluginTest
from len_bot.plugin_testing import PluginTest


@pytest.mark.asyncio
Expand Down