Describe the bug
Running node scripts/agents/meta.agent.js --dry-run still writes real changes to disk. It appended a _Built by π§± LightSpeedWP with β, π, and open-source spirit!_ footer to CLAUDE.md and thousands of other markdown files, even though the summary output printed Mode: DRY RUN and Changed: 0.
To Reproduce
- On a clean checkout, run:
META_SKIP_README=true node scripts/agents/meta.agent.js --dry-run
- Check
git status afterwards.
Expected behavior
--dry-run should make zero writes to the working tree. git status should show no changes.
Root cause
processMarkdownFile (scripts/agents/meta.agent.js) correctly gates its own fs.writeFileSync behind if (!dryRun), but it delegates to helper functions that write to disk as a side effect of computing their return value, and dryRun was never threaded into them:
ensureFooter (scripts/agents/includes/header-footer.js), called via applyFooter, wrote the footer unconditionally.
updateReadmeBadges / updateBadgesInReadme (scripts/agents/includes/badges.js), called via applyBadges, had the identical unconditional-write pattern.
- The metrics write in
main() (.github/metrics/meta-metrics.json) was also unconditional.
Because the delegated writes happened before processMarkdownFile's own dry-run gate, the printed Changed: 0 summary was misleading β it only reflected processMarkdownFile's own gated write, not what the delegated helpers had already done to the file on disk.
Additional context
Use branch prefix fix/ for the related PR.
Describe the bug
Running
node scripts/agents/meta.agent.js --dry-runstill writes real changes to disk. It appended a_Built by π§± LightSpeedWP with β, π, and open-source spirit!_footer toCLAUDE.mdand thousands of other markdown files, even though the summary output printedMode: DRY RUNandChanged: 0.To Reproduce
git statusafterwards.Expected behavior
--dry-runshould make zero writes to the working tree.git statusshould show no changes.Root cause
processMarkdownFile(scripts/agents/meta.agent.js) correctly gates its ownfs.writeFileSyncbehindif (!dryRun), but it delegates to helper functions that write to disk as a side effect of computing their return value, anddryRunwas never threaded into them:ensureFooter(scripts/agents/includes/header-footer.js), called viaapplyFooter, wrote the footer unconditionally.updateReadmeBadges/updateBadgesInReadme(scripts/agents/includes/badges.js), called viaapplyBadges, had the identical unconditional-write pattern.main()(.github/metrics/meta-metrics.json) was also unconditional.Because the delegated writes happened before
processMarkdownFile's own dry-run gate, the printedChanged: 0summary was misleading β it only reflectedprocessMarkdownFile's own gated write, not what the delegated helpers had already done to the file on disk.Additional context
Use branch prefix
fix/for the related PR.