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 =

Returns Supported level values.

Returns:

  • (Array)

    Supported level values.

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

Returns Default log level.

Returns:

  • (String)

    Default log 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



33
34
35
36
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 33

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

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



29
30
31
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 29

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:



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

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



50
51
52
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 50

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



55
56
57
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 55

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



60
61
62
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 60

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



65
66
67
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 65

def include_trailer_guidance?
  at_least?('minimal')
end