/**
 * Skills Module
 *
 * Unified skill system that bridges two underlying implementations:
 * 1. Legacy JSON-based skills (skill-manager, skill-loader)
 * 2. OpenClaw-inspired SKILL.md natural language skills (registry, executor)
 *
 * The UnifiedSkill type and adapters provide a single interface over both.
 * The SKILL.md system uses YAML frontmatter + Markdown for natural language
 * skill definitions with three-tier loading (workspace > managed > bundled).
 */
// Legacy skill system (deprecated - use SKILL.md system instead)
/** @deprecated Use SKILL.md system (SkillRegistry) instead */
export * from "./skill-manager.js";
/** @deprecated Use SKILL.md system (SkillRegistry) instead */
export * from "./skill-loader.js";
export * from "./eligibility.js";
export { parseSkillFile, validateSkill, serializeSkill } from './parser.js';
export { SkillRegistry, getSkillRegistry, resetSkillRegistry } from './registry.js';
export { SkillExecutor, getSkillExecutor, resetSkillExecutor } from './executor.js';
export { legacyToUnified, legacyLoadedToUnified, unifiedToLegacy, skillMdToUnified, unifiedToSkillMd, } from './adapters/index.js';
// ============================================================================
// Bundled Skills Path
// ============================================================================
import * as path from 'path';
/**
 * Get the path to bundled SKILL.md skills
 */
export function getBundledSkillsPath() {
    return path.join(__dirname, 'bundled');
}
// ============================================================================
// Convenience Functions for SKILL.md System
// ============================================================================
import { getSkillRegistry } from './registry.js';
import { getSkillExecutor } from './executor.js';
import { getSkillManager } from './skill-manager.js';
/**
 * Initialize both skill systems (legacy and SKILL.md) and unify them.
 *
 * This loads the SKILL.md registry from bundled/workspace/managed paths,
 * initializes the legacy SkillManager, and registers legacy skills into
 * the SKILL.md registry so they can be queried through a single interface.
 *
 * @param projectRoot - The project root for the legacy SkillManager (defaults to cwd)
 */
export async function initializeAllSkills(projectRoot) {
    // Initialize the SKILL.md registry
    const registry = getSkillRegistry({
        bundledPath: getBundledSkillsPath(),
    });
    await registry.load();
    // Initialize the legacy skill manager
    const manager = getSkillManager(projectRoot);
    await manager.initialize();
    // Register legacy skills into the SKILL.md registry so they are searchable
    // via the unified interface. Only register those not already present.
    for (const skillName of manager.getAvailableSkills()) {
        if (!registry.get(skillName)) {
            const legacySkill = manager.getSkill(skillName);
            if (legacySkill) {
                registry.registerLegacySkill(legacySkill, 'workspace');
            }
        }
    }
    // Return unified view
    const unified = registry.getAllUnified();
    return { registry, manager, unified };
}
/**
 * Initialize the SKILL.md skills system only (backward-compatible).
 */
export async function initializeSkills() {
    const registry = getSkillRegistry({
        bundledPath: getBundledSkillsPath(),
    });
    await registry.load();
}
/**
 * Find the best SKILL.md skill for a request
 */
export function findSkill(request) {
    const registry = getSkillRegistry();
    return registry.findBestMatch(request);
}
/**
 * Execute a SKILL.md skill by name
 */
export async function executeSkill(skillName, context) {
    const registry = getSkillRegistry();
    const skill = registry.get(skillName);
    if (!skill) {
        return {
            success: false,
            error: `Skill not found: ${skillName}`,
            duration: 0,
        };
    }
    const executor = getSkillExecutor();
    return executor.execute(skill, context);
}
/**
 * List all available SKILL.md skills
 */
export function listSkillMdSkills() {
    const registry = getSkillRegistry();
    return registry.list();
}
/**
 * Search for SKILL.md skills
 */
export function searchSkillMd(query, limit) {
    const registry = getSkillRegistry();
    return registry.search({ query, limit });
}
/**
 * Get all skills from both systems as UnifiedSkill objects.
 * This is a convenience function that combines skills from
 * both the SKILL.md registry and the legacy SkillManager.
 *
 * @returns An array of UnifiedSkill objects
 */
export function getAllUnifiedSkills() {
    const registry = getSkillRegistry();
    return registry.getAllUnified();
}
//# sourceMappingURL=index.js.map