Execute a custom Cypher query on the code graph. Examples: cgc query "MATCH (f:Function) RETURN f.name LIMIT 10" cgc query "MATCH (c:Class)-[:CONTAINS]->(m) RETURN c.name, count(m)" cgc query "MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 50" --visual
(
ctx: typer.Context,
query: str = typer.Argument(..., help="Cypher query to execute (read-only)"),
visual: bool = typer.Option(False, "--visual", "--viz", "-V", help="Show results as interactive graph visualization"),
context: Optional[str] = typer.Option(None, "--context", "-c", help="Specific context to use"),
)
| 3015 | |
| 3016 | @app.command("query") |
| 3017 | def query_graph( |
| 3018 | ctx: typer.Context, |
| 3019 | query: str = typer.Argument(..., help="Cypher query to execute (read-only)"), |
| 3020 | visual: bool = typer.Option(False, "--visual", "--viz", "-V", help="Show results as interactive graph visualization"), |
| 3021 | context: Optional[str] = typer.Option(None, "--context", "-c", help="Specific context to use"), |
| 3022 | ): |
| 3023 | """ |
| 3024 | Execute a custom Cypher query on the code graph. |
| 3025 | |
| 3026 | Examples: |
| 3027 | cgc query "MATCH (f:Function) RETURN f.name LIMIT 10" |
| 3028 | cgc query "MATCH (c:Class)-[:CONTAINS]->(m) RETURN c.name, count(m)" |
| 3029 | cgc query "MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 50" --visual |
| 3030 | """ |
| 3031 | _load_credentials() |
| 3032 | |
| 3033 | # Check if visual mode is enabled |
| 3034 | if check_visual_flag(ctx, visual): |
| 3035 | cypher_helper_visual(query, context) |
| 3036 | else: |
| 3037 | cypher_helper(query, context) |
| 3038 | |
| 3039 | # Keep old 'cypher' as alias for backward compatibility |
| 3040 | @app.command("cypher", hidden=True) |
nothing calls this directly
no test coverage detected