#!/usr/bin/env node
/**
* Forgen — Skill Injector Hook
*
* Claude Code UserPromptSubmit 훅으로 등록.
* 프롬프트와 매칭되는 학습된 스킬을 자동으로 컨텍스트에 주입합니다.
*
* 스킬 파일 위치 (우선순위):
* 0. {project}/.forgen/skills/*.md (프로젝트 포지 스킬 — 최우선)
* 1. {project}/.compound/skills/*.md (프로젝트 스킬)
* 2. ~/.forgen/me/skills/*.md (개인 학습 스킬)
* 3. ~/.forgen/skills/*.md (글로벌 스킬)
*
* 스킬 포맷:
* ---
* name: my-skill
* description: What this skill does
* triggers:
* - "keyword1"
* - "keyword2"
* ---
* ...
* ...
*/
export interface SkillMeta {
name: string;
description: string;
triggers: string[];
filePath: string;
content: string;
}
/** YAML frontmatter 파싱 (간단한 구현) */
export declare function parseFrontmatter(content: string): {
meta: Record;
body: string;
};
/** 프롬프트와 스킬 트리거 매칭 (sanitized 텍스트에서만)
* keyword-detector가 이미 처리하는 스킬은 제외하여 이중 주입을 방지합니다. */
export declare function matchSkills(prompt: string, skills: SkillMeta[]): SkillMeta[];