Skip to content

meta.agent.js --dry-run writes real changes to diskΒ #1083

Description

@ashleyshaw

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

  1. On a clean checkout, run:
    META_SKIP_README=true node scripts/agents/meta.agent.js --dry-run
    
  2. 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.

Metadata

Metadata

Assignees

Type

Fields

Priority

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions