How nxtsoft/cgraph works
CGraph scans source trees into deterministic code graphs, then exposes navigation and change-impact answers through a one-shot CLI or a resident per-project daemon. The main build path detects files, extracts structural fragments, resolves relationships, analyzes the graph, and exports graph and report formats. Clients and the MCP server route queries to the daemon; documented capabilities also include live updates, workspace federation, and optional semantic enrichment. The core pipeline and client routing are supported by sampled source; daemon operations and several feature branches are represented from the README and tree, since their implementations were not sampled.
Main entry points: pipeline.cpp Build pipeline · main.cpp One-shot CLI · client_runtime.cpp Thin client · daemon_server.cpp Daemon server
Components 19
Graph construction
- Build pipeline
src/engine/pipeline.cpp - File detection
src/engine/detect.cpp - Language extraction
src/engine/file_extraction.cpp - Graph assembly
src/engine/graph_builder.cpp - Graph analysis
src/engine/analysis.cpp - Graph exports
src/engine/pipeline.cpp
Daemon service
- Resident daemon
src/daemon/main.cpp - Daemon server
src/engine/daemon_server.cpp - Query operations
src/engine/daemon_ops.cpp - Live file updates
src/engine/file_watcher.cpp - Incremental graph update
src/engine/incremental_update.cpp - Graph persistence
src/engine/index_persistence.cpp
Client access
- One-shot CLI
src/cli/main.cpp - Thin client
src/client/client_runtime.cpp - MCP server
src/mcp/mcp_server.cpp
Enrichment and federation
- Semantic enrichment
src/engine/semantic_orchestration.cpp - Fragment ingestion
src/engine/semantic_ingest.cpp - Workspace federation
src/engine/workspace.cpp
Other components
- Engineer or agent
Connections 22
- Engineer or agent → One-shot CLI: runs build
- One-shot CLI → Build pipeline: runs scan
- Build pipeline → File detection: detects files
- Build pipeline → Language extraction: extracts files
- Build pipeline → Graph assembly: merges fragments
- Build pipeline → Graph assembly: resolves relations
- Build pipeline → Graph analysis: analyzes graph
- One-shot CLI → Graph exports: writes exports
- Engineer or agent → Thin client: queries graph
- Thin client → Resident daemon: connects or spawns
- Resident daemon → Daemon server: starts service
- Daemon server → Query operations: dispatches requests
- Daemon server → Live file updates: watches files
- Live file updates → Incremental graph update: triggers updates
- Incremental graph update → Graph persistence: persists graph
- Query operations → Graph persistence: loads graph
- Engineer or agent → MCP server: sends MCP requests
- MCP server → Thin client: forwards operations
- One-shot CLI → Semantic enrichment: plans enrichment
- One-shot CLI → Fragment ingestion: ingests fragments
- Semantic enrichment → Fragment ingestion: produces fragments
- Thin client → Workspace federation: federates requests