@sanity/cli 8.10.0 → 8.12.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/README.md +69 -26
- package/dist/actions/assets/ingestAssetFromUrlWithProgress.js +21 -0
- package/dist/actions/assets/ingestAssetFromUrlWithProgress.js.map +1 -0
- package/dist/actions/assets/withUrlIngestProgress.js +45 -0
- package/dist/actions/assets/withUrlIngestProgress.js.map +1 -0
- package/dist/actions/auth/authServer.js +5 -8
- package/dist/actions/auth/authServer.js.map +1 -1
- package/dist/actions/auth/login/getProvider.js +10 -14
- package/dist/actions/auth/login/getProvider.js.map +1 -1
- package/dist/actions/auth/login/login.js +0 -1
- package/dist/actions/auth/login/login.js.map +1 -1
- package/dist/actions/deploy/deployApp.js +5 -2
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/deploy/deployChecks.js +3 -2
- package/dist/actions/deploy/deployChecks.js.map +1 -1
- package/dist/actions/deploy/findUserApplication.js +3 -2
- package/dist/actions/deploy/findUserApplication.js.map +1 -1
- package/dist/actions/deploy/resolveDeployTarget.js +6 -1
- package/dist/actions/deploy/resolveDeployTarget.js.map +1 -1
- package/dist/actions/documents/validateDocuments.worker.js +1 -4
- package/dist/actions/documents/validateDocuments.worker.js.map +1 -1
- package/dist/actions/media/importMedia.js.map +1 -1
- package/dist/actions/media/ingestMediaAssetFromUrlWithProgress.js +19 -0
- package/dist/actions/media/ingestMediaAssetFromUrlWithProgress.js.map +1 -0
- package/dist/commands/assets/upload.js +78 -52
- package/dist/commands/assets/upload.js.map +1 -1
- package/dist/commands/deploy.js +33 -1
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/media/import.js +149 -13
- package/dist/commands/media/import.js.map +1 -1
- package/dist/exports/invokeSanityCli/commandPolicies/index.js +1 -4
- package/dist/exports/invokeSanityCli/commandPolicies/index.js.map +1 -1
- package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js +26 -6
- package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js.map +1 -1
- package/dist/exports/invokeSanityCli/commandPolicies/resolve.js +112 -0
- package/dist/exports/invokeSanityCli/commandPolicies/resolve.js.map +1 -0
- package/dist/exports/invokeSanityCli/help.js +8 -1
- package/dist/exports/invokeSanityCli/help.js.map +1 -1
- package/dist/exports/invokeSanityCli/index.d.ts +1 -2
- package/dist/exports/invokeSanityCli/index.js +37 -15
- package/dist/exports/invokeSanityCli/index.js.map +1 -1
- package/dist/generated/apiRoutes.js +2 -0
- package/dist/generated/apiRoutes.js.map +1 -1
- package/dist/services/assets.js +46 -1
- package/dist/services/assets.js.map +1 -1
- package/dist/services/mediaLibraries.js +39 -1
- package/dist/services/mediaLibraries.js.map +1 -1
- package/dist/util/assetSourceValidation.js +56 -0
- package/dist/util/assetSourceValidation.js.map +1 -0
- package/dist/util/assetUploadErrors.js +64 -0
- package/dist/util/assetUploadErrors.js.map +1 -0
- package/dist/util/isRemoteAssetSource.js +19 -0
- package/dist/util/isRemoteAssetSource.js.map +1 -0
- package/dist/util/parseAspectFlags.js +34 -0
- package/dist/util/parseAspectFlags.js.map +1 -0
- package/oclif.config.js +0 -1
- package/oclif.manifest.json +2134 -2055
- package/package.json +18 -18
- package/templates/app-quickstart/AGENTS.md +18 -0
- package/templates/app-sanity-ui/AGENTS.md +18 -0
- package/templates/shopify/.gitignore +26 -0
- package/dist/exports/invokeSanityCli/commandPolicies/policy.js +0 -46
- package/dist/exports/invokeSanityCli/commandPolicies/policy.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.0",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity projects and organizations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -62,25 +62,25 @@
|
|
|
62
62
|
"@oclif/core": "^4.11.14",
|
|
63
63
|
"@oclif/plugin-help": "^6.2.53",
|
|
64
64
|
"@oclif/plugin-not-found": "^3.2.88",
|
|
65
|
-
"@sanity/cli-build": "^6.
|
|
66
|
-
"@sanity/cli-core": "^3.
|
|
67
|
-
"@sanity/client": "^8.
|
|
65
|
+
"@sanity/cli-build": "^6.4.0",
|
|
66
|
+
"@sanity/cli-core": "^3.8.0",
|
|
67
|
+
"@sanity/client": "^8.6.2",
|
|
68
68
|
"@sanity/codegen": "^8.1.0",
|
|
69
69
|
"@sanity/descriptors": "^1.3.0",
|
|
70
70
|
"@sanity/export": "^6.2.1",
|
|
71
71
|
"@sanity/generate-help-url": "^4.0.0",
|
|
72
|
-
"@sanity/id-utils": "^1.
|
|
73
|
-
"@sanity/import": "^7.0.
|
|
74
|
-
"@sanity/migrate": "^8.0.
|
|
75
|
-
"@sanity/runtime-cli": "
|
|
76
|
-
"@sanity/schema": "^6.
|
|
72
|
+
"@sanity/id-utils": "^1.1.0",
|
|
73
|
+
"@sanity/import": "^7.0.3",
|
|
74
|
+
"@sanity/migrate": "^8.0.3",
|
|
75
|
+
"@sanity/runtime-cli": "17.14.0",
|
|
76
|
+
"@sanity/schema": "^6.15.0",
|
|
77
77
|
"@sanity/telemetry": "^1.1.0",
|
|
78
78
|
"@sanity/template-validator": "^3.1.1",
|
|
79
|
-
"@sanity/types": "^6.
|
|
80
|
-
"@sanity/workbench-cli": "^2.
|
|
79
|
+
"@sanity/types": "^6.15.0",
|
|
80
|
+
"@sanity/workbench-cli": "^2.5.2",
|
|
81
81
|
"@sanity/worker-channels": "^2.0.0",
|
|
82
|
-
"@sanity/workflow-cli": "0.
|
|
83
|
-
"@sanity/workflow-engine": "0.
|
|
82
|
+
"@sanity/workflow-cli": "0.32.0",
|
|
83
|
+
"@sanity/workflow-engine": "0.32.0",
|
|
84
84
|
"@vercel/frameworks": "3.29.0",
|
|
85
85
|
"chokidar": "^5.0.0",
|
|
86
86
|
"console-table-printer": "^2.15.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"jsonc-parser": "^3.3.1",
|
|
97
97
|
"lodash-es": "^4.18.1",
|
|
98
98
|
"minimist": "^1.2.8",
|
|
99
|
-
"obug": "^
|
|
99
|
+
"obug": "^3.0.0",
|
|
100
100
|
"oneline": "^2.0.0",
|
|
101
101
|
"open": "^11.0.0",
|
|
102
102
|
"p-map": "^7.0.3",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"tinyglobby": "^0.2.17",
|
|
117
117
|
"typeid-js": "^1.2.0",
|
|
118
118
|
"valibot": "^1.4.2",
|
|
119
|
-
"vite": "^8.
|
|
119
|
+
"vite": "^8.3.0",
|
|
120
120
|
"which": "^6.0.1",
|
|
121
121
|
"wrap-ansi": "^9.0.2",
|
|
122
122
|
"yaml": "^2.9.0",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"@eslint/compat": "^2.1.0",
|
|
127
127
|
"@repo/package.config": "0.0.1",
|
|
128
128
|
"@repo/tsconfig": "3.70.0",
|
|
129
|
-
"@sanity/cli-test": "
|
|
129
|
+
"@sanity/cli-test": "18.0.0",
|
|
130
130
|
"@sanity/eslint-config-cli": "1.1.3",
|
|
131
131
|
"@sanity/pkg-utils": "^12.3.4",
|
|
132
132
|
"@swc/cli": "^0.8.1",
|
|
@@ -143,14 +143,14 @@
|
|
|
143
143
|
"@vitest/coverage-istanbul": "^4.1.11",
|
|
144
144
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
145
145
|
"eslint": "^10.7.0",
|
|
146
|
-
"get-it": "^9.5.
|
|
146
|
+
"get-it": "^9.5.4",
|
|
147
147
|
"jsdom": "^29.1.1",
|
|
148
148
|
"nock": "^14.0.15",
|
|
149
149
|
"oclif": "^4.23.27",
|
|
150
150
|
"oxc-transform-react": "^0.147.0",
|
|
151
151
|
"publint": "^0.3.21",
|
|
152
152
|
"rimraf": "^6.0.1",
|
|
153
|
-
"sanity": "^6.
|
|
153
|
+
"sanity": "^6.15.0",
|
|
154
154
|
"tsx": "^4.23.12",
|
|
155
155
|
"typescript": "^6.0.3",
|
|
156
156
|
"vitest": "^4.1.11"
|
|
@@ -19,6 +19,24 @@ A React application built with the Sanity App SDK (`@sanity/sdk-react`). It is n
|
|
|
19
19
|
|
|
20
20
|
Environment variables prefixed with `SANITY_APP_` are bundled into the app.
|
|
21
21
|
|
|
22
|
+
## Deploying without prompts
|
|
23
|
+
|
|
24
|
+
For the standard App SDK config, create the app explicitly on the first deploy:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm run deploy -- --create --title "My App" --yes --json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If `app` uses `defineApplication`, omit `--create`; that deployment flow already creates the app on its first run.
|
|
31
|
+
|
|
32
|
+
For the standard config, `--create` works even when the organization already has other apps. `app.title` in `sanity.cli.ts` can supply the title instead of `--title`. Add `--dry-run` to preview the deployment without creating or uploading anything.
|
|
33
|
+
|
|
34
|
+
Save `application.id` from the JSON response as `deployment.appId` in `sanity.cli.ts`. For later deploys, omit `--create` and run `npm run deploy -- --yes --json`. `--create` rejects a config that already has an app ID.
|
|
35
|
+
|
|
36
|
+
Agent terminals may disable interactive prompts even with a PTY (`TERM=dumb`). Use these flags rather than changing terminal settings or calling the applications API directly. Run `npm run deploy -- --help` to check which flags the installed CLI supports.
|
|
37
|
+
|
|
38
|
+
This app is not a Studio. For a Studio's first hosted deployment, use `sanity deploy --url <hostname> --yes`; `studioHost`, if used in config, belongs at the top level, not inside `deployment`.
|
|
39
|
+
|
|
22
40
|
## Working with the App SDK
|
|
23
41
|
|
|
24
42
|
If the Sanity MCP server is available, call its `get_sanity_rules` tool with the `app-sdk` rule before writing SDK code. That rule is the maintained guide and supersedes the notes below.
|
|
@@ -20,6 +20,24 @@ A React application built with the Sanity App SDK (`@sanity/sdk-react`) and Sani
|
|
|
20
20
|
|
|
21
21
|
Environment variables prefixed with `SANITY_APP_` are bundled into the app.
|
|
22
22
|
|
|
23
|
+
## Deploying without prompts
|
|
24
|
+
|
|
25
|
+
For the standard App SDK config, create the app explicitly on the first deploy:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run deploy -- --create --title "My App" --yes --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If `app` uses `defineApplication`, omit `--create`; that deployment flow already creates the app on its first run.
|
|
32
|
+
|
|
33
|
+
For the standard config, `--create` works even when the organization already has other apps. `app.title` in `sanity.cli.ts` can supply the title instead of `--title`. Add `--dry-run` to preview the deployment without creating or uploading anything.
|
|
34
|
+
|
|
35
|
+
Save `application.id` from the JSON response as `deployment.appId` in `sanity.cli.ts`. For later deploys, omit `--create` and run `npm run deploy -- --yes --json`. `--create` rejects a config that already has an app ID.
|
|
36
|
+
|
|
37
|
+
Agent terminals may disable interactive prompts even with a PTY (`TERM=dumb`). Use these flags rather than changing terminal settings or calling the applications API directly. Run `npm run deploy -- --help` to check which flags the installed CLI supports.
|
|
38
|
+
|
|
39
|
+
This app is not a Studio. For a Studio's first hosted deployment, use `sanity deploy --url <hostname> --yes`; `studioHost`, if used in config, belongs at the top level, not inside `deployment`.
|
|
40
|
+
|
|
23
41
|
## Working with the App SDK
|
|
24
42
|
|
|
25
43
|
If the Sanity MCP server is available, call its `get_sanity_rules` tool with the `app-sdk` rule before writing SDK code. That rule is the maintained guide and supersedes the notes below.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# Dependencies
|
|
4
|
+
/node_modules
|
|
5
|
+
/.pnp
|
|
6
|
+
.pnp.js
|
|
7
|
+
|
|
8
|
+
# Compiled Sanity Studio
|
|
9
|
+
/dist
|
|
10
|
+
|
|
11
|
+
# Temporary Sanity runtime, generated by the CLI on every dev server start
|
|
12
|
+
/.sanity
|
|
13
|
+
|
|
14
|
+
# Logs
|
|
15
|
+
/logs
|
|
16
|
+
*.log
|
|
17
|
+
|
|
18
|
+
# Coverage directory used by testing tools
|
|
19
|
+
/coverage
|
|
20
|
+
|
|
21
|
+
# Misc
|
|
22
|
+
.DS_Store
|
|
23
|
+
*.pem
|
|
24
|
+
|
|
25
|
+
# Typescript
|
|
26
|
+
*.tsbuildinfo
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-source command policies for programmatic CLI invocation.
|
|
3
|
-
*
|
|
4
|
-
* A policy decides, for one invocation source (e.g. the remote MCP server),
|
|
5
|
-
* which commands may be invoked and — for conditional entries — which parsed
|
|
6
|
-
* invocations of those commands are acceptable. Policies are exhaustive:
|
|
7
|
-
* every command in this package's oclif manifest has exactly one entry, so a
|
|
8
|
-
* newly added CLI command cannot slip into (or ambiguously stay out of) the
|
|
9
|
-
* invokable surface. A unit test enforces this; at runtime an uncategorized
|
|
10
|
-
* command id fails closed (treated as deny).
|
|
11
|
-
*/ /** The parsed command invocation a conditional policy is evaluated against. */ /** Every valid invocation of the command is safe. */ export const allow = {
|
|
12
|
-
kind: 'allow',
|
|
13
|
-
validate: ()=>true
|
|
14
|
-
};
|
|
15
|
-
/** No invocation of the command is safe. Behaves like an unknown command. */ export const deny = {
|
|
16
|
-
kind: 'deny',
|
|
17
|
-
validate: ()=>false
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Conditional policies to deny flags. The flags are also hidden
|
|
21
|
-
* from rendered help, so hosts are never told about surface they cannot use.
|
|
22
|
-
*/ export function conditionalDenyFlags(...names) {
|
|
23
|
-
return {
|
|
24
|
-
deniedFlags: names,
|
|
25
|
-
kind: 'conditional',
|
|
26
|
-
validate: ({ flags })=>names.every((name)=>flags[name] === undefined || flags[name] === false)
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Conditional policy combining {@link conditionalDenyFlags} with an extra
|
|
31
|
-
* predicate on the parsed invocation, for conditions a flag name alone
|
|
32
|
-
* cannot express — e.g. flag values that would read from the host machine.
|
|
33
|
-
* `deniedFlags` are hidden from rendered help; the predicate is not
|
|
34
|
-
* expressible there, so flags it constrains stay advertised.
|
|
35
|
-
*/ export function conditionalPolicy(options) {
|
|
36
|
-
const denyFlags = conditionalDenyFlags(...options.deniedFlags ?? []);
|
|
37
|
-
return {
|
|
38
|
-
...denyFlags,
|
|
39
|
-
validate: (invocation)=>denyFlags.validate(invocation) && options.validate(invocation)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export function isConditionalInvocationPolicy(policy) {
|
|
43
|
-
return policy.kind === 'conditional';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/exports/invokeSanityCli/commandPolicies/policy.ts"],"sourcesContent":["/**\n * Per-source command policies for programmatic CLI invocation.\n *\n * A policy decides, for one invocation source (e.g. the remote MCP server),\n * which commands may be invoked and — for conditional entries — which parsed\n * invocations of those commands are acceptable. Policies are exhaustive:\n * every command in this package's oclif manifest has exactly one entry, so a\n * newly added CLI command cannot slip into (or ambiguously stay out of) the\n * invokable surface. A unit test enforces this; at runtime an uncategorized\n * command id fails closed (treated as deny).\n */\n\n/** The parsed command invocation a conditional policy is evaluated against. */\ninterface Invocation {\n args: Readonly<Record<string, unknown>>\n flags: Readonly<Record<string, unknown>>\n}\n\ntype InvocationPolicy = (invocation: Invocation) => boolean\n\ntype ConditionalInvocationPolicy = CommandPolicy & {\n /**\n * Flag names this policy refuses. Declarative so the help renderer can\n * omit them (and examples using them) from the advertised command surface.\n */\n deniedFlags: readonly string[]\n\n kind: 'conditional'\n}\n\nexport interface CommandPolicy {\n kind: 'allow' | 'conditional' | 'deny'\n validate: InvocationPolicy\n}\n\n/** Every valid invocation of the command is safe. */\nexport const allow: CommandPolicy = {kind: 'allow', validate: () => true}\n\n/** No invocation of the command is safe. Behaves like an unknown command. */\nexport const deny: CommandPolicy = {kind: 'deny', validate: () => false}\n\n/**\n * Conditional policies to deny flags. The flags are also hidden\n * from rendered help, so hosts are never told about surface they cannot use.\n */\nexport function conditionalDenyFlags(...names: string[]): ConditionalInvocationPolicy {\n return {\n deniedFlags: names,\n kind: 'conditional',\n validate: ({flags}) =>\n names.every((name) => flags[name] === undefined || flags[name] === false),\n }\n}\n\n/**\n * Conditional policy combining {@link conditionalDenyFlags} with an extra\n * predicate on the parsed invocation, for conditions a flag name alone\n * cannot express — e.g. flag values that would read from the host machine.\n * `deniedFlags` are hidden from rendered help; the predicate is not\n * expressible there, so flags it constrains stay advertised.\n */\nexport function conditionalPolicy(options: {\n deniedFlags?: string[]\n validate: InvocationPolicy\n}): ConditionalInvocationPolicy {\n const denyFlags = conditionalDenyFlags(...(options.deniedFlags ?? []))\n return {\n ...denyFlags,\n validate: (invocation) => denyFlags.validate(invocation) && options.validate(invocation),\n }\n}\n\nexport function isConditionalInvocationPolicy(\n policy: CommandPolicy,\n): policy is ConditionalInvocationPolicy {\n return policy.kind === 'conditional'\n}\n\n/** A complete policy table, keyed by oclif command id. */\nexport type CommandPolicySet = Readonly<Record<string, CommandPolicy>>\n\n/** Where an invocation originates; selects the policy to enforce. */\nexport type InvocationSource = 'mcp'\n"],"names":["allow","kind","validate","deny","conditionalDenyFlags","names","deniedFlags","flags","every","name","undefined","conditionalPolicy","options","denyFlags","invocation","isConditionalInvocationPolicy","policy"],"mappings":"AAAA;;;;;;;;;;CAUC,GAED,6EAA6E,GAuB7E,mDAAmD,GACnD,OAAO,MAAMA,QAAuB;IAACC,MAAM;IAASC,UAAU,IAAM;AAAI,EAAC;AAEzE,2EAA2E,GAC3E,OAAO,MAAMC,OAAsB;IAACF,MAAM;IAAQC,UAAU,IAAM;AAAK,EAAC;AAExE;;;CAGC,GACD,OAAO,SAASE,qBAAqB,GAAGC,KAAe;IACrD,OAAO;QACLC,aAAaD;QACbJ,MAAM;QACNC,UAAU,CAAC,EAACK,KAAK,EAAC,GAChBF,MAAMG,KAAK,CAAC,CAACC,OAASF,KAAK,CAACE,KAAK,KAAKC,aAAaH,KAAK,CAACE,KAAK,KAAK;IACvE;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASE,kBAAkBC,OAGjC;IACC,MAAMC,YAAYT,wBAAyBQ,QAAQN,WAAW,IAAI,EAAE;IACpE,OAAO;QACL,GAAGO,SAAS;QACZX,UAAU,CAACY,aAAeD,UAAUX,QAAQ,CAACY,eAAeF,QAAQV,QAAQ,CAACY;IAC/E;AACF;AAEA,OAAO,SAASC,8BACdC,MAAqB;IAErB,OAAOA,OAAOf,IAAI,KAAK;AACzB"}
|