npm package: @sanity/runtime-cli
Description: Sanity's Runtime CLI for Blueprints and Functions
Author: Sanity Runtime Team
Latest version: 14.11.0

@sanity/runtime-cli
===================

Sanity's Runtime CLI for Blueprints and Functions


[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/@sanity/runtime-cli.svg)](https://npmjs.org/package/@sanity/runtime-cli)
[![Downloads/week](https://img.shields.io/npm/dw/@sanity/runtime-cli.svg)](https://npmjs.org/package/@sanity/runtime-cli)


<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g @sanity/runtime-cli
$ sanity-run COMMAND
running command...
$ sanity-run (--version)
@sanity/runtime-cli/14.11.0 linux-x64 node-v24.14.1
$ sanity-run --help [COMMAND]
USAGE
  $ sanity-run COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`sanity-run blueprints add TYPE`](#sanity-run-blueprints-add-type)
* [`sanity-run blueprints config`](#sanity-run-blueprints-config)
* [`sanity-run blueprints deploy`](#sanity-run-blueprints-deploy)
* [`sanity-run blueprints destroy`](#sanity-run-blueprints-destroy)
* [`sanity-run blueprints doctor`](#sanity-run-blueprints-doctor)
* [`sanity-run blueprints info`](#sanity-run-blueprints-info)
* [`sanity-run blueprints init [DIR]`](#sanity-run-blueprints-init-dir)
* [`sanity-run blueprints logs`](#sanity-run-blueprints-logs)
* [`sanity-run blueprints plan`](#sanity-run-blueprints-plan)
* [`sanity-run blueprints stacks`](#sanity-run-blueprints-stacks)
* [`sanity-run functions add`](#sanity-run-functions-add)
* [`sanity-run functions dev`](#sanity-run-functions-dev)
* [`sanity-run functions env add NAME KEY VALUE`](#sanity-run-functions-env-add-name-key-value)
* [`sanity-run functions env list NAME`](#sanity-run-functions-env-list-name)
* [`sanity-run functions env remove NAME KEY`](#sanity-run-functions-env-remove-name-key)
* [`sanity-run functions logs [NAME]`](#sanity-run-functions-logs-name)
* [`sanity-run functions test [NAME]`](#sanity-run-functions-test-name)
* [`sanity-run help [COMMAND]`](#sanity-run-help-command)

## `sanity-run blueprints add TYPE`

Add a function resource to a Blueprint

```
USAGE
  $ sanity-run blueprints add TYPE [--json] [--validate-resources] [--example <value> | -n <value> | --fn-type
    document-publish|document-create|document-update|document-delete|media-library-asset-create|media-library-asset-upda
    te|media-library-asset-delete|scheduled-function... | --language ts|js | --javascript | --fn-helpers |
    --fn-installer skip|npm|pnpm|yarn] [-i | ]

ARGUMENTS
  TYPE  (function) Type of resource to add (only "function" is supported)

FLAGS
  -i, --install                  Shortcut for --fn-installer npm
  -n, --name=<value>             Name of the resource to add
      --example=<value>          Example to use for the function resource. Discover examples at
                                 https://www.sanity.io/exchange/type=recipes/by=sanity
      --[no-]fn-helpers          Add helpers to the new function
      --fn-installer=<option>    Which package manager to use when installing the @sanity/functions helpers
                                 <options: skip|npm|pnpm|yarn>
      --fn-type=<option>...      Document change event(s) that should trigger the function; you can specify multiple
                                 events by specifying this flag multiple times
                                 <options:
                                 document-publish|document-create|document-update|document-delete|media-library-asset-cr
                                 eate|media-library-asset-update|media-library-asset-delete|scheduled-function>
      --javascript               Use JavaScript instead of TypeScript
      --json                     Format output as json
      --language=<option>        [default: ts] Language of the new function
                                 <options: ts|js>
      --[no-]validate-resources  Validate resources

DESCRIPTION
  Add a function resource to a Blueprint

  Scaffolds a new Sanity Function in your Blueprint. Functions are serverless handlers triggered by document events
  (create, update, delete, publish) or media library events.

  After adding a function, use 'functions dev' to test locally, then 'blueprints deploy' to publish it.

EXAMPLES
  $ sanity-run blueprints add function

  $ sanity-run blueprints add function --helpers

  $ sanity-run blueprints add function --name my-function

  $ sanity-run blueprints add function --name my-function --fn-type document-create

  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
```

_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/add.ts)_

## `sanity-run blueprints config`

View or edit the local Blueprint configuration

```
USAGE
  $ sanity-run blueprints config [--json] [--validate-resources] [--project-id <value> -e] [--organization-id <value> ]
    [--stack <value> ]

FLAGS
  -e, --edit                     Modify the configuration interactively, or directly when combined with ID flags.
      --json                     Format output as json
      --organization-id=<value>  Sanity organization ID used to scope Blueprint and Stack
      --project-id=<value>       Sanity project ID used to scope Blueprint and Stack
      --stack=<value>            Stack name or ID to set in the configuration. Requires --edit flag
      --[no-]validate-resources  Validate resources

DESCRIPTION
  View or edit the local Blueprint configuration

  Manages the local Blueprint configuration, which links your Blueprint to a Sanity project and Stack.

  Without flags, displays the current configuration. Use --edit to interactively modify settings, or combine --edit with
  ID flags to update values directly (useful for scripting and automation).

  If you need to switch your Blueprint to a different Stack, use --edit --stack.

EXAMPLES
  $ sanity-run blueprints config

  $ sanity-run blueprints config --edit

  $ sanity-run blueprints config --edit --project-id <projectId>

  $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
```

_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/config.ts)_

## `sanity-run blueprints deploy`

Deploy the local Blueprint to the remote Stack

```
USAGE
  $ sanity-run blueprints deploy [--json] [--validate-resources] [--stack <value>] [-m <value>] [--no-wait]

FLAGS
  -m, --message=<value>          Message describing the deployment (e.g. reason for change)
      --json                     Format output as json
      --no-wait                  Do not wait for Stack deployment to complete
      --stack=<value>            Stack name or ID to use instead of the locally configured Stack
      --[no-]validate-resources  Validate resources

DESCRIPTION
  Deploy the local Blueprint to the remote Stack

  Applies your local Blueprint to the remote Stack, creating, updating, or removing resources as needed. This is the
  primary command for applying infrastructure changes.

  Before deploying, run 'blueprints plan' to preview changes. After deployment, use 'blueprints info' to verify Stack
  status or 'blueprints logs' to monitor activity.

  Use --no-wait to queue the deployment and return immediately without waiting for completion.

  Use --fn-installer to force which package manager to use when deploying functions.

  Set SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for processing resource assets.

EXAMPLES
  $ sanity-run blueprints deploy

  $ sanity-run blueprints deploy --message "Enable staging dataset"

  $ sanity-run blueprints deploy --no-wait

  $ sanity-run blueprints deploy --fn-installer npm
```

_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/deploy.ts)_

## `sanity-run blueprints destroy`

Destroy a remote Stack deployment and its resources

```
USAGE
  $ sanity-run blueprints destroy [--json] [--validate-resources] [--project-id <value> --stack <value> --force]
    [--organization-id <value>  ] [--no-wait]

FLAGS
  --force                    Force Stack destruction (skip confirmation)
  --json                     Format output as json
  --no-wait                  Do not wait for Stack destruction to complete
  --organization-id=<value>  Sanity organization ID used to scope Blueprint and Stack
  --project-id=<value>       Sanity project ID used to scope Blueprint and Stack
  --stack=<value>            Stack name or ID to destroy (defaults to the locally configured Stack)
  --[no-]validate-resources  Validate resources

DESCRIPTION
  Destroy a remote Stack deployment and its resources

  Permanently removes the remote Stack and all its provisioned resources. Your local Blueprint files remain untouched,
  allowing you to redeploy later with 'blueprints init' + 'blueprints deploy'.

  This is a destructive operation. You will be prompted to confirm unless --force is specified.

  Use this to clean up test environments or decommission a Stack you no longer need.

EXAMPLES
  $ sanity-run blueprints destroy

  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
```

_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/destroy.ts)_

## `sanity-run blueprints doctor`

Diagnose potential issues with local Blueprint and remote Stack configuration

```
USAGE
  $ sanity-run blueprints doctor [--json] [-p <value>] [--validate-resources] [--verbose] [--fix]

FLAGS
  -p, --path=<value>             [env: SANITY_BLUEPRINT_PATH] Path to a Blueprint file or directory containing one
      --fix                      Interactively fix configuration issues
      --json                     Format output as json
      --[no-]validate-resources  Validate resources
      --[no-]verbose             Verbose output; defaults to true

DESCRIPTION
  Diagnose potential issues with local Blueprint and remote Stack configuration

  Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication,
  invalid project references, or misconfigured resources.

  Run this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected
  issues.

EXAMPLES
  $ sanity-run blueprints doctor

  $ sanity-run blueprints doctor --fix
```

_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/doctor.ts)_

## `sanity-run blueprints info`

Display the status and resources of the remote Stack deployment

```
USAGE
  $ sanity-run blueprints info [--json] [--validate-resources] [--stack <value>]

FLAGS
  --json                     Format output as json
  --stack=<value>            Stack name or ID to use instead of the locally configured Stack
  --[no-]validate-resources  Validate resources

DESCRIPTION
  Display the status and resources of the remote Stack deployment

  Displays the current state and metadata of your remote Stack deployment, including deployed resources, status, and
  configuration.

  Use this command to verify a deployment succeeded, check what resources are live, or confirm which Stack your local
  Blueprint is connected to.

  Run 'blueprints stacks' to see all available Stacks in your project or organization.

EXAMPLES
  $ sanity-run blueprints info

  $ sanity-run blueprints info --stack <name-or-id>
```

_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/info.ts)_

## `sanity-run blueprints init [DIR]`

Initialize a Blueprint and create a remote Stack

```
USAGE
  $ sanity-run blueprints init [DIR] [--json] [--validate-resources] [--verbose] [--dir <value>] [--example <value> |
    --blueprint-type json|js|ts | --stack-id <value> | --stack-name <value>] [--project-id <value>] [--organization-id
    <value>]

ARGUMENTS
  [DIR]  Directory to create the local Blueprint in

FLAGS
  --blueprint-type=<option>  Blueprint manifest type to use for the local Blueprint
                             <options: json|js|ts>
  --dir=<value>              Directory to create the local Blueprint in
  --example=<value>          Example to use for the local Blueprint
  --json                     Format output as json
  --organization-id=<value>  Sanity organization ID used to scope Blueprint and Stack
  --project-id=<value>       Sanity project ID used to scope Blueprint and Stack
  --stack-id=<value>         Existing Stack ID used to scope local Blueprint
  --stack-name=<value>       Name to use for a new Stack provisioned during initialization
  --[no-]validate-resources  Validate resources
  --verbose                  Verbose output

DESCRIPTION
  Initialize a Blueprint and create a remote Stack

  A Blueprint is your local infrastructure-as-code configuration that defines Sanity resources (datasets, functions,
  etc.). A Stack is the remote deployment target where your Blueprint is applied.
  [NOTE: Currently, accounts are limited to three (3) Stacks per project scope.]

  This is typically the first command you run in a new project. It creates a local Blueprint manifest file
  (sanity.blueprint.ts, .js, or .json) and provisions a new remote Stack.
  Additionally, a Blueprint configuration file is created in .sanity/ containing the scope and Stack IDs. This is
  .gitignored by default.

  After initialization, use 'blueprints plan' to preview changes, then 'blueprints deploy' to apply them.

EXAMPLES
  $ sanity-run blueprints init

  $ sanity-run blueprints init [directory]

  $ sanity-run blueprints init --blueprint-type <json|js|ts>

  $ sanity-run blueprints init --blueprint-type <json|js|ts> --project-id <projectId> --stack-id <stackId>

  $ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
```

_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/init.ts)_

## `sanity-run blueprints logs`

Display logs for the current Blueprint's Stack deployment

```
USAGE
  $ sanity-run blueprints logs [--json] [--validate-resources] [--stack <value>] [-w]

FLAGS
  -w, --watch                    Watch for new Stack logs (streaming mode)
      --json                     Format output as json
      --stack=<value>            Stack name or ID to use instead of the locally configured Stack
      --[no-]validate-resources  Validate resources

DESCRIPTION
  Display logs for the current Blueprint's Stack deployment

  Retrieves Stack deployment logs, useful for debugging and monitoring deployment activity.

  Use --watch (-w) to stream logs in real-time.

  If you're not seeing expected logs, verify your Stack is deployed with 'blueprints info'.

EXAMPLES
  $ sanity-run blueprints logs

  $ sanity-run blueprints logs --watch
```

_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/logs.ts)_

## `sanity-run blueprints plan`

Preview changes that will be applied to the remote Stack

```
USAGE
  $ sanity-run blueprints plan [--json] [--validate-resources] [--stack <value>]

FLAGS
  --json                     Format output as json
  --stack=<value>            Stack name or ID to use instead of the locally configured Stack
  --[no-]validate-resources  Validate resources

DESCRIPTION
  Preview changes that will be applied to the remote Stack

  Use this command to preview what changes will be applied to your remote Stack before deploying. This is a safe,
  read-only operation—no resources are created, modified, or deleted.

  Run 'blueprints plan' after making local changes to your Blueprint manifest to verify the expected diff. When ready,
  run 'blueprints deploy' to apply changes.

EXAMPLES
  $ sanity-run blueprints plan
```

_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/plan.ts)_

## `sanity-run blueprints stacks`

List remote Stack deployments for your project or organization

```
USAGE
  $ sanity-run blueprints stacks [--json] [--validate-resources] [--project-id <value> | --organization-id <value>]

FLAGS
  --json                     Format output as json
  --organization-id=<value>  Sanity organization ID used to scope Blueprint and Stack
  --project-id=<value>       Sanity project ID used to scope Blueprint and Stack
  --[no-]validate-resources  Validate resources

DESCRIPTION
  List remote Stack deployments for your project or organization

  Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.

  Use this to discover existing Stacks you can scope a local Blueprint to (using 'blueprints config --edit'), or to
  audit what's deployed across your project.

EXAMPLES
  $ sanity-run blueprints stacks

  $ sanity-run blueprints stacks --project-id <projectId>

  $ sanity-run blueprints stacks --organization-id <organizationId>
```

_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/blueprints/stacks.ts)_

## `sanity-run functions add`

Add a Function to your Blueprint

```
USAGE
  $ sanity-run functions add [--json] [--validate-resources] [--example <value> | -n <value> |  | --language ts|js
    | --javascript |  | ] [--type document-publish|document-create|document-update|document-delete|media-library-asset-c
    reate|media-library-asset-update|media-library-asset-delete|scheduled-function... ] [--helpers] [--installer
    skip|npm|pnpm|yarn] [-i | ]

FLAGS
  -i, --install                  Shortcut for --fn-installer npm
  -n, --name=<value>             Name of the Function to add
      --example=<value>          Example to use for the Function
      --[no-]helpers             Add helpers to the new Function
      --installer=<option>       How to install the @sanity/functions helpers
                                 <options: skip|npm|pnpm|yarn>
      --javascript               Use JavaScript instead of TypeScript
      --json                     Format output as json
      --language=<option>        [default: ts] Language of the new Function
                                 <options: ts|js>
      --type=<option>...         Document change event(s) that should trigger the function; you can specify multiple
                                 events by specifying this flag multiple times
                                 <options:
                                 document-publish|document-create|document-update|document-delete|media-library-asset-cr
                                 eate|media-library-asset-update|media-library-asset-delete|scheduled-function>
      --[no-]validate-resources  Validate resources

DESCRIPTION
  Add a Function to your Blueprint

  Scaffolds a new Function in the functions/ folder and templates a resource for your Blueprint manifest.

  Functions are serverless handlers triggered by document events (create, update, delete, publish) or media library
  events.

  After adding, use 'functions dev' to test locally, then 'blueprints deploy' to publish.

EXAMPLES
  $ sanity-run functions add

  $ sanity-run functions add --helpers

  $ sanity-run functions add --name my-function

  $ sanity-run functions add --name my-function --type document-create

  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
```

_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/functions/add.ts)_

## `sanity-run functions dev`

Start the Sanity Function emulator

```
USAGE
  $ sanity-run functions dev [--json] [--validate-resources] [-h <value>] [-p <value>] [-t <value>]

FLAGS
  -h, --host=<value>             The local network interface at which to listen. [default: "localhost"]
  -p, --port=<value>             TCP port to start emulator on. [default: 8080]
  -t, --timeout=<value>          Maximum execution time for all functions, in seconds. Takes precedence over
                                 function-specific `timeout`
      --json                     Format output as json
      --[no-]validate-resources  Validate resources

DESCRIPTION
  Start the Sanity Function emulator

  Runs a local, web-based development server to test your functions before deploying.

  Open the emulator in your browser to interactively test your functions with the payload editor.

  Optionally, set the host and port with the --host and --port flags. Function timeout can be configured with the
  --timeout flag.

  To invoke a function with the CLI, use 'functions test'.

EXAMPLES
  $ sanity-run functions dev --host 127.0.0.1 --port 8974

  $ sanity-run functions dev --timeout 60
```

_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/functions/dev.ts)_

## `sanity-run functions env add NAME KEY VALUE`

Add or set an environment variable for a deployed function

```
USAGE
  $ sanity-run functions env add NAME KEY VALUE [--json] [--validate-resources]

ARGUMENTS
  NAME   The name of the Sanity Function
  KEY    The name of the environment variable
  VALUE  The value of the environment variable

FLAGS
  --json                     Format output as json
  --[no-]validate-resources  Validate resources

DESCRIPTION
  Add or set an environment variable for a deployed function

  Sets an environment variable in a deployed Sanity Function. If the variable already exists, its value is updated.

  Environment variables are useful for API keys, configuration values, and other secrets that shouldn't be hardcoded.
  Changes take effect on the next function invocation.

EXAMPLES
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
```

_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/functions/env/add.ts)_

## `sanity-run functions env list NAME`

List environment variables for a deployed function

```
USAGE
  $ sanity-run functions env list NAME [--json] [--validate-resources]

ARGUMENTS
  NAME  The name of the Sanity Function

FLAGS
  --json                     Format output as json
  --[no-]validate-resources  Validate resources

DESCRIPTION
  List environment variables for a deployed function

  Displays all environment variables (keys only) configured in a deployed Sanity Function.

  Use 'functions env add' to set variables or 'functions env remove' to delete them.

EXAMPLES
  $ sanity-run functions env list MyFunction
```

_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/functions/env/list.ts)_

## `sanity-run functions env remove NAME KEY`

Remove an environment variable from a deployed function

```
USAGE
  $ sanity-run functions env remove NAME KEY [--json] [--validate-resources]

ARGUMENTS
  NAME  The name of the Sanity Function
  KEY   The name of the environment variable

FLAGS
  --json                     Format output as json
  --[no-]validate-resources  Validate resources

DESCRIPTION
  Remove an environment variable from a deployed function

  Deletes an environment variable from a deployed Sanity Function. The change takes effect on the next function
  invocation.

  Use 'functions env list' to see current variables before removing.

EXAMPLES
  $ sanity-run functions env remove MyFunction API_URL
```

_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/functions/env/remove.ts)_

## `sanity-run functions logs [NAME]`

Retrieve or delete logs for a Sanity Function

```
USAGE
  $ sanity-run functions logs [NAME] [--validate-resources] [--stack <value>] [-u] [-f [-d | -l <value> | --json]]
    [-w]

ARGUMENTS
  [NAME]  The name of the Sanity Function

FLAGS
  -d, --delete                   Delete all logs for the function
  -f, --force                    Skip confirmation for deleting logs
  -l, --limit=<value>            [default: 50] Total number of log entries to retrieve
  -u, --utc                      Show dates in UTC time zone
  -w, --watch                    Watch for new logs (streaming mode)
      --json                     Format output as json
      --stack=<value>            Stack name or ID to use instead of the locally configured Stack
      --[no-]validate-resources  Validate resources

DESCRIPTION
  Retrieve or delete logs for a Sanity Function

  Fetches execution logs from a deployed function, useful for debugging production issues or monitoring activity.

  Use --watch (-w) to stream logs in real-time. Use --delete to clear all logs for a function (requires confirmation
  unless --force is specified).

EXAMPLES
  $ sanity-run functions logs <name>

  $ sanity-run functions logs <name> --json

  $ sanity-run functions logs <name> --limit 100

  $ sanity-run functions logs <name> --delete
```

_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/functions/logs.ts)_

## `sanity-run functions test [NAME]`

Invoke a local Sanity Function

```
USAGE
  $ sanity-run functions test [NAME] [--json] [--validate-resources] [--data-before <value> | [-d <value> | -f
    <value> | --document-id <value>] |  |  | --file-before <value> | --file-after <value> | --document-id-before <value>
    | --document-id-after <value>] [--data-after <value> |  |  |  |  |  |  | ] [-e create|update|delete] [-t <value>]
    [-a <value>] [--organization-id <value>] [--with-user-token] [--media-library-id <value> | --project-id <value> |
    --dataset <value>]

ARGUMENTS
  [NAME]  The name of the Sanity Function

FLAGS
  -a, --api=<value>                 Sanity API Version to use
  -d, --data=<value>                Data to send to the function
  -e, --event=<option>              Type of event (create, update, delete)
                                    <options: create|update|delete>
  -f, --file=<value>                Read data from file and send to the function
  -t, --timeout=<value>             Execution timeout value in seconds
      --data-after=<value>          Current document
      --data-before=<value>         Original document
      --dataset=<value>             The Sanity dataset to use
      --document-id=<value>         Document to fetch and send to function
      --document-id-after=<value>   Current document
      --document-id-before=<value>  Original document
      --file-after=<value>          Current document
      --file-before=<value>         Original document
      --json                        Format output as json
      --media-library-id=<value>    Sanity Media Library ID to use
      --organization-id=<value>     Sanity organization ID used to scope Blueprint and Stack
      --project-id=<value>          Sanity project ID used to scope Blueprint and Stack
      --[no-]validate-resources     Validate resources
      --with-user-token             Prime access token from CLI config

DESCRIPTION
  Invoke a local Sanity Function

  Executes a function locally with the provided payload, simulating how it would run when deployed. Use this to test
  your function logic before deploying.

  Provide test data via --data (inline JSON), --file (JSON file), or --document-id (fetch from Sanity). For update
  events, use the before/after flag pairs to simulate document changes.

EXAMPLES
  $ sanity-run functions test <name> --data '{ "id": 1 }'

  $ sanity-run functions test <name> --file 'payload.json'

  $ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60

  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
```

_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.11.0/src/commands/functions/test.ts)_

## `sanity-run help [COMMAND]`

Display help for sanity-run.

```
USAGE
  $ sanity-run help [COMMAND...] [-n]

ARGUMENTS
  [COMMAND...]  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for sanity-run.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.38/src/commands/help.ts)_
<!-- commandsstop -->