Files
dsh-plugins/scripts/dsh-plugin-install.sh
Coder f686c1413c
Some checks failed
build-and-publish / build-test (push) Failing after 20s
build-and-publish / publish (push) Has been skipped
fix: install plugins via direct Gitea tarball URLs (core deps from npmjs)
2026-08-26 23:10:05 +07:00

48 lines
1.9 KiB
Bash

#!/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.
# Transitive @deepseek-ai/* core deps resolve from npmjs, not scoped to Gitea.
set -euo pipefail
PROFILE="${1:-web}"
DSH_HOME="${DSH_HOME:-$HOME/.dsh}"
BASE_URL="https://git.byte-mate.ru/api/packages/Coder/npm"
declare -a SPECS=()
add_plugin() {
local pkg="$1" version="$2"
local esc="${pkg//\//%2F}"
local basename="${pkg##*/}"
SPECS+=("$pkg@$BASE_URL/$esc/-/$version/$basename-$version.tgz")
}
add_plugin "@deepseek-ai/dsh-tool-lab" "0.1.0-rc.7" tool-lab
add_plugin "@deepseek-ai/dsh-web-search-searxng" "0.1.0-rc.7" web-search-searxng
add_plugin "@deepseek-ai/dsh-telegram-remote" "0.1.0" telegram-remote
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. Remove stale versions.
pnpm --dir "$PROFILE_DIR" remove \
@deepseek-ai/dsh-tool-lab @deepseek-ai/dsh-web-search-searxng @deepseek-ai/dsh-telegram-remote >/dev/null 2>&1 || true
echo "Removed stale versions (if any)"
# 2. Add plugins as direct tarball URLs from the Gitea npm registry.
pnpm --dir "$PROFILE_DIR" add "${SPECS[@]}"
# 3. 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."