// engine/hooks/handlers/on-create.ts — on-create hook handler (SPEC-129)
// Checks if new file falls in any active spec's file plan, suggests annotations.
import { matchesGlobPattern } from '../file-watcher.js';
// ---------------------------------------------------------------------------
// Handler
// ---------------------------------------------------------------------------
/**
 * Handle on-create event for a new file.
 * - Checks if file falls in any active spec's file plan
 * - Suggests @spec annotations if the file matches a spec but has no annotation
 */
export function handleOnCreate(relPath, ctx) {
    const normalizedPath = relPath.replace(/\\/g, '/');
    const matchedSpecs = [];
    const suggestedAnnotations = [];
    for (const plan of ctx.specFilePlans) {
        const matches = plan.plannedFiles.some((pattern) => matchesGlobPattern(normalizedPath, pattern));
        if (matches) {
            matchedSpecs.push(plan.specId);
            suggestedAnnotations.push(`// @spec ${plan.specId}`);
        }
    }
    return {
        hook: 'on-create',
        path: normalizedPath,
        matchedSpecs,
        suggestedAnnotations,
    };
}
//# sourceMappingURL=on-create.js.map