chore: isolate shared dsh plugins into independent monorepo
This commit is contained in:
51
scripts/dsh-plugin-install.sh
Normal file
51
scripts/dsh-plugin-install.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# dsh-plugin-install.sh — install shared @deepseek-ai/* plugins from the Gitea
|
||||
# npm registry into a DSH profile and wire them into cordis.patch.yml.
|
||||
set -euo pipefail
|
||||
|
||||
PROFILE="${1:-web}"
|
||||
DSH_HOME="${DSH_HOME:-$HOME/.dsh}"
|
||||
TOKEN="${GITEA_NPM_TOKEN:-}"
|
||||
|
||||
REGISTRY="https://git.byte-mate.ru/api/packages/Coder/npm/"
|
||||
|
||||
PROFILE_DIR="$DSH_HOME/profiles/$PROFILE"
|
||||
if [ ! -d "$PROFILE_DIR" ]; then
|
||||
echo "Profile dir not found: $PROFILE_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Profile dir: $PROFILE_DIR"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# 1. Ensure .npmrc scoped registry + token.
|
||||
NPMRC="$PROFILE_DIR/.npmrc"
|
||||
touch "$NPMRC"
|
||||
SCOPE_LINE="@deepseek-ai:registry=$REGISTRY"
|
||||
if ! grep -qF "$SCOPE_LINE" "$NPMRC"; then
|
||||
echo "$SCOPE_LINE" >> "$NPMRC"
|
||||
fi
|
||||
if [ -n "$TOKEN" ]; then
|
||||
sed -i.bak "/^\/\/.*:_authToken=/d" "$NPMRC" && rm -f "$NPMRC.bak"
|
||||
printf '//%s/:_authToken=%s\n' "$(printf '%s' "$REGISTRY" | sed 's#^https://##; s#/$##')" "$TOKEN" >> "$NPMRC"
|
||||
fi
|
||||
echo "Wrote $NPMRC"
|
||||
|
||||
# 2. Remove stale link: dependencies.
|
||||
pnpm --dir "$PROFILE_DIR" remove @deepseek-ai/dsh-web-search-searxng dsh-telegram-remote >/dev/null 2>&1 || true
|
||||
echo "Removed stale link dependencies (if any)"
|
||||
|
||||
# 3. Install the shared plugins from the Gitea registry.
|
||||
pnpm --dir "$PROFILE_DIR" add \
|
||||
"@deepseek-ai/dsh-tool-lab@0.1.0-rc.7" \
|
||||
"@deepseek-ai/dsh-web-search-searxng@0.1.0-rc.7" \
|
||||
"@deepseek-ai/dsh-telegram-remote@0.1.0"
|
||||
|
||||
# 4. Idempotently append insert blocks to cordis.patch.yml.
|
||||
PATCH_FILE="$PROFILE_DIR/cordis.patch.yml"
|
||||
node "$SCRIPT_DIR/patch-cordis.mjs" --file "$PATCH_FILE" --name "@deepseek-ai/dsh-tool-lab" --id tool-lab
|
||||
node "$SCRIPT_DIR/patch-cordis.mjs" --file "$PATCH_FILE" --name "@deepseek-ai/dsh-web-search-searxng" --id web-search-searxng
|
||||
node "$SCRIPT_DIR/patch-cordis.mjs" --file "$PATCH_FILE" --name "@deepseek-ai/dsh-telegram-remote" --id telegram-remote
|
||||
|
||||
echo ""
|
||||
echo "Done. Plugins installed into $PROFILE profile. Restart dsh to load them."
|
||||
Reference in New Issue
Block a user