Files
brain/tools/m3c-coverage-invariants.test.mjs
T
Дмитрий acd9bdc479 feat(registry): токенизация needs/produces — батч superpowers (этап 2b, роутер-реестр)
Phase 2b батч 1: 14 superpowers-контрактов переведены с прозы на токены словаря.
Словарь +13 (атомарные выходы + данности), всего 39 токенов, v0.3.0.

Граф ожил для рабочих цепочек (рёбра producer->consumer):
- brainstorming -> writing-plans -> executing-plans / subagent-driven
- test-driven-development -> requesting-code-review -> receiving-code-review
- finishing-a-development-branch (needs completed-change)

Тесты: новый замок-тест батча (14 контрактов проходят словарь + рёбра графа);
m3c-coverage-invariants просьба обновлена на токен; capability-vocabulary
счётчик -> >= (словарь живой). Регрессия 4369 passed, exit 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:03:22 +03:00

29 lines
1.8 KiB
JavaScript

import { describe, it, expect } from 'vitest';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import { buildRegistry } from './skill-contract-registry.mjs';
import { readinessChecklist, findHoles } from './coverage-machine.mjs';
const here = dirname(fileURLToPath(import.meta.url));
const cdir = join(here, '..', 'docs', 'registry', 'contracts');
describe('Машина 3-C — охват на реальных контрактах 3-A', () => {
it('контракты 3-A загружаются и прогоняются через машину охвата', () => {
// writing-plans мигрирован в superpowers__writing-plans (external) при разворачивании superpowers
const wp = JSON.parse(readFileSync(join(cdir, 'superpowers__writing-plans.contract.json'), 'utf8'));
const pd = JSON.parse(readFileSync(join(cdir, 'operations-process-doc.contract.json'), 'utf8'));
const { contracts } = buildRegistry([{ contract: wp, currentContent: '' }, { contract: pd, currentContent: '' }]);
// этап 2b: writing-plans токенизирован → produces ['implementation-plan']; просьба = токен словаря
const r = readinessChecklist({ contracts, requests: ['implementation-plan'] });
expect(Array.isArray(r.items)).toBe(true);
expect(r.items).toHaveLength(4);
expect(r.items.find((i) => /просьб/i.test(i.label)).ok).toBe(true);
});
it('findHoles на контракте с непокрытой нуждой ловит дыру', () => {
const wp = JSON.parse(readFileSync(join(cdir, 'superpowers__writing-plans.contract.json'), 'utf8'));
const holes = findHoles([wp]);
expect(holes.length).toBeGreaterThan(0);
});
});