# `PtcRunner.Kernel.CommandSource`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/kernel/command_source.ex#L1)

Closed, path-free provenance for command diagnostics.

Names are fixed document roles or portable logical application names. A
filesystem path, provider alias, endpoint, or caller-selected private input
name is never a command source. Internal byte bounds and optional contract
authority are attested so callers cannot widen a span or substitute a path
from another classifying contract by mutating the struct.

# `kind`

```elixir
@type kind() ::
  :host
  | :project
  | :application
  | :component
  | :input_contract
  | :result_contract
  | :phase_return_contract
  | :external_input
  | :component_override
  | :runtime
```

# `t`

```elixir
@type t() :: %PtcRunner.Kernel.CommandSource{
  attestation: binary(),
  byte_size: non_neg_integer() | nil,
  contract_authority: PtcRunner.Kernel.CommandContractAuthority.t() | nil,
  kind: kind(),
  name: binary()
}
```

# `fixed`

```elixir
@spec fixed(kind()) :: t()
```

# `new`

```elixir
@spec new(kind(), binary()) :: {:ok, t()} | {:error, :invalid_command_source}
```

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

# `valid?`

```elixir
@spec valid?(term()) :: boolean()
```

# `with_bytes`

```elixir
@spec with_bytes(kind(), binary(), binary()) :: t()
```

Constructs provenance with the exact trusted source-byte bound used by spans.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
