MCPcopy
hub / github.com/coder/mux / listWorkspacesCommand

Function listWorkspacesCommand

src/cli/debug/list-workspaces.ts:6–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { getMuxSessionsDir } from "@/common/constants/paths";
5
6export 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}

Callers 1

index.tsFile · 0.90

Calls 4

getMuxSessionsDirFunction · 0.90
loadConfigOrDefaultMethod · 0.80
findWorkspaceMethod · 0.80
basenameMethod · 0.45

Tested by

no test coverage detected