fix(installer): prevent duplicate installs across skill roots - #36
Open
Wunrry wants to merge 1 commit into
Open
Conversation
SanHsien
added a commit
to SanHsien/dashi-ppt-skill
that referenced
this pull request
Sep 4, 2026
First four-axis review since the fork point. The commit axis is empty (the fork point is upstream's head); the PR and issue axes were both at zero, so this covers everything upstream has. Nothing adopted, no product file touched. The two Windows-relevant pull requests (chuspeeism#34 path case comparison, chuspeeism#28 native PowerShell render entry) are recorded with the condition that would make us revisit them, rather than cherry-picked into a tree this fork does not maintain. Issue chuspeeism#29 reproduces here: preview-freshness.mjs runs `npm run render:themes` and project/package.json has no such script, so theme preview breaks once it goes stale. Tracked as REVIEW.md R-06 and left for upstream to fix. Watermarks advanced to PR 36 / issue 43. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
起因
我通过下面的命令安装 skill:
安装完成后,我在 CLI 中调用
dashi-ppt,技能列表里出现了两个同名 skill。检查文件目录后发现,安装器分别写入了:~/.agents/skills/dashi-ppt~/.codex/skills/dashi-ppt这两个目录是两份独立副本。当前安装器会收集所有已经存在的候选 skills 目录,再逐个执行安装。用户同时使用通用 skills 目录和 CLI 自带目录时,一次安装就会产生多份副本。
两份副本会分别保存
.npmrc、node_modules和运行产物。它们后续可能出现配置或依赖差异,CLI 也可能同时发现两个同名 skill。修改内容
默认安装现在会先查找已有的
dashi-ppt。如果只找到一份,安装器会继续在原目录更新。旧名称dashiai-ppt也会进入这套判断,并沿用原来的迁移流程。全新安装优先写入通用目录
~/.agents/skills。这个目录不存在时,如果只检测到一个宿主目录,安装器会使用该目录。检测到多份已有安装时,安装器会列出所有路径并退出。检测到多个宿主目录,但无法判断该用哪一个时,也会停止安装。退出码为
2,已有文件不会被覆盖或删除。用户仍然可以明确选择安装方式:
--all保留了原来的多宿主安装能力。--dir和--all不能同时使用。中英文 README 和 npm 包内的安装说明也做了同步。
测试
新增了基于 Node.js
node:test的安装器集成测试。每个用例都会创建独立的临时 HOME 和最小 npm 包,不会读写用户真实的 skills 目录。测试覆盖全新安装、旧安装更新、旧名称迁移、重复安装检测、宿主目录回退、
--dir和--all等路径。测试结果:
安装器、发布脚本和测试文件也通过了
node --check,git diff --check没有发现空白错误。发布同步
npm-dist/publish-npm-skill.mjs中的注释说明,公开仓库里的安装器是发布流程同步出的审计副本。维护者发布新版本时,还需要把这次安装器改动同步回对应的私有开发仓库,避免后续发布覆盖本次修复。