@sanity/cli 8.32.0 → 8.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "8.32.0",
3
+ "version": "8.33.0",
4
4
  "description": "Sanity CLI tool for managing Sanity projects and organizations",
5
5
  "keywords": [
6
6
  "cli",
@@ -63,17 +63,17 @@
63
63
  "@oclif/plugin-help": "^6.3.0",
64
64
  "@oclif/plugin-not-found": "^3.3.0",
65
65
  "@sanity/blueprints": "^0.34.1",
66
- "@sanity/cli-build": "^7.4.0",
67
- "@sanity/cli-core": "^3.15.1",
68
- "@sanity/client": "^8.16.0",
69
- "@sanity/codegen": "^8.3.1",
66
+ "@sanity/cli-build": "^7.5.0",
67
+ "@sanity/cli-core": "^3.16.0",
68
+ "@sanity/client": "^8.17.0",
69
+ "@sanity/codegen": "^8.3.3",
70
70
  "@sanity/descriptors": "^1.3.0",
71
71
  "@sanity/export": "^7.1.1",
72
72
  "@sanity/generate-help-url": "^4.0.0",
73
73
  "@sanity/id-utils": "^1.1.0",
74
74
  "@sanity/import": "^7.1.1",
75
75
  "@sanity/migrate": "^8.0.5",
76
- "@sanity/runtime-cli": "^17.21.5",
76
+ "@sanity/runtime-cli": "^17.21.6",
77
77
  "@sanity/schema": "^6.24.0",
78
78
  "@sanity/schema-descriptor-utils": "^1.4.0",
79
79
  "@sanity/telemetry": "^1.1.0",
@@ -81,7 +81,7 @@
81
81
  "@sanity/types": "^6.24.0",
82
82
  "@sanity/util": "^6.24.0",
83
83
  "@sanity/validation": "^6.24.0",
84
- "@sanity/workbench-cli": "^2.18.0",
84
+ "@sanity/workbench-cli": "^2.19.0",
85
85
  "@sanity/worker-channels": "^2.0.0",
86
86
  "@sanity/workflows": ">=0.39.0 <1.0.0",
87
87
  "@sanity/workflows-cli": ">=0.39.0 <1.0.0",
@@ -92,7 +92,7 @@
92
92
  "execa": "^10.0.1",
93
93
  "form-data": "^4.0.6",
94
94
  "get-latest-version": "^6.0.1",
95
- "groq-js": "^2.0.1",
95
+ "groq-js": "^2.0.3",
96
96
  "gunzip-maybe": "^1.4.2",
97
97
  "import-meta-resolve": "^4.2.0",
98
98
  "is-installed-globally": "^1.0.1",
@@ -110,14 +110,14 @@
110
110
  "promise-props-recursive": "^2.0.2",
111
111
  "rxjs": "^7.8.2",
112
112
  "semver": "^7.8.6",
113
- "skills": "^1.8.1",
113
+ "skills": "^1.9.0",
114
114
  "smol-toml": "^1.9.1",
115
115
  "string-argv": "^0.3.2",
116
116
  "string-width": "^7.2.0",
117
117
  "tar": "^7.5.23",
118
118
  "tar-stream": "^3.2.2",
119
119
  "tinyglobby": "^0.2.17",
120
- "valibot": "^1.4.2",
120
+ "valibot": "^1.5.0",
121
121
  "vite": "^8.3.8",
122
122
  "which": "^6.0.1",
123
123
  "wrap-ansi": "^9.0.2",
@@ -129,7 +129,7 @@
129
129
  "@repo/oxc-config": "0.0.0",
130
130
  "@repo/package.config": "0.0.1",
131
131
  "@repo/tsconfig": "3.70.0",
132
- "@sanity/cli-test": "25.0.2",
132
+ "@sanity/cli-test": "26.0.0",
133
133
  "@sanity/pkg-utils": "^12.3.4",
134
134
  "@swc/cli": "^0.8.2",
135
135
  "@swc/core": "^1.16.22",
@@ -148,7 +148,7 @@
148
148
  "nock": "^14.0.17",
149
149
  "oclif": "^4.24.0",
150
150
  "oxc-transform-react": "^0.158.0",
151
- "oxlint": "^1.93.0",
151
+ "oxlint": "^1.94.0",
152
152
  "publint": "^0.3.25",
153
153
  "rimraf": "^6.0.1",
154
154
  "sanity": "^6.24.0",
@@ -105,3 +105,14 @@ Essentials:
105
105
  - Editing documents: https://www.sanity.io/docs/app-sdk/editing-documents
106
106
  - Configuration: https://www.sanity.io/docs/app-sdk/sdk-configuration
107
107
  - API reference with current signatures: https://reference.sanity.io/_sanity/sdk-react/
108
+
109
+ ## Sanity: connect MCP, then what to build next
110
+
111
+ Check whether Sanity MCP tools are available before Sanity work. If they aren't, offer the user `npx sanity@latest mcp configure`. It detects their editor and adds the Sanity MCP server; they sign in from the editor the first time it connects. Ask before running it.
112
+
113
+ Once the app is running, show the user this map and offer the next step:
114
+
115
+ 1. **Schema**: this app has no Studio schema of its own to deploy. Types come from the schema file(s) at the project root, extracted from the Studio that owns the schema — see "Set up TypeGen before writing components" above.
116
+ 2. **Queries and types**: write GROQ with `defineQuery` and projections with `defineProjection`, then regenerate types with `npx sanity typegen generate` — again, see "Set up TypeGen before writing components" above.
117
+ 3. **Functions**: run code when content changes or on a schedule, for example fill in a slug when a post is published ([Functions guide](https://github.com/sanity-io/agent-toolkit/blob/main/skills/sanity-best-practices/references/functions.md)).
118
+ 4. **Deploy**: `npm run deploy` — see "Deploying without prompts" above for flags that work in agent terminals.
@@ -109,3 +109,14 @@ Essentials:
109
109
  - Sanity UI with the App SDK: https://www.sanity.io/docs/app-sdk/sanity-ui-sdk
110
110
  - Sanity UI docs: https://www.sanity.io/ui
111
111
  - API reference with current signatures: https://reference.sanity.io/_sanity/sdk-react/
112
+
113
+ ## Sanity: connect MCP, then what to build next
114
+
115
+ Check whether Sanity MCP tools are available before Sanity work. If they aren't, offer the user `npx sanity@latest mcp configure`. It detects their editor and adds the Sanity MCP server; they sign in from the editor the first time it connects. Ask before running it.
116
+
117
+ Once the app is running, show the user this map and offer the next step:
118
+
119
+ 1. **Schema**: this app has no Studio schema of its own to deploy. Types come from the schema file(s) at the project root, extracted from the Studio that owns the schema — see "Set up TypeGen before writing components" above.
120
+ 2. **Queries and types**: write GROQ with `defineQuery` and projections with `defineProjection`, then regenerate types with `npx sanity typegen generate` — again, see "Set up TypeGen before writing components" above.
121
+ 3. **Functions**: run code when content changes or on a schedule, for example fill in a slug when a post is published ([Functions guide](https://github.com/sanity-io/agent-toolkit/blob/main/skills/sanity-best-practices/references/functions.md)).
122
+ 4. **Deploy**: `npm run deploy` — see "Deploying without prompts" above for flags that work in agent terminals.
@@ -0,0 +1,14 @@
1
+ # AGENTS.md
2
+
3
+ Guidance for AI coding agents working in this repository.
4
+
5
+ ## Sanity: connect MCP, then what to build next
6
+
7
+ Check whether Sanity MCP tools are available before Sanity work. If they aren't, offer the user `npx sanity@latest mcp configure`. It detects their editor and adds the Sanity MCP server; they sign in from the editor the first time it connects. Ask before running it.
8
+
9
+ Once the project is set up, show the user this map and offer the next step:
10
+
11
+ 1. **Schema**: model content in `schemaTypes/`, then offer to run `npx sanity schemas deploy` so MCP tools can see it.
12
+ 2. **Queries and types**: put queries under `src/` or set `typegen.path` in the CLI config to their location. Add `groq` if importing `defineQuery` from it. From the Studio root, run `npx sanity schema extract && npx sanity typegen generate`.
13
+ 3. **Functions**: run code when content changes or on a schedule, for example fill in a slug when a post is published ([Functions guide](https://github.com/sanity-io/agent-toolkit/blob/main/skills/sanity-best-practices/references/functions.md)).
14
+ 4. **Deploy**: when the user is ready to publish, offer `npx sanity deploy`.
@@ -108,3 +108,14 @@ Essentials:
108
108
  - Editing documents: https://www.sanity.io/docs/app-sdk/editing-documents
109
109
  - Configuration: https://www.sanity.io/docs/app-sdk/sdk-configuration
110
110
  - API reference with current signatures: https://reference.sanity.io/_sanity/sdk-react/
111
+
112
+ ## Sanity: connect MCP, then what to build next
113
+
114
+ Check whether Sanity MCP tools are available before Sanity work. If they aren't, offer the user `npx sanity@latest mcp configure`. It detects their editor and adds the Sanity MCP server; they sign in from the editor the first time it connects. Ask before running it.
115
+
116
+ Once the app is running, show the user this map and offer the next step:
117
+
118
+ 1. **Schema**: this app has no Studio schema of its own to deploy. Types come from the schema file(s) at the project root, extracted from the Studio that owns the schema — see "Set up TypeGen before writing components" above.
119
+ 2. **Queries and types**: write GROQ with `defineQuery` and projections with `defineProjection`, then regenerate types with `npx sanity typegen generate` — again, see "Set up TypeGen before writing components" above.
120
+ 3. **Functions**: run code when content changes or on a schedule, for example fill in a slug when a post is published ([Functions guide](https://github.com/sanity-io/agent-toolkit/blob/main/skills/sanity-best-practices/references/functions.md)).
121
+ 4. **Deploy**: `npm run deploy` — see "Deploying without prompts" above for flags that work in agent terminals.
@@ -112,3 +112,14 @@ Essentials:
112
112
  - Sanity UI with the App SDK: https://www.sanity.io/docs/app-sdk/sanity-ui-sdk
113
113
  - Sanity UI docs: https://www.sanity.io/ui
114
114
  - API reference with current signatures: https://reference.sanity.io/_sanity/sdk-react/
115
+
116
+ ## Sanity: connect MCP, then what to build next
117
+
118
+ Check whether Sanity MCP tools are available before Sanity work. If they aren't, offer the user `npx sanity@latest mcp configure`. It detects their editor and adds the Sanity MCP server; they sign in from the editor the first time it connects. Ask before running it.
119
+
120
+ Once the app is running, show the user this map and offer the next step:
121
+
122
+ 1. **Schema**: this app has no Studio schema of its own to deploy. Types come from the schema file(s) at the project root, extracted from the Studio that owns the schema — see "Set up TypeGen before writing components" above.
123
+ 2. **Queries and types**: write GROQ with `defineQuery` and projections with `defineProjection`, then regenerate types with `npx sanity typegen generate` — again, see "Set up TypeGen before writing components" above.
124
+ 3. **Functions**: run code when content changes or on a schedule, for example fill in a slug when a post is published ([Functions guide](https://github.com/sanity-io/agent-toolkit/blob/main/skills/sanity-best-practices/references/functions.md)).
125
+ 4. **Deploy**: `npm run deploy` — see "Deploying without prompts" above for flags that work in agent terminals.
@@ -1,49 +0,0 @@
1
- import { readFile, stat } from 'node:fs/promises';
2
- import { extname } from 'node:path';
3
- // The image formats populus accepts as an organization logo. It needs an image Content-Type, and
4
- // the CLI has no other source for one.
5
- const LOGO_CONTENT_TYPES = {
6
- '.avif': 'image/avif',
7
- '.bmp': 'image/bmp',
8
- '.gif': 'image/gif',
9
- '.heic': 'image/heic',
10
- '.heif': 'image/heif',
11
- '.jpeg': 'image/jpeg',
12
- '.jpg': 'image/jpeg',
13
- '.png': 'image/png',
14
- '.svg': 'image/svg+xml',
15
- '.tif': 'image/tiff',
16
- '.tiff': 'image/tiff',
17
- '.webp': 'image/webp'
18
- };
19
- // Matches populus's limit, so a large file fails here instead of after uploading it.
20
- const MAX_LOGO_BYTES = 5 * 1024 * 1024;
21
- /**
22
- * Read an image file to upload as an organization's logo. Throws an error a user can act on when
23
- * the file is missing, isn't a supported image type, or is over 5 MB.
24
- */ export async function readOrganizationLogo(filePath) {
25
- const contentType = LOGO_CONTENT_TYPES[extname(filePath).toLowerCase()];
26
- if (!contentType) {
27
- throw new Error(`"${filePath}" isn't a supported image type. Use a PNG, JPEG, GIF, WebP, SVG, BMP, TIFF, HEIF or AVIF file.`);
28
- }
29
- let stats;
30
- try {
31
- stats = await stat(filePath);
32
- } catch (error) {
33
- if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
34
- throw new Error(`Couldn't find "${filePath}". Check the path and try again.`, {
35
- cause: error
36
- });
37
- }
38
- throw error;
39
- }
40
- if (stats.size > MAX_LOGO_BYTES) {
41
- throw new Error(`"${filePath}" is larger than 5 MB, the limit for a logo. Use a smaller image.`);
42
- }
43
- return {
44
- contentType,
45
- image: await readFile(filePath)
46
- };
47
- }
48
-
49
- //# sourceMappingURL=readOrganizationLogo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/organizations/readOrganizationLogo.ts"],"sourcesContent":["import {type Stats} from 'node:fs'\nimport {readFile, stat} from 'node:fs/promises'\nimport {extname} from 'node:path'\n\n// The image formats populus accepts as an organization logo. It needs an image Content-Type, and\n// the CLI has no other source for one.\nconst LOGO_CONTENT_TYPES: Record<string, string> = {\n '.avif': 'image/avif',\n '.bmp': 'image/bmp',\n '.gif': 'image/gif',\n '.heic': 'image/heic',\n '.heif': 'image/heif',\n '.jpeg': 'image/jpeg',\n '.jpg': 'image/jpeg',\n '.png': 'image/png',\n '.svg': 'image/svg+xml',\n '.tif': 'image/tiff',\n '.tiff': 'image/tiff',\n '.webp': 'image/webp',\n}\n\n// Matches populus's limit, so a large file fails here instead of after uploading it.\nconst MAX_LOGO_BYTES = 5 * 1024 * 1024\n\nexport interface OrganizationLogo {\n contentType: string\n image: Buffer\n}\n\n/**\n * Read an image file to upload as an organization's logo. Throws an error a user can act on when\n * the file is missing, isn't a supported image type, or is over 5 MB.\n */\nexport async function readOrganizationLogo(filePath: string): Promise<OrganizationLogo> {\n const contentType = LOGO_CONTENT_TYPES[extname(filePath).toLowerCase()]\n if (!contentType) {\n throw new Error(\n `\"${filePath}\" isn't a supported image type. Use a PNG, JPEG, GIF, WebP, SVG, BMP, TIFF, HEIF or AVIF file.`,\n )\n }\n\n let stats: Stats\n try {\n stats = await stat(filePath)\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {\n throw new Error(`Couldn't find \"${filePath}\". Check the path and try again.`, {cause: error})\n }\n throw error\n }\n\n if (stats.size > MAX_LOGO_BYTES) {\n throw new Error(`\"${filePath}\" is larger than 5 MB, the limit for a logo. Use a smaller image.`)\n }\n\n return {contentType, image: await readFile(filePath)}\n}\n"],"names":["readFile","stat","extname","LOGO_CONTENT_TYPES","MAX_LOGO_BYTES","readOrganizationLogo","filePath","contentType","toLowerCase","Error","stats","error","code","cause","size","image"],"mappings":"AACA,SAAQA,QAAQ,EAAEC,IAAI,QAAO,mBAAkB;AAC/C,SAAQC,OAAO,QAAO,YAAW;AAEjC,iGAAiG;AACjG,uCAAuC;AACvC,MAAMC,qBAA6C;IACjD,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;AACX;AAEA,qFAAqF;AACrF,MAAMC,iBAAiB,IAAI,OAAO;AAOlC;;;CAGC,GACD,OAAO,eAAeC,qBAAqBC,QAAgB;IACzD,MAAMC,cAAcJ,kBAAkB,CAACD,QAAQI,UAAUE,WAAW,GAAG;IACvE,IAAI,CAACD,aAAa;QAChB,MAAM,IAAIE,MACR,CAAC,CAAC,EAAEH,SAAS,8FAA8F,CAAC;IAEhH;IAEA,IAAII;IACJ,IAAI;QACFA,QAAQ,MAAMT,KAAKK;IACrB,EAAE,OAAOK,OAAO;QACd,IAAIA,iBAAiBF,SAAS,UAAUE,SAASA,MAAMC,IAAI,KAAK,UAAU;YACxE,MAAM,IAAIH,MAAM,CAAC,eAAe,EAAEH,SAAS,gCAAgC,CAAC,EAAE;gBAACO,OAAOF;YAAK;QAC7F;QACA,MAAMA;IACR;IAEA,IAAID,MAAMI,IAAI,GAAGV,gBAAgB;QAC/B,MAAM,IAAIK,MAAM,CAAC,CAAC,EAAEH,SAAS,iEAAiE,CAAC;IACjG;IAEA,OAAO;QAACC;QAAaQ,OAAO,MAAMf,SAASM;IAAS;AACtD"}