8000 GitHub - TrexPD/struct_repo: Struct_Repo is a Dart-based command-line tool that scans a project's folders and creates one Markdown file with everything from its text files.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Struct_Repo is a Dart-based command-line tool that scans a project's folders and creates one Markdown file with everything from its text files.

License

Notifications You must be signed in to change notification settings

TrexPD/struct_repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Struct_Repo

Struct_Repo is a command-line (CLI) tool written in Dart that analyzes a project's directory structure and generates a single, comprehensive Markdown file containing the contents of all its text-based files.

This tool is incredibly useful for:

  • Code Analysis: Having an entire project's source code in one file makes it easier to search, understand architecture, and get a high-level overview.
  • Code Reviews: Share a single file with the complete project structure for more effective and context-aware reviews.
  • Documentation: Create a complete, text-based "snapshot" of your repository at any given time.
  • AI and LLM Context: Provide full project context to Large Language Models like GPT-4, Claude 3, and Gemini for more accurate assistance and analysis.

The tool is designed to be smart: it automatically ignores binary files, focusing only on content that can be read as text.

Installation

You can use Struct_Repo by either compiling it from source or running it directly with the Dart SDK.

Prerequisites

  • Dart SDK installed and configured in your system's PATH.

Option 1: Compile to a Standalone Executable (Recommended)

Compiling the tool creates a native executable that you can run from anywhere on your system without needing to call Dart directly.

  1. Clone the repository:

    git clone https://github.com/TrexPD/struct_repo.git
    cd struct_repo
  2. Compile for your platform:

    • For Windows:

      dart compile exe .\src\main.dart -o .\bin\structrepo.exe
    • For macOS or Linux:

      dart compile exe src/main.dart -o bin/structrepo
  3. (Optional) Add the Executable to Your PATH: To use the structrepo command from any directory, add the project's bin folder to your system's PATH environment variable.

    • Windows (in PowerShell):

      # Get the full path to the 'bin' directory
      $binPath = (Get-Item "bin").FullName
      
      # Add it to your user PATH (this change is permanent)
      $oldPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
      [System.Environment]::SetEnvironmentVariable("Path", "$oldPath;$binPath", "User")
      
      # You will need to restart your terminal for the change to take effect
      Write-Host "The 'bin' directory has been added to your PATH. Please restart your terminal."
    • macOS/Linux (for bash/zsh): Open your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile) and add the following line:

      export PATH="$PATH:/full/path/to/struct_repo/bin"

      Save the file and reload your shell configuration by running source ~/.bashrc (or the name of the file you edited).

Option 2: Run Directly with Dart

If you prefer not to compile an executable, you can run the script directly.

  1. Clone the repository:

    git clone https://github.com/TrexPD/struct_repo.git
    cd struct_repo
  2. Run the command:

    Instead of structrepo, you will use dart run src/main.dart. See usage examples below.

How to Use

The tool is designed for simplicity. The basic syntax is:

structrepo [directory_path]

Or, if you are using dart run:

dart run src/main.dart [directory_path]
  • If no directory_path is provided, the tool will analyze the current directory.
  • The output file will be generated in the directory from which the command is run, named [directory_name].md.

Examples

1. Analyze the Current Directory

Navigate to the project folder you want to document and run:

structrepo .

Or, more simply:

structrepo

This will create a file named current_directory_name.md in that same location.

2. Analyze a Specific Directory

You can provide a relative or absolute path to any directory.

# Example with a relative path
structrepo ../my-other-project

# Example with an absolute path on Windows
structrepo C:\Users\YourName\Documents\Projects\my-web-project

# Example with an absolute path on macOS/Linux
structrepo /home/your_user/projects/my-api-project

This will generate an output file (my-other-project.md, my-web-project.md, etc.) in the directory where you ran the command.

Sample Output

When structrepo is run on a project, it generates a Markdown file formatted as follows:

content of file1
# Project Structure: project-name

### file1.txt
content...
content of file2
##### subdirectory/file2.dart
content...

...and so on for all text files.

Contributions

Contributions are welcome! Feel free to report problems or send pull requests.

License

Struct_Repo is open-source under the MIT License.

🌟 Favourite this repository! 🌟

Created with ❤️ and Dart by Paulo Daniel (TrexPD)!

About

Struct_Repo is a Dart-based command-line tool that scans a project's folders and creates one Markdown file with everything from its text files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages

0