Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(cli): preserve literal inline text (#10526)

沙雕的小鱼儿 boyfeiyu9fda25de685b
diff --git a/server/cmd/multica/cmd_issue.go b/server/cmd/multica/cmd_issue.go
index 30aac22531..ab58827923 100644
--- a/server/cmd/multica/cmd_issue.go
+++ b/server/cmd/multica/cmd_issue.go
@@ -30,10 +30,8 @@ import (
// flag, and a `--<name>-file <path>` flag, mirroring the existing `--content`
// / `--content-stdin` pattern. It returns the resolved string and an error
// when more than one source is set, or when stdin/file is requested but
-// produces no body. Inline flag values are passed through
-// util.UnescapeBackslashEscapes so bash-double-quoted `\n` becomes a real
-// newline; stdin and file bodies are returned verbatim so literal backslashes
-// survive intact.
+// produces no body. Inline values are preserved exactly as received from the
+// shell. Stdin and file bodies retain their content except for one trailing LF.
//
// The `-file` source exists for Windows agents: piping HEREDOC content to
// `--<name>-stdin` from Windows PowerShell silently drops non-ASCII bytes
@@ -90,7 +88,7 @@ func resolveTextFlag(cmd *cobra.Command, flagName string) (string, bool, error)
if inline == "" {
return "", false, nil
}
- return util.UnescapeBackslashEscapes(inline), true, nil
+ return inline, true, nil
}
// ensureFileFlagWithinWorkdir fails closed when a --<name>-file path resolves
@@ -688,7 +686,7 @@ func init() {
// issue create
issueCreateCmd.Flags().String("title", "", "Issue title (required)")
- issueCreateCmd.Flags().String("description", "", "Issue description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
+ issueCreateCmd.Flags().String("description", "", "Issue description (preserves literal text. Use --description-stdin or --description-file for multi-line input)")
issueCreateCmd.Flags().Bool("description-stdin", false, "Read issue description from stdin (preserves multi-line content verbatim)")
issueCreateCmd.Flags().String("description-file", "", "Read issue description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
issueCreateCmd.Flags().Bool("allow-external-file", false, "Allow --description-file / --attachment to read a path outside the current working directory. Off by default so a stale file from another run/environment can't be picked up (MUL-4252).")
@@ -711,7 +709,7 @@ func init() {
// issue update
issueUpdateCmd.Flags().String("title", "", "New title")
- issueUpdateCmd.Flags().String("description", "", "New description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
+ issueUpdateCmd.Flags().String("description", "", "New description (preserves literal text. Use --description-stdin or --description-file for multi-line input)")
issueUpdateCmd.Flags().Bool("description-stdin", false, "Read new description from stdin (preserves multi-line content verbatim)")
issueUpdateCmd.Flags().String("description-file", "", "Read new description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
issueUpdateCmd.Flags().Bool("allow-external-file", false, "Allow --description-file / --attachment to read a path outside the current working directory. Off by default so a stale temp file from another run/environment can't be picked up (MUL-4252).")
@@ -788,7 +786,7 @@ func init() {
issueRunMessagesCmd.Flags().String("issue", "", "Issue ID/key to scope short run ID prefix resolution")
// issue comment add
- issueCommentAddCmd.Flags().String("content", "", "Comment content (decodes \\n, \\r, \\t, \\\\; pipe via --content-stdin for multi-line bodies or to preserve literal backslashes)")
+ issueCommentAddCmd.Flags().String("content", "", "Comment content (preserves literal text. Use --content-stdin or --content-file for multi-line input)")
issueCommentAddCmd.Flags().Bool("content-stdin", false, "Read comment content from stdin (preserves multi-line content verbatim)")
issueCommentAddCmd.Flags().String("content-file", "", "Read comment content from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
issueCommentAddCmd.Flags().Bool("allow-external-file", false, "Allow --content-file / --attachment to read a path outside the current working directory. Off by default so a stale file from another run/environment can't be picked up (MUL-4252).")
@@ -799,7 +797,7 @@ func init() {
issueCommentAddCmd.Flags().String("output", "json", "Output format: table or json")
// issue comment update
- issueCommentUpdateCmd.Flags().String("content", "", "New comment content (decodes \\n, \\r, \\t, \\\\; pipe via --content-stdin for multi-line bodies or to preserve literal backslashes)")
+ issueCommentUpdateCmd.Flags().String("content", "", "New comment content (preserves literal text. Use --content-stdin or --content-file for multi-line input)")
issueCommentUpdateCmd.Flags().Bool("content-stdin", false, "Read new comment content from stdin (preserves multi-line content verbatim)")
issueCommentUpdateCmd.Flags().String("content-file", "", "Read new comment content from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
issueCommentUpdateCmd.Flags().Bool("allow-external-file", false, "Allow --content-file to read a path outside the current working directory. Off by default so a stale file from another run/environment can't be picked up (MUL-4252).")
diff --git a/server/cmd/multica/cmd_issue_test.go b/server/cmd/multica/cmd_issue_test.go
index 820213c3b4..5dd7c67b06 100644
--- a/server/cmd/multica/cmd_issue_test.go
+++ b/server/cmd/multica/cmd_issue_test.go
@@ -105,15 +105,15 @@ func newFlagTestCmd(name string) *cobra.Command {
}
func TestResolveTextFlag(t *testing.T) {
- t.Run("inline value is unescaped", func(t *testing.T) {
+ t.Run("inline value is preserved literally", func(t *testing.T) {
c := newFlagTestCmd("description")
_ = c.Flags().Set("description", `para1\n\npara2`)
got, ok, err := resolveTextFlag(c, "description")
if err != nil || !ok {
t.Fatalf("unexpected: ok=%v err=%v", ok, err)
}
- if got != "para1\n\npara2" {
- t.Errorf("got %q, want decoded paragraphs", got)
+ if got != `para1\n\npara2` {
+ t.Errorf("got %q, want literal backslashes", got)
}
})
@@ -751,7 +751,7 @@ func TestRunIssueCommentUpdateSendsExpectedRequest(t *testing.T) {
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode request body: %v", err)
}
- if len(body) != 2 || body["content"] != "updated\ncomment" || body["expected_revision"] != float64(7) {
+ if len(body) != 2 || body["content"] != `updated\ncomment` || body["expected_revision"] != float64(7) {
t.Fatalf("body = %#v, want content plus expected revision", body)
}
_ = json.NewEncoder(w).Encode(map[string]any{
@@ -784,7 +784,7 @@ func TestRunIssueCommentUpdateSendsExpectedRequest(t *testing.T) {
if err := json.Unmarshal([]byte(out), &got); err != nil {
t.Fatalf("decode stdout JSON %q: %v", out, err)
}
- if got["id"] != commentID || got["content"] != "updated\ncomment" {
+ if got["id"] != commentID || got["content"] != `updated\ncomment` {
t.Fatalf("stdout = %#v", got)
}
}
diff --git a/server/cmd/multica/cmd_text_test.go b/server/cmd/multica/cmd_text_test.go
new file mode 100644
index 0000000000..a5abaab7f7
--- /dev/null
+++ b/server/cmd/multica/cmd_text_test.go
@@ -0,0 +1,283 @@
+package main
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "io"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "sync"
+ "testing"
+ "time"
+)
+
+// Exercise the registered command tree in fresh processes using the existing
+// argv fixture. This covers parsing, RunE and JSON serialization together.
+func TestTextFlagRequests(t *testing.T) {
+ const issueID = "11111111-1111-4111-8111-111111111111"
+ const literal = `tools\texconv.exe C:\repo\new \\server\share \times \theta ^\n\t\r$`
+ const mixed = "中文 Русский\r\n" + literal + "\tactual tab\rbare CR\n\n"
+ commands := []struct {
+ name string
+ args []string
+ method, path string
+ flag, field string
+ stdin, file bool
+ required, emptyAbsent bool
+ omittedPresent bool
+ }{
+ {
+ name: "issue create", args: []string{"issue", "create", "--title", "text fixture"},
+ method: "POST", path: "/api/issues", flag: "description", field: "description",
+ stdin: true, file: true, emptyAbsent: true,
+ },
+ {
+ name: "issue update", args: []string{"issue", "update", issueID, "--title", "text fixture"},
+ method: "PUT", path: "/api/issues/" + issueID, flag: "description", field: "description",
+ stdin: true, file: true,
+ },
+ {
+ name: "comment add", args: []string{"issue", "comment", "add", issueID},
+ method: "POST", path: "/api/issues/" + issueID + "/comments", flag: "content", field: "content",
+ stdin: true, file: true, required: true,
+ },
+ {
+ name: "comment update", args: []string{"issue", "comment", "update", issueID, "--expected-revision", "1"},
+ method: "PUT", path: "/api/comments/" + issueID, flag: "content", field: "content",
+ stdin: true, file: true, required: true,
+ },
+ {
+ name: "wakeup create", args: []string{"issue", "wakeup", "create", issueID, "--event", "task.completed"},
+ method: "POST", path: "/api/issues/" + issueID + "/wakeups", flag: "instruction", field: "instruction",
+ file: true, omittedPresent: true,
+ },
+ {
+ name: "wakeup update", args: []string{"issue", "wakeup", "update", issueID, "wake", "--event", "task.completed"},
+ method: "PUT", path: "/api/issues/" + issueID + "/wakeups/wake", flag: "instruction", field: "instruction",
+ file: true, omittedPresent: true,
+ },
+ {
+ name: "user profile", args: []string{"user", "profile", "update"},
+ method: "PATCH", path: "/api/me", flag: "description", field: "profile_description",
+ stdin: true, file: true,
+ },
+ {
+ name: "workspace create description", args: []string{"workspace", "create", "--name", "text fixture", "--slug", "text-fixture"},
+ method: "POST", path: "/api/workspaces", flag: "description", field: "description",
+ stdin: true,
+ },
+ {
+ name: "workspace create context", args: []string{"workspace", "create", "--name", "text fixture", "--slug", "text-fixture"},
+ method: "POST", path: "/api/workspaces", flag: "context", field: "context",
+ stdin: true,
+ },
+ {
+ name: "workspace update description", args: []string{"workspace", "update", issueID, "--name", "text fixture"},
+ method: "PATCH", path: "/api/workspaces/" + issueID, flag: "description", field: "description",
+ stdin: true,
+ },
+ {
+ name: "workspace update context", args: []string{"workspace", "update", issueID, "--name", "text fixture"},
+ method: "PATCH", path: "/api/workspaces/" + issueID, flag: "context", field: "context",
+ stdin: true,
+ },
+ }
+ type textCase struct {
+ name string
+ flags []string
+ stdin string
+ want string
+ absent bool
+ wantError string
+ apiError bool
+ }
+
+ executable, err := os.Executable()
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, command := range commands {
+ t.Run(command.name, func(t *testing.T) {
+ registered, _, err := rootCmd.Find(command.args)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got := registered.Flags().Lookup(command.flag+"-stdin") != nil; got != command.stdin {
+ t.Fatalf("stdin registration = %v, want %v", got, command.stdin)
+ }
+ if got := registered.Flags().Lookup(command.flag+"-file") != nil; got != command.file {
+ t.Fatalf("file registration = %v, want %v", got, command.file)
+ }
+ cases := []textCase{
+ {name: "control", flags: []string{"--" + command.flag, "Plain UTF8 中文 Русский"}, want: "Plain UTF8 中文 Русский"},
+ {name: "literal", flags: []string{"--" + command.flag, literal}, want: literal},
+ {name: "actual whitespace", flags: []string{"--" + command.flag, "line1\nline2\r\nline3\tend\r"}, want: "line1\nline2\r\nline3\tend\r"},
+ {name: "mixed", flags: []string{"--" + command.flag, mixed}, want: mixed},
+ {name: "consecutive backslashes", flags: []string{"--" + command.flag, `one\ two\\ three\\\ four\\\\ trailing\`}, want: `one\ two\\ three\\\ four\\\\ trailing\`},
+ {name: "omitted", absent: !command.omittedPresent},
+ {name: "explicit empty", flags: []string{"--" + command.flag, ""}, absent: command.emptyAbsent},
+ {name: "API error", flags: []string{"--" + command.flag, literal}, want: literal, wantError: "synthetic rejection", apiError: true},
+ }
+ if command.required {
+ cases[5].wantError = "--" + command.flag
+ cases[6].wantError = "--" + command.flag
+ }
+ if command.name == "user profile" {
+ cases[5].wantError = "nothing to update"
+ cases = append(cases,
+ textCase{name: "clear", flags: []string{"--clear"}},
+ textCase{name: "clear conflicts with description", flags: []string{"--clear", "--description", literal}, wantError: "--clear cannot be combined"},
+ )
+ }
+ if command.stdin {
+ cases = append(cases,
+ textCase{name: "stdin", flags: []string{"--" + command.flag + "-stdin"}, stdin: mixed, want: strings.TrimSuffix(mixed, "\n")},
+ textCase{name: "empty stdin", flags: []string{"--" + command.flag + "-stdin"}, wantError: "is empty"},
+ textCase{name: "inline and stdin conflict", flags: []string{"--" + command.flag, literal, "--" + command.flag + "-stdin"}, stdin: mixed, wantError: "mutually exclusive"},
+ )
+ }
+ if command.file {
+ cases = append(cases,
+ textCase{name: "file", flags: []string{"--" + command.flag + "-file", "body.txt"}, want: strings.TrimSuffix(mixed, "\n")},
+ textCase{name: "empty inline and file", flags: []string{"--" + command.flag, "", "--" + command.flag + "-file", "body.txt"}, want: strings.TrimSuffix(mixed, "\n")},
+ textCase{name: "empty file", flags: []string{"--" + command.flag + "-file", "empty.txt"}, wantError: "is empty"},
+ textCase{name: "missing file", flags: []string{"--" + command.flag + "-file", "missing.txt"}, wantError: "read file"},
+ textCase{name: "directory file", flags: []string{"--" + command.flag + "-file", "."}, wantError: "read file"},
+ textCase{name: "inline and file conflict", flags: []string{"--" + command.flag, literal, "--" + command.flag + "-file", "body.txt"}, wantError: "mutually exclusive"},
+ textCase{name: "external file", flags: []string{"--" + command.flag + "-file", "../outside.txt"}, wantError: "outside the current working directory"},
+ textCase{name: "external symlink", flags: []string{"--" + command.flag + "-file", "link.txt"}, wantError: "outside the current working directory"},
+ )
+ }
+ if command.file && command.stdin {
+ cases = append(cases, textCase{
+ name: "stdin and file conflict", flags: []string{"--" + command.flag + "-stdin", "--" + command.flag + "-file", "body.txt"},
+ stdin: mixed, wantError: "mutually exclusive",
+ })
+ }
+ if command.file && registered.Flags().Lookup("allow-external-file") != nil {
+ cases = append(cases, textCase{
+ name: "external file allowed", flags: []string{"--" + command.flag + "-file", "../outside.txt", "--allow-external-file"},
+ want: strings.TrimSuffix(mixed, "\n"),
+ })
+ }
+ if strings.HasPrefix(command.name, "workspace create") {
+ cases = append(cases, textCase{
+ name: "dual stdin", flags: []string{"--description-stdin", "--context-stdin"},
+ stdin: mixed, wantError: "cannot be combined",
+ })
+ }
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ var mu sync.Mutex
+ var requests int
+ var body map[string]any
+ var raw []byte
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ mu.Lock()
+ defer mu.Unlock()
+ requests++
+ if r.Method != command.method || r.URL.Path != command.path {
+ t.Errorf("unexpected request %s %s", r.Method, r.URL.Path)
+ http.NotFound(w, r)
+ return
+ }
+ var readErr error
+ raw, readErr = io.ReadAll(r.Body)
+ if readErr != nil {
+ t.Error(readErr)
+ }
+ if err := json.Unmarshal(raw, &body); err != nil {
+ t.Error(err)
+ }
+ w.Header().Set("Content-Type", "application/json")
+ if tc.apiError {
+ w.WriteHeader(http.StatusBadRequest)
+ _, _ = w.Write([]byte(`{"error":"synthetic rejection"}`))
+ return
+ }
+ _ = json.NewEncoder(w).Encode(map[string]any{"id": issueID, "identifier": "TEST-1"})
+ }))
+ defer server.Close()
+ parent := t.TempDir()
+ dir := filepath.Join(parent, "run")
+ if err := os.Mkdir(dir, 0o700); err != nil {
+ t.Fatal(err)
+ }
+ outside := filepath.Join(parent, "outside.txt")
+ if err := os.WriteFile(outside, []byte(mixed), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ if tc.name == "external symlink" {
+ if err := os.Symlink(outside, filepath.Join(dir, "link.txt")); err != nil {
+ t.Skipf("symlinks unavailable: %v", err)
+ }
+ }
+ if err := os.WriteFile(filepath.Join(dir, "body.txt"), []byte(mixed), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(dir, "empty.txt"), nil, 0o600); err != nil {
+ t.Fatal(err)
+ }
+ argv := append(append([]string{}, command.args...), tc.flags...)
+ argv = append(argv, "--output", "json")
+ ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
+ defer cancel()
+ child := exec.CommandContext(ctx, executable, append([]string{"-test.run=^TestIssueAttachmentArgvProcess$", "--"}, argv...)...)
+ child.Dir = dir
+ for _, entry := range os.Environ() {
+ if !strings.HasPrefix(entry, "MULTICA_") {
+ child.Env = append(child.Env, entry)
+ }
+ }
+ child.Env = append(child.Env, "MULTICA_TEST_ATTACHMENT_ARGV=1", "MULTICA_TEST_ATTACHMENT_SERVER="+server.URL)
+ child.Stdin = strings.NewReader(tc.stdin)
+ var stderr bytes.Buffer
+ child.Stderr = &stderr
+ output, runErr := child.Output()
+ mu.Lock()
+ defer mu.Unlock()
+ t.Logf("argv=%q endpoint=%s %s raw=%s decoded=%#v expected=%q stdout=%s stderr=%s", argv, command.method, command.path, raw, body[command.field], tc.want, output, stderr.String())
+ if tc.wantError != "" && !tc.apiError {
+ if runErr == nil || !strings.Contains(string(output)+stderr.String(), tc.wantError) {
+ t.Fatalf("CLI error = %v, want %q", runErr, tc.wantError)
+ }
+ if requests != 0 {
+ t.Fatalf("invalid source made %d requests", requests)
+ }
+ return
+ }
+ if tc.apiError {
+ if runErr == nil || !strings.Contains(string(output)+stderr.String(), tc.wantError) {
+ t.Fatalf("CLI error = %v, want API error %q", runErr, tc.wantError)
+ }
+ } else if runErr != nil {
+ t.Fatalf("CLI error: %v", runErr)
+ }
+ if requests != 1 {
+ t.Fatalf("requests = %d, want 1", requests)
+ }
+ value, present := body[command.field]
+ if present == tc.absent || (present && value != tc.want) {
+ t.Errorf("serialized %s = %q (present=%v), want %q (present=%v)", command.field, value, present, tc.want, !tc.absent)
+ }
+ if command.name == "issue create" {
+ if _, present := body["allow_duplicate"]; present {
+ t.Error("default issue creation bypassed the duplicate guard")
+ }
+ }
+ if !tc.apiError {
+ var printed map[string]any
+ if err := json.NewDecoder(bytes.NewReader(output)).Decode(&printed); err != nil || printed["id"] != issueID {
+ t.Errorf("normal JSON output = %s, decode error = %v", output, err)
+ }
+ }
+ })
+ }
+ })
+ }
+}
diff --git a/server/cmd/multica/cmd_user.go b/server/cmd/multica/cmd_user.go
index 0881dd4134..f459b08183 100644
--- a/server/cmd/multica/cmd_user.go
+++ b/server/cmd/multica/cmd_user.go
@@ -43,7 +43,7 @@ var userProfileUpdateCmd = &cobra.Command{
Long: "Set the personal profile description that gets injected into agent " +
"briefs as `## Requesting User`. Pass an empty value to clear it.\n\n" +
"Pick the input mode that preserves your content:\n" +
- " --description \"...\" inline (decodes \\n / \\t escapes)\n" +
+ " --description \"...\" inline (preserves literal text)\n" +
" --description-stdin pipe a HEREDOC (preserves verbatim)\n" +
" --description-file <path> read a UTF-8 file (Windows-safe)\n",
RunE: runUserProfileUpdate,
@@ -56,7 +56,7 @@ func init() {
userProfileGetCmd.Flags().String("output", "table", "Output format: table or json")
- userProfileUpdateCmd.Flags().String("description", "", "New profile description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
+ userProfileUpdateCmd.Flags().String("description", "", "New profile description (preserves literal text. Use --description-stdin or --description-file for multi-line input)")
userProfileUpdateCmd.Flags().Bool("description-stdin", false, "Read description from stdin (preserves multi-line content verbatim)")
userProfileUpdateCmd.Flags().String("description-file", "", "Read description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
userProfileUpdateCmd.Flags().Bool("allow-external-file", false, "Allow --description-file to read a path outside the current working directory. Off by default so a stale temp file from another run/environment can't be picked up (MUL-4252).")
diff --git a/server/cmd/multica/cmd_user_test.go b/server/cmd/multica/cmd_user_test.go
index 2734ac61e5..9f2fc914d2 100644
--- a/server/cmd/multica/cmd_user_test.go
+++ b/server/cmd/multica/cmd_user_test.go
@@ -85,8 +85,8 @@ func TestRunUserProfileUpdateSendsResolvedDescription(t *testing.T) {
if _, err := captureStdout(t, func() error { return runUserProfileUpdate(cmd, nil) }); err != nil {
t.Fatalf("runUserProfileUpdate: %v", err)
}
- if body["profile_description"] != "Reviewer\nTypeScript" {
- t.Fatalf("body = %#v, want decoded description", body)
+ if body["profile_description"] != `Reviewer\nTypeScript` {
+ t.Fatalf("body = %#v, want literal description", body)
}
}
diff --git a/server/cmd/multica/cmd_workspace.go b/server/cmd/multica/cmd_workspace.go
index b8dc152f8d..4c974ded03 100644
--- a/server/cmd/multica/cmd_workspace.go
+++ b/server/cmd/multica/cmd_workspace.go
@@ -175,9 +175,9 @@ func init() {
workspaceListCmd.Flags().Bool("full-id", false, "Show full UUIDs in table output")
workspaceCreateCmd.Flags().String("name", "", "Workspace name")
workspaceCreateCmd.Flags().String("slug", "", "Workspace slug")
- workspaceCreateCmd.Flags().String("description", "", "Workspace description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
+ workspaceCreateCmd.Flags().String("description", "", "Workspace description (preserves literal text. Use --description-stdin for multi-line input)")
workspaceCreateCmd.Flags().Bool("description-stdin", false, "Read description from stdin (preserves multi-line content verbatim)")
- workspaceCreateCmd.Flags().String("context", "", "Workspace context (decodes \\n, \\r, \\t, \\\\; pipe via --context-stdin to preserve literal backslashes)")
+ workspaceCreateCmd.Flags().String("context", "", "Workspace context (preserves literal text. Use --context-stdin for multi-line input)")
workspaceCreateCmd.Flags().Bool("context-stdin", false, "Read context from stdin (preserves multi-line content verbatim)")
workspaceCreateCmd.Flags().String("issue-prefix", "", "Issue prefix (uppercased server-side)")
workspaceCreateCmd.Flags().String("output", "json", "Output format: table or json")
@@ -187,9 +187,9 @@ func init() {
workspaceMemberInviteCmd.Flags().String("output", "table", "Output format: table or json")
workspaceUpdateCmd.Flags().String("name", "", "New workspace name")
- workspaceUpdateCmd.Flags().String("description", "", "New description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
+ workspaceUpdateCmd.Flags().String("description", "", "New description (preserves literal text. Use --description-stdin for multi-line input)")
workspaceUpdateCmd.Flags().Bool("description-stdin", false, "Read description from stdin (preserves multi-line content verbatim)")
- workspaceUpdateCmd.Flags().String("context", "", "New workspace context (decodes \\n, \\r, \\t, \\\\; pipe via --context-stdin to preserve literal backslashes)")
+ workspaceUpdateCmd.Flags().String("context", "", "New workspace context (preserves literal text. Use --context-stdin for multi-line input)")
workspaceUpdateCmd.Flags().Bool("context-stdin", false, "Read context from stdin (preserves multi-line content verbatim)")
workspaceUpdateCmd.Flags().String("issue-prefix", "", "New issue prefix (uppercased server-side)")
workspaceUpdateCmd.Flags().String("output", "json", "Output format: table or json")
diff --git a/server/cmd/multica/cmd_workspace_test.go b/server/cmd/multica/cmd_workspace_test.go
index 85996cd4d0..04c5776299 100644
--- a/server/cmd/multica/cmd_workspace_test.go
+++ b/server/cmd/multica/cmd_workspace_test.go
@@ -122,8 +122,8 @@ func TestRunWorkspaceCreatePostsWorkspaceAndDoesNotSwitchDefault(t *testing.T) {
if gotBody["slug"] != "growth-team" {
t.Errorf("slug = %v, want growth-team", gotBody["slug"])
}
- if gotBody["description"] != "Handles\nGTM work" {
- t.Errorf("description = %q, want decoded newline", gotBody["description"])
+ if gotBody["description"] != `Handles\nGTM work` {
+ t.Errorf("description = %q, want literal backslashes", gotBody["description"])
}
if gotBody["context"] != "Launch notes" {
t.Errorf("context = %v, want Launch notes", gotBody["context"])
@@ -600,9 +600,9 @@ func TestBuildWorkspaceUpdateBody(t *testing.T) {
if body["name"] != "Acme" {
t.Errorf("name = %v, want Acme", body["name"])
}
- // resolveTextFlag decodes \n in inline values.
- if body["description"] != "line1\nline2" {
- t.Errorf("description = %q, want decoded newline", body["description"])
+ // Inline text retains literal backslashes.
+ if body["description"] != `line1\nline2` {
+ t.Errorf("description = %q, want literal backslashes", body["description"])
}
if body["issue_prefix"] != "ENG" {
t.Errorf("issue_prefix = %v, want ENG", body["issue_prefix"])