Files
brain/tools/vocab-rollout-superpowers.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

36 lines
2.1 KiB
JavaScript

import { describe, it, expect } from 'vitest';
import { readFileSync, readdirSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import { buildRegistry } from './skill-contract-registry.mjs';
import { loadVocabulary } from './capability-vocabulary.mjs';
import { buildDependencyGraph } from './coverage-machine.mjs';
const here = dirname(fileURLToPath(import.meta.url));
const cdir = join(here, '..', 'docs', 'registry', 'contracts');
const vocabPath = join(here, '..', 'docs', 'registry', 'capability-vocabulary.json');
const SP = readdirSync(cdir).filter((f) => f.startsWith('superpowers__') && f.endsWith('.contract.json'));
const entries = SP.map((f) => ({ contract: JSON.parse(readFileSync(join(cdir, f), 'utf8')), currentContent: '' }));
describe('Phase 2b батч superpowers — замок словаря + рёбра графа', () => {
const { tokens } = loadVocabulary({ path: vocabPath });
it('все 14 superpowers-контрактов проходят замок словаря (нет неизвестных токенов)', () => {
expect(SP.length).toBe(14);
const { contracts, errors } = buildRegistry(entries, { vocabTokens: tokens });
expect(errors).toEqual([]);
expect(contracts.length).toBe(14);
});
it('рёбра рабочей цепочки сформированы (brainstorming→writing-plans→executing-plans)', () => {
const { contracts } = buildRegistry(entries, { vocabTokens: tokens });
const { edges } = buildDependencyGraph(contracts);
const has = (from, to) => edges.some((e) => e.from === from && e.to === to);
expect(has('superpowers:brainstorming', 'superpowers:writing-plans')).toBe(true); // via feature-spec
expect(has('superpowers:writing-plans', 'superpowers:executing-plans')).toBe(true); // via implementation-plan
expect(has('superpowers:test-driven-development', 'superpowers:requesting-code-review')).toBe(true); // via completed-change
expect(has('superpowers:requesting-code-review', 'superpowers:receiving-code-review')).toBe(true); // via code-review-feedback
});
});