fix(generator): don't re-inject the MCP route scaffold over live routes#53
Merged
Conversation
…live routes add_mcp_route drew the commented /mcp scaffold with plain Thor `route`, which only skips byte-identical lines — a site that opted in has LIVE routes in its own style (`, as: :mcp`, single quotes) that never match, so every --sync run re-injected the commented noise. Guard on the endpoint via route_present? instead (matches docs_kit/mcp#create in any form, live or commented). Found dogfooding 1.0.3 into pgbus + phlex-reactive — both hit it. Claude-Session: https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs_kit:install --syncre-injected the commented/mcproute scaffold into sites that had already opted in with live routes.add_mcp_routeused plain Thorroute, which only skips byte-identical lines — a livepost "/mcp" => "docs_kit/mcp#create", as: :mcpnever matches the commented template line, so every sync accumulated more commented noise above the real routes.Fix: guard on the endpoint with the existing
route_present?helper (matchesdocs_kit/mcp#createin any quote style, live or commented) — the same tolerance the other routes already have viaroute_once.Found dogfooding 1.0.3 into pgbus (mhenrixon/pgbus#271) and phlex-reactive (mhenrixon/phlex-reactive#157) — both hit it and had the noise reverted locally.
Test Coverage
/mcproutes (own style,, as: :mcpsuffix) gets NO commented scaffold on--sync, anddocs_kit/mcp#createappears exactly once.Verification
bundle exec rspec— 716/716 (82 generator examples)bundle exec rubocop— no offenseshttps://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX