From 6356dce01b3b0021df3110e7658befa7fe77a4b3 Mon Sep 17 00:00:00 2001 From: Kushida Date: Fri, 31 Jul 2026 20:18:23 +0300 Subject: [PATCH] fix(comments): preserve unquoted multi-word text (#5192) --- cmd/bd/comment_proxied_integration_test.go | 2 +- cmd/bd/comments.go | 4 ++-- cmd/bd/comments_cli_embedded_test.go | 2 +- cmd/bd/comments_proxied_server.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/bd/comment_proxied_integration_test.go b/cmd/bd/comment_proxied_integration_test.go index b22ae7eca..ee5b91ebd 100644 --- a/cmd/bd/comment_proxied_integration_test.go +++ b/cmd/bd/comment_proxied_integration_test.go @@ -193,7 +193,7 @@ func TestProxiedServerComment(t *testing.T) { p := newSharedProxiedProject(t, bd, "aj") issue := bdProxiedCreate(t, bd, p.dir, "Add JSON") - stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "comments", "add", issue.ID, "add json body", "--json") + stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "comments", "add", issue.ID, "add", "json", "body", "--json") if err != nil { t.Fatalf("comments add --json failed: %v\nstderr:\n%s", err, stderr) } diff --git a/cmd/bd/comments.go b/cmd/bd/comments.go index 7901fa1b1..5b3ef7cbf 100644 --- a/cmd/bd/comments.go +++ b/cmd/bd/comments.go @@ -164,7 +164,7 @@ See: bd comments --help`) } var commentsAddCmd = &cobra.Command{ - Use: "add [issue-id] [text]", + Use: "add [issue-id] [text...]", Short: "Add a comment to an issue", Long: `Add a comment to an issue. @@ -203,7 +203,7 @@ Examples: } else if len(args) < 2 { return HandleErrorRespectJSON("comment text required (use -f to read from file)") } else { - commentText = args[1] + commentText = strings.Join(args[1:], " ") } if strings.TrimSpace(commentText) == "" { diff --git a/cmd/bd/comments_cli_embedded_test.go b/cmd/bd/comments_cli_embedded_test.go index b37b860cd..f37ff8080 100644 --- a/cmd/bd/comments_cli_embedded_test.go +++ b/cmd/bd/comments_cli_embedded_test.go @@ -48,7 +48,7 @@ func TestEmbeddedCommentsCLI(t *testing.T) { t.Run("comments_add_json", func(t *testing.T) { issue := bdCreate(t, bd, dir, "JSON comment", "--type", "task") - cmd := exec.Command(bd, "comments", "add", issue.ID, "JSON comment text", "--json") + cmd := exec.Command(bd, "comments", "add", issue.ID, "JSON", "comment", "text", "--json") cmd.Dir = dir cmd.Env = bdEnv(dir) stdout, stderr, err := runCommandBuffers(t, cmd) diff --git a/cmd/bd/comments_proxied_server.go b/cmd/bd/comments_proxied_server.go index e706abc35..8dea40e6b 100644 --- a/cmd/bd/comments_proxied_server.go +++ b/cmd/bd/comments_proxied_server.go @@ -127,7 +127,7 @@ func runCommentsAddProxiedServer(cmd *cobra.Command, ctx context.Context, args [ } else if len(args) < 2 { return HandleErrorRespectJSON("comment text required (use -f to read from file)") } else { - commentText = args[1] + commentText = strings.Join(args[1:], " ") } if strings.TrimSpace(commentText) == "" {