(cmd *cobra.Command, deps commandDeps, workspaceRef string)
| 183 | } |
| 184 | |
| 185 | func resolveAgentCreateDirectory(cmd *cobra.Command, deps commandDeps, workspaceRef string) (string, error) { |
| 186 | if strings.TrimSpace(workspaceRef) == "" { |
| 187 | homePaths, err := deps.resolveHome() |
| 188 | if err != nil { |
| 189 | return "", err |
| 190 | } |
| 191 | if deps.ensureHome != nil { |
| 192 | if err := deps.ensureHome(homePaths); err != nil { |
| 193 | return "", err |
| 194 | } |
| 195 | } |
| 196 | return homePaths.AgentsDir, nil |
| 197 | } |
| 198 | |
| 199 | client, err := clientFromDeps(deps) |
| 200 | if err != nil { |
| 201 | return "", err |
| 202 | } |
| 203 | detail, err := client.GetWorkspace(cmd.Context(), workspaceRef) |
| 204 | if err != nil { |
| 205 | return "", err |
| 206 | } |
| 207 | rootDir := strings.TrimSpace(detail.Workspace.RootDir) |
| 208 | if rootDir == "" { |
| 209 | return "", errors.New("cli: resolved workspace root_dir is empty") |
| 210 | } |
| 211 | return filepath.Join(rootDir, aghconfig.DirName, aghconfig.AgentsDirName), nil |
| 212 | } |
| 213 | |
| 214 | func agentRecordFromDefinition(agent aghconfig.AgentDef) AgentRecord { |
| 215 | return AgentRecord{ |
no test coverage detected