fix(export): 离线包的 install.sh 别再教在包目录里跑 lc code (#52) - #54
Merged
Conversation
install.sh 的收尾指引是「在当前目录接着跑 ... ./bin/lc code」,而紧邻的上一行 正是 `lc init`——它把全部上游的地址与凭证写进了那个目录的 .env。这就是 #46 / #50 两次踩坑的 happy path 的源头之一:包里的安装脚本自己在教。 #52 之后 lc code 在这种情况下会拒绝启动,所以这条指引不改就是「按包里的提示 走,走到一半被工具拒绝」,而那种体验的第一反应是去找怎么关掉那个检查。 改成先 cd 到自己的项目目录,并给出 $(pwd)/bin/lc code 的绝对路径(可直接粘贴), 再说清为什么不能在包目录里跑,以及确实要在那里干活时的逃生阀。 test-export.sh 补 6 条断言:静态模板 4 条(不再出现 ./bin/lc code、教了 cd、 说清会被拒绝、给了逃生阀),真跑一遍 install.sh 的那条路径 2 条(stdout 里 $(pwd) 已展开,顺带钉住给的是绝对路径)。 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.
#52 的收尾补丁。#53 合并后我复查了「还有哪里在教用户在仓库/包目录里跑
lc code」,发现漏了一处,而且是最要紧的那处。问题
lc export生成的install.sh(bin/lc里的INSTALL_SH模板)收尾是:「在当前目录接着跑」+
lc init+lc code三行连在一起 ——lc init刚把全部上游的地址与凭证写进这个目录的.env,紧接着就让你在同一个目录里启动 Codex。这就是 #46 / #50 两次踩坑的 happy path 的源头之一:包里的安装脚本自己在教。#53 之后
lc code在这种情况下会拒绝启动,所以这条指引不改,内网侧的人的体验就是「按包里的提示一行一行走,走到最后一行被工具拒绝」。那种体验的第一反应不是「哦我该 cd」,而是「这个检查怎么关掉」——正好是 #52 决策里最想避免的结果。docs/offline-deployment.md第 3 节的写法一直是对的(cd /path/to/your-project再跑),漏的只有生成的install.sh。改动
$(pwd)由 install.sh 运行时展开(它开头就cd "$(dirname "$0")"),所以给出的是可直接粘贴的绝对路径 —— 用户cd到自己项目之后,相对路径./bin/lc就不管用了,这一点原来的指引不需要考虑,现在需要。怎么验证的
scripts/test-export.sh补 6 条断言(ci.yml已有bash scripts/test-export.sh,不需要动.github/):静态模板([3a],总是跑):
refute "./bin/lc code"—— 这条是防回归的主锚:包里的安装脚本永远不该出现相对路径的lc code,因为它只在包目录里有意义cd /path/to/your-project--allow-workspace-secrets真跑一遍 install.sh([6],有 docker 时跑):
./bin/lc code$DIR2/bin/lc code——$(pwd)真的展开成了绝对路径,不是把字面量$(pwd)打给用户看本地全套:
py_compile/bash -n/lc --help/test-project-metadata.py/test-version.sh/test-entrypoint.sh/test-codex-review-script.sh/test-doctor-probe.sh/test-lc-secrets.sh/test-lc-commands.sh/test-export.sh全绿;git status --short干净。Refs #52
🤖 Generated with Claude Code