Skip to content
docsv0.30.2

Operation

The class IS the operation — its identity, declared where a human writes it and an agent reads it. This is the intent half of greenhouse decisions/0212: «what changes authority is DECLARED; what a type already says is DERIVED». Everything this attribute carries is intent — a name a human types, a sentence that explains the purpose, the surfaces it is allowed to appear on. Nothing here can be inferred from a signature, which is exactly why it is written down. The mechanics — the input schema, the admissible values of an enum, the output shape — are NOT here: they are read off the constructor and the return type by {@see DeclaredOperation}. ```php #[Operation(name: 'hola:greet', description: 'Write a greeting into var/greetings.txt')] #[Mutates(Mutation::Persistent, Externality::None, Reversibility::Guaranteed, subject: Subject::Data)] final class Greet { public function __construct(#[Target] #[Because('who to greet')] public readonly string $name) {} public function run(Greetings $greetings): array { return $greetings->write($this->name); } } ```

Operation::__construct()

public function __construct(string $name, string $description, ?string $version = null, ?string $path = null, ?array $surfaces = null):

Parameters

Parameters of __construct()
NameTypeDescription
$namestringHow a human and an agent both call it (`domain:verb`).
$descriptionstringWhat it does, in one sentence — the text the CLI's `--help` and the agent's catalogue BOTH show. One truth, two readers; there is no second copy to keep in sync.
$version(string | null)The contract version, when this operation has one.
$path(string | null)An explicit HTTP path, when the derived one will not do.
$surfaces(list<string> | null)The surfaces allowed to project it; `null` means all.