I created a script that merges all files in a directory into this format, and a counterpart that splits it again. Below is just a small sample I asked it to create to show the format, but I did it with almost 80 files including lots of documentation etc.
When providing the flat format it was able to replicate it without much instructions for a blank prompt i had success with the prompt below
===FILE===
Index: 1
Path: src/main/java/com/example/myapp/Greeter.java
Length: 151
Content:
package com.example.myapp;
public class Greeter {
public String getGreeting() {
return "Hello from the Greeter class!";
}
}
===ENDFILE===
===FILE===
Index: 2
Path: src/main/java/com/example/myapp/Main.java
Length: 222
Content:
package com.example.myapp;
public class Main {
public static void main(String[] args) {
Greeter greeter = new Greeter();
String message = greeter.getGreeting();
System.out.println("Main app says: " + message);
}
}
===ENDFILE===
===FILE===
Index: 3
Path: pom.xml
Length: 659
Content:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-simple-app</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
===ENDFILE===
Prompt to request the format if starting from scratch:
Present the entire codebase using the following multi-file format:
The codebase should be presented as a single, monolithic text output. Inside this output, represent each file of the project individually using the following structure:
Start Marker: Each file must begin with the exact line:
===FILE===
Metadata Block: Immediately following the start marker, include these four specific metadata lines, each on its own line:
Index: <N> (where <N> is a sequential integer index for the file, starting from 1).
Path: <path/to/file/filename.ext> (The full relative path of the file from the project's root directory, e.g., index.html, css/style.css, js/script.js, jobs.html, etc.).
Length: <L> (where <L> is the exact character count of the file's content that follows).
Content: (This literal line acts as a separator).
File Content: Immediately after the Content: line, include the entire raw content of the file. Preserve all original line breaks, indentation, and formatting exactly as it should appear in the actual file.
End Marker: Each file's section must end with the exact line:
===ENDFILE===
Ensure all necessary files for the project (HTML, CSS, JS) are included sequentially within the single output block according to this structure.
Crucially, enclose the entire multi-file output, starting from the very first ===FILE=== line down to the very last ===ENDFILE=== line, within a single Markdown fenced code block using exactly five backticks (`````) on the lines immediately before the first ===FILE=== and immediately after the last `===ENDFILE===`. This ensures that any triple backticks (```) within the generated file content are displayed correctly.