// storage/skill-bootstrap-store.ts — SPEC-439: Persistence for skill bootstrap config and results
import { join } from 'node:path';
import { readJson, writeJson, hashProjectPath, projectDataDir } from './base-store.js';
const CONFIG_FILE = 'skill-bootstrap/config.json';
const LAST_RESULT_FILE = 'skill-bootstrap/last-result.json';
function defaultConfig() {
    return {
        sources: [
            { type: 'awesome-cursorrules', name: 'awesome-cursorrules', enabled: true },
            { type: 'skills-sh', name: 'skills.sh', enabled: true },
        ],
        targets: ['cursorrules', 'claude-md', 'agents-md'],
        autoMerge: true,
        configuredAt: new Date().toISOString(),
    };
}
function resolveConfigPath(projectPath) {
    const projectId = hashProjectPath(projectPath);
    return join(projectDataDir(projectId), CONFIG_FILE);
}
function resolveResultPath(projectPath) {
    const projectId = hashProjectPath(projectPath);
    return join(projectDataDir(projectId), LAST_RESULT_FILE);
}
export async function getSkillBootstrapConfig(projectPath) {
    const filePath = resolveConfigPath(projectPath);
    return readJson(filePath, defaultConfig());
}
export async function saveSkillBootstrapConfig(projectPath, config) {
    const filePath = resolveConfigPath(projectPath);
    await writeJson(filePath, config);
}
export async function saveLastSkillBootstrapResult(projectPath, result) {
    const filePath = resolveResultPath(projectPath);
    await writeJson(filePath, result);
}
//# sourceMappingURL=skill-bootstrap-store.js.map