fix(codeagent-wrapper): reject dash as workdir parameter (#118)

Prevent '-' from being incorrectly parsed as a workdir path.
This fixes a potential ambiguity when using stdin mode.
This commit is contained in:
NieiR
2026-01-14 10:04:23 +08:00
committed by GitHub
parent b0d7a09ff2
commit 4395c5785d
2 changed files with 18 additions and 0 deletions

View File

@@ -1094,6 +1094,11 @@ func TestBackendParseArgs_NewMode(t *testing.T) {
args: []string{"codeagent-wrapper", "-", "/some/dir"},
want: &Config{Mode: "new", Task: "-", WorkDir: "/some/dir", ExplicitStdin: true, Backend: defaultBackendName},
},
{
name: "stdin with dash workdir rejected",
args: []string{"codeagent-wrapper", "-", "-"},
wantErr: true,
},
{name: "no args", args: []string{"codeagent-wrapper"}, wantErr: true},
}
@@ -1155,6 +1160,7 @@ func TestBackendParseArgs_ResumeMode(t *testing.T) {
{name: "resume missing task", args: []string{"codeagent-wrapper", "resume", "session-123"}, wantErr: true},
{name: "resume empty session_id", args: []string{"codeagent-wrapper", "resume", "", "task"}, wantErr: true},
{name: "resume whitespace session_id", args: []string{"codeagent-wrapper", "resume", " ", "task"}, wantErr: true},
{name: "resume with dash workdir rejected", args: []string{"codeagent-wrapper", "resume", "session-123", "task", "-"}, wantErr: true},
}
for _, tt := range tests {