@sanity/cli 8.27.0 → 8.28.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.
Files changed (138) hide show
  1. package/README.md +1515 -408
  2. package/dist/actions/context/commandTable.js +215 -0
  3. package/dist/actions/context/commandTable.js.map +1 -0
  4. package/dist/actions/context/contextCommand.js +246 -0
  5. package/dist/actions/context/contextCommand.js.map +1 -0
  6. package/dist/actions/context/contextSpec.js +18 -0
  7. package/dist/actions/context/contextSpec.js.map +1 -0
  8. package/dist/actions/context/distillContextOperations.js +335 -0
  9. package/dist/actions/context/distillContextOperations.js.map +1 -0
  10. package/dist/actions/context/mcpEndpoint.js.map +1 -1
  11. package/dist/actions/context/operationInput.js +226 -0
  12. package/dist/actions/context/operationInput.js.map +1 -0
  13. package/dist/actions/context/operationTypes.js +3 -0
  14. package/dist/actions/context/operationTypes.js.map +1 -0
  15. package/dist/actions/context/removedCommands.js +26 -0
  16. package/dist/actions/context/removedCommands.js.map +1 -0
  17. package/dist/actions/context/renderOperationResult.js +72 -0
  18. package/dist/actions/context/renderOperationResult.js.map +1 -0
  19. package/dist/actions/context/sourceFile.js +31 -0
  20. package/dist/actions/context/sourceFile.js.map +1 -0
  21. package/dist/actions/context/syncOutput.js +17 -0
  22. package/dist/actions/context/syncOutput.js.map +1 -0
  23. package/dist/actions/context/table.js +13 -0
  24. package/dist/actions/context/table.js.map +1 -0
  25. package/dist/actions/context/waitForJob.js.map +1 -1
  26. package/dist/actions/context/waitForSourceSync.js +48 -0
  27. package/dist/actions/context/waitForSourceSync.js.map +1 -0
  28. package/dist/actions/context/watchJob.js.map +1 -1
  29. package/dist/actions/context/watchSourceSync.js +40 -0
  30. package/dist/actions/context/watchSourceSync.js.map +1 -0
  31. package/dist/actions/dev/servers/startStudioDevServer.js +4 -1
  32. package/dist/actions/dev/servers/startStudioDevServer.js.map +1 -1
  33. package/dist/commands/context/build.js +19 -81
  34. package/dist/commands/context/build.js.map +1 -1
  35. package/dist/commands/context/create.js +3 -90
  36. package/dist/commands/context/create.js.map +1 -1
  37. package/dist/commands/context/delete.js +3 -73
  38. package/dist/commands/context/delete.js.map +1 -1
  39. package/dist/commands/context/documents/content.js +117 -0
  40. package/dist/commands/context/documents/content.js.map +1 -0
  41. package/dist/commands/context/documents/delete.js +5 -0
  42. package/dist/commands/context/documents/delete.js.map +1 -0
  43. package/dist/commands/context/documents/edit.js +5 -0
  44. package/dist/commands/context/documents/edit.js.map +1 -0
  45. package/dist/commands/context/documents/get.js +5 -0
  46. package/dist/commands/context/documents/get.js.map +1 -0
  47. package/dist/commands/context/documents/list.js +5 -0
  48. package/dist/commands/context/documents/list.js.map +1 -0
  49. package/dist/commands/context/entries/list.js +2 -2
  50. package/dist/commands/context/entries/list.js.map +1 -1
  51. package/dist/commands/context/entries/rebuild.js +3 -93
  52. package/dist/commands/context/entries/rebuild.js.map +1 -1
  53. package/dist/commands/context/get.js +3 -88
  54. package/dist/commands/context/get.js.map +1 -1
  55. package/dist/commands/context/instructions/create.js +5 -0
  56. package/dist/commands/context/instructions/create.js.map +1 -0
  57. package/dist/commands/context/instructions/delete.js +5 -0
  58. package/dist/commands/context/instructions/delete.js.map +1 -0
  59. package/dist/commands/context/instructions/edit.js +5 -0
  60. package/dist/commands/context/instructions/edit.js.map +1 -0
  61. package/dist/commands/context/issues/apply.js +3 -84
  62. package/dist/commands/context/issues/apply.js.map +1 -1
  63. package/dist/commands/context/issues/dismiss.js +3 -50
  64. package/dist/commands/context/issues/dismiss.js.map +1 -1
  65. package/dist/commands/context/issues/reopen.js +3 -51
  66. package/dist/commands/context/issues/reopen.js.map +1 -1
  67. package/dist/commands/context/issues/resolve.js +23 -92
  68. package/dist/commands/context/issues/resolve.js.map +1 -1
  69. package/dist/commands/context/jobs/get.js +3 -88
  70. package/dist/commands/context/jobs/get.js.map +1 -1
  71. package/dist/commands/context/list.js +3 -95
  72. package/dist/commands/context/list.js.map +1 -1
  73. package/dist/commands/context/mcp/initial-context.js +5 -0
  74. package/dist/commands/context/mcp/initial-context.js.map +1 -0
  75. package/dist/commands/context/mcp/list.js +2 -2
  76. package/dist/commands/context/mcp/list.js.map +1 -1
  77. package/dist/commands/context/mcp/status.js.map +1 -1
  78. package/dist/commands/context/mcp/update.js.map +1 -1
  79. package/dist/commands/context/sources/create.js +175 -0
  80. package/dist/commands/context/sources/create.js.map +1 -0
  81. package/dist/commands/context/sources/delete.js +5 -0
  82. package/dist/commands/context/sources/delete.js.map +1 -0
  83. package/dist/commands/context/sources/edit.js +29 -0
  84. package/dist/commands/context/sources/edit.js.map +1 -0
  85. package/dist/commands/context/sources/get.js +5 -0
  86. package/dist/commands/context/sources/get.js.map +1 -0
  87. package/dist/commands/context/sources/list.js +5 -0
  88. package/dist/commands/context/sources/list.js.map +1 -0
  89. package/dist/commands/context/sources/sync.js +5 -0
  90. package/dist/commands/context/sources/sync.js.map +1 -0
  91. package/dist/commands/context/sources/syncs/confirm.js +5 -0
  92. package/dist/commands/context/sources/syncs/confirm.js.map +1 -0
  93. package/dist/commands/context/sources/syncs/discard.js +5 -0
  94. package/dist/commands/context/sources/syncs/discard.js.map +1 -0
  95. package/dist/commands/context/sources/syncs/get.js +5 -0
  96. package/dist/commands/context/sources/syncs/get.js.map +1 -0
  97. package/dist/commands/context/sources/syncs/list.js +5 -0
  98. package/dist/commands/context/sources/syncs/list.js.map +1 -0
  99. package/dist/commands/context/sources/upload.js +63 -0
  100. package/dist/commands/context/sources/upload.js.map +1 -0
  101. package/dist/commands/context/sync.js +5 -0
  102. package/dist/commands/context/sync.js.map +1 -0
  103. package/dist/commands/context/update.js +3 -136
  104. package/dist/commands/context/update.js.map +1 -1
  105. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js +41 -26
  106. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js.map +1 -1
  107. package/dist/generated/apiRoutes.js +28 -0
  108. package/dist/generated/apiRoutes.js.map +1 -1
  109. package/dist/generated/contextOperations.js +1116 -0
  110. package/dist/generated/contextOperations.js.map +1 -0
  111. package/dist/hooks/commandNotFound/topicAliases.js +8 -2
  112. package/dist/hooks/commandNotFound/topicAliases.js.map +1 -1
  113. package/dist/services/context.js +241 -268
  114. package/dist/services/context.js.map +1 -1
  115. package/dist/util/telemetry/cliCommandIdentity.js +10 -18
  116. package/dist/util/telemetry/cliCommandIdentity.js.map +1 -1
  117. package/oclif.manifest.json +3380 -1910
  118. package/package.json +24 -23
  119. package/templates/app-quickstart/.claude/skills/sanity-app-sdk/SKILL.md +49 -0
  120. package/templates/app-quickstart/AGENTS.md +49 -0
  121. package/templates/app-sanity-ui/.claude/skills/sanity-app-sdk/SKILL.md +49 -0
  122. package/templates/app-sanity-ui/AGENTS.md +49 -0
  123. package/templates/shared/dashboard/app-quickstart/.claude/skills/sanity-app-sdk/SKILL.md +49 -0
  124. package/templates/shared/dashboard/app-quickstart/AGENTS.md +49 -0
  125. package/templates/shared/dashboard/app-sanity-ui/.claude/skills/sanity-app-sdk/SKILL.md +49 -0
  126. package/templates/shared/dashboard/app-sanity-ui/AGENTS.md +49 -0
  127. package/dist/commands/context/imports/create.js +0 -270
  128. package/dist/commands/context/imports/create.js.map +0 -1
  129. package/dist/commands/context/imports/delete.js +0 -73
  130. package/dist/commands/context/imports/delete.js.map +0 -1
  131. package/dist/commands/context/imports/download.js +0 -60
  132. package/dist/commands/context/imports/download.js.map +0 -1
  133. package/dist/commands/context/imports/get.js +0 -88
  134. package/dist/commands/context/imports/get.js.map +0 -1
  135. package/dist/commands/context/imports/list.js +0 -100
  136. package/dist/commands/context/imports/list.js.map +0 -1
  137. package/dist/commands/context/refresh.js +0 -46
  138. package/dist/commands/context/refresh.js.map +0 -1
package/README.md CHANGED
@@ -36,16 +36,19 @@ Code for sanity cli
36
36
  - [`sanity context build KNOWLEDGEBASEID`](#sanity-context-build-knowledgebaseid)
37
37
  - [`sanity context create`](#sanity-context-create)
38
38
  - [`sanity context delete KNOWLEDGEBASEID`](#sanity-context-delete-knowledgebaseid)
39
+ - [`sanity context documents content KNOWLEDGEBASEID DOCUMENTID`](#sanity-context-documents-content-knowledgebaseid-documentid)
40
+ - [`sanity context documents delete KNOWLEDGEBASEID DOCUMENTID`](#sanity-context-documents-delete-knowledgebaseid-documentid)
41
+ - [`sanity context documents edit KNOWLEDGEBASEID DOCUMENTID`](#sanity-context-documents-edit-knowledgebaseid-documentid)
42
+ - [`sanity context documents get KNOWLEDGEBASEID DOCUMENTID`](#sanity-context-documents-get-knowledgebaseid-documentid)
43
+ - [`sanity context documents list KNOWLEDGEBASEID`](#sanity-context-documents-list-knowledgebaseid)
39
44
  - [`sanity context entries get KNOWLEDGEBASEID PATH`](#sanity-context-entries-get-knowledgebaseid-path)
40
45
  - [`sanity context entries list KNOWLEDGEBASEID`](#sanity-context-entries-list-knowledgebaseid)
41
- - [`sanity context entries rebuild KNOWLEDGEBASEID PATH`](#sanity-context-entries-rebuild-knowledgebaseid-path)
46
+ - [`sanity context entries rebuild KNOWLEDGEBASEID ENTRYPATH`](#sanity-context-entries-rebuild-knowledgebaseid-entrypath)
42
47
  - [`sanity context get KNOWLEDGEBASEID`](#sanity-context-get-knowledgebaseid)
43
- - [`sanity context imports create KNOWLEDGEBASEID`](#sanity-context-imports-create-knowledgebaseid)
44
- - [`sanity context imports delete KNOWLEDGEBASEID IMPORTID`](#sanity-context-imports-delete-knowledgebaseid-importid)
45
- - [`sanity context imports download KNOWLEDGEBASEID IMPORTID`](#sanity-context-imports-download-knowledgebaseid-importid)
46
- - [`sanity context imports get KNOWLEDGEBASEID IMPORTID`](#sanity-context-imports-get-knowledgebaseid-importid)
47
- - [`sanity context imports list KNOWLEDGEBASEID`](#sanity-context-imports-list-knowledgebaseid)
48
- - [`sanity context issues apply KNOWLEDGEBASEID ISSUEID`](#sanity-context-issues-apply-knowledgebaseid-issueid)
48
+ - [`sanity context instructions create KNOWLEDGEBASEID`](#sanity-context-instructions-create-knowledgebaseid)
49
+ - [`sanity context instructions delete KNOWLEDGEBASEID INSTRUCTIONID`](#sanity-context-instructions-delete-knowledgebaseid-instructionid)
50
+ - [`sanity context instructions edit KNOWLEDGEBASEID INSTRUCTIONID`](#sanity-context-instructions-edit-knowledgebaseid-instructionid)
51
+ - [`sanity context issues apply KNOWLEDGEBASEID ISSUEIDS`](#sanity-context-issues-apply-knowledgebaseid-issueids)
49
52
  - [`sanity context issues dismiss KNOWLEDGEBASEID ISSUEID`](#sanity-context-issues-dismiss-knowledgebaseid-issueid)
50
53
  - [`sanity context issues get KNOWLEDGEBASEID ISSUEID`](#sanity-context-issues-get-knowledgebaseid-issueid)
51
54
  - [`sanity context issues list KNOWLEDGEBASEID`](#sanity-context-issues-list-knowledgebaseid)
@@ -53,8 +56,26 @@ Code for sanity cli
53
56
  - [`sanity context issues resolve KNOWLEDGEBASEID ISSUEID`](#sanity-context-issues-resolve-knowledgebaseid-issueid)
54
57
  - [`sanity context jobs get KNOWLEDGEBASEID JOBID`](#sanity-context-jobs-get-knowledgebaseid-jobid)
55
58
  - [`sanity context list`](#sanity-context-list)
59
+ - [`sanity context mcp create NAME`](#sanity-context-mcp-create-name)
60
+ - [`sanity context mcp delete NAME`](#sanity-context-mcp-delete-name)
61
+ - [`sanity context mcp get NAME`](#sanity-context-mcp-get-name)
62
+ - [`sanity context mcp initial-context MCPENDPOINT`](#sanity-context-mcp-initial-context-mcpendpoint)
63
+ - [`sanity context mcp list`](#sanity-context-mcp-list)
64
+ - [`sanity context mcp status NAME`](#sanity-context-mcp-status-name)
65
+ - [`sanity context mcp update NAME`](#sanity-context-mcp-update-name)
56
66
  - [`sanity context query QUERY`](#sanity-context-query-query)
57
- - [`sanity context refresh KNOWLEDGEBASEID`](#sanity-context-refresh-knowledgebaseid)
67
+ - [`sanity context sources create KNOWLEDGEBASEID`](#sanity-context-sources-create-knowledgebaseid)
68
+ - [`sanity context sources delete KNOWLEDGEBASEID SOURCEID`](#sanity-context-sources-delete-knowledgebaseid-sourceid)
69
+ - [`sanity context sources edit KNOWLEDGEBASEID SOURCEID`](#sanity-context-sources-edit-knowledgebaseid-sourceid)
70
+ - [`sanity context sources get KNOWLEDGEBASEID SOURCEID`](#sanity-context-sources-get-knowledgebaseid-sourceid)
71
+ - [`sanity context sources list KNOWLEDGEBASEID`](#sanity-context-sources-list-knowledgebaseid)
72
+ - [`sanity context sources sync KNOWLEDGEBASEID SOURCEID`](#sanity-context-sources-sync-knowledgebaseid-sourceid)
73
+ - [`sanity context sources syncs confirm KNOWLEDGEBASEID SOURCEID SYNCID`](#sanity-context-sources-syncs-confirm-knowledgebaseid-sourceid-syncid)
74
+ - [`sanity context sources syncs discard KNOWLEDGEBASEID SOURCEID SYNCID`](#sanity-context-sources-syncs-discard-knowledgebaseid-sourceid-syncid)
75
+ - [`sanity context sources syncs get KNOWLEDGEBASEID SOURCEID SYNCID`](#sanity-context-sources-syncs-get-knowledgebaseid-sourceid-syncid)
76
+ - [`sanity context sources syncs list KNOWLEDGEBASEID SOURCEID`](#sanity-context-sources-syncs-list-knowledgebaseid-sourceid)
77
+ - [`sanity context sources upload KNOWLEDGEBASEID SOURCEID`](#sanity-context-sources-upload-knowledgebaseid-sourceid)
78
+ - [`sanity context sync KNOWLEDGEBASEID`](#sanity-context-sync-knowledgebaseid)
58
79
  - [`sanity context update KNOWLEDGEBASEID`](#sanity-context-update-knowledgebaseid)
59
80
  - [`sanity cors add ORIGIN`](#sanity-cors-add-origin)
60
81
  - [`sanity cors delete [ORIGIN]`](#sanity-cors-delete-origin)
@@ -151,11 +172,12 @@ Code for sanity cli
151
172
  - [`sanity versions`](#sanity-versions)
152
173
  - [`sanity whoami`](#sanity-whoami)
153
174
  - [`sanity workflows abort INSTANCEID`](#sanity-workflows-abort-instanceid)
154
- - [`sanity workflows blueprint generate`](#sanity-workflows-blueprint-generate)
155
- - [`sanity workflows definition delete NAME`](#sanity-workflows-definition-delete-name)
156
- - [`sanity workflows definition diff NAME`](#sanity-workflows-definition-diff-name)
157
- - [`sanity workflows definition list`](#sanity-workflows-definition-list)
158
- - [`sanity workflows definition show NAME`](#sanity-workflows-definition-show-name)
175
+ - [`sanity workflows blueprints generate`](#sanity-workflows-blueprints-generate)
176
+ - [`sanity workflows definitions delete NAME`](#sanity-workflows-definitions-delete-name)
177
+ - [`sanity workflows definitions diff NAME`](#sanity-workflows-definitions-diff-name)
178
+ - [`sanity workflows definitions list`](#sanity-workflows-definitions-list)
179
+ - [`sanity workflows definitions show NAME`](#sanity-workflows-definitions-show-name)
180
+ - [`sanity workflows definitions validate FILE`](#sanity-workflows-definitions-validate-file)
159
181
  - [`sanity workflows deploy`](#sanity-workflows-deploy)
160
182
  - [`sanity workflows diagnose INSTANCEID`](#sanity-workflows-diagnose-instanceid)
161
183
  - [`sanity workflows fire-action INSTANCEID`](#sanity-workflows-fire-action-instanceid)
@@ -439,8 +461,8 @@ EXAMPLES
439
461
  USAGE
440
462
  $ sanity blueprints add TYPE [--json] [--example <value> | -n <value> | --fn-type
441
463
  document-publish|document-create|document-delete|document-update|media-library-asset-create|media-library-asset-dele
442
- te|media-library-asset-update|pub-sub|scheduled-function|sync-tag-invalidate... | --language ts|js | --javascript |
443
- --fn-helpers | --fn-installer skip|npm|pnpm|yarn] [-i | ]
464
+ te|media-library-asset-update|pub-sub|scheduled-function|sync-tag-invalidate|durable-function... | --language ts|js
465
+ | --javascript | --fn-helpers | --fn-installer skip|npm|pnpm|yarn] [-i | ]
444
466
 
445
467
  ARGUMENTS
446
468
  TYPE (function) Type of resource to add (only "function" is supported)
@@ -457,7 +479,7 @@ FLAGS
457
479
  events by specifying this flag multiple times
458
480
  <options: document-publish|document-create|document-delete|document-update|media-library-
459
481
  asset-create|media-library-asset-delete|media-library-asset-update|pub-sub|scheduled-func
460
- tion|sync-tag-invalidate>
482
+ tion|sync-tag-invalidate|durable-function>
461
483
  --javascript Use JavaScript instead of TypeScript
462
484
  --json Format output as json
463
485
  --language=<option> [default: ts] Language of the new function
@@ -984,21 +1006,28 @@ EXAMPLES
984
1006
 
985
1007
  ## `sanity context build KNOWLEDGEBASEID`
986
1008
 
987
- Build a knowledge base from its imported content
1009
+ Start a knowledge base build
988
1010
 
989
1011
  ```
990
1012
  USAGE
991
- $ sanity context build KNOWLEDGEBASEID [--cancel | --watch]
1013
+ $ sanity context build KNOWLEDGEBASEID [--json] [--cancel | --watch]
992
1014
 
993
1015
  ARGUMENTS
994
- KNOWLEDGEBASEID Knowledge base ID
1016
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
995
1017
 
996
1018
  FLAGS
997
1019
  --cancel Cancel the running build instead of starting one
998
- --watch Wait for the build to finish, exiting non-zero if it fails
1020
+ --watch Wait for the job to finish, exiting non-zero if it fails
1021
+
1022
+ GLOBAL FLAGS
1023
+ --json Format output as json.
999
1024
 
1000
1025
  DESCRIPTION
1001
- Build a knowledge base from its imported content
1026
+ Start a knowledge base build
1027
+
1028
+ Queues a build over the knowledge base's current sources and returns a job ID immediately. If a build is already
1029
+ running, the response returns that build's job ID instead of starting a second build. A draft can't be built: the
1030
+ request returns `409` with code `knowledgeBaseIsDraft`.
1002
1031
 
1003
1032
  EXAMPLES
1004
1033
  Start a build and return the job ID
@@ -1009,629 +1038,1590 @@ EXAMPLES
1009
1038
 
1010
1039
  $ sanity context build kb-abc123 --watch
1011
1040
 
1012
- Cancel the running build, if any
1041
+ Cancel the running build, if any
1042
+
1043
+ $ sanity context build kb-abc123 --cancel
1044
+ ```
1045
+
1046
+ ## `sanity context create`
1047
+
1048
+ Create a knowledge base
1049
+
1050
+ ```
1051
+ USAGE
1052
+ $ sanity context create [--json] [--title <value>] [--description <value>] [--draft] [--organization <id>]
1053
+
1054
+ FLAGS
1055
+ --description=<value> A short description of what the knowledge base covers. Required unless `draft` is `true`.
1056
+ --[no-]draft Whether to create the knowledge base as a draft. You can add sources to a draft, and they sync
1057
+ right away, but you can't build it, and the list leaves it out unless you set `includeDrafts`
1058
+ to `true`. A draft counts toward your plan's knowledge base limit. To finish it, update it with
1059
+ `draft` set to `false`.
1060
+ --title=<value> The knowledge base's title. Required unless `draft` is `true`.
1061
+
1062
+ GLOBAL FLAGS
1063
+ --json Format output as json.
1064
+
1065
+ OVERRIDE FLAGS
1066
+ --organization=<id> Organization ID (overrides CLI configuration)
1067
+
1068
+ DESCRIPTION
1069
+ Create a knowledge base
1070
+
1071
+ Creates a knowledge base in your organization. To add content to it, add a source. Set `draft` to `true` to create a
1072
+ draft, which needs no title or description until you finish it. If your organization's Context document store can't be
1073
+ used, the request returns `503` with code `contextStoreUnavailable` and you can retry.
1074
+
1075
+ EXAMPLES
1076
+ Create a knowledge base
1077
+
1078
+ $ sanity context create
1079
+
1080
+ Create a knowledge base, as JSON
1081
+
1082
+ $ sanity context create --json
1083
+ ```
1084
+
1085
+ ## `sanity context delete KNOWLEDGEBASEID`
1086
+
1087
+ Delete a knowledge base
1088
+
1089
+ ```
1090
+ USAGE
1091
+ $ sanity context delete KNOWLEDGEBASEID [--json] [-y]
1092
+
1093
+ ARGUMENTS
1094
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1095
+
1096
+ FLAGS
1097
+ -y, --yes Skip confirmation prompt (unattended mode)
1098
+
1099
+ GLOBAL FLAGS
1100
+ --json Format output as json.
1101
+
1102
+ DESCRIPTION
1103
+ Delete a knowledge base
1104
+
1105
+ Deletes the knowledge base and everything it owns: its sources, revisions, stored source files, and its documents in
1106
+ your organization's document store. While a build, refresh, apply, or sync is running, the request returns `409` with
1107
+ code `buildInFlight`. Retry after that work finishes.
1108
+
1109
+ EXAMPLES
1110
+ Delete a knowledge base
1111
+
1112
+ $ sanity context delete <knowledgeBaseId>
1113
+
1114
+ Delete a knowledge base, as JSON
1115
+
1116
+ $ sanity context delete <knowledgeBaseId> --json
1117
+ ```
1118
+
1119
+ ## `sanity context documents content KNOWLEDGEBASEID DOCUMENTID`
1120
+
1121
+ Get a document's markdown
1122
+
1123
+ ```
1124
+ USAGE
1125
+ $ sanity context documents content KNOWLEDGEBASEID DOCUMENTID [--json] [--format json|markdown|plain|raw] [--chunk <value>]
1126
+ [--lines <value>] [--line-numbers] [-o <file>]
1127
+
1128
+ ARGUMENTS
1129
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1130
+ DOCUMENTID The document's ID.
1131
+
1132
+ FLAGS
1133
+ -o, --output=<file> Write the content to this file instead of stdout
1134
+ --chunk=<value> Return only this chunk's lines. Citations name the chunk they quote.
1135
+ --format=<option> Response format. `json` (default) returns the markdown with its line numbers. `markdown` and
1136
+ `plain` return the markdown alone, ready to pass to a model. `raw` returns the bytes the source
1137
+ gave, before conversion: the uploaded file, the crawled page, the dataset document as JSON.
1138
+ <options: json|markdown|plain|raw>
1139
+ --line-numbers Number each line as citations number them
1140
+ --lines=<value> Return only these lines, from 1 and inclusive: `10-20`, or `10` for line 10 to the end. A range
1141
+ past the end returns up to the last line.
1142
+
1143
+ GLOBAL FLAGS
1144
+ --json Format output as json.
1145
+
1146
+ DESCRIPTION
1147
+ Get a document's markdown
1148
+
1149
+ Returns the markdown a document converted to: the text builds read, and the line numbers citations use. Set `chunk` or
1150
+ `lines` to get part of it, and `format` to `markdown` or `plain` to get the text alone instead of JSON. Until the
1151
+ document is converted, the request returns `409` with code `documentNotConverted`. With `format=raw` it returns the
1152
+ document as its source gave it, as an attachment, or `409` with code `documentNotStored` when the document was too
1153
+ large to keep.
1154
+
1155
+ EXAMPLES
1156
+ Print a document's markdown
1157
+
1158
+ $ sanity context documents content kb-abc123 document-def456
1159
+
1160
+ Print lines 10 to 20, each with its line number
1161
+
1162
+ $ sanity context documents content kb-abc123 document-def456 --lines 10-20 --line-numbers
1163
+
1164
+ Download the original file
1165
+
1166
+ $ sanity context documents content kb-abc123 document-def456 --format raw --output handbook.pdf
1167
+ ```
1168
+
1169
+ ## `sanity context documents delete KNOWLEDGEBASEID DOCUMENTID`
1170
+
1171
+ Delete a document
1172
+
1173
+ ```
1174
+ USAGE
1175
+ $ sanity context documents delete KNOWLEDGEBASEID DOCUMENTID [--json] [-y]
1176
+
1177
+ ARGUMENTS
1178
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1179
+ DOCUMENTID The document's ID.
1180
+
1181
+ FLAGS
1182
+ -y, --yes Skip confirmation prompt (unattended mode)
1183
+
1184
+ GLOBAL FLAGS
1185
+ --json Format output as json.
1186
+
1187
+ DESCRIPTION
1188
+ Delete a document
1189
+
1190
+ Deletes a document from its source. A page that is still on the website comes back on the next sync of its source
1191
+ unless the crawl options exclude it. Entries that cite the document stay the same until the next build or refresh,
1192
+ which removes the citations.
1193
+
1194
+ EXAMPLES
1195
+ Delete a document
1196
+
1197
+ $ sanity context documents delete <knowledgeBaseId> <documentId>
1198
+
1199
+ Delete a document, as JSON
1200
+
1201
+ $ sanity context documents delete <knowledgeBaseId> <documentId> --json
1202
+ ```
1203
+
1204
+ ## `sanity context documents edit KNOWLEDGEBASEID DOCUMENTID`
1205
+
1206
+ Keep a missing document
1207
+
1208
+ ```
1209
+ USAGE
1210
+ $ sanity context documents edit KNOWLEDGEBASEID DOCUMENTID --state active [--json]
1211
+
1212
+ ARGUMENTS
1213
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1214
+ DOCUMENTID The document's ID.
1215
+
1216
+ FLAGS
1217
+ --state=<option> (required) Set to `active` to keep a `missing` page in the knowledge base. The count of crawls that
1218
+ missed it starts again.
1219
+ <options: active>
1220
+
1221
+ GLOBAL FLAGS
1222
+ --json Format output as json.
1223
+
1224
+ DESCRIPTION
1225
+ Keep a missing document
1226
+
1227
+ Keeps a `missing` web page in the knowledge base by setting its `state` back to `active`. A document that isn't
1228
+ `missing` returns `409` with code `documentInvalidState`.
1229
+
1230
+ EXAMPLES
1231
+ Keep a missing document
1232
+
1233
+ $ sanity context documents edit <knowledgeBaseId> <documentId>
1234
+
1235
+ Keep a missing document, as JSON
1236
+
1237
+ $ sanity context documents edit <knowledgeBaseId> <documentId> --json
1238
+ ```
1239
+
1240
+ ## `sanity context documents get KNOWLEDGEBASEID DOCUMENTID`
1241
+
1242
+ Get a document
1243
+
1244
+ ```
1245
+ USAGE
1246
+ $ sanity context documents get KNOWLEDGEBASEID DOCUMENTID [--json]
1247
+
1248
+ ARGUMENTS
1249
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1250
+ DOCUMENTID The document's ID.
1251
+
1252
+ GLOBAL FLAGS
1253
+ --json Format output as json.
1254
+
1255
+ DESCRIPTION
1256
+ Get a document
1257
+
1258
+ Returns a document with its conversion status and the chunks of its markdown. Entry citations point at a document's
1259
+ chunks.
1260
+
1261
+ EXAMPLES
1262
+ Get a document
1263
+
1264
+ $ sanity context documents get <knowledgeBaseId> <documentId>
1265
+
1266
+ Get a document, as JSON
1267
+
1268
+ $ sanity context documents get <knowledgeBaseId> <documentId> --json
1269
+ ```
1270
+
1271
+ ## `sanity context documents list KNOWLEDGEBASEID`
1272
+
1273
+ List documents
1274
+
1275
+ ```
1276
+ USAGE
1277
+ $ sanity context documents list KNOWLEDGEBASEID [--json] [--limit <value>] [--source <value>] [--state
1278
+ active|missing|deleted] [--ids <value>]
1279
+
1280
+ ARGUMENTS
1281
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1282
+
1283
+ FLAGS
1284
+ --ids=<value> Comma-separated IDs of the documents to return, up to 200, in any state. Use it to look up the
1285
+ documents entry citations point at.
1286
+ --limit=<value> The maximum number of items to return.
1287
+ --source=<value> Return only the documents of this source.
1288
+ --state=<option> Return only documents in this state. Without it, `deleted` documents are left out.
1289
+ <options: active|missing|deleted>
1290
+
1291
+ GLOBAL FLAGS
1292
+ --json Format output as json.
1293
+
1294
+ DESCRIPTION
1295
+ List documents
1296
+
1297
+ Lists the documents in a knowledge base: the pages, dataset documents and files its sources yield, which builds read
1298
+ and cite. Results are cursor-paginated, and you can filter them by `source` and `state`.
1299
+
1300
+ EXAMPLES
1301
+ List documents
1302
+
1303
+ $ sanity context documents list <knowledgeBaseId>
1304
+
1305
+ List documents, as JSON
1306
+
1307
+ $ sanity context documents list <knowledgeBaseId> --json
1308
+ ```
1309
+
1310
+ ## `sanity context entries get KNOWLEDGEBASEID PATH`
1311
+
1312
+ Get an entry and its content
1313
+
1314
+ ```
1315
+ USAGE
1316
+ $ sanity context entries get KNOWLEDGEBASEID PATH [--json]
1317
+
1318
+ ARGUMENTS
1319
+ KNOWLEDGEBASEID Knowledge base ID
1320
+ PATH Entry path, as listed by `sanity context entries list`
1321
+
1322
+ GLOBAL FLAGS
1323
+ --json Format output as json.
1324
+
1325
+ DESCRIPTION
1326
+ Get an entry and its content
1327
+
1328
+ EXAMPLES
1329
+ Print an entry and its content
1330
+
1331
+ $ sanity context entries get kb-abc123 billing/refunds
1332
+
1333
+ Output the entry, including citations, as JSON
1334
+
1335
+ $ sanity context entries get kb-abc123 billing/refunds --json
1336
+ ```
1337
+
1338
+ ## `sanity context entries list KNOWLEDGEBASEID`
1339
+
1340
+ List the entries a knowledge base build produced
1341
+
1342
+ ```
1343
+ USAGE
1344
+ $ sanity context entries list KNOWLEDGEBASEID [--json]
1345
+
1346
+ ARGUMENTS
1347
+ KNOWLEDGEBASEID Knowledge base ID
1348
+
1349
+ GLOBAL FLAGS
1350
+ --json Format output as json.
1351
+
1352
+ DESCRIPTION
1353
+ List the entries a knowledge base build produced
1354
+
1355
+ EXAMPLES
1356
+ List all entries for a knowledge base
1357
+
1358
+ $ sanity context entries list kb-abc123
1359
+
1360
+ Output entries as JSON
1361
+
1362
+ $ sanity context entries list kb-abc123 --json
1363
+ ```
1364
+
1365
+ ## `sanity context entries rebuild KNOWLEDGEBASEID ENTRYPATH`
1366
+
1367
+ Rebuild an entry from its sources
1368
+
1369
+ ```
1370
+ USAGE
1371
+ $ sanity context entries rebuild KNOWLEDGEBASEID ENTRYPATH [--json] [--watch]
1372
+
1373
+ ARGUMENTS
1374
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1375
+ ENTRYPATH The entry's slash-delimited path, such as `pricing/plans/free`, URL-encoded.
1376
+
1377
+ FLAGS
1378
+ --watch Wait for the job to finish, exiting non-zero if it fails
1379
+
1380
+ GLOBAL FLAGS
1381
+ --json Format output as json.
1382
+
1383
+ DESCRIPTION
1384
+ Rebuild an entry from its sources
1385
+
1386
+ Queues a rewrite of the entry at `entryPath` from its cited sources and the active instructions, and returns a job ID
1387
+ immediately. The response also lists the other entries built from any of the same sources. An instruction applies to
1388
+ every entry built from its sources, so those entries can change too. Returns `422` with code `entryDocumentInvalid` if
1389
+ the entry document was edited into a shape the API cannot read.
1390
+
1391
+ EXAMPLES
1392
+ Rebuild an entry from its sources
1393
+
1394
+ $ sanity context entries rebuild <knowledgeBaseId> <entryPath>
1395
+
1396
+ Rebuild an entry from its sources, as JSON
1397
+
1398
+ $ sanity context entries rebuild <knowledgeBaseId> <entryPath> --json
1399
+ ```
1400
+
1401
+ ## `sanity context get KNOWLEDGEBASEID`
1402
+
1403
+ Get a knowledge base
1404
+
1405
+ ```
1406
+ USAGE
1407
+ $ sanity context get KNOWLEDGEBASEID [--json]
1408
+
1409
+ ARGUMENTS
1410
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1411
+
1412
+ GLOBAL FLAGS
1413
+ --json Format output as json.
1414
+
1415
+ DESCRIPTION
1416
+ Get a knowledge base
1417
+
1418
+ Returns a knowledge base's metadata and state. `knowledgeBaseId` accepts the public ID (`kb...`) or the UUID, and you
1419
+ don't need to pass an organization. If you can't read the knowledge base, the request returns `404`. To read the built
1420
+ entries, query `sanity.context.entry` documents with GROQ from your organization's document store.
1421
+
1422
+ EXAMPLES
1423
+ Get a knowledge base
1424
+
1425
+ $ sanity context get <knowledgeBaseId>
1426
+
1427
+ Get a knowledge base, as JSON
1428
+
1429
+ $ sanity context get <knowledgeBaseId> --json
1430
+ ```
1431
+
1432
+ ## `sanity context instructions create KNOWLEDGEBASEID`
1433
+
1434
+ Create an instruction
1435
+
1436
+ ```
1437
+ USAGE
1438
+ $ sanity context instructions create KNOWLEDGEBASEID --statement <value> --scope-document-ids <value>... [--json]
1439
+ [--rebuild-paths <value>...] [--verified]
1440
+
1441
+ ARGUMENTS
1442
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1443
+
1444
+ FLAGS
1445
+ --rebuild-paths=<value>... Paths of entries to rebuild under the new instruction right away. The response
1446
+ returns the rebuild job ID in `rebuildJobId`.
1447
+ --scope-document-ids=<value>... (required) IDs of the documents the instruction applies to. Builds apply it when they
1448
+ write entries built from these documents. IDs of documents that no longer exist are
1449
+ dropped. If none exist, the request returns `422` with code
1450
+ `instructionScopeVanished`.
1451
+ --statement=<value> (required) The instruction in plain language. Builds follow it over what the sources
1452
+ say.
1453
+ --[no-]verified Whether you already checked the instruction for entries that contradict it. When
1454
+ `true`, the background check that files issues for those entries is skipped. It still
1455
+ runs if the rebuild you requested in `rebuildPaths` does not start.
1456
+
1457
+ GLOBAL FLAGS
1458
+ --json Format output as json.
1459
+
1460
+ DESCRIPTION
1461
+ Create an instruction
1462
+
1463
+ Creates a standing instruction for how entries built from its documents are written. Every instruction applies to
1464
+ specific documents, set in `scopeDocumentIds`. To rebuild entries under the new instruction right away, pass their
1465
+ paths in `rebuildPaths`. The response includes the rebuild job ID, or `null` if the rebuild could not start. The
1466
+ instruction is saved either way. After the instruction is saved, a background check files issues for entries that
1467
+ contradict it. If you already checked the instruction for contradictions, set `verified` to skip the background check.
1468
+ If the requested rebuild does not start, the background check runs even when `verified` is set.
1469
+
1470
+ EXAMPLES
1471
+ Create an instruction
1472
+
1473
+ $ sanity context instructions create <knowledgeBaseId>
1474
+
1475
+ Create an instruction, as JSON
1476
+
1477
+ $ sanity context instructions create <knowledgeBaseId> --json
1478
+ ```
1479
+
1480
+ ## `sanity context instructions delete KNOWLEDGEBASEID INSTRUCTIONID`
1481
+
1482
+ Delete an instruction
1483
+
1484
+ ```
1485
+ USAGE
1486
+ $ sanity context instructions delete KNOWLEDGEBASEID INSTRUCTIONID [--json] [--rebuild] [-y]
1487
+
1488
+ ARGUMENTS
1489
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1490
+ INSTRUCTIONID The instruction's ID.
1491
+
1492
+ FLAGS
1493
+ -y, --yes Skip confirmation prompt (unattended mode)
1494
+ --[no-]rebuild Set to `true` to rebuild every entry built from the instruction's documents once it is deleted, so
1495
+ pages written under the instruction reflect their documents again. The response returns the
1496
+ rebuild job ID in `rebuildJobId`.
1497
+
1498
+ GLOBAL FLAGS
1499
+ --json Format output as json.
1500
+
1501
+ DESCRIPTION
1502
+ Delete an instruction
1503
+
1504
+ Deletes the instruction. Builds stop applying it from the next run. Entries already written under it keep their text
1505
+ until they are rebuilt; pass `rebuild=true` to rebuild every entry built from its documents right away.
1506
+
1507
+ EXAMPLES
1508
+ Delete an instruction
1509
+
1510
+ $ sanity context instructions delete <knowledgeBaseId> <instructionId>
1511
+
1512
+ Delete an instruction, as JSON
1513
+
1514
+ $ sanity context instructions delete <knowledgeBaseId> <instructionId> --json
1515
+ ```
1516
+
1517
+ ## `sanity context instructions edit KNOWLEDGEBASEID INSTRUCTIONID`
1518
+
1519
+ Update an instruction
1520
+
1521
+ ```
1522
+ USAGE
1523
+ $ sanity context instructions edit KNOWLEDGEBASEID INSTRUCTIONID [--json] [--statement <value>] [--scope-document-ids
1524
+ <value>...]
1525
+
1526
+ ARGUMENTS
1527
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1528
+ INSTRUCTIONID The instruction's ID.
1529
+
1530
+ FLAGS
1531
+ --scope-document-ids=<value>... IDs of the documents the instruction applies to. Replaces the current list. Omit it
1532
+ to keep the current documents. IDs of documents that no longer exist are dropped. If
1533
+ none exist, the request returns `422` with code `instructionScopeVanished`.
1534
+ --statement=<value> The new instruction text. Omit it to keep the current text.
1535
+
1536
+ GLOBAL FLAGS
1537
+ --json Format output as json.
1538
+
1539
+ DESCRIPTION
1540
+ Update an instruction
1541
+
1542
+ Updates the instruction's statement or documents. The change applies from the next build. Any update also reactivates
1543
+ an archived instruction and ties it to the current content of its documents.
1544
+
1545
+ EXAMPLES
1546
+ Update an instruction
1547
+
1548
+ $ sanity context instructions edit <knowledgeBaseId> <instructionId>
1549
+
1550
+ Update an instruction, as JSON
1551
+
1552
+ $ sanity context instructions edit <knowledgeBaseId> <instructionId> --json
1553
+ ```
1554
+
1555
+ ## `sanity context issues apply KNOWLEDGEBASEID ISSUEIDS`
1556
+
1557
+ Accept and apply issues
1558
+
1559
+ ```
1560
+ USAGE
1561
+ $ sanity context issues apply KNOWLEDGEBASEID ISSUEIDS... [--json] [--watch]
1562
+
1563
+ ARGUMENTS
1564
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1565
+ ISSUEIDS... The IDs of the issues to accept and apply.
1566
+
1567
+ FLAGS
1568
+ --watch Wait for the job to finish, exiting non-zero if it fails
1569
+
1570
+ GLOBAL FLAGS
1571
+ --json Format output as json.
1572
+
1573
+ DESCRIPTION
1574
+ Accept and apply issues
1575
+
1576
+ Accepts the issues in `issueIds`, then queues a job that applies them, rewrites the affected entries, and saves a new
1577
+ revision. Returns a job ID. IDs of issues that no longer exist are skipped. Returns `409` with code
1578
+ `issueNotAutoApplicable`, and accepts none of the issues, if any of them cannot be applied: a `conflict` (resolve it
1579
+ with `POST .../issues/{issueId}/resolve`), or an `update_required` issue whose `scopePath` is `*` or names an entry
1580
+ that no longer exists. Dismiss those instead.
1581
+
1582
+ EXAMPLES
1583
+ Accept and apply issues
1584
+
1585
+ $ sanity context issues apply <knowledgeBaseId>
1586
+
1587
+ Accept and apply issues, as JSON
1588
+
1589
+ $ sanity context issues apply <knowledgeBaseId> --json
1590
+ ```
1591
+
1592
+ ## `sanity context issues dismiss KNOWLEDGEBASEID ISSUEID`
1593
+
1594
+ Dismiss an issue
1595
+
1596
+ ```
1597
+ USAGE
1598
+ $ sanity context issues dismiss KNOWLEDGEBASEID ISSUEID [--json]
1599
+
1600
+ ARGUMENTS
1601
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1602
+ ISSUEID The issue's document ID.
1603
+
1604
+ GLOBAL FLAGS
1605
+ --json Format output as json.
1606
+
1607
+ DESCRIPTION
1608
+ Dismiss an issue
1609
+
1610
+ Marks the issue as rejected. If the issue already left triage, the request returns it unchanged. Returns `422` with
1611
+ code `issueDocumentInvalid` if the issue document was edited into a shape the API cannot verify. Returns `409` with
1612
+ code `issueTransitionConflict` if another change to the issue happened at the same time. You can safely retry a `409`.
1613
+
1614
+ EXAMPLES
1615
+ Dismiss an issue
1616
+
1617
+ $ sanity context issues dismiss <knowledgeBaseId> <issueId>
1618
+
1619
+ Dismiss an issue, as JSON
1620
+
1621
+ $ sanity context issues dismiss <knowledgeBaseId> <issueId> --json
1622
+ ```
1623
+
1624
+ ## `sanity context issues get KNOWLEDGEBASEID ISSUEID`
1625
+
1626
+ Get details of an issue
1627
+
1628
+ ```
1629
+ USAGE
1630
+ $ sanity context issues get KNOWLEDGEBASEID ISSUEID [--json]
1631
+
1632
+ ARGUMENTS
1633
+ KNOWLEDGEBASEID Knowledge base ID
1634
+ ISSUEID Issue ID
1635
+
1636
+ GLOBAL FLAGS
1637
+ --json Format output as json.
1638
+
1639
+ DESCRIPTION
1640
+ Get details of an issue
1641
+
1642
+ EXAMPLES
1643
+ Get details of a specific issue
1644
+
1645
+ $ sanity context issues get kb-abc123 issue.def456
1646
+
1647
+ Output the issue as JSON
1648
+
1649
+ $ sanity context issues get kb-abc123 issue.def456 --json
1650
+ ```
1651
+
1652
+ ## `sanity context issues list KNOWLEDGEBASEID`
1653
+
1654
+ List issues found by knowledge base builds
1655
+
1656
+ ```
1657
+ USAGE
1658
+ $ sanity context issues list KNOWLEDGEBASEID [--json] [--kind conflict|update_required] [--scope <path>] [--severity
1659
+ critical|suggestion] [--status open|accepted|rejected]
1660
+
1661
+ ARGUMENTS
1662
+ KNOWLEDGEBASEID Knowledge base ID
1663
+
1664
+ FLAGS
1665
+ --kind=<option> Only list issues of this kind
1666
+ <options: conflict|update_required>
1667
+ --scope=<path> Only list issues about this entry path or anything under it (`*` for knowledge-base-wide issues)
1668
+ --severity=<option> Only list issues of this severity
1669
+ <options: critical|suggestion>
1670
+ --status=<option> Only list issues with this status (rejected = dismissed, accepted = resolved or applied)
1671
+ <options: open|accepted|rejected>
1672
+
1673
+ GLOBAL FLAGS
1674
+ --json Format output as json.
1675
+
1676
+ DESCRIPTION
1677
+ List issues found by knowledge base builds
1678
+
1679
+ EXAMPLES
1680
+ List all issues for a knowledge base
1681
+
1682
+ $ sanity context issues list kb-abc123
1683
+
1684
+ List issues awaiting triage
1685
+
1686
+ $ sanity context issues list kb-abc123 --status open
1687
+
1688
+ List critical conflicts
1689
+
1690
+ $ sanity context issues list kb-abc123 --kind conflict --severity critical
1691
+
1692
+ List issues about entries under billing/
1693
+
1694
+ $ sanity context issues list kb-abc123 --scope billing
1695
+
1696
+ Output issues as JSON
1697
+
1698
+ $ sanity context issues list kb-abc123 --json
1699
+ ```
1700
+
1701
+ ## `sanity context issues reopen KNOWLEDGEBASEID ISSUEID`
1702
+
1703
+ Reopen an accepted conflict
1704
+
1705
+ ```
1706
+ USAGE
1707
+ $ sanity context issues reopen KNOWLEDGEBASEID ISSUEID [--json]
1708
+
1709
+ ARGUMENTS
1710
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1711
+ ISSUEID The issue's document ID.
1712
+
1713
+ GLOBAL FLAGS
1714
+ --json Format output as json.
1715
+
1716
+ DESCRIPTION
1717
+ Reopen an accepted conflict
1718
+
1719
+ Returns an accepted conflict issue to triage, clears its resolution, and deletes the instruction the resolution
1720
+ created. Reopening an open or dismissed conflict returns it unchanged. Other issue types return `422` with code
1721
+ `issueNotResolvable`.
1722
+
1723
+ EXAMPLES
1724
+ Reopen an accepted conflict
1725
+
1726
+ $ sanity context issues reopen <knowledgeBaseId> <issueId>
1727
+
1728
+ Reopen an accepted conflict, as JSON
1729
+
1730
+ $ sanity context issues reopen <knowledgeBaseId> <issueId> --json
1731
+ ```
1732
+
1733
+ ## `sanity context issues resolve KNOWLEDGEBASEID ISSUEID`
1734
+
1735
+ Resolve a conflict issue
1736
+
1737
+ ```
1738
+ USAGE
1739
+ $ sanity context issues resolve KNOWLEDGEBASEID ISSUEID [--json] [--watch] [--side <value>]
1740
+
1741
+ ARGUMENTS
1742
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1743
+ ISSUEID The issue's document ID.
1744
+
1745
+ FLAGS
1746
+ --side=<value> Index of the correct side, as listed by `sanity context issues get`
1747
+ --watch Wait for the job to finish, exiting non-zero if it fails
1748
+
1749
+ GLOBAL FLAGS
1750
+ --json Format output as json.
1751
+
1752
+ DESCRIPTION
1753
+ Resolve a conflict issue
1754
+
1755
+ Resolves a conflict issue by choosing one of its sides. Set `resolution` to the index of a side in `content.sides`.
1756
+ For a conflict on a single entry, index `0` is the entry's current content, so choosing it keeps the entry as it is.
1757
+ Choosing any other side rewrites the entry, and the returned `jobId` tracks the rewrite. The decision becomes a
1758
+ standing instruction for every future build, and `resolvedBy` records who made it. To change a decision, resolve the
1759
+ accepted conflict again. Other issue types, dismissed conflicts, and out-of-range indexes return `422` with code
1760
+ `issueNotResolvable`.
1761
+
1762
+ EXAMPLES
1763
+ Choose the correct side interactively
1764
+
1765
+ $ sanity context issues resolve kb-abc123 issue-def456
1766
+
1767
+ Choose side 1 and wait for the entry rewrite
1768
+
1769
+ $ sanity context issues resolve kb-abc123 issue-def456 --side 1 --watch
1770
+ ```
1771
+
1772
+ ## `sanity context jobs get KNOWLEDGEBASEID JOBID`
1773
+
1774
+ Get a job
1775
+
1776
+ ```
1777
+ USAGE
1778
+ $ sanity context jobs get KNOWLEDGEBASEID JOBID [--json] [--watch]
1779
+
1780
+ ARGUMENTS
1781
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1782
+ JOBID The job ID returned by the endpoint that started the work.
1783
+
1784
+ FLAGS
1785
+ --watch Wait for the job to finish, exiting non-zero if it fails
1786
+
1787
+ GLOBAL FLAGS
1788
+ --json Format output as json.
1789
+
1790
+ DESCRIPTION
1791
+ Get a job
1792
+
1793
+ Returns the status of a background job, such as a build, sync, or refresh. The endpoint that starts the work returns
1794
+ the job ID.
1795
+
1796
+ EXAMPLES
1797
+ Get a job
1798
+
1799
+ $ sanity context jobs get <knowledgeBaseId> <jobId>
1800
+
1801
+ Get a job, as JSON
1802
+
1803
+ $ sanity context jobs get <knowledgeBaseId> <jobId> --json
1804
+ ```
1805
+
1806
+ ## `sanity context list`
1807
+
1808
+ List knowledge bases
1809
+
1810
+ ```
1811
+ USAGE
1812
+ $ sanity context list [--json] [--limit <value>] [--include-drafts] [--organization <id>]
1813
+
1814
+ FLAGS
1815
+ --[no-]include-drafts Set to `true` to also list the organization's drafts, which have `state` set to `draft`. Drafts
1816
+ count toward the plan's knowledge base limit, and `createdBy` says who started each one.
1817
+ --limit=<value> The maximum number of items to return.
1818
+
1819
+ GLOBAL FLAGS
1820
+ --json Format output as json.
1821
+
1822
+ OVERRIDE FLAGS
1823
+ --organization=<id> Organization ID (overrides CLI configuration)
1824
+
1825
+ DESCRIPTION
1826
+ List knowledge bases
1827
+
1828
+ Returns the knowledge bases you can access in the organization set by `organizationId`. Drafts are left out unless you
1829
+ set `includeDrafts` to `true`. Results are cursor-paginated, newest first.
1830
+
1831
+ EXAMPLES
1832
+ List knowledge bases
1833
+
1834
+ $ sanity context list
1835
+
1836
+ List knowledge bases, as JSON
1013
1837
 
1014
- $ sanity context build kb-abc123 --cancel
1838
+ $ sanity context list --json
1015
1839
  ```
1016
1840
 
1017
- ## `sanity context create`
1841
+ ## `sanity context mcp create NAME`
1018
1842
 
1019
- Create a knowledge base
1843
+ Create a Context MCP endpoint that serves knowledge bases and a dataset to agents
1020
1844
 
1021
1845
  ```
1022
1846
  USAGE
1023
- $ sanity context create [--organization <id>] [--description <value>] [--title <value>]
1847
+ $ sanity context mcp create NAME [--organization <id>] [-p <id> -d <name>] [--groq-filter <value> ] [--instructions
1848
+ <value>] [--knowledge-base <id>...] [--perspective published|drafts|raw ] [--semantic-search ] [--title <value>]
1849
+ [--workspace <value> ]
1850
+
1851
+ ARGUMENTS
1852
+ NAME Permanent MCP endpoint name used in its URL, made of lowercase letters, digits and hyphens
1024
1853
 
1025
1854
  FLAGS
1026
- --description=<value> Knowledge base description
1027
- --title=<value> Knowledge base title
1855
+ -d, --dataset=<name> Dataset the endpoint serves
1856
+ --groq-filter=<value> GROQ filter that limits which dataset documents the endpoint serves
1857
+ --instructions=<value> Instructions the endpoint serves to connecting agents
1858
+ --knowledge-base=<id>... Knowledge base the endpoint serves; repeat the flag to serve several
1859
+ --perspective=<option> Perspective agents query the dataset with
1860
+ <options: published|drafts|raw>
1861
+ --[no-]semantic-search Let agents use semantic search on the dataset (--no-semantic-search to turn it off)
1862
+ --title=<value> MCP endpoint title
1863
+ --workspace=<value> Studio workspace whose schema agents use, instead of the first workspace
1028
1864
 
1029
1865
  OVERRIDE FLAGS
1030
- --organization=<id> Organization to create the knowledge base in (overrides CLI configuration)
1866
+ -p, --project=<id> Project the dataset belongs to (overrides CLI configuration)
1867
+ --organization=<id> Organization to create the MCP endpoint in (overrides CLI configuration)
1031
1868
 
1032
1869
  DESCRIPTION
1033
- Create a knowledge base
1870
+ Create a Context MCP endpoint that serves knowledge bases and a dataset to agents
1034
1871
 
1035
1872
  EXAMPLES
1036
- Interactively create a knowledge base
1873
+ Create an MCP endpoint that serves two knowledge bases
1037
1874
 
1038
- $ sanity context create
1875
+ $ sanity context mcp create support --title "Support" --knowledge-base kb-abc123 --knowledge-base kb-def456
1039
1876
 
1040
- Create a knowledge base in a specific organization
1877
+ Create an MCP endpoint that serves the products in a dataset
1041
1878
 
1042
- $ sanity context create --organization org-abc123 --title "Support docs" --description "Product docs and \
1043
- troubleshooting guides"
1879
+ $ sanity context mcp create catalog --title "Catalog" --project abc123 --dataset production --perspective drafts \
1880
+ --groq-filter '_type in ["product"]'
1044
1881
  ```
1045
1882
 
1046
- ## `sanity context delete KNOWLEDGEBASEID`
1883
+ ## `sanity context mcp delete NAME`
1047
1884
 
1048
- Delete a knowledge base and its generated content
1885
+ Delete a Context MCP endpoint, which disconnects any agents using it
1049
1886
 
1050
1887
  ```
1051
1888
  USAGE
1052
- $ sanity context delete KNOWLEDGEBASEID [-y]
1889
+ $ sanity context mcp delete NAME [--organization <id>] [-y]
1053
1890
 
1054
1891
  ARGUMENTS
1055
- KNOWLEDGEBASEID Knowledge base ID
1892
+ NAME MCP endpoint name, as in its URL
1056
1893
 
1057
1894
  FLAGS
1058
1895
  -y, --yes Skip confirmation prompt (unattended mode)
1059
1896
 
1897
+ OVERRIDE FLAGS
1898
+ --organization=<id> Organization the MCP endpoint belongs to (overrides CLI configuration)
1899
+
1060
1900
  DESCRIPTION
1061
- Delete a knowledge base and its generated content
1901
+ Delete a Context MCP endpoint, which disconnects any agents using it
1062
1902
 
1063
1903
  EXAMPLES
1064
- Delete a knowledge base after confirmation
1904
+ Delete an MCP endpoint after confirmation
1065
1905
 
1066
- $ sanity context delete kb-abc123
1906
+ $ sanity context mcp delete support
1067
1907
 
1068
- Delete a knowledge base without confirmation prompt
1908
+ Delete an MCP endpoint without confirmation prompt
1069
1909
 
1070
- $ sanity context delete kb-abc123 --yes
1910
+ $ sanity context mcp delete support --yes
1071
1911
  ```
1072
1912
 
1073
- ## `sanity context entries get KNOWLEDGEBASEID PATH`
1913
+ ## `sanity context mcp get NAME`
1074
1914
 
1075
- Get an entry and its content
1915
+ Get details of a Context MCP endpoint, including its URL
1076
1916
 
1077
1917
  ```
1078
1918
  USAGE
1079
- $ sanity context entries get KNOWLEDGEBASEID PATH [--json]
1919
+ $ sanity context mcp get NAME [--json] [--organization <id>]
1080
1920
 
1081
1921
  ARGUMENTS
1082
- KNOWLEDGEBASEID Knowledge base ID
1083
- PATH Entry path, as listed by `sanity context entries list`
1922
+ NAME MCP endpoint name, as in its URL
1084
1923
 
1085
1924
  GLOBAL FLAGS
1086
1925
  --json Format output as json.
1087
1926
 
1927
+ OVERRIDE FLAGS
1928
+ --organization=<id> Organization the MCP endpoint belongs to (overrides CLI configuration)
1929
+
1088
1930
  DESCRIPTION
1089
- Get an entry and its content
1931
+ Get details of a Context MCP endpoint, including its URL
1090
1932
 
1091
1933
  EXAMPLES
1092
- Print an entry and its content
1934
+ Get details of the "support" MCP endpoint
1093
1935
 
1094
- $ sanity context entries get kb-abc123 billing/refunds
1936
+ $ sanity context mcp get support
1095
1937
 
1096
- Output the entry, including citations, as JSON
1938
+ Output an MCP endpoint in a specific organization as JSON
1097
1939
 
1098
- $ sanity context entries get kb-abc123 billing/refunds --json
1940
+ $ sanity context mcp get support --organization org-abc123 --json
1099
1941
  ```
1100
1942
 
1101
- ## `sanity context entries list KNOWLEDGEBASEID`
1943
+ ## `sanity context mcp initial-context MCPENDPOINT`
1102
1944
 
1103
- List the entries a knowledge base build produced
1945
+ Get an MCP endpoint's initial context
1104
1946
 
1105
1947
  ```
1106
1948
  USAGE
1107
- $ sanity context entries list KNOWLEDGEBASEID [--json]
1949
+ $ sanity context mcp initial-context MCPENDPOINT [--json] [--link-resolver <value>] [--heading_offset <value>] [--organization
1950
+ <id>]
1108
1951
 
1109
1952
  ARGUMENTS
1110
- KNOWLEDGEBASEID Knowledge base ID
1953
+ MCPENDPOINT The MCP endpoint's name, set when the endpoint was created.
1954
+
1955
+ FLAGS
1956
+ --heading_offset=<value> How many levels to shift markdown headings down, from `0` to `6`. Defaults to `1`, so `#`
1957
+ becomes `##`.
1958
+ --link-resolver=<value> A JSON array that adds `_url` fields to query results. Each item has `types` (document
1959
+ types), `baseUrl`, and an optional `slugExpression`, a GROQ expression that defaults to
1960
+ `slug.current`. Invalid JSON is ignored.
1111
1961
 
1112
1962
  GLOBAL FLAGS
1113
1963
  --json Format output as json.
1114
1964
 
1965
+ OVERRIDE FLAGS
1966
+ --organization=<id> Organization ID (overrides CLI configuration)
1967
+
1115
1968
  DESCRIPTION
1116
- List the entries a knowledge base build produced
1969
+ Get an MCP endpoint's initial context
1970
+
1971
+ Returns the same text as the `initial_context` MCP tool, as plain text you can add to a system prompt.
1972
+ `heading_offset` shifts markdown headings down by that many levels. The default is `1`, so `#` becomes `##`.
1117
1973
 
1118
1974
  EXAMPLES
1119
- List all entries for a knowledge base
1975
+ Get an MCP endpoint's initial context
1120
1976
 
1121
- $ sanity context entries list kb-abc123
1977
+ $ sanity context mcp initial-context <mcpEndpoint>
1122
1978
 
1123
- Output entries as JSON
1979
+ Get an MCP endpoint's initial context, as JSON
1124
1980
 
1125
- $ sanity context entries list kb-abc123 --json
1981
+ $ sanity context mcp initial-context <mcpEndpoint> --json
1126
1982
  ```
1127
1983
 
1128
- ## `sanity context entries rebuild KNOWLEDGEBASEID PATH`
1984
+ ## `sanity context mcp list`
1129
1985
 
1130
- Rebuild one entry from its sources
1986
+ List Context MCP endpoints in an organization
1131
1987
 
1132
1988
  ```
1133
1989
  USAGE
1134
- $ sanity context entries rebuild KNOWLEDGEBASEID PATH [--watch]
1990
+ $ sanity context mcp list [--json] [--organization <id>]
1135
1991
 
1136
- ARGUMENTS
1137
- KNOWLEDGEBASEID Knowledge base ID
1138
- PATH Entry path, as listed by `sanity context entries list`
1992
+ GLOBAL FLAGS
1993
+ --json Format output as json.
1139
1994
 
1140
- FLAGS
1141
- --watch Wait for the rebuild to finish, exiting non-zero if it fails
1995
+ OVERRIDE FLAGS
1996
+ --organization=<id> Organization to list MCP endpoints for (overrides CLI configuration)
1142
1997
 
1143
1998
  DESCRIPTION
1144
- Rebuild one entry from its sources
1999
+ List Context MCP endpoints in an organization
1145
2000
 
1146
2001
  EXAMPLES
1147
- Start a rebuild and return the job ID
2002
+ List MCP endpoints, selecting the organization interactively
1148
2003
 
1149
- $ sanity context entries rebuild kb-abc123 billing/refunds
2004
+ $ sanity context mcp list
1150
2005
 
1151
- Rebuild an entry and wait for it to finish (non-zero exit on failure)
2006
+ Output the MCP endpoints of a specific organization as JSON
1152
2007
 
1153
- $ sanity context entries rebuild kb-abc123 billing/refunds --watch
2008
+ $ sanity context mcp list --organization org-abc123 --json
1154
2009
  ```
1155
2010
 
1156
- ## `sanity context get KNOWLEDGEBASEID`
2011
+ ## `sanity context mcp status NAME`
1157
2012
 
1158
- Get details of a knowledge base
2013
+ Check whether an agent connecting with your credentials can use a Context MCP endpoint
1159
2014
 
1160
2015
  ```
1161
2016
  USAGE
1162
- $ sanity context get KNOWLEDGEBASEID [--json]
2017
+ $ sanity context mcp status NAME [--json] [--organization <id>]
1163
2018
 
1164
2019
  ARGUMENTS
1165
- KNOWLEDGEBASEID Knowledge base ID
2020
+ NAME MCP endpoint name, as in its URL
1166
2021
 
1167
2022
  GLOBAL FLAGS
1168
2023
  --json Format output as json.
1169
2024
 
2025
+ OVERRIDE FLAGS
2026
+ --organization=<id> Organization the MCP endpoint belongs to (overrides CLI configuration)
2027
+
1170
2028
  DESCRIPTION
1171
- Get details of a knowledge base
2029
+ Check whether an agent connecting with your credentials can use a Context MCP endpoint
1172
2030
 
1173
2031
  EXAMPLES
1174
- Get details of a specific knowledge base
1175
-
1176
- $ sanity context get kb-abc123
2032
+ Check the "support" MCP endpoint
1177
2033
 
1178
- Output the knowledge base as JSON
1179
-
1180
- $ sanity context get kb-abc123 --json
2034
+ $ sanity context mcp status support
1181
2035
  ```
1182
2036
 
1183
- ## `sanity context imports create KNOWLEDGEBASEID`
2037
+ ## `sanity context mcp update NAME`
1184
2038
 
1185
- Import content into a knowledge base
2039
+ Update a Context MCP endpoint
1186
2040
 
1187
2041
  ```
1188
2042
  USAGE
1189
- $ sanity context imports create KNOWLEDGEBASEID [--content-type <mime>] [--file <path> | --text <value> | --url <url> |
1190
- --query <value>] [--sanity-dataset <name> ] [--sanity-project <id> ] [--title <value> ]
2043
+ $ sanity context mcp update NAME [--organization <id>] [--add-knowledge-base <id>...] [-p <id> -d <name>]
2044
+ [--groq-filter <value>] [--instructions <value>] [--no-dataset | ] [--perspective published|drafts|raw]
2045
+ [--remove-knowledge-base <id>...] [--semantic-search] [--title <value>] [--workspace <value>]
1191
2046
 
1192
2047
  ARGUMENTS
1193
- KNOWLEDGEBASEID Knowledge base ID
2048
+ NAME MCP endpoint name, as in its URL
1194
2049
 
1195
2050
  FLAGS
1196
- --content-type=<mime> Content type of the import (--text: text/markdown or text/plain; --file: any MIME type,
1197
- inferred from the file extension when omitted)
1198
- --file=<path> Path to a local file to import
1199
- --query=<value> GROQ query binding a Sanity dataset as a source
1200
- --sanity-dataset=<name> Sanity dataset for a dataset import
1201
- --sanity-project=<id> Sanity project ID for a dataset import
1202
- --text=<value> Inline text content to import (requires --title)
1203
- --title=<value> Title for an inline text import
1204
- --url=<url> Website URL to crawl
2051
+ -d, --dataset=<name> Dataset the endpoint serves, replacing its current dataset
2052
+ --add-knowledge-base=<id>... Knowledge base to add to the endpoint; repeat the flag to add several
2053
+ --groq-filter=<value> GROQ filter that limits which dataset documents the endpoint serves ("" removes
2054
+ it)
2055
+ --instructions=<value> Instructions the endpoint serves to connecting agents ("" removes them)
2056
+ --no-dataset Stop serving the dataset, which also removes the GROQ filter
2057
+ --perspective=<option> Perspective agents query the dataset with
2058
+ <options: published|drafts|raw>
2059
+ --remove-knowledge-base=<id>... Knowledge base to remove from the endpoint; repeat the flag to remove several
2060
+ --[no-]semantic-search Let agents use semantic search on the dataset (--no-semantic-search to turn it
2061
+ off)
2062
+ --title=<value> New MCP endpoint title
2063
+ --workspace=<value> Studio workspace whose schema agents use ("" goes back to the first workspace)
2064
+
2065
+ OVERRIDE FLAGS
2066
+ -p, --project=<id> Project the dataset belongs to (overrides CLI configuration)
2067
+ --organization=<id> Organization the MCP endpoint belongs to (overrides CLI configuration)
1205
2068
 
1206
2069
  DESCRIPTION
1207
- Import content into a knowledge base
2070
+ Update a Context MCP endpoint
2071
+
2072
+ Only the settings you pass change. Dataset settings (--workspace, --perspective, --semantic-search) apply to the
2073
+ endpoint's dataset and start from the defaults when --dataset switches to another dataset.
1208
2074
 
1209
2075
  EXAMPLES
1210
- Import inline text
2076
+ Rename an MCP endpoint
1211
2077
 
1212
- $ sanity context imports create kb-abc123 --text "Refunds are processed within 5 days" --title "Refund policy"
2078
+ $ sanity context mcp update support --title "Customer support"
1213
2079
 
1214
- Upload and import a local file
2080
+ Serve a different knowledge base
1215
2081
 
1216
- $ sanity context imports create kb-abc123 --file ./handbook.pdf
2082
+ $ sanity context mcp update support --add-knowledge-base kb-def456 --remove-knowledge-base kb-abc123
1217
2083
 
1218
- Crawl a website
2084
+ Switch to another dataset and query its drafts
2085
+
2086
+ $ sanity context mcp update catalog --project abc123 --dataset staging --perspective drafts
2087
+
2088
+ Stop serving the dataset
1219
2089
 
1220
- $ sanity context imports create kb-abc123 --url https://example.com/docs
2090
+ $ sanity context mcp update support --no-dataset
1221
2091
 
1222
- Bind a Sanity dataset as a source
2092
+ Remove the instructions
1223
2093
 
1224
- $ sanity context imports create kb-abc123 --query '*[_type == "article"]' --sanity-project abc123 \
1225
- --sanity-dataset production
2094
+ $ sanity context mcp update support --instructions ""
1226
2095
  ```
1227
2096
 
1228
- ## `sanity context imports delete KNOWLEDGEBASEID IMPORTID`
2097
+ ## `sanity context query QUERY`
1229
2098
 
1230
- Delete an import from a knowledge base
2099
+ Query an organization's Context documents with GROQ
1231
2100
 
1232
2101
  ```
1233
2102
  USAGE
1234
- $ sanity context imports delete KNOWLEDGEBASEID IMPORTID [-y]
2103
+ $ sanity context query QUERY [--json] [--organization <id>] [--params <json>]
1235
2104
 
1236
2105
  ARGUMENTS
1237
- KNOWLEDGEBASEID Knowledge base ID
1238
- IMPORTID Import ID
2106
+ QUERY GROQ query to run against the organization's Context documents
1239
2107
 
1240
2108
  FLAGS
1241
- -y, --yes Skip confirmation prompt (unattended mode)
2109
+ --params=<json> Query parameters as a JSON object
2110
+
2111
+ GLOBAL FLAGS
2112
+ --json Format output as json.
2113
+
2114
+ OVERRIDE FLAGS
2115
+ --organization=<id> Organization to query (overrides CLI configuration)
1242
2116
 
1243
2117
  DESCRIPTION
1244
- Delete an import from a knowledge base
2118
+ Query an organization's Context documents with GROQ
1245
2119
 
1246
2120
  EXAMPLES
1247
- Delete an import after confirmation
2121
+ List open issues across all knowledge bases
1248
2122
 
1249
- $ sanity context imports delete kb-abc123 import-def456
2123
+ $ sanity context query '*[_type == "sanity.context.issue" && status == "open"]{_id, knowledgeBaseId}'
1250
2124
 
1251
- Delete an import without confirmation prompt
2125
+ List the entry paths of one knowledge base as plain JSON
1252
2126
 
1253
- $ sanity context imports delete kb-abc123 import-def456 --yes
2127
+ $ sanity context query '*[_type == "sanity.context.entry" && knowledgeBaseId == $kb].path' --params '{"kb": \
2128
+ "kb-abc123"}' --json
1254
2129
  ```
1255
2130
 
1256
- ## `sanity context imports download KNOWLEDGEBASEID IMPORTID`
2131
+ ## `sanity context sources create KNOWLEDGEBASEID`
1257
2132
 
1258
- Get a short-lived signed URL for the original uploaded bytes of a file import
2133
+ Add a source
1259
2134
 
1260
2135
  ```
1261
2136
  USAGE
1262
- $ sanity context imports download KNOWLEDGEBASEID IMPORTID [--json]
2137
+ $ sanity context sources create KNOWLEDGEBASEID [--json] [--type web|sanity-dataset|files] [--url <value> | --query
2138
+ <value> | --file <path> | --text <path|->] [--include-paths <value>...] [--exclude-paths <value>...] [--max-depth
2139
+ <value>] [--sitemap-only] [--ignore-query-parameters] [--page-limit <value>] [--dry-run] [--sanity-project-id
2140
+ <value>] [--sanity-dataset-id <value>] [--title <value>] [--content-type text/markdown|text/plain] [--watch]
1263
2141
 
1264
2142
  ARGUMENTS
1265
- KNOWLEDGEBASEID Knowledge base ID
1266
- IMPORTID Import ID
2143
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2144
+
2145
+ FLAGS
2146
+ --content-type=<option> The format of `content`: `text/markdown` (the default) or `text/plain`. Only with
2147
+ `content`. Only for type files.
2148
+ <options: text/markdown|text/plain>
2149
+ --[no-]dry-run Set to `true` to estimate what a crawl would fetch without adding the source. The
2150
+ response is then `200` with a preview of the pages the site has, grouped by path. Only
2151
+ for type web.
2152
+ --exclude-paths=<value>... Regular expressions for URL paths to skip. Pages whose path matches one of them aren't
2153
+ crawled. Only for type web.
2154
+ --file=<path> Local file to upload as a files source: a document, or a zip, tar or gzip archive of
2155
+ them
2156
+ --[no-]ignore-query-parameters Whether to treat URLs that differ only by query string as one page. New crawls set it
2157
+ to `true` unless you set it. Set it to `false` when the query string selects different
2158
+ content, such as pagination. Only for type web.
2159
+ --include-paths=<value>... Regular expressions for URL paths to crawl. When set, the crawl only includes pages
2160
+ whose path matches one of them. Only for type web.
2161
+ --max-depth=<value> How many levels deep the crawl goes from the root URL. Only for type web.
2162
+ --page-limit=<value> The maximum number of pages to crawl. The crawl can stop sooner when the knowledge
2163
+ base reaches its source limit. Only for type web.
2164
+ --query=<value> A GROQ query that selects the documents, with an optional projection. Each sync runs
2165
+ it again. Only for type sanity-dataset.
2166
+ --sanity-dataset-id=<value> The dataset to read documents from. Only for type sanity-dataset.
2167
+ --sanity-project-id=<value> The ID of the Sanity project to read documents from. You need full read access to the
2168
+ dataset and, on its project, the Administrator or Developer role or a custom role that
2169
+ can create datasets. Only for type sanity-dataset.
2170
+ --[no-]sitemap-only Whether to crawl only the pages listed in the site's sitemap. Only for type web.
2171
+ --text=<path|-> Text or markdown to hold as a files source, read from a local file or `-` for stdin
2172
+ --title=<value> The source's title. Only for type files.
2173
+ --type=<option> The source type. `web` crawls a website. Inferred from the other flags when left out.
2174
+ <options: web|sanity-dataset|files>
2175
+ --url=<value> The URL to start crawling from. It must be a public `http` or `https` URL. Only for
2176
+ type web.
2177
+ --watch Wait for the sync to settle, exiting non-zero unless it completes: when it fails, is
2178
+ cancelled or is held for confirmation
1267
2179
 
1268
2180
  GLOBAL FLAGS
1269
2181
  --json Format output as json.
1270
2182
 
1271
2183
  DESCRIPTION
1272
- Get a short-lived signed URL for the original uploaded bytes of a file import
2184
+ Add a source
1273
2185
 
1274
- EXAMPLES
1275
- Get a download URL for an uploaded file
2186
+ Adds a source to a knowledge base. Set `type` to choose what it reads:
1276
2187
 
1277
- $ sanity context imports download kb-abc123 import-def456
1278
- ```
2188
+ - `web`: a website, crawled from `url`
2189
+ - `sanity-dataset`: the documents a GROQ query selects in a Sanity dataset
2190
+ - `files`: files you upload with `POST .../sources/{sourceId}/uploads`, or text you send in `content`
1279
2191
 
1280
- ## `sanity context imports get KNOWLEDGEBASEID IMPORTID`
2192
+ A website or dataset starts its first sync right away. A `files` source syncs when you upload a file, or right away
2193
+ when you send `content`: one request stores the text, adds the source and starts its sync. For a website, set `dryRun`
2194
+ to `true` to preview the crawl without adding the source.
1281
2195
 
1282
- Get details of an import
2196
+ Adding a website that is already a source returns `409` with code `webSourceRootConflict`, and adding more websites
2197
+ than your limit allows returns `409` with code `webSourceRootLimitExceeded`. When the organization's knowledge bases
2198
+ already hold as many source chunks as its plan allows, returns `403` with code `planLimitReached` and adds nothing.
2199
+ Supports the `Idempotency-Key` header.
1283
2200
 
1284
- ```
1285
- USAGE
1286
- $ sanity context imports get KNOWLEDGEBASEID IMPORTID [--json]
2201
+ EXAMPLES
2202
+ Crawl a website
1287
2203
 
1288
- ARGUMENTS
1289
- KNOWLEDGEBASEID Knowledge base ID
1290
- IMPORTID Import ID
2204
+ $ sanity context sources create kb-abc123 --url https://example.com/docs
1291
2205
 
1292
- GLOBAL FLAGS
1293
- --json Format output as json.
2206
+ Estimate how many pages a crawl of /docs would find, without adding it
1294
2207
 
1295
- DESCRIPTION
1296
- Get details of an import
2208
+ $ sanity context sources create kb-abc123 --url https://example.com/docs --dry-run
1297
2209
 
1298
- EXAMPLES
1299
- Get details of a specific import
2210
+ Read the documents a GROQ query selects from a Sanity dataset
2211
+
2212
+ $ sanity context sources create kb-abc123 --query '*[_type == "article"]' --sanity-project-id abc123 \
2213
+ --sanity-dataset-id production
2214
+
2215
+ Upload a local file and wait for its sync
1300
2216
 
1301
- $ sanity context imports get kb-abc123 import-def456
2217
+ $ sanity context sources create kb-abc123 --file ./handbook.pdf --watch
1302
2218
 
1303
- Output the import as JSON
2219
+ Add markdown from stdin
1304
2220
 
1305
- $ sanity context imports get kb-abc123 import-def456 --json
2221
+ cat refunds.md | sanity context sources create kb-abc123 --text - --title "Refund policy"
1306
2222
  ```
1307
2223
 
1308
- ## `sanity context imports list KNOWLEDGEBASEID`
2224
+ ## `sanity context sources delete KNOWLEDGEBASEID SOURCEID`
1309
2225
 
1310
- List imports for a knowledge base
2226
+ Delete a source
1311
2227
 
1312
2228
  ```
1313
2229
  USAGE
1314
- $ sanity context imports list KNOWLEDGEBASEID [--json]
2230
+ $ sanity context sources delete KNOWLEDGEBASEID SOURCEID [--json] [-y]
1315
2231
 
1316
2232
  ARGUMENTS
1317
- KNOWLEDGEBASEID Knowledge base ID
2233
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2234
+ SOURCEID The source's ID.
2235
+
2236
+ FLAGS
2237
+ -y, --yes Skip confirmation prompt (unattended mode)
1318
2238
 
1319
2239
  GLOBAL FLAGS
1320
2240
  --json Format output as json.
1321
2241
 
1322
2242
  DESCRIPTION
1323
- List imports for a knowledge base
2243
+ Delete a source
2244
+
2245
+ Removes a source and its documents from the knowledge base, and starts a refresh that removes their citations from
2246
+ entries and deletes the entries left with none. A source no other knowledge base uses stops syncing and is deleted
2247
+ once that refresh has run.
1324
2248
 
1325
2249
  EXAMPLES
1326
- List all imports for a knowledge base
2250
+ Delete a source
1327
2251
 
1328
- $ sanity context imports list kb-abc123
2252
+ $ sanity context sources delete <knowledgeBaseId> <sourceId>
1329
2253
 
1330
- Output imports as JSON
2254
+ Delete a source, as JSON
1331
2255
 
1332
- $ sanity context imports list kb-abc123 --json
2256
+ $ sanity context sources delete <knowledgeBaseId> <sourceId> --json
1333
2257
  ```
1334
2258
 
1335
- ## `sanity context issues apply KNOWLEDGEBASEID ISSUEID`
2259
+ ## `sanity context sources edit KNOWLEDGEBASEID SOURCEID`
1336
2260
 
1337
- Accept and apply issues to a knowledge base
2261
+ Update a source
1338
2262
 
1339
2263
  ```
1340
2264
  USAGE
1341
- $ sanity context issues apply KNOWLEDGEBASEID ISSUEID... [--watch]
2265
+ $ sanity context sources edit KNOWLEDGEBASEID SOURCEID [--json] [--title <value>] [--include-paths <value>...]
2266
+ [--exclude-paths <value>...] [--max-depth <value>] [--sitemap-only] [--ignore-query-parameters] [--page-limit
2267
+ <value>] [--query <value>] [--sync-frequency weekly|monthly|null] [--confirm-deletions]
1342
2268
 
1343
2269
  ARGUMENTS
1344
- KNOWLEDGEBASEID Knowledge base ID
1345
- ISSUEID... ID of an issue to accept and apply (pass several to apply them in one batch). Conflicts can't be
1346
- applied; resolve them with `sanity context issues resolve`
2270
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2271
+ SOURCEID The source's ID.
1347
2272
 
1348
2273
  FLAGS
1349
- --watch Wait for the apply to finish, exiting non-zero if it fails
2274
+ --[no-]confirm-deletions Set to `true` to apply new crawl options that delete many documents. Without it, a
2275
+ change that would delete all of the documents, or five or more that are over a fifth
2276
+ of them, returns `409` with code `sourceDeletionsUnconfirmed`.
2277
+ --exclude-paths=<value>... Regular expressions for URL paths to skip. Pages whose path matches one of them aren't
2278
+ crawled.
2279
+ --[no-]ignore-query-parameters Whether to treat URLs that differ only by query string as one page. New crawls set it
2280
+ to `true` unless you set it. Set it to `false` when the query string selects different
2281
+ content, such as pagination.
2282
+ --include-paths=<value>... Regular expressions for URL paths to crawl. When set, the crawl only includes pages
2283
+ whose path matches one of them.
2284
+ --max-depth=<value> How many levels deep the crawl goes from the root URL.
2285
+ --page-limit=<value> The maximum number of pages to crawl. The crawl can stop sooner when the knowledge
2286
+ base reaches its source limit.
2287
+ --query=<value> For a `sanity-dataset` source, the GROQ query, replacing the stored one. A sync is
2288
+ queued, and removes the documents the query no longer returns.
2289
+ --[no-]sitemap-only Whether to crawl only the pages listed in the site's sitemap.
2290
+ --sync-frequency=<option> For a `web` or `sanity-dataset` source, how often it syncs on its own: `weekly` or
2291
+ `monthly`. `null` stops scheduled syncs, and you can still start a sync yourself.
2292
+ Setting a frequency requires a plan that includes scheduled syncs; without one, the
2293
+ request returns `403` with code `featureNotInPlan`. Pass `null` to clear it.
2294
+ <options: weekly|monthly|null>
2295
+ --title=<value> The source's title.
2296
+
2297
+ GLOBAL FLAGS
2298
+ --json Format output as json.
1350
2299
 
1351
2300
  DESCRIPTION
1352
- Accept and apply issues to a knowledge base
2301
+ Update a source
2302
+
2303
+ Changes a source's title, a website's crawl options, a dataset's query, or how often a website or dataset syncs on its
2304
+ own. New crawl options delete the documents whose path they leave out. When that would delete all of the source's
2305
+ documents, or five or more that are over a fifth of them, the request returns `409` with code
2306
+ `sourceDeletionsUnconfirmed` until you send it again with `confirmDeletions` set to `true`. New crawl options sent
2307
+ while the source syncs return `409` with code `syncInProgress`; send them again once the sync finishes. A new query
2308
+ queues a sync, which removes the documents the query no longer selects.
2309
+
2310
+ Crawl options on a source that isn't a website, a query on one that isn't a dataset, or a sync frequency on a `files`
2311
+ source, return `422` with code `sourceTypeMismatch`. Setting a sync frequency on a plan without scheduled syncs
2312
+ returns `403` with code `featureNotInPlan`; setting it to `null` always works.
1353
2313
 
1354
2314
  EXAMPLES
1355
- Accept and apply two issues in one batch
2315
+ Update a source
1356
2316
 
1357
- $ sanity context issues apply kb-abc123 issue.def456 issue.ghi789
2317
+ $ sanity context sources edit <knowledgeBaseId> <sourceId>
1358
2318
 
1359
- Apply an issue and wait for it to finish (non-zero exit on failure)
2319
+ Update a source, as JSON
1360
2320
 
1361
- $ sanity context issues apply kb-abc123 issue.def456 --watch
2321
+ $ sanity context sources edit <knowledgeBaseId> <sourceId> --json
1362
2322
  ```
1363
2323
 
1364
- ## `sanity context issues dismiss KNOWLEDGEBASEID ISSUEID`
2324
+ ## `sanity context sources get KNOWLEDGEBASEID SOURCEID`
1365
2325
 
1366
- Dismiss an issue
2326
+ Get a source
1367
2327
 
1368
2328
  ```
1369
2329
  USAGE
1370
- $ sanity context issues dismiss KNOWLEDGEBASEID ISSUEID
2330
+ $ sanity context sources get KNOWLEDGEBASEID SOURCEID [--json]
1371
2331
 
1372
2332
  ARGUMENTS
1373
- KNOWLEDGEBASEID Knowledge base ID
1374
- ISSUEID Issue ID
2333
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2334
+ SOURCEID The source's ID.
2335
+
2336
+ GLOBAL FLAGS
2337
+ --json Format output as json.
1375
2338
 
1376
2339
  DESCRIPTION
1377
- Dismiss an issue
2340
+ Get a source
1378
2341
 
1379
- Dismissing is permanent: dismissed issues can't be reopened.
2342
+ Returns a source with its settings, document counts and latest sync.
1380
2343
 
1381
2344
  EXAMPLES
1382
- Dismiss an issue
2345
+ Get a source
1383
2346
 
1384
- $ sanity context issues dismiss kb-abc123 issue.def456
2347
+ $ sanity context sources get <knowledgeBaseId> <sourceId>
2348
+
2349
+ Get a source, as JSON
2350
+
2351
+ $ sanity context sources get <knowledgeBaseId> <sourceId> --json
1385
2352
  ```
1386
2353
 
1387
- ## `sanity context issues get KNOWLEDGEBASEID ISSUEID`
2354
+ ## `sanity context sources list KNOWLEDGEBASEID`
1388
2355
 
1389
- Get details of an issue
2356
+ List sources
1390
2357
 
1391
2358
  ```
1392
2359
  USAGE
1393
- $ sanity context issues get KNOWLEDGEBASEID ISSUEID [--json]
2360
+ $ sanity context sources list KNOWLEDGEBASEID [--json] [--limit <value>]
1394
2361
 
1395
2362
  ARGUMENTS
1396
- KNOWLEDGEBASEID Knowledge base ID
1397
- ISSUEID Issue ID
2363
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2364
+
2365
+ FLAGS
2366
+ --limit=<value> The maximum number of items to return.
1398
2367
 
1399
2368
  GLOBAL FLAGS
1400
2369
  --json Format output as json.
1401
2370
 
1402
2371
  DESCRIPTION
1403
- Get details of an issue
2372
+ List sources
2373
+
2374
+ Lists the sources of a knowledge base: the websites, Sanity datasets and files its documents come from, each with its
2375
+ document counts and its latest sync. Results are cursor-paginated.
1404
2376
 
1405
2377
  EXAMPLES
1406
- Get details of a specific issue
2378
+ List sources
1407
2379
 
1408
- $ sanity context issues get kb-abc123 issue.def456
2380
+ $ sanity context sources list <knowledgeBaseId>
1409
2381
 
1410
- Output the issue as JSON
2382
+ List sources, as JSON
1411
2383
 
1412
- $ sanity context issues get kb-abc123 issue.def456 --json
2384
+ $ sanity context sources list <knowledgeBaseId> --json
1413
2385
  ```
1414
2386
 
1415
- ## `sanity context issues list KNOWLEDGEBASEID`
2387
+ ## `sanity context sources sync KNOWLEDGEBASEID SOURCEID`
1416
2388
 
1417
- List issues found by knowledge base builds
2389
+ Sync a source
1418
2390
 
1419
2391
  ```
1420
2392
  USAGE
1421
- $ sanity context issues list KNOWLEDGEBASEID [--json] [--kind
1422
- add_entry|conflict|gap|merge_entry|remove_entry|split_entry|update_required] [--scope <path>] [--severity
1423
- critical|suggestion] [--status open|accepted|rejected]
2393
+ $ sanity context sources sync KNOWLEDGEBASEID SOURCEID [--json] [--watch]
1424
2394
 
1425
2395
  ARGUMENTS
1426
- KNOWLEDGEBASEID Knowledge base ID
2396
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2397
+ SOURCEID The source's ID.
1427
2398
 
1428
2399
  FLAGS
1429
- --kind=<option> Only list issues of this kind
1430
- <options: add_entry|conflict|gap|merge_entry|remove_entry|split_entry|update_required>
1431
- --scope=<path> Only list issues about this entry path or anything under it (`*` for knowledge-base-wide issues)
1432
- --severity=<option> Only list issues of this severity
1433
- <options: critical|suggestion>
1434
- --status=<option> Only list issues with this status (rejected = dismissed, accepted = resolved or applied)
1435
- <options: open|accepted|rejected>
2400
+ --watch Wait for the sync to settle, exiting non-zero unless it completes: when it fails, is cancelled or is held for
2401
+ confirmation
1436
2402
 
1437
2403
  GLOBAL FLAGS
1438
2404
  --json Format output as json.
1439
2405
 
1440
2406
  DESCRIPTION
1441
- List issues found by knowledge base builds
1442
-
1443
- EXAMPLES
1444
- List all issues for a knowledge base
1445
-
1446
- $ sanity context issues list kb-abc123
1447
-
1448
- List issues awaiting triage
2407
+ Sync a source
1449
2408
 
1450
- $ sanity context issues list kb-abc123 --status open
2409
+ Starts a sync of the source. A website or dataset is read again: its sync is queued, and starts once any sync of the
2410
+ source that is running ends, including the first one that started when it was added. Asking again while one waits
2411
+ queues nothing more. Follow it with the source's `latestSync`.
1451
2412
 
1452
- List critical conflicts
2413
+ For a `files` source, set `uploadId` to the upload whose file the source should hold from now on; without it, the
2414
+ source reads its current file again. Its sync starts at once and returns a job ID to poll; the finished job's `result`
2415
+ names the sync and whether it is `held`. While a sync of a `files` source is running, including the first one, the
2416
+ request returns `409` with code `syncInProgress` and leaves the upload for a later request. An `uploadId` whose file
2417
+ never arrived returns `404` with code `uploadNotFound`, and an `uploadId` on a source that isn't `files` returns `422`
2418
+ with code `sourceTypeMismatch`.
1453
2419
 
1454
- $ sanity context issues list kb-abc123 --kind conflict --severity critical
2420
+ Supports the `Idempotency-Key` header.
1455
2421
 
1456
- List issues about entries under billing/
2422
+ EXAMPLES
2423
+ Sync a source
1457
2424
 
1458
- $ sanity context issues list kb-abc123 --scope billing
2425
+ $ sanity context sources sync <knowledgeBaseId> <sourceId>
1459
2426
 
1460
- Output issues as JSON
2427
+ Sync a source, as JSON
1461
2428
 
1462
- $ sanity context issues list kb-abc123 --json
2429
+ $ sanity context sources sync <knowledgeBaseId> <sourceId> --json
1463
2430
  ```
1464
2431
 
1465
- ## `sanity context issues reopen KNOWLEDGEBASEID ISSUEID`
2432
+ ## `sanity context sources syncs confirm KNOWLEDGEBASEID SOURCEID SYNCID`
1466
2433
 
1467
- Reopen a resolved conflict issue
2434
+ Confirm a held sync's deletions
1468
2435
 
1469
2436
  ```
1470
2437
  USAGE
1471
- $ sanity context issues reopen KNOWLEDGEBASEID ISSUEID
2438
+ $ sanity context sources syncs confirm KNOWLEDGEBASEID SOURCEID SYNCID [--json]
1472
2439
 
1473
2440
  ARGUMENTS
1474
- KNOWLEDGEBASEID Knowledge base ID
1475
- ISSUEID Issue ID
2441
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2442
+ SOURCEID The source's ID.
2443
+ SYNCID The sync's ID.
2444
+
2445
+ GLOBAL FLAGS
2446
+ --json Format output as json.
1476
2447
 
1477
2448
  DESCRIPTION
1478
- Reopen a resolved conflict issue
2449
+ Confirm a held sync's deletions
2450
+
2451
+ Deletes the documents a `held` sync didn't find, unless a sync has found them since, completes the sync, and starts a
2452
+ refresh of each knowledge base that uses the source, which removes their citations from entries. A sync that isn't
2453
+ `held` returns `409` with code `syncNotHeld`.
1479
2454
 
1480
2455
  EXAMPLES
1481
- Return a resolved conflict issue to triage
2456
+ Confirm a held sync's deletions
1482
2457
 
1483
- $ sanity context issues reopen kb-abc123 issue.def456
2458
+ $ sanity context sources syncs confirm <knowledgeBaseId> <sourceId> <syncId>
2459
+
2460
+ Confirm a held sync's deletions, as JSON
2461
+
2462
+ $ sanity context sources syncs confirm <knowledgeBaseId> <sourceId> <syncId> --json
1484
2463
  ```
1485
2464
 
1486
- ## `sanity context issues resolve KNOWLEDGEBASEID ISSUEID`
2465
+ ## `sanity context sources syncs discard KNOWLEDGEBASEID SOURCEID SYNCID`
1487
2466
 
1488
- Resolve a conflict issue by choosing the correct side
2467
+ Discard a held sync's deletions
1489
2468
 
1490
2469
  ```
1491
2470
  USAGE
1492
- $ sanity context issues resolve KNOWLEDGEBASEID ISSUEID [--side <value>] [--watch]
2471
+ $ sanity context sources syncs discard KNOWLEDGEBASEID SOURCEID SYNCID [--json]
1493
2472
 
1494
2473
  ARGUMENTS
1495
- KNOWLEDGEBASEID Knowledge base ID
1496
- ISSUEID Issue ID
2474
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2475
+ SOURCEID The source's ID.
2476
+ SYNCID The sync's ID.
1497
2477
 
1498
- FLAGS
1499
- --side=<value> Index of the correct side, as listed by `sanity context issues get`
1500
- --watch Wait for the entry rewrite to finish, exiting non-zero if it fails
2478
+ GLOBAL FLAGS
2479
+ --json Format output as json.
1501
2480
 
1502
2481
  DESCRIPTION
1503
- Resolve a conflict issue by choosing the correct side
2482
+ Discard a held sync's deletions
1504
2483
 
1505
- Resolving also creates a standing instruction that future builds follow. `sanity context issues reopen` removes it.
2484
+ Completes a `held` sync without deleting anything: every document stays as it is. A sync that isn't `held` returns
2485
+ `409` with code `syncNotHeld`.
1506
2486
 
1507
2487
  EXAMPLES
1508
- Interactively choose the correct side of a conflict
1509
-
1510
- $ sanity context issues resolve kb-abc123 issue.def456
2488
+ Discard a held sync's deletions
1511
2489
 
1512
- Choose side 1 and wait for the entry to be rewritten
2490
+ $ sanity context sources syncs discard <knowledgeBaseId> <sourceId> <syncId>
1513
2491
 
1514
- $ sanity context issues resolve kb-abc123 issue.def456 --side 1 --watch
2492
+ Discard a held sync's deletions, as JSON
1515
2493
 
1516
- Keep the entry as it is (for a conflict on a single entry)
1517
-
1518
- $ sanity context issues resolve kb-abc123 issue.def456 --side 0
2494
+ $ sanity context sources syncs discard <knowledgeBaseId> <sourceId> <syncId> --json
1519
2495
  ```
1520
2496
 
1521
- ## `sanity context jobs get KNOWLEDGEBASEID JOBID`
2497
+ ## `sanity context sources syncs get KNOWLEDGEBASEID SOURCEID SYNCID`
1522
2498
 
1523
- Get the status of a knowledge base job
2499
+ Get a sync
1524
2500
 
1525
2501
  ```
1526
2502
  USAGE
1527
- $ sanity context jobs get KNOWLEDGEBASEID JOBID [--json] [--watch]
2503
+ $ sanity context sources syncs get KNOWLEDGEBASEID SOURCEID SYNCID [--json]
1528
2504
 
1529
2505
  ARGUMENTS
1530
- KNOWLEDGEBASEID Knowledge base ID
1531
- JOBID Job ID
1532
-
1533
- FLAGS
1534
- --watch Poll until the job reaches a terminal state
2506
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2507
+ SOURCEID The source's ID.
2508
+ SYNCID The sync's ID.
1535
2509
 
1536
2510
  GLOBAL FLAGS
1537
2511
  --json Format output as json.
1538
2512
 
1539
2513
  DESCRIPTION
1540
- Get the status of a knowledge base job
2514
+ Get a sync
2515
+
2516
+ Returns one sync of a source with its status and counts.
1541
2517
 
1542
2518
  EXAMPLES
1543
- Get the current status of a job
2519
+ Get a sync
1544
2520
 
1545
- $ sanity context jobs get kb-abc123 job-def456
2521
+ $ sanity context sources syncs get <knowledgeBaseId> <sourceId> <syncId>
1546
2522
 
1547
- Wait for the job to finish (non-zero exit if it does not succeed)
2523
+ Get a sync, as JSON
1548
2524
 
1549
- $ sanity context jobs get kb-abc123 job-def456 --watch
2525
+ $ sanity context sources syncs get <knowledgeBaseId> <sourceId> <syncId> --json
1550
2526
  ```
1551
2527
 
1552
- ## `sanity context list`
2528
+ ## `sanity context sources syncs list KNOWLEDGEBASEID SOURCEID`
1553
2529
 
1554
- List knowledge bases in an organization
2530
+ List a source's syncs
1555
2531
 
1556
2532
  ```
1557
2533
  USAGE
1558
- $ sanity context list [--json] [--organization <id>]
2534
+ $ sanity context sources syncs list KNOWLEDGEBASEID SOURCEID [--json] [--limit <value>]
2535
+
2536
+ ARGUMENTS
2537
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2538
+ SOURCEID The source's ID.
2539
+
2540
+ FLAGS
2541
+ --limit=<value> The maximum number of items to return.
1559
2542
 
1560
2543
  GLOBAL FLAGS
1561
2544
  --json Format output as json.
1562
2545
 
1563
- OVERRIDE FLAGS
1564
- --organization=<id> Organization to list knowledge bases for (overrides CLI configuration)
1565
-
1566
2546
  DESCRIPTION
1567
- List knowledge bases in an organization
2547
+ List a source's syncs
1568
2548
 
1569
- EXAMPLES
1570
- List knowledge bases, selecting the organization interactively
1571
-
1572
- $ sanity context list
2549
+ Lists the syncs of a source, newest first. Results are cursor-paginated.
1573
2550
 
1574
- List knowledge bases in a specific organization
2551
+ EXAMPLES
2552
+ List a source's syncs
1575
2553
 
1576
- $ sanity context list --organization org-abc123
2554
+ $ sanity context sources syncs list <knowledgeBaseId> <sourceId>
1577
2555
 
1578
- Output knowledge bases as JSON
2556
+ List a source's syncs, as JSON
1579
2557
 
1580
- $ sanity context list --organization org-abc123 --json
2558
+ $ sanity context sources syncs list <knowledgeBaseId> <sourceId> --json
1581
2559
  ```
1582
2560
 
1583
- ## `sanity context query QUERY`
2561
+ ## `sanity context sources upload KNOWLEDGEBASEID SOURCEID`
1584
2562
 
1585
- Query an organization's Context documents with GROQ
2563
+ Upload a file to a source
1586
2564
 
1587
2565
  ```
1588
2566
  USAGE
1589
- $ sanity context query QUERY [--json] [--organization <id>] [--params <json>]
2567
+ $ sanity context sources upload KNOWLEDGEBASEID SOURCEID --file <path> [--json] [--watch] [--content-type <type>]
1590
2568
 
1591
2569
  ARGUMENTS
1592
- QUERY GROQ query to run against the organization's Context documents
2570
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2571
+ SOURCEID The source's ID.
1593
2572
 
1594
2573
  FLAGS
1595
- --params=<json> Query parameters as a JSON object
2574
+ --content-type=<type> MIME type of the file, inferred from the file extension when omitted
2575
+ --file=<path> (required) Local file to upload: a document, or a zip, tar or gzip archive of them
2576
+ --watch Wait for the sync to settle, exiting non-zero unless it completes: when it fails, is cancelled
2577
+ or is held for confirmation
1596
2578
 
1597
2579
  GLOBAL FLAGS
1598
2580
  --json Format output as json.
1599
2581
 
1600
- OVERRIDE FLAGS
1601
- --organization=<id> Organization to query (overrides CLI configuration)
1602
-
1603
2582
  DESCRIPTION
1604
- Query an organization's Context documents with GROQ
2583
+ Upload a file to a source
2584
+
2585
+ Upload a new file to a files source, replacing the one it holds, and sync it
1605
2586
 
1606
2587
  EXAMPLES
1607
- List open issues across all knowledge bases
2588
+ Replace the file a source holds
1608
2589
 
1609
- $ sanity context query '*[_type == "sanity.context.issue" && status == "open"]{_id, knowledgeBaseId}'
2590
+ $ sanity context sources upload kb-abc123 source-def456 --file ./handbook.pdf
1610
2591
 
1611
- List the entry paths of one knowledge base as plain JSON
2592
+ Replace the file and wait for its sync to finish
1612
2593
 
1613
- $ sanity context query '*[_type == "sanity.context.entry" && knowledgeBaseId == $kb].path' --params '{"kb": \
1614
- "kb-abc123"}' --json
2594
+ $ sanity context sources upload kb-abc123 source-def456 --file ./handbook.pdf --watch
1615
2595
  ```
1616
2596
 
1617
- ## `sanity context refresh KNOWLEDGEBASEID`
2597
+ ## `sanity context sync KNOWLEDGEBASEID`
1618
2598
 
1619
- Refresh a knowledge base: re-check sources and apply what changed
2599
+ Sync every source
1620
2600
 
1621
2601
  ```
1622
2602
  USAGE
1623
- $ sanity context refresh KNOWLEDGEBASEID
2603
+ $ sanity context sync KNOWLEDGEBASEID [--json]
1624
2604
 
1625
2605
  ARGUMENTS
1626
- KNOWLEDGEBASEID Knowledge base ID
2606
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
2607
+
2608
+ GLOBAL FLAGS
2609
+ --json Format output as json.
1627
2610
 
1628
2611
  DESCRIPTION
1629
- Refresh a knowledge base: re-check sources and apply what changed
2612
+ Sync every source
2613
+
2614
+ Queues a sync of every website and dataset source, which starts once any sync of the source that is running ends.
2615
+ `files` sources sync when you upload a file.
1630
2616
 
1631
2617
  EXAMPLES
1632
- Start an incremental refresh
2618
+ Sync every source
1633
2619
 
1634
- $ sanity context refresh kb-abc123
2620
+ $ sanity context sync <knowledgeBaseId>
2621
+
2622
+ Sync every source, as JSON
2623
+
2624
+ $ sanity context sync <knowledgeBaseId> --json
1635
2625
  ```
1636
2626
 
1637
2627
  ## `sanity context update KNOWLEDGEBASEID`
@@ -1640,34 +2630,36 @@ Update a knowledge base
1640
2630
 
1641
2631
  ```
1642
2632
  USAGE
1643
- $ sanity context update KNOWLEDGEBASEID [--description <value>] [--refresh-enabled] [--refresh-frequency
1644
- weekly|monthly] [--title <value>]
2633
+ $ sanity context update KNOWLEDGEBASEID [--json] [--title <value>] [--description <value>] [--draft]
1645
2634
 
1646
2635
  ARGUMENTS
1647
- KNOWLEDGEBASEID Knowledge base ID
2636
+ KNOWLEDGEBASEID The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.
1648
2637
 
1649
2638
  FLAGS
1650
- --description=<value> New knowledge base description
1651
- --[no-]refresh-enabled Enable scheduled refresh (--no-refresh-enabled to disable)
1652
- --refresh-frequency=<option> How often scheduled refresh runs
1653
- <options: weekly|monthly>
1654
- --title=<value> New knowledge base title
2639
+ --description=<value> The knowledge base's new description.
2640
+ --[no-]draft Set to `false` to finish a draft, so it can be built and is listed with your other knowledge
2641
+ bases. The knowledge base needs a title, sent here or set before. Ignored when the knowledge
2642
+ base isn't a draft. A finished knowledge base can't become a draft again.
2643
+ --title=<value> The knowledge base's new title.
2644
+
2645
+ GLOBAL FLAGS
2646
+ --json Format output as json.
1655
2647
 
1656
2648
  DESCRIPTION
1657
2649
  Update a knowledge base
1658
2650
 
1659
- EXAMPLES
1660
- Rename a knowledge base
1661
-
1662
- $ sanity context update kb-abc123 --title "New title"
2651
+ Updates the title or the description, or finishes a draft (`draft: false`). Fields equal to their current value are
2652
+ ignored, so sending the current values changes nothing. Finishing a draft with no title returns `422` with code
2653
+ `draftTitleRequired`. How often a website or dataset syncs is set on the source, with `PATCH .../sources/{sourceId}`.
1663
2654
 
1664
- Enable weekly scheduled refresh
2655
+ EXAMPLES
2656
+ Update a knowledge base
1665
2657
 
1666
- $ sanity context update kb-abc123 --refresh-enabled --refresh-frequency weekly
2658
+ $ sanity context update <knowledgeBaseId>
1667
2659
 
1668
- Disable scheduled refresh
2660
+ Update a knowledge base, as JSON
1669
2661
 
1670
- $ sanity context update kb-abc123 --no-refresh-enabled
2662
+ $ sanity context update <knowledgeBaseId> --json
1671
2663
  ```
1672
2664
 
1673
2665
  ## `sanity cors add ORIGIN`
@@ -2789,8 +3781,8 @@ Add a Function to your Blueprint
2789
3781
  USAGE
2790
3782
  $ sanity functions add [--json] [--example <value> | -n <value> | --type
2791
3783
  document-publish|document-create|document-delete|document-update|media-library-asset-create|media-library-asset-dele
2792
- te|media-library-asset-update|pub-sub|scheduled-function|sync-tag-invalidate... | --language ts|js | --javascript |
2793
- --helpers | --installer skip|npm|pnpm|yarn | -i]
3784
+ te|media-library-asset-update|pub-sub|scheduled-function|sync-tag-invalidate|durable-function... | --language ts|js
3785
+ | --javascript | --helpers | --installer skip|npm|pnpm|yarn | -i]
2794
3786
 
2795
3787
  FLAGS
2796
3788
  -i, --install Shortcut for --installer npm
@@ -2807,7 +3799,7 @@ FLAGS
2807
3799
  by specifying this flag multiple times
2808
3800
  <options: document-publish|document-create|document-delete|document-update|media-library-ass
2809
3801
  et-create|media-library-asset-delete|media-library-asset-update|pub-sub|scheduled-function|s
2810
- ync-tag-invalidate>
3802
+ ync-tag-invalidate|durable-function>
2811
3803
 
2812
3804
  DESCRIPTION
2813
3805
  Add a Function to your Blueprint
@@ -4794,17 +5786,20 @@ Abort an in-flight workflow instance — a hard stop: pending effects are cancel
4794
5786
 
4795
5787
  ```
4796
5788
  USAGE
4797
- $ sanity workflows abort INSTANCEID [--deployment <value> | --tag <value>] [--reason <value>]
5789
+ $ sanity workflows abort INSTANCEID [--path <file|dir>] [--deployment <value> | --partition <value>] [--reason
5790
+ <value>]
4798
5791
 
4799
5792
  ARGUMENTS
4800
5793
  INSTANCEID Workflow instance id.
4801
5794
 
4802
5795
  FLAGS
4803
- --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the tag
5796
+ --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
4804
5797
  partition still comes from the loaded instance.
5798
+ --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
5799
+ instance; the instance's stored partition is what the command uses.
5800
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
5801
+ Defaults to the current directory.
4805
5802
  --reason=<value> Reason for aborting (recorded in history).
4806
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
4807
- resources are searched; omit to span them all.
4808
5803
 
4809
5804
  DESCRIPTION
4810
5805
  Abort an in-flight workflow instance — a hard stop: pending effects are cancelled, stage guards removed, and the
@@ -4816,17 +5811,19 @@ EXAMPLES
4816
5811
  $ sanity workflows abort wf-instance.abc123 --reason 'superseded by relaunch'
4817
5812
  ```
4818
5813
 
4819
- ## `sanity workflows blueprint generate`
5814
+ ## `sanity workflows blueprints generate`
4820
5815
 
4821
5816
  Experimental: generate the Sanity Blueprints runtime the definitions require, next to sanity.workflow.ts. Writes the workflow resources, one function per derived need, the effect-handler registry, and a handler stub per declared effect. Covers every deployment in the config, because the emitted resources module declares them all. These flags and this output may change before the Blueprints backend accepts the sanity.workflow resource.
4822
5817
 
4823
5818
  ```
4824
5819
  USAGE
4825
- $ sanity workflows blueprint generate [--check]
5820
+ $ sanity workflows blueprints generate [--path <file|dir>] [--check]
4826
5821
 
4827
5822
  FLAGS
4828
- --check Experimental: verify the tree on disk still matches the definitions; write nothing and exit non-zero on any
4829
- difference. The CI drift gate.
5823
+ --check Experimental: verify the tree on disk still matches the definitions; write nothing and exit
5824
+ non-zero on any difference. The CI drift gate.
5825
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents. Defaults
5826
+ to the current directory.
4830
5827
 
4831
5828
  DESCRIPTION
4832
5829
  Experimental: generate the Sanity Blueprints runtime the definitions require, next to sanity.workflow.ts. Writes the
@@ -4835,19 +5832,19 @@ DESCRIPTION
4835
5832
  this output may change before the Blueprints backend accepts the sanity.workflow resource.
4836
5833
 
4837
5834
  EXAMPLES
4838
- $ sanity workflows blueprint generate
5835
+ $ sanity workflows blueprints generate
4839
5836
 
4840
- $ sanity workflows blueprint generate --check
5837
+ $ sanity workflows blueprints generate --check
4841
5838
  ```
4842
5839
 
4843
- ## `sanity workflows definition delete NAME`
5840
+ ## `sanity workflows definitions delete NAME`
4844
5841
 
4845
5842
  Delete a deployed workflow definition (every version, or one via --version). Refuses while non-terminal instances exist unless --cascade aborts them first — instances are aborted in place, never deleted.
4846
5843
 
4847
5844
  ```
4848
5845
  USAGE
4849
- $ sanity workflows definition delete NAME [--deployment <value> | --tag <value>] [--version <value>] [--cascade] [--reason
4850
- <value>]
5846
+ $ sanity workflows definitions delete NAME [--path <file|dir>] [--deployment <value> | --partition <value>] [--version <value>]
5847
+ [--cascade] [--reason <value>]
4851
5848
 
4852
5849
  ARGUMENTS
4853
5850
  NAME Workflow definition name.
@@ -4855,9 +5852,11 @@ ARGUMENTS
4855
5852
  FLAGS
4856
5853
  --cascade Abort every non-terminal instance pinned to the targeted versions, then delete.
4857
5854
  --deployment=<value> Deployment name — the unique identity of one deployment in the config.
5855
+ --partition=<value> Workflow environment partition (e.g. prod, test) — selects the deployment to act on while the
5856
+ partition names exactly one; pass --deployment when it spans several.
5857
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
5858
+ Defaults to the current directory.
4858
5859
  --reason=<value> Free-text reason — recorded on each cascade-abort history entry.
4859
- --tag=<value> Workflow environment tag (e.g. prod, test) — selects the deployment to act on while the tag
4860
- names exactly one; pass --deployment when it spans several.
4861
5860
  --version=<value> Delete only this deployed version (default: every version).
4862
5861
 
4863
5862
  DESCRIPTION
@@ -4865,97 +5864,148 @@ DESCRIPTION
4865
5864
  exist unless --cascade aborts them first — instances are aborted in place, never deleted.
4866
5865
 
4867
5866
  EXAMPLES
4868
- $ sanity workflows definition delete my-workflow
5867
+ $ sanity workflows definitions delete my-workflow
4869
5868
 
4870
- $ sanity workflows definition delete my-workflow --version 2
5869
+ $ sanity workflows definitions delete my-workflow --version 2
4871
5870
 
4872
- $ sanity workflows definition delete my-workflow --cascade --reason 'workflow retired'
5871
+ $ sanity workflows definitions delete my-workflow --cascade --reason 'workflow retired'
4873
5872
  ```
4874
5873
 
4875
- ## `sanity workflows definition diff NAME`
5874
+ ## `sanity workflows definitions diff NAME`
4876
5875
 
4877
5876
  Diff an in-code definition against the deployed version (latest by default).
4878
5877
 
4879
5878
  ```
4880
5879
  USAGE
4881
- $ sanity workflows definition diff NAME [--deployment <value> | --tag <value>] [--version <value>]
5880
+ $ sanity workflows definitions diff NAME [--path <file|dir>] [--deployment <value> | --partition <value>] [--version
5881
+ <value>]
4882
5882
 
4883
5883
  ARGUMENTS
4884
5884
  NAME Workflow definition name.
4885
5885
 
4886
5886
  FLAGS
4887
5887
  --deployment=<value> Deployment name — the unique identity of one deployment in the config.
4888
- --tag=<value> Workflow environment tag (e.g. prod, test) — selects the deployment to act on while the tag
4889
- names exactly one; pass --deployment when it spans several.
5888
+ --partition=<value> Workflow environment partition (e.g. prod, test) — selects the deployment to act on while the
5889
+ partition names exactly one; pass --deployment when it spans several.
5890
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
5891
+ Defaults to the current directory.
4890
5892
  --version=<value> Deployed version to diff against (default: latest).
4891
5893
 
4892
5894
  DESCRIPTION
4893
5895
  Diff an in-code definition against the deployed version (latest by default).
4894
5896
 
4895
5897
  EXAMPLES
4896
- $ sanity workflows definition diff productLaunch
5898
+ $ sanity workflows definitions diff productLaunch
4897
5899
 
4898
- $ sanity workflows definition diff productLaunch --version 2
5900
+ $ sanity workflows definitions diff productLaunch --version 2
4899
5901
  ```
4900
5902
 
4901
- ## `sanity workflows definition list`
5903
+ ## `sanity workflows definitions list`
4902
5904
 
4903
5905
  List deployed workflow definitions.
4904
5906
 
4905
5907
  ```
4906
5908
  USAGE
4907
- $ sanity workflows definition list [--tag <value>] [--limit <value>] [--name <value>] [--json]
5909
+ $ sanity workflows definitions list [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> | [--deployment
5910
+ <value> | --partition <value>]] [--limit <value>] [--name <value>] [--json]
4908
5911
 
4909
5912
  FLAGS
4910
- --json Emit structured JSON instead of rendered output.
4911
- --limit=<value> [default: 100] The maximum number of definitions to return.
4912
- --name=<value> Filter to a single workflow definition name (e.g. product-launch).
4913
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
4914
- resources are searched; omit to span them all.
5913
+ --deployment=<value> Deployment name — read only the resource and partition that deployment targets.
5914
+ --json Emit structured JSON instead of rendered output.
5915
+ --limit=<value> [default: 100] The maximum number of definitions to return.
5916
+ --name=<value> Filter to a single workflow definition name (e.g. product-launch).
5917
+ --partition=<value> Workflow environment partition (e.g. prod, test) — an optional query filter that also narrows
5918
+ which resources are searched; omit to span them all.
5919
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
5920
+ Defaults to the current directory.
5921
+
5922
+ OVERRIDE FLAGS
5923
+ -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
5924
+ -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
5925
+ --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
4915
5926
 
4916
5927
  DESCRIPTION
4917
5928
  List deployed workflow definitions.
4918
5929
 
4919
5930
  EXAMPLES
4920
- $ sanity workflows definition list
5931
+ $ sanity workflows definitions list
4921
5932
 
4922
- $ sanity workflows definition list --tag prod
5933
+ $ sanity workflows definitions list --partition prod
4923
5934
 
4924
- $ sanity workflows definition list --json
5935
+ $ sanity workflows definitions list --json
4925
5936
  ```
4926
5937
 
4927
- ## `sanity workflows definition show NAME`
5938
+ ## `sanity workflows definitions show NAME`
4928
5939
 
4929
5940
  Show a deployed workflow definition.
4930
5941
 
4931
5942
  ```
4932
5943
  USAGE
4933
- $ sanity workflows definition show NAME [--tag <value>] [--version <value>] [--json]
5944
+ $ sanity workflows definitions show NAME [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> | [--deployment
5945
+ <value> | --partition <value>]] [--version <value>] [--json]
4934
5946
 
4935
5947
  ARGUMENTS
4936
5948
  NAME Workflow definition name.
4937
5949
 
4938
5950
  FLAGS
4939
- --json Emit structured JSON instead of rendered output.
4940
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
4941
- resources are searched; omit to span them all.
4942
- --version=<value> Specific version (default: latest).
5951
+ --deployment=<value> Deployment name — read only the resource and partition that deployment targets.
5952
+ --json Emit structured JSON instead of rendered output.
5953
+ --partition=<value> Workflow environment partition (e.g. prod, test) — an optional query filter that also narrows
5954
+ which resources are searched; omit to span them all.
5955
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
5956
+ Defaults to the current directory.
5957
+ --version=<value> Specific version (default: latest).
5958
+
5959
+ OVERRIDE FLAGS
5960
+ -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
5961
+ -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
5962
+ --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
4943
5963
 
4944
5964
  DESCRIPTION
4945
5965
  Show a deployed workflow definition.
4946
5966
  ```
4947
5967
 
5968
+ ## `sanity workflows definitions validate FILE`
5969
+
5970
+ Validate workflow definitions in JSON files without a config, login, or network access. Checks shape, cross-field rules, and GROQ syntax; deploy additionally checks duplicate names, spawn dependencies, resource bindings, project roles, and the reader-model acknowledgement. Exits non-zero when any definition is invalid. A file that cannot be read, is not valid JSON, or does not hold definition objects stops the command with an error message instead of a report, including with --json.
5971
+
5972
+ ```
5973
+ USAGE
5974
+ $ sanity workflows definitions validate FILE... [--json]
5975
+
5976
+ ARGUMENTS
5977
+ FILE... JSON file holding one definition or an array of them. Pass several files to validate a parent and its child
5978
+ workflows together.
5979
+
5980
+ FLAGS
5981
+ --json Emit structured JSON instead of rendered output.
5982
+
5983
+ DESCRIPTION
5984
+ Validate workflow definitions in JSON files without a config, login, or network access. Checks shape, cross-field
5985
+ rules, and GROQ syntax; deploy additionally checks duplicate names, spawn dependencies, resource bindings, project
5986
+ roles, and the reader-model acknowledgement. Exits non-zero when any definition is invalid. A file that cannot be
5987
+ read, is not valid JSON, or does not hold definition objects stops the command with an error message instead of a
5988
+ report, including with --json.
5989
+
5990
+ EXAMPLES
5991
+ $ sanity workflows definitions validate review.json
5992
+
5993
+ $ sanity workflows definitions validate parent.json child.json
5994
+
5995
+ $ sanity workflows definitions validate review.json --json
5996
+ ```
5997
+
4948
5998
  ## `sanity workflows deploy`
4949
5999
 
4950
- Validate workflow definitions, check any generated runtime beside the config against them, then diff and deploy to the resource bound by the selected deployment. A generated runtime that no longer matches the definitions fails the deploy before anything is written; regenerate it with `sanity-workflows blueprint generate`.
6000
+ Validate workflow definitions, check any generated runtime beside the config against them, then diff and deploy to the resource bound by the selected deployment. A generated runtime that no longer matches the definitions fails the deploy before anything is written; regenerate it with `sanity-workflows blueprints generate`.
4951
6001
 
4952
6002
  ```
4953
6003
  USAGE
4954
- $ sanity workflows deploy [--all-tags | | [--deployment <value> | --tag <value>]] [--dry-run] [--check] [--only
4955
- <value>] [--share-defs]
6004
+ $ sanity workflows deploy [--path <file|dir>] [--all-partitions | | [--deployment <value> | --partition <value>]]
6005
+ [--dry-run] [--check] [--verbose] [--only <value>] [--share-defs]
4956
6006
 
4957
6007
  FLAGS
4958
- --all-tags Deploy every deployment in the config, not just a selection.
6008
+ --all-partitions Deploy every deployment in the config, not just a selection.
4959
6009
  --check Validate definitions and check any generated runtime against them; do not contact the dataset.
4960
6010
  --deployment=<value> Deployment name — the unique identity of one deployment in the config.
4961
6011
  --dry-run Validate definitions, check any generated runtime against them, and diff against the deployed
@@ -4963,30 +6013,36 @@ FLAGS
4963
6013
  --only=<value> Limit deploy/check/diff to a single workflow definition by name (deployments are selected with
4964
6014
  --deployment). Every targeted deployment must contain it. The generated-runtime check still
4965
6015
  covers the whole config, because the generated tree declares every deployment in it.
6016
+ --partition=<value> Workflow partition (e.g. prod, test) — deploys every deployment using that partition across
6017
+ configured resources.
6018
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6019
+ Defaults to the current directory.
4966
6020
  --[no-]share-defs Share the definition documents newly created by this deploy with Sanity — the full document,
4967
6021
  verbatim (structure, names, filters, effect configuration, seeded values), plus its deployment
4968
6022
  coordinates (project and dataset, or resource id); never content documents, instances, or your
4969
6023
  Sanity auth token. Sharing is the default in every environment, including CI / non-TTY /
4970
6024
  DO_NOT_TRACK. Use --no-share-defs to opt out.
4971
- --tag=<value> Workflow environment tag (e.g. prod, test) — deploys every deployment carrying the tag (a tag is
4972
- an environment group).
6025
+ --verbose When no generated runtime is here, print the full report of the Sanity Functions the selected
6026
+ deployments need, in place of the summary.
4973
6027
 
4974
6028
  DESCRIPTION
4975
6029
  Validate workflow definitions, check any generated runtime beside the config against them, then diff and deploy to the
4976
6030
  resource bound by the selected deployment. A generated runtime that no longer matches the definitions fails the deploy
4977
- before anything is written; regenerate it with `sanity-workflows blueprint generate`.
6031
+ before anything is written; regenerate it with `sanity-workflows blueprints generate`.
4978
6032
 
4979
6033
  EXAMPLES
4980
6034
  $ sanity workflows deploy --deployment review-prod
4981
6035
 
4982
- $ sanity workflows deploy --tag prod
6036
+ $ sanity workflows deploy --partition prod
4983
6037
 
4984
- $ sanity workflows deploy --all-tags
6038
+ $ sanity workflows deploy --all-partitions
4985
6039
 
4986
6040
  $ sanity workflows deploy --check
4987
6041
 
4988
6042
  $ sanity workflows deploy --dry-run
4989
6043
 
6044
+ $ sanity workflows deploy --check --verbose
6045
+
4990
6046
  $ sanity workflows deploy --only productLaunch
4991
6047
  ```
4992
6048
 
@@ -4996,17 +6052,25 @@ Explain why a workflow instance is or isn't progressing, and what would unstick
4996
6052
 
4997
6053
  ```
4998
6054
  USAGE
4999
- $ sanity workflows diagnose INSTANCEID [--deployment <value> | --tag <value>] [--json]
6055
+ $ sanity workflows diagnose INSTANCEID [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> |
6056
+ [--deployment <value> | --partition <value>]] [--json]
5000
6057
 
5001
6058
  ARGUMENTS
5002
6059
  INSTANCEID Workflow instance id.
5003
6060
 
5004
6061
  FLAGS
5005
- --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the tag
6062
+ --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
5006
6063
  partition still comes from the loaded instance.
5007
6064
  --json Emit structured JSON instead of rendered output.
5008
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
5009
- resources are searched; omit to span them all.
6065
+ --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
6066
+ instance; the instance's stored partition is what the command uses.
6067
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6068
+ Defaults to the current directory.
6069
+
6070
+ OVERRIDE FLAGS
6071
+ -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6072
+ -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6073
+ --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
5010
6074
 
5011
6075
  DESCRIPTION
5012
6076
  Explain why a workflow instance is or isn't progressing, and what would unstick it.
@@ -5014,7 +6078,7 @@ DESCRIPTION
5014
6078
  EXAMPLES
5015
6079
  $ sanity workflows diagnose wf-instance.abc123
5016
6080
 
5017
- $ sanity workflows diagnose wf-instance.abc123 --tag prod
6081
+ $ sanity workflows diagnose wf-instance.abc123 --partition prod
5018
6082
 
5019
6083
  $ sanity workflows diagnose wf-instance.abc123 --json
5020
6084
  ```
@@ -5025,8 +6089,8 @@ Fire an action on an instance to unstick a waiting activity — the write acts a
5025
6089
 
5026
6090
  ```
5027
6091
  USAGE
5028
- $ sanity workflows fire-action INSTANCEID [--deployment <value> | --tag <value>] [--activity <value>] [--action <value>]
5029
- [--param <value>...] [--json]
6092
+ $ sanity workflows fire-action INSTANCEID [--path <file|dir>] [--deployment <value> | --partition <value>] [--activity
6093
+ <value>] [--action <value>] [--param <value>...] [--json]
5030
6094
 
5031
6095
  ARGUMENTS
5032
6096
  INSTANCEID Workflow instance id.
@@ -5034,13 +6098,15 @@ ARGUMENTS
5034
6098
  FLAGS
5035
6099
  --action=<value> Action to fire. Omit to list the actions available on the instance.
5036
6100
  --activity=<value> Activity the action belongs to. Required to fire; omit --action to list.
5037
- --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the tag
6101
+ --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
5038
6102
  partition still comes from the loaded instance.
5039
6103
  --json Emit structured JSON instead of rendered output.
5040
6104
  --param=<value>... [default: ] Action param as key=value (repeatable). Values are JSON-parsed, falling back to a
5041
6105
  string.
5042
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
5043
- resources are searched; omit to span them all.
6106
+ --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
6107
+ instance; the instance's stored partition is what the command uses.
6108
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6109
+ Defaults to the current directory.
5044
6110
 
5045
6111
  DESCRIPTION
5046
6112
  Fire an action on an instance to unstick a waiting activity — the write acts as the configured token. Omit --action to
@@ -5056,13 +6122,14 @@ EXAMPLES
5056
6122
 
5057
6123
  ## `sanity workflows list`
5058
6124
 
5059
- List workflow instances in the configured dataset (in-flight by default).
6125
+ List workflow instances (in-flight by default) across the resources sanity.workflow.ts declares, or in the one resource --project-id/--dataset or --media-library-id names.
5060
6126
 
5061
6127
  ```
5062
6128
  USAGE
5063
- $ sanity workflows list [--tag <value>] [--include-completed] [--failed] [--definition <value>] [--document
5064
- <value>] [--assignment-user <value>] [--assignment-role <value>...] [--assignment-state unrouted|routed|held...]
5065
- [--limit <value>] [--json]
6129
+ $ sanity workflows list [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> | [--deployment
6130
+ <value> | --partition <value>]] [--include-completed] [--failed] [--definition <value>] [--document <value>]
6131
+ [--assignment-user <value>] [--assignment-role <value>...] [--assignment-state unrouted|routed|held...] [--limit
6132
+ <value>] [--json]
5066
6133
 
5067
6134
  FLAGS
5068
6135
  --assignment-role=<value>... A literal project role held by --assignment-user. Repeat for multiple roles.
@@ -5072,17 +6139,26 @@ FLAGS
5072
6139
  --assignment-user=<value> Account-global user id used for viewer-scoped assignment filtering and counts.
5073
6140
  --definition=<value> Only instances of this workflow definition (its `name`; the instance's `definition`
5074
6141
  field).
6142
+ --deployment=<value> Deployment name — read only the resource and partition that deployment targets.
5075
6143
  --document=<value> Only instances that reference this document (resource-qualified GDR URI, e.g.
5076
6144
  "dataset:proj:ds:article-1").
5077
6145
  --failed Only instances with at least one failed activity.
5078
6146
  --include-completed Include completed/aborted instances (default: in-flight only).
5079
6147
  --json Emit structured JSON instead of rendered output.
5080
6148
  --limit=<value> [default: 50] Maximum rows to return.
5081
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also
6149
+ --partition=<value> Workflow environment partition (e.g. prod, test) — an optional query filter that also
5082
6150
  narrows which resources are searched; omit to span them all.
6151
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its
6152
+ parents. Defaults to the current directory.
6153
+
6154
+ OVERRIDE FLAGS
6155
+ -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6156
+ -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6157
+ --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
5083
6158
 
5084
6159
  DESCRIPTION
5085
- List workflow instances in the configured dataset (in-flight by default).
6160
+ List workflow instances (in-flight by default) across the resources sanity.workflow.ts declares, or in the one
6161
+ resource --project-id/--dataset or --media-library-id names.
5086
6162
 
5087
6163
  EXAMPLES
5088
6164
  $ sanity workflows list
@@ -5095,39 +6171,42 @@ EXAMPLES
5095
6171
 
5096
6172
  $ sanity workflows list --assignment-user gAda --assignment-role legal --assignment-state routed
5097
6173
 
5098
- $ sanity workflows list --tag prod
6174
+ $ sanity workflows list --partition prod
5099
6175
 
5100
6176
  $ sanity workflows list --json
5101
6177
  ```
5102
6178
 
5103
6179
  ## `sanity workflows nuke`
5104
6180
 
5105
- Delete engine-owned documents — a whole deployment tag, or a single instance.
6181
+ Delete engine-owned documents — a whole deployment partition, or a single instance.
5106
6182
 
5107
6183
  ```
5108
6184
  USAGE
5109
- $ sanity workflows nuke [--deployment <value>] [--tag <value>] [--instance <value>] [--force]
6185
+ $ sanity workflows nuke [--path <file|dir>] [--deployment <value>] [--partition <value>] [--instance <value>]
6186
+ [--force]
5110
6187
 
5111
6188
  FLAGS
5112
6189
  --deployment=<value> The deployment name to reset. With --instance, narrows which deployment the instance is looked
5113
- up in when its tag spans several.
6190
+ up in when its partition spans several.
5114
6191
  --force Skip the confirmation prompt (for scripts/CI). The plan still prints.
5115
- --instance=<value> Delete a single terminal instance by id, plus its guard docs, instead of a tag.
5116
- --tag=<value> The deployment tag to reset (while it names exactly one deployment). Not valid with --instance,
5117
- which reads its tag from the instance id.
6192
+ --instance=<value> Delete a single terminal instance by id, plus its guard docs, instead of a partition.
6193
+ --partition=<value> The deployment partition to reset (while it names exactly one deployment). Not valid with
6194
+ --instance, which reads its partition from the stored instance.
6195
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6196
+ Defaults to the current directory.
5118
6197
 
5119
6198
  DESCRIPTION
5120
- Delete engine-owned documents — a whole deployment tag, or a single instance.
6199
+ Delete engine-owned documents — a whole deployment partition, or a single instance.
5121
6200
 
5122
- The reset for a dataset holding engine documents the versioned upgrade framework cannot yet migrate: deletes the tag's
5123
- instances, definitions, and guards (across every alias-bound resource). --instance <id> instead deletes one terminal
5124
- instance plus its guards. Content documents are never touched. Prints a dry-run plan, then confirms (--force skips the
5125
- prompt; the plan still prints).
6201
+ The reset for a dataset holding engine documents the versioned upgrade framework cannot yet migrate: deletes the
6202
+ partition's instances, definitions, and guards (across every alias-bound resource). --instance <id> instead deletes
6203
+ one terminal instance plus its guards. Content documents are never touched. Prints a dry-run plan, then confirms
6204
+ (--force skips the prompt; the plan still prints).
5126
6205
 
5127
6206
  EXAMPLES
5128
6207
  $ sanity workflows nuke --deployment plugin-dev
5129
6208
 
5130
- $ sanity workflows nuke --tag plugin-dev --force
6209
+ $ sanity workflows nuke --partition plugin-dev --force
5131
6210
 
5132
6211
  $ sanity workflows nuke --instance plugin-dev.wf-instance.abc123
5133
6212
  ```
@@ -5138,18 +6217,21 @@ Reset a failed activity on an in-flight instance — back to active to re-run it
5138
6217
 
5139
6218
  ```
5140
6219
  USAGE
5141
- $ sanity workflows reset-activity INSTANCEID ACTIVITY [--deployment <value> | --tag <value>] [--skip]
6220
+ $ sanity workflows reset-activity INSTANCEID ACTIVITY [--path <file|dir>] [--deployment <value> | --partition <value>]
6221
+ [--skip]
5142
6222
 
5143
6223
  ARGUMENTS
5144
6224
  INSTANCEID Workflow instance id.
5145
6225
  ACTIVITY Activity name within the current stage.
5146
6226
 
5147
6227
  FLAGS
5148
- --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the tag
6228
+ --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
5149
6229
  partition still comes from the loaded instance.
6230
+ --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
6231
+ instance; the instance's stored partition is what the command uses.
6232
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6233
+ Defaults to the current directory.
5150
6234
  --skip Bypass the activity (mark it skipped) instead of re-running it (back to active).
5151
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
5152
- resources are searched; omit to span them all.
5153
6235
 
5154
6236
  DESCRIPTION
5155
6237
  Reset a failed activity on an in-flight instance — back to active to re-run it, or --skip to bypass it (mark it
@@ -5167,17 +6249,20 @@ Force an instance into a stage, regardless of its declared transitions and filte
5167
6249
 
5168
6250
  ```
5169
6251
  USAGE
5170
- $ sanity workflows set-stage INSTANCEID [--deployment <value> | --tag <value>] [--to <value>] [--reason <value>]
6252
+ $ sanity workflows set-stage INSTANCEID [--path <file|dir>] [--deployment <value> | --partition <value>] [--to <value>]
6253
+ [--reason <value>]
5171
6254
 
5172
6255
  ARGUMENTS
5173
6256
  INSTANCEID Workflow instance id to move.
5174
6257
 
5175
6258
  FLAGS
5176
- --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the tag
6259
+ --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
5177
6260
  partition still comes from the loaded instance.
6261
+ --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
6262
+ instance; the instance's stored partition is what the command uses.
6263
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6264
+ Defaults to the current directory.
5178
6265
  --reason=<value> Free-text reason — recorded on the history entry for audit.
5179
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
5180
- resources are searched; omit to span them all.
5181
6266
  --to=<value> Target stage name. Omit on an interactive terminal to pick from the workflow’s stages.
5182
6267
 
5183
6268
  DESCRIPTION
@@ -5199,18 +6284,28 @@ Show the state, activities, and effects of a workflow instance.
5199
6284
 
5200
6285
  ```
5201
6286
  USAGE
5202
- $ sanity workflows show INSTANCEID [--tag <value>] [--include history...] [--json]
6287
+ $ sanity workflows show INSTANCEID [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> |
6288
+ [--deployment <value> | --partition <value>]] [--include history...] [--json]
5203
6289
 
5204
6290
  ARGUMENTS
5205
6291
  INSTANCEID Workflow instance document id.
5206
6292
 
5207
6293
  FLAGS
6294
+ --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
6295
+ partition still comes from the loaded instance.
5208
6296
  --include=<option>... [default: ] Optional sections to include in rendered output (--json always carries the full
5209
6297
  document).
5210
6298
  <options: history>
5211
6299
  --json Emit structured JSON instead of rendered output.
5212
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which
5213
- resources are searched; omit to span them all.
6300
+ --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
6301
+ instance; the instance's stored partition is what the command uses.
6302
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6303
+ Defaults to the current directory.
6304
+
6305
+ OVERRIDE FLAGS
6306
+ -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6307
+ -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6308
+ --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
5214
6309
 
5215
6310
  DESCRIPTION
5216
6311
  Show the state, activities, and effects of a workflow instance.
@@ -5229,8 +6324,8 @@ Start a workflow instance from a deployed definition. Supply values for the work
5229
6324
 
5230
6325
  ```
5231
6326
  USAGE
5232
- $ sanity workflows start NAME [--deployment <value> | --tag <value>] [--version <value>] [--field <value>...]
5233
- [--instance-id <value>] [--json]
6327
+ $ sanity workflows start NAME [--path <file|dir>] [--deployment <value> | --partition <value>] [--version <value>]
6328
+ [--field <value>...] [--instance-id <value>] [--json]
5234
6329
 
5235
6330
  ARGUMENTS
5236
6331
  NAME Workflow definition name.
@@ -5244,8 +6339,10 @@ FLAGS
5244
6339
  of a start that failed partway and the engine resumes it instead of creating a duplicate (an
5245
6340
  already-settled start replays as a no-op). Omit to mint a fresh id.
5246
6341
  --json Emit structured JSON instead of rendered output.
5247
- --tag=<value> Workflow environment tag (e.g. prod, test) — selects the deployment to act on while the tag
5248
- names exactly one; pass --deployment when it spans several.
6342
+ --partition=<value> Workflow environment partition (e.g. prod, test) — selects the deployment to act on while the
6343
+ partition names exactly one; pass --deployment when it spans several.
6344
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6345
+ Defaults to the current directory.
5249
6346
  --version=<value> Definition version to start from (default: highest deployed).
5250
6347
 
5251
6348
  DESCRIPTION
@@ -5257,7 +6354,7 @@ EXAMPLES
5257
6354
 
5258
6355
  $ sanity workflows start article-review --field subject='{"id":"dataset:proj:ds:article-1","type":"article"}'
5259
6356
 
5260
- $ sanity workflows start productLaunch --version 2 --tag prod
6357
+ $ sanity workflows start productLaunch --version 2 --partition prod
5261
6358
 
5262
6359
  $ sanity workflows start productLaunch --instance-id prod.wf-instance.a1b2c3d4e5f6
5263
6360
  ```
@@ -5268,14 +6365,24 @@ Stream new history entries on a workflow instance as they land in the dataset.
5268
6365
 
5269
6366
  ```
5270
6367
  USAGE
5271
- $ sanity workflows tail INSTANCEID [--tag <value>]
6368
+ $ sanity workflows tail INSTANCEID [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> |
6369
+ [--deployment <value> | --partition <value>]]
5272
6370
 
5273
6371
  ARGUMENTS
5274
6372
  INSTANCEID Workflow instance id to tail.
5275
6373
 
5276
6374
  FLAGS
5277
- --tag=<value> Workflow environment tag (e.g. prod, test) — an optional query filter that also narrows which resources
5278
- are searched; omit to span them all.
6375
+ --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
6376
+ partition still comes from the loaded instance.
6377
+ --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
6378
+ instance; the instance's stored partition is what the command uses.
6379
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6380
+ Defaults to the current directory.
6381
+
6382
+ OVERRIDE FLAGS
6383
+ -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6384
+ -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6385
+ --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
5279
6386
 
5280
6387
  DESCRIPTION
5281
6388
  Stream new history entries on a workflow instance as they land in the dataset.