Module: RailsAiBridge::Serializers::RegenerationFooter

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

Overview

Builds the standard --- regeneration footer used across provider context files.

Class Method Summary collapse

Class Method Details

.continuation_lines(command:, variant:) ⇒ Array<String>

Lines to append after body content: blank line, rule, regeneration line (no trailing newline on string).

Parameters:

  • command (String)
  • variant (Symbol)

Returns:

  • (Array<String>)


45
46
47
# File 'lib/rails_ai_bridge/serializers/regeneration_footer.rb', line 45

def continuation_lines(command:, variant:)
  ['', '---', message_line(command: command, variant: variant)]
end

.markdown(command:, variant:) ⇒ String

Full markdown block: horizontal rule plus regeneration line (trailing newline).

Parameters:

  • command (String)
  • variant (Symbol)

Returns:

  • (String)


33
34
35
36
37
38
# File 'lib/rails_ai_bridge/serializers/regeneration_footer.rb', line 33

def markdown(command:, variant:)
  <<~MD
    ---
    #{message_line(command: command, variant: variant)}
  MD
end

.message_line(command:, variant:) ⇒ String

Renders the italic regeneration line for a rake command.

Parameters:

  • command (String)

    shell command (e.g. +rails ai:bridge+)

  • variant (Symbol)

    +:context_file+, +:auto_short+, or +:auto_branded+

Returns:

  • (String)

    single markdown line (italic wrapper)

Raises:

  • (ArgumentError)

    if +variant+ is unknown



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rails_ai_bridge/serializers/regeneration_footer.rb', line 15

def message_line(command:, variant:)
  case variant
  when :context_file
    "_This context file is auto-generated. Run `#{command}` to regenerate._"
  when :auto_short
    "_Auto-generated. Run `#{command}` to regenerate._"
  when :auto_branded
    "_Auto-generated by rails-ai-bridge. Run `#{command}` to regenerate._"
  else
    raise ArgumentError, "unknown regeneration footer variant: #{variant.inspect}"
  end
end