Module: RailsAiBridge::Serializers::LegacyAgentFiles

Defined in:
lib/rails_ai_bridge/serializers/legacy_agent_files.rb

Overview

Deprecated assistant files that are no longer written unless config.output.legacy_agent_files is on.

Cursor reads .cursor/rules/ and AGENTS.md, Devin does not read .devinrules, and Codex reads only AGENTS.md. The split-rules directories of the Cursor and Devin formats are still written; only their single main file is skipped. For Codex, only the .codex/README.md split output is skipped.

Constant Summary collapse

MAIN_FORMATS =
%i[cursor devin].freeze
SPLIT_FORMATS =
%i[codex].freeze
WARN_MUTEX =
Mutex.new
WARNING =
'[rails-ai-bridge] DEPRECATION: config.output.legacy_agent_files enables deprecated assistant files ' \
'(.cursorrules, .devinrules, and .codex/README.md), where selected. They will be removed in 6.0.'

Class Method Summary collapse

Class Method Details

.reset_warning! ⇒ void

This method returns an undefined value.

Clears the once-per-process memo (for specs).



44
45
46
# File 'lib/rails_ai_bridge/serializers/legacy_agent_files.rb', line 44

def reset_warning!
  @warned = false
end

.skip_main?(fmt) ⇒ Boolean

Returns true when the format's main file is deprecated output and the flag is off.

Parameters:

  • fmt (Symbol) —

    format key

Returns:

  • (Boolean) —

    true when the format's main file is deprecated output and the flag is off



20
# File 'lib/rails_ai_bridge/serializers/legacy_agent_files.rb', line 20

def skip_main?(fmt) = skipped?(fmt, MAIN_FORMATS)

.skip_split?(fmt) ⇒ Boolean

Returns true when the format's split-rules output is deprecated and the flag is off.

Parameters:

  • fmt (Symbol) —

    format key

Returns:

  • (Boolean) —

    true when the format's split-rules output is deprecated and the flag is off



24
# File 'lib/rails_ai_bridge/serializers/legacy_agent_files.rb', line 24

def skip_split?(fmt) = skipped?(fmt, SPLIT_FORMATS)

.warn_once(formats) ⇒ void

This method returns an undefined value.

Prints the deprecation notice once per process when the flag writes deprecated files.

Parameters:

  • formats (Array<Symbol>) —

    formats being written



30
31
32
33
34
35
36
37
38
39
# File 'lib/rails_ai_bridge/serializers/legacy_agent_files.rb', line 30

def warn_once(formats)
  return unless enabled? && formats.intersect?(MAIN_FORMATS + SPLIT_FORMATS)

  should_warn = WARN_MUTEX.synchronize do
    next false if @warned

    @warned = true
  end
  warn(WARNING) if should_warn
end