d144284 补了「Prerequisite: link the harness packages first」章节,但留下两处
与新章节自相矛盾的话,这一提交收掉:
1. README §Install 的安装注释 `npm install # nothing to install; dsh packages
are peers` —— 直接删。实测它不成立:干净副本里 npm install 只拉到 cordis
(四个 peer 里唯一非 optional 的)加它的传递依赖,dsh-llm /
dsh-system-prompt / dsh-tools 三个仍然缺;不 install 更彻底,四个全缺。
改成说明 peer 归属 + 指向前置章节的链接。
2. 新章节开头 `This repository has **no runtime dependencies**` —— 同样不成立
(lib/index.js 运行时 import 三个 @deepseek-ai 包)。改成「不以本插件自身
依赖的形式拉取任何东西」,把 peer 归属说清,并写明 npm install 只解决
cordis 一个。
3. 症状段补一句 npm run check 同样红(实测 exit=1,checkpoints.js 在 import
阶段就 ERR_MODULE_NOT_FOUND),原文只提了 npm test。
4. scripts/link-dsh.sh 头部注释里的 `zero runtime dependencies` 一并改成同义
但不撒谎的说法。
验证(自己跑,不转述)
- 干净副本 git archive HEAD + 本补丁,不 link:
not ok loader / phase-b-g / phase-b-h / plugin
# tests 34 # pass 30 # fail 4
npm run check exit=1(Cannot find package '@deepseek-ai/cordis')
- 同一副本 bash scripts/link-dsh.sh 之后:
# tests 120 # pass 120 # fail 0
npm run check exit=0,10 条 ✔
- npm install 单独一步(不 link)也复现:四文件 ERR_MODULE_NOT_FOUND,
缺的是 dsh-system-prompt / dsh-llm(cordis 已装)
- README 全文再无「nothing to install / no runtime dependencies / zero
runtime dependencies」类断言(grep 零命中)
- README 计数禁令仍绿,无 .orig/.rej/.bak 入库
更正一处旧结论:交接说「不 link 时 4 个文件 ERR_MODULE_NOT_FOUND」= 少 4 个
用例,不对。那四个文件在 import 阶段就死,用例根本没注册,所以 npm test 汇总
是 34 tests,不是 116/120。已在 README 里写成「a handful of tests rather than
the full suite」,避免再误导。
54 lines
1.5 KiB
Bash
Executable File
54 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Link the globally-installed dsh packages into node_modules.
|
|
#
|
|
# The plugin declares no dependency of its own, so nothing here is fetched from a
|
|
# registry. The dsh packages it *imports* at runtime are **peers**: they must come
|
|
# from the running harness, and npm will not install them for us. During
|
|
# development they live in
|
|
# /usr/lib/node_modules/@deepseek-ai (a global install), so this script wires them
|
|
# up by symlink instead of vendoring a copy that could drift from the harness.
|
|
#
|
|
# Usage: ./scripts/link-dsh.sh [global-modules-root]
|
|
set -euo pipefail
|
|
|
|
GLOBAL_ROOT="${1:-/usr/lib/node_modules}"
|
|
PEERS=(
|
|
cordis
|
|
cosmokit
|
|
dsh-llm
|
|
dsh-session
|
|
dsh-scope
|
|
dsh-system-prompt
|
|
dsh-tools
|
|
dsh-util-values
|
|
cordis-plugin-loader
|
|
)
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
if [[ ! -d "$GLOBAL_ROOT/@deepseek-ai" ]]; then
|
|
echo "error: $GLOBAL_ROOT/@deepseek-ai not found — pass the root that holds the dsh install" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p node_modules/@deepseek-ai
|
|
for peer in "${PEERS[@]}"; do
|
|
src="$GLOBAL_ROOT/@deepseek-ai/$peer"
|
|
if [[ ! -d "$src" ]]; then
|
|
echo " skip $peer (not installed)"
|
|
continue
|
|
fi
|
|
ln -sfn "$src" "node_modules/@deepseek-ai/$peer"
|
|
echo " link $peer"
|
|
done
|
|
|
|
# js-yaml is a transitive dep of cordis-plugin-include; needed only by the
|
|
# loader integration test, and only when it is not resolvable already.
|
|
if [[ -d "$GLOBAL_ROOT/js-yaml" && ! -e node_modules/js-yaml ]]; then
|
|
ln -sfn "$GLOBAL_ROOT/js-yaml" node_modules/js-yaml
|
|
echo " link js-yaml"
|
|
fi
|
|
|
|
echo
|
|
echo "done. try: npm test && npm run check"
|