v0.4.0¶
Release Date: 2026-06-13
Release featuring full-text search, code reuse tracking, and architectural pattern detection.
Highlights¶
- Full-text search using bleve with fuzzy matching and faceted results
- Code reuse tracking to identify similar patterns and refactoring opportunities
- Architectural pattern detection with anti-pattern warnings and health scoring
Full-Text Search¶
The new graphize search command provides fast full-text search across your knowledge graph using bleve v2.6.0.
Basic Search¶
# Search for authentication-related code
graphize search "authentication"
# Search with fuzzy matching (typo tolerant)
graphize search "authenticaton" --fuzzy 1
# Filter by node type
graphize search "handler" --type function
# Show index statistics
graphize search --stats
# Rebuild the search index
graphize search --reindex
Search Fields¶
The search indexes these node attributes:
| Field | Description |
|---|---|
label |
Function/class/variable names |
doc |
Docstrings and comments |
package |
Package names |
signature |
Function signatures |
source_file |
File paths |
Search Output¶
Results include:
- Relevance score
- Node type and label
- Package and source file
- Snippet from docstring
- Highlighted matching fragments
- Faceted counts by node type
Code Reuse Tracking¶
The new graphize reuse command identifies code patterns that may benefit from consolidation or refactoring.
Analysis Categories¶
| Category | Description |
|---|---|
| Similar Groups | Functions with similar signatures that could share an interface |
| Duplicate Names | Same names appearing in multiple packages |
| Shared Dependencies | Nodes with identical dependency sets |
| Refactor Candidates | Suggested refactoring opportunities with priority |
Refactoring Suggestions¶
The analyzer suggests:
- Extract Interface: Multiple functions with similar signatures
- Consolidate: Same name in 3+ packages
- Extract Service: Multiple nodes sharing 5+ dependencies
Architectural Pattern Detection¶
The new graphize patterns command detects common architectural patterns and anti-patterns.
Architectural Patterns Detected¶
| Pattern | Detection Method |
|---|---|
| Factory | New* functions that create instances |
| Singleton | Global instances with instance/default/global in name |
| Handler | Functions with handle/handler/serve and HTTP signatures |
| Repository | Structs/interfaces with repo/repository/store/dao |
| Builder | Structs with fluent methods returning same type |
Structural Patterns Detected¶
| Pattern | Description |
|---|---|
| Hub Nodes | Highly connected nodes (10+ edges) |
| Layered Architecture | Presentation/business/data layer groupings |
| Clusters | Tightly coupled node groups within packages |
Anti-Patterns Detected¶
| Anti-Pattern | Severity | Description |
|---|---|---|
| God Object | Medium/High | Structs with 20+ methods or 30+ dependencies |
| Circular Dependency | High | Mutual dependencies between nodes |
| Dead Code | Low | Unexported functions with no callers |
Health Score¶
The report includes a health score (0-100) based on anti-pattern severity:
- High severity: -10 points
- Medium severity: -5 points
- Low severity: -2 points
Dependencies¶
New dependencies in v0.4.0:
github.com/blevesearch/bleve/v2 v2.6.0 # Full-text search
golang.org/x/tools v0.46.0 # (bumped)
golang.org/x/text v0.38.0 # (bumped)
github.com/grokify/mogo v0.74.6 # (bumped)
Upgrading from v0.3.0¶
No breaking changes. The new commands are additive.
Search Index¶
The search index is stored in .graphize/search_index/. It will be automatically created on first search. To rebuild:
Performance¶
| Command | Typical Runtime |
|---|---|
search (indexed) |
1-5ms |
search --reindex |
100-500ms per 100 nodes |
reuse |
50-200ms |
patterns |
100-500ms |