feat: 支持本地 WASM 文件构建#13
Open
geekspeng wants to merge 1 commit into
Open
Conversation
88a7c59 to
6a71cc3
Compare
6a71cc3 to
366f8a1
Compare
无需修改 plugins.properties,直接把 plugin.wasm 放进仓库的 plugins/ 目录,按目录约定 plugins/<插件名>/<版本>/plugin.wasm 自动识别。 新增构建参数 USE_LOCAL_PLUGINS(默认 false):Dockerfile 改为多 阶段构建(builder-base / local-true / local-false / builder), 仅在 USE_LOCAL_PLUGINS=true 时由 local-true stage 执行 COPY plugins/ 把本地源纳入构建上下文,并向 pull_plugins.py 传入 --use-local;脚本下载阶段发现本地已存在同名同版本即跳过下载。 最后统一调用 generate_all_metadata() 遍历 plugins/<name>/<version>/ plugin.wasm,按实际文件(重新)生成 metadata.txt,覆盖下载/本地预置/ 未在 properties 中定义的自定义插件三种来源。 Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: geekspeng <geekspeng@icloud.com>
366f8a1 to
d1e77cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
把自定义/自编译的
plugin.wasm放进仓库的plugins/目录,而不是每次都从 OCI 仓库拉取。改动
Dockerfile:新增COPY plugins/ ./plugins/,把本地plugins/<name>/<version>/plugin.wasm带入构建镜像。.gitignore+plugins/.gitkeep:保留plugins/目录被 git 跟踪(否则全新克隆后COPY plugins/会因源缺失失败),同时把构建产物排除出库。pull_plugins.py:process_plugin()增加早返回:若本地plugin.wasm已存在则跳过下载。generate_all_metadata(),把metadata.txt生成从各插件内下沉到末尾统一处理——既能覆盖下载/跳过的官方插件,也能覆盖未在plugins.properties中出现的自定义插件。README.md:补充两种典型用法(新增自定义插件 / 覆盖官方插件)及目录结构示例。使用方式
新增自定义插件
在
plugins/<插件名>/<版本>/下放置plugin.wasm,无需写入plugins.properties,构建时自动识别并生成metadata.txt。覆盖官方插件
保留
plugins.properties中该插件的 OCI 配置,同时把plugin.wasm放到同名同版本目录下,脚本检测到本地副本后会跳过下载。注意--download-v2还会处理 2.0.0 版本,要覆盖哪个版本就把文件放进对应版本目录。验证
python3 -c "import ast; ast.parse(...)"语法检查通过。plugins/foo/2.0.0/plugin.wasm存在 +--download-v2时,早返回触发 → 跳过下载 → 末尾generate_all_metadata生成 metadata。✓.gitignore规则:/plugins/*不匹配点文件,!/plugins/.gitkeep为防御性写法,挡掉未来误加.*通配时把占位文件吞掉。✓🤖 Generated with Claude Code