Skip to content

File summary tool for signatures-only reading - #12

Merged
tjdoomer merged 2 commits into
mainfrom
feature/file-summary
Apr 2, 2026
Merged

tjdoomer merged 2 commits into
mainfrom
feature/file-summary

Conversation

@tjdoomer

@tjdoomer tjdoomer commented Apr 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • read_file_summary tool: structural skeleton extraction, no function bodies
  • TypeScript/JS: exports, classes, interfaces, types, method signatures
  • Python: classes, functions, decorators, imports
  • Generic fallback for other languages
  • 2000-line file → ~50-line summary (~95% token savings)

Test plan

  • All 1873 tests pass, type-check clean

Summary by CodeRabbit

  • New Features

    • Introduced a file summary tool that extracts structural information (exports, class declarations, method signatures, type definitions, docstrings) from source files without displaying full code. Supports TypeScript, JavaScript, Python, Go, and Rust.
  • Documentation

    • Added documentation for the new file summary tool, including schema specifications and implementation details.

Structural skeleton extraction (signatures only, no bodies) for
95% token reduction. Tree-sitter preferred, regex fallback.
Regex-based extraction of exports, classes, methods, types, and
interfaces — no function bodies. ~95% token reduction vs read_file.

Supports TypeScript/JavaScript, Python, and generic fallback.
Upgradeable to tree-sitter when repo-map branch lands.
@tjdoomer
tjdoomer merged commit 10c546c into main Apr 2, 2026
@coderabbitai

coderabbitai Bot commented Apr 2, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5dfb9ef4-15b2-4dde-a3d0-25c5e4db0ff2

📥 Commits

Reviewing files that changed from the base of the PR and between e5b1493 and 2b8a66f.

📒 Files selected for processing (3)
  • docs/roadmap/13-file-summary.md
  • packages/core/src/config/config.ts
  • packages/core/src/tools/fileSummary.ts

📝 Walkthrough

Walkthrough

A new File Summary Tool (read_file_summary) has been introduced through documentation, implementation, and configuration registration. The tool extracts structural skeletons from files (exports, class/function signatures, type definitions, docstrings) using language-specific regex patterns, with support for TypeScript/JavaScript, Python, Go, and Rust, and a fallback generic approach for other file types.

Changes

Cohort / File(s) Summary
Documentation
docs/roadmap/13-file-summary.md
Describes the File Summary Tool proposal, specifying expected behavior (extracts structural skeleton without function bodies), JSON schema with path, include_docstrings, and include_private parameters, two extraction approaches (tree-sitter-based preferred, regex-based fallback), and lists implementation files to create.
Implementation
packages/core/src/tools/fileSummary.ts
Adds FileSummaryTool class extending BaseDeclarativeTool that implements regex-based signature extraction for TypeScript/JavaScript (imports, exports, type/class/function declarations), Python (decorators and definitions), and generic fallback patterns. Returns deduplicated structural elements or file-not-found errors.
Configuration
packages/core/src/config/config.ts
Registers FileSummaryTool in Config.createToolRegistry() via import and registerCoreTool() invocation alongside existing core tools.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A skeleton emerges from the code so deep,
Extracting signatures while bodies sleep,
Multi-lingual patterns, regex so keen,
The finest file summary you've ever seen! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/file-summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants