"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = require("assert");
const child_process_1 = require("child_process");
const runJson = (args) => {
    const r = (0, child_process_1.spawnSync)('node', ['bin/openlife.js', ...args], { cwd: process.cwd(), encoding: 'utf-8' });
    assert_1.strict.equal(r.status, 0, `${args.join(' ')} failed: ${r.stderr || r.stdout}`);
    return JSON.parse(r.stdout);
};
const catalog = runJson(['catalog', 'doctor', '--strict']);
assert_1.strict.equal(catalog.ok, true);
assert_1.strict.ok(catalog.summary.skills.total >= 50, `expected >=50 imported skills, got ${catalog.summary.skills.total}`);
const skills = runJson(['skills', 'list']);
assert_1.strict.ok(skills.total >= 50, `expected runtime skills >=50, got ${skills.total}`);
assert_1.strict.ok(String(skills.source || skills.sources || '').includes('.catalog/skills'));
assert_1.strict.ok(skills.items.some((s) => s.id === 'github'));
assert_1.strict.ok(skills.items.some((s) => s.id === 'gemini'));
const route = runJson(['route', 'intent', 'criar landing page com design, copy e deploy no github']);
assert_1.strict.equal(route.ok, true);
assert_1.strict.equal(route.type, 'openlife.route.intent');
assert_1.strict.ok(route.intent);
assert_1.strict.ok(Array.isArray(route.squads) && route.squads.length > 0, 'expected squad recommendations');
assert_1.strict.ok(Array.isArray(route.agents) && route.agents.length > 0, 'expected agent recommendations');
assert_1.strict.ok(Array.isArray(route.skills) && route.skills.length > 0, 'expected skill recommendations');
assert_1.strict.ok(route.squads[0].score >= route.squads[route.squads.length - 1].score);
assert_1.strict.ok(route.skills.some((s) => ['github', 'gemini', 'canvas', 'coding-agent'].includes(s.id)));
console.log('TEST_OPENLIFE_ROUTING_SURFACE_OK');
