Skip to content

Commit 68f81a0

Browse files
committed
chore: migrate codebase memory to CLI defaults
1 parent aa536ea commit 68f81a0

13 files changed

Lines changed: 58 additions & 33 deletions

File tree

‎.github/workflows/_lint.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ jobs:
7171
- name: Install LLVM 21 (pinned analyzer toolchain)
7272
run: |
7373
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
74-
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | sudo tee /etc/apt/sources.list.d/llvm-21.list
74+
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" | sudo tee /etc/apt/sources.list.d/llvm-22.list
7575
sudo apt-get update
76-
sudo apt-get install -y clang-tidy-21
76+
sudo apt-get install -y clang-tidy-22
7777
7878
- name: Memory-analyzer gate
79-
run: scripts/ci/lint-mem.sh clang-tidy-21
79+
run: scripts/ci/lint-mem.sh clang-tidy-22

‎Makefile.cbm‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,9 @@ clean-c:
11011101

11021102
# ── Linting ─────────────────────────────────────────────────────
11031103

1104-
# clang-tidy and clang-format: use Homebrew LLVM on macOS, overridable via make args
1105-
# e.g. make lint-format CLANG_FORMAT=clang-format-18
1106-
LLVM_BIN := $(shell brew --prefix llvm 2>/dev/null)/bin
1107-
CLANG_TIDY ?= $(shell [ -x "$(LLVM_BIN)/clang-tidy" ] && echo "$(LLVM_BIN)/clang-tidy" || echo clang-tidy)
1108-
CLANG_FORMAT ?= $(shell [ -x "$(LLVM_BIN)/clang-format" ] && echo "$(LLVM_BIN)/clang-format" || echo clang-format)
1104+
# Pinned lint toolchain; callers may override either binary explicitly.
1105+
CLANG_TIDY ?= clang-tidy-22
1106+
CLANG_FORMAT ?= clang-format-20
11091107
CPPCHECK ?= cppcheck
11101108
# Cppcheck is the long pole in the CI lint gate. Its own worker pool is safer
11111109
# than partitioning LINT_SRCS across separate invocations because diagnostics,

‎docs/CONFIGURATION.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Configuration Reference
22

3-
This page documents the configuration and persisted runtime files used by `codebase-memory-cli`. Several filesystem paths retain the historical `codebase-memory-mcp` name for compatibility; those paths do not represent an MCP product interface.
3+
This page documents the configuration and persisted runtime files used by `codebase-memory-cli`.
44

55
## At a Glance
66

77
| Purpose | Path | Format | Notes |
88
|---|---|---|---|
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. |
9+
| Global custom extension mapping | `$XDG_CONFIG_HOME/codebase-memory-cli/config.json` | JSON | Falls back to `~/.config/codebase-memory-cli/config.json` when `XDG_CONFIG_HOME` is unset. |
1010
| 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-cli config set/reset`. |
12-
| UI settings | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/config.json` | JSON | Stores `ui_enabled` and `ui_port`. |
13-
| Daemon operation log | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/logs/cbm-daemon.log` | Structured log | Durable daemon lifecycle, watcher/indexing, UI, resource, and error events. |
14-
| Admission conflict log | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/logs/daemon-conflicts.ndjson` | NDJSON | Exact-build, ABI, and canonical-cache conflicts. |
15-
| Activation log | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/logs/activation-events.ndjson` | NDJSON | Install/update/uninstall activation progress and outcomes. |
11+
| CLI-managed runtime settings | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-cli}/_config.db` | SQLite | Written by `codebase-memory-cli config set/reset`. |
12+
| UI settings | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-cli}/config.json` | JSON | Stores `ui_enabled` and `ui_port`. |
13+
| Daemon operation log | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-cli}/logs/cbm-daemon.log` | Structured log | Durable daemon lifecycle, watcher/indexing, UI, resource, and error events. |
14+
| Admission conflict log | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-cli}/logs/daemon-conflicts.ndjson` | NDJSON | Exact-build, ABI, and canonical-cache conflicts. |
15+
| Activation log | `${CBM_CACHE_DIR:-~/.cache/codebase-memory-cli}/logs/activation-events.ndjson` | NDJSON | Install/update/uninstall activation progress and outcomes. |
1616

1717
CBM resolves `CBM_CACHE_DIR` to a canonical per-account path before using any of these locations. The log directory and files are private to the account.
1818

@@ -25,13 +25,13 @@ Two optional JSON files let you map additional file extensions to built-in langu
2525
Default path:
2626

2727
```text
28-
$XDG_CONFIG_HOME/codebase-memory-mcp/config.json
28+
$XDG_CONFIG_HOME/codebase-memory-cli/config.json
2929
```
3030

3131
Fallback when `XDG_CONFIG_HOME` is unset:
3232

3333
```text
34-
~/.config/codebase-memory-mcp/config.json
34+
~/.config/codebase-memory-cli/config.json
3535
```
3636

3737
### Per-project config
@@ -67,7 +67,7 @@ Notes:
6767
The `config` subcommand stores runtime settings in a small SQLite database:
6868

6969
```text
70-
${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/_config.db
70+
${CBM_CACHE_DIR:-~/.cache/codebase-memory-cli}/_config.db
7171
```
7272

7373
Inspect or change values with the CLI:
@@ -105,7 +105,7 @@ Current keys:
105105
The optional built-in graph UI stores its settings in:
106106

107107
```text
108-
${CBM_CACHE_DIR:-~/.cache/codebase-memory-mcp}/config.json
108+
${CBM_CACHE_DIR:-~/.cache/codebase-memory-cli}/config.json
109109
```
110110

111111
Current format:
@@ -130,7 +130,7 @@ These environment variables affect runtime behavior:
130130
| Variable | Default | Description |
131131
|---|---|---|
132132
| `CBM_ALLOWED_ROOT` | *(unset)* | Confine `index_repository` to paths within this directory. When set, a `repo_path` that resolves (after symlink / `..` resolution) outside this root is refused, and the same check now applies to the graph UI's `POST /api/index` route rather than only to one request path. Unset imposes no *containment* restriction — but see the always-on limits below, which apply whether or not this is set. Useful when agentic callers operate in a repository and indexing scope must remain human-controlled. |
133-
| `CBM_CACHE_DIR` | `~/.cache/codebase-memory-mcp` | Override the cache directory used for indexes, `_config.db`, and UI `config.json`. |
133+
| `CBM_CACHE_DIR` | `~/.cache/codebase-memory-cli` | Override the cache directory used for indexes, `_config.db`, and UI `config.json`. |
134134
| `CBM_DIAGNOSTICS` | `false` | Enable periodic `snapshot.json` and retained `trajectory.ndjson` below a fresh owner-private directory in the system temp directory. The daemon records the randomized paths in the `diagnostics.start` discovery record (a single JSON line) in `${CBM_CACHE_DIR}/logs/cbm-daemon.log`; that one record is emitted even when `CBM_LOG_LEVEL` suppresses ordinary logging, so the paths always remain discoverable. |
135135
| `CBM_DOWNLOAD_URL` | GitHub releases | Override the update download URL. |
136136
| `CBM_LOG_LEVEL` | `info` | Set the log level to `debug`, `info`, `warn`, `error`, or `none` (or `0`-`4`). One-shot CLI messages use that command's stderr; retained detached-runtime events use `${CBM_CACHE_DIR}/logs/cbm-daemon.log`. |

‎scripts/ci/lint-mem.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ set -euo pipefail
1515

1616
cd "$(dirname "$0")/../.."
1717

18-
CLANG_TIDY_BIN="${1:-${CLANG_TIDY:-clang-tidy}}"
18+
CLANG_TIDY_BIN="${1:-${CLANG_TIDY:-clang-tidy-22}}"
1919

2020
exec make -f Makefile.cbm lint-mem-ci CLANG_TIDY="$CLANG_TIDY_BIN"

‎scripts/hooks/pre-commit‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ echo "pre-commit: running all linters in parallel..."
3535
# the full lint-tidy sweep surfaces thousands of pre-existing findings that
3636
# have nothing to do with this commit and would block every contributor who
3737
# has clang-tidy on PATH. `make lint-tidy` remains available for a full audit.
38-
make -j3 -f Makefile.cbm lint-ci lint-tidy-diff
38+
make -j3 -f Makefile.cbm lint-ci lint-tidy-diff CLANG_FORMAT="$FORMATTER"
3939

4040
echo "pre-commit: security audit (source-level)..."
4141
scripts/security-audit.sh

‎scripts/lint.sh‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ Options:
2828
--ci CI mode: cppcheck + clang-format only (no clang-tidy) —
2929
exactly what _lint.yml gates on. `make lint-ci` uses this.
3030
VAR=VAL Forwarded to make, e.g. CLANG_FORMAT=clang-format-20.
31-
NOTE: the project formatter is the Homebrew LLVM build; a
32-
standalone clang-format-20 produces false whole-file drift.
31+
The pinned formatter is clang-format-20.
3332
-h, --help This text.
3433
EOF
3534
}

‎src/cli/cli.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static const char CLI_ACTIVATION_REFUSED_MESSAGE[] =
168168
"error: this is NOT a running-session problem — the reservation itself "
169169
"failed (coordination lock, leftover state, or permissions). Nothing needs "
170170
"to be closed. Check the errors above, and report this with the output of "
171-
"'ls -la \"${CBM_CACHE_DIR:-$HOME/.cache/codebase-memory-mcp}\"' if it "
171+
"'ls -la \"${CBM_CACHE_DIR:-$HOME/.cache/codebase-memory-cli}\"' if it "
172172
"persists.";
173173
static const char CLI_ACTIVATION_PARTIAL_MESSAGE[] =
174174
"error: activation stopped after one or more agent configuration or "

‎src/daemon/application.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ static bool application_cache_dir(char out[APPLICATION_PATH_CAP]) {
708708
if (!home[0]) {
709709
return false;
710710
}
711-
int written = snprintf(out, APPLICATION_PATH_CAP, "%s/.cache/codebase-memory-mcp", home);
711+
int written = snprintf(out, APPLICATION_PATH_CAP, "%s/.cache/codebase-memory-cli", home);
712712
if (written <= 0 || written >= APPLICATION_PATH_CAP) {
713713
return false;
714714
}

‎src/discover/userconfig.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ cbm_userconfig_t *cbm_userconfig_load(const char *repo_path) {
331331
const char *cfg_base = cbm_app_config_dir();
332332
const char *cfg_fallback = cfg_base ? cfg_base : "/tmp";
333333
char global_path[PATH_BUF_SZ];
334-
snprintf(global_path, sizeof(global_path), "%s/codebase-memory-mcp/config.json", cfg_fallback);
334+
snprintf(global_path, sizeof(global_path), "%s/codebase-memory-cli/config.json", cfg_fallback);
335335

336336
if (load_config_file(global_path, &entries, &count, cfg->global_source_sha256) != 0) {
337337
for (int i = 0; i < count; i++) {

‎src/discover/userconfig.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* userconfig.h — User-defined file extension → language mappings.
33
*
44
* Reads extra_extensions from two optional JSON config files:
5-
* Global: $XDG_CONFIG_HOME/codebase-memory-mcp/config.json
6-
* (falls back to ~/.config/codebase-memory-mcp/config.json)
5+
* Global: $XDG_CONFIG_HOME/codebase-memory-cli/config.json
6+
* (falls back to ~/.config/codebase-memory-cli/config.json)
77
* Project: {repo_root}/.codebase-memory.json
88
*
99
* Project config wins over global. Unknown language values warn and are

0 commit comments

Comments
 (0)