Skip to content

A high-performance Java utility for consolidating complex project structures into a single flat text file. Perfect for code analysis, archival, or intellectual property applications.

Notifications You must be signed in to change notification settings

ForestRealms/Source-Code-Flattener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Source Code Flattener

A high-performance Java utility for consolidating complex project structures into a single flat text file. Perfect for code analysis, archival, or intellectual property applications.

๐Ÿš€ Quick Start

  1. Configure paths in SourceCodeFlattener.java๏ผš
private final static Path rootPath = get("YOUR_SOURCE_CODE_PATH");
private final static Path outputPath = get("source-code.txt");
  1. Use default implementations: The default FileFilter processes all files (no filtering).
private final static FileFilter FILE_FILTER = path -> true; // Process all files
private final static FileProcessor fileProcessor = new DefaultFileProcessor(FILE_FILTER, rootPath);
  1. Run the application:
mvn compile
java -cp target/classes org.glowberry.flattener.SourceCodeFlattener
  1. Get organized output in source-code.txt with clear file boundaries.

โœจ Architecture Highlights

๐Ÿ—๏ธ Extensible by Design

  • Pluggable Filter Interface: Implement FileFilter to define custom inclusion rules
  • Flexible Processing: Replace FileProcessor for specialized traversal logic
  • Interface Segregation: Clean separation between filtering, processing, and output

๐ŸŽฎ Customization First

The tool provides sensible defaults while empowering complete customization:

// Implement your own filtering logic
public class CustomFilter implements FileFilter {
    @Override
    public boolean shouldProcess(Path path) {
        return path.toString().endsWith(".java"); // Your rules
    }
}
// Use with existing processor
FileProcessor processor = new CustomFileProcessor(new CustomFilter(), rootPath);

About

A high-performance Java utility for consolidating complex project structures into a single flat text file. Perfect for code analysis, archival, or intellectual property applications.

Resources

Stars

Watchers

Forks

Languages