rails-ai-context 4.0.0 → 4.2.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +56 -0
  3. data/CLAUDE.md +12 -7
  4. data/CONTRIBUTING.md +2 -2
  5. data/README.md +21 -11
  6. data/SECURITY.md +3 -1
  7. data/docs/GUIDE.md +7 -6
  8. data/lib/generators/rails_ai_context/install/install_generator.rb +212 -34
  9. data/lib/rails_ai_context/cli/tool_runner.rb +15 -0
  10. data/lib/rails_ai_context/configuration.rb +26 -1
  11. data/lib/rails_ai_context/data/docs/index.json +1082 -0
  12. data/lib/rails_ai_context/introspector.rb +1 -0
  13. data/lib/rails_ai_context/introspectors/api_introspector.rb +47 -1
  14. data/lib/rails_ai_context/introspectors/auth_introspector.rb +63 -1
  15. data/lib/rails_ai_context/introspectors/frontend_framework_introspector.rb +426 -0
  16. data/lib/rails_ai_context/introspectors/gem_introspector.rb +6 -0
  17. data/lib/rails_ai_context/introspectors/schema_introspector.rb +2 -0
  18. data/lib/rails_ai_context/introspectors/turbo_introspector.rb +77 -1
  19. data/lib/rails_ai_context/serializers/stack_overview_helper.rb +8 -0
  20. data/lib/rails_ai_context/serializers/tool_guide_helper.rb +24 -6
  21. data/lib/rails_ai_context/server.rb +5 -1
  22. data/lib/rails_ai_context/tasks/rails_ai_context.rake +33 -0
  23. data/lib/rails_ai_context/tools/analyze_feature.rb +9 -7
  24. data/lib/rails_ai_context/tools/get_component_catalog.rb +6 -1
  25. data/lib/rails_ai_context/tools/get_context.rb +18 -6
  26. data/lib/rails_ai_context/tools/get_edit_context.rb +10 -1
  27. data/lib/rails_ai_context/tools/get_frontend_stack.rb +160 -0
  28. data/lib/rails_ai_context/tools/get_stimulus.rb +2 -2
  29. data/lib/rails_ai_context/tools/get_view.rb +3 -1
  30. data/lib/rails_ai_context/tools/migration_advisor.rb +16 -2
  31. data/lib/rails_ai_context/tools/performance_check.rb +11 -0
  32. data/lib/rails_ai_context/tools/query.rb +315 -0
  33. data/lib/rails_ai_context/tools/read_logs.rb +272 -0
  34. data/lib/rails_ai_context/tools/search_code.rb +6 -0
  35. data/lib/rails_ai_context/tools/search_docs.rb +237 -0
  36. data/lib/rails_ai_context/tools/validate.rb +3 -0
  37. data/lib/rails_ai_context/version.rb +1 -1
  38. metadata +10 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4dfcbb5d44af0ed1defb25731f71a4777f9e0905dd662f0e7fa3ff83a870f02
4
- data.tar.gz: 8321f5166e78daa800a68c34f05b4b30eb83c6096a43d87916463d4ff7f07ee2
3
+ metadata.gz: f82bdd4a192f2776214a228f36e54c62cc6e5e19ac5351d997ade9e5bbdd1667
4
+ data.tar.gz: 303476c0cf9c43ed4eb4f10df5cdf89c7dba0e5b8858d86a90b984c7cd5ffd0e
5
5
  SHA512:
6
- metadata.gz: e66d58d898c8136321ba0d7bd3e188a446f219746bbb2073f73bf9b270b7e71ff0e776afa568ab91f9abe4343e9957b066384c63d0571d68592643bf740811ea
7
- data.tar.gz: fcfc393aa754c35ee729157322e58fd03d47649ddd4c1e4d68ff8e6f40c4498ab2c9375381c28e10b0016880cf0672ed030de927d432762651b32493e7a64889
6
+ metadata.gz: aacc3fad8dbbced828ff47eece6d37db6baefaf92b5e2ad1fa4a55d18fa720857d284aba325742985dde0e8e83420f3bb45b8cccf6be6e37d8a9b4973f96365a
7
+ data.tar.gz: 8c860fedacf47a88253f732a74298f6e7a0a878631d09d090aff3f017703b930bc4add8909bf33407c4165121e942d15c3abce6befc88ccc9e08b0cb09a9e0bb
data/CHANGELOG.md CHANGED
@@ -5,6 +5,62 @@ 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
+ ## [4.2.0] — 2026-03-26
9
+
10
+ ### Added
11
+ - New `rails_search_docs` tool: bundled topic index with weighted keyword search, on-demand GitHub fetch for Rails documentation
12
+ - New `rails_query` tool: safe read-only SQL queries with defense-in-depth (regex pre-filter + SET TRANSACTION READ ONLY + configurable timeout + row limit + column redaction)
13
+ - New `rails_read_logs` tool: reverse file tail with level filtering (debug/info/warn/error/fatal) and sensitive data redaction
14
+ - New config options: `query_timeout` (default timeout for SQL queries), `query_row_limit` (max rows returned), `query_redacted_columns` (columns to mask in query results), `allow_query_in_production` (safety gate, default false), `log_lines` (default number of log lines to read)
15
+
16
+ ### Changed
17
+ - Tool count: 30 → 33
18
+ - Test count: 893 → 983
19
+
20
+ ## [4.1.0] — 2026-03-29
21
+
22
+ ### Added
23
+ - New `rails_get_frontend_stack` tool: detects React/Vue/Svelte/Angular, Inertia/react-rails mounting, state management, TypeScript config, monorepo layout, package manager
24
+ - New `FrontendFrameworkIntrospector`: parses package.json (JSON.parse with BOM-safe reading), config/vite.json, config/shakapacker.yml, tsconfig.json
25
+ - Frontend framework detection covers patterns 3 (hybrid SPA), 4 (API+SPA), and 7 (Turbo Native)
26
+ - API introspector: OpenAPI/Swagger spec detection, CORS config parsing, API codegen tool detection (openapi-typescript, graphql-codegen, orval)
27
+ - Auth introspector: JWT strategy (devise-jwt, Doorkeeper config), HTTP token auth detection
28
+ - Turbo introspector: Turbo Native detection (turbo_native_app?, native navigation patterns, native conditionals in views)
29
+ - Gem introspector: 6 new notable gems (devise-jwt, rswag-api, rswag-ui, grape-swagger, apipie-rails, hotwire-native-rails)
30
+ - Optional config: `frontend_paths`, `mobile_paths` (auto-detected if nil, user override for edge cases)
31
+ - Install generator: re-install now updates `ai_tools` and `tool_mode` selections, adds missing config sections without removing existing settings
32
+ - Install generator: prompts to remove generated files when AI tools are deselected (per-tool chooser)
33
+ - `rails ai:context:cursor` (and other format tasks) now auto-adds the format to `config.ai_tools`
34
+ - CLI tool_runner: warns on invalid enum values instead of silent fallback
35
+
36
+ ### Fixed
37
+ - `analyze_feature` crash on nil/empty input — now returns helpful prompt
38
+ - `analyze_feature` with nonexistent feature — returns clean "no match" instead of scaffolded empty sections
39
+ - `migration_advisor` crash on empty/invalid action — now validates with "Did you mean?" suggestions
40
+ - `migration_advisor` generates broken SQL with empty table/column — now validates required params
41
+ - `migration_advisor` doesn't normalize table names — "Cook" now auto-resolves to "cooks"
42
+ - `migration_advisor` no duplicate column/index detection — now warns on existing columns, indexes, and FKs
43
+ - `migration_advisor` no nonexistent column detection — now warns on remove/rename/change_type/add_index for missing columns
44
+ - `edit_context` "File not found" with no hint — now suggests full path with "Did you mean?"
45
+ - `performance_check` model filter fails for multi-word models — "BrandProfile" now resolves to "brand_profiles"
46
+ - `performance_check` unknown model silently ignored — now returns "not found" with suggestions
47
+ - `turbo_map` stream filter misses dynamic broadcasts — multi-line call handling + snippet fallback + fuzzy prefix matching
48
+ - `turbo_map` controller filter misses job broadcasts — now includes broadcasts matching filtered subscriptions' streams
49
+ - `security_scan` wrong check name examples — added CHECK_ALIASES mapping (CheckXSS → CheckCrossSiteScripting, sql → CheckSQL, etc.)
50
+ - `search_code` unknown match_type silently ignored — now returns error with valid values
51
+ - `validate` unknown level silently ignored — now returns error with valid values
52
+ - `get_view` no "Did you mean?" on wrong controller — now uses `find_closest_match`
53
+ - `get_context` plural model name ("Cooks") produces mixed output — now normalizes via singularize/classify, fails fast when not found
54
+ - `component_catalog` specific component returns generic "no components" — now acknowledges the input
55
+ - `stimulus` doesn't strip `_controller` suffix — now auto-strips for lookup
56
+ - `controller_introspector_spec` rate_limit test crashes on Rails 7.1 — split into source-parsing test (no class loading)
57
+
58
+ ### Changed
59
+ - Full preset: 31 → 32 introspectors (added :frontend_frameworks)
60
+ - Tool count: 29 → 30
61
+ - Test count: 817 → 893
62
+ - Install generator always writes `config.ai_tools` and `config.tool_mode` uncommented for re-install detection
63
+
8
64
  ## [4.0.0] — 2026-03-26
9
65
 
10
66
  ### Added
data/CLAUDE.md CHANGED
@@ -8,8 +8,8 @@ structure to AI assistants via the Model Context Protocol (MCP).
8
8
  - `lib/rails_ai_context.rb` — Main entry point, public API (Zeitwerk autoloaded)
9
9
  - `lib/rails_ai_context/configuration.rb` — User-facing config with presets (:standard, :full)
10
10
  - `lib/rails_ai_context/introspector.rb` — Orchestrates sub-introspectors
11
- - `lib/rails_ai_context/introspectors/` — 32 introspectors (schema, models, routes, jobs, gems, conventions, stimulus, database_stats, controllers, views, view_templates, design_tokens, turbo, i18n, config, active_storage, action_text, auth, api, tests, rake_tasks, assets, devops, action_mailbox, migrations, seeds, middleware, engines, multi_database, components, accessibility, performance)
12
- - `lib/rails_ai_context/tools/` — 29 MCP tools using the official mcp SDK
11
+ - `lib/rails_ai_context/introspectors/` — 33 introspectors (schema, models, routes, jobs, gems, conventions, stimulus, database_stats, controllers, views, view_templates, design_tokens, turbo, i18n, config, active_storage, action_text, auth, api, tests, rake_tasks, assets, devops, action_mailbox, migrations, seeds, middleware, engines, multi_database, components, accessibility, performance, frontend_frameworks)
12
+ - `lib/rails_ai_context/tools/` — 33 MCP tools using the official mcp SDK
13
13
  - `lib/rails_ai_context/cli/` — CLI tool runner (`tool_runner.rb`) — executes MCP tools from rake/Thor
14
14
  - `lib/rails_ai_context/serializers/` — Output formatters (claude, claude_rules, opencode, opencode_rules, cursor_rules, copilot, copilot_instructions, rules, markdown, JSON, context_file_serializer, test_command_detection, tool_guide_helper, design_system_helper, stack_overview_helper)
15
15
  - `lib/rails_ai_context/resources.rb` — MCP resources (static data AI clients read directly)
@@ -34,28 +34,33 @@ structure to AI assistants via the Model Context Protocol (MCP).
34
34
  7. **Diff-aware** — context regeneration skips unchanged files
35
35
  8. **Per-assistant serializers** — each AI tool gets tailored output format
36
36
  9. **Zeitwerk autoloading** — files loaded on-demand, not all upfront
37
- 10. **Introspector presets** — `:full` (31) default, `:standard` (14 core) for lightweight usage
37
+ 10. **Introspector presets** — `:full` (32) default, `:standard` (14 core) for lightweight usage
38
38
  11. **MCP auto-discovery** — `.mcp.json` generated by install generator
39
39
  12. **Compact by default** — context files ≤150 lines, MCP tools use `detail` parameter (summary/standard/full)
40
40
  13. **Per-tool split rules** — `.claude/rules/`, `.cursor/rules/`, `.github/instructions/`
41
41
  14. **Section markers** — root file content wrapped in `<!-- BEGIN/END rails-ai-context -->` to preserve user content
42
42
  15. **generate_root_files toggle** — when false, skip root files (CLAUDE.md, etc.), only generate split rules
43
- 16. **custom_tools API** — `config.custom_tools` array lets users register additional MCP::Tool subclasses alongside the 29 built-in tools
43
+ 16. **custom_tools API** — `config.custom_tools` array lets users register additional MCP::Tool subclasses alongside the 33 built-in tools
44
44
  17. **Design system extraction** — view templates analyzed for canonical examples, color palette, typography, responsive patterns, interactive states, dark mode
45
45
  18. **skip_tools API** — `config.skip_tools` array lets users exclude specific built-in tools (e.g. `%w[rails_security_scan]`)
46
46
  19. **Security scanning** — optional Brakeman integration via `rails_security_scan` tool (graceful degradation if not installed)
47
47
  20. **tool_mode config** — `:mcp` (default, MCP primary + CLI fallback) or `:cli` (CLI only, no MCP server needed). Selected during install.
48
- 21. **CLI tool access** — all 29 MCP tools callable from terminal: `rails ai:tool[schema]`, `rails-ai-context tool schema`. Tool name resolution: `schema` → `get_schema` → `rails_get_schema`.
48
+ 21. **CLI tool access** — all 33 MCP tools callable from terminal: `rails ai:tool[schema]`, `rails-ai-context tool schema`. Tool name resolution: `schema` → `get_schema` → `rails_get_schema`.
49
49
  22. **Shared ToolGuideHelper** — serializers use a shared module for tool reference sections, rendering MCP or CLI syntax based on `tool_mode`
50
50
  23. **Component catalog** — ViewComponent/Phlex introspection: props, slots, previews, sidecar assets, usage examples via `rails_get_component_catalog`
51
51
  24. **Accessibility scanning** — ARIA attributes, semantic HTML, screen reader text, alt text, landmark roles, accessibility score via AccessibilityIntrospector
52
52
  25. **Performance analysis** — N+1 query risks, missing counter_cache, missing FK indexes, eager load candidates via `rails_performance_check`
53
- 26. **Migration advisor** — migration code generation with reversibility warnings and affected model detection via `rails_migration_advisor`
53
+ 26. **Migration advisor** — migration code generation with duplicate/nonexistent column warnings, reversibility flags, table name normalization via `rails_migration_advisor`
54
+ 27. **Frontend framework detection** — auto-detects React/Vue/Svelte/Angular from package.json, Vite/Shakapacker/Webpacker config, TypeScript setup, monorepo layout, package manager via `rails_get_frontend_stack`
55
+ 28. **Install generator idempotency** — re-install preserves existing config, only adds new sections, updates ai_tools/tool_mode selections, prompts per-tool file cleanup for removed tools
56
+ 29. **Docs search** — bundled topic index with weighted keyword search, on-demand GitHub fetch
57
+ 30. **Safe SQL queries** — defense-in-depth: regex pre-filter + SET TRANSACTION READ ONLY + timeout
58
+ 31. **Log reading** — reverse file tail with level filtering and sensitive data redaction
54
59
 
55
60
  ## Testing
56
61
 
57
62
  ```bash
58
- bundle exec rspec # Run specs (806 examples)
63
+ bundle exec rspec # Run specs (983 examples)
59
64
  bundle exec rubocop # Lint
60
65
  ```
61
66
 
data/CONTRIBUTING.md CHANGED
@@ -19,8 +19,8 @@ The test suite uses [Combustion](https://github.com/pat/combustion) to boot a mi
19
19
  ```
20
20
  lib/rails_ai_context/
21
21
  ├── cli/ # CLI tool runner (tool_runner.rb) — executes MCP tools from rake/Thor
22
- ├── introspectors/ # 32 introspectors (schema, models, routes, etc.)
23
- ├── tools/ # 29 MCP tools with detail levels and pagination
22
+ ├── introspectors/ # 33 introspectors (schema, models, routes, etc.)
23
+ ├── tools/ # 33 MCP tools with detail levels and pagination
24
24
  ├── serializers/ # Per-assistant formatters + shared ToolGuideHelper
25
25
  ├── server.rb # MCP server setup (stdio + HTTP)
26
26
  ├── live_reload.rb # MCP live reload (file watcher + cache invalidation)
data/README.md CHANGED
@@ -3,20 +3,24 @@
3
3
  ### Your AI is guessing. This gem makes it know.
4
4
 
5
5
  [![Gem Version](https://img.shields.io/gem/v/rails-ai-context?color=brightgreen)](https://rubygems.org/gems/rails-ai-context)
6
- [![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-green)](https://registry.modelcontextprotocol.io)
6
+ [![Downloads](https://img.shields.io/gem/dt/rails-ai-context?color=blue)](https://rubygems.org/gems/rails-ai-context)
7
7
  [![CI](https://github.com/crisnahine/rails-ai-context/actions/workflows/ci.yml/badge.svg)](https://github.com/crisnahine/rails-ai-context/actions)
8
+ [![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-green)](https://registry.modelcontextprotocol.io)
9
+ [![Ruby](https://img.shields.io/badge/Ruby-3.2%20%7C%203.3%20%7C%203.4-red)](https://github.com/crisnahine/rails-ai-context)
10
+ [![Rails](https://img.shields.io/badge/Rails-7.1%20%7C%207.2%20%7C%208.0-red)](https://github.com/crisnahine/rails-ai-context)
11
+ [![Tests](https://img.shields.io/badge/Tests-983%20passing-brightgreen)](https://github.com/crisnahine/rails-ai-context/actions)
8
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
9
13
 
10
14
  **Works with:** Claude Code &bull; Cursor &bull; GitHub Copilot &bull; OpenCode &bull; Any terminal
11
15
 
12
- > Built by a Rails developer with 10+ years of production experience. AI assisted — the same way it assists me shipping features at work. I designed the architecture, made every decision, reviewed every line, and wrote 806 tests. This gem exists because I understand Rails deeply enough to know exactly what AI agents get wrong and what context they need to get it right.
16
+ > Built by a Rails developer with 10+ years of production experience. AI assisted — the same way it assists me shipping features at work. I designed the architecture, made every decision, reviewed every line, and wrote 983 tests. This gem exists because I understand Rails deeply enough to know exactly what AI agents get wrong and what context they need to get it right.
13
17
 
14
18
  ```bash
15
19
  gem "rails-ai-context", group: :development
16
20
  rails generate rails_ai_context:install
17
21
  ```
18
22
 
19
- That's it. Your AI now has 29 tools that understand your entire Rails app — via MCP server or CLI. Zero config.
23
+ That's it. Your AI now has 33 tools that understand your entire Rails app — via MCP server or CLI. Zero config.
20
24
 
21
25
  > **[Full Guide →](docs/GUIDE.md)** — every command, every parameter, every configuration option.
22
26
 
@@ -46,7 +50,7 @@ rails 'ai:tool[schema]' table=users
46
50
  rails 'ai:tool[analyze_feature]' feature=billing
47
51
  ```
48
52
 
49
- Same 29 tools. Same output. AI agents run these as shell commands. **Works in any terminal, any AI tool, any workflow.** No MCP client required.
53
+ Same 33 tools. Same output. AI agents run these as shell commands. **Works in any terminal, any AI tool, any workflow.** No MCP client required.
50
54
 
51
55
  ---
52
56
 
@@ -170,7 +174,7 @@ Tested on a real Rails 8 app (5 models, 19 controllers, 95 routes):
170
174
 
171
175
  ---
172
176
 
173
- ## 29 Tools
177
+ ## 33 Tools
174
178
 
175
179
  Every tool is **read-only** and returns structured, token-efficient data.
176
180
 
@@ -214,6 +218,12 @@ Every tool is **read-only** and returns structured, token-efficient data.
214
218
  | `performance_check` | `rails_performance_check` | `rails 'ai:tool[performance_check]'` | N+1 risks, missing indexes, counter_cache, eager load candidates |
215
219
  | `dependency_graph` | `rails_dependency_graph` | `rails 'ai:tool[dependency_graph]'` | Model/service dependency graph in Mermaid or text format |
216
220
  | `migration_advisor` | `rails_migration_advisor` | `rails 'ai:tool[migration_advisor]'` | Migration code generation with reversibility + affected models |
221
+ | **Frontend** | | | |
222
+ | `get_frontend_stack` | `rails_get_frontend_stack` | `rails 'ai:tool[frontend_stack]'` | React/Vue/Svelte/Angular, Inertia, TypeScript, package manager |
223
+ | **Data & Debugging** | | | |
224
+ | `search_docs` | `rails_search_docs(topic:"X")` | `rails 'ai:tool[search_docs]'` | Bundled topic index with weighted keyword search, on-demand GitHub fetch |
225
+ | `query` | `rails_query(sql:"X")` | `rails 'ai:tool[query]'` | Safe read-only SQL queries with timeout, row limit, column redaction |
226
+ | `read_logs` | `rails_read_logs(level:"X")` | `rails 'ai:tool[read_logs]'` | Reverse file tail with level filtering and sensitive data redaction |
217
227
 
218
228
  > **[Full parameter docs →](docs/GUIDE.md)**
219
229
 
@@ -226,7 +236,7 @@ Every tool is **read-only** and returns structured, token-efficient data.
226
236
  │ Your Rails App │
227
237
  │ models + schema + routes + controllers + views + jobs │
228
238
  └────────────────────────┬────────────────────────────────┘
229
- │ introspects (32 introspectors)
239
+ │ introspects (33 introspectors)
230
240
 
231
241
  ┌─────────────────────────────────────────────────────────┐
232
242
  │ rails-ai-context │
@@ -236,7 +246,7 @@ Every tool is **read-only** and returns structured, token-efficient data.
236
246
  ▼ ▼ ▼
237
247
  ┌──────────────────┐ ┌────────────┐ ┌────────────────────┐
238
248
  │ Static Files │ │ MCP Server │ │ CLI Tools │
239
- │ CLAUDE.md │ │ 29 tools │ │ Same 29 tools │
249
+ │ CLAUDE.md │ │ 33 tools │ │ Same 33 tools │
240
250
  │ .cursor/rules/ │ │ stdio/HTTP │ │ No server needed │
241
251
  │ .github/instr... │ │ .mcp.json │ │ rails 'ai:tool[X]' │
242
252
  └──────────────────┘ └────────────┘ └────────────────────┘
@@ -272,7 +282,7 @@ MCP auto-discovery: `.mcp.json` is detected automatically by Claude Code and Cur
272
282
  | Command | What it does |
273
283
  |---------|-------------|
274
284
  | `rails ai:context` | Generate context files for your AI tools |
275
- | `rails 'ai:tool[NAME]'` | Run any of the 29 tools from the CLI |
285
+ | `rails 'ai:tool[NAME]'` | Run any of the 33 tools from the CLI |
276
286
  | `rails ai:tool` | List all available tools with short names |
277
287
  | `rails ai:serve` | Start MCP server (stdio) |
278
288
  | `rails ai:doctor` | Diagnostics + AI readiness score |
@@ -292,7 +302,7 @@ RailsAiContext.configure do |config|
292
302
  # Tool mode: :mcp (default, MCP + CLI fallback) or :cli (CLI only)
293
303
  # config.tool_mode = :mcp
294
304
 
295
- # Presets: :full (31 introspectors, default) or :standard (14 core)
305
+ # Presets: :full (32 introspectors, default) or :standard (14 core)
296
306
  # config.preset = :full
297
307
 
298
308
  # Exclude models from introspection
@@ -310,7 +320,7 @@ end
310
320
  |--------|---------|-------------|
311
321
  | **Presets & Introspectors** | | |
312
322
  | `preset` | `:full` | Introspector preset (`:full` or `:standard`) |
313
- | `introspectors` | 31 (full) | Array of introspector symbols |
323
+ | `introspectors` | 32 (full) | Array of introspector symbols |
314
324
  | **Context Generation** | | |
315
325
  | `context_mode` | `:compact` | `:compact` (≤150 lines) or `:full` (dump everything) |
316
326
  | `claude_max_lines` | `150` | Max lines for CLAUDE.md in compact mode |
@@ -345,7 +355,7 @@ end
345
355
  ```bash
346
356
  git clone https://github.com/crisnahine/rails-ai-context.git
347
357
  cd rails-ai-context && bundle install
348
- bundle exec rspec # 806 examples
358
+ bundle exec rspec # 983 examples
349
359
  bundle exec rubocop # Lint
350
360
  ```
351
361
 
data/SECURITY.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  | Version | Supported |
6
6
  |---------|--------------------|
7
+ | 4.2.x | :white_check_mark: |
8
+ | 4.1.x | :white_check_mark: |
7
9
  | 4.0.x | :white_check_mark: |
8
10
  | 3.1.x | :white_check_mark: |
9
11
  | 3.0.x | :x: |
@@ -24,7 +26,7 @@ If you discover a security vulnerability in rails-ai-context, please report it r
24
26
 
25
27
  ## Security Design
26
28
 
27
- - All 29 MCP tools are **read-only** and never modify your application or database.
29
+ - All 33 MCP tools are **read-only** and never modify your application or database.
28
30
  - **Sensitive file blocking** — configurable `sensitive_patterns` blocks access to `.env`, `*.key`, `*.pem`, `credentials.yml.enc` across all search and read tools. Patterns are checked in `rails_search_code`, `rails_get_edit_context`, and all new tools.
29
31
  - **Path traversal protection** — all file-reading tools validate paths with `File.realpath()` against `Rails.root` to prevent directory escape.
30
32
  - **Command injection prevention** — code search uses `Open3.capture2` with array arguments (never shell strings). The `--` flag separator prevents pattern injection.
data/docs/GUIDE.md CHANGED
@@ -252,7 +252,7 @@ rails ai:context:claude # Use this instead (no quoting needed)
252
252
 
253
253
  ## CLI Tools
254
254
 
255
- All 29 MCP tools can be run directly from the terminal — no MCP server or AI client needed.
255
+ All 33 MCP tools can be run directly from the terminal — no MCP server or AI client needed.
256
256
 
257
257
  ### Rake
258
258
 
@@ -316,7 +316,7 @@ The `tool_mode` is selected during `rails generate rails_ai_context:install`.
316
316
 
317
317
  ## MCP Tools — Full Reference
318
318
 
319
- All 29 tools are **read-only** and **idempotent** — they never modify your application or database.
319
+ All 33 tools are **read-only** and **idempotent** — they never modify your application or database.
320
320
 
321
321
  ### rails_get_schema
322
322
 
@@ -1117,7 +1117,7 @@ RailsAiContext.configure do |config|
1117
1117
  end
1118
1118
  ```
1119
1119
 
1120
- Both transports are **read-only** — they expose the same 29 tools and never modify your app.
1120
+ Both transports are **read-only** — they expose the same 33 tools and never modify your app.
1121
1121
 
1122
1122
  ---
1123
1123
 
@@ -1128,7 +1128,7 @@ Both transports are **read-only** — they expose the same 29 tools and never mo
1128
1128
  RailsAiContext.configure do |config|
1129
1129
  # --- Introspectors ---
1130
1130
 
1131
- # Presets: :full (31 introspectors, default) or :standard (14 core)
1131
+ # Presets: :full (32 introspectors, default) or :standard (14 core)
1132
1132
  config.preset = :full
1133
1133
 
1134
1134
  # Cherry-pick on top of a preset
@@ -1243,7 +1243,7 @@ end
1243
1243
  | Option | Type | Default | Description |
1244
1244
  |--------|------|---------|-------------|
1245
1245
  | `preset` | Symbol | `:full` | Introspector preset (`:full` or `:standard`) |
1246
- | `introspectors` | Array | 28 (full preset) | Which introspectors to run |
1246
+ | `introspectors` | Array | 32 (full preset) | Which introspectors to run |
1247
1247
  | `context_mode` | Symbol | `:compact` | `:compact` or `:full` |
1248
1248
  | `claude_max_lines` | Integer | `150` | Max lines for CLAUDE.md in compact mode |
1249
1249
  | `max_tool_response_chars` | Integer | `200_000` | Safety cap for MCP tool responses |
@@ -1321,7 +1321,7 @@ Core Rails structure only. Use `config.preset = :standard` for a lighter footpri
1321
1321
  | `design_tokens` | Auto-detects CSS framework (Tailwind v3/v4, Bootstrap, Sass, plain CSS) and extracts design tokens from config files and built CSS. |
1322
1322
  | `components` | ViewComponent/Phlex components: props, slots, previews, sidecar assets, usage examples. |
1323
1323
 
1324
- ### Full preset (31 introspectors) — default
1324
+ ### Full preset (32 introspectors) — default
1325
1325
 
1326
1326
  Includes all standard introspectors plus:
1327
1327
 
@@ -1344,6 +1344,7 @@ Includes all standard introspectors plus:
1344
1344
  | `multi_database` | Multiple databases, replicas, sharding config, model-specific `connects_to` declarations. database.yml parsing fallback. |
1345
1345
  | `accessibility` | ARIA attributes, semantic HTML elements, screen reader text, alt text coverage, landmark roles, accessibility score. |
1346
1346
  | `performance` | N+1 query risks, missing counter_cache, missing FK indexes, Model.all anti-patterns, eager load candidates. |
1347
+ | `frontend_frameworks` | Frontend JS framework detection (React/Vue/Svelte/Angular), mounting strategy (Inertia/react-rails), TypeScript config, state management, package manager. |
1347
1348
  | `database_stats` | PostgreSQL approximate row counts via `pg_stat_user_tables`. **Opt-in only** — not in any preset, add manually: `config.introspectors += [:database_stats]`. |
1348
1349
 
1349
1350
  ### Using the standard preset