mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-09 05:10:45 +08:00
Fix local link: peer packages invisible outside profile tree.
Path installs junction the checkout outside ~/.dsh/profiles/*/node_modules, so Node cannot see DSH peers; add link-dsh-peers scripts and document the one-time setup. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fd1a86ec2f
commit
13db99484f
5 changed files with 101 additions and 6 deletions
56
scripts/link-dsh-peers.ps1
Normal file
56
scripts/link-dsh-peers.ps1
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Link DSH peer packages into this checkout for local `dsh plugin add <path>` / `link:`.
|
||||
#
|
||||
# Node resolves imports from the realpath of a linked package. A junction out of
|
||||
# ~/.dsh/profiles/<name>/node_modules therefore cannot see the profile's
|
||||
# hoisted peers or the healed profiles/node_modules fallback. Point the peers
|
||||
# this package imports at the shared installation copy instead.
|
||||
#
|
||||
# Usage (PowerShell):
|
||||
# .\scripts\link-dsh-peers.ps1
|
||||
# Optional:
|
||||
# .\scripts\link-dsh-peers.ps1 -DshHome $env:DSH_HOME
|
||||
|
||||
param(
|
||||
[string]$DshHome = $(if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE '.dsh' })
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = Split-Path -Parent $PSScriptRoot
|
||||
$SrcRoot = Join-Path $DshHome 'profiles\node_modules\@deepseek-ai'
|
||||
$DstRoot = Join-Path $Root 'node_modules\@deepseek-ai'
|
||||
|
||||
# Runtime imports from src/index.ts (and peers they commonly need nearby).
|
||||
$Peers = @(
|
||||
'schemastery',
|
||||
'cordis',
|
||||
'dsh-credentials',
|
||||
'dsh-settings',
|
||||
'dsh-mcp-client',
|
||||
'dsh-tools'
|
||||
)
|
||||
|
||||
if (-not (Test-Path $SrcRoot)) {
|
||||
throw "DSH installation fallback missing: $SrcRoot`nRun ``dsh web`` once (or any profile) so dsh heals profiles/node_modules."
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $DstRoot | Out-Null
|
||||
|
||||
foreach ($name in $Peers) {
|
||||
$src = Join-Path $SrcRoot $name
|
||||
$dst = Join-Path $DstRoot $name
|
||||
if (-not (Test-Path $src)) {
|
||||
throw "Peer not found under installation fallback: $src"
|
||||
}
|
||||
if (Test-Path $dst) {
|
||||
$item = Get-Item $dst -Force
|
||||
if ($item.LinkType -eq 'Junction' -or $item.Attributes -band [IO.FileAttributes]::ReparsePoint) {
|
||||
cmd /c "rmdir `"$dst`""
|
||||
} else {
|
||||
Remove-Item -Recurse -Force $dst
|
||||
}
|
||||
}
|
||||
New-Item -ItemType Junction -Path $dst -Target $src | Out-Null
|
||||
Write-Host "linked @deepseek-ai/$name -> $src"
|
||||
}
|
||||
|
||||
Write-Host "Done. Re-run: dsh web"
|
||||
29
scripts/link-dsh-peers.sh
Normal file
29
scripts/link-dsh-peers.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
# Link DSH peer packages into this checkout for local `dsh plugin add <path>` / `link:`.
|
||||
# See link-dsh-peers.ps1 for why.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
DSH_HOME="${DSH_HOME:-$HOME/.dsh}"
|
||||
SRC_ROOT="$DSH_HOME/profiles/node_modules/@deepseek-ai"
|
||||
DST_ROOT="$ROOT/node_modules/@deepseek-ai"
|
||||
PEERS=(schemastery cordis dsh-credentials dsh-settings dsh-mcp-client dsh-tools)
|
||||
|
||||
if [[ ! -d "$SRC_ROOT" ]]; then
|
||||
echo "DSH installation fallback missing: $SRC_ROOT" >&2
|
||||
echo "Run dsh web once so dsh heals profiles/node_modules." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DST_ROOT"
|
||||
for name in "${PEERS[@]}"; do
|
||||
src="$SRC_ROOT/$name"
|
||||
dst="$DST_ROOT/$name"
|
||||
if [[ ! -e "$src" ]]; then
|
||||
echo "Peer not found: $src" >&2
|
||||
exit 1
|
||||
fi
|
||||
rm -rf "$dst"
|
||||
ln -s "$src" "$dst"
|
||||
echo "linked @deepseek-ai/$name -> $src"
|
||||
done
|
||||
echo "Done. Re-run: dsh web"
|
||||
Loading…
Add table
Add a link
Reference in a new issue