@@ -18,14 +18,53 @@ A powerful CLI tool that analyzes Go codebases and generates graph visualization
1818- ** 📝 Configurable** : YAML-based configuration for project-specific settings
1919- ** 🏛️ Clean Architecture** : Extensible design following Domain-Driven Design principles
2020
21+ ## 🛡️ Project Isolation
22+
23+ gograph provides ** complete project isolation** to enable multiple Go projects to coexist safely in the same Neo4j database:
24+
25+ ### Key Benefits
26+
27+ - ** 🏗️ Multi-Project Support** : Analyze multiple projects without data conflicts
28+ - ** 🔒 Data Isolation** : Each project's data is completely isolated from others
29+ - ** 🏷️ Unique Identifiers** : User-defined project IDs ensure clear project boundaries
30+ - ** 🚀 Performance Optimized** : Database indexes on project_id for fast queries
31+ - ** 🧹 Safe Cleanup** : Clear project data without affecting other projects
32+
33+ ### How It Works
34+
35+ 1 . ** Project Initialization** : Each project requires a unique ` project_id ` during setup
36+ 2 . ** Data Tagging** : All nodes and relationships are tagged with the project_id
37+ 3 . ** Query Filtering** : All operations automatically filter by project_id
38+ 4 . ** Index Optimization** : Database indexes ensure fast project-scoped queries
39+
40+ ### Usage Example
41+
42+ ``` bash
43+ # Project A
44+ cd /path/to/project-a
45+ gograph init --project-id backend-api --project-name " Backend API"
46+ gograph analyze
47+
48+ # Project B
49+ cd /path/to/project-b
50+ gograph init --project-id frontend-app --project-name " Frontend App"
51+ gograph analyze
52+
53+ # Both projects coexist safely in the same database
54+ # Queries automatically filter by project_id
55+ ```
56+
2157## 📋 Table of Contents
2258
23- - [ Installation] ( #installation )
59+ - [ Project Isolation] ( #️-project-isolation )
60+ - [ Installation] ( #installation )
2461- [ Quick Start] ( #quick-start )
62+ - [ Complete Workflow] ( #-complete-codebase-analysis-workflow )
2563- [ Usage] ( #usage )
2664- [ Configuration] ( #configuration )
2765- [ Graph Schema] ( #graph-schema )
2866- [ MCP Integration] ( #mcp-integration )
67+ - [ Architecture] ( #️-architecture )
2968- [ Development] ( #development )
3069- [ Contributing] ( #contributing )
3170- [ License] ( #license )
@@ -88,7 +127,7 @@ docker run -v $(pwd):/workspace compozy/gograph:latest analyze /workspace
881272 . ** Initialize project configuration** :
89128
90129 ``` bash
91- gograph init
130+ gograph init --project-id my-awesome-project
92131 ```
93132
941333 . ** Analyze your Go project** :
@@ -124,15 +163,14 @@ make run-neo4j
124163# Navigate to your Go project directory
125164cd /path/to/your/go/project
126165
127- # Initialize gograph configuration
128- gograph init --project-name my-awesome-project
166+ # Initialize gograph configuration with required project ID
167+ gograph init --project-id my-awesome-project --project-name " My Awesome Project "
129168
130- # Analyze the entire codebase (including tests and dependencies )
169+ # Analyze the entire codebase (project ID is read from config )
131170gograph analyze . \
132171 --include-tests \
133172 --include-vendor \
134- --concurrency 8 \
135- --project-id my-awesome-project
173+ --concurrency 8
136174```
137175
138176### 2. Access Neo4j Browser
@@ -299,28 +337,57 @@ Initialize a new project configuration in the current directory.
299337gograph init [flags]
300338
301339Flags:
302- --force Overwrite existing configuration
303- --project-name Set project name (default: directory name)
340+ --project-id string Unique project identifier (required)
341+ --project-name string Human-readable project name (defaults to project-id)
342+ --project-path string Project root path (defaults to current directory)
343+ --force Overwrite existing configuration
344+ ```
345+
346+ ** Examples:**
347+ ``` bash
348+ # Basic initialization with required project ID
349+ gograph init --project-id my-backend-api
350+
351+ # Full initialization with custom settings
352+ gograph init \
353+ --project-id my-backend-api \
354+ --project-name " My Backend API" \
355+ --project-path ./src
356+
357+ # Force overwrite existing configuration
358+ gograph init --project-id my-api --force
304359```
305360
306361#### ` gograph analyze `
307362
308- Analyze a Go project and store the results in Neo4j.
363+ Analyze a Go project and store the results in Neo4j. The project ID is automatically loaded from the ` gograph.yaml ` configuration file.
309364
310365``` bash
311366gograph analyze [path] [flags]
312367
313368Flags:
314369 --path string Path to analyze (default: current directory)
315- --neo4j-uri string Neo4j connection URI
316- --neo4j-user string Neo4j username
317- --neo4j-password string Neo4j password
318- --project-id string Project identifier
370+ --neo4j-uri string Neo4j connection URI (overrides config)
371+ --neo4j-user string Neo4j username (overrides config)
372+ --neo4j-password string Neo4j password (overrides config)
373+ --project-id string Project identifier (overrides config)
319374 --concurrency int Number of concurrent workers (default: 4)
320375 --include-tests Include test files in analysis
321376 --include-vendor Include vendor directory
322377```
323378
379+ ** Examples:**
380+ ``` bash
381+ # Analyze current directory (uses config from gograph.yaml)
382+ gograph analyze
383+
384+ # Analyze specific directory with all options
385+ gograph analyze /path/to/project --include-tests --include-vendor --concurrency 8
386+
387+ # Override project ID for one-time analysis
388+ gograph analyze --project-id temporary-analysis
389+ ```
390+
324391#### ` gograph query `
325392
326393Execute Cypher queries against the graph database.
@@ -349,25 +416,44 @@ Flags:
349416
350417#### ` gograph clear `
351418
352- Clear project data from the database.
419+ Clear project data from the database. Uses project isolation to safely remove only the specified project's data.
353420
354421``` bash
355422gograph clear [project-id] [flags]
356423
357424Flags:
358- --all Clear all projects
425+ --all Clear all projects (dangerous - use with caution)
359426 --force Skip confirmation prompt
360427```
361428
429+ ** Examples:**
430+ ``` bash
431+ # Clear current project (reads project ID from gograph.yaml)
432+ gograph clear
433+
434+ # Clear specific project by ID
435+ gograph clear my-backend-api
436+
437+ # Clear with confirmation skip
438+ gograph clear my-backend-api --force
439+
440+ # Clear all projects (dangerous - removes all data)
441+ gograph clear --all --force
442+ ```
443+
444+ ** Safety** : The clear command only removes data tagged with the specified project_id, ensuring other projects remain untouched.
445+
362446### Examples
363447
364448``` bash
365- # Analyze current directory
449+ # Initialize a new project
450+ gograph init --project-id myproject --project-name " My Go Project"
451+
452+ # Analyze current directory (uses project ID from gograph.yaml)
366453gograph analyze
367454
368455# Analyze specific project with custom settings
369456gograph analyze /path/to/project \
370- --project-id myproject \
371457 --concurrency 8 \
372458 --include-tests
373459
@@ -395,15 +481,15 @@ Create a `gograph.yaml` file in your project root:
395481
396482``` yaml
397483project :
398- name : my-project
399- root_path : .
400- id : my-project-id
484+ id : my-project-id # Required: Unique project identifier
485+ name : my-project # Optional: Human-readable name (defaults to id)
486+ root_path : . # Optional: Project root path (defaults to ".")
401487
402488neo4j :
403- uri : bolt://localhost:7687
404- username : neo4j
405- password : password
406- database : gograph_my_project
489+ uri : bolt://localhost:7687 # Neo4j connection URI
490+ username : neo4j # Neo4j username
491+ password : password # Neo4j password
492+ database : " " # Optional: Database name (uses default if empty)
407493
408494analysis :
409495 ignore_dirs :
@@ -449,10 +535,12 @@ You can override configuration using environment variables:
449535export GOGRAPH_NEO4J_URI=bolt://localhost:7687
450536export GOGRAPH_NEO4J_USERNAME=neo4j
451537export GOGRAPH_NEO4J_PASSWORD=password
452- export GOGRAPH_PROJECT_ID=my-project
538+ export GOGRAPH_PROJECT_ID=my-project # Overrides config project ID
453539export GOGRAPH_MCP_PORT=8080
454540```
455541
542+ ** Important** : The ` GOGRAPH_PROJECT_ID ` environment variable will override the project ID from your ` gograph.yaml ` file. This is useful for CI/CD environments or temporary analysis.
543+
456544## 📊 Graph Schema
457545
458546### Node Types
@@ -532,15 +620,32 @@ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/
532620
533621### Available MCP Tools
534622
535- - ` analyze_project ` : Analyze a Go project
536- - ` query_dependencies ` : Query project dependencies
623+ ** Project Management:**
624+ - ` list_projects ` : List all projects in the database
625+ - ` validate_project ` : Validate project existence and configuration
626+ - ` analyze_project ` : Analyze a Go project with full isolation
627+
628+ ** Code Analysis:**
629+ - ` query_dependencies ` : Query project dependencies with filtering
537630- ` get_function_info ` : Get detailed function information
538- - ` list_packages ` : List all packages in a project
539- - ` execute_cypher ` : Execute custom Cypher queries
631+ - ` list_packages ` : List all packages in a specific project
632+ - ` get_package_structure ` : Get detailed package structure
633+ - ` find_implementations ` : Find interface implementations
634+ - ` trace_call_chain ` : Trace function call chains
635+
636+ ** Querying & Search:**
637+ - ` execute_cypher ` : Execute custom Cypher queries with project filtering
540638- ` natural_language_query ` : Translate natural language to Cypher
541- - ` detect_code_patterns ` : Detect common design patterns
542- - ` verify_function_exists ` : Verify function existence (prevent hallucinations)
543- - ` verify_import_relationship ` : Verify import relationships
639+ - ` get_code_context ` : Get code context for LLM understanding
640+
641+ ** Code Quality:**
642+ - ` detect_code_patterns ` : Detect common design patterns and anti-patterns
643+ - ` check_test_coverage ` : Analyze test coverage by package
644+ - ` detect_circular_deps ` : Find circular dependencies
645+
646+ ** Verification (Anti-Hallucination):**
647+ - ` verify_code_exists ` : Verify function/type existence
648+ - ` validate_import_path ` : Verify import relationships
544649
545650For detailed MCP integration guide, see [ docs/MCP_INTEGRATION.md] ( docs/MCP_INTEGRATION.md ) .
546651
0 commit comments