CodexGigantus is a command-line tool written in Go that processes files in a specified directory based on given criteria. It's designed to integrate seamlessly with Language Learning Models (LLMs) for extracting smaller code components.
- Specify root directory
- Ignore specific directories
- Exclude files with specific extensions
- Include only files with specific extensions
- Process and display contents of text files
- Go 1.16 or later
- Clone the repository:
git clone https://github.com/yourusername/codexgigantus.git
- Navigate to the project directory:
cd codexgigantus
- Build the project:
./build.sh
./codexgigantus -dir /path/to/dir --ignore-dir logs,temp --ignore-ext log,tmp --include-ext txt,md
./CodexGigantus -dir . --ignore-file CodexGigantus,.DS_Store,qodana.yaml --ignore-ext txt --ignore-dir .git,.idea --save --output-file chatgpt_code.txt
--dir
or-dir
: Comma-separated list of directories to search (default: current directory).--ignore-file
or-ignore-file
: Comma-separated list of files to ignore.--ignore-dir
or-ignore-dir
: Comma-separated list of directories to ignore.--ignore-ext
or-ignore-ext
: Comma-separated list of file extensions to ignore.--include-ext
or-include-ext
: Comma-separated list of file extensions to include.--ignore-suffix
or-ignore-suffix
: Comma-separated list of file suffixes to ignore.--recursive
or-recursive
: Recursively search directories (default: true).--debug
or-debug
: Enable debug output.--save
: Save the output to a file.--output-file
: Specify the output file name (default: output.txt).--show-size
: Show the size of the result in bytes.--show-funcs
: Show only functions and their parameters.
codexgigantus -dir social-network-frontend -ignore-file package-lock.json -ignore-dir node_modules,__previewjs__ -ignore-ext svg,png,ico,md -output-file frontend.txt -save
codexgigantus -dir social-network-backend -ignore-file package-lock.json,auth_test.go -ignore-dir tests -ignore-ext sum,mod -output-file backend.txt -save
codexgigantus -debug -dir . -ignore-file package-lock.json,codexgigantus,frontend.txt -ignore-dir cmd,pkg,.idea,.git,node_modules,__previewjs__ -ignore-ext svg,png,ico,md -output-file frontend.txt -save
The code has been refactored to improve modularity and testability using functional programming principles. Key changes include:
- Configuration Parsing: Decoupled from the main function for better readability and testability.
- File Processing: Extracted into a separate function to simplify the main function.
- Functional Style: Refactored file handling using higher-order functions.
- Debug Information: Improved handling using a functional approach.
- Utility Functions: Consolidated into a single module for improved organization and reusability.
To ensure the code is easy to test, functional parameters are used for gathering and processing files, allowing easy mocking during tests. Each function handles a single responsibility, making the codebase modular and maintainable.
Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.
This project is licensed under the MIT License.