Module: Textus::Manifest::Capabilities

Defined in:
lib/textus/manifest/capabilities.rb

Overview

Resolves a manifest’s ‘roles:` block (or the absence of one) into a capability map: { role_name => [verbs] }. Verbs are a subset of the closed capability set (Schema::CAPABILITIES). See ADR 0030.

Constant Summary collapse

DEFAULT_MAPPING =

Fallback role set for a manifest that omits ‘roles:` entirely. Agent is intentionally minimal here (`propose` only) — narrower than the `textus init` scaffold, which declares `agent: [propose, keep]` so the default `notebook` workspace is writable. A roles-less manifest that declares a `kind: workspace` zone is therefore rejected at load (no `keep`-holder); declare `roles:` to opt into a workspace lane (ADR 0033).

{
  "human" => %w[author propose].freeze,
  "agent" => %w[propose].freeze,
  "automation" => %w[fetch build].freeze,
}.freeze

Class Method Summary collapse

Class Method Details

.resolve(raw_roles) ⇒ Object

Returns { role_name => [verbs] }. When ‘roles:` is declared we use exactly that; defaults are not layered in (declaring roles is an opt-in to a fully user-defined vocabulary).



22
23
24
25
26
# File 'lib/textus/manifest/capabilities.rb', line 22

def self.resolve(raw_roles)
  return DEFAULT_MAPPING if raw_roles.nil?

  raw_roles.to_h { |r| [r["name"], Array(r["can"]).freeze] }.freeze
end