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

Function resolveSessionCreateWorkspace

internal/cli/session.go:1307–1328  ·  view source on GitHub ↗
(deps commandDeps, workspaceRef string, cwd string)

Source from the content-addressed store, hash-verified

1305}
1306
1307func resolveSessionCreateWorkspace(deps commandDeps, workspaceRef string, cwd string) (string, string, error) {
1308 trimmedWorkspace := strings.TrimSpace(workspaceRef)
1309 trimmedCWD := strings.TrimSpace(cwd)
1310
1311 switch {
1312 case trimmedWorkspace != "" && trimmedCWD != "":
1313 return "", "", errors.New("cli: --workspace and --cwd are mutually exclusive")
1314 case trimmedWorkspace != "":
1315 return trimmedWorkspace, "", nil
1316 case trimmedCWD != "":
1317 if !filepath.IsAbs(trimmedCWD) {
1318 return "", "", fmt.Errorf("cli: --cwd must be an absolute path: %q", trimmedCWD)
1319 }
1320 return "", filepath.Clean(trimmedCWD), nil
1321 default:
1322 workspacePath, err := currentWorkingDirectory(deps)
1323 if err != nil {
1324 return "", "", err
1325 }
1326 return "", workspacePath, nil
1327 }
1328}
1329
1330func flattenHistory(history []TurnHistoryRecord) []SessionEventRecord {
1331 flattened := make([]SessionEventRecord, 0)

Callers 1

newSessionCreateCommandFunction · 0.85

Calls 1

currentWorkingDirectoryFunction · 0.85

Tested by

no test coverage detected