# Resource verbs

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> The verbs every resource kind carries: get, describe, create, edit, label, annotate, copy, delete, and wait, plus the cross-cutting apply.


The `rl` command tree has one shape, so learning it once covers every
[resource kind](https://docs.ringleader.dev/reference/resources/). Each kind gets a command group of the
same name, and every group carries the same set of generic verbs:
`rl <kind> <verb>`. So you list workstations with `rl workstation get`, inspect one with
`rl workstation describe`, and remove it with `rl workstation delete`. The verbs
mirror `kubectl`: you describe state in YAML and `apply` it, then `get`/`describe`
to observe and `wait` to synchronize.

Most kinds have a short alias you can use in place of the full name, e.g. `ws`
(Workstation), `wsc` (WorkstationConfig), `lb` (LocalBinding), `ns` (Namespace),
`ci` (CloudIdentity), `ca` (CloudAccount), `od` (OrgDomain). `rl ws get` is the same
command as `rl workstation get`.

## `rl apply -f <file>`

Parse a (multi-document) YAML manifest and create or update each resource. This is
the one cross-cutting verb, since it is not tied to a single kind. `-f` takes a local
file, an `http://` or `https://` URL, or `-` for stdin.

```bash
rl apply -f workstation.yaml
rl apply -f https://example.com/manifests/dev-box.yaml   # fetched over HTTP
cat manifest.yaml | rl apply -f -
rl apply -f manifest.yaml -o yaml   # echo the written objects
```

| Flag | Description |
|------|-------------|
| `-f, --filename <file>` | Manifest file, `http(s)://` URL, or `-` for stdin. **Required.** Repeatable. Files are applied in the order given. |
| `-o, --output <format>` | Echo written objects: `yaml`, `json`, or `jsonpath='{.path}'`. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

A URL is downloaded and handed to the same pipeline a local file is, so you can apply a
manifest someone shared by link without piping it through `curl`. The download times out
after 30 seconds, and a body over 10 MiB is refused. `rl <kind> delete -f <url>` reads
a URL the same way.

Apply is **declarative and safe to re-run**: applying the same file again brings
the resources to match, reporting `unchanged` where nothing differs.

### Fields a command owns

Some spec fields are written by a command rather than by you: `rl workstation stop`
sets `spec.stopped`, `rl workstation restart` sets `spec.restartNonce`,
`rl binding enable`/`disable` sets `spec.enabled`, and so on. Apply is
last-apply-wins, so a manifest captured before one of those commands ran will quietly
undo it, starting a workstation you stopped or triggering a real power cycle.

`rl apply -f` warns before it does, naming the field, both values, and the command
that owns it:

```text
warning: workstation/my-box: the live workstation has spec.stopped=true (set by
rl workstation start/stop, or an idle policy in spec.lifecycle.idle) but your manifest
does not set it. Applying will clear it
```

Leaving a field out draws no warning when clearing it changes nothing. That covers a
Workstation whose `spec.stopped` is `false`, and a LocalBinding, SSHKey or Grant whose
`spec.enabled` is `true`. The warning still fires for `spec.restartNonce` and for every
other field a command owns, whatever its value.

The warning is **not fatal** and the apply proceeds. Use [`rl diff -f`](#rl-diff--f-file)
first if you want to see the whole change before committing to it.

## `rl diff -f <file>`

Preview what `rl apply -f <file>` would change, without changing anything. Each
document in the manifest is compared against the object the apply would actually land
on, using the same routing apply uses, so a workstation pinned to a cloud provider is
compared with the copy at the control plane, not a stale local one.

```bash
rl diff -f workstation.yaml
rl diff -f manifest.yaml -o json
cat manifest.yaml | rl diff -f -
```

An object that would be created shows as an all-new document; one that already exists
shows a unified diff of what the apply would replace. Fields an apply cannot change
are left out: status, ownership and finalizer bookkeeping, the server-assigned
identity fields, and the annotations the server derives on every write.

Secrets are compared **by key name only**: which keys the apply adds, removes, or
writes. No secret value, and nothing derived from one, is ever printed in any output
mode.

An object the apply would refuse shows as `<kind>/<namespace>/<name> @ <origin>: refused`,
with a note giving the reason, and counts as a difference. If a document earlier in the
same run is written first and could change that answer, the object keeps its usual
`create`, `update` or `unchanged` line, and a note says the refusal may not hold.

| Flag | Description |
|------|-------------|
| `-f, --filename <file>` | Manifest file, `http(s)://` URL, or `-` for stdin. **Required.** Repeatable. Files are previewed in the order given. |
| `-o, --output <format>` | `text` (default), `json`, or `yaml`. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

Exit codes differ from the rest of the CLI, so `rl diff` can drive a script:

| Code | Meaning |
|------|---------|
| `0` | No differences. |
| `1` | Differences found. This is not an error. |
| `2` | Usage error. |
| `3` | The preview could not be produced (unreadable manifest, unreachable origin, invalid document). |

## `rl <kind> get [name]`

List resources of a kind, or get one by name. Defaults to a table; supports YAML,
JSON, and JSONPath, and can watch for changes. `list` is an alias for `get`.

```bash
rl workstation get
rl workstation get my-box -o yaml
rl ws get -A                        # all namespaces
rl workstation get -w               # watch
rl secret get db -o jsonpath='{.metadata.name}'
```

| Flag | Description |
|------|-------------|
| `-n, --namespace <ns>` | Namespace. |
| `-A, --all-namespaces` | List across all namespaces. |
| `-l, --selector <selector>` | Label selector (`key=value[,key!=value,key in (a,b),key,!key]`) instead of name(s). |
| `-o, --output <format>` | `table` (default), `yaml`, `json`, `jsonpath='{.path}'`. |
| `-w, --watch` | Stream changes as they happen. |
| `--mine` | List only the objects you own. It is a usage error with a name, or on a kind that has no owner, such as Namespace or Org. |
| `--to <origin>` | Read from one origin by name (`self` for this device) instead of the usual routing. Alias: `--origin`. |
| `--reveal` | Reveal a Secret's values (needs the access right). It cannot be combined with `--to`: together they exit `2` and print no value. Drop `--to` to see the real values, or drop `--reveal` to read the redacted Secret at that origin. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

`-w` streams changes as they happen. Watching **workstations** additionally gives
each row a STATUS and an AGE, the same status label the table and the TUI show,
so you can watch a workstation advance to `Ready` (or settle into `Stopped`) live:

```text
$ rl workstation get -w
EVENT     NAMESPACE  NAME    STATUS       AGE
ADDED     local      my-box  Configuring  32s
MODIFIED  local      my-box  Ready        1m4s
```

Watching **Edges** streams `EVENT`, `NAMESPACE`, `NAME`, `READY`, `REASON` and `AGE`. Most other
kinds stream `EVENT`, `NAMESPACE`, `NAME` and `GEN`.

## JSONPath

`-o jsonpath=` evaluates **kubectl's JSONPath grammar**. An expression copied from
the kubectl documentation behaves here as it does there, including its limits.

```bash
# A field, plus a trailing newline literal.
rl workstation get my-box -o jsonpath='{.spec.stopped}{"\n"}'

# Filter a conditions list, the idiom a readiness model invites.
rl ws get my-box -o jsonpath='{.status.conditions[?(@.type=="Configured")].status}'

# Each attached config, one per line.
rl ws get my-box -o jsonpath='{range .spec.configs[*]}{.name}{"\n"}{end}'
```

What is available:

| Form | Example |
|------|---------|
| Field / nested field | `{.metadata.name}` |
| Index, negative index | `{.spec.configs[0].name}`, `{.spec.configs[-1].name}` |
| Wildcard | `{.spec.packages[*]}` |
| Filter | `{.status.conditions[?(@.type=="Ready")].reason}` |
| Existence filter | `{.status.conditions[?(@.reason)].type}` |
| Range | `{range .spec.configs[*]}{.name},{end}` |
| Recursive descent | `{..name}` |
| Text literals | `{"name="}{.metadata.name}{"\n"}` |
| Bracket keys | `{.metadata.labels['tier']}` |
| Whole object | `{$}` |

Filters compare with `==`, `!=`, `<`, `>`, `<=`, `>=`.

Mind the shape of what you are walking: a `{.name}` inside a `{range}` needs the
list to hold **objects**. Ringleader accepts `packages` as either bare strings or
`{name, version}` entries, so `{range .spec.packages[*]}{.name}{"\n"}{end}` prints
blank lines against a list of bare names; walk `{.spec.packages[*]}` directly
instead. A path that does not match renders empty rather than complaining.

Over a list, the template is evaluated once per object and each result gets its own
line. A missing key renders **empty** rather than erroring; a malformed template is
an error.

<div class="callout callout-note">
  <p class="callout-title">Three traps worth knowing</p>
  <div class="callout-body">
    <ul>
<li><strong><code>&amp;&amp;</code> and <code>||</code> do not work in a filter.</strong> They belong to label selectors, a
different grammar. Write one comparison per filter.</li>
<li><strong>A numeric comparison needs a decimal literal</strong>: <code>[?(@.seq&gt;1.0)]</code> works,
<code>[?(@.seq&gt;1)]</code> errors.</li>
<li><strong>A key containing a dot must escape it.</strong>
<code>{.metadata.annotations['ringleader\.dev/subject']}</code> resolves;
the unescaped form silently means a nested path and renders empty. Bracket keys
are <strong>single</strong>-quoted only.</li>
</ul>

  </div>
</div>


## `rl <kind> describe [name]`

Print a human-friendly summary of one or more resources: metadata, phase and
message, conditions, and spec. Good for a quick "why isn't this Ready?" glance.

```bash
rl workstation describe my-box
rl ws describe -A                 # every workstation you can see
```

| Flag | Description |
|------|-------------|
| `-n, --namespace <ns>` | Namespace. |
| `-A, --all-namespaces` | Describe across all namespaces. |
| `-l, --selector <selector>` | Label selector instead of name(s). |
| `--timestamps <zone>` | `utc` (default) or `local`. |
| `--to <origin>` | Read from one origin by name (`self` for this device). Alias: `--origin`. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl <kind> delete [name...]`

Delete one or more resources by name, every resource a label selector matches, or every
resource declared in a manifest with `-f`.

```bash
rl workstation delete my-box other-box
rl workstation delete -f manifest.yaml   # delete everything the file declares
```

Deleting a **Workstation** or a **Secret** asks you to confirm first, with a short summary
of what it destroys. For a workstation, that is its provider, its status, and whether it is
a cloud virtual machine that you pay for.

```text
About to delete workstation dev/my-box
  provider: gcp (billed cloud VM)
  status:   Ready
Deletion is final: the workstation, its disk, and any state on it are gone,
and anything not pushed elsewhere cannot be recovered.
Delete workstation/my-box? [y/N]
```

Only `y` or `yes` proceeds, and anything else, including a bare Enter, cancels. Pass `-y`
to skip the question. The prompt appears only at a terminal: when the input or the output is
redirected, the delete proceeds as if `-y` had been given.
[Deletion and delete deadlines](https://docs.ringleader.dev/workstations/lifecycle/deletion-deadlines/) says
what deleting a workstation removes, and what `-f` deletes beyond the workstation.

The command prints one line for each object. An object that is not gone yet, such as a
workstation whose machine is still being deleted, reads `workstation/my-box is being deleted`.
An object that is already gone reads `<kind>/<name> deleted`.

| Flag | Description |
|------|-------------|
| `-f, --filename <file>` | Manifest file, `http(s)://` URL, or `-` for stdin: delete every resource it declares. Repeatable. |
| `-l, --selector <selector>` | Label selector instead of name(s). |
| `-y, --yes` | Skip the confirmation prompt when deleting a Workstation or Secret. |
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl <kind> edit <name>`

Fetch the object as YAML, open it in `$VISUAL`/`$EDITOR`, and re-apply on save.

```bash
rl workstation edit my-box
rl secret edit db --reveal     # edit real Secret values in place
```

| Flag | Description |
|------|-------------|
| `-n, --namespace <ns>` | Namespace. |
| `--reveal` | Edit a Secret's real values (requires the access right). |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl <kind> label <name> <key>=<value>... <key>-...`

Add, change or remove labels on one object. Labels are the `key: value` pairs that a
[selector](https://docs.ringleader.dev/reference/resources/selectors/) and the `-l` flag match. `label` changes
only the keys you name, and the object's other labels stay as they are.

```bash
rl workstation label my-box team=billing tier=dev   # set two labels
rl workstation label my-box tier-                   # remove the tier label
rl ws label my-box tier=prod owner-                 # change one label and remove another
```

Each argument after the name is one change:

- `key=value` sets the key, adding it or replacing its value. `rl` splits the argument at its
  first `=`, so a value may contain `=` or a comma. Quote a value that contains a space.
  `key=` sets the key to an empty value.
- `key-` removes the key. Removing a key the object does not carry changes nothing.

`rl` prints one line that says what happened:

```text
$ rl workstation label my-box team=billing tier=dev
workstation/my-box labeled

$ rl workstation label my-box team=billing
workstation/my-box unchanged: its labels already match
```

When every change is already in place, `rl` writes nothing and exits `0`. If someone else
changes the object while `label` runs, `rl` reads the object again and makes your changes to
the new version. Their change stays too.

`label` changes one object, so run it once for each object you want to change. It takes no
`-l`, `-A` or `--to`. On a Secret, the values stay as they are and `rl` prints none of them.

`rl` exits `2` and changes nothing in each of these cases:

- An argument is neither `key=value` nor `key-`.
- A key appears twice.
- You give no change at all.

It exits `1` when Ringleader refuses the change, and prints the reason.

| Flag | Description |
|------|-------------|
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl <kind> annotate <name> <key>=<value>... <key>-...`

Add, change or remove annotations on one object. An annotation is a `key: value` note on an
object, such as who to ask about it. Selectors and `-l` match labels, not annotations.

```bash
rl workstation annotate my-box contact='billing team'
rl workstation annotate my-box contact-
```

`annotate` takes the same arguments and flags as [`label`](#rl-kind-label-name-keyvalue-key-),
changes only the keys you name, and exits the same way. Its line says `annotated` where
`label` says `labeled`.

Ringleader sets some annotations itself, such as `ringleader.dev/subject`, which records the
object's owner. A change to one of them does not hold: Ringleader either refuses it or keeps
its own value. When it keeps its own value, `rl` names the annotation and that value, and
exits `1`:

```text
$ rl workstation annotate my-box ringleader.dev/subject-
workstation/my-box: annotation ringleader.dev/subject is still "user:alice". Ringleader sets this key itself.
```

| Flag | Description |
|------|-------------|
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl <kind> copy <name> <new-name>`

Copy a resource under a new name. The copy is a **fresh, un-owned** object (owner
references are dropped) routed like `apply`, preserving the source's origin.

```bash
rl workstationconfig copy ide ide-experimental
```

To copy a [node-bound workstation](https://docs.ringleader.dev/workstations/basics/#node-bound-workstations) that runs
on another computer, add `--node self`, which binds the copy to the computer you run `rl` on.
Without it, a copy the control plane stores stays bound to the source's computer, and only that
computer can create it.

```bash
rl workstation copy dev dev-mine --node self
```

| Flag | Description |
|------|-------------|
| `--node self` | Bind a Workstation copy to this computer. `self` is the only value it accepts. |
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl <kind> wait [name...]`

Block until resources reach a desired state, like `kubectl wait`.

```bash
rl workstation wait my-box --for Ready --timeout 10m
rl workstation wait my-box --for Deleted
rl ws wait --all --for condition=Configured=True
rl ws wait my-box --for=jsonpath='{.status.phase}'=Running
rl ws wait my-box --for=jsonpath='{.status.conditions[?(@.type=="Ready")].status}'=False
```

Supported: `Ready`, `Deleted`, a phase name (e.g. `Running`, `Stopped`), a condition
name (e.g. `Configured`), `condition=<Type>[=<Status>]`, and `jsonpath='{<path>}'=<value>`,
the same [JSONPath grammar](#jsonpath) `get -o jsonpath=` evaluates. `wait` prints one
line for each resource that meets the condition, such as `workstation/my-box ready`. It
exits `0` once every resource has met it, and `1` on timeout.

When you wait for `Ready` or a phase other than `Failed`, a final failed verdict on the current
spec ends the wait for that workstation. `Available` does too unless the control plane will retry
the failure on its own; then it keeps waiting for recovery. `wait` prints its message and, when
there is one, what to do. It keeps waiting on any others, then exits `1`.

<div class="callout callout-note">
  <p class="callout-title">Note</p>
  <div class="callout-body">
    Under <code>--for=jsonpath=</code>, an expression that <strong>cannot</strong> evaluate reads as &ldquo;not
satisfied yet&rdquo;, so a permanently broken one (the integer-comparison trap above,
say) waits out the full timeout instead of failing fast. Try the same expression
under <code>get -o jsonpath=</code> first, where it errors immediately.
  </div>
</div>


| Flag | Description |
|------|-------------|
| `--for <condition>` | Condition to wait for (default `Ready`). |
| `--timeout <duration>` | How long to wait (default `20m`; `0` = no timeout). |
| `--all` | Wait on all resources of the kind in the namespace. |
| `-l, --selector <selector>` | Label selector instead of name(s). |
| `-A, --all-namespaces` | Wait across all namespaces. |
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## Unmatched names

The verbs on this page report a name they cannot find in the same way, and exit `1`:

```text
$ rl workstation get my-box
get: workstation "my-box" not found in namespace "dev"
  (try `rl workstation get my-box -A` to search every namespace)
```

The second line suggests a `get` across every namespace, whichever verb missed. It is left
out for a kind that has no namespace, such as Namespace or Org, and when the command already
searched every namespace with `-A`. With `-A`, a name that exists in more than one namespace
exits `2` and lists those namespaces, so you can name one with `-n`.

Given several names, `get` reports each one it cannot find, prints the ones it found, and
exits `1`. A verb that works on one object at a time, such as `edit`, refuses a second name
and exits `2`:

```text
$ rl workstation edit my-box other-box
edit: accepts at most 1 argument(s), got 2 (unexpected: "other-box")
```

