rails-ai-context 5.38.2 → 5.39.1

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 (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +207 -0
  3. data/CODE_OF_CONDUCT.md +44 -0
  4. data/CONTRIBUTING.md +26 -1
  5. data/README.md +436 -193
  6. data/docs/ARCHITECTURE.md +2 -2
  7. data/docs/CLI.md +6 -3
  8. data/docs/COMPATIBILITY.md +4 -3
  9. data/docs/CONFIGURATION.md +1 -1
  10. data/docs/FAQ.md +1 -2
  11. data/docs/GUIDE.md +25 -27
  12. data/docs/INTROSPECTORS.md +11 -5
  13. data/docs/PROMPTS.md +6 -7
  14. data/docs/QUICKSTART.md +1 -1
  15. data/docs/SECURITY.md +10 -10
  16. data/docs/SETUP.md +53 -31
  17. data/docs/STANDALONE.md +3 -3
  18. data/docs/TOOLS.md +6 -6
  19. data/docs/TROUBLESHOOTING.md +15 -10
  20. data/docs/adr/0002-static-tier-declared-not-detected.md +5 -0
  21. data/docs/adr/0005-workspace-mcp-entries.md +6 -5
  22. data/docs/index.md +30 -36
  23. data/exe/rails-ai-context +2 -2
  24. data/lib/generators/rails_ai_context/install/install_generator.rb +22 -15
  25. data/lib/rails_ai_context/action_filters.rb +1 -1
  26. data/lib/rails_ai_context/brackets.rb +58 -6
  27. data/lib/rails_ai_context/cli/app_root.rb +12 -3
  28. data/lib/rails_ai_context/concern_membership.rb +1 -1
  29. data/lib/rails_ai_context/database_yml.rb +12 -1
  30. data/lib/rails_ai_context/doctor.rb +67 -103
  31. data/lib/rails_ai_context/erb_source.rb +41 -26
  32. data/lib/rails_ai_context/gem_lock.rb +4 -1
  33. data/lib/rails_ai_context/install/ai_tool.rb +37 -10
  34. data/lib/rails_ai_context/install/initializer_file.rb +111 -12
  35. data/lib/rails_ai_context/install/program.rb +25 -23
  36. data/lib/rails_ai_context/install/uninstall.rb +3 -5
  37. data/lib/rails_ai_context/install/workspace.rb +1 -1
  38. data/lib/rails_ai_context/introspectors/action_resolver.rb +14 -18
  39. data/lib/rails_ai_context/introspectors/controller_introspector.rb +2 -2
  40. data/lib/rails_ai_context/introspectors/convention_introspector.rb +3 -4
  41. data/lib/rails_ai_context/introspectors/declared_constant.rb +8 -0
  42. data/lib/rails_ai_context/introspectors/devops_introspector.rb +30 -6
  43. data/lib/rails_ai_context/introspectors/env_references.rb +16 -0
  44. data/lib/rails_ai_context/introspectors/frontend_framework_introspector.rb +1 -0
  45. data/lib/rails_ai_context/introspectors/i18n_introspector.rb +1 -0
  46. data/lib/rails_ai_context/introspectors/job_introspector.rb +37 -9
  47. data/lib/rails_ai_context/introspectors/listeners/env_access_listener.rb +15 -6
  48. data/lib/rails_ai_context/introspectors/model_introspector.rb +11 -2
  49. data/lib/rails_ai_context/introspectors/module_aliases.rb +1 -0
  50. data/lib/rails_ai_context/introspectors/multi_database_introspector.rb +6 -2
  51. data/lib/rails_ai_context/introspectors/n_plus_one_scan.rb +22 -4
  52. data/lib/rails_ai_context/introspectors/performance_introspector.rb +41 -2
  53. data/lib/rails_ai_context/introspectors/recurring_schedules.rb +18 -2
  54. data/lib/rails_ai_context/introspectors/render_calls.rb +40 -2
  55. data/lib/rails_ai_context/introspectors/route_introspector.rb +6 -3
  56. data/lib/rails_ai_context/introspectors/side_effects.rb +1 -1
  57. data/lib/rails_ai_context/introspectors/source_scan.rb +2 -1
  58. data/lib/rails_ai_context/introspectors/stimulus_introspector.rb +57 -28
  59. data/lib/rails_ai_context/introspectors/structure_sql_reader.rb +24 -1
  60. data/lib/rails_ai_context/introspectors/turbo_introspector.rb +108 -20
  61. data/lib/rails_ai_context/introspectors/view_introspector.rb +50 -25
  62. data/lib/rails_ai_context/introspectors/view_template_introspector.rb +98 -22
  63. data/lib/rails_ai_context/mcp_config_generator.rb +110 -46
  64. data/lib/rails_ai_context/ruby_source.rb +102 -0
  65. data/lib/rails_ai_context/schema_version.rb +22 -2
  66. data/lib/rails_ai_context/tasks/rails_ai_context.rake +0 -6
  67. data/lib/rails_ai_context/tools/analyze_feature.rb +15 -8
  68. data/lib/rails_ai_context/tools/diagnose.rb +6 -1
  69. data/lib/rails_ai_context/tools/generate_test.rb +27 -14
  70. data/lib/rails_ai_context/tools/get_concern.rb +48 -36
  71. data/lib/rails_ai_context/tools/get_context.rb +44 -14
  72. data/lib/rails_ai_context/tools/get_controllers.rb +36 -31
  73. data/lib/rails_ai_context/tools/get_conventions.rb +57 -42
  74. data/lib/rails_ai_context/tools/get_edit_context.rb +23 -7
  75. data/lib/rails_ai_context/tools/get_env.rb +58 -13
  76. data/lib/rails_ai_context/tools/get_helper_methods.rb +9 -1
  77. data/lib/rails_ai_context/tools/get_job_pattern.rb +14 -14
  78. data/lib/rails_ai_context/tools/get_model_details.rb +4 -6
  79. data/lib/rails_ai_context/tools/get_partial_interface.rb +115 -62
  80. data/lib/rails_ai_context/tools/get_service_pattern.rb +21 -11
  81. data/lib/rails_ai_context/tools/get_stimulus.rb +2 -1
  82. data/lib/rails_ai_context/tools/get_test_info.rb +6 -3
  83. data/lib/rails_ai_context/tools/get_view.rb +28 -10
  84. data/lib/rails_ai_context/tools/migration_advisor.rb +7 -3
  85. data/lib/rails_ai_context/tools/review_changes.rb +19 -8
  86. data/lib/rails_ai_context/tools/search_code.rb +24 -8
  87. data/lib/rails_ai_context/tools/validate_semantics.rb +53 -45
  88. data/lib/rails_ai_context/unbooted_settings.rb +9 -4
  89. data/lib/rails_ai_context/version.rb +1 -1
  90. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51468955210c3dfe5b635691b5408be3f813f674380481115c098fab27973eae
4
- data.tar.gz: 5fa9d2735c18d79c6bbd3f3e23205f9c5ffc8bd6728bae6feb0dcbf5cbdaaa1f
3
+ metadata.gz: 9009c01e492d1f80697f24c8a405105a672e9658600ea91a2900e927ae7e393c
4
+ data.tar.gz: 7b1c562d16a0eb4dcbb2e2709ef3aa584770c49cb29e463ce643d7aa3b822aa9
5
5
  SHA512:
6
- metadata.gz: 0bdc32c9fd9e5d09c666fc59690b38f5808383a676d3e40dbd026f0c97c2b3f00b79ad80c16b0defe34052df83a82e7e64c8e9f64195b376fb6190ba259c04a7
7
- data.tar.gz: c5dedfae2bdbb103d435cc38673ac35a077ae60d6c480bded1c93b6ba4146bacfd7c98bf3c06b795e74261b86f51438c1b1a4b82dd525959213fc49b8ce6eb70
6
+ metadata.gz: 1d0a8ab86108420d68e1222eea52a90bce730a8332cb798fe7fd934bf5b30185a309ac9543bada3889c6c96b2d28766edfe4546de6ca23dc6f99ac10385cc973
7
+ data.tar.gz: c5e4bd9ba02f4477a92454fac2b44f7043f8f2a2e9dd05ffe9aa0e5985590310a198c7b36fd7af33f21d3da0c2c2335e4b4c778638fe185e63783bbb60d0b61f
data/CHANGELOG.md CHANGED
@@ -5,6 +5,213 @@ 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.39.1] - 2026-10-31
9
+
10
+ ### Fixed
11
+
12
+ - **A comment, a string or a heredoc is no longer read as code.** About 150
13
+ answers came from a regex that matched text Ruby never runs: a
14
+ commented-out line, a word inside a string, a line inside a heredoc or an
15
+ `=begin` block. Each of those readers now reads only the code, through
16
+ Prism, the existing listeners, or the new `RubySource`, which blanks
17
+ comments and string bodies while keeping every line and column. The
18
+ sections below list what each surface stops reporting and what it now
19
+ finds.
20
+ - **ERB.** A `<%%` escape is text, as Erubi prints it. A Ruby comment inside a
21
+ code tag (`<% # render "old" %>`) counts for nothing, and text inside
22
+ `<!-- -->` is no markup, while ERB inside it still runs.
23
+ - **Views and partials** (`rails_get_view`, `rails_get_partial_interface`).
24
+ A render inside a string, a comment or plain page text is no render, and a
25
+ `partial:` key inside another helper's hash (`data: { partial: }`) is no
26
+ partial. A form builder named in a string no longer renames a record
27
+ render. A partial's locals leave out its own variables and what a
28
+ commented-out loop names, and read `local_assigns` and `defined?` only from
29
+ Ruby. `formats:` and `partial:` inside a string value, a jbuilder line's
30
+ trailing comment and a Turbo Stream builder named in a comment no longer
31
+ move a render site. `rails_get_view` prints the form builders (with
32
+ counts) and components the views it lists use, which it never printed
33
+ before.
34
+ `rails_get_helper_methods` lists every module an `include` names
35
+ (`include A, B`, `include Rails.application.routes.url_helpers`) and none a
36
+ heredoc holds.
37
+ - **Turbo** (`rails_get_turbo_map`). A frame, stream action or Drive
38
+ attribute inside an ERB comment, or a Ruby comment in a code tag, is not
39
+ counted. A frame's `src:` and a
40
+ subscription's parts on the next line of a wrapped call are read, so the
41
+ stream wiring stops warning about a mismatch that is not there. A
42
+ permanent element's id comes from its `id` attribute, never `data-id`, and
43
+ elements whose attributes hold ERB, or that a tag helper writes, are found.
44
+ `format.turbo_stream` in a comment is no stream response.
45
+ - **Stimulus** (`rails_get_stimulus`). A commented import, registration,
46
+ `extends`, `static targets`, `this.x()` call or Turbo event listener counts
47
+ for nothing. An arrow-function class field is an action, a wrapped import
48
+ is read, a class written on one line has its methods, and lifecycle lists
49
+ only the hooks the class defines (`this.observer.disconnect()` is no
50
+ hook). A commented alias entry and a commented plugin import in
51
+ `vite.config` are skipped.
52
+ - **Controllers and actions** (`rails_get_context`, `rails_get_controllers`,
53
+ `rails_get_edit_context`, `rails_search_code`). Only a real assignment sets
54
+ an ivar: `@post == x` and `@post.title = x` do not. `render action: :show`
55
+ and `render "edit"` are read, so are methods called under a modifier `if`
56
+ and filters written as `private def`. A file that declares another class
57
+ first no longer lends that class's method. The class a method belongs to
58
+ respects nesting and `class << self`, so `class Error < StandardError; end`
59
+ on the line above no longer names it. An action's Side Effects lines are
60
+ redacted as its source listing is, so a key passed to the receiver reads
61
+ `[FILTERED]`.
62
+ - **Validate** (`rails_validate`, rails level). A route or helper inside a
63
+ heredoc or `=begin` block no longer silences a missing-route warning, and
64
+ every line of a multi-line `helper_method` counts. A controller set through
65
+ `data: { controller: }` is checked, and one in an HTML comment is not. An
66
+ email address in a string is no ivar, and a comparison is no assignment. A
67
+ commented broadcast or subscription is not checked. The memory warning
68
+ reads the call: a scope or association chain (`Post.active.map`,
69
+ `current_user.posts.each`) warns, and a chain over `params`, a string, a
70
+ literal, or a call that takes arguments (`JSON.parse(body).map`,
71
+ `Dir.glob(x).map`) does not.
72
+ - **analyze_feature.** Tag-helper `data: { controller: }` is read, ERB inside
73
+ `data-controller` gives no names and an HTML-commented one gives none, the
74
+ test count reads `it(...)`, `specify` and `it { }` one-liners and skips
75
+ heredoc text, and every `ENV.fetch` form is listed.
76
+ - **Conventions and test info** (`rails_get_config(section:"conventions")`,
77
+ `rails_get_test_info`). The create action ends at its own `end` inside a
78
+ namespace module, and commented code adds no permission check, rescue,
79
+ read-only page, default locale or UI language. Japanese flash text with
80
+ kanji is Japanese. Devise test helpers and route helpers count only where
81
+ the code uses them.
82
+ - **Models, concerns and performance.** A custom validate method's body is
83
+ read when the def has parameters or a trailing comment. A heredoc adds no
84
+ structure line, makes no model abstract, and holds no concern macro. A
85
+ multi-line macro and an `included { }` block are read whole. A class whose
86
+ superclass sits on the next line is found. A comment naming
87
+ `Rails::Engine` makes no Rack app an engine. Strict locals read every
88
+ default, as Rails' own pattern does, a word in a scope's SQL string calls
89
+ no scope, a comparison or an `order` on a counter column is not a write,
90
+ and `Model.all` in a comment is not flagged.
91
+ - **Jobs and services** (`rails_get_job_pattern`,
92
+ `rails_get_service_pattern`). Commented `queue_as`, broadcasts, mailers,
93
+ `include` words and `.success` calls count for nothing, and heredoc text
94
+ adds no guard clause. `queue_as proc { }.call` is a computed queue, not a
95
+ Proc. A mailer whose parent is the app's own mailer base is listed. A
96
+ whenever runner names the job it enqueues or performs
97
+ (`ReportJob.new.perform`), or no class so its command shows. A rescue modifier rescues StandardError, and a service named only
98
+ in a comment has no caller there.
99
+ - **Config and data files.** The credentials example is read as YAML, so a
100
+ block scalar adds no key and nested keys keep their full path; one that is
101
+ not YAML is read line by line, by indentation. A
102
+ `=begin` block sets no default locale. `::ENV[...]`, `::ENV.fetch` and
103
+ `ENV["X"] ||=` count as ENV reads. Shards come from the database list,
104
+ in the guide's layout too, and `shard_count:` is no shard. A computed puma
105
+ setting reads as unknown, while `ENV[...] || 2` keeps its default. A
106
+ commented health route is no health check, an `ENV.fetch` default names the
107
+ adapter, doctor finds a password in a flow-style mapping, the schema
108
+ version comes from the `define` call, mise's `[tools.ruby]` table is read,
109
+ and a `CREATE TABLE` or `CREATE VIEW` inside a PostgreSQL function body or
110
+ string is not a table or view.
111
+ - **generate_test, diagnose, migration_advisor, review_changes.** A
112
+ paren-less `create :post` counts, a `def` inside a heredoc names no sign-in
113
+ helper, a string in an inclusion list is a value, and a `%r{}` format is
114
+ read like `/.../`. `diagnose` takes no receiver from a string.
115
+ `:null => false` and `{ null: false }` get the NOT NULL warning. A
116
+ validation moved into a
117
+ heredoc or wrapped in `=begin` is reported as removed.
118
+ - **Install and boot.** `::RailsAiContext.configure` is the gem's call, a
119
+ heredoc line is not, and a guard that is only a comment or closes before
120
+ the call does not count, in doctor and in the install alike: the install
121
+ wraps a call no guard covers, and upgrades a bare guard with a note after
122
+ it. The generator leaves heredoc text alone and keeps every magic comment
123
+ above the guard it adds. The static tier reads heredoc escapes and `%W`
124
+ and `%I` lists. The CLI finds the app a Rails 5.1 engine's `bin/rails`
125
+ names through `__FILE__`, and a Rails 4.2 or 5.0 engine's `test/dummy` or
126
+ `spec/dummy`.
127
+
128
+ ## [5.39.0] - 2026-10-31
129
+
130
+ ### Changed
131
+
132
+ - **The website is built from the repository.** `scripts/site.rb` fills in
133
+ `site/index.html` with the install prompt from `docs/PROMPTS.md`, the tool
134
+ list and the counts from the registry, and the answers it shows, recorded by
135
+ running the gem's own binary against the sample app in `site/sample_app`;
136
+ every page under `docs/` is rendered beside it with the same layout, at the
137
+ same URLs as before, except the docs index, which moves from the site root
138
+ to `docs.html`. `.github/workflows/pages.yml` builds it on a pull
139
+ request and deploys it from `main`, which replaces the Jekyll build of
140
+ `docs/`. The README leads with a figure of real answers in place of the
141
+ GIFs, which are gone with `demo/`. The packaged gem gains the two files the
142
+ README now links: `CODE_OF_CONDUCT.md` and ADR 0002.
143
+ - **The glossary is `GLOSSARY.md`.** It was `CONTEXT.md`; every doc, ADR and
144
+ code comment that points at it uses the new name. The gem does not ship it.
145
+ - **A new `opencode.json` starts with `"$schema": "https://opencode.ai/config.json"`**,
146
+ the line OpenCode adds itself to a config it loads without one. An existing
147
+ `opencode.json` gets none added, and removing the gem's entry deletes an
148
+ `opencode.json` left holding only that line.
149
+ - **The Codex setup docs say why the first step of a new session can lack the
150
+ rails tools.** Codex waits about one second
151
+ (`mcp_optional_startup_grace_ms`) for a server still starting, so the first
152
+ step of a session, `codex exec` above all, can run while the app boots.
153
+ `required = true` in the server's table (Codex 0.100 or later) makes Codex
154
+ wait. The install does not write it.
155
+
156
+ ### Fixed
157
+
158
+ - **The Cursor CLI starts the server under rvm and chruby.** It starts a
159
+ server with only `HOME`, `LOGNAME`, `PATH`, `SHELL`, `TERM` and `USER`, so
160
+ `bundle` or `rails-ai-context` found no gems and the server never started.
161
+ The `.cursor/mcp.json` entries now run the command through a one-line
162
+ `ruby -e` launcher, which sets `GEM_PATH` from the gem folders on `PATH`
163
+ when the client passed neither `GEM_PATH` nor `GEM_HOME`, keeping RubyGems'
164
+ own folders, and changes nothing when it passed either. `.github/mcp.json`
165
+ gets the same launcher: Copilot CLI 1.0.105 passes the whole environment,
166
+ but GitHub's docs say only `PATH` is passed. The install recognizes the
167
+ launcher as its own, so a re-run keeps the entry current and removal takes
168
+ it; the Cursor editor asks once to turn the rewritten entry back on.
169
+ Windows entries get no launcher.
170
+ - **Windows entries start through `cmd /d /c`.** `/d` skips the registry's
171
+ AutoRun commands, whose output, a `chcp` line for one, would reach the
172
+ client ahead of the server's first message. An entry an earlier release
173
+ wrote with `cmd /c` stays the gem's, and the next install rewrites it.
174
+ - **Copilot CLI finds the server.** It reads
175
+ `.github/mcp.json` (and `.mcp.json`), never `.vscode/mcp.json`, so choosing
176
+ `copilot` now writes `.github/mcp.json` too: `mcpServers`, each entry with
177
+ `command`, `args`, an optional `env` and `"tools": ["*"]`. A `tools` list
178
+ you narrowed there is kept. In a folder of apps its entries use bare
179
+ relative paths, since Copilot CLI expands no variable naming the folder.
180
+ Copilot CLI loads it only in a folder you trust, and `copilot mcp list`
181
+ shows it. Removal and uninstall take the entry out of both files, and
182
+ `rails ai:doctor` checks the new one as "GitHub Copilot CLI". Copilot in
183
+ JetBrains IDEs reads that file only under `servers` and starts a server in
184
+ the IDE's own folder, so it takes the entry `rails-ai-context mcp-entry`
185
+ prints.
186
+ - **Codex no longer starts the server with this machine's saved Ruby
187
+ environment.** `.codex/config.toml` held the `PATH`, `GEM_HOME` and the
188
+ rest from the install, which a Ruby switch left stale. The gem's table now
189
+ lists `env_vars = ["GEM_HOME", "GEM_PATH", "GEM_ROOT", "RUBY_VERSION",
190
+ "BUNDLE_PATH"]`, which Codex passes from the shell it started in beside the
191
+ `PATH` it always keeps, and `startup_timeout_sec = 30.0`, since Codex waited
192
+ only 10 s for a server before 0.120 and the server boots the app first. A
193
+ timeout you set is kept and none is added beside it, and a removal still
194
+ takes the table, since the timeout configures only the gem's server.
195
+ `env_vars` names you added are merged into the list. The next install or
196
+ context run replaces a table an earlier release wrote. The install no longer adds `.codex/config.toml` to `.gitignore`,
197
+ since the file is committed like the other MCP configs, and takes out the
198
+ line an earlier release added. `rails ai:doctor` drops the
199
+ "Codex env snapshot" check and no longer counts the Codex config as a file
200
+ never to commit; its MCP config check warns about an entry that still holds
201
+ a saved environment and fails it when the saved `PATH` no longer reaches the
202
+ command.
203
+ - **Cursor's entries in a folder of apps start.** They named each app from
204
+ `${workspaceFolder}`, which the Cursor CLI passes to the server as literal
205
+ text. They are now written like Claude Code's, `rails-ai-context serve
206
+ --app-path shop` with a relative `BUNDLE_GEMFILE`: the CLI starts the
207
+ server in the folder it runs in, and the editor in the project's folder.
208
+ VS Code keeps `${workspaceFolder}`. An entry an earlier release wrote is
209
+ still read, and the next `init` in the folder rewrites it.
210
+ - **The guide's Cursor table gives the tools guide rule's real scope.**
211
+ `.cursor/rules/rails-mcp-tools.mdc` has been `alwaysApply: true` since
212
+ 5.38.2, and the table in `docs/GUIDE.md` still said the agent loaded it only
213
+ on request.
214
+
8
215
  ## [5.38.2] - 2026-10-29
9
216
 
10
217
  ### Added
@@ -0,0 +1,44 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment:
18
+
19
+ * Using welcoming and inclusive language
20
+ * Being respectful of differing viewpoints and experiences
21
+ * Gracefully accepting constructive criticism
22
+ * Focusing on what is best for the community
23
+ * Showing empathy towards other community members
24
+
25
+ Examples of unacceptable behavior:
26
+
27
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
28
+ * Trolling, insulting or derogatory comments, and personal or political attacks
29
+ * Public or private harassment
30
+ * Publishing others' private information without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
32
+
33
+ ## Enforcement
34
+
35
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
36
+ reported to the project maintainer at **crisjosephnahine@gmail.com**.
37
+
38
+ All complaints will be reviewed and investigated promptly and fairly.
39
+
40
+ ## Attribution
41
+
42
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
43
+ version 2.1, available at
44
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
data/CONTRIBUTING.md CHANGED
@@ -34,7 +34,7 @@ lib/rails_ai_context/
34
34
  2. Subclass `Introspectors::Base` (it holds `app` and `root`) and implement `#call` → returns a Hash. Let it raise: the loop in `Introspector#call` records a failed section as `{ error: msg }` and warns
35
35
  3. Register it in `lib/rails_ai_context/introspector.rb` (the `INTROSPECTOR_MAP`)
36
36
  4. `extend StaticTier` and declare one: `static_tier :files_only` if `#call` runs unchanged with nothing booted, `:runtime_only` if it needs live reflection, or `:alternate_source` plus a `static_call` reading elsewhere. A mapped introspector that declares nothing fails the suite
37
- 5. If it opens a file outside the fingerprint's watched folders and extensions, declare `READS = %w[...]` (globs from the app root), or an edit to that file is not seen until a restart (see **READS** in `CONTEXT.md`)
37
+ 5. If it opens a file outside the fingerprint's watched folders and extensions, declare `READS = %w[...]` (globs from the app root), or an edit to that file is not seen until a restart (see **READS** in `GLOSSARY.md`)
38
38
  6. Add the key to the appropriate preset(s) in `Configuration::PRESETS` (`:full` is the default, `:standard` for core-only)
39
39
  7. Write specs in `spec/lib/rails_ai_context/introspectors/your_introspector_spec.rb`
40
40
 
@@ -72,6 +72,7 @@ The `ToolRunner` (`lib/rails_ai_context/cli/tool_runner.rb`) handles CLI executi
72
72
  - Target Ruby 3.1 (the gem's floor). Ruby 3.2+ features (`Data.define`, `Regexp` `timeout:`, etc.) need a runtime-guarded fallback so 3.1 keeps working
73
73
  - Support Rails 7.0 through 8.1. Guard Rails 7.1+ APIs with `respond_to?`/`defined?` so introspectors degrade cleanly on 7.0
74
74
  - Every introspector returns a Hash. Let a failure raise: the loop in `Introspector#call` records it as `{ error: msg }` and warns, so no introspector wraps its own errors
75
+ - Read Ruby source with Prism or a listener. A regex kept over Ruby runs on `RubySource.code_only` or `RubySource.without_comments` text, so a comment, a string or a heredoc cannot match (the AST-vs-regex rule in `docs/INTROSPECTORS.md`)
75
76
  - MCP tools return `MCP::Tool::Response` objects
76
77
  - All tools must be prefixed with `rails_` and annotated as read-only
77
78
 
@@ -134,6 +135,30 @@ Adding or removing a fixture model means changing that spec in the same commit.
134
135
  `docs/RELEASING.md` is the checklist. The tag publishes, not the merge, and the
135
136
  release gate wants a green E2E run for the tagged commit before it will start.
136
137
 
138
+ ## The website
139
+
140
+ `site/` is the page at <https://crisnahine.github.io/rails-ai-context/>, and `scripts/site.rb` fills it
141
+ in from the repository: the install prompt from `docs/PROMPTS.md`, the tool list and the counts from the
142
+ registry and the introspector map, every page under `docs/` rendered with the same layout, and the
143
+ answers it shows recorded by running the gem's own binary against `site/sample_app` in the static tier.
144
+ Change the words in `site/index.html` and the facts where they live. To see it before pushing:
145
+
146
+ ```bash
147
+ bundle exec ruby scripts/site.rb _site
148
+ python3 -m http.server 8000 -d _site
149
+ ```
150
+
151
+ Any static file server will do, and a server it has to be: a browser loads no module script from a
152
+ `file://` page. The script writes only into a new directory or one it wrote before. A placeholder
153
+ nothing fills, a heading a quoted block has lost, a tool `docs/TOOLS.md` files under no category, a
154
+ docs page `Site::DOC_NAV` does not place, or a tool call that fails stops the build, and
155
+ `spec/site_spec.rb` names which. `.github/workflows/pages.yml` builds the site on every pull request,
156
+ since a change to the gem changes the answers on the page, and deploys it from `main`, where the
157
+ repository's Pages source has to be GitHub Actions.
158
+
159
+ The sample app is a fixture with no `config/environment.rb`, so every tool reads it without booting. A change to it changes the answers on the page, and the README quotes some of
160
+ them, so check both.
161
+
137
162
  ## Reporting Bugs
138
163
 
139
164
  Open an issue at https://github.com/crisnahine/rails-ai-context/issues with: