// engine/ai-integration/github-copilot/prompt-files-generator.ts — .github/prompts/*.prompt.md generator (SPEC-272)
import { mkdirSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
function buildCreateSpecPrompt(projectName, activeSpecId) {
    const activeNote = activeSpecId !== undefined
        ? `\nNote: There is currently an active spec (${activeSpecId}). Consider implementing it before creating a new one.\n`
        : '';
    const content = `---
mode: agent
description: Trigger the Planu create_spec workflow to define a new feature spec
---
Use the \`mcp__planu__create_spec\` tool for the **${projectName}** project.

Pass the user's description as the \`description\` parameter.${activeNote}
Always wait for user approval before implementing. The spec is a contract — implementation starts only after approval.

After creation, suggest running \`mcp__planu__challenge_spec\` to stress-test the spec.
`;
    return {
        name: 'create-spec',
        filePath: '.github/prompts/create-spec.prompt.md',
        content,
        mode: 'agent',
        description: 'Trigger create_spec workflow in Planu',
    };
}
function buildValidateSpecPrompt() {
    const content = `---
mode: agent
description: Trigger the Planu validate workflow to check implementation against spec criteria
---
Use the \`mcp__planu__validate\` tool with the current project path.

Report any compliance gaps found. For each gap:
1. Show which acceptance criterion is not met
2. Suggest what needs to be changed

If all criteria pass, suggest running \`mcp__planu__update_status\` to mark the spec as done.
`;
    return {
        name: 'validate-spec',
        filePath: '.github/prompts/validate-spec.prompt.md',
        content,
        mode: 'agent',
        description: 'Trigger validate workflow to check spec compliance',
    };
}
function buildSpecStatusPrompt() {
    const content = `---
mode: ask
description: Show current Planu project status including active spec, git state, and pending queue
---
Use the \`mcp__planu__planu_status\` tool with the current project path.

Present the results in a concise summary:
- **Active spec**: ID and title of the spec currently being implemented
- **Git state**: current branch and whether it matches the active spec
- **Pending queue**: approved specs waiting to be implemented

If there is no active spec, suggest the next approved spec in the queue.
`;
    return {
        name: 'spec-status',
        filePath: '.github/prompts/spec-status.prompt.md',
        content,
        mode: 'ask',
        description: 'Show Planu project status with active spec and queue',
    };
}
export function generatePromptFiles(options) {
    return [
        buildCreateSpecPrompt(options.projectName, options.activeSpecId),
        buildValidateSpecPrompt(),
        buildSpecStatusPrompt(),
    ];
}
export function writePromptFiles(projectPath, options) {
    const promptsDir = join(projectPath, '.github', 'prompts');
    mkdirSync(promptsDir, { recursive: true });
    const files = generatePromptFiles(options);
    for (const file of files) {
        const filePath = join(promptsDir, `${file.name}.prompt.md`);
        writeFileSync(filePath, file.content, 'utf8');
    }
}
//# sourceMappingURL=prompt-files-generator.js.map