Skip to content

Add JSON output format for query results #250

@vitali87

Description

@vitali87

📋 Task Description

Add support for JSON output format when running queries, enabling integration with other tools and scripts.

🎯 Acceptance Criteria

  • Add --output-format option with values: table (default), json
  • When json is selected, output query results as valid JSON
  • JSON should be well-structured and parseable
  • Works with the export command as well

🔗 Related Files/Components

  • File: codebase_rag/cli.py - add output format option
  • File: codebase_rag/main.py - modify result display logic

📝 Additional Context

This enables:

  • Piping results to jq for processing
  • Integration with other automation tools
  • Programmatic access to query results

Example usage:

graph-code query "find all functions" --output-format json | jq '.functions[].name'

Example JSON output:

{
  "query": "find all functions",
  "results": [
    {"name": "process_file", "module": "parser.py", "line": 42},
    {"name": "validate_input", "module": "utils.py", "line": 15}
  ],
  "count": 2
}

🚦 Priority

  • High
  • Medium
  • Low

📊 Estimated Effort

  • Small (< 2 hours)
  • Medium (2-8 hours)
  • Large (> 8 hours)

Metadata

Metadata

Labels

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions