Pew is a simple, lightweight CLI for dumping source code or directories into a single file, makes it easier to work with LLMs.
Claude Code and Sonnet 3.7 its amazing at coding, but it lacks intelligence. So the best workflow is dump your code to Grok, asking grok to prompt claude first, create a PLAN.md
, and let your fellow claude to follow it
WHAT THIS CLI CAN DO
- Convert source code files to well-formatted Markdown
- Automatically detect and skip binary files
- Tree-style directory structure visualization
- GitIgnore-style pattern matching via
.pewc
configuration file - Auto ignore the binary files
- Smart file extension detection for proper syntax highlighting
imgae below its how the out put files looks like
Using Homebrew
brew tap yuann3/pew
brew install pew
Linux
# Download and install in one command
curl -L https://raw.githubusercontent.com/yuann3/pew/main/install.sh | bash
pew [flags] [files...]
Flags:
-d <directory> Directory to dump (mutually exclusive with specifying files)
-o <filename> Output Markdown file (default: "source.md")
-h Show this help message
--no-default-ignores Disable default ignore patterns for directories
Dump specific files:
pew file1.go file2.go -o output.md
Dump a directory with default ignores:
pew -d /path/to/project -o project.md
Dump a directory without default ignores:
pew -d /path/to/project --no-default-ignores -o project.md
Create a .pewc
file in your project directory to specify ignore patterns. The .pewc
file works exactly like .gitignore
:
# Lines starting with # are comments
# Ignore specific files
bla.md
README.md
*.log
*.tmp
# Ignore directories (patterns ending with /)
node_modules/
dist/
build/
# Wildcards work just like in gitignore
doc/*.txt # Ignore all .txt files in doc/ directory
test/*/data # Ignore data in subdirectories of test/
- Blank lines are ignored
- Lines starting with
#
are comments - Patterns ending with
/
match directories only *
matches any sequence of characters except/
?
matches any single character except/
- You can specify exact filenames like
bla.md
to ignore them
By default, pew ignores these patterns:
.*
(hidden files/directories)node_modules/
target/
dist/
build/
bin/
pkg/
.pewc
(the configuration file itself)
Use --no-default-ignores
to override this behavior.
The output Markdown file contains:
- A directory structure tree (if dumping a directory)
- Code sections with proper syntax highlighting
- All text files found in the specified location(s), excluding any files that match patterns in your
.pewc
file