@@ -249,6 +249,85 @@ func TestDocsCreateV2PreservesBackendURL(t *testing.T) {
249249 }
250250}
251251
252+ func TestDocsCreateV2RejectsV1OnlyFlags (t * testing.T ) {
253+ t .Parallel ()
254+
255+ tests := []struct {
256+ name string
257+ args []string
258+ wantErr string
259+ }{
260+ {
261+ name : "markdown" ,
262+ args : []string {
263+ "+create" ,
264+ "--api-version" , "v2" ,
265+ "--markdown" , "## legacy" ,
266+ },
267+ wantErr : "use --content with --doc-format markdown" ,
268+ },
269+ {
270+ name : "wiki node" ,
271+ args : []string {
272+ "+create" ,
273+ "--api-version" , "v2" ,
274+ "--content" , "<title>内容</title><p>正文</p>" ,
275+ "--wiki-node" , "wikcn_legacy_node" ,
276+ },
277+ wantErr : "use --parent-token" ,
278+ },
279+ {
280+ name : "title" ,
281+ args : []string {
282+ "+create" ,
283+ "--api-version" , "v2" ,
284+ "--content" , "<p>正文</p>" ,
285+ "--title" , "Legacy title" ,
286+ },
287+ wantErr : "include the document title in --content" ,
288+ },
289+ {
290+ name : "folder token" ,
291+ args : []string {
292+ "+create" ,
293+ "--api-version" , "v2" ,
294+ "--content" , "<title>内容</title><p>正文</p>" ,
295+ "--folder-token" , "fldcn_legacy_folder" ,
296+ },
297+ wantErr : "use --parent-token" ,
298+ },
299+ {
300+ name : "wiki space" ,
301+ args : []string {
302+ "+create" ,
303+ "--api-version" , "v2" ,
304+ "--content" , "<title>内容</title><p>正文</p>" ,
305+ "--wiki-space" , "my_library" ,
306+ },
307+ wantErr : "use --parent-position or --parent-token" ,
308+ },
309+ }
310+
311+ for _ , tt := range tests {
312+ tt := tt
313+ t .Run (tt .name , func (t * testing.T ) {
314+ t .Parallel ()
315+
316+ f , stdout , _ , _ := cmdutil .TestFactory (t , docsCreateTestConfig (t , "" ))
317+ err := runDocsCreateShortcut (t , f , stdout , tt .args )
318+ if err == nil {
319+ t .Fatal ("expected validation error, got nil" )
320+ }
321+ if ! strings .Contains (err .Error (), tt .wantErr ) {
322+ t .Fatalf ("error = %v, want to contain %q" , err , tt .wantErr )
323+ }
324+ if ! strings .Contains (err .Error (), "--api-version v2" ) {
325+ t .Fatalf ("error = %v, want v2 guidance" , err )
326+ }
327+ })
328+ }
329+ }
330+
252331// ── V1 (MCP) tests ──
253332
254333func TestDocsCreateV1BotAutoGrantSuccess (t * testing.T ) {
0 commit comments