Skip to content

Progressive file disclosure for agentic AI - explore files hierarchically with plugin-based analyzers

License

Notifications You must be signed in to change notification settings

Huzza27/reveal

Β 
Β 

Repository files navigation

reveal - Explore Code Semantically

The simplest way to understand code

Point it at a directory, file, or function. Get exactly what you need with zero configuration.

🎯 The Problem

Developers and AI agents waste time reading entire files when they only need to understand structure or extract specific functions. There's no standard way to progressively explore code.

πŸ’‘ The Solution

reveal provides smart, semantic exploration of codebases:

  • Directories β†’ See what's inside
  • Files β†’ See structure (imports, functions, classes)
  • Elements β†’ See implementation (extract specific function/class)

All with perfect filename:line integration for vim, git, grep, and other tools.

⚑ Quick Start

Install:

pip install reveal-cli                    # Basic install
pip install reveal-cli[treesitter]        # With 50+ language support

Use:

reveal src/                    # Directory β†’ tree view
reveal app.py                  # File β†’ structure
reveal app.py load_config      # Element β†’ extraction

That's it. No flags, no configuration, just works.

🎨 Clean Design

Smart Auto-Detection

# Directories β†’ tree view
$ reveal src/
πŸ“ src/
β”œβ”€β”€ app.py (247 lines, Python)
β”œβ”€β”€ database.py (189 lines, Python)
└── models/
    β”œβ”€β”€ user.py (156 lines, Python)
    └── post.py (203 lines, Python)

# Files β†’ structure view
$ reveal app.py
πŸ“„ app.py

Imports (3):
  app.py:1    import os, sys
  app.py:2    from typing import Dict

Functions (5):
  app.py:15   load_config(path: str) -> Dict
  app.py:28   setup_logging(level: str) -> None

Classes (2):
  app.py:95   Database
  app.py:145  RequestHandler

# Elements β†’ extraction
$ reveal app.py load_config
app.py:15-27 | load_config

   15  def load_config(path: str) -> Dict:
   16      """Load configuration from JSON file."""
   17
   18      if not os.path.exists(path):
   19          raise FileNotFoundError(f"Config not found: {path}")
   20
   21      with open(path) as f:
   22          return json.load(f)

Perfect Unix Integration

Every line is filename:line format:

# Works with vim
$ reveal app.py | grep "Database"
  app.py:95     Database

$ vim app.py:95

# Works with git
$ reveal app.py | grep "load_config"
  app.py:15   load_config(path: str) -> Dict

$ git blame app.py -L 15,27

# Pipe to other tools
$ reveal app.py --format=grep | grep "config"
app.py:15:def load_config(path: str) -> Dict:
app.py:18:    if not os.path.exists(path):

πŸ”Œ Adding New File Types (Stupidly Easy)

Tree-Sitter Languages (10 lines!)

from reveal import TreeSitterAnalyzer, register

@register('.go', name='Go', icon='πŸ”·')
class GoAnalyzer(TreeSitterAnalyzer):
    language = 'go'

Done! Full Go support with structure extraction and element access.

Works for: Python, Rust, Go, JavaScript, TypeScript, C#, Java, PHP, Bash, C, C++, Swift, Kotlin, and 40+ more languages!

Custom Analyzers (20-50 lines)

from reveal import FileAnalyzer, register

@register('.md', name='Markdown', icon='πŸ“')
class MarkdownAnalyzer(FileAnalyzer):
    def get_structure(self):
        """Extract headings."""
        headings = []
        for i, line in enumerate(self.lines, 1):
            if line.startswith('#'):
                headings.append({'line': i, 'name': line.strip('# ')})
        return {'headings': headings}

    def extract_element(self, element_type, name):
        """Extract a section."""
        # Custom extraction logic
        ...

That's it! Your file type now works with reveal.

πŸš€ Features

  • βœ… Smart defaults - No flags needed for 99% of use cases
  • βœ… Directory trees - See what's in a folder
  • βœ… Structure extraction - Imports, functions, classes
  • βœ… Element extraction - Get specific function/class
  • βœ… 50+ languages - Via tree-sitter (Python, Rust, Go, JS, TS, C#, Java, PHP, etc.)
  • βœ… Perfect line numbers - filename:line format everywhere
  • βœ… Unix composable - Works with vim, git, grep, sed, awk
  • βœ… Multiple output formats - text (default), json, grep
  • βœ… Easy to extend - Add new file type in 10-50 lines
  • βœ… AI-optimized - Designed for agentic workflows

πŸ“š Real-World Examples

AI Agent Workflow

# Start broad
$ reveal src/
# Pick interesting file
$ reveal src/app.py
# Deep dive
$ reveal src/app.py Database

Developer Quick Lookup

# See function implementation
$ reveal app.py load_config

# Jump to edit
$ vim app.py:15

Integration with Tools

# Find all TODO comments
$ reveal src/*.py | grep -i "todo"

# Count functions per file
$ for f in src/*.py; do echo "$f: $(reveal $f | grep -c 'Functions')"; done

# Extract all function names
$ reveal app.py | awk '/Functions/,/^$/ {if ($2 ~ /:/) print $3}'

🎯 Use Cases

For AI Agents:

  • Explore unknown codebases efficiently
  • Get structure without reading full files
  • Extract specific elements on demand
  • Standard interface across all file types

For Developers:

  • Quick reference without opening editor
  • Understand file structure rapidly
  • Find specific functions/classes
  • Perfect for terminal workflows

For Scripts:

  • JSON output for programmatic access
  • Grep-compatible format
  • Composable with Unix tools
  • Reliable filename:line references

πŸ—οΈ Architecture

reveal/
β”œβ”€β”€ base.py              # FileAnalyzer base class
β”œβ”€β”€ treesitter.py        # TreeSitterAnalyzer (50+ languages!)
β”œβ”€β”€ tree_view.py         # Directory tree view
β”œβ”€β”€ new_cli.py           # Simple CLI (200 lines)
└── analyzers_new/
    β”œβ”€β”€ python.py        # 15 lines
    β”œβ”€β”€ rust.py          # 13 lines
    β”œβ”€β”€ go.py            # 13 lines
    β”œβ”€β”€ markdown.py      # 79 lines
    β”œβ”€β”€ yaml_json.py     # 110 lines
    └── ...              # Easy to add more!

Total core: ~500 lines Per analyzer: 10-50 lines

πŸ“– Optional Flags

# Metadata only
reveal app.py --meta

# JSON output
reveal app.py --format=json

# Grep-compatible output
reveal app.py --format=grep

# Directory depth
reveal src/ --depth=5

🀝 Contributing

We welcome contributions! Adding a new file type takes 10-50 lines of code.

Most wanted:

  • New language analyzers (TypeScript, Java, Swift, Kotlin)
  • Better extraction logic for existing analyzers
  • Documentation improvements
  • Bug reports and feature requests

πŸ“œ License

MIT License - See LICENSE

πŸ”— Links

🌟 Vision

Make reveal the standard way to explore code - for humans and AI agents alike. Clean, simple, powerful.


Status: πŸš€ v0.2.0 - Clean Redesign | License: MIT

GitHub Stars License Python

About

Progressive file disclosure for agentic AI - explore files hierarchically with plugin-based analyzers

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.6%
  • Shell 3.4%