Skip to content
Merged
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
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ members = [
]

[workspace.package]
version = "2.1.2"
version = "2.1.3"
edition = "2021"
rust-version = "1.80"
license = "MIT"
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ The agent binds the workspace with `codegraph_init {"path": ...}` and gets tools

→ [Full comparison with decision matrix](docs/comparison.md)

## 📄 Supported Formats

CodeGraph-docs now supports parsing the following configuration file formats:

| Format | Parser | Status |
|--------|--------|--------|
| YAML | YamlParser | ✅ Implemented |
| JSON | JsonParser | ✅ Implemented |
| TOML | TomlParser | ✅ Implemented |
| **HCL** (HashiCorp Configuration Language) | **HclParser** | **✅ New** |
| **Terraform (.tf)** | **HclParser** | **✅ New** |

HCL and Terraform files can now be indexed and analyzed through the codegraph CLI, enabling semantic understanding of HashiCorp configuration files.

## 🎯 Key Features

- **24 MCP tools** — `search_symbol`, `flow`, `callers`, `callees`, `impact`, `search_flow`, `context`, `references`, `diff`, `sandbox`, `mermaid`, and more
Expand Down
20 changes: 20 additions & 0 deletions crates/codegraph-docs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "codegraph-docs"
version.workspace = true
edition = "2024"
license.workspace = true
repository.workspace = true

[lints.rust]
warnings = "deny"

[dependencies]
codegraph-core = { path = "../codegraph-core" }
codegraph-graph = { path = "../codegraph-graph" }

serde = { workspace = true }
serde_json = { workspace = true }
serde_yaml = "0.9"
toml = "0.8"
toml_edit = { workspace = true }
hcl-rs = "0.19.8"
52 changes: 52 additions & 0 deletions crates/codegraph-docs/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
use serde::{Deserialize, Serialize};

/// Configuration for the document graph layer (`.codegraph/config.toml [docgraph]`).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DocConfig {
/// Storage backend for document tries (same kind as code graph).
pub storage: Option<StorageConfig>,
/// Base id for document nodes.
pub doc_base: Option<u64>,
/// Base id for mined pattern ids.
pub pattern_base: Option<u64>,
/// Bloom bloom-filter cap (in tokens) for document search.
pub bloom_cap: Option<usize>,
/// Key normalization aliases (e.g. `instances → replicas`).
pub aliases: Option<Vec<(String, String)>>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct StorageConfig {
pub r#type: Option<String>,
pub dsn: Option<String>,
}

impl DocConfig {
pub fn doc_base(&self) -> u64 {
self.doc_base.unwrap_or(1_000_000_000)
}
pub fn pattern_base(&self) -> u64 {
self.pattern_base.unwrap_or(3_000_000_000)
}
pub fn bloom_cap(&self) -> usize {
self.bloom_cap.unwrap_or(64)
}
pub fn storage_kind(&self) -> Option<&str> {
self.storage.as_ref().and_then(|s| s.r#type.as_deref())
}
pub fn storage_dsn(&self) -> Option<&str> {
self.storage.as_ref().and_then(|s| s.dsn.as_deref())
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn defaults() {
let cfg = DocConfig::default();
assert_eq!(cfg.doc_base(), 1_000_000_000);
assert_eq!(cfg.bloom_cap(), 64);
}
}
Loading
Loading