"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = register;
const zod_1 = require("zod");
const defaults_1 = require("../../../lib/defaults");
function register(server, mgr) {
    server.registerTool('skills_create', {
        description: 'Create a new skill (reusable recipe/procedure) in the skill graph. ' +
            'The skill is automatically embedded for semantic search. ' +
            'Returns the generated skillId (slug from title). ' +
            'Use link_skill to connect skills, or create_skill_link to link to docs/code/files/knowledge/tasks.',
        inputSchema: {
            title: zod_1.z.string().min(1).max(defaults_1.MAX_TITLE_LEN).describe('Short title for the skill, e.g. "Deploy to staging"'),
            description: zod_1.z.string().max(defaults_1.MAX_DESCRIPTION_LEN).describe('Full description of the skill (markdown)'),
            steps: zod_1.z.array(zod_1.z.string().max(defaults_1.MAX_SKILL_STEP_LEN)).max(defaults_1.MAX_SKILL_STEPS_COUNT).optional().describe('Ordered steps to execute this skill (default [])'),
            triggers: zod_1.z.array(zod_1.z.string().max(defaults_1.MAX_SKILL_TRIGGER_LEN)).max(defaults_1.MAX_SKILL_TRIGGERS_COUNT).optional().describe('Conditions or cues that suggest using this skill (default [])'),
            inputHints: zod_1.z.array(zod_1.z.string().max(500)).max(100).optional().describe('Expected inputs or prerequisites (default [])'),
            filePatterns: zod_1.z.array(zod_1.z.string().max(500)).max(100).optional().describe('Glob patterns for files this skill applies to (default [])'),
            tags: zod_1.z.array(zod_1.z.string().max(defaults_1.MAX_TAG_LEN)).max(defaults_1.MAX_TAGS_COUNT).optional().describe('Optional tags for filtering, e.g. ["deploy", "ci"]'),
            source: zod_1.z.enum(['user', 'learned']).optional().describe('Source: "user" (default) or "learned" (AI-discovered)'),
            confidence: zod_1.z.number().min(0).max(1).optional().describe('Confidence score 0–1 (default 1)'),
        },
    }, async ({ title, description, steps, triggers, inputHints, filePatterns, tags, source, confidence }) => {
        const skillId = await mgr.createSkill(title, description, steps ?? [], triggers ?? [], inputHints ?? [], filePatterns ?? [], tags ?? [], source ?? 'user', confidence ?? 1);
        return { content: [{ type: 'text', text: JSON.stringify({ skillId }, null, 2) }] };
    });
}
