Class: RailsAiContext::Serializers::CursorRulesSerializer
- Inherits:
-
Object
- Object
- RailsAiContext::Serializers::CursorRulesSerializer
- Includes:
- StackOverviewHelper, ToolGuideHelper
- Defined in:
- lib/rails_ai_context/serializers/cursor_rules_serializer.rb
Overview
Generates .cursor/rules/*.mdc files in the new Cursor MDC format. Each file is focused, <50 lines, with YAML frontmatter. .cursorrules is deprecated by Cursor; this is the recommended format.
Constant Summary
Constants included from ToolGuideHelper
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#call(output_dir) ⇒ Hash
{ written: [paths], skipped: [paths] }.
-
#initialize(context) ⇒ CursorRulesSerializer
constructor
A new instance of CursorRulesSerializer.
Methods included from ToolGuideHelper
#build_tools_table, #render_tools_guide, #render_tools_guide_compact, #tool_call, #tool_count, #tool_mode, #tools_anti_hallucination_section, #tools_antipatterns_section, #tools_detail_guidance, #tools_header, #tools_intro, #tools_name_list, #tools_power_tool_section, #tools_rules_section, #tools_table, #tools_workflow_section
Methods included from StackOverviewHelper
#arch_labels_hash, #detect_before_actions, #detect_job_files, #detect_service_files, #full_preset_stack_lines, #model_extras_line, #notable_gems_list, #pattern_labels_hash, #project_root, #render_compact_controllers_list, #scope_names, #write_rule_files
Constructor Details
#initialize(context) ⇒ CursorRulesSerializer
Returns a new instance of CursorRulesSerializer.
14 15 16 |
# File 'lib/rails_ai_context/serializers/cursor_rules_serializer.rb', line 14 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
12 13 14 |
# File 'lib/rails_ai_context/serializers/cursor_rules_serializer.rb', line 12 def context @context end |
Instance Method Details
#call(output_dir) ⇒ Hash
Returns { written: [paths], skipped: [paths] }.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rails_ai_context/serializers/cursor_rules_serializer.rb', line 20 def call(output_dir) rules_dir = File.join(output_dir, ".cursor", "rules") files = { File.join(rules_dir, "rails-project.mdc") => render_project_rule, File.join(rules_dir, "rails-models.mdc") => render_models_rule, File.join(rules_dir, "rails-controllers.mdc") => render_controllers_rule, File.join(rules_dir, "rails-mcp-tools.mdc") => render_mcp_tools_rule } write_rule_files(files) end |