rails-ai-bridge 5.2.0 → 5.3.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/.reek.yml +3 -19
- data/Archspec.rb +0 -1
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTING.md +5 -5
- data/README.md +14 -6
- data/UPGRADING.md +31 -0
- data/docs/GUIDE.md +28 -0
- data/docs/ROADMAP.md +3 -3
- data/docs/design/prism-confidence-tags.md +40 -21
- data/docs/mcp-security.md +3 -2
- data/lib/rails_ai_bridge/config/static_analysis.rb +28 -0
- data/lib/rails_ai_bridge/configuration.rb +11 -0
- data/lib/rails_ai_bridge/introspectors/controller_introspector/filter_extractor.rb +8 -1
- data/lib/rails_ai_bridge/introspectors/controller_introspector/strong_params_provenance.rb +41 -0
- data/lib/rails_ai_bridge/introspectors/controller_introspector.rb +26 -2
- data/lib/rails_ai_bridge/introspectors/static_prism_scanner.rb +134 -0
- data/lib/rails_ai_bridge/introspectors/view_introspector.rb +14 -2
- data/lib/rails_ai_bridge/mcp/cache_rate_limiter.rb +3 -2
- data/lib/rails_ai_bridge/resources.rb +22 -0
- data/lib/rails_ai_bridge/rubydex_adapter/incremental_indexer.rb +6 -2
- data/lib/rails_ai_bridge/tools/confidence_tag.rb +16 -0
- data/lib/rails_ai_bridge/tools/get_controllers.rb +25 -2
- data/lib/rails_ai_bridge/tools/get_view/full_formatter.rb +44 -13
- data/lib/rails_ai_bridge/tools/provenance_lines.rb +33 -0
- data/lib/rails_ai_bridge/version.rb +1 -1
- data/server.json +1 -1
- metadata +5 -7
- data/.reviewer.toml +0 -13
- data/.rs-guardignore +0 -26
- data/lib/rails_ai_bridge/services/app_introspection_service.rb +0 -72
- data/lib/rails_ai_bridge/services/configuration_service.rb +0 -59
- data/lib/rails_ai_bridge/services/context_generation_service.rb +0 -71
- data/lib/rails_ai_bridge/services/file_management_service.rb +0 -174
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2fdc446dd143e92672029e1d06c7081ad870772236dbbf912443ca6bfcab8fb5
|
|
4
|
+
data.tar.gz: edcfd12eabe928b0103bf3e241ae2393b0cd5836b433ffff72c1f454374f0540
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d8b295f8d78e7a4f037f2bb9437bc9281ff535c4d9f6951d848fcae4500c1fbe438675588a247cbff1e98abae6816c0a66dca547a16a09504bd6b3a27e8ed53
|
|
7
|
+
data.tar.gz: 1f479fb9b30ff3a82a2c73f5692cae70f136baf73034b51d372c65fdb7ade96b318a155171b72630479aba4c6244535c73307ac4e0a123880a694ff6445f9439
|
data/.reek.yml
CHANGED
|
@@ -74,6 +74,9 @@ detectors:
|
|
|
74
74
|
- RailsAiBridge::Config::Server#http_port
|
|
75
75
|
- RailsAiBridge::Config::Server#server_name
|
|
76
76
|
- RailsAiBridge::Config::Server#server_version
|
|
77
|
+
- RailsAiBridge::Config::StaticAnalysis#confidence_tags_enabled
|
|
78
|
+
- RailsAiBridge::Config::StaticAnalysis#prism_enabled
|
|
79
|
+
- RailsAiBridge::Config::StaticAnalysis#prism_max_files
|
|
77
80
|
- RailsAiBridge::Fingerprinter::CachedSnapshot#snapshot_ttl
|
|
78
81
|
- RailsAiBridge::Tools::ExplainSymbol#explorer
|
|
79
82
|
- RailsAiBridge#configuration
|
|
@@ -86,7 +89,6 @@ detectors:
|
|
|
86
89
|
- RailsAiBridge::Serializers::ContextFileSerializer#initialize
|
|
87
90
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#compact_engineering_rules_footer_lines
|
|
88
91
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#cursor_engineering_mdc_body_lines
|
|
89
|
-
- RailsAiBridge::Services::FileManagementService#validate_path!
|
|
90
92
|
ControlParameter:
|
|
91
93
|
exclude:
|
|
92
94
|
- RailsAiBridge::Registry::ContextProviderClient#probe
|
|
@@ -112,7 +114,6 @@ detectors:
|
|
|
112
114
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#compact_engineering_rules_footer_lines
|
|
113
115
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#cursor_engineering_mdc_body_lines
|
|
114
116
|
- RailsAiBridge::Service::Result#initialize
|
|
115
|
-
- RailsAiBridge::Services::FileManagementService#validate_path!
|
|
116
117
|
- RailsAiBridge::Tools::GetContext::Resolver#nothing_resolved_error
|
|
117
118
|
- RailsAiBridge::Tools::GetView#self.build_formatter
|
|
118
119
|
- RailsAiBridge::Tools::ResolveSkill#self.not_found_message
|
|
@@ -263,8 +264,6 @@ detectors:
|
|
|
263
264
|
- RailsAiBridge::Serializers::Providers::DevinSerializer#render
|
|
264
265
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#resolved_assistant_overrides_path
|
|
265
266
|
- RailsAiBridge::Server#run_rack_server
|
|
266
|
-
- RailsAiBridge::Services::ContextGenerationService#call
|
|
267
|
-
- RailsAiBridge::Services::FileManagementService#default_allowed_base_dir
|
|
268
267
|
- RailsAiBridge::ToolResultCache#fetch_response
|
|
269
268
|
- RailsAiBridge::ToolResultCache::CachedTool#detect_server_context_param
|
|
270
269
|
- RailsAiBridge::Tools::BaseTool#text_response
|
|
@@ -429,8 +428,6 @@ detectors:
|
|
|
429
428
|
- RailsAiBridge::Serializers::Providers::DevinSerializer#render
|
|
430
429
|
- RailsAiBridge::Server#create_mcp_server
|
|
431
430
|
- RailsAiBridge::Server#run_rack_server
|
|
432
|
-
- RailsAiBridge::Services::AppIntrospectionService#call
|
|
433
|
-
- RailsAiBridge::Services::FileManagementService#file_exists?
|
|
434
431
|
- RailsAiBridge::Tools::GetContext::Composer#append_controller
|
|
435
432
|
- RailsAiBridge::Tools::GetContext::Composer#append_model
|
|
436
433
|
- RailsAiBridge::Tools::GetContext::Composer#append_routes
|
|
@@ -559,7 +556,6 @@ detectors:
|
|
|
559
556
|
- RailsAiBridge::RubydexAdapter#constant_references
|
|
560
557
|
- RailsAiBridge::RubydexAdapter#descendants
|
|
561
558
|
- RailsAiBridge::RubydexAdapter#safe_count
|
|
562
|
-
- RailsAiBridge::Services::FileManagementService#default_allowed_base_dir
|
|
563
559
|
MissingSafeMethod:
|
|
564
560
|
exclude:
|
|
565
561
|
- RailsAiBridge::AssistantFormatsPreference
|
|
@@ -574,7 +570,6 @@ detectors:
|
|
|
574
570
|
- RailsAiBridge::Registry::ResolverCache
|
|
575
571
|
- RailsAiBridge::Registry::DefaultGitRunner
|
|
576
572
|
- RailsAiBridge::RubydexAdapter
|
|
577
|
-
- RailsAiBridge::Services::FileManagementService
|
|
578
573
|
- RailsAiBridge::ToolResultCache
|
|
579
574
|
- RailsAiBridge::Tools::BaseTool
|
|
580
575
|
- RailsAiBridge::Tools::ExplainSymbol
|
|
@@ -659,7 +654,6 @@ detectors:
|
|
|
659
654
|
- RailsAiBridge::Serializers::Providers::ClaudeRulesSerializer#append_tier_model_bullets
|
|
660
655
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#mergeable_override_content?
|
|
661
656
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#resolved_assistant_overrides_path
|
|
662
|
-
- RailsAiBridge::Services::FileManagementService#call
|
|
663
657
|
- RailsAiBridge::Tools::ConfidenceTag#tag
|
|
664
658
|
- RailsAiBridge::Tools::GetContext::Composer#append_controller
|
|
665
659
|
- RailsAiBridge::Tools::GetContext::Composer#append_model
|
|
@@ -970,13 +964,6 @@ detectors:
|
|
|
970
964
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#read_assistant_overrides
|
|
971
965
|
- RailsAiBridge::Serializers::SharedAssistantGuidance#resolved_assistant_overrides_path
|
|
972
966
|
- RailsAiBridge::Server#start_http
|
|
973
|
-
- RailsAiBridge::Services::AppIntrospectionService#call
|
|
974
|
-
- RailsAiBridge::Services::ConfigurationService#call
|
|
975
|
-
- RailsAiBridge::Services::ContextGenerationService#call
|
|
976
|
-
- RailsAiBridge::Services::FileManagementService#call
|
|
977
|
-
- RailsAiBridge::Services::FileManagementService#file_exists?
|
|
978
|
-
- RailsAiBridge::Services::FileManagementService#validate_path!
|
|
979
|
-
- RailsAiBridge::Services::FileManagementService#write_file
|
|
980
967
|
- RailsAiBridge::ToolResultCache#fetch_response
|
|
981
968
|
- RailsAiBridge::ToolResultCache::CachedTool#detect_server_context_param
|
|
982
969
|
- RailsAiBridge::Tools::BaseTool#text_response
|
|
@@ -1317,9 +1304,6 @@ detectors:
|
|
|
1317
1304
|
- RailsAiBridge::Server#register_resources
|
|
1318
1305
|
- RailsAiBridge::Server#tool_classes
|
|
1319
1306
|
- RailsAiBridge::Server#validate_http_server_in_production
|
|
1320
|
-
- RailsAiBridge::Services::ConfigurationService#call
|
|
1321
|
-
- RailsAiBridge::Services::FileManagementService#default_allowed_base_dir
|
|
1322
|
-
- RailsAiBridge::Services::FileManagementService#root_directory?
|
|
1323
1307
|
- RailsAiBridge::ToolResultCache::CachedTool#detect_server_context_param
|
|
1324
1308
|
- RailsAiBridge::Tools::ExplainSymbol::CliExplorer#failure_detail
|
|
1325
1309
|
- RailsAiBridge::Tools::GetContext::RelatedTests#contained?
|
data/Archspec.rb
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,83 @@ 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
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [5.3.0] - 2026-10-08
|
|
11
|
+
|
|
12
|
+
Confidence tags now reach controllers and the full view listing, and an opt-in Prism pass can upgrade
|
|
13
|
+
controller strong params from `[INFERRED]` to `[VERIFIED]`. This release also removes the unused
|
|
14
|
+
`Services` layer, makes `config.mcp.rate_limiter_key_prefix` take effect, and refreshes dependencies.
|
|
15
|
+
Tool output changes by default because `confidence_tags_enabled` is on; see [UPGRADING.md](UPGRADING.md).
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `RailsAiBridge::Tools::ConfidenceTag.footer` builds a one-line verification summary, such as
|
|
20
|
+
`Verification: [VERIFIED] reflection (3) · [INFERRED] regex (2)`, from a per-source count hash.
|
|
21
|
+
Sources with a zero count are left out, and the result is `nil` when none remain.
|
|
22
|
+
- `RailsAiBridge::Introspectors::StaticPrismScanner` finds controller filter macros
|
|
23
|
+
(`before_action` and its variants) with the optional Prism parser and tags each fact
|
|
24
|
+
`provenance: :prism`. It returns an error hash, and never raises, when Prism is unavailable.
|
|
25
|
+
The controller introspector uses it for strong params when `prism_enabled` is on.
|
|
26
|
+
- `Config::StaticAnalysis` adds `confidence_tags_enabled` (default `true`), `prism_enabled` (default `false`), and `prism_max_files` (default `500`). `prism_enabled` turns on the Prism pass for controller strong params.
|
|
27
|
+
- With `prism_enabled` on, strong params that Prism finds as methods in the controller source are tagged `[VERIFIED]` (source `prism`). Otherwise they stay `[INFERRED]`.
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
|
|
31
|
+
- Removed the unused `Services` layer (`AppIntrospectionService`, `ConfigurationService`,
|
|
32
|
+
`ContextGenerationService`, `FileManagementService`). Nothing in the gem used them; they
|
|
33
|
+
were only exercised by their own specs. `RailsAiBridge::Service` and `Service::Result` remain.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- `RailsAiBridge::RubydexAdapter::IncrementalIndexer` raises `ServiceErrors::ValidationError` for an
|
|
38
|
+
unsupported operation and rescues `ServiceErrors::BaseError` into a failure result with
|
|
39
|
+
the same message. The returned result shape is unchanged. Errors that descend from
|
|
40
|
+
`ServiceErrors::BaseError` skip the generic `StandardError` logging path.
|
|
41
|
+
- The controller tool (`rails_get_controllers`) shows confidence tags when `confidence_tags_enabled`
|
|
42
|
+
is on, which is the default. Filters come from Rails reflection. The footer counts them as
|
|
43
|
+
`[VERIFIED]`, except a filter whose `only:` or `except:` came from a string condition, which
|
|
44
|
+
counts as `[INFERRED]`. Filter lines get no per-line tag. Strong params are regex-derived unless Prism confirms them, so they get an
|
|
45
|
+
`[INFERRED]` tag, and are counted as `[INFERRED]` in the footer. Set
|
|
46
|
+
`confidence_tags_enabled` to `false` for the previous output. Controller introspection facts gain
|
|
47
|
+
additive `provenance` keys. Respond_to formats carry provenance in the payload only, because the
|
|
48
|
+
tool does not render them yet.
|
|
49
|
+
- The controller section of `rails_get_context` at `detail: full` shows the same tags and footer as the controller tool. That section is unchanged at summary and standard detail.
|
|
50
|
+
- The full view of `rails_get_view` shows confidence tags when `confidence_tags_enabled` is
|
|
51
|
+
on. Helper methods are regex-derived, so they get an `[INFERRED]` tag. A verification footer
|
|
52
|
+
counts the facts the full view renders. Summary and standard output are unchanged. The setting
|
|
53
|
+
is on by default, so existing full-view output changes. Set `config.confidence_tags_enabled = false`
|
|
54
|
+
to keep the previous output.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- `config.mcp.rate_limiter_key_prefix` now applies to `Mcp::CacheRateLimiter` when `key_prefix:`
|
|
59
|
+
is omitted. The option was previously set but never read. An explicit `key_prefix:` still wins.
|
|
60
|
+
- The README no longer says `rails_get_model_details` verifies facts with `rubydex`. Association facts are verified by reflection, and no tool emits `rubydex` yet. No `rails_get_model_details` output changed.
|
|
61
|
+
|
|
62
|
+
### Maintenance
|
|
63
|
+
|
|
64
|
+
- Refreshed the mutation testing lockfile (`Gemfile-mutation.lock`): `mcp` 1.6.0 → 1.7.0 and
|
|
65
|
+
`railties` 8.1.3.1 → 8.1.4, with the matching Rails gems. Runtime dependency requirements
|
|
66
|
+
are unchanged.
|
|
67
|
+
- Bumped the `simplecov` development dependency from 1.2.0 to 1.3.2 on Ruby 3.3 and newer.
|
|
68
|
+
The lockfile pins 1.3.2, and the Gemfile allows the 1.3.x line. Ruby 3.2 stays on 1.2.0,
|
|
69
|
+
because simplecov 1.3 requires Ruby 3.3. `reek` and `rubycritic` stay on their current versions.
|
|
70
|
+
- Refreshed nine transitive development gems in `Gemfile-mutation.lock` (`date`, `net-http`,
|
|
71
|
+
`net-smtp`, `parallel`, `prettyprint`, `rdoc`, `regexp_parser`, `sorbet-runtime`, `uri`).
|
|
72
|
+
Their versions are newer; no gem moved down. `reek` and `rubycritic` stay on their current
|
|
73
|
+
versions, because `rubycritic` 4.12.0 requires `reek ~> 6.5.0`.
|
|
74
|
+
|
|
75
|
+
## [5.2.1] - 2026-09-23
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
|
|
79
|
+
- Updated the GitHub Pages documentation workflow to `actions/upload-pages-artifact@v5`
|
|
80
|
+
and `actions/deploy-pages@v5` (Dependabot PRs #289 and #290).
|
|
81
|
+
- Updated mutation testing to `mutant-rspec` 0.17.0 and refreshed its lockfile
|
|
82
|
+
to current compatible releases, including `mcp` 1.6.0. Refreshed the demo
|
|
83
|
+
app lockfile as well; runtime dependency requirements are unchanged.
|
|
84
|
+
|
|
8
85
|
## [5.2.0] - 2026-09-14
|
|
9
86
|
|
|
10
87
|
### Added
|
data/CONTRIBUTING.md
CHANGED
|
@@ -73,9 +73,9 @@ bundle exec rubocop --parallel # Lint check
|
|
|
73
73
|
4. Update CHANGELOG.md under an `## [Unreleased]` section
|
|
74
74
|
5. Open a PR with a clear title and description
|
|
75
75
|
|
|
76
|
-
The
|
|
77
|
-
receive `
|
|
78
|
-
|
|
76
|
+
The ocr review workflow skips `dependabot[bot]` PRs and PRs from forks. Those PRs
|
|
77
|
+
do not receive `OPENAI_API_KEY`, so the review would fail. They are reviewed by
|
|
78
|
+
CI (RSpec, RuboCop, bundle-audit) only, and a maintainer reviews them by hand.
|
|
79
79
|
|
|
80
80
|
## Reporting Bugs
|
|
81
81
|
|
|
@@ -90,11 +90,11 @@ Open an issue at https://github.com/igmarin/rails-ai-bridge/issues with:
|
|
|
90
90
|
Pre-flight checklist:
|
|
91
91
|
|
|
92
92
|
1. **Name availability** — Confirm `rails-ai-bridge` is available (or owned by you) on [RubyGems](https://rubygems.org/gems/rails-ai-bridge).
|
|
93
|
-
2. **Version** — `lib/rails_ai_bridge/version.rb` must match the Git tag (release workflow expects `v#{VERSION}`).
|
|
93
|
+
2. **Version** — Bump `lib/rails_ai_bridge/version.rb`, `server.json`, and the `rails-ai-bridge (x.y.z)` lines in `Gemfile-mutation.lock` and `examples/demo_app/Gemfile.lock` together. The version must match the Git tag (the release workflow expects `v#{VERSION}`); `spec/lib/rails_ai_bridge/release_consistency_spec.rb` guards `server.json`, the CHANGELOG heading, and the lockfiles.
|
|
94
94
|
3. **Changelog** — Add a `## [x.y.z]` section in `CHANGELOG.md` (release notes are extracted from it in CI).
|
|
95
95
|
4. **Build locally** — `gem build rails-ai-bridge.gemspec` and smoke-test in a dummy Rails app (`rails generate rails_ai_bridge:install`, `rails ai:bridge`, `rails ai:serve`).
|
|
96
96
|
5. **MFA** — RubyGems account must have MFA; `spec.metadata["rubygems_mfa_required"]` is already `"true"`.
|
|
97
|
-
6. **Trusted publishing** — Prefer [OIDC trusted publishing](https://guides.rubygems.org/trusted-publishing/) with the
|
|
97
|
+
6. **Trusted publishing** — Prefer [OIDC trusted publishing](https://guides.rubygems.org/trusted-publishing/) through `.github/workflows/release.yml`, which runs on a `v*` tag and configures OIDC itself with the `RUBYGEMS_OIDC_ROLE` repository variable (`rubygems/release-gem@v1` does not work here). Configure the gem owner on RubyGems to trust this repository/workflow.
|
|
98
98
|
7. **Secrets** — Avoid API keys in the repo; rely on trusted publishing or short-lived CI secrets.
|
|
99
99
|
8. **MCP registry** — If you publish `server.json` to the MCP registry, coordinate the `name` field (`io.github.igmarin/rails-ai-bridge`) with registry requirements.
|
|
100
100
|
9. **Post-release** — Verify `bundle add rails-ai-bridge` from RubyGems and that badges in the README resolve.
|
data/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Use the README as the shortest path to understanding and setup. Jump to deeper d
|
|
|
41
41
|
| Check what the AI learns | [What Your AI Learns](#what-your-ai-learns) |
|
|
42
42
|
| Choose `:standard`, `:full`, or opt-ins | [Pick the right preset for your app](#pick-the-right-preset-for-your-app) |
|
|
43
43
|
| Use MCP safely | [HTTP transport](#http-transport-alternative-for-all-clients) and [mcp-security.md](docs/mcp-security.md) |
|
|
44
|
-
| Upgrade from
|
|
44
|
+
| Upgrade from an earlier version | [UPGRADING.md](UPGRADING.md) |
|
|
45
45
|
| Improve day-to-day AI results | [Best Practices](docs/BEST_PRACTICES.md) |
|
|
46
46
|
|
|
47
47
|
## When this helps
|
|
@@ -76,7 +76,7 @@ flowchart LR
|
|
|
76
76
|
|
|
77
77
|
1. **Introspect**: built-in scanners read your Rails app structure: schema, models, routes, controllers, gems, tests, conventions, and optional full-stack details.
|
|
78
78
|
2. **Generate**: `rails ai:bridge` writes compact, assistant-specific files such as `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, and Copilot instructions.
|
|
79
|
-
3. **Serve**: `rails ai:serve` exposes 22 read-only `rails_*` tools so an assistant can drill into exact details on demand.
|
|
79
|
+
3. **Serve**: `rails ai:serve` exposes 22 read-only `rails_*` tools (20 registered by default; `enable_data_tools` adds the other 2) so an assistant can drill into exact details on demand.
|
|
80
80
|
|
|
81
81
|
This creates two complementary layers:
|
|
82
82
|
|
|
@@ -112,7 +112,7 @@ RailsAiBridge.configure do |c|
|
|
|
112
112
|
end
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
3. Only remote tools advertising `read_only_hint: true` and `destructive_hint: false` are callable; reflected credentials in provider responses are redacted before they reach MCP clients.
|
|
116
116
|
|
|
117
117
|
See [docs/v5/context-providers-design.md](docs/v5/context-providers-design.md) for the design and security model, and [docs/mcp-security.md](docs/mcp-security.md) for SSRF controls and operator checklists.
|
|
118
118
|
|
|
@@ -296,7 +296,7 @@ The gem exposes **22 built-in tool classes** via MCP — 20 registered by defaul
|
|
|
296
296
|
| Tool | What it returns |
|
|
297
297
|
|------|----------------|
|
|
298
298
|
| `rails_get_schema` | Tables, columns, indexes, foreign keys — tagged `[VERIFIED]` (live ActiveRecord) or `[INFERRED]` (static schema.rb / structure.sql parse) |
|
|
299
|
-
| `rails_get_model_details` | Associations, validations, scopes, enums, callbacks, source macros, semantic tier, non-AR models (when enabled) — tagged `[VERIFIED]` (reflection
|
|
299
|
+
| `rails_get_model_details` | Associations, validations, scopes, enums, callbacks, source macros, semantic tier, non-AR models (when enabled) — tagged `[VERIFIED]` (reflection) or `[INFERRED]` (source regex) |
|
|
300
300
|
| `rails_get_context` | In-process composite for one model, controller, or feature: table + model + routes + controller actions + cheap related tests (no HTTP) |
|
|
301
301
|
| `rails_get_routes` | HTTP verbs, paths, controller actions |
|
|
302
302
|
| `rails_get_controllers` | Actions, inherited filters (source class at standard/full), strong params, concerns |
|
|
@@ -320,6 +320,8 @@ The gem exposes **22 built-in tool classes** via MCP — 20 registered by defaul
|
|
|
320
320
|
|
|
321
321
|
All tools are **read-only** — they never modify your application or database.
|
|
322
322
|
|
|
323
|
+
**Confidence tags legend.** Some tools label each fact with its evidence. `[VERIFIED]` means the fact is provable at runtime or from the AST. `[INFERRED]` means it comes from a pattern, a heuristic, or a schema-file parse (the `static` source label). `[STATIC]` is reserved and never emitted. `rails_get_schema` and `rails_get_model_details` tag facts, as do single-controller `rails_get_controllers` output at any detail level, full-detail `rails_get_controllers` lists, and full-detail `rails_get_view` output. The schema and model sections of `rails_get_context` are tagged too, and its controller section is tagged at full detail. Set `config.confidence_tags_enabled = false` in the `RailsAiBridge.configure` block to remove the controller and view tags; schema and model tags stay on. The guide's [Reading confidence tags](docs/GUIDE.md#reading-confidence-tags) section explains the footer and the settings.
|
|
324
|
+
|
|
323
325
|
### Smart Detail Levels
|
|
324
326
|
|
|
325
327
|
Schema, routes, models, and controllers tools support a `detail` parameter — critical for large apps:
|
|
@@ -568,6 +570,8 @@ end
|
|
|
568
570
|
<details>
|
|
569
571
|
<summary><strong>All configuration options</strong></summary>
|
|
570
572
|
|
|
573
|
+
The confidence and Prism settings also work on the `static_analysis` sub-object. See the [options reference in the guide](docs/GUIDE.md#options-reference) for both paths.
|
|
574
|
+
|
|
571
575
|
| Option | Default | Description |
|
|
572
576
|
|--------|---------|-------------|
|
|
573
577
|
| `preset` | `:standard` | Introspector preset (`:standard` or `:full`) |
|
|
@@ -604,6 +608,10 @@ end
|
|
|
604
608
|
| `parallel_introspection` | `false` | Run introspectors concurrently (requires `concurrent-ruby`, which is already a Rails dependency) |
|
|
605
609
|
| `parallel_pool_size` | `4` | Max threads in the parallel pool; capped at the number of active introspectors so no idle threads are created |
|
|
606
610
|
| `parallel_timeout_seconds` | `10` | Per-introspector future timeout (seconds); timed-out introspectors return `{ error: "timed out after Ns" }` without blocking the others |
|
|
611
|
+
| `static_analysis` | built in | Sub-object (`RailsAiBridge::Config::StaticAnalysis`) for the confidence and Prism settings below, such as `config.static_analysis.confidence_tags_enabled` |
|
|
612
|
+
| `confidence_tags_enabled` | `true` | Adds tags and footers to single-controller output at any `detail` level, to full-detail `rails_get_controllers` output, to the controller section of full-detail `rails_get_context` output, and to full-detail `rails_get_view` output. Summary and standard list output (no `controller:` argument) has no tags or footers. Schema and model tags are always on. |
|
|
613
|
+
| `prism_enabled` | `false` | Turns on the Prism pass. Strong params that Prism finds as methods in the controller source render as `[VERIFIED]`. Needs Prism, a default gem on Ruby 3.3+. |
|
|
614
|
+
| `prism_max_files` | `500` | Caps the files the Prism pass reads per introspection run. |
|
|
607
615
|
| `registry.registry_manifest_path` | `"config/rails_ai_bridge/registry.json"` | Path to the registry manifest JSON file for skill pack resolution |
|
|
608
616
|
| `registry.skill_cache_dir` | `"~/.rails-ai-bridge/cache"` | Directory for caching git repositories containing skill packs |
|
|
609
617
|
| `registry.skill_packs` | `nil` | Explicit pack names to load, or `nil` for auto-detection based on framework |
|
|
@@ -906,7 +914,7 @@ The docs are layered so new users do not need to read everything at once.
|
|
|
906
914
|
| A quick install and mental model | This README |
|
|
907
915
|
| See it working on a tiny app | [docs/EXAMPLES.md](docs/EXAMPLES.md) and [examples/](examples/) |
|
|
908
916
|
| MCP Registry listing steps | [docs/mcp-registry-submission.md](docs/mcp-registry-submission.md) |
|
|
909
|
-
| Full API reference (YARD) | [https://igmarin.github.io/rails-ai-bridge/](https://igmarin.github.io/rails-ai-bridge/) —
|
|
917
|
+
| Full API reference (YARD) | [https://igmarin.github.io/rails-ai-bridge/](https://igmarin.github.io/rails-ai-bridge/) — published on every `v*` tag release |
|
|
910
918
|
| How to get better AI output day to day | [docs/BEST_PRACTICES.md](docs/BEST_PRACTICES.md) |
|
|
911
919
|
| Every command, config option, generated file, and MCP parameter | [docs/GUIDE.md](docs/GUIDE.md) |
|
|
912
920
|
| Complete Devin setup — MCP wiring, skills, troubleshooting | [docs/devin-setup.md](docs/devin-setup.md) |
|
|
@@ -945,7 +953,7 @@ Bug reports and pull requests: [github.com/igmarin/rails-ai-bridge/issues](https
|
|
|
945
953
|
|
|
946
954
|
## Acknowledgments & Origins
|
|
947
955
|
|
|
948
|
-
This gem ships as **rails-ai-bridge** (Ruby **`RailsAiBridge
|
|
956
|
+
This gem ships as **rails-ai-bridge** (Ruby **`RailsAiBridge`**). Earlier iterations of the same codebase were distributed as `rails-ai-context`.
|
|
949
957
|
|
|
950
958
|
RailsMCP evolved from
|
|
951
959
|
[crisnahine/rails-ai-context](https://github.com/crisnahine/rails-ai-context),
|
data/UPGRADING.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Upgrading rails-ai-bridge
|
|
2
2
|
|
|
3
|
+
## Upgrading from 5.2.x to 5.3.0
|
|
4
|
+
|
|
5
|
+
**No action is required.** One default changes what tools print.
|
|
6
|
+
|
|
7
|
+
- **Confidence tags are on by default.** `rails_get_controllers`, full-detail `rails_get_view`, and the
|
|
8
|
+
controller section of full-detail `rails_get_context` now mark facts `[VERIFIED]` or `[INFERRED]` and end
|
|
9
|
+
with a `Verification:` footer. To get the previous output, set
|
|
10
|
+
`config.confidence_tags_enabled = false`. See "Reading confidence tags" in [docs/GUIDE.md](docs/GUIDE.md).
|
|
11
|
+
- **Prism verification is opt-in.** `config.prism_enabled = true` lets a Prism parse confirm controller
|
|
12
|
+
strong params, which then show `[VERIFIED]`. Prism is a default gem on Ruby 3.3 and newer. On Ruby 3.2,
|
|
13
|
+
add `gem 'prism'` to your Gemfile; without it the pass is skipped and strong params stay `[INFERRED]`.
|
|
14
|
+
`config.prism_max_files` (default `500`) caps how many files one run parses.
|
|
15
|
+
- **`config.mcp.rate_limiter_key_prefix` now takes effect.** If you set it, `Mcp::CacheRateLimiter` uses it
|
|
16
|
+
when you do not pass `key_prefix:`, so existing counters start fresh once.
|
|
17
|
+
- **The unused `Services` layer is removed** (`RailsAiBridge::Services::AppIntrospectionService`,
|
|
18
|
+
`ConfigurationService`, `ContextGenerationService`, `FileManagementService`). The gem never called them.
|
|
19
|
+
If your code referenced them, use `RailsAiBridge.introspect` and `RailsAiBridge.generate_context`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Upgrading from 5.1.x to 5.2.0
|
|
24
|
+
|
|
25
|
+
**No action is required.**
|
|
26
|
+
|
|
27
|
+
- Every generated context file now carries an `## Anti-hallucination rules` block. Set
|
|
28
|
+
`config.output.anti_hallucination_rules = false` to leave it out.
|
|
29
|
+
- `rails_query` and `rails_read_logs` are new and stay off until you set `config.enable_data_tools = true`.
|
|
30
|
+
See [docs/mcp-security.md](docs/mcp-security.md) before enabling them.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
3
34
|
## Upgrading from 5.0.0 to 5.1.0
|
|
4
35
|
|
|
5
36
|
**One action required if you are pinned to `rubydex` 0.3.x:**
|
data/docs/GUIDE.md
CHANGED
|
@@ -10,6 +10,7 @@ Commands, tools, config, and setup. For the short path, use the [README](../READ
|
|
|
10
10
|
- [Context Modes](#context-modes)
|
|
11
11
|
- [Generated Files](#generated-files)
|
|
12
12
|
- [All Commands](#all-commands)
|
|
13
|
+
- [Reading confidence tags](#reading-confidence-tags)
|
|
13
14
|
- [MCP Tools — Full Reference](#mcp-tools--full-reference)
|
|
14
15
|
- [MCP Resources](#mcp-resources)
|
|
15
16
|
- [MCP Server Setup](#mcp-server-setup)
|
|
@@ -293,6 +294,27 @@ end
|
|
|
293
294
|
|
|
294
295
|
---
|
|
295
296
|
|
|
297
|
+
## Reading confidence tags
|
|
298
|
+
|
|
299
|
+
Some tools label each fact with the evidence behind it.
|
|
300
|
+
|
|
301
|
+
| Tag | Meaning | Sources |
|
|
302
|
+
|-----|---------|---------|
|
|
303
|
+
| `[VERIFIED]` | Provable at runtime or from the AST | `reflection`, `prism` (controller strong params, with `prism_enabled`), `live`. `rubydex` is recognized by the tag layer, but no tool emits it. |
|
|
304
|
+
| `[INFERRED]` | Comes from a pattern or heuristic | `regex`, `heuristic`, schema file parses (the internal `static` source, not the `[STATIC]` tag), and any other source |
|
|
305
|
+
| `[STATIC]` | Reserved for a future static tier. Not emitted yet. | none |
|
|
306
|
+
|
|
307
|
+
Tags appear in two forms:
|
|
308
|
+
|
|
309
|
+
- **Inline tags** on a single line, such as ``- `name` [INFERRED]`` for a strong param found by regex.
|
|
310
|
+
- **A footer** that counts facts by source, such as `Verification: [VERIFIED] reflection (3) · [INFERRED] regex (2)`. Single-controller output (a request for one controller) gets one under the controller heading at every `detail` level. The controller section of full-detail `rails_get_context` output gets one too. Full-detail output gets one per controller in `rails_get_controllers`, and one at the end of `rails_get_view`. Summary and standard lists have no footer.
|
|
311
|
+
|
|
312
|
+
Tagged output: single-controller output at any `detail` level, full-detail `rails_get_controllers` output, the controller section of full-detail `rails_get_context` output, and full-detail `rails_get_view` output. The schema and model tools also tag facts. Controller and view list output at summary and standard detail has no tags or footers. Other tools don't tag facts yet.
|
|
313
|
+
|
|
314
|
+
To remove the controller and view tags, set `config.confidence_tags_enabled = false` in the `RailsAiBridge.configure` block. Schema and model tags stay on regardless, because they predate the setting.
|
|
315
|
+
|
|
316
|
+
`prism_enabled` turns on the Prism pass. It confirms controller strong params that Prism finds as methods in the controller source, and those render as `[VERIFIED]`. `prism_max_files` caps how many files the pass reads per run. Without Prism available, strong params stay `[INFERRED]`.
|
|
317
|
+
|
|
296
318
|
## MCP Tools — Full Reference
|
|
297
319
|
|
|
298
320
|
All **22 built-in tools** are **read-only** and **idempotent** — they never modify your application or database. Hosts can append more via `config.additional_tools`.
|
|
@@ -866,6 +888,8 @@ sort then take), and `parallel_introspection` is **off**.
|
|
|
866
888
|
|
|
867
889
|
### Options reference
|
|
868
890
|
|
|
891
|
+
The settings `confidence_tags_enabled`, `prism_enabled`, and `prism_max_files` work at the top level, such as `config.confidence_tags_enabled`, and on the sub-object, such as `config.static_analysis.confidence_tags_enabled`. Both paths write the same setting, so the last assignment wins.
|
|
892
|
+
|
|
869
893
|
| Option | Type | Default | Description |
|
|
870
894
|
|--------|------|---------|-------------|
|
|
871
895
|
| `preset` | Symbol | `:standard` | Introspector preset (`:standard` or `:full`) |
|
|
@@ -901,6 +925,10 @@ sort then take), and `parallel_introspection` is **off**.
|
|
|
901
925
|
| `parallel_introspection` | Boolean | `false` | Run introspectors concurrently using a `Concurrent::FixedThreadPool`. Requires `concurrent-ruby` (already a Rails transitive dep). Automatically disabled when the ActiveRecord connection pool has only one slot. |
|
|
902
926
|
| `parallel_pool_size` | Integer | `4` | Upper bound on pool threads. Actual size is `min(introspector_count, parallel_pool_size)` — no idle threads are created. Only relevant when `parallel_introspection` is `true`. |
|
|
903
927
|
| `parallel_timeout_seconds` | Integer | `10` | Seconds each future may run before being cancelled. Timed-out introspectors return `{ error: "timed out after Ns" }`. Also used as the `wait_for_termination` grace period. Only relevant when `parallel_introspection` is `true`. |
|
|
928
|
+
| `static_analysis` | `RailsAiBridge::Config::StaticAnalysis` | built in | Sub-object for the confidence and Prism settings below, such as `config.static_analysis.confidence_tags_enabled` |
|
|
929
|
+
| `confidence_tags_enabled` | Boolean | `true` | Adds tags and footers to single-controller output at any `detail` level, to full-detail `rails_get_controllers` output, to the controller section of full-detail `rails_get_context` output, and to full-detail `rails_get_view` output. Summary and standard list output (no `controller:` argument) has no tags or footers. Schema and model tags are always on. |
|
|
930
|
+
| `prism_enabled` | Boolean | `false` | Turns on the Prism pass. Strong params that Prism finds as methods in the controller source render as `[VERIFIED]`. Needs Prism, a default gem on Ruby 3.3+. |
|
|
931
|
+
| `prism_max_files` | Integer | `500` | Caps the files the Prism pass reads per introspection run. |
|
|
904
932
|
|
|
905
933
|
---
|
|
906
934
|
|
data/docs/ROADMAP.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# rails-ai-bridge — Roadmap
|
|
2
2
|
|
|
3
|
-
Last updated: 2026-
|
|
3
|
+
Last updated: 2026-10-08
|
|
4
4
|
|
|
5
5
|
## Vision
|
|
6
6
|
|
|
@@ -50,11 +50,11 @@ Epic [#259](https://github.com/igmarin/rails-ai-bridge/issues/259) — Growth &
|
|
|
50
50
|
| #262 | Hosted docs | YARD to GitHub Pages on tag push with latest banner |
|
|
51
51
|
| #263 | Positioning | docs/COMPARISON.md + README rewrite; factual, cited, no disparagement |
|
|
52
52
|
|
|
53
|
-
## Phase 3 —
|
|
53
|
+
## Phase 3 — milestone #9: design-doc epics (#264 shipped in 5.3.0; #265 and #266 are next)
|
|
54
54
|
|
|
55
55
|
| # | Epic | Description |
|
|
56
56
|
|---|------|-------------|
|
|
57
|
-
| #264 | Prism confidence tags |
|
|
57
|
+
| #264 | Prism confidence tags | **Done** in 5.3.0 for the tag layer (schema, model, controller, and full-view output, including the controller section of `rails_get_context`) and the opt-in Prism upgrade of strong params (#326). `rails_get_test_info` is deferred. |
|
|
58
58
|
| #265 | Dependency graph | introspector + `rails_get_dependency_graph` tool (woods-style edges); design doc first |
|
|
59
59
|
| #266 | Multi-project | `switch_project`, version-manager-aware booting; config-server rework design doc first |
|
|
60
60
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Design:
|
|
1
|
+
# Design: Prism confidence tags (`[VERIFIED]` / `[INFERRED]`)
|
|
2
2
|
|
|
3
|
-
Epic: [#264](https://github.com/igmarin/rails-ai-bridge/issues/264) —
|
|
3
|
+
Epic: [#264](https://github.com/igmarin/rails-ai-bridge/issues/264) — Prism confidence tags (shipped in 5.3.0; milestone #9, phase 3).
|
|
4
4
|
|
|
5
5
|
## Problem / Motivation
|
|
6
6
|
|
|
@@ -67,8 +67,12 @@ new edges — `StaticPrismScanner` lives in `introspectors/` (glob-covered), rea
|
|
|
67
67
|
imports tools. `RubydexAdapter` use from introspectors is the existing pattern (`ModelSemanticEnrichment`).
|
|
68
68
|
|
|
69
69
|
**Which introspectors get tags first** (epic requirement): schema and models are done (#187). Order
|
|
70
|
-
of the remaining rollout: controllers
|
|
71
|
-
|
|
70
|
+
of the remaining rollout: controllers. Filters come from Rails reflection (`_process_action_callbacks`),
|
|
71
|
+
so they are `[VERIFIED]`, except filters whose `only:`/`except:` came from a string condition. Those
|
|
72
|
+
are `[INFERRED]`. Strong params and respond_to formats are regex-derived, so they are
|
|
73
|
+
`[INFERRED]`. The controllers tool does not render respond_to formats yet, so their provenance is in
|
|
74
|
+
the payload only. Prism upgrades strong params to `[VERIFIED]` once the scanner reports their method
|
|
75
|
+
definitions with `prism_enabled` on (#326). Then
|
|
72
76
|
jobs (sidekiq/activejob class-level config), then views. Routes are runtime-extracted and stay
|
|
73
77
|
implicitly `[VERIFIED]`.
|
|
74
78
|
|
|
@@ -92,7 +96,7 @@ implicitly `[VERIFIED]`.
|
|
|
92
96
|
|---|---|---|
|
|
93
97
|
| `[VERIFIED]` | Provable at runtime or via AST | `reflection`, `rubydex`, `prism`, `live` |
|
|
94
98
|
| `[INFERRED]` | Regex/heuristic or absent provenance | `regex`, `heuristic`, `nil` |
|
|
95
|
-
| `[STATIC]` | Reserved — static-tier fallback | backlog, not emitted in
|
|
99
|
+
| `[STATIC]` | Reserved — static-tier fallback | backlog, not emitted in 5.3.0 |
|
|
96
100
|
|
|
97
101
|
Rendering rules (compact-by-default):
|
|
98
102
|
|
|
@@ -109,7 +113,7 @@ Introspector payloads stay backward compatible; provenance is additive:
|
|
|
109
113
|
|
|
110
114
|
```ruby
|
|
111
115
|
# e.g. context[:controllers][:controllers]["UsersController"][:before_actions]
|
|
112
|
-
[{ filter: 'authenticate_user!', provenance: :
|
|
116
|
+
[{ filter: 'authenticate_user!', provenance: :prism }, ...]
|
|
113
117
|
```
|
|
114
118
|
|
|
115
119
|
`ConfidenceTag` gains one public helper: `ConfidenceTag.footer(provenance_counts)` returning a
|
|
@@ -132,13 +136,14 @@ directions; no file moves (no #250-style churn).
|
|
|
132
136
|
|
|
133
137
|
### Tool / response surface
|
|
134
138
|
|
|
135
|
-
- No new
|
|
139
|
+
- No new tool classes. `Server::TOOLS` unchanged; count parity specs unchanged. Existing tool output gains tags and footers instead.
|
|
136
140
|
- `rails_get_schema`, `rails_get_model_details` keep current behavior (already tagged).
|
|
137
|
-
- `rails_get_controllers`, `
|
|
141
|
+
- `rails_get_controllers`, `rails_get_view`, and the controller section of full-detail `rails_get_context` gain footer/inline tags when
|
|
138
142
|
`confidence_tags_enabled`; all keep `detail:` (`summary`/`standard`/`full`), `format:`
|
|
139
143
|
(`json`/`markdown`), and annotations `read_only_hint: true, destructive_hint: false,
|
|
140
144
|
idempotent_hint: true, open_world_hint: false`.
|
|
141
145
|
- Errors unchanged: unavailable sections return the existing "not available" message, never a tag.
|
|
146
|
+
- Deferred: `rails_get_test_info` was in the first draft of this scope. No sub-issue covers it, so it stays untagged in 5.3.0.
|
|
142
147
|
|
|
143
148
|
**Preset decision (explicit):** no preset changes. Tags ride existing introspectors; the optional
|
|
144
149
|
`:static_analysis` introspector is **opt-in only** (host registers via
|
|
@@ -160,9 +165,9 @@ First failing specs (write, run, confirm they fail for the right reason):
|
|
|
160
165
|
unavailable: `#facts_for(path)` returns `{ error: '...' }`, never raises; with a fixture class,
|
|
161
166
|
emits `provenance: :prism` facts capped by `prism_max_files`.
|
|
162
167
|
4. `spec/lib/rails_ai_bridge/tools/get_controllers_detail_spec.rb` — extend: markdown contains
|
|
163
|
-
`[INFERRED]` for regex-derived
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
`[INFERRED]` for regex-derived strong params; `[VERIFIED]` for reflected filters; a verification
|
|
169
|
+
footer that counts both; absent entirely when `confidence_tags_enabled=false`. The Prism upgrade of
|
|
170
|
+
strong params is a follow-up (see the rollout note above).
|
|
166
171
|
|
|
167
172
|
Implementation order: (1) `ConfidenceTag.footer` -> (2) `Config::StaticAnalysis` + delegators ->
|
|
168
173
|
(3) `StaticPrismScanner` (prism-optional, error-safe) -> (4) provenance on controller introspector ->
|
|
@@ -184,8 +189,8 @@ Implementation order: (1) `ConfidenceTag.footer` -> (2) `Config::StaticAnalysis`
|
|
|
184
189
|
|
|
185
190
|
## Rollout
|
|
186
191
|
|
|
187
|
-
- Milestone #9 (phase 3
|
|
188
|
-
- CHANGELOG
|
|
192
|
+
- Milestone #9 (phase 3). Implementation sub-issues created from this doc per epic #264.
|
|
193
|
+
- CHANGELOG 5.3.0 entry; README tool-table note ("confidence tags legend"); GUIDE section
|
|
189
194
|
"Reading confidence tags"; `docs/ROADMAP.md` backlog `[STATIC]` item stays reserved.
|
|
190
195
|
- Deprecation/compat: none — additive keys and opt-in behavior; disabled path is byte-identical to
|
|
191
196
|
today's output.
|
|
@@ -203,12 +208,26 @@ Implementation order: (1) `ConfidenceTag.footer` -> (2) `Config::StaticAnalysis`
|
|
|
203
208
|
- **Tags rendered inside introspectors**: rejected — would make introspectors depend on
|
|
204
209
|
presentation and break the "plain Hashes" rule (`introspectors.cannot_use :serializers, :tools`).
|
|
205
210
|
|
|
206
|
-
##
|
|
211
|
+
## Decisions
|
|
207
212
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
Recorded 2026-10-08. These answer the three questions this section used to list.
|
|
214
|
+
|
|
215
|
+
1. **Provenance shape: one symbol per fact.** Precedence is `reflection > prism > rubydex > regex`.
|
|
216
|
+
There is no `prism_verified` boolean. The JSON payload carries one `provenance` symbol.
|
|
217
|
+
2. **Prism dependency: optional.** The gemspec does not change. The gem keeps supporting Ruby 3.2,
|
|
218
|
+
with the static Prism pass off. Users on 3.2 add `prism` to their own Gemfile to enable it. The
|
|
219
|
+
scanner must degrade silently when Prism is missing (TDD plan item 3).
|
|
220
|
+
3. **`[STATIC]` tag: reserved, not emitted.** It stays out of output until the static-tier backlog
|
|
221
|
+
epic. This matches the non-goals above.
|
|
222
|
+
|
|
223
|
+
## Implementation sub-issues
|
|
224
|
+
|
|
225
|
+
Created from the TDD plan once this doc is merged. One sub-issue per implementation step:
|
|
226
|
+
|
|
227
|
+
1. `ConfidenceTag.footer` (TDD plan item 1). [#315](https://github.com/igmarin/rails-ai-bridge/issues/315)
|
|
228
|
+
2. `Config::StaticAnalysis` and its flat delegators (item 2). [#316](https://github.com/igmarin/rails-ai-bridge/issues/316)
|
|
229
|
+
3. `StaticPrismScanner`, Prism-optional and error-safe (item 3). [#317](https://github.com/igmarin/rails-ai-bridge/issues/317)
|
|
230
|
+
4. Provenance on the controller introspector (item 4). [#318](https://github.com/igmarin/rails-ai-bridge/issues/318)
|
|
231
|
+
4b. Prism upgrade of strong params via method definitions, opt-in through `prism_enabled`. [#326](https://github.com/igmarin/rails-ai-bridge/issues/326)
|
|
232
|
+
5. Tool rendering: controllers, the controller section of full-detail `rails_get_context`, and views. Jobs were skipped because no tool renders job facts. [#319](https://github.com/igmarin/rails-ai-bridge/issues/319)
|
|
233
|
+
6. Docs parity: README, GUIDE, CHANGELOG, ROADMAP (item 6). [#320](https://github.com/igmarin/rails-ai-bridge/issues/320)
|
data/docs/mcp-security.md
CHANGED
|
@@ -82,12 +82,13 @@ RailsAiBridge.configure do |config|
|
|
|
82
82
|
config.mcp.rate_limiter = RailsAiBridge::Mcp::CacheRateLimiter.new(
|
|
83
83
|
max_requests: 300,
|
|
84
84
|
window_seconds: 60,
|
|
85
|
-
cache: Rails.cache
|
|
86
|
-
key_prefix: "rab:rl"
|
|
85
|
+
cache: Rails.cache
|
|
87
86
|
)
|
|
88
87
|
end
|
|
89
88
|
```
|
|
90
89
|
|
|
90
|
+
The cache key prefix comes from `config.mcp.rate_limiter_key_prefix` (default `"rab:rl"`). Set it to keep keys separate per app or environment.
|
|
91
|
+
|
|
91
92
|
Alternatively, use `Rack::Attack` in front of the MCP endpoint for centralized, proxy-aware throttling:
|
|
92
93
|
|
|
93
94
|
```ruby
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsAiBridge
|
|
4
|
+
module Config
|
|
5
|
+
# Holds static analysis settings for confidence tags and the optional Prism pass.
|
|
6
|
+
#
|
|
7
|
+
# Confidence tags mark each fact as [VERIFIED] or [INFERRED]. The Prism pass is
|
|
8
|
+
# off by default. It needs the +prism+ gem, which this gem does not depend on.
|
|
9
|
+
#
|
|
10
|
+
# @see RailsAiBridge::Tools::ConfidenceTag
|
|
11
|
+
class StaticAnalysis
|
|
12
|
+
# @return [Boolean] whether tool output carries [VERIFIED] / [INFERRED] tags
|
|
13
|
+
attr_accessor :confidence_tags_enabled
|
|
14
|
+
|
|
15
|
+
# @return [Boolean] whether the optional Prism AST pass runs
|
|
16
|
+
attr_accessor :prism_enabled
|
|
17
|
+
|
|
18
|
+
# @return [Integer] maximum number of source files the Prism pass scans
|
|
19
|
+
attr_accessor :prism_max_files
|
|
20
|
+
|
|
21
|
+
def initialize
|
|
22
|
+
@confidence_tags_enabled = true
|
|
23
|
+
@prism_enabled = false
|
|
24
|
+
@prism_max_files = 500
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -19,6 +19,7 @@ module RailsAiBridge
|
|
|
19
19
|
# @see Config::Output
|
|
20
20
|
# @see Config::Mcp
|
|
21
21
|
# @see Config::Registry
|
|
22
|
+
# @see Config::StaticAnalysis
|
|
22
23
|
# @see RailsAiBridge.configure
|
|
23
24
|
class Configuration
|
|
24
25
|
extend Forwardable
|
|
@@ -61,6 +62,9 @@ module RailsAiBridge
|
|
|
61
62
|
# @return [Config::ContextProviders]
|
|
62
63
|
attr_reader :context_providers
|
|
63
64
|
|
|
65
|
+
# @return [Config::StaticAnalysis]
|
|
66
|
+
attr_reader :static_analysis
|
|
67
|
+
|
|
64
68
|
def initialize
|
|
65
69
|
@auth = Config::Auth.new
|
|
66
70
|
@server = Config::Server.new
|
|
@@ -70,6 +74,7 @@ module RailsAiBridge
|
|
|
70
74
|
@rubydex = Config::Rubydex.new
|
|
71
75
|
@registry = Config::Registry.new
|
|
72
76
|
@context_providers = Config::ContextProviders.new
|
|
77
|
+
@static_analysis = Config::StaticAnalysis.new
|
|
73
78
|
end
|
|
74
79
|
|
|
75
80
|
# -- Config::Auth -----------------------------------------------------------
|
|
@@ -140,6 +145,12 @@ module RailsAiBridge
|
|
|
140
145
|
:rubydex_incremental_threshold, :rubydex_incremental_threshold=,
|
|
141
146
|
:rubydex_persist_index, :rubydex_persist_index=
|
|
142
147
|
|
|
148
|
+
# -- Config::StaticAnalysis -------------------------------------------------
|
|
149
|
+
def_delegators :@static_analysis,
|
|
150
|
+
:confidence_tags_enabled, :confidence_tags_enabled=,
|
|
151
|
+
:prism_enabled, :prism_enabled=,
|
|
152
|
+
:prism_max_files, :prism_max_files=
|
|
153
|
+
|
|
143
154
|
# Convenience predicate for checking if rubydex is available and enabled.
|
|
144
155
|
#
|
|
145
156
|
# @return [Boolean]
|