Last active
February 21, 2025 13:37
-
-
Save panchicore/624e33104590465fbb91a8aad7c8c1f6 to your computer and use it in GitHub Desktop.
Revisions
-
panchicore revised this gist
Feb 21, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ A command-line utility to consolidate your code files for AI code reviews 4. **Customize the file extensions** ```bash ./aggregate_code.sh -d /my/project -e "ts,tsx" ``` --- -
panchicore renamed this gist
Feb 21, 2025 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ # aggregate_code.sh A command-line utility to consolidate your code files for AI code reviews ### **How to Use** 1. **Make the script executable** -
panchicore created this gist
Feb 21, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ ### **How to Use** 1. **Make the script executable** ```bash chmod +x aggregate_code.sh ``` 2. **Run it with a required directory path** ```bash ./aggregate_code.sh -d /Users/panchicore/code/frontend/src/components/WorkflowManagerModal ``` 3. **Specify a different output file** ```bash ./aggregate_code.sh -d /my/project -o /tmp/my_review.txt ``` 4. **Customize the file extensions** ```bash ./aggregate_code.sh -d /my/project -e "js,ts,jsx" ``` --- This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ #!/bin/bash # Default values OUTPUT_FILE="./aggregated_code_review.txt" EXTENSIONS="jsx,js,tsx,ts" # Function to show usage usage() { echo "Usage: $0 -d <directory> [-o <output_file>] [-e <extensions>]" echo " -d Directory to search (required)" echo " -o Output file path (default: $OUTPUT_FILE)" echo " -e File extensions to search (comma-separated, default: $EXTENSIONS)" exit 1 } # Parse arguments while getopts "d:o:e:" opt; do case "$opt" in d) SEARCH_DIR="$OPTARG" ;; o) OUTPUT_FILE="$OPTARG" ;; e) EXTENSIONS="$OPTARG" ;; *) usage ;; esac done # Check if directory was provided if [ -z "$SEARCH_DIR" ]; then echo "Error: Directory is required." usage fi # Convert comma-separated extensions to `-o` options for `find` EXT_PATTERN=$(echo "$EXTENSIONS" | sed 's/,/ -o -name *./g') EXT_PATTERN="-name *.$EXT_PATTERN" # Clear or create the output file > "$OUTPUT_FILE" # Find and concatenate files find "$SEARCH_DIR" -type f \( $EXT_PATTERN \) | while read -r file; do echo -e "\n=== $file ===\n" >> "$OUTPUT_FILE" cat "$file" >> "$OUTPUT_FILE" done echo "Aggregation complete. Output saved to $OUTPUT_FILE."