> For the complete documentation index, see [llms.txt](https://docs.specifyapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.specifyapp.com/reference/parsers/select-modes-2.md).

# suffix-by

## Interface

```typescript
interface parser {
  name: 'suffix-by';
  options: ({
    all: string
  } | 
  {
    group?: string;
    collection?: string;
    token?: string;
  }) & { applyTo?: SDTFQuery }
}
```

## Options

<table><thead><tr><th width="170">Parameter</th><th width="127.33333333333331">Required</th><th width="330">Type</th><th width="136">Default</th><th width="253">Description</th></tr></thead><tbody><tr><td><code>all</code></td><td><code>false</code></td><td><code>string</code></td><td></td><td>Select all collections, groups and tokens in your SDTF token graph.</td></tr><tr><td><code>group</code></td><td><code>false</code></td><td><code>string</code></td><td></td><td>Select all groups in your SDTF token graph.</td></tr><tr><td><code>collection</code></td><td><code>false</code></td><td><code>string</code></td><td></td><td>Select all collections in your SDTF token graph.</td></tr><tr><td><code>token</code></td><td><code>false</code></td><td><code>string</code></td><td></td><td>Select all tokens in your SDTF token graph.</td></tr><tr><td><code>applyTo</code></td><td><code>false</code></td><td><pre class="language-typescript"><code class="lang-typescript">| { collection: string | true }
| { group: string | true }
| { token: string | true }
| SDTFQuery
</code></pre></td><td></td><td>The selection where to apply the transformation.<br><br><code>collection</code>, <code>group</code>, <code>token</code> take a Regex string or <code>true</code> to select anything of the kind.<br><br>An <a href="/pages/o67KwpWZQBri4JwW36gc#introduction"><code>SDTFQuery</code></a> can be used for advance use cases.</td></tr></tbody></table>

## Basic usage: Suffix color tokens

{% tabs %}
{% tab title="Input" %}
{% code lineNumbers="true" %}

```json
{
  "spacing": {
    "1": {
      "$type": "dimension",
      "$value": {
        "default": {
          "value": 4,
          "unit": "px"
        }
      }
    }
  },
  "colors": {
    "black": {
      "$type": "color",
      "$value": {
        "default": {
          "model": "hex",
          "hex": "#000000",
          "alpha": 1
        }
      }
    }
  }
}
```

{% endcode %}
{% endtab %}

{% tab title="Config" %}
{% code title=".specifyrc.json" lineNumbers="true" %}

```json5
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Prefix color tokens",
      "parsers": [
        {
          "name": "suffix-by",
          "options": {
            "token": "-color",
            "applyTo": {
              "where": {
                "token": ".*",
                "withTypes": {
                  "include": [
                    "color"
                  ]
                },
                "select": {
                  "parents": true
                }
              }
            }
          }
        },
        {
          "name": "to-sdtf",
          "output": {
            "type": "file",
            "filePath": "tokens.json"
          }
        }
      ]
    }
  ]
}
```

{% endcode %}
{% endtab %}

{% tab title="Output" %}
{% code title="tokens.json" lineNumbers="true" %}

```css
{
  "colors": {
    "black-color": {
      "$type": "color",
      "$value": {
        "default": {
          "model": "hex",
          "hex": "#000000",
          "alpha": 1
        }
      }
    }
  },
  "spacing": {
    "1": {
      "$type": "dimension",
      "$value": {
        "default": {
          "value": 4,
          "unit": "px"
        }
      }
    }
  }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.specifyapp.com/reference/parsers/select-modes-2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
