Repository navigation
fix(plugin): 修 hooks 重复声明与安装副本污染,补打包脚本 - #19
Merged
Merged
Conversation
插件安装是整目录拷贝,不问 .gitignore。以仓库根直接作插件源时,克隆后自建的 docs/、memory/、AGENTS.md、.v2c 会一起进安装缓存,其中 project-info.md 与 AGENTS.md 含本机绝对路径。 pack_plugin.py 用 git ls-files 取已跟踪文件复制到 dist/,本机内容天然被排除—— 不需要维护白名单,仓库以后新增本机目录也不会失准。输出结构与真实分发一致:市场根 与插件根分开,marketplace.json 的 source 指向插件子目录。 --selftest 做正反两向校验:干净包必须零本机路径,放进一个含主目录的文本必须被抓到。 本机路径检测取 Path.home() 动态比对,不硬编码盘符与用户名。 .gitignore 加 dist/ 与 marketplace.json,两者都是打包产物,不入库。
清单写了 hooks: ./hooks/hooks.json,而 ZCode 会自动探测插件根的这个约定路径,同一份 文件被读两次,插件详情报 plugin_hook_invalid: Duplicate plugin hooks file ignored。 hook 本身没失效,但每装一次都留一条诊断噪声。 去掉显式字段交由自动探测,重装后 diagnostics 清空,hook 归一为一条 runnable: true。 CI 同时加 pack_plugin 的离线自检。
原说明写「粘贴克隆下来的目录」,但仓库根没有 marketplace.json,那样添加市场会失败。 即使能添加,装到的也是含 docs/、memory/ 的完整副本。 改为先跑 python tools/pack_plugin.py,再粘贴 dist/ 的绝对路径,并说明为什么要打包。 中英双版同步,工具表补 pack_plugin 与 check_plugin。
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.
做了什么
修掉插件安装的两个真问题,并纠正 README 里会失败的安装说明。
一、hooks 被读两次
清单写了
hooks: ./hooks/hooks.json,而 ZCode 会自动探测插件根的同一路径,报plugin_hook_invalid: Duplicate plugin hooks file ignored。hook 没失效,但每装一次留一条诊断。去掉显式字段交由自动探测后diagnostics清空。二、插件安装会把本机专属内容拷进缓存
ZCode 按目录树逐文件复制,不读
.gitignore。以仓库根作插件源时,docs/、memory/、AGENTS.md、.v2c全部进安装缓存,其中project-info.md、AGENTS.md含本机绝对路径。新增
tools/pack_plugin.py:用git ls-files取已跟踪文件复制到dist/,本机内容天然排除,不用维护白名单。输出市场根与插件根分开,与真实分发结构一致。三、README 安装说明会失败
原来写「粘贴克隆下来的目录」,但仓库根没有
marketplace.json,添加市场会失败。改为先python tools/pack_plugin.py再粘贴dist/绝对路径。验证
pack_plugin.py --selftest做正反两向:干净包零本机路径;放一个含主目录的文本必须被抓到。实测 126 文件、零泄漏。实机验证
装插件后真实会话
-p实测,四个 MCP 工具全部可见且可调用:query_atom(杯壶, 主图)→a21、a01;query_atom(美妆日化, 详情页)→a22、a01、a02,与判据一致。未验证
/菜单(UI 层,需新会话人工查看)