The Code Segmenter is a Rust-based tool designed to parse and analyze code repositories. It generates a simplified code structure to help users understand the architecture of the codebase. The tool can handle both local directories and remote Git repositories.
- Cloning Git Repositories: Automatically clones a Git repository into a temporary directory for analysis.
- Code Simplification: Processes and simplifies code files based on language-specific segmenters.
- Error Logging: Logs errors encountered during file processing to an
temp/_arch_/error.txt
file. - Directory Handling: Saves simplified code into a parallel
_arch_
directory structure outside the original directory being processed.
- Rust (with
tokio
andgit2
crates) - Compatible code segmenters for various languages (e.g., Python, JavaScript)
To use this project, clone the repository and ensure that you have Rust installed on your system. Run the following commands to build and run the application:
git clone <repository-url>
cd <repository-directory>
cargo build
cargo run -- <git-repo-url|directory-path>
Replace with the URL of the Git repository or with the local directory path.
The application requires a command-line argument specifying either a Git repository URL or a local directory path. Here's how to run the application:
cargo run -- <git-repo-url|directory-path>
: The URL of the Git repository you want to clone and analyze. : The path to the local directory you want to analyze.
The application will:
- Clone the Git repository if a URL is provided.
- Normalize the input path.
- Process and simplify code files based on language-specific segmenters.
- Save the simplified code and log errors into the temp/arch directory.