File: //proc/self/root/tmp/fix-growth-backlog-parser.cjs
const fs = require('fs');
const file = 'scripts/growth-backlog.mjs';
let s = fs.readFileSync(file, 'utf8');
const oldLine = " if (line.startsWith('## ') && !line.includes(heading)) break;";
const newLine = " if (/^#{2,3} /.test(line) && !line.includes(heading)) break;";
if (!s.includes(newLine)) {
if (!s.includes(oldLine)) throw new Error('parser line not found');
s = s.replace(oldLine, newLine);
}
s = s.replace("if (mtmCampaigns.size === 0 && (markerExists('growth-distribution-plan.mjs') || markerExists('local-distribution-plan.mjs') || markerExists('mtm_campaign'))) {", "if (mtmCampaigns.size === 0) {");
fs.writeFileSync(file, s, 'utf8');