rails-ai-context 2.0.0 → 2.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/rails_ai_context/serializers/claude_rules_serializer.rb +45 -23
- data/lib/rails_ai_context/serializers/claude_serializer.rb +40 -24
- data/lib/rails_ai_context/serializers/copilot_instructions_serializer.rb +29 -27
- data/lib/rails_ai_context/serializers/cursor_rules_serializer.rb +29 -27
- data/lib/rails_ai_context/serializers/opencode_serializer.rb +31 -25
- data/lib/rails_ai_context/serializers/windsurf_rules_serializer.rb +26 -25
- data/lib/rails_ai_context/version.rb +1 -1
- data/server.json +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 485ed8bdee695a10d5fd05b9a578bb3ff55f918d5ea9d3ddd3a18ba56f03c3f7
|
|
4
|
+
data.tar.gz: 010af0cd0f8958e09856f08e6be2c54d87f75ab6ea7a1e3c2993523a15d18992
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66aced48319fe77c7d5301ca154150db872d5ee682be94c5ae81af229901fb3ac950e932ce984f0f5c13d4dbfceae5f89bcb2fbe479c04ab38ec1a6fb605d7a2
|
|
7
|
+
data.tar.gz: 81cbff9c0f81ef41d1c1db9b9b97a6af606da9915c59214097dfe8386d7437250f4e6c470b59ca3c1dd8721bf21a458bbe6cf351313ff7a47cfaaab90fabb221
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ 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
|
+
## [2.0.1] - 2026-03-25
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **MCP-first mandatory workflow in all serializers** — all 6 serializer outputs (Claude, Cursor, Copilot, Windsurf, OpenCode) now use "MANDATORY, Use Before Read" language with structured workflow, anti-patterns table, and "Do NOT Bypass" rules. AI agents are explicitly instructed to never read reference files directly.
|
|
13
|
+
- **27 type-safety bugs in serializers** — fixed `.keys` called on Array values (same pattern as #14) across `design_system_helper.rb`, `get_design_system.rb`, `markdown_serializer.rb`, and `stack_overview_helper.rb`.
|
|
14
|
+
- **Strong params JSONB check** — no longer skips the entire check when JSONB columns exist. Plain-word params allowed (could be JSON keys), `_id` params still validated.
|
|
15
|
+
- **Strong params test skip on Ruby < 3.3** — test now skips gracefully when Prism is unavailable, matching the tool's own degradation.
|
|
16
|
+
- **Issue #14** — `multi_db[:databases].keys` crash on Array fixed.
|
|
17
|
+
- **Search code NON_CODE_GLOBS** — excludes lock files, docs, CI configs, generated context from all searches.
|
|
18
|
+
|
|
8
19
|
## [2.0.0] - 2026-03-24
|
|
9
20
|
|
|
10
21
|
### Added
|
|
@@ -96,7 +96,8 @@ module RailsAiContext
|
|
|
96
96
|
rescue; end
|
|
97
97
|
|
|
98
98
|
lines << ""
|
|
99
|
-
lines << "
|
|
99
|
+
lines << "ALWAYS use MCP tools for context — do NOT read reference files directly."
|
|
100
|
+
lines << "Start with `detail:\"summary\"`. Read files ONLY when you will Edit them."
|
|
100
101
|
|
|
101
102
|
lines.join("\n")
|
|
102
103
|
end
|
|
@@ -294,31 +295,52 @@ module RailsAiContext
|
|
|
294
295
|
|
|
295
296
|
def render_mcp_tools_reference # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
|
296
297
|
lines = [
|
|
297
|
-
"# Rails MCP Tools —
|
|
298
|
-
"",
|
|
299
|
-
"
|
|
300
|
-
"
|
|
301
|
-
"
|
|
302
|
-
"",
|
|
303
|
-
"##
|
|
304
|
-
"
|
|
305
|
-
"
|
|
306
|
-
"-
|
|
307
|
-
"-
|
|
308
|
-
"-
|
|
309
|
-
"-
|
|
310
|
-
"",
|
|
311
|
-
"
|
|
312
|
-
"-
|
|
298
|
+
"# Rails MCP Tools — MANDATORY, Use Before Read/Grep",
|
|
299
|
+
"",
|
|
300
|
+
"CRITICAL: This project has live MCP tools. You MUST use them for gathering context.",
|
|
301
|
+
"MCP tools return parsed, up-to-date, token-efficient data with line numbers.",
|
|
302
|
+
"Read files ONLY when you are about to Edit them. Never read reference files directly.",
|
|
303
|
+
"",
|
|
304
|
+
"## Mandatory Workflow — Follow This Order",
|
|
305
|
+
"",
|
|
306
|
+
"### 1. Gathering context (BEFORE writing any code)",
|
|
307
|
+
"- Exploring a feature area → `rails_analyze_feature(feature:\"...\")` — NOT Explore agents, NOT Grep",
|
|
308
|
+
"- Understanding a model → `rails_get_model_details(model:\"...\")` — NOT reading the model file",
|
|
309
|
+
"- Checking database columns → `rails_get_schema(table:\"...\")` — NOT reading db/schema.rb",
|
|
310
|
+
"- Checking routes → `rails_get_routes(controller:\"...\")` — NOT reading config/routes.rb",
|
|
311
|
+
"- Understanding a controller → `rails_get_controllers(controller:\"...\", action:\"...\")` — NOT reading the file",
|
|
312
|
+
"- Finding code patterns → `rails_search_code(pattern:\"...\")` — NOT using Grep tool",
|
|
313
|
+
"- UI patterns → `rails_get_design_system` — NOT reading view files for patterns",
|
|
314
|
+
"- Full cross-layer context → `rails_get_context(model:\"...\")` — replaces multiple Read calls",
|
|
315
|
+
"",
|
|
316
|
+
"### 2. Reading files (ONLY files you will edit)",
|
|
317
|
+
"- Read a file ONLY when you are about to Edit it (Read is required before Edit)",
|
|
318
|
+
"- For everything else — schema, routes, models, tests, patterns — use MCP tools above",
|
|
319
|
+
"",
|
|
320
|
+
"### 3. After editing (EVERY time, no exceptions)",
|
|
321
|
+
"- `rails_validate(files:[\"path/to/file.rb\", \"path/to/view.erb\"])` — one call checks all",
|
|
313
322
|
"- Do NOT run `ruby -c`, `erb` checks, or `node -c` separately — use rails_validate instead",
|
|
314
323
|
"- Do NOT re-read files to verify edits. Trust your Edit and validate syntax only.",
|
|
315
324
|
"",
|
|
316
|
-
"##
|
|
317
|
-
"
|
|
318
|
-
"
|
|
319
|
-
"
|
|
320
|
-
"
|
|
321
|
-
"
|
|
325
|
+
"## Do NOT Bypass — Anti-Patterns",
|
|
326
|
+
"| Instead of... | Use this MCP tool |",
|
|
327
|
+
"|---------------|-------------------|",
|
|
328
|
+
"| Reading db/schema.rb | `rails_get_schema(table:\"name\")` |",
|
|
329
|
+
"| Reading config/routes.rb for reference | `rails_get_routes(controller:\"name\")` |",
|
|
330
|
+
"| Reading model files for associations | `rails_get_model_details(model:\"Name\")` |",
|
|
331
|
+
"| Grep/Explore agent for code search | `rails_search_code(pattern:\"regex\")` |",
|
|
332
|
+
"| Reading test files for patterns | `rails_get_test_info(model:\"Name\")` |",
|
|
333
|
+
"| Reading controller files for context | `rails_get_controllers(controller:\"Name\")` |",
|
|
334
|
+
"| Reading JS files for Stimulus API | `rails_get_stimulus(controller:\"name\")` |",
|
|
335
|
+
"| Multiple reads to understand a feature | `rails_analyze_feature(feature:\"keyword\")` |",
|
|
336
|
+
"| ruby -c / erb / node -c after edits | `rails_validate(files:[...])` |",
|
|
337
|
+
"",
|
|
338
|
+
"## Reference-only files — NEVER read these, use MCP",
|
|
339
|
+
"- db/schema.rb → `rails_get_schema` (column types in rails-schema.md rules for quick checks)",
|
|
340
|
+
"- config/routes.rb → `rails_get_routes` (Read ONLY when adding routes)",
|
|
341
|
+
"- Model files → `rails_get_model_details` (Read ONLY when editing business logic)",
|
|
342
|
+
"- app/javascript/controllers/index.js → Stimulus auto-registers. Never read this.",
|
|
343
|
+
"- Test files → `rails_get_test_info`",
|
|
322
344
|
"",
|
|
323
345
|
"## Tools (25)",
|
|
324
346
|
"",
|
|
@@ -200,30 +200,38 @@ module RailsAiContext
|
|
|
200
200
|
[
|
|
201
201
|
"## MCP Tools (25) — ALWAYS Use These First",
|
|
202
202
|
"",
|
|
203
|
-
"
|
|
204
|
-
"
|
|
203
|
+
"This project has live MCP tools. You MUST use them instead of reading reference files.",
|
|
204
|
+
"Start with `detail:\"summary\"`, then drill into specifics.",
|
|
205
205
|
"",
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
"
|
|
220
|
-
"
|
|
221
|
-
"
|
|
222
|
-
"
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
206
|
+
"### Mandatory Workflow",
|
|
207
|
+
"1. **Before exploring a feature**: `rails_analyze_feature(feature:\"...\")` — NOT Explore agents or Grep",
|
|
208
|
+
"2. **Before writing migrations**: `rails_get_schema(table:\"...\")` — NOT reading db/schema.rb",
|
|
209
|
+
"3. **Before modifying a model**: `rails_get_model_details(model:\"...\")` — NOT reading the model file",
|
|
210
|
+
"4. **Before adding routes**: `rails_get_routes(controller:\"...\")` — Read routes.rb only when you will edit it",
|
|
211
|
+
"5. **Before creating views**: `rails_get_design_system` — match existing patterns",
|
|
212
|
+
"6. **After editing ANY file**: `rails_validate(files:[...])` — no exceptions, no ruby -c / erb / node -c",
|
|
213
|
+
"",
|
|
214
|
+
"### Quick Reference",
|
|
215
|
+
"| Need | Use this MCP tool | Do NOT use |",
|
|
216
|
+
"|------|-------------------|------------|",
|
|
217
|
+
"| Column types | `rails_get_schema(table:\"x\")` | Read db/schema.rb |",
|
|
218
|
+
"| Model associations | `rails_get_model_details(model:\"X\")` | Read app/models/x.rb |",
|
|
219
|
+
"| Route paths | `rails_get_routes(controller:\"x\")` | Read config/routes.rb |",
|
|
220
|
+
"| Feature overview | `rails_analyze_feature(feature:\"x\")` | Explore agent / Grep |",
|
|
221
|
+
"| Find code | `rails_search_code(pattern:\"x\")` | Grep tool |",
|
|
222
|
+
"| Validate edits | `rails_validate(files:[...])` | ruby -c / erb / node |",
|
|
223
|
+
"| Controller logic | `rails_get_controllers(controller:\"X\", action:\"y\")` | Read controller file |",
|
|
224
|
+
"| UI patterns | `rails_get_design_system` | Read view files |",
|
|
225
|
+
"| Stimulus API | `rails_get_stimulus(controller:\"x\")` | Read JS files |",
|
|
226
|
+
"| Test patterns | `rails_get_test_info(model:\"X\")` | Read test files |",
|
|
227
|
+
"| Full context | `rails_get_context(model:\"X\")` | Multiple Read calls |",
|
|
228
|
+
"",
|
|
229
|
+
"### More Tools",
|
|
230
|
+
"- `rails_get_view(controller:\"x\")` | `rails_get_concern(name:\"X\")` | `rails_get_callbacks(model:\"X\")`",
|
|
231
|
+
"- `rails_get_helper_methods` | `rails_get_service_pattern` | `rails_get_job_pattern`",
|
|
232
|
+
"- `rails_get_env` | `rails_get_partial_interface(path:\"shared/_form\")` | `rails_get_turbo_map`",
|
|
233
|
+
"- `rails_get_config` | `rails_get_gems` | `rails_get_conventions` | `rails_security_scan`",
|
|
234
|
+
"- `rails_get_edit_context(file:\"path\", near:\"keyword\")` — surgical edit helper with line numbers",
|
|
227
235
|
""
|
|
228
236
|
]
|
|
229
237
|
end
|
|
@@ -256,12 +264,20 @@ module RailsAiContext
|
|
|
256
264
|
[
|
|
257
265
|
"## Rules",
|
|
258
266
|
"- Follow existing patterns and conventions",
|
|
259
|
-
"- Use the MCP tools to check schema before writing migrations",
|
|
260
267
|
"- Match existing code style",
|
|
261
268
|
"- Run tests after changes",
|
|
262
269
|
"- After editing, ALWAYS use `rails_validate(files:[...])` — do NOT use separate ruby -c / erb / node -c calls",
|
|
263
270
|
"- Do NOT re-read files to verify edits — trust your Edit, validate syntax only",
|
|
264
271
|
"- Stimulus controllers auto-register — no manual import in controllers/index.js needed",
|
|
272
|
+
"",
|
|
273
|
+
"## MCP-First Rule — Do NOT Bypass",
|
|
274
|
+
"- Do NOT read db/schema.rb — use `rails_get_schema`",
|
|
275
|
+
"- Do NOT read config/routes.rb for reference — use `rails_get_routes`",
|
|
276
|
+
"- Do NOT read model files for associations/scopes — use `rails_get_model_details`",
|
|
277
|
+
"- Do NOT use Grep to search code — use `rails_search_code`",
|
|
278
|
+
"- Do NOT launch Explore agents for context — use `rails_analyze_feature`",
|
|
279
|
+
"- Do NOT read test files for patterns — use `rails_get_test_info`",
|
|
280
|
+
"- Read files ONLY when you are about to Edit them",
|
|
265
281
|
""
|
|
266
282
|
]
|
|
267
283
|
end
|
|
@@ -219,36 +219,38 @@ module RailsAiContext
|
|
|
219
219
|
"applyTo: \"**/*\"",
|
|
220
220
|
"---",
|
|
221
221
|
"",
|
|
222
|
-
"# Rails MCP Tools (25) — Use
|
|
222
|
+
"# Rails MCP Tools (25) — MANDATORY, Use Before Read",
|
|
223
223
|
"",
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
224
|
+
"CRITICAL: This project has live MCP tools. You MUST use them for gathering context.",
|
|
225
|
+
"Read files ONLY when you are about to edit them. Never read reference files directly.",
|
|
226
|
+
"Start with `detail:\"summary\"`, then drill into specifics.",
|
|
227
227
|
"",
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"- `rails_get_view(controller:\"cooks\")` — view list; `(path:\"cooks/index.html.erb\")` — content",
|
|
233
|
-
"- `rails_get_stimulus(detail:\"summary\")` → `(controller:\"name\")` — targets, actions, values",
|
|
234
|
-
"- `rails_get_test_info(detail:\"full\")` — fixtures, factories, helpers; `(model:\"Cook\")` — existing tests",
|
|
235
|
-
"- `rails_analyze_feature(feature:\"auth\")` — schema + models + controllers + routes for a feature",
|
|
236
|
-
"- `rails_get_design_system` — color palette, components, canonical page examples",
|
|
237
|
-
"- `rails_get_config` | `rails_get_gems` | `rails_get_conventions` | `rails_search_code`",
|
|
238
|
-
"- `rails_get_edit_context(file:\"path\", near:\"keyword\")` — surgical edit context with line numbers",
|
|
239
|
-
"- `rails_validate(files:[\"path\"])` — validate Ruby, ERB, JS syntax in one call",
|
|
240
|
-
"- `rails_security_scan` — Brakeman security analysis",
|
|
241
|
-
"- `rails_get_concern(name:\"Searchable\")` — concern methods and includers",
|
|
242
|
-
"- `rails_get_callbacks(model:\"User\")` — model callbacks in execution order",
|
|
243
|
-
"- `rails_get_helper_methods` — app + framework helpers",
|
|
244
|
-
"- `rails_get_service_pattern` — service object patterns and interfaces",
|
|
245
|
-
"- `rails_get_job_pattern` — background job patterns and schedules",
|
|
246
|
-
"- `rails_get_env` — environment variables and credentials keys",
|
|
247
|
-
"- `rails_get_partial_interface(path:\"shared/_form\")` — partial locals contract",
|
|
248
|
-
"- `rails_get_turbo_map` — Turbo Streams/Frames wiring",
|
|
249
|
-
"- `rails_get_context(model:\"User\")` — composite cross-layer context",
|
|
228
|
+
"## Mandatory Workflow",
|
|
229
|
+
"1. Gathering context → use MCP tools (NOT file reads, NOT grep)",
|
|
230
|
+
"2. Reading files → ONLY files you will edit",
|
|
231
|
+
"3. After editing → `rails_validate(files:[...])` every time, no exceptions",
|
|
250
232
|
"",
|
|
251
|
-
"
|
|
233
|
+
"## Do NOT Bypass",
|
|
234
|
+
"| Instead of... | Use this MCP tool |",
|
|
235
|
+
"|---------------|-------------------|",
|
|
236
|
+
"| Reading db/schema.rb | `rails_get_schema(table:\"name\")` |",
|
|
237
|
+
"| Reading config/routes.rb | `rails_get_routes(controller:\"name\")` |",
|
|
238
|
+
"| Reading model files for context | `rails_get_model_details(model:\"Name\")` |",
|
|
239
|
+
"| Grep for code patterns | `rails_search_code(pattern:\"regex\")` |",
|
|
240
|
+
"| Reading test files | `rails_get_test_info(model:\"Name\")` |",
|
|
241
|
+
"| Reading controller for context | `rails_get_controllers(controller:\"Name\", action:\"x\")` |",
|
|
242
|
+
"| Reading JS for Stimulus API | `rails_get_stimulus(controller:\"name\")` |",
|
|
243
|
+
"| Multiple reads for a feature | `rails_analyze_feature(feature:\"keyword\")` |",
|
|
244
|
+
"| ruby -c / erb / node -c | `rails_validate(files:[...])` |",
|
|
245
|
+
"",
|
|
246
|
+
"## All 25 Tools",
|
|
247
|
+
"- `rails_get_schema` | `rails_get_model_details` | `rails_get_routes` | `rails_get_controllers`",
|
|
248
|
+
"- `rails_get_view` | `rails_get_stimulus` | `rails_get_test_info` | `rails_analyze_feature`",
|
|
249
|
+
"- `rails_get_design_system` | `rails_get_edit_context` | `rails_validate` | `rails_search_code`",
|
|
250
|
+
"- `rails_get_config` | `rails_get_gems` | `rails_get_conventions` | `rails_security_scan`",
|
|
251
|
+
"- `rails_get_concern` | `rails_get_callbacks` | `rails_get_helper_methods` | `rails_get_service_pattern`",
|
|
252
|
+
"- `rails_get_job_pattern` | `rails_get_env` | `rails_get_partial_interface` | `rails_get_turbo_map`",
|
|
253
|
+
"- `rails_get_context(model:\"X\")` — composite cross-layer context in one call"
|
|
252
254
|
]
|
|
253
255
|
|
|
254
256
|
lines.join("\n")
|
|
@@ -256,39 +256,41 @@ module RailsAiContext
|
|
|
256
256
|
def render_mcp_tools_rule # rubocop:disable Metrics/MethodLength
|
|
257
257
|
lines = [
|
|
258
258
|
"---",
|
|
259
|
-
"description: \"Rails MCP tools (25) — use
|
|
259
|
+
"description: \"Rails MCP tools (25) — MANDATORY, use before reading any reference files\"",
|
|
260
260
|
"alwaysApply: true",
|
|
261
261
|
"---",
|
|
262
262
|
"",
|
|
263
|
-
"# Rails MCP Tools (25) — Use
|
|
263
|
+
"# Rails MCP Tools (25) — MANDATORY, Use Before Read",
|
|
264
264
|
"",
|
|
265
|
-
"
|
|
266
|
-
"
|
|
265
|
+
"CRITICAL: This project has live MCP tools. You MUST use them for gathering context.",
|
|
266
|
+
"Read files ONLY when you are about to edit them. Never read reference files directly.",
|
|
267
267
|
"",
|
|
268
|
-
"
|
|
269
|
-
"
|
|
270
|
-
"
|
|
271
|
-
"
|
|
272
|
-
"- `rails_get_view(controller:\"cooks\")` — view list; `rails_get_view(path:\"cooks/index.html.erb\")` — content",
|
|
273
|
-
"- `rails_get_stimulus(detail:\"summary\")` → `rails_get_stimulus(controller:\"name\")`",
|
|
274
|
-
"- `rails_get_test_info(detail:\"full\")` — fixtures, factories, helpers; `(model:\"Cook\")` — existing tests",
|
|
275
|
-
"- `rails_analyze_feature(feature:\"auth\")` — schema + models + controllers + routes for a feature",
|
|
276
|
-
"- `rails_get_design_system` — color palette, components, canonical page examples",
|
|
277
|
-
"- `rails_get_config` | `rails_get_gems` | `rails_get_conventions` | `rails_search_code`",
|
|
278
|
-
"- `rails_get_edit_context(file:\"path\", near:\"keyword\")` — surgical edit context with line numbers",
|
|
279
|
-
"- `rails_validate(files:[\"path\"])` — validate Ruby, ERB, JS syntax in one call",
|
|
280
|
-
"- `rails_security_scan` — Brakeman security analysis",
|
|
281
|
-
"- `rails_get_concern(name:\"Searchable\")` — concern methods and includers",
|
|
282
|
-
"- `rails_get_callbacks(model:\"User\")` — model callbacks in execution order",
|
|
283
|
-
"- `rails_get_helper_methods` — app + framework helpers",
|
|
284
|
-
"- `rails_get_service_pattern` — service object patterns and interfaces",
|
|
285
|
-
"- `rails_get_job_pattern` — background job patterns and schedules",
|
|
286
|
-
"- `rails_get_env` — environment variables and credentials keys",
|
|
287
|
-
"- `rails_get_partial_interface(path:\"shared/_form\")` — partial locals contract",
|
|
288
|
-
"- `rails_get_turbo_map` — Turbo Streams/Frames wiring",
|
|
289
|
-
"- `rails_get_context(model:\"User\")` — composite cross-layer context",
|
|
268
|
+
"## Mandatory Workflow",
|
|
269
|
+
"1. Gathering context → use MCP tools (NOT file reads, NOT grep)",
|
|
270
|
+
"2. Reading files → ONLY files you will edit (Read is required before Edit)",
|
|
271
|
+
"3. After editing → `rails_validate(files:[...])` every time, no exceptions",
|
|
290
272
|
"",
|
|
291
|
-
"
|
|
273
|
+
"## Do NOT Bypass — Anti-Patterns",
|
|
274
|
+
"| Instead of... | Use this MCP tool |",
|
|
275
|
+
"|---------------|-------------------|",
|
|
276
|
+
"| Reading db/schema.rb | `rails_get_schema(table:\"name\")` |",
|
|
277
|
+
"| Reading config/routes.rb | `rails_get_routes(controller:\"name\")` |",
|
|
278
|
+
"| Reading model files for context | `rails_get_model_details(model:\"Name\")` |",
|
|
279
|
+
"| Grep for code patterns | `rails_search_code(pattern:\"regex\")` |",
|
|
280
|
+
"| Reading test files for patterns | `rails_get_test_info(model:\"Name\")` |",
|
|
281
|
+
"| Reading controller for context | `rails_get_controllers(controller:\"Name\", action:\"x\")` |",
|
|
282
|
+
"| Reading JS for Stimulus API | `rails_get_stimulus(controller:\"name\")` |",
|
|
283
|
+
"| Multiple reads for a feature | `rails_analyze_feature(feature:\"keyword\")` |",
|
|
284
|
+
"| ruby -c / erb / node -c | `rails_validate(files:[...])` |",
|
|
285
|
+
"",
|
|
286
|
+
"## All 25 Tools",
|
|
287
|
+
"- `rails_get_schema` | `rails_get_model_details` | `rails_get_routes` | `rails_get_controllers`",
|
|
288
|
+
"- `rails_get_view` | `rails_get_stimulus` | `rails_get_test_info` | `rails_analyze_feature`",
|
|
289
|
+
"- `rails_get_design_system` | `rails_get_edit_context` | `rails_validate` | `rails_search_code`",
|
|
290
|
+
"- `rails_get_config` | `rails_get_gems` | `rails_get_conventions` | `rails_security_scan`",
|
|
291
|
+
"- `rails_get_concern` | `rails_get_callbacks` | `rails_get_helper_methods` | `rails_get_service_pattern`",
|
|
292
|
+
"- `rails_get_job_pattern` | `rails_get_env` | `rails_get_partial_interface` | `rails_get_turbo_map`",
|
|
293
|
+
"- `rails_get_context(model:\"X\")` — composite cross-layer context in one call"
|
|
292
294
|
]
|
|
293
295
|
|
|
294
296
|
lines.join("\n")
|
|
@@ -165,33 +165,39 @@ module RailsAiContext
|
|
|
165
165
|
|
|
166
166
|
def render_mcp_guide # rubocop:disable Metrics/MethodLength
|
|
167
167
|
[
|
|
168
|
-
"## MCP Tools (25) —
|
|
168
|
+
"## MCP Tools (25) — MANDATORY, Use Before Read",
|
|
169
169
|
"",
|
|
170
|
-
"
|
|
171
|
-
"
|
|
170
|
+
"CRITICAL: This project has live MCP tools. You MUST use them for gathering context.",
|
|
171
|
+
"Read files ONLY when you are about to edit them. Never read reference files directly.",
|
|
172
|
+
"Start with `detail:\"summary\"`, then drill into specifics.",
|
|
172
173
|
"",
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"-
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"- `
|
|
194
|
-
"- `
|
|
174
|
+
"### Mandatory Workflow",
|
|
175
|
+
"1. **Before exploring a feature**: `rails_analyze_feature(feature:\"...\")` — NOT file reads or grep",
|
|
176
|
+
"2. **Before writing migrations**: `rails_get_schema(table:\"...\")` — NOT reading db/schema.rb",
|
|
177
|
+
"3. **Before modifying a model**: `rails_get_model_details(model:\"...\")` — NOT reading the model file",
|
|
178
|
+
"4. **Before adding routes**: `rails_get_routes(controller:\"...\")` — Read only when you will edit",
|
|
179
|
+
"5. **Before creating views**: `rails_get_design_system` — match existing patterns",
|
|
180
|
+
"6. **After editing ANY file**: `rails_validate(files:[...])` — no exceptions",
|
|
181
|
+
"",
|
|
182
|
+
"### Do NOT Bypass",
|
|
183
|
+
"| Instead of... | Use this MCP tool |",
|
|
184
|
+
"|---------------|-------------------|",
|
|
185
|
+
"| Reading db/schema.rb | `rails_get_schema(table:\"x\")` |",
|
|
186
|
+
"| Reading model files | `rails_get_model_details(model:\"X\")` |",
|
|
187
|
+
"| Reading routes.rb | `rails_get_routes(controller:\"x\")` |",
|
|
188
|
+
"| Grep for code | `rails_search_code(pattern:\"x\")` |",
|
|
189
|
+
"| Reading test files | `rails_get_test_info(model:\"X\")` |",
|
|
190
|
+
"| Reading controller | `rails_get_controllers(controller:\"X\", action:\"y\")` |",
|
|
191
|
+
"| ruby -c / erb / node | `rails_validate(files:[...])` |",
|
|
192
|
+
"",
|
|
193
|
+
"### All 25 Tools",
|
|
194
|
+
"- `rails_get_schema` | `rails_get_model_details` | `rails_get_routes` | `rails_get_controllers`",
|
|
195
|
+
"- `rails_get_view` | `rails_get_stimulus` | `rails_get_test_info` | `rails_analyze_feature`",
|
|
196
|
+
"- `rails_get_design_system` | `rails_get_edit_context` | `rails_validate` | `rails_search_code`",
|
|
197
|
+
"- `rails_get_config` | `rails_get_gems` | `rails_get_conventions` | `rails_security_scan`",
|
|
198
|
+
"- `rails_get_concern` | `rails_get_callbacks` | `rails_get_helper_methods` | `rails_get_service_pattern`",
|
|
199
|
+
"- `rails_get_job_pattern` | `rails_get_env` | `rails_get_partial_interface` | `rails_get_turbo_map`",
|
|
200
|
+
"- `rails_get_context(model:\"X\")` — composite cross-layer context in one call",
|
|
195
201
|
""
|
|
196
202
|
]
|
|
197
203
|
end
|
|
@@ -67,34 +67,35 @@ module RailsAiContext
|
|
|
67
67
|
|
|
68
68
|
def render_mcp_tools_rule # rubocop:disable Metrics/MethodLength
|
|
69
69
|
lines = [
|
|
70
|
-
"# Rails MCP Tools (25) — Use
|
|
70
|
+
"# Rails MCP Tools (25) — MANDATORY, Use Before Read",
|
|
71
71
|
"",
|
|
72
|
-
"
|
|
72
|
+
"CRITICAL: This project has live MCP tools. Use them for ALL context gathering.",
|
|
73
|
+
"Read files ONLY when you are about to edit them.",
|
|
73
74
|
"",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"- rails_get_view(controller:\"cooks\") — views; rails_get_view(path:\"file\") — content",
|
|
79
|
-
"- rails_get_stimulus(detail:\"summary\") → rails_get_stimulus(controller:\"name\")",
|
|
80
|
-
"- rails_get_test_info(detail:\"full\") — fixtures, helpers; (model:\"Cook\") — tests",
|
|
81
|
-
"- rails_analyze_feature(feature:\"auth\") — schema + models + controllers + routes for a feature",
|
|
82
|
-
"- rails_get_design_system — color palette, components, page examples",
|
|
83
|
-
"- rails_get_config | rails_get_gems | rails_get_conventions | rails_search_code",
|
|
84
|
-
"- rails_get_edit_context(file:\"path\", near:\"keyword\") — surgical edit context with line numbers",
|
|
85
|
-
"- rails_validate(files:[\"path\"]) — validate Ruby, ERB, JS syntax in one call",
|
|
86
|
-
"- rails_security_scan — Brakeman security analysis",
|
|
87
|
-
"- rails_get_concern(name:\"Searchable\") — concern methods and includers",
|
|
88
|
-
"- rails_get_callbacks(model:\"User\") — model callbacks in execution order",
|
|
89
|
-
"- rails_get_helper_methods — app + framework helpers",
|
|
90
|
-
"- rails_get_service_pattern — service object patterns and interfaces",
|
|
91
|
-
"- rails_get_job_pattern — background job patterns and schedules",
|
|
92
|
-
"- rails_get_env — environment variables and credentials keys",
|
|
93
|
-
"- rails_get_partial_interface(path:\"shared/_form\") — partial locals contract",
|
|
94
|
-
"- rails_get_turbo_map — Turbo Streams/Frames wiring",
|
|
95
|
-
"- rails_get_context(model:\"User\") — composite cross-layer context",
|
|
75
|
+
"Mandatory Workflow:",
|
|
76
|
+
"1. Gathering context → use MCP tools (NOT file reads)",
|
|
77
|
+
"2. Reading files → ONLY files you will edit",
|
|
78
|
+
"3. After editing → rails_validate(files:[...]) every time",
|
|
96
79
|
"",
|
|
97
|
-
"
|
|
80
|
+
"Do NOT Bypass:",
|
|
81
|
+
"- Reading db/schema.rb → rails_get_schema(table:\"name\")",
|
|
82
|
+
"- Reading config/routes.rb → rails_get_routes(controller:\"name\")",
|
|
83
|
+
"- Reading model files → rails_get_model_details(model:\"Name\")",
|
|
84
|
+
"- Grep for code → rails_search_code(pattern:\"regex\")",
|
|
85
|
+
"- Reading test files → rails_get_test_info(model:\"Name\")",
|
|
86
|
+
"- Reading controller → rails_get_controllers(controller:\"Name\", action:\"x\")",
|
|
87
|
+
"- Reading JS for Stimulus → rails_get_stimulus(controller:\"name\")",
|
|
88
|
+
"- Multiple reads for feature → rails_analyze_feature(feature:\"keyword\")",
|
|
89
|
+
"- ruby -c / erb / node -c → rails_validate(files:[...])",
|
|
90
|
+
"",
|
|
91
|
+
"All 25 Tools:",
|
|
92
|
+
"- rails_get_schema | rails_get_model_details | rails_get_routes | rails_get_controllers",
|
|
93
|
+
"- rails_get_view | rails_get_stimulus | rails_get_test_info | rails_analyze_feature",
|
|
94
|
+
"- rails_get_design_system | rails_get_edit_context | rails_validate | rails_search_code",
|
|
95
|
+
"- rails_get_config | rails_get_gems | rails_get_conventions | rails_security_scan",
|
|
96
|
+
"- rails_get_concern | rails_get_callbacks | rails_get_helper_methods | rails_get_service_pattern",
|
|
97
|
+
"- rails_get_job_pattern | rails_get_env | rails_get_partial_interface | rails_get_turbo_map",
|
|
98
|
+
"- rails_get_context(model:\"X\") — composite cross-layer context in one call"
|
|
98
99
|
]
|
|
99
100
|
|
|
100
101
|
lines.join("\n")
|
data/server.json
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
"url": "https://github.com/crisnahine/rails-ai-context",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "2.0.
|
|
10
|
+
"version": "2.0.1",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "mcpb",
|
|
14
|
-
"identifier": "https://github.com/crisnahine/rails-ai-context/releases/download/v2.0.
|
|
14
|
+
"identifier": "https://github.com/crisnahine/rails-ai-context/releases/download/v2.0.1/rails-ai-context-mcp.mcpb",
|
|
15
15
|
"fileSha256": "dd711a0ad6c4de943ae4da94eaf59a6dc9494b9d57f726e24649ed4e2f156990",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|