@sanity/cli 8.32.1 → 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/dist/actions/deploy/deployApp.js +3 -3
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/deploy/deployStudio.js +2 -3
- package/dist/actions/deploy/deployStudio.js.map +1 -1
- package/dist/actions/dev/devAction.js +2 -1
- package/dist/actions/dev/devAction.js.map +1 -1
- package/dist/actions/init/bootstrapLocalTemplate.js +18 -0
- package/dist/actions/init/bootstrapLocalTemplate.js.map +1 -1
- package/dist/actions/preview/previewAction.js +2 -1
- package/dist/actions/preview/previewAction.js.map +1 -1
- package/dist/commands/organizations/create.js +2 -2
- package/dist/commands/organizations/create.js.map +1 -1
- package/dist/commands/organizations/update.js +2 -2
- package/dist/commands/organizations/update.js.map +1 -1
- package/dist/generated/apiRoutes.js +2 -0
- package/dist/generated/apiRoutes.js.map +1 -1
- package/dist/services/organizations.js.map +1 -1
- package/oclif.manifest.json +252 -252
- package/package.json +11 -11
- package/templates/app-quickstart/AGENTS.md +11 -0
- package/templates/app-sanity-ui/AGENTS.md +11 -0
- package/templates/shared/AGENTS.md +14 -0
- package/templates/shared/dashboard/app-quickstart/AGENTS.md +11 -0
- package/templates/shared/dashboard/app-sanity-ui/AGENTS.md +11 -0
- package/dist/actions/organizations/readOrganizationLogo.js +0 -49
- package/dist/actions/organizations/readOrganizationLogo.js.map +0 -1
|
@@ -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"}
|