workspace_tools 0.12.0

Reliable workspace-relative path resolution for Rust projects. Automatically finds your workspace root and provides consistent file path handling regardless of execution context. Features memory-safe secret management, configuration loading with validation, and resource discovery.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
# Task 011: IDE Integration

**Priority**: 💻 High Impact  
**Phase**: 4 (Tooling Ecosystem)  
**Estimated Effort**: 6-8 weeks  
**Dependencies**: Task 010 (CLI Tool), Task 001 (Cargo Integration)  

## **Objective**
Develop IDE extensions and integrations to make workspace_tools visible and accessible to all Rust developers directly within their development environment, significantly increasing discoverability and adoption.

## **Technical Requirements**

### **Core Features**
1. **VS Code Extension**
   - Workspace navigation panel showing standard directories
   - Quick actions for creating config files and standard directories
   - Auto-completion for workspace paths in Rust code
   - Integration with file explorer for workspace-relative operations

2. **IntelliJ/RustRover Plugin**
   - Project tool window for workspace management
   - Code generation templates using workspace_tools patterns
   - Inspection and quick fixes for workspace path usage
   - Integration with existing Rust plugin ecosystem

3. **rust-analyzer Integration**
   - LSP extension for workspace path completion
   - Hover information for workspace paths
   - Code actions for converting absolute paths to workspace-relative
   - Integration with workspace metadata

### **VS Code Extension Architecture**
```typescript
// Extension API surface
interface WorkspaceToolsAPI {
    // Workspace detection and management
    detectWorkspace(): Promise<WorkspaceInfo>;
    getStandardDirectories(): Promise<DirectoryInfo[]>;
    createStandardDirectory(name: string): Promise<void>;
    
    // Configuration management
    loadConfig<T>(name: string): Promise<T>;
    saveConfig<T>(name: string, config: T): Promise<void>;
    editConfig(name: string): Promise<void>;
    
    // Resource discovery
    findResources(pattern: string): Promise<string[]>;
    searchWorkspace(query: string): Promise<SearchResult[]>;
    
    // Integration features
    generateBoilerplate(template: string): Promise<void>;
    validateWorkspaceStructure(): Promise<ValidationResult>;
}

interface WorkspaceInfo {
    root: string;
    type: 'cargo' | 'standard' | 'git' | 'manual';
    standardDirectories: string[];
    configFiles: ConfigFileInfo[];
    metadata?: CargoMetadata;
}

interface DirectoryInfo {
    name: string;
    path: string;
    purpose: string;
    exists: boolean;
    isEmpty: boolean;
}

interface ConfigFileInfo {
    name: string;
    path: string;
    format: 'toml' | 'yaml' | 'json';
    schema?: string;
}

interface SearchResult {
    path: string;
    type: 'file' | 'directory' | 'config' | 'resource';
    relevance: number;
    preview?: string;
}

interface ValidationResult {
    valid: boolean;
    warnings: ValidationWarning[];
    suggestions: ValidationSuggestion[];
}
```

### **Implementation Steps**

#### **Phase 1: VS Code Extension Foundation** (Weeks 1-2)

**Week 1: Core Extension Structure**
```json
// package.json
{
  "name": "workspace-tools",
  "displayName": "Workspace Tools",
  "description": "Universal workspace-relative path resolution for Rust projects",
  "version": "0.1.0",
  "publisher": "workspace-tools",
  "categories": ["Other", "Snippets", "Formatters"],
  "keywords": ["rust", "workspace", "path", "configuration"],
  "engines": {
    "vscode": "^1.74.0"
  },
  "activationEvents": [
    "onLanguage:rust",
    "workspaceContains:Cargo.toml",
    "workspaceContains:.cargo/config.toml"
  ],
  "contributes": {
    "commands": [
      {
        "command": "workspace-tools.detectWorkspace",
        "title": "Detect Workspace",
        "category": "Workspace Tools"
      },
      {
        "command": "workspace-tools.createStandardDirectories",
        "title": "Create Standard Directories",
        "category": "Workspace Tools"
      },
      {
        "command": "workspace-tools.openConfig",
        "title": "Open Configuration",
        "category": "Workspace Tools"
      }
    ],
    "views": {
      "explorer": [
        {
          "id": "workspace-tools.workspaceExplorer",
          "name": "Workspace Tools",
          "when": "workspace-tools.isWorkspace"
        }
      ]
    },
    "viewsContainers": {
      "activitybar": [
        {
          "id": "workspace-tools",
          "title": "Workspace Tools",
          "icon": "$(folder-library)"
        }
      ]
    },
    "configuration": {
      "title": "Workspace Tools",
      "properties": {
        "workspace-tools.autoDetect": {
          "type": "boolean",
          "default": true,
          "description": "Automatically detect workspace_tools workspaces"
        },
        "workspace-tools.showInStatusBar": {
          "type": "boolean", 
          "default": true,
          "description": "Show workspace status in status bar"
        }
      }
    }
  }
}
```

**Week 2: Rust Integration Bridge**
```typescript
// src/rustBridge.ts - Bridge to workspace_tools CLI
import { exec } from 'child_process';
import { promisify } from 'util';
import * as vscode from 'vscode';

const execAsync = promisify(exec);

export class RustWorkspaceBridge {
    private workspaceRoot: string;
    private cliPath: string;

    constructor(workspaceRoot: string) {
        this.workspaceRoot = workspaceRoot;
        this.cliPath = 'workspace-tools'; // Assume CLI is in PATH
    }

    async detectWorkspace(): Promise<WorkspaceInfo> {
        try {
            const { stdout } = await execAsync(
                `${this.cliPath} info --json`,
                { cwd: this.workspaceRoot }
            );
            return JSON.parse(stdout);
        } catch (error) {
            throw new Error(`Failed to detect workspace: ${error}`);
        }
    }

    async getStandardDirectories(): Promise<DirectoryInfo[]> {
        const { stdout } = await execAsync(
            `${this.cliPath} directories --json`,
            { cwd: this.workspaceRoot }
        );
        return JSON.parse(stdout);
    }

    async createStandardDirectory(name: string): Promise<void> {
        await execAsync(
            `${this.cliPath} create-dir "${name}"`,
            { cwd: this.workspaceRoot }
        );
    }

    async loadConfig<T>(name: string): Promise<T> {
        const { stdout } = await execAsync(
            `${this.cliPath} config get "${name}" --json`,
            { cwd: this.workspaceRoot }
        );
        return JSON.parse(stdout);
    }

    async saveConfig<T>(name: string, config: T): Promise<void> {
        const configJson = JSON.stringify(config, null, 2);
        await execAsync(
            `${this.cliPath} config set "${name}"`,
            { 
                cwd: this.workspaceRoot,
                input: configJson
            }
        );
    }

    async findResources(pattern: string): Promise<string[]> {
        const { stdout } = await execAsync(
            `${this.cliPath} find "${pattern}" --json`,
            { cwd: this.workspaceRoot }
        );
        return JSON.parse(stdout);
    }

    async validateWorkspaceStructure(): Promise<ValidationResult> {
        try {
            const { stdout } = await execAsync(
                `${this.cliPath} validate --json`,
                { cwd: this.workspaceRoot }
            );
            return JSON.parse(stdout);
        } catch (error) {
            return {
                valid: false,
                warnings: [{ message: `Validation failed: ${error}`, severity: 'error' }],
                suggestions: []
            };
        }
    }
}

// Workspace detection and activation
export async function activateWorkspaceTools(context: vscode.ExtensionContext) {
    const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
    if (!workspaceFolder) {
        return;
    }

    const bridge = new RustWorkspaceBridge(workspaceFolder.uri.fsPath);
    
    try {
        const workspaceInfo = await bridge.detectWorkspace();
        vscode.commands.executeCommand('setContext', 'workspace-tools.isWorkspace', true);
        
        // Initialize workspace explorer
        const workspaceExplorer = new WorkspaceExplorerProvider(bridge);
        vscode.window.registerTreeDataProvider('workspace-tools.workspaceExplorer', workspaceExplorer);
        
        // Register commands
        registerCommands(context, bridge);
        
        // Update status bar
        updateStatusBar(workspaceInfo);
        
    } catch (error) {
        console.log('workspace_tools not detected in this workspace');
        vscode.commands.executeCommand('setContext', 'workspace-tools.isWorkspace', false);
    }
}
```

#### **Phase 2: Workspace Explorer and Navigation** (Weeks 3-4)

**Week 3: Tree View Implementation**
```typescript
// src/workspaceExplorer.ts
import * as vscode from 'vscode';
import * as path from 'path';
import { RustWorkspaceBridge } from './rustBridge';

export class WorkspaceExplorerProvider implements vscode.TreeDataProvider<WorkspaceItem> {
    private _onDidChangeTreeData: vscode.EventEmitter<WorkspaceItem | undefined | null | void> = new vscode.EventEmitter<WorkspaceItem | undefined | null | void>();
    readonly onDidChangeTreeData: vscode.Event<WorkspaceItem | undefined | null | void> = this._onDidChangeTreeData.event;

    constructor(private bridge: RustWorkspaceBridge) {}

    refresh(): void {
        this._onDidChangeTreeData.fire();
    }

    getTreeItem(element: WorkspaceItem): vscode.TreeItem {
        return element;
    }

    async getChildren(element?: WorkspaceItem): Promise<WorkspaceItem[]> {
        if (!element) {
            // Root level items
            return [
                new WorkspaceItem(
                    'Standard Directories',
                    vscode.TreeItemCollapsibleState.Expanded,
                    'directories'
                ),
                new WorkspaceItem(
                    'Configuration Files',
                    vscode.TreeItemCollapsibleState.Expanded,
                    'configs'
                ),
                new WorkspaceItem(
                    'Resources',
                    vscode.TreeItemCollapsibleState.Collapsed,
                    'resources'
                )
            ];
        }

        switch (element.contextValue) {
            case 'directories':
                return this.getDirectoryItems();
            case 'configs':
                return this.getConfigItems();
            case 'resources':
                return this.getResourceItems();
            default:
                return [];
        }
    }

    private async getDirectoryItems(): Promise<WorkspaceItem[]> {
        try {
            const directories = await this.bridge.getStandardDirectories();
            return directories.map(dir => {
                const item = new WorkspaceItem(
                    `${dir.name} ${dir.exists ? '✓' : '✗'}`,
                    vscode.TreeItemCollapsibleState.None,
                    'directory'
                );
                item.resourceUri = vscode.Uri.file(dir.path);
                item.tooltip = `${dir.purpose} ${dir.exists ? '(exists)' : '(missing)'}`;
                item.command = {
                    command: 'vscode.openFolder',
                    title: 'Open Directory',
                    arguments: [vscode.Uri.file(dir.path)]
                };
                return item;
            });
        } catch (error) {
            return [new WorkspaceItem('Error loading directories', vscode.TreeItemCollapsibleState.None, 'error')];
        }
    }

    private async getConfigItems(): Promise<WorkspaceItem[]> {
        try {
            const workspaceInfo = await this.bridge.detectWorkspace();
            return workspaceInfo.configFiles.map(config => {
                const item = new WorkspaceItem(
                    `${config.name}.${config.format}`,
                    vscode.TreeItemCollapsibleState.None,
                    'config'
                );
                item.resourceUri = vscode.Uri.file(config.path);
                item.tooltip = `Configuration file (${config.format.toUpperCase()})`;
                item.command = {
                    command: 'vscode.open',
                    title: 'Open Config',
                    arguments: [vscode.Uri.file(config.path)]
                };
                return item;
            });
        } catch (error) {
            return [new WorkspaceItem('No configuration files found', vscode.TreeItemCollapsibleState.None, 'info')];
        }
    }

    private async getResourceItems(): Promise<WorkspaceItem[]> {
        try {
            const commonPatterns = [
                { name: 'Rust Sources', pattern: 'src/**/*.rs' },
                { name: 'Tests', pattern: 'tests/**/*.rs' },
                { name: 'Documentation', pattern: 'docs/**/*' },
                { name: 'Scripts', pattern: '**/*.sh' }
            ];

            const items: WorkspaceItem[] = [];
            for (const pattern of commonPatterns) {
                const resources = await this.bridge.findResources(pattern.pattern);
                const item = new WorkspaceItem(
                    `${pattern.name} (${resources.length})`,
                    resources.length > 0 ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None,
                    'resource-group'
                );
                item.tooltip = `Pattern: ${pattern.pattern}`;
                items.push(item);
            }
            return items;
        } catch (error) {
            return [new WorkspaceItem('Error loading resources', vscode.TreeItemCollapsibleState.None, 'error')];
        }
    }
}

class WorkspaceItem extends vscode.TreeItem {
    constructor(
        public readonly label: string,
        public readonly collapsibleState: vscode.TreeItemCollapsibleState,
        public readonly contextValue: string
    ) {
        super(label, collapsibleState);
    }
}
```

**Week 4: Quick Actions and Context Menus**
```typescript
// src/commands.ts
import * as vscode from 'vscode';
import { RustWorkspaceBridge } from './rustBridge';

export function registerCommands(context: vscode.ExtensionContext, bridge: RustWorkspaceBridge) {
    // Workspace detection command
    const detectWorkspaceCommand = vscode.commands.registerCommand(
        'workspace-tools.detectWorkspace',
        async () => {
            try {
                const workspaceInfo = await bridge.detectWorkspace();
                vscode.window.showInformationMessage(
                    `Workspace detected: ${workspaceInfo.type} at ${workspaceInfo.root}`
                );
            } catch (error) {
                vscode.window.showErrorMessage(`Failed to detect workspace: ${error}`);
            }
        }
    );

    // Create standard directories command
    const createDirectoriesCommand = vscode.commands.registerCommand(
        'workspace-tools.createStandardDirectories',
        async () => {
            const directories = ['config', 'data', 'logs', 'docs', 'tests'];
            const selected = await vscode.window.showQuickPick(
                directories.map(dir => ({ label: dir, picked: false })),
                {
                    placeHolder: 'Select directories to create',
                    canPickMany: true
                }
            );

            if (selected && selected.length > 0) {
                for (const dir of selected) {
                    try {
                        await bridge.createStandardDirectory(dir.label);
                        vscode.window.showInformationMessage(`Created ${dir.label} directory`);
                    } catch (error) {
                        vscode.window.showErrorMessage(`Failed to create ${dir.label}: ${error}`);
                    }
                }
                
                // Refresh explorer
                vscode.commands.executeCommand('workspace-tools.refresh');
            }
        }
    );

    // Open configuration command
    const openConfigCommand = vscode.commands.registerCommand(
        'workspace-tools.openConfig',
        async () => {
            const configName = await vscode.window.showInputBox({
                placeHolder: 'Enter configuration name (e.g., "app", "database")',
                prompt: 'Configuration file to open or create'
            });

            if (configName) {
                try {
                    // Try to load existing config
                    await bridge.loadConfig(configName);
                    
                    // If successful, open the file
                    const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
                    if (workspaceFolder) {
                        const configPath = vscode.Uri.joinPath(
                            workspaceFolder.uri,
                            'config',
                            `${configName}.toml`
                        );
                        await vscode.window.showTextDocument(configPath);
                    }
                } catch (error) {
                    // Config doesn't exist, offer to create it
                    const create = await vscode.window.showQuickPick(
                        ['Create TOML config', 'Create YAML config', 'Create JSON config'],
                        { placeHolder: 'Configuration file not found. Create new?' }
                    );

                    if (create) {
                        const format = create.split(' ')[1].toLowerCase();
                        // Create empty config file
                        const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
                        if (workspaceFolder) {
                            const configPath = vscode.Uri.joinPath(
                                workspaceFolder.uri,
                                'config',
                                `${configName}.${format}`
                            );
                            
                            const edit = new vscode.WorkspaceEdit();
                            edit.createFile(configPath, { overwrite: false });
                            await vscode.workspace.applyEdit(edit);
                            await vscode.window.showTextDocument(configPath);
                        }
                    }
                }
            }
        }
    );

    // Validate workspace structure command
    const validateCommand = vscode.commands.registerCommand(
        'workspace-tools.validate',
        async () => {
            try {
                const result = await bridge.validateWorkspaceStructure();
                
                if (result.valid) {
                    vscode.window.showInformationMessage('Workspace structure is valid ✓');
                } else {
                    const warnings = result.warnings.map(w => w.message).join('\n');
                    vscode.window.showWarningMessage(
                        `Workspace validation found issues:\n${warnings}`
                    );
                }
            } catch (error) {
                vscode.window.showErrorMessage(`Validation failed: ${error}`);
            }
        }
    );

    // Generate boilerplate command
    const generateBoilerplateCommand = vscode.commands.registerCommand(
        'workspace-tools.generateBoilerplate',
        async () => {
            const templates = [
                'CLI Application',
                'Web Service', 
                'Library',
                'Desktop Application',
                'Configuration File'
            ];

            const selected = await vscode.window.showQuickPick(templates, {
                placeHolder: 'Select template to generate'
            });

            if (selected) {
                try {
                    // This would integrate with the template system (Task 002)
                    vscode.window.showInformationMessage(`Generating ${selected} template...`);
                    // await bridge.generateBoilerplate(selected.toLowerCase().replace(' ', '-'));
                    vscode.window.showInformationMessage(`${selected} template generated successfully`);
                } catch (error) {
                    vscode.window.showErrorMessage(`Template generation failed: ${error}`);
                }
            }
        }
    );

    // Register all commands
    context.subscriptions.push(
        detectWorkspaceCommand,
        createDirectoriesCommand,
        openConfigCommand,
        validateCommand,
        generateBoilerplateCommand
    );
}
```

#### **Phase 3: IntelliJ/RustRover Plugin** (Weeks 5-6)

**Week 5: Plugin Foundation**
```kotlin
// src/main/kotlin/com/workspace_tools/plugin/WorkspaceToolsPlugin.kt
package com.workspace_tools.plugin

import com.intellij.openapi.components.BaseComponent
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupActivity
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.openapi.wm.ToolWindowManager

class WorkspaceToolsPlugin : BaseComponent {
    override fun getComponentName(): String = "WorkspaceToolsPlugin"
}

class WorkspaceToolsStartupActivity : StartupActivity {
    override fun runActivity(project: Project) {
        val workspaceService = project.getService(WorkspaceService::class.java)
        
        if (workspaceService.isWorkspaceProject()) {
            // Register tool window
            val toolWindowManager = ToolWindowManager.getInstance(project)
            val toolWindow = toolWindowManager.registerToolWindow(
                "Workspace Tools",
                true,
                ToolWindowAnchor.LEFT
            )
            
            // Initialize workspace explorer
            val explorerPanel = WorkspaceExplorerPanel(project, workspaceService)
            toolWindow.contentManager.addContent(
                toolWindow.contentManager.factory.createContent(explorerPanel, "Explorer", false)
            )
        }
    }
}

// src/main/kotlin/com/workspace_tools/plugin/WorkspaceService.kt
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.execution.util.ExecUtil
import com.intellij.openapi.components.Service
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.google.gson.Gson
import java.io.File

@Service
class WorkspaceService(private val project: Project) {
    private val gson = Gson()
    
    fun isWorkspaceProject(): Boolean {
        return try {
            detectWorkspace()
            true
        } catch (e: Exception) {
            false
        }
    }
    
    fun detectWorkspace(): WorkspaceInfo {
        val projectPath = project.basePath ?: throw IllegalStateException("No project path")
        
        val commandLine = GeneralCommandLine()
            .withExePath("workspace-tools")
            .withParameters("info", "--json")
            .withWorkDirectory(File(projectPath))
        
        val output = ExecUtil.execAndGetOutput(commandLine)
        if (output.exitCode != 0) {
            throw RuntimeException("Failed to detect workspace: ${output.stderr}")
        }
        
        return gson.fromJson(output.stdout, WorkspaceInfo::class.java)
    }
    
    fun getStandardDirectories(): List<DirectoryInfo> {
        val projectPath = project.basePath ?: return emptyList()
        
        val commandLine = GeneralCommandLine()
            .withExePath("workspace-tools")
            .withParameters("directories", "--json")
            .withWorkDirectory(File(projectPath))
        
        val output = ExecUtil.execAndGetOutput(commandLine)
        if (output.exitCode != 0) {
            return emptyList()
        }
        
        return gson.fromJson(output.stdout, Array<DirectoryInfo>::class.java).toList()
    }
    
    fun createStandardDirectory(name: String) {
        val projectPath = project.basePath ?: return
        
        val commandLine = GeneralCommandLine()
            .withExePath("workspace-tools")
            .withParameters("create-dir", name)
            .withWorkDirectory(File(projectPath))
        
        ExecUtil.execAndGetOutput(commandLine)
        
        // Refresh project view
        VirtualFileManager.getInstance().syncRefresh()
    }
}

data class WorkspaceInfo(
    val root: String,
    val type: String,
    val standardDirectories: List<String>,
    val configFiles: List<ConfigFileInfo>
)

data class DirectoryInfo(
    val name: String,
    val path: String,
    val purpose: String,
    val exists: Boolean,
    val isEmpty: Boolean
)

data class ConfigFileInfo(
    val name: String,
    val path: String,
    val format: String
)
```

**Week 6: Tool Window and Actions**
```kotlin
// src/main/kotlin/com/workspace_tools/plugin/WorkspaceExplorerPanel.kt
import com.intellij.openapi.project.Project
import com.intellij.ui.components.JBScrollPane
import com.intellij.ui.treeStructure.SimpleTree
import com.intellij.util.ui.tree.TreeUtil
import javax.swing.*
import javax.swing.tree.DefaultMutableTreeNode
import javax.swing.tree.DefaultTreeModel
import java.awt.BorderLayout

class WorkspaceExplorerPanel(
    private val project: Project,
    private val workspaceService: WorkspaceService
) : JPanel() {
    
    private val tree: SimpleTree
    private val rootNode = DefaultMutableTreeNode("Workspace")
    
    init {
        layout = BorderLayout()
        
        tree = SimpleTree()
        tree.model = DefaultTreeModel(rootNode)
        tree.isRootVisible = true
        
        add(JBScrollPane(tree), BorderLayout.CENTER)
        add(createToolbar(), BorderLayout.NORTH)
        
        refreshTree()
    }
    
    private fun createToolbar(): JComponent {
        val toolbar = JPanel()
        
        val refreshButton = JButton("Refresh")
        refreshButton.addActionListener { refreshTree() }
        
        val createDirButton = JButton("Create Directory")
        createDirButton.addActionListener { showCreateDirectoryDialog() }
        
        val validateButton = JButton("Validate")
        validateButton.addActionListener { validateWorkspace() }
        
        toolbar.add(refreshButton)
        toolbar.add(createDirButton)
        toolbar.add(validateButton)
        
        return toolbar
    }
    
    private fun refreshTree() {
        SwingUtilities.invokeLater {
            rootNode.removeAllChildren()
            
            try {
                val workspaceInfo = workspaceService.detectWorkspace()
                
                // Add directories node
                val directoriesNode = DefaultMutableTreeNode("Standard Directories")
                rootNode.add(directoriesNode)
                
                val directories = workspaceService.getStandardDirectories()
                directories.forEach { dir ->
                    val status = if (dir.exists) "✓" else "✗"
                    val dirNode = DefaultMutableTreeNode("${dir.name} $status")
                    directoriesNode.add(dirNode)
                }
                
                // Add configuration files node
                val configsNode = DefaultMutableTreeNode("Configuration Files")
                rootNode.add(configsNode)
                
                workspaceInfo.configFiles.forEach { config ->
                    val configNode = DefaultMutableTreeNode("${config.name}.${config.format}")
                    configsNode.add(configNode)
                }
                
                TreeUtil.expandAll(tree)
                (tree.model as DefaultTreeModel).reload()
                
            } catch (e: Exception) {
                val errorNode = DefaultMutableTreeNode("Error: ${e.message}")
                rootNode.add(errorNode)
                (tree.model as DefaultTreeModel).reload()
            }
        }
    }
    
    private fun showCreateDirectoryDialog() {
        val directories = arrayOf("config", "data", "logs", "docs", "tests")
        val selected = JOptionPane.showInputDialog(
            this,
            "Select directory to create:",
            "Create Standard Directory",
            JOptionPane.PLAIN_MESSAGE,
            null,
            directories,
            directories[0]
        ) as String?
        
        if (selected != null) {
            try {
                workspaceService.createStandardDirectory(selected)
                JOptionPane.showMessageDialog(
                    this,
                    "Directory '$selected' created successfully",
                    "Success",
                    JOptionPane.INFORMATION_MESSAGE
                )
                refreshTree()
            } catch (e: Exception) {
                JOptionPane.showMessageDialog(
                    this,
                    "Failed to create directory: ${e.message}",
                    "Error",
                    JOptionPane.ERROR_MESSAGE
                )
            }
        }
    }
    
    private fun validateWorkspace() {
        try {
            // This would call the validation functionality
            JOptionPane.showMessageDialog(
                this,
                "Workspace structure is valid ✓",
                "Validation Result",
                JOptionPane.INFORMATION_MESSAGE
            )
        } catch (e: Exception) {
            JOptionPane.showMessageDialog(
                this,
                "Validation failed: ${e.message}",
                "Validation Result",
                JOptionPane.WARNING_MESSAGE
            )
        }
    }
}
```

#### **Phase 4: rust-analyzer Integration** (Weeks 7-8)

**Week 7: LSP Extension Specification**
```json
// rust-analyzer extension specification
{
  "workspaceTools": {
    "capabilities": {
      "workspacePathCompletion": true,
      "workspacePathHover": true,
      "workspacePathCodeActions": true,
      "workspaceValidation": true
    },
    "features": {
      "completion": {
        "workspacePaths": {
          "trigger": ["ws.", "workspace."],
          "patterns": [
            "ws.config_dir()",
            "ws.data_dir()",
            "ws.logs_dir()",
            "ws.join(\"{path}\")"
          ]
        }
      },
      "hover": {
        "workspacePaths": {
          "provides": "workspace-relative path information"
        }
      },
      "codeAction": {
        "convertPaths": {
          "title": "Convert to workspace-relative path",
          "kind": "refactor.rewrite"
        }
      },
      "diagnostics": {
        "workspaceStructure": {
          "validates": ["workspace configuration", "standard directories"]
        }
      }
    }
  }
}
```

**Week 8: Implementation and Testing**
```rust
// rust-analyzer integration (conceptual - would be contributed to rust-analyzer)
// This shows what the integration would look like

// Completion provider for workspace_tools
pub fn workspace_tools_completion(
    ctx: &CompletionContext,
) -> Option<Vec<CompletionItem>> {
    if !is_workspace_tools_context(ctx) {
        return None;
    }
    
    let items = vec![
        CompletionItem {
            label: "config_dir()".to_string(),
            kind: CompletionItemKind::Method,
            detail: Some("workspace_tools::Workspace::config_dir".to_string()),
            documentation: Some("Get the standard configuration directory path".to_string()),
            ..Default::default()
        },
        CompletionItem {
            label: "data_dir()".to_string(),
            kind: CompletionItemKind::Method,
            detail: Some("workspace_tools::Workspace::data_dir".to_string()),
            documentation: Some("Get the standard data directory path".to_string()),
            ..Default::default()
        },
        // ... more completions
    ];
    
    Some(items)
}

// Hover provider for workspace paths
pub fn workspace_path_hover(
    ctx: &HoverContext,
) -> Option<HoverResult> {
    if let Some(workspace_path) = extract_workspace_path(ctx) {
        Some(HoverResult {
            markup: format!(
                "**Workspace Path**: `{}`\n\nResolves to: `{}`",
                workspace_path.relative_path,
                workspace_path.absolute_path
            ),
            range: ctx.range,
        })
    } else {
        None
    }
}
```

### **Success Criteria**
- [ ] VS Code extension published to marketplace with >1k installs
- [ ] IntelliJ plugin published to JetBrains marketplace
- [ ] rust-analyzer integration proposal accepted (or prototype working)
- [ ] Extensions provide meaningful workspace navigation and management
- [ ] Auto-completion and code actions work seamlessly
- [ ] User feedback score >4.5 stars on extension marketplaces
- [ ] Integration increases workspace_tools adoption by 50%+

### **Metrics to Track**
- Extension download/install counts
- User ratings and reviews
- Feature usage analytics (which features are used most)
- Bug reports and resolution time
- Contribution to overall workspace_tools adoption

### **Future Enhancements**
- Integration with other editors (Vim, Emacs, Sublime Text)
- Advanced refactoring tools for workspace-relative paths  
- Visual workspace structure designer
- Integration with workspace templates and scaffolding
- Real-time workspace validation and suggestions
- Team collaboration features for shared workspace configurations

### **Distribution Strategy**
1. **VS Code**: Publish to Visual Studio Code Marketplace
2. **IntelliJ**: Publish to JetBrains Plugin Repository
3. **rust-analyzer**: Contribute as upstream feature or extension
4. **Documentation**: Comprehensive setup and usage guides
5. **Community**: Demo videos, blog posts, conference presentations

This task significantly increases workspace_tools visibility by putting it directly into developers' daily workflow, making adoption natural and discoverable.