rails-ai-bridge 5.3.0 → 5.5.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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/.reek.yml +8 -0
  3. data/AGENTS.md +2 -2
  4. data/CHANGELOG.md +115 -0
  5. data/CLAUDE.md +2 -2
  6. data/README.md +49 -519
  7. data/SECURITY.md +3 -0
  8. data/UPGRADING.md +15 -0
  9. data/docs/BEST_PRACTICES.md +7 -10
  10. data/docs/COMPARISON.md +8 -8
  11. data/docs/COVERAGE.md +1 -1
  12. data/docs/EXAMPLES.md +3 -6
  13. data/docs/GUIDE.md +298 -33
  14. data/docs/ROADMAP.md +3 -3
  15. data/docs/devin-setup.md +5 -8
  16. data/docs/mcp-security.md +22 -2
  17. data/docs/ruby-version-support.md +58 -0
  18. data/lib/generators/rails_ai_bridge/install/command_help.rb +3 -3
  19. data/lib/generators/rails_ai_bridge/install/install_generator.rb +2 -2
  20. data/lib/rails_ai_bridge/config/output.rb +6 -0
  21. data/lib/rails_ai_bridge/configuration.rb +5 -2
  22. data/lib/rails_ai_bridge/http_transport_app.rb +7 -1
  23. data/lib/rails_ai_bridge/instrumentation.rb +7 -2
  24. data/lib/rails_ai_bridge/introspector.rb +3 -2
  25. data/lib/rails_ai_bridge/introspectors/code_intelligence_introspector.rb +105 -0
  26. data/lib/rails_ai_bridge/introspectors/config_introspector.rb +21 -5
  27. data/lib/rails_ai_bridge/introspectors/timezone_introspector.rb +44 -0
  28. data/lib/rails_ai_bridge/mcp/http_rate_limiter.rb +24 -9
  29. data/lib/rails_ai_bridge/middleware.rb +9 -3
  30. data/lib/rails_ai_bridge/serializers/README.md +0 -1
  31. data/lib/rails_ai_bridge/serializers/context_file_serializer.rb +6 -0
  32. data/lib/rails_ai_bridge/serializers/formatters/sections/code_intelligence_formatter.rb +69 -0
  33. data/lib/rails_ai_bridge/serializers/legacy_agent_files.rb +60 -0
  34. data/lib/rails_ai_bridge/serializers/markdown_serializer.rb +1 -0
  35. data/lib/rails_ai_bridge/serializers/providers/codex_serializer.rb +0 -1
  36. data/lib/rails_ai_bridge/tasks/rails_ai_bridge.rake +5 -5
  37. data/lib/rails_ai_bridge/tool_result_cache.rb +24 -4
  38. data/lib/rails_ai_bridge/tools/explain_symbol/cli_explorer.rb +7 -31
  39. data/lib/rails_ai_bridge/tools/explain_symbol/cli_runner.rb +45 -0
  40. data/lib/rails_ai_bridge/tools/explain_symbol/graphify_explorer.rb +44 -0
  41. data/lib/rails_ai_bridge/tools/explain_symbol.rb +35 -7
  42. data/lib/rails_ai_bridge/tools/query/payload_formatter.rb +9 -9
  43. data/lib/rails_ai_bridge/tools/query.rb +25 -10
  44. data/lib/rails_ai_bridge/tools/search_code/ruby_search.rb +1 -1
  45. data/lib/rails_ai_bridge/tools/search_code/validator.rb +20 -1
  46. data/lib/rails_ai_bridge/version.rb +1 -1
  47. data/lib/rails_ai_bridge.rb +1 -1
  48. data/server.json +1 -1
  49. metadata +8 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fdc446dd143e92672029e1d06c7081ad870772236dbbf912443ca6bfcab8fb5
4
- data.tar.gz: edcfd12eabe928b0103bf3e241ae2393b0cd5836b433ffff72c1f454374f0540
3
+ metadata.gz: f7bb48a28251ee8e4bfe0e4c53c997a2761ebbc2ff3514b3932665f3e6f2ab7e
4
+ data.tar.gz: 5efeab1f89784d31f004263056c3d58a93f391baadb301aafdf1be0f084a085f
5
5
  SHA512:
6
- metadata.gz: 6d8b295f8d78e7a4f037f2bb9437bc9281ff535c4d9f6951d848fcae4500c1fbe438675588a247cbff1e98abae6816c0a66dca547a16a09504bd6b3a27e8ed53
7
- data.tar.gz: 1f479fb9b30ff3a82a2c73f5692cae70f136baf73034b51d372c65fdb7ade96b318a155171b72630479aba4c6244535c73307ac4e0a123880a694ff6445f9439
6
+ metadata.gz: 5be842f71f3a2f60f5005b825e7f3feffba30bf09fe4c9e25649af9e60daaa7f6007256ccf400037fba47ff2221738d60ab4d02a1e89d8828278c48ed5f1643f
7
+ data.tar.gz: ff93e2abe13b0c2ecbbcacaf8dd4806271796a2ec2ab0e4a3c147151396b5b2b6e65d120bbc102d9074107e2f17904b0d2f84dcd77e9632e48f21b1b35c1d2f2
data/.reek.yml CHANGED
@@ -49,6 +49,7 @@ detectors:
49
49
  - RailsAiBridge::Config::Output#codex_compact_model_list_limit
50
50
  - RailsAiBridge::Config::Output#context_mode
51
51
  - RailsAiBridge::Config::Output#copilot_compact_model_list_limit
52
+ - RailsAiBridge::Config::Output#legacy_agent_files
52
53
  - RailsAiBridge::Config::Output#managed_region
53
54
  - RailsAiBridge::Config::Output#max_tool_response_chars
54
55
  - RailsAiBridge::Config::Output#output_dir
@@ -92,6 +93,7 @@ detectors:
92
93
  ControlParameter:
93
94
  exclude:
94
95
  - RailsAiBridge::Registry::ContextProviderClient#probe
96
+ - RailsAiBridge::Serializers::Formatters::Sections::CodeIntelligenceFormatter#staleness_label
95
97
  - RailsAiBridge::ContextProvider#rebuild
96
98
  - RailsAiBridge::Doctor::Checkers::RegistryChecker#call
97
99
  - RailsAiBridge::Doctor::Checkers::BaseChecker#check
@@ -469,6 +471,9 @@ detectors:
469
471
  - RailsAiBridge::Tools::ModelDetails::SingleModelFormatter#format_macro_list
470
472
  - RailsAiBridge::Tools::ModelDetails::StandardFormatter#call
471
473
  - RailsAiBridge::Tools::Schema::TableFormatter#call
474
+ - RailsAiBridge::Serializers::Formatters::Sections::CodeIntelligenceFormatter#codegraph_lines
475
+ - RailsAiBridge::Serializers::Formatters::Sections::CodeIntelligenceFormatter#graphify_lines
476
+ - RailsAiBridge::Serializers::Formatters::Sections::CodeIntelligenceFormatter#render
472
477
  InstanceVariableAssumption:
473
478
  exclude:
474
479
  - RailsAiBridge::Generators::InstallGenerator
@@ -1044,6 +1049,8 @@ detectors:
1044
1049
  - RailsAiBridge::Watcher#handle_change
1045
1050
  - RailsAiBridge::Watcher#start
1046
1051
  - RailsAiBridge#validate_auto_mount_configuration!
1052
+ - RailsAiBridge::Serializers::Formatters::Sections::CodeIntelligenceFormatter#graphify_lines
1053
+ - RailsAiBridge::Serializers::Formatters::Sections::CodeIntelligenceFormatter#render
1047
1054
  UncommunicativeVariableName:
1048
1055
  exclude:
1049
1056
  - RailsAiBridge::AssistantFormatsPreference#formats_for_default_bridge_task
@@ -1322,3 +1329,4 @@ detectors:
1322
1329
  - RailsAiBridge::Tools::ModelDetails::SingleModelFormatter#macro_present?
1323
1330
  - RailsAiBridge::Tools::Schema::StandardFormatter#partition_note
1324
1331
  - RailsAiBridge::Tools::SearchCode::Formatter#call
1332
+ - RailsAiBridge::Serializers::Formatters::Sections::CodeIntelligenceFormatter#format_time
data/AGENTS.md CHANGED
@@ -8,7 +8,7 @@ committed context files. It does not write to the host database.
8
8
  - `lib/rails_ai_bridge.rb` — Main entry point, public API (Zeitwerk autoloaded)
9
9
  - `lib/rails_ai_bridge/configuration.rb` — User-facing config with presets (:standard, :full)
10
10
  - `lib/rails_ai_bridge/introspector.rb` — Orchestrates sub-introspectors
11
- - `lib/rails_ai_bridge/introspectors/` — Built-in introspector classes; `:standard` preset runs **9**, `:full` runs **27** (see `Configuration::PRESETS`). Registry: `Introspector::BUILTIN_INTROSPECTORS` (`:full` already includes `non_ar_models`; opt-in-only symbols not in any preset: `database_stats`, `semantic`).
11
+ - `lib/rails_ai_bridge/introspectors/` — Built-in introspector classes; `:standard` preset runs **9**, `:full` runs **28** (see `Configuration::PRESETS`). Registry: `Introspector::BUILTIN_INTROSPECTORS` (`:full` already includes `non_ar_models`; opt-in-only symbols not in any preset: `database_stats`, `semantic`).
12
12
  - `lib/rails_ai_bridge/tools/` — 22 built-in MCP tools using the official mcp SDK (hosts can add more via `additional_tools`)
13
13
  - `lib/rails_ai_bridge/serializers/` — Output formatters (claude, claude_rules, codex, cursor_rules, devin, devin_rules, copilot, copilot_instructions, gemini, rules, markdown, JSON)
14
14
  - `lib/rails_ai_bridge/resources.rb` — MCP resources (static data AI clients read directly)
@@ -32,7 +32,7 @@ committed context files. It does not write to the host database.
32
32
  6. **Diff-aware** — context regeneration skips unchanged files
33
33
  7. **Per-assistant serializers** — each AI tool gets tailored output format
34
34
  8. **Zeitwerk autoloading** — files loaded on-demand, not all upfront
35
- 9. **Introspector presets** — `:standard` (9 core) default, `:full` (27 introspectors, includes `non_ar_models`) with opt-in extras such as `database_stats` and `semantic` for power users
35
+ 9. **Introspector presets** — `:standard` (9 core) default, `:full` (28 introspectors, includes `non_ar_models`) with opt-in extras such as `database_stats` and `semantic` for power users
36
36
  10. **MCP auto-discovery** — `.mcp.json` generated by install generator
37
37
  11. **Outbound context providers (v5)** — `rails_get_provider_context` fetches from declared external MCP services. Disabled by default, exact host allowlist, read-only tool enforcement, `ToolResultCache::NON_CACHEABLE` exclusion. Separate from local `rails_get_context`.
38
38
  12. **Compact by default** — context files ≤150 lines, MCP tools use `detail` parameter (summary/standard/full)
data/CHANGELOG.md CHANGED
@@ -7,6 +7,121 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.5.0] - 2026-11-20
11
+
12
+ ### Added
13
+
14
+ - `rails_explain_symbol` now falls back to a local Graphify index: when
15
+ `.codegraph/` is absent but `graphify-out/graph.json` exists, the tool runs
16
+ `graphify query` against the project's graph. Shared CLI execution moved to
17
+ `ExplainSymbol::CliRunner`; the missing-index message and tool description
18
+ name both index types.
19
+ - `CodeIntelligenceIntrospector` (`:code_intelligence`, included in the
20
+ `:full` preset — 28 introspectors) reports whether local CodeGraph and
21
+ Graphify indexes exist, when they were last generated, and whether the
22
+ Graphify graph is stale relative to `git HEAD`. Rendered as a new
23
+ `## Code Intelligence Indexes` section in markdown output.
24
+ - Dependency refresh: archspec dev-dependency raised to `~> 1.2.0`
25
+ (Dependabot #359).
26
+
27
+ ### Changed
28
+
29
+ - README restructured: install-profile detail, per-client setup walkthroughs,
30
+ managed regions, Rubydex, extending the built-ins, and skill packs moved to
31
+ `docs/GUIDE.md`, which becomes the single source for the full configuration
32
+ tables.
33
+ - Refreshed `docs/COMPARISON.md` against live sources (2026-11-20): the
34
+ read-only SQL/data-access row now reflects the shipped `rails_query` and
35
+ `rails_read_logs`, tool and introspector counts updated, download counts
36
+ re-verified.
37
+
38
+ ### Fixed
39
+
40
+ - HTTP MCP CORS: when `cors_origins` includes `'*'`, the response now sends
41
+ the literal `Access-Control-Allow-Origin: *` instead of echoing the
42
+ request's arbitrary `Origin` header back.
43
+ - Rack middleware: the HTTP transport app is built inside the same reentrant
44
+ monitor as the transport, so concurrent first requests can no longer build
45
+ two apps (and two rate limiters) with one discarded.
46
+
47
+ ### Security
48
+
49
+ - Documented two accepted limits in `docs/mcp-security.md`: `rails_query`
50
+ blocks statement types, not SQL function side effects (e.g. `SELECT
51
+ setval(...)` on PostgreSQL) — use a read-only database role when exposing
52
+ data tools; and CORS `'*'` mode is wildcard-allow — prefer exact origins.
53
+
54
+ ### Maintenance
55
+
56
+ - Refresh the mutation and demo-app lockfiles and the local lockfile, including
57
+ MCP 1.11.0, Rubydex 0.4.4, Combustion 1.7.0, Faraday 2.15.1, RuboCop 1.92.3,
58
+ Zeitwerk 2.8.3, WEBrick 1.9.2, and YARD 0.9.45. Skunk remains on 0.5.4 and
59
+ Reek on 6.5.x: RubyCritic pins `reek (~> 6.5.0, < 7.0)` in both 4.12.0 and
60
+ 5.0.0, and Skunk requires `rubycritic < 5.0`, so Dependabot PR #358 (reek
61
+ 6.6) was rejected.
62
+ - Added focused specs for five previously unspec'd serializer collaborators
63
+ (`RulesArchitectureBuilder`, `RulesStackOverviewBuilder`,
64
+ `RulesKeyConsiderationsBuilder`, `RulesDocumentBuilder`, `LineEnforcer`);
65
+ refreshed `docs/COVERAGE.md` to state the shipped 90/90 coverage floor.
66
+
67
+ ## [5.4.0] - 2026-10-23
68
+
69
+ ### Added
70
+
71
+ - `rails_ai_bridge.tool.call` notifications now include `success` and
72
+ `error_class`, while preserving the existing duration, tool name, and
73
+ arguments payload (#339).
74
+ - Ruby version support policy in `docs/ruby-version-support.md` (ticket #341).
75
+ - README Requirements and Ruby policy distinguish blocking Ruby 3.2–3.4 coverage
76
+ from the existing non-blocking Ruby 4.0 / Rails 8.1 canary. The historical Ruby
77
+ 3.5 preview is excluded from the matrix.
78
+ - `RailsAiBridge::Introspectors::TimezoneIntrospector` adds runtime confirmation
79
+ metadata to the existing config section (part of #342). `timezone_confirmed`
80
+ compares the IANA identifiers of `config.time_zone` and the current thread's
81
+ `Time.zone`, supporting both Rails names and IANA identifiers. It is false
82
+ when the runtime zone is unavailable or different. Static config introspection
83
+ remains unavailable; tool and serializer rendering is unchanged.
84
+
85
+ ### Changed
86
+
87
+ - `rails_query` enforces its row limit in SQL and fetches one sentinel row
88
+ before ActiveRecord materializes results. Summary responses now report the
89
+ same bounded `row_count` and `truncated` semantics as other detail levels
90
+ (#350).
91
+
92
+ ### Fixed
93
+
94
+ - Disable the review CLI's background auto-updater in CI so the pinned executable
95
+ cannot be replaced during an automated review.
96
+ - Bound the in-process tool response cache to 1,000 entries and the HTTP rate
97
+ limiter to 10,000 active client buckets. Expired entries are reclaimed
98
+ incrementally, and new clients fail closed when the limiter is full (#349).
99
+
100
+ ### Security
101
+
102
+ - Code search now skips symlinked files, rejects directory aliases into excluded
103
+ paths, and streams Ruby fallback reads up to the requested result cap (#347).
104
+ - Tool response cache keys now include the active Rails application, preventing
105
+ identical requests from reusing another application scope's response (#348).
106
+ - Refresh locked dependencies to include `crass` 1.0.8, which fixes
107
+ GHSA-pq4g-8rxf-4g29 in the CSS sanitizer dependency chain (#343).
108
+
109
+ ### Maintenance
110
+
111
+ - Refresh the mutation and demo-app lockfiles, including MCP 1.8.1, Rubydex
112
+ 0.4.2, Rails 8.1.4, SQLite 2.10.1, Faraday 2.15.0, Mutant 0.17.1,
113
+ RuboCop 1.92.1, and compatible transitive updates (#343). Skunk remains on
114
+ 0.5.4 because its 0.6 line conflicts with RubyCritic's `path_expander`
115
+ requirement; Reek remains on 6.5.x as required by RubyCritic 4.12.
116
+
117
+ ### Deprecated
118
+
119
+ - `.cursorrules`, `.devinrules`, and `.codex/README.md` are no longer written by default. Cursor reads
120
+ `.cursor/rules/` and `AGENTS.md`, Devin does not read `.devinrules`, and Codex reads only `AGENTS.md`.
121
+ `.cursor/rules/`, `.devin/rules/`, and `AGENTS.md` are unchanged. Set
122
+ `config.output.legacy_agent_files = true` to keep writing the three files; the first run prints a
123
+ deprecation notice. The option and the files are removed in 6.0. Existing copies are never deleted.
124
+
10
125
  ## [5.3.0] - 2026-10-08
11
126
 
12
127
  Confidence tags now reach controllers and the full view listing, and an opt-in Prism pass can upgrade
data/CLAUDE.md CHANGED
@@ -9,7 +9,7 @@ committed context files. It does not write to the host database.
9
9
  - `lib/rails_ai_bridge/configuration.rb` — User-facing config with presets (:standard, :full)
10
10
  - `lib/rails_ai_bridge/introspector.rb` — Orchestrates sub-introspectors
11
11
  - `lib/rails_ai_bridge/introspectors/` — Built-in introspector classes; `:standard` preset
12
- runs **9**, `:full` runs **27** (see `Configuration::PRESETS`). Registry:
12
+ runs **9**, `:full` runs **28** (see `Configuration::PRESETS`). Registry:
13
13
  `Introspector::BUILTIN_INTROSPECTORS` (`:full` already includes
14
14
  `non_ar_models`; opt-in-only symbols not in any preset: `database_stats`,
15
15
  `semantic`).
@@ -39,7 +39,7 @@ committed context files. It does not write to the host database.
39
39
  6. **Diff-aware** — context regeneration skips unchanged files
40
40
  7. **Per-assistant serializers** — each AI tool gets tailored output format
41
41
  8. **Zeitwerk autoloading** — files loaded on-demand, not all upfront
42
- 9. **Introspector presets** — `:standard` (9 core) default, `:full` (27 introspectors, includes `non_ar_models`) with opt-in extras such as `database_stats` and `semantic` for power users
42
+ 9. **Introspector presets** — `:standard` (9 core) default, `:full` (28 introspectors, includes `non_ar_models`) with opt-in extras such as `database_stats` and `semantic` for power users
43
43
  10. **MCP auto-discovery** — `.mcp.json` generated by install generator
44
44
  11. **Outbound context providers (v5)** — `rails_get_provider_context` fetches from declared external MCP services. Disabled by default, exact host allowlist, read-only tool enforcement, `ToolResultCache::NON_CACHEABLE` exclusion. Separate from local `rails_get_context`.
45
45
  12. **Compact by default** — context files ≤150 lines, MCP tools use `detail` parameter (summary/standard/full)