// engine/hooks/templates.ts — Predefined hook templates for common workflows (SPEC-071)
// ---------------------------------------------------------------------------
// Built-in templates
// ---------------------------------------------------------------------------
/**
 * sdd-full: Full SDD workflow automation.
 * Validates spec on creation, logs when done.
 */
const SDD_FULL_TEMPLATE = {
    name: 'sdd-full',
    description: 'Full SDD workflow: validate on creation, audit on done',
    hooks: [
        {
            name: 'Auto-validate on spec creation',
            description: 'Runs validate tool whenever a new spec is created',
            trigger: 'on_spec_created',
            actions: [
                {
                    type: 'run_tool',
                    tool: 'validate',
                    args: {},
                },
            ],
            enabled: true,
        },
        {
            name: 'Log spec completion',
            description: 'Logs a message when a spec reaches done status',
            trigger: 'on_spec_status_change',
            filter: { toStatus: 'done' },
            actions: [
                {
                    type: 'log_message',
                    message: 'Spec {{specId}} is now done in project {{projectId}}',
                },
            ],
            enabled: true,
        },
    ],
};
/**
 * ci-ready: CI/CD integration hooks.
 * Runs checks on drift detection and commit events.
 */
const CI_READY_TEMPLATE = {
    name: 'ci-ready',
    description: 'CI/CD integration: alert on drift, notify on commit',
    hooks: [
        {
            name: 'Alert on drift',
            description: 'Logs alert when drift is detected above threshold',
            trigger: 'on_drift_detected',
            actions: [
                {
                    type: 'log_message',
                    message: 'DRIFT ALERT: spec {{specId}} drift score {{driftScore}} in project {{projectId}}',
                },
            ],
            enabled: true,
        },
        {
            name: 'Log commit events',
            description: 'Records commit information for traceability',
            trigger: 'on_commit',
            actions: [
                {
                    type: 'log_message',
                    message: 'Commit {{commitHash}} on branch {{branch}}: {{commitMessage}}',
                },
            ],
            enabled: true,
        },
    ],
};
/**
 * quality-gate: Enforces quality gates at critical transitions.
 */
const QUALITY_GATE_TEMPLATE = {
    name: 'quality-gate',
    description: 'Quality gates: audit before implementing, validate on review',
    hooks: [
        {
            name: 'Audit before implementing',
            description: 'Runs audit tool when spec moves to implementing',
            trigger: 'on_spec_status_change',
            filter: { toStatus: 'implementing' },
            actions: [
                {
                    type: 'run_tool',
                    tool: 'audit',
                    args: {},
                },
            ],
            enabled: true,
        },
        {
            name: 'Validate on review',
            description: 'Runs validate tool when spec moves to review',
            trigger: 'on_spec_status_change',
            filter: { toStatus: 'review' },
            actions: [
                {
                    type: 'run_tool',
                    tool: 'validate',
                    args: {},
                },
            ],
            enabled: true,
        },
    ],
};
// ---------------------------------------------------------------------------
// Template registry
// ---------------------------------------------------------------------------
const TEMPLATES = {
    'sdd-full': SDD_FULL_TEMPLATE,
    'ci-ready': CI_READY_TEMPLATE,
    'quality-gate': QUALITY_GATE_TEMPLATE,
};
/**
 * Return all available template names.
 */
export function listTemplateNames() {
    return Object.keys(TEMPLATES);
}
/**
 * Return a template by name, or undefined if not found.
 */
export function getTemplate(name) {
    return TEMPLATES[name];
}
/**
 * Return all templates.
 */
export function getAllTemplates() {
    return Object.values(TEMPLATES);
}
//# sourceMappingURL=templates.js.map