Skip to content

Commit e7182cd

Browse files
committed
docs(config): add configuration reference for existing config files
Signed-off-by: Andrew Barnes <bortstheboat@gmail.com>
1 parent e599df1 commit e7182cd

2 files changed

Lines changed: 131 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ export CBM_CACHE_DIR=~/my-projects/cbm-data
455455

456456
Map additional file extensions to supported languages via JSON config files. Useful for framework-specific extensions like `.blade.php` (Laravel) or `.mjs` (ES modules).
457457

458+
Need the full config-file reference? See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
459+
458460
**Per-project** (in your repo root):
459461
```json
460462
// .codebase-memory.json

docs/CONFIGURATION.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Configuration Reference
2+
3+
This page documents the configuration files that `codebase-memory-mcp` reads or writes today.
4+
5+
## At a Glance
6+
7+
| Purpose | Path | Format | Notes |
8+
|---|---|---|---|
9+
| Global custom extension mapping | `$XDG_CONFIG_HOME/codebase-memory-mcp/config.json` | JSON | Falls back to `~/.config/codebase-memory-mcp/config.json` when `XDG_CONFIG_HOME` is unset. |
10+
| Per-project custom extension mapping | `{repo_root}/.codebase-memory.json` | JSON | Overrides conflicting global `extra_extensions` entries. |
11+
| CLI-managed runtime settings | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/_config.db` | SQLite | Written by `codebase-memory-mcp config set/reset`. |
12+
| UI settings | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/config.json` | JSON | Stores `ui_enabled` and `ui_port`. |
13+
14+
## 1. Custom File Extension Mapping
15+
16+
Two optional JSON files let you map additional file extensions to built-in languages.
17+
18+
### Global config
19+
20+
Default path:
21+
22+
```text
23+
$XDG_CONFIG_HOME/codebase-memory-mcp/config.json
24+
```
25+
26+
Fallback when `XDG_CONFIG_HOME` is unset:
27+
28+
```text
29+
~/.config/codebase-memory-mcp/config.json
30+
```
31+
32+
### Per-project config
33+
34+
Place this file in the repository root:
35+
36+
```text
37+
.codebase-memory.json
38+
```
39+
40+
### Format
41+
42+
```json
43+
{
44+
"extra_extensions": {
45+
".blade.php": "php",
46+
".mjs": "javascript",
47+
".twig": "html"
48+
}
49+
}
50+
```
51+
52+
Notes:
53+
54+
- Extension keys must include the leading dot.
55+
- Language names are case-insensitive.
56+
- Unknown language names are skipped.
57+
- Missing files are ignored.
58+
- If the same extension appears in both files, the per-project file wins.
59+
60+
## 2. CLI-Managed Runtime Settings
61+
62+
The `config` subcommand stores runtime settings in a small SQLite database:
63+
64+
```text
65+
${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/_config.db
66+
```
67+
68+
Inspect or change values with the CLI:
69+
70+
```bash
71+
codebase-memory-mcp config list
72+
codebase-memory-mcp config get auto_index
73+
codebase-memory-mcp config set auto_index true
74+
codebase-memory-mcp config set auto_index_limit 50000
75+
codebase-memory-mcp config reset auto_index
76+
```
77+
78+
Current keys:
79+
80+
| Key | Default | Meaning |
81+
|---|---|---|
82+
| `auto_index` | `false` | Automatically index new projects when an MCP session starts. |
83+
| `auto_index_limit` | `50000` | Maximum file count allowed for automatic indexing of a new project. |
84+
85+
## 3. UI Settings
86+
87+
The optional built-in graph UI stores its settings in:
88+
89+
```text
90+
${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/config.json
91+
```
92+
93+
Current format:
94+
95+
```json
96+
{
97+
"ui_enabled": false,
98+
"ui_port": 9749
99+
}
100+
```
101+
102+
Notes:
103+
104+
- If the UI-enabled binary has embedded assets and no UI config file exists yet, the UI auto-enables on first run.
105+
- `CBM_CACHE_DIR` changes both the UI config location and the runtime settings database location.
106+
107+
## 4. Environment Variables
108+
109+
These environment variables affect runtime behavior:
110+
111+
| Variable | Default | Description |
112+
|---|---|---|
113+
| `CBM_CACHE_DIR` | `~/.cache/codebase-memory-mcp` | Override the cache directory used for indexes, `_config.db`, and UI `config.json`. |
114+
| `CBM_DIAGNOSTICS` | `false` | Enable periodic diagnostics output to `/tmp/cbm-diagnostics-<pid>.json`. |
115+
| `CBM_DOWNLOAD_URL` | GitHub releases | Override the update download URL. |
116+
| `CBM_LOG_LEVEL` | `info` | Set stderr log level to `debug`, `info`, `warn`, `error`, or `none` (or `0`-`4`). |
117+
| `CBM_WORKERS` | auto-detected | Override the indexing worker count. |
118+
119+
## 5. Agent and Editor Integration Files
120+
121+
The `install` command can also write MCP entries and instruction blocks into agent/editor config files such as Claude Code, Codex, Gemini, VS Code, Cursor, Zed, and others.
122+
123+
Those target paths vary by tool and platform, so the easiest way to inspect the exact files for your machine is:
124+
125+
```bash
126+
codebase-memory-mcp install --dry-run
127+
```
128+
129+
That prints the specific config files the installer would modify without writing anything.

0 commit comments

Comments
 (0)