@sanity/cli 8.13.0 → 8.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +6 -5
  2. package/dist/actions/init/bootstrapLocalTemplate.js +5 -0
  3. package/dist/actions/init/bootstrapLocalTemplate.js.map +1 -1
  4. package/dist/actions/init/initAction.js +11 -3
  5. package/dist/actions/init/initAction.js.map +1 -1
  6. package/dist/actions/init/sdkAppDependencies.js +4 -4
  7. package/dist/actions/init/sdkAppDependencies.js.map +1 -1
  8. package/dist/actions/init/studioDependencies.js +2 -1
  9. package/dist/actions/init/studioDependencies.js.map +1 -1
  10. package/dist/actions/init/templates/appSanityUi.js +1 -1
  11. package/dist/actions/init/templates/appSanityUi.js.map +1 -1
  12. package/dist/actions/init/types.js +1 -1
  13. package/dist/actions/init/types.js.map +1 -1
  14. package/dist/commands/dev.js +1 -1
  15. package/dist/commands/dev.js.map +1 -1
  16. package/dist/commands/init.js +7 -7
  17. package/dist/commands/init.js.map +1 -1
  18. package/dist/generated/apiRoutes.js +2 -0
  19. package/dist/generated/apiRoutes.js.map +1 -1
  20. package/dist/util/update/resolveRunnerPackage.js +1 -1
  21. package/dist/util/update/resolveRunnerPackage.js.map +1 -1
  22. package/dist/util/update/resolveUpdateTarget.js +1 -1
  23. package/dist/util/update/resolveUpdateTarget.js.map +1 -1
  24. package/dist/util/update/updateChecker.js +7 -2
  25. package/dist/util/update/updateChecker.js.map +1 -1
  26. package/dist/util/update/updateCheckerDebug.js +1 -1
  27. package/dist/util/update/updateCheckerDebug.js.map +1 -1
  28. package/oclif.manifest.json +570 -567
  29. package/package.json +7 -7
  30. package/templates/app-sanity-ui/src/App.tsx +8 -8
  31. package/templates/app-sanity-ui/src/ExampleComponent.tsx +1 -1
  32. package/templates/app-sanity-ui/src/SanityUI.tsx +3 -1
  33. package/templates/shared/dashboard/app-quickstart/.claude/skills/sanity-app-sdk/SKILL.md +66 -0
  34. package/templates/shared/dashboard/app-quickstart/AGENTS.md +61 -0
  35. package/templates/shared/dashboard/app-quickstart/README.md +30 -0
  36. package/templates/shared/dashboard/app-sanity-ui/.claude/skills/sanity-app-sdk/SKILL.md +70 -0
  37. package/templates/shared/dashboard/app-sanity-ui/AGENTS.md +65 -0
  38. package/templates/shared/dashboard/app-sanity-ui/README.md +31 -0
  39. package/templates/shared/tsconfig.json +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/generated/apiRoutes.ts"],"sourcesContent":["/**\n * GENERATED FILE - DO NOT EDIT\n *\n * Routing manifest for `sanity api`, distilled from the published OpenAPI\n * specifications at https://www.sanity.io/docs/api/openapi\n *\n * Regenerate with: pnpm generate:api-routes\n */\nimport {type ApiRouteEntry} from '../actions/api/types.js'\n\nexport const apiRoutes: ApiRouteEntry[] = [\n {\n defaultApiVersion: 'v2025-07-11',\n host: 'global',\n pathPatterns: [\n 'access/invites/me',\n 'access/organization/{resourceId}/users/roles/default',\n 'access/requests/me',\n 'access/robots/me',\n 'access/robots/me/rotate',\n 'access/{resourceType}/{resourceId}/invites',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/accept',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/eligibility',\n 'access/{resourceType}/{resourceId}/invites/{inviteId}',\n 'access/{resourceType}/{resourceId}/permissions',\n 'access/{resourceType}/{resourceId}/permissions/{permissionName}',\n 'access/{resourceType}/{resourceId}/requests',\n 'access/{resourceType}/{resourceId}/requests/state',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/accept',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/decline',\n 'access/{resourceType}/{resourceId}/robots',\n 'access/{resourceType}/{resourceId}/robots/{robotId}',\n 'access/{resourceType}/{resourceId}/roles',\n 'access/{resourceType}/{resourceId}/roles/{roleName}',\n 'access/{resourceType}/{resourceId}/user-permissions/me',\n 'access/{resourceType}/{resourceId}/user-permissions/me/check',\n 'access/{resourceType}/{resourceId}/users',\n 'access/{resourceType}/{resourceId}/users/me',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles/{roleName}'\n ],\n slug: 'access-api',\n title: 'Access API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/actions/{dataset}'\n ],\n slug: 'actions',\n title: 'Actions API reference'\n },\n {\n defaultApiVersion: 'v2021-02-01',\n host: 'global',\n pathPatterns: [\n 'activity',\n 'activity/export/csv'\n ],\n slug: 'activity-log',\n title: 'Activity Log API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'agent/action/generate/{dataset}',\n 'agent/action/patch/{dataset}',\n 'agent/action/prompt/{dataset}',\n 'agent/action/transform/{dataset}',\n 'agent/action/translate/{dataset}'\n ],\n slug: 'agent-actions',\n title: 'Agent Actions'\n },\n {\n host: 'global',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n host: 'project',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n defaultApiVersion: 'v2024-06-24',\n host: 'project',\n pathPatterns: [\n 'assets/files/{dataset}',\n 'assets/files/{dataset}/from-url',\n 'assets/images/{dataset}',\n 'assets/images/{dataset}/from-url',\n 'assets/media-library-link/{dataset}'\n ],\n slug: 'assets',\n title: 'Assets API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{datasetName}/backups',\n 'projects/{projectId}/datasets/{datasetName}/backups/{backupId}',\n 'projects/{projectId}/datasets/{datasetName}/settings/backups'\n ],\n slug: 'backups',\n title: 'Backups API reference'\n },\n {\n defaultApiVersion: 'v1',\n host: 'global',\n pathPatterns: [\n 'projects/{project_id}/datasets/{dataset_name}/assets/{asset_id}/purges',\n 'projects/{project_id}/datasets/{dataset_name}/purges'\n ],\n slug: 'cdn-cache-purge',\n title: 'CDN Cache Purge API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'global',\n pathPatterns: [\n 'agent/prompt',\n 'agent/{organizationId}/threads/{threadId}'\n ],\n slug: 'content-agent',\n title: 'Content Agent API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{dataset}/copy'\n ],\n slug: 'copy',\n title: 'Copy API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/doc/{dataset}/{documentId}'\n ],\n slug: 'doc',\n title: 'Doc API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'embeddings-index/query/{dataset}/{indexName}',\n 'embeddings-index/{dataset}',\n 'embeddings-index/{dataset}/{indexName}'\n ],\n slug: 'embeddings-index',\n title: 'Embeddings Index API reference (deprecated)'\n },\n {\n defaultApiVersion: 'v2021-03-25',\n host: 'project',\n pathPatterns: [\n 'data/export/{dataset}'\n ],\n slug: 'export',\n title: 'Export API reference'\n },\n {\n host: 'global',\n pathPatterns: [\n 'functions',\n 'functions/{functionId}',\n 'functions/{functionId}/envvars',\n 'functions/{functionId}/envvars/{envVarKey}',\n 'functions/{functionId}/invoke',\n 'functions/{functionId}/logs',\n 'functions/{functionId}/logs/stream'\n ],\n slug: 'functions-api',\n title: 'Functions API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/history/{dataset}/documents/{documentId}',\n 'data/history/{dataset}/transactions',\n 'data/history/{dataset}/transactions/{documentIds}'\n ],\n slug: 'history',\n title: 'History API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'jobs/{jobId}',\n 'jobs/{jobId}/listen'\n ],\n slug: 'jobs',\n title: 'Jobs API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/listen/{dataset}'\n ],\n slug: 'listen',\n title: 'Listen API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/live/events/{dataset}'\n ],\n slug: 'live',\n title: 'Live Content API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/mutate/{dataset}'\n ],\n slug: 'mutation',\n title: 'Mutation API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'projects',\n 'projects/{projectId}',\n 'projects/{projectId}/cors',\n 'projects/{projectId}/cors/{id}',\n 'projects/{projectId}/datasets',\n 'projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}',\n 'projects/{projectId}/datasets/{name}',\n 'projects/{projectId}/datasets/{name}/copy',\n 'projects/{projectId}/datasets/{name}/settings/embeddings',\n 'projects/{projectId}/datasets/{name}/tags',\n 'projects/{projectId}/features',\n 'projects/{projectId}/permissions',\n 'projects/{projectId}/tags',\n 'projects/{projectId}/tags/{tagIdentifier}',\n 'projects/{projectId}/tokens',\n 'projects/{projectId}/tokens/{tokenId}',\n 'projects/{projectId}/users/{userId}'\n ],\n slug: 'projects-api',\n title: 'Projects API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/query/{dataset}'\n ],\n slug: 'query',\n title: 'Query API reference'\n },\n {\n defaultApiVersion: 'v2021-10-04',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{userId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/roles',\n 'projects/{projectId}/roles/{roleName}'\n ],\n slug: 'roles',\n title: 'Roles API reference'\n },\n {\n defaultApiVersion: 'v2022-04-01',\n host: 'project',\n pathPatterns: [\n 'publish/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}/{scheduleId}',\n 'schedules/{projectId}/{dataset}/{scheduleId}/publish',\n 'unpublish/{projectId}/{dataset}'\n ],\n slug: 'scheduling',\n title: 'Scheduling API reference'\n },\n {\n defaultApiVersion: 'v2026-04-27',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/attribute-definitions',\n 'organizations/{organizationId}/attribute-definitions/{key}',\n 'organizations/{organizationId}/users/me/attributes',\n 'organizations/{organizationId}/users/{sanityUserId}/attributes'\n ],\n slug: 'user-attributes',\n title: 'User attributes API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'hooks/projects/{projectId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/{id}/messages'\n ],\n slug: 'webhooks',\n title: 'Webhooks API reference'\n }\n]\n"],"names":["apiRoutes","defaultApiVersion","host","pathPatterns","slug","title"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,YAA6B;IACxC;QACEC,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;CACD,CAAA"}
1
+ {"version":3,"sources":["../../src/generated/apiRoutes.ts"],"sourcesContent":["/**\n * GENERATED FILE - DO NOT EDIT\n *\n * Routing manifest for `sanity api`, distilled from the published OpenAPI\n * specifications at https://www.sanity.io/docs/api/openapi\n *\n * Regenerate with: pnpm generate:api-routes\n */\nimport {type ApiRouteEntry} from '../actions/api/types.js'\n\nexport const apiRoutes: ApiRouteEntry[] = [\n {\n defaultApiVersion: 'v2025-07-11',\n host: 'global',\n pathPatterns: [\n 'access/invites/me',\n 'access/organization/{resourceId}/users/roles/default',\n 'access/requests/me',\n 'access/robots/me',\n 'access/robots/me/rotate',\n 'access/{resourceType}/{resourceId}/invites',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/accept',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/eligibility',\n 'access/{resourceType}/{resourceId}/invites/{inviteId}',\n 'access/{resourceType}/{resourceId}/permissions',\n 'access/{resourceType}/{resourceId}/permissions/{permissionName}',\n 'access/{resourceType}/{resourceId}/requests',\n 'access/{resourceType}/{resourceId}/requests/state',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/accept',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/decline',\n 'access/{resourceType}/{resourceId}/robots',\n 'access/{resourceType}/{resourceId}/robots/{robotId}',\n 'access/{resourceType}/{resourceId}/roles',\n 'access/{resourceType}/{resourceId}/roles/{roleName}',\n 'access/{resourceType}/{resourceId}/user-permissions/me',\n 'access/{resourceType}/{resourceId}/user-permissions/me/check',\n 'access/{resourceType}/{resourceId}/users',\n 'access/{resourceType}/{resourceId}/users/me',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles/{roleName}'\n ],\n slug: 'access-api',\n title: 'Access API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/actions/{dataset}'\n ],\n slug: 'actions',\n title: 'Actions API reference'\n },\n {\n defaultApiVersion: 'v2021-02-01',\n host: 'global',\n pathPatterns: [\n 'activity',\n 'activity/export/csv'\n ],\n slug: 'activity-log',\n title: 'Activity Log API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'agent/action/generate/{dataset}',\n 'agent/action/patch/{dataset}',\n 'agent/action/prompt/{dataset}',\n 'agent/action/transform/{dataset}',\n 'agent/action/translate/{dataset}'\n ],\n slug: 'agent-actions',\n title: 'Agent Actions'\n },\n {\n host: 'global',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/ai-features',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n host: 'project',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/ai-features',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n defaultApiVersion: 'v2024-06-24',\n host: 'project',\n pathPatterns: [\n 'assets/files/{dataset}',\n 'assets/files/{dataset}/from-url',\n 'assets/images/{dataset}',\n 'assets/images/{dataset}/from-url',\n 'assets/media-library-link/{dataset}'\n ],\n slug: 'assets',\n title: 'Assets API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{datasetName}/backups',\n 'projects/{projectId}/datasets/{datasetName}/backups/{backupId}',\n 'projects/{projectId}/datasets/{datasetName}/settings/backups'\n ],\n slug: 'backups',\n title: 'Backups API reference'\n },\n {\n defaultApiVersion: 'v1',\n host: 'global',\n pathPatterns: [\n 'projects/{project_id}/datasets/{dataset_name}/assets/{asset_id}/purges',\n 'projects/{project_id}/datasets/{dataset_name}/purges'\n ],\n slug: 'cdn-cache-purge',\n title: 'CDN Cache Purge API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'global',\n pathPatterns: [\n 'agent/prompt',\n 'agent/{organizationId}/threads/{threadId}'\n ],\n slug: 'content-agent',\n title: 'Content Agent API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{dataset}/copy'\n ],\n slug: 'copy',\n title: 'Copy API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/doc/{dataset}/{documentId}'\n ],\n slug: 'doc',\n title: 'Doc API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'embeddings-index/query/{dataset}/{indexName}',\n 'embeddings-index/{dataset}',\n 'embeddings-index/{dataset}/{indexName}'\n ],\n slug: 'embeddings-index',\n title: 'Embeddings Index API reference (deprecated)'\n },\n {\n defaultApiVersion: 'v2021-03-25',\n host: 'project',\n pathPatterns: [\n 'data/export/{dataset}'\n ],\n slug: 'export',\n title: 'Export API reference'\n },\n {\n host: 'global',\n pathPatterns: [\n 'functions',\n 'functions/{functionId}',\n 'functions/{functionId}/envvars',\n 'functions/{functionId}/envvars/{envVarKey}',\n 'functions/{functionId}/invoke',\n 'functions/{functionId}/logs',\n 'functions/{functionId}/logs/stream'\n ],\n slug: 'functions-api',\n title: 'Functions API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/history/{dataset}/documents/{documentId}',\n 'data/history/{dataset}/transactions',\n 'data/history/{dataset}/transactions/{documentIds}'\n ],\n slug: 'history',\n title: 'History API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'jobs/{jobId}',\n 'jobs/{jobId}/listen'\n ],\n slug: 'jobs',\n title: 'Jobs API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/listen/{dataset}'\n ],\n slug: 'listen',\n title: 'Listen API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/live/events/{dataset}'\n ],\n slug: 'live',\n title: 'Live Content API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/mutate/{dataset}'\n ],\n slug: 'mutation',\n title: 'Mutation API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'projects',\n 'projects/{projectId}',\n 'projects/{projectId}/cors',\n 'projects/{projectId}/cors/{id}',\n 'projects/{projectId}/datasets',\n 'projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}',\n 'projects/{projectId}/datasets/{name}',\n 'projects/{projectId}/datasets/{name}/copy',\n 'projects/{projectId}/datasets/{name}/settings/embeddings',\n 'projects/{projectId}/datasets/{name}/tags',\n 'projects/{projectId}/features',\n 'projects/{projectId}/permissions',\n 'projects/{projectId}/tags',\n 'projects/{projectId}/tags/{tagIdentifier}',\n 'projects/{projectId}/tokens',\n 'projects/{projectId}/tokens/{tokenId}',\n 'projects/{projectId}/users/{userId}'\n ],\n slug: 'projects-api',\n title: 'Projects API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/query/{dataset}'\n ],\n slug: 'query',\n title: 'Query API reference'\n },\n {\n defaultApiVersion: 'v2021-10-04',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{userId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/roles',\n 'projects/{projectId}/roles/{roleName}'\n ],\n slug: 'roles',\n title: 'Roles API reference'\n },\n {\n defaultApiVersion: 'v2022-04-01',\n host: 'project',\n pathPatterns: [\n 'publish/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}/{scheduleId}',\n 'schedules/{projectId}/{dataset}/{scheduleId}/publish',\n 'unpublish/{projectId}/{dataset}'\n ],\n slug: 'scheduling',\n title: 'Scheduling API reference'\n },\n {\n defaultApiVersion: 'v2026-04-27',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/attribute-definitions',\n 'organizations/{organizationId}/attribute-definitions/{key}',\n 'organizations/{organizationId}/users/me/attributes',\n 'organizations/{organizationId}/users/{sanityUserId}/attributes'\n ],\n slug: 'user-attributes',\n title: 'User attributes API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'hooks/projects/{projectId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/{id}/messages'\n ],\n slug: 'webhooks',\n title: 'Webhooks API reference'\n }\n]\n"],"names":["apiRoutes","defaultApiVersion","host","pathPatterns","slug","title"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,YAA6B;IACxC;QACEC,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;CACD,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { readFile, realpath } from 'node:fs/promises';
2
2
  import { dirname, resolve } from 'node:path';
3
- import { subdebug } from '@sanity/cli-core';
3
+ import { subdebug } from '@sanity/cli-core/debug';
4
4
  const debug = subdebug('updateChecker');
5
5
  const KNOWN_PACKAGES = new Set([
6
6
  '@sanity/cli',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/util/update/resolveRunnerPackage.ts"],"sourcesContent":["import {readFile, realpath} from 'node:fs/promises'\nimport {dirname, resolve} from 'node:path'\n\nimport {subdebug} from '@sanity/cli-core'\n\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\nconst KNOWN_PACKAGES = new Set<SanityPackage>(['@sanity/cli', 'sanity'])\nconst MAX_WALK_ITERATIONS = 25\n\ninterface RunnerPackage {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Resolve the Sanity package name + installed version from a runner install.\n * Falls back to `sanity` + `fallbackVersion` when the walk can't determine them.\n */\nexport async function resolveRunnerPackage(\n binaryPath: string = process.argv[1] ?? '',\n fallbackVersion = '',\n): Promise<RunnerPackage> {\n try {\n // Follow the runner's .bin/sanity symlink to the real bin file, then walk\n // up until we hit a package.json for a known Sanity package.\n let dir = dirname(await realpath(binaryPath))\n for (let i = 0; i < MAX_WALK_ITERATIONS && dir !== resolve(dir, '..'); i++) {\n try {\n const pkg = JSON.parse(await readFile(resolve(dir, 'package.json'), 'utf8'))\n if (\n typeof pkg.name === 'string' &&\n typeof pkg.version === 'string' &&\n isKnownSanityPackage(pkg.name)\n ) {\n return {installedVersion: pkg.version, packageName: pkg.name}\n }\n } catch {\n // ignore missing/malformed package.json and keep walking\n }\n dir = dirname(dir)\n }\n debug('resolveRunnerPackage: walk exhausted without finding a known Sanity package')\n } catch (err) {\n debug('resolveRunnerPackage: realpath failed for %s (%s)', binaryPath, err)\n }\n\n return {installedVersion: fallbackVersion, packageName: 'sanity'}\n}\n\nfunction isKnownSanityPackage(name: string): name is SanityPackage {\n return KNOWN_PACKAGES.has(name as SanityPackage)\n}\n"],"names":["readFile","realpath","dirname","resolve","subdebug","debug","KNOWN_PACKAGES","Set","MAX_WALK_ITERATIONS","resolveRunnerPackage","binaryPath","process","argv","fallbackVersion","dir","i","pkg","JSON","parse","name","version","isKnownSanityPackage","installedVersion","packageName","err","has"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,QAAQ,QAAO,mBAAkB;AACnD,SAAQC,OAAO,EAAEC,OAAO,QAAO,YAAW;AAE1C,SAAQC,QAAQ,QAAO,mBAAkB;AAIzC,MAAMC,QAAQD,SAAS;AAEvB,MAAME,iBAAiB,IAAIC,IAAmB;IAAC;IAAe;CAAS;AACvE,MAAMC,sBAAsB;AAO5B;;;CAGC,GACD,OAAO,eAAeC,qBACpBC,aAAqBC,QAAQC,IAAI,CAAC,EAAE,IAAI,EAAE,EAC1CC,kBAAkB,EAAE;IAEpB,IAAI;QACF,0EAA0E;QAC1E,6DAA6D;QAC7D,IAAIC,MAAMZ,QAAQ,MAAMD,SAASS;QACjC,IAAK,IAAIK,IAAI,GAAGA,IAAIP,uBAAuBM,QAAQX,QAAQW,KAAK,OAAOC,IAAK;YAC1E,IAAI;gBACF,MAAMC,MAAMC,KAAKC,KAAK,CAAC,MAAMlB,SAASG,QAAQW,KAAK,iBAAiB;gBACpE,IACE,OAAOE,IAAIG,IAAI,KAAK,YACpB,OAAOH,IAAII,OAAO,KAAK,YACvBC,qBAAqBL,IAAIG,IAAI,GAC7B;oBACA,OAAO;wBAACG,kBAAkBN,IAAII,OAAO;wBAAEG,aAAaP,IAAIG,IAAI;oBAAA;gBAC9D;YACF,EAAE,OAAM;YACN,yDAAyD;YAC3D;YACAL,MAAMZ,QAAQY;QAChB;QACAT,MAAM;IACR,EAAE,OAAOmB,KAAK;QACZnB,MAAM,qDAAqDK,YAAYc;IACzE;IAEA,OAAO;QAACF,kBAAkBT;QAAiBU,aAAa;IAAQ;AAClE;AAEA,SAASF,qBAAqBF,IAAY;IACxC,OAAOb,eAAemB,GAAG,CAACN;AAC5B"}
1
+ {"version":3,"sources":["../../../src/util/update/resolveRunnerPackage.ts"],"sourcesContent":["import {readFile, realpath} from 'node:fs/promises'\nimport {dirname, resolve} from 'node:path'\n\nimport {subdebug} from '@sanity/cli-core/debug'\n\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\nconst KNOWN_PACKAGES = new Set<SanityPackage>(['@sanity/cli', 'sanity'])\nconst MAX_WALK_ITERATIONS = 25\n\ninterface RunnerPackage {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Resolve the Sanity package name + installed version from a runner install.\n * Falls back to `sanity` + `fallbackVersion` when the walk can't determine them.\n */\nexport async function resolveRunnerPackage(\n binaryPath: string = process.argv[1] ?? '',\n fallbackVersion = '',\n): Promise<RunnerPackage> {\n try {\n // Follow the runner's .bin/sanity symlink to the real bin file, then walk\n // up until we hit a package.json for a known Sanity package.\n let dir = dirname(await realpath(binaryPath))\n for (let i = 0; i < MAX_WALK_ITERATIONS && dir !== resolve(dir, '..'); i++) {\n try {\n const pkg = JSON.parse(await readFile(resolve(dir, 'package.json'), 'utf8'))\n if (\n typeof pkg.name === 'string' &&\n typeof pkg.version === 'string' &&\n isKnownSanityPackage(pkg.name)\n ) {\n return {installedVersion: pkg.version, packageName: pkg.name}\n }\n } catch {\n // ignore missing/malformed package.json and keep walking\n }\n dir = dirname(dir)\n }\n debug('resolveRunnerPackage: walk exhausted without finding a known Sanity package')\n } catch (err) {\n debug('resolveRunnerPackage: realpath failed for %s (%s)', binaryPath, err)\n }\n\n return {installedVersion: fallbackVersion, packageName: 'sanity'}\n}\n\nfunction isKnownSanityPackage(name: string): name is SanityPackage {\n return KNOWN_PACKAGES.has(name as SanityPackage)\n}\n"],"names":["readFile","realpath","dirname","resolve","subdebug","debug","KNOWN_PACKAGES","Set","MAX_WALK_ITERATIONS","resolveRunnerPackage","binaryPath","process","argv","fallbackVersion","dir","i","pkg","JSON","parse","name","version","isKnownSanityPackage","installedVersion","packageName","err","has"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,QAAQ,QAAO,mBAAkB;AACnD,SAAQC,OAAO,EAAEC,OAAO,QAAO,YAAW;AAE1C,SAAQC,QAAQ,QAAO,yBAAwB;AAI/C,MAAMC,QAAQD,SAAS;AAEvB,MAAME,iBAAiB,IAAIC,IAAmB;IAAC;IAAe;CAAS;AACvE,MAAMC,sBAAsB;AAO5B;;;CAGC,GACD,OAAO,eAAeC,qBACpBC,aAAqBC,QAAQC,IAAI,CAAC,EAAE,IAAI,EAAE,EAC1CC,kBAAkB,EAAE;IAEpB,IAAI;QACF,0EAA0E;QAC1E,6DAA6D;QAC7D,IAAIC,MAAMZ,QAAQ,MAAMD,SAASS;QACjC,IAAK,IAAIK,IAAI,GAAGA,IAAIP,uBAAuBM,QAAQX,QAAQW,KAAK,OAAOC,IAAK;YAC1E,IAAI;gBACF,MAAMC,MAAMC,KAAKC,KAAK,CAAC,MAAMlB,SAASG,QAAQW,KAAK,iBAAiB;gBACpE,IACE,OAAOE,IAAIG,IAAI,KAAK,YACpB,OAAOH,IAAII,OAAO,KAAK,YACvBC,qBAAqBL,IAAIG,IAAI,GAC7B;oBACA,OAAO;wBAACG,kBAAkBN,IAAII,OAAO;wBAAEG,aAAaP,IAAIG,IAAI;oBAAA;gBAC9D;YACF,EAAE,OAAM;YACN,yDAAyD;YAC3D;YACAL,MAAMZ,QAAQY;QAChB;QACAT,MAAM;IACR,EAAE,OAAOmB,KAAK;QACZnB,MAAM,qDAAqDK,YAAYc;IACzE;IAEA,OAAO;QAACF,kBAAkBT;QAAiBU,aAAa;IAAQ;AAClE;AAEA,SAASF,qBAAqBF,IAAY;IACxC,OAAOb,eAAemB,GAAG,CAACN;AAC5B"}
@@ -1,4 +1,4 @@
1
- import { subdebug } from '@sanity/cli-core';
1
+ import { subdebug } from '@sanity/cli-core/debug';
2
2
  import { findInstalledPackage, findPackageDeclaration } from '../packageManager/installationInfo/detectPackages.js';
3
3
  const debug = subdebug('updateChecker');
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/util/update/resolveUpdateTarget.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core'\n\nimport {\n findInstalledPackage,\n findPackageDeclaration,\n} from '../packageManager/installationInfo/detectPackages.js'\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\ninterface UpdateTarget {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Determine which package to check for updates and what version is currently installed.\n *\n * If the user's project declares `sanity` as a dependency and it's installed,\n * we check `sanity` (since that's what the user manages). Otherwise, we fall back\n * to `@sanity/cli` (the currently running CLI binary).\n */\nexport async function resolveUpdateTarget(cwd: string, cliVersion: string): Promise<UpdateTarget> {\n // Check if `sanity` is a dependency in the local project\n const sanityDeclaration = await findPackageDeclaration('sanity', cwd)\n\n if (sanityDeclaration) {\n debug('Project declares sanity as a dependency, checking installed version')\n const sanityInstalled = await findInstalledPackage('sanity', cwd)\n\n if (sanityInstalled) {\n debug('Installed sanity version: %s', sanityInstalled.version)\n return {installedVersion: sanityInstalled.version, packageName: 'sanity'}\n }\n\n debug('sanity is declared but not installed, falling back to @sanity/cli')\n }\n\n return {installedVersion: cliVersion, packageName: '@sanity/cli'}\n}\n"],"names":["subdebug","findInstalledPackage","findPackageDeclaration","debug","resolveUpdateTarget","cwd","cliVersion","sanityDeclaration","sanityInstalled","version","installedVersion","packageName"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AAEzC,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB,uDAAsD;AAG7D,MAAMC,QAAQH,SAAS;AAOvB;;;;;;CAMC,GACD,OAAO,eAAeI,oBAAoBC,GAAW,EAAEC,UAAkB;IACvE,yDAAyD;IACzD,MAAMC,oBAAoB,MAAML,uBAAuB,UAAUG;IAEjE,IAAIE,mBAAmB;QACrBJ,MAAM;QACN,MAAMK,kBAAkB,MAAMP,qBAAqB,UAAUI;QAE7D,IAAIG,iBAAiB;YACnBL,MAAM,gCAAgCK,gBAAgBC,OAAO;YAC7D,OAAO;gBAACC,kBAAkBF,gBAAgBC,OAAO;gBAAEE,aAAa;YAAQ;QAC1E;QAEAR,MAAM;IACR;IAEA,OAAO;QAACO,kBAAkBJ;QAAYK,aAAa;IAAa;AAClE"}
1
+ {"version":3,"sources":["../../../src/util/update/resolveUpdateTarget.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core/debug'\n\nimport {\n findInstalledPackage,\n findPackageDeclaration,\n} from '../packageManager/installationInfo/detectPackages.js'\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\ninterface UpdateTarget {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Determine which package to check for updates and what version is currently installed.\n *\n * If the user's project declares `sanity` as a dependency and it's installed,\n * we check `sanity` (since that's what the user manages). Otherwise, we fall back\n * to `@sanity/cli` (the currently running CLI binary).\n */\nexport async function resolveUpdateTarget(cwd: string, cliVersion: string): Promise<UpdateTarget> {\n // Check if `sanity` is a dependency in the local project\n const sanityDeclaration = await findPackageDeclaration('sanity', cwd)\n\n if (sanityDeclaration) {\n debug('Project declares sanity as a dependency, checking installed version')\n const sanityInstalled = await findInstalledPackage('sanity', cwd)\n\n if (sanityInstalled) {\n debug('Installed sanity version: %s', sanityInstalled.version)\n return {installedVersion: sanityInstalled.version, packageName: 'sanity'}\n }\n\n debug('sanity is declared but not installed, falling back to @sanity/cli')\n }\n\n return {installedVersion: cliVersion, packageName: '@sanity/cli'}\n}\n"],"names":["subdebug","findInstalledPackage","findPackageDeclaration","debug","resolveUpdateTarget","cwd","cliVersion","sanityDeclaration","sanityInstalled","version","installedVersion","packageName"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,yBAAwB;AAE/C,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB,uDAAsD;AAG7D,MAAMC,QAAQH,SAAS;AAOvB;;;;;;CAMC,GACD,OAAO,eAAeI,oBAAoBC,GAAW,EAAEC,UAAkB;IACvE,yDAAyD;IACzD,MAAMC,oBAAoB,MAAML,uBAAuB,UAAUG;IAEjE,IAAIE,mBAAmB;QACrBJ,MAAM;QACN,MAAMK,kBAAkB,MAAMP,qBAAqB,UAAUI;QAE7D,IAAIG,iBAAiB;YACnBL,MAAM,gCAAgCK,gBAAgBC,OAAO;YAC7D,OAAO;gBAACC,kBAAkBF,gBAAgBC,OAAO;gBAAEE,aAAa;YAAQ;QAC1E;QAEAR,MAAM;IACR;IAEA,OAAO;QAACO,kBAAkBJ;QAAYK,aAAa;IAAa;AAClE"}
@@ -1,11 +1,12 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { fileURLToPath } from 'node:url';
3
- import { getUserConfig, isCi, subdebug } from '@sanity/cli-core';
3
+ import { getUserConfig } from '@sanity/cli-core/config';
4
+ import { subdebug } from '@sanity/cli-core/debug';
5
+ import { isCi } from '@sanity/cli-core/util';
4
6
  import { gt as semverGt } from 'semver';
5
7
  import { detectPackageRunner } from './packageRunner.js';
6
8
  import { resolveRunnerPackage } from './resolveRunnerPackage.js';
7
9
  import { resolveUpdateTarget } from './resolveUpdateTarget.js';
8
- import { showUpdateNotification } from './showNotificationUpdate.js';
9
10
  const debug = subdebug('updateChecker');
10
11
  const TWELVE_HOURS = 12 * 60 * 60 * 1000;
11
12
  /**
@@ -41,6 +42,10 @@ const TWELVE_HOURS = 12 * 60 * 60 * 1000;
41
42
  debug('Update is available (%s), already notified for this cache cycle', latestVersion);
42
43
  } else {
43
44
  debug('Update is available (%s)', latestVersion);
45
+ // Imported lazily: the notification pulls in the ux helpers, and this
46
+ // check runs on every invocation, including `--version` and `--help`.
47
+ // eslint-disable-next-line no-restricted-syntax -- static relative import, not a user file path
48
+ const { showUpdateNotification } = await import('./showNotificationUpdate.js');
44
49
  await showUpdateNotification(installedVersion, latestVersion, packageName, runner);
45
50
  store.set(notifiedKey, updatedAt);
46
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/util/update/updateChecker.ts"],"sourcesContent":["import {spawn} from 'node:child_process'\nimport {fileURLToPath} from 'node:url'\n\nimport {getUserConfig, isCi, subdebug} from '@sanity/cli-core'\nimport {gt as semverGt} from 'semver'\n\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\nimport {detectPackageRunner} from './packageRunner.js'\nimport {resolveRunnerPackage} from './resolveRunnerPackage.js'\nimport {resolveUpdateTarget} from './resolveUpdateTarget.js'\nimport {showUpdateNotification} from './showNotificationUpdate.js'\n\nconst debug = subdebug('updateChecker')\n\nconst TWELVE_HOURS = 12 * 60 * 60 * 1000\n\n/**\n * Check for CLI updates and notify the user if a new version is available.\n *\n * The main process resolves the local update target (which package and installed version),\n * then reads the latest version from the config cache. It never makes network requests.\n * If the cache is empty or expired, a detached worker process is spawned to fetch the\n * latest version from npm and write it to the cache. The notification is shown on the\n * next CLI invocation when the cached result is available instantly.\n */\nexport async function updateChecker(config: {version: string}): Promise<void> {\n debug(`Installed CLI version is ${config.version}`)\n\n // Skip in CI or if disabled\n if (isCi() || process.env.NO_UPDATE_NOTIFIER) {\n debug('Running on CI, or explicitly disabled, skipping update check')\n return\n }\n\n if (!process.stdout.isTTY) {\n return\n }\n\n const runner = detectPackageRunner()\n const {installedVersion, packageName} = runner\n ? await resolveRunnerPackage(process.argv[1] ?? '', config.version)\n : await resolveUpdateTarget(process.cwd(), config.version)\n debug('Update target: %s@%s%s', packageName, installedVersion, runner ? ` via ${runner}` : '')\n\n const store = getUserConfig()\n const cacheKey = `latestVersion:${packageName}`\n const cached = readCachedLatestVersion(store, cacheKey)\n\n if (cached) {\n const {expired, latestVersion, updatedAt} = cached\n\n debug(\n 'Cache %s for %s: installed=%s, latest=%s',\n expired ? 'expired' : 'hit',\n packageName,\n installedVersion,\n latestVersion,\n )\n\n if (semverGt(latestVersion, installedVersion)) {\n const notifiedKey = `notifiedAt:${packageName}`\n if (store.get(notifiedKey) === updatedAt) {\n debug('Update is available (%s), already notified for this cache cycle', latestVersion)\n } else {\n debug('Update is available (%s)', latestVersion)\n await showUpdateNotification(installedVersion, latestVersion, packageName, runner)\n store.set(notifiedKey, updatedAt)\n }\n } else {\n debug('No update found')\n }\n\n if (expired) {\n debug('Cache expired, spawning worker to refresh')\n spawnFetchWorker(config.version, packageName)\n }\n } else {\n debug('No cached update info, spawning worker to fetch')\n spawnFetchWorker(config.version, packageName)\n }\n}\n\n/**\n * Read and validate the cached latest version for a specific package.\n * The cache only stores the latest npm version (globally valid) - the installed\n * version is always resolved locally to avoid cross-project confusion.\n */\nfunction readCachedLatestVersion(\n store: ReturnType<typeof getUserConfig>,\n cacheKey: string,\n): {expired: boolean; latestVersion: string; updatedAt: number} | null {\n const stored: unknown = store.get(cacheKey)\n\n if (\n !stored ||\n typeof stored !== 'object' ||\n !('updatedAt' in stored) ||\n typeof stored.updatedAt !== 'number' ||\n !('value' in stored) ||\n typeof stored.value !== 'string'\n ) {\n return null\n }\n\n const expired = Date.now() - stored.updatedAt > TWELVE_HOURS\n return {expired, latestVersion: stored.value, updatedAt: stored.updatedAt}\n}\n\n/**\n * Spawn a detached worker process to fetch the latest version and update the cache.\n * The worker is unref'd so the parent CLI can exit immediately.\n */\nfunction spawnFetchWorker(cliVersion: string, packageName: SanityPackage): void {\n const workerPath = fileURLToPath(new URL('fetchUpdateInfo.worker.js', import.meta.url))\n debug(`Spawning update check worker: ${process.execPath} ${workerPath}`)\n\n spawn(process.execPath, [workerPath], {\n detached: true,\n env: {\n ...process.env,\n SANITY_UPDATE_CHECK_CLI_VERSION: cliVersion,\n SANITY_UPDATE_CHECK_CWD: process.cwd(),\n SANITY_UPDATE_CHECK_PACKAGE: packageName,\n },\n stdio: debug.enabled ? 'inherit' : 'ignore',\n }).unref()\n}\n"],"names":["spawn","fileURLToPath","getUserConfig","isCi","subdebug","gt","semverGt","detectPackageRunner","resolveRunnerPackage","resolveUpdateTarget","showUpdateNotification","debug","TWELVE_HOURS","updateChecker","config","version","process","env","NO_UPDATE_NOTIFIER","stdout","isTTY","runner","installedVersion","packageName","argv","cwd","store","cacheKey","cached","readCachedLatestVersion","expired","latestVersion","updatedAt","notifiedKey","get","set","spawnFetchWorker","stored","value","Date","now","cliVersion","workerPath","URL","url","execPath","detached","SANITY_UPDATE_CHECK_CLI_VERSION","SANITY_UPDATE_CHECK_CWD","SANITY_UPDATE_CHECK_PACKAGE","stdio","enabled","unref"],"mappings":"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"}
1
+ {"version":3,"sources":["../../../src/util/update/updateChecker.ts"],"sourcesContent":["import {spawn} from 'node:child_process'\nimport {fileURLToPath} from 'node:url'\n\nimport {getUserConfig} from '@sanity/cli-core/config'\nimport {subdebug} from '@sanity/cli-core/debug'\nimport {isCi} from '@sanity/cli-core/util'\nimport {gt as semverGt} from 'semver'\n\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\nimport {detectPackageRunner} from './packageRunner.js'\nimport {resolveRunnerPackage} from './resolveRunnerPackage.js'\nimport {resolveUpdateTarget} from './resolveUpdateTarget.js'\n\nconst debug = subdebug('updateChecker')\n\nconst TWELVE_HOURS = 12 * 60 * 60 * 1000\n\n/**\n * Check for CLI updates and notify the user if a new version is available.\n *\n * The main process resolves the local update target (which package and installed version),\n * then reads the latest version from the config cache. It never makes network requests.\n * If the cache is empty or expired, a detached worker process is spawned to fetch the\n * latest version from npm and write it to the cache. The notification is shown on the\n * next CLI invocation when the cached result is available instantly.\n */\nexport async function updateChecker(config: {version: string}): Promise<void> {\n debug(`Installed CLI version is ${config.version}`)\n\n // Skip in CI or if disabled\n if (isCi() || process.env.NO_UPDATE_NOTIFIER) {\n debug('Running on CI, or explicitly disabled, skipping update check')\n return\n }\n\n if (!process.stdout.isTTY) {\n return\n }\n\n const runner = detectPackageRunner()\n const {installedVersion, packageName} = runner\n ? await resolveRunnerPackage(process.argv[1] ?? '', config.version)\n : await resolveUpdateTarget(process.cwd(), config.version)\n debug('Update target: %s@%s%s', packageName, installedVersion, runner ? ` via ${runner}` : '')\n\n const store = getUserConfig()\n const cacheKey = `latestVersion:${packageName}`\n const cached = readCachedLatestVersion(store, cacheKey)\n\n if (cached) {\n const {expired, latestVersion, updatedAt} = cached\n\n debug(\n 'Cache %s for %s: installed=%s, latest=%s',\n expired ? 'expired' : 'hit',\n packageName,\n installedVersion,\n latestVersion,\n )\n\n if (semverGt(latestVersion, installedVersion)) {\n const notifiedKey = `notifiedAt:${packageName}`\n if (store.get(notifiedKey) === updatedAt) {\n debug('Update is available (%s), already notified for this cache cycle', latestVersion)\n } else {\n debug('Update is available (%s)', latestVersion)\n // Imported lazily: the notification pulls in the ux helpers, and this\n // check runs on every invocation, including `--version` and `--help`.\n // eslint-disable-next-line no-restricted-syntax -- static relative import, not a user file path\n const {showUpdateNotification} = await import('./showNotificationUpdate.js')\n await showUpdateNotification(installedVersion, latestVersion, packageName, runner)\n store.set(notifiedKey, updatedAt)\n }\n } else {\n debug('No update found')\n }\n\n if (expired) {\n debug('Cache expired, spawning worker to refresh')\n spawnFetchWorker(config.version, packageName)\n }\n } else {\n debug('No cached update info, spawning worker to fetch')\n spawnFetchWorker(config.version, packageName)\n }\n}\n\n/**\n * Read and validate the cached latest version for a specific package.\n * The cache only stores the latest npm version (globally valid) - the installed\n * version is always resolved locally to avoid cross-project confusion.\n */\nfunction readCachedLatestVersion(\n store: ReturnType<typeof getUserConfig>,\n cacheKey: string,\n): {expired: boolean; latestVersion: string; updatedAt: number} | null {\n const stored: unknown = store.get(cacheKey)\n\n if (\n !stored ||\n typeof stored !== 'object' ||\n !('updatedAt' in stored) ||\n typeof stored.updatedAt !== 'number' ||\n !('value' in stored) ||\n typeof stored.value !== 'string'\n ) {\n return null\n }\n\n const expired = Date.now() - stored.updatedAt > TWELVE_HOURS\n return {expired, latestVersion: stored.value, updatedAt: stored.updatedAt}\n}\n\n/**\n * Spawn a detached worker process to fetch the latest version and update the cache.\n * The worker is unref'd so the parent CLI can exit immediately.\n */\nfunction spawnFetchWorker(cliVersion: string, packageName: SanityPackage): void {\n const workerPath = fileURLToPath(new URL('fetchUpdateInfo.worker.js', import.meta.url))\n debug(`Spawning update check worker: ${process.execPath} ${workerPath}`)\n\n spawn(process.execPath, [workerPath], {\n detached: true,\n env: {\n ...process.env,\n SANITY_UPDATE_CHECK_CLI_VERSION: cliVersion,\n SANITY_UPDATE_CHECK_CWD: process.cwd(),\n SANITY_UPDATE_CHECK_PACKAGE: packageName,\n },\n stdio: debug.enabled ? 'inherit' : 'ignore',\n }).unref()\n}\n"],"names":["spawn","fileURLToPath","getUserConfig","subdebug","isCi","gt","semverGt","detectPackageRunner","resolveRunnerPackage","resolveUpdateTarget","debug","TWELVE_HOURS","updateChecker","config","version","process","env","NO_UPDATE_NOTIFIER","stdout","isTTY","runner","installedVersion","packageName","argv","cwd","store","cacheKey","cached","readCachedLatestVersion","expired","latestVersion","updatedAt","notifiedKey","get","showUpdateNotification","set","spawnFetchWorker","stored","value","Date","now","cliVersion","workerPath","URL","url","execPath","detached","SANITY_UPDATE_CHECK_CLI_VERSION","SANITY_UPDATE_CHECK_CWD","SANITY_UPDATE_CHECK_PACKAGE","stdio","enabled","unref"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import { subdebug } from '@sanity/cli-core';
1
+ import { subdebug } from '@sanity/cli-core/debug';
2
2
  export const updateCheckerDebug = subdebug('updateChecker');
3
3
 
4
4
  //# sourceMappingURL=updateCheckerDebug.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/util/update/updateCheckerDebug.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core'\n\nexport const updateCheckerDebug = subdebug('updateChecker')\n"],"names":["subdebug","updateCheckerDebug"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AAEzC,OAAO,MAAMC,qBAAqBD,SAAS,iBAAgB"}
1
+ {"version":3,"sources":["../../../src/util/update/updateCheckerDebug.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core/debug'\n\nexport const updateCheckerDebug = subdebug('updateChecker')\n"],"names":["subdebug","updateCheckerDebug"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,yBAAwB;AAE/C,OAAO,MAAMC,qBAAqBD,SAAS,iBAAgB"}