MCPcopy Create free account
hub / github.com/compozy/agh / agentCreatePrompt

Function agentCreatePrompt

internal/cli/agent.go:166–183  ·  view source on GitHub ↗
(flags agentCreateFlags)

Source from the content-addressed store, hash-verified

164}
165
166func 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
185func resolveAgentCreateDirectory(cmd *cobra.Command, deps commandDeps, workspaceRef string) (string, error) {
186 if strings.TrimSpace(workspaceRef) == "" {

Callers 1

createAgentDefinitionFunction · 0.85

Calls 1

ReadFileMethod · 0.65

Tested by

no test coverage detected