Class: RosettAi::Authorship::DisclosurePolicy
- Inherits:
-
Object
- Object
- RosettAi::Authorship::DisclosurePolicy
- 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.
Constant Summary collapse
- LEVELS =
['none', 'minimal', 'standard', 'full'].freeze
- DEFAULT_LEVEL =
'standard'
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Class Method Summary collapse
-
.from_config(data) ⇒ DisclosurePolicy
Loads the disclosure level from a config data hash.
Instance Method Summary collapse
-
#disclose? ⇒ Boolean
True if any metadata should be emitted.
-
#include_attribution? ⇒ Boolean
True if compiled output should include attribution section.
-
#include_per_file? ⇒ Boolean
True if per-file AI involvement should be included.
-
#include_trailer_guidance? ⇒ Boolean
True if trailer guidance should be in compiled output.
-
#initialize(level: DEFAULT_LEVEL) ⇒ DisclosurePolicy
constructor
A new instance of DisclosurePolicy.
Constructor Details
#initialize(level: DEFAULT_LEVEL) ⇒ DisclosurePolicy
Returns a new instance of DisclosurePolicy.
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
#level ⇒ Object (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.
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.
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.
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.
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.
63 64 65 |
# File 'lib/rosett_ai/authorship/disclosure_policy.rb', line 63 def include_trailer_guidance? at_least?('minimal') end |