textify-codebase
v0.3.0
Published
Generates/Applies a structured text representation of a codebase. Includes directory tree, file contents, excludes ignores, optionally scrubs secrets. Useful for LLMs.
Downloads
9
Maintainers
Readme
textify-codebase
textify-codebase is a CLI utility for generating a clean, shareable text snapshot of an entire repository. The output pairs a directory tree with each file's contents so that you can hand comprehensive project context to an AI assistant or archive it for review. It also ships with an apply command that can recreate a codebase from a previously generated snapshot.
Features
- 📂 Directory tree export with configurable depth limits.
- 📝 File content capture that respects
.gitignore, built-in safe defaults, and custom ignore patterns. - 🛡️ Optional secret scrubbing for common key formats and credentials.
- 🎯 New selective export controls:
--includeto focus on glob-matched files.--max-file-depthto constrain how deep the content scan travels.--max-file-bytesto skip unexpectedly large artifacts.
- 🔁 Apply mode to materialise a textified snapshot back onto disk, with dry-run and confirmation safeguards.
Installation
npm install --global textify-codebaseOr add it to an existing project:
npm install --save-dev textify-codebaseUsage
Generate a snapshot
textify-codebase [directory] [options]Common flags:
| Flag | Description |
| --- | --- |
| -o, --output <file> | Write to a file instead of stdout. |
| -i, --ignore <pattern...> | Append ignore rules (same format as .gitignore). |
| -I, --include <pattern...> | Only include files matching the provided glob(s). |
| -d, --max-depth <depth> | Maximum depth when rendering the directory tree (default 5). |
| --max-file-depth <depth> | Limit how deep the file content scan traverses (default unlimited). |
| --max-file-bytes <bytes> | Skip files larger than the specified size. |
| --no-gitignore | Skip reading .gitignore rules. |
| --no-default-ignore | Skip bundled safe-ignore defaults. |
| --scrub | Enable heuristic secret scrubbing. |
| --tree-only | Emit only the directory tree. |
| --content-only | Emit only the file contents. |
Tip: Include patterns only influence the file content export. The directory tree remains unchanged so you maintain full context of project structure.
Apply a snapshot
textify-codebase apply <inputFile> [options]Key flags:
| Flag | Description |
| --- | --- |
| -t, --target <directory> | Destination directory (defaults to current working directory). |
| -y, --yes | Skip the confirmation prompt. |
| --dry-run | Show the files that would be written without touching disk. |
| --encoding <encoding> | Override the output encoding (default utf-8). |
Examples
Generate a focused snapshot of all JavaScript source files but skip assets larger than 200 kB:
textify-codebase src --include "**/*.js" --max-file-bytes 204800 --output snapshot.txtLimit both the directory tree and the content scan to just two levels deep:
textify-codebase --max-depth 2 --max-file-depth 2Dry-run the apply workflow to preview the files that would be written:
textify-codebase apply snapshot.txt --target ./restored --dry-runDevelopment
Install dependencies and run the automated checks:
npm install
npm run lint
npm run typecheck
npm run buildThe lint script enforces a couple of lightweight hygiene rules (no trailing whitespace and files must end in a newline), the type
check script runs node --check across every JavaScript entry point, and the build script performs a CLI smoke test to ensure bo
th the main and apply commands can display their help text successfully.
License
MIT
