[AI][Fix #26] 防止 slug 冲突时静默覆盖已有前任(数据丢失)#31
Open
josephmqiu wants to merge 1 commit into
Open
Conversation
Without pypinyin (documented as optional), slugify() stripped all non-ASCII characters and fell back to "ex" for every Chinese-only nickname, and create_skill() overwrote existing files unconditionally (exist_ok=True) — so creating a second ex silently destroyed the first, with no warning and no archive. - slugify() now returns "" instead of falling back to "ex"; the create path exits with a clear error suggesting pypinyin or an explicit --slug - create_skill() raises FileExistsError when the target directory already exists instead of overwriting - SKILL.md (zh + en) Step 5 gains a step-0 collision check: stop and ask the user instead of silently overwriting - README/README_EN/requirements.txt: pypinyin documented as required for Chinese nicknames Fixes perkfly#26 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qxv8G25EYkYzQyY6FdJ6qH
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.
Important
🤖 AI 声明:本 PR 由 AI 模型 Claude Fable 5(Anthropic,运行于 Claude Code)编写并在本地测试,经 @josephmqiu 授权提交。
Fixes #26
问题
未安装 pypinyin 时(文档标注它为"可选"),
slugify()的 fallback 会丢弃所有非 ASCII 字符——任何纯中文昵称都退化为"ex";而create_skill()全程exist_ok=True且无条件覆盖写入。组合结果:创建第二个前任会静默覆盖第一个的全部数据(memories.md / persona.md / meta.json),无提示、无存档、不可恢复。改动
slugify()生成失败时返回空字符串(不再退化为"ex"),create 路径对空 slug 明确报错并提示安装 pypinyin 或显式传入--slugcreate_skill()在目标目录已存在时抛出FileExistsError,拒绝静默覆盖;CLI 捕获后友好报错退出exes/{slug}是否已存在,存在则停下询问用户(换 slug 或确认覆盖并先存档)本地测试
🤖 Generated with Claude Code
https://claude.ai/code/session_01Qxv8G25EYkYzQyY6FdJ6qH