rails-kit

command module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 1 Imported by: 0

README

rails-kit

A fast, compiled CLI for inspecting Rails projects. Most commands read project files directly without loading Rails, making them useful for developers, scripts, editors, and AI agents.

Installation

brew install --cask janstol/tap/rails-kit

Homebrew is macOS/Linux only. On Windows, download the windows_amd64.zip asset from the releases page (works well with Rails-on-WSL2 setups too).

Or install with Go:

go install github.com/janstol/rails-kit@latest

Quick start

Run rails-kit anywhere inside a Rails project. It finds the Rails root automatically; use --root to override it.

rails-kit about
rails-kit schema users
rails-kit routes users
rails-kit related user
rails-kit model user
rails-kit skeleton app/services

Most inspection commands accept --json for structured output:

rails-kit model user --json
rails-kit --root /path/to/app schema users --json

schema and model accept --color=auto|always|never (default auto) for terminal accents. auto disables color when stdout isn't a terminal; NO_COLOR (any non-empty value) disables color even under --color=always; --json output is never colored.

Commands

Command Description
rails-kit about Summarize application, dependency, runtime, and database metadata
rails-kit schema [table...] Inspect db/schema.rb or db/structure.sql
rails-kit routes [pattern...] Cached Rails routes, offline --static parsing, or --watch re-render
rails-kit related <name> Find files related to a model
rails-kit fixtures [name] Inspect test fixtures
rails-kit locales [scope] Browse locale keys and values
rails-kit model <name> Summarize an Active Record model
rails-kit skeleton <input...> Generate compact Ruby AST skeletons through Prism
rails-kit gem [name] Inspect Gemfile.lock
rails-kit concerns [name] Inspect model and controller concerns
rails-kit controllers [name] Summarize a Rails controller's filters, rescue_from, and actions
rails-kit mailers [name] Summarize a Rails mailer's defaults, layout, and attachments
rails-kit jobs [name] Summarize a Rails ActiveJob's queue, retry/discard, and methods
rails-kit services [name] Summarize a Rails service's constants, concerns, and methods
rails-kit datagrids [name] Summarize a Rails datagrid's filters, columns, scope, and decorator
rails-kit helpers [name] Summarize a Rails view helper's concerns, constants, and method signatures
rails-kit decorators [name] Summarize a Rails decorator's parent class, concerns, macros, and method signatures
rails-kit formers [name] Summarize a Rails form object's attributes, validations, macros, and method signatures
rails-kit presenters [name] Summarize a Rails presenter's parent class, concerns, constants, attributes, macros, and method signatures
rails-kit skill install|uninstall Manage the bundled Claude Code or Codex skill
rails-kit completion bash|zsh|fish Generate shell completions
rails-kit version Print version information

See the command reference for examples, JSON shapes, requirements, and limitations.

rails-kit completion bash|zsh|fish emits a shell completion script. Once sourced, commands also dynamically complete positional arguments — model names, table names, gem, concern, controller, mailer, job, service, datagrid, helper, decorator, former, and presenter names, and locale keys (drilling down one dotted segment at a time for locales).

Documentation

Runtime behavior

Most commands are pure Go and do not boot Rails. The main exceptions are:

  • routes runs bundle exec rails routes; use routes --static for a fast offline approximation, or routes --watch to re-render on file change.
  • about --runtime boots Rails to obtain active runtime values; plain about is static.

skeleton parses Ruby through an embedded in-process Prism parser (pure-Go WASM) — no Ruby install required, and it does not load the Rails application.

Static parsing is intentionally conservative. Consult the relevant reference page before using its output as a source of truth in CI or production audits.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
astutil
Package astutil holds AST-walking helpers shared across the Prism-backed readers (controllers, mailers, jobs, services, datagrids, model, concerns).
Package astutil holds AST-walking helpers shared across the Prism-backed readers (controllers, mailers, jobs, services, datagrids, model, concerns).
controllers
Package controllers extracts a structural summary of a Rails controller file -- filters, rescue_from handlers, helper methods, layout, respond_to formats, strong params, and action methods -- without booting Rails.
Package controllers extracts a structural summary of a Rails controller file -- filters, rescue_from handlers, helper methods, layout, respond_to formats, strong params, and action methods -- without booting Rails.
datagrids
Package datagrids extracts a structural summary of a Rails datagrid file -- its parent class, included concerns, decorator, scope, filters, columns, other class-level DSL calls, and methods -- without booting Rails.
Package datagrids extracts a structural summary of a Rails datagrid file -- its parent class, included concerns, decorator, scope, filters, columns, other class-level DSL calls, and methods -- without booting Rails.
decorators
Package decorators extracts a structural summary of a Rails decorator file -- its parent class, included concerns, class-level constants, other class-level DSL calls (surfaced as macros), and methods -- without booting Rails.
Package decorators extracts a structural summary of a Rails decorator file -- its parent class, included concerns, class-level constants, other class-level DSL calls (surfaced as macros), and methods -- without booting Rails.
formers
Package formers extracts a structural summary of a Rails form object -- its parent class, included concerns, class-level constants, attributes, validations, other class-level DSL calls (surfaced as macros), and methods -- without booting Rails.
Package formers extracts a structural summary of a Rails form object -- its parent class, included concerns, class-level constants, attributes, validations, other class-level DSL calls (surfaced as macros), and methods -- without booting Rails.
gem
helpers
Package helpers extracts a structural summary of a Rails view helper file -- its included concerns, class-level constants, and methods -- without booting Rails.
Package helpers extracts a structural summary of a Rails view helper file -- its included concerns, class-level constants, and methods -- without booting Rails.
jobs
Package jobs extracts a structural summary of a Rails ActiveJob file -- its queue, retry_on/discard_on handlers, included concerns, and public methods (notably `perform`) -- without booting Rails.
Package jobs extracts a structural summary of a Rails ActiveJob file -- its queue, retry_on/discard_on handlers, included concerns, and public methods (notably `perform`) -- without booting Rails.
mailers
Package mailers extracts a structural summary of a Rails mailer file -- its default headers, layout, included concerns, attachments, and public action methods -- without booting Rails.
Package mailers extracts a structural summary of a Rails mailer file -- its default headers, layout, included concerns, attachments, and public action methods -- without booting Rails.
presenters
Package presenters extracts a structural summary of a Rails presenter file -- its parent class, included concerns, class-level constants, attributes, other class-level DSL calls (surfaced as macros), and methods -- without booting Rails.
Package presenters extracts a structural summary of a Rails presenter file -- its parent class, included concerns, class-level constants, attributes, other class-level DSL calls (surfaced as macros), and methods -- without booting Rails.
reader
Package reader holds the file-resolution, listing, and entry-styling conventions shared by the controllers, mailers, jobs, services, datagrids, helpers, decorators, formers, presenters, and model readers.
Package reader holds the file-resolution, listing, and entry-styling conventions shared by the controllers, mailers, jobs, services, datagrids, helpers, decorators, formers, presenters, and model readers.
services
Package services extracts a structural summary of a Rails service file -- its parent class (if any), included concerns, class-level constants, and methods (both public instance methods and singleton `def self.x` class methods) -- without booting Rails.
Package services extracts a structural summary of a Rails service file -- its parent class (if any), included concerns, class-level constants, and methods (both public instance methods and singleton `def self.x` class methods) -- without booting Rails.
term
Package term provides minimal TTY detection and screen clearing for interactive command output.
Package term provides minimal TTY detection and screen clearing for interactive command output.
testutil
Package testutil provides cross-platform test helpers shared across rails-kit's test suites.
Package testutil provides cross-platform test helpers shared across rails-kit's test suites.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL