AiSummary
AI-powered summary generator for Ruby on Rails applications.
AiSummary
scans your Rails project and creates a structured summary of your models, database tables, associations, controllers, and routes. Itβs designed to help AI tools (like ChatGPT or GitHub Copilot) better understand your codebase for debugging, refactoring, onboarding, or generating code.
β¨ Features
- Lists all models and their database columns
- Extracts ActiveRecord associations (
has_many
,belongs_to
, etc.) - Summarizes all controllers and public methods
- Extracts and maps all routes to their controller actions
- Outputs a clean
.txt
file (YAML and JSON output planned) - Useful for documentation, developer onboarding, and AI integration
π¦ Installation
After it's released to RubyGems.org, add it to your Gemfile: bundle add ai_summary Or install it manually: gem install ai_summary If you want to use the gem directly from GitHub before release: gem 'ai_summary', git: 'https://github.com/andersmarkc/ai_summary' Then run: bundle install
π Usage
Rails Runner
bundle exec rails runner 'AiSummary::SummaryGenerator.generate'
Rails Console
AiSummary::SummaryGenerator.generate
Rake Task
bundle exec rake ai_summary:generate # Default output: rails_summary.txt bundle exec rake ai_summary:generate[json] # Output: rails_summary.json bundle exec rake ai_summary:generate[yaml] # Output: rails_summary.yaml
By default, this will generate a rails_summary.txt file in your project root.
π Output Example
MODELS
User (table: users)
- id: integer
- email: string
- created_at: datetime
- has_many :orders
Order (table: orders)
- id: integer
- user_id: integer
- total_price: decimal
- belongs_to :user
CONTROLLERS
UsersController
- index
- show
OrdersController
- create
- update
ROUTES
GET /users => users#index GET /users/:id => users#show POST /orders => orders#create PATCH /orders/:id => orders#update
π€ Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/andersmarkc/ai_summary
This project is intended to be a safe, welcoming space for collaboration. Contributors are expected to follow the Code of Conduct.
π License
The gem is available as open source under the terms of the MIT License.