bc-code-intelligence-mcp 1.5.2 → 1.5.3

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.
@@ -1,37 +1,90 @@
1
1
  ---
2
2
  title: "Configuration File Discovery"
3
3
  domain: "chris-config"
4
- bc_versions: "1.5.0+"
4
+ bc_versions: "1.5.3+"
5
5
  difficulty: "beginner"
6
- tags: ["mcp-configuration", "file-discovery", "workspace", "environment"]
6
+ tags: ["mcp-configuration", "file-discovery", "workspace", "environment", "config-merge"]
7
7
  related_topics:
8
8
  - "configuration-file-formats.md"
9
9
  - "workspace-detection-solutions.md"
10
10
  - "layer-system-fundamentals.md"
11
11
  applies_to:
12
12
  - "BC Code Intelligence MCP Server"
13
- last_updated: "2025-10-27"
13
+ last_updated: "2025-10-30"
14
14
  ---
15
15
 
16
16
  # Configuration File Discovery
17
17
 
18
18
  ## Overview
19
19
 
20
- The BC Code Intelligence MCP server searches for configuration files in multiple locations with a specific priority order. Understanding this discovery process helps you place configuration files correctly for different scenarios (workspace-specific, user-wide, or environment-based).
20
+ The BC Code Intelligence MCP server searches for configuration files in multiple locations. **Starting in v1.5.3**, the server loads and intelligently merges BOTH user-level AND project-level configuration files, giving you VSCode-like behavior where project configs override user configs.
21
21
 
22
- ## Discovery Priority Order
22
+ ## User + Project Configuration Merge (v1.5.3+)
23
23
 
24
- The MCP server searches these locations **in order** and uses the **first config file found**:
24
+ ### **How It Works**
25
25
 
26
- ### **1. Environment Variable** (Highest Priority)
26
+ The server now loads configurations in **two phases**:
27
+
28
+ **Phase 1: Startup (User Config)**
29
+ - Loads user-level config from `~/.bc-code-intel/config.json`
30
+ - Available immediately when server starts
31
+ - Contains your personal preferences and company-wide layers
32
+
33
+ **Phase 2: Workspace Discovery (User + Project Merge)**
34
+ - When workspace becomes known (via `set_workspace_info`)
35
+ - Loads project config from `./bc-code-intel-config.json`
36
+ - **Merges** with user config using priority-based strategy
37
+ - Project config overrides user config at same priority
38
+
39
+ ### **Merge Strategy**
40
+
41
+ Layers are merged by **priority number**:
42
+ - **Same priority**: Project layer **wins** (overrides user layer)
43
+ - **Different priorities**: Both layers **included** (sorted by priority)
44
+
45
+ **Example Merge:**
46
+ ```
47
+ User config (~/.bc-code-intel/config.json):
48
+ - Layer A (priority 20)
49
+ - Layer B (priority 30)
50
+ - Layer C (priority 80)
51
+
52
+ Project config (./bc-code-intel-config.json):
53
+ - Layer X (priority 30) ← Conflicts with user Layer B
54
+ - Layer Y (priority 40)
55
+ - Layer Z (priority 50)
56
+
57
+ Result after merge:
58
+ - Layer A (priority 20) ← User (no conflict)
59
+ - Layer X (priority 30) ← Project wins conflict
60
+ - Layer Y (priority 40) ← Project (no conflict)
61
+ - Layer Z (priority 50) ← Project (no conflict)
62
+ - Layer C (priority 80) ← User (no conflict)
63
+ ```
64
+
65
+ ## Configuration File Locations
66
+
67
+ The MCP server searches these locations for configuration files:
68
+
69
+ ## Configuration File Locations
70
+
71
+ The MCP server searches these locations for configuration files:
72
+
73
+ ### **1. Environment Variable** (Explicit Override)
27
74
  ```bash
28
75
  BC_CODE_INTEL_CONFIG=/absolute/path/to/config.json
76
+ # Legacy: BCKB_CONFIG_PATH (deprecated, use BC_CODE_INTEL_CONFIG)
29
77
  ```
30
78
 
31
79
  **When to use:**
32
80
  - CI/CD pipelines with dynamic config paths
33
81
  - Testing different configurations
34
- - Override all other config locations
82
+ - Temporary override for debugging
83
+
84
+ **Behavior:**
85
+ - Loaded at **priority 50** in merge process
86
+ - Overrides both user and project configs at lower priorities
87
+ - Does NOT prevent user/project configs from loading
35
88
 
36
89
  **Example:**
37
90
  ```bash
@@ -42,133 +95,373 @@ export BC_CODE_INTEL_CONFIG="/opt/configs/bc-code-intel-config.json"
42
95
  $env:BC_CODE_INTEL_CONFIG = "C:\Configs\bc-code-intel-config.json"
43
96
  ```
44
97
 
45
- ### **2. Workspace Directory** (Project-Specific)
98
+ ---
99
+
100
+ ### **2. User-Level Configuration** (Personal + Company-Wide)
101
+
102
+ **Recommended Path:**
103
+ ```
104
+ ~/.bc-code-intel/config.json
105
+ ~/.bc-code-intel/config.yaml
106
+ ```
107
+
108
+ **Legacy Paths (deprecated):**
46
109
  ```
47
- ./bc-code-intel-config.json
48
- ./bc-code-intel-config.yaml
49
- ./bc-code-intel-config.yml
110
+ ~/.bckb/config.json ← Shows deprecation warning
111
+ ~/.bckb/config.yaml
112
+ ```
113
+
114
+ **System-Wide Paths:**
115
+ ```
116
+ # Linux
117
+ /etc/bc-code-intel/config.json
118
+ /usr/local/etc/bc-code-intel/config.json
119
+
120
+ # Windows
121
+ C:\ProgramData\bc-code-intel\config.json
50
122
  ```
51
123
 
52
124
  **When to use:**
53
- - Project-specific layer configurations
54
- - Team-shared settings (committed to repo)
55
- - Project requires specific company/team layers
125
+ - Company-wide knowledge layers for all projects
126
+ - Personal authentication credentials
127
+ - Default preferences across all workspaces
56
128
 
57
- **Workspace detection:** Requires workspace root to be set (see Workspace Management below).
129
+ **Priority:** Layers in user config load at **priority 10** by default
58
130
 
59
131
  **Example:**
60
- ```bash
61
- # In project root
62
- MyBCProject/
63
- ├── bc-code-intel-config.json Project-specific config
64
- ├── app.json
65
- └── src/
132
+ ```json
133
+ // ~/.bc-code-intel/config.json
134
+ {
135
+ "layers": [
136
+ {
137
+ "name": "company-standards",
138
+ "priority": 20,
139
+ "source": {
140
+ "type": "git",
141
+ "url": "https://github.com/mycompany/bc-knowledge",
142
+ "branch": "main"
143
+ },
144
+ "auth": {
145
+ "type": "pat",
146
+ "token_env_var": "GITHUB_TOKEN"
147
+ },
148
+ "enabled": true
149
+ },
150
+ {
151
+ "name": "personal-snippets",
152
+ "priority": 80,
153
+ "source": {
154
+ "type": "local",
155
+ "path": "~/bc-knowledge-personal"
156
+ },
157
+ "enabled": true
158
+ }
159
+ ]
160
+ }
66
161
  ```
67
162
 
68
- ### **3. User Home Directory** (User-Wide)
163
+ ---
164
+
165
+ ### **3. Project-Level Configuration** (Project-Specific Overrides)
166
+
167
+ **Recommended Path (in workspace root):**
69
168
  ```
70
- ~/.bc-code-intel/config.json
71
- ~/.bc-code-intel/config.yaml
72
- ~/.bc-code-intel/config.yml
169
+ bc-code-intel-config.json
170
+ bc-code-intel-config.yaml
171
+ ```
172
+
173
+ **Legacy Filenames (deprecated):**
174
+ ```
175
+ bckb-config.json ← Shows deprecation warning
176
+ .bc-code-intel/config.json ← Hidden directory variant
177
+ .bckb/config.json
73
178
  ```
74
179
 
75
180
  **When to use:**
76
- - Personal configurations across all projects
77
- - User-specific authentication tokens
78
- - Default layer setup for all your work
181
+ - Project-specific layer overrides
182
+ - Team-shared configuration (committed to repo)
183
+ - Project requires specific knowledge layers
79
184
 
80
- **Path expansion:**
81
- - Linux/macOS: `~` expands to `/home/username` or `/Users/username`
82
- - Windows: `~` expands to `C:\Users\Username`
185
+ **Priority:** Layers in project config load at **priority 20** by default
83
186
 
84
- **Example:**
85
- ```bash
86
- # Linux/macOS
87
- ~/.bc-code-intel/
88
- ├── config.json ← User-wide config
89
- └── cache/ ← Optional cache directory
187
+ **Workspace Detection Required:** Project config only loads after workspace is set via `set_workspace_info`
90
188
 
91
- # Windows
92
- C:\Users\YourName\.bc-code-intel\
93
- └── config.json User-wide config
189
+ **Example:**
190
+ ```json
191
+ // bc-code-intel-config.json (in project root)
192
+ {
193
+ "layers": [
194
+ {
195
+ "name": "project-team-alpha",
196
+ "priority": 30,
197
+ "source": {
198
+ "type": "git",
199
+ "url": "https://github.com/mycompany/team-alpha-knowledge"
200
+ },
201
+ "enabled": true
202
+ },
203
+ {
204
+ "name": "project-overrides",
205
+ "priority": 50,
206
+ "source": {
207
+ "type": "local",
208
+ "path": "./bc-code-intel-overrides"
209
+ },
210
+ "enabled": true
211
+ }
212
+ ]
213
+ }
94
214
  ```
95
215
 
96
- ### **4. Embedded Default** (Lowest Priority)
97
- If no configuration file is found, the server uses **embedded defaults**:
98
- - Only embedded knowledge layer (priority 0)
99
- - No git layers
216
+ ---
217
+
218
+ ### **4. Embedded Default** (Always Present)
219
+
220
+ If no configuration files are found, the server uses **embedded defaults**:
221
+ - Embedded knowledge layer (priority 0)
222
+ - Standard cache and performance settings
100
223
  - Diagnostic tools disabled
101
224
 
102
- **When this happens:**
225
+ **When this applies:**
103
226
  - Zero-configuration first-time use
104
- - No config file in any location
227
+ - No config files in any location
105
228
  - Quick testing without setup
106
229
 
230
+ ## When to Use User vs Project Config
231
+
232
+ ### **Use User Config (~/.bc-code-intel/config.json) For:**
233
+
234
+ ✅ **Company-wide knowledge layers**
235
+ ```json
236
+ {
237
+ "layers": [
238
+ { "name": "company", "priority": 20, "source": {...} }
239
+ ]
240
+ }
241
+ ```
242
+ - Applies to ALL projects you work on
243
+ - Company standards, best practices, common patterns
244
+
245
+ ✅ **Personal authentication**
246
+ ```json
247
+ {
248
+ "layers": [
249
+ {
250
+ "name": "company",
251
+ "priority": 20,
252
+ "auth": {
253
+ "type": "pat",
254
+ "token_env_var": "GITHUB_TOKEN" ← Your personal token
255
+ }
256
+ }
257
+ ]
258
+ }
259
+ ```
260
+
261
+ ✅ **Personal preferences**
262
+ ```json
263
+ {
264
+ "cache": { "max_size_mb": 200 },
265
+ "developer": { "diagnostics_enabled": true }
266
+ }
267
+ ```
268
+
269
+ ### **Use Project Config (./bc-code-intel-config.json) For:**
270
+
271
+ ✅ **Project-specific layer overrides**
272
+ ```json
273
+ {
274
+ "layers": [
275
+ { "name": "project-team", "priority": 30, "source": {...} }
276
+ ]
277
+ }
278
+ ```
279
+ - Only applies to this project
280
+ - Can be committed to repo and shared with team
281
+
282
+ ✅ **Team-shared configuration**
283
+ - All team members get same layers
284
+ - Version controlled with project code
285
+
286
+ ✅ **Override user config layers**
287
+ ```json
288
+ {
289
+ "layers": [
290
+ // This overrides user's priority 30 layer if they have one
291
+ { "name": "project-override", "priority": 30, "source": {...} }
292
+ ]
293
+ }
294
+ ```
295
+
296
+ ## Configuration Merge Examples
297
+
298
+ ### **Example 1: No Conflicts (All Layers Preserved)**
299
+
300
+ **User config:**
301
+ ```json
302
+ {
303
+ "layers": [
304
+ { "name": "company", "priority": 20, "source": {...} },
305
+ { "name": "personal", "priority": 80, "source": {...} }
306
+ ]
307
+ }
308
+ ```
309
+
310
+ **Project config:**
311
+ ```json
312
+ {
313
+ "layers": [
314
+ { "name": "team-alpha", "priority": 30, "source": {...} },
315
+ { "name": "project-local", "priority": 50, "source": {...} }
316
+ ]
317
+ }
318
+ ```
319
+
320
+ **Result:**
321
+ ```
322
+ [embedded(0), company(20), team-alpha(30), project-local(50), personal(80)]
323
+ ```
324
+ ✅ All layers included (no priority conflicts)
325
+
326
+ ---
327
+
328
+ ### **Example 2: Priority Conflict (Project Wins)**
329
+
330
+ **User config:**
331
+ ```json
332
+ {
333
+ "layers": [
334
+ { "name": "company-standard", "priority": 30, "source": {...} }
335
+ ]
336
+ }
337
+ ```
338
+
339
+ **Project config:**
340
+ ```json
341
+ {
342
+ "layers": [
343
+ { "name": "project-specific", "priority": 30, "source": {...} }
344
+ ]
345
+ }
346
+ ```
347
+
348
+ **Result:**
349
+ ```
350
+ [embedded(0), project-specific(30)]
351
+ ```
352
+ ✅ Project layer **replaces** user layer at priority 30
353
+
354
+ ---
355
+
356
+ ### **Example 3: Multiple Conflicts**
357
+
358
+ **User config:**
359
+ ```json
360
+ {
361
+ "layers": [
362
+ { "name": "user-A", "priority": 10, "source": {...} },
363
+ { "name": "user-B", "priority": 20, "source": {...} },
364
+ { "name": "user-C", "priority": 30, "source": {...} }
365
+ ]
366
+ }
367
+ ```
368
+
369
+ **Project config:**
370
+ ```json
371
+ {
372
+ "layers": [
373
+ { "name": "project-B", "priority": 20, "source": {...} },
374
+ { "name": "project-C", "priority": 30, "source": {...} }
375
+ ]
376
+ }
377
+ ```
378
+
379
+ **Result:**
380
+ ```
381
+ [embedded(0), user-A(10), project-B(20), project-C(30)]
382
+ ```
383
+ ✅ user-A preserved (no conflict)
384
+ ✅ project-B replaces user-B (priority 20)
385
+ ✅ project-C replaces user-C (priority 30)
386
+
107
387
  ## File Name Variations
108
388
 
109
389
  The server recognizes these file names **in each location**:
110
390
 
111
- ### **JSON Format** (Most Common)
391
+ ### **Recommended (v1.5.3+)**
112
392
  - `bc-code-intel-config.json`
113
-
114
- ### **YAML Format** (Alternative)
115
393
  - `bc-code-intel-config.yaml`
116
394
  - `bc-code-intel-config.yml`
117
395
 
396
+ ### **Legacy (deprecated, shows warning)**
397
+ - `bckb-config.json`
398
+ - `bckb-config.yaml`
399
+ - `bckb-config.yml`
400
+
118
401
  **Search order within each location:**
119
402
  1. `.json` checked first
120
403
  2. `.yaml` checked second
121
404
  3. `.yml` checked last
122
405
 
123
- ## Workspace Detection and Configuration Discovery
406
+ **Deprecation warnings:** Legacy filenames trigger a warning suggesting migration to `bc-code-intel-*` naming.
124
407
 
125
- ### **The Workspace Problem**
408
+ ## Workspace Detection for Project Config
126
409
 
127
- The VS Code MCP extension doesn't set `process.cwd()` to workspace root, causing:
128
- - Workspace directory search to fail
129
- - Project-specific configs not found
130
- - Project layer not loading
410
+ ### **The Workspace Challenge**
131
411
 
132
- ### **The Solution: Workspace Management (v1.5.0+)**
412
+ VS Code MCP extension doesn't automatically set workspace root, causing:
413
+ - Project config discovery to fail initially
414
+ - Project-specific layers not loading at startup
133
415
 
134
- Use the `set_workspace_root` MCP tool:
416
+ ### **The Solution: set_workspace_info Tool (v1.5.0+)**
417
+
418
+ Use the `set_workspace_info` MCP tool to enable project config:
135
419
 
136
420
  ```typescript
137
- set_workspace_root({
421
+ set_workspace_info({
138
422
  workspace_root: "/absolute/path/to/workspace"
139
423
  })
140
424
  ```
141
425
 
142
426
  **What happens after setting workspace:**
143
- 1. `process.chdir()` changes to workspace root
144
- 2. Configuration discovery re-runs
145
- 3. Workspace config file (if exists) is now found
146
- 4. All services reinitialize with new config
147
- 5. Project layer (if configured) now loads
427
+ 1. Configuration re-loads with workspace context
428
+ 2. Project config discovered from workspace root
429
+ 3. User + Project configs merged
430
+ 4. All services reinitialize with merged configuration
431
+ 5. Project layers (if configured) now load
148
432
 
149
433
  **Query current workspace:**
150
434
  ```typescript
151
- get_workspace_root()
152
- // Returns: { workspace_root: "/current/path", services_initialized: true }
435
+ get_workspace_info()
436
+ // Returns: { workspace_root: "/current/path", layers_loaded: [...] }
153
437
  ```
154
438
 
155
- ## Configuration Discovery Flow
439
+ ## Configuration Loading Flow (v1.5.3+)
156
440
 
157
441
  ```mermaid
158
442
  graph TD
159
- A[MCP Server Starts] --> B{BC_CODE_INTEL_CONFIG set?}
160
- B -->|Yes| C[Load config from env var path]
161
- B -->|No| D{Workspace root set?}
162
- D -->|No| E[Lazy init: embedded only]
163
- D -->|Yes| F{./bc-code-intel-config.* exists?}
164
- F -->|Yes| G[Load workspace config]
165
- F -->|No| H{~/.bc-code-intel/config.* exists?}
166
- H -->|Yes| I[Load user-wide config]
167
- H -->|No| J[Use embedded defaults]
443
+ A[MCP Server Starts] --> B[Load User Config]
444
+ B --> C{~/.bc-code-intel/config.json exists?}
445
+ C -->|Yes| D[User layers loaded]
446
+ C -->|No| E[Embedded defaults only]
447
+
448
+ D --> F[Server Ready - User Config Active]
449
+ E --> F
168
450
 
169
- E --> K[First tool call triggers workspace prompt]
170
- K --> L[User calls set_workspace_root]
171
- L --> D
451
+ F --> G[Client calls set_workspace_info]
452
+ G --> H{Project config exists?}
453
+ H -->|Yes| I[Load Project Config]
454
+ H -->|No| J[Keep User Config Only]
455
+
456
+ I --> K[Merge User + Project Configs]
457
+ K --> L[Priority-Based Merge]
458
+ L --> M{Same priority?}
459
+ M -->|Yes| N[Project Wins]
460
+ M -->|No| O[Both Included]
461
+
462
+ N --> P[Merged Config Active]
463
+ O --> P
464
+ J --> P
172
465
  ```
173
466
 
174
467
  ## Path Expansion Details
@@ -191,10 +484,10 @@ The server expands `~` to user home directory:
191
484
 
192
485
  ### **Relative vs Absolute Paths**
193
486
 
194
- **Workspace config (relative):**
487
+ **Project config (relative to workspace):**
195
488
  ```
196
489
  ./bc-code-intel-config.json
197
- # Relative to current working directory (workspace root after set_workspace_root)
490
+ # Relative to workspace root (set via set_workspace_info)
198
491
  ```
199
492
 
200
493
  **Environment variable (absolute):**
@@ -203,7 +496,7 @@ BC_CODE_INTEL_CONFIG=/absolute/path/to/config.json
203
496
  # Must be absolute path
204
497
  ```
205
498
 
206
- ## Common Configuration Scenarios
499
+ ## Common Configuration Scenarios (v1.5.3+)
207
500
 
208
501
  ### **Scenario 1: Individual Developer (Zero Config)**
209
502
 
@@ -211,7 +504,7 @@ BC_CODE_INTEL_CONFIG=/absolute/path/to/config.json
211
504
 
212
505
  **Result:**
213
506
  - Embedded knowledge only
214
- - No git layers
507
+ - No custom layers
215
508
  - Works immediately
216
509
 
217
510
  **Use case:** Trying out BC Code Intelligence, no customization needed
@@ -223,18 +516,18 @@ BC_CODE_INTEL_CONFIG=/absolute/path/to/config.json
223
516
  **Setup:** `~/.bc-code-intel/config.json`
224
517
  ```json
225
518
  {
226
- "knowledge_layers": [
519
+ "layers": [
227
520
  {
228
- "name": "Company Standards",
229
- "type": "git",
521
+ "name": "company-standards",
230
522
  "priority": 20,
231
523
  "source": {
232
- "repository_url": "https://github.com/mycompany/bc-knowledge",
233
- "branch": "main",
234
- "auth": {
235
- "type": "pat",
236
- "token_env_var": "GITHUB_TOKEN"
237
- }
524
+ "type": "git",
525
+ "url": "https://github.com/mycompany/bc-knowledge",
526
+ "branch": "main"
527
+ },
528
+ "auth": {
529
+ "type": "pat",
530
+ "token_env_var": "GITHUB_TOKEN"
238
531
  },
239
532
  "enabled": true
240
533
  }
@@ -243,55 +536,118 @@ BC_CODE_INTEL_CONFIG=/absolute/path/to/config.json
243
536
  ```
244
537
 
245
538
  **Result:**
246
- - Applies to all projects for this user
247
- - Company layer always available
248
- - Personal authentication
539
+ - Company layer loads for ALL projects
540
+ - Available immediately at server startup
541
+ - Uses your personal GitHub token
249
542
 
250
543
  **Use case:** Company developer wants company standards in all projects
251
544
 
252
545
  ---
253
546
 
254
- ### **Scenario 3: Project-Specific Multi-Layer**
547
+ ### **Scenario 3: User + Project Merge**
548
+
549
+ **Setup:**
255
550
 
256
- **Setup:** `./bc-code-intel-config.json` (in project root)
551
+ User config `~/.bc-code-intel/config.json`:
257
552
  ```json
258
553
  {
259
- "knowledge_layers": [
554
+ "layers": [
260
555
  {
261
- "name": "Company",
262
- "type": "git",
556
+ "name": "company-standards",
263
557
  "priority": 20,
264
- "source": { "repository_url": "..." },
558
+ "source": { "type": "git", "url": "..." },
265
559
  "enabled": true
266
560
  },
267
561
  {
268
- "name": "Team Alpha",
269
- "type": "git",
270
- "priority": 50,
271
- "source": { "repository_url": "..." },
562
+ "name": "personal-snippets",
563
+ "priority": 80,
564
+ "source": { "type": "local", "path": "~/bc-snippets" },
565
+ "enabled": true
566
+ }
567
+ ]
568
+ }
569
+ ```
570
+
571
+ Project config `./bc-code-intel-config.json`:
572
+ ```json
573
+ {
574
+ "layers": [
575
+ {
576
+ "name": "team-alpha",
577
+ "priority": 30,
578
+ "source": { "type": "git", "url": "..." },
272
579
  "enabled": true
273
580
  },
274
581
  {
275
- "name": "Project",
276
- "type": "project",
277
- "priority": 100,
278
- "source": { "path": "./bc-code-intel-overrides" },
582
+ "name": "project-overrides",
583
+ "priority": 50,
584
+ "source": { "type": "local", "path": "./bc-code-intel-overrides" },
279
585
  "enabled": true
280
586
  }
281
587
  ]
282
588
  }
283
589
  ```
284
590
 
285
- **Result:**
286
- - Project-specific layer configuration
287
- - Committed to repo, shared with team
288
- - Requires workspace root set in VS Code
591
+ **Result after merge:**
592
+ ```
593
+ Layers: [
594
+ embedded (priority 0),
595
+ company-standards (priority 20) ← From user config
596
+ team-alpha (priority 30) ← From project config
597
+ project-overrides (priority 50) ← From project config
598
+ personal-snippets (priority 80) ← From user config
599
+ ]
600
+ ```
289
601
 
290
- **Use case:** Project needs specific company + team + project layers
602
+ **Use case:** Developer has company layer for all projects, but this specific project adds team-specific layer
291
603
 
292
604
  ---
293
605
 
294
- ### **Scenario 4: CI/CD with Dynamic Config**
606
+ ### **Scenario 4: Project Overrides User Layer**
607
+
608
+ **Setup:**
609
+
610
+ User config `~/.bc-code-intel/config.json`:
611
+ ```json
612
+ {
613
+ "layers": [
614
+ {
615
+ "name": "company-default-patterns",
616
+ "priority": 30,
617
+ "source": { "type": "git", "url": "https://github.com/company/default-patterns" },
618
+ "enabled": true
619
+ }
620
+ ]
621
+ }
622
+ ```
623
+
624
+ Project config `./bc-code-intel-config.json`:
625
+ ```json
626
+ {
627
+ "layers": [
628
+ {
629
+ "name": "legacy-project-patterns",
630
+ "priority": 30, // Same priority = project wins
631
+ "source": { "type": "local", "path": "./legacy-patterns" },
632
+ "enabled": true
633
+ }
634
+ ]
635
+ }
636
+ ```
637
+
638
+ **Result after merge:**
639
+ ```
640
+ Layers: [
641
+ embedded (priority 0),
642
+ legacy-project-patterns (priority 30) ← Project REPLACED user layer
643
+ ]
644
+ ```
645
+
646
+ **Use case:** Legacy project needs different patterns than company default
647
+
648
+ ---
649
+
650
+ ### **Scenario 5: CI/CD with Dynamic Config**
295
651
 
296
652
  **Setup:** Environment variable
297
653
  ```bash
@@ -299,11 +655,11 @@ export BC_CODE_INTEL_CONFIG="/ci/configs/bc-code-intel-prod.json"
299
655
  ```
300
656
 
301
657
  **Result:**
302
- - Overrides any file-based configs
658
+ - Loads at priority 50 in merge
659
+ - Merges with user and project configs
303
660
  - CI pipeline controls configuration
304
- - Different configs for different pipelines
305
661
 
306
- **Use case:** Automated build/test environments
662
+ **Use case:** Automated build/test environments with specific layer requirements
307
663
 
308
664
  ## Creating Configuration File Directories
309
665
 
@@ -321,73 +677,119 @@ New-Item -Path "$env:USERPROFILE\.bc-code-intel" -ItemType Directory -Force
321
677
  New-Item -Path "$env:USERPROFILE\.bc-code-intel\config.json" -ItemType File
322
678
  ```
323
679
 
324
- ### **Workspace Directory**
680
+ ### **Project Directory**
325
681
 
326
682
  ```bash
327
- # Already in workspace root (after set_workspace_root)
683
+ # In workspace root
328
684
  touch bc-code-intel-config.json
329
685
  ```
330
686
 
331
- ## Troubleshooting Discovery Issues
687
+ ## Troubleshooting Discovery Issues (v1.5.3+)
332
688
 
333
- ### **"Config file not found"**
334
-
335
- **Check each location manually:**
689
+ ### **"User config not loading"**
336
690
 
691
+ **Check user config location:**
337
692
  ```bash
338
- # 1. Environment variable
339
- echo $BC_CODE_INTEL_CONFIG # Linux/macOS
340
- echo $env:BC_CODE_INTEL_CONFIG # Windows PowerShell
341
-
342
- # 2. Workspace directory (after workspace set)
343
- ls -la ./bc-code-intel-config.*
344
-
345
- # 3. User home directory
693
+ # Linux/macOS
346
694
  ls -la ~/.bc-code-intel/config.*
347
- ```
348
695
 
349
- **Verify workspace root:**
350
- ```typescript
351
- get_workspace_root()
696
+ # Windows PowerShell
697
+ ls "$env:USERPROFILE\.bc-code-intel\config.*"
352
698
  ```
353
699
 
354
- ### **"Wrong config being loaded"**
700
+ **Verify file is valid:**
701
+ ```bash
702
+ # Test JSON syntax
703
+ cat ~/.bc-code-intel/config.json | jq . # Linux/macOS (if jq installed)
704
+ Get-Content "$env:USERPROFILE\.bc-code-intel\config.json" | ConvertFrom-Json # PowerShell
705
+ ```
355
706
 
356
- **Remember priority order:**
357
- 1. Environment variable (highest)
358
- 2. Workspace directory
359
- 3. User home directory
360
- 4. Embedded defaults (lowest)
707
+ **Check server logs:**
708
+ - Look for: `[config] Loaded user configuration: <path>`
709
+ - Deprecation warnings if using legacy paths
361
710
 
362
- **Solution:** Check if higher-priority config exists and is being used unintentionally.
711
+ ---
363
712
 
364
- ### **"Workspace config not found in VS Code"**
713
+ ### **"Project config not loading"**
365
714
 
366
- **Problem:** VS Code MCP extension doesn't set workspace root
715
+ **Problem:** Project config only loads after workspace is set
367
716
 
368
717
  **Solution:**
369
718
  ```typescript
370
- // Explicitly set workspace root first
371
- set_workspace_root({
719
+ // 1. Set workspace root first
720
+ set_workspace_info({
372
721
  workspace_root: "/absolute/path/to/workspace"
373
722
  })
374
723
 
375
- // Now workspace config will be discovered
724
+ // 2. Check logs for project config discovery
725
+ // Look for: [config] Loaded project configuration: <path>
726
+ // And: [config] Merged user + project configs
376
727
  ```
377
728
 
378
- ### **"Path expansion not working"**
379
-
380
- **Check home directory expansion:**
729
+ **Verify project config location:**
381
730
  ```bash
382
- # Linux/macOS
383
- echo ~
384
- # Should show: /home/username or /Users/username
731
+ # Must be in workspace root
732
+ ls -la ./bc-code-intel-config.*
733
+ ```
385
734
 
386
- # Windows PowerShell
387
- echo $env:USERPROFILE
388
- # Should show: C:\Users\Username
735
+ ---
736
+
737
+ ### **"Which config is being used?"**
738
+
739
+ **Query loaded configuration:**
740
+ ```typescript
741
+ get_config_sources()
742
+ // Returns list of loaded config files and their priorities
389
743
  ```
390
744
 
745
+ **Check server logs for merge details:**
746
+ ```
747
+ [config] Loaded user configuration: ~/.bc-code-intel/config.json (json)
748
+ [config] Loaded project configuration: ./bc-code-intel-config.json (json)
749
+ [config] Merged user + project configs. Active layers: embedded(p0), company(p20), team(p30), project(p50)
750
+ ```
751
+
752
+ ---
753
+
754
+ ### **"Layer priority conflict - wrong layer loading"**
755
+
756
+ **Remember merge rules:**
757
+ - Same priority → **Project wins**
758
+ - Different priorities → Both included
759
+
760
+ **Debug priority conflicts:**
761
+ 1. List all configured layers with priorities
762
+ 2. Identify conflicts (same priority number)
763
+ 3. Remember: Project config overrides user config at same priority
764
+
765
+ **Example conflict resolution:**
766
+ ```
767
+ User: company-layer (priority 30)
768
+ Project: team-layer (priority 30)
769
+ Result: team-layer wins (project overrides user)
770
+ ```
771
+
772
+ **Solution:** Adjust priorities to avoid conflicts if you want both layers
773
+
774
+ ---
775
+
776
+ ### **"Deprecation warnings appearing"**
777
+
778
+ **Legacy paths trigger warnings:**
779
+ ```
780
+ ⚠️ Using legacy config path: ~/.bckb/config.json
781
+ Consider moving to ~/.bc-code-intel/config.json or config.yaml
782
+ ```
783
+
784
+ **Migration steps:**
785
+ 1. Copy existing config:
786
+ ```bash
787
+ cp ~/.bckb/config.json ~/.bc-code-intel/config.json
788
+ ```
789
+ 2. Test new location works
790
+ 3. Remove old config file
791
+ 4. Warning disappears
792
+
391
793
  **Use absolute paths if tilde expansion fails:**
392
794
  ```bash
393
795
  # Instead of: ~/.bc-code-intel/config.json