@mayoyo25/codedump
v1.0.0
Published
Concatenate a Next.js/Astro project's source files into one .txt file for pasting into an AI. Lists media/asset paths separately instead of dumping binary content.
Maintainers
Readme
codedump
Dump a Next.js or Astro project's source into one .txt file for pasting into an AI —
each file preceded by a // relative/path/to/file comment (forward slashes, always,
even on Windows).
Media/asset files (images, video, fonts, etc.) are listed as paths only — their binary content is never dumped into the output.
Install
pnpm add -g @mayoyo25/codedumpWorks the same with npm or yarn if that's your package manager:
npm install -g @mayoyo25/codedump
yarn global add @mayoyo25/codedumpRequires Node.js 18 or later.
Usage
Run it from your project root:
codedumpThat scans the whole project (skipping node_modules, build output, lockfiles, etc.)
and writes codedump.txt — ready to paste straight into ChatGPT, Claude, or any AI tool.
Common examples
codedump --dir src # Astro: just the src/ folder
codedump --dir app # Next.js App Router: just app/
codedump --dir src,app # scan a few folders at once
codedump --out project.txt # custom output filename
codedump --ignore "*.test.ts,tmp" # extra ignores, added on top of the defaults
codedump --media-dirs public,assets,static
codedump --no-media # skip listing media/asset paths entirely
codedump --ext .astro,.ts,.tsx # override which extensions count as "code"All flags
| Flag | What it does | Default |
|---|---|---|
| --dir <list> | Comma-separated folders to scan, relative to where you run the command | . (whole project) |
| --out <file> | Output filename | codedump.txt |
| --ext <list> | Comma-separated file extensions to dump in full | see below |
| --ignore <list> | Extra names/patterns to skip, added to the defaults (supports * wildcards) | — |
| --media-dirs <list> | Folders whose contents are always listed path-only, never read | public,assets,static |
| --no-media | Don't list media/asset paths at all | media listed by default |
| --help, -h | Show usage | — |
What gets included
Ignored everywhere: node_modules, .git, .next, .astro, .vercel, .netlify,
dist, build, out, coverage, .turbo, .cache, .vscode, .idea, and common
lockfiles.
Code extensions dumped in full:
.astro .ts .tsx .js .jsx .mjs .cjs .css .scss .sass .md .mdx .json .jsonc .html .yml .yaml
Media dirs (path-only, contents never read): public, assets, static
Media extensions (path-only, wherever they appear in the project):
images (.png .jpg .jpeg .gif .svg .webp .avif .ico .bmp), video (.mp4 .mov .webm .avi
.mkv), audio (.mp3 .wav .ogg .flac .m4a), fonts (.woff .woff2 .ttf .otf .eot),
.pdf, .zip.
Every default above is just a flag — override any of it per project, per run.
Example output
// src/components/Header.astro
---
const title = "Home";
---
<h1>{title}</h1>
--------------------------------------------------------------------------------
// src/utils/format.ts
export function formatDate(d: Date) {
return d.toLocaleDateString();
}
================================================================================
MEDIA / ASSET FILES (path only, 2 files)
================================================================================
// public/images/logo.png
// public/fonts/inter.woff2License
MIT
