fix: install plugins via direct Gitea tarball URLs (core deps from npmjs)
Some checks failed
build-and-publish / build-test (push) Failing after 20s
build-and-publish / publish (push) Has been skipped

This commit is contained in:
2026-08-26 23:06:25 +07:00
parent 81159a22e8
commit f686c1413c
5 changed files with 95 additions and 63 deletions

14
.gitignore vendored
View File

@@ -3,4 +3,16 @@ lib/
*.tsbuildinfo *.tsbuildinfo
*.tgz *.tgz
.unpublished .unpublished
dist/ dist/
# Local caches and scratch (never commit)
.npm-cache/
.pnpm-cache/
.pack-check/
.publish-tmp/
.test-dsh/
iso-install/
iso-install2/
e2e-dsh/
*.log
pnpm-debug.log*

View File

@@ -27,21 +27,35 @@ pnpm -r pack # контроль упаковки tarball
## Публикация ## Публикация
Для публикации в Gitea npm-реестр: Пакеты публикуются в Gitea npm-реестр (`https://git.byte-mate.ru/api/packages/Coder/npm/`)
под scope `@deepseek-ai/*`. Транзитивные core-зависимости (`@deepseek-ai/cordis`,
`dsh-settings`, `dsh-web`, `schemastery` и т.д.) тянутся из публичного npmjs —
реестр Gitea не проксирует npmjs, поэтому скоуп `@deepseek-ai` НЕ перенаправляется
на Gitea при установке.
### Через CI (рекомендуется)
1. Убедись, что в настройках репозитория есть секрет `GITEA_NPM_TOKEN` (токен 1. Убедись, что в настройках репозитория есть секрет `GITEA_NPM_TOKEN` (токен
пользователя `Coder` с правами на packages). пользователя `Coder` с правами на packages) — Settings → Actions → Secrets.
2. Создай git-тег с префиксом `v*` (например `v0.1.0-rc.7`) и запушь его. 2. Создай git-тег с префиксом `v*` (например `v0.1.0-rc.7`) и запушь его.
3. Gitea Actions запустит job `publish`: workflow проверяет `check-published.mjs`, 3. Job `publish` в `.gitea/workflows/publish.yml` соберёт пакеты и опубликует те,
какие пакеты ещё не опубликованы (идемпотентно), и публикует их в реестр. которых ещё нет (идемпотентно через `check-published.mjs`).
Публикация только по тегу; пуш в `main` гоняет `build-test` без публикации. Пуш в `main` гоняет только `build-test` (сборка + тесты), публикация — по тегу.
### Вручную
```sh
pnpm --filter @deepseek-ai/dsh-tool-lab publish --no-git-checks \
--registry https://git.byte-mate.ru/api/packages/Coder/npm/ \
"--//git.byte-mate.ru/api/packages/Coder/npm/:_authToken=$GITEA_NPM_TOKEN"
```
## Установка плагина ## Установка плагина
Скрипты-установщики ставят все три плагина в активный профиль DSH, пишут в Скрипты-установщики добавляют плагины в активный профиль DSH как **прямые tarball
`.npmrc` профиля scoped-registry `@deepseek-ai` → Gitea и идемпотентно URL из Gitea-реестра** (не скоупят `@deepseek-ai` — транзитивные core-зависимости
дописывают insert-записи в `cordis.patch.yml`. берутся из npmjs) и идемпотентно дописывают insert-записи в `cordis.patch.yml`.
### Windows ### Windows

12
pnpm-lock.yaml generated
View File

@@ -8,6 +8,18 @@ importers:
.: {} .: {}
.test-dsh/profiles/web:
dependencies:
'@deepseek-ai/dsh-telegram-remote':
specifier: workspace:*
version: link:../../../packages/telegram-remote
'@deepseek-ai/dsh-tool-lab':
specifier: workspace:*
version: link:../../../packages/tool-lab
'@deepseek-ai/dsh-web-search-searxng':
specifier: workspace:*
version: link:../../../packages/web-search-searxng
packages/telegram-remote: {} packages/telegram-remote: {}
packages/tool-lab: packages/tool-lab:

View File

@@ -4,9 +4,11 @@
DSH profile and wires them into cordis.patch.yml. DSH profile and wires them into cordis.patch.yml.
.DESCRIPTION .DESCRIPTION
Ensures the profile .npmrc maps the @deepseek-ai scope to the Gitea npm Adds the three shared plugins to the profile's package.json as direct
registry, installs the three shared plugins into the profile, removes stale tarball URLs pointing at the Gitea npm registry, installs them, removes
link: dependencies, and idempotently appends insert rows to cordis.patch.yml. stale link: dependencies, and idempotently appends insert rows to
cordis.patch.yml. Transitive @deepseek-ai/* core dependencies resolve from
the public npmjs registry (NOT scoped to Gitea).
.PARAMETER Profile .PARAMETER Profile
Profile name (directory under $DshHome\profiles). Default: 'web'. Profile name (directory under $DshHome\profiles). Default: 'web'.
@@ -27,12 +29,13 @@ param(
[string]$Token = $env:GITEA_NPM_TOKEN [string]$Token = $env:GITEA_NPM_TOKEN
) )
$registry = 'https://git.byte-mate.ru/api/packages/Coder/npm/' $baseUrl = 'https://git.byte-mate.ru/api/packages/Coder/npm'
$plugins = @( # Ordered: name → tarball path within the Gitea npm registry.
@{ Name = '@deepseek-ai/dsh-tool-lab'; Version = '0.1.0-rc.7'; Id = 'tool-lab' }, $plugins = [ordered]@{
@{ Name = '@deepseek-ai/dsh-web-search-searxng'; Version = '0.1.0-rc.7'; Id = 'web-search-searxng' }, '@deepseek-ai/dsh-tool-lab' = @{ Version = '0.1.0-rc.7'; Id = 'tool-lab' }
@{ Name = '@deepseek-ai/dsh-telegram-remote'; Version = '0.1.0'; Id = 'telegram-remote' } '@deepseek-ai/dsh-web-search-searxng' = @{ Version = '0.1.0-rc.7'; Id = 'web-search-searxng' }
) '@deepseek-ai/dsh-telegram-remote' = @{ Version = '0.1.0'; Id = 'telegram-remote' }
}
if (-not $DshHome) { $DshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $HOME '.dsh' } } if (-not $DshHome) { $DshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $HOME '.dsh' } }
$profileDir = Join-Path $DshHome "profiles\$Profile" $profileDir = Join-Path $DshHome "profiles\$Profile"
@@ -42,32 +45,26 @@ if (-not (Test-Path $profileDir)) {
} }
Write-Host "Profile dir: $profileDir" Write-Host "Profile dir: $profileDir"
# 1. Ensure .npmrc scoped registry + token. # 1. Remove stale link: dependencies (installed under the old scoped registry).
$npmrc = Join-Path $profileDir '.npmrc' & pnpm --dir $profileDir remove @deepseek-ai/dsh-tool-lab @deepseek-ai/dsh-web-search-searxng @deepseek-ai/dsh-telegram-remote 2>$null | Out-Null
$npmrcLines = if (Test-Path $npmrc) { Get-Content $npmrc } else { @() } Write-Host "Removed stale versions (if any)"
$scopeLine = "@deepseek-ai:registry=$registry"
$authLine = "//$($registry -replace 'https://','')/:_authToken=$token" # 2. Add plugins as direct tarball URLs from the Gitea npm registry.
if ($npmrcLines -notcontains $scopeLine) { $npmrcLines += $scopeLine } $specs = @()
if ($Token) { foreach ($pkg in $plugins.Keys) {
$npmrcLines = ($npmrcLines | Where-Object { $_ -notlike '//*:_authToken=*' }) $esc = $pkg -replace '/', '%2F'
$npmrcLines += $authLine $basename = ($pkg -split '/')[-1]
$meta = $plugins[$pkg]
$tarball = "$baseUrl/$esc/-/$($meta.Version)/$basename-$($meta.Version).tgz"
$specs += "$pkg@$tarball"
} }
Set-Content -Path $npmrc -Value $npmrcLines -Encoding ascii
Write-Host "Wrote $npmrc"
# 2. Remove stale link: dependencies.
& pnpm --dir $profileDir remove @deepseek-ai/dsh-web-search-searxng dsh-telegram-remote 2>$null | Out-Null
Write-Host "Removed stale link dependencies (if any)"
# 3. Install the shared plugins from the Gitea registry.
$specs = $plugins | ForEach-Object { "$($_.Name)@$($_.Version)" }
& pnpm --dir $profileDir add $specs & pnpm --dir $profileDir add $specs
# 4. Idempotently append insert blocks to cordis.patch.yml. # 3. Idempotently append insert blocks to cordis.patch.yml.
$patchFile = Join-Path $profileDir 'cordis.patch.yml' $patchFile = Join-Path $profileDir 'cordis.patch.yml'
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
foreach ($p in $plugins) { foreach ($pkg in $plugins.Keys) {
& node (Join-Path $scriptDir 'patch-cordis.mjs') --file $patchFile --name $p.Name --id $p.Id & node (Join-Path $scriptDir 'patch-cordis.mjs') --file $patchFile --name $pkg --id $plugins[$pkg].Id
} }
Write-Host "`nDone. Plugins installed into $Profile profile. Restart dsh to load them." Write-Host "`nDone. Plugins installed into $Profile profile. Restart dsh to load them."

View File

@@ -1,13 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# dsh-plugin-install.sh — install shared @deepseek-ai/* plugins from the Gitea # 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. # 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 set -euo pipefail
PROFILE="${1:-web}" PROFILE="${1:-web}"
DSH_HOME="${DSH_HOME:-$HOME/.dsh}" DSH_HOME="${DSH_HOME:-$HOME/.dsh}"
TOKEN="${GITEA_NPM_TOKEN:-}"
REGISTRY="https://git.byte-mate.ru/api/packages/Coder/npm/" 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" PROFILE_DIR="$DSH_HOME/profiles/$PROFILE"
if [ ! -d "$PROFILE_DIR" ]; then if [ ! -d "$PROFILE_DIR" ]; then
@@ -18,30 +30,15 @@ echo "Profile dir: $PROFILE_DIR"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 1. Ensure .npmrc scoped registry + token. # 1. Remove stale versions.
NPMRC="$PROFILE_DIR/.npmrc" pnpm --dir "$PROFILE_DIR" remove \
touch "$NPMRC" @deepseek-ai/dsh-tool-lab @deepseek-ai/dsh-web-search-searxng @deepseek-ai/dsh-telegram-remote >/dev/null 2>&1 || true
SCOPE_LINE="@deepseek-ai:registry=$REGISTRY" echo "Removed stale versions (if any)"
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. # 2. Add plugins as direct tarball URLs from the Gitea npm registry.
pnpm --dir "$PROFILE_DIR" remove @deepseek-ai/dsh-web-search-searxng dsh-telegram-remote >/dev/null 2>&1 || true pnpm --dir "$PROFILE_DIR" add "${SPECS[@]}"
echo "Removed stale link dependencies (if any)"
# 3. Install the shared plugins from the Gitea registry. # 3. Idempotently append insert blocks to cordis.patch.yml.
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" 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-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-web-search-searxng" --id web-search-searxng