Metadata-Version: 2.1
Name: rtfs
Version: 0.1.1
Summary: Code Repo Summary Generator
Author: John Peng
Author-email: kongyijipeng@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: PyYAML (==6.0.1)
Requires-Dist: anthropic (==0.32.0)
Requires-Dist: infomap (==2.8.0)
Requires-Dist: intervaltree (==3.1.0)
Requires-Dist: llama_index (==0.10.59)
Requires-Dist: networkx (==3.3)
Requires-Dist: openai (==1.38.0)
Requires-Dist: pydantic (==2.8.2)
Requires-Dist: python-dotenv (==1.0.1)
Requires-Dist: setuptools (==70.1.1)
Requires-Dist: simple_parsing (==0.1.5)
Requires-Dist: starlette (==0.38.2)
Requires-Dist: tenacity (==8.5.0)
Requires-Dist: tiktoken (==0.7.0)
Requires-Dist: tree_sitter (==0.22.3)
Requires-Dist: tree_sitter_java (==0.21.0)
Requires-Dist: tree_sitter_python (==0.21.0)
Requires-Dist: typing_extensions (==4.12.2)
Description-Content-Type: text/markdown

# How it works
1. Chunk code using custom code chunker (stolen from Moatless)
2. Generate dep graph (partly stolen from Bloop)
3. Cluster chunks together using multi-level graph clustering algo (basically identifies local communities that are more related amongst each other than they are with outside nodes)
4. Recursively generate summaries from leaf to root

What the clusters represent are functional groupings of code that inter-depend on each other (ie. Web Content Scraping and Integration Feature).

Generation is relatively cheap, fraction of the cost of the ingesting the whole repo

# Install

OPENAI_API_KEY must be set in the env to use 
```
pip install rtfs
```

# Get text output to console
```
rtfs chunk-graph tests\cowboy-server\

...
# accept the summarization charge (we are not summarizing over every single file)
The summarization will cost $0.023670999999999998 and use 23671 tokens. Do you want to proceed? (yes/no): yes
```

# Get json output
```
rtfs chunk-graph tests\cowboy-server\ --output-format json --output-file json- 
```

# Sample output
```
Chat Interaction and Summarization Handler 0:12
Keywords: Coder, ChatSummary
Summary: This set of code is responsible for managing chat interactions with AI models, including sending messages, handling responses, and summarizing chat content. The `Coder` class handles the flow of sending messages to the models, managing partial responses, logging the interactions, and processing interruptions. It also checks for file mentions within the messages and handles them appropriately. The `ChatSummary` class focuses on summarizing chat content by compiling user and assistant messages and then interacting with AI models to generate a concise summary. Utility functions like `send_with_retries` and `simple_send_with_retries` ensure robust and retriable communication with the AI models.
  ChunkNode: coders/base_coder.py#38.63
  ChunkNode: aider/history.py#167.25
  ChunkNode: aider/sendchat.py#249.48
File Content Replacement and Editing 0:17
Keywords: do_replace, EditBlockFunctionCoder
Summary: This feature provides functionality for text replacements and bulk edits within files. The `do_replace` function handles the core logic of replacing text within a file, either by creating a new file if it doesn't exist or updating the content by replacing a specified text chunk with new content. The `EditBlockFunctionCoder` class manages bulk edit operations by parsing arguments, validating edit requests, and invoking the `do_replace` function to perform the content replacements. It ensures that file paths are allowed for editing and handles exceptions for missing or incorrect parameters using the `get_arg` function. This feature is primarily used for automating text updates in multiple files while maintaining file integrity.
  ChunkNode: coders/editblock_coder.py#60.19
  ChunkNode: coders/editblock_func_coder.py#69.47
Chat History Analysis and Patch Application 0:4
Keywords: main, map_patches
Summary: This feature encompasses several utility functions and classes to analyze chat history markdown to generate diffs and apply patches to texts. The `main` function reads a markdown file containing chat history and identifies patches by analyzing diffs between the states. Functions like `map_patches`, `dmp_apply`, and `dmp_lines_apply` manage the application of these patches to ensure accurate mapping and transformation of text changes. There are also utility functions for dealing with general patch management, such as `find_diffs`, and `show_stats` for statistical analysis and visualization. Additional code sections cover the creation of graphical representations of the results and handling exceptions during such operations
```

