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
@@ -30,7 +30,7 @@ const AGENT_TEMPLATES = {
30
30
  "---",
31
31
  "name: reviewer",
32
32
  "description: Ревью диффа, тестов и рисков. Возвращает только findings.",
33
- "tools: read, grep, glob, browser_qa, team_board, team_message",
33
+ "tools: read, grep, glob, browser_qa, read_image, web_fetch, skill, team_board, team_message",
34
34
  "permission: read-only",
35
35
  "---",
36
36
  "",
@@ -41,7 +41,7 @@ const AGENT_TEMPLATES = {
41
41
  "---",
42
42
  "name: researcher",
43
43
  "description: Исследует документацию и практики по внешним источникам, не меняет код.",
44
- "tools: read, grep, glob, web_search, web_fetch, browser_qa, team_board, team_message",
44
+ "tools: read, grep, glob, web_search, web_fetch, browser_qa, read_image, skill, team_board, team_message",
45
45
  "permission: read-only",
46
46
  "---",
47
47
  "",
@@ -52,7 +52,7 @@ const AGENT_TEMPLATES = {
52
52
  "---",
53
53
  "name: tester",
54
54
  "description: Запускает тесты и проверки в рабочей папке, разбирает падения.",
55
- "tools: read, grep, glob, bash, pwsh, browser_qa, team_board, team_message",
55
+ "tools: read, grep, glob, bash, pwsh, browser_qa, read_image, skill, team_board, team_message",
56
56
  "permission: workspace-write",
57
57
  "---",
58
58
  "",
@@ -63,7 +63,7 @@ const AGENT_TEMPLATES = {
63
63
  "---",
64
64
  "name: coordinator",
65
65
  "description: Координирует рой: читает board, назначает задачи, пишет участникам.",
66
- "tools: read, grep, repo_map, browser_qa, team_board, team_message",
66
+ "tools: read, grep, glob, repo_map, browser_qa, read_image, web_fetch, skill, list_agents, team_board, team_message",
67
67
  "permission: read-only",
68
68
  "---",
69
69
  "",
@@ -74,7 +74,7 @@ const AGENT_TEMPLATES = {
74
74
  "---",
75
75
  "name: verifier",
76
76
  "description: Проверяет claims, ссылки, даты и тесты; возвращает structured findings.",
77
- "tools: read, grep, glob, repo_map, web_fetch, browser_qa, research_ledger, team_board, team_message",
77
+ "tools: read, grep, glob, repo_map, web_fetch, browser_qa, read_image, research_ledger, skill, team_board, team_message",
78
78
  "model: deepseek-v4-pro",
79
79
  "permission: read-only",
80
80
  "output: findings",
@@ -87,7 +87,7 @@ const AGENT_TEMPLATES = {
87
87
  "---",
88
88
  "name: synthesizer",
89
89
  "description: Сводит findings команды в единый PASS/FAIL без дублей.",
90
- "tools: read, repo_map, research_ledger, team_board, team_message",
90
+ "tools: read, repo_map, research_ledger, web_fetch, skill, team_board, team_message",
91
91
  "model: deepseek-v4-pro",
92
92
  "permission: read-only",
93
93
  "output: findings",
@@ -100,7 +100,7 @@ const AGENT_TEMPLATES = {
100
100
  "---",
101
101
  "name: security",
102
102
  "description: Ищет уязвимости, секреты, права и опасные дефолты; не меняет код.",
103
- "tools: read, grep, glob, repo_map, guardrails, team_board, team_message",
103
+ "tools: read, grep, glob, repo_map, guardrails, web_fetch, skill, team_board, team_message",
104
104
  "model: deepseek-v4-pro",
105
105
  "permission: read-only",
106
106
  "output: findings",
@@ -113,7 +113,7 @@ const AGENT_TEMPLATES = {
113
113
  "---",
114
114
  "name: performance",
115
115
  "description: Ищет узкие места, лишние запросы и регрессии производительности.",
116
- "tools: read, grep, glob, repo_map, browser_qa, team_board, team_message",
116
+ "tools: read, grep, glob, repo_map, browser_qa, read_image, skill, team_board, team_message",
117
117
  "model: deepseek-v4-pro",
118
118
  "permission: read-only",
119
119
  "output: findings",
@@ -126,7 +126,7 @@ const AGENT_TEMPLATES = {
126
126
  "---",
127
127
  "name: ui-critic",
128
128
  "description: Визуальный критик: скриншоты, сетка, ритм отступов, типографика, состояния.",
129
- "tools: read, grep, glob, browser_qa, team_board, team_message",
129
+ "tools: read, grep, glob, browser_qa, read_image, skill, team_board, team_message",
130
130
  "permission: read-only",
131
131
  "output: findings",
132
132
  "---",
@@ -138,7 +138,7 @@ const AGENT_TEMPLATES = {
138
138
  "---",
139
139
  "name: a11y",
140
140
  "description: Доступность по WCAG 2.2 AA: имена, подписи, контраст, фокус, тап-таргеты.",
141
- "tools: read, grep, glob, browser_qa, team_board, team_message",
141
+ "tools: read, grep, glob, browser_qa, read_image, skill, team_board, team_message",
142
142
  "permission: read-only",
143
143
  "output: findings",
144
144
  "---",
@@ -150,7 +150,7 @@ const AGENT_TEMPLATES = {
150
150
  "---",
151
151
  "name: cms-ops",
152
152
  "description: CMS-эксплуатация: версии, плагины, checksums, почта, cron, права, обновляемость.",
153
- "tools: read, grep, glob, pwsh, browser_qa, team_board, team_message",
153
+ "tools: read, grep, glob, pwsh, browser_qa, read_image, web_fetch, skill, team_board, team_message",
154
154
  "permission: read-only",
155
155
  "output: findings",
156
156
  "---",
@@ -162,7 +162,7 @@ const AGENT_TEMPLATES = {
162
162
  "---",
163
163
  "name: builder",
164
164
  "description: Писатель: собирает одну единицу работы в своём worktree и сдаёт её на проверку.",
165
- "tools: read, grep, glob, write, edit, pwsh, browser_qa, quality_gate, team_board, team_message",
165
+ "tools: read, grep, glob, write, edit, pwsh, browser_qa, read_image, skill, quality_gate, team_board, team_message",
166
166
  "permission: workspace-write",
167
167
  "---",
168
168
  "",
@@ -173,7 +173,7 @@ const AGENT_TEMPLATES = {
173
173
  "---",
174
174
  "name: release-ops",
175
175
  "description: Выпускает релизы: сборка, подпись, канал обновлений, бэкап, выкатка, откат.",
176
- "tools: read, grep, glob, pwsh, remote_ops, quality_gate, team_board, team_message",
176
+ "tools: read, grep, glob, pwsh, remote_ops, quality_gate, read_image, skill, team_board, team_message",
177
177
  "permission: workspace-write",
178
178
  "---",
179
179
  "",
@@ -184,7 +184,7 @@ const AGENT_TEMPLATES = {
184
184
  "---",
185
185
  "name: demo-watch",
186
186
  "description: Следит за демо-стендом: доступность, состояние обновлений, следы демо на проде.",
187
- "tools: read, grep, glob, remote_ops, browser_qa, team_board, team_message",
187
+ "tools: read, grep, glob, remote_ops, browser_qa, read_image, skill, team_board, team_message",
188
188
  "permission: read-only",
189
189
  "output: findings",
190
190
  "---",
@@ -282,7 +282,8 @@ export function createUiGate(ctx) {
282
282
  if (!strict) return missing;
283
283
  if (!state.a11yAt || state.a11yAt < state.lastEditAt) missing.push("a11y-missing");
284
284
  else if (Number(state.a11y?.serious ?? 0) > 0) missing.push("a11y-issues");
285
- if (state.interactAt >= state.lastEditAt && state.interact && state.interact.pass !== true) missing.push("interact-fail");
285
+ if (!state.interactAt || state.interactAt < state.lastEditAt) missing.push("interact-missing");
286
+ else if (state.interact && state.interact.pass !== true) missing.push("interact-fail");
286
287
  return missing;
287
288
  }
288
289
 
@@ -307,6 +308,9 @@ export function createUiGate(ctx) {
307
308
  if (missing.includes("a11y-issues")) {
308
309
  lines.push(`browser_qa a11y нашёл serious ${state.a11y?.serious ?? "?"}: почини и прогони a11y заново — порог 0.`);
309
310
  }
311
+ if (missing.includes("interact-missing")) {
312
+ lines.push("Гейт качества требует поведение, а не только геометрию: запусти browser_qa action=interact хотя бы по одному ключевому сценарию (меню, форма, модалка) и приложи PASS.");
313
+ }
310
314
  if (missing.includes("interact-fail")) {
311
315
  lines.push("Сценарий browser_qa action=interact упал: элемент перекрыт, невидим или не прошло ожидание. Почини и прогони сценарий заново.");
312
316
  }
@@ -32,13 +32,14 @@ import {
32
32
  policyPath,
33
33
  } from "./lib/policy.js";
34
34
  import { scanProject } from "./lib/scan.js";
35
+ import { createRuntimeState } from "./lib/runtime.js";
35
36
 
36
37
  /** Tool and hook plugin depends on the tool registry only. */
37
38
  export const inject = ["tools"];
38
39
 
39
40
  const PLUGIN_NAME = "dsh-guardrails";
40
41
  const PLUGIN_VERSION = "1.0.0";
41
- const ACTIONS = ["status", "check", "policy"];
42
+ const ACTIONS = ["status", "check", "policy", "runtime"];
42
43
  const DEFAULT_ACTION = "status";
43
44
  const TEXT_LIMIT = 24_000;
44
45
 
@@ -306,6 +307,30 @@ function renderScanReport(value) {
306
307
  return lines.join("\n");
307
308
  }
308
309
 
310
+ /* ------------------------------------------------------------------ */
311
+ /* runtime */
312
+ /* ------------------------------------------------------------------ */
313
+
314
+ function runtimeValue(runtime, mode) {
315
+ const snapshot = runtime.snapshot();
316
+ const lines = [
317
+ "Guardrails runtime (in-memory, no command text):",
318
+ `permission: ${mode ? `${mode.name} (sandbox=${mode.sandbox}, approval=${mode.approval ?? "default"})` : "unknown (no DSH permission preset)"}`,
319
+ `decisions: ${snapshot.count} · ask ${snapshot.asks} · deny ${snapshot.denies}`,
320
+ ];
321
+ if (!snapshot.last) {
322
+ lines.push("Последних ask/deny нет: за этот процесс не было решений.");
323
+ } else {
324
+ for (const item of snapshot.decisions) {
325
+ lines.push(
326
+ `- ${item.at} ${item.kind.toUpperCase()} ${item.tool} · level=${item.level}${item.irreversible ? " · irreversible" : ""}${item.external ? " · external" : ""} · mode=${item.mode || "?"} · rule=${item.rule || "?"} · fp=${item.fingerprint}`,
327
+ );
328
+ }
329
+ }
330
+ lines.push("DSH владеет approval-карточкой; runtime только фиксирует ask/deny для диагностики.");
331
+ return { ok: true, enabled: true, ...snapshot, text: lines.join("\n") };
332
+ }
333
+
309
334
  /* ------------------------------------------------------------------ */
310
335
  /* Plugin entry */
311
336
  /* ------------------------------------------------------------------ */
@@ -314,7 +339,8 @@ export function apply(ctx) {
314
339
  const env = process.env;
315
340
  const logger = ctx?.logger;
316
341
  const hookState = createHookState();
317
- const guard = createGuard({ env, logger, modeFor: (agent) => resolveMode(ctx, agent) });
342
+ const runtime = createRuntimeState();
343
+ const guard = createGuard({ env, logger, runtime, modeFor: (agent) => resolveMode(ctx, agent) });
318
344
  try {
319
345
  registerHooks(ctx, guard, hookState);
320
346
  } catch (error) {
@@ -325,7 +351,7 @@ export function apply(ctx) {
325
351
  const tool = {
326
352
  name: "guardrails",
327
353
  description:
328
- "Read-only guardrails control and security scan. `status` shows effective command rules, protected paths, hook registration and the DSH_GUARDRAILS kill switch. `check` scans a project or worktree with strict limits (no network) for secrets, .env files, protected paths, oversized files, dangerous commands in shell scripts and `git diff --check`; token values are redacted. `policy` prints the effective JSON policy. Scanning never executes files and never writes.",
354
+ "Read-only guardrails control and security scan. `status` shows effective command rules, protected paths, hook registration and the DSH_GUARDRAILS kill switch. `check` scans a project or worktree with strict limits (no network) for secrets, .env files, protected paths, oversized files, dangerous commands in shell scripts and `git diff --check`; token values are redacted. `policy` prints the effective JSON policy. `runtime` shows the current permission preset and recent ask/deny decisions (consequence level, fingerprint; command text is never stored). Scanning never executes files and never writes.",
329
355
  parameters: {
330
356
  type: "object",
331
357
  additionalProperties: false,
@@ -333,7 +359,7 @@ export function apply(ctx) {
333
359
  action: {
334
360
  type: "string",
335
361
  enum: ACTIONS,
336
- description: "status (rules, protected paths, hooks) | check (bounded read-only scan) | policy (effective JSON policy).",
362
+ description: "status (rules, protected paths, hooks) | check (bounded read-only scan) | policy (effective JSON policy) | runtime (permission preset + recent ask/deny).",
337
363
  },
338
364
  root: {
339
365
  type: "string",
@@ -368,6 +394,7 @@ export function apply(ctx) {
368
394
  const loaded = loadPolicy({ env });
369
395
  if (action === "policy") return policyValue(loaded);
370
396
  if (action === "status") return statusValue(loaded, hookState);
397
+ if (action === "runtime") return runtimeValue(runtime, resolveMode(ctx, exec?.agent));
371
398
  if (action === "check") return await checkValue(loaded, args, exec, logger);
372
399
  return {
373
400
  ok: false,
@@ -131,7 +131,15 @@ export function createGuard(options = {}) {
131
131
  const env = options.env ?? process.env;
132
132
  const policyFile = options.policyFile;
133
133
  const logger = options.logger;
134
+ const runtime = options.runtime;
134
135
  const load = () => loadPolicy({ env, ...(policyFile === undefined ? {} : { filePath: policyFile }) });
136
+ function record(exec, decision, mode, rule) {
137
+ try {
138
+ runtime?.record?.(exec, decision, { mode, rule });
139
+ } catch {
140
+ /* runtime diagnostics must never break a decision */
141
+ }
142
+ }
135
143
  async function allowPreTool(next) {
136
144
  return typeof next === "function" ? next() : { kind: "allow" };
137
145
  }
@@ -155,15 +163,19 @@ export function createGuard(options = {}) {
155
163
  const ruleId = verdict.primary?.id ?? "policy";
156
164
  logger?.debug?.(`[guardrails] pre-execute ${verdict.action} tool=${toolName} rule=${ruleId}`);
157
165
  if (verdict.action === "deny") {
158
- return denyDecision(
166
+ const decision = denyDecision(
159
167
  `guardrails: command denied by rule "${ruleId}" (${verdict.primary?.description ?? "policy"}). ${policyHint()}`,
160
168
  ruleId,
161
169
  );
170
+ record(exec, decision, "rule", ruleId);
171
+ return decision;
162
172
  }
163
- return askDecision(
173
+ const decision = askDecision(
164
174
  `guardrails: command requires confirmation by rule "${ruleId}" (${verdict.primary?.description ?? "policy"})`,
165
175
  ruleId,
166
176
  );
177
+ record(exec, decision, "rule", ruleId);
178
+ return decision;
167
179
  }
168
180
  }
169
181
  }
@@ -172,18 +184,23 @@ export function createGuard(options = {}) {
172
184
  const hit = matchProtectedPath(requestedPath, { policy: loaded.policy, env });
173
185
  if (hit === undefined) continue;
174
186
  logger?.debug?.(`[guardrails] pre-execute deny tool=${toolName} rule=${hit.id}`);
175
- return denyDecision(
187
+ const decision = denyDecision(
176
188
  `guardrails: modifying a protected path is not allowed: ${requestedPath} (rule: ${hit.id}). ${policyHint()}`,
177
189
  hit.id,
178
190
  );
191
+ record(exec, decision, "protected-path", hit.id);
192
+ return decision;
179
193
  }
180
194
  }
181
195
  const mode = typeof options.modeFor === "function" ? options.modeFor(exec?.agent) : undefined;
182
196
  const modeHit = modeDecision(mode, exec, exec?.agent?.session?.header?.cwd ?? process.cwd());
183
197
  if (modeHit) {
184
198
  logger?.debug?.(`[guardrails] pre-execute mode=${mode?.name ?? "?"} action=${modeHit.kind} tool=${toolName}`);
185
- if (modeHit.kind === "ask") return askDecision(modeHit.reason, "permission-mode");
186
- return denyDecision(modeHit.reason, "permission-mode");
199
+ const decision = modeHit.kind === "ask"
200
+ ? askDecision(modeHit.reason, "permission-mode")
201
+ : denyDecision(modeHit.reason, "permission-mode");
202
+ record(exec, decision, mode, "permission-mode");
203
+ return decision;
187
204
  }
188
205
  return allowPreTool(next);
189
206
  } catch (error) {
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Consequence classification and the in-memory approval runtime.
3
+ *
4
+ * DSH owns the approval card. This module does not create a second one: it
5
+ * labels a decision (read/write/external/destructive/credential), records the
6
+ * ask/deny that DSH actually received, and exposes a bounded snapshot for
7
+ * `/guardrails action=runtime`. Command text is never stored; only a hash.
8
+ */
9
+ import crypto from "node:crypto";
10
+
11
+ const DESTRUCTIVE = /\b(?:rm\s+-rf|rmdir\s+\/s|rd\s+\/s|del\s+\/[sfq]|git\s+(?:reset\s+--hard|clean\s+-[a-z]*f|push\s+(?:--force|-f)|checkout\s+--\s+\.)|drop\s+(?:table|database|schema)|truncate\s+table|delete\s+from|format\s+[a-z]:|shutdown|Stop-Computer|Remove-Item\b[^\n]*-Recurse|migrate:fresh|migrate:refresh|db:wipe|pg_dropcluster)\b/iu;
12
+ const EXTERNAL = /\b(?:git\s+push|npm\s+publish|pnpm\s+publish|gh\s+release|gh\s+pr\s+(?:create|merge)|ssh\b|scp\b|remote_ops|curl\b[^\n]*(?:-X\s*(?:POST|PUT|DELETE)|--data)|Invoke-WebRequest\b[^\n]*-Method\s*(?:Post|Put|Delete)|wget\b[^\n]*--post)/iu;
13
+ const COSTLY = /\b(?:npm\s+(?:install|i|add)|pnpm\s+(?:add|install)|yarn\s+add|pip\s+install|composer\s+(?:install|update|require)|winget\s+install|choco\s+install|docker\s+pull|git\s+clone)\b/iu;
14
+ const CREDENTIAL = /\b(?:\.ssh[\\/]|id_(?:rsa|ed25519|ecdsa)|\.aws[\\/]|\.npmrc|\.git-credentials|credentials\.json|\.env(?:\.|$)|secret|token|api[_-]?key)\b/iu;
15
+ const MUTATING_TOOLS = new Set(["write", "edit", "apply_patch", "patch", "delete", "move", "mkdir", "touch"]);
16
+ const SHELL_TOOLS = new Set(["bash", "pwsh", "powershell", "shell", "sh", "zsh", "cmd", "terminal"]);
17
+
18
+ export function commandOf(args) {
19
+ if (typeof args === "string") return args;
20
+ if (!args || typeof args !== "object") return "";
21
+ for (const key of ["command", "cmd", "script"]) {
22
+ if (typeof args[key] === "string" && args[key].trim().length > 0) return args[key];
23
+ }
24
+ return "";
25
+ }
26
+
27
+ /** SHA-256 prefix so the runtime can show a stable fingerprint without the command. */
28
+ export function fingerprint(value) {
29
+ return crypto.createHash("sha256").update(String(value ?? "")).digest("hex").slice(0, 12);
30
+ }
31
+
32
+ /**
33
+ * Label a tool call by consequence. The label is advisory for policy and
34
+ * diagnostics; the authoritative allow/deny is still the DSH permission preset
35
+ * plus `guardrails.json`.
36
+ *
37
+ * @param {{name?: string, arguments?: unknown}} exec
38
+ * @param {string} [cwd]
39
+ * @returns {{level:'read'|'write'|'external'|'destructive'|'credential', irreversible:boolean, external:boolean, costly:boolean, needsApproval:boolean, reason:string, fingerprint:string}}
40
+ */
41
+ export function classifyConsequence(exec, cwd = "") {
42
+ const tool = String(exec?.name ?? "");
43
+ const args = exec?.arguments;
44
+ const command = commandOf(args);
45
+ const text = [tool, command, typeof args === "object" ? JSON.stringify(args) : String(args ?? "")].join("\n");
46
+ let level = "read";
47
+ let reason = "read-only";
48
+
49
+ if (DESTRUCTIVE.test(text)) {
50
+ level = "destructive";
51
+ reason = "destructive or irreversible command";
52
+ } else if (EXTERNAL.test(text)) {
53
+ level = "external";
54
+ reason = "external side effect";
55
+ } else if (CREDENTIAL.test(text)) {
56
+ level = "credential";
57
+ reason = "credential or secret path";
58
+ } else if (MUTATING_TOOLS.has(tool) || (SHELL_TOOLS.has(tool) && command.trim().length > 0 && COSTLY.test(command))) {
59
+ level = "write";
60
+ reason = "workspace mutation";
61
+ }
62
+
63
+ return {
64
+ level,
65
+ irreversible: level === "destructive",
66
+ external: level === "external" || level === "destructive",
67
+ costly: COSTLY.test(text),
68
+ needsApproval: level === "destructive" || level === "external" || level === "credential",
69
+ reason,
70
+ fingerprint: fingerprint([tool, command].join("\n")),
71
+ };
72
+ }
73
+
74
+ const MAX_DECISIONS = 80;
75
+
76
+ /**
77
+ * Bounded in-memory runtime. No disk writes, no command text, no secrets.
78
+ */
79
+ export function createRuntimeState({ limit = MAX_DECISIONS } = {}) {
80
+ const decisions = [];
81
+ let asks = 0;
82
+ let denies = 0;
83
+ return {
84
+ record(exec, decision, { mode, rule } = {}) {
85
+ if (!decision || (decision.kind !== "ask" && decision.kind !== "deny")) return;
86
+ const consequence = classifyConsequence(exec, exec?.agent?.session?.header?.cwd ?? "");
87
+ const item = {
88
+ at: new Date().toISOString(),
89
+ tool: String(exec?.name ?? ""),
90
+ kind: decision.kind,
91
+ level: consequence.level,
92
+ irreversible: consequence.irreversible,
93
+ external: consequence.external,
94
+ needsApproval: consequence.needsApproval,
95
+ fingerprint: consequence.fingerprint,
96
+ mode: typeof mode === "string" ? mode : (mode?.name ?? ""),
97
+ rule: String(rule ?? ""),
98
+ reason: String(decision.reason ?? "").slice(0, 240),
99
+ };
100
+ decisions.push(item);
101
+ if (decisions.length > limit) decisions.splice(0, decisions.length - limit);
102
+ if (decision.kind === "ask") asks += 1;
103
+ else denies += 1;
104
+ return item;
105
+ },
106
+ snapshot() {
107
+ return {
108
+ ok: true,
109
+ count: decisions.length,
110
+ asks,
111
+ denies,
112
+ last: decisions[decisions.length - 1] ?? null,
113
+ decisions: decisions.slice(-20),
114
+ };
115
+ },
116
+ reset() {
117
+ decisions.length = 0;
118
+ asks = 0;
119
+ denies = 0;
120
+ },
121
+ };
122
+ }
@@ -1,4 +1,4 @@
1
- $ErrorActionPreference = "Stop"
1
+ $ErrorActionPreference = "Stop"
2
2
  $spec = $env:DSH_JOB_SPEC | ConvertFrom-Json
3
3
  Add-Type @"
4
4
  using System;
@@ -1,4 +1,4 @@
1
- #requires -Version 5.1
1
+ #requires -Version 5.1
2
2
  <#
3
3
  .SYNOPSIS
4
4
  Bootstrap the dsh-profile-transfer plugin on a clean DSH machine.
@@ -1109,6 +1109,31 @@ async function runTool(deps, args, exec) {
1109
1109
  markMemoryUpdated(state, sessionId);
1110
1110
  return jsonResult([`Автоскан «${project.name}» обновлён: ${facts.stats?.files ?? 0} файлов, ${facts.warnings?.length ?? 0} предупреждений.`, ...summary].join("\n"), { project, scan: facts });
1111
1111
  }
1112
+ if (action === "health") {
1113
+ const project = projectFromArgs(deps, args, session);
1114
+ const root = project.roots[0] ?? process.cwd();
1115
+ const facts = loadScan(project) ?? scanProject(root);
1116
+ const findings = [];
1117
+ if (!exists(root)) findings.push({ level: "error", code: "root-missing", message: `корень не найден: ${root}` });
1118
+ if (!exists(path.join(root, ".dsh"))) findings.push({ level: "warning", code: "no-dsh", message: "нет .dsh: агенты, hooks, verify и project memory не настроены" });
1119
+ if (!exists(path.join(root, ".dsh", "PROJECT.md"))) findings.push({ level: "warning", code: "no-project-md", message: "нет .dsh/PROJECT.md: создайте /init" });
1120
+ if (!exists(path.join(root, "AGENTS.md")) && !exists(path.join(root, "CLAUDE.md"))) findings.push({ level: "info", code: "no-instructions", message: "нет AGENTS.md/CLAUDE.md: правила проекта не загружаются" });
1121
+ const git = gitInfo(root);
1122
+ if (!git) findings.push({ level: "warning", code: "no-git", message: "нет git: используйте файловые checkpoint и делайте резервные копии" });
1123
+ for (const warning of (facts.warnings ?? []).slice(0, 10)) findings.push({ level: "warning", code: "scan-warning", message: String(warning) });
1124
+ const age = project.lastScanAt ? Date.now() - Date.parse(project.lastScanAt) : null;
1125
+ if (age !== null && Number.isFinite(age) && age > 30 * 24 * 60 * 60 * 1000) findings.push({ level: "info", code: "stale-scan", message: `автоскан старше 30 дней: ${project.lastScanAt}` });
1126
+ const lines = [
1127
+ `Project health: «${project.name}» (${project.slug})`,
1128
+ `Root: ${root}`,
1129
+ `Git: ${git ? `${git.branch ?? "detached"} @ ${String(git.head ?? "").slice(0, 12)}` : "none"}`,
1130
+ `Scan: ${facts.scannedAt ?? "never"} · ${facts.stats?.files ?? 0} files`,
1131
+ `Findings: ${findings.length}`,
1132
+ ...findings.map((item) => `- ${item.level.toUpperCase()} ${item.code}: ${item.message}`),
1133
+ findings.length === 0 ? "Проблем не найдено." : "Исправьте warnings/errors; info — не блокер.",
1134
+ ];
1135
+ return jsonResult(lines.join("\n"), { project, root, git, findings, scan: { at: facts.scannedAt, warnings: facts.warnings ?? [], files: facts.stats?.files ?? 0 } });
1136
+ }
1112
1137
  if (action === "status") {
1113
1138
  const project = projectFromArgs(deps, args, session);
1114
1139
  const fresh = freshness(project);
@@ -1191,8 +1216,8 @@ const TOOL_PARAMETERS = {
1191
1216
  properties: {
1192
1217
  action: {
1193
1218
  type: "string",
1194
- enum: ["status", "brief", "list", "read", "search", "scan", "append_journal", "update_section", "register"],
1195
- description: "status|brief|list|read|search|scan|append_journal|update_section|register",
1219
+ enum: ["status", "brief", "list", "read", "search", "scan", "health", "append_journal", "update_section", "register"],
1220
+ description: "status|brief|list|read|search|scan|health|append_journal|update_section|register",
1196
1221
  },
1197
1222
  project: { type: "string", description: "Project slug or name; defaults to the current Session's project." },
1198
1223
  file: { type: "string", enum: SECTION_NAMES, description: "Dossier section for read/update_section." },
@@ -1221,7 +1246,7 @@ function makeToolDefinition(deps) {
1221
1246
  return {
1222
1247
  name: "project_memory",
1223
1248
  description:
1224
- "Local long-term project memory. The plugin auto-detects the project from cwd, scans manifests/docs locally and injects a compact digest. Use brief for a one-screen card, status for freshness, read/search for details, scan to refresh the local recon, update_section/append_journal to record durable facts, register only when auto-detection is wrong. Never store secrets or PII; link to files instead of copying code.",
1249
+ "Local long-term project memory. The plugin auto-detects the project from cwd, scans manifests/docs locally and injects a compact digest. Use brief for a one-screen card, status for freshness, health for project health (git, .dsh, instructions, scan warnings), read/search for details, scan to refresh the local recon, update_section/append_journal to record durable facts, register only when auto-detection is wrong. Never store secrets or PII; link to files instead of copying code.",
1225
1250
  parameters: TOOL_PARAMETERS,
1226
1251
  timeoutMs: 20000,
1227
1252
  output: {
@@ -610,14 +610,25 @@ export function apply(ctx) {
610
610
  const dispose = child.commands.register({
611
611
  name: "quality",
612
612
  description: "Миссия качества: статус, фазы, приёмка",
613
- input: { hint: "status | accept | next" },
613
+ input: { hint: "start | status | accept | next" },
614
614
  recordInput: false,
615
615
  handler: async ({ rawInput, agent }) => {
616
616
  const cwd = agent?.session?.header?.cwd ?? process.cwd();
617
- const mission = readMission(cwd);
617
+ let mission = readMission(cwd);
618
618
  const command = String(rawInput ?? "").trim().toLowerCase();
619
+ const raw = String(rawInput ?? "").trim();
619
620
  try {
620
- if (!mission) return { kind: "error", text: "Миссии нет. Начните с tool quality_gate action=start task=\"…\"" };
621
+ if (!mission) {
622
+ if (command === "start" || command.startsWith("start ")) {
623
+ const task = raw.replace(/^start\s*/iu, "").trim() || `Качество проекта ${path.basename(cwd)}`;
624
+ mission = createMission({ task, type: "web-site", profile: "standard" });
625
+ mission.autoStarted = false;
626
+ writeMission(cwd, mission);
627
+ return { kind: "success", text: formatStatus(mission) };
628
+ }
629
+ return { kind: "error", text: "Миссии нет. Начните с /quality start [задача] — или tool quality_gate action=start task=\"…\"." };
630
+ }
631
+ if (command === "start") return { kind: "success", text: `Миссия уже существует (${mission.profile}). ${formatStatus(mission)}` };
621
632
  if (command === "accept") {
622
633
  const rows = await runAcceptance({ cwd, mission });
623
634
  applyAcceptanceRows(mission, rows);
@@ -95,7 +95,7 @@ function describeGateIds(mission) {
95
95
  /** One line for the system prompt: cheap, stable, no tables. */
96
96
  export function formatPromptLine(mission) {
97
97
  if (!mission) {
98
- return "<quality-state>Миссии нет. Для веб-проекта она создаётся автоматически на первом ходе; вручную — tool quality_gate action=start task=\"…\" (профиль fast|standard|turnkey).</quality-state>";
98
+ return "<quality-state>Миссии нет. Для веб-проекта она создаётся автоматически на первом ходе; вручную — /quality start (или tool quality_gate action=start task=\"…\", профиль fast|standard|turnkey).</quality-state>";
99
99
  }
100
100
  const current = progress(mission);
101
101
  const open = current.missing.slice(0, 6).join(" ");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
- "kitVersion": "2.30.0",
4
- "generatedAt": "2026-11-29T13:09:29.349Z",
3
+ "kitVersion": "2.31.0",
4
+ "generatedAt": "2026-12-01T19:01:37.037Z",
5
5
  "skills": {
6
6
  "a11y-audit": {
7
7
  "hash": "707659a5cc1207b478bcf45012b06ba46ba88e795ef7e482799f415072fc47b2",
@@ -2,6 +2,8 @@
2
2
  "schema": 1,
3
3
  "versions": {
4
4
  "2.1.4": {
5
+ "a11y-audit": "707659a5cc1207b478bcf45012b06ba46ba88e795ef7e482799f415072fc47b2",
6
+ "cms-ops": "640b803276aee0db1d088d8434dfeee2631b937b206aa0130feac952ed7bcdd1",
5
7
  "code-review-checklist": "e665bf72cfbfb77948a3cd6df6ebced38777f9aff543d7b9c80b2ced8cccc662",
6
8
  "content-writing": "a21b26ff814e0337d03eeb587b200a1dc66e7de91bfea0f32840ddf8884deeee",
7
9
  "context-economy": "bc8fa2e15327d21cf9ebd187b0df5f620d6a5b617976fa88910ae7877eb46b75",
@@ -9,16 +11,19 @@
9
11
  "debugging-playbook": "0d70b8102f04d29774e466efd81abb448c84a6537a2ca3438f6931a2d6fe0c3a",
10
12
  "delivery-gate": "7b76909a8d5ce099d03813533a1f935aef62d8fe11e63080961c38fd9835e47f",
11
13
  "design-critique": "bbc6ca34b0b76798d581dcd78e83a59040dfac028b5e10d8e7a9be28225410b8",
14
+ "design-system": "5638f678b8d529e71a62e59c5a2ddc4dffd71ee4f77411035ea09d7df5e349e1",
12
15
  "dev-workflow": "832d36da6d3dc3e6e7d1feb18c38260ed8669c7702dffbd2d7a96fc9bc93d22f",
13
16
  "git-and-ci": "a2dc59c5920190bbc715a4a523f3a1592e1914e6d06385ec07341fb76897a6b6",
17
+ "legal-ru-web": "4f070daa636f9d083317d35bd3eb474134fbdf1d9e87b289bf1b4ff586d520b9",
14
18
  "pg-upgrade-verify": "d734178c5dad317fc55842215bbeeba85230cdd8e7b0ea46d74eed92910b8dea",
15
19
  "project-deep-dive": "a70355f2a40b42a6ff03e745ba42389549b4efe4f392c98033fe5073f946452e",
16
20
  "project-memory-maintenance": "648f175093f6a86e20157156d8731b8e9602badedc79188e77160b18832f4893",
17
21
  "release-and-deploy": "e6ed27856b00e8759d31659162290307c16e203d2b5d28fcacb574be17fc795b",
22
+ "release-pipeline": "405f052530d4755e7401faca91ba7a209bf6aff136498125c590ef9f056882e4",
18
23
  "requirements-and-planning": "16f3235a9dcdcd1858112806854ef03d76f77588b56434bbacab803bd204f005",
19
24
  "research-first": "ea5e3684d20529fca65a233044e914ba5b7be56a3d93ce283d8632e87904c23e",
20
25
  "security-review": "8665b2c469de8e83aca670021d5c335fa8c9b93b8dc6bb866759e6062b1abde4",
21
- "seo": "ed48ebc4c1278f857ff430f9a5ec55f638c2f9ba07cc406185cfb94be18ee80d",
26
+ "seo": "4e2a6a3c960fa51edbdac0467d41ea023be37a50afb67b03c0474f33adfb6fc6",
22
27
  "service-desk-conventions": "22ae6c29b7debb0154d183bc732795b67557aeaa0ac906d7b038134aea8ba39a",
23
28
  "service-desk-db-safety": "672c08d25e0a9262aeb0eec27b6daa2a619fade6ff3269bc2b9dc27e22c83d28",
24
29
  "service-desk-release": "1bd0c03f772bf4b79ec4e887f5d0ebd564653bafd3d0d33d70f6c934afdcce47",
@@ -27,12 +32,11 @@
27
32
  "skills-router": "63c2dcdeb07dd4af464a30a8065465bd06b73e4caa8aa874802e5188d4d5a4ae",
28
33
  "subagent-playbook": "72d10995462d43891e7ec2d028caa0ccbca7932875410d4a0d6cfa75c5fe2df9",
29
34
  "testing-strategy": "773fdf1e389e59841b7766862f8890a11fba4a2fce42a2022b9c4bfaae8f6ecc",
30
- "ui-craft": "0fbca80ca2ca434828b3238ecd901fce54b5dc306456cb81a4ed52f7a95921c5",
31
- "ui-design-system": "19244221171995b758dbad02f2e3602859308370b50cc37d93c6f2a6d44cd6f1",
32
- "visual-qa": "97ff6c9c02bbab4bb38c8591a39792f4f51c45bfe278dd7ea839d6cad27c7cf9",
35
+ "ui-batch": "ffe12fb958e2ff7478f2903d367e72828cc927ef07fe74602ef758a4066773cd",
36
+ "web-build": "9e8aa571f28e6974f8ba25a5004ba983efedd7def9daa865a39c78cecd16d55c",
33
37
  "web-quality": "9cffe064faac7ec5763d4644c52e28e7993adca633e0ad92bbd4a88c67ceee23",
34
38
  "web-research": "9bf4d8ba6d2a0fc39c241cdd9f5fe54835af28872473aa617941589c526387c8",
35
- "wow-design": "81139f32fc759f438a36eb4c0212ed3ea17df9d8075e909580e12bc47a0848dd"
39
+ "wow-design": "bba0d65db46c89d971eed43e7cd934f59752c062795a4e0d3d345d7313640e48"
36
40
  },
37
41
  "2.2.0": {
38
42
  "code-review-checklist": "e665bf72cfbfb77948a3cd6df6ebced38777f9aff543d7b9c80b2ced8cccc662",
package/uninstall.ps1 CHANGED
@@ -1,4 +1,4 @@
1
- #requires -Version 5.1
1
+ #requires -Version 5.1
2
2
  <#
3
3
  .SYNOPSIS
4
4
  Remove dsh-desktop-kit from a DSH profile.