fs2md
v0.3.0
Published
A CLI that adds contents of files to markdown along with a visual file tree.
Readme
fs2md
A CLI that adds contents of files to markdown along with a visual file tree.
Perfect for pasting context into LLMs.
Quick Start
# Include only TypeScript, exclude tests
npx fs2md . -i "**/*.ts" -x "**/*.test.ts" | pbcopy
# Or save to file (node_modules and .git excluded by default)
npx fs2md . -o codebase.md
# Exclude some binary files
fs2md . -x "**/*.{png,jpg,gif,pdf}"Install
Install globally via npm:
npm install -g fs2mdOr use directly with npx (no installation needed):
npx fs2md <root> [options]Usage
fs2md <root> [options]| Option | Description | Default |
| -------------------------- | ---------------------------------------------------- | ------- |
| -o, --output FILE | Write the Markdown here instead of stdout | — |
| -i, --include PATTERN | Glob(s) to include (repeatable, comma-separated) | all |
| -x, --exclude PATTERN | Glob(s) to exclude (repeatable, comma-separated) | see below |
| --no-default-excludes | Disable default excludes | false |
Default excludes: node_modules/**, .git/** (disable with --no-default-excludes)
Examples
1 · Dump current directory to stdout
fs2md .2 · Only include TypeScript files, exclude tests, then copy to clipboard
fs2md . -i "**/*.ts" -x "**/*.test.ts" | pbCopy3 · Produce a single repo.md that excludes node_modules
fs2md . -x "node_modules/**" -o repo.md"4 · Include only source files from specific directories
fs2md . -i "src/**, lib/**" -o codebase.mdExample Input and output
Input:
fs2md ./test/fixtures/sample-project -x "**/*.js"Output:
Exit codes
| Code | Meaning |
| ---- | -------------------------------------------- |
| 0 | Success |
| 1 | Usage error / invalid flag |
| >1 | Unhandled exception (I/O, permissions, etc.) |
License
MIT
Build and run manually
# Clone repo
npm install
npm run build
# Run local build
node dist/fs2md.js <root> [options]