Class: RosettAi::Authorship::DisclosurePolicy

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

Overview

Manages disclosure levels for AI authorship attribution.

Four levels control how much AI involvement metadata appears in compiled output and commit messages:

  • +none+: no authorship metadata emitted
  • +minimal+: brief note that AI tools were used
  • +standard+: AI Attribution section in compiled output
  • +full+: per-file AI involvement summary

Disclosure level is read from +.rosett-ai/config.yml+ under +authorship.disclosure+, not from behaviour YAML.

Author:

  • hugo

  • claude

Constant Summary collapse

LEVELS =
['none', 'minimal', 'standard', 'full'].freeze
DEFAULT_LEVEL =
'standard'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level: DEFAULT_LEVEL) ⇒ DisclosurePolicy

Returns a new instance of DisclosurePolicy.

Parameters:

  • level (String) (defaults to: DEFAULT_LEVEL)

    one of LEVELS

Raises:

  • (ArgumentError)

    if level is not valid



31
32
33
34
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 31

def initialize(level: DEFAULT_LEVEL)
  validate_level!(level)
  @level = level.freeze
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



27
28
29
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 27

def level
  @level
end

Class Method Details

.from_config(data) ⇒ DisclosurePolicy

Loads the disclosure level from a config data hash.

Parameters:

  • data (Hash)

    configuration hash (e.g. from YAML config file)

Returns:



40
41
42
43
44
45
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 40

def self.from_config(data)
  level = data.dig('authorship', 'disclosure') || DEFAULT_LEVEL
  new(level: level)
rescue ArgumentError
  new(level: DEFAULT_LEVEL)
end

Instance Method Details

#disclose?Boolean

Returns true if any metadata should be emitted.

Returns:

  • (Boolean)

    true if any metadata should be emitted



48
49
50
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 48

def disclose?
  @level != 'none'
end

#include_attribution?Boolean

Returns true if compiled output should include attribution section.

Returns:

  • (Boolean)

    true if compiled output should include attribution section



53
54
55
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 53

def include_attribution?
  at_least?('standard')
end

#include_per_file?Boolean

Returns true if per-file AI involvement should be included.

Returns:

  • (Boolean)

    true if per-file AI involvement should be included



58
59
60
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 58

def include_per_file?
  at_least?('full')
end

#include_trailer_guidance?Boolean

Returns true if trailer guidance should be in compiled output.

Returns:

  • (Boolean)

    true if trailer guidance should be in compiled output



63
64
65
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 63

def include_trailer_guidance?
  at_least?('minimal')
end