rails-ai-context 5.13.0 → 5.14.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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -0
  3. data/README.md +10 -10
  4. data/docs/CLI.md +3 -1
  5. data/docs/TOOLS.md +10 -2
  6. data/docs/index.md +1 -1
  7. data/exe/rails-ai-context +159 -118
  8. data/lib/generators/rails_ai_context/install/install_generator.rb +120 -30
  9. data/lib/rails_ai_context/boot_manager.rb +68 -0
  10. data/lib/rails_ai_context/cli/tool_runner.rb +46 -11
  11. data/lib/rails_ai_context/configuration.rb +4 -1
  12. data/lib/rails_ai_context/doctor.rb +39 -24
  13. data/lib/rails_ai_context/facts_formatter.rb +102 -0
  14. data/lib/rails_ai_context/install_mode.rb +39 -0
  15. data/lib/rails_ai_context/introspector.rb +1 -1
  16. data/lib/rails_ai_context/introspectors/controller_introspector.rb +76 -23
  17. data/lib/rails_ai_context/introspectors/convention_introspector.rb +9 -2
  18. data/lib/rails_ai_context/introspectors/database_stats_introspector.rb +6 -1
  19. data/lib/rails_ai_context/introspectors/gem_introspector.rb +1 -0
  20. data/lib/rails_ai_context/introspectors/migration_introspector.rb +7 -20
  21. data/lib/rails_ai_context/introspectors/route_introspector.rb +4 -1
  22. data/lib/rails_ai_context/introspectors/schema_introspector.rb +4 -6
  23. data/lib/rails_ai_context/introspectors/view_template_introspector.rb +14 -0
  24. data/lib/rails_ai_context/mcp_config_generator.rb +18 -6
  25. data/lib/rails_ai_context/middleware.rb +1 -1
  26. data/lib/rails_ai_context/migration_status.rb +53 -0
  27. data/lib/rails_ai_context/output_guard.rb +48 -0
  28. data/lib/rails_ai_context/presets.rb +46 -0
  29. data/lib/rails_ai_context/resources.rb +5 -2
  30. data/lib/rails_ai_context/schema_version.rb +53 -0
  31. data/lib/rails_ai_context/serializers/claude_rules_serializer.rb +16 -1
  32. data/lib/rails_ai_context/serializers/stack_overview_helper.rb +1 -1
  33. data/lib/rails_ai_context/serializers/tool_guide_helper.rb +80 -14
  34. data/lib/rails_ai_context/server.rb +14 -0
  35. data/lib/rails_ai_context/tasks/rails_ai_context.rake +55 -103
  36. data/lib/rails_ai_context/tools/analyze_feature.rb +42 -22
  37. data/lib/rails_ai_context/tools/base_tool.rb +57 -3
  38. data/lib/rails_ai_context/tools/diagnose.rb +79 -0
  39. data/lib/rails_ai_context/tools/generate_test.rb +530 -126
  40. data/lib/rails_ai_context/tools/get_api.rb +200 -0
  41. data/lib/rails_ai_context/tools/get_config.rb +38 -11
  42. data/lib/rails_ai_context/tools/get_context.rb +58 -20
  43. data/lib/rails_ai_context/tools/get_conventions.rb +72 -17
  44. data/lib/rails_ai_context/tools/get_frontend_stack.rb +56 -16
  45. data/lib/rails_ai_context/tools/get_gems.rb +20 -2
  46. data/lib/rails_ai_context/tools/get_job_pattern.rb +28 -4
  47. data/lib/rails_ai_context/tools/get_model_details.rb +1 -1
  48. data/lib/rails_ai_context/tools/get_partial_interface.rb +13 -2
  49. data/lib/rails_ai_context/tools/get_routes.rb +13 -17
  50. data/lib/rails_ai_context/tools/get_schema.rb +4 -4
  51. data/lib/rails_ai_context/tools/get_test_info.rb +1 -1
  52. data/lib/rails_ai_context/tools/get_turbo_map.rb +20 -0
  53. data/lib/rails_ai_context/tools/get_view.rb +9 -1
  54. data/lib/rails_ai_context/tools/migration_advisor.rb +46 -11
  55. data/lib/rails_ai_context/tools/onboard.rb +67 -29
  56. data/lib/rails_ai_context/tools/performance_check.rb +10 -1
  57. data/lib/rails_ai_context/tools/query.rb +40 -10
  58. data/lib/rails_ai_context/tools/review_changes.rb +14 -12
  59. data/lib/rails_ai_context/tools/runtime_info.rb +20 -13
  60. data/lib/rails_ai_context/tools/safe_call.rb +33 -0
  61. data/lib/rails_ai_context/tools/search_code.rb +35 -16
  62. data/lib/rails_ai_context/tools/validate.rb +5 -0
  63. data/lib/rails_ai_context/version.rb +1 -1
  64. data/lib/rails_ai_context/vfs.rb +28 -15
  65. data/lib/rails_ai_context.rb +12 -0
  66. metadata +12 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3747460b78ef9b52d5e2d4bbe59e348599499285fb0215a97ce029ad49b27aa0
4
- data.tar.gz: 2f0fff5d8986ca5ead4d74933dac2c7933d2ca7bd7dd1cab11fc3c4c5c756106
3
+ metadata.gz: ab9892f397e65d076b20e20f7a01da83cd70b1bfb2a2d71fe9949e09616d7bdb
4
+ data.tar.gz: 3f5021a82283731cc7ea915bfbab0b11f06950d5bbc9fd9b656ca70fe43d6cc9
5
5
  SHA512:
6
- metadata.gz: b343b7456a8f26c0738ebf3ca19b50758f54e859d82b3c40dba97765bde151f429f7da7b6d7a9abba2ac35438faaa858686c306e4f99482e2fc5a0b8692a7055
7
- data.tar.gz: b18a15e6fcb931bc9ae34c340c8c3c2481092273e7c0d1ca3d63da3b40282f2a18988656a96588c2e80ea271ab2f4ebc224124b7872328663eb5bc63da93ea0f
6
+ metadata.gz: e5f33eee0cbaedf8d21d6983e8672b72de97f58baab5a4c12ced685389d8e78b103f3f55974ba30a9d786e200ee5609ef3930a156614e502caafe80a56222e77
7
+ data.tar.gz: bcb99dcf463633f7762636ee7a75b247fde3e2438e2eddfb76e977014d84bb2ab65bc6f88d0df6932f5e16adfa3d533712bab8f36fa96f45bd442b990cd7f448
data/CHANGELOG.md CHANGED
@@ -5,6 +5,68 @@ 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.14.0] - 2026-07-11
9
+
10
+ ### Added
11
+
12
+ - **New `rails_get_api` tool (CLI: `api`)** exposing the API-layer introspection that was previously invisible on demand: API-only mode, serialization strategy (Jbuilder templates, serializer classes), GraphQL, versioning, rate limiting, OpenAPI specs, CORS, and pagination. On API-only apps the API layer was the least-served layer while six view tools returned nothing; this closes that gap. Tool count is now 39.
13
+ - **`doctor --strict`** exits 1 when any check fails, giving CI a real gate. Default behavior is unchanged: doctor is a readiness report and exits 0.
14
+ - **`rails_generate_test` scaffolds tests that pass out of the box.** Generated controller tests use the app's real routes, fixtures, and strong params; destroy tests create a fresh record instead of deleting a fixture row other fixtures hold foreign keys on; create/update params mutate values for columns backed by a unique index (a fixture's own value would collide). Verified by running the generated tests for real on scaffold HTML and API-only JSON controllers.
15
+
16
+ ### Added - Boot resilience
17
+
18
+ - **Friendly boot-failure diagnostics.** Every CLI command (`tool`, `doctor`, `serve`, `context`, etc.) now boots the host app through `BootManager`, which catches `StandardError` and `ScriptError` alike. When the app can't boot -- a missing ENV var, an unreachable database or Redis, a syntax error in an initializer -- the CLI prints a one-line cause plus common-cause hints and exits 1, instead of a raw Thor backtrace. Boot is bounded by a 60-second timeout so a hanging initializer fails loudly rather than wedging the process; the timeout is configurable via `RAILS_AI_CONTEXT_BOOT_TIMEOUT`. A timed-out boot gets a dedicated message naming the configured limit and how to raise it, instead of the stdlib's `Timeout::Error: execution expired`. Set `DEBUG=1` for the full backtrace. `doctor` on an app that fails to boot appends one line noting it needs a bootable app to run its checks.
19
+ - **stdout quarantine on every stdio launch path.** The stdio MCP transport carries JSON-RPC on stdout, so anything the host app prints while booting (initializer `puts`, deprecation warnings) used to corrupt the handshake and leave the client reporting a dead server. `OutputGuard` now redirects `$stdout` to `$stderr` for the duration of boot on every stdio launch path -- the `rails-ai-context serve` binary, the `rails ai:serve` rake task, and standalone mode. It also reopens file descriptor 1 onto `$stderr`'s target for that duration, so writes through the `STDOUT` constant (which bypass the `$stdout` global) and subprocess output inherited on fd 1 are caught too; only a descriptor duplicated before boot starts stays out of reach.
20
+ - **Unexpected tool errors return in-band MCP error results instead of protocol errors.** Every registered tool's `call` is now wrapped so an unhandled exception produces an `isError: true` tool response (error class, origin line, and a recovery hint) rather than escaping to the MCP SDK, which turned it into a JSON-RPC -32603 protocol error that most AI clients silently swallow. Exceptions that still escape at the SDK level get a stderr backtrace via a new `exception_reporter`.
21
+ - **Aggregate tools flag partial context.** `rails_get_context` and `rails_onboard` append a "Partial context" note listing which introspectors failed when any did, so an AI client can tell missing data from empty data. The note is appended after the truncation decision, so it survives response truncation instead of being cut off with the rest of the body.
22
+ - **Generated MCP configs launch the quarantined CLI command.** All 5 generated config formats (Claude Code, Cursor, VS Code, OpenCode, and Codex CLI) now point at `bundle exec rails-ai-context serve` instead of `bundle exec rails ai:serve`, so new installs get stdout quarantine from before `Bundler.require` runs. `rails ai:serve` still works and now quarantines its own boot output too.
23
+
24
+ ### Fixed
25
+
26
+ - Introspector fault isolation no longer crashes when `Rails.logger` is nil (early-boot rake tasks, engine dummy apps). The failure-logging call that the rescue exists to protect now falls back to `$stderr` via `RailsAiContext.log_warn` instead of raising `NoMethodError` on a nil logger.
27
+ - `BaseTool.abstract!` now works when called on a subclass. It read `registry_mutex` and `descendants` off `self`, but those are ivars set on `BaseTool` itself -- a subclass has no ivar storage of its own to read them from, so the call raised `NoMethodError` on the nil mutex. It now reaches back to `BaseTool` explicitly.
28
+ - Custom tools that subclass `RailsAiContext::Tools::BaseTool` must accept a `server_context:` keyword (or `**kwargs`) in `self.call` -- the MCP dispatch now always passes it.
29
+ - **The install generator no longer crashes on non-interactive stdin.** Thor's `ask` returns `nil` on EOF (piping fewer answers than prompts, or `< /dev/null`), and the very next `.strip` call raised `NoMethodError`. Every prompt now goes through `ask_safe`, which treats EOF the same as an empty answer -- each prompt's existing default-handling logic takes it from there. A new `--defaults` flag skips every prompt outright for CI/scripted installs.
30
+ - **`rails-ai-context --version` and `-v` work**, not just the `version` subcommand -- Thor only recognized the bare subcommand by default.
31
+ - **Presets share one definition.** The rake task (`rails 'ai:preset[name]'`) and the CLI (`rails-ai-context preset name`) used to define their own, different tool lists under the same preset name. Both now read from `RailsAiContext::Presets::DEFINITIONS`, the single source of truth. The `migration` preset's old tool list called `migration_advisor` with an invalid `action` and `validate` with no files -- both require a caller-supplied target and only emitted errors on a healthy app; it now runs `get_schema`, `runtime_info`, and `performance_check` with zero arguments, matching what `architecture` and `debugging` already did correctly.
32
+ - **`rails_performance_check` no longer claims "Your app looks good!" when a category or model filter is hiding issues elsewhere.** A zero count under a filter now says so explicitly and points back at the unfiltered call, instead of implying the whole app is clean.
33
+ - **`rails_get_view`'s render map now detects the Rails 7+ bare local-variable render form** (`render article`, as the default scaffold generates), not just `render "partial"` and `render @article`. The scan excludes keyword-argument hashes (`render json:`, `render partial:`, ...) so it doesn't misread those as local-variable renders.
34
+ - **`rails_get_view` accepts a full repo-relative path** (e.g. `app/views/layouts/mailer.html.erb`) in addition to the documented app/views-relative form -- previously a genuinely-existing file read as "not found" solely because of which convention the caller used.
35
+ - **`rails_analyze_feature` no longer substring-matches unrelated identifiers.** `feature:"post"` used to pull in ActionMailbox's `postmark` ingress route because `"postmark".include?("post")` is true. Matching is now word-boundary aware (with basic singular/plural handling), so `post` still matches `posts`, `post_comments`, and `PostsController`, but not `postmark`.
36
+ - Empty-result "not found" responses no longer end with a dangling `Available:` line when there's nothing to list (`rails_get_concern`, and any other tool built on the shared `not_found_response` helper).
37
+ - `rails_get_partial_interface`'s "not found" suggestion list no longer lists the same partial twice when it exists under two extensions (e.g. `_article.html.erb` and `_article.json.jbuilder` both display as `articles/article`).
38
+ - A non-numeric `RAILS_AI_CONTEXT_BOOT_TIMEOUT` value now falls back to the default with a stderr warning instead of raising a raw `ArgumentError` that surfaced as a Thor backtrace on `doctor`, `inspect_app`, and `watch`.
39
+ - **`rails_get_conventions`'s create-action and read-only-page skeletons now reflect what's actually detected**, instead of a hardcoded `current_user`-based template labeled with real controller names regardless of whether any auth pattern existed. They're built from the union of flow parts actually matched, and only reference `current_user` when a permission or auth check was really found.
40
+ - **`rails_analyze_feature`'s test counts are accurate again.** `discover_tests` counted the bare words `it`/`test`/`should` anywhere in a file's text, including comments and prose. It now counts line-anchored `test`/`it`/`specify` declarations and `def test_*` methods, matching how `rails_get_test_info` already counted correctly.
41
+ - **CLI and rake tool failures exit non-zero.** `rails-ai-context tool NAME` and `rails 'ai:tool[NAME]'` used to exit 0 even when the tool itself reported failure (`isError: true`); both now exit 1 in that case, and `--json` output gains an `error` key so scripts can check it without parsing text. An unrecognized `rails-ai-context` subcommand also exits 1 instead of Thor's default 0. The "unknown tool" error message points at whichever `--list` invocation actually works for the caller (CLI vs rake) instead of always suggesting the CLI-only flag, and a blank tool-name query no longer produces an arbitrary "Did you mean" suggestion.
42
+ - Routine MCP protocol errors (unknown tool, invalid params) now log as a single quiet line instead of a 10-line backtrace; only genuinely unhandled exceptions still get the full backtrace.
43
+ - **Install generator output is honest about install mode and idempotency.** Generating context files for multiple selected AI-tool formats no longer reports the shared `AGENTS.md` trio as both written and unchanged in the same run. `.rails-ai-context.yml` writes report Created/Updated/unchanged consistently across the generator, standalone `init`, and the `ai:context` rake task. `.codex/config.toml` (which embeds a machine's Ruby PATH/GEM_HOME) is now flagged as local and added to `.gitignore` instead of told to commit it. Generated context files reference the `rails-ai-context` CLI binary instead of rake tasks on standalone installs, detected via a Gemfile.lock scan for the gem's own spec line.
44
+ - Eight tool-output and doctor accuracy fixes from live QA: `rails_get_gems` points the Solid Queue config hint at `config/queue.yml`/`config/recurring.yml` (checked at runtime) instead of `config/solid_queue.yml`, which Rails 8's generator never writes; `doctor`'s gitignore check distinguishes a missing `.gitignore` file from a missing entry; `rails_get_model_details` no longer renders a bare "Key instance methods" heading when every candidate method was filtered out as an association accessor; `rails_onboard`'s route total shares dedup logic and prefix config with `rails_get_routes` instead of disagreeing with it; CLI `tool --list` truncates descriptions with an ellipsis instead of mid-word; `tool --list` falls back to loading the gem standalone when there's no app to boot; and `doctor`'s introspector-health message computes the tool count it compares against dynamically instead of hardcoding it.
45
+ - **Tools stay truthful on API-only apps.** `rails_get_frontend_stack` reports "No frontend stack detected" instead of a lone "TypeScript: disabled" line implying a JS frontend exists. `rails_get_turbo_map` reports that Turbo isn't installed when `turbo-rails` isn't in `Gemfile.lock`, instead of an empty broadcast/subscription report. `rails_get_context`'s instance-variable cross-check recognizes ivars rendered via `render json: @foo`/`render xml: @foo` (which have no view template to cross-reference), and swaps "used in view" language for "used in response" on API-only apps; the generated CLAUDE.md/AGENTS.md workflow guide swaps its view-editing walkthrough for a JSON-endpoint walkthrough on the same apps. `app/models/concerns` and `app/controllers/concerns` are only reported as in-use patterns when they contain a real Ruby file, not just the `.keep` placeholder a fresh `rails new` leaves behind. `rails_get_conventions`'s create-action skeleton now emits `render json:` (and `render json: @record.errors`) instead of an HTML redirect when the app's create actions render JSON directly, not just via a scaffold's `respond_to` JSON branch.
46
+ - **MySQL/Trilogy adapter parity.** Rails 8's default MySQL adapter reports `adapter_name` as "Trilogy", not "Mysql2", so every `/mysql/`-only regex dispatch silently fell through to unsafe or degraded fallbacks -- `rails_query`'s read-only transaction and statement timeout, `rails_runtime_info`'s table sizes, and the database-stats introspector now all match `/mysql|trilogy/i`. `rails_query`'s `SHOW`/`DESCRIBE`/`EXPLAIN` are exempted from row-limit appending (invalid syntax after those statements) and from column-name-based redaction (MySQL's `DESCRIBE` returns a literal "Key" column that isn't secret data); `EXPLAIN` on MySQL forces `FORMAT=TRADITIONAL` so parsing doesn't depend on the server's default explain format.
47
+ - **Pending-migrations detection works again.** All three call sites (`rails_runtime_info`, `doctor`, the migration introspector) guarded on `respond_to?(:pending_migrations)`, which is never true on any currently supported Rails version, and fell back to an `ActiveRecord::Migrator.new` signature that raises on Rails 7.0+ -- it always reported zero pending migrations. A shared `MigrationStatus` helper now walks `migration_context.open.pending_migrations`, the same path Rails uses for its own "migrations are pending" error page; the file-based fallback also reads the schema version from `db/structure.sql`'s trailing `schema_migrations` insert, so `:sql`-format apps get correct results instead of always reporting zero.
48
+ - `migration_advisor`'s locking advice is now adapter-aware instead of always suggesting Postgres-only `algorithm: :concurrently` and two-step foreign key validation on every adapter.
49
+ - The generated tool-usage guide names `db/structure.sql` instead of `db/schema.rb` in its "don't read this file" guidance on apps configured with `schema_format = :sql`.
50
+ - Fixed the remaining "N indexes"/"N files" pluralization misses: `rails_get_schema`'s summary view now says "1 column, 1 index" and `rails_get_conventions`'s directory structure says "1 file", matching the singular/plural handling already applied to table, issue, and test counts.
51
+ - The CLI `preset` command's banner now uses a plain hyphen instead of an em dash, matching the rake task's output, and its per-tool "Running:" headers print to stdout (the same stream as the tool's own output) instead of stderr, so `2>&1` captures stay in order.
52
+ - The install generator no longer emits raw terminal escape sequences (cursor hide/show, line clears) when stdin or stdout isn't a real terminal (`rails generate rails_ai_context:install < /dev/null`, captured CI logs). Thor's line editor now falls back to its plain, escape-free reader outside a genuine interactive TTY session.
53
+ - **The generated initializer no longer crashes `bin/rails test` on path:/git: Gemfile installs scoped to `group :development`.** Bundler evaluates a path:/git: gemspec in-process during dependency resolution in every environment, so `require_relative "lib/rails_ai_context/version"` defines a VERSION-only stub `RailsAiContext` module even in environments where `Bundler.require` correctly skips the gem. The initializer's `if defined?(RailsAiContext)` guard was satisfied by that stub and called `.configure` on it anyway, raising `NoMethodError`. The guard now also checks `RailsAiContext.respond_to?(:configure)`; re-running the install generator upgrades an existing initializer's bare guard in place, and `doctor` warns when one is still on the old guard.
54
+ - **`DEBUGGER__::TrapInterceptor` no longer shows up as a model concern.** The `debug` gem, default in Rails 7.0+ Gemfiles, prepends this module onto `Kernel`, so it appeared in every model's ancestors. It's now excluded the same way other framework-internal modules are.
55
+ - **The `rails-ai-context://routes/{controller}` MCP resource returns real routes.** It filtered a flat `:routes` list that the route introspector never emits (routes are grouped under `:by_controller`), so every read returned an empty array. It now reads the real shape, merges the controller name back into each entry, and dedupes PUT/PATCH update pairs into one `PATCH|PUT` entry so the resource reports the same counts as the routes tool.
56
+ - MCP resource contents use the spec field name `mimeType` instead of snake_case `mime_type`.
57
+ - **Rails-internal routes are excluded correctly.** The route introspector guarded on `route.respond_to?(:internal?)`, but `ActionDispatch::Journey::Route` exposes the flag as a plain `internal` attribute, so the guard never matched and Rails' info/mailers/welcome routes leaked into route listings as "framework routes". The tool and the MCP resource now agree on route counts, and the routes header notes how many framework routes were excluded.
58
+ - **`.mcp.json` content is stable across entry points.** The standalone `init` wrote `rails-ai-context serve` while the in-Gemfile generator and `ai:context` rake task wrote `bundle exec rails-ai-context serve`, so alternating commands rewrote the file on every run. All writers now derive the command from the detected install mode.
59
+ - **`rails_validate` failures exit non-zero.** A failed validation ("0/1 files passed", real Prism diagnostics) is now an MCP error result, so the CLI exits 1 and CI can gate on it; passing validations still exit 0. `rails_query`'s genuine SQL execution errors (unknown column, syntax error) get the same treatment, while policy guardrail messages ("Blocked: contains UPDATE") remain informational at exit 0.
60
+ - `rails-ai-context preset bogus` exits 1 with the available-presets list instead of exiting 0.
61
+ - **`rails_get_conventions` renders the status symbol actually detected in the app's controllers** (`:unprocessable_content` on Rails 7.1+ scaffolds) instead of hardcoding `:unprocessable_entity` in a skeleton labeled "Detected in".
62
+ - `rails_get_frontend_stack` reads the introspector's real output keys, so the Framework and Testing lines (React/Vue/Jest and friends) render again; they had been silently dropped for every app.
63
+ - `rails_search_code` marks match lines with a `>` prefix and indents context lines, so matches are distinguishable in captured output; a legend line explains the markers.
64
+ - `rails_diagnose` classifies an undefined method on a model by checking the model's real associations and columns, reporting "no association or column named X" instead of the generic nil-reference guidance.
65
+ - `rails_review_changes` no longer leaks git's raw "fatal: not a git repository" stderr line above its own friendly message when run outside a repository.
66
+ - The config tool lists every file in `config/initializers/`, not just the gem's own initializer.
67
+ - CLI copy is install-mode aware everywhere: `tool --list`, per-tool help, unknown-tool errors, and the generated git pre-commit hook show only invocation forms that exist in the current install (standalone installs have no rake tasks). The `tree` command shows the binary name as its root and `inspect` under its public name.
68
+ - Assorted output honesty from the final QA sweep: onboard only recommends `bin/dev` when the app has one, names the real queue adapter instead of mentioning Sidekiq on non-Sidekiq apps, labels implicit `belongs_to` validations as such, and pluralizes counts correctly; the view tool omits its "Directories with views:" enumeration when there are none; the standalone `facts` command matches the rake task's singular/plural forms and prints `_none_` instead of a bare Associations header; `rails_get_partial_interface` no longer lists ERB block parameters (`|form|`, `|error|`) as partial locals.
69
+
8
70
  ## [5.13.0] - 2026-07-10
9
71
 
10
72
  ### Added
data/README.md CHANGED
@@ -20,8 +20,8 @@
20
20
  [![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-green)](https://registry.modelcontextprotocol.io)
21
21
  <br>
22
22
  [![Ruby](https://img.shields.io/badge/Ruby-3.1%20%7C%203.2%20%7C%203.3%20%7C%203.4-CC342D)](https://github.com/crisnahine/rails-ai-context)
23
- [![Rails](https://img.shields.io/badge/Rails-7.0%20%7C%207.1%20%7C%207.2%20%7C%208.0-CC0000)](https://github.com/crisnahine/rails-ai-context)
24
- [![Tests](https://img.shields.io/badge/Tests-2257%20passing-brightgreen)](https://github.com/crisnahine/rails-ai-context/actions)
23
+ [![Rails](https://img.shields.io/badge/Rails-7.0%20%7C%207.1%20%7C%207.2%20%7C%208.0%20%7C%208.1-CC0000)](https://github.com/crisnahine/rails-ai-context)
24
+ [![Tests](https://img.shields.io/badge/Tests-2501%20passing-brightgreen)](https://github.com/crisnahine/rails-ai-context/actions)
25
25
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
26
26
 
27
27
  </div>
@@ -68,7 +68,7 @@ rails-ai-context serve # start MCP server
68
68
 
69
69
  </div>
70
70
 
71
- Now your AI doesn't guess - it **asks your app directly.** 38 tools and 5 resource templates that query your schema, models, routes, controllers, views, and conventions on demand. Model introspection uses Prism AST parsing - every result carries a `[VERIFIED]` or `[INFERRED]` confidence tag so AI knows what's ground truth and what needs runtime checking.
71
+ Now your AI doesn't guess - it **asks your app directly.** 39 tools and 5 resource templates that query your schema, models, routes, controllers, views, and conventions on demand. Model introspection uses Prism AST parsing - every result carries a `[VERIFIED]` or `[INFERRED]` confidence tag so AI knows what's ground truth and what needs runtime checking.
72
72
 
73
73
  <br>
74
74
 
@@ -163,7 +163,7 @@ Native Rails controller transport. No separate process needed.
163
163
 
164
164
  ### CLI
165
165
 
166
- Same 38 tools, no server needed. Works in any terminal, any AI tool.
166
+ Same 39 tools, no server needed. Works in any terminal, any AI tool.
167
167
 
168
168
  ```bash
169
169
  rails 'ai:tool[search_code]' pattern="publishable?" match_type=trace
@@ -351,7 +351,7 @@ Every tool is **read-only** and returns data verified against your actual app -
351
351
 
352
352
  </details>
353
353
 
354
- > **[All 38 tools with parameters →](docs/TOOLS.md)** &nbsp;|&nbsp; **[Real-world recipes →](docs/RECIPES.md)**
354
+ > **[All 39 tools with parameters →](docs/TOOLS.md)** &nbsp;|&nbsp; **[Real-world recipes →](docs/RECIPES.md)**
355
355
 
356
356
  <br>
357
357
 
@@ -401,8 +401,8 @@ graph TD
401
401
 
402
402
  B["rails-ai-context\nPrism AST parsing · Cached · Confidence-tagged\nVFS: rails-ai-context:// URIs introspected fresh"]
403
403
 
404
- B --> C["MCP Server\nstdio / HTTP\n38 tools · 5 templates"]
405
- B --> D["CLI Tools\nRake / Thor\nSame 38 tools"]
404
+ B --> C["MCP Server\nstdio / HTTP\n39 tools · 5 templates"]
405
+ B --> D["CLI Tools\nRake / Thor\nSame 39 tools"]
406
406
  B --> E["Static Files\nCLAUDE.md · .cursor/rules/ · .cursorrules\n.github/instructions/"]
407
407
 
408
408
  style A fill:#4a9eff,stroke:#2d7ad4,color:#fff
@@ -440,7 +440,7 @@ Both paths ask which AI tools you use (Claude Code, Cursor, GitHub Copilot, Open
440
440
  | In-Gemfile | Standalone | What it does |
441
441
  |:-----------|:-----------|:------------|
442
442
  | `rails ai:context` | `rails-ai-context context` | Generate context files |
443
- | `rails 'ai:tool[NAME]'` | `rails-ai-context tool NAME` | Run any of the 38 tools |
443
+ | `rails 'ai:tool[NAME]'` | `rails-ai-context tool NAME` | Run any of the 39 tools |
444
444
  | `rails ai:tool` | `rails-ai-context tool --list` | List all available tools |
445
445
  | `rails ai:serve` | `rails-ai-context serve` | Start MCP server (stdio) |
446
446
  | `rails ai:doctor` | `rails-ai-context doctor` | Diagnostics + AI readiness score |
@@ -453,7 +453,7 @@ Both paths ask which AI tools you use (Claude Code, Cursor, GitHub Copilot, Open
453
453
  | | |
454
454
  |:------|:------------|
455
455
  | **[Quickstart](docs/QUICKSTART.md)** | 5-minute getting started |
456
- | **[Tools Reference](docs/TOOLS.md)** | All 38 tools with every parameter |
456
+ | **[Tools Reference](docs/TOOLS.md)** | All 39 tools with every parameter |
457
457
  | **[Recipes](docs/RECIPES.md)** | Real-world workflows and examples |
458
458
  | **[Custom Tools](docs/CUSTOM_TOOLS.md)** | Build and test your own MCP tools |
459
459
  | **[Configuration](docs/CONFIGURATION.md)** | 40+ config options with defaults |
@@ -543,7 +543,7 @@ end
543
543
  ## About
544
544
 
545
545
  Built by a Rails developer with 10+ years of production experience.<br>
546
- 2154 tests + 100-example e2e harness. 38 tools. 5 resource templates. 39 introspectors. Standalone or in-Gemfile.<br>
546
+ 2154 tests + 100-example e2e harness. 39 tools. 5 resource templates. 39 introspectors. Standalone or in-Gemfile.<br>
547
547
  MIT licensed. [Contributions welcome.](CONTRIBUTING.md)
548
548
 
549
549
  <br>
data/docs/CLI.md CHANGED
@@ -17,7 +17,7 @@
17
17
  | In-Gemfile (Rake) | `rails ai:` | `rails 'ai:tool[schema]' table=users` |
18
18
  | Standalone (Thor) | `rails-ai-context` | `rails-ai-context tool schema --table users` |
19
19
 
20
- Both provide the same 38 tools and functionality.
20
+ Both provide the same 39 tools and functionality.
21
21
 
22
22
  ---
23
23
 
@@ -98,6 +98,8 @@ Run 23 diagnostic checks and report AI readiness score.
98
98
  ```bash
99
99
  rails ai:doctor
100
100
  rails-ai-context doctor
101
+ rails-ai-context doctor --strict # exit 1 when any check fails (CI gate)
102
+ rails ai:doctor STRICT=1 # rake equivalent
101
103
  ```
102
104
 
103
105
  Checks include: schema existence, pending migrations, model files, routes, MCP config validity, introspector health, ripgrep availability, Prism gem, Brakeman gem, listen gem, gitignore security, auto_mount security, schema size, view count, and more.
data/docs/TOOLS.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # MCP Tools Reference
4
4
 
5
- **All 38 read-only tools, with every parameter.**
5
+ **All 39 read-only tools, with every parameter.**
6
6
 
7
7
  [Quickstart](QUICKSTART.md) · [Recipes](RECIPES.md) · [Custom Tools](CUSTOM_TOOLS.md) · [CLI Reference](CLI.md)
8
8
 
@@ -59,7 +59,7 @@ Individual lookup tools accept a **`detail`** parameter: `summary` (compact), `s
59
59
  | [Controllers & Routes](#controllers--routes) | `get_controllers`, `get_routes` |
60
60
  | [Views & Frontend](#views--frontend) | `get_view`, `get_stimulus`, `get_partial_interface`, `get_turbo_map`, `get_frontend_stack` |
61
61
  | [Testing & Quality](#testing--quality) | `get_test_info`, `generate_test`, `validate`, `security_scan`, `performance_check` |
62
- | [App Config & Services](#app-config--services) | `get_conventions`, `get_config`, `get_gems`, `get_env`, `get_helper_methods`, `get_service_pattern`, `get_job_pattern`, `get_component_catalog` |
62
+ | [App Config & Services](#app-config--services) | `get_api`, `get_conventions`, `get_config`, `get_gems`, `get_env`, `get_helper_methods`, `get_service_pattern`, `get_job_pattern`, `get_component_catalog` |
63
63
  | [Data & Debugging](#data--debugging) | `dependency_graph`, `migration_advisor`, `search_docs`, `query`, `read_logs`, `diagnose`, `review_changes`, `runtime_info`, `session_context` |
64
64
 
65
65
  <p align="right"><a href="#table-of-contents">↑ back to top</a></p>
@@ -303,6 +303,14 @@ N+1 query risks, missing indexes, missing counter_cache, eager load candidates.
303
303
 
304
304
  ## App Config & Services
305
305
 
306
+ ### `rails_get_api`
307
+
308
+ API layer: api_only mode, serialization strategy (Jbuilder, serializers), GraphQL, versioning, rate limiting, OpenAPI specs, CORS, pagination.
309
+
310
+ | Parameter | Type | Default | Description |
311
+ |:----------|:-----|:--------|:------------|
312
+ | `detail` | enum | `standard` | `summary` (one-liner), `standard` (per-area breakdown), `full` (adds OpenAPI spec paths) |
313
+
306
314
  ### `rails_get_conventions`
307
315
 
308
316
  Auth checks, flash messages, create action template, test patterns.
data/docs/index.md CHANGED
@@ -22,7 +22,7 @@ Works with Claude Code, Cursor, GitHub Copilot, OpenCode, and Codex CLI.
22
22
 
23
23
  | Guide | Description |
24
24
  |:------|:------------|
25
- | **[Tools Reference](TOOLS.md)** | All 38 tools with every parameter |
25
+ | **[Tools Reference](TOOLS.md)** | All 39 tools with every parameter |
26
26
  | **[Configuration](CONFIGURATION.md)** | 40+ config options with defaults |
27
27
  | **[CLI Reference](CLI.md)** | Commands and argument syntax |
28
28
  | **[Introspectors](INTROSPECTORS.md)** | All 39 introspectors and AST engine |