# 「财之道」WorkBuddy — Windows 核心插件一键初始化脚本 # 自动定位「财之道」独立安装目录内置 CLI 与 %USERPROFILE%\.caizhidao 数据目录,与原版 DeepSeek Harness 完全隔离。 $ErrorActionPreference = "Continue" if (-not $env:DSH_HOME -or [string]::IsNullOrWhiteSpace($env:DSH_HOME)) { $env:DSH_HOME = Join-Path $env:USERPROFILE ".caizhidao" } $Candidates = @( (Join-Path $env:LOCALAPPDATA "Programs\财之道\resources\runtime\cli\bin\dsh.cmd"), (Join-Path $env:LOCALAPPDATA "Programs\Caizhidao\resources\runtime\cli\bin\dsh.cmd") ) $DshCli = $null if ($env:DSH_CLI) { $DshCli = $env:DSH_CLI } else { foreach ($candidate in $Candidates) { if (Test-Path -LiteralPath $candidate -PathType Leaf) { $DshCli = $candidate break } } if (-not $DshCli) { $cmd = Get-Command "dsh" -ErrorAction SilentlyContinue if ($cmd) { $DshCli = $cmd.Source } } } if (-not $DshCli) { Write-Host "未找到「财之道」内置命令行工具。请先安装并打开一次「财之道」Windows 桌面端,再重跑本脚本。" -ForegroundColor Yellow exit 1 } Write-Host "=== 使用 CLI: $DshCli | 数据目录: $env:DSH_HOME ===" -ForegroundColor Cyan $CorePlugins = @( "dshmarket", "dsh-better-sidebar", "dsh-context", "billion-context", "@zilliz/memsearch-dsh", "github:xiaoheizi1212/dsh-computer-use", "github:xmanrui/dsh-im", "github:CatNebulaaaa/wps-dsh-plugin", "github:ZhuoSir/dsh-cron" ) $FailedPlugins = @() Write-Host "=== 开始为「财之道」安装核心插件包 ===" -ForegroundColor Cyan foreach ($pkg in $CorePlugins) { Write-Host ">>> 正在安装: $pkg" & $DshCli plugin --profile desktop add $pkg if ($LASTEXITCODE -ne 0) { Write-Host " [警告] $pkg 安装失败 (退出码 $LASTEXITCODE)。若提示 git 依赖构建限制,请在应用内插件市场确认授权或手动重试。" -ForegroundColor Yellow $FailedPlugins += $pkg } } $Succeeded = $CorePlugins.Count - $FailedPlugins.Count if ($FailedPlugins.Count -eq 0) { Write-Host "=== 全部 $($CorePlugins.Count) 个核心插件安装成功!请重新打开「财之道」桌面客户端 ===" -ForegroundColor Green } else { Write-Host "=== 核心插件处理完成:成功 $Succeeded 个,失败 $($FailedPlugins.Count) 个 ($($FailedPlugins -join ", ")) ===" -ForegroundColor Yellow Write-Host "请打开「财之道」桌面客户端,并在应用内插件市场对失败项手动重试。" -ForegroundColor Yellow }