How It Works
-
Resolve Paths Converts
inputandoutputto absolute paths and ensures the output file itself is excluded. -
Directory Walk Recursively walks directories sequentially to avoid concurrency deadlocks.
- Directories are traversed first.
- Files are processed concurrently, respecting the
concurrencylimit.
-
File Processing For each file:
- Skips if hidden, excluded, or exceeds
maxFileSize. - Reads file contents (
utf-8). - Generates a Markdown header using
filenameFormatter. - Wraps the content in a fenced code block with language derived from the file extension.
- Appends content to the output Markdown file.
- Calls
onprogresscallback.
- Skips if hidden, excluded, or exceeds
-
Summary Generation After all files are processed:
- Calls
summaryFormatterwith the list of processed files. - Appends the generated summary to the Markdown file.
- Calls
-
Error Handling
- Wraps file system operations in
safeRunto catch errors without stopping execution unlessstopOnErroristrue. - Logs warnings and errors for files that fail to process.
- Wraps file system operations in