reposnap
is a simple CLI tool to generate a complete snapshot of your codebase, including file contents and structure. You can exclude specific directories or files during the snapshot process.
reposnap
is ideal for preparing your code for AI review. It:
- Creates a single file containing all your code files
- Identifies and optionally excludes binary files
- Limits the number of files to respect AI context limits
- Focuses on source code by excluding common non-code files
Use the --ai-prep
flag for optimal AI review preparation.
npm install reposnap
While the package name is reposnap
, the CLI command is simply reposnap
.
You can use it directly with npx
:
npx reposnap
Alternatively, you can install it globally:
npm install -g reposnap
And then use it as:
reposnap
Simply run the command:
reposnap
This will:
- Generate a snapshot of the current directory.
- Save the output as
<folder-name>_snapshot.txt
(e.g.,my-project_snapshot.txt
).
reposnap --ai-prep
This will:
- Exclude binary files
- Set reasonable file count limits for AI context windows
- Limit max file size to focus on code
Option | Alias | Description |
---|---|---|
--root <directory> |
--r |
Root directory of the codebase (default: current directory) |
--output <file> |
--o |
Output file name (default: <folder-name>_snapshot.txt ) |
--ignore-dirs <dirs> |
--idir |
Additional directories to ignore (in addition to defaults) |
--ignore-files <files> |
--ifile |
Additional files to ignore (in addition to defaults) |
--exclude-binary |
--xb |
Completely exclude binary files from the snapshot |
--max-files <number> |
--mf |
Maximum number of files to include (default: 1000) |
--max-size <KB> |
--ms |
Maximum file size in KB (default: 500) |
--ai-prep |
--ai |
Optimize for AI review (excludes binary, limits files) |
-
Basic Snapshot:
reposnap
This will scan the current directory and generate a snapshot file with the default name.
-
Specify Root Directory:
reposnap --r ./my-project
-
Custom Output File:
reposnap --o my_snapshot.txt
-
Ignore Additional Directories:
reposnap --idir dist temp logs
-
Ignore Additional Files:
reposnap --ifile *.env *.pem
-
Prepare for AI Review:
reposnap --ai-prep --o for_gpt.txt
-
Combine Options:
reposnap --r ./my-project --o snapshot.txt --idir dist --ifile *.log --exclude-binary
.git
node_modules
dist
build
.vscode
__pycache__
coverage
.DS_Store
.gitignore
*.pyc
*.log
.env
*.key
*.crt
*.pem
package-lock.json
yarn.lock
pnpm-lock.yaml
- Many common binary file types (images, fonts, executables)
- Quickly create a complete snapshot of your codebase.
- Prepare code for AI review with appropriate context limits.
- Avoid sensitive information by using default excludes.
- Customize the snapshot with simple options.
MIT License