Class: Shadwire::Commands::Status
- Inherits:
-
Object
- Object
- Shadwire::Commands::Status
- Defined in:
- lib/shadwire/commands/status.rb
Overview
Reports the consuming app's Shadwire context: stack detection, the components installed with the helper methods they actually define, and per-component drift.
This is the payload the agent skill injects, so it must always succeed. A directory that is not a Rails app, a missing shadwire.json, or an unreachable registry are all reported as data — never raised — because an exception here would leave an agent starting from a backtrace instead of its project context.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(root:, registry: nil, json: false, ui: UI.new) ⇒ Status
constructor
A new instance of Status.
Constructor Details
#initialize(root:, registry: nil, json: false, ui: UI.new) ⇒ Status
Returns a new instance of Status.
17 18 19 20 21 22 |
# File 'lib/shadwire/commands/status.rb', line 17 def initialize(root:, registry: nil, json: false, ui: UI.new) @root = root.to_s @registry_override = registry @json = json @ui = ui end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/shadwire/commands/status.rb', line 24 def call project = Project.new(@root) config = Config.load(@root) result = context(project, config) begin client = RegistryClient.new(@registry_override || config.registry) result["registryVersion"] = client.index["version"] result["availableCount"] = Array(client.index["items"]).size result["installed"] = installed(config, client) rescue Shadwire::Error => e result["registryError"] = e. end emit(result) result end |