bc-code-intelligence-mcp 1.4.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-loader.js +33 -1
- package/dist/config/config-loader.js.map +1 -1
- package/dist/config/config-validator.d.ts.map +1 -1
- package/dist/config/config-validator.js +5 -1
- package/dist/config/config-validator.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +272 -24
- package/dist/index.js.map +1 -1
- package/dist/layers/base-layer.d.ts +41 -17
- package/dist/layers/base-layer.d.ts.map +1 -1
- package/dist/layers/base-layer.js +103 -41
- package/dist/layers/base-layer.js.map +1 -1
- package/dist/layers/embedded-layer.d.ts +5 -2
- package/dist/layers/embedded-layer.d.ts.map +1 -1
- package/dist/layers/embedded-layer.js +58 -23
- package/dist/layers/embedded-layer.js.map +1 -1
- package/dist/layers/git-layer.d.ts +16 -1
- package/dist/layers/git-layer.d.ts.map +1 -1
- package/dist/layers/git-layer.js +118 -10
- package/dist/layers/git-layer.js.map +1 -1
- package/dist/layers/project-layer.d.ts +8 -0
- package/dist/layers/project-layer.d.ts.map +1 -1
- package/dist/layers/project-layer.js +33 -3
- package/dist/layers/project-layer.js.map +1 -1
- package/dist/services/methodology-service.d.ts.map +1 -1
- package/dist/services/methodology-service.js +5 -1
- package/dist/services/methodology-service.js.map +1 -1
- package/dist/services/multi-content-layer-service.d.ts +13 -0
- package/dist/services/multi-content-layer-service.d.ts.map +1 -1
- package/dist/services/multi-content-layer-service.js +59 -3
- package/dist/services/multi-content-layer-service.js.map +1 -1
- package/dist/services/roleplay-engine.d.ts.map +1 -1
- package/dist/services/roleplay-engine.js +4 -4
- package/dist/services/roleplay-engine.js.map +1 -1
- package/dist/tools/config-diagnostic-tools.d.ts +234 -0
- package/dist/tools/config-diagnostic-tools.d.ts.map +1 -0
- package/dist/tools/config-diagnostic-tools.js +887 -0
- package/dist/tools/config-diagnostic-tools.js.map +1 -0
- package/dist/tools/specialist-tools.d.ts.map +1 -1
- package/dist/tools/specialist-tools.js +7 -1
- package/dist/tools/specialist-tools.js.map +1 -1
- package/dist/tools/workspace-tools.d.ts +71 -0
- package/dist/tools/workspace-tools.d.ts.map +1 -0
- package/dist/tools/workspace-tools.js +134 -0
- package/dist/tools/workspace-tools.js.map +1 -0
- package/dist/types/bc-knowledge.d.ts +6 -0
- package/dist/types/bc-knowledge.d.ts.map +1 -1
- package/dist/types/bc-knowledge.js +3 -0
- package/dist/types/bc-knowledge.js.map +1 -1
- package/dist/types/config-types.d.ts +3 -0
- package/dist/types/config-types.d.ts.map +1 -1
- package/dist/types/config-types.js +5 -1
- package/dist/types/config-types.js.map +1 -1
- package/embedded-knowledge/domains/alex-architect/delegating-to-github-copilot-agents.md +371 -0
- package/embedded-knowledge/domains/alex-architect/object-id-ninja-integration.md +281 -0
- package/embedded-knowledge/domains/alex-architect/recommend-object-id-ninja.md +248 -0
- package/embedded-knowledge/domains/chris-config/configuration-file-discovery.md +444 -0
- package/embedded-knowledge/domains/chris-config/configuration-file-formats.md +540 -0
- package/embedded-knowledge/domains/chris-config/content-types-structure.md +421 -0
- package/embedded-knowledge/domains/chris-config/layer-system-fundamentals.md +257 -0
- package/embedded-knowledge/domains/chris-config/workspace-detection-solutions.md +336 -0
- package/embedded-knowledge/domains/dean-debug/bc-telemetry-buddy-integration.md +453 -0
- package/embedded-knowledge/domains/dean-debug/recommend-bc-telemetry-buddy.md +160 -0
- package/embedded-knowledge/specialists/chris-config.md +98 -192
- package/embedded-knowledge/specialists/dean-debug.md +55 -0
- package/package.json +1 -1
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Workspace Detection Solutions"
|
|
3
|
+
domain: "chris-config"
|
|
4
|
+
bc_versions: "1.5.0+"
|
|
5
|
+
difficulty: "intermediate"
|
|
6
|
+
tags: ["mcp-configuration", "workspace-management", "vscode", "troubleshooting"]
|
|
7
|
+
related_topics:
|
|
8
|
+
- "layer-system-fundamentals.md"
|
|
9
|
+
- "configuration-troubleshooting.md"
|
|
10
|
+
- "project-layer-setup.md"
|
|
11
|
+
applies_to:
|
|
12
|
+
- "BC Code Intelligence MCP Server"
|
|
13
|
+
- "VS Code MCP Extension"
|
|
14
|
+
last_updated: "2025-10-27"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Workspace Detection Solutions
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
The VS Code MCP extension does **not** set `process.cwd()` to the workspace root, causing the BC Code Intelligence MCP server to be unable to detect project-local configuration and knowledge layers. This document explains the problem, its impact, and the workspace management solution introduced in v1.5.0.
|
|
22
|
+
|
|
23
|
+
## The Problem
|
|
24
|
+
|
|
25
|
+
### **Root Cause**
|
|
26
|
+
|
|
27
|
+
When the MCP server runs in VS Code via the MCP extension:
|
|
28
|
+
- `process.cwd()` points to the MCP extension's installation directory
|
|
29
|
+
- **NOT** the user's workspace directory
|
|
30
|
+
- Example: `C:\Users\Username\.vscode\extensions\...` instead of `C:\Work\MyProject\`
|
|
31
|
+
|
|
32
|
+
### **Impact**
|
|
33
|
+
|
|
34
|
+
Without correct working directory:
|
|
35
|
+
1. **Configuration Discovery Fails**: Can't find `./bc-code-intel-config.json` in workspace
|
|
36
|
+
2. **Project Layer Won't Load**: Can't access `./bc-code-intel-overrides/` directory
|
|
37
|
+
3. **Relative Paths Broken**: Any workspace-relative path resolution fails
|
|
38
|
+
4. **User Confusion**: Project-specific knowledge appears missing
|
|
39
|
+
|
|
40
|
+
## The Solution: Workspace Management Tools (v1.5.0+)
|
|
41
|
+
|
|
42
|
+
### **Two New MCP Tools**
|
|
43
|
+
|
|
44
|
+
**1. set_workspace_root** - Configure workspace explicitly
|
|
45
|
+
```typescript
|
|
46
|
+
set_workspace_root({
|
|
47
|
+
workspace_root: "/absolute/path/to/workspace"
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**What it does:**
|
|
52
|
+
1. Validates the provided path exists
|
|
53
|
+
2. Calls `process.chdir(workspace_root)` to change working directory
|
|
54
|
+
3. Triggers full service reinitialization
|
|
55
|
+
4. Reloads all knowledge layers with new workspace context
|
|
56
|
+
5. Discovers project-local configuration if present
|
|
57
|
+
|
|
58
|
+
**2. get_workspace_root** - Query current workspace
|
|
59
|
+
```typescript
|
|
60
|
+
get_workspace_root()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Returns:**
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"workspace_root": "/current/working/directory",
|
|
67
|
+
"services_initialized": true
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### **First-Call Interception Pattern**
|
|
72
|
+
|
|
73
|
+
The MCP server implements **lazy initialization** with **first-call interception**:
|
|
74
|
+
|
|
75
|
+
**At Startup:**
|
|
76
|
+
- Server loads embedded knowledge only (fast startup, ~100ms)
|
|
77
|
+
- `servicesInitialized = false`
|
|
78
|
+
- All tool classes initialized but not ready
|
|
79
|
+
|
|
80
|
+
**On First Tool Call (before workspace set):**
|
|
81
|
+
- Tool handler checks `servicesInitialized === false`
|
|
82
|
+
- Returns helpful message instead of executing tool:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
🚀 BC Code Intelligence MCP Server - Workspace Configuration
|
|
86
|
+
|
|
87
|
+
The MCP server needs workspace context to load project-specific knowledge and configuration.
|
|
88
|
+
|
|
89
|
+
REQUIRED ACTION:
|
|
90
|
+
Call the set_workspace_root tool with your workspace path:
|
|
91
|
+
|
|
92
|
+
set_workspace_root({
|
|
93
|
+
workspace_root: "/absolute/path/to/your/workspace"
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
This enables:
|
|
97
|
+
- Project-local configuration (bc-code-intel-config.json)
|
|
98
|
+
- Project knowledge overrides (bc-code-intel-overrides/)
|
|
99
|
+
- Team and company knowledge layers
|
|
100
|
+
- Full workspace-aware functionality
|
|
101
|
+
|
|
102
|
+
After setting workspace root, all tools will be available.
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**After Workspace Set:**
|
|
106
|
+
- Full initialization runs
|
|
107
|
+
- All layers loaded (embedded, git, project)
|
|
108
|
+
- `servicesInitialized = true`
|
|
109
|
+
- All tools execute normally
|
|
110
|
+
|
|
111
|
+
## Usage Patterns
|
|
112
|
+
|
|
113
|
+
### **VS Code Workflow**
|
|
114
|
+
|
|
115
|
+
**Step 1: Open workspace in VS Code**
|
|
116
|
+
```
|
|
117
|
+
File → Open Folder → Select your BC project
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Step 2: Start MCP conversation**
|
|
121
|
+
```
|
|
122
|
+
User: "Hey, can you help me optimize this code?"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Step 3: Server prompts for workspace**
|
|
126
|
+
```
|
|
127
|
+
MCP: "I need workspace context. Call set_workspace_root first..."
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Step 4: Set workspace root** (agent or user)
|
|
131
|
+
```typescript
|
|
132
|
+
set_workspace_root({
|
|
133
|
+
workspace_root: "C:\\Work\\MyBCProject"
|
|
134
|
+
})
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Step 5: Full functionality available**
|
|
138
|
+
```
|
|
139
|
+
✅ Project config loaded
|
|
140
|
+
✅ Project knowledge layers available
|
|
141
|
+
✅ All tools ready
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### **Claude Desktop Workflow** (Manual Setup)
|
|
145
|
+
|
|
146
|
+
**Option A: Environment Variable** (Recommended)
|
|
147
|
+
```bash
|
|
148
|
+
# Set before launching Claude Desktop
|
|
149
|
+
export BC_WORKSPACE_ROOT="/path/to/workspace"
|
|
150
|
+
|
|
151
|
+
# On Windows PowerShell:
|
|
152
|
+
$env:BC_WORKSPACE_ROOT = "C:\Work\MyBCProject"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Option B: Manual Tool Call**
|
|
156
|
+
```typescript
|
|
157
|
+
// First interaction with MCP
|
|
158
|
+
set_workspace_root({
|
|
159
|
+
workspace_root: "/path/to/workspace"
|
|
160
|
+
})
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### **Automated CI/CD Workflow**
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# CI script sets workspace before running MCP tools
|
|
167
|
+
export BC_WORKSPACE_ROOT="$CI_PROJECT_DIR"
|
|
168
|
+
|
|
169
|
+
# MCP server auto-detects from environment
|
|
170
|
+
# No set_workspace_root call needed
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Configuration Discovery After Workspace Set
|
|
174
|
+
|
|
175
|
+
Once workspace is set, configuration discovery searches:
|
|
176
|
+
|
|
177
|
+
1. **Workspace Root**
|
|
178
|
+
- `./bc-code-intel-config.json`
|
|
179
|
+
- `./bc-code-intel-config.yaml`
|
|
180
|
+
- `./bc-code-intel-config.yml`
|
|
181
|
+
|
|
182
|
+
2. **User Home Directory** (expanded paths)
|
|
183
|
+
- `~/.bc-code-intel/config.json`
|
|
184
|
+
- `~/.bc-code-intel/config.yaml`
|
|
185
|
+
- `~/.bc-code-intel/config.yml`
|
|
186
|
+
|
|
187
|
+
3. **Environment Variable**
|
|
188
|
+
- `BC_CODE_INTEL_CONFIG=/path/to/config.json`
|
|
189
|
+
|
|
190
|
+
4. **Default Embedded Config**
|
|
191
|
+
- Embedded fallback if no config found
|
|
192
|
+
|
|
193
|
+
**Priority:** Workspace config > Environment variable > Home directory > Embedded
|
|
194
|
+
|
|
195
|
+
## Project Layer After Workspace Set
|
|
196
|
+
|
|
197
|
+
With workspace configured, project layer loads from:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
{workspace_root}/bc-code-intel-overrides/
|
|
201
|
+
├── domains/ # Project-specific topics
|
|
202
|
+
├── specialists/ # Project-specific specialists (future)
|
|
203
|
+
└── methodologies/ # Project-specific workflows (future)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Layer Priority:** 100 (highest - always wins)
|
|
207
|
+
|
|
208
|
+
## Troubleshooting
|
|
209
|
+
|
|
210
|
+
### **"Project config not found"**
|
|
211
|
+
|
|
212
|
+
**Problem:** Configuration exists but not being loaded
|
|
213
|
+
|
|
214
|
+
**Solution:**
|
|
215
|
+
```typescript
|
|
216
|
+
// Verify current workspace
|
|
217
|
+
get_workspace_root()
|
|
218
|
+
|
|
219
|
+
// If wrong, set correct path
|
|
220
|
+
set_workspace_root({ workspace_root: "/correct/path" })
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### **"Project layer showing 0 topics"**
|
|
224
|
+
|
|
225
|
+
**Problem:** `bc-code-intel-overrides/` directory structure incorrect
|
|
226
|
+
|
|
227
|
+
**Check:**
|
|
228
|
+
1. Directory exists: `{workspace}/bc-code-intel-overrides/`
|
|
229
|
+
2. Content in subdirectories: `domains/`, `specialists/`, `methodologies/`
|
|
230
|
+
3. Proper frontmatter in markdown files
|
|
231
|
+
|
|
232
|
+
**Solution:**
|
|
233
|
+
```bash
|
|
234
|
+
# Create proper structure
|
|
235
|
+
mkdir -p bc-code-intel-overrides/domains/my-domain
|
|
236
|
+
mkdir -p bc-code-intel-overrides/specialists
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### **"Services not initializing after set_workspace_root"**
|
|
240
|
+
|
|
241
|
+
**Problem:** Path doesn't exist or insufficient permissions
|
|
242
|
+
|
|
243
|
+
**Verify:**
|
|
244
|
+
```bash
|
|
245
|
+
# Check path exists
|
|
246
|
+
ls -la /path/to/workspace
|
|
247
|
+
|
|
248
|
+
# Check permissions
|
|
249
|
+
# Should be readable by MCP server process
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Solution:**
|
|
253
|
+
- Use absolute paths (not relative)
|
|
254
|
+
- Ensure directory exists before calling set_workspace_root
|
|
255
|
+
- Check file permissions
|
|
256
|
+
|
|
257
|
+
## Implementation Details
|
|
258
|
+
|
|
259
|
+
### **Lazy Initialization Benefits**
|
|
260
|
+
|
|
261
|
+
1. **Fast Startup**: Embedded knowledge only (~100ms)
|
|
262
|
+
2. **User-Friendly**: Clear guidance when workspace needed
|
|
263
|
+
3. **Zero-Config Default**: Works without workspace for embedded-only usage
|
|
264
|
+
4. **Explicit Configuration**: User/agent explicitly opts into workspace features
|
|
265
|
+
|
|
266
|
+
### **Service Reinitialization on Workspace Change**
|
|
267
|
+
|
|
268
|
+
When `set_workspace_root` is called:
|
|
269
|
+
```typescript
|
|
270
|
+
// 1. Change working directory
|
|
271
|
+
process.chdir(workspace_root)
|
|
272
|
+
|
|
273
|
+
// 2. Reload configuration
|
|
274
|
+
configService.loadConfiguration()
|
|
275
|
+
|
|
276
|
+
// 3. Reinitialize all services
|
|
277
|
+
await initializeServices()
|
|
278
|
+
|
|
279
|
+
// 4. Reload all knowledge layers
|
|
280
|
+
await layerService.loadAllLayers()
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Performance:** Full reinitialization takes 1-3 seconds including git layer cloning (if not cached).
|
|
284
|
+
|
|
285
|
+
## Best Practices
|
|
286
|
+
|
|
287
|
+
1. **Set Workspace Early**: Call `set_workspace_root` at the start of MCP conversations in VS Code
|
|
288
|
+
2. **Absolute Paths**: Always use absolute paths, not relative
|
|
289
|
+
3. **Verify Before Setting**: Ensure workspace directory exists and is accessible
|
|
290
|
+
4. **Check After Setting**: Use `get_workspace_root` to confirm workspace configured correctly
|
|
291
|
+
5. **Environment Variables**: For CLI/CI scenarios, use `BC_WORKSPACE_ROOT` env var
|
|
292
|
+
|
|
293
|
+
## Advanced: Environment-Based Auto-Configuration
|
|
294
|
+
|
|
295
|
+
### **Setting Default Workspace**
|
|
296
|
+
|
|
297
|
+
Create a shell alias or launcher script:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# ~/.bashrc or ~/.zshrc
|
|
301
|
+
export BC_WORKSPACE_ROOT="$HOME/BCProjects/current"
|
|
302
|
+
|
|
303
|
+
# Windows PowerShell profile
|
|
304
|
+
$env:BC_WORKSPACE_ROOT = "C:\Work\CurrentProject"
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### **Per-Project Launch Scripts**
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
#!/bin/bash
|
|
311
|
+
# launch-mcp.sh in project root
|
|
312
|
+
|
|
313
|
+
export BC_WORKSPACE_ROOT="$(pwd)"
|
|
314
|
+
code . # Launch VS Code with workspace set
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Migration from Pre-1.5.0
|
|
318
|
+
|
|
319
|
+
**Before v1.5.0:**
|
|
320
|
+
- Project layer only worked in environments where `process.cwd()` was correct
|
|
321
|
+
- VS Code users couldn't use project-local features
|
|
322
|
+
- No workaround available
|
|
323
|
+
|
|
324
|
+
**After v1.5.0:**
|
|
325
|
+
- Explicit workspace configuration via `set_workspace_root`
|
|
326
|
+
- Works in all environments (VS Code, Claude Desktop, CLI)
|
|
327
|
+
- Backward compatible - embedded knowledge still works without workspace
|
|
328
|
+
|
|
329
|
+
**No Breaking Changes:** Existing configurations continue to work. Workspace management is optional but recommended for project features.
|
|
330
|
+
|
|
331
|
+
## See Also
|
|
332
|
+
|
|
333
|
+
- [Layer System Fundamentals](layer-system-fundamentals.md) - Understanding layer architecture
|
|
334
|
+
- [Project Layer Setup](project-layer-setup.md) - Setting up project-local knowledge
|
|
335
|
+
- [Configuration File Discovery](configuration-file-discovery.md) - Where configs are found
|
|
336
|
+
- [Configuration Troubleshooting](configuration-troubleshooting.md) - Common issues and solutions
|