Files
brain/tools/vocab-rollout-knowledge.test.mjs
T
Дмитрий ef92b5e39e feat(registry): токенизация needs/produces — группа knowledge-work (этап 2b, роутер-реестр)
Phase 2b группа A: 43 контракта (product-management/design/marketing/
operations/finance/brand-voice) переведены с прозы на токены словаря.
Словарь +67, всего 106 токенов, v0.4.0.

Достроены мостовые цепочки графа:
- user-research -> research-synthesis / synthesize-research (raw-research)
- content-creation -> draft-content -> brand-review (content-framework/marketing-draft)
- journal-entry-prep -> close-management (close-entries)
- write-spec -> (feature-spec, кормит writing-plans)
- design-handoff <- ui-design (от frontend-design, цепочка в группе tools)

Тест: новый замок-тест группы (43 контракта проходят словарь + рёбра).
Регрессия 4369 passed, exit 0.

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

39 lines
2.3 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 PREFIXES = ['product-management__', 'design-plugin__', 'marketing-plugin__', 'operations__', 'finance-plugin__', 'brand-voice__'];
const FILES = readdirSync(cdir).filter((f) =>
f.endsWith('.contract.json') && (PREFIXES.some((p) => f.startsWith(p)) || f === 'operations-process-doc.contract.json'));
const entries = FILES.map((f) => ({ contract: JSON.parse(readFileSync(join(cdir, f), 'utf8')), currentContent: '' }));
describe('Phase 2b группа knowledge-work — замок словаря + мостовые рёбра', () => {
const { tokens } = loadVocabulary({ path: vocabPath });
it('все knowledge-work контракты проходят замок словаря', () => {
expect(FILES.length).toBe(43);
const { contracts, errors } = buildRegistry(entries, { vocabTokens: tokens });
expect(errors).toEqual([]);
expect(contracts.length).toBe(43);
});
it('мостовые рёбра рабочих цепочек сформированы', () => {
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('marketing-plugin:content-creation', 'marketing-plugin:draft-content')).toBe(true); // content-framework
expect(has('marketing-plugin:draft-content', 'marketing-plugin:brand-review')).toBe(true); // marketing-draft
expect(has('finance-plugin:journal-entry-prep', 'finance-plugin:close-management')).toBe(true); // close-entries
expect(has('design-plugin:user-research', 'design-plugin:research-synthesis')).toBe(true); // raw-research
expect(has('design-plugin:user-research', 'product-management:synthesize-research')).toBe(true); // raw-research
});
});