class ArchSpec::Producer

A named source of runtime facts. archspec reflect runs each producer declared in Archspec.rb in its own process: it boots the framework, analyzes the source, lets the producer record what it observes through a Facts::Builder, and writes <facts>/<name>.yml.

ArchSpec.producer :widgets do
  inputs "config/widgets.yml"          # global: a change invalidates every fact
  sources "app/widgets/**/*.rb"        # per file: a change invalidates that file's facts
  env "WIDGETS_ENV"                    # must match when a check sets it

  boot { |root| require File.join(root, "config/environment") }

  capture do |facts|
    Widgets.registry.each do |widget, service|
      facts.reference(source: widget, target: service, location: widget.declaration_site)
    end
  end
end

Checks never run producers; they read the files they wrote.