@@ -29,6 +29,16 @@ const KB_CREATE_FLAGS = {
2929 } ,
3030 required : true ,
3131 } ,
32+ description : {
33+ type : "string" ,
34+ valueHint : "<text>" ,
35+ description : {
36+ "en-US" :
37+ "What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-200 chars)" ,
38+ "zh-CN" : "知识库装了什么内容、给谁用,用于在 Workspace 列表中区分同类知识库(1–200 个字符)" ,
39+ } ,
40+ required : true ,
41+ } ,
3242 docId : {
3343 type : "array" ,
3444 valueHint : "<id>" ,
@@ -107,7 +117,7 @@ export default defineCommand({
107117 "zh-CN" : "创建知识库并导入数据中心文件或类目" ,
108118 } ,
109119 auth : "apiKey" ,
110- usageArgs : "--name <text> (--doc-id <id> | --category-id <id>) [flags]" ,
120+ usageArgs : "--name <text> --description <text> (--doc-id <id> | --category-id <id>) [flags]" ,
111121 flags : KB_CREATE_FLAGS ,
112122 notes : [
113123 {
@@ -126,11 +136,20 @@ export default defineCommand({
126136 } ,
127137 ] ,
128138 exampleArgs : [
129- "--name demo --doc-id file-xxx --workspace-id ws-xxx" ,
130- "--name demo --category-id cate-xxx --wait" ,
139+ {
140+ "en-US" : "--name demo --description 'product docs' --doc-id file-xxx --workspace-id ws-xxx" ,
141+ "zh-CN" : "--name demo --description '产品文档' --doc-id file-xxx --workspace-id ws-xxx" ,
142+ } ,
143+ {
144+ "en-US" : "--name demo --description 'product docs' --category-id cate-xxx --wait" ,
145+ "zh-CN" : "--name demo --description '产品文档' --category-id cate-xxx --wait" ,
146+ } ,
131147 ] ,
132148 validate ( flags ) {
133149 if ( flags . name . length < 1 || flags . name . length > 20 ) return "--name must be 1-20 characters" ;
150+ if ( flags . description . length < 1 || flags . description . length > 200 ) {
151+ return "--description must be 1-200 characters" ;
152+ }
134153 const hasDocIds = ! ! flags . docId ?. length ;
135154 const hasCategoryIds = ! ! flags . categoryId ?. length ;
136155 if ( hasDocIds && hasCategoryIds ) return "Use either --doc-id or --category-id, not both" ;
@@ -147,6 +166,9 @@ export default defineCommand({
147166 // Note: the public docs' example uses sinkType DEFAULT, but BUILT_IN is what works against the live API.
148167 const body = {
149168 name : flags . name ,
169+ // The server enforces description as a required 1-200 char field (the public
170+ // API docs still list it as absent from CreateIndexV2Request.required).
171+ description : flags . description ,
150172 structureType : "unstructured" ,
151173 sinkType : "BUILT_IN" ,
152174 embeddingModelName : flags . embeddingModel ?? "text-embedding-v4" ,
0 commit comments