()
| 4 | import { getMuxSessionsDir } from "@/common/constants/paths"; |
| 5 | |
| 6 | export function listWorkspacesCommand() { |
| 7 | const config = defaultConfig.loadConfigOrDefault(); |
| 8 | |
| 9 | console.log("\n=== Configuration Debug ===\n"); |
| 10 | console.log("Projects in config:", config.projects.size); |
| 11 | |
| 12 | for (const [projectPath, project] of config.projects) { |
| 13 | const projectName = PlatformPaths.basename(projectPath); |
| 14 | console.log(`\nProject: ${projectName}`); |
| 15 | console.log(` Path: ${projectPath}`); |
| 16 | console.log(` Workspaces: ${project.workspaces.length}`); |
| 17 | |
| 18 | for (const workspace of project.workspaces) { |
| 19 | const dirName = PlatformPaths.basename(workspace.path); |
| 20 | console.log(` - Directory: ${dirName}`); |
| 21 | if (workspace.id) { |
| 22 | console.log(` ID: ${workspace.id}`); |
| 23 | } |
| 24 | if (workspace.name) { |
| 25 | console.log(` Name: ${workspace.name}`); |
| 26 | } |
| 27 | console.log(` Path: ${workspace.path}`); |
| 28 | console.log(` Exists: ${fs.existsSync(workspace.path)}`); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | console.log("\n=== Testing findWorkspace ===\n"); |
| 33 | |
| 34 | // Test finding specific workspaces by ID |
| 35 | const testCases = ["mux-colors", "mux-main", "mux-fix", "mux-markdown"]; |
| 36 | |
| 37 | for (const workspaceId of testCases) { |
| 38 | const result = defaultConfig.findWorkspace(workspaceId); |
| 39 | console.log(`findWorkspace('${workspaceId}'):`); |
| 40 | if (result) { |
| 41 | console.log(` Found: ${result.workspacePath}`); |
| 42 | console.log(` Project: ${result.projectPath}`); |
| 43 | console.log(` Exists: ${fs.existsSync(result.workspacePath)}`); |
| 44 | } else { |
| 45 | console.log(` Not found!`); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | console.log("\n=== Sessions Directory ===\n"); |
| 50 | const sessionsDir = getMuxSessionsDir(); |
| 51 | if (fs.existsSync(sessionsDir)) { |
| 52 | const sessions = fs.readdirSync(sessionsDir); |
| 53 | console.log(`Sessions in ${sessionsDir}:`); |
| 54 | for (const session of sessions) { |
| 55 | console.log(` - ${session}`); |
| 56 | } |
| 57 | } else { |
| 58 | console.log("Sessions directory does not exist"); |
| 59 | } |
| 60 | } |
no test coverage detected