diff --git a/docs/INSTALL.md b/docs/INSTALL.md index fd2ea47..5f7ed1d 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -60,12 +60,16 @@ Open `dsh web`, new session → preset **Netx Ops**. See [TOOL_MAP.md](TOOL_MAP.md). -## Local debug (DeepSeekHarness checkout) +## Local `link:` / path install -See [examples/local-debug/README.md](../examples/local-debug/README.md). - -Rebuild the Plugins card after editing `src/client/`: +When you `dsh plugin add D:\path\to\netxops`, pnpm junctions the checkout **outside** the profile tree. Node then resolves imports from that checkout, so DSH peer packages (`@deepseek-ai/schemastery`, …) are invisible unless you link them once: ```powershell -bun run bundle +powershell -File .\scripts\link-dsh-peers.ps1 ``` + +Unix: `./scripts/link-dsh-peers.sh` + +(Requires a prior `dsh web` / profile boot so `~/.dsh/profiles/node_modules` exists.) + +npm / GitHub installs place the package under the profile `node_modules` and do **not** need this step. diff --git a/examples/local-debug/README.md b/examples/local-debug/README.md index d4c434c..3c45e7b 100644 --- a/examples/local-debug/README.md +++ b/examples/local-debug/README.md @@ -4,10 +4,13 @@ ```powershell cd D:\project\chatgpt\netxops +powershell -File .\scripts\link-dsh-peers.ps1 powershell -File .\scripts\link-preset.ps1 powershell -File .\scripts\set-netx-token.ps1 -Token (Get-Content D:\project\chatgpt\netx\data\auth\mcp_token -Raw).Trim() ``` +`link-dsh-peers.ps1` is required for path/`link:` installs: Node resolves peers from the checkout realpath, not from the profile `node_modules`. Run it after the first successful `dsh` boot (so `~/.dsh/profiles/node_modules` exists). + From DeepSeekHarness (source): ```powershell diff --git a/package.json b/package.json index 3443f11..0d3719f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-netxops", - "version": "0.1.3", + "version": "0.1.4", "description": "DeepSeek Harness Netx Ops: host bridge + Plugins settings card + agent preset", "license": "MIT", "type": "module", @@ -77,6 +77,9 @@ "@deepseek-ai/dsh-api-remotes": "*", "react": "^18.2.0 || ^19.0.0" }, + "dependencies": { + "@deepseek-ai/schemastery": "*" + }, "devDependencies": { "@types/react": "~18.3.1", "typescript": "^5.8.0" diff --git a/scripts/link-dsh-peers.ps1 b/scripts/link-dsh-peers.ps1 new file mode 100644 index 0000000..3ca8dff --- /dev/null +++ b/scripts/link-dsh-peers.ps1 @@ -0,0 +1,56 @@ +# Link DSH peer packages into this checkout for local `dsh plugin add ` / `link:`. +# +# Node resolves imports from the realpath of a linked package. A junction out of +# ~/.dsh/profiles//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" diff --git a/scripts/link-dsh-peers.sh b/scripts/link-dsh-peers.sh new file mode 100644 index 0000000..b3a2201 --- /dev/null +++ b/scripts/link-dsh-peers.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Link DSH peer packages into this checkout for local `dsh plugin add ` / `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"