dsh-desktop-kit 2.30.0 → 2.33.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.en.md +118 -0
  3. package/README.md +71 -11
  4. package/client.js +1 -1
  5. package/docs/COMPATIBILITY.md +2 -1
  6. package/docs/LAPTOP-INSTALL.md +9 -5
  7. package/docs/MEASURED.md +25 -0
  8. package/docs/TEST-2.31.0.md +61 -0
  9. package/docs/TEST-2.32.0.md +32 -0
  10. package/docs/TEST-2.33.0.md +33 -0
  11. package/docs/UPGRADING.md +3 -1
  12. package/docs/images/hero-2.31.png +0 -0
  13. package/docs/measured.json +30 -0
  14. package/docs/preview/hero-2.31.html +133 -0
  15. package/doctor.ps1 +161 -142
  16. package/index.js +76 -5
  17. package/install.ps1 +178 -99
  18. package/lib/kit-diagnostics.js +780 -0
  19. package/package.json +8 -4
  20. package/plugins/dsh-agent-extensions/lib/agents.js +20 -1
  21. package/plugins/dsh-agent-extensions/lib/checkpoints.js +109 -5
  22. package/plugins/dsh-agent-extensions/lib/commands.js +40 -3
  23. package/plugins/dsh-agent-extensions/lib/instructions.js +96 -1
  24. package/plugins/dsh-agent-extensions/lib/locks.js +114 -0
  25. package/plugins/dsh-agent-extensions/lib/policy.js +5 -0
  26. package/plugins/dsh-agent-extensions/lib/project.js +7 -1
  27. package/plugins/dsh-agent-extensions/lib/scaffold.js +14 -14
  28. package/plugins/dsh-browser-qa/lib/ui-gate.js +5 -1
  29. package/plugins/dsh-guardrails/index.js +31 -4
  30. package/plugins/dsh-guardrails/lib/hooks.js +22 -5
  31. package/plugins/dsh-guardrails/lib/runtime.js +122 -0
  32. package/plugins/dsh-integrations/lib/job-sandbox.ps1 +1 -1
  33. package/plugins/dsh-profile-transfer/bootstrap/install-on-clean-machine.ps1 +1 -1
  34. package/plugins/dsh-project-memory/index.js +28 -3
  35. package/plugins/dsh-quality-pipeline/index.js +14 -3
  36. package/plugins/dsh-quality-pipeline/lib/text.js +1 -1
  37. package/skills/manifest.json +2 -2
  38. package/skills-baseline.json +9 -5
  39. package/uninstall.ps1 +1 -1
@@ -0,0 +1,133 @@
1
+ <!doctype html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=2400, initial-scale=1">
6
+ <title>DSH Desktop Kit 2.31 — hero</title>
7
+ <link rel="stylesheet" href="readme-visuals.css">
8
+ <style>
9
+ .hero { width: 2400px; height: 1260px; padding: 58px 96px 42px; display: flex; flex-direction: column; }
10
+ .top { display: flex; align-items: center; justify-content: space-between; gap: 40px; }
11
+ .brand { display: flex; align-items: center; gap: 18px; font-family: var(--mono); font-size: 21px; letter-spacing: 0.13em; color: var(--muted); }
12
+ .brand b { color: var(--text); font-weight: 500; letter-spacing: 0.18em; }
13
+ .brand .ver { padding: 5px 10px; border: 1px solid #2e6a55; color: var(--mint); border-radius: 6px; letter-spacing: 0.06em; }
14
+ .brand .mark { width: 16px; height: 16px; border: 1.5px solid var(--mint); border-radius: 3px; position: relative; }
15
+ .brand .mark::after { content: ""; position: absolute; inset: 4px; background: var(--mint); border-radius: 1px; }
16
+ .meta { color: var(--dim); font-family: var(--mono); font-size: 17px; letter-spacing: 0.08em; }
17
+ .main { flex: 1; display: grid; grid-template-columns: 1340px 1fr; gap: 64px; padding-top: 56px; min-height: 0; }
18
+ .copy { display: flex; flex-direction: column; min-width: 0; }
19
+ h1 { font-size: 101px; line-height: 1.04; letter-spacing: -0.035em; max-width: 1240px; }
20
+ h1 em { font-style: normal; color: var(--mint); }
21
+ .lead { margin-top: 28px; max-width: 1080px; color: var(--muted); font-size: 31px; line-height: 1.42; }
22
+ .lead b { color: var(--text); font-weight: 500; }
23
+ .stats { margin-top: 46px; display: flex; gap: 54px; padding-top: 26px; border-top: 1px solid var(--line); }
24
+ .stat b { display: block; font-family: "Unbounded", sans-serif; font-weight: 500; font-size: 54px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
25
+ .stat span { display: block; margin-top: 10px; color: var(--dim); font-family: var(--mono); font-size: 16px; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
26
+ .install { margin-top: 30px; display: flex; align-items: center; gap: 16px; width: fit-content; max-width: 100%; padding: 18px 22px; border: 1px solid var(--line); background: #0b110e; border-radius: 8px; font-family: var(--mono); font-size: 21px; color: var(--muted); }
27
+ .points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; max-width: 1240px; }
28
+ .point { border-top: 1px solid var(--line-strong); padding-top: 12px; display: flex; flex-direction: column; gap: 5px; }
29
+ .point span { color: var(--dim); font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; }
30
+ .point b { font-size: 19px; font-weight: 500; color: var(--text); }
31
+ .point small { color: var(--muted); font-size: 15px; line-height: 1.35; }
32
+ .prework { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
33
+ .pw-head { color: var(--dim); font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; margin-bottom: 8px; }
34
+ .pw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
35
+ .pw { border: 1px solid var(--line-strong); color: var(--muted); border-radius: 4px; padding: 4px 8px; font-size: 13px; font-family: var(--mono); }
36
+ .rules { margin-top: 12px; color: var(--copper); font-size: 13px; font-family: var(--mono); letter-spacing: 0.02em; }
37
+ .accept { margin-top: 14px; border: 1px solid #2d5c4a; background: #0c1a14; border-radius: 7px; padding: 12px 14px; }
38
+ .accept-head { display: flex; justify-content: space-between; color: var(--dim); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; margin-bottom: 7px; }
39
+ .accept-head b { color: var(--mint); font-weight: 500; }
40
+ .accept p { color: var(--muted); font-size: 13px; line-height: 1.55; }
41
+ .accept p b { color: var(--mint); font-weight: 500; }
42
+ .install .prompt { color: var(--mint); }
43
+ .install code { color: var(--text); font-family: inherit; white-space: nowrap; }
44
+ .mission { min-width: 0; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(17, 26, 22, 0.96), rgba(9, 14, 11, 0.96)); border-radius: 12px; padding: 26px 28px 24px; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35); }
45
+ .mission-head { display: flex; justify-content: space-between; align-items: center; color: var(--dim); font-family: var(--mono); font-size: 15px; letter-spacing: 0.1em; }
46
+ .mission-title { margin-top: 10px; font-family: "Unbounded", sans-serif; font-size: 29px; font-weight: 500; letter-spacing: -0.02em; }
47
+ .mission-sub { margin-top: 6px; color: var(--dim); font-size: 16px; }
48
+ .phases { margin-top: 20px; border-top: 1px solid var(--line); }
49
+ .phase { display: grid; grid-template-columns: 126px 1fr; gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid rgba(36, 51, 44, 0.72); }
50
+ .ph-name { color: var(--muted); font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; padding-top: 4px; }
51
+ .ph-name small { display: block; color: var(--dim); font-size: 12px; margin-top: 3px; letter-spacing: 0.02em; }
52
+ .gate-row { display: flex; flex-wrap: wrap; gap: 6px; }
53
+ .chip { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 27px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--dim); font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; }
54
+ .chip.done { color: var(--mint); border-color: #2d5c4a; background: #10251d; }
55
+ .chip.active { color: #0a1510; border-color: var(--mint); background: var(--mint); font-weight: 600; }
56
+ .chip.lock { color: #6d7d74; border-color: #26332c; background: #0b100d; }
57
+ .chip.warn { color: var(--copper); border-color: #5a452d; background: #21170f; }
58
+ .phase.active { background: rgba(115, 230, 187, 0.045); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 4px; }
59
+ .phase.active .ph-name { color: var(--text); }
60
+ .evidence { margin-top: 18px; border: 1px solid var(--line); border-radius: 7px; padding: 13px 15px; background: #0a100d; }
61
+ .ev-head { display: flex; justify-content: space-between; color: var(--dim); font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; margin-bottom: 8px; }
62
+ .ev-head b { color: var(--mint); font-weight: 500; }
63
+ .evidence p { color: var(--muted); font-size: 14px; line-height: 1.55; }
64
+ .evidence p b { color: var(--text); font-weight: 500; }
65
+ .footer { display: flex; justify-content: space-between; align-items: center; padding-top: 18px; color: var(--dim); font-family: var(--mono); font-size: 15px; letter-spacing: 0.05em; }
66
+ .sig { color: var(--mint); letter-spacing: 0.1em; }
67
+ </style>
68
+ </head>
69
+ <body>
70
+ <div class="page hero">
71
+ <header class="top">
72
+ <div class="brand"><span class="mark"></span><b>DSH DESKTOP KIT</b><span class="ver">2.31</span></div>
73
+ <div class="meta">21 PLUGINS · 35 SKILLS · 14 ROLES · 7 PRESETS</div>
74
+ </header>
75
+
76
+ <main class="main">
77
+ <section class="copy">
78
+ <p class="kicker">Quality mission · diagnostics · browser QA</p>
79
+ <h1>Качество, которое нельзя закрыть без <em>доказательств.</em></h1>
80
+ <p class="lead">Миссия с гейтами <b>G0–G13</b>, браузерная проверка <b>interact / a11y / perf</b>, диагностика <b>/kit doctor</b> и замеры — в одном npm-пакете для DeepSeek Harness.</p>
81
+ <div class="stats">
82
+ <div class="stat"><b>21</b><span>плагин</span></div>
83
+ <div class="stat"><b>35</b><span>навыков</span></div>
84
+ <div class="stat"><b>14</b><span>ролей</span></div>
85
+ <div class="stat"><b>14</b><span>гейтов</span></div>
86
+ </div>
87
+ <div class="points">
88
+ <div class="point"><span>01</span><b>Миссия качества</b><small>7 фаз · 14 гейтов · evidence ≥ 12</small></div>
89
+ <div class="point"><span>02</span><b>Browser QA</b><small>18 действий · матрица 4/4 · a11y и perf</small></div>
90
+ <div class="point"><span>03</span><b>Диагностика и замеры</b><small>/kit doctor · plan · tune · measured</small></div>
91
+ </div>
92
+ <div class="install"><span class="prompt">$</span><code>dsh plugin --profile desktop add dsh-desktop-kit@2.31.0</code></div>
93
+ </section>
94
+
95
+ <aside class="mission" aria-label="Схема миссии качества">
96
+ <div class="mission-head"><span>MISSION / QUALITY</span><span class="tag mint">turnkey</span></div>
97
+ <div class="mission-title">Редизайн клиники</div>
98
+ <div class="mission-sub">Схема: фазы · гейты · evidence</div>
99
+ <div class="phases">
100
+ <div class="phase"><span class="ph-name">research<small>бриф + замеры</small></span><div class="gate-row"><span class="chip done">G0</span><span class="chip done">G1</span></div></div>
101
+ <div class="phase"><span class="ph-name">plan<small>DAG + риски</small></span><div class="gate-row"><span class="chip done">G2</span></div></div>
102
+ <div class="phase"><span class="ph-name">system<small>токены + палитра</small></span><div class="gate-row"><span class="chip done">G3</span></div></div>
103
+ <div class="phase active"><span class="ph-name">build<small>единица работы</small></span><div class="gate-row"><span class="chip active">G4</span><span class="chip lock">G5</span><span class="chip lock">G6</span></div></div>
104
+ <div class="phase"><span class="ph-name">verify<small>5 проверок</small></span><div class="gate-row"><span class="chip lock">G5</span><span class="chip lock">G6</span><span class="chip lock">G7</span><span class="chip lock">G8</span><span class="chip lock">G9</span><span class="chip lock">G10</span></div></div>
105
+ <div class="phase"><span class="ph-name">fix<small>возврат в build</small></span><div class="gate-row"><span class="chip warn">loop</span></div></div>
106
+ <div class="phase"><span class="ph-name">handoff<small>приёмка + релиз</small></span><div class="gate-row"><span class="chip lock">G11</span><span class="chip lock">G12</span><span class="chip lock">G13</span></div></div>
107
+ </div>
108
+ <div class="evidence">
109
+ <div class="ev-head"><span>evidence.jsonl</span><b>42 записи</b></div>
110
+ <p><b>G4</b> audit matrix=full · overflow 0 · console 0</p>
111
+ <p><b>G5/G6</b> interact 7/7 · a11y serious 0</p>
112
+ <p><b>G7</b> LCP 740 ms · INP 96 ms · CLS 0.01</p>
113
+ </div>
114
+ <div class="accept">
115
+ <div class="accept-head"><span>ACCEPTANCE</span><b>PASS</b></div>
116
+ <p><b>PASS</b> audit matrix=full · overflow 0 · a11y serious 0</p>
117
+ <p><b>PASS</b> LCP 740 ms · INP 96 ms · CLS 0.01</p>
118
+ </div>
119
+ <div class="prework">
120
+ <div class="pw-head">PRE-WORK · ДО КОДА</div>
121
+ <div class="pw-chips"><span class="pw">product</span><span class="pw">references</span><span class="pw">IA</span><span class="pw">plan</span><span class="pw">brief</span></div>
122
+ <div class="rules">2 падения одного гейта → escalate, а не третий круг</div>
123
+ </div>
124
+ </aside>
125
+ </main>
126
+
127
+ <footer class="footer">
128
+ <span>Windows 11 · DSH 0.2.x · npm dsh-desktop-kit@2.31.0</span>
129
+ <span class="sig">G0 — G13</span>
130
+ </footer>
131
+ </div>
132
+ </body>
133
+ </html>
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
- param(
7
- [string]$Profile = "desktop",
8
- [string]$DshHome = ""
9
- )
10
-
11
- $ErrorActionPreference = "Continue"
12
-
13
- if ([string]::IsNullOrWhiteSpace($DshHome)) {
14
- if ($env:DSH_HOME) { $DshHome = $env:DSH_HOME } else { $DshHome = Join-Path $env:USERPROFILE ".dsh" }
15
- }
16
-
17
- $profileDir = Join-Path $DshHome "profiles\$Profile"
18
- $profileJson = Join-Path $profileDir "package.json"
19
-
20
- Write-Host "DSH home: $DshHome"
21
- Write-Host "Profile: $profileDir"
22
-
23
- $dsh = $null
24
- $command = Get-Command dsh -ErrorAction SilentlyContinue
25
- if ($command) { $dsh = $command.Source }
26
- if (-not $dsh) {
27
- $fallback = Join-Path ${env:LOCALAPPDATA} "Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd"
28
- if (Test-Path $fallback) { $dsh = $fallback }
29
- }
30
- if ($dsh) {
31
- $version = & $dsh --version 2>$null
32
- Write-Host "DSH CLI: $version"
33
- } else {
34
- Write-Host "DSH CLI: not found" -ForegroundColor Yellow
35
- }
36
-
37
- if (-not (Test-Path $profileJson)) {
38
- Write-Host "Profile manifest not found." -ForegroundColor Red
39
- exit 1
40
- }
41
-
42
- $json = Get-Content -Path $profileJson -Raw | ConvertFrom-Json
43
- $issues = 0
44
-
45
- $dependency = $null
46
- if ($json.dependencies) { $dependency = $json.dependencies.'dsh-desktop-kit' }
47
- if ($dependency) {
48
- Write-Host "Dependency: $dependency" -ForegroundColor Green
49
- } else {
50
- Write-Host "Dependency: not installed" -ForegroundColor Red
51
- $issues += 1
52
- }
53
-
54
- $bundles = @()
55
- if ($json.dsh -and $json.dsh.profile -and $json.dsh.profile.bundles) { $bundles = @($json.dsh.profile.bundles) }
56
- if ($bundles -contains "dsh-desktop-kit") {
57
- Write-Host "Bundle: enabled" -ForegroundColor Green
58
- } else {
59
- Write-Host "Bundle: not enabled" -ForegroundColor Red
60
- $issues += 1
61
- }
62
-
63
- $link = Join-Path $profileDir "node_modules\dsh-desktop-kit"
64
- if (Test-Path $link) {
65
- $item = Get-Item -Path $link -Force
66
- if ($item.LinkType -eq "Junction" -or $item.LinkType -eq "SymbolicLink") {
67
- Write-Host "Package: linked -> $($item.Target)" -ForegroundColor Yellow
68
- Write-Host " development link; production installs use a real directory"
69
- } else {
70
- Write-Host "Package: real directory" -ForegroundColor Green
71
- }
72
- $kitPackage = Join-Path $link "package.json"
73
- if (Test-Path $kitPackage) {
74
- try {
75
- $kit = Get-Content -Path $kitPackage -Raw | ConvertFrom-Json
76
- Write-Host "Kit: $($kit.version)" -ForegroundColor Green
77
- } catch {
78
- Write-Host "Kit: package.json is unreadable" -ForegroundColor Red
79
- $issues += 1
80
- }
81
- } else {
82
- Write-Host "Kit: package.json missing" -ForegroundColor Red
83
- $issues += 1
84
- }
85
- $tmp = @(Get-ChildItem -Path (Join-Path $profileDir "node_modules") -Directory -Filter "dsh-desktop-kit_tmp_*" -ErrorAction SilentlyContinue)
86
- if ($tmp.Count -gt 0) {
87
- Write-Host "Stale: $($tmp.Count) dsh-desktop-kit_tmp_* folder(s); pnpm may fail with EPERM" -ForegroundColor Yellow
88
- Write-Host " remove them, then re-run the install"
89
- $issues += 1
90
- }
91
- } else {
92
- Write-Host "Package: missing (run install.ps1 again)" -ForegroundColor Red
93
- $issues += 1
94
- }
95
-
96
- $statePath = Join-Path $DshHome "skills\.dsh-kit-skills.json"
97
- if (Test-Path $statePath) {
98
- try {
99
- $state = Get-Content -Path $statePath -Raw | ConvertFrom-Json
100
- $skillNames = @()
101
- if ($state.skills) { $skillNames = @($state.skills.PSObject.Properties | ForEach-Object { $_.Name } | Where-Object { $_ }) }
102
- $conflictNames = @()
103
- if ($state.conflicts) { $conflictNames = @($state.conflicts.PSObject.Properties | ForEach-Object { $_.Name } | Where-Object { $_ }) }
104
- Write-Host "Skill sync: $($skillNames.Count) packaged, $($conflictNames.Count) conflicts, updated $($state.updatedAt)" -ForegroundColor Green
105
- if ($conflictNames.Count -gt 0) {
106
- Write-Host "Skill conflicts (your edits were kept): $($conflictNames -join ', ')" -ForegroundColor Yellow
107
- Write-Host " /kit conflicts - list; /kit sync - update without overwriting"
108
- }
109
- } catch {
110
- Write-Host "Skill sync: state file is unreadable ($($_.Exception.Message))" -ForegroundColor Yellow
111
- }
112
- } else {
113
- Write-Host "Skill sync: not written yet (start DSH once or run /kit sync)" -ForegroundColor Yellow
114
- }
115
-
116
- $pinned = @()
117
- foreach ($name in @($json.dependencies.PSObject.Properties.Name)) {
118
- if ($name -like "@deepseek-ai/*") { $pinned += $name }
119
- }
120
- if ($pinned.Count -gt 0) {
121
- Write-Host "Pinned @deepseek-ai packages (possible 'incompatible plugins' after a DSH update):" -ForegroundColor Yellow
122
- $pinned | ForEach-Object { Write-Host " $_" }
123
- } else {
124
- Write-Host "Pinned packages: none" -ForegroundColor Green
125
- }
126
-
127
- $skillsDir = Join-Path $DshHome "skills"
128
- if (Test-Path $skillsDir) {
129
- $count = (Get-ChildItem $skillsDir -Directory | Measure-Object).Count
130
- Write-Host "Skills: $count" -ForegroundColor Green
131
- } else {
132
- Write-Host "Skills: folder missing (the kit creates it on first start)" -ForegroundColor Yellow
133
- }
134
-
135
- if ($issues -eq 0) {
136
- Write-Host ""
137
- Write-Host "Everything is in place." -ForegroundColor Green
138
- exit 0
139
- }
140
- Write-Host ""
141
- Write-Host "$issues problem(s) found." -ForegroundColor Red
142
- exit 1
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 command = String(rawInput ?? "").trim().toLowerCase();
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 });