dsh-ide-window 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +360 -0
- package/LICENSE +21 -0
- package/README.md +413 -2
- package/client.js +10798 -0
- package/cordis.patch.yml +4 -0
- package/enable-navigation.ps1 +189 -0
- package/enable-navigation.sh +131 -0
- package/icon.svg +25 -0
- package/index.js +1352 -0
- package/install.ps1 +203 -0
- package/install.sh +198 -0
- package/locale/en.json +217 -0
- package/locale/zh.json +217 -0
- package/package.json +68 -4
- package/platform/contract.js +46 -0
- package/platform/index.js +29 -0
- package/platform/macos.js +30 -0
- package/platform/windows.js +37 -0
package/install.ps1
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Install the dsh-ide-window plugin into a DSH profile (Windows).
|
|
2
|
+
#
|
|
3
|
+
# .\install.ps1 # clone/pull into %USERPROFILE%\dev\dsh-ide-window, install into `desktop`
|
|
4
|
+
# .\install.ps1 -Profile web # another profile
|
|
5
|
+
# .\install.ps1 -Dir C:\src\x # another checkout location
|
|
6
|
+
# .\install.ps1 -WithLsp # also add the LSP pipeline packages
|
|
7
|
+
# .\install.ps1 -NoPull # keep the checkout as it is
|
|
8
|
+
#
|
|
9
|
+
# Safe to re-run: an existing checkout is fast-forwarded, and installing an
|
|
10
|
+
# already linked package changes nothing. The DSH application itself is never
|
|
11
|
+
# modified.
|
|
12
|
+
#
|
|
13
|
+
# Only pnpm and plain PowerShell are used: the Electron binary is a GUI
|
|
14
|
+
# application on Windows, so driving it in Node mode from PowerShell would
|
|
15
|
+
# neither wait nor capture output.
|
|
16
|
+
param(
|
|
17
|
+
[string]$Profile = 'desktop',
|
|
18
|
+
[string]$Dir = $(if ($env:DSH_IDE_DIR) { $env:DSH_IDE_DIR } else { Join-Path $env:USERPROFILE 'dev\dsh-ide-window' }),
|
|
19
|
+
[switch]$WithLsp,
|
|
20
|
+
[switch]$NoPull
|
|
21
|
+
)
|
|
22
|
+
$ErrorActionPreference = 'Stop'
|
|
23
|
+
|
|
24
|
+
# A window that flashes and closes hides the reason. Every terminating error is
|
|
25
|
+
# printed with its source, and the console waits for a key before exiting.
|
|
26
|
+
trap {
|
|
27
|
+
Write-Host ''
|
|
28
|
+
Write-Host "安装失败:$($_.Exception.Message)" -ForegroundColor Red
|
|
29
|
+
if ($_.InvocationInfo -and $_.InvocationInfo.PositionMessage) {
|
|
30
|
+
Write-Host $_.InvocationInfo.PositionMessage -ForegroundColor DarkYellow
|
|
31
|
+
}
|
|
32
|
+
if ([Environment]::UserInteractive -and $Host.Name -ne 'ServerRemoteHost') {
|
|
33
|
+
Write-Host '按回车键退出…' -ForegroundColor Yellow
|
|
34
|
+
[void](Read-Host)
|
|
35
|
+
}
|
|
36
|
+
exit 1
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
$repoUrl = 'https://github.com/simons-jiang/dsh-ide-window.git'
|
|
40
|
+
$packageName = 'dsh-ide-window'
|
|
41
|
+
$lspPackages = @('@deepseek-ai/dsh-lsp@0.2.2-rc.3', '@deepseek-ai/dsh-lsp-stdio@0.2.2-rc.3')
|
|
42
|
+
|
|
43
|
+
function Step([string]$Text) { Write-Host "`n==> $Text" }
|
|
44
|
+
function Fail([string]$Text) {
|
|
45
|
+
Write-Host "错误:$Text" -ForegroundColor Red
|
|
46
|
+
throw "dsh-ide-window: $Text"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# ---- 1. locate DSH and pnpm -------------------------------------------------
|
|
50
|
+
|
|
51
|
+
Step '检查 DSH'
|
|
52
|
+
$candidates = @()
|
|
53
|
+
if ($env:LOCALAPPDATA) { $candidates += (Join-Path $env:LOCALAPPDATA 'Programs\DeepSeek Harness\DeepSeek Harness.exe') }
|
|
54
|
+
if ($env:ProgramFiles) { $candidates += (Join-Path $env:ProgramFiles 'DeepSeek Harness\DeepSeek Harness.exe') }
|
|
55
|
+
if (${env:ProgramFiles(x86)}) { $candidates += (Join-Path ${env:ProgramFiles(x86)} 'DeepSeek Harness\DeepSeek Harness.exe') }
|
|
56
|
+
$appBin = $null
|
|
57
|
+
foreach ($candidate in $candidates) {
|
|
58
|
+
if (Test-Path $candidate) { $appBin = $candidate; break }
|
|
59
|
+
}
|
|
60
|
+
if (-not $appBin) { Fail '没找到 DeepSeek Harness.exe,请先安装并登录 DSH。' }
|
|
61
|
+
Write-Host " DSH:$appBin"
|
|
62
|
+
|
|
63
|
+
$dshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE '.dsh' }
|
|
64
|
+
$profileDir = Join-Path $dshHome "profiles\$Profile"
|
|
65
|
+
|
|
66
|
+
# The copy DSH ships comes first: the profile was installed by that exact pnpm,
|
|
67
|
+
# and a different major version uses a different store directory — pnpm then
|
|
68
|
+
# refuses with ERR_PNPM_UNEXPECTED_STORE. PATH is only the fallback.
|
|
69
|
+
$pnpmCommand = $null
|
|
70
|
+
$pnpmArgs = @()
|
|
71
|
+
$runtime = Join-Path $dshHome 'dsh-runtimes\dsh-primary-runtime\dependencies'
|
|
72
|
+
$nodeExe = Join-Path $runtime 'node\node.exe'
|
|
73
|
+
$pnpmCjs = Join-Path $runtime 'pnpm\bin\pnpm.cjs'
|
|
74
|
+
if ((Test-Path $nodeExe) -and (Test-Path $pnpmCjs)) {
|
|
75
|
+
$pnpmCommand = $nodeExe
|
|
76
|
+
$pnpmArgs = @($pnpmCjs)
|
|
77
|
+
} else {
|
|
78
|
+
$onPath = Get-Command pnpm -ErrorAction SilentlyContinue
|
|
79
|
+
if ($onPath) { $pnpmCommand = $onPath.Source }
|
|
80
|
+
}
|
|
81
|
+
if (-not $pnpmCommand) { Fail '需要 pnpm:npm i -g pnpm(也可以先启动一次 DSH,它会自带一份 pnpm)。' }
|
|
82
|
+
$pnpmVersion = (& $pnpmCommand @pnpmArgs --version 2>$null | Out-String).Trim()
|
|
83
|
+
Write-Host " pnpm:$pnpmCommand $pnpmVersion"
|
|
84
|
+
|
|
85
|
+
function Invoke-Pnpm([string[]]$Arguments, [string]$WorkDir) {
|
|
86
|
+
Push-Location $WorkDir
|
|
87
|
+
try {
|
|
88
|
+
$all = @($pnpmArgs) + @($Arguments)
|
|
89
|
+
& $pnpmCommand @all
|
|
90
|
+
if ($LASTEXITCODE -ne 0) { throw "pnpm 执行失败(exit $LASTEXITCODE)" }
|
|
91
|
+
} finally {
|
|
92
|
+
Pop-Location
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
# ---- 2. checkout ------------------------------------------------------------
|
|
97
|
+
|
|
98
|
+
function Normalize-Remote([string]$Remote) {
|
|
99
|
+
$normalized = $Remote -replace '^git@[^:]*:', 'https://github.com/'
|
|
100
|
+
$normalized = $normalized -replace '^ssh://git@[^/]*/', 'https://github.com/'
|
|
101
|
+
$normalized = $normalized -replace '^https?://[^/]*/', 'https://github.com/'
|
|
102
|
+
$normalized = $normalized -replace '\.git$', '' -replace '/+$', ''
|
|
103
|
+
return ($normalized -replace '^https://github.com/', '')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
|
107
|
+
Fail '需要 git,请先安装(https://git-scm.com/download/win)。'
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (Test-Path (Join-Path $Dir '.git')) {
|
|
111
|
+
$have = (git -C $Dir remote get-url origin 2>$null)
|
|
112
|
+
if ((Normalize-Remote $have) -ne (Normalize-Remote $repoUrl)) {
|
|
113
|
+
Fail "${Dir}已存在,但不是本仓库(origin: $have);换一个 -Dir 再试。"
|
|
114
|
+
}
|
|
115
|
+
if ($NoPull) {
|
|
116
|
+
Step "使用现有仓库:${Dir}(-NoPull)"
|
|
117
|
+
} else {
|
|
118
|
+
Step "更新仓库:${Dir}"
|
|
119
|
+
git -C $Dir pull --ff-only
|
|
120
|
+
if ($LASTEXITCODE -ne 0) { Fail 'git pull 失败,请手动处理后重跑。' }
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
Step "克隆仓库到 ${Dir}"
|
|
124
|
+
$parent = Split-Path $Dir -Parent
|
|
125
|
+
if ($parent -and -not (Test-Path $parent)) { New-Item -ItemType Directory -Path $parent -Force | Out-Null }
|
|
126
|
+
git clone $repoUrl $Dir
|
|
127
|
+
if ($LASTEXITCODE -ne 0) { Fail 'git clone 失败,请检查网络或代理。' }
|
|
128
|
+
}
|
|
129
|
+
foreach ($required in @('package.json', 'client.js')) {
|
|
130
|
+
if (-not (Test-Path (Join-Path $Dir $required))) { Fail "${Dir}里缺少 $required,仓库不完整。" }
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
# ---- 3. install into the profile -------------------------------------------
|
|
134
|
+
|
|
135
|
+
if (-not (Test-Path (Join-Path $profileDir 'package.json'))) {
|
|
136
|
+
Fail "profile ${Profile}还没有初始化:先启动一次 DSH,再重跑本脚本。"
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
Step "安装插件到 profile:$Profile"
|
|
140
|
+
$installed = $false
|
|
141
|
+
$dshCommand = Get-Command dsh -ErrorAction SilentlyContinue
|
|
142
|
+
if ($dshCommand) {
|
|
143
|
+
try {
|
|
144
|
+
& dsh plugin --profile $Profile add "link:$Dir"
|
|
145
|
+
if ($LASTEXITCODE -eq 0) { $installed = $true }
|
|
146
|
+
} catch {
|
|
147
|
+
$installed = $false
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (-not $installed) {
|
|
151
|
+
# `desktop` is owned by the application and its CLI refuses every command; the
|
|
152
|
+
# application itself installs through pnpm inside the profile directory.
|
|
153
|
+
Write-Host ' 改用 profile 内的 pnpm 安装'
|
|
154
|
+
Invoke-Pnpm @('add', "link:$Dir") $profileDir
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if ($WithLsp) {
|
|
158
|
+
Step '安装 LSP 管道包(语言服务器本身还要另外准备)'
|
|
159
|
+
Invoke-Pnpm (@('add') + $lspPackages) $profileDir
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
# ---- 4. make sure the bundle is listed -------------------------------------
|
|
163
|
+
|
|
164
|
+
Step '确认 bundle 已登记'
|
|
165
|
+
$packageJsonPath = Join-Path $profileDir 'package.json'
|
|
166
|
+
$packageJson = Get-Content -Path $packageJsonPath -Raw | ConvertFrom-Json
|
|
167
|
+
if ($null -eq $packageJson.dsh) { $packageJson | Add-Member -NotePropertyName dsh -NotePropertyValue ([pscustomobject]@{}) }
|
|
168
|
+
if ($null -eq $packageJson.dsh.profile) { $packageJson.dsh | Add-Member -NotePropertyName profile -NotePropertyValue ([pscustomobject]@{}) }
|
|
169
|
+
if ($null -eq $packageJson.dsh.profile.bundles) { $packageJson.dsh.profile | Add-Member -NotePropertyName bundles -NotePropertyValue @() }
|
|
170
|
+
$bundles = @($packageJson.dsh.profile.bundles)
|
|
171
|
+
if ($bundles -contains $packageName) {
|
|
172
|
+
Write-Host " 已登记: $packageName"
|
|
173
|
+
} else {
|
|
174
|
+
$packageJson.dsh.profile.bundles = @($bundles + $packageName)
|
|
175
|
+
# UTF-8 without BOM: the profile loader parses this file as JSON.
|
|
176
|
+
$utf8 = New-Object System.Text.UTF8Encoding($false)
|
|
177
|
+
[System.IO.File]::WriteAllText($packageJsonPath, ($packageJson | ConvertTo-Json -Depth 20), $utf8)
|
|
178
|
+
Write-Host " 已登记: $packageName"
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
# ---- 5. verify -------------------------------------------------------------
|
|
182
|
+
|
|
183
|
+
Step '校验安装结果'
|
|
184
|
+
$check = Get-Content -Path $packageJsonPath -Raw | ConvertFrom-Json
|
|
185
|
+
$linkedEntry = $check.dependencies.PSObject.Properties[$packageName]
|
|
186
|
+
$linked = if ($null -eq $linkedEntry) { $null } else { $linkedEntry.Value }
|
|
187
|
+
$bundleList = @($check.dsh.profile.bundles)
|
|
188
|
+
$linkedText = if ($null -eq $linked) { '' } else { [string]$linked }
|
|
189
|
+
Write-Host " 依赖: $(if ($linkedText -eq '') { '缺失' } else { $linkedText })"
|
|
190
|
+
Write-Host " bundle: $(if ($bundleList -contains $packageName) { '已登记' } else { '缺失' })"
|
|
191
|
+
if ($linkedText -eq '' -or -not $linkedText.Contains($Dir) -or -not ($bundleList -contains $packageName)) {
|
|
192
|
+
Fail '装完了但校验没过,请把上面的输出发给维护者。'
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
Write-Host "`n全部完成。" -ForegroundColor Green
|
|
196
|
+
Write-Host " 仓库:$Dir"
|
|
197
|
+
Write-Host " profile:$profileDir"
|
|
198
|
+
Write-Host "`n下一步:完全退出 DSH(托盘里退出,不是关窗口)再打开,左侧导航或左下角会出现「代码工作区」。"
|
|
199
|
+
if (-not $WithLsp) {
|
|
200
|
+
Write-Host '代码导航(可选):再运行 enable-navigation.ps1,见 README 第五节。'
|
|
201
|
+
} else {
|
|
202
|
+
Write-Host 'LSP 管道包已装;还差语言服务器与 cordis.patch.yml 两行——enable-navigation.ps1 会一次做完。'
|
|
203
|
+
}
|
package/install.sh
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Install the dsh-ide-window plugin into a DSH profile (macOS).
|
|
4
|
+
#
|
|
5
|
+
# ./install.sh # clone/pull into ~/dev/dsh-ide-window, install into `desktop`
|
|
6
|
+
# ./install.sh --profile web # another profile
|
|
7
|
+
# ./install.sh --dir ~/src/x # another checkout location
|
|
8
|
+
# ./install.sh --with-lsp # also add the LSP pipeline packages
|
|
9
|
+
# ./install.sh --no-pull # keep the checkout as it is
|
|
10
|
+
#
|
|
11
|
+
# Safe to re-run: an existing checkout is fast-forwarded, and `plugin add` on an
|
|
12
|
+
# already linked package is a no-op. The DSH application itself is never modified.
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
|
|
15
|
+
REPO_URL="https://github.com/simons-jiang/dsh-ide-window.git"
|
|
16
|
+
PACKAGE="dsh-ide-window"
|
|
17
|
+
LSP_PACKAGES=("@deepseek-ai/dsh-lsp@0.2.2-rc.3" "@deepseek-ai/dsh-lsp-stdio@0.2.2-rc.3")
|
|
18
|
+
|
|
19
|
+
PROFILE="desktop"
|
|
20
|
+
DIR="${DSH_IDE_DIR:-$HOME/dev/dsh-ide-window}"
|
|
21
|
+
WITH_LSP=0
|
|
22
|
+
PULL=1
|
|
23
|
+
|
|
24
|
+
usage() {
|
|
25
|
+
cat <<'TEXT'
|
|
26
|
+
Install the dsh-ide-window plugin into a DSH profile (macOS).
|
|
27
|
+
|
|
28
|
+
./install.sh clone/pull ~/dev/dsh-ide-window, install into `desktop`
|
|
29
|
+
./install.sh --profile web another profile
|
|
30
|
+
./install.sh --dir ~/src/x another checkout location
|
|
31
|
+
./install.sh --with-lsp also add the LSP pipeline packages
|
|
32
|
+
./install.sh --no-pull keep the checkout as it is
|
|
33
|
+
curl -fsSL <raw install.sh> | bash run without keeping the script
|
|
34
|
+
|
|
35
|
+
Also works when piped: the arguments go after `bash -s --`.
|
|
36
|
+
TEXT
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
while [ $# -gt 0 ]; do
|
|
40
|
+
case "$1" in
|
|
41
|
+
--profile) PROFILE="${2:-}"; shift 2 ;;
|
|
42
|
+
--dir) DIR="${2:-}"; shift 2 ;;
|
|
43
|
+
--with-lsp) WITH_LSP=1; shift ;;
|
|
44
|
+
--no-pull) PULL=0; shift ;;
|
|
45
|
+
-h|--help) usage; exit 0 ;;
|
|
46
|
+
*) echo "未知参数: $1" >&2; usage >&2; exit 1 ;;
|
|
47
|
+
esac
|
|
48
|
+
done
|
|
49
|
+
|
|
50
|
+
step() { printf '\n==> %s\n' "$1"; }
|
|
51
|
+
fail() { printf '错误:%s\n' "$1" >&2; exit 1; }
|
|
52
|
+
|
|
53
|
+
# ---- 1. locate DSH and its CLI ---------------------------------------------
|
|
54
|
+
|
|
55
|
+
step "检查 DSH"
|
|
56
|
+
APP_BIN=""
|
|
57
|
+
for candidate in \
|
|
58
|
+
"/Applications/DeepSeek Harness.app/Contents/MacOS/DeepSeek Harness" \
|
|
59
|
+
"$HOME/Applications/DeepSeek Harness.app/Contents/MacOS/DeepSeek Harness"
|
|
60
|
+
do
|
|
61
|
+
if [ -x "$candidate" ]; then APP_BIN="$candidate"; break; fi
|
|
62
|
+
done
|
|
63
|
+
[ -n "$APP_BIN" ] || fail "没找到 DeepSeek Harness.app,请先安装并登录 DSH。"
|
|
64
|
+
CONTENTS_DIR="$(cd "$(dirname "$APP_BIN")/.." && pwd)"
|
|
65
|
+
# The application is packed in an asar archive: the shell cannot stat a path
|
|
66
|
+
# inside it, only the Electron binary (Node mode) can read it.
|
|
67
|
+
CLI_JS="$CONTENTS_DIR/Resources/app.asar/dsh/node_modules/@deepseek-ai/dsh/lib/bin.js"
|
|
68
|
+
|
|
69
|
+
DSH_HOME_DIR="${DSH_HOME:-$HOME/.dsh}"
|
|
70
|
+
PROFILE_DIR="$DSH_HOME_DIR/profiles/$PROFILE"
|
|
71
|
+
|
|
72
|
+
# Prefer the `dsh` command (documented form); otherwise run the bundled CLI
|
|
73
|
+
# through the application binary in Node mode, which every install has.
|
|
74
|
+
if command -v dsh >/dev/null 2>&1; then
|
|
75
|
+
echo " 使用命令行:$(command -v dsh)"
|
|
76
|
+
dsh_cli() { dsh "$@"; }
|
|
77
|
+
else
|
|
78
|
+
echo " 命令行 dsh 不在 PATH,改用应用自带的 CLI"
|
|
79
|
+
dsh_cli() { ELECTRON_RUN_AS_NODE=1 "$APP_BIN" "$CLI_JS" "$@"; }
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# Same binary, Node mode: used for the JSON edits below so that the script does
|
|
83
|
+
# not depend on a system Node installation.
|
|
84
|
+
node_run() { ELECTRON_RUN_AS_NODE=1 "$APP_BIN" "$@"; }
|
|
85
|
+
|
|
86
|
+
node_run -e 'process.exit(require("node:fs").existsSync(process.argv[1]) ? 0 : 1)' "$CLI_JS" \
|
|
87
|
+
|| fail "DSH 安装不完整:找不到内置 CLI(${CLI_JS})"
|
|
88
|
+
|
|
89
|
+
command -v git >/dev/null 2>&1 || fail "需要 git,请先安装(xcode-select --install)。"
|
|
90
|
+
|
|
91
|
+
# ---- 2. checkout ------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
# Reduce every clone URL to `owner/repo`, so a checkout created over SSH (or
|
|
94
|
+
# copied from another machine) still counts as the same repository.
|
|
95
|
+
normalize_remote() {
|
|
96
|
+
printf '%s' "$1" \
|
|
97
|
+
| sed -e 's#^git@[^:]*:#https://github.com/#' \
|
|
98
|
+
-e 's#^ssh://git@[^/]*/#https://github.com/#' \
|
|
99
|
+
-e 's#^https://[^/]*/#https://github.com/#' \
|
|
100
|
+
-e 's#^http://[^/]*/#https://github.com/#' \
|
|
101
|
+
-e 's#\.git$##' -e 's#/*$##' \
|
|
102
|
+
| sed -e 's#^https://github.com/##'
|
|
103
|
+
}
|
|
104
|
+
WANT_REMOTE="$(normalize_remote "$REPO_URL")"
|
|
105
|
+
|
|
106
|
+
if [ -d "$DIR/.git" ]; then
|
|
107
|
+
HAVE_REMOTE="$(git -C "$DIR" remote get-url origin 2>/dev/null || true)"
|
|
108
|
+
if [ "$(normalize_remote "$HAVE_REMOTE")" != "$WANT_REMOTE" ]; then
|
|
109
|
+
fail "$DIR 已存在,但不是本仓库(origin: ${HAVE_REMOTE:-无});换一个 --dir 再试。"
|
|
110
|
+
fi
|
|
111
|
+
if [ "$PULL" = 1 ]; then
|
|
112
|
+
step "更新仓库:$DIR"
|
|
113
|
+
git -C "$DIR" pull --ff-only
|
|
114
|
+
else
|
|
115
|
+
step "使用现有仓库:${DIR}(--no-pull)"
|
|
116
|
+
fi
|
|
117
|
+
else
|
|
118
|
+
step "克隆仓库到 $DIR"
|
|
119
|
+
mkdir -p "$(dirname "$DIR")"
|
|
120
|
+
git clone "$REPO_URL" "$DIR"
|
|
121
|
+
fi
|
|
122
|
+
[ -f "$DIR/package.json" ] || fail "$DIR 里没有 package.json,克隆不完整。"
|
|
123
|
+
[ -f "$DIR/client.js" ] || fail "$DIR 里没有 client.js,仓库不完整。"
|
|
124
|
+
|
|
125
|
+
# ---- 3. install into the profile -------------------------------------------
|
|
126
|
+
|
|
127
|
+
step "安装插件到 profile:$PROFILE"
|
|
128
|
+
# The `desktop` profile is owned by the application: its CLI answers
|
|
129
|
+
# "managed exclusively by the Electron application" for every command. The app
|
|
130
|
+
# itself installs through pnpm inside the profile directory, so fall back to
|
|
131
|
+
# exactly that instead of failing.
|
|
132
|
+
if ! dsh_cli plugin --profile "$PROFILE" add "link:$DIR"; then
|
|
133
|
+
echo " 该 profile 由应用托管,改用 profile 内的 pnpm"
|
|
134
|
+
command -v pnpm >/dev/null 2>&1 || fail "需要 pnpm(DSH 安装插件也依赖它):npm i -g pnpm"
|
|
135
|
+
[ -f "$PROFILE_DIR/package.json" ] || fail "profile ${PROFILE}尚未初始化:先启动一次 DSH,再重跑本脚本。"
|
|
136
|
+
( cd "$PROFILE_DIR" && pnpm add "link:$DIR" )
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
if [ "$WITH_LSP" = 1 ]; then
|
|
140
|
+
step "安装 LSP 管道包(语言服务器本身还要另外准备)"
|
|
141
|
+
if ! dsh_cli plugin --profile "$PROFILE" add "${LSP_PACKAGES[@]}"; then
|
|
142
|
+
echo " 该 profile 由应用托管,改用 profile 内的 pnpm"
|
|
143
|
+
command -v pnpm >/dev/null 2>&1 || fail "需要 pnpm(DSH 安装插件也依赖它):npm i -g pnpm"
|
|
144
|
+
( cd "$PROFILE_DIR" && pnpm add "${LSP_PACKAGES[@]}" )
|
|
145
|
+
fi
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
# ---- 4. make sure the bundle is listed -------------------------------------
|
|
149
|
+
|
|
150
|
+
step "确认 bundle 已登记"
|
|
151
|
+
node_run -e '
|
|
152
|
+
const fs = require("node:fs")
|
|
153
|
+
const [file, name] = process.argv.slice(1)
|
|
154
|
+
let data
|
|
155
|
+
try {
|
|
156
|
+
data = JSON.parse(fs.readFileSync(file, "utf8"))
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error("读不了 profile 的 package.json: " + file)
|
|
159
|
+
process.exit(1)
|
|
160
|
+
}
|
|
161
|
+
data.dsh ??= {}
|
|
162
|
+
data.dsh.profile ??= {}
|
|
163
|
+
data.dsh.profile.bundles ??= []
|
|
164
|
+
if (data.dsh.profile.bundles.includes(name)) {
|
|
165
|
+
console.log(" 已登记: " + name)
|
|
166
|
+
process.exit(0)
|
|
167
|
+
}
|
|
168
|
+
data.dsh.profile.bundles.push(name)
|
|
169
|
+
fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n")
|
|
170
|
+
console.log(" 已登记: " + name)
|
|
171
|
+
' "$PROFILE_DIR/package.json" "$PACKAGE"
|
|
172
|
+
|
|
173
|
+
# ---- 5. verify -------------------------------------------------------------
|
|
174
|
+
|
|
175
|
+
step "校验安装结果"
|
|
176
|
+
node_run -e '
|
|
177
|
+
const fs = require("node:fs")
|
|
178
|
+
const [file, name, dir] = process.argv.slice(1)
|
|
179
|
+
const data = JSON.parse(fs.readFileSync(file, "utf8"))
|
|
180
|
+
const deps = data.dependencies ?? {}
|
|
181
|
+
const bundles = data.dsh?.profile?.bundles ?? []
|
|
182
|
+
const linked = deps[name] ?? ""
|
|
183
|
+
const ok = bundles.includes(name) && String(linked).includes(dir)
|
|
184
|
+
console.log(" 依赖: " + (linked === "" ? "缺失" : linked))
|
|
185
|
+
console.log(" bundle: " + (bundles.includes(name) ? "已登记" : "缺失"))
|
|
186
|
+
process.exit(ok ? 0 : 1)
|
|
187
|
+
' "$PROFILE_DIR/package.json" "$PACKAGE" "$DIR" || fail "装完了但校验没过,请把上面的输出发给维护者。"
|
|
188
|
+
|
|
189
|
+
printf '\n全部完成。\n'
|
|
190
|
+
printf ' 仓库:%s\n' "$DIR"
|
|
191
|
+
printf ' profile:%s\n' "$PROFILE_DIR"
|
|
192
|
+
printf '\n下一步:完全退出 DSH(⌘Q)再打开,左侧导航或左下角会出现「代码工作区」。\n'
|
|
193
|
+
if [ "$WITH_LSP" = 0 ]; then
|
|
194
|
+
printf '代码导航(可选):还需要 LSP 管道包与语言服务器,见 README 第五节,或重跑本脚本加 --with-lsp。\n'
|
|
195
|
+
else
|
|
196
|
+
printf 'LSP 管道包已装(DSH 提示「declares no dsh.bundle」是正常的:它靠 profile 的 cordis.patch.yml 挂载)。\n'
|
|
197
|
+
printf '还差两步:把语言服务器放到本机,并在 cordis.patch.yml 里加 lsp / lsp-stdio 两行——见 README 第五节。\n'
|
|
198
|
+
fi
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Code Workspace",
|
|
4
|
+
"description": "Turns the centre area into an IDEA-style workspace: a workspace file tree, editor tabs and a live-updating source view, with the left navigation column hidden."
|
|
5
|
+
},
|
|
6
|
+
"title": "Code Workspace",
|
|
7
|
+
"subtitle": "Workspace",
|
|
8
|
+
"files": "Files",
|
|
9
|
+
"showFiles": "Show file tree",
|
|
10
|
+
"hideFiles": "Hide file tree",
|
|
11
|
+
"refresh": "Refresh",
|
|
12
|
+
"refreshTree": "Reload the file tree",
|
|
13
|
+
"openInIde": "Open in editor",
|
|
14
|
+
"backToChat": "Chat",
|
|
15
|
+
"backToChatHint": "Back to the conversation panel",
|
|
16
|
+
"noWorkspace": "This session has no workspace directory.",
|
|
17
|
+
"noWorkspaceHint": "Pick a workspace in the conversation first, then come back here.",
|
|
18
|
+
"loading": "Loading…",
|
|
19
|
+
"loadingTree": "Reading the directory…",
|
|
20
|
+
"emptyDir": "Empty directory",
|
|
21
|
+
"errorPrefix": "Error: ",
|
|
22
|
+
"truncated": "Too many entries; only the first part is shown.",
|
|
23
|
+
"closeTab": "Close",
|
|
24
|
+
"closeOtherTabs": "Close other tabs",
|
|
25
|
+
"closeAllTabs": "Close all tabs",
|
|
26
|
+
"fileNotText": "This file is not displayable text, or it exceeds the size limit.",
|
|
27
|
+
"fileTooLarge": "The file is too large to load in full.",
|
|
28
|
+
"linesSuffix": "lines",
|
|
29
|
+
"line": "Line",
|
|
30
|
+
"language": "Language",
|
|
31
|
+
"utf8": "UTF-8",
|
|
32
|
+
"copyPath": "Copy path",
|
|
33
|
+
"copied": "Copied",
|
|
34
|
+
"live": "Live",
|
|
35
|
+
"liveOn": "Live refresh is on",
|
|
36
|
+
"liveOff": "Live refresh is off",
|
|
37
|
+
"updated": "Updated",
|
|
38
|
+
"openTabHint": "Click a file to open it on the right",
|
|
39
|
+
"searchPlaceholder": "Search files (⌘P / Ctrl+P)",
|
|
40
|
+
"noMatch": "No matching files",
|
|
41
|
+
"treeWidthHint": "Drag to resize the file tree",
|
|
42
|
+
"toggleChat": "Show/hide the conversation",
|
|
43
|
+
"reload": "Reload",
|
|
44
|
+
"settings": "Settings",
|
|
45
|
+
"readOnly": "Read-only",
|
|
46
|
+
"watchUnsupported": "This directory cannot be watched; use manual refresh.",
|
|
47
|
+
"toggleNav": "Show/hide the navigation column",
|
|
48
|
+
"jumpFailed": "Cannot jump to that file (outside the current workspace)",
|
|
49
|
+
"jumpOn": "Reference jump: on",
|
|
50
|
+
"jumpOff": "Reference jump: off",
|
|
51
|
+
"noDefinition": "No definition found",
|
|
52
|
+
"indexing": "Indexing",
|
|
53
|
+
"noUsages": "No known call site",
|
|
54
|
+
"lspFailed": "Code navigation unavailable (LSP)",
|
|
55
|
+
"querying": "Querying the language server…",
|
|
56
|
+
"truncatedLines": "The file is large; only the first {n} lines are loaded",
|
|
57
|
+
"tabImplements": "Implementations",
|
|
58
|
+
"tabCallers": "Callers",
|
|
59
|
+
"tabDeclaration": "Declaration",
|
|
60
|
+
"maybeIndexing": " (if the server just started, retry once indexing finishes)",
|
|
61
|
+
"searching": "Searching…",
|
|
62
|
+
"searchResults": "results",
|
|
63
|
+
"searchTruncated": "(truncated)",
|
|
64
|
+
"noSearchResults": "No matching files",
|
|
65
|
+
"searchFailed": "Search failed",
|
|
66
|
+
"palettePlaceholder": "Search classes, symbols, files, commands…",
|
|
67
|
+
"paletteTab_class": "Classes",
|
|
68
|
+
"paletteTab_symbol": "Symbols",
|
|
69
|
+
"paletteTab_all": "All",
|
|
70
|
+
"paletteTab_files": "Files",
|
|
71
|
+
"paletteTab_text": "Text",
|
|
72
|
+
"paletteTab_actions": "Actions",
|
|
73
|
+
"paletteKind_class": "class",
|
|
74
|
+
"paletteKind_symbol": "symbol",
|
|
75
|
+
"paletteKind_files": "file",
|
|
76
|
+
"paletteKind_text": "text",
|
|
77
|
+
"paletteKind_actions": "action",
|
|
78
|
+
"paletteEmpty": "Nothing matched",
|
|
79
|
+
"paletteBusy": "Searching…",
|
|
80
|
+
"paletteHint": "↑↓ select · Enter open · Tab change category · Esc close · double Shift to open",
|
|
81
|
+
"paletteActionTree": "Toggle the file tree",
|
|
82
|
+
"paletteActionRefresh": "Refresh the tree and open files",
|
|
83
|
+
"paletteActionJump": "Toggle code jumping",
|
|
84
|
+
"paletteActionCloseTabs": "Close all tabs",
|
|
85
|
+
"paletteActionBack": "Back to the conversation",
|
|
86
|
+
"paletteActionPalette": "Open the search palette",
|
|
87
|
+
"projectSwitch": "Switch project",
|
|
88
|
+
"currentProject": "Current project",
|
|
89
|
+
"projectNoSession": "This workspace has no session yet, so its files cannot be read",
|
|
90
|
+
"tabCallersText": "Callers (text match)",
|
|
91
|
+
"navBack": "Back (mouse side button)",
|
|
92
|
+
"navForward": "Forward (mouse side button)",
|
|
93
|
+
"noSourceInJar": "No sources in that jar",
|
|
94
|
+
"shortcutToggle": "Code workspace: open / close",
|
|
95
|
+
"shortcutBackToChat": "Code workspace: back to conversation",
|
|
96
|
+
"gestureSection": "Code workspace shortcuts",
|
|
97
|
+
"gestureSectionHint": "Every shortcut of this plugin, viewable and editable here (kept out of DSH's own list)",
|
|
98
|
+
"gestureEdit": "View",
|
|
99
|
+
"gestureClose": "Close",
|
|
100
|
+
"gestureHint": "Press a new combo after 「修改」 for keys (Esc cancels); pick gestures from the dropdown (⌘ and Ctrl are distinct on macOS); double Shift and ⌘P stay fixed.",
|
|
101
|
+
"gestureDefinition": "Go to definition",
|
|
102
|
+
"gestureUsages": "Show implementations / callers",
|
|
103
|
+
"gestureDouble": "Double click",
|
|
104
|
+
"gestureMeta": "⌘+click",
|
|
105
|
+
"gestureAlt": "⌥+click",
|
|
106
|
+
"gestureConflict": "Already taken",
|
|
107
|
+
"gestureTaken": "Used by the other action",
|
|
108
|
+
"shortcutSearchEverywhere": "Open search everywhere",
|
|
109
|
+
"shortcutFileSearch": "Focus the file filter",
|
|
110
|
+
"ksUnbound": "Unbound",
|
|
111
|
+
"gestureEditInDsh": "Edit it in Settings → General → Edit shortcuts",
|
|
112
|
+
"ksRecording": "Press keys…",
|
|
113
|
+
"ksChange": "Change",
|
|
114
|
+
"ksReset": "Reset",
|
|
115
|
+
"ksCancel": "Cancel",
|
|
116
|
+
"settingsTitle": "Code workspace settings",
|
|
117
|
+
"settingsHint": "Shortcuts, font sizes and the rest of this plugin",
|
|
118
|
+
"settingsBasic": "Basics",
|
|
119
|
+
"settingsFont": "Font size",
|
|
120
|
+
"settingsCodeFont": "Editor",
|
|
121
|
+
"settingsTreeFont": "File tree",
|
|
122
|
+
"tabMenuClose": "Close",
|
|
123
|
+
"tabMenuCloseOthers": "Close other tabs",
|
|
124
|
+
"tabMenuCloseAll": "Close all tabs",
|
|
125
|
+
"tabMenuCloseUnmodified": "Close unmodified tabs",
|
|
126
|
+
"tabMenuCloseRight": "Close tabs to the right",
|
|
127
|
+
"tabMenuCloseReadOnly": "Close all read-only tabs",
|
|
128
|
+
"tabMenuAddToContext": "Add to agent context",
|
|
129
|
+
"tabMenuCopyPath": "Copy path / reference",
|
|
130
|
+
"tabMenuCopied": "Copied — paste it into the chat input",
|
|
131
|
+
"tabMenuCloseLeft": "Close tabs to the left",
|
|
132
|
+
"tabMenuLabel": "Tab actions",
|
|
133
|
+
"gutterMenuLabel": "Code gutter actions",
|
|
134
|
+
"gutterMenuAnnotate": "Annotate with Git blame",
|
|
135
|
+
"gutterMenuUnannotate": "Close Git annotate",
|
|
136
|
+
"setupTitle": "Code navigation is not ready",
|
|
137
|
+
"setupBody": "Browsing, search, Git and copied references already work. Navigation, call chains and usage counts need a JetBrains language server — run the two commands below.",
|
|
138
|
+
"setupLicence": "Licence:",
|
|
139
|
+
"setupRecheck": "Check again",
|
|
140
|
+
"setupChecking": "Checking…",
|
|
141
|
+
"setupClose": "Close",
|
|
142
|
+
"setupReady": "Code navigation is ready",
|
|
143
|
+
"setupStill": "Still no LSP: check the DSH startup log and the profile cordis.patch.yml.",
|
|
144
|
+
"treeRevealNone": "No file is open",
|
|
145
|
+
"treeExpandAll": "Expand all",
|
|
146
|
+
"treeCollapseAll": "Collapse all",
|
|
147
|
+
"treeExpandLimit": "Stopped at the 200-directory limit",
|
|
148
|
+
"annotateUncommitted": "Not committed",
|
|
149
|
+
"gestureCtrl": "Ctrl+click",
|
|
150
|
+
"gesturePickHint": "Pick the trigger",
|
|
151
|
+
"gestureChain": "Call chain",
|
|
152
|
+
"chainLoading": "Walking callers…",
|
|
153
|
+
"chainNone": "No callers found (this may be an entry point)",
|
|
154
|
+
"chainHint": "Click a node to jump to it",
|
|
155
|
+
"chainRule": "Upper nodes call the ones below them; the ← line is where that call happens",
|
|
156
|
+
"treeMenuLabel": "File menu",
|
|
157
|
+
"treeOpen": "Open in Code Workspace",
|
|
158
|
+
"treeCopyContent": "Copy File Contents",
|
|
159
|
+
"treeCopyPath": "Copy Absolute Path",
|
|
160
|
+
"treeCopyRelative": "Copy Repository Path",
|
|
161
|
+
"treeCopyFqn": "Copy Qualified Name",
|
|
162
|
+
"treeCopied": "Copied",
|
|
163
|
+
"treeCopyFailed": "Copy failed",
|
|
164
|
+
"treeGitSection": "Git",
|
|
165
|
+
"treeAnnotate": "Annotate with Git Blame",
|
|
166
|
+
"treeDiff": "Show Diff",
|
|
167
|
+
"treeHistory": "Show History",
|
|
168
|
+
"treeCompareRevision": "Compare with Revision…",
|
|
169
|
+
"treeCompareRef": "Compare with Branch or Tag…",
|
|
170
|
+
"treeDiffFailed": "Could not read the diff",
|
|
171
|
+
"treeLogFailed": "Could not read the history",
|
|
172
|
+
"treeRefsFailed": "Could not read the branches",
|
|
173
|
+
"treeNoHistory": "This file has no commits",
|
|
174
|
+
"treeNoRefs": "The repository has no branches or tags",
|
|
175
|
+
"treeNoDiff": "No differences from the current revision",
|
|
176
|
+
"treeUntracked": "This file is not tracked yet",
|
|
177
|
+
"treeTruncated": "Truncated",
|
|
178
|
+
"treeTag": "tag",
|
|
179
|
+
"treeBranch": "branch",
|
|
180
|
+
"treeRouteMissing": "The route is missing; quit and reopen DSH",
|
|
181
|
+
"tabImplementsText": "Implementations (text)",
|
|
182
|
+
"chainTextual": "Language service unavailable — callers are text matches",
|
|
183
|
+
"propertyLabel": "property",
|
|
184
|
+
"implementationLabel": "implementation",
|
|
185
|
+
"alreadyAtDefinition": "Already at the definition",
|
|
186
|
+
"lspUnsupported": "The language server does not support this query; results are text matches",
|
|
187
|
+
"lspLicense": "Opened the JetBrains licence page in your browser; restart DSH after signing in",
|
|
188
|
+
"paletteActionLicenseRelogin": "JetBrains licence: sign out and sign in again",
|
|
189
|
+
"lspReloginRunning": "Signing out of the current JetBrains account and opening the sign-in page…",
|
|
190
|
+
"lspReloginOpened": "Opened the JetBrains sign-in page; restart DSH after signing in",
|
|
191
|
+
"settingsMavenRepo": "Maven repository",
|
|
192
|
+
"settingsMavenRepoHint": "Dependency sources (-sources.jar) are read from here; leave empty to use Maven settings.xml and ~/.m2/repository",
|
|
193
|
+
"settingsMavenRepoAuto": "Detected automatically",
|
|
194
|
+
"mavenRepoMissing": "Maven repository not found",
|
|
195
|
+
"settingsMavenRepoInUse": "In use",
|
|
196
|
+
"settingsMavenRepoManual": "from settings",
|
|
197
|
+
"settingsMavenRepoDetecting": "Detecting the repository…",
|
|
198
|
+
"settingsMavenRepoMissingDir": "directory not found",
|
|
199
|
+
"treeLocate": "Locate the open file",
|
|
200
|
+
"gestureAltWin": "Alt+Click",
|
|
201
|
+
"paletteActionDiagnostics": "Copy diagnostics",
|
|
202
|
+
"diagCopied": "Diagnostics copied; the host log was appended",
|
|
203
|
+
"diagCopyFailed": "Clipboard unavailable; diagnostics were not copied",
|
|
204
|
+
"diagReported": "Diagnostics written to the host log (clipboard unavailable)",
|
|
205
|
+
"symbolMenuLabel": "Symbol actions",
|
|
206
|
+
"symbolMenuCopyName": "Copy name",
|
|
207
|
+
"symbolMenuCopyReference": "Copy reference",
|
|
208
|
+
"symbolMenuReferenceToChat": "Copy reference to chat",
|
|
209
|
+
"treeReferenceToChat": "Copy reference to chat",
|
|
210
|
+
"referenceInserted": "Reference inserted into the chat",
|
|
211
|
+
"referenceInsertedPlain": "Inserted as a plain-text reference",
|
|
212
|
+
"referenceNoEditor": "Composer not found; nothing was inserted",
|
|
213
|
+
"setupStepScript": "Step 1: run the install script (packages, server download, config; use your own path if it is not at the default location)",
|
|
214
|
+
"setupStepLicence": "Step 2: license the server (opens a browser; an existing license prints \"licensed\")",
|
|
215
|
+
"setupStepRestart": "Finally: quit DSH completely (⌘Q / tray) and reopen it.",
|
|
216
|
+
"setupCopyAll": "Copy commands"
|
|
217
|
+
}
|