Skip to content

Commit 4d9592b

Browse files
authored
Merge pull request #2068 from DeusData/feat/codeatlas-web
CBM Lens Beta: graph exploration and architecture workspace
2 parents 475db1e + 5d10cb7 commit 4d9592b

1,152 files changed

Lines changed: 374229 additions & 9895 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/_security.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2323
- name: "Layer 1: Static allow-list audit"
24-
run: scripts/security-audit.sh
24+
run: |
25+
bash tests/test_security_audit_subprocess_calls.sh
26+
scripts/security-audit.sh
2527
- name: "Layer 6: UI security audit"
26-
run: scripts/security-ui.sh
28+
run: |
29+
bash tests/test_security_ui_urls.sh
30+
scripts/security-ui.sh
2731
- name: "Layer 8: Vendored dependency integrity"
2832
run: scripts/security-vendored.sh
2933

‎.github/workflows/_test.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,28 @@ jobs:
301301
shell: bash
302302
run: scripts/ci/test-package-wrappers.sh
303303

304+
# CodeAtlasWeb (graph-ui) leg: the frontend's own vitest suite (2000+
305+
# tests; the render tests run under jsdom), its hardcoded-string and
306+
# promise scans, its portable frozen acceptance checks, and a production
307+
# build with the same npm ci the product build runs. One canonical script
308+
# (scripts/ci/test-ui.sh) is the whole leg, here and locally. No browser
309+
# is downloaded: the browser proofs (graph-ui/tools/smoke-*.mjs) need a
310+
# running server and Playwright browsers, and they stay a local, manually
311+
# dispatched venue documented in graph-ui/README.md rather than a hosted
312+
# gate.
313+
test-ui:
314+
runs-on: ubuntu-latest
315+
timeout-minutes: 20
316+
steps:
317+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
318+
319+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
320+
with:
321+
node-version: "22"
322+
323+
- name: CodeAtlasWeb leg (install, unit, style, promises, acceptance, build)
324+
run: scripts/ci/test-ui.sh
325+
304326
# ThreadSanitizer data-race gate. The threaded production surfaces (watcher,
305327
# subprocess, httpd, pipeline, mcp, worker pool, diagnostics, the runnable
306328
# daemon-coordination paths) plus allocator concurrency all run under TSan

‎Makefile.cbm‎

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,13 +448,13 @@ PREPROCESSOR_SRC = $(CBM_DIR)/preprocessor.cpp
448448
SQLITE_WRITER_SRC = $(CBM_DIR)/sqlite_writer.c
449449

450450
# Store module (new)
451-
STORE_SRCS = src/store/store.c src/store/store_impact.c src/store/store_graph_digest.c src/store/store_content_digest.c
451+
STORE_SRCS = src/store/store.c src/store/architecture_projection.c src/store/store_impact.c src/store/store_graph_digest.c src/store/store_content_digest.c
452452

453453
# Cypher module (new)
454454
CYPHER_SRCS = src/cypher/cypher.c
455455

456456
# MCP server module (new)
457-
MCP_SRCS = src/mcp/mcp.c src/mcp/index_supervisor.c src/mcp/compact_out.c \
457+
MCP_SRCS = src/mcp/mcp.c src/mcp/index_supervisor.c src/mcp/compact_out.c src/mcp/architecture_jobs.c \
458458
src/mcp/test_impact.c src/mcp/test_impact_diff.c src/mcp/test_impact_classify.c src/mcp/test_impact_source.c src/mcp/test_impact_seed.c src/mcp/test_impact_engine.c src/mcp/test_impact_engine_snapshot.c src/mcp/test_impact_engine_reach.c src/mcp/test_impact_engine_artifact.c src/mcp/test_impact_cli.c src/mcp/test_impact_artifact.c src/mcp/test_impact_changes.c src/mcp/test_impact_origins.c src/mcp/test_impact_coverage.c src/mcp/test_impact_config.c src/mcp/test_impact_select.c src/mcp/test_impact_policy.c src/mcp/test_impact_git.c src/mcp/test_impact_inventory.c src/mcp/test_impact_inventory_input.c src/mcp/test_impact_tree.c src/mcp/test_impact_tree_audit.c src/mcp/test_impact_tree_read.c src/mcp/test_impact_tree_batch.c src/mcp/test_impact_tree_digest.c src/mcp/test_impact_tree_names.c src/mcp/test_impact_tree_plan.c src/mcp/test_impact_tree_posix.c src/mcp/test_impact_tree_posix_acl.c src/mcp/test_impact_tree_posix_io.c src/mcp/test_impact_tree_util.c src/mcp/test_impact_tree_windows.c src/mcp/test_impact_tree_windows_acl.c src/mcp/test_impact_tree_windows_io.c \
459459
src/mcp/test_impact_result.c src/mcp/test_impact_result_json.c src/mcp/test_impact_result_project.c src/mcp/test_impact_result_receipt.c src/mcp/test_impact_result_rows.c src/mcp/test_impact_result_util.c src/mcp/test_impact_result_validate.c src/mcp/test_impact_result_wire.c
460460

@@ -565,7 +565,7 @@ WATCHER_SRCS = src/watcher/watcher.c
565565
GIT_SRCS = src/git/git_context.c
566566

567567
# CLI module (new)
568-
CLI_SRCS = src/cli/cli.c src/cli/progress_sink.c src/cli/hook_augment.c src/cli/client_adapter.c \
568+
CLI_SRCS = src/cli/cli.c src/cli/runtime_settings.c src/cli/progress_sink.c src/cli/hook_augment.c src/cli/client_adapter.c \
569569
src/cli/agent_clients.c src/cli/agent_profiles.c \
570570
src/cli/config_json_like.c src/cli/config_toml_edit.c src/cli/config_yaml_edit.c \
571571
src/cli/config_text_edit.c src/cli/config_edit_path.c src/cli/activation_transaction.c
@@ -574,7 +574,16 @@ CLI_SRCS = src/cli/cli.c src/cli/progress_sink.c src/cli/hook_augment.c src/cli/
574574
UI_SRCS = \
575575
src/ui/config.c \
576576
src/ui/http_server.c \
577+
src/ui/activity.c \
578+
src/ui/atlas_repository.c \
577579
src/ui/layout3d.c \
580+
src/ui/layout_regions.c \
581+
src/ui/atlas_api.c \
582+
src/ui/atlas_flows.c \
583+
src/ui/atlas_handout.c \
584+
src/ui/atlas_why.c \
585+
src/ui/atlas_metrics.c \
586+
src/ui/atlas_impact.c \
578587
src/ui/httpd.c \
579588
src/ui/embedded_stub.c
580589

@@ -732,6 +741,7 @@ TEST_STORE_SRCS = \
732741
tests/test_store_graph_digest.c \
733742
tests/test_store_search.c \
734743
tests/test_store_arch.c \
744+
tests/test_architecture_projection.c \
735745
tests/test_store_bulk.c \
736746
tests/test_store_pragmas.c \
737747
tests/test_store_checkpoint.c \
@@ -836,7 +846,7 @@ TEST_INTEGRATION_SRCS = tests/test_integration.c tests/test_incremental.c tests/
836846
TEST_TRACES_SRCS = tests/test_traces.c
837847

838848

839-
TEST_CLI_SRCS = tests/test_cli.c tests/test_agent_clients.c tests/test_agent_profiles.c \
849+
TEST_CLI_SRCS = tests/test_cli.c tests/test_runtime_settings.c tests/test_agent_clients.c tests/test_agent_profiles.c \
840850
tests/test_config_json_like.c \
841851
tests/test_config_toml_edit.c tests/test_config_yaml_edit.c tests/test_config_text_edit.c \
842852
tests/test_activation_transaction.c
@@ -982,7 +992,7 @@ $(BUILD_DIR)/test-foundation: $(TEST_FOUNDATION_SRCS) $(FOUNDATION_SRCS) $(PROJE
982992
$(CC) $(CFLAGS_TEST) -o $@ $(TEST_FOUNDATION_SRCS) $(FOUNDATION_SRCS) $(LDFLAGS_TEST)
983993

984994
test-foundation: $(BUILD_DIR)/test-foundation
985-
cd $(CURDIR) && $(BUILD_DIR)/test-foundation
995+
cd "$(CURDIR)" && $(BUILD_DIR)/test-foundation
986996

987997
# ── Grammar/TS/LSP object files (compiled with relaxed warnings) ─
988998

@@ -1141,21 +1151,21 @@ $(BUILD_DIR)/test-runner: $(ALL_TEST_SRCS) $(PROD_SRCS) $(EXTRACTION_SRCS) $(AC_
11411151
$(LDFLAGS_TEST)
11421152

11431153
test: $(BUILD_DIR)/test-runner
1144-
cd $(CURDIR) && $(BUILD_DIR)/test-runner
1154+
cd "$(CURDIR)" && $(BUILD_DIR)/test-runner
11451155

11461156
# Parallel variant: every suite as its own process; identical gate quality
11471157
# (see the ZERO-LOSS CONTRACT in scripts/run-tests-parallel.sh — union guard
11481158
# against --list-suites + aggregated pass/fail/skip totals).
11491159
test-par: $(BUILD_DIR)/test-runner
1150-
cd $(CURDIR) && bash scripts/run-tests-parallel.sh $(BUILD_DIR)/test-runner
1160+
cd "$(CURDIR)" && bash scripts/run-tests-parallel.sh $(BUILD_DIR)/test-runner
11511161

11521162
# Focused native development is intentionally a separate, explicit target so
11531163
# an inherited TEST_SUITES value cannot silently narrow the gating test target.
11541164
TEST_SUITES ?=
11551165
test-focused: $(BUILD_DIR)/test-runner
11561166
@test -n "$(strip $(TEST_SUITES))" || \
11571167
(echo "TEST_SUITES is required for test-focused"; exit 2)
1158-
cd $(CURDIR) && $(BUILD_DIR)/test-runner $(TEST_SUITES)
1168+
cd "$(CURDIR)" && $(BUILD_DIR)/test-runner $(TEST_SUITES)
11591169

11601170
# ── Cumulative bug-reproduction runner (RED board by design, non-gating) ──
11611171
# Mirrors test-runner's link line but uses repro_main.c (own main + counters)
@@ -1327,8 +1337,11 @@ PROD_SRCS_WITH_ASSETS = $(subst src/ui/embedded_stub.c,src/ui/embedded_assets.c,
13271337
# Embedded asset object files (generated by embed script)
13281338
EMBED_OBJS = $(wildcard $(BUILD_DIR)/embedded/embed_*.o)
13291339

1340+
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: the UI's dev dependencies include
1341+
# playwright for its local browser proofs; a plain `npm ci` would otherwise
1342+
# download browsers, which no build or gate needs.
13301343
frontend:
1331-
cd graph-ui && npm ci && npm run build
1344+
cd graph-ui && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm ci && npm run build
13321345

13331346
embed: frontend
13341347
scripts/embed-frontend.sh graph-ui/dist $(BUILD_DIR)/embedded

‎README.md‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-si
3535
- **162 languages** — vendored tree-sitter grammars compiled into the binary. Nothing to install, nothing that breaks.
3636
- **120x fewer tokens** — 5 structural queries: ~3,400 tokens vs ~412,000 via file-by-file search. One graph query replaces dozens of grep/read cycles.
3737
- **45 supported automatic/conditional client surfaces** — `install` configures detected clients and safely activates conditional clients only when their documented platform, marker, or explicit existing config path is present. See [Multi-Agent Support](#multi-agent-support) for the complete matrix and manual/UI-only boundaries.
38-
- **Built-in graph visualization** — 3D interactive UI at `localhost:9749`, served from the binary itself.
38+
- **CBM Atlas** — the built-in human interface at `localhost:9749`: a reading IDE over the index (explorer and read-only Monaco reader, a semantic twin that follows the caret, flow, bug-hunt and change-scope reading modes, the 3D galaxy, source-cited answers, project management), served from the binary itself.
3939
- **Infrastructure-as-code indexing** — Dockerfiles, Kubernetes manifests, and Kustomize overlays indexed as graph nodes with cross-references. `Resource` nodes for K8s kinds, `Module` nodes for Kustomize overlays with `IMPORTS` edges to referenced resources.
4040
- **17 MCP tools** — search, trace, architecture, impact analysis, targeted index-coverage checks, Cypher queries, dead code detection, cross-service HTTP linking, ADR management, and more.
4141

@@ -131,16 +131,31 @@ Package-manager setup (npm, PyPI, or Go) verifies and publishes a coherent priva
131131

132132
The ordinary `cli` mode runs one command locally, but it is not disconnected from the daemon above: it connects to the shared coordination daemon — starting one if none is already running — for that same admission barrier plus per-project locks on graph mutations. Its connection is a `cli_session`: it never registers with the background watcher and never starts a UI, and it holds the admission lease only for the command's lifetime. If the command's own connection is what started the daemon, that daemon exits again once the command closes and no other session is attached; if a daemon was already running, the command simply joins and leaves it exactly as found. While the command is running, a temporary monitor separately lets activation cancel that operation and its supervised worker safely; the monitor exits with the command and never becomes a standing daemon. See [CLI Mode](#cli-mode) for details.
133133

134-
### Graph Visualization UI
134+
### CBM Lens Beta — the human interface
135135

136-
The graph UI is built into the binary — every install on every channel has it. Then run it:
136+
The MCP tools are the agent's interface to the code graph; **CBM Lens Beta** is the human's. It is built into the binary — every install on every channel has it:
137137

138138
```bash
139139
codebase-memory-mcp --ui=true --port=9749
140140
```
141141

142142
Open `http://localhost:9749` in your browser. The UI is owned by the shared coordination daemon, so concurrent agent sessions do not start duplicate HTTP servers.
143143

144+
CBM Lens builds on **CodeAtlasWeb**, a reading IDE built by [Bernhard Jackiewicz](https://github.com/BernhardJackiewicz) on the CBM read surface (design and tracking in #1964). It runs air-gapped on loopback, reaches no cloud, and every panel names where its facts come from; what the index did not record is shown as a gap, never filled in with a guess.
145+
146+
When something in CBM Lens does not load, the page has already written it down: its console output, uncaught errors and failed requests go to `${CBM_CACHE_DIR}/logs/ui.log` (default `~/.cache/codebase-memory-mcp/logs/ui.log`, one JSON line per entry, rotated once at 5 MiB). The projects panel (alt+p) shows the tail under "This server", `GET http://localhost:9749/api/ui-log?lines=200` returns it, and a bug report can attach the file.
147+
148+
- **Explorer and reader** — the indexed file tree and a read-only Monaco reader whose source comes from the index.
149+
- **Semantic twin** — follows the caret: what the symbol under it holds, calls, raises and touches, as facts or as pseudocode, pitched at who is reading.
150+
- **Reading modes** — `[w]hy am I here` picks a way in (hunt a bug, scope a change, understand the project, pick an entry point); **flow** walks the calls in the order they run; **bug hunt** compares the expected path into a symbol with what `ingest_traces` observed; **change scope** shows what a change reaches and what covers it.
151+
- **Galaxy** — the persistent 3D graph with focus following in both directions, and a hierarchy view of the entry subgraph.
152+
- **Command line** — search by meaning while you type; a line ending in `?` builds a source-cited answer from indexed fact cards, with an optional local-model wording pass (a llama-server sidecar you start yourself; off by default, and no model or binary ships).
153+
- **Live agents** — an opt-in overlay of AI agents working in the same repository, fed by a loopback bridge over tool-hook events (`graph-ui/agents/`).
154+
- **`[p]rojects`** — index a repository, check or remove an index, edit the project's decision record, and see the server's processes and log.
155+
- **`[?]help`** — what it reads, what it cannot do, and every key it listens to, derived from the wiring itself.
156+
157+
Open a project with `?project=<name>` in the address, or pick it in the projects panel. The frontend's own README, plan, honesty rules and recorded proof runs live under `graph-ui/`.
158+
144159
### Auto-Index
145160

146161
Enable automatic indexing on MCP session start:

‎docs/graph-ui-screenshot.png‎

-938 KB
Loading

‎graph-ui/.gitignore‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.DS_Store
2+
cbm/
3+
node_modules/
4+
dist/
5+
*.log
6+
.vite/
7+
*.tsbuildinfo
8+
9+
# Die lokalen Modelle und die gebaute Inferenz-Runtime: zusammen ueber 11 GB
10+
# und beide reproduzierbar aus Pruefsummen und Baubefehl. Was committet wird,
11+
# ist die Herkunft und nicht das Gewicht.
12+
#
13+
# Die vier Zeilen je Verzeichnis sind kein Umweg, sondern das, was git
14+
# verlangt: ein ausgeschlossenes VERZEICHNIS wird gar nicht erst betreten, also
15+
# koennte eine Ausnahme darin nie greifen (git-scm, gitignore(5): "It is not
16+
# possible to re-include a file if a parent directory of that file is
17+
# excluded"). Die Verzeichnisregel steht trotzdem zuerst, weil sie die Absicht
18+
# nennt; die naechste hebt sie fuer das Verzeichnis selbst wieder auf, die
19+
# dritte schliesst seinen Inhalt aus, und erst die vierte holt die eine Datei
20+
# zurueck, die committet gehoert.
21+
models/
22+
!models/
23+
models/*
24+
!models/SHA256SUMS
25+
26+
vendor/
27+
!vendor/
28+
vendor/*
29+
!vendor/llama/
30+
vendor/llama/*
31+
!vendor/llama/HERKUNFT.md
32+
33+
# Die Laufspuren des Sidecars. Die PID-Datei gehoert dem laufenden Prozess,
34+
# das Log ist ohnehin schon durch *.log erfasst.
35+
llm/.pid
36+
37+
# Der Node-Bau des Context-Compilers fuer die Eval. Er wird bei jedem Lauf neu
38+
# erzeugt (tools/lib/compiler-bundle.mjs); ein committetes Bundle waere eine
39+
# zweite, alternde Fassung der Dateien daneben.
40+
.eval-build/
41+
42+
# Die Ereignisdatei der Agenten (W11a). Sie enthaelt keine Dateiinhalte, aber
43+
# sie verraet, an welchen Dateien jemand gearbeitet und welche Befehle er
44+
# gefahren hat. Das ist die Arbeitsspur einer Person und gehoert nicht in ein
45+
# Repository; was committet ist, ist die AUFZEICHNUNG des Beweislaufs unter
46+
# fixtures/agent-events/, und deren Herkunft steht dort daneben.
47+
.atlas-trace/
48+
events.jsonl
49+
events.jsonl.seq
50+
51+
# Local visual captures and development reports; JSON/JSONL fixtures stay tracked.
52+
/verification/**/*.png
53+
/verification/**/*.jpg
54+
/verification/**/*.jpeg
55+
/verification/**/*.gif
56+
/verification/**/*.webp
57+
/verification/**/*.svg
58+
/verification/**/*.webm
59+
/verification/**/*.mp4
60+
/verification/**/*.md

‎graph-ui/@/components/ui/badge.tsx‎

Lines changed: 0 additions & 48 deletions
This file was deleted.

‎graph-ui/@/components/ui/button.tsx‎

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)