feat: подключение лаборатории к BHS 0.1.0 (BHL-041)
- bhl.yaml: манифест потребителя (spec 0.1.0, профиль prof-core, без предварительных исключений) - spec/profiles/prof-core.yaml: 15 требований без ослаблений; профили и пресеты валидируются bhl validate как факультативные каталоги - конвейер release→sha256→fetch(lock)→verify→manifest→resolve закреплён интеграционным тестом; артефакты .artifacts/ вне Git - инвентарь исключений и классификация отклонений (5.2) — results/dogfooding/2026-11-29-lab-connection.md - check.mjs не сканирует .artifacts (локальное состояние сборки)
This commit is contained in:
@@ -34,12 +34,16 @@ interface Changelog {
|
||||
entries: Doc[];
|
||||
}
|
||||
|
||||
const ENTITY_DIRS: readonly { dir: string; schema: string }[] = [
|
||||
const ENTITY_DIRS: readonly { dir: string; schema: string; optional?: boolean }[] = [
|
||||
{ dir: 'domains', schema: 'domain' },
|
||||
{ dir: 'capabilities', schema: 'capability' },
|
||||
{ dir: 'requirements', schema: 'requirement' },
|
||||
{ dir: 'parameters', schema: 'parameter' },
|
||||
{ dir: 'antipatterns', schema: 'antipattern' },
|
||||
// Профили и пресеты — нормативный контент, но не обязательны для валидации
|
||||
// ядра спецификации: корень без них остаётся валидным (BHL-041).
|
||||
{ dir: 'profiles', schema: 'profile', optional: true },
|
||||
{ dir: 'presets', schema: 'preset', optional: true },
|
||||
];
|
||||
|
||||
const SCHEMA_BASE = 'https://baseline-harness.dev/spec/schemas/';
|
||||
@@ -210,22 +214,30 @@ class Validator {
|
||||
private loadEntityDocs(): Doc[] {
|
||||
const docs: Doc[] = [];
|
||||
for (const spec of ENTITY_DIRS) {
|
||||
const dir = path.join(this.root, spec.dir);
|
||||
if (!existsSync(dir)) {
|
||||
docs.push(...this.loadEntityDir(spec));
|
||||
}
|
||||
return docs;
|
||||
}
|
||||
|
||||
private loadEntityDir(spec: { dir: string; schema: string; optional?: boolean }): Doc[] {
|
||||
const dir = path.join(this.root, spec.dir);
|
||||
if (!existsSync(dir)) {
|
||||
if (spec.optional !== true) {
|
||||
this.push(`${spec.dir}/`, 'missing-directory', `directory ${spec.dir}/ is required`);
|
||||
continue;
|
||||
}
|
||||
for (const file of yamlFiles(dir)) {
|
||||
this.files += 1;
|
||||
const value = readYamlDoc(file, this.diagnostics);
|
||||
if (isRecord(value)) {
|
||||
const doc: Doc = { kind: spec.schema, file, value };
|
||||
this.schemaValidate(doc);
|
||||
this.collectInlineParameters(doc, spec.schema);
|
||||
docs.push(doc);
|
||||
} else if (value !== undefined) {
|
||||
this.push(file, 'parse-error', 'top level must be a mapping');
|
||||
}
|
||||
return [];
|
||||
}
|
||||
const docs: Doc[] = [];
|
||||
for (const file of yamlFiles(dir)) {
|
||||
this.files += 1;
|
||||
const value = readYamlDoc(file, this.diagnostics);
|
||||
if (isRecord(value)) {
|
||||
const doc: Doc = { kind: spec.schema, file, value };
|
||||
this.schemaValidate(doc);
|
||||
this.collectInlineParameters(doc, spec.schema);
|
||||
docs.push(doc);
|
||||
} else if (value !== undefined) {
|
||||
this.push(file, 'parse-error', 'top level must be a mapping');
|
||||
}
|
||||
}
|
||||
return docs;
|
||||
|
||||
Reference in New Issue
Block a user