From cd16787af923ed581d8bc1570a10ee849c3d84c1 Mon Sep 17 00:00:00 2001 From: Kazuki Yamada Date: Sat, 28 Sep 2024 18:56:27 +0900 Subject: [PATCH] feat(style): Add Markdown output style --- .gitignore | 1 + README.md | 43 +++++++++- src/cli/cliRunner.ts | 2 +- src/config/configTypes.ts | 2 +- src/core/output/markdownStyleGenerator.ts | 81 +++++++++++++++++++ src/core/output/outputGenerator.ts | 4 + src/core/output/plainStyleGenerator.ts | 28 +++---- src/core/output/xmlStyleGenerator.ts | 2 +- .../output/markdownStyleGenerator.test.ts | 34 ++++++++ 9 files changed, 177 insertions(+), 20 deletions(-) create mode 100644 src/core/output/markdownStyleGenerator.ts create mode 100644 tests/core/output/markdownStyleGenerator.test.ts diff --git a/.gitignore b/.gitignore index d3593d30..cc49991d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ coverage/ # Repopack output repopack-output.txt repopack-output.xml +repopack-output.md # ESLint cache .eslintcache diff --git a/README.md b/README.md index 1bbdb818..5462669c 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,45 @@ https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml- This means that the XML output from Repopack is not just a different format, but potentially a more effective way to feed your codebase into AI systems for analysis, code review, or other tasks. +#### Markdown Format + +To generate output in Markdown format, use the `--style markdown` option: +```bash +repopack --style markdown +``` + +The Markdown format structures the content in a hierarchical manner: + +````markdown +This file is a merged representation of the entire codebase, combining all repository files into a single document. + +# File Summary +(Metadata and usage AI instructions) + +# Repository Structure +``` +src/ + cli/ + cliOutput.ts + index.ts +``` +(...remaining directories) + +# Repository Files + +## File: src/index.js +``` +// File contents here +``` + +(...remaining files) + +# Instruction +(Custom instructions from `output.instructionFilePath`) +```` + +This format provides a clean, readable structure that is both human-friendly and easily parseable by AI systems. + ### Command Line Options - `-v, --version`: Show tool version @@ -230,7 +269,7 @@ This means that the XML output from Repopack is not just a different format, but - `--include `: List of include patterns (comma-separated) - `-i, --ignore `: Additional ignore patterns (comma-separated) - `-c, --config `: Path to a custom config file -- `--style