// engine/registry/glama-publisher.ts — SPEC-273: Glama MCP directory publisher
// Generates .glama.json for glama.ai/mcp community directory.
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
/**
 * Generates a Glama directory entry from the given options.
 * featured and verified default to false — these are set by Glama's team, not by the publisher.
 *
 * @param options  Configuration for the Glama entry.
 * @returns A fully populated GlamaEntry.
 */
export function generateGlamaEntry(options) {
    return {
        name: options.name,
        description: options.description,
        repository: options.repository,
        tags: options.tags,
        author: options.author,
        featured: false,
        verified: false,
    };
}
/**
 * Writes .glama.json to the given project directory.
 *
 * @param projectPath  Absolute path to the project root.
 * @param options      Glama directory options.
 */
export function writeGlamaEntry(projectPath, options) {
    const filePath = join(projectPath, '.glama.json');
    const entry = generateGlamaEntry(options);
    const content = JSON.stringify(entry, null, 2) + '\n';
    /* v8 ignore start */
    try {
        writeFileSync(filePath, content, 'utf-8');
    }
    catch (err) {
        const msg = err instanceof Error ? err.message : String(err);
        throw new Error(`Failed to write .glama.json to ${filePath}: ${msg}`, { cause: err });
    }
    /* v8 ignore stop */
}
//# sourceMappingURL=glama-publisher.js.map