diff --git a/apps/console/src/openclaw/parse-mode-guard.test.ts b/apps/console/src/openclaw/parse-mode-guard.test.ts index 9c724fd17..043439fec 100644 --- a/apps/console/src/openclaw/parse-mode-guard.test.ts +++ b/apps/console/src/openclaw/parse-mode-guard.test.ts @@ -68,9 +68,7 @@ function validateTelegramHtml(text: string): void { if (closing) { const top = stack.pop(); if (!top) { - throw new Error( - `Stray with no opener at offset ${offset}.`, - ); + throw new Error(`Stray with no opener at offset ${offset}.`); } if (top.tag !== tag) { throw new Error( @@ -175,7 +173,7 @@ describe("OpenClaw parse_mode integrity (regression PR #1568)", () => { expect(() => validateTelegramLegacyMarkdown("`code")).toThrow(/Unbalanced/); }); - it("handler.ts does not wrap a long-form *_TEXT/*_MESSAGE/*_HELP const with legacy parse_mode: \"Markdown\"", () => { + it('handler.ts does not wrap a long-form *_TEXT/*_MESSAGE/*_HELP const with legacy parse_mode: "Markdown"', () => { // Шукаємо паттерн виду `parse_mode: "Markdown"` і дивимось 8 рядків // вище — якщо там згадка HELP_TEXT / FOO_TEXT / FOO_MESSAGE / // FOO_HELP / FOO_REPLY — fail, бо такі змінні майже завжди довгі і diff --git a/docs/diagnostics/README.md b/docs/diagnostics/README.md index 4f89a13bb..61f79520f 100644 --- a/docs/diagnostics/README.md +++ b/docs/diagnostics/README.md @@ -7,13 +7,13 @@ ## Чим це відрізняється від `docs/audits/`? -| | `docs/audits/` | `docs/diagnostics/` | -| --- | --- | --- | -| Періодичність | Регулярні (квартальні / напівщорічні) | Ad-hoc, на запит | -| Скоуп | Вся система чи весь домен | Тонкий зріз або фокусована thematic прожарка | -| Lifecycle | Active / Closed / Archived | Active / Superseded | -| Що породжує | Roadmap, plan, tracker | Спрямовані рекомендації + посилання у відповідні tracker-и | -| Приклад | `2026-04-28-sergeant-comprehensive-audit.md` | `2026-05-03-web-deep-dive/` | +| | `docs/audits/` | `docs/diagnostics/` | +| ------------- | -------------------------------------------- | ---------------------------------------------------------- | +| Періодичність | Регулярні (квартальні / напівщорічні) | Ad-hoc, на запит | +| Скоуп | Вся система чи весь домен | Тонкий зріз або фокусована thematic прожарка | +| Lifecycle | Active / Closed / Archived | Active / Superseded | +| Що породжує | Roadmap, plan, tracker | Спрямовані рекомендації + посилання у відповідні tracker-и | +| Приклад | `2026-04-28-sergeant-comprehensive-audit.md` | `2026-05-03-web-deep-dive/` | > **Правило:** якщо документ описує **загальний стан** системи на дату — це аудит. Якщо це **точкова прожарка** з конкретними fix points — це diagnostic. @@ -24,8 +24,8 @@ ## Документи -| Документ | Скоуп | Status | -| --- | --- | --- | +| Документ | Скоуп | Status | +| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------ | | [`2026-05-03-web-deep-dive/`](./2026-05-03-web-deep-dive/) | Глибока прожарка `apps/web` + `apps/server` + `packages/*` (frontend ergonomics, architecture, backend, performance, security, testing, DevX) | Active | ## Як додавати новий diagnostic diff --git a/docs/initiatives/0009-agent-os-hardening.md b/docs/initiatives/0009-agent-os-hardening.md index 9301b053b..5dc5f9d38 100644 --- a/docs/initiatives/0009-agent-os-hardening.md +++ b/docs/initiatives/0009-agent-os-hardening.md @@ -9,26 +9,26 @@ ## Поточний прогрес -| Фаза | PR | Опис | Гілка/PR | Статус | -| ---- | ------ | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 1.1 | merged | `pnpm lint:skills` + skills-lock SHA256 | [#1659](https://github.com/Skords-01/Sergeant/pull/1659) | Мерджнуто 2026-05-04 (commit `e3529e0a`). Поставлено: `scripts/check-skill-shape.mjs`, `scripts/check-skills-lock.mjs`, `pnpm lint:skills`, `pnpm skills:lock`, реальні SHA-256 для 12 skill-ів, `Playbooks` секції в 8 SKILL.md. | -| 1.2a | merged | `pnpm lint:playbook-language` (UA, warn-only) | [#1672](https://github.com/Skords-01/Sergeant/pull/1672) | Мерджнуто 2026-05-04 (commit `11bebf8`). Лінтер `scripts/check-playbook-language.mjs` (Cyrillic ratio ≥ 0.4 + `lang: en` opt-out) + 24 unit tests; інтеграція в `pnpm lint` і `docs-automation.yml` у `--warn-only`. Базова warn-list: 21 EN playbook + 12 EN SKILL.md — є входом для 1.2b. | -| 1.2b | TBD | Backfill EN-only playbook'ів і SKILL.md | — | Не розпочато. Серії перекладацьких PR-ів проти warn-listу з 1.2a; може йти паралельно з фазою 2. | -| 1.2c | TBD | Перемикання `lint:playbook-language` у gate-ON | — | Не розпочато. Прибрати `--warn-only` після завершення 1.2b. | -| 1.3 | hold | Husky pre-commit `tsc-files` | — | Заблоковано pre-existing typecheck failures на `main` (`apps/server/src/modules/mono/rotateSecret.test.ts:63` TS2345; `apps/web/src/core/hub/HubDashboard.tsx:682` TS2741). Потрібен hotfix-PR з фіксом перед тим, як активувати pre-commit gate. | -| 1.4 | merged | `playbook-schema` extension | [#1670](https://github.com/Skords-01/Sergeant/pull/1670) + fix [#1676](https://github.com/Skords-01/Sergeant/pull/1676) | Мерджнуто 2026-05-04 (commit `a26ae6e`). Schema гейт тепер вимагає `## Owner surface` + `Governing skill:`, `## Verification` ≥1 чекбокс, `**Trigger:**` ≤ 240 chars. Backfill на 22 playbook'и + `_TEMPLATE-decision-tree.md`. PR #1676 — follow-up з фіксом `apps/web/src/core/App.tsx` шляху на `add-new-page-route.md` (governance-sync false-positive). | -| 1.5 | merged | Hard-rules categorization | [#1660](https://github.com/Skords-01/Sergeant/pull/1660) | Мерджнуто 2026-05-04 (commit `549b0dd2`). Додано required-поле `category` (`blocker-invariant` / `lint-enforced-convention` / `active-initiative`) у `hard-rules.json` + schema; новий стовпець + Category legend у `hard-rules-matrix.md`. | -| 2.1 | open | Specialists ↔ skills mapping | [#1687](https://github.com/Skords-01/Sergeant/pull/1687) | Відкрито 2026-05-04. Новий `docs/agents/specialists-mapping.md` (11 SpecialistAgent → governance skill + primary playbook + ADR; 3 `extra` без 1:1 skill); JSDoc `@see` коментарі в `apps/console/src/agents/dispatcher.ts`; primer-и в `personas.ts` посилаються на skills. Status callback rendering — як follow-up (PR 2.1b). | -| 2.2 | merged | `docs/superpowers/` → `docs/agents/` | [#1684](https://github.com/Skords-01/Sergeant/pull/1684) | Мерджнуто 2026-05-04 (commit `3edf244e`). `git mv` перейменував 5 файлів; оновлено ~30 референсів (AGENTS.md, CLAUDE.md, DEVIN.md, README.md, docs/README.md, CONTRIBUTING.md, 12 SKILL.md, scripts, console code, audits, ops, CODEOWNERS). `docs/agents/README.md` перефреймено з “Superpowers” на “Agents” з явною роздільною від product-side AI. | +| Фаза | PR | Опис | Гілка/PR | Статус | +| ---- | ------ | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.1 | merged | `pnpm lint:skills` + skills-lock SHA256 | [#1659](https://github.com/Skords-01/Sergeant/pull/1659) | Мерджнуто 2026-05-04 (commit `e3529e0a`). Поставлено: `scripts/check-skill-shape.mjs`, `scripts/check-skills-lock.mjs`, `pnpm lint:skills`, `pnpm skills:lock`, реальні SHA-256 для 12 skill-ів, `Playbooks` секції в 8 SKILL.md. | +| 1.2a | merged | `pnpm lint:playbook-language` (UA, warn-only) | [#1672](https://github.com/Skords-01/Sergeant/pull/1672) | Мерджнуто 2026-05-04 (commit `11bebf8`). Лінтер `scripts/check-playbook-language.mjs` (Cyrillic ratio ≥ 0.4 + `lang: en` opt-out) + 24 unit tests; інтеграція в `pnpm lint` і `docs-automation.yml` у `--warn-only`. Базова warn-list: 21 EN playbook + 12 EN SKILL.md — є входом для 1.2b. | +| 1.2b | TBD | Backfill EN-only playbook'ів і SKILL.md | — | Не розпочато. Серії перекладацьких PR-ів проти warn-listу з 1.2a; може йти паралельно з фазою 2. | +| 1.2c | TBD | Перемикання `lint:playbook-language` у gate-ON | — | Не розпочато. Прибрати `--warn-only` після завершення 1.2b. | +| 1.3 | hold | Husky pre-commit `tsc-files` | — | Заблоковано pre-existing typecheck failures на `main` (`apps/server/src/modules/mono/rotateSecret.test.ts:63` TS2345; `apps/web/src/core/hub/HubDashboard.tsx:682` TS2741). Потрібен hotfix-PR з фіксом перед тим, як активувати pre-commit gate. | +| 1.4 | merged | `playbook-schema` extension | [#1670](https://github.com/Skords-01/Sergeant/pull/1670) + fix [#1676](https://github.com/Skords-01/Sergeant/pull/1676) | Мерджнуто 2026-05-04 (commit `a26ae6e`). Schema гейт тепер вимагає `## Owner surface` + `Governing skill:`, `## Verification` ≥1 чекбокс, `**Trigger:**` ≤ 240 chars. Backfill на 22 playbook'и + `_TEMPLATE-decision-tree.md`. PR #1676 — follow-up з фіксом `apps/web/src/core/App.tsx` шляху на `add-new-page-route.md` (governance-sync false-positive). | +| 1.5 | merged | Hard-rules categorization | [#1660](https://github.com/Skords-01/Sergeant/pull/1660) | Мерджнуто 2026-05-04 (commit `549b0dd2`). Додано required-поле `category` (`blocker-invariant` / `lint-enforced-convention` / `active-initiative`) у `hard-rules.json` + schema; новий стовпець + Category legend у `hard-rules-matrix.md`. | +| 2.1 | open | Specialists ↔ skills mapping | [#1687](https://github.com/Skords-01/Sergeant/pull/1687) | Відкрито 2026-05-04. Новий `docs/agents/specialists-mapping.md` (11 SpecialistAgent → governance skill + primary playbook + ADR; 3 `extra` без 1:1 skill); JSDoc `@see` коментарі в `apps/console/src/agents/dispatcher.ts`; primer-и в `personas.ts` посилаються на skills. Status callback rendering — як follow-up (PR 2.1b). | +| 2.2 | merged | `docs/superpowers/` → `docs/agents/` | [#1684](https://github.com/Skords-01/Sergeant/pull/1684) | Мерджнуто 2026-05-04 (commit `3edf244e`). `git mv` перейменував 5 файлів; оновлено ~30 референсів (AGENTS.md, CLAUDE.md, DEVIN.md, README.md, docs/README.md, CONTRIBUTING.md, 12 SKILL.md, scripts, console code, audits, ops, CODEOWNERS). `docs/agents/README.md` перефреймено з “Superpowers” на “Agents” з явною роздільною від product-side AI. | | 2.3 | merged | Merge `release-*` playbooks | [#1705](https://github.com/Skords-01/Sergeant/pull/1705) | Мерджнуто 2026-05-04 (commits `e8ca5bda` + `571ee6c1`). Новий `docs/playbooks/release.md` з `flowchart TD` decision tree і трьома секціями (Web + API, Mobile shell (Capacitor), Expo). Старі 3 файли — `Status: Deprecated` + `Superseded by:` лінк (не вилучено для git blame). Оновлено specialists-mapping, service-catalog, release-policy, playbook-catalog, INDEX, 4 SKILL.md, skills-lock. | | 2.4 | open | Merge `access-*` playbooks | [#1707](https://github.com/Skords-01/Sergeant/pull/1707) | Відкрито 2026-05-04. Новий `docs/playbooks/access-governance.md` з `flowchart TD` decision tree і чотирма секціями (Grant, Revoke, Periodic review, Suspected compromise; Q2 рутить revoke → compromise за ознакою компромісу). Старі 4 файли — `Status: Deprecated` + `Superseded by:` лінк. Оновлено access-policy, security-incident-policy, specialists-mapping, playbook-catalog, INDEX, README, better-auth-best-practices SKILL.md, skills-lock. Перебазовано на `main` після мерджу PR 2.3 — конфлікти в `INDEX.md` / `playbook-catalog.md` / `specialists-mapping.md` вирішено вручну (об'єднано `release.md` + `access-governance.md` рядки в одну канонічну таблицю). Окремий CI-розблокувач: [#1719](https://github.com/Skords-01/Sergeant/pull/1719) — скоротити Trigger у `deploy-config-change.md` з 275 → 236 chars. | -| 3.1 | open | Демоутити дизайн-конвенції з Hard Rules | [#1725](https://github.com/Skords-01/Sergeant/pull/1725) | Відкрито 2026-05-04. AGENTS.md розщеплено: § Hard rules (12 правил: 6 blocker-invariant + 5 lint-enforced non-design + 1 active-initiative) і новий § Lint-enforced design conventions (#11–#14, #16, #17). `id` стабільні в обох розділах і `hard-rules.json`. ADR-0045 «Hard Rules taxonomy» фіксує семантику категорій. `scripts/check-hard-rules-registry.mjs` тепер сінкує обидві секції. Acceptance criteria: «≤ 6 blocker-invariants у Hard rules» виконано. | -| 3.2 | TBD | AGENTS.md slim (≤ 150 LOC core) | — | Залежить від 3.1 (taxonomy + per-rule структура). Не розпочато. | -| 3.3 | TBD | Slim `.env.example` + повний reference | — | Не розпочато | +| 3.1 | open | Демоутити дизайн-конвенції з Hard Rules | [#1725](https://github.com/Skords-01/Sergeant/pull/1725) | Відкрито 2026-05-04. AGENTS.md розщеплено: § Hard rules (12 правил: 6 blocker-invariant + 5 lint-enforced non-design + 1 active-initiative) і новий § Lint-enforced design conventions (#11–#14, #16, #17). `id` стабільні в обох розділах і `hard-rules.json`. ADR-0045 «Hard Rules taxonomy» фіксує семантику категорій. `scripts/check-hard-rules-registry.mjs` тепер сінкує обидві секції. Acceptance criteria: «≤ 6 blocker-invariants у Hard rules» виконано. | +| 3.2 | TBD | AGENTS.md slim (≤ 150 LOC core) | — | Залежить від 3.1 (taxonomy + per-rule структура). Не розпочато. | +| 3.3 | TBD | Slim `.env.example` + повний reference | — | Не розпочато | | 4.x | TBD | Operational cleanup | — | Не розпочато | -| 5.1 | TBD | Plop generators (skill, playbook, n8n, …) | — | Не розпочато | -| 5.2 | open | `docs/agents/onboarding.md` | [#1728](https://github.com/Skords-01/Sergeant/pull/1728) | Відкрито 2026-05-04. Новий `docs/agents/onboarding.md` (UA, Status: Active, freshness 2026-05-04 → 2026-08-02) — quickstart за 30 хвилин: секрети (`/run/repo_secrets/Sergeant/.env.secrets`), Postgres + pgvector image (`pnpm db:up`), `AI_QUOTA_DISABLED` semantics, hard-rule навігація, skill routing decision tree, plop generators, verification before PR. Лінки додано в AGENTS.md, CLAUDE.md, DEVIN.md, `docs/agents/README.md`. `docs:check-links` без нових broken links від цього PR. | -| 5.3 | TBD | n8n smoke contract test | — | Не розпочато | +| 5.1 | TBD | Plop generators (skill, playbook, n8n, …) | — | Не розпочато | +| 5.2 | open | `docs/agents/onboarding.md` | [#1728](https://github.com/Skords-01/Sergeant/pull/1728) | Відкрито 2026-05-04. Новий `docs/agents/onboarding.md` (UA, Status: Active, freshness 2026-05-04 → 2026-08-02) — quickstart за 30 хвилин: секрети (`/run/repo_secrets/Sergeant/.env.secrets`), Postgres + pgvector image (`pnpm db:up`), `AI_QUOTA_DISABLED` semantics, hard-rule навігація, skill routing decision tree, plop generators, verification before PR. Лінки додано в AGENTS.md, CLAUDE.md, DEVIN.md, `docs/agents/README.md`. `docs:check-links` без нових broken links від цього PR. | +| 5.3 | TBD | n8n smoke contract test | — | Не розпочато | > **PR 1.3 deferred reason:** запуск `tsc-files`/`tsc -p` на staged TS-файлах поверх `main` падає на pre-existing помилках (`apps/server/src/modules/mono/rotateSecret.test.ts:63` TS2345; `apps/web/src/core/hub/HubDashboard.tsx:682` TS2741). Pre-commit gate не може бути зеленим, доки ці помилки не виправлено. План: винести фікс цих TS errors як hotfix-PR (поза 0009), потім додати PR 1.3. diff --git a/scripts/check-localstorage-allowlist.mjs b/scripts/check-localstorage-allowlist.mjs index 051764e67..6e78c5dd5 100644 --- a/scripts/check-localstorage-allowlist.mjs +++ b/scripts/check-localstorage-allowlist.mjs @@ -154,7 +154,10 @@ export function countProductionEntries(blockText) { */ export function parseBudgetFile(text) { const json = JSON.parse(text); - if (typeof json.production !== "number" || !Number.isFinite(json.production)) { + if ( + typeof json.production !== "number" || + !Number.isFinite(json.production) + ) { throw new Error("budget.production must be a finite number"); } if (json.production < 0) { @@ -215,7 +218,7 @@ export function run({ envBudget } = {}) { budget: null, reason: `Budget file missing: ${BUDGET_PATH}. ` + - "Create it with `{ \"production\": , \"rationale\": \"...\" }`.", + 'Create it with `{ "production": , "rationale": "…" }`.', }; } try {