codex-exec 모드를 명시적으로 지정하기 위해 CLIProfileConf에 mode와 resume_args 필드를 추가한다. 기존 isCodexExecProfile()의 명명 기반 판별을 삭제하고 설정 기반으로 전환한다. 주요 변경사항: - CLIProfileConf에 mode, resume_args 필드 추가 - codex_exec.go에서 isCodexExecProfile(), codexResumeOptions() 삭제 - resume_args를 사용하여 resume 명령어 구성 - edge.yaml에 codex 프로필 mode와 resume_args 설정 추가 - codex-exec 모드 전용 테스트 케이스 추가
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package cli
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"iop/packages/config"
|
|
)
|
|
|
|
func TestCodexExecArgs_NoSessionUsesProfileArgs(t *testing.T) {
|
|
profile := config.CLIProfileConf{
|
|
Command: "codex",
|
|
Args: []string{"exec", "--json"},
|
|
}
|
|
|
|
args := codexExecArgs(profile, "", "hello prompt")
|
|
expected := []string{"exec", "--json", "hello prompt"}
|
|
if len(args) != len(expected) {
|
|
t.Fatalf("expected %d args, got %d: %v", len(expected), len(args), args)
|
|
}
|
|
for i, v := range expected {
|
|
if args[i] != v {
|
|
t.Errorf("args[%d]: expected %q, got %q", i, v, args[i])
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCodexExecArgs_WithSessionUsesResumeArgs(t *testing.T) {
|
|
profile := config.CLIProfileConf{
|
|
Args: []string{"exec", "--json"},
|
|
ResumeArgs: []string{"exec", "resume", "--color", "never"},
|
|
}
|
|
|
|
args := codexExecArgs(profile, "session-abc", "hello prompt")
|
|
expected := []string{"exec", "resume", "--color", "never", "session-abc", "hello prompt"}
|
|
if len(args) != len(expected) {
|
|
t.Fatalf("expected %d args, got %d: %v", len(expected), len(args), args)
|
|
}
|
|
for i, v := range expected {
|
|
if args[i] != v {
|
|
t.Errorf("args[%d]: expected %q, got %q", i, v, args[i])
|
|
}
|
|
}
|
|
}
|