const path = require('path');
const fs = require('fs');
module.paths.unshift(path.join(require('os').homedir(), '.claude/skills/pptx-skill/scripts/node_modules'));

const PptxGenJS = require('pptxgenjs');
const html2pptx = require(path.join(require('os').homedir(), '.claude/skills/pptx-skill/scripts/html2pptx.js'));

async function main() {
    const pres = new PptxGenJS();
    pres.defineLayout({ name: 'CUSTOM_16x9', width: 10, height: 5.625 });
    pres.layout = 'CUSTOM_16x9';

    const dir = __dirname;
    const slides = fs.readdirSync(dir)
        .filter(f => f.startsWith('slide-') && f.endsWith('.html'))
        .sort();

    for (const file of slides) {
        await html2pptx(path.join(dir, file), pres);
    }

    const output = path.join(dir, '..', '..', 'customer-pricing.pptx');
    await pres.writeFile({ fileName: output });
    console.log('PPTX created:', output);
}

main().catch(console.error);
