dsh-desktop-kit 2.24.0 → 2.30.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 +74 -6
- package/README.md +192 -291
- package/client.js +1 -1
- package/cordis.patch.yml +5 -151
- package/docs/ARCHITECTURE.md +10 -16
- package/docs/COMPATIBILITY.md +1 -1
- package/docs/DEVELOPMENT.md +0 -1
- package/docs/PROPOSAL-2.25-quality-pipeline.md +435 -0
- package/docs/PROPOSAL-NEXUM-FINDINGS.md +259 -0
- package/docs/TEST-2.24.1.md +66 -0
- package/docs/TEST-2.30.0.md +83 -0
- package/docs/images/capability-map-2.30.png +0 -0
- package/docs/images/hero-2.30.png +0 -0
- package/docs/images/quality-pipeline-2.30.png +0 -0
- package/docs/preview/capability-map-2.30.html +106 -0
- package/docs/preview/hero-2.30.html +133 -0
- package/docs/preview/quality-pipeline-2.30.html +142 -0
- package/docs/preview/readme-visuals.css +111 -0
- package/index.js +6 -0
- package/package.json +11 -4
- package/plugins/dsh-agent-extensions/lib/routing.js +4 -0
- package/plugins/dsh-agent-extensions/lib/scaffold.js +152 -27
- package/plugins/dsh-agent-extensions/lib/settings.js +19 -0
- package/plugins/dsh-agent-extensions/lib/swarm.js +6 -2
- package/plugins/dsh-browser-qa/index.js +202 -9
- package/plugins/dsh-browser-qa/lib/design-more.js +688 -0
- package/plugins/dsh-browser-qa/lib/extras.js +1313 -0
- package/plugins/dsh-browser-qa/lib/pages.js +4 -3
- package/plugins/dsh-browser-qa/lib/png.js +190 -0
- package/plugins/dsh-browser-qa/lib/ui-gate.js +171 -31
- package/plugins/dsh-i18n/README.md +36 -0
- package/plugins/dsh-i18n/cordis.patch.yml +3 -0
- package/plugins/dsh-i18n/index.js +294 -0
- package/plugins/dsh-i18n/lib/lang.js +179 -0
- package/plugins/dsh-i18n/package.json +29 -0
- package/plugins/dsh-quality-pipeline/README.md +53 -0
- package/plugins/dsh-quality-pipeline/cordis.patch.yml +3 -0
- package/plugins/dsh-quality-pipeline/index.js +647 -0
- package/plugins/dsh-quality-pipeline/lib/acceptance.js +132 -0
- package/plugins/dsh-quality-pipeline/lib/autostart.js +159 -0
- package/plugins/dsh-quality-pipeline/lib/design.js +123 -0
- package/plugins/dsh-quality-pipeline/lib/machine.js +312 -0
- package/plugins/dsh-quality-pipeline/lib/prework.js +215 -0
- package/plugins/dsh-quality-pipeline/lib/release.js +53 -0
- package/plugins/dsh-quality-pipeline/lib/schema.js +256 -0
- package/plugins/dsh-quality-pipeline/lib/store.js +114 -0
- package/plugins/dsh-quality-pipeline/lib/text.js +109 -0
- package/plugins/dsh-quality-pipeline/package.json +33 -0
- package/plugins/dsh-remote-ops/README.md +38 -0
- package/plugins/dsh-remote-ops/cordis.patch.yml +3 -0
- package/plugins/dsh-remote-ops/index.js +268 -0
- package/plugins/dsh-remote-ops/lib/hosts.js +118 -0
- package/plugins/dsh-remote-ops/lib/ssh.js +96 -0
- package/plugins/dsh-remote-ops/lib/state.js +66 -0
- package/plugins/dsh-remote-ops/package.json +31 -0
- package/plugins/dsh-skill-autopilot/index.js +204 -15
- package/skills/a11y-audit/SKILL.md +67 -0
- package/skills/cms-ops/SKILL.md +74 -0
- package/skills/design-system/SKILL.md +100 -0
- package/skills/legal-ru-web/SKILL.md +68 -0
- package/skills/manifest.json +38 -18
- package/skills/release-pipeline/SKILL.md +67 -0
- package/skills/ui-batch/SKILL.md +60 -0
- package/skills/web-build/SKILL.md +106 -0
- package/skills/web-build/recipes/form.md +16 -0
- package/skills/web-build/recipes/payment.md +16 -0
- package/skills/web-build/recipes/review.md +16 -0
- package/skills-baseline.json +192 -0
- package/docs/TEST-2.24.0.md +0 -123
- package/skills/ui-design-system/references/accessibility-and-responsive.md +0 -50
- package/skills/ui-design-system/references/tokens-and-components.md +0 -67
- package/skills/ui-design-system/references/visual-qa.md +0 -44
- package/skills/visual-qa/references/commands.md +0 -32
- /package/skills/{ui-craft/SKILL.md → design-system/references/ui-craft.md} +0 -0
- /package/skills/{ui-design-system/SKILL.md → design-system/references/ui-design-system.md} +0 -0
- /package/skills/{visual-qa/SKILL.md → ui-batch/references/visual-qa.md} +0 -0
|
@@ -30,57 +30,57 @@ const AGENT_TEMPLATES = {
|
|
|
30
30
|
"---",
|
|
31
31
|
"name: reviewer",
|
|
32
32
|
"description: Ревью диффа, тестов и рисков. Возвращает только findings.",
|
|
33
|
-
"tools: read, grep, glob, team_board, team_message",
|
|
33
|
+
"tools: read, grep, glob, browser_qa, team_board, team_message",
|
|
34
34
|
"permission: read-only",
|
|
35
35
|
"---",
|
|
36
36
|
"",
|
|
37
|
-
"Ты ревьюер проекта. Проверяй дифф, тесты и риски. Не меняй файлы. Возвращай только findings с путями и приоритетом.",
|
|
37
|
+
"Ты ревьюер проекта. Проверяй дифф, тесты и риски. Не меняй файлы. Возвращай только findings с путями и приоритетом. Для UI-правок можешь сам прогнать browser_qa (audit/interact/a11y) — инструмент read-only.",
|
|
38
38
|
"",
|
|
39
39
|
].join("\n"),
|
|
40
40
|
"researcher.md": [
|
|
41
41
|
"---",
|
|
42
42
|
"name: researcher",
|
|
43
43
|
"description: Исследует документацию и практики по внешним источникам, не меняет код.",
|
|
44
|
-
"tools: read, grep, glob, web_search, web_fetch, team_board, team_message",
|
|
44
|
+
"tools: read, grep, glob, web_search, web_fetch, browser_qa, team_board, team_message",
|
|
45
45
|
"permission: read-only",
|
|
46
46
|
"---",
|
|
47
47
|
"",
|
|
48
|
-
"Ты исследователь. Для внешних фактов используй web_search/web_fetch, 2+ источника, даты и ссылки. Не меняй код.",
|
|
48
|
+
"Ты исследователь. Для внешних фактов используй web_search/web_fetch, 2+ источника, даты и ссылки. browser_qa помогает снять реальные метрики референса (perf/a11y). Не меняй код.",
|
|
49
49
|
"",
|
|
50
50
|
].join("\n"),
|
|
51
51
|
"tester.md": [
|
|
52
52
|
"---",
|
|
53
53
|
"name: tester",
|
|
54
54
|
"description: Запускает тесты и проверки в рабочей папке, разбирает падения.",
|
|
55
|
-
"tools: read, grep, glob, bash, pwsh, team_board, team_message",
|
|
55
|
+
"tools: read, grep, glob, bash, pwsh, browser_qa, team_board, team_message",
|
|
56
56
|
"permission: workspace-write",
|
|
57
57
|
"---",
|
|
58
58
|
"",
|
|
59
|
-
"Ты тестировщик. Запускай тесты и проверки, разбирай падения. Не делай необратимых операций.",
|
|
59
|
+
"Ты тестировщик. Запускай тесты и проверки, разбирай падения. Для UI обязательны browser_qa audit matrix=full, interact по ключевым сценариям и a11y. Не делай необратимых операций.",
|
|
60
60
|
"",
|
|
61
61
|
].join("\n"),
|
|
62
62
|
"coordinator.md": [
|
|
63
63
|
"---",
|
|
64
64
|
"name: coordinator",
|
|
65
65
|
"description: Координирует рой: читает board, назначает задачи, пишет участникам.",
|
|
66
|
-
"tools: read, grep, repo_map, team_board, team_message",
|
|
66
|
+
"tools: read, grep, repo_map, browser_qa, team_board, team_message",
|
|
67
67
|
"permission: read-only",
|
|
68
68
|
"---",
|
|
69
69
|
"",
|
|
70
|
-
"Ты лид команды. Сначала прочитай board, затем назначай задачи и пиши участникам через team_message. Не меняй код. Требуй acceptance criteria, evidence и финальный PASS/FAIL.",
|
|
70
|
+
"Ты лид команды. Сначала прочитай board, затем назначай задачи и пиши участникам через team_message. Не меняй код. Требуй acceptance criteria, evidence и финальный PASS/FAIL. Прогоны можешь проверять сам через browser_qa.",
|
|
71
71
|
"",
|
|
72
72
|
].join("\n"),
|
|
73
73
|
"verifier.md": [
|
|
74
74
|
"---",
|
|
75
75
|
"name: verifier",
|
|
76
76
|
"description: Проверяет claims, ссылки, даты и тесты; возвращает structured findings.",
|
|
77
|
-
"tools: read, grep, glob, repo_map, web_fetch, research_ledger, team_board, team_message",
|
|
77
|
+
"tools: read, grep, glob, repo_map, web_fetch, browser_qa, research_ledger, team_board, team_message",
|
|
78
78
|
"model: deepseek-v4-pro",
|
|
79
79
|
"permission: read-only",
|
|
80
80
|
"output: findings",
|
|
81
81
|
"---",
|
|
82
82
|
"",
|
|
83
|
-
"Ты верификатор. Проверяй каждое утверждение: источник доступен, дата актуальна, цитата соответствует claim, тест реально запускался. Ищи противоречия и неподтверждённые выводы. Верни только JSON по findings-контракту.",
|
|
83
|
+
"Ты верификатор. Проверяй каждое утверждение: источник доступен, дата актуальна, цитата соответствует claim, тест реально запускался. Для метрик (LCP/CLS/overflow/контраст) перепроверяй browser_qa, а не верь отчёту. Ищи противоречия и неподтверждённые выводы. Верни только JSON по findings-контракту.",
|
|
84
84
|
"",
|
|
85
85
|
].join("\n"),
|
|
86
86
|
"synthesizer.md": [
|
|
@@ -93,7 +93,7 @@ const AGENT_TEMPLATES = {
|
|
|
93
93
|
"output: findings",
|
|
94
94
|
"---",
|
|
95
95
|
"",
|
|
96
|
-
"Ты синтезатор. Собери находки команды, убери дубли, отдели факты от предположений, проверь ссылки через ledger и верни единый JSON по findings-контракту с blockers и unknowns.",
|
|
96
|
+
"Ты синтезатор. Собери находки команды, убери дубли, отдели факты от предположений, проверь ссылки через ledger и верни единый JSON по findings-контракту с blockers и unknowns. PASS возможен только при 0 P0 и 0 serious.",
|
|
97
97
|
"",
|
|
98
98
|
].join("\n"),
|
|
99
99
|
"security.md": [
|
|
@@ -119,7 +119,77 @@ const AGENT_TEMPLATES = {
|
|
|
119
119
|
"output: findings",
|
|
120
120
|
"---",
|
|
121
121
|
"",
|
|
122
|
-
"Ты performance-ревьюер. Ищи N+1, лишние рендеры, блокирующие операции, размер бандла и регрессии. Каждый finding — severity, file:line, evidence (
|
|
122
|
+
"Ты performance-ревьюер. Ищи N+1, лишние рендеры, блокирующие операции, размер бандла и регрессии. Каждый finding — severity, file:line, evidence (метрика browser_qa perf или команда) и fix.",
|
|
123
|
+
"",
|
|
124
|
+
].join("\n"),
|
|
125
|
+
"ui-critic.md": [
|
|
126
|
+
"---",
|
|
127
|
+
"name: ui-critic",
|
|
128
|
+
"description: Визуальный критик: скриншоты, сетка, ритм отступов, типографика, состояния.",
|
|
129
|
+
"tools: read, grep, glob, browser_qa, team_board, team_message",
|
|
130
|
+
"permission: read-only",
|
|
131
|
+
"output: findings",
|
|
132
|
+
"---",
|
|
133
|
+
"",
|
|
134
|
+
"Ты визуальный критик. Снимай browser_qa shot на 390×844, 844×390, 768×1024, 1024×768 и 1440×900, смотри PNG глазами и ищи: разъехавшийся ритм отступов, два разных заголовка секции, дубли правил, обрезанный текст, слипшиеся блоки, случайные тени и градиенты, отсутствующие состояния. Каждый finding — P0/P1/P2, элемент (селектор), что видно на скриншоте, чем мерить. Не меняй файлы.",
|
|
135
|
+
"",
|
|
136
|
+
].join("\n"),
|
|
137
|
+
"a11y.md": [
|
|
138
|
+
"---",
|
|
139
|
+
"name: a11y",
|
|
140
|
+
"description: Доступность по WCAG 2.2 AA: имена, подписи, контраст, фокус, тап-таргеты.",
|
|
141
|
+
"tools: read, grep, glob, browser_qa, team_board, team_message",
|
|
142
|
+
"permission: read-only",
|
|
143
|
+
"output: findings",
|
|
144
|
+
"---",
|
|
145
|
+
"",
|
|
146
|
+
"Ты аудитор доступности. Запускай browser_qa action=a11y на каждой ключевой странице и проверяй: доступные имена, label у полей, контраст 4.5:1 (крупный 3:1), видимый фокус и его перекрытие (2.4.11), тап-таргеты 24×24 (2.5.8 AA; 44 — рекомендация), порядок заголовков, lang, зум. Каждый finding — критерий WCAG, селектор, метрика, severity. Не меняй файлы.",
|
|
147
|
+
"",
|
|
148
|
+
].join("\n"),
|
|
149
|
+
"cms-ops.md": [
|
|
150
|
+
"---",
|
|
151
|
+
"name: cms-ops",
|
|
152
|
+
"description: CMS-эксплуатация: версии, плагины, checksums, почта, cron, права, обновляемость.",
|
|
153
|
+
"tools: read, grep, glob, pwsh, browser_qa, team_board, team_message",
|
|
154
|
+
"permission: read-only",
|
|
155
|
+
"output: findings",
|
|
156
|
+
"---",
|
|
157
|
+
"",
|
|
158
|
+
"Ты CMS-инженер (read-only). Проверяй WordPress/Bitrix/Drupal: версии ядра и плагинов, checksums, активные плагины, cron, SMTP/доставку писем, права и роли, бэкапы, свободное место, 2FA. Разрешены только читающие команды (wp ... list/get/verify-checksums, ls, df, php -v); изменяющие команды policy заблокирует. Отдельно проверяй карту владения: где в админке правится каждый блок страницы, и нет ли полей, недоступных администратору. Не меняй файлы.",
|
|
159
|
+
"",
|
|
160
|
+
].join("\n"),
|
|
161
|
+
"builder.md": [
|
|
162
|
+
"---",
|
|
163
|
+
"name: builder",
|
|
164
|
+
"description: Писатель: собирает одну единицу работы в своём worktree и сдаёт её на проверку.",
|
|
165
|
+
"tools: read, grep, glob, write, edit, pwsh, browser_qa, quality_gate, team_board, team_message",
|
|
166
|
+
"permission: workspace-write",
|
|
167
|
+
"---",
|
|
168
|
+
"",
|
|
169
|
+
"Ты разработчик одной единицы работы. Работай только в своём worktree. Перед правкой прочитай quality_gate action=status и инварианты проекта. После сборки сам прогоняй browser_qa audit matrix=full, interact по сценариям единицы и a11y, затем закрывай гейты evidence. Не объединяй ветку сам — сдавай на ревью координатору.",
|
|
170
|
+
"",
|
|
171
|
+
].join("\n"),
|
|
172
|
+
"release-ops.md": [
|
|
173
|
+
"---",
|
|
174
|
+
"name: release-ops",
|
|
175
|
+
"description: Выпускает релизы: сборка, подпись, канал обновлений, бэкап, выкатка, откат.",
|
|
176
|
+
"tools: read, grep, glob, pwsh, remote_ops, quality_gate, team_board, team_message",
|
|
177
|
+
"permission: workspace-write",
|
|
178
|
+
"---",
|
|
179
|
+
"",
|
|
180
|
+
"Ты release-инженер. Сначала опиши откат, потом выкатку. Сборка → подпись → канал обновлений → бэкап БД → установка → кеши → запись в «Выпусках» → демо → журнал. Каждый шаг — через remote_ops с dry-run, деструктивное — с confirm. После выкатки проверь version state на прод и демо и что канал обновлений отдаёт новую версию. Не заявляй релиз без evidence в quality_gate (гейт G13).",
|
|
181
|
+
"",
|
|
182
|
+
].join("\n"),
|
|
183
|
+
"demo-watch.md": [
|
|
184
|
+
"---",
|
|
185
|
+
"name: demo-watch",
|
|
186
|
+
"description: Следит за демо-стендом: доступность, состояние обновлений, следы демо на проде.",
|
|
187
|
+
"tools: read, grep, glob, remote_ops, browser_qa, team_board, team_message",
|
|
188
|
+
"permission: read-only",
|
|
189
|
+
"output: findings",
|
|
190
|
+
"---",
|
|
191
|
+
"",
|
|
192
|
+
"Ты наблюдатель демо. Проверяй: демо отвечает 200, версия демо совпадает с ожидаемой, сброс раз в час работает, на проде нет демо-плашек и тестовых данных, канал обновлений не содержит черновиков. Каждый finding — что именно, где, метрика. Не меняй файлы.",
|
|
123
193
|
"",
|
|
124
194
|
].join("\n"),
|
|
125
195
|
};
|
|
@@ -129,6 +199,24 @@ const TEAM_TEMPLATES = {
|
|
|
129
199
|
"research.json": { name: "research", members: ["researcher", "reviewer"], lead: "coordinator", description: "Исследование с проверкой фактов" },
|
|
130
200
|
"audit.json": { name: "audit", members: ["researcher", "reviewer", "verifier"], lead: "coordinator", description: "Read-only аудит: факты, код, проверка ссылок" },
|
|
131
201
|
"security.json": { name: "security", members: ["security", "reviewer"], lead: "coordinator", description: "Read-only security-аудит" },
|
|
202
|
+
"web-accept.json": {
|
|
203
|
+
name: "web-accept",
|
|
204
|
+
members: ["ui-critic", "a11y", "cms-ops", "verifier", "reviewer"],
|
|
205
|
+
lead: "coordinator",
|
|
206
|
+
description: "Приёмка веб-работы: визуал, доступность, CMS, ссылки и независимая проверка метрик",
|
|
207
|
+
},
|
|
208
|
+
"ops.json": {
|
|
209
|
+
name: "ops",
|
|
210
|
+
members: ["release-ops", "demo-watch", "cms-ops", "verifier"],
|
|
211
|
+
lead: "coordinator",
|
|
212
|
+
description: "Эксплуатация: релиз, демо, CMS и независимая проверка состояния",
|
|
213
|
+
},
|
|
214
|
+
"web-build.json": {
|
|
215
|
+
name: "web-build",
|
|
216
|
+
members: ["builder", "ui-critic", "a11y", "verifier"],
|
|
217
|
+
lead: "coordinator",
|
|
218
|
+
description: "Сборка единицы: писатель в worktree + визуальный критик + доступность + верификатор (только явный team + worktrees=true)",
|
|
219
|
+
},
|
|
132
220
|
};
|
|
133
221
|
|
|
134
222
|
function readPackage(cwd) {
|
|
@@ -184,6 +272,20 @@ function projectMarkdown(cwd, meta) {
|
|
|
184
272
|
meta.remote ? `Git: ${meta.remote}` : "",
|
|
185
273
|
meta.commands.length > 0 ? `Verify: ${meta.commands.join(" · ")}` : "",
|
|
186
274
|
"",
|
|
275
|
+
"## Инварианты",
|
|
276
|
+
"",
|
|
277
|
+
"- Один слой стилей на компонент: второе определение того же блока — баг процесса.",
|
|
278
|
+
"- `tokens.css` (или его аналог) — единственный источник цвета, отступов и типографики.",
|
|
279
|
+
"- Штатные пункты админки и меню не удаляются: изменение фиксируется в «Карте владения».",
|
|
280
|
+
"- Форма не считается рабочей, пока не проверена доставка заявки (SMTP или запись в БД).",
|
|
281
|
+
"- «Готово» без evidence (команда, метрика, путь к отчёту) не принимается.",
|
|
282
|
+
"",
|
|
283
|
+
"## Карта владения",
|
|
284
|
+
"",
|
|
285
|
+
"| Что на сайте | Файл / шаблон | Где правится в админке |",
|
|
286
|
+
"|---|---|---|",
|
|
287
|
+
"| Главная, герой | | |",
|
|
288
|
+
"",
|
|
187
289
|
"Created automatically by dsh-desktop-kit on the first session. Edit freely; `/init --force` regenerates.",
|
|
188
290
|
"",
|
|
189
291
|
].filter((line) => line !== "").join("\n");
|
|
@@ -286,10 +388,12 @@ export function ensureProjectScaffold(cwd) {
|
|
|
286
388
|
if (readSettings().autoScaffold === false) return { skipped: true, reason: "autoScaffold:false", created: [], dsh: path.join(cwd, ".dsh") };
|
|
287
389
|
const dsh = path.join(cwd, ".dsh");
|
|
288
390
|
const configFile = path.join(dsh, "kit.json");
|
|
391
|
+
let config = {};
|
|
289
392
|
try {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
393
|
+
config = JSON.parse(fs.readFileSync(configFile, "utf8")) ?? {};
|
|
394
|
+
} catch { /* no config */ }
|
|
395
|
+
if (config?.provision === false) return { skipped: true, reason: "provision:false", created: [], dsh };
|
|
396
|
+
const disabledAgents = new Set(Array.isArray(config.disabledAgents) ? config.disabledAgents.map((name) => String(name)) : []);
|
|
293
397
|
const cached = PROVISION_CACHE.get(cwd);
|
|
294
398
|
if (cached && Date.now() - cached < PROVISION_TTL) return { skipped: false, cached: true, created: [], dsh };
|
|
295
399
|
const created = [];
|
|
@@ -303,20 +407,19 @@ export function ensureProjectScaffold(cwd) {
|
|
|
303
407
|
}
|
|
304
408
|
}
|
|
305
409
|
const agentsDir = path.join(dsh, "agents");
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
410
|
+
/* Fill in missing roles on every provision, so an upgrade delivers new roles
|
|
411
|
+
* (ui-critic, a11y, cms-ops, builder) to existing projects. A role the user
|
|
412
|
+
* deleted on purpose can be excluded in `.dsh/kit.json`:
|
|
413
|
+
* { "disabledAgents": ["builder"] } */
|
|
414
|
+
for (const [file, content] of Object.entries(AGENT_TEMPLATES)) {
|
|
415
|
+
const name = file.replace(/\.md$/u, "");
|
|
416
|
+
if (disabledAgents.has(name)) continue;
|
|
417
|
+
if (writeIfMissing(path.join(agentsDir, file), content)) created.push(path.join(agentsDir, file));
|
|
312
418
|
}
|
|
313
419
|
const teamsDir = path.join(dsh, "teams");
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
for (const [file, value] of Object.entries(TEAM_TEMPLATES)) {
|
|
318
|
-
if (writeIfMissing(path.join(teamsDir, file), `${JSON.stringify(value, null, 2)}\n`)) created.push(path.join(teamsDir, file));
|
|
319
|
-
}
|
|
420
|
+
for (const [file, value] of Object.entries(TEAM_TEMPLATES)) {
|
|
421
|
+
if (disabledAgents.has(file.replace(/\.json$/u, ""))) continue;
|
|
422
|
+
if (writeIfMissing(path.join(teamsDir, file), `${JSON.stringify(value, null, 2)}\n`)) created.push(path.join(teamsDir, file));
|
|
320
423
|
}
|
|
321
424
|
if (writeIfMissing(path.join(dsh, "swarm.json"), `${JSON.stringify({ enabled: true, threshold: 3, maxAgents: 4 }, null, 2)}\n`)) created.push(path.join(dsh, "swarm.json"));
|
|
322
425
|
if (writeIfMissing(path.join(dsh, "agents", ".gitkeep"), "")) created.push(path.join(dsh, "agents", ".gitkeep"));
|
|
@@ -358,6 +461,28 @@ export function ensureProjectScaffold(cwd) {
|
|
|
358
461
|
fs.writeFileSync(projectFile, projectMarkdown(cwd, meta), "utf8");
|
|
359
462
|
created.push(projectFile);
|
|
360
463
|
}
|
|
464
|
+
|
|
465
|
+
const designRuleFile = path.join(dsh, "rules", "design.md");
|
|
466
|
+
if (!fs.existsSync(designRuleFile)) {
|
|
467
|
+
fs.writeFileSync(
|
|
468
|
+
designRuleFile,
|
|
469
|
+
[
|
|
470
|
+
"---",
|
|
471
|
+
"always: true",
|
|
472
|
+
"---",
|
|
473
|
+
"# Правила дизайна",
|
|
474
|
+
"",
|
|
475
|
+
"- Отступы секций — только через токен (--section-y / аналог), не «100px» в компоненте.",
|
|
476
|
+
"- Ничего не липнет к линиям и иконкам: минимум 12px между текстом и разделителем.",
|
|
477
|
+
"- Ширина контента одинаковая на всех страницах одного типа (как главная).",
|
|
478
|
+
"- Плитки в одном ряду одного цвета и без вертикальных полос по краям.",
|
|
479
|
+
"- Иконки — только из набора проекта; эмодзи вместо иконок не используются.",
|
|
480
|
+
"- Состояния hover/focus/active заданы и не вызывают «рябь» на кнопках.",
|
|
481
|
+
"",
|
|
482
|
+
].join("\n"),
|
|
483
|
+
);
|
|
484
|
+
created.push(designRuleFile);
|
|
485
|
+
}
|
|
361
486
|
const ruleFile = path.join(dsh, "rules", "project.md");
|
|
362
487
|
if (!fs.existsSync(ruleFile)) {
|
|
363
488
|
fs.writeFileSync(ruleFile, "---\nalways: true\n---\n# Правила проекта\n\n- Источник истины: `.dsh/PROJECT.md`.\n- Перед сдачей — тесты и проверка UI.\n", "utf8");
|
|
@@ -11,8 +11,16 @@ export const DEFAULTS = {
|
|
|
11
11
|
autoScaffold: true,
|
|
12
12
|
swarm: { enabled: true, threshold: 3, maxAgents: 4 },
|
|
13
13
|
mcpBootstrap: { enabled: true, trusted: false },
|
|
14
|
+
quality: { enabled: true, profile: "standard", autoStart: true },
|
|
14
15
|
};
|
|
15
16
|
|
|
17
|
+
const QUALITY_PROFILES = new Set(["fast", "standard", "turnkey"]);
|
|
18
|
+
|
|
19
|
+
function qualityProfileOf(value) {
|
|
20
|
+
const profile = String(value ?? "");
|
|
21
|
+
return QUALITY_PROFILES.has(profile) ? profile : DEFAULTS.quality.profile;
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
function home() {
|
|
17
25
|
return process.env.DSH_HOME || path.join(os.homedir(), ".dsh");
|
|
18
26
|
}
|
|
@@ -38,6 +46,11 @@ export function readSettings() {
|
|
|
38
46
|
enabled: current.mcpBootstrap?.enabled !== false,
|
|
39
47
|
trusted: current.mcpBootstrap?.trusted === true,
|
|
40
48
|
},
|
|
49
|
+
quality: {
|
|
50
|
+
enabled: current.quality?.enabled !== false,
|
|
51
|
+
profile: qualityProfileOf(current.quality?.profile),
|
|
52
|
+
autoStart: current.quality?.autoStart !== false,
|
|
53
|
+
},
|
|
41
54
|
};
|
|
42
55
|
}
|
|
43
56
|
|
|
@@ -58,6 +71,12 @@ export function updateSettings(patch = {}) {
|
|
|
58
71
|
...(typeof patch.mcpBootstrap?.enabled === "boolean" ? { enabled: patch.mcpBootstrap.enabled } : {}),
|
|
59
72
|
...(typeof patch.mcpBootstrap?.trusted === "boolean" ? { trusted: patch.mcpBootstrap.trusted } : {}),
|
|
60
73
|
},
|
|
74
|
+
quality: {
|
|
75
|
+
...current.quality,
|
|
76
|
+
...(typeof patch.quality?.enabled === "boolean" ? { enabled: patch.quality.enabled } : {}),
|
|
77
|
+
...(typeof patch.quality?.autoStart === "boolean" ? { autoStart: patch.quality.autoStart } : {}),
|
|
78
|
+
...(typeof patch.quality?.profile === "string" ? { profile: qualityProfileOf(patch.quality.profile) } : {}),
|
|
79
|
+
},
|
|
61
80
|
};
|
|
62
81
|
const file = settingsPath();
|
|
63
82
|
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
@@ -21,6 +21,9 @@ const EXTERNAL = [
|
|
|
21
21
|
/* A bare Russian "и" is far too common to signal several areas: "проверь X и Y"
|
|
22
22
|
* is one question. Only explicit "plus/also" (or the English equivalents) count. */
|
|
23
23
|
const MULTI = [/\b(?:and|plus|also)\b/iu, /(?:^|\s)(?:плюс|также)(?:\s|$)/iu];
|
|
24
|
+
/* UI work is where a read-only swarm pays for itself: screenshots, contrast,
|
|
25
|
+
* admin edits and metrics are independent checks of the same page. */
|
|
26
|
+
const UI = [/\b(?:ui|ux|layout|css|page|site|design|responsive|mobile|tablet)\b/iu, /(?:вёрстк|верстк|дизайн|страниц|сайт|адаптив|мобил|планшет|интерфейс|лендинг)/iu];
|
|
24
27
|
|
|
25
28
|
export function loadSwarmOptions(projectRoot) {
|
|
26
29
|
try {
|
|
@@ -50,11 +53,12 @@ export function chooseSwarm(task, teams = [], agents = [], options = {}) {
|
|
|
50
53
|
|
|
51
54
|
const maxAgents = Math.max(2, Math.min(6, Number(options.maxAgents) || 4));
|
|
52
55
|
const research = EXTERNAL.some((pattern) => pattern.test(text));
|
|
56
|
+
const ui = UI.some((pattern) => pattern.test(text));
|
|
53
57
|
const readOnlyNames = new Set(readOnly.map((agent) => agent.name));
|
|
54
58
|
const lead = readOnly.find((agent) => /^(?:lead|coordinator|orchestrator)$/iu.test(agent.name))?.name ?? "";
|
|
55
59
|
const candidates = readOnly.filter((agent) => agent.name !== lead);
|
|
56
60
|
|
|
57
|
-
const preferredPresets = research ? ["research", "audit"] : ["review", "security", "audit"];
|
|
61
|
+
const preferredPresets = research ? ["research", "audit"] : ui ? ["web-accept", "review", "security", "audit"] : ["review", "security", "audit"];
|
|
58
62
|
const presets = teams
|
|
59
63
|
.filter((team) => Array.isArray(team.members) && team.members.length >= 2)
|
|
60
64
|
.map((team) => ({ team, score: preferredPresets.indexOf(team.id) }))
|
|
@@ -68,7 +72,7 @@ export function chooseSwarm(task, teams = [], agents = [], options = {}) {
|
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
const preferred = ["reviewer", "researcher", "verifier", "security", "performance"];
|
|
75
|
+
const preferred = ["ui-critic", "a11y", "reviewer", "cms-ops", "researcher", "verifier", "security", "performance"];
|
|
72
76
|
const members = candidates
|
|
73
77
|
.slice()
|
|
74
78
|
.sort((a, b) => (preferred.indexOf(a.name) + 1 || 99) - (preferred.indexOf(b.name) + 1 || 99))
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-browser-qa — headless-Chrome quality checks for DSH agents.
|
|
3
3
|
*
|
|
4
|
-
* One tool,
|
|
5
|
-
* status
|
|
6
|
-
* shot
|
|
7
|
-
* audit
|
|
8
|
-
*
|
|
4
|
+
* One tool, seven actions:
|
|
5
|
+
* status — detect Chrome/Edge and report its path/version;
|
|
6
|
+
* shot — open a URL or local HTML file, set a viewport, save a PNG;
|
|
7
|
+
* audit — at responsive widths measure horizontal overflow, list the
|
|
8
|
+
* overflowing elements and console errors, optionally save PNGs;
|
|
9
|
+
* interact — run a click/fill/expect scenario and catch covered controls;
|
|
10
|
+
* a11y — accessibility checks (names, labels, contrast, tap targets,
|
|
11
|
+
* focus visibility) without axe-core;
|
|
12
|
+
* perf — LCP/INP/CLS/FCP/TTFB against the web.dev budget;
|
|
13
|
+
* probe — crawl internal links and empty sections for 404 and dead hrefs.
|
|
9
14
|
*
|
|
10
15
|
* Everything is Node-built-ins only: the DevTools protocol is spoken over the
|
|
11
16
|
* WebSocket client built into Node 22+/24, so there is no Playwright dependency.
|
|
12
17
|
*/
|
|
18
|
+
import { runA11y, runCompare, runDesign, runFlow, runLocate, runPerf, runProbe } from "./lib/extras.js";
|
|
19
|
+
import { annotateReference, appendRule, runBenchmark, runConsistency, runContent, runReport, runStates, runTokens } from "./lib/design-more.js";
|
|
13
20
|
import { auditPages, captureShot, statusReport } from "./lib/pages.js";
|
|
14
21
|
import { createUiGate } from "./lib/ui-gate.js";
|
|
15
22
|
import { errorMessage, normalizeViewport, parseTimeout, parseWidths } from "./lib/qa.js";
|
|
@@ -50,15 +57,15 @@ function makeToolDefinition() {
|
|
|
50
57
|
return {
|
|
51
58
|
name: TOOL_NAME,
|
|
52
59
|
description:
|
|
53
|
-
"Headless-Chrome quality checks without Playwright. status: detect Chrome and its version. shot: open an http(s) URL or local HTML file, set the viewport, save a PNG and return its path/size. audit: load the page at responsive viewports (matrix 'full' = phone 390x844 and 844x390, tablet 768x1024 and 1024x768, desktop 1440x900; default 390/768/1440) and report horizontal overflow (documentElement.scrollWidth vs clientWidth), the overflowing elements, per-viewport device labels, console errors, markup/accessibility issues (missing alt, unlabeled fields, nameless links/buttons, duplicate ids, heading order, lang/title/viewport, positive tabindex), and optionally one PNG per viewport (pass outDir). Uses the Chrome DevTools protocol over a temporary profile; no external network calls beyond the page itself.",
|
|
60
|
+
"Headless-Chrome quality checks without Playwright. status: detect Chrome and its version. shot: open an http(s) URL or local HTML file, set the viewport, save a PNG and return its path/size. audit: load the page at responsive viewports (matrix 'full' = phone 390x844 and 844x390, tablet 768x1024 and 1024x768, desktop 1440x900; default 390/768/1440) and report horizontal overflow (documentElement.scrollWidth vs clientWidth), the overflowing elements, per-viewport device labels, console errors, markup/accessibility issues (missing alt, unlabeled fields, nameless links/buttons, duplicate ids, heading order, lang/title/viewport, positive tabindex), and optionally one PNG per viewport (pass outDir). interact: run a scenario of click/fill/press/wait/expect/eval/shot/reload steps at one viewport — a click fails when the element is missing, invisible, disabled or covered by another element (the classic dead zone), so a green audit plus a broken menu can no longer happen. a11y: check accessible names, form labels, heading order, duplicate ids, contrast, tap targets (WCAG 2.2 AA 2.5.8 = 24px, 44px reported as advisory), zoom locks, aria-hidden focusables and focus visibility/obscuring for up to focusLimit elements. perf: LCP/INP/CLS/FCP/TTFB plus requests and bytes against the web.dev budget (LCP 2500 ms, INP 200 ms, CLS 0.1). probe: crawl same-origin links and sections, report 404/410, empty hrefs and sections without links. Uses the Chrome DevTools protocol over a temporary profile; no external network calls beyond the page itself.",
|
|
54
61
|
parameters: {
|
|
55
62
|
type: "object",
|
|
56
63
|
additionalProperties: false,
|
|
57
64
|
properties: {
|
|
58
65
|
action: {
|
|
59
66
|
type: "string",
|
|
60
|
-
enum: ["shot", "audit", "status"],
|
|
61
|
-
description: "shot: one viewport PNG | audit: overflow/console report at responsive widths | status: Chrome path/version",
|
|
67
|
+
enum: ["shot", "audit", "status", "interact", "a11y", "perf", "probe", "design", "locate", "compare", "tokens", "consistency", "content", "states", "rule", "report", "benchmark", "reference"],
|
|
68
|
+
description: "shot: one viewport PNG | audit: overflow/console report at responsive widths | interact: scenario steps | a11y: accessibility report | perf: LCP/INP/CLS | probe: link crawl | design: rhythm, duplicate selectors, layers, type scale | status: Chrome path/version",
|
|
62
69
|
},
|
|
63
70
|
url: {
|
|
64
71
|
type: "string",
|
|
@@ -99,6 +106,43 @@ function makeToolDefinition() {
|
|
|
99
106
|
},
|
|
100
107
|
fullPage: { type: "boolean", description: "Capture the full page instead of the viewport (height capped at 16384 px)." },
|
|
101
108
|
timeoutMs: { type: "integer", description: "Page load timeout per width in ms (default 30000, range 3000..120000)." },
|
|
109
|
+
steps: {
|
|
110
|
+
type: "array",
|
|
111
|
+
maxItems: 40,
|
|
112
|
+
description:
|
|
113
|
+
"interact: scenario steps. {type:'click', selector}, {type:'fill', selector, value}, {type:'press', key}, {type:'wait', ms}, {type:'expect', selector, visible?, text?, count?, enabled?}, {type:'eval', code}, {type:'shot', name?, fullPage?}, {type:'reload'}.",
|
|
114
|
+
items: {
|
|
115
|
+
type: "object",
|
|
116
|
+
additionalProperties: true,
|
|
117
|
+
required: ["type"],
|
|
118
|
+
properties: {
|
|
119
|
+
type: { type: "string", enum: ["click", "fill", "press", "wait", "expect", "eval", "shot", "reload"] },
|
|
120
|
+
selector: { type: "string" },
|
|
121
|
+
value: { type: "string" },
|
|
122
|
+
key: { type: "string" },
|
|
123
|
+
ms: { type: "integer" },
|
|
124
|
+
text: { type: "string" },
|
|
125
|
+
count: { type: "integer" },
|
|
126
|
+
visible: { type: "boolean" },
|
|
127
|
+
enabled: { type: "boolean" },
|
|
128
|
+
code: { type: "string" },
|
|
129
|
+
name: { type: "string" },
|
|
130
|
+
fullPage: { type: "boolean" },
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
focusLimit: { type: "integer", description: "a11y: how many focusable elements to walk for focus visibility (default 12, 0 disables)." },
|
|
135
|
+
maxLinks: { type: "integer", description: "probe: how many links to check (default 40, max 80)." },
|
|
136
|
+
internalOnly: { type: "boolean", description: "probe: check only same-origin links (default true)." },
|
|
137
|
+
text: { type: "string", description: "locate: visible text of the element to find (e.g. «Записаться на приём»)." },
|
|
138
|
+
index: { type: "integer", description: "locate: which match to take when the text repeats (default 0)." },
|
|
139
|
+
scope: { type: "string", description: "locate: CSS selector to limit the search (default body)." },
|
|
140
|
+
baselineDir: { type: "string", description: "compare: folder for baselines (default .dsh/browser-qa/baseline)." },
|
|
141
|
+
threshold: { type: "number", description: "compare: allowed share of changed pixels (default 0.002 = 0.2 %)." },
|
|
142
|
+
update: { type: "boolean", description: "compare: write the current screenshot as the new baseline." },
|
|
143
|
+
urls: { type: "array", items: { type: "string" }, maxItems: 8, description: "consistency: 2+ page URLs to compare (container width, headings, paddings)." },
|
|
144
|
+
rule: { type: "string", description: "rule: owner design rule text to append to .dsh/rules/design.md." },
|
|
145
|
+
take: { type: "string", description: "reference: what exactly we take from this reference (grid, type, states)." },
|
|
102
146
|
},
|
|
103
147
|
required: ["action"],
|
|
104
148
|
},
|
|
@@ -158,10 +202,159 @@ function makeToolDefinition() {
|
|
|
158
202
|
signal,
|
|
159
203
|
});
|
|
160
204
|
}
|
|
205
|
+
if (action === "interact") {
|
|
206
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("interact");
|
|
207
|
+
if (!Array.isArray(args?.steps) || args.steps.length === 0) {
|
|
208
|
+
return { ok: false, error: "steps are required", text: "browser_qa interact: нужен массив steps (click/fill/press/wait/expect/eval/shot/reload)" };
|
|
209
|
+
}
|
|
210
|
+
const viewport = normalizeViewport(args);
|
|
211
|
+
return await runFlow({
|
|
212
|
+
target: args.url,
|
|
213
|
+
width: viewport.width,
|
|
214
|
+
height: viewport.height,
|
|
215
|
+
steps: args.steps,
|
|
216
|
+
outDir: args?.outDir,
|
|
217
|
+
timeoutMs: parseTimeout(args?.timeoutMs),
|
|
218
|
+
cwd,
|
|
219
|
+
signal,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
if (action === "a11y") {
|
|
223
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("a11y");
|
|
224
|
+
const viewport = normalizeViewport(args);
|
|
225
|
+
return await runA11y({
|
|
226
|
+
target: args.url,
|
|
227
|
+
width: viewport.width,
|
|
228
|
+
height: viewport.height,
|
|
229
|
+
focusLimit: args?.focusLimit,
|
|
230
|
+
timeoutMs: parseTimeout(args?.timeoutMs),
|
|
231
|
+
cwd,
|
|
232
|
+
signal,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (action === "perf") {
|
|
236
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("perf");
|
|
237
|
+
const viewport = normalizeViewport(args);
|
|
238
|
+
return await runPerf({
|
|
239
|
+
target: args.url,
|
|
240
|
+
width: viewport.width,
|
|
241
|
+
height: viewport.height,
|
|
242
|
+
timeoutMs: parseTimeout(args?.timeoutMs),
|
|
243
|
+
cwd,
|
|
244
|
+
signal,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
if (action === "probe") {
|
|
248
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("probe");
|
|
249
|
+
return await runProbe({
|
|
250
|
+
target: args.url,
|
|
251
|
+
maxLinks: args?.maxLinks,
|
|
252
|
+
internalOnly: args?.internalOnly !== false,
|
|
253
|
+
timeoutMs: parseTimeout(args?.timeoutMs),
|
|
254
|
+
cwd,
|
|
255
|
+
signal,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (action === "design") {
|
|
259
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("design");
|
|
260
|
+
const viewport = normalizeViewport(args);
|
|
261
|
+
return await runDesign({
|
|
262
|
+
target: args.url,
|
|
263
|
+
width: viewport.width,
|
|
264
|
+
height: viewport.height,
|
|
265
|
+
timeoutMs: parseTimeout(args?.timeoutMs),
|
|
266
|
+
cwd,
|
|
267
|
+
signal,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
if (action === "locate") {
|
|
271
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("locate");
|
|
272
|
+
if (typeof args?.text !== "string" || args.text.trim().length === 0) {
|
|
273
|
+
return { ok: false, error: "text is required", text: "browser_qa locate: нужен text — видимый текст элемента («Записаться на приём»)" };
|
|
274
|
+
}
|
|
275
|
+
const viewport = normalizeViewport(args);
|
|
276
|
+
return await runLocate({
|
|
277
|
+
target: args.url,
|
|
278
|
+
width: viewport.width,
|
|
279
|
+
height: viewport.height,
|
|
280
|
+
text: args.text,
|
|
281
|
+
index: args?.index,
|
|
282
|
+
scope: args?.scope,
|
|
283
|
+
outDir: args?.outDir,
|
|
284
|
+
timeoutMs: parseTimeout(args?.timeoutMs),
|
|
285
|
+
cwd,
|
|
286
|
+
signal,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
if (action === "compare") {
|
|
290
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("compare");
|
|
291
|
+
const viewport = normalizeViewport(args);
|
|
292
|
+
return await runCompare({
|
|
293
|
+
target: args.url,
|
|
294
|
+
width: viewport.width,
|
|
295
|
+
height: viewport.height,
|
|
296
|
+
fullPage: args?.fullPage === true,
|
|
297
|
+
baselineDir: args?.baselineDir,
|
|
298
|
+
outDir: args?.outDir,
|
|
299
|
+
threshold: args?.threshold,
|
|
300
|
+
update: args?.update === true,
|
|
301
|
+
timeoutMs: parseTimeout(args?.timeoutMs),
|
|
302
|
+
cwd,
|
|
303
|
+
signal,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (action === "reference") {
|
|
307
|
+
if (typeof args?.url !== "string" || typeof args?.take !== "string") {
|
|
308
|
+
return { ok: false, error: "url and take are required", text: 'browser_qa reference: нужен url и take="что берём из референса"' };
|
|
309
|
+
}
|
|
310
|
+
return annotateReference(cwd, args.url, args.take);
|
|
311
|
+
}
|
|
312
|
+
if (action === "benchmark") {
|
|
313
|
+
const urls = Array.isArray(args?.urls) ? args.urls : [];
|
|
314
|
+
if (urls.length === 0) return { ok: false, error: "urls are required", text: "browser_qa benchmark: нужен urls=[…] с 2–6 референсами" };
|
|
315
|
+
const viewport = normalizeViewport(args);
|
|
316
|
+
return await runBenchmark({ urls, width: viewport.width, height: viewport.height, outDir: args?.outDir, timeoutMs: parseTimeout(args?.timeoutMs), cwd, signal });
|
|
317
|
+
}
|
|
318
|
+
if (action === "tokens") {
|
|
319
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("tokens");
|
|
320
|
+
const viewport = normalizeViewport(args);
|
|
321
|
+
return await runTokens({ target: args.url, width: viewport.width, height: viewport.height, timeoutMs: parseTimeout(args?.timeoutMs), cwd, signal });
|
|
322
|
+
}
|
|
323
|
+
if (action === "consistency") {
|
|
324
|
+
const urls = Array.isArray(args?.urls) ? args.urls : [];
|
|
325
|
+
if (urls.length < 2) {
|
|
326
|
+
return { ok: false, error: "urls are required", text: "browser_qa consistency: нужен массив urls (2+ страницы одного типа)" };
|
|
327
|
+
}
|
|
328
|
+
const viewport = normalizeViewport(args);
|
|
329
|
+
return await runConsistency({ urls, width: viewport.width, height: viewport.height, timeoutMs: parseTimeout(args?.timeoutMs), cwd, signal });
|
|
330
|
+
}
|
|
331
|
+
if (action === "content") {
|
|
332
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("content");
|
|
333
|
+
const viewport = normalizeViewport(args);
|
|
334
|
+
return await runContent({ target: args.url, width: viewport.width, height: viewport.height, timeoutMs: parseTimeout(args?.timeoutMs), cwd, signal });
|
|
335
|
+
}
|
|
336
|
+
if (action === "states") {
|
|
337
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("states");
|
|
338
|
+
const viewport = normalizeViewport(args);
|
|
339
|
+
return await runStates({ target: args.url, width: viewport.width, height: viewport.height, timeoutMs: parseTimeout(args?.timeoutMs), cwd, signal });
|
|
340
|
+
}
|
|
341
|
+
if (action === "rule") {
|
|
342
|
+
if (typeof args?.rule !== "string" || args.rule.trim().length === 0) {
|
|
343
|
+
return { ok: false, error: "rule is required", text: "browser_qa rule: нужен текст правила, например rule=\"плитки в ряду одного цвета\"" };
|
|
344
|
+
}
|
|
345
|
+
return appendRule(cwd, args.rule);
|
|
346
|
+
}
|
|
347
|
+
if (action === "report") {
|
|
348
|
+
if (typeof args?.url !== "string" || args.url.trim().length === 0) return missingUrl("report");
|
|
349
|
+
return await runReport(
|
|
350
|
+
{ target: args.url, outDir: args?.outDir, timeoutMs: parseTimeout(args?.timeoutMs), cwd },
|
|
351
|
+
{ auditPages, runA11y, runDesign, runContent, runTokens },
|
|
352
|
+
);
|
|
353
|
+
}
|
|
161
354
|
return {
|
|
162
355
|
ok: false,
|
|
163
356
|
error: `unknown action: ${action || "(empty)"}`,
|
|
164
|
-
text: `browser_qa: неизвестное действие «${action || "(пусто)"}». Доступно: shot, audit, status.`,
|
|
357
|
+
text: `browser_qa: неизвестное действие «${action || "(пусто)"}». Доступно: shot, audit, interact, a11y, perf, probe, design, locate, compare, tokens, consistency, content, states, rule, report, status.`,
|
|
165
358
|
};
|
|
166
359
|
} catch (error) {
|
|
167
360
|
return failure("browser_qa", error);
|