These commands allow you to extract insights from your indexed code.
Finds every function that calls a specific function. Essential for "Impact Analysis" before refactoring.
Usage:
cgc analyze callers <func_name>The reverse of callers. Shows what a specific function calls.
Usage:
cgc analyze calls <func_name>Connects the dots. Finds the path of execution between two functions.
Usage:
cgc analyze chain <start_func> <end_func> --depth 5Shows dependencies and imports for a specific module.
Usage:
cgc analyze deps <module>Visualizes the Class Inheritance hierarchy for a given class.
Usage:
cgc analyze tree <class_name>Finds functions that are difficult to maintain (Cyclomatic Complexity).
Usage:
cgc analyze complexity --threshold 10Finds potentially unused functions (0 callers).
Usage:
cgc analyze dead-code --exclude "@route"Shows methods that override parent class methods.
Usage:
cgc analyze overrides <class_name>Analyzes where a variable is defined and used.
Usage:
cgc analyze variable <var_name>Fuzzy search for code elements. Use this when you don't know the exact name.
Usage:
cgc find pattern <text>Finds code elements (Class, Function) by their exact name.
Usage:
cgc find name <name>List all nodes of a specific type.
Usage:
cgc find type <type>Supported Types:
class: Find all classes.function: Find all functions/methods.module: Find all indexed files/modules.
Example:
# Find all classes in the codebase
cgc find type classFull-text search across your source code and docstrings.
Usage:
cgc find content "search term"Finds all functions that are decorated with a specific decorator.
Usage:
cgc find decorator @app.routeFinds all functions that define a specific argument name.
Usage:
cgc find argument user_id