feat(status): show graph backend (kuzu / duckdb) in cgh status#25
Merged
Conversation
A new Backend row right under Version. Tells you at a glance which
backend cgh is using for this repo without poking around .codegraph/.
Display covers the four meaningful cases:
Backend kuzu (graph.db, 68.1 MB)
Backend duckdb (graph.duckdb, 2.8 MB)
Backend kuzu (graph.db, 68.1 MB) CGH_DB='duckdb' mismatch — next
index would create a duckdb DB
Backend none on disk (would create graph.db)
The mismatch warning is the important one — it catches the case
where you set CGH_DB=duckdb but the repo was last indexed with
Kuzu. Without the warning, the next `cgh index` silently creates a
second graph file and the two backends drift.
JSON payload (`cgh status --json`) gains a structured `backend`
field with on_disk[], active, env_var, env_implies, mismatch.
Lets scripts answer "is this repo on duckdb yet?" without parsing
text.
The detection mirrors federation.py's _detect_backend_file:
graph.duckdb wins when both are present (half-migrated repo).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Backend row to `cgh status` right under Version, plus a structured `backend` field in the JSON payload. Tells you which backend cgh is using for the repo without poking around `.codegraph/`.
Display
```
codegraph status
Version 0.4.0
Backend kuzu (graph.db, 68.1 MB)
Owner running pid=15350 ...
...
```
Four cases:
The mismatch warning catches the gotcha: you set the env var but the repo was last indexed with the other backend. Without the warning, the next `cgh index` would silently create a second graph file.
JSON shape
```json
"backend": {
"on_disk": ["kuzu"],
"active": "kuzu",
"env_var": "duckdb",
"env_implies": "duckdb",
"mismatch": true
}
```
Verification
Tested across all four cases on wb-backend (Kuzu) + a scratch DuckDB repo. Detection mirrors `federation.py`'s `_detect_backend_file` so the table and federation agree on what's active.