Hwaro::CLI::Commands::Tool::AgentsMdCommand
Constants
A CLOSING fence carries no info string (CommonMark) — accepting one (```text) would flip the in/out-of-fence parity.
The heading only counts when the line STARTS with the marker
(≤3 leading spaces still renders as the same ATX heading) — a
first-substring index let a mid-prose mention shift the merge
point. Trailing text after a separating blank is allowed so a
user-annotated heading ("## Site-Specific Instructions (do not
delete)") keeps being found; losing it meant --write --force
discarded the user's whole section.
Single source of truth for command metadata
The generated document ends with a "Site-Specific Instructions" section that explicitly invites the user to add their own rules. Regenerating used to overwrite the whole file — destroying exactly the content the template told them to write there. Carry the existing file's section (heading included) into the fresh template; a file without the marker falls back to a full rewrite (announced above), as does a template variant without one. The marker itself lives on the template service so the two can't drift apart.