Class: RailsAiContext::Install::AiTool
- Inherits:
-
Struct
- Object
- Struct
- RailsAiContext::Install::AiTool
- Defined in:
- lib/rails_ai_context/install/ai_tool.rb,
lib/rails_ai_context/install/ai_tool.rb
Overview
What each AI tool means to this gem, in one table: what to call it, what context files it gets, where its MCP config lives and in what shape, and what it left behind in older releases. The generator, the rake task and the standalone CLI all asked these questions separately and answered them from copies that drifted.
Vocabulary per CONTEXT.md: "AI tool" for the assistant, "context files" for what the gem generates for it.
Constant Summary collapse
- ALL =
[ new( number: "1", key: :claude, name: "Claude Code", files: "CLAUDE.md + .claude/rules/", context_paths: %w[CLAUDE.md .claude/rules], mcp_config: { path: ".mcp.json", root_key: "mcpServers", format: :mcp_json }, legacy_paths: [ ".claude/rules/rails-ui-patterns.md", ".claude/rules/rails-accessibility.md" ] ), new( number: "2", key: :cursor, name: "Cursor", files: ".cursor/rules/ + .cursorrules (legacy fallback)", context_paths: %w[.cursor/rules .cursorrules], mcp_config: { path: ".cursor/mcp.json", root_key: "mcpServers", format: :mcp_json }, legacy_paths: [ ".cursor/rules/rails-ui-patterns.mdc" ] ), new( number: "3", key: :copilot, name: "GitHub Copilot", files: ".github/copilot-instructions.md + .github/instructions/", context_paths: %w[.github/copilot-instructions.md .github/instructions], mcp_config: { path: ".vscode/mcp.json", root_key: "servers", format: :vscode_json }, legacy_paths: [ ".github/instructions/rails-ui-patterns.instructions.md" ] ), new( number: "4", key: :opencode, name: "OpenCode", files: "AGENTS.md", context_paths: %w[AGENTS.md app/models/AGENTS.md app/controllers/AGENTS.md], mcp_config: { path: "opencode.json", root_key: "mcp", format: :opencode_json }, legacy_paths: [] ), new( number: "5", key: :codex, name: "Codex CLI", files: "AGENTS.md + .codex/config.toml", context_paths: %w[AGENTS.md app/models/AGENTS.md app/controllers/AGENTS.md], mcp_config: { path: ".codex/config.toml", root_key: nil, format: :codex_toml }, legacy_paths: [] ) ].freeze
Instance Attribute Summary collapse
-
#context_paths ⇒ Object
Returns the value of attribute context_paths.
-
#files ⇒ Object
Returns the value of attribute files.
-
#key ⇒ Object
Returns the value of attribute key.
-
#legacy_paths ⇒ Object
Returns the value of attribute legacy_paths.
-
#mcp_config ⇒ Object
Returns the value of attribute mcp_config.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
Class Method Summary collapse
Instance Attribute Details
#context_paths ⇒ Object
Returns the value of attribute context_paths
13 14 15 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 13 def context_paths @context_paths end |
#files ⇒ Object
Returns the value of attribute files
13 14 15 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 13 def files @files end |
#key ⇒ Object
Returns the value of attribute key
13 14 15 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 13 def key @key end |
#legacy_paths ⇒ Object
Returns the value of attribute legacy_paths
13 14 15 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 13 def legacy_paths @legacy_paths end |
#mcp_config ⇒ Object
Returns the value of attribute mcp_config
13 14 15 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 13 def mcp_config @mcp_config end |
#name ⇒ Object
Returns the value of attribute name
13 14 15 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 13 def name @name end |
#number ⇒ Object
Returns the value of attribute number
13 14 15 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 13 def number @number end |
Class Method Details
.all ⇒ Object
56 57 58 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 56 def all ALL end |
.find(key) ⇒ Object
60 61 62 63 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 60 def find(key) key = key.to_sym if key.respond_to?(:to_sym) ALL.find { |tool| tool.key == key } end |
.legacy_files ⇒ Object
69 70 71 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 69 def legacy_files ALL.flat_map { |tool| tool.legacy_paths.map { |path| { path: path, ai_tool: tool.key } } } end |
.mcp_configs_by_key ⇒ Object
65 66 67 |
# File 'lib/rails_ai_context/install/ai_tool.rb', line 65 def mcp_configs_by_key ALL.to_h { |tool| [ tool.key, tool.mcp_config ] } end |