apply

audit decides what needs fixing. apply does the fixing. The bridge is a structured markdown file produced by the audit's interactive HTML report.

When to use it

  • Right after running groundwork audit --html, making decisions in the browser, and downloading the remediation plan.
  • When a teammate hands you a remediation plan and asks you to enact it.

When not to

  • On a hand-written .md that lacks the groundwork-remediation: v1 frontmatter marker. The command refuses by design.
  • When the underlying repo state has changed since the audit ran. Re-audit first; the plan references the state captured at audit time.

What it produces

  • Edits to one or more files (usually AGENTS.md, sometimes package.json or a SKILL.md), each tied to a finding the user already decided on.
  • A short chat summary: what changed, what was skipped, what is deferred.
  • The remediation file stays in place. Suggest committing it alongside the changes.

How it works

  1. Read and validate. YAML frontmatter parses, groundwork-remediation: v1 marker is present. Files without the marker are refused.
  2. Build the action list, dry-run. Group actions by file. Show the user, ask for confirmation. Never touch files before consent.
  3. Pre-flight state check. For each replace-line, confirm the target line still matches the recorded original. Skip cleanly on mismatch; do not patch the wrong line.
  4. Apply each action by kind: replace-line, remove, append-to-section, add-stub, split-to-target, rewrite-link, create-target, add-frontmatter, rewrite-description, manual-review.
  5. Verify. Run the fast verification command from AGENTS.md. If it fails, offer to roll back via git checkout on the touched files. Default to rolling back.
  6. Report. Files touched, changes per file, skipped actions with reasons, deferred + dismissed counts, verification result, one next move.