Skip to content

Sanitize fetched AGENTS template to avoid duplicated section markers#184

Merged
kalashnikovisme merged 2 commits intomainfrom
codex/fix-duplicate-agents-end-marker
Feb 19, 2026
Merged

Sanitize fetched AGENTS template to avoid duplicated section markers#184
kalashnikovisme merged 2 commits intomainfrom
codex/fix-duplicate-agents-end-marker

Conversation

@kalashnikovisme
Copy link
Member

Motivation

  • The install generator appended Tramway section markers even when the remote AGENTS template already included them, causing duplicated ## End of Tramway AGENTS.md (and start) markers on repeated runs.

Description

  • Sanitize the fetched AGENTS template by adding sanitize_agents_template_body and call it from agents_template_body to strip surrounding Tramway section markers when present.
  • Preserve the original content when the remote payload does not include the markers, and keep existing UTF-8 encoding/repair behavior.
  • Add a regression spec it 'does not duplicate section markers when remote template already includes them' to spec/tramway/generators/install_generator_spec.rb that simulates a remote template containing the start/end markers and asserts each marker appears only once in the produced AGENTS.md.

Testing

  • Attempted to run the generator specs with bundle exec rspec spec/tramway/generators/install_generator_spec.rb, but the rspec executable was unavailable in this environment (bundler error).
  • Performed syntax checks with ruby -c lib/generators/tramway/install/install_generator.rb and ruby -c spec/tramway/generators/install_generator_spec.rb, both returned Syntax OK.
  • Local unit test added to the generator spec to validate the fix (will run under CI or a developer environment with bundle install).

Codex Task

@kalashnikovisme kalashnikovisme merged commit 908df55 into main Feb 19, 2026
31 of 34 checks passed
@kalashnikovisme kalashnikovisme deleted the codex/fix-duplicate-agents-end-marker branch February 19, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments