Repository navigation
[1415] feat(cli): gf pi install 支持本地扩展目录安装 - #107
Merged
Merged
Conversation
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.
概述
在 HEAD(单文件安装/卸载重构)基础上,支持
gf pi install <目录>安装多文件扩展包。约定:源目录须含
gfcode/<name>/index.scm(与gf pi link包发现一致)。改动
核心
code/liii/pi/code/core/extensions/install.scm%copytree-rec(新增):递归拷贝目录树(path-list+path-mkdir+path-copy),补齐无 copytree 的能力缺口。%resolve-package-source(新增):严格只认gfcode/<name>/index.scm,不 fallback 单文件(区别于 link 用的pi-resolve-link-source会 fallback,install 语义需严格)。pi-install-extension改为cond分流:gfcode/<name>/→ 自覆盖校验 → already-exists → force 时 rmtree 旧目录再 copytree → 返回路径。pi-uninstall-extension改为cond:单文件path-unlink/ 目录rmtree/ 都不在则 value-error。(liii shutil)(用rmtree)。CLI 层
help.scm:install 用法改为<file.scm | dir>,说明含包目录约定。impl.scm:参数描述改为 "a .scm file or package directory"。测试
pi-install-dir-extension-test.scm:目录安装、加载校验(含子库 import)、重复报错、force 覆盖、局部安装、无 index.scm 报错、自覆盖报错。run-pi-test.scm:补 CLI 端目录安装→重复失败→卸载目录流程。端到端验证(真实 gfcode-simplify)
源目录
C:\Users\darcy\git\gfcode-simplify,~/.gf/gfcode/simplify原为指向它的软链接:gf pi install <dir>(无 --force,目标已存在)→Error: Extension already exists: ...simplify (use --force to overwrite)✓gf pi install --force <dir>→ 软链接被替换为真实拷贝目录,6 文件与源diff -r完全一致 ✓gf pi uninstall simplify→ 目录被删除 ✓注:Windows
path-resolve不解析符号链接,故自覆盖校验不会误命中已链接目标,already-exists 优先报出。