rails-ai-bridge 3.0.0 → 3.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +55 -0
- data/README.md +101 -105
- data/docs/BEST_PRACTICES.md +20 -0
- data/docs/GUIDE.md +20 -18
- data/docs/roadmap-context-assistants.md +61 -2
- data/docs/roadmaps.md +23 -0
- data/lib/rails_ai_bridge/introspectors/action_text_introspector.rb +7 -9
- data/lib/rails_ai_bridge/introspectors/active_storage_introspector.rb +18 -17
- data/lib/rails_ai_bridge/introspectors/api_introspector.rb +30 -33
- data/lib/rails_ai_bridge/introspectors/auth_introspector.rb +23 -16
- data/lib/rails_ai_bridge/introspectors/config_introspector.rb +7 -5
- data/lib/rails_ai_bridge/introspectors/controller_introspector.rb +9 -2
- data/lib/rails_ai_bridge/introspectors/convention_detector.rb +91 -13
- data/lib/rails_ai_bridge/introspectors/database_stats_introspector.rb +6 -1
- data/lib/rails_ai_bridge/introspectors/gem_introspector.rb +29 -10
- data/lib/rails_ai_bridge/introspectors/model_introspector.rb +17 -33
- data/lib/rails_ai_bridge/introspectors/non_ar_models_introspector.rb +77 -83
- data/lib/rails_ai_bridge/introspectors/stimulus_introspector.rb +17 -8
- data/lib/rails_ai_bridge/introspectors/turbo_introspector.rb +21 -13
- data/lib/rails_ai_bridge/introspectors/view_introspector.rb +111 -46
- data/lib/rails_ai_bridge/path_resolver.rb +229 -0
- data/lib/rails_ai_bridge/resources.rb +30 -2
- data/lib/rails_ai_bridge/serializers/context_file_serializer.rb +59 -16
- data/lib/rails_ai_bridge/serializers/context_summary.rb +331 -0
- data/lib/rails_ai_bridge/serializers/formatters/sections/conventions_formatter.rb +4 -3
- data/lib/rails_ai_bridge/serializers/providers/base_provider_serializer.rb +12 -10
- data/lib/rails_ai_bridge/serializers/providers/claude_rules_serializer.rb +16 -11
- data/lib/rails_ai_bridge/serializers/providers/codex_serializer.rb +3 -2
- data/lib/rails_ai_bridge/serializers/providers/collaborators/rules_model_section_builder.rb +1 -1
- data/lib/rails_ai_bridge/serializers/providers/collaborators/stack_overview_builder.rb +65 -4
- data/lib/rails_ai_bridge/serializers/providers/copilot_serializer.rb +3 -2
- data/lib/rails_ai_bridge/serializers/providers/cursor_rules_serializer.rb +121 -31
- data/lib/rails_ai_bridge/serializers/providers/windsurf_serializer.rb +6 -4
- data/lib/rails_ai_bridge/serializers/shared_assistant_guidance.rb +1 -1
- data/lib/rails_ai_bridge/tools/get_conventions.rb +3 -2
- data/lib/rails_ai_bridge/tools/get_routes.rb +33 -6
- data/lib/rails_ai_bridge/tools/get_view.rb +1 -1
- data/lib/rails_ai_bridge/tools/search_code.rb +3 -2
- data/lib/rails_ai_bridge/version.rb +1 -1
- data/lib/rails_ai_bridge/view_file_analyzer.rb +88 -9
- data/lib/rails_ai_bridge.rb +21 -8
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f1a7f2bdb4fc3a64a5a2647b829a154df6a3c39bc01bcb98e806fb9aaa713c8
|
|
4
|
+
data.tar.gz: 4d6e82d276a1398100767639804da6109cbbd4ec780c7e448d27a84591186874
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b7401347104c6f8871998e485d1c58828b15b5f487bd4ea0cc080cf6d0f953e0d63a0b6a4b1dfa485d84c691b89a9224444c1d0da1761c7bb3f5f365213c427
|
|
7
|
+
data.tar.gz: 0b141263596fc4b10fab84f2dfca832ea0c371c21f1de912097e4a20bbf1b034cb736cd77938b6a507dea0302eb41452308eb4dd9f7fd019a5a57f4d0bd35b2b
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,61 @@ 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
|
+
## [3.1.0] - 2026-05-01
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Task-relevance ordering for compact context** — model lists now rank by semantic tier,
|
|
13
|
+
structural complexity, route density, recent migrations, and optional database-size signals
|
|
14
|
+
instead of relying mostly on alphabetical order.
|
|
15
|
+
- **Endpoint focus summaries** — compact stack/project context now surfaces the busiest route
|
|
16
|
+
targets with direct `rails_get_routes(controller:"...", detail:"summary")` drill-down hints.
|
|
17
|
+
- **Database size buckets** — the optional `database_stats` introspector now annotates PostgreSQL
|
|
18
|
+
approximate row counts as `small`, `medium`, `large`, or `hot`; generated context shows these
|
|
19
|
+
hints only when `database_stats` is explicitly enabled.
|
|
20
|
+
- **Context quality matrix specs** — generated-output acceptance coverage now exercises standard
|
|
21
|
+
CRUD, large-schema, API-only, Hotwire, engine-style, and regulated/no-domain-metadata profiles,
|
|
22
|
+
with real Rails-shaped fixture trees for API-only, Hotwire, large-schema, engine-style, and
|
|
23
|
+
regulated/no-domain-metadata apps plus bounded output and secret-adjacent regression checks.
|
|
24
|
+
- **Serialization benchmark guard** — large-fixture compact serialization now has a small
|
|
25
|
+
performance budget to catch accidental context bloat.
|
|
26
|
+
- **MCP large-payload stability checks** — route/schema tool specs now exercise truncation,
|
|
27
|
+
pagination, next-offset guidance, and section-cache reuse against large payloads.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **Claude rules** — `.claude/rules/rails-context.md` now includes bounded endpoint focus and
|
|
32
|
+
route drill-down guidance; `.claude/rules/rails-schema.md` adds optional size-bucket hints.
|
|
33
|
+
- **Route MCP pagination** — `rails_get_routes` standard/full output now includes a next
|
|
34
|
+
`offset` hint when more route rows are available.
|
|
35
|
+
- **Secret-bearing config paths** — generated context, `rails_get_conventions`, and the
|
|
36
|
+
`rails://conventions` MCP resource now omit dotenv files, Rails credentials files, secret/private
|
|
37
|
+
directories, master keys, and private key material from config-file listings while preserving
|
|
38
|
+
safe operational files such as `config/database.yml`.
|
|
39
|
+
- **Convention detection with custom Rails paths** — architecture and directory-structure signals
|
|
40
|
+
now honor configured Rails paths for directories such as `app/models` and `app/services` while
|
|
41
|
+
keeping generated output on logical names instead of absolute local paths.
|
|
42
|
+
- **Model introspection with custom Rails paths** — ActiveRecord source-derived metadata and
|
|
43
|
+
`non_ar_models` discovery now resolve every configured `app/models` path, so apps that place
|
|
44
|
+
domain models outside the conventional directory still generate useful model context.
|
|
45
|
+
- **Controller and frontend introspection with custom Rails paths** — controller source metadata,
|
|
46
|
+
view summaries, Stimulus controllers, and Turbo frame/stream/broadcast detection now honor
|
|
47
|
+
configured `app/controllers`, `app/views`, `app/helpers`, `app/components`, and
|
|
48
|
+
`app/javascript/controllers` paths where Rails exposes them.
|
|
49
|
+
- **View detail access with custom Rails paths** — `rails_get_view(path:"...")` and
|
|
50
|
+
`rails://views/{path}` now resolve files through configured `app/views` paths while preserving
|
|
51
|
+
traversal protection.
|
|
52
|
+
- **Specialized introspectors with custom Rails paths** — Active Storage, Action Text,
|
|
53
|
+
CurrentAttributes, API serializers/GraphQL/versioning/rate-limit scans, Devise,
|
|
54
|
+
`has_secure_password`, Rails auth, Pundit, and CanCanCan detection now honor configured logical
|
|
55
|
+
Rails paths instead of assuming only conventional `app/*` directories.
|
|
56
|
+
- **Copilot, Codex, Cursor, Windsurf, and shared compact serializers** — key model sections now
|
|
57
|
+
use the same relevance score so assistants see core, routed, recently changed, or hot-domain
|
|
58
|
+
models before lower-signal supporting models.
|
|
59
|
+
- **Generated override guidance** — compact instructions no longer include the literal
|
|
60
|
+
omit-merge marker string unless reading the actual override stub; user-facing docs still explain
|
|
61
|
+
how to activate `config/rails_ai_bridge/overrides.md`.
|
|
62
|
+
|
|
8
63
|
## [3.0.0] - 2026-04-28
|
|
9
64
|
|
|
10
65
|
### Added
|
data/README.md
CHANGED
|
@@ -11,27 +11,42 @@
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## What this gem does
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
AI coding tools are much better when they know your Rails app before they start editing. Without that context, they guess table names, miss routes, ignore conventions, and spend tokens rediscovering structure your app already has.
|
|
17
17
|
|
|
18
|
-
rails-ai-bridge
|
|
18
|
+
rails-ai-bridge turns a Rails app into an AI-readable project map:
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- Less token waste on exploration
|
|
24
|
-
- More predictable, production-ready outputs
|
|
20
|
+
- **Static context files** give assistants an immediate overview of your app, conventions, schema shape, routes, and important models.
|
|
21
|
+
- **A read-only MCP server** lets assistants ask for exact details only when needed, such as one model, one table, one controller, or one route group.
|
|
22
|
+
- **Assistant-specific output** keeps Claude Code, Cursor, Codex, Copilot, Windsurf, Gemini, and JSON consumers aligned without making you hand-write context files.
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
The goal is simple: help AI assistants produce code that fits your Rails app instead of generic Rails code.
|
|
27
25
|
|
|
28
|
-
##
|
|
26
|
+
## Start here
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
Use the README as the shortest path to understanding and setup. Jump to deeper docs only when you need details.
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
| You want to... | Read this first |
|
|
31
|
+
|---|---|
|
|
32
|
+
| Understand the idea in 3 minutes | [How it works](#how-it-works) |
|
|
33
|
+
| Install and generate files | [Quick start](#quick-start) |
|
|
34
|
+
| Check what the AI learns | [What Your AI Learns](#what-your-ai-learns) |
|
|
35
|
+
| Choose `:standard`, `:full`, or opt-ins | [Pick the right preset for your app](#pick-the-right-preset-for-your-app) |
|
|
36
|
+
| Use MCP safely | [MCP Server Setup](#mcp-server-setup) and [mcp-security.md](docs/mcp-security.md) |
|
|
37
|
+
| Improve day-to-day AI results | [Best Practices](docs/BEST_PRACTICES.md) |
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
## When this helps
|
|
40
|
+
|
|
41
|
+
This is useful when you want an AI assistant to work inside a real Rails codebase, especially if the app has:
|
|
42
|
+
|
|
43
|
+
- More than a few models or routes
|
|
44
|
+
- Existing conventions that new code should follow
|
|
45
|
+
- Auth, background jobs, API endpoints, Hotwire, engines, or service objects
|
|
46
|
+
- A team that wants shared AI guidance committed to the repo
|
|
47
|
+
- Large schemas where dumping everything into context would be noisy
|
|
48
|
+
|
|
49
|
+
For tiny apps or one-off scripts, manual context may be enough. For team Rails apps, generated context plus MCP gives the assistant a much better starting point.
|
|
35
50
|
|
|
36
51
|
---
|
|
37
52
|
|
|
@@ -41,25 +56,35 @@ You open Claude Code, Cursor, or Codex and ask it to add a feature. It generates
|
|
|
41
56
|
flowchart LR
|
|
42
57
|
app[Rails_app]
|
|
43
58
|
intro[Introspectors]
|
|
59
|
+
files[Static_context_files]
|
|
44
60
|
mcp[MCP_server]
|
|
45
61
|
clients[AI_clients]
|
|
46
|
-
app --> intro
|
|
62
|
+
app --> intro
|
|
63
|
+
intro --> files
|
|
64
|
+
intro --> mcp
|
|
65
|
+
files --> clients
|
|
66
|
+
mcp --> clients
|
|
47
67
|
```
|
|
48
68
|
|
|
49
|
-
1. **
|
|
50
|
-
2.
|
|
51
|
-
3.
|
|
69
|
+
1. **Introspect**: built-in scanners read your Rails app structure: schema, models, routes, controllers, gems, tests, conventions, and optional full-stack details.
|
|
70
|
+
2. **Generate**: `rails ai:bridge` writes compact, assistant-specific files such as `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, and Copilot instructions.
|
|
71
|
+
3. **Serve**: `rails ai:serve` exposes read-only `rails_*` MCP tools so an assistant can drill into exact details on demand.
|
|
52
72
|
|
|
53
|
-
|
|
73
|
+
This creates two complementary layers:
|
|
54
74
|
|
|
55
|
-
|
|
75
|
+
| Layer | What it does | Why it matters |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| Static files | Give the assistant passive project orientation at session start | Fewer cold starts and fewer generic assumptions |
|
|
78
|
+
| MCP tools | Return exact live details when requested | Less context bloat and fewer schema/route hallucinations |
|
|
56
79
|
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
80
|
+
Compact files are ordered for usefulness: primary domain models, busy endpoints, recently migrated tables, and optional hot-table signals appear before lower-signal supporting details.
|
|
81
|
+
|
|
82
|
+
## Safety model
|
|
83
|
+
|
|
84
|
+
- MCP tools are **read-only**. They inspect Rails structure; they do not write files or mutate the database.
|
|
85
|
+
- `database_stats` is **opt-in** because it queries PostgreSQL table statistics.
|
|
86
|
+
- Generated assistant context avoids credential values and suppresses secret-bearing config paths such as `.env*`, Rails credentials, `master.key`, private key material, and custom `config/secrets` or `config/private` files.
|
|
87
|
+
- HTTP MCP should stay bound to `127.0.0.1` unless you add authentication and network controls. See [docs/mcp-security.md](docs/mcp-security.md).
|
|
63
88
|
|
|
64
89
|
---
|
|
65
90
|
|
|
@@ -114,7 +139,7 @@ Optional: `gem install rails-ai-bridge` installs the gem into your Ruby environm
|
|
|
114
139
|
### Verify the integration in *your* Rails app
|
|
115
140
|
|
|
116
141
|
1. **`bundle install` must finish cleanly** — until it does, `bundle exec rails -T` and `rails ai:serve` (from `.mcp.json`) cannot be verified. Merging this gem to `main` does not fix a broken or incomplete bundle on the host app.
|
|
117
|
-
2. **Regenerate in one shot** — run `rails ai:bridge` (not only a single format) so route/controller summaries stay consistent across `CLAUDE.md`, `.cursor/rules/`, and `.github/instructions/`.
|
|
142
|
+
2. **Regenerate in one shot** — run `rails ai:bridge` (not only a single format) so route/controller summaries and relevance ordering stay consistent across `CLAUDE.md`, `.cursor/rules/`, and `.github/instructions/`.
|
|
118
143
|
3. **Keep team-specific rules** — generated files are snapshots. Use **`config/rails_ai_bridge/overrides.md`** for org-specific constraints (merged only after you **delete the first-line** `<!-- rails-ai-bridge:omit-merge -->` stub). Until then, the gem does not inject placeholder text into Copilot/Codex. See **`overrides.md.example`** for an outline. Alternatively re-merge into generated files after each `rails ai:bridge` (see `.codex/README.md`).
|
|
119
144
|
4. **Tune list sizes** — `RailsAiBridge.configure { |c| c.copilot_compact_model_list_limit = 5 }` (and `codex_compact_model_list_limit`); set `0` to list no model names and point only to MCP.
|
|
120
145
|
5. **Check your readiness** — `rails ai:doctor` prints a 0–100 score and flags anything missing after first install.
|
|
@@ -194,25 +219,25 @@ Each file respects the AI tool's format and size limits. **Commit these files**
|
|
|
194
219
|
|
|
195
220
|
| Category | What's introspected |
|
|
196
221
|
|----------|-------------------|
|
|
197
|
-
| **Database** | Every table, column, index, foreign key, and migration |
|
|
222
|
+
| **Database** | Every table, column, index, foreign key, and migration. Optional PostgreSQL stats add `small` / `medium` / `large` / `hot` table hints. |
|
|
198
223
|
| **Models** | Associations, validations, scopes, enums, callbacks, concerns, macros (`has_secure_password`, `encrypts`, `normalizes`, etc.), **semantic tier** (`core_entity`, `pure_join`, `rich_join`, `supporting`) |
|
|
199
|
-
| **Non-AR Models** | Ruby classes under `app/models` that aren't ActiveRecord, tagged as `[POJO/Service]` (opt
|
|
200
|
-
| **Routing** | Every route with HTTP verbs, paths, controller actions, API namespaces |
|
|
201
|
-
| **Controllers** | Actions, filters, strong params, concerns, API controllers |
|
|
224
|
+
| **Non-AR Models** | Ruby classes under the configured logical `app/models` path that aren't ActiveRecord, tagged as `[POJO/Service]` (included in `:full`, or opt in with `:non_ar_models`) |
|
|
225
|
+
| **Routing** | Every route with HTTP verbs, paths, controller actions, API namespaces, plus compact endpoint-focus summaries for busy controllers |
|
|
226
|
+
| **Controllers** | Actions, filters, strong params, concerns, API controllers; source metadata honors configured controller paths |
|
|
202
227
|
| **Views** | Layouts, templates, partials, helpers, template engines, view components |
|
|
203
|
-
| **Frontend** | Stimulus controllers
|
|
228
|
+
| **Frontend** | Stimulus controllers, views, Turbo Frames/Streams, and broadcasts from configured Rails paths |
|
|
204
229
|
| **Background** | ActiveJob classes, mailers, Action Cable channels |
|
|
205
230
|
| **Gems** | 70+ notable gems categorized (Devise = auth, Sidekiq = jobs, Pundit = authorization, etc.) |
|
|
206
|
-
| **Auth** | Devise modules, Pundit policies, CanCanCan, has_secure_password, CORS, CSP |
|
|
207
|
-
| **API** | Serializers, GraphQL, versioning, rate limiting, API-only mode |
|
|
231
|
+
| **Auth** | Devise modules, Pundit policies, CanCanCan, has_secure_password, Rails auth, CORS, CSP; source scans honor configured Rails paths |
|
|
232
|
+
| **API** | Serializers, GraphQL, versioning, rate limiting, API-only mode; source scans honor configured Rails paths |
|
|
208
233
|
| **Testing** | Framework, factories/fixtures, CI config, coverage, system tests |
|
|
209
|
-
| **Config** | Cache store, session store, middleware, initializers, timezone |
|
|
234
|
+
| **Config** | Cache store, session store, middleware, initializers, timezone, CurrentAttributes from configured model paths |
|
|
210
235
|
| **DevOps** | Puma, Procfile, Docker, deployment tools, asset pipeline |
|
|
211
236
|
| **Architecture** | Service objects, STI, polymorphism, state machines, multi-tenancy, engines |
|
|
212
237
|
|
|
213
238
|
The `:full` preset runs 27 introspectors. The `:standard` preset runs 9 core ones by default.
|
|
214
239
|
|
|
215
|
-
Start with `:standard` for most apps, then selectively enable additional introspectors (like `:
|
|
240
|
+
Start with `:standard` for most apps, then selectively enable additional introspectors (like `:database_stats`) as your use case requires. Use `config.core_models` to tell the generator which models are primary domain entities.
|
|
216
241
|
|
|
217
242
|
This keeps context focused and avoids unnecessary token usage while still allowing deep introspection when needed.
|
|
218
243
|
|
|
@@ -233,7 +258,7 @@ The gem exposes **11 built-in tools** via MCP that AI clients call on-demand (ho
|
|
|
233
258
|
| `rails_get_gems` | Notable gems categorized by function |
|
|
234
259
|
| `rails_get_conventions` | Architecture patterns, directory structure |
|
|
235
260
|
| `rails_search_code` | Ripgrep (or Ruby) search under `Rails.root` with allowlisted extensions, pattern size cap, and optional wall-clock timeout |
|
|
236
|
-
| `rails_get_view` | View layouts, templates, partials; optional per-file detail under `app/views` |
|
|
261
|
+
| `rails_get_view` | View layouts, templates, partials; optional per-file detail under the configured `app/views` path |
|
|
237
262
|
| `rails_get_stimulus` | Stimulus controllers: targets, values, actions, outlets (requires `:stimulus` introspector) |
|
|
238
263
|
|
|
239
264
|
All tools are **read-only** — they never modify your application or database.
|
|
@@ -332,7 +357,7 @@ end
|
|
|
332
357
|
|
|
333
358
|
Clients must send `Authorization: Bearer <token>` when a token is configured.
|
|
334
359
|
|
|
335
|
-
Security note: keep the HTTP transport bound to `127.0.0.1` unless you add your own network and authentication controls. The tools are read-only, but they can still expose sensitive application structure. In **production**, `rails ai:serve_http` and `auto_mount` require a configured MCP token; `auto_mount` also requires `allow_auto_mount_in_production = true`. For operational hardening (tokens, proxies, `require_http_auth`, stdio threat model), see **[docs/mcp-security.md](docs/mcp-security.md)** and **[SECURITY.md](SECURITY.md)**.
|
|
360
|
+
Security note: keep the HTTP transport bound to `127.0.0.1` unless you add your own network and authentication controls. The tools are read-only, but they can still expose sensitive application structure. Generated context and the built-in conventions resource filter secret-bearing config paths, but MCP access should still be treated as internal. In **production**, `rails ai:serve_http` and `auto_mount` require a configured MCP token; `auto_mount` also requires `allow_auto_mount_in_production = true`. For operational hardening (tokens, proxies, `require_http_auth`, stdio threat model), see **[docs/mcp-security.md](docs/mcp-security.md)** and **[SECURITY.md](SECURITY.md)**.
|
|
336
361
|
</details>
|
|
337
362
|
|
|
338
363
|
---
|
|
@@ -350,68 +375,21 @@ Codex support is centered on **`AGENTS.md`** at the repository root.
|
|
|
350
375
|
|
|
351
376
|
## Best Practices
|
|
352
377
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
After testing with Cursor, Windsurf, Copilot, Codex, and Claude Code in real projects, these patterns consistently produce the best results.
|
|
356
|
-
|
|
357
|
-
### Layer 1: Commit your static files
|
|
378
|
+
The shortest path to good results:
|
|
358
379
|
|
|
359
|
-
|
|
380
|
+
1. **Commit generated static files** so every teammate gets the same passive AI context.
|
|
381
|
+
2. **Run MCP when doing real implementation work** so assistants can drill into current schema, routes, models, controllers, and views.
|
|
382
|
+
3. **Regenerate after meaningful app changes** so static files do not drift from the code.
|
|
383
|
+
4. **Start MCP calls with `detail: "summary"`** and drill into one table, model, route group, or controller only when needed.
|
|
384
|
+
5. **Put team-specific rules in `config/rails_ai_bridge/overrides.md`** instead of hand-editing generated files.
|
|
360
385
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
### Layer 2: Run the MCP server
|
|
364
|
-
|
|
365
|
-
Static files cover overview. The MCP server covers depth. When an assistant needs full schema details, specific model associations, or a filtered route listing, the `rails_*` tools fetch live data on demand — without inflating your initial context window.
|
|
366
|
-
|
|
367
|
-
The combination is additive:
|
|
368
|
-
|
|
369
|
-
| Setup | What you get |
|
|
370
|
-
|-------|-------------|
|
|
371
|
-
| Static files only | Passive overview: project structure always loaded |
|
|
372
|
-
| MCP server only | On-demand depth: accurate live data, no passive grounding |
|
|
373
|
-
| **Both (recommended)** | **Passive overview + on-demand depth = best coverage** |
|
|
374
|
-
|
|
375
|
-
This is the pattern that consistently outperforms either layer alone. The files reduce orientation overhead; the server handles the details when the assistant actually needs them.
|
|
376
|
-
|
|
377
|
-
### Keep files fresh — regenerate after every significant change
|
|
378
|
-
|
|
379
|
-
Static files are snapshots. An assistant working from a schema that is 20 commits out of date will still make assumptions based on the old structure. After any significant change — a new model, a migration, a refactor, a feature merged — run:
|
|
386
|
+
Static files are snapshots. After a new model, migration, route change, significant refactor, or feature merge, run:
|
|
380
387
|
|
|
381
388
|
```bash
|
|
382
389
|
rails ai:bridge
|
|
383
390
|
```
|
|
384
391
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
#### Auto-regeneration during active development
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
rails ai:watch
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
Watches for file changes and regenerates relevant context files automatically. Useful when you are actively adding models, routes, or controllers and want the assistant to track along in the same session.
|
|
394
|
-
|
|
395
|
-
By default `rails ai:watch` regenerates all formats. To limit regeneration to only the formats you actively use:
|
|
396
|
-
|
|
397
|
-
```ruby
|
|
398
|
-
# config/initializers/rails_ai_bridge.rb
|
|
399
|
-
RailsAiBridge.configure do |config|
|
|
400
|
-
config.watcher_formats = %i[claude cursor] # only CLAUDE.md + .cursorrules on change
|
|
401
|
-
end
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
### Use `detail: "summary"` first with the MCP server
|
|
405
|
-
|
|
406
|
-
When the MCP server is running, start broad and drill down:
|
|
407
|
-
|
|
408
|
-
```
|
|
409
|
-
1. rails_get_schema(detail: "summary") → all tables, no noise
|
|
410
|
-
2. rails_get_schema(table: "orders") → full detail for one table
|
|
411
|
-
3. rails_get_model_details(model: "Order") → associations, validations, scopes
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
This keeps token usage low and answer quality high. Requesting full detail on every table at once is rarely necessary and wastes context on data the assistant does not need yet.
|
|
392
|
+
For the full guide to client compatibility, token usage, overrides, staleness, and per-assistant workflow tips, read [docs/BEST_PRACTICES.md](docs/BEST_PRACTICES.md).
|
|
415
393
|
|
|
416
394
|
### Pick the right preset for your app
|
|
417
395
|
|
|
@@ -427,6 +405,14 @@ config.preset = :standard
|
|
|
427
405
|
config.introspectors += %i[non_ar_models views auth api]
|
|
428
406
|
```
|
|
429
407
|
|
|
408
|
+
For PostgreSQL apps where row-volume context matters, opt into safe approximate table-size hints:
|
|
409
|
+
|
|
410
|
+
```ruby
|
|
411
|
+
config.introspectors += %i[database_stats]
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
This adds `small`, `medium`, `large`, or `hot` hints to generated context without exposing row data.
|
|
415
|
+
|
|
430
416
|
### Check your readiness score
|
|
431
417
|
|
|
432
418
|
```bash
|
|
@@ -442,11 +428,11 @@ Prints a 0–100 AI readiness score and flags anything missing: `.mcp.json`, gen
|
|
|
442
428
|
```ruby
|
|
443
429
|
# config/initializers/rails_ai_bridge.rb
|
|
444
430
|
RailsAiBridge.configure do |config|
|
|
445
|
-
# Presets: :standard (9 introspectors, default) or :full (27). Add
|
|
431
|
+
# Presets: :standard (9 introspectors, default) or :full (27). Add opt-in extras as needed.
|
|
446
432
|
config.preset = :standard
|
|
447
433
|
|
|
448
434
|
# Cherry-pick on top of a preset
|
|
449
|
-
# config.introspectors += %i[non_ar_models views turbo auth api]
|
|
435
|
+
# config.introspectors += %i[non_ar_models views turbo auth api database_stats]
|
|
450
436
|
|
|
451
437
|
# Context mode: :compact (≤150 lines, default) or :full (dump everything)
|
|
452
438
|
# config.context_mode = :compact
|
|
@@ -603,16 +589,17 @@ The gem parses `db/schema.rb` as text when no database is connected. Works in CI
|
|
|
603
589
|
|
|
604
590
|
## Documentation
|
|
605
591
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
|
609
|
-
|
|
610
|
-
|
|
|
611
|
-
| [
|
|
612
|
-
| [
|
|
613
|
-
| [
|
|
614
|
-
| [
|
|
615
|
-
| [
|
|
592
|
+
The docs are layered so new users do not need to read everything at once.
|
|
593
|
+
|
|
594
|
+
| If you need... | Start here |
|
|
595
|
+
|---|---|
|
|
596
|
+
| A quick install and mental model | This README |
|
|
597
|
+
| How to get better AI output day to day | [docs/BEST_PRACTICES.md](docs/BEST_PRACTICES.md) |
|
|
598
|
+
| Every command, config option, generated file, and MCP parameter | [docs/GUIDE.md](docs/GUIDE.md) |
|
|
599
|
+
| HTTP MCP hardening and production safety | [docs/mcp-security.md](docs/mcp-security.md) and [SECURITY.md](SECURITY.md) |
|
|
600
|
+
| Upgrade notes between major versions | [UPGRADING.md](UPGRADING.md) |
|
|
601
|
+
| Release history | [CHANGELOG.md](CHANGELOG.md) |
|
|
602
|
+
| Development and contribution workflow | [CONTRIBUTING.md](CONTRIBUTING.md) |
|
|
616
603
|
|
|
617
604
|
---
|
|
618
605
|
|
|
@@ -627,11 +614,20 @@ bundle exec rubocop # lint
|
|
|
627
614
|
|
|
628
615
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide: adding introspectors, adding MCP tools, code style rules, PR process, and the maintainer release checklist.
|
|
629
616
|
|
|
617
|
+
For contributors, key folders include local guides:
|
|
618
|
+
|
|
619
|
+
- [`lib/rails_ai_bridge/README.md`](lib/rails_ai_bridge/README.md)
|
|
620
|
+
- [`lib/rails_ai_bridge/introspectors/README.md`](lib/rails_ai_bridge/introspectors/README.md)
|
|
621
|
+
- [`lib/rails_ai_bridge/tools/README.md`](lib/rails_ai_bridge/tools/README.md)
|
|
622
|
+
- [`lib/rails_ai_bridge/serializers/README.md`](lib/rails_ai_bridge/serializers/README.md)
|
|
623
|
+
- [`lib/generators/rails_ai_bridge/README.md`](lib/generators/rails_ai_bridge/README.md)
|
|
624
|
+
- [`spec/lib/rails_ai_bridge/README.md`](spec/lib/rails_ai_bridge/README.md)
|
|
625
|
+
|
|
630
626
|
Bug reports and pull requests: [github.com/igmarin/rails-ai-bridge/issues](https://github.com/igmarin/rails-ai-bridge/issues)
|
|
631
627
|
|
|
632
628
|
## Acknowledgments & Origins
|
|
633
629
|
|
|
634
|
-
This gem ships as **rails-ai-bridge** (Ruby **`RailsAiBridge`**, version **3.
|
|
630
|
+
This gem ships as **rails-ai-bridge** (Ruby **`RailsAiBridge`**, version **3.1.0**). Earlier iterations of the same codebase were distributed as `rails-ai-context`.
|
|
635
631
|
|
|
636
632
|
RailsMCP evolved from
|
|
637
633
|
[crisnahine/rails-ai-context](https://github.com/crisnahine/rails-ai-context),
|
data/docs/BEST_PRACTICES.md
CHANGED
|
@@ -17,6 +17,7 @@ This document consolidates the patterns that consistently produce the best resul
|
|
|
17
17
|
- [Per-Assistant Workflow Tips](#per-assistant-workflow-tips)
|
|
18
18
|
- [MCP Drill-Down Workflow](#mcp-drill-down-workflow)
|
|
19
19
|
- [Choosing the Right Preset](#choosing-the-right-preset)
|
|
20
|
+
- [Reading the Generated Context](#reading-the-generated-context)
|
|
20
21
|
- [What to Commit and What to Ignore](#what-to-commit-and-what-to-ignore)
|
|
21
22
|
|
|
22
23
|
---
|
|
@@ -299,6 +300,25 @@ config.introspectors += %i[views auth api tests]
|
|
|
299
300
|
|
|
300
301
|
The `tests` introspector is particularly valuable — it tells the AI your test framework (RSpec vs Minitest), factory setup (FactoryBot vs fixtures), and CI config. Without it, the AI may generate Minitest assertions in an RSpec project.
|
|
301
302
|
|
|
303
|
+
For large PostgreSQL apps, consider adding `database_stats` when row-volume hints matter:
|
|
304
|
+
|
|
305
|
+
```ruby
|
|
306
|
+
config.introspectors += %i[database_stats]
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
It uses PostgreSQL's approximate table statistics and renders only coarse buckets (`small`, `medium`, `large`, `hot`). Keep it opt-in for regulated apps or environments where table-volume metadata is sensitive.
|
|
310
|
+
|
|
311
|
+
## Reading the Generated Context
|
|
312
|
+
|
|
313
|
+
Compact generated files are ordered for action, not inventory completeness:
|
|
314
|
+
|
|
315
|
+
- Core entities from `config.core_models` are intentionally promoted.
|
|
316
|
+
- Models with more associations, validations, callbacks, scopes, routed endpoints, recent migrations, or optional hot-table signals appear earlier.
|
|
317
|
+
- Endpoint focus highlights busy controllers and points the assistant to `rails_get_routes(controller:"...", detail:"summary")`.
|
|
318
|
+
- Full schema, route, and model details stay behind MCP tools to avoid always-on token bloat.
|
|
319
|
+
|
|
320
|
+
Use this ordering as a starting point, not a replacement for live checks. When a change touches data access, ask the assistant to verify the exact table, route, or model through MCP before editing.
|
|
321
|
+
|
|
302
322
|
---
|
|
303
323
|
|
|
304
324
|
## What to Commit and What to Ignore
|
data/docs/GUIDE.md
CHANGED
|
@@ -134,8 +134,8 @@ end
|
|
|
134
134
|
| File | Purpose | Notes |
|
|
135
135
|
|------|---------|-------|
|
|
136
136
|
| `CLAUDE.md` | Main context file | ≤150 lines in compact mode. Claude Code reads this automatically. |
|
|
137
|
-
| `.claude/rules/rails-context.md` | Semantic layer | App metadata + models grouped by `semantic_tier
|
|
138
|
-
| `.claude/rules/rails-schema.md` | Database table listing | Auto-loaded by Claude Code alongside CLAUDE.md. |
|
|
137
|
+
| `.claude/rules/rails-context.md` | Semantic layer | App metadata + models grouped by `semantic_tier`, ordered by task relevance, plus bounded endpoint focus. In **compact** mode, at most 20 names per tier with an overflow line pointing to `rails_get_model_details`; **full** mode lists all. |
|
|
138
|
+
| `.claude/rules/rails-schema.md` | Database table listing | Auto-loaded by Claude Code alongside CLAUDE.md. Adds coarse table-size buckets when `database_stats` is enabled. |
|
|
139
139
|
| `.claude/rules/rails-models.md` | Model listing with associations | Includes `tier: …` per ActiveRecord model; adds **Non-ActiveRecord classes (POJO/Service)** for plain Ruby classes under `app/models`. |
|
|
140
140
|
| `.claude/rules/rails-mcp-tools.md` | Full MCP tool reference | Parameters, detail levels, pagination, workflow guide. |
|
|
141
141
|
|
|
@@ -145,8 +145,8 @@ end
|
|
|
145
145
|
|------|---------|-------|
|
|
146
146
|
| `.cursorrules` | Legacy context file | Compact mode: engineering rules + stack + MCP (aligned with Copilot order). |
|
|
147
147
|
| `.cursor/rules/rails-engineering.mdc` | Engineering essentials | `alwaysApply: true` — strong params, auth, N+1, security; points to overrides + full docs. |
|
|
148
|
-
| `.cursor/rules/rails-project.mdc` | Project overview | `alwaysApply: true` — stack counts, gems (capped), `routes_stack_line`. |
|
|
149
|
-
| `.cursor/rules/rails-models.mdc` | Model reference | `globs: app/models/**/*.rb` — auto-attaches when editing models. |
|
|
148
|
+
| `.cursor/rules/rails-project.mdc` | Project overview | `alwaysApply: true` — stack counts, endpoint focus, gems (capped), `routes_stack_line`. |
|
|
149
|
+
| `.cursor/rules/rails-models.mdc` | Model reference | `globs: app/models/**/*.rb` — auto-attaches when editing models; rows are ordered by task relevance. |
|
|
150
150
|
| `.cursor/rules/rails-controllers.mdc` | Controller reference | `globs: app/controllers/**/*.rb` — auto-attaches when editing controllers. |
|
|
151
151
|
| `.cursor/rules/rails-mcp-tools.mdc` | MCP tool reference | `alwaysApply: true` — always available. |
|
|
152
152
|
|
|
@@ -482,7 +482,7 @@ rails_search_code(pattern: "def create", path: "app/controllers", file_type: "rb
|
|
|
482
482
|
|
|
483
483
|
View-layer context: layouts, templates, partials, helpers, components. Requires the `:views` introspector (included in the `:full` preset, or add `config.introspectors << :views`).
|
|
484
484
|
|
|
485
|
-
**Parameters:** optional `path` (file under `app/views`), `controller`, `partial`, and `detail` (`summary` / `standard` / `full`).
|
|
485
|
+
**Parameters:** optional `path` (file under the configured logical `app/views` path), `controller`, `partial`, and `detail` (`summary` / `standard` / `full`).
|
|
486
486
|
|
|
487
487
|
### rails_get_stimulus
|
|
488
488
|
|
|
@@ -523,7 +523,7 @@ In addition to tools, the gem registers static MCP resources that AI clients can
|
|
|
523
523
|
| `rails://tests` | Test infrastructure details (JSON) |
|
|
524
524
|
| `rails://migrations` | Migration history and statistics (JSON) |
|
|
525
525
|
| `rails://engines` | Mounted engines with paths and descriptions (JSON) |
|
|
526
|
-
| `rails://views` | View-layer summary (JSON); template `rails://views/{path}` |
|
|
526
|
+
| `rails://views` | View-layer summary (JSON); template `rails://views/{path}` resolves through the configured logical `app/views` path |
|
|
527
527
|
| `rails://stimulus` | Stimulus summary (JSON); template `rails://stimulus/{name}` |
|
|
528
528
|
| `rails://models/{name}` | Per-model details (resource template) |
|
|
529
529
|
|
|
@@ -748,27 +748,28 @@ These run by default. Fast and cover core Rails structure.
|
|
|
748
748
|
| `jobs` | ActiveJob classes with queue names. Mailers with action methods. Action Cable channels. |
|
|
749
749
|
| `gems` | 70+ notable gems categorized: auth, background_jobs, admin, monitoring, search, pagination, forms, file_upload, testing, linting, security, api, frontend, utilities. |
|
|
750
750
|
| `conventions` | Architecture patterns (MVC, service objects, STI, polymorphism, etc.), directory structure with file counts, config files, detected patterns. |
|
|
751
|
-
| `controllers` | Actions, filters (before/after/around with only/except), strong params methods, parent class, API controller detection, concerns. |
|
|
751
|
+
| `controllers` | Actions, filters (before/after/around with only/except), strong params methods, parent class, API controller detection, concerns. Source-derived metadata honors the configured logical `app/controllers` path. |
|
|
752
752
|
| `tests` | Test framework (rspec/minitest), factories/fixtures with locations and counts, system tests, CI config files, coverage tool, test helpers, VCR cassettes. |
|
|
753
753
|
| `migrations` | Total count, schema version, pending migrations, recent migration history with detected actions (create_table, add_column, etc.), migration statistics. |
|
|
754
754
|
|
|
755
|
-
**
|
|
755
|
+
**Standard opt-in:** `non_ar_models` — Ruby classes under the configured logical `app/models` Rails path that are not subclasses of `ActiveRecord::Base`, tagged **`[POJO/Service]`** in `rails_get_model_details` listings and Claude `rails-models.md`. Included in `:full`; add it manually when staying on `:standard`. Uses `Object.const_source_location` after eager load and reports stable logical paths instead of absolute custom directories.
|
|
756
756
|
|
|
757
|
-
### Full preset (
|
|
757
|
+
### Full preset (27 introspectors)
|
|
758
758
|
|
|
759
759
|
Includes all standard introspectors plus:
|
|
760
760
|
|
|
761
761
|
| Introspector | What it discovers |
|
|
762
762
|
|-------------|-------------------|
|
|
763
|
-
| `
|
|
764
|
-
| `
|
|
765
|
-
| `
|
|
763
|
+
| `non_ar_models` | Ruby classes under the configured logical `app/models` path that are not subclasses of `ActiveRecord::Base`, tagged **`[POJO/Service]`** in model listings. |
|
|
764
|
+
| `stimulus` | Stimulus controllers with targets, values (with types), actions, outlets, classes. Extracted from JS/TS files under the configured logical `app/javascript/controllers` path. |
|
|
765
|
+
| `views` | Layouts, templates grouped by controller, partials (per-controller and shared), helpers with methods, template engines (erb, haml, slim), view components. Honors configured logical `app/views`, `app/helpers`, and `app/components` paths. |
|
|
766
|
+
| `turbo` | Turbo Frames (IDs and files), Turbo Stream templates, model broadcasts (`broadcasts_to`, `broadcasts`). Honors configured logical `app/views` and `app/models` paths. |
|
|
766
767
|
| `i18n` | Default locale, available locales, locale files with key counts, backend class, parse errors. |
|
|
767
|
-
| `config` | Cache store, session store, timezone, middleware stack, initializers, credentials keys, CurrentAttributes classes. |
|
|
768
|
-
| `active_storage` | Attachments (has_one_attached, has_many_attached per model), storage services, direct upload config. |
|
|
769
|
-
| `action_text` | Rich text fields (has_rich_text per model), Action Text installation status. |
|
|
770
|
-
| `auth` | Devise models with modules, Rails 8 built-in auth, has_secure_password, Pundit policies, CanCanCan, CORS config, CSP config. |
|
|
771
|
-
| `api` | API-only mode, API versioning (from directory structure), serializers (Jbuilder, AMS, etc.), GraphQL (types, mutations), rate limiting (Rack::Attack). |
|
|
768
|
+
| `config` | Cache store, session store, timezone, middleware stack, initializers, credentials keys, CurrentAttributes classes from the configured logical `app/models` path. |
|
|
769
|
+
| `active_storage` | Attachments (has_one_attached, has_many_attached per model), storage services, direct upload config. Attachment and direct-upload scans honor configured `app/models`, `app/views`, and `app/javascript` paths. |
|
|
770
|
+
| `action_text` | Rich text fields (has_rich_text per model), Action Text installation status. Model scans honor the configured logical `app/models` path. |
|
|
771
|
+
| `auth` | Devise models with modules, Rails 8 built-in auth, has_secure_password, Pundit policies, CanCanCan, CORS config, CSP config. Model and policy scans honor configured `app/models` and `app/policies` paths. |
|
|
772
|
+
| `api` | API-only mode, API versioning (from directory structure), serializers (Jbuilder, AMS, etc.), GraphQL (types, mutations), rate limiting (Rack::Attack). View, serializer, GraphQL, and controller scans honor configured Rails paths. |
|
|
772
773
|
| `rake_tasks` | Custom rake tasks in `lib/tasks/` with names, descriptions, namespaces, file paths. |
|
|
773
774
|
| `assets` | Asset pipeline (Propshaft/Sprockets), JS bundler (importmap/esbuild/webpack/vite), CSS framework, importmap pins, manifest files. |
|
|
774
775
|
| `devops` | Puma config (threads, workers, port), Procfile entries, Docker (multi-stage detection), deployment tools, health check routes. |
|
|
@@ -777,7 +778,7 @@ Includes all standard introspectors plus:
|
|
|
777
778
|
| `middleware` | Custom Rack middleware in app/middleware/ with detected patterns (auth, rate limiting, tenant isolation, logging). Full middleware stack. |
|
|
778
779
|
| `engines` | Mounted Rails engines from routes.rb with paths and descriptions for 23+ known engines (Sidekiq::Web, Flipper::UI, PgHero, ActiveAdmin, etc.). |
|
|
779
780
|
| `multi_database` | Multiple databases, replicas, sharding config, model-specific `connects_to` declarations. database.yml parsing fallback. |
|
|
780
|
-
| `database_stats` | PostgreSQL approximate row counts via `pg_stat_user_tables`. Opt-in, requires PostgreSQL. |
|
|
781
|
+
| `database_stats` | PostgreSQL approximate row counts via `pg_stat_user_tables`, bucketed as `small`, `medium`, `large`, or `hot`. Opt-in only, requires PostgreSQL. |
|
|
781
782
|
|
|
782
783
|
### Enabling the full preset
|
|
783
784
|
|
|
@@ -938,6 +939,7 @@ Works in:
|
|
|
938
939
|
- Code search uses `Open3.capture2` with array arguments — **no shell injection**
|
|
939
940
|
- File paths are validated against **path traversal** attacks
|
|
940
941
|
- Credentials and secret values are **never exposed** — only key names are introspected (unless you opt in with `expose_credentials_key_names`)
|
|
942
|
+
- Generated config-file listings and the `rails://conventions` MCP resource omit secret-bearing paths such as `.env*`, Rails credentials files, secret/private directories, `master.key`, and private key material
|
|
941
943
|
- The gem makes **no outbound network requests**
|
|
942
944
|
- File type validation prevents arbitrary file access in code search
|
|
943
945
|
- `max_results` is capped at 100 to prevent resource exhaustion; `pattern` length is capped (`search_code_pattern_max_bytes`); optional per-invocation timeout (`search_code_timeout_seconds`)
|
|
@@ -14,10 +14,69 @@ This track is **separate** from [roadmap-mcp-v2.md](roadmap-mcp-v2.md) (MCP HTTP
|
|
|
14
14
|
- DRY the formatter hierarchy (done: `SectionFormatter` template method base).
|
|
15
15
|
- Align tool references and workflow hints across Claude, Cursor, Copilot, Windsurf, Codex, and **Gemini** (v2.1.0).
|
|
16
16
|
- Refactor provider serializers with a shared `BaseProviderSerializer` for consistent, high-fidelity output (v2.1.0).
|
|
17
|
+
- Rank compact context by task relevance: semantic tier, structural complexity, endpoint density, recent migrations, and optional database-size hints (v3.1.0).
|
|
18
|
+
- Add bounded endpoint-focus summaries and context-quality fixture matrix coverage for common Rails app shapes (v3.1.0).
|
|
19
|
+
- Back the matrix with real Rails-shaped fixture trees for API-only, Hotwire, large-schema, engine-style, and regulated/no-domain-metadata applications (v3.1.0).
|
|
20
|
+
- Add MCP large-payload stability checks for truncation, pagination hints, and section-cache reuse (v3.1.0).
|
|
21
|
+
- Filter secret-bearing config paths from generated context, `rails_get_conventions`, and `rails://conventions` output (v3.1.0).
|
|
22
|
+
- Honor configured Rails paths in convention detection so custom `app/models` and `app/services`
|
|
23
|
+
locations still produce useful architecture and directory-structure context without exposing absolute paths (v3.1.0).
|
|
24
|
+
- Honor configured `app/models` paths in ActiveRecord source metadata and `non_ar_models`
|
|
25
|
+
discovery, mapping custom filesystem locations back to stable logical paths in generated context (v3.1.0).
|
|
26
|
+
- Honor configured controller and frontend paths in controller metadata, view summaries,
|
|
27
|
+
Stimulus controllers, and Turbo frame/stream/broadcast discovery (v3.1.0).
|
|
28
|
+
- Honor configured `app/views` paths in file-level view detail reads for `rails_get_view(path:)`
|
|
29
|
+
and `rails://views/{path}` while preserving traversal checks (v3.1.0).
|
|
30
|
+
- Honor configured Rails paths in specialized Active Storage, Action Text, Config, Auth, and API
|
|
31
|
+
scans so attachments, rich text fields, CurrentAttributes, API layers, and auth/policy signals
|
|
32
|
+
remain useful in non-conventional app layouts (v3.1.0).
|
|
17
33
|
|
|
18
|
-
##
|
|
34
|
+
## Release closure
|
|
19
35
|
|
|
20
|
-
-
|
|
36
|
+
The v3.1.0 context-quality implementation is complete for the default `:standard` preset and the
|
|
37
|
+
highest-value generated-context signals. Before merging or tagging the release, run the final gate:
|
|
38
|
+
|
|
39
|
+
- `rtk bundle exec rspec`
|
|
40
|
+
- `env PERF=true rtk bundle exec rspec --tag perf`
|
|
41
|
+
- `rtk bundle exec rubocop --cache false --format simple`
|
|
42
|
+
- `rtk bundle exec reek`
|
|
43
|
+
- `rtk bundle exec reek spec/fixtures/apps`
|
|
44
|
+
- `rtk bundle exec yard stats --list-undoc`
|
|
45
|
+
|
|
46
|
+
Any future code-producing slice should continue to apply the `yard-documentation` skill: every new
|
|
47
|
+
or changed public Ruby class/method needs an English summary plus `@param`, `@return`, and `@raise`
|
|
48
|
+
tags where applicable before the slice is considered complete.
|
|
49
|
+
|
|
50
|
+
## Custom Path Support Coverage
|
|
51
|
+
|
|
52
|
+
For **v3.1.0**, custom Rails path support is considered complete for the default `:standard`
|
|
53
|
+
context-quality promise and the highest-value `:full` signals:
|
|
54
|
+
|
|
55
|
+
- **Standard preset coverage:** `models`, `controllers`, and `conventions` honor configured Rails
|
|
56
|
+
paths where those introspectors read application source. `schema`, `routes`, `jobs`, `gems`,
|
|
57
|
+
`tests`, and `migrations` are not primarily driven by `app.paths`.
|
|
58
|
+
- **High-value full-preset coverage:** `non_ar_models`, `views`, `stimulus`, `turbo`,
|
|
59
|
+
`active_storage`, `action_text`, `config`, `auth`, `api`, and file-level view detail reads honor
|
|
60
|
+
configured logical Rails paths where they scan source files.
|
|
61
|
+
- **Deferred parity candidates:** `assets`, `i18n`, `rake_tasks`, `action_mailbox`, `devops`,
|
|
62
|
+
and `middleware` remain full-preset follow-up candidates. Treat these as targeted future work
|
|
63
|
+
when a real fixture or user app shows custom path value, not as a blocker for the 3.1.0 release.
|
|
64
|
+
|
|
65
|
+
## Documentation readability recommendations
|
|
66
|
+
|
|
67
|
+
Because this gem serves Rails developers with different experience levels, documentation should
|
|
68
|
+
prefer a layered path over one large linear read:
|
|
69
|
+
|
|
70
|
+
- **README:** keep as the shortest product path: problem, value, quick start, generated files,
|
|
71
|
+
common presets, and safe MCP setup. Link out before diving into every option.
|
|
72
|
+
- **Best Practices:** make this the "how to get value" guide: choosing a preset, reading generated
|
|
73
|
+
context, writing useful overrides, and avoiding token/security pitfalls.
|
|
74
|
+
- **Guide:** keep exhaustive reference material here: every command, config option, MCP tool, and
|
|
75
|
+
generated file behavior.
|
|
76
|
+
- **Security docs:** keep threat-model and deployment advice out of the README except for clear
|
|
77
|
+
links and short warnings.
|
|
78
|
+
- **Examples:** add small scenario-first examples over time, such as API-only, Hotwire CRUD,
|
|
79
|
+
regulated app, and large-schema CRM. These are easier for new users to follow than option tables.
|
|
21
80
|
|
|
22
81
|
## Relation to versioning
|
|
23
82
|
|