dsh-desktop-kit 2.30.0 → 2.31.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/CHANGELOG.md +14 -0
- package/README.en.md +102 -0
- package/README.md +47 -11
- package/client.js +1 -1
- package/docs/COMPATIBILITY.md +2 -1
- package/docs/LAPTOP-INSTALL.md +9 -5
- package/docs/MEASURED.md +25 -0
- package/docs/TEST-2.31.0.md +61 -0
- package/docs/UPGRADING.md +3 -1
- package/docs/images/hero-2.31.png +0 -0
- package/docs/measured.json +30 -0
- package/docs/preview/hero-2.31.html +133 -0
- package/doctor.ps1 +161 -142
- package/index.js +76 -5
- package/install.ps1 +178 -99
- package/lib/kit-diagnostics.js +780 -0
- package/package.json +7 -4
- package/plugins/dsh-integrations/lib/job-sandbox.ps1 +1 -1
- package/plugins/dsh-profile-transfer/bootstrap/install-on-clean-machine.ps1 +1 -1
- package/skills/manifest.json +2 -2
- package/skills-baseline.json +9 -5
- package/uninstall.ps1 +1 -1
package/doctor.ps1
CHANGED
|
@@ -1,142 +1,161 @@
|
|
|
1
|
-
#requires -Version 5.1
|
|
2
|
-
<#
|
|
3
|
-
.SYNOPSIS
|
|
4
|
-
Report whether dsh-desktop-kit is installed and enabled.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
$
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
$
|
|
28
|
-
if (Test-Path $
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
$
|
|
43
|
-
$
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if ($
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
Write-Host "
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Write-Host "
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
$
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if ($
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} else {
|
|
132
|
-
Write-Host "
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
Write-Host ""
|
|
141
|
-
Write-Host "$
|
|
142
|
-
|
|
1
|
+
#requires -Version 5.1
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Report whether dsh-desktop-kit is installed and enabled.
|
|
5
|
+
|
|
6
|
+
.PARAMETER Json
|
|
7
|
+
Print the full environment probe and the install plan as JSON (exit 0 when
|
|
8
|
+
no blocking problem, 1 otherwise). Used by tools/onboarding-tests.mjs.
|
|
9
|
+
|
|
10
|
+
.PARAMETER SkipExternal
|
|
11
|
+
Do not probe dsh/gh/processes (tests).
|
|
12
|
+
#>
|
|
13
|
+
param(
|
|
14
|
+
[string]$Profile = "desktop",
|
|
15
|
+
[string]$DshHome = "",
|
|
16
|
+
[switch]$Json,
|
|
17
|
+
[switch]$SkipExternal
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
$ErrorActionPreference = "Continue"
|
|
21
|
+
|
|
22
|
+
if ([string]::IsNullOrWhiteSpace($DshHome)) {
|
|
23
|
+
if ($env:DSH_HOME) { $DshHome = $env:DSH_HOME } else { $DshHome = Join-Path $env:USERPROFILE ".dsh" }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if ($Json) {
|
|
27
|
+
$kitEnvScript = Join-Path $PSScriptRoot "tools\kit-env.ps1"
|
|
28
|
+
if (-not (Test-Path $kitEnvScript)) { throw "tools\kit-env.ps1 not found" }
|
|
29
|
+
. $kitEnvScript
|
|
30
|
+
$environment = Get-KitEnvironment -DshHome $DshHome -ProfileName $Profile -RepoPath $PSScriptRoot -SkipExternal:$SkipExternal
|
|
31
|
+
$plan = Get-KitPlan -Environment $environment
|
|
32
|
+
[pscustomobject]@{ environment = $environment; plan = $plan } | ConvertTo-Json -Depth 12
|
|
33
|
+
if ($environment.ok) { exit 0 } else { exit 1 }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
$profileDir = Join-Path $DshHome "profiles\$Profile"
|
|
37
|
+
$profileJson = Join-Path $profileDir "package.json"
|
|
38
|
+
|
|
39
|
+
Write-Host "DSH home: $DshHome"
|
|
40
|
+
Write-Host "Profile: $profileDir"
|
|
41
|
+
|
|
42
|
+
$dsh = $null
|
|
43
|
+
$command = Get-Command dsh -ErrorAction SilentlyContinue
|
|
44
|
+
if ($command) { $dsh = $command.Source }
|
|
45
|
+
if (-not $dsh) {
|
|
46
|
+
$fallback = Join-Path ${env:LOCALAPPDATA} "Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd"
|
|
47
|
+
if (Test-Path $fallback) { $dsh = $fallback }
|
|
48
|
+
}
|
|
49
|
+
if ($dsh) {
|
|
50
|
+
$version = & $dsh --version 2>$null
|
|
51
|
+
Write-Host "DSH CLI: $version"
|
|
52
|
+
} else {
|
|
53
|
+
Write-Host "DSH CLI: not found" -ForegroundColor Yellow
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (-not (Test-Path $profileJson)) {
|
|
57
|
+
Write-Host "Profile manifest not found." -ForegroundColor Red
|
|
58
|
+
exit 1
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
$profileData = Get-Content -Path $profileJson -Raw | ConvertFrom-Json
|
|
62
|
+
$issues = 0
|
|
63
|
+
|
|
64
|
+
$dependency = $null
|
|
65
|
+
if ($profileData.dependencies) { $dependency = $profileData.dependencies.'dsh-desktop-kit' }
|
|
66
|
+
if ($dependency) {
|
|
67
|
+
Write-Host "Dependency: $dependency" -ForegroundColor Green
|
|
68
|
+
} else {
|
|
69
|
+
Write-Host "Dependency: not installed" -ForegroundColor Red
|
|
70
|
+
$issues += 1
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
$bundles = @()
|
|
74
|
+
if ($profileData.dsh -and $profileData.dsh.profile -and $profileData.dsh.profile.bundles) { $bundles = @($profileData.dsh.profile.bundles) }
|
|
75
|
+
if ($bundles -contains "dsh-desktop-kit") {
|
|
76
|
+
Write-Host "Bundle: enabled" -ForegroundColor Green
|
|
77
|
+
} else {
|
|
78
|
+
Write-Host "Bundle: not enabled" -ForegroundColor Red
|
|
79
|
+
$issues += 1
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
$link = Join-Path $profileDir "node_modules\dsh-desktop-kit"
|
|
83
|
+
if (Test-Path $link) {
|
|
84
|
+
$item = Get-Item -Path $link -Force
|
|
85
|
+
if ($item.LinkType -eq "Junction" -or $item.LinkType -eq "SymbolicLink") {
|
|
86
|
+
Write-Host "Package: linked -> $($item.Target)" -ForegroundColor Yellow
|
|
87
|
+
Write-Host " development link; production installs use a real directory"
|
|
88
|
+
} else {
|
|
89
|
+
Write-Host "Package: real directory" -ForegroundColor Green
|
|
90
|
+
}
|
|
91
|
+
$kitPackage = Join-Path $link "package.json"
|
|
92
|
+
if (Test-Path $kitPackage) {
|
|
93
|
+
try {
|
|
94
|
+
$kit = Get-Content -Path $kitPackage -Raw | ConvertFrom-Json
|
|
95
|
+
Write-Host "Kit: $($kit.version)" -ForegroundColor Green
|
|
96
|
+
} catch {
|
|
97
|
+
Write-Host "Kit: package.json is unreadable" -ForegroundColor Red
|
|
98
|
+
$issues += 1
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
Write-Host "Kit: package.json missing" -ForegroundColor Red
|
|
102
|
+
$issues += 1
|
|
103
|
+
}
|
|
104
|
+
$tmp = @(Get-ChildItem -Path (Join-Path $profileDir "node_modules") -Directory -Filter "dsh-desktop-kit_tmp_*" -ErrorAction SilentlyContinue)
|
|
105
|
+
if ($tmp.Count -gt 0) {
|
|
106
|
+
Write-Host "Stale: $($tmp.Count) dsh-desktop-kit_tmp_* folder(s); pnpm may fail with EPERM" -ForegroundColor Yellow
|
|
107
|
+
Write-Host " remove them, then re-run the install"
|
|
108
|
+
$issues += 1
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
Write-Host "Package: missing (run install.ps1 again)" -ForegroundColor Red
|
|
112
|
+
$issues += 1
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
$statePath = Join-Path $DshHome "skills\.dsh-kit-skills.json"
|
|
116
|
+
if (Test-Path $statePath) {
|
|
117
|
+
try {
|
|
118
|
+
$state = Get-Content -Path $statePath -Raw | ConvertFrom-Json
|
|
119
|
+
$skillNames = @()
|
|
120
|
+
if ($state.skills) { $skillNames = @($state.skills.PSObject.Properties | ForEach-Object { $_.Name } | Where-Object { $_ }) }
|
|
121
|
+
$conflictNames = @()
|
|
122
|
+
if ($state.conflicts) { $conflictNames = @($state.conflicts.PSObject.Properties | ForEach-Object { $_.Name } | Where-Object { $_ }) }
|
|
123
|
+
Write-Host "Skill sync: $($skillNames.Count) packaged, $($conflictNames.Count) conflicts, updated $($state.updatedAt)" -ForegroundColor Green
|
|
124
|
+
if ($conflictNames.Count -gt 0) {
|
|
125
|
+
Write-Host "Skill conflicts (your edits were kept): $($conflictNames -join ', ')" -ForegroundColor Yellow
|
|
126
|
+
Write-Host " /kit conflicts - list; /kit sync - update without overwriting"
|
|
127
|
+
}
|
|
128
|
+
} catch {
|
|
129
|
+
Write-Host "Skill sync: state file is unreadable ($($_.Exception.Message))" -ForegroundColor Yellow
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
Write-Host "Skill sync: not written yet (start DSH once or run /kit sync)" -ForegroundColor Yellow
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
$pinned = @()
|
|
136
|
+
foreach ($name in @($profileData.dependencies.PSObject.Properties.Name)) {
|
|
137
|
+
if ($name -like "@deepseek-ai/*") { $pinned += $name }
|
|
138
|
+
}
|
|
139
|
+
if ($pinned.Count -gt 0) {
|
|
140
|
+
Write-Host "Pinned @deepseek-ai packages (possible 'incompatible plugins' after a DSH update):" -ForegroundColor Yellow
|
|
141
|
+
$pinned | ForEach-Object { Write-Host " $_" }
|
|
142
|
+
} else {
|
|
143
|
+
Write-Host "Pinned packages: none" -ForegroundColor Green
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
$skillsDir = Join-Path $DshHome "skills"
|
|
147
|
+
if (Test-Path $skillsDir) {
|
|
148
|
+
$count = (Get-ChildItem $skillsDir -Directory | Measure-Object).Count
|
|
149
|
+
Write-Host "Skills: $count" -ForegroundColor Green
|
|
150
|
+
} else {
|
|
151
|
+
Write-Host "Skills: folder missing (the kit creates it on first start)" -ForegroundColor Yellow
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if ($issues -eq 0) {
|
|
155
|
+
Write-Host ""
|
|
156
|
+
Write-Host "Everything is in place." -ForegroundColor Green
|
|
157
|
+
exit 0
|
|
158
|
+
}
|
|
159
|
+
Write-Host ""
|
|
160
|
+
Write-Host "$issues problem(s) found." -ForegroundColor Red
|
|
161
|
+
exit 1
|
package/index.js
CHANGED
|
@@ -22,6 +22,16 @@ import {
|
|
|
22
22
|
loadSkillState,
|
|
23
23
|
STATE_FILE,
|
|
24
24
|
} from "./lib/skills-sync.js";
|
|
25
|
+
import {
|
|
26
|
+
applyTune,
|
|
27
|
+
collectTuneMetrics,
|
|
28
|
+
detectEnvironment,
|
|
29
|
+
formatDoctor,
|
|
30
|
+
formatPlan,
|
|
31
|
+
formatTune,
|
|
32
|
+
planActions,
|
|
33
|
+
writeTuneReport,
|
|
34
|
+
} from "./lib/kit-diagnostics.js";
|
|
25
35
|
|
|
26
36
|
import * as gkbRuUi from "./plugins/dsh-gkb-ru-ui/lib/index.js";
|
|
27
37
|
import * as peakGuard from "./plugins/dsh-peak-guard/index.js";
|
|
@@ -139,10 +149,30 @@ function kitStatusText() {
|
|
|
139
149
|
for (const error of runtimeState.mountErrors.slice(0, 5)) lines.push(`Ошибка ${error.name}: ${error.message}`);
|
|
140
150
|
}
|
|
141
151
|
lines.push(`Состояние: ${path.join(home, "skills", STATE_FILE)}`);
|
|
142
|
-
lines.push("Команды: /kit status | sync | conflicts | force
|
|
152
|
+
lines.push("Команды: /kit status | doctor | plan | tune | sync | conflicts | force");
|
|
143
153
|
return lines.join("\n");
|
|
144
154
|
}
|
|
145
155
|
|
|
156
|
+
/** Split `/kit <command> [--flag value] [--json]` without a dependency. */
|
|
157
|
+
function parseKitArgs(rest) {
|
|
158
|
+
const flags = new Set();
|
|
159
|
+
const options = {};
|
|
160
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
161
|
+
const item = rest[index];
|
|
162
|
+
if (!item.startsWith("--")) continue;
|
|
163
|
+
const [key, inline] = item.slice(2).split("=", 2);
|
|
164
|
+
if (inline !== undefined) {
|
|
165
|
+
options[key] = inline;
|
|
166
|
+
} else if (rest[index + 1] && !rest[index + 1].startsWith("--")) {
|
|
167
|
+
options[key] = rest[index + 1];
|
|
168
|
+
index += 1;
|
|
169
|
+
} else {
|
|
170
|
+
flags.add(key);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return { flags, options };
|
|
174
|
+
}
|
|
175
|
+
|
|
146
176
|
export function apply(ctx) {
|
|
147
177
|
try {
|
|
148
178
|
installSkills(ctx.logger);
|
|
@@ -173,12 +203,53 @@ export function apply(ctx) {
|
|
|
173
203
|
try {
|
|
174
204
|
const dispose = commandCtx.commands.register({
|
|
175
205
|
name: "kit",
|
|
176
|
-
description: "DSH Desktop Kit:
|
|
177
|
-
input: { hint: "status | sync | conflicts | force" },
|
|
206
|
+
description: "DSH Desktop Kit: диагностика, план установки, замеры, синхронизация навыков",
|
|
207
|
+
input: { hint: "status | doctor | plan | tune | sync | conflicts | force (--json, --profile <имя>, --apply)" },
|
|
178
208
|
recordInput: false,
|
|
179
|
-
handler: ({ rawInput }) => {
|
|
180
|
-
const
|
|
209
|
+
handler: async ({ rawInput }) => {
|
|
210
|
+
const args = String(rawInput ?? "").trim().split(/\s+/u).filter(Boolean);
|
|
211
|
+
const command = (args[0] ?? "status").toLowerCase();
|
|
212
|
+
const { flags, options } = parseKitArgs(args.slice(1));
|
|
213
|
+
const profile = options.profile || process.env.DSH_PROFILE || "desktop";
|
|
214
|
+
const home = skillsHome();
|
|
181
215
|
try {
|
|
216
|
+
if (command === "doctor") {
|
|
217
|
+
const env = detectEnvironment({ home, profile, repoPath: here });
|
|
218
|
+
return { kind: env.ok ? "success" : "error", text: formatDoctor(env) };
|
|
219
|
+
}
|
|
220
|
+
if (command === "plan") {
|
|
221
|
+
const env = detectEnvironment({ home, profile, repoPath: here });
|
|
222
|
+
const plan = planActions(env);
|
|
223
|
+
if (flags.has("json")) {
|
|
224
|
+
return {
|
|
225
|
+
kind: "success",
|
|
226
|
+
text: JSON.stringify(
|
|
227
|
+
{
|
|
228
|
+
plan,
|
|
229
|
+
environment: {
|
|
230
|
+
profile: env.profile,
|
|
231
|
+
kit: env.kit,
|
|
232
|
+
dsh: env.dsh,
|
|
233
|
+
node: env.node,
|
|
234
|
+
problems: env.problems,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
null,
|
|
238
|
+
2,
|
|
239
|
+
),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
return { kind: plan.blocked ? "error" : "success", text: formatPlan(plan, env) };
|
|
243
|
+
}
|
|
244
|
+
if (command === "tune") {
|
|
245
|
+
const report = collectTuneMetrics({ home, repoPath: here, profile });
|
|
246
|
+
const reportFile = writeTuneReport(home, report);
|
|
247
|
+
const applied = flags.has("apply") ? applyTune(home, report) : null;
|
|
248
|
+
if (flags.has("json")) {
|
|
249
|
+
return { kind: "success", text: JSON.stringify({ report, reportFile, applied }, null, 2) };
|
|
250
|
+
}
|
|
251
|
+
return { kind: "success", text: `${formatTune(report, applied)}\nОтчёт: ${reportFile}` };
|
|
252
|
+
}
|
|
182
253
|
if (command === "sync" || command === "force") {
|
|
183
254
|
const force = command === "force";
|
|
184
255
|
const result = installSkills(ctx.logger, { force });
|