(flags agentCreateFlags)
| 164 | } |
| 165 | |
| 166 | func agentCreatePrompt(flags agentCreateFlags) (string, error) { |
| 167 | prompt := strings.TrimSpace(flags.prompt) |
| 168 | promptFile := strings.TrimSpace(flags.promptFile) |
| 169 | if prompt != "" && promptFile != "" { |
| 170 | return "", errors.New("cli: use either --prompt or --prompt-file, not both") |
| 171 | } |
| 172 | if promptFile != "" { |
| 173 | contents, err := os.ReadFile(promptFile) |
| 174 | if err != nil { |
| 175 | return "", fmt.Errorf("cli: read prompt file %q: %w", promptFile, err) |
| 176 | } |
| 177 | prompt = strings.TrimSpace(string(contents)) |
| 178 | } |
| 179 | if prompt == "" { |
| 180 | return "", errors.New("cli: --prompt or --prompt-file is required") |
| 181 | } |
| 182 | return prompt, nil |
| 183 | } |
| 184 | |
| 185 | func resolveAgentCreateDirectory(cmd *cobra.Command, deps commandDeps, workspaceRef string) (string, error) { |
| 186 | if strings.TrimSpace(workspaceRef) == "" { |
no test coverage detected