A CLI tool to summarize files in a directory using OpenAI.
- Java 17 or higher
- Maven 3.6 or higher
- OpenAI API key
mvn clean packageThis will create an executable JAR file in the target directory.
java -jar target/repo-summarizer-1.0.0.jar -d <directory> [options]-d, --directory <path>- Directory to process (required)-o, --output <file>- Output JSON file path (optional)-k, --api-key <key>- OpenAI API key (or setOPENAI_API_KEYenvironment variable)-l, --log-level <level>- Log level: debug, info, warn, error (default: info)-m, --model <model>- OpenAI model to use (default: gpt-3.5-turbo)-h, --help- Show help message-V, --version- Show version information
Using API key from command line:
java -jar target/repo-summarizer-1.0.0.jar -d ./test-files -k your-api-keyUsing API key from environment variable:
export OPENAI_API_KEY=your-api-key
java -jar target/repo-summarizer-1.0.0.jar -d ./test-filesSave output to a file:
java -jar target/repo-summarizer-1.0.0.jar -d ./test-files -o results.jsonWith debug logging:
java -jar target/repo-summarizer-1.0.0.jar -d ./test-files -l debugThe tool outputs a JSON object containing:
totalFiles- Total number of files foundprocessedFiles- Number of files successfully processedskippedFiles- Number of files skippedsummaries- Array of file summaries, each containing:filePath- Full path to the filefileName- Name of the filesummary- AI-generated summaryfileSize- Size of the file in bytesprocessedAt- ISO timestamp of when the file was processed
processingTime- Total processing time in milliseconds
Logs are written to both:
- Console (with colored output)
summarizer.logfile in the current directory