@sanity/cli 8.0.1 → 8.0.3

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.
Files changed (119) hide show
  1. package/dist/SanityHelp.js.map +1 -1
  2. package/dist/actions/backup/assertDatasetExist.js +2 -1
  3. package/dist/actions/backup/assertDatasetExist.js.map +1 -1
  4. package/dist/actions/backup/downloadAsset.js +3 -24
  5. package/dist/actions/backup/downloadAsset.js.map +1 -1
  6. package/dist/actions/backup/downloadDocument.js +11 -22
  7. package/dist/actions/backup/downloadDocument.js.map +1 -1
  8. package/dist/actions/backup/downloadStream.js +83 -0
  9. package/dist/actions/backup/downloadStream.js.map +1 -0
  10. package/dist/actions/build/buildStudio.js +3 -2
  11. package/dist/actions/build/buildStudio.js.map +1 -1
  12. package/dist/actions/build/eventListenerFactory.js +7 -6
  13. package/dist/actions/build/eventListenerFactory.js.map +1 -1
  14. package/dist/actions/build/shouldAutoUpdate.js +2 -1
  15. package/dist/actions/build/shouldAutoUpdate.js.map +1 -1
  16. package/dist/actions/cors/filterAndValidateOrigin.js +3 -2
  17. package/dist/actions/cors/filterAndValidateOrigin.js.map +1 -1
  18. package/dist/actions/deploy/createUserApplication.js +2 -1
  19. package/dist/actions/deploy/createUserApplication.js.map +1 -1
  20. package/dist/actions/deploy/deployRunner.js +3 -2
  21. package/dist/actions/deploy/deployRunner.js.map +1 -1
  22. package/dist/actions/deploy/deployStudio.js +3 -3
  23. package/dist/actions/deploy/deployStudio.js.map +1 -1
  24. package/dist/actions/deploy/findUserApplication.js +8 -7
  25. package/dist/actions/deploy/findUserApplication.js.map +1 -1
  26. package/dist/actions/dev/servers/startAppDevServer.js +2 -1
  27. package/dist/actions/dev/servers/startAppDevServer.js.map +1 -1
  28. package/dist/actions/dev/servers/startStudioDevServer.js +3 -3
  29. package/dist/actions/dev/servers/startStudioDevServer.js.map +1 -1
  30. package/dist/actions/documents/validate.js +5 -5
  31. package/dist/actions/documents/validate.js.map +1 -1
  32. package/dist/actions/documents/validateDocuments.worker.js +4 -1
  33. package/dist/actions/documents/validateDocuments.worker.js.map +1 -1
  34. package/dist/actions/init/env/createOrAppendEnvVars.js +2 -1
  35. package/dist/actions/init/env/createOrAppendEnvVars.js.map +1 -1
  36. package/dist/actions/init/env/parseAndUpdateEnvVars.js +2 -2
  37. package/dist/actions/init/env/parseAndUpdateEnvVars.js.map +1 -1
  38. package/dist/actions/schema/extractSchema.js +2 -2
  39. package/dist/actions/schema/extractSchema.js.map +1 -1
  40. package/dist/actions/schema/extractSchemaWatcher.js +2 -1
  41. package/dist/actions/schema/extractSchemaWatcher.js.map +1 -1
  42. package/dist/actions/schema/uploadSchemaToLexicon.js +3 -0
  43. package/dist/actions/schema/uploadSchemaToLexicon.js.map +1 -1
  44. package/dist/actions/telemetry/telemetryDebug.js +2 -2
  45. package/dist/actions/telemetry/telemetryDebug.js.map +1 -1
  46. package/dist/actions/undeploy/runUndeploy.js +2 -2
  47. package/dist/actions/undeploy/runUndeploy.js.map +1 -1
  48. package/dist/commands/backups/list.js +5 -8
  49. package/dist/commands/backups/list.js.map +1 -1
  50. package/dist/commands/datasets/copy.js +5 -7
  51. package/dist/commands/datasets/copy.js.map +1 -1
  52. package/dist/commands/datasets/import.js +7 -10
  53. package/dist/commands/datasets/import.js.map +1 -1
  54. package/dist/commands/docs/search.js +2 -2
  55. package/dist/commands/docs/search.js.map +1 -1
  56. package/dist/commands/mcp/configure.js +2 -2
  57. package/dist/commands/mcp/configure.js.map +1 -1
  58. package/dist/commands/typegen/generate.js +6 -6
  59. package/dist/commands/typegen/generate.js.map +1 -1
  60. package/dist/exports/_internal.d.ts +50 -82
  61. package/dist/exports/index.d.ts +48 -78
  62. package/dist/exports/invokeSanityCli/index.d.ts +108 -18
  63. package/dist/exports/invokeSanityCli/index.js +2 -1
  64. package/dist/exports/invokeSanityCli/index.js.map +1 -1
  65. package/dist/exports/runtime.d.ts +3 -65
  66. package/dist/services/api.js +23 -15
  67. package/dist/services/api.js.map +1 -1
  68. package/dist/services/auth.js +4 -4
  69. package/dist/services/auth.js.map +1 -1
  70. package/dist/services/backup.js +3 -3
  71. package/dist/services/backup.js.map +1 -1
  72. package/dist/services/cors.js +3 -3
  73. package/dist/services/cors.js.map +1 -1
  74. package/dist/services/datasetAliases.js +5 -5
  75. package/dist/services/datasetAliases.js.map +1 -1
  76. package/dist/services/datasets.js +3 -3
  77. package/dist/services/datasets.js.map +1 -1
  78. package/dist/services/documents.js +1 -1
  79. package/dist/services/documents.js.map +1 -1
  80. package/dist/services/getProjectFeatures.js +1 -1
  81. package/dist/services/getProjectFeatures.js.map +1 -1
  82. package/dist/services/getUrlHeaders.js +3 -9
  83. package/dist/services/getUrlHeaders.js.map +1 -1
  84. package/dist/services/grants.js +1 -1
  85. package/dist/services/grants.js.map +1 -1
  86. package/dist/services/graphql.js +4 -3
  87. package/dist/services/graphql.js.map +1 -1
  88. package/dist/services/hooks.js +6 -6
  89. package/dist/services/hooks.js.map +1 -1
  90. package/dist/services/mcp.js +4 -4
  91. package/dist/services/mcp.js.map +1 -1
  92. package/dist/services/mediaLibraries.js +3 -3
  93. package/dist/services/mediaLibraries.js.map +1 -1
  94. package/dist/services/mintProject.js +33 -14
  95. package/dist/services/mintProject.js.map +1 -1
  96. package/dist/services/organizations.js +6 -6
  97. package/dist/services/organizations.js.map +1 -1
  98. package/dist/services/plans.js +2 -2
  99. package/dist/services/plans.js.map +1 -1
  100. package/dist/services/projects.js +7 -7
  101. package/dist/services/projects.js.map +1 -1
  102. package/dist/services/schemas.js +2 -2
  103. package/dist/services/schemas.js.map +1 -1
  104. package/dist/services/telemetry.js +2 -2
  105. package/dist/services/telemetry.js.map +1 -1
  106. package/dist/services/tokens.js +5 -5
  107. package/dist/services/tokens.js.map +1 -1
  108. package/dist/services/user.js +1 -1
  109. package/dist/services/user.js.map +1 -1
  110. package/dist/services/userApplications.js +18 -18
  111. package/dist/services/userApplications.js.map +1 -1
  112. package/dist/util/appId.js +2 -1
  113. package/dist/util/appId.js.map +1 -1
  114. package/dist/util/dates.js +125 -0
  115. package/dist/util/dates.js.map +1 -0
  116. package/dist/util/getCliVersion.js +1 -11
  117. package/dist/util/getCliVersion.js.map +1 -1
  118. package/oclif.manifest.json +1093 -1093
  119. package/package.json +12 -15
@@ -1,54 +1,13 @@
1
- import { getStudioEnvironmentVariables } from "@sanity/cli-build/_internal/env";
2
- import { Interfaces } from "@oclif/core";
3
1
  import { Schema } from "@sanity/types";
4
- import { StudioEnvVariablesOptions } from "@sanity/cli-build/_internal/env";
5
-
6
- /** @internal */
7
- export declare interface CommandTelemetry {
8
- redactedFlags: readonly RedactedFlag[];
9
- }
10
-
11
- declare type CommandTelemetryConfig<Flags extends Interfaces.FlagInput> = {
12
- redact?: readonly OptionFlagName<Flags>[];
13
- };
14
-
15
- /** @internal */
16
- export declare function defineCommandTelemetry<
17
- const Flags extends Interfaces.FlagInput,
18
- >(flags: Flags, config: CommandTelemetryConfig<Flags>): CommandTelemetry;
19
-
20
- /**
21
- * Extracts all serializable properties from userland schema types,
22
- * so they best-effort can be used as definitions for Schema.compile.
23
- *
24
- * @internal
25
- */
26
- export declare function extractManifestSchemaTypes(
27
- schema: Schema,
28
- workDir: string,
29
- ): Promise<ManifestSchemaType[]>;
30
-
31
- export { getStudioEnvironmentVariables };
32
-
33
- declare type ManifestArrayMember = Omit<ManifestSchemaType, "name"> & {
34
- name?: string;
35
- };
36
-
37
- declare type ManifestField = ManifestSchemaType & {
38
- fieldset?: string;
39
- };
40
-
41
- declare interface ManifestFieldset {
42
- [index: string]: ManifestSerializable | undefined;
43
- name: string;
44
- title?: string;
45
- }
46
-
47
- declare type ManifestReferenceMember = Omit<ManifestSchemaType, "name"> & {
48
- name?: string;
2
+ import "sanity";
3
+ import "zod/mini";
4
+ import "@sanity/cli-core";
5
+ import { Interfaces } from "@oclif/core";
6
+ import { StudioEnvVariablesOptions, getStudioEnvironmentVariables } from "@sanity/cli-build/_internal/env";
7
+ type ManifestSerializable = boolean | ManifestSerializable[] | number | string | {
8
+ [k: string]: ManifestSerializable;
49
9
  };
50
-
51
- declare interface ManifestSchemaType {
10
+ interface ManifestSchemaType {
52
11
  name: string;
53
12
  type: string;
54
13
  deprecated?: {
@@ -56,7 +15,7 @@ declare interface ManifestSchemaType {
56
15
  };
57
16
  fields?: ManifestField[];
58
17
  fieldsets?: ManifestFieldset[];
59
- hidden?: "conditional" | boolean;
18
+ hidden?: 'conditional' | boolean;
60
19
  lists?: ManifestTitledValue[];
61
20
  marks?: {
62
21
  annotations?: ManifestArrayMember[];
@@ -67,53 +26,62 @@ declare interface ManifestSchemaType {
67
26
  preview?: {
68
27
  select: Record<string, string>;
69
28
  };
70
- readOnly?: "conditional" | boolean;
29
+ readOnly?: 'conditional' | boolean;
71
30
  styles?: ManifestTitledValue[];
72
31
  title?: string;
73
32
  to?: ManifestReferenceMember[];
74
33
  validation?: ManifestValidationGroup[];
75
34
  }
76
-
77
- declare type ManifestSerializable =
78
- | boolean
79
- | ManifestSerializable[]
80
- | number
81
- | string
82
- | {
83
- [k: string]: ManifestSerializable;
84
- };
85
-
86
- declare interface ManifestTitledValue {
35
+ interface ManifestFieldset {
36
+ [index: string]: ManifestSerializable | undefined;
37
+ name: string;
38
+ title?: string;
39
+ }
40
+ interface ManifestTitledValue {
87
41
  value: string;
88
42
  title?: string;
89
43
  }
90
-
91
- declare interface ManifestValidationGroup {
44
+ type ManifestArrayMember = Omit<ManifestSchemaType, 'name'> & {
45
+ name?: string;
46
+ };
47
+ type ManifestReferenceMember = Omit<ManifestSchemaType, 'name'> & {
48
+ name?: string;
49
+ };
50
+ type ManifestField = ManifestSchemaType & {
51
+ fieldset?: string;
52
+ };
53
+ interface ManifestValidationGroup {
92
54
  rules: ManifestValidationRule[];
93
- level?: "error" | "info" | "warning";
55
+ level?: 'error' | 'info' | 'warning';
94
56
  message?: string;
95
57
  }
96
-
97
- declare type ManifestValidationRule = {
58
+ type ManifestValidationRule = {
98
59
  [index: string]: ManifestSerializable | undefined;
99
60
  constraint?: ManifestSerializable;
100
61
  flag: string;
101
62
  };
102
-
103
- declare type OptionFlagName<Flags extends Interfaces.FlagInput> = string &
104
- {
105
- [Name in keyof Flags]: Flags[Name] extends {
106
- type: "option";
107
- }
108
- ? Name
109
- : never;
110
- }[keyof Flags];
111
-
112
- declare interface RedactedFlag {
63
+ /**
64
+ * Extracts all serializable properties from userland schema types,
65
+ * so they best-effort can be used as definitions for Schema.compile.
66
+ *
67
+ * @internal
68
+ */
69
+ declare function extractManifestSchemaTypes(schema: Schema, workDir: string): Promise<ManifestSchemaType[]>;
70
+ interface RedactedFlag {
113
71
  canonical: string;
114
72
  flags: readonly string[];
115
73
  }
116
-
117
- export { StudioEnvVariablesOptions };
118
-
119
- export {};
74
+ /** @internal */
75
+ interface CommandTelemetry {
76
+ redactedFlags: readonly RedactedFlag[];
77
+ }
78
+ type OptionFlagName<Flags extends Interfaces.FlagInput> = string & { [Name in keyof Flags]: Flags[Name] extends {
79
+ type: 'option';
80
+ } ? Name : never; }[keyof Flags];
81
+ type CommandTelemetryConfig<Flags extends Interfaces.FlagInput> = {
82
+ redact?: readonly OptionFlagName<Flags>[];
83
+ };
84
+ /** @internal */
85
+ declare function defineCommandTelemetry<const Flags extends Interfaces.FlagInput>(flags: Flags, config: CommandTelemetryConfig<Flags>): CommandTelemetry;
86
+ export { type CommandTelemetry, type StudioEnvVariablesOptions, defineCommandTelemetry, extractManifestSchemaTypes, getStudioEnvironmentVariables };
87
+ //# sourceMappingURL=_internal.d.ts.map
@@ -1,72 +1,12 @@
1
- import { CliConfig } from "@sanity/cli-core";
2
- import { ClientConfig } from "@sanity/client";
3
- import { DefineAppInput } from "@sanity/workbench-cli";
4
- import { DefineMediaLibraryInput } from "@sanity/workbench-cli";
1
+ import "@sanity/types";
2
+ import { CliConfig, CliConfig as CliConfig$1, UserViteConfig } from "@sanity/cli-core";
3
+ import { ClientConfig, SanityClient } from "@sanity/client";
5
4
  import { loadEnv } from "vite";
6
- import { MediaLibraryField } from "@sanity/workbench-cli";
7
- import { SanityClient } from "@sanity/client";
8
- import { unstable_defineApp } from "@sanity/workbench-cli";
9
- import { unstable_defineMediaLibrary } from "@sanity/workbench-cli";
10
- import { UserViteConfig } from "@sanity/cli-core";
11
-
5
+ import { DefineAppInput, DefineMediaLibraryInput, MediaLibraryField, unstable_defineApp, unstable_defineMediaLibrary } from "@sanity/workbench-cli";
12
6
  /**
13
7
  * @public
14
8
  */
15
- export declare interface CliApiConfig {
16
- dataset?: string;
17
- projectId?: string;
18
- }
19
-
20
- declare type CliClientGetter = ((
21
- options?: CliClientOptions,
22
- ) => SanityClient) & {
23
- /**
24
- * @deprecated This is only for INTERNAL use, and should not be relied upon outside of official Sanity modules
25
- * @returns A token to use when constructing a client without a `token` explicitly defined, or undefined
26
- * @internal
27
- */
28
- __internal__getToken: () => string | undefined;
29
- };
30
-
31
- /**
32
- * @public
33
- */
34
- export declare interface CliClientOptions extends ClientConfig {
35
- /**
36
- * If no `projectId` or `dataset` is provided, `getCliClient` will try to
37
- * resolve these from the `sanity.cli.ts` configuration file. Use this option
38
- * to specify the directory to look for this file.
39
- */
40
- cwd?: string;
41
- }
42
-
43
- export { CliConfig };
44
-
45
- /**
46
- * @deprecated Use `defineCliConfig` instead
47
- * @public
48
- */
49
- export declare function createCliConfig(config: CliConfig): CliConfig;
50
-
51
- export { DefineAppInput };
52
-
53
- /** @beta */
54
- export declare function defineCliConfig(config: CliConfig): CliConfig;
55
-
56
- export { DefineMediaLibraryInput };
57
-
58
- /**
59
- * @public
60
- *
61
- * @param options - The options to use for the client.
62
- * @returns A configured Sanity API client.
63
- */
64
- export declare const getCliClient: CliClientGetter;
65
-
66
- /**
67
- * @public
68
- */
69
- export declare interface GraphQLAPIConfig {
9
+ interface GraphQLAPIConfig {
70
10
  /**
71
11
  * Suffix to use for generated filter types.
72
12
  *
@@ -79,7 +19,7 @@ export declare interface GraphQLAPIConfig {
79
19
  *
80
20
  * Optional, defaults to `gen3` (which is the only option, currently)
81
21
  */
82
- generation?: "gen1" | "gen2" | "gen3";
22
+ generation?: 'gen1' | 'gen2' | 'gen3';
83
23
  /**
84
24
  * ID of GraphQL API. Only (currently) required when using the `--api` flag
85
25
  * for `sanity graphql deploy`, in order to only deploy a specific API.
@@ -114,15 +54,45 @@ export declare interface GraphQLAPIConfig {
114
54
  */
115
55
  workspace?: string;
116
56
  }
117
-
118
- export { loadEnv };
119
-
120
- export { MediaLibraryField };
121
-
122
- export { unstable_defineApp };
123
-
124
- export { unstable_defineMediaLibrary };
125
-
126
- export { UserViteConfig };
127
-
128
- export {};
57
+ /**
58
+ * @deprecated Use `defineCliConfig` instead
59
+ * @public
60
+ */
61
+ declare function createCliConfig(config: CliConfig$1): CliConfig$1;
62
+ /** @beta */
63
+ declare function defineCliConfig(config: CliConfig$1): CliConfig$1;
64
+ /**
65
+ * @public
66
+ */
67
+ interface CliApiConfig {
68
+ dataset?: string;
69
+ projectId?: string;
70
+ }
71
+ /**
72
+ * @public
73
+ */
74
+ interface CliClientOptions extends ClientConfig {
75
+ /**
76
+ * If no `projectId` or `dataset` is provided, `getCliClient` will try to
77
+ * resolve these from the `sanity.cli.ts` configuration file. Use this option
78
+ * to specify the directory to look for this file.
79
+ */
80
+ cwd?: string;
81
+ }
82
+ /**
83
+ * @public
84
+ *
85
+ * @param options - The options to use for the client.
86
+ * @returns A configured Sanity API client.
87
+ */
88
+ declare const getCliClient: CliClientGetter;
89
+ type CliClientGetter = ((options?: CliClientOptions) => SanityClient) & {
90
+ /**
91
+ * @deprecated This is only for INTERNAL use, and should not be relied upon outside of official Sanity modules
92
+ * @returns A token to use when constructing a client without a `token` explicitly defined, or undefined
93
+ * @internal
94
+ */
95
+ __internal__getToken: () => string | undefined;
96
+ };
97
+ export { type CliApiConfig, type CliClientOptions, type CliConfig, type DefineAppInput, type DefineMediaLibraryInput, type GraphQLAPIConfig, type MediaLibraryField, type UserViteConfig, createCliConfig, defineCliConfig, getCliClient, loadEnv, unstable_defineApp, unstable_defineMediaLibrary };
98
+ //# sourceMappingURL=index.d.ts.map
@@ -1,26 +1,100 @@
1
1
  import { Config } from "@oclif/core";
2
2
  import { SanityEnvironment } from "@sanity/cli-core/executionContext";
3
-
4
- /** Where an invocation originates; selects the policy to enforce. */
5
- declare type InvocationSource = "mcp";
6
-
7
3
  /**
8
- * Run a policy-permitted CLI command in-process and capture its result.
4
+ * Valid body types for fetch requests.
9
5
  *
10
- * Command-level failures (unknown command, bad flags, API errors) are
11
- * reported through `exitCode`/`output` rather than thrown, so callers can
12
- * relay them verbatim.
6
+ * Includes `Uint8Array` since the standard `fetch` accepts typed-array
7
+ * request bodies. It is pinned to `Uint8Array<ArrayBuffer>` (rather than the
8
+ * abstract `ArrayBufferView` or the default `Uint8Array<ArrayBufferLike>`) to
9
+ * stay assignable to the platform `BodyInit` across the DOM and Node lib
10
+ * definitions, which keeps `FetchFunction` compatible with the runtime
11
+ * `fetch`. Widening further breaks that compatibility.
13
12
  *
14
- * @internal
13
+ * @public
15
14
  */
16
- export declare function invokeSanityCli(
17
- options: InvokeSanityCliOptions,
18
- ): Promise<InvokeSanityCliResult>;
19
-
15
+ type FetchBody = string | ArrayBuffer | Uint8Array<ArrayBuffer> | Blob | FormData | URLSearchParams | ReadableStream;
16
+ /**
17
+ * Accepted header formats — tuple pairs, a plain record, or a `Headers` instance.
18
+ *
19
+ * @public
20
+ */
21
+ type FetchHeaders = [string, string][] | Record<string, string> | Headers;
22
+ /**
23
+ * Init options passed to a {@link FetchFunction}.
24
+ *
25
+ * This is a minimal subset of the standard `RequestInit` so the library
26
+ * doesn't depend on the full DOM lib.
27
+ *
28
+ * @public
29
+ */
30
+ interface FetchInit {
31
+ /** HTTP method (GET, POST, PUT, etc.). */
32
+ method?: string;
33
+ /** Request headers. */
34
+ headers?: FetchHeaders;
35
+ /** Request body. */
36
+ body?: FetchBody | null;
37
+ /** Abort signal for cancellation. */
38
+ signal?: AbortSignal;
39
+ /**
40
+ * Redirect handling strategy.
41
+ *
42
+ * ⚠️ In browsers, `'manual'` yields an opaque-redirect response (status `0`,
43
+ * empty headers) per the Fetch spec — you cannot read the status or headers
44
+ * (e.g. `location`) of the 3xx response. Reading them throws nothing and warns
45
+ * nothing: `headers.get()` returns `null` and iteration is empty. Detect it via
46
+ * `status === 0`. Non-browser runtimes (Node.js, Bun, Deno, edge runtimes,
47
+ * workers) return the real 3xx response, so its status and headers are readable.
48
+ */
49
+ redirect?: 'error' | 'follow' | 'manual';
50
+ /** Credentials mode (browser-only — some runtimes crash if set). */
51
+ credentials?: 'include' | 'omit' | 'same-origin';
52
+ }
53
+ /**
54
+ * Response object returned by a {@link FetchFunction}.
55
+ *
56
+ * A minimal subset of the standard `Response` — just the properties
57
+ * get-it actually reads.
58
+ *
59
+ * @public
60
+ */
61
+ interface FetchResponse {
62
+ /** Whether the response status is in the 200–299 range. */
63
+ ok: boolean;
64
+ /** HTTP status code. */
65
+ status: number;
66
+ /** HTTP status text (e.g. "OK", "Not Found"). */
67
+ statusText: string;
68
+ /** Response headers. */
69
+ headers: Headers;
70
+ /** The final URL after any redirects. */
71
+ url: string;
72
+ /** Whether the response was the result of a redirect. */
73
+ redirected: boolean;
74
+ /** Readable stream of the response body, or `null` if empty. */
75
+ body: ReadableStream<Uint8Array> | null;
76
+ /** Reads the entire body as a string. */
77
+ text(): Promise<string>;
78
+ /** Reads the entire body as an ArrayBuffer. */
79
+ arrayBuffer(): Promise<ArrayBuffer>;
80
+ }
81
+ /**
82
+ * A function that performs an HTTP fetch. Must conform to the standard
83
+ * `fetch()` signature but only needs to return a `FetchResponse`.
84
+ *
85
+ * @param input - The URL to fetch.
86
+ * @param init - Optional request init options.
87
+ * @returns A promise resolving to the response.
88
+ *
89
+ * @public
90
+ */
91
+ type FetchFunction = (input: string, init?: FetchInit) => Promise<FetchResponse>;
92
+ /** Where an invocation originates; selects the policy to enforce. */
93
+ type InvocationSource = 'mcp';
20
94
  /**
21
95
  * @internal
22
96
  */
23
- export declare interface InvokeSanityCliOptions {
97
+ interface InvokeSanityCliOptions {
24
98
  /**
25
99
  * Arguments after `sanity` (a leading `sanity` token is tolerated), either
26
100
  * as a single string — shell-style quoting is supported, but no shell is
@@ -43,6 +117,13 @@ export declare interface InvokeSanityCliOptions {
43
117
  * package's config, loaded once and cached across invocations.
44
118
  */
45
119
  config?: Config;
120
+ /**
121
+ * Optional fetch implementation for API requests made by this invocation.
122
+ * Scoped to this call via the CLI execution context; defaults to the CLI's
123
+ * own transport. The execution context's transport hygiene (such as
124
+ * stripping the embedding process's lineage header) is applied on top.
125
+ */
126
+ fetch?: FetchFunction;
46
127
  /**
47
128
  * Sanity deployment environment for this invocation. Scoped to this call
48
129
  * via the CLI execution context and defaults to production. The embedding
@@ -50,11 +131,10 @@ export declare interface InvokeSanityCliOptions {
50
131
  */
51
132
  sanityEnv?: SanityEnvironment;
52
133
  }
53
-
54
134
  /**
55
135
  * @internal
56
136
  */
57
- export declare interface InvokeSanityCliResult {
137
+ interface InvokeSanityCliResult {
58
138
  /** `0` on success, the command's exit code otherwise. */
59
139
  exitCode: number;
60
140
  /** Combined stdout and stderr output, in emission order. */
@@ -65,5 +145,15 @@ export declare interface InvokeSanityCliResult {
65
145
  */
66
146
  commandId?: string;
67
147
  }
68
-
69
- export {};
148
+ /**
149
+ * Run a policy-permitted CLI command in-process and capture its result.
150
+ *
151
+ * Command-level failures (unknown command, bad flags, API errors) are
152
+ * reported through `exitCode`/`output` rather than thrown, so callers can
153
+ * relay them verbatim.
154
+ *
155
+ * @internal
156
+ */
157
+ declare function invokeSanityCli(options: InvokeSanityCliOptions): Promise<InvokeSanityCliResult>;
158
+ export { InvokeSanityCliOptions, InvokeSanityCliResult, invokeSanityCli };
159
+ //# sourceMappingURL=index.d.ts.map
@@ -93,11 +93,12 @@ function unknownCommandResult(argv, policySet) {
93
93
  const resolvedConfig = options.config ?? await (cachedConfig ??= loadCliCommandConfig());
94
94
  const output = [];
95
95
  const sink = (line)=>output.push(line);
96
- const { sanityEnv, token } = options;
96
+ const { fetch, sanityEnv, token } = options;
97
97
  // Establish the isolation boundary before rendering help, loading command
98
98
  // modules, parsing, or executing. Any code reached by an external
99
99
  // invocation can therefore fail closed on context.
100
100
  return runWithCliExecutionContext({
101
+ fetch,
101
102
  sanityEnv,
102
103
  stderr: sink,
103
104
  stdout: sink,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/exports/invokeSanityCli/index.ts"],"sourcesContent":["/**\n * Programmatic (in-process) invocation of CLI commands, e.g. from an MCP\n * server. The invokable surface is governed by a per-source command policy\n * (see ./commandPolicies): every CLI command is explicitly allowed, denied,\n * or allowed conditionally on the parsed invocation.\n *\n * {@link invokeSanityCli} handles arg parsing, policy enforcement, command\n * dispatch, per-invocation auth, and output capture.\n * ```ts\n * import {invokeSanityCli} from '@sanity/cli/invokeSanityCli'\n *\n * const {exitCode, output} = await invokeSanityCli({\n * args: 'cors list --project-id abc123',\n * source: 'mcp',\n * token: extra.authInfo.token,\n * })\n * ```\n *\n * Help works like the regular CLI, scoped to the source's policy: `--help`\n * (or `help`) renders root help listing the invokable topics, and a subject\n * (`cors --help`, `cors list --help`) renders topic or command help.\n */\nimport {Command, Config, Parser, settings} from '@oclif/core'\nimport {getHelpFlagAdditions, normalizeArgv} from '@oclif/core/help'\nimport {exitCodes} from '@sanity/cli-core'\nimport {runWithCliExecutionContext, type SanityEnvironment} from '@sanity/cli-core/executionContext'\nimport {type SanityCommand} from '@sanity/cli-core/SanityCommand'\nimport {parseArgsStringToArgv} from 'string-argv'\n\nimport {resolveTopicAliasInArgv} from '../../topicAliases.js'\nimport {commandPolicies} from './commandPolicies/index.js'\nimport {\n type CommandPolicySet,\n deny,\n type InvocationSource,\n isConditionalInvocationPolicy,\n} from './commandPolicies/policy.js'\nimport {isHelpRequest, renderInvokableHelp} from './help.js'\nimport {prettyPrintError} from './prettyPrintError.js'\n\ntype InvokableCommand = Pick<SanityCommand<typeof Command>, 'runInExecutionContext'>\n\n/**\n * Instantiate a policy-approved command for isolated execution.\n *\n * Every invokable command extends `SanityCommand`, whose\n * `runInExecutionContext()` runs the instance without oclif's static\n * `Command.run()` — the static runner re-enters `Config.load()` (filesystem\n * reads and a process-global config cache write) on every call. The manifest\n * types command classes as the abstract oclif `Command`, hence the\n * constructor cast. The method is probed rather than checked with\n * `instanceof`, because command modules may load from the compiled build\n * while this module runs from source, giving `SanityCommand` two identities.\n */\nfunction instantiateCommand(\n CommandClass: Command.Class,\n argv: string[],\n config: Config,\n): InvokableCommand {\n const ConcreteCommand = CommandClass as unknown as new (argv: string[], config: Config) => Command\n const command = new ConcreteCommand(argv, config) as Command & Partial<InvokableCommand>\n if (typeof command.runInExecutionContext !== 'function') {\n throw new TypeError(`Command \"${CommandClass.id}\" does not support isolated execution`)\n }\n return command as InvokableCommand\n}\n\n/**\n * Load the oclif `Config` for this package, needed to resolve, load, and run\n * commands. Loading it once and reusing it across invocations avoids\n * re-reading the command manifest per call. It only reads this package's own\n * installed files — process-lifetime initialization, not per-invocation host\n * state — so it happens outside any execution context.\n */\nfunction loadCliCommandConfig(): Promise<Config> {\n return Config.load(import.meta.url)\n}\n\nlet cachedConfig: Promise<Config> | undefined\n\nfunction unknownCommandResult(argv: string[], policySet: CommandPolicySet): InvokeSanityCliResult {\n const available = Object.entries(policySet)\n .filter(([, policy]) => policy.kind !== 'deny')\n .map(([id]) => id.replaceAll(':', ' '))\n .toSorted()\n return {\n exitCode: exitCodes.USAGE_ERROR,\n output: [\n `Unknown or unsupported command: ${argv.slice(0, 2).join(' ') || '(none)'}`,\n `Available commands: ${available.join(', ')}`,\n ].join('\\n'),\n }\n}\n\n/**\n * @internal\n */\nexport interface InvokeSanityCliOptions {\n /**\n * Arguments after `sanity` (a leading `sanity` token is tolerated), either\n * as a single string — shell-style quoting is supported, but no shell is\n * ever executed — or as a pre-split argv array.\n */\n args: string | string[]\n\n /**\n * Where this invocation originates. Selects the command policy to enforce:\n * which commands are invokable and which invocations of them are permitted.\n */\n source: InvocationSource\n\n /**\n * Auth token for this invocation. Scoped to this call via the CLI execution\n * context: it never touches process env or the process-wide token cache, so\n * concurrent invocations with different tokens are fully isolated.\n */\n token: string\n\n /**\n * Optional oclif config override (mainly for tests). Defaults to this\n * package's config, loaded once and cached across invocations.\n */\n config?: Config\n\n /**\n * Sanity deployment environment for this invocation. Scoped to this call\n * via the CLI execution context and defaults to production. The embedding\n * process's `SANITY_INTERNAL_ENV` is never consulted.\n */\n sanityEnv?: SanityEnvironment\n}\n\n/**\n * @internal\n */\nexport interface InvokeSanityCliResult {\n /** `0` on success, the command's exit code otherwise. */\n exitCode: number\n\n /** Combined stdout and stderr output, in emission order. */\n output: string\n\n /**\n * Canonical oclif command id when the invocation resolved to a command\n * exposed by the selected policy (for example, `datasets:create`).\n */\n commandId?: string\n}\n\n/**\n * Unlike a shell, string-argv keeps quotes that are glued to unquoted text:\n * `--name=\"my project\"` tokenizes with the quotes intact. Strip a matching\n * wrapping quote pair from the value side of `--flag=`-shaped tokens so the\n * common shell-style form yields the value the caller intended.\n */\nfunction stripFlagQuotes(rawToken: string): string {\n const match = /^(-{1,2}[^\\s=]+=)(['\"])([\\s\\S]*)\\2$/.exec(rawToken)\n return match ? match[1] + match[3] : rawToken\n}\n\n/**\n * Run a policy-permitted CLI command in-process and capture its result.\n *\n * Command-level failures (unknown command, bad flags, API errors) are\n * reported through `exitCode`/`output` rather than thrown, so callers can\n * relay them verbatim.\n *\n * @internal\n */\nexport async function invokeSanityCli(\n options: InvokeSanityCliOptions,\n): Promise<InvokeSanityCliResult> {\n // Always load compiled command modules. Oclif's dev-mode source resolution\n // otherwise probes tsconfigs (reading the filesystem and process.cwd) on\n // every command load, and may register ts-node process-wide.\n settings.enableAutoTranspile = false\n\n const resolvedConfig = options.config ?? (await (cachedConfig ??= loadCliCommandConfig()))\n const output: string[] = []\n const sink = (line: string) => output.push(line)\n const {sanityEnv, token} = options\n\n // Establish the isolation boundary before rendering help, loading command\n // modules, parsing, or executing. Any code reached by an external\n // invocation can therefore fail closed on context.\n return runWithCliExecutionContext({sanityEnv, stderr: sink, stdout: sink, token}, () =>\n invokeSanityCliInContext(options, resolvedConfig, output),\n )\n}\n\nasync function invokeSanityCliInContext(\n {args, source}: InvokeSanityCliOptions,\n resolvedConfig: Config,\n output: string[],\n): Promise<InvokeSanityCliResult> {\n const policySet = commandPolicies[source]\n\n // Pre-split argv arrays are taken verbatim; only string input goes through\n // shell-style tokenization and quote normalization.\n let argv =\n typeof args === 'string'\n ? parseArgsStringToArgv(args).map((t) => stripFlagQuotes(t))\n : [...args]\n if (argv[0] === 'sanity') argv = argv.slice(1)\n argv = resolveTopicAliasInArgv(argv)\n\n // Help requests are routed through oclif's help system, scoped to the\n // source's policy: root help for a bare request, topic/command help when a\n // subject is given. Denied subjects get the standard unknown-command\n // response (identical to a truly unknown command, so hosts can't probe the\n // full CLI surface through help), and a help request never executes a\n // command.\n if (isHelpRequest(argv, resolvedConfig)) {\n try {\n // Drop a leading `help` so the rest is the subject, mirroring how\n // oclif's dispatch consumes the token before the help command sees argv\n const helpArgv = argv[0] === 'help' ? argv.slice(1) : argv\n const result = await renderInvokableHelp(resolvedConfig, helpArgv, policySet)\n if (result) return {...result, exitCode: exitCodes.SUCCESS}\n const helpFlags = getHelpFlagAdditions(resolvedConfig)\n return unknownCommandResult(\n helpArgv.filter((token) => !helpFlags.includes(token)),\n policySet,\n )\n } catch (err) {\n return {\n exitCode: exitCodes.RUNTIME_ERROR,\n output: err instanceof Error ? err.message : String(err),\n }\n }\n }\n\n // Resolve the command id the same way oclif's dispatch would (collating\n // space-separated topics, accepting colon-separated ids as-is), then apply\n // the policy. Denied and uncategorized ids fail closed, indistinguishable\n // from commands that don't exist.\n const [commandId = '', ...commandArgv] = normalizeArgv(resolvedConfig, argv)\n const policy = policySet[commandId] ?? deny\n const commandDefinition =\n policy.kind === 'deny' ? undefined : resolvedConfig.findCommand(commandId)\n if (!commandDefinition) return unknownCommandResult(argv, policySet)\n\n const CommandClass = await commandDefinition.load()\n\n // Parse with the command's real definitions (without executing anything) so\n // conditional policies are evaluated against typed args/flags, not tokens.\n let invocation: {args: Record<string, unknown>; flags: Record<string, unknown>}\n try {\n const parsed = await Parser.parse(commandArgv, {\n args: CommandClass.args,\n baseFlags: CommandClass.baseFlags,\n enableJsonFlag: CommandClass.enableJsonFlag,\n flags: CommandClass.flags,\n strict: CommandClass.strict,\n })\n invocation = {\n args: parsed.args as Record<string, unknown>,\n flags: parsed.flags as Record<string, unknown>,\n }\n } catch (err) {\n return {\n commandId,\n exitCode: exitCodes.USAGE_ERROR,\n output: err instanceof Error ? err.message : String(err),\n }\n }\n\n if (!policy.validate(invocation)) {\n const displayId = commandId.replaceAll(':', ' ')\n let output = `This invocation of \\`${displayId}\\` is not supported here`\n\n if (isConditionalInvocationPolicy(policy)) {\n const usedDeniedFlags = policy.deniedFlags.filter(\n (name) => invocation.flags[name] !== undefined && invocation.flags[name] !== false,\n )\n if (usedDeniedFlags.length > 0) {\n output = `\\nThe ${usedDeniedFlags.map((name) => `--${name}`).join(', ')} flag is not supported here for \\`${displayId}\\``\n }\n }\n\n return {\n commandId,\n exitCode: exitCodes.USAGE_ERROR,\n output,\n }\n }\n\n try {\n const command = instantiateCommand(CommandClass, commandArgv, resolvedConfig)\n await command.runInExecutionContext()\n return {commandId, exitCode: exitCodes.SUCCESS, output: output.join('\\n')}\n } catch (err) {\n const exit = err.oclif?.exit\n\n // `this.exit(0)` throws an ExitError but is a successful outcome\n if (exit === exitCodes.SUCCESS) {\n return {commandId, exitCode: exitCodes.SUCCESS, output: output.join('\\n')}\n }\n\n const message = prettyPrintError(err) || String(err)\n if (message) output.push(message)\n return {\n commandId,\n exitCode: typeof exit === 'number' ? exit : exitCodes.RUNTIME_ERROR,\n output: output.join('\\n'),\n }\n }\n}\n"],"names":["Config","Parser","settings","getHelpFlagAdditions","normalizeArgv","exitCodes","runWithCliExecutionContext","parseArgsStringToArgv","resolveTopicAliasInArgv","commandPolicies","deny","isConditionalInvocationPolicy","isHelpRequest","renderInvokableHelp","prettyPrintError","instantiateCommand","CommandClass","argv","config","ConcreteCommand","command","runInExecutionContext","TypeError","id","loadCliCommandConfig","load","url","cachedConfig","unknownCommandResult","policySet","available","Object","entries","filter","policy","kind","map","replaceAll","toSorted","exitCode","USAGE_ERROR","output","slice","join","stripFlagQuotes","rawToken","match","exec","invokeSanityCli","options","enableAutoTranspile","resolvedConfig","sink","line","push","sanityEnv","token","stderr","stdout","invokeSanityCliInContext","args","source","t","helpArgv","result","SUCCESS","helpFlags","includes","err","RUNTIME_ERROR","Error","message","String","commandId","commandArgv","commandDefinition","undefined","findCommand","invocation","parsed","parse","baseFlags","enableJsonFlag","flags","strict","validate","displayId","usedDeniedFlags","deniedFlags","name","length","exit","oclif"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,SAAiBA,MAAM,EAAEC,MAAM,EAAEC,QAAQ,QAAO,cAAa;AAC7D,SAAQC,oBAAoB,EAAEC,aAAa,QAAO,mBAAkB;AACpE,SAAQC,SAAS,QAAO,mBAAkB;AAC1C,SAAQC,0BAA0B,QAA+B,oCAAmC;AAEpG,SAAQC,qBAAqB,QAAO,cAAa;AAEjD,SAAQC,uBAAuB,QAAO,wBAAuB;AAC7D,SAAQC,eAAe,QAAO,6BAA4B;AAC1D,SAEEC,IAAI,EAEJC,6BAA6B,QACxB,8BAA6B;AACpC,SAAQC,aAAa,EAAEC,mBAAmB,QAAO,YAAW;AAC5D,SAAQC,gBAAgB,QAAO,wBAAuB;AAItD;;;;;;;;;;;CAWC,GACD,SAASC,mBACPC,YAA2B,EAC3BC,IAAc,EACdC,MAAc;IAEd,MAAMC,kBAAkBH;IACxB,MAAMI,UAAU,IAAID,gBAAgBF,MAAMC;IAC1C,IAAI,OAAOE,QAAQC,qBAAqB,KAAK,YAAY;QACvD,MAAM,IAAIC,UAAU,CAAC,SAAS,EAAEN,aAAaO,EAAE,CAAC,qCAAqC,CAAC;IACxF;IACA,OAAOH;AACT;AAEA;;;;;;CAMC,GACD,SA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;YAC/BC;QACF;IACF;IAEA,IAAI;QACF,MAAMrB,UAAUL,mBAAmBC,cAAc0D,aAAavB;QAC9D,MAAM/B,QAAQC,qBAAqB;QACnC,OAAO;YAACoD;YAAWlC,UAAUlC,UAAU4D,OAAO;YAAExB,QAAQA,OAAOE,IAAI,CAAC;QAAK;IAC3E,EAAE,OAAOyB,KAAK;QACZ,MAAMuB,OAAOvB,IAAIwB,KAAK,EAAED;QAExB,iEAAiE;QACjE,IAAIA,SAAStF,UAAU4D,OAAO,EAAE;YAC9B,OAAO;gBAACQ;gBAAWlC,UAAUlC,UAAU4D,OAAO;gBAAExB,QAAQA,OAAOE,IAAI,CAAC;YAAK;QAC3E;QAEA,MAAM4B,UAAUzD,iBAAiBsD,QAAQI,OAAOJ;QAChD,IAAIG,SAAS9B,OAAOa,IAAI,CAACiB;QACzB,OAAO;YACLE;YACAlC,UAAU,OAAOoD,SAAS,WAAWA,OAAOtF,UAAUgE,aAAa;YACnE5B,QAAQA,OAAOE,IAAI,CAAC;QACtB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/exports/invokeSanityCli/index.ts"],"sourcesContent":["/**\n * Programmatic (in-process) invocation of CLI commands, e.g. from an MCP\n * server. The invokable surface is governed by a per-source command policy\n * (see ./commandPolicies): every CLI command is explicitly allowed, denied,\n * or allowed conditionally on the parsed invocation.\n *\n * {@link invokeSanityCli} handles arg parsing, policy enforcement, command\n * dispatch, per-invocation auth, and output capture.\n * ```ts\n * import {invokeSanityCli} from '@sanity/cli/invokeSanityCli'\n *\n * const {exitCode, output} = await invokeSanityCli({\n * args: 'cors list --project-id abc123',\n * source: 'mcp',\n * token: extra.authInfo.token,\n * })\n * ```\n *\n * Help works like the regular CLI, scoped to the source's policy: `--help`\n * (or `help`) renders root help listing the invokable topics, and a subject\n * (`cors --help`, `cors list --help`) renders topic or command help.\n */\nimport {Command, Config, Parser, settings} from '@oclif/core'\nimport {getHelpFlagAdditions, normalizeArgv} from '@oclif/core/help'\nimport {exitCodes} from '@sanity/cli-core'\nimport {runWithCliExecutionContext, type SanityEnvironment} from '@sanity/cli-core/executionContext'\nimport {type SanityCommand} from '@sanity/cli-core/SanityCommand'\nimport {type FetchFunction} from 'get-it'\nimport {parseArgsStringToArgv} from 'string-argv'\n\nimport {resolveTopicAliasInArgv} from '../../topicAliases.js'\nimport {commandPolicies} from './commandPolicies/index.js'\nimport {\n type CommandPolicySet,\n deny,\n type InvocationSource,\n isConditionalInvocationPolicy,\n} from './commandPolicies/policy.js'\nimport {isHelpRequest, renderInvokableHelp} from './help.js'\nimport {prettyPrintError} from './prettyPrintError.js'\n\ntype InvokableCommand = Pick<SanityCommand<typeof Command>, 'runInExecutionContext'>\n\n/**\n * Instantiate a policy-approved command for isolated execution.\n *\n * Every invokable command extends `SanityCommand`, whose\n * `runInExecutionContext()` runs the instance without oclif's static\n * `Command.run()` — the static runner re-enters `Config.load()` (filesystem\n * reads and a process-global config cache write) on every call. The manifest\n * types command classes as the abstract oclif `Command`, hence the\n * constructor cast. The method is probed rather than checked with\n * `instanceof`, because command modules may load from the compiled build\n * while this module runs from source, giving `SanityCommand` two identities.\n */\nfunction instantiateCommand(\n CommandClass: Command.Class,\n argv: string[],\n config: Config,\n): InvokableCommand {\n const ConcreteCommand = CommandClass as unknown as new (argv: string[], config: Config) => Command\n const command = new ConcreteCommand(argv, config) as Command & Partial<InvokableCommand>\n if (typeof command.runInExecutionContext !== 'function') {\n throw new TypeError(`Command \"${CommandClass.id}\" does not support isolated execution`)\n }\n return command as InvokableCommand\n}\n\n/**\n * Load the oclif `Config` for this package, needed to resolve, load, and run\n * commands. Loading it once and reusing it across invocations avoids\n * re-reading the command manifest per call. It only reads this package's own\n * installed files — process-lifetime initialization, not per-invocation host\n * state — so it happens outside any execution context.\n */\nfunction loadCliCommandConfig(): Promise<Config> {\n return Config.load(import.meta.url)\n}\n\nlet cachedConfig: Promise<Config> | undefined\n\nfunction unknownCommandResult(argv: string[], policySet: CommandPolicySet): InvokeSanityCliResult {\n const available = Object.entries(policySet)\n .filter(([, policy]) => policy.kind !== 'deny')\n .map(([id]) => id.replaceAll(':', ' '))\n .toSorted()\n return {\n exitCode: exitCodes.USAGE_ERROR,\n output: [\n `Unknown or unsupported command: ${argv.slice(0, 2).join(' ') || '(none)'}`,\n `Available commands: ${available.join(', ')}`,\n ].join('\\n'),\n }\n}\n\n/**\n * @internal\n */\nexport interface InvokeSanityCliOptions {\n /**\n * Arguments after `sanity` (a leading `sanity` token is tolerated), either\n * as a single string — shell-style quoting is supported, but no shell is\n * ever executed — or as a pre-split argv array.\n */\n args: string | string[]\n\n /**\n * Where this invocation originates. Selects the command policy to enforce:\n * which commands are invokable and which invocations of them are permitted.\n */\n source: InvocationSource\n\n /**\n * Auth token for this invocation. Scoped to this call via the CLI execution\n * context: it never touches process env or the process-wide token cache, so\n * concurrent invocations with different tokens are fully isolated.\n */\n token: string\n\n /**\n * Optional oclif config override (mainly for tests). Defaults to this\n * package's config, loaded once and cached across invocations.\n */\n config?: Config\n\n /**\n * Optional fetch implementation for API requests made by this invocation.\n * Scoped to this call via the CLI execution context; defaults to the CLI's\n * own transport. The execution context's transport hygiene (such as\n * stripping the embedding process's lineage header) is applied on top.\n */\n fetch?: FetchFunction\n\n /**\n * Sanity deployment environment for this invocation. Scoped to this call\n * via the CLI execution context and defaults to production. The embedding\n * process's `SANITY_INTERNAL_ENV` is never consulted.\n */\n sanityEnv?: SanityEnvironment\n}\n\n/**\n * @internal\n */\nexport interface InvokeSanityCliResult {\n /** `0` on success, the command's exit code otherwise. */\n exitCode: number\n\n /** Combined stdout and stderr output, in emission order. */\n output: string\n\n /**\n * Canonical oclif command id when the invocation resolved to a command\n * exposed by the selected policy (for example, `datasets:create`).\n */\n commandId?: string\n}\n\n/**\n * Unlike a shell, string-argv keeps quotes that are glued to unquoted text:\n * `--name=\"my project\"` tokenizes with the quotes intact. Strip a matching\n * wrapping quote pair from the value side of `--flag=`-shaped tokens so the\n * common shell-style form yields the value the caller intended.\n */\nfunction stripFlagQuotes(rawToken: string): string {\n const match = /^(-{1,2}[^\\s=]+=)(['\"])([\\s\\S]*)\\2$/.exec(rawToken)\n return match ? match[1] + match[3] : rawToken\n}\n\n/**\n * Run a policy-permitted CLI command in-process and capture its result.\n *\n * Command-level failures (unknown command, bad flags, API errors) are\n * reported through `exitCode`/`output` rather than thrown, so callers can\n * relay them verbatim.\n *\n * @internal\n */\nexport async function invokeSanityCli(\n options: InvokeSanityCliOptions,\n): Promise<InvokeSanityCliResult> {\n // Always load compiled command modules. Oclif's dev-mode source resolution\n // otherwise probes tsconfigs (reading the filesystem and process.cwd) on\n // every command load, and may register ts-node process-wide.\n settings.enableAutoTranspile = false\n\n const resolvedConfig = options.config ?? (await (cachedConfig ??= loadCliCommandConfig()))\n const output: string[] = []\n const sink = (line: string) => output.push(line)\n const {fetch, sanityEnv, token} = options\n\n // Establish the isolation boundary before rendering help, loading command\n // modules, parsing, or executing. Any code reached by an external\n // invocation can therefore fail closed on context.\n return runWithCliExecutionContext({fetch, sanityEnv, stderr: sink, stdout: sink, token}, () =>\n invokeSanityCliInContext(options, resolvedConfig, output),\n )\n}\n\nasync function invokeSanityCliInContext(\n {args, source}: InvokeSanityCliOptions,\n resolvedConfig: Config,\n output: string[],\n): Promise<InvokeSanityCliResult> {\n const policySet = commandPolicies[source]\n\n // Pre-split argv arrays are taken verbatim; only string input goes through\n // shell-style tokenization and quote normalization.\n let argv =\n typeof args === 'string'\n ? parseArgsStringToArgv(args).map((t) => stripFlagQuotes(t))\n : [...args]\n if (argv[0] === 'sanity') argv = argv.slice(1)\n argv = resolveTopicAliasInArgv(argv)\n\n // Help requests are routed through oclif's help system, scoped to the\n // source's policy: root help for a bare request, topic/command help when a\n // subject is given. Denied subjects get the standard unknown-command\n // response (identical to a truly unknown command, so hosts can't probe the\n // full CLI surface through help), and a help request never executes a\n // command.\n if (isHelpRequest(argv, resolvedConfig)) {\n try {\n // Drop a leading `help` so the rest is the subject, mirroring how\n // oclif's dispatch consumes the token before the help command sees argv\n const helpArgv = argv[0] === 'help' ? argv.slice(1) : argv\n const result = await renderInvokableHelp(resolvedConfig, helpArgv, policySet)\n if (result) return {...result, exitCode: exitCodes.SUCCESS}\n const helpFlags = getHelpFlagAdditions(resolvedConfig)\n return unknownCommandResult(\n helpArgv.filter((token) => !helpFlags.includes(token)),\n policySet,\n )\n } catch (err) {\n return {\n exitCode: exitCodes.RUNTIME_ERROR,\n output: err instanceof Error ? err.message : String(err),\n }\n }\n }\n\n // Resolve the command id the same way oclif's dispatch would (collating\n // space-separated topics, accepting colon-separated ids as-is), then apply\n // the policy. Denied and uncategorized ids fail closed, indistinguishable\n // from commands that don't exist.\n const [commandId = '', ...commandArgv] = normalizeArgv(resolvedConfig, argv)\n const policy = policySet[commandId] ?? deny\n const commandDefinition =\n policy.kind === 'deny' ? undefined : resolvedConfig.findCommand(commandId)\n if (!commandDefinition) return unknownCommandResult(argv, policySet)\n\n const CommandClass = await commandDefinition.load()\n\n // Parse with the command's real definitions (without executing anything) so\n // conditional policies are evaluated against typed args/flags, not tokens.\n let invocation: {args: Record<string, unknown>; flags: Record<string, unknown>}\n try {\n const parsed = await Parser.parse(commandArgv, {\n args: CommandClass.args,\n baseFlags: CommandClass.baseFlags,\n enableJsonFlag: CommandClass.enableJsonFlag,\n flags: CommandClass.flags,\n strict: CommandClass.strict,\n })\n invocation = {\n args: parsed.args as Record<string, unknown>,\n flags: parsed.flags as Record<string, unknown>,\n }\n } catch (err) {\n return {\n commandId,\n exitCode: exitCodes.USAGE_ERROR,\n output: err instanceof Error ? err.message : String(err),\n }\n }\n\n if (!policy.validate(invocation)) {\n const displayId = commandId.replaceAll(':', ' ')\n let output = `This invocation of \\`${displayId}\\` is not supported here`\n\n if (isConditionalInvocationPolicy(policy)) {\n const usedDeniedFlags = policy.deniedFlags.filter(\n (name) => invocation.flags[name] !== undefined && invocation.flags[name] !== false,\n )\n if (usedDeniedFlags.length > 0) {\n output = `\\nThe ${usedDeniedFlags.map((name) => `--${name}`).join(', ')} flag is not supported here for \\`${displayId}\\``\n }\n }\n\n return {\n commandId,\n exitCode: exitCodes.USAGE_ERROR,\n output,\n }\n }\n\n try {\n const command = instantiateCommand(CommandClass, commandArgv, resolvedConfig)\n await command.runInExecutionContext()\n return {commandId, exitCode: exitCodes.SUCCESS, output: output.join('\\n')}\n } catch (err) {\n const exit = err.oclif?.exit\n\n // `this.exit(0)` throws an ExitError but is a successful outcome\n if (exit === exitCodes.SUCCESS) {\n return {commandId, exitCode: exitCodes.SUCCESS, output: output.join('\\n')}\n }\n\n const message = prettyPrintError(err) || String(err)\n if (message) output.push(message)\n return {\n commandId,\n exitCode: typeof exit === 'number' ? exit : exitCodes.RUNTIME_ERROR,\n output: output.join('\\n'),\n }\n }\n}\n"],"names":["Config","Parser","settings","getHelpFlagAdditions","normalizeArgv","exitCodes","runWithCliExecutionContext","parseArgsStringToArgv","resolveTopicAliasInArgv","commandPolicies","deny","isConditionalInvocationPolicy","isHelpRequest","renderInvokableHelp","prettyPrintError","instantiateCommand","CommandClass","argv","config","ConcreteCommand","command","runInExecutionContext","TypeError","id","loadCliCommandConfig","load","url","cachedConfig","unknownCommandResult","policySet","available","Object","entries","filter","policy","kind","map","replaceAll","toSorted","exitCode","USAGE_ERROR","output","slice","join","stripFlagQuotes","rawToken","match","exec","invokeSanityCli","options","enableAutoTranspile","resolvedConfig","sink","line","push","fetch","sanityEnv","token","stderr","stdout","invokeSanityCliInContext","args","source","t","helpArgv","result","SUCCESS","helpFlags","includes","err","RUNTIME_ERROR","Error","message","String","commandId","commandArgv","commandDefinition","undefined","findCommand","invocation","parsed","parse","baseFlags","enableJsonFlag","flags","strict","validate","displayId","usedDeniedFlags","deniedFlags","name","length","exit","oclif"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,SAAiBA,MAAM,EAAEC,MAAM,EAAEC,QAAQ,QAAO,cAAa;AAC7D,SAAQC,oBAAoB,EAAEC,aAAa,QAAO,mBAAkB;AACpE,SAA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E,aAAa;YACnE7B,QAAQA,OAAOE,IAAI,CAAC;QACtB;IACF;AACF"}
@@ -1,65 +1,3 @@
1
- import { AssetSource } from "@sanity/types";
2
- import { AssetSourceComponent } from "@sanity/workbench-cli";
3
- import { AssetSourceComponentProps } from "@sanity/types";
4
- import { AssetSourceViewComponents } from "@sanity/workbench-cli";
5
- import { DefinedService } from "@sanity/workbench-cli";
6
- import { DefinedView } from "@sanity/workbench-cli";
7
- import { InterfaceType } from "@sanity/workbench-cli";
8
- import { PanelComponent } from "@sanity/workbench-cli";
9
- import { PanelViewComponents } from "@sanity/workbench-cli";
10
- import { PanelViewProps } from "@sanity/workbench-cli";
11
- import { ServiceCallback } from "@sanity/workbench-cli";
12
- import { ServiceContext } from "@sanity/workbench-cli";
13
- import { ServiceInfo } from "@sanity/workbench-cli";
14
- import { ServiceType } from "@sanity/workbench-cli";
15
- import { TileComponent } from "@sanity/workbench-cli";
16
- import { TileSize } from "@sanity/workbench-cli";
17
- import { TileViewComponents } from "@sanity/workbench-cli";
18
- import { TileViewProps } from "@sanity/workbench-cli";
19
- import { unstable_defineService } from "@sanity/workbench-cli";
20
- import { unstable_defineView } from "@sanity/workbench-cli";
21
- import { ViewComponentsByType } from "@sanity/workbench-cli";
22
-
23
- export { AssetSource };
24
-
25
- export { AssetSourceComponent };
26
-
27
- export { AssetSourceComponentProps };
28
-
29
- export { AssetSourceViewComponents };
30
-
31
- export { DefinedService };
32
-
33
- export { DefinedView };
34
-
35
- export { InterfaceType };
36
-
37
- export { PanelComponent };
38
-
39
- export { PanelViewComponents };
40
-
41
- export { PanelViewProps };
42
-
43
- export { ServiceCallback };
44
-
45
- export { ServiceContext };
46
-
47
- export { ServiceInfo };
48
-
49
- export { ServiceType };
50
-
51
- export { TileComponent };
52
-
53
- export { TileSize };
54
-
55
- export { TileViewComponents };
56
-
57
- export { TileViewProps };
58
-
59
- export { unstable_defineService };
60
-
61
- export { unstable_defineView };
62
-
63
- export { ViewComponentsByType };
64
-
65
- export {};
1
+ import { AssetSource, AssetSourceComponentProps } from "@sanity/types";
2
+ import { AssetSourceComponent, AssetSourceViewComponents, DefinedService, DefinedView, InterfaceType, PanelComponent, PanelViewComponents, PanelViewProps, ServiceCallback, ServiceContext, ServiceInfo, ServiceType, TileComponent, TileSize, TileViewComponents, TileViewProps, ViewComponentsByType, unstable_defineService, unstable_defineView } from "@sanity/workbench-cli";
3
+ export { type AssetSource, type AssetSourceComponent, type AssetSourceComponentProps, type AssetSourceViewComponents, type DefinedService, type DefinedView, type InterfaceType, type PanelComponent, type PanelViewComponents, type PanelViewProps, type ServiceCallback, type ServiceContext, type ServiceInfo, type ServiceType, type TileComponent, type TileSize, type TileViewComponents, type TileViewProps, type ViewComponentsByType, unstable_defineService, unstable_defineView };