Skip to content

Conversation

@Sahilbhatane
Copy link

Summary

Implements a universal --visual flag that renders any analyze/find/query results as interactive graph visualizations in the browser.

Changes

New Files:

  • visualizer.py - Visualization module with HTML generation using vis-network.js
  • test_visualization.py - 51 tests covering all visualization functionality

Modified Files:

  • main.py - Added global --visual/-V/--viz flag and updated all analyze/find/query commands
  • cli_helpers.py - Added cypher_helper_visual() function
  • CLI_Commands.md - Documentation for the new flag

Features

  • Global flag: cgc -V analyze calls my_function
  • Per-command flag: cgc analyze calls my_function --visual
  • Generates standalone HTML files with interactive vis-network.js graphs
  • Saves visualizations to ~/.codegraphcontext/visualizations/
  • Auto-opens in default browser
  • Supports all analyze commands (calls, callers, chain, deps, tree, overrides)
  • Supports all find commands (name, pattern, type)
  • Supports query command for raw Cypher results

Security

  • HTML escaping for XSS prevention
  • Safe JSON serialization for non-serializable objects
  • Read-only query validation

Testing

  • 51 tests added covering utilities, HTML generation, visualization functions, CLI integration, and XSS protection

Closes #487

Copilot AI review requested due to automatic review settings January 8, 2026 15:38
@vercel
Copy link

vercel bot commented Jan 8, 2026

@Sahilbhatane is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Sahilbhatane
Copy link
Author

@Shashankss1205 done

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a universal --visual flag (-V/--viz) that renders analyze/find/query results as interactive graph visualizations using vis-network.js. The feature adds browser-based visualization capabilities to the CLI toolkit.

Key Changes

  • New visualization module with HTML generation for interactive graphs
  • Global and per-command --visual flag support across analyze, find, and query commands
  • Comprehensive test suite with 51 tests covering visualization functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/codegraphcontext/cli/visualizer.py New module implementing HTML generation and visualization functions for all supported command types
tests/test_visualization.py Comprehensive test suite covering utilities, HTML generation, visualization functions, CLI integration, and XSS protection
src/codegraphcontext/cli/main.py Added global --visual flag and integrated visualization calls in all analyze/find/query commands with proper context propagation
src/codegraphcontext/cli/cli_helpers.py Added cypher_helper_visual() function for visualizing raw Cypher query results with security checks
CLI_Commands.md Updated documentation with visual flag usage, examples, and new "Visual Graph Exploration" scenario

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sahilbhatane
Copy link
Author

@Shashankss1205 PR is ready for merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add -v flag

1 participant