[Tools](https://oods-foundry.com/tools) / brand_apply

# `brand_apply`

Preview or apply changes to an existing brand's canonical token source.

Generated from @oods/foundry 0.10.1

One of the 20 tools your assistant sees by default.

Use it when editing a brand; use brand_create to create one. Returns validation, changed slots, before/after hashes and build evidence. delta is required and supports aliases or add/remove/replace patches. apply defaults to a dry run that writes nothing. apply:true validates first, then writes source and rebuilds; build failure leaves source edits in place. For shipped brands in the portable runtime, apply emits a review kit and reports source/build steps as skipped. User brands rebuild in their own folder. Reference: TOOL-REFERENCE.md#brand_apply; full schema: oods\://schemas/brand_apply.input.json.

## Inputs

| Name | Type | Required | Description |
| - | - | - | - |
| `brand` | `string` | no | Target brand identifier. Must name a brand directory under packages/tokens/src/tokens/brands. |
| `delta` | `object \| array` | yes | Alias changes (object) or an array using the supported add/remove/replace subset of RFC 6902 when strategy=patch. |
| `strategy` | `"alias" \| "patch"` | no | Alias strategy rewrites token values; patch applies the supported add/remove/replace subset of RFC 6902. |
| `preview` | `object` | no | Preview response controls (apply=false). |
| `apply` | `boolean` | no | Write on true; otherwise preview. |

## Outputs

| Name | Type | Required | Description |
| - | - | - | - |
| `receipt` | `object` | yes | |
| `artifacts` | `string[]` | yes | |
| `diagnosticsPath` | `string` | no | |
| `transcriptPath` | `string` | no | |
| `bundleIndexPath` | `string` | no | |
| `preview` | `object` | no | |
| `artifactsDetail` | `artifactDetail[]` | no | |

## A real call

Recorded by this site's `tools` run, step `brand-apply`, with the published OODS Foundry 0.10.1.

Its input:

```
{
  "brand": "A",
  "delta": {
    "surface.interactive.primary.default": "oklch(0.5 0.1 183)"
  }
}
```

Its result, first lines:

```
{
  "receipt": {
    "sourceWritten": false,
    "sourceFiles": [],
    "build": null,
    "changes": [],
    "metadataChanges": 3,
    "validation": {
      "valid": false,
      "brand_id": "A",
      "themes": {
        "base": {
          "label": "light",
          "slots": 103,
          "provided": 104
        },
        "dark": {
          "label": "dark",
          "slots": 96,
          "provided": 97
        },
        "hc": {
          "label": "high contrast",
          "slots": 96,
          "provided": 97
        }
      },
      "issues": [
        {
          "rule": "slot-not-token",
          "theme": "base",
          "slot": "surface.interactive.primary.default",
          "message": "base.surface.interactive.primary.default is not a token: give {\"$type\": \"color\", \"$value\": \"…\"}."
        },
        {
          "rule": "slot-not-token",
          "theme": "dark",
          "slot": "surface.interactive.primary.default",
          "message": "dark.surface.interactive.primary.default is not a token: give {\"$type\": \"color\", \"$value\": \"…\"}."
        },
        {
          "rule": "slot-not-token",
          "theme": "hc",
          "slot": "surface.interactive.primary.default",
          "message": "hc.surface.interactive.primary.default is not a token: give {\"$type\": \"color\", \"$value\": \"…\"}."
        }
      ],
      "contrast": {
        "base": {
          "graded": 84,
          "passed": 84,
          "failed": 0,
          "ungraded": 0,
          "charts": {
            "graded": 7,
            "passed": 7,
            "failed": 0,
            "ungraded": 0
          }
        },
```

[The whole call, 6 KB of JSON](https://oods-foundry.com/tools/brand-apply/call.json)
