test-studio-script-runner
/test-studio-script-runner
Wyjaśnia narzędzie Script Runner w dev/test-studio i pomaga dodawać, edytować, uruchamiać oraz dokumentować skrypty, ich zmienne i skrypty Sanity Studio działające w przeglądarce.
- Autor
- sanity-io ↗
- Repozytorium
- plugins ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 27.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Wyjaśnia narzędzie Script Runner w dev/test-studio i pomaga dodawać, edytować, uruchamiać oraz dokumentować skrypty, ich zmienne i skrypty Sanity Studio działające w przeglądarce.
Oryginalny opis (EN)
Explains the dev/test-studio Script Runner tool. Use when adding, editing, running, or documenting scripts in dev/test-studio/src/script-runner, or when the user mentions the Scripts tool, Studio runner scripts, script variables, or browser-side Sanity Studio scripts.
Jak działa
- Key Files
- What The Tool Does
- Adding A Script
- Runtime Contract
- String Variables
- Browser-Safe Rules
- Verification
Podgląd SKILL.md
---
name: test-studio-script-runner
description: Explains the dev/test-studio Script Runner tool. Use when adding, editing, running, or documenting scripts in dev/test-studio/src/script-runner, or when the user mentions the Scripts tool, Studio runner scripts, script variables, or browser-side Sanity Studio scripts.
---
# Test Studio Script Runner
Use this skill when working with the `Scripts` tool in `dev/test-studio`.
## Key Files
- Tool plugin: `dev/test-studio/src/script-runner/index.tsx`
- Runner UI: `dev/test-studio/src/script-runner/ScriptRunnerTool.tsx`
- Script registry: `dev/test-studio/src/script-runner/registry.ts`
- Script contract: `dev/test-studio/src/script-runner/types.ts`
- Script modules: `dev/test-studio/src/script-runner/scripts/*/index.ts`
- Agent-facing docs: `dev/test-studio/src/script-runner/README.md`
Read `README.md` and `types.ts` before changing the runner or adding scripts.
## What The Tool Does
The runner is a Sanity Studio custom tool registered in the `home` workspace.
- Home route: `<studio>/home/scripts`
- Script route: `<studio>/home/scripts/<script-name>`
Scripts are browser-side TypeScript modules discovered at build time with Vite `import.meta.glob`.
They run inside Sanity Studio with the logged-in user's permissions and receive the Studio client.
## Adding A Script
Add a folder under `dev/test-studio/src/script-runner/scripts/`. The folder name should match the
script name. Put the registered entrypoint in `index.ts`; any helper files can live beside it.
```text
scripts/
my-script-name/
index.ts
helpers.ts
```
Only `scripts/*/index.ts` files are discovered at build time.
```ts
import type {StudioScript} from '../../types'
const script: StudioScript = {
name: 'my-script-name',
title: 'My script name',
description: 'What this script does.',
apiVersion: '2026-03-01',
inputs: [
{
name: 'documentId',
title: 'Document ID',
defaultValue: 'example-id',
required: true,
},
],
async run({client, inputs, log}) {
log.info(`Running for ${inputs.documentId}`)
await client.fetch('*[_type == "post"][0...1]')
log.success('Done')
},
}
export default script
```
Script names must be unique and use lowercase letters, numbers, and hyphens. Keep the folder name
and script `name` aligned. The script name becomes the URL segment.
## Runtime Contract
`run()` receives:
- `client`: Sanity Studio client, configured with the script `apiVersion` or the runner default.
- `inputs`: string values from the run screen, keyed by input `name`.
- `log`: `info`, `success`, `warning`, and `error` methods that append output in the UI.
- `signal`: an `AbortSignal` reserved for script code that supports cancellation.
## String Variables
Use `inputs` for string variables. Each input renders as a text field on the script run screen.
Required inputs disable the run button until non-empty.
Available input fields:
- `name`
- `title`
- `description`
- `defaultValue`
- `placeholder`
- `required`
All values passed to scripts are strings. Validate and trim values inside `run()` when needed.
## Browser-Safe Rules
Script runner modules execute in the browser. Do not use:
- `fs`, `path`, or other Node built-ins
- `process.exit`
- direct environment variable access
- `SANITY_AUTH_TOKEN`
Do not create a separate Sanity client from env vars. Use the provided `client`.
If a task needs Node-only APIs or token-based CLI behavior, keep it in `dev/test-studio/scripts/`
instead of the Studio script runner.
## Verification
After changing the runner or adding scripts, run:
```bash
pnpm lint
pnpm --filter test-studio build
```
If `pnpm --filter test-studio build` fails because workspace package `dist` output is missing, build
with dependencies first:
```bash
pnpm --filter test-studio... build
```
Wersje
W bazie nie ma innych skilli o nazwie test-studio-script-runner.
Migawka bazy z 13.11.2026 · wersja paczki ce929affcc58 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100mutation-test-runner
Prawdopodobnie pomaga uruchamiać testy mutacyjne przy pisaniu i uruchamianiu testów, w kategorii Test Automation. - 90test-runner-setup
Instaluje runner testów i jeden test dymny w projekcie bez testów, żeby sprawdzanie zachowania stało się poleceniem. - 100sanity-plugin-authoring
Wyjaśnia i pomaga tworzyć pluginy Sanity Studio z użyciem publicznych API pluginów i narzędzi, w tym dodawanie narzędzi przez pluginy. - 100studio
Uruchamia Remotion Studio z packages/example i otwiera je w przeglądarce Codex, gdy użytkownik wywoła /studio lub chce lokalnie mieć interfejs deweloperski. - 100sanity
Pomaga pracować z headless CMS Sanity: schematy, zapytania GROQ, konfiguracja Studio, Portable Text oraz integracja z Next.js przez next-sanity, Draft Mode i visual editing. - 100setup
Przygotowuje projekt pod kod: testy, linter z limitami rozmiaru i złożoności oraz skrypty test i lint.