Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,397 changes: 1,351 additions & 1,046 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ tree-sitter-c-sharp = "0.23.0"
tree-sitter-ruby = "0.23.0"
tree-sitter-php = "0.24.2"
tree-sitter-dart = "0.0.4"
tree-sitter-pascal = "0.10.2"

# GraphQL
async-graphql = "7.0"
Expand Down Expand Up @@ -285,6 +286,9 @@ codegraph-ai = { path = "crates/codegraph-ai" }
# Development dependencies


[patch.crates-io]
objc_exception = { path = "patches/objc_exception" }

[profile.release]
# Performance-oriented release (kept as-is for general builds)
opt-level = 3
Expand Down
32 changes: 32 additions & 0 deletions codegraph-mcp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Wrapper to start CodeGraph MCP server with SurrealDB + OpenRouter (ZDR)
#
# LLM: google/gemini-2.0-flash-lite-001 via OpenRouter
# - $0.025/M input, $0.075/M output, 1M context, tool use supported
# - Zero Data Retention enforced via openrouter.ai/settings/privacy (account-level)
#
# Embeddings: ONNX (local, bundled — no external API needed)

export CODEGRAPH_EMBEDDING_PROVIDER=onnx
export CODEGRAPH_LOCAL_MODEL=BAAI/bge-small-en-v1.5
export ORT_DYLIB_PATH=/home/sash/.pyenv/versions/3.13.7/lib/python3.13/site-packages/onnxruntime/capi/libonnxruntime.so
export CODEGRAPH_SURREALDB_URL=ws://127.0.0.1:8529
export CODEGRAPH_SURREALDB_USERNAME=root
export CODEGRAPH_SURREALDB_PASSWORD=root
export CODEGRAPH_SURREALDB_NAMESPACE=codegraph
export CODEGRAPH_SURREALDB_DATABASE=main

# OpenRouter via openai-compatible — routes to /v1/chat/completions
# ZDR enforced at account level: openrouter.ai/settings/privacy → Disable data collection
export CODEGRAPH_LLM_PROVIDER=openai-compatible
export CODEGRAPH_USE_COMPLETIONS_API=true
export OPENAI_API_KEY=REDACTED_OPENROUTER_API_KEY
export CODEGRAPH_OPENAI_COMPATIBLE_URL=https://openrouter.ai/api/v1
export CODEGRAPH_LLM_MODEL=google/gemini-2.0-flash-lite-001
export CODEGRAPH_AGENT_MODEL=google/gemini-2.0-flash-lite-001
export CODEGRAPH_CONTEXT_WINDOW=1048576

# ReAct architecture — simpler, works with openai-compatible providers
export CODEGRAPH_AGENT_ARCHITECTURE=react

exec /home/sash/projects/research/codegraph-rust/target/release/codegraph start stdio "$@"
1 change: 1 addition & 0 deletions crates/codegraph-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub enum Language {
Ruby,
Php,
Dart,
FreePascal,
Other(String),
}

Expand Down
2 changes: 1 addition & 1 deletion crates/codegraph-graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ chrono = { workspace = true }
sha2 = { workspace = true }

# SurrealDB support (optional, default on via feature flag)
surrealdb = { version = "2.2", optional = true, features = ["kv-mem"] }
surrealdb = { version = "3", optional = true, features = ["kv-mem"] }
dotenvy = { version = "0.15", optional = true }
tokio = { workspace = true, optional = true, features = ["macros", "rt-multi-thread"] }

Expand Down
16 changes: 8 additions & 8 deletions crates/codegraph-graph/src/bin/surreal_smoke_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ async fn main() -> anyhow::Result<()> {
.to_string();
let db = Surreal::new::<Ws>(&endpoint).await?;
db.signin(Root {
username: &username,
password: &password,
username: username.clone(),
password: password.clone(),
})
.await?;
db.use_ns(&namespace).use_db(&database).await?;
Expand Down Expand Up @@ -52,11 +52,11 @@ async fn main() -> anyhow::Result<()> {
"project_id": "smoke-project",
});

db.query("UPSERT type::thing('nodes', $doc.id) CONTENT $doc;")
db.query("UPSERT type::record('nodes', $doc.id) CONTENT $doc;")
.bind(("doc", node_one))
.await?;

db.query("UPSERT type::thing('nodes', $doc.id) CONTENT $doc;")
db.query("UPSERT type::record('nodes', $doc.id) CONTENT $doc;")
.bind(("doc", node_two))
.await?;

Expand All @@ -70,10 +70,10 @@ async fn main() -> anyhow::Result<()> {
});

db.query(
"UPSERT type::thing('edges', $doc.id) CONTENT {
"UPSERT type::record('edges', $doc.id) CONTENT {
id: $doc.id,
from: type::thing('nodes', $doc.from),
to: type::thing('nodes', $doc.to),
from: type::record('nodes', $doc.from),
to: type::record('nodes', $doc.to),
edge_type: $doc.edge_type,
weight: $doc.weight,
metadata: $doc.metadata,
Expand All @@ -94,7 +94,7 @@ async fn main() -> anyhow::Result<()> {
"access_count": 0,
});

db.query("UPSERT type::thing('symbol_embeddings', $doc.id) CONTENT $doc;")
db.query("UPSERT type::record('symbol_embeddings', $doc.id) CONTENT $doc;")
.bind(("doc", symbol_doc))
.await?;

Expand Down
Loading