Open
Conversation
Rails engine that auto-injects the Agentation toolbar in development via Rack middleware. Zero configuration — one line in Gemfile. - Bundles React + Agentation into a standalone IIFE served at /__agentation__/ - Middleware injects script tag in <head>, config div before </body> - XSS-safe: HTML-escapes all data attributes injected by middleware - Handles Turbo navigation with before-cache cleanup - Bridges all React callbacks as CustomEvents (agentation:add, :delete, :update, :clear, :copy, :submit, :session) for Stimulus/plain JS - Includes rails generate agentation:install generator - Streaming guard: skips injection for ActionController::Live responses - Cache-Control: no-store for JS asset to prevent stale bundles - Aligns gem version to 2.1.1 to match main agentation npm package - Updates all repo URLs to github.com/benjitaylor/agentation
|
@stevysmith is attempting to deploy a commit to the Benji Taylor's Projects Team on Vercel. A member of the Team first needs to authorize it. |
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
Adds
agentation-rails— a Rails engine gem that brings the Agentation toolbar to Rails apps. One line in the Gemfile, zero configuration.The gem auto-injects the toolbar into every HTML response in development via Rack middleware — the same pattern used by
bullet,web-console, andrack-mini-profiler. Rails devs never touch React or modify their views.What's included
<script>tag (toolbar IIFE) and a config<div>into HTML responsespnpm build:rails— bundles React + Agentation into a single self-executing script so Rails devs never see Reactagentation:add,:delete,:update,:clear,:copy,:submit,:session) dispatched ondocumentfor use with Stimulus or plain JSrails generate agentation:installgenerator for optional configCache-Control: no-storeon the JS assetHow it connects to Agents
A Rails user's full setup is:
gem "agentation-rails", group: :development+bundle install(toolbar appears)npx skills add benjitaylor/agentation(installs the/agentationAgent skill)agentation-mcpto~/.claude/claude_code_config.json(so agent receives annotations)The gem replaces both
npm install agentationand adding<Agentation />to the component tree — the middleware handles injection automatically, which is the standard Rails convention for dev tooling.Maintenance notes
Rebuilding the JS when the npm package changes
The gem ships a pre-built IIFE at
rails/gem/app/assets/javascripts/agentation.js. After any change to the mainagentationpackage, rebuild it:The build reads the version from
package/package.jsonand injects it as__VERSION__, so the npm version is the source of truth. If you ship a new npm version without runningpnpm build:rails, the gem will serve stale JS.Version bumping on release
Two places need manual updates:
package/package.jsonrails/gem/agentation-rails.gemspecPublishing to RubyGems
The gem isn't published yet. When ready:
cd rails/gem gem build agentation-rails.gemspec gem push agentation-rails-2.1.1.gemFor easier maintenance consider adding a
publish:railsscript to the rootpackage.jsonalongside the existingpublish:agentationandpublish:mcp.Demo of Setup & Use in Rails
agentation-rails.mp4
Why Rails?
whyrails.mp4
Why this method?
Keeps the npm package as the source of truth and reduces maintenance complexity - just adds a build step. This follows the same approach as the following libraries: