rails-ai-context 5.39.1 → 5.39.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +187 -0
  3. data/README.md +18 -3
  4. data/docs/ARCHITECTURE.md +1 -1
  5. data/docs/CLI.md +1 -1
  6. data/docs/FAQ.md +1 -1
  7. data/docs/GUIDE.md +9 -6
  8. data/docs/INTROSPECTORS.md +3 -3
  9. data/docs/TOOLS.md +117 -16
  10. data/docs/TROUBLESHOOTING.md +1 -1
  11. data/lib/rails_ai_context/ast_cache.rb +76 -2
  12. data/lib/rails_ai_context/class_declarations.rb +54 -2
  13. data/lib/rails_ai_context/initializer_settings.rb +4 -2
  14. data/lib/rails_ai_context/introspectors/action_presence.rb +50 -1
  15. data/lib/rails_ai_context/introspectors/api_introspector.rb +53 -16
  16. data/lib/rails_ai_context/introspectors/controller_introspector.rb +59 -3
  17. data/lib/rails_ai_context/introspectors/eager_load.rb +2 -1
  18. data/lib/rails_ai_context/introspectors/listeners/callbacks_listener.rb +2 -1
  19. data/lib/rails_ai_context/introspectors/listeners/macros_listener.rb +3 -0
  20. data/lib/rails_ai_context/introspectors/listeners/routes_dsl_listener.rb +12 -0
  21. data/lib/rails_ai_context/introspectors/listeners/validations_listener.rb +9 -4
  22. data/lib/rails_ai_context/introspectors/model_introspector.rb +54 -21
  23. data/lib/rails_ai_context/introspectors/model_record.rb +22 -5
  24. data/lib/rails_ai_context/introspectors/route_introspector.rb +29 -1
  25. data/lib/rails_ai_context/introspectors/runtime_registries.rb +402 -0
  26. data/lib/rails_ai_context/markup_source.rb +1 -0
  27. data/lib/rails_ai_context/negative_claim.rb +34 -0
  28. data/lib/rails_ai_context/portable_path.rb +5 -0
  29. data/lib/rails_ai_context/runtime_origin.rb +41 -0
  30. data/lib/rails_ai_context/serializers/section_facts.rb +22 -1
  31. data/lib/rails_ai_context/server.rb +3 -3
  32. data/lib/rails_ai_context/tools/analyze_feature.rb +2 -0
  33. data/lib/rails_ai_context/tools/base_tool.rb +149 -1
  34. data/lib/rails_ai_context/tools/dependency_graph.rb +13 -14
  35. data/lib/rails_ai_context/tools/diagnose.rb +2 -2
  36. data/lib/rails_ai_context/tools/generate_test.rb +56 -24
  37. data/lib/rails_ai_context/tools/get_api.rb +15 -6
  38. data/lib/rails_ai_context/tools/get_callbacks.rb +102 -14
  39. data/lib/rails_ai_context/tools/get_concern.rb +3 -2
  40. data/lib/rails_ai_context/tools/get_context.rb +1 -1
  41. data/lib/rails_ai_context/tools/get_controllers.rb +117 -7
  42. data/lib/rails_ai_context/tools/get_helper_methods.rb +81 -68
  43. data/lib/rails_ai_context/tools/get_mailers.rb +6 -1
  44. data/lib/rails_ai_context/tools/get_model_details.rb +127 -42
  45. data/lib/rails_ai_context/tools/get_partial_interface.rb +4 -2
  46. data/lib/rails_ai_context/tools/get_schema.rb +21 -1
  47. data/lib/rails_ai_context/tools/get_test_info.rb +7 -0
  48. data/lib/rails_ai_context/tools/get_view.rb +4 -1
  49. data/lib/rails_ai_context/tools/migration_advisor.rb +11 -4
  50. data/lib/rails_ai_context/tools/onboard.rb +1 -1
  51. data/lib/rails_ai_context/tools/review_changes.rb +56 -3
  52. data/lib/rails_ai_context/tools/validate.rb +11 -0
  53. data/lib/rails_ai_context/tools/validate_semantics.rb +114 -45
  54. data/lib/rails_ai_context/version.rb +1 -1
  55. metadata +4 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9009c01e492d1f80697f24c8a405105a672e9658600ea91a2900e927ae7e393c
4
- data.tar.gz: 7b1c562d16a0eb4dcbb2e2709ef3aa584770c49cb29e463ce643d7aa3b822aa9
3
+ metadata.gz: 15bdb8cba276a174d0528c46be02eb2d150cafd816ab369d09004a987026560d
4
+ data.tar.gz: e03c9cb21526bb72f913593ebe314ba091616b10420cb248a6f77a3c9f679017
5
5
  SHA512:
6
- metadata.gz: 1d0a8ab86108420d68e1222eea52a90bce730a8332cb798fe7fd934bf5b30185a309ac9543bada3889c6c96b2d28766edfe4546de6ca23dc6f99ac10385cc973
7
- data.tar.gz: c5e4bd9ba02f4477a92454fac2b44f7043f8f2a2e9dd05ffe9aa0e5985590310a198c7b36fd7af33f21d3da0c2c2335e4b4c778638fe185e63783bbb60d0b61f
6
+ metadata.gz: 417e473cbb705040e16d20e321a1a22761243c6dd63644c5f5773d4f2dbea73baa7cdae4d4420de6635f8b4f8597682ef96981c58471700d6b7bf2b59affa30f
7
+ data.tar.gz: 8a3c6dbdee3ea9679c071cd7b6f7120cb88d640f93e5d90e858624f90227e87fe73187a2bd10a761a37e397e58ad4483acb5587e371ac722c16da69162b9d49b
data/CHANGELOG.md CHANGED
@@ -5,6 +5,193 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.39.2] - 2026-12-07
9
+
10
+ ### Fixed
11
+
12
+ - **The HTTP transport starts on Puma 8.1.4.** Puma 8.1.4 gave its launcher's
13
+ `setup_signals` an argument, and the server's own stop handling took none,
14
+ so `serve --transport http` died at start with "wrong number of arguments
15
+ (given 1, expected 0)". It now passes Puma's arguments through, on every
16
+ Puma version.
17
+
18
+ - **Text nested thousands of brackets deep no longer ends the process.**
19
+ Prism recurses once per level and can run out of native stack before its
20
+ own nesting cap; on Windows that ended the process with no error. A Ruby
21
+ file or ERB tag that nests brackets or interpolations deeper than 250 levels
22
+ is now parsed only up to that point, a HAML attribute hash that deep is left
23
+ unread, and `validate` says the file nests too deep and was not checked past
24
+ that line instead of reporting a syntax error there. Nesting by keywords
25
+ (`if`, `begin`) is not counted.
26
+
27
+ - **A "none" or "not found" names the class macros it could not read.** On
28
+ the static tier a model that calls a macro no reader expands
29
+ (`has_paper_trail`, `monetize`, `acts_as_list`, a `class_eval` string) got
30
+ answers that denied what the macro adds. The model record now carries
31
+ `macros_unread`, and the tools say what they did not read.
32
+ `rails_validate` keeps a missing column, callback method or route helper as
33
+ a warning, but drops `Fix: add migration` when such a macro may add the
34
+ column, names the macro beside a callback method it cannot find, and says
35
+ how many dynamic route constructs the static read left out.
36
+ `rails_get_callbacks` names the macro where it said "No callbacks defined",
37
+ and its listing names the models that have one, ten by name and the rest
38
+ counted. `rails_get_model_details` names every such call in one line, with
39
+ one count, and says when the static read expanded its validations
40
+ (`devise :validatable`); a `class_eval` string in the model's own file no
41
+ longer reads as a gem. `rails_dependency_graph` says any of the macros it
42
+ names may add associations, and `rails_migration_advisor` names them too, and `rails_get_controllers` says
43
+ that a gem's or an `on_load` hook's filters are read only with the app
44
+ booted, in the `ApplicationController` answer too. `rails_get_callbacks`
45
+ shows a callback name built by interpolation as written and says it is
46
+ built at runtime.
47
+ - **Gem macros, middleware and helpers are no longer judged by a fixed list
48
+ of gem names or file names alone.** `rails_get_model_details` lists every
49
+ class-body call no reader expands under "Other class macros", as written
50
+ with its arguments redacted, on both tiers, so `rolify`, `paginates_per`,
51
+ `attr_encrypted` and `enumerize :status, in: [...]` show up with their
52
+ values. `rails_onboard` titles its encrypted-data section by the
53
+ Active Record `encrypts` macro it reads. `rails_get_config(section:"api")`
54
+ reads `Rack::Attack` and `Rack::Cors` from the middleware stack on a booted
55
+ app, `Rack::Attack` from any initializer whose code names it, and CORS rules
56
+ from any initializer that inserts `Rack::Cors`, so an initializer not named
57
+ after the gem no longer reads as "not detected". A `cors.rb` left fully
58
+ commented out is reported only when no other initializer and no booted
59
+ stack holds `Rack::Cors`. The payload marks a stack-only find with
60
+ `in_stack: true`, and a static "not detected" says that middleware a gem
61
+ inserts at boot is not read.
62
+ `rails_get_helper_methods` no longer names gem helpers the app's gems do
63
+ not have: its table listed `pagy_nav` for pagy 43, which has none, and
64
+ `current_user` whatever the Devise scope. Its static `detail:"full"` answer names them
65
+ from the lockfile: a gem's line prints only when the lockfile holds it,
66
+ Pagy's `pagy_nav` and `pagy_info` only below pagy 43, and Devise's names
67
+ come from each `devise_for` scope the route files spell (`current_member`
68
+ for `devise_for :members`), or as the `current_<scope>` pattern when no
69
+ scope is read. The section says the names come from the lockfile and were
70
+ not read from the gems. `rails_validate` drops its list of Devise route names. Booted, the
71
+ app's `url_helpers` and view helpers answer, so Devise's
72
+ `session_path(resource_name)` and the like pass. Statically, those view
73
+ helpers pass when the lockfile has `devise` and the call passes the scope;
74
+ a bare `new_session_path` is still reported. A missing route helper
75
+ says how many dynamic route constructs, such as `devise_for`, were not read.
76
+ The helper Rails names a mount by is no longer reported on the static
77
+ tier: the mount's `as:` or its app's name (`sidekiq_web_path` for
78
+ `mount Sidekiq::Web`), under the names of the scopes around it
79
+ (`admin_sidekiq_web_path` inside `namespace :admin`), and an app engine's
80
+ `engine_name`. The routes payload carries those names in `mount_route_names`.
81
+ - **Derived tools no longer turn partial facts into conclusions.**
82
+ `rails_generate_test` writes a skipping example for a length rule whose
83
+ bound is a proc or a constant, where it wrote `.is_at_most((proc))`, which
84
+ raised when the spec ran; integer bounds and a literal `in:` range keep the
85
+ matcher. An inclusion list read as a constant's name (`in: STATUSES`) gets a
86
+ skipping example too, where it wrote `.in_array(STATUSES)`, which raised
87
+ `NameError` when the spec loaded. Devise's `:validatable` read statically
88
+ now carries the options Devise declares, so its email uniqueness is a conditional `skip` and no
89
+ longer a plain `validate_uniqueness_of(:email)` that fails. Both model test
90
+ generators end with a comment naming the class macros whose behaviour the
91
+ cases do not cover. `rails_migration_advisor` names the table's class
92
+ macros under the lines that name a dropped column, as it already did when
93
+ no line names it. `rails_review_changes` warns on a removed class macro,
94
+ such as `:validatable` cut from `devise` or a dropped `has_paper_trail`.
95
+ A macro counts as removed when no call of the same name on the new side
96
+ holds its symbol, string and constant arguments, so dropping
97
+ `after_save AuditLogger` warns, while editing a scope's lambda, adding
98
+ an `enum` value or moving a `serialize` coder to `coder:` does not.
99
+ `rails_analyze_feature` and `rails_get_context` print a model's macros, and
100
+ `rails_get_test_info` names the suite's shared examples.
101
+ - **A lookup no longer says "not found" for what a gem defines.** On a booted
102
+ app, a model, concern, controller, mailer, view folder, partial or helper
103
+ method the app's own files do not hold is looked up in the runtime, and the
104
+ answer names the gem, its version and the file in it, such as
105
+ `Devise::SessionsController` or `link_to`. A helper method a route macro
106
+ defines, such as Devise's `current_user`, is found too: routes Rails 8
107
+ draws on first use are drawn before the lookup. Nothing the gem holds is listed,
108
+ no gem file is read, and a constant still waiting on its autoload is
109
+ answered from the file Ruby registered, without loading it. A name under a
110
+ namespace still waiting on its autoload is "not found", and the answer says
111
+ what defines it was not read. On the static tier the "not found" says that
112
+ only the app's own files are read and a gem may define it, unless the app
113
+ declares the name: then it says which file declares it and why the lookup
114
+ does not list it, so an abstract `ApplicationRecord` reads as abstract. `rails_validate`
115
+ no longer reports a partial a gem's views hold on a booted app, and
116
+ statically says a gem may define one.
117
+ `rails_get_mailers` says that its listing leaves out gem mailers, and
118
+ `rails_get_schema` names a gem's loaded model on a table no app model reads.
119
+ - **A booted model answer reads the registries Rails keeps, not only the
120
+ source.** Callbacks, default scopes, scopes and first-party macros that a
121
+ gem or runtime code adds were denied ("No callbacks defined.") or dropped.
122
+ The booted tier now compares the model's callback chains, `default_scopes`,
123
+ scope methods, `nested_attributes_options`, `encrypted_attributes`,
124
+ `stored_attributes`, attribute aliases, non-column attributes, serialized
125
+ columns, `readonly_attributes` and `normalized_attributes` with what the
126
+ source declared, and lists each extra. Non-column attributes and serialized
127
+ columns are compared only on a model that has connected, since their types
128
+ load the schema. A counter cache column Rails 7.0
129
+ marks read-only for a child's `belongs_to` is left out, and a column runtime
130
+ code makes read-only is listed whatever its name. A callback or default scope is
131
+ tagged with the gem that added it, or as read from the running app. A
132
+ scope or macro is always tagged as read from the running app: a scope's
133
+ method lives in Active Record's own file, and a macro's registry keeps no
134
+ file. A gem's block callback is named by its `file:line` inside the gem,
135
+ callbacks sit where Rails runs them, and a loop's interpolated callback
136
+ name lists the names it made. The `rails_get_callbacks` listing prints the
137
+ callbacks a gem adds alike to several models once, at the end under the
138
+ gem, and each of those models says how many it holds from that gem. What Rails adds itself (including the scopes
139
+ Active Storage, Action Text and `delegated_type` make from a line the
140
+ source declares), the `validate` chain, and anything from outside the app
141
+ and its gems are left out. A gem's scope moves from Class methods to
142
+ Scopes, and `rails_generate_test` only asserts that it exists.
143
+ `rails_validate` asks the running class before reporting a missing column
144
+ or callback method, so a gem's `tag_list` is no longer "add migration", a
145
+ column the running class does not have keeps its `Fix:` line beside a macro
146
+ the source does not expand,
147
+ and a missing callback method on a model that includes a module is
148
+ reported again on a booted app; a method every object has, such as
149
+ Kernel's `format`, does not count as the model's. `rails_get_model_details`
150
+ says how many methods reflection reports for a model whose file defines
151
+ some, and lists the names a gem or the app defines beyond the file, one
152
+ line per gem tagged with it; Rails' own methods are left out. An unread
153
+ class macro is listed as written, and an unread class macro, concern or
154
+ base class says that what the running class holds from it is in the
155
+ answer and only the rest is not read. None of this entry changes the
156
+ static tier.
157
+ - **A booted controller answer reads its actions, rescue handlers and
158
+ `helper_method` names from the running class, not only the source.** An
159
+ action a `define_method` loop, a gem's `class_eval` or an `inherited` hook
160
+ defines read as "(no public actions)", `rails_get_context` said it was not
161
+ found, and `rails_validate` said to add a `def` for it. The booted tier now
162
+ lists such an action with its `file:line` and tag, and an `action` lookup
163
+ answers with that place and its routes. `rescue_from` handlers a gem or an
164
+ `on_load` hook adds are listed and tagged, and `rails_get_helper_methods`
165
+ lists the `helper_method` names a gem declares (`can?`), leaving out Rails'
166
+ own. It reads them from the running `ApplicationController`, and each
167
+ controller's own from a context another call already built, so it builds
168
+ no context of its own. `rails_validate` asks the running class before it reports a route's
169
+ action as missing, and an action the running class defines nowhere keeps
170
+ its `Fix:` line even beside a module it could not read, unless its own
171
+ `action_missing` or a template in one of its view paths could answer the
172
+ route. Asked for `ApplicationController`,
173
+ `rails_get_controllers` counts the filters its running chain holds that it
174
+ does not declare, names the gems that added them, and lists the rescue
175
+ handlers its running class holds. On the static tier, a controller whose
176
+ class body calls `define_method` with a computed name, or `class_eval` with
177
+ a string, names that call and its line where it lists actions, where an
178
+ action lookup misses, and in `rails_validate`'s note on a route's action.
179
+ - **Strong params set outside `params` are no longer left out.** A
180
+ `permit` call on another receiver, such as Devise's
181
+ `devise_parameter_sanitizer.permit(:sign_up, keys: [:name])`, was dropped,
182
+ so `rails_get_controllers` showed the filter and no strong params. Both
183
+ tiers now list it under its method, with its line and the call as written,
184
+ secrets filtered, and say what it permits is not expanded;
185
+ `ApplicationController`'s answer lists it too, and the controllers below
186
+ it do not. `rails_generate_test` does not take it as the controller's
187
+ create params. Booted, a controller built at runtime with no file of its
188
+ own (an ActiveAdmin resource) says where its `permitted_params` is defined
189
+ and that the params are not read: the app file and line that sets them, or,
190
+ when a gem builds the method from the app's call, that gem and its line.
191
+ - **Booted model details on Rails 7.0 no longer walk every model once per
192
+ model.** The counter cache columns a child's `belongs_to` marks read-only
193
+ are collected once per run.
194
+
8
195
  ## [5.39.1] - 2026-10-31
9
196
 
10
197
  ### Fixed
data/README.md CHANGED
@@ -8,9 +8,13 @@
8
8
  <h3 align="center">Your coding agent guesses your Rails app. Let it ask.</h3>
9
9
 
10
10
  <p align="center">
11
- rails-ai-context turns your Rails app into the source of truth for Claude Code, Cursor, GitHub Copilot,
12
- OpenCode and Codex CLI: 35 read-only tools answer from the schema, the models, the routes, the controllers
13
- and the views, over MCP or in any terminal, and still answer when the app cannot boot.
11
+ <a href="docs/SETUP.md"><img src="https://img.shields.io/badge/works_with-555" alt="Works with"></a>
12
+ <a href="docs/SETUP.md#claude-code"><img src="https://img.shields.io/badge/Claude_Code-D97757?logo=claudecode&logoColor=white" alt="Claude Code"></a>
13
+ <a href="docs/SETUP.md#cursor"><img src="https://img.shields.io/badge/Cursor-000000?logo=cursor&logoColor=white" alt="Cursor"></a>
14
+ <a href="docs/SETUP.md#github-copilot"><img src="https://img.shields.io/badge/GitHub_Copilot-000000?logo=githubcopilot&logoColor=white" alt="GitHub Copilot"></a>
15
+ <a href="docs/SETUP.md#opencode"><img src="https://img.shields.io/badge/OpenCode-000000?logo=opencode&logoColor=white" alt="OpenCode"></a>
16
+ <a href="docs/SETUP.md#codex-cli"><img src="https://img.shields.io/badge/Codex_CLI-000000?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPHBhdGggZmlsbD0iI2ZmZiIgZD0iTTMgNS40IDQuNCA0bDggOC04IDhMMyAxOC42IDkuNiAxMnpNMTMgMThoOHYyaC04eiIvPjwvc3ZnPg%3D%3D" alt="Codex CLI"></a>
17
+ <a href="docs/CLI.md"><img src="https://img.shields.io/badge/Any_terminal-4D4D4D?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyAzaDE4YTIgMiAwIDAgMSAyIDJ2MTRhMiAyIDAgMCAxLTIgMkgzYTIgMiAwIDAgMS0yLTJWNWEyIDIgMCAwIDEgMi0yem0wIDJ2MTRoMThWNXptMyAzLjRMNy40IDdsNSA1LTUgNUw2IDE1LjYgOS42IDEyek0xMyAxNWg1djJoLTV6Ii8%2BPC9zdmc%2B" alt="Any terminal"></a>
14
18
  </p>
15
19
 
16
20
  <p align="center">
@@ -26,6 +30,7 @@
26
30
  <p align="center">
27
31
  <a href="https://crisnahine.github.io/rails-ai-context/">Website</a> ·
28
32
  <a href="#try-it-in-your-rails-app">Quick start</a> ·
33
+ <a href="https://crisnahine.github.io/rails-ai-context/FAQ.html"><b>FAQ</b></a> ·
29
34
  <a href="#what-it-does">What it does</a> ·
30
35
  <a href="#a-closer-look">A closer look</a> ·
31
36
  <a href="#how-it-works">How it works</a> ·
@@ -33,6 +38,12 @@
33
38
  <a href="CONTRIBUTING.md">Contributing</a>
34
39
  </p>
35
40
 
41
+ <p align="center">
42
+ <a href="https://crisnahine.github.io/rails-ai-context/FAQ.html"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/crisnahine/rails-ai-context/main/docs/assets/faq-dark.svg"><img src="https://raw.githubusercontent.com/crisnahine/rails-ai-context/main/docs/assets/faq-light.svg" alt="Questions before you install? Read the FAQ. Do I need MCP support in my AI tool? No. The gem works three ways. 1, MCP server: AI calls tools via the protocol, the best experience. 2, Static files: generated context files (CLAUDE.md, .cursor/rules/, etc.). 3, CLI: the same 35 tools from the terminal, no server needed. More questions the FAQ answers: What does this gem do? Which AI tools are supported? Is this safe for production? Does it work without a database? Do I need to commit the generated files? How does this compare to a hand-written CLAUDE.md?" width="860"></picture></a>
43
+ </p>
44
+
45
+ <br>
46
+
36
47
  <p align="center">
37
48
  <picture>
38
49
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/crisnahine/rails-ai-context/main/docs/assets/session-dark.svg">
@@ -425,6 +436,10 @@ MCP config written for them. Any other MCP client, such as Claude Desktop, Winds
425
436
  IDE (Copilot or AI Assistant), gets an entry from `rails-ai-context mcp-entry`. A tool with no MCP at all
426
437
  gets the CLI setup, where the context files name the shell commands.
427
438
 
439
+ **Still wondering about something?** [The FAQ](https://crisnahine.github.io/rails-ai-context/FAQ.html)
440
+ answers the rest: install, the tools, configuration, context files, performance, security, and how it
441
+ compares to a hand-written `CLAUDE.md` or pasting `schema.rb` into the prompt.
442
+
428
443
  ## What it will not do
429
444
 
430
445
  - **Write to your app or your database from a tool.** Every tool reads. The assistant still decides
data/docs/ARCHITECTURE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Architecture
4
4
 
5
- **How rails-ai-context is built, and why.**
5
+ **How rails-ai-context is built, and why: its modules and the request lifecycle.**
6
6
 
7
7
  [Tools Reference](TOOLS.md) · [Introspectors](INTROSPECTORS.md) · [Security](SECURITY.md) · [Custom Tools](CUSTOM_TOOLS.md)
8
8
 
data/docs/CLI.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # CLI Reference
4
4
 
5
- **All commands available from the terminal.**
5
+ **All rails-ai-context commands available from the terminal, with their flags.**
6
6
 
7
7
  [Quickstart](QUICKSTART.md) · [Tools Reference](TOOLS.md) · [Standalone](STANDALONE.md) · [Configuration](CONFIGURATION.md)
8
8
 
data/docs/FAQ.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # FAQ
4
4
 
5
- **Frequently asked questions about rails-ai-context.**
5
+ **Answers about rails-ai-context: MCP support, production safety, running without a database, generated files, and how it compares to a hand-written CLAUDE.md.**
6
6
 
7
7
  [Quickstart](QUICKSTART.md) · [Recipes](RECIPES.md) · [Troubleshooting](TROUBLESHOOTING.md) · [Configuration](CONFIGURATION.md)
8
8
 
data/docs/GUIDE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # rails-ai-context - Complete Guide
4
4
 
5
- **The all-in-one reference. Everything in one file.**
5
+ **The all-in-one rails-ai-context reference: every command, parameter and option in one file.**
6
6
 
7
7
  [Quickstart](QUICKSTART.md) · [Tools](TOOLS.md) · [Recipes](RECIPES.md) · [FAQ](FAQ.md)
8
8
 
@@ -929,17 +929,20 @@ order (`load_defaults 7.1`). A method declared again shows once with the later
929
929
  declaration's conditions. A block or lambda callback shows its declaration at
930
930
  `detail: "full"`, and turbo-rails' broadcast macros (`broadcasts_refreshes`,
931
931
  `broadcasts_to` and the rest) are listed as the commit callbacks they declare.
932
+ On a booted app the model's callback chains are read too, so a callback a gem
933
+ or runtime code adds is listed where Rails runs it, tagged with the gem or as
934
+ read from the running app; Rails' own callbacks are left out.
932
935
 
933
936
  ### rails_get_helper_methods
934
937
 
935
- Get Rails helper modules: method signatures, framework helpers in use, and which views call each helper. Specify a helper for full detail, or omit to list all helpers with method counts.
938
+ Get the app's Rails helper modules: method signatures, the view helpers controllers declare with `helper_method`, and which views call each helper. Helper modules that gems or `on_load` hooks add are not listed; on a booted app the `helper_method` names they declare are, and on the static tier `detail:"full"` names the helpers of gems the lockfile holds, checked against the locked version. Specify a helper for full detail, or omit to list all helpers with method counts.
936
939
 
937
940
  **Parameters:**
938
941
 
939
942
  | Param | Type | Description |
940
943
  |-------|------|-------------|
941
944
  | `helper` | string | Helper module name (e.g. `ApplicationHelper`, `UsersHelper`). Omit to list all helpers. |
942
- | `detail` | string | `summary` / `standard` (default) / `full`. summary: names + method counts. standard: names + method signatures. full: method signatures + view cross-references + framework helpers. |
945
+ | `detail` | string | `summary` / `standard` (default) / `full`. summary: names + method counts. standard: names + method signatures. full: method signatures + view cross-references. |
943
946
  | `limit` | integer | Max helpers to return. Default: 50. |
944
947
  | `offset` | integer | Skip this many helpers for pagination. Default: 0. |
945
948
 
@@ -953,10 +956,10 @@ rails_get_helper_methods(helper: "ApplicationHelper")
953
956
  → Full detail: method signatures, included modules
954
957
 
955
958
  rails_get_helper_methods(detail: "full")
956
- → All helpers with method signatures + detected framework helpers (Devise, Pagy, Turbo, etc.)
959
+ → All helpers with method signatures; statically, the helpers of gems the lockfile holds
957
960
  ```
958
961
 
959
- **Returns:** Helper module listing or full detail including file path, method signatures, included modules, and (at full detail) which views reference each helper method. Detects usage of framework helpers from Devise, Pagy, Turbo, Pundit, CanCanCan, Kaminari, SimpleForm, and others.
962
+ **Returns:** Helper module listing or full detail including file path, method signatures, included modules, and (at full detail) which views reference each helper method. Booted, it names no gem's helper modules. Statically, a gem's helper names print only when the lockfile holds the gem at a version that ships them, and Devise's are named by the `devise_for` scopes the routes spell.
960
963
 
961
964
  ### rails_get_service_pattern
962
965
 
@@ -1756,7 +1759,7 @@ When running the MCP server via `rails ai:serve`, **live reload** notifies conne
1756
1759
 
1757
1760
  Answers never wait on it. Every tool call and resource read first checks the watched files, with `listen` or without it (a new Rails 8 app does not bundle it), and when one changed it reloads the app's code and drops the caches - so an answer sees every edit made before the call began, one made a moment earlier included, which `listen` would deliver only after its debounce. The check stats each watched directory and file and reads a directory again only when it changed: about a millisecond on a small app, about 30 ms at 10,000 files. Calls made at the same time, over HTTP, wait for one check together; calls one after another each check.
1758
1761
 
1759
- A server whose app cannot reload code - `RAILS_ENV=test`, or production with eager loading, where `config.enable_reloading` is off - keeps the code it booted with. What reflection reads, such as associations and enums, then stays as of boot (validations and callbacks are read off the source, so they still follow the edit), and once a file under the app's autoload paths changes, every answer ends with a note naming it: restart the server to see the edit.
1762
+ A server whose app cannot reload code - `RAILS_ENV=test`, or production with eager loading, where `config.enable_reloading` is off - keeps the code it booted with. What reflection reads, such as associations and enums, then stays as of boot (validations and callbacks are read off the source, so they still follow the edit; one no source line declares is read from the running class and stays as of boot), and once a file under the app's autoload paths changes, every answer ends with a note naming it: restart the server to see the edit.
1760
1763
 
1761
1764
  One save a reload can miss: Bootsnap's compile cache knows a Ruby file by its size and the second of its mtime, so a file saved twice within one second at the same size can reload as the first save. Every answer then names the file until it is saved again a second later ([Known limits](COMPATIBILITY.md#known-limits)).
1762
1765
 
@@ -85,9 +85,9 @@ end
85
85
  | Introspector | Key | What it extracts |
86
86
  |:-------------|:----|:-----------------|
87
87
  | SchemaIntrospector | `:schema` | Database tables, columns, types, indexes, defaults, check constraints, enum types, extensions |
88
- | ModelIntrospector | `:models` | Associations, validations, scopes, enums, concerns (AST-based). Both tiers merge what the included concerns declare, tagged `from_concern:`; a concern whose file could not be read is listed in `concerns_unread`, a base class whose file could not be read in `bases_unread`, and the number of concerns `excluded_concerns` hid in `concerns_hidden` |
88
+ | ModelIntrospector | `:models` | Associations, validations, scopes, enums, concerns (AST-based). Both tiers merge what the included concerns declare, tagged `from_concern:`; a concern whose file could not be read is listed in `concerns_unread`, a base class whose file could not be read in `bases_unread`, each class-body call no reader expands (a gem macro, a `class_eval` string, an unknown call) in `macros_unread` as `{ name:, line:, file:, text: }` with its source redacted, and the number of concerns `excluded_concerns` hid in `concerns_hidden`. Booted, the callback chains, `default_scopes`, scope methods and first-party macro registries are compared with the source (a `readonly_attributes` entry Rails 7.0 sets for a child's `belongs_to counter_cache:` is left out): an extra callback carries its origin in `callback_origins` (in step with `callbacks`), an extra default scope carries `added_by:` or `reflection_only:`, an extra scope `reflection_only: true`, and an extra macro is in `reflected_macros` as `{ text:, reflection_only: true }`; Rails' own entries and ones from outside the app and its gems are left out (`RuntimeOrigin`) |
89
89
  | RouteIntrospector | `:routes` | Routes with helpers, HTTP methods, constraints |
90
- | ControllerIntrospector | `:controllers` | Actions, filters, strong params, concerns, `rescue_from` handlers, rate limits |
90
+ | ControllerIntrospector | `:controllers` | Actions, filters, strong params, concerns, `rescue_from` handlers, rate limits. Booted, `action_methods`, `rescue_handlers` and `_helper_methods` are compared with the source: an action the class itself holds and the source does not name joins `actions` and is listed in `runtime_actions` as `{ name:, added_by: or reflection_only:, label: }`, an extra handler joins `rescue_from` with the same tags (a block by its `file:line`), and an extra `helper_method` name is in `runtime_helper_methods`; Rails' own entries and an app parent's are left out (`RuntimeOrigin`) |
91
91
  | ViewIntrospector | `:views` | View files, layouts, partials |
92
92
  | ViewTemplateIntrospector | `:view_templates` | Each template with its line count, ivars, rendered partials and Stimulus refs; each partial with its line count, model fields and helper calls |
93
93
 
@@ -344,7 +344,7 @@ Introspection results are cached at three levels:
344
344
  2. **AST cache** - Per-file parse results, invalidated by file content change (SHA256), with a stat shortcut for a file older than the read
345
345
  3. **Run cache** - File lists, stats and directory answers for one introspection run, dropped when it ends
346
346
 
347
- The **Fingerprinter** reads one set of files: all watched directories (`app/`, `config/`, `db/`, `lib/`, `rakelib/`, `test/`, `spec/`), the Gemfile and `Gemfile.lock` (or `gems.rb` and `gems.locked`), `package.json`, `tsconfig.json`, `config.ru`, the Rakefile, the scripts in `bin/`, and the other root files a reader opens or checks for (`Dockerfile`, `Procfile`, `docker-compose.yml`, CI and deploy configs, JS lockfiles and bundler configs, Ruby version files). Each file counts by its path and its mtime, so a rename is a change too. When one of them changes, a server drops the introspection cache even if the TTL hasn't expired, and in the booted tier reloads the app's code first, so what reflection reads (an association, an enum) is current too, wherever the app can reload. Under `RAILS_ENV=test`, or in production with eager loading, `config.enable_reloading` is off and Rails keeps the code it booted with: what reflection reads stays as of boot (validations and callbacks are read off the source, so they still follow the edit), and once a file under the app's autoload paths changes, every answer ends with a note naming it and asking for a restart.
347
+ The **Fingerprinter** reads one set of files: all watched directories (`app/`, `config/`, `db/`, `lib/`, `rakelib/`, `test/`, `spec/`), the Gemfile and `Gemfile.lock` (or `gems.rb` and `gems.locked`), `package.json`, `tsconfig.json`, `config.ru`, the Rakefile, the scripts in `bin/`, and the other root files a reader opens or checks for (`Dockerfile`, `Procfile`, `docker-compose.yml`, CI and deploy configs, JS lockfiles and bundler configs, Ruby version files). Each file counts by its path and its mtime, so a rename is a change too. When one of them changes, a server drops the introspection cache even if the TTL hasn't expired, and in the booted tier reloads the app's code first, so what reflection reads (an association, an enum) is current too, wherever the app can reload. Under `RAILS_ENV=test`, or in production with eager loading, `config.enable_reloading` is off and Rails keeps the code it booted with: what reflection reads stays as of boot (validations and callbacks are read off the source, so they still follow the edit; one no source line declares is read from the running class and stays as of boot), and once a file under the app's autoload paths changes, every answer ends with a note naming it and asking for a restart.
348
348
 
349
349
  - **Every server** - stdio, HTTP, or the endpoints mounted inside the app - checks before each tool call and resource read, so an answer sees every edit made before the call began. `Fingerprinter::Snapshot` stats each watched directory and file and lists a directory again only when its stat moved: about a millisecond on a small app, about 30 ms at 10,000 files. Only a check that began after a call arrived stands in for that call's own, so calls one after another each check and calls made at once wait for one check together. Inside a request the app serves, Rails' own reloader has already reloaded the code.
350
350
  - **Live Reload** (the `listen` gem: the app's bundle's, or for the standalone binary one installed beside it) watches these directories and notifies connected MCP clients via `notify_resources_list_changed`. It loads none of the app's code and drops no cache: a change reaches it after the 1.5-second debounce, and by then the call that followed the edit has checked the files itself.