Class: RosettAi::Authorship::AttributionCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/authorship/attribution_compiler.rb

Overview

Compiles authorship attribution sections for engine output.

Generates markdown sections for CLAUDE.md, AGENTS.md, and other engine-specific output based on the active disclosure level. Ensures compiled metadata never exceeds what the disclosure level permits — per-file details are stripped at any level below full.

Author:

  • hugo

  • claude

Constant Summary collapse

FILES_KEYS =
['files', :files].freeze

Instance Method Summary collapse

Constructor Details

#initialize(disclosure_policy:) ⇒ AttributionCompiler

Returns a new instance of AttributionCompiler.

Parameters:



21
22
23
# File 'lib/rosett_ai/authorship/attribution_compiler.rb', line 21

def initialize(disclosure_policy:)
  @policy = disclosure_policy
end

Instance Method Details

#compile(engine_name:, provider:, provenance_entries: []) ⇒ Hash

Compiles an attribution section for inclusion in engine output.

Parameters:

  • engine_name (String)

    active engine display name

  • provider (String)

    engine provider

  • provenance_entries (Array<Hash>) (defaults to: [])

    recent provenance entries

Returns:

  • (Hash)

    with +:section+ (String, nil) and +:warnings+ (Array)



31
32
33
34
35
36
37
38
# File 'lib/rosett_ai/authorship/attribution_compiler.rb', line 31

def compile(engine_name:, provider:, provenance_entries: [])
  warnings = []
  return { section: nil, warnings: warnings } unless @policy.disclose?

  safe_entries = sanitize_entries(provenance_entries)
  section = build_section(engine_name, provider, safe_entries, warnings)
  { section: section, warnings: warnings }
end