Class: Igniter::Extensions::Contracts::Creator::Report
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Creator::Report
- Defined in:
- lib/igniter/extensions/contracts/creator/report.rb
Instance Attribute Summary collapse
-
#audit ⇒ Object
readonly
Returns the value of attribute audit.
-
#scaffold ⇒ Object
readonly
Returns the value of attribute scaffold.
Instance Method Summary collapse
-
#initialize(scaffold:, audit: nil) ⇒ Report
constructor
A new instance of Report.
- #next_steps ⇒ Object
- #quality_bar ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(scaffold:, audit: nil) ⇒ Report
Returns a new instance of Report.
12 13 14 15 16 |
# File 'lib/igniter/extensions/contracts/creator/report.rb', line 12 def initialize(scaffold:, audit: nil) @scaffold = scaffold @audit = audit freeze end |
Instance Attribute Details
#audit ⇒ Object (readonly)
Returns the value of attribute audit.
10 11 12 |
# File 'lib/igniter/extensions/contracts/creator/report.rb', line 10 def audit @audit end |
#scaffold ⇒ Object (readonly)
Returns the value of attribute scaffold.
10 11 12 |
# File 'lib/igniter/extensions/contracts/creator/report.rb', line 10 def scaffold @scaffold end |
Instance Method Details
#next_steps ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/igniter/extensions/contracts/creator/report.rb', line 18 def next_steps steps = [ "fill in #{scaffold.pack_file_path} using only public Igniter::Contracts APIs", "run the generated spec and example", "use Igniter::Extensions::Contracts.audit_pack(...) before finalize" ] case scaffold.profile.name when :feature_node steps << "implement node kind, DSL keyword, validator, and runtime handler" when :operational_adapter steps << "implement effect and executor handlers with typed invocation contracts" when :diagnostic_bundle steps << "compose the suggested diagnostic dependency packs and add one pack-specific diagnostics contributor" when :bundle_pack steps << "install dependency packs and keep the bundle free of hidden runtime mutation" else case scaffold.kind when :feature steps << "make sure declared node contracts, DSL, validators, and runtime handlers stay aligned" when :operational steps << "make sure executor/effect contracts stay aligned with typed invocation objects" when :bundle steps << "prefer explicit dependency installation over hidden runtime mutation" end end steps << "review dependency hints: #{scaffold.profile.dependency_hints.join(", ")}" unless scaffold.profile.dependency_hints.empty? scaffold.profile.development_hints.each do |hint| steps << hint end scaffold.scope.packaging_hints.each do |hint| steps << hint end steps end |
#quality_bar ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/igniter/extensions/contracts/creator/report.rb', line 58 def { public_contracts_only: true, includes_spec: true, includes_example: true, includes_readme: true, audit_ok: audit&.ok?, authoring_profile: scaffold.profile.name, target_scope: scaffold.scope.name, runtime_dependency_hints: scaffold.profile.runtime_dependency_hints, development_dependency_hints: scaffold.profile.development_dependency_hints } end |
#to_h ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/igniter/extensions/contracts/creator/report.rb', line 72 def to_h payload = { scaffold: scaffold.to_h, next_steps: next_steps, quality_bar: } payload[:audit] = audit.to_h if audit payload end |