reposnap
v1.3.0
Published
Create structured snapshots of codebases with configurable file and directory filtering.
Maintainers
Readme
reposnap
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.
AI Code Review
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.
Installation
npm install reposnapWhile the package name is reposnap, the CLI command is simply reposnap.
You can use it directly with npx:
npx reposnapAlternatively, you can install it globally:
npm install -g reposnapAnd then use it as:
reposnapUsage
Basic Usage
Simply run the command:
reposnapThis will:
- Generate a snapshot of the current directory.
- Save the output as
<folder-name>_snapshot.txt(e.g.,my-project_snapshot.txt).
AI Review Preparation
reposnap --ai-prepThis will:
- Exclude binary files
- Set reasonable file count limits for AI context windows
- Limit max file size to focus on code
Options
| 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) |
Example
Basic Snapshot:
reposnapThis will scan the current directory and generate a snapshot file with the default name.
Specify Root Directory:
reposnap --r ./my-projectCustom Output File:
reposnap --o my_snapshot.txtIgnore Additional Directories:
reposnap --idir dist temp logsIgnore Additional Files:
reposnap --ifile *.env *.pemPrepare for AI Review:
reposnap --ai-prep --o for_gpt.txtCombine Options:
reposnap --r ./my-project --o snapshot.txt --idir dist --ifile *.log --exclude-binary
Default Ignored Paths
Directories
.gitnode_modulesdistbuild.vscode__pycache__coverage
Files
.DS_Store.gitignore*.pyc*.log.env*.key*.crt*.pempackage-lock.jsonyarn.lockpnpm-lock.yaml- Many common binary file types (images, fonts, executables)
Why Use reposnap?
- 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.
License
MIT License
