@sanity/cli 7.7.0 → 7.7.1

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.
@@ -193,7 +193,12 @@ export async function checkBuild(reporter, { build, skipReason, successMessage }
193
193
  if (title) {
194
194
  return {
195
195
  message: `Would create a new application "${title}"`,
196
- status: 'pass'
196
+ status: 'pass',
197
+ target: {
198
+ applicationId: null,
199
+ title,
200
+ url: null
201
+ }
197
202
  };
198
203
  }
199
204
  return {
@@ -265,9 +270,11 @@ export async function checkAppTarget(reporter, { appId, organizationId, title })
265
270
  return {
266
271
  message: isExternal ? `Would register external studio at ${resolution.appHost}${titled}` : `Would create studio hostname ${url}${titled} (name availability is checked on deploy)`,
267
272
  status: 'pass',
273
+ // `title || null`, not `?? null`, so target.title tracks the same
274
+ // truthiness the message's `titled` suffix uses (an empty title is no title)
268
275
  target: {
269
276
  applicationId: null,
270
- title: null,
277
+ title: title || null,
271
278
  url
272
279
  }
273
280
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/deploy/deployChecks.ts"],"sourcesContent":["import {type CliConfig, exitCodes, getLocalPackageVersion, type Output} from '@sanity/cli-core'\nimport {spinner} from '@sanity/cli-core/ux'\nimport {checkBuiltOutput} from '@sanity/workbench-cli/deploy'\n\nimport {resolveAppIdIssue} from '../../util/appId.js'\nimport {APP_ID_NOT_FOUND_IN_ORGANIZATION} from '../../util/errorMessages.js'\nimport {getErrorMessage} from '../../util/getErrorMessage.js'\nimport {\n getAutoUpdateIssueMessage,\n getAutoUpdateMigrationHint,\n resolveAutoUpdates,\n} from '../build/shouldAutoUpdate.js'\nimport {checkDir} from './checkDir.js'\nimport {deployDebug} from './deployDebug.js'\nimport {\n type AppDeployTargetResolution,\n resolveAppDeployTarget,\n resolveStudioDeployTarget,\n type StudioDeployTargetResolution,\n} from './resolveDeployTarget.js'\nimport {type DeployFlags} from './types.js'\nimport {getCoreAppUrl} from './urlUtils.js'\n\ntype DeployCheckStatus = 'fail' | 'pass' | 'skip' | 'warn'\n\n/**\n * Where a deploy resolves to, computed once from the deploy-target verdict. The\n * dry-run report and its JSON both read this, so the human and machine outputs\n * can't drift.\n */\nexport interface DeployTarget {\n /** The application the deploy targets; `null` when a deploy would create one. */\n applicationId: string | null\n /** The application's title; `null` when it has none (or isn't created yet). */\n title: string | null\n /** Where the deployed studio/app is reachable; `null` when it can't be resolved yet. */\n url: string | null\n}\n\nexport interface DeployCheck {\n message: string\n status: DeployCheckStatus\n\n /** Exit code a real deploy uses when this check fails; defaults to 1 */\n exitCode?: number\n /** Actionable fix, shown under a failing or warning check */\n solution?: string\n /** Set on the deploy-target check with the resolved target both reporters read. */\n target?: DeployTarget\n /** Set on the package-version check with the version both reporters read. */\n version?: string\n}\n\n/**\n * Where deploy steps send their check outcomes — and the only place the deploy\n * mode lives. A real deploy fails fast: a `fail` prints and exits immediately,\n * which aborts the sequence. A dry run collects every outcome and never exits.\n * Steps just call `report`; they never know which mode is running.\n */\nexport interface CheckReporter {\n report(check: DeployCheck): void\n}\n\nexport function createFailFastReporter(output: Output): CheckReporter {\n return {\n report(check) {\n // Fixes surface in both modes: appended after the message here, and in the\n // dry-run report, so the problem and its fix never drift apart.\n const text = check.solution ? `${check.message}: ${check.solution}` : check.message\n if (check.status === 'fail') {\n output.error(text, {exit: check.exitCode ?? 1})\n } else if (check.status === 'warn') {\n output.warn(text)\n }\n },\n }\n}\n\nexport function createCollectingReporter(): CheckReporter & {results: DeployCheck[]} {\n const results: DeployCheck[] = []\n return {\n report(check) {\n results.push(check)\n },\n results,\n }\n}\n\n/**\n * Runs a fallible step and turns a throw into a `fail` check. In a real deploy\n * that fail exits (aborting the run); in a dry run it's recorded and `null`\n * comes back so the caller can skip the rest of the step. `name` labels the\n * step in debug logs.\n */\nexport async function runStep<T>(\n reporter: CheckReporter,\n name: string,\n work: () => Promise<T>,\n formatError: (err: unknown) => string = getErrorMessage,\n solution?: string,\n): Promise<T | null> {\n try {\n return await work()\n } catch (err) {\n deployDebug(`${name} step failed`, err)\n reporter.report({message: formatError(err), solution, status: 'fail'})\n return null\n }\n}\n\nexport async function checkPackageVersion(\n reporter: CheckReporter,\n {moduleName, workDir}: {moduleName: string; workDir: string},\n): Promise<string | null> {\n const version = await getLocalPackageVersion(moduleName, workDir)\n reporter.report(\n version\n ? {message: `Using ${moduleName} ${version}`, status: 'pass', version}\n : {\n message: `Failed to find installed ${moduleName} version`,\n solution: `Install ${moduleName} in this project`,\n status: 'fail',\n },\n )\n return version\n}\n\nexport function checkAutoUpdates(\n reporter: CheckReporter,\n {cliConfig, flags}: {cliConfig: CliConfig; flags: DeployFlags},\n): boolean {\n const {enabled, issue} = resolveAutoUpdates({cliConfig, flags})\n\n if (issue) {\n reporter.report({\n message: getAutoUpdateIssueMessage(issue),\n // A config conflict makes a real deploy refuse to run; deprecations only warn\n status: issue.type === 'conflicting-config' ? 'fail' : 'warn',\n })\n\n // The deprecated top-level config also gets the styled migration edit, the\n // same second warning the build/dev path prints through shouldAutoUpdate.\n if (issue.type === 'deprecated-config') {\n reporter.report({\n message: getAutoUpdateMigrationHint(cliConfig.autoUpdates),\n status: 'warn',\n })\n }\n }\n\n return enabled\n}\n\n/**\n * The dry-run form of the `app.id` config check a real deploy runs in\n * `findUserApplication`: a conflict fails (both `app.id` and `deployment.appId`\n * set), the deprecated config alone warns.\n */\nexport function checkAppId(reporter: CheckReporter, {cliConfig}: {cliConfig: CliConfig}): void {\n const issue = resolveAppIdIssue(cliConfig)\n if (issue === 'conflicting-config') {\n reporter.report({\n message: 'Both `app.id` (deprecated) and `deployment.appId` are set',\n solution: 'Remove `app.id` from sanity.cli.ts',\n status: 'fail',\n })\n } else if (issue === 'deprecated-config') {\n reporter.report({\n message: 'The `app.id` config is deprecated',\n solution: 'Move it to `deployment.appId` in sanity.cli.ts',\n status: 'warn',\n })\n }\n}\n\nexport async function checkBuild(\n reporter: CheckReporter,\n {\n build,\n skipReason,\n successMessage,\n }: {build: () => Promise<void>; skipReason: string | undefined; successMessage: string},\n): Promise<void> {\n if (skipReason) {\n reporter.report({message: skipReason, status: 'skip'})\n return\n }\n\n await runStep(\n reporter,\n 'build',\n async () => {\n await build()\n reporter.report({message: successMessage, status: 'pass'})\n },\n (err) => `Build failed: ${getErrorMessage(err)}`,\n 'Fix the build error above, then retry',\n )\n}\n\n/**\n * The deploy directory must exist and hold the right build output: a federation\n * remote for a workbench app, an `index.html` SPA otherwise.\n */\nexport async function verifyOutputDir({\n isWorkbenchApp,\n reporter,\n sourceDir,\n}: {\n isWorkbenchApp: boolean\n reporter: CheckReporter\n sourceDir: string\n}): Promise<void> {\n const spin = spinner('Verifying local content...').start()\n const verifyBuild = isWorkbenchApp ? checkBuiltOutput : checkDir\n try {\n await verifyBuild(sourceDir)\n spin.succeed()\n } catch (err) {\n spin.fail()\n deployDebug('Error checking directory', err)\n reporter.report({\n message: getErrorMessage(err),\n solution: 'Run the build first, or check the output directory',\n status: 'fail',\n })\n }\n}\n\n/**\n * The single diagnosis for each app deploy-target verdict, shared by the\n * dry-run report and the real deploy's unattended error paths so message,\n * fix, and exit code can't drift between the two.\n */\nexport function describeAppTarget(\n resolution: AppDeployTargetResolution,\n {title}: {title?: string} = {},\n): DeployCheck {\n switch (resolution.type) {\n case 'blocked': {\n return {message: `Deploy target not resolved — ${resolution.message}`, status: 'skip'}\n }\n case 'found': {\n const {application} = resolution\n const title = application.title ?? application.appHost\n const url = getCoreAppUrl(application.organizationId, application.id)\n return {\n message: `Deploys to existing application \"${title}\" at ${url}`,\n status: 'pass',\n target: {applicationId: application.id, title: application.title ?? null, url},\n }\n }\n case 'invalid': {\n return {\n message: APP_ID_NOT_FOUND_IN_ORGANIZATION,\n solution: 'Check `deployment.appId` matches an app in your organization',\n status: 'fail',\n }\n }\n case 'needs-input': {\n return {\n exitCode: exitCodes.USAGE_ERROR,\n message: `No \\`deployment.appId\\` configured (${resolution.existing.length} existing ${resolution.existing.length === 1 ? 'application' : 'applications'} to choose from)`,\n solution: 'Add `deployment.appId` to sanity.cli.ts',\n status: 'fail',\n }\n }\n // Without --title, creating an app needs a prompt no unattended run can answer\n case 'would-create': {\n if (title) {\n return {message: `Would create a new application \"${title}\"`, status: 'pass'}\n }\n return {\n exitCode: exitCodes.USAGE_ERROR,\n message: 'No application to deploy to — creating one needs a title',\n solution:\n 'Pass `--title \"<name>\"` or set `app.title` in sanity.cli.ts to create one, or set `deployment.appId` to deploy to an existing app',\n status: 'fail',\n }\n }\n }\n}\n\nexport function describeAppTargetError(err: unknown, organizationId: string | undefined): string {\n return (err as {statusCode?: number})?.statusCode === 403\n ? `You don’t have permission to view applications for the configured organization ID (\"${organizationId}\"). Verify the organization ID, or ask your organization’s admin for access.`\n : `Failed to resolve deploy target: ${getErrorMessage(err)}`\n}\n\nexport async function checkAppTarget(\n reporter: CheckReporter,\n {\n appId,\n organizationId,\n title,\n }: {appId: string | undefined; organizationId: string | undefined; title?: string},\n): Promise<void> {\n await runStep(\n reporter,\n 'target',\n async () =>\n reporter.report(\n describeAppTarget(await resolveAppDeployTarget({appId, organizationId}), {title}),\n ),\n (err) => describeAppTargetError(err, organizationId),\n )\n}\n\n/** Same contract as {@link describeAppTarget}, for the studio verdicts. */\nexport function describeStudioTarget(\n resolution: StudioDeployTargetResolution,\n {isExternal, title}: {isExternal: boolean; title?: string},\n): DeployCheck {\n const studioUrl = (host: string) => (isExternal ? host : `https://${host}.sanity.studio`)\n\n switch (resolution.type) {\n case 'blocked': {\n return {message: `Deploy target not resolved — ${resolution.message}`, status: 'skip'}\n }\n case 'found': {\n const url = studioUrl(resolution.application.appHost)\n return {\n message: `Deploys to existing studio ${url}`,\n status: 'pass',\n target: {\n applicationId: resolution.application.id,\n title: resolution.application.title ?? null,\n url,\n },\n }\n }\n case 'invalid': {\n return {\n // A bad host is a usage error; other invalid targets exit 1\n exitCode: resolution.reason === 'invalid-host' ? exitCodes.USAGE_ERROR : 1,\n message: resolution.message,\n solution: 'Check `studioHost` and `deployment.appId` in sanity.cli.ts',\n status: 'fail',\n }\n }\n case 'needs-input': {\n return {\n exitCode: exitCodes.USAGE_ERROR,\n message: isExternal ? 'No external studio URL configured' : 'No studio hostname configured',\n solution: isExternal\n ? 'Set `studioHost` in sanity.cli.ts, or pass the full URL with --url'\n : 'Set `studioHost` in sanity.cli.ts, or pass a hostname with --url',\n status: 'fail',\n }\n }\n case 'would-create': {\n const url = studioUrl(resolution.appHost)\n const titled = title ? ` titled \"${title}\"` : ''\n return {\n message: isExternal\n ? `Would register external studio at ${resolution.appHost}${titled}`\n : `Would create studio hostname ${url}${titled} (name availability is checked on deploy)`,\n status: 'pass',\n target: {applicationId: null, title: null, url},\n }\n }\n }\n}\n\nexport async function checkStudioTarget(\n reporter: CheckReporter,\n options: {\n appId: string | undefined\n isExternal: boolean\n projectId: string | undefined\n studioHost: string | undefined\n title: string | undefined\n urlFlag: string | undefined\n },\n): Promise<void> {\n await runStep(\n reporter,\n 'target',\n async () =>\n reporter.report(\n describeStudioTarget(await resolveStudioDeployTarget(options), {\n isExternal: options.isExternal,\n title: options.title,\n }),\n ),\n (err) => `Failed to resolve deploy target: ${getErrorMessage(err)}`,\n )\n}\n"],"names":["exitCodes","getLocalPackageVersion","spinner","checkBuiltOutput","resolveAppIdIssue","APP_ID_NOT_FOUND_IN_ORGANIZATION","getErrorMessage","getAutoUpdateIssueMessage","getAutoUpdateMigrationHint","resolveAutoUpdates","checkDir","deployDebug","resolveAppDeployTarget","resolveStudioDeployTarget","getCoreAppUrl","createFailFastReporter","output","report","check","text","solution","message","status","error","exit","exitCode","warn","createCollectingReporter","results","push","runStep","reporter","name","work","formatError","err","checkPackageVersion","moduleName","workDir","version","checkAutoUpdates","cliConfig","flags","enabled","issue","type","autoUpdates","checkAppId","checkBuild","build","skipReason","successMessage","verifyOutputDir","isWorkbenchApp","sourceDir","spin","start","verifyBuild","succeed","fail","describeAppTarget","resolution","title","application","appHost","url","organizationId","id","target","applicationId","USAGE_ERROR","existing","length","describeAppTargetError","statusCode","checkAppTarget","appId","describeStudioTarget","isExternal","studioUrl","host","reason","titled","checkStudioTarget","options"],"mappings":"AAAA,SAAwBA,SAAS,EAAEC,sBAAsB,QAAoB,mBAAkB;AAC/F,SAAQC,OAAO,QAAO,sBAAqB;AAC3C,SAAQC,gBAAgB,QAAO,+BAA8B;AAE7D,SAAQC,iBAAiB,QAAO,sBAAqB;AACrD,SAAQC,gCAAgC,QAAO,8BAA6B;AAC5E,SAAQC,eAAe,QAAO,gCAA+B;AAC7D,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,kBAAkB,QACb,+BAA8B;AACrC,SAAQC,QAAQ,QAAO,gBAAe;AACtC,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAEEC,sBAAsB,EACtBC,yBAAyB,QAEpB,2BAA0B;AAEjC,SAAQC,aAAa,QAAO,gBAAe;AA0C3C,OAAO,SAASC,uBAAuBC,MAAc;IACnD,OAAO;QACLC,QAAOC,KAAK;YACV,2EAA2E;YAC3E,gEAAgE;YAChE,MAAMC,OAAOD,MAAME,QAAQ,GAAG,GAAGF,MAAMG,OAAO,CAAC,EAAE,EAAEH,MAAME,QAAQ,EAAE,GAAGF,MAAMG,OAAO;YACnF,IAAIH,MAAMI,MAAM,KAAK,QAAQ;gBAC3BN,OAAOO,KAAK,CAACJ,MAAM;oBAACK,MAAMN,MAAMO,QAAQ,IAAI;gBAAC;YAC/C,OAAO,IAAIP,MAAMI,MAAM,KAAK,QAAQ;gBAClCN,OAAOU,IAAI,CAACP;YACd;QACF;IACF;AACF;AAEA,OAAO,SAASQ;IACd,MAAMC,UAAyB,EAAE;IACjC,OAAO;QACLX,QAAOC,KAAK;YACVU,QAAQC,IAAI,CAACX;QACf;QACAU;IACF;AACF;AAEA;;;;;CAKC,GACD,OAAO,eAAeE,QACpBC,QAAuB,EACvBC,IAAY,EACZC,IAAsB,EACtBC,cAAwC5B,eAAe,EACvDc,QAAiB;IAEjB,IAAI;QACF,OAAO,MAAMa;IACf,EAAE,OAAOE,KA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,yCAAyC,CAAC;oBAC3F5D,QAAQ;oBACR8C,QAAQ;wBAACC,eAAe;wBAAMP,OAAO;wBAAMG;oBAAG;gBAChD;YACF;IACF;AACF;AAEA,OAAO,eAAekB,kBACpBpD,QAAuB,EACvBqD,OAOC;IAED,MAAMtD,QACJC,UACA,UACA,UACEA,SAASd,MAAM,CACb4D,qBAAqB,MAAMhE,0BAA0BuE,UAAU;YAC7DN,YAAYM,QAAQN,UAAU;YAC9BhB,OAAOsB,QAAQtB,KAAK;QACtB,KAEJ,CAAC3B,MAAQ,CAAC,iCAAiC,EAAE7B,gBAAgB6B,MAAM;AAEvE"}
1
+ {"version":3,"sources":["../../../src/actions/deploy/deployChecks.ts"],"sourcesContent":["import {type CliConfig, exitCodes, getLocalPackageVersion, type Output} from '@sanity/cli-core'\nimport {spinner} from '@sanity/cli-core/ux'\nimport {checkBuiltOutput} from '@sanity/workbench-cli/deploy'\n\nimport {resolveAppIdIssue} from '../../util/appId.js'\nimport {APP_ID_NOT_FOUND_IN_ORGANIZATION} from '../../util/errorMessages.js'\nimport {getErrorMessage} from '../../util/getErrorMessage.js'\nimport {\n getAutoUpdateIssueMessage,\n getAutoUpdateMigrationHint,\n resolveAutoUpdates,\n} from '../build/shouldAutoUpdate.js'\nimport {checkDir} from './checkDir.js'\nimport {deployDebug} from './deployDebug.js'\nimport {\n type AppDeployTargetResolution,\n resolveAppDeployTarget,\n resolveStudioDeployTarget,\n type StudioDeployTargetResolution,\n} from './resolveDeployTarget.js'\nimport {type DeployFlags} from './types.js'\nimport {getCoreAppUrl} from './urlUtils.js'\n\ntype DeployCheckStatus = 'fail' | 'pass' | 'skip' | 'warn'\n\n/**\n * Where a deploy resolves to, computed once from the deploy-target verdict. The\n * dry-run report and its JSON both read this, so the human and machine outputs\n * can't drift.\n */\nexport interface DeployTarget {\n /** The application the deploy targets; `null` when a deploy would create one. */\n applicationId: string | null\n /** The application's title; `null` when it has none (or isn't created yet). */\n title: string | null\n /** Where the deployed studio/app is reachable; `null` when it can't be resolved yet. */\n url: string | null\n}\n\nexport interface DeployCheck {\n message: string\n status: DeployCheckStatus\n\n /** Exit code a real deploy uses when this check fails; defaults to 1 */\n exitCode?: number\n /** Actionable fix, shown under a failing or warning check */\n solution?: string\n /** Set on the deploy-target check with the resolved target both reporters read. */\n target?: DeployTarget\n /** Set on the package-version check with the version both reporters read. */\n version?: string\n}\n\n/**\n * Where deploy steps send their check outcomes — and the only place the deploy\n * mode lives. A real deploy fails fast: a `fail` prints and exits immediately,\n * which aborts the sequence. A dry run collects every outcome and never exits.\n * Steps just call `report`; they never know which mode is running.\n */\nexport interface CheckReporter {\n report(check: DeployCheck): void\n}\n\nexport function createFailFastReporter(output: Output): CheckReporter {\n return {\n report(check) {\n // Fixes surface in both modes: appended after the message here, and in the\n // dry-run report, so the problem and its fix never drift apart.\n const text = check.solution ? `${check.message}: ${check.solution}` : check.message\n if (check.status === 'fail') {\n output.error(text, {exit: check.exitCode ?? 1})\n } else if (check.status === 'warn') {\n output.warn(text)\n }\n },\n }\n}\n\nexport function createCollectingReporter(): CheckReporter & {results: DeployCheck[]} {\n const results: DeployCheck[] = []\n return {\n report(check) {\n results.push(check)\n },\n results,\n }\n}\n\n/**\n * Runs a fallible step and turns a throw into a `fail` check. In a real deploy\n * that fail exits (aborting the run); in a dry run it's recorded and `null`\n * comes back so the caller can skip the rest of the step. `name` labels the\n * step in debug logs.\n */\nexport async function runStep<T>(\n reporter: CheckReporter,\n name: string,\n work: () => Promise<T>,\n formatError: (err: unknown) => string = getErrorMessage,\n solution?: string,\n): Promise<T | null> {\n try {\n return await work()\n } catch (err) {\n deployDebug(`${name} step failed`, err)\n reporter.report({message: formatError(err), solution, status: 'fail'})\n return null\n }\n}\n\nexport async function checkPackageVersion(\n reporter: CheckReporter,\n {moduleName, workDir}: {moduleName: string; workDir: string},\n): Promise<string | null> {\n const version = await getLocalPackageVersion(moduleName, workDir)\n reporter.report(\n version\n ? {message: `Using ${moduleName} ${version}`, status: 'pass', version}\n : {\n message: `Failed to find installed ${moduleName} version`,\n solution: `Install ${moduleName} in this project`,\n status: 'fail',\n },\n )\n return version\n}\n\nexport function checkAutoUpdates(\n reporter: CheckReporter,\n {cliConfig, flags}: {cliConfig: CliConfig; flags: DeployFlags},\n): boolean {\n const {enabled, issue} = resolveAutoUpdates({cliConfig, flags})\n\n if (issue) {\n reporter.report({\n message: getAutoUpdateIssueMessage(issue),\n // A config conflict makes a real deploy refuse to run; deprecations only warn\n status: issue.type === 'conflicting-config' ? 'fail' : 'warn',\n })\n\n // The deprecated top-level config also gets the styled migration edit, the\n // same second warning the build/dev path prints through shouldAutoUpdate.\n if (issue.type === 'deprecated-config') {\n reporter.report({\n message: getAutoUpdateMigrationHint(cliConfig.autoUpdates),\n status: 'warn',\n })\n }\n }\n\n return enabled\n}\n\n/**\n * The dry-run form of the `app.id` config check a real deploy runs in\n * `findUserApplication`: a conflict fails (both `app.id` and `deployment.appId`\n * set), the deprecated config alone warns.\n */\nexport function checkAppId(reporter: CheckReporter, {cliConfig}: {cliConfig: CliConfig}): void {\n const issue = resolveAppIdIssue(cliConfig)\n if (issue === 'conflicting-config') {\n reporter.report({\n message: 'Both `app.id` (deprecated) and `deployment.appId` are set',\n solution: 'Remove `app.id` from sanity.cli.ts',\n status: 'fail',\n })\n } else if (issue === 'deprecated-config') {\n reporter.report({\n message: 'The `app.id` config is deprecated',\n solution: 'Move it to `deployment.appId` in sanity.cli.ts',\n status: 'warn',\n })\n }\n}\n\nexport async function checkBuild(\n reporter: CheckReporter,\n {\n build,\n skipReason,\n successMessage,\n }: {build: () => Promise<void>; skipReason: string | undefined; successMessage: string},\n): Promise<void> {\n if (skipReason) {\n reporter.report({message: skipReason, status: 'skip'})\n return\n }\n\n await runStep(\n reporter,\n 'build',\n async () => {\n await build()\n reporter.report({message: successMessage, status: 'pass'})\n },\n (err) => `Build failed: ${getErrorMessage(err)}`,\n 'Fix the build error above, then retry',\n )\n}\n\n/**\n * The deploy directory must exist and hold the right build output: a federation\n * remote for a workbench app, an `index.html` SPA otherwise.\n */\nexport async function verifyOutputDir({\n isWorkbenchApp,\n reporter,\n sourceDir,\n}: {\n isWorkbenchApp: boolean\n reporter: CheckReporter\n sourceDir: string\n}): Promise<void> {\n const spin = spinner('Verifying local content...').start()\n const verifyBuild = isWorkbenchApp ? checkBuiltOutput : checkDir\n try {\n await verifyBuild(sourceDir)\n spin.succeed()\n } catch (err) {\n spin.fail()\n deployDebug('Error checking directory', err)\n reporter.report({\n message: getErrorMessage(err),\n solution: 'Run the build first, or check the output directory',\n status: 'fail',\n })\n }\n}\n\n/**\n * The single diagnosis for each app deploy-target verdict, shared by the\n * dry-run report and the real deploy's unattended error paths so message,\n * fix, and exit code can't drift between the two.\n */\nexport function describeAppTarget(\n resolution: AppDeployTargetResolution,\n {title}: {title?: string} = {},\n): DeployCheck {\n switch (resolution.type) {\n case 'blocked': {\n return {message: `Deploy target not resolved — ${resolution.message}`, status: 'skip'}\n }\n case 'found': {\n const {application} = resolution\n const title = application.title ?? application.appHost\n const url = getCoreAppUrl(application.organizationId, application.id)\n return {\n message: `Deploys to existing application \"${title}\" at ${url}`,\n status: 'pass',\n target: {applicationId: application.id, title: application.title ?? null, url},\n }\n }\n case 'invalid': {\n return {\n message: APP_ID_NOT_FOUND_IN_ORGANIZATION,\n solution: 'Check `deployment.appId` matches an app in your organization',\n status: 'fail',\n }\n }\n case 'needs-input': {\n return {\n exitCode: exitCodes.USAGE_ERROR,\n message: `No \\`deployment.appId\\` configured (${resolution.existing.length} existing ${resolution.existing.length === 1 ? 'application' : 'applications'} to choose from)`,\n solution: 'Add `deployment.appId` to sanity.cli.ts',\n status: 'fail',\n }\n }\n // Without --title, creating an app needs a prompt no unattended run can answer\n case 'would-create': {\n if (title) {\n return {\n message: `Would create a new application \"${title}\"`,\n status: 'pass',\n target: {applicationId: null, title, url: null},\n }\n }\n return {\n exitCode: exitCodes.USAGE_ERROR,\n message: 'No application to deploy to — creating one needs a title',\n solution:\n 'Pass `--title \"<name>\"` or set `app.title` in sanity.cli.ts to create one, or set `deployment.appId` to deploy to an existing app',\n status: 'fail',\n }\n }\n }\n}\n\nexport function describeAppTargetError(err: unknown, organizationId: string | undefined): string {\n return (err as {statusCode?: number})?.statusCode === 403\n ? `You don’t have permission to view applications for the configured organization ID (\"${organizationId}\"). Verify the organization ID, or ask your organization’s admin for access.`\n : `Failed to resolve deploy target: ${getErrorMessage(err)}`\n}\n\nexport async function checkAppTarget(\n reporter: CheckReporter,\n {\n appId,\n organizationId,\n title,\n }: {appId: string | undefined; organizationId: string | undefined; title?: string},\n): Promise<void> {\n await runStep(\n reporter,\n 'target',\n async () =>\n reporter.report(\n describeAppTarget(await resolveAppDeployTarget({appId, organizationId}), {title}),\n ),\n (err) => describeAppTargetError(err, organizationId),\n )\n}\n\n/** Same contract as {@link describeAppTarget}, for the studio verdicts. */\nexport function describeStudioTarget(\n resolution: StudioDeployTargetResolution,\n {isExternal, title}: {isExternal: boolean; title?: string},\n): DeployCheck {\n const studioUrl = (host: string) => (isExternal ? host : `https://${host}.sanity.studio`)\n\n switch (resolution.type) {\n case 'blocked': {\n return {message: `Deploy target not resolved — ${resolution.message}`, status: 'skip'}\n }\n case 'found': {\n const url = studioUrl(resolution.application.appHost)\n return {\n message: `Deploys to existing studio ${url}`,\n status: 'pass',\n target: {\n applicationId: resolution.application.id,\n title: resolution.application.title ?? null,\n url,\n },\n }\n }\n case 'invalid': {\n return {\n // A bad host is a usage error; other invalid targets exit 1\n exitCode: resolution.reason === 'invalid-host' ? exitCodes.USAGE_ERROR : 1,\n message: resolution.message,\n solution: 'Check `studioHost` and `deployment.appId` in sanity.cli.ts',\n status: 'fail',\n }\n }\n case 'needs-input': {\n return {\n exitCode: exitCodes.USAGE_ERROR,\n message: isExternal ? 'No external studio URL configured' : 'No studio hostname configured',\n solution: isExternal\n ? 'Set `studioHost` in sanity.cli.ts, or pass the full URL with --url'\n : 'Set `studioHost` in sanity.cli.ts, or pass a hostname with --url',\n status: 'fail',\n }\n }\n case 'would-create': {\n const url = studioUrl(resolution.appHost)\n const titled = title ? ` titled \"${title}\"` : ''\n return {\n message: isExternal\n ? `Would register external studio at ${resolution.appHost}${titled}`\n : `Would create studio hostname ${url}${titled} (name availability is checked on deploy)`,\n status: 'pass',\n // `title || null`, not `?? null`, so target.title tracks the same\n // truthiness the message's `titled` suffix uses (an empty title is no title)\n target: {applicationId: null, title: title || null, url},\n }\n }\n }\n}\n\nexport async function checkStudioTarget(\n reporter: CheckReporter,\n options: {\n appId: string | undefined\n isExternal: boolean\n projectId: string | undefined\n studioHost: string | undefined\n title: string | undefined\n urlFlag: string | undefined\n },\n): Promise<void> {\n await runStep(\n reporter,\n 'target',\n async () =>\n reporter.report(\n describeStudioTarget(await resolveStudioDeployTarget(options), {\n isExternal: options.isExternal,\n title: options.title,\n }),\n ),\n (err) => `Failed to resolve deploy target: ${getErrorMessage(err)}`,\n )\n}\n"],"names":["exitCodes","getLocalPackageVersion","spinner","checkBuiltOutput","resolveAppIdIssue","APP_ID_NOT_FOUND_IN_ORGANIZATION","getErrorMessage","getAutoUpdateIssueMessage","getAutoUpdateMigrationHint","resolveAutoUpdates","checkDir","deployDebug","resolveAppDeployTarget","resolveStudioDeployTarget","getCoreAppUrl","createFailFastReporter","output","report","check","text","solution","message","status","error","exit","exitCode","warn","createCollectingReporter","results","push","runStep","reporter","name","work","formatError","err","checkPackageVersion","moduleName","workDir","version","checkAutoUpdates","cliConfig","flags","enabled","issue","type","autoUpdates","checkAppId","checkBuild","build","skipReason","successMessage","verifyOutputDir","isWorkbenchApp","sourceDir","spin","start","verifyBuild","succeed","fail","describeAppTarget","resolution","title","application","appHost","url","organizationId","id","target","applicationId","USAGE_ERROR","existing","length","describeAppTargetError","statusCode","checkAppTarget","appId","describeStudioTarget","isExternal","studioUrl","host","reason","titled","checkStudioTarget","options"],"mappings":"AAAA,SAAwBA,SAAS,EAAEC,sBAAsB,QAAoB,mBAAkB;AAC/F,SAAQC,OAAO,QAAO,sBA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C,eAAe;wBAAMP,OAAOA,SAAS;wBAAMG;oBAAG;gBACzD;YACF;IACF;AACF;AAEA,OAAO,eAAekB,kBACpBpD,QAAuB,EACvBqD,OAOC;IAED,MAAMtD,QACJC,UACA,UACA,UACEA,SAASd,MAAM,CACb4D,qBAAqB,MAAMhE,0BAA0BuE,UAAU;YAC7DN,YAAYM,QAAQN,UAAU;YAC9BhB,OAAOsB,QAAQtB,KAAK;QACtB,KAEJ,CAAC3B,MAAQ,CAAC,iCAAiC,EAAE7B,gBAAgB6B,MAAM;AAEvE"}
@@ -1,5 +1,6 @@
1
1
  import { format } from 'node:util';
2
2
  import { CLIError } from '@oclif/core/errors';
3
+ import { getErrorMessage } from '../../util/getErrorMessage.js';
3
4
  import { createCollectingReporter, createFailFastReporter } from './deployChecks.js';
4
5
  import { deployDebug } from './deployDebug.js';
5
6
  import { deploymentPlanToJson, isDeployable, renderDeploymentPlan } from './deploymentPlan.js';
@@ -10,6 +11,7 @@ import { deploymentPlanToJson, isDeployable, renderDeploymentPlan } from './depl
10
11
  */ export async function runDeploy(options, spec) {
11
12
  const { output } = options;
12
13
  const json = !!options.flags.json;
14
+ const emitJson = (payload)=>output.log(JSON.stringify(payload, null, 2));
13
15
  // The JSON payload owns stdout, so the run's progress logs go to stderr; only
14
16
  // the final JSON.stringify writes to stdout. Spinners are already on stderr.
15
17
  const runOptions = json ? {
@@ -22,19 +24,31 @@ import { deploymentPlanToJson, isDeployable, renderDeploymentPlan } from './depl
22
24
  try {
23
25
  if (options.flags['dry-run']) {
24
26
  const plan = await collectPlan(runOptions, spec);
25
- if (json) output.log(JSON.stringify(deploymentPlanToJson(plan), null, 2));
27
+ if (json) emitJson(deploymentPlanToJson(plan));
26
28
  else renderDeploymentPlan(plan, output);
27
29
  exitIfBlocked(plan, output);
28
30
  return;
29
31
  }
30
32
  const result = await spec.run(runOptions, createFailFastReporter(runOptions.output));
31
- if (json && result) output.log(JSON.stringify({
33
+ if (json && result) emitJson({
32
34
  deployed: true,
33
35
  ...result
34
- }, null, 2));
36
+ });
35
37
  } catch (error) {
36
- // Failures signal via exit code and stderr, like every other command — no JSON on stdout.
37
- normalizeDeployError(error, output, spec.type);
38
+ const failure = normalizeFailure(error, spec.type);
39
+ // A blocked dry run reaches this catch too (its exit throws) and already
40
+ // printed its plan, so only a real deploy adds the {deployed: false} envelope.
41
+ if (json && !options.flags['dry-run']) {
42
+ emitJson({
43
+ deployed: false,
44
+ error: {
45
+ message: failure.message
46
+ }
47
+ });
48
+ }
49
+ output.error(failure.message, {
50
+ exit: failure.exit
51
+ });
38
52
  }
39
53
  }
40
54
  /** Runs the step sequence read-only and gathers the plan a dry run reports. */ async function collectPlan(options, spec) {
@@ -58,21 +72,26 @@ import { deploymentPlanToJson, isDeployable, renderDeploymentPlan } from './depl
58
72
  exit: failed?.exitCode ?? 1
59
73
  });
60
74
  }
61
- function normalizeDeployError(error, output, type) {
62
- const noun = type === 'coreApp' ? 'application' : 'studio';
75
+ /** The one failure diagnosis both the stderr message and the `--json` envelope read. */ function normalizeFailure(error, type) {
63
76
  // Ctrl+C on an interactive prompt isn't a real failure
64
77
  if (error instanceof Error && error.name === 'ExitPromptError') {
65
- output.error('Deployment cancelled by user', {
66
- exit: 1
67
- });
68
- return;
78
+ return {
79
+ exit: 1,
80
+ message: 'Deployment cancelled by user'
81
+ };
69
82
  }
70
- // A failed check already carries its own message and exit code; rethrow untouched
71
- if (error instanceof CLIError) throw error;
72
- deployDebug(`Error deploying ${noun}`, error);
73
- output.error(`Error deploying ${noun}: ${error}`, {
74
- exit: 1
75
- });
83
+ // A failed check already carries its own message and exit code
84
+ if (error instanceof CLIError) {
85
+ return {
86
+ exit: error.oclif?.exit ?? 1,
87
+ message: error.message
88
+ };
89
+ }
90
+ deployDebug(`Error deploying ${type === 'coreApp' ? 'application' : 'studio'}`, error);
91
+ return {
92
+ exit: 1,
93
+ message: `Error deploying ${type === 'coreApp' ? 'application' : 'studio'}: ${getErrorMessage(error)}`
94
+ };
76
95
  }
77
96
 
78
97
  //# sourceMappingURL=deployRunner.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/deploy/deployRunner.ts"],"sourcesContent":["import {format} from 'node:util'\n\nimport {CLIError} from '@oclif/core/errors'\nimport {type Output} from '@sanity/cli-core'\n\nimport {\n type CheckReporter,\n createCollectingReporter,\n createFailFastReporter,\n type DeployTarget,\n} from './deployChecks.js'\nimport {deployDebug} from './deployDebug.js'\nimport {\n type DeploymentFile,\n type DeploymentPlan,\n deploymentPlanToJson,\n isDeployable,\n renderDeploymentPlan,\n} from './deploymentPlan.js'\nimport {type DeployAppOptions} from './types.js'\n\n/** What a real deploy produced — the payload `--json` reports. */\nexport interface DeployResult {\n applicationType: 'coreApp' | 'studio'\n /** Installed framework version the deploy used (`sanity` or `@sanity/sdk-react`). */\n applicationVersion: string\n /**\n * The deployed application/studio, in the same shape the dry-run plan reports\n * so the two modes can't drift; `null` for a config-only singleton deploy.\n */\n target: DeployTarget | null\n\n /** Set when a media-library singleton deployed its installation config. */\n installationId?: string\n}\n\n/**\n * The parts of a deploy that differ between core apps and studios. The shared\n * sequence — mode selection, error handling, the dry-run plan, `--json` — lives\n * in `runDeploy`.\n */\nexport interface DeploySpec {\n /** Files a real deploy would upload, listed only for the dry-run plan. */\n listFiles: (options: DeployAppOptions) => Promise<DeploymentFile[]>\n /** The step sequence; every step reports through `reporter`. */\n run: (options: DeployAppOptions, reporter: CheckReporter) => Promise<DeployResult | void>\n type: 'coreApp' | 'studio'\n}\n\n/**\n * Runs a deploy in the mode the flags select: a real deploy fails fast and\n * mutates, `--dry-run` drives the same `run` sequence read-only and renders a\n * plan, and `--json` emits the same information as machine-readable JSON.\n */\nexport async function runDeploy(options: DeployAppOptions, spec: DeploySpec): Promise<void> {\n const {output} = options\n const json = !!options.flags.json\n\n // The JSON payload owns stdout, so the run's progress logs go to stderr; only\n // the final JSON.stringify writes to stdout. Spinners are already on stderr.\n const runOptions = json\n ? {\n ...options,\n output: {\n ...output,\n log: (message = '', ...args: unknown[]) =>\n void process.stderr.write(`${format(message, ...args)}\\n`),\n },\n }\n : options\n\n try {\n if (options.flags['dry-run']) {\n const plan = await collectPlan(runOptions, spec)\n if (json) output.log(JSON.stringify(deploymentPlanToJson(plan), null, 2))\n else renderDeploymentPlan(plan, output)\n exitIfBlocked(plan, output)\n return\n }\n\n const result = await spec.run(runOptions, createFailFastReporter(runOptions.output))\n if (json && result) output.log(JSON.stringify({deployed: true, ...result}, null, 2))\n } catch (error) {\n // Failures signal via exit code and stderr, like every other command no JSON on stdout.\n normalizeDeployError(error, output, spec.type)\n }\n}\n\n/** Runs the step sequence read-only and gathers the plan a dry run reports. */\nasync function collectPlan(options: DeployAppOptions, spec: DeploySpec): Promise<DeploymentPlan> {\n const reporter = createCollectingReporter()\n await spec.run(options, reporter)\n const plan: DeploymentPlan = {\n checks: reporter.results,\n files: [],\n target: reporter.results.find((check) => check.target)?.target ?? null,\n type: spec.type,\n version: reporter.results.find((check) => check.version)?.version ?? null,\n }\n // A blocked deploy uploads nothing, so only enumerate files for a deployable plan.\n if (isDeployable(plan)) plan.files = await spec.listFiles(options)\n return plan\n}\n\n/** Exits like a real (fail-fast) deploy would, on the first failing check's exit code. */\nfunction exitIfBlocked(plan: DeploymentPlan, output: Output): void {\n if (isDeployable(plan)) return\n const failed = plan.checks.find((check) => check.status === 'fail')\n output.error('Deploy blocked by failing checks.', {exit: failed?.exitCode ?? 1})\n}\n\nfunction normalizeDeployError(error: unknown, output: Output, type: 'coreApp' | 'studio'): void {\n const noun = type === 'coreApp' ? 'application' : 'studio'\n\n // Ctrl+C on an interactive prompt isn't a real failure\n if (error instanceof Error && error.name === 'ExitPromptError') {\n output.error('Deployment cancelled by user', {exit: 1})\n return\n }\n // A failed check already carries its own message and exit code; rethrow untouched\n if (error instanceof CLIError) throw error\n deployDebug(`Error deploying ${noun}`, error)\n output.error(`Error deploying ${noun}: ${error}`, {exit: 1})\n}\n"],"names":["format","CLIError","createCollectingReporter","createFailFastReporter","deployDebug","deploymentPlanToJson","isDeployable","renderDeploymentPlan","runDeploy","options","spec","output","json","flags","runOptions","log","message","args","process","stderr","write","plan","collectPlan","JSON","stringify","exitIfBlocked","result","run","deployed","error","normalizeDeployError","type","reporter","checks","results","files","target","find","check","version","listFiles","failed","status","exit","exitCode","noun","Error","name"],"mappings":"AAAA,SAAQA,MAAM,QAAO,YAAW;AAEhC,SAAQC,QAAQ,QAAO,qBAAoB;AAG3C,SAEEC,wBAAwB,EACxBC,sBAAsB,QAEjB,oBAAmB;AAC1B,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAGEC,oBAAoB,EACpBC,YAAY,EACZC,oBAAoB,QACf,sBAAqB;AA+B5B;;;;CAIC,GACD,OAAO,eAAeC,UAAUC,OAAyB,EAAEC,IAAgB;IACzE,MAAM,EAACC,MAAM,EAAC,GAAGF;IACjB,MAAMG,OAAO,CAAC,CAACH,QAAQI,KAAK,CAACD,IAAI;IAEjC,8EAA8E;IAC9E,6EAA6E;IAC7E,MAAME,aAAaF,OACf;QACE,GAAGH,OAAO;QACVE,QAAQ;YACN,GAAGA,MAAM;YACTI,KAAK,CAACC,UAAU,EAAE,EAAE,GAAGC,OACrB,KAAKC,QAAQC,MAAM,CAACC,KAAK,CAAC,GAAGpB,OAAOgB,YAAYC,MAAM,EAAE,CAAC;QAC7D;IACF,IACAR;IAEJ,IAAI;QACF,IAAIA,QAAQI,KAAK,CAAC,UAAU,EAAE;YAC5B,MAAMQ,OAAO,MAAMC,YAAYR,YAAYJ;YAC3C,IAAIE,MAAMD,OAAOI,GAAG,CAACQ,KAAKC,SAAS,CAACnB,qBAAqBgB,OAAO,MAAM;iBACjEd,qBAAqBc,MAAMV;YAChCc,cAAcJ,MAAMV;YACpB;QACF;QAEA,MAAMe,SAAS,MAAMhB,KAAKiB,GAAG,CAACb,YAAYX,uBAAuBW,WAAWH,MAAM;QAClF,IAAIC,QAAQc,QAAQf,OAAOI,GAAG,CAACQ,KAAKC,SAAS,CA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,EAAEhB;IACvClB,OAAOkB,KAAK,CAAC,CAAC,gBAAgB,EAAEgB,KAAK,EAAE,EAAEhB,OAAO,EAAE;QAACc,MAAM;IAAC;AAC5D"}
1
+ {"version":3,"sources":["../../../src/actions/deploy/deployRunner.ts"],"sourcesContent":["import {format} from 'node:util'\n\nimport {CLIError} from '@oclif/core/errors'\nimport {type Output} from '@sanity/cli-core'\n\nimport {getErrorMessage} from '../../util/getErrorMessage.js'\nimport {\n type CheckReporter,\n createCollectingReporter,\n createFailFastReporter,\n type DeployTarget,\n} from './deployChecks.js'\nimport {deployDebug} from './deployDebug.js'\nimport {\n type DeploymentFile,\n type DeploymentPlan,\n deploymentPlanToJson,\n isDeployable,\n renderDeploymentPlan,\n} from './deploymentPlan.js'\nimport {type DeployAppOptions} from './types.js'\n\n/** What a real deploy produced — the payload `--json` reports. */\nexport interface DeployResult {\n applicationType: 'coreApp' | 'studio'\n /** Installed framework version the deploy used (`sanity` or `@sanity/sdk-react`). */\n applicationVersion: string\n /**\n * The deployed application/studio, in the same shape the dry-run plan reports\n * so the two modes can't drift; `null` for a config-only singleton deploy.\n */\n target: DeployTarget | null\n\n /** Set when a media-library singleton deployed its installation config. */\n installationId?: string\n}\n\n/**\n * The parts of a deploy that differ between core apps and studios. The shared\n * sequence — mode selection, error handling, the dry-run plan, `--json` — lives\n * in `runDeploy`.\n */\nexport interface DeploySpec {\n /** Files a real deploy would upload, listed only for the dry-run plan. */\n listFiles: (options: DeployAppOptions) => Promise<DeploymentFile[]>\n /** The step sequence; every step reports through `reporter`. */\n run: (options: DeployAppOptions, reporter: CheckReporter) => Promise<DeployResult | void>\n type: 'coreApp' | 'studio'\n}\n\n/**\n * Runs a deploy in the mode the flags select: a real deploy fails fast and\n * mutates, `--dry-run` drives the same `run` sequence read-only and renders a\n * plan, and `--json` emits the same information as machine-readable JSON.\n */\nexport async function runDeploy(options: DeployAppOptions, spec: DeploySpec): Promise<void> {\n const {output} = options\n const json = !!options.flags.json\n const emitJson = (payload: unknown) => output.log(JSON.stringify(payload, null, 2))\n\n // The JSON payload owns stdout, so the run's progress logs go to stderr; only\n // the final JSON.stringify writes to stdout. Spinners are already on stderr.\n const runOptions = json\n ? {\n ...options,\n output: {\n ...output,\n log: (message = '', ...args: unknown[]) =>\n void process.stderr.write(`${format(message, ...args)}\\n`),\n },\n }\n : options\n\n try {\n if (options.flags['dry-run']) {\n const plan = await collectPlan(runOptions, spec)\n if (json) emitJson(deploymentPlanToJson(plan))\n else renderDeploymentPlan(plan, output)\n exitIfBlocked(plan, output)\n return\n }\n\n const result = await spec.run(runOptions, createFailFastReporter(runOptions.output))\n if (json && result) emitJson({deployed: true, ...result})\n } catch (error) {\n const failure = normalizeFailure(error, spec.type)\n // A blocked dry run reaches this catch too (its exit throws) and already\n // printed its plan, so only a real deploy adds the {deployed: false} envelope.\n if (json && !options.flags['dry-run']) {\n emitJson({deployed: false, error: {message: failure.message}})\n }\n output.error(failure.message, {exit: failure.exit})\n }\n}\n\n/** Runs the step sequence read-only and gathers the plan a dry run reports. */\nasync function collectPlan(options: DeployAppOptions, spec: DeploySpec): Promise<DeploymentPlan> {\n const reporter = createCollectingReporter()\n await spec.run(options, reporter)\n const plan: DeploymentPlan = {\n checks: reporter.results,\n files: [],\n target: reporter.results.find((check) => check.target)?.target ?? null,\n type: spec.type,\n version: reporter.results.find((check) => check.version)?.version ?? null,\n }\n // A blocked deploy uploads nothing, so only enumerate files for a deployable plan.\n if (isDeployable(plan)) plan.files = await spec.listFiles(options)\n return plan\n}\n\n/** Exits like a real (fail-fast) deploy would, on the first failing check's exit code. */\nfunction exitIfBlocked(plan: DeploymentPlan, output: Output): void {\n if (isDeployable(plan)) return\n const failed = plan.checks.find((check) => check.status === 'fail')\n output.error('Deploy blocked by failing checks.', {exit: failed?.exitCode ?? 1})\n}\n\n/** The one failure diagnosis both the stderr message and the `--json` envelope read. */\nfunction normalizeFailure(\n error: unknown,\n type: 'coreApp' | 'studio',\n): {exit: number; message: string} {\n // Ctrl+C on an interactive prompt isn't a real failure\n if (error instanceof Error && error.name === 'ExitPromptError') {\n return {exit: 1, message: 'Deployment cancelled by user'}\n }\n // A failed check already carries its own message and exit code\n if (error instanceof CLIError) {\n return {exit: error.oclif?.exit ?? 1, message: error.message}\n }\n deployDebug(`Error deploying ${type === 'coreApp' ? 'application' : 'studio'}`, error)\n return {\n exit: 1,\n message: `Error deploying ${type === 'coreApp' ? 'application' : 'studio'}: ${getErrorMessage(error)}`,\n }\n}\n"],"names":["format","CLIError","getErrorMessage","createCollectingReporter","createFailFastReporter","deployDebug","deploymentPlanToJson","isDeployable","renderDeploymentPlan","runDeploy","options","spec","output","json","flags","emitJson","payload","log","JSON","stringify","runOptions","message","args","process","stderr","write","plan","collectPlan","exitIfBlocked","result","run","deployed","error","failure","normalizeFailure","type","exit","reporter","checks","results","files","target","find","check","version","listFiles","failed","status","exitCode","Error","name","oclif"],"mappings":"AAAA,SAAQA,MAAM,QAAO,YAAW;AAEhC,SAAQC,QAAQ,QAAO,qBAAoB;AAG3C,SAAQC,eAAe,QAAO,gCAA+B;AAC7D,SAEEC,wBAAwB,EACxBC,sBAAsB,QAEjB,oBAAmB;AAC1B,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAGEC,oBAAoB,EACpBC,YAAY,EACZC,oBAAoB,QACf,sBAAqB;AA+B5B;;;;CAIC,GACD,OAAO,eAAeC,UAAUC,OAAyB,EAAEC,IAAgB;IACzE,MAAM,EAACC,MAAM,EAAC,GAAGF;IACjB,MAAMG,OAAO,CAAC,CAACH,QAAQI,KAAK,CAACD,IAAI;IACjC,MAAME,WAAW,CAACC,UAAqBJ,OAAOK,GAAG,CAACC,KAAKC,SAAS,CAACH,SAAS,MAAM;IAEhF,8EAA8E;IAC9E,6EAA6E;IAC7E,MAAMI,aAAaP,OACf;QACE,GAAGH,OAAO;QACVE,QAAQ;YACN,GAAGA,MAAM;YACTK,KAAK,CAACI,UAAU,EAAE,EAAE,GAAGC,OACrB,KAAKC,QAAQC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K,GAAG,MAAM7B,KAAKkC,SAAS,CAACnC;IAC1D,OAAOgB;AACT;AAEA,wFAAwF,GACxF,SAASE,cAAcF,IAAoB,EAAEd,MAAc;IACzD,IAAIL,aAAamB,OAAO;IACxB,MAAMoB,SAASpB,KAAKY,MAAM,CAACI,IAAI,CAAC,CAACC,QAAUA,MAAMI,MAAM,KAAK;IAC5DnC,OAAOoB,KAAK,CAAC,qCAAqC;QAACI,MAAMU,QAAQE,YAAY;IAAC;AAChF;AAEA,sFAAsF,GACtF,SAASd,iBACPF,KAAc,EACdG,IAA0B;IAE1B,uDAAuD;IACvD,IAAIH,iBAAiBiB,SAASjB,MAAMkB,IAAI,KAAK,mBAAmB;QAC9D,OAAO;YAACd,MAAM;YAAGf,SAAS;QAA8B;IAC1D;IACA,+DAA+D;IAC/D,IAAIW,iBAAiB/B,UAAU;QAC7B,OAAO;YAACmC,MAAMJ,MAAMmB,KAAK,EAAEf,QAAQ;YAAGf,SAASW,MAAMX,OAAO;QAAA;IAC9D;IACAhB,YAAY,CAAC,gBAAgB,EAAE8B,SAAS,YAAY,gBAAgB,UAAU,EAAEH;IAChF,OAAO;QACLI,MAAM;QACNf,SAAS,CAAC,gBAAgB,EAAEc,SAAS,YAAY,gBAAgB,SAAS,EAAE,EAAEjC,gBAAgB8B,QAAQ;IACxG;AACF"}
@@ -4652,26 +4652,43 @@
4652
4652
  "list.js"
4653
4653
  ]
4654
4654
  },
4655
- "datasets:embeddings:disable": {
4655
+ "datasets:alias:create": {
4656
4656
  "aliases": [],
4657
4657
  "args": {
4658
- "dataset": {
4659
- "description": "Dataset name to disable embeddings for",
4660
- "name": "dataset",
4658
+ "aliasName": {
4659
+ "description": "Dataset alias name to create",
4660
+ "name": "aliasName",
4661
+ "required": false
4662
+ },
4663
+ "targetDataset": {
4664
+ "description": "Target dataset name to link the alias to",
4665
+ "name": "targetDataset",
4661
4666
  "required": false
4662
4667
  }
4663
4668
  },
4664
- "description": "Disable embeddings for a dataset",
4669
+ "description": "Create a dataset alias for the project",
4665
4670
  "examples": [
4666
4671
  {
4667
- "command": "<%= config.bin %> <%= command.id %> production",
4668
- "description": "Disable embeddings for the production dataset"
4672
+ "command": "<%= config.bin %> <%= command.id %> --project-id abc123 conference conf-2025",
4673
+ "description": "Create alias in a specific project"
4674
+ },
4675
+ {
4676
+ "command": "<%= config.bin %> <%= command.id %>",
4677
+ "description": "Create an alias with interactive prompts"
4678
+ },
4679
+ {
4680
+ "command": "<%= config.bin %> <%= command.id %> conference",
4681
+ "description": "Create alias named \"conference\" with interactive dataset selection"
4682
+ },
4683
+ {
4684
+ "command": "<%= config.bin %> <%= command.id %> conference conf-2025",
4685
+ "description": "Create alias \"conference\" linked to \"conf-2025\" dataset"
4669
4686
  }
4670
4687
  ],
4671
4688
  "flags": {
4672
4689
  "project-id": {
4673
4690
  "char": "p",
4674
- "description": "Project ID to disable embeddings for (overrides CLI configuration)",
4691
+ "description": "Project ID to create dataset alias in (overrides CLI configuration)",
4675
4692
  "helpGroup": "OVERRIDE",
4676
4693
  "name": "project-id",
4677
4694
  "hasDynamicHelp": false,
@@ -4682,9 +4699,9 @@
4682
4699
  },
4683
4700
  "hasDynamicHelp": false,
4684
4701
  "hiddenAliases": [
4685
- "dataset:embeddings:disable"
4702
+ "dataset:alias:create"
4686
4703
  ],
4687
- "id": "datasets:embeddings:disable",
4704
+ "id": "datasets:alias:create",
4688
4705
  "pluginAlias": "@sanity/cli",
4689
4706
  "pluginName": "@sanity/cli",
4690
4707
  "pluginType": "core",
@@ -4694,38 +4711,34 @@
4694
4711
  "dist",
4695
4712
  "commands",
4696
4713
  "datasets",
4697
- "embeddings",
4698
- "disable.js"
4714
+ "alias",
4715
+ "create.js"
4699
4716
  ]
4700
4717
  },
4701
- "datasets:embeddings:enable": {
4718
+ "datasets:alias:delete": {
4702
4719
  "aliases": [],
4703
4720
  "args": {
4704
- "dataset": {
4705
- "description": "Dataset name to enable embeddings for",
4706
- "name": "dataset",
4707
- "required": false
4721
+ "aliasName": {
4722
+ "description": "Dataset alias name to delete",
4723
+ "name": "aliasName",
4724
+ "required": true
4708
4725
  }
4709
4726
  },
4710
- "description": "Enable embeddings for a dataset",
4727
+ "description": "Delete a dataset alias from the project",
4711
4728
  "examples": [
4712
4729
  {
4713
- "command": "<%= config.bin %> <%= command.id %> production",
4714
- "description": "Enable embeddings for the production dataset"
4715
- },
4716
- {
4717
- "command": "<%= config.bin %> <%= command.id %> production --projection \"{ title, body }\"",
4718
- "description": "Enable embeddings with a specific projection"
4730
+ "command": "<%= config.bin %> <%= command.id %> conference",
4731
+ "description": "Delete alias named \"conference\" with confirmation prompt"
4719
4732
  },
4720
4733
  {
4721
- "command": "<%= config.bin %> <%= command.id %> production --wait",
4722
- "description": "Enable embeddings and wait for processing to complete"
4734
+ "command": "<%= config.bin %> <%= command.id %> conference --force",
4735
+ "description": "Delete alias named \"conference\" without confirmation prompt"
4723
4736
  }
4724
4737
  ],
4725
4738
  "flags": {
4726
4739
  "project-id": {
4727
4740
  "char": "p",
4728
- "description": "Project ID to enable embeddings for (overrides CLI configuration)",
4741
+ "description": "Project ID to delete dataset alias from (overrides CLI configuration)",
4729
4742
  "helpGroup": "OVERRIDE",
4730
4743
  "name": "project-id",
4731
4744
  "hasDynamicHelp": false,
@@ -4733,26 +4746,19 @@
4733
4746
  "multiple": false,
4734
4747
  "type": "option"
4735
4748
  },
4736
- "projection": {
4737
- "description": "GROQ projection defining which fields to embed (e.g. \"{ title, body }\")",
4738
- "name": "projection",
4749
+ "force": {
4750
+ "description": "Skip confirmation prompt and delete immediately",
4751
+ "name": "force",
4739
4752
  "required": false,
4740
- "hasDynamicHelp": false,
4741
- "multiple": false,
4742
- "type": "option"
4743
- },
4744
- "wait": {
4745
- "description": "Wait for embeddings processing to complete before returning",
4746
- "name": "wait",
4747
4753
  "allowNo": false,
4748
4754
  "type": "boolean"
4749
4755
  }
4750
4756
  },
4751
4757
  "hasDynamicHelp": false,
4752
4758
  "hiddenAliases": [
4753
- "dataset:embeddings:enable"
4759
+ "dataset:alias:delete"
4754
4760
  ],
4755
- "id": "datasets:embeddings:enable",
4761
+ "id": "datasets:alias:delete",
4756
4762
  "pluginAlias": "@sanity/cli",
4757
4763
  "pluginName": "@sanity/cli",
4758
4764
  "pluginType": "core",
@@ -4762,43 +4768,67 @@
4762
4768
  "dist",
4763
4769
  "commands",
4764
4770
  "datasets",
4765
- "embeddings",
4766
- "enable.js"
4771
+ "alias",
4772
+ "delete.js"
4767
4773
  ]
4768
4774
  },
4769
- "datasets:embeddings:status": {
4775
+ "datasets:alias:link": {
4770
4776
  "aliases": [],
4771
4777
  "args": {
4772
- "dataset": {
4773
- "description": "The name of the dataset to check embeddings status for",
4774
- "name": "dataset",
4778
+ "aliasName": {
4779
+ "description": "Dataset alias name to link",
4780
+ "name": "aliasName",
4781
+ "required": false
4782
+ },
4783
+ "targetDataset": {
4784
+ "description": "Target dataset name to link the alias to",
4785
+ "name": "targetDataset",
4775
4786
  "required": false
4776
4787
  }
4777
4788
  },
4778
- "description": "Show embeddings settings and status for a dataset",
4789
+ "description": "Link a dataset alias to a dataset in the project",
4779
4790
  "examples": [
4780
4791
  {
4781
- "command": "<%= config.bin %> <%= command.id %> production",
4782
- "description": "Show embeddings status for the production dataset"
4792
+ "command": "<%= config.bin %> <%= command.id %>",
4793
+ "description": "Link an alias with interactive prompts"
4794
+ },
4795
+ {
4796
+ "command": "<%= config.bin %> <%= command.id %> conference",
4797
+ "description": "Link alias named \"conference\" with interactive dataset selection"
4798
+ },
4799
+ {
4800
+ "command": "<%= config.bin %> <%= command.id %> conference conf-2025",
4801
+ "description": "Link alias \"conference\" to \"conf-2025\" dataset"
4802
+ },
4803
+ {
4804
+ "command": "<%= config.bin %> <%= command.id %> conference conf-2025 --force",
4805
+ "description": "Force link without confirmation (skip relink prompt)"
4783
4806
  }
4784
4807
  ],
4785
4808
  "flags": {
4786
4809
  "project-id": {
4787
4810
  "char": "p",
4788
- "description": "Project ID to check embeddings status for (overrides CLI configuration)",
4811
+ "description": "Project ID to link dataset alias in (overrides CLI configuration)",
4789
4812
  "helpGroup": "OVERRIDE",
4790
4813
  "name": "project-id",
4791
4814
  "hasDynamicHelp": false,
4792
4815
  "helpValue": "<id>",
4793
4816
  "multiple": false,
4794
4817
  "type": "option"
4818
+ },
4819
+ "force": {
4820
+ "description": "Skip confirmation prompt when relinking existing alias",
4821
+ "name": "force",
4822
+ "required": false,
4823
+ "allowNo": false,
4824
+ "type": "boolean"
4795
4825
  }
4796
4826
  },
4797
4827
  "hasDynamicHelp": false,
4798
4828
  "hiddenAliases": [
4799
- "dataset:embeddings:status"
4829
+ "dataset:alias:link"
4800
4830
  ],
4801
- "id": "datasets:embeddings:status",
4831
+ "id": "datasets:alias:link",
4802
4832
  "pluginAlias": "@sanity/cli",
4803
4833
  "pluginName": "@sanity/cli",
4804
4834
  "pluginType": "core",
@@ -4808,43 +4838,58 @@
4808
4838
  "dist",
4809
4839
  "commands",
4810
4840
  "datasets",
4811
- "embeddings",
4812
- "status.js"
4841
+ "alias",
4842
+ "link.js"
4813
4843
  ]
4814
4844
  },
4815
- "datasets:visibility:get": {
4845
+ "datasets:alias:unlink": {
4816
4846
  "aliases": [],
4817
4847
  "args": {
4818
- "dataset": {
4819
- "description": "The name of the dataset to get visibility for",
4820
- "name": "dataset",
4821
- "required": true
4848
+ "aliasName": {
4849
+ "description": "Dataset alias name to unlink",
4850
+ "name": "aliasName",
4851
+ "required": false
4822
4852
  }
4823
4853
  },
4824
- "description": "Get the visibility of a dataset",
4854
+ "description": "Unlink a dataset alias from its dataset in the project",
4825
4855
  "examples": [
4826
4856
  {
4827
- "command": "<%= config.bin %> <%= command.id %> my-dataset",
4828
- "description": "Check the visibility of a dataset"
4857
+ "command": "<%= config.bin %> <%= command.id %>",
4858
+ "description": "Unlink an alias with interactive selection"
4859
+ },
4860
+ {
4861
+ "command": "<%= config.bin %> <%= command.id %> conference",
4862
+ "description": "Unlink alias \"conference\" with confirmation prompt"
4863
+ },
4864
+ {
4865
+ "command": "<%= config.bin %> <%= command.id %> conference --force",
4866
+ "description": "Unlink alias \"conference\" without confirmation prompt"
4829
4867
  }
4830
4868
  ],
4831
4869
  "flags": {
4832
4870
  "project-id": {
4833
4871
  "char": "p",
4834
- "description": "Project ID to get dataset visibility for (overrides CLI configuration)",
4872
+ "description": "Project ID to unlink dataset alias in (overrides CLI configuration)",
4835
4873
  "helpGroup": "OVERRIDE",
4836
4874
  "name": "project-id",
4837
4875
  "hasDynamicHelp": false,
4838
4876
  "helpValue": "<id>",
4839
4877
  "multiple": false,
4840
4878
  "type": "option"
4879
+ },
4880
+ "force": {
4881
+ "description": "Skip confirmation prompt and unlink immediately",
4882
+ "name": "force",
4883
+ "required": false,
4884
+ "allowNo": false,
4885
+ "type": "boolean"
4841
4886
  }
4842
4887
  },
4843
4888
  "hasDynamicHelp": false,
4844
4889
  "hiddenAliases": [
4845
- "dataset:visibility:get"
4890
+ "dataset:alias:unlink"
4846
4891
  ],
4847
- "id": "datasets:visibility:get",
4892
+ "id": "datasets:alias:unlink",
4848
4893
  "pluginAlias": "@sanity/cli",
4849
4894
  "pluginName": "@sanity/cli",
4850
4895
  "pluginType": "core",
@@ -4854,43 +4899,30 @@
4854
4899
  "dist",
4855
4900
  "commands",
4856
4901
  "datasets",
4857
- "visibility",
4858
- "get.js"
4902
+ "alias",
4903
+ "unlink.js"
4859
4904
  ]
4860
4905
  },
4861
- "datasets:visibility:set": {
4906
+ "datasets:embeddings:disable": {
4862
4907
  "aliases": [],
4863
4908
  "args": {
4864
4909
  "dataset": {
4865
- "description": "The name of the dataset to set visibility for",
4910
+ "description": "Dataset name to disable embeddings for",
4866
4911
  "name": "dataset",
4867
- "required": true
4868
- },
4869
- "mode": {
4870
- "description": "The visibility mode to set",
4871
- "name": "mode",
4872
- "options": [
4873
- "public",
4874
- "private"
4875
- ],
4876
- "required": true
4912
+ "required": false
4877
4913
  }
4878
4914
  },
4879
- "description": "Set the visibility of a dataset",
4915
+ "description": "Disable embeddings for a dataset",
4880
4916
  "examples": [
4881
4917
  {
4882
- "command": "<%= config.bin %> <%= command.id %> my-dataset private",
4883
- "description": "Make a dataset private"
4884
- },
4885
- {
4886
- "command": "<%= config.bin %> <%= command.id %> my-dataset public",
4887
- "description": "Make a dataset public"
4918
+ "command": "<%= config.bin %> <%= command.id %> production",
4919
+ "description": "Disable embeddings for the production dataset"
4888
4920
  }
4889
4921
  ],
4890
4922
  "flags": {
4891
4923
  "project-id": {
4892
4924
  "char": "p",
4893
- "description": "Project ID to set dataset visibility for (overrides CLI configuration)",
4925
+ "description": "Project ID to disable embeddings for (overrides CLI configuration)",
4894
4926
  "helpGroup": "OVERRIDE",
4895
4927
  "name": "project-id",
4896
4928
  "hasDynamicHelp": false,
@@ -4901,9 +4933,9 @@
4901
4933
  },
4902
4934
  "hasDynamicHelp": false,
4903
4935
  "hiddenAliases": [
4904
- "dataset:visibility:set"
4936
+ "dataset:embeddings:disable"
4905
4937
  ],
4906
- "id": "datasets:visibility:set",
4938
+ "id": "datasets:embeddings:disable",
4907
4939
  "pluginAlias": "@sanity/cli",
4908
4940
  "pluginName": "@sanity/cli",
4909
4941
  "pluginType": "core",
@@ -4913,60 +4945,65 @@
4913
4945
  "dist",
4914
4946
  "commands",
4915
4947
  "datasets",
4916
- "visibility",
4917
- "set.js"
4948
+ "embeddings",
4949
+ "disable.js"
4918
4950
  ]
4919
4951
  },
4920
- "datasets:alias:create": {
4952
+ "datasets:embeddings:enable": {
4921
4953
  "aliases": [],
4922
4954
  "args": {
4923
- "aliasName": {
4924
- "description": "Dataset alias name to create",
4925
- "name": "aliasName",
4926
- "required": false
4927
- },
4928
- "targetDataset": {
4929
- "description": "Target dataset name to link the alias to",
4930
- "name": "targetDataset",
4955
+ "dataset": {
4956
+ "description": "Dataset name to enable embeddings for",
4957
+ "name": "dataset",
4931
4958
  "required": false
4932
4959
  }
4933
4960
  },
4934
- "description": "Create a dataset alias for the project",
4961
+ "description": "Enable embeddings for a dataset",
4935
4962
  "examples": [
4936
4963
  {
4937
- "command": "<%= config.bin %> <%= command.id %> --project-id abc123 conference conf-2025",
4938
- "description": "Create alias in a specific project"
4939
- },
4940
- {
4941
- "command": "<%= config.bin %> <%= command.id %>",
4942
- "description": "Create an alias with interactive prompts"
4964
+ "command": "<%= config.bin %> <%= command.id %> production",
4965
+ "description": "Enable embeddings for the production dataset"
4943
4966
  },
4944
4967
  {
4945
- "command": "<%= config.bin %> <%= command.id %> conference",
4946
- "description": "Create alias named \"conference\" with interactive dataset selection"
4968
+ "command": "<%= config.bin %> <%= command.id %> production --projection \"{ title, body }\"",
4969
+ "description": "Enable embeddings with a specific projection"
4947
4970
  },
4948
4971
  {
4949
- "command": "<%= config.bin %> <%= command.id %> conference conf-2025",
4950
- "description": "Create alias \"conference\" linked to \"conf-2025\" dataset"
4972
+ "command": "<%= config.bin %> <%= command.id %> production --wait",
4973
+ "description": "Enable embeddings and wait for processing to complete"
4951
4974
  }
4952
4975
  ],
4953
4976
  "flags": {
4954
4977
  "project-id": {
4955
4978
  "char": "p",
4956
- "description": "Project ID to create dataset alias in (overrides CLI configuration)",
4979
+ "description": "Project ID to enable embeddings for (overrides CLI configuration)",
4957
4980
  "helpGroup": "OVERRIDE",
4958
4981
  "name": "project-id",
4959
4982
  "hasDynamicHelp": false,
4960
4983
  "helpValue": "<id>",
4961
4984
  "multiple": false,
4962
4985
  "type": "option"
4986
+ },
4987
+ "projection": {
4988
+ "description": "GROQ projection defining which fields to embed (e.g. \"{ title, body }\")",
4989
+ "name": "projection",
4990
+ "required": false,
4991
+ "hasDynamicHelp": false,
4992
+ "multiple": false,
4993
+ "type": "option"
4994
+ },
4995
+ "wait": {
4996
+ "description": "Wait for embeddings processing to complete before returning",
4997
+ "name": "wait",
4998
+ "allowNo": false,
4999
+ "type": "boolean"
4963
5000
  }
4964
5001
  },
4965
5002
  "hasDynamicHelp": false,
4966
5003
  "hiddenAliases": [
4967
- "dataset:alias:create"
5004
+ "dataset:embeddings:enable"
4968
5005
  ],
4969
- "id": "datasets:alias:create",
5006
+ "id": "datasets:embeddings:enable",
4970
5007
  "pluginAlias": "@sanity/cli",
4971
5008
  "pluginName": "@sanity/cli",
4972
5009
  "pluginType": "core",
@@ -4976,54 +5013,43 @@
4976
5013
  "dist",
4977
5014
  "commands",
4978
5015
  "datasets",
4979
- "alias",
4980
- "create.js"
5016
+ "embeddings",
5017
+ "enable.js"
4981
5018
  ]
4982
5019
  },
4983
- "datasets:alias:delete": {
5020
+ "datasets:embeddings:status": {
4984
5021
  "aliases": [],
4985
5022
  "args": {
4986
- "aliasName": {
4987
- "description": "Dataset alias name to delete",
4988
- "name": "aliasName",
4989
- "required": true
5023
+ "dataset": {
5024
+ "description": "The name of the dataset to check embeddings status for",
5025
+ "name": "dataset",
5026
+ "required": false
4990
5027
  }
4991
5028
  },
4992
- "description": "Delete a dataset alias from the project",
5029
+ "description": "Show embeddings settings and status for a dataset",
4993
5030
  "examples": [
4994
5031
  {
4995
- "command": "<%= config.bin %> <%= command.id %> conference",
4996
- "description": "Delete alias named \"conference\" with confirmation prompt"
4997
- },
4998
- {
4999
- "command": "<%= config.bin %> <%= command.id %> conference --force",
5000
- "description": "Delete alias named \"conference\" without confirmation prompt"
5032
+ "command": "<%= config.bin %> <%= command.id %> production",
5033
+ "description": "Show embeddings status for the production dataset"
5001
5034
  }
5002
5035
  ],
5003
5036
  "flags": {
5004
5037
  "project-id": {
5005
5038
  "char": "p",
5006
- "description": "Project ID to delete dataset alias from (overrides CLI configuration)",
5039
+ "description": "Project ID to check embeddings status for (overrides CLI configuration)",
5007
5040
  "helpGroup": "OVERRIDE",
5008
5041
  "name": "project-id",
5009
5042
  "hasDynamicHelp": false,
5010
5043
  "helpValue": "<id>",
5011
5044
  "multiple": false,
5012
5045
  "type": "option"
5013
- },
5014
- "force": {
5015
- "description": "Skip confirmation prompt and delete immediately",
5016
- "name": "force",
5017
- "required": false,
5018
- "allowNo": false,
5019
- "type": "boolean"
5020
5046
  }
5021
5047
  },
5022
5048
  "hasDynamicHelp": false,
5023
5049
  "hiddenAliases": [
5024
- "dataset:alias:delete"
5050
+ "dataset:embeddings:status"
5025
5051
  ],
5026
- "id": "datasets:alias:delete",
5052
+ "id": "datasets:embeddings:status",
5027
5053
  "pluginAlias": "@sanity/cli",
5028
5054
  "pluginName": "@sanity/cli",
5029
5055
  "pluginType": "core",
@@ -5033,67 +5059,43 @@
5033
5059
  "dist",
5034
5060
  "commands",
5035
5061
  "datasets",
5036
- "alias",
5037
- "delete.js"
5062
+ "embeddings",
5063
+ "status.js"
5038
5064
  ]
5039
5065
  },
5040
- "datasets:alias:link": {
5066
+ "datasets:visibility:get": {
5041
5067
  "aliases": [],
5042
5068
  "args": {
5043
- "aliasName": {
5044
- "description": "Dataset alias name to link",
5045
- "name": "aliasName",
5046
- "required": false
5047
- },
5048
- "targetDataset": {
5049
- "description": "Target dataset name to link the alias to",
5050
- "name": "targetDataset",
5051
- "required": false
5069
+ "dataset": {
5070
+ "description": "The name of the dataset to get visibility for",
5071
+ "name": "dataset",
5072
+ "required": true
5052
5073
  }
5053
5074
  },
5054
- "description": "Link a dataset alias to a dataset in the project",
5075
+ "description": "Get the visibility of a dataset",
5055
5076
  "examples": [
5056
5077
  {
5057
- "command": "<%= config.bin %> <%= command.id %>",
5058
- "description": "Link an alias with interactive prompts"
5059
- },
5060
- {
5061
- "command": "<%= config.bin %> <%= command.id %> conference",
5062
- "description": "Link alias named \"conference\" with interactive dataset selection"
5063
- },
5064
- {
5065
- "command": "<%= config.bin %> <%= command.id %> conference conf-2025",
5066
- "description": "Link alias \"conference\" to \"conf-2025\" dataset"
5067
- },
5068
- {
5069
- "command": "<%= config.bin %> <%= command.id %> conference conf-2025 --force",
5070
- "description": "Force link without confirmation (skip relink prompt)"
5078
+ "command": "<%= config.bin %> <%= command.id %> my-dataset",
5079
+ "description": "Check the visibility of a dataset"
5071
5080
  }
5072
5081
  ],
5073
5082
  "flags": {
5074
5083
  "project-id": {
5075
5084
  "char": "p",
5076
- "description": "Project ID to link dataset alias in (overrides CLI configuration)",
5085
+ "description": "Project ID to get dataset visibility for (overrides CLI configuration)",
5077
5086
  "helpGroup": "OVERRIDE",
5078
5087
  "name": "project-id",
5079
5088
  "hasDynamicHelp": false,
5080
5089
  "helpValue": "<id>",
5081
5090
  "multiple": false,
5082
5091
  "type": "option"
5083
- },
5084
- "force": {
5085
- "description": "Skip confirmation prompt when relinking existing alias",
5086
- "name": "force",
5087
- "required": false,
5088
- "allowNo": false,
5089
- "type": "boolean"
5090
5092
  }
5091
5093
  },
5092
5094
  "hasDynamicHelp": false,
5093
5095
  "hiddenAliases": [
5094
- "dataset:alias:link"
5096
+ "dataset:visibility:get"
5095
5097
  ],
5096
- "id": "datasets:alias:link",
5098
+ "id": "datasets:visibility:get",
5097
5099
  "pluginAlias": "@sanity/cli",
5098
5100
  "pluginName": "@sanity/cli",
5099
5101
  "pluginType": "core",
@@ -5103,58 +5105,56 @@
5103
5105
  "dist",
5104
5106
  "commands",
5105
5107
  "datasets",
5106
- "alias",
5107
- "link.js"
5108
+ "visibility",
5109
+ "get.js"
5108
5110
  ]
5109
5111
  },
5110
- "datasets:alias:unlink": {
5112
+ "datasets:visibility:set": {
5111
5113
  "aliases": [],
5112
5114
  "args": {
5113
- "aliasName": {
5114
- "description": "Dataset alias name to unlink",
5115
- "name": "aliasName",
5116
- "required": false
5115
+ "dataset": {
5116
+ "description": "The name of the dataset to set visibility for",
5117
+ "name": "dataset",
5118
+ "required": true
5119
+ },
5120
+ "mode": {
5121
+ "description": "The visibility mode to set",
5122
+ "name": "mode",
5123
+ "options": [
5124
+ "public",
5125
+ "private"
5126
+ ],
5127
+ "required": true
5117
5128
  }
5118
5129
  },
5119
- "description": "Unlink a dataset alias from its dataset in the project",
5130
+ "description": "Set the visibility of a dataset",
5120
5131
  "examples": [
5121
5132
  {
5122
- "command": "<%= config.bin %> <%= command.id %>",
5123
- "description": "Unlink an alias with interactive selection"
5124
- },
5125
- {
5126
- "command": "<%= config.bin %> <%= command.id %> conference",
5127
- "description": "Unlink alias \"conference\" with confirmation prompt"
5133
+ "command": "<%= config.bin %> <%= command.id %> my-dataset private",
5134
+ "description": "Make a dataset private"
5128
5135
  },
5129
5136
  {
5130
- "command": "<%= config.bin %> <%= command.id %> conference --force",
5131
- "description": "Unlink alias \"conference\" without confirmation prompt"
5137
+ "command": "<%= config.bin %> <%= command.id %> my-dataset public",
5138
+ "description": "Make a dataset public"
5132
5139
  }
5133
5140
  ],
5134
5141
  "flags": {
5135
5142
  "project-id": {
5136
5143
  "char": "p",
5137
- "description": "Project ID to unlink dataset alias in (overrides CLI configuration)",
5144
+ "description": "Project ID to set dataset visibility for (overrides CLI configuration)",
5138
5145
  "helpGroup": "OVERRIDE",
5139
5146
  "name": "project-id",
5140
5147
  "hasDynamicHelp": false,
5141
5148
  "helpValue": "<id>",
5142
5149
  "multiple": false,
5143
5150
  "type": "option"
5144
- },
5145
- "force": {
5146
- "description": "Skip confirmation prompt and unlink immediately",
5147
- "name": "force",
5148
- "required": false,
5149
- "allowNo": false,
5150
- "type": "boolean"
5151
5151
  }
5152
5152
  },
5153
5153
  "hasDynamicHelp": false,
5154
5154
  "hiddenAliases": [
5155
- "dataset:alias:unlink"
5155
+ "dataset:visibility:set"
5156
5156
  ],
5157
- "id": "datasets:alias:unlink",
5157
+ "id": "datasets:visibility:set",
5158
5158
  "pluginAlias": "@sanity/cli",
5159
5159
  "pluginName": "@sanity/cli",
5160
5160
  "pluginType": "core",
@@ -5164,10 +5164,10 @@
5164
5164
  "dist",
5165
5165
  "commands",
5166
5166
  "datasets",
5167
- "alias",
5168
- "unlink.js"
5167
+ "visibility",
5168
+ "set.js"
5169
5169
  ]
5170
5170
  }
5171
5171
  },
5172
- "version": "7.7.0"
5172
+ "version": "7.7.1"
5173
5173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "7.7.0",
3
+ "version": "7.7.1",
4
4
  "description": "Sanity CLI tool for managing Sanity projects and organizations",
5
5
  "keywords": [
6
6
  "cli",
@@ -118,9 +118,9 @@
118
118
  "which": "^6.0.1",
119
119
  "yaml": "^2.9.0",
120
120
  "zod": "^4.4.3",
121
- "@sanity/cli-core": "^2.2.1",
122
121
  "@sanity/workbench-cli": "^1.2.0",
123
- "@sanity/cli-build": "^3.0.0"
122
+ "@sanity/cli-build": "^3.0.0",
123
+ "@sanity/cli-core": "^2.2.1"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@eslint/compat": "^2.1.0",
@@ -154,8 +154,8 @@
154
154
  "sanity": "^6.1.0",
155
155
  "typescript": "^5.9.3",
156
156
  "vitest": "^4.1.9",
157
- "@repo/tsconfig": "3.70.0",
158
157
  "@repo/package.config": "0.0.1",
158
+ "@repo/tsconfig": "3.70.0",
159
159
  "@sanity/cli-test": "3.0.1",
160
160
  "@sanity/eslint-config-cli": "1.1.2"
161
161
  },