lsallcp
v2.0.0
Published
Recursively list every file's content as relativePath: ```ext code fences```, with glob/regex/name skip patterns, progress bar and colored output
Readme
lsallcp
Recursively dump every file in a directory as colorized, fenced-code blocks -- with smart skip patterns, a live progress bar, and one-flag clipboard export. Built on
cli-atelier, runs on Node.js.
npm install -g lsallcpWhat it does
lsallcp walks a directory tree and prints every file it finds as a labeled, syntax-tagged code block:
src/index.ts:
<code>ts
console.log("hello")
</code>It's built for quickly dumping a project's source into a chat window, a doc, or a clipboard -- for code review, LLM prompts, documentation, or debugging -- without manually opening and copy-pasting dozens of files.
Features
| Feature | Description |
| ------------------------------------------------- | --------------------------------------------------------------------------- |
| Recursive listing | Walks the full directory tree from any starting path |
| Smart skip patterns | Skip by exact name, glob (*.png), or regex literal (/\.test\.ts$/i) |
| True recursive pruning | A matched directory is never descended into -- not just filtered afterward |
| Binary-safe | Detects binary files and shows a placeholder instead of dumping raw bytes |
| Live progress bar | Real-time progress while files are read, powered by cli-atelier |
| Colorized output | Paths, fences, and log messages are colored for readability |
| Clipboard export | -c / --copy copies plain-text results directly to your system clipboard |
| Zero runtime dependencies (besides cli-atelier) | Ships precompiled JavaScript -- no separate build step at install time |
| Cross-platform | Works in Windows Terminal, Git Bash, macOS Terminal, and Linux shells |
Requirements
| Dependency | Minimum version | Notes |
| ---------- | --------------- | ------------------------------------------------------- |
| Node.js | >= 18.0.0 | Runs the compiled CLI directly, no other runtime needed |
lsallcp is a pure Node.js package. TypeScript sources are compiled to plain JavaScript with tsc and published under dist/, so no Bun, ts-node, or extra runtime is required to use it.
Installation
npm install -g lsallcp
# or
pnpm add -g lsallcp
# or
yarn global add lsallcpTo use it inside a single project instead of globally:
npm install -D lsallcp
npx lsallcp .Usage
lsallcp <path> [skipPattern...] [--copy | -c]| Argument | Required | Description |
| -------------- | -------- | -------------------------------------------------------------- |
| <path> | Yes | Directory to scan, e.g. ., ./src, ../my-project |
| skipPattern | No | Zero or more names/globs/regexes to skip, recursively |
| --copy, -c | No | Copy plain-text output to the clipboard instead of printing it |
Flags can appear anywhere after the path -- order doesn't matter.
Basic examples
# List every file in the current directory
lsallcp .
# Skip an exact folder name (matched at any depth)
lsallcp . node_modules
# Skip multiple exact names at once
lsallcp . node_modules dist .env
# Skip by glob pattern
lsallcp . *.png *.lock
# Skip by regex literal (wrap in slashes, flags optional)
lsallcp . /\.test\.ts$/i
# Combine skip types freely
lsallcp . node_modules *.png /\.spec\.ts$/
# Copy the result to your clipboard instead of printing it
lsallcp . --copy
lsallcp . node_modules -cSkip patterns
Every skip argument is compiled into a matcher and checked against both the file/folder's basename and its relative path. A match on a directory prunes the entire subtree -- files inside are never even read.
| Pattern type | Syntax | Example | Matches |
| ------------- | ------------------- | --------------------- | ---------------------------------------- |
| Exact name | plain string | node_modules | Any file/folder named exactly this |
| Glob | contains * or ? | *.png, **/dist/** | Shell-style wildcard match |
| Regex literal | /pattern/flags | /\.test\.ts$/i | Full regular expression, flags supported |
Glob rules:
*matches any characters except/**matches any characters, including/?matches exactly one character (not/)
.git is always skipped automatically, regardless of the patterns you pass.
Clipboard export
Passing -c or --copy copies the full, ANSI-free plain-text result directly to your system clipboard and suppresses the normal terminal printout -- you'll only see the scan log, progress bar, and a final confirmation:
lsallcp . node_modules --copyℹ Target: /Users/<nolly>/projects/my-app
ℹ Skip patterns: node_modules
ℹ Clipboard: enabled (content will not be printed)
✔ Found 214 file(s) after skipping
✔ All files read
✔ Listed 214 file(s) from /Users/<nolly>/projects/my-app
✔ Result copied to clipboardClipboard support is zero-dependency and platform-native:
| Platform | Tool used |
| -------- | ------------------------------------------- |
| Windows | clip (built-in, also works from Git Bash) |
| macOS | pbcopy (built-in) |
| Linux | wl-copy → xclip → xsel, first found |
If none of these tools are available on Linux, lsallcp prints a warning and leaves the terminal output untouched.
Output format
Each file is rendered as:
<relativePath>: <code><extension> <file content> </code>
<relativePath>is colored cyan and bold, relative to the scanned root, using forward slashes on all platforms.<extension>is the file's extension without the leading dot (ts,json,md); extensionless files fall back totext.- Binary files render as a dimmed, italic
[binary file - content skipped]placeholder instead of raw bytes. - Unreadable files (permissions, broken symlinks, etc.) render a red
[unreadable: <reason>]placeholder instead of crashing the whole run.
Exit behavior
- Directory scanning never aborts on a single unreadable subdirectory -- it logs a warning and continues.
- If the target path doesn't exist or isn't a directory,
lsallcpexits with an error and a non-zero status code. - If no files remain after skip patterns are applied,
lsallcplogs a warning and exits cleanly.
How it works
lsallcp is a thin, purpose-built CLI in three stages, written in TypeScript and compiled to JavaScript via tsc (npm run build, wired to prepare so it's built automatically on install from source):
- Scan -- recursively walks the target directory (
src/scanner.ts), pruning any path matched by a compiled skip matcher (src/matcher.ts) before ever entering it. - Read -- reads each remaining file, detects binary content (
src/binary.ts), and formats it into a colorized fenced block (src/render.ts), updating a live progress bar as it goes. - Output -- either prints the assembled result to stdout, or strips ANSI codes and sends it to the system clipboard (
src/clipboard.ts) when-c/--copyis set.
All terminal UI -- headers, spinners, progress bars, logs, boxes -- comes from cli-atelier, a zero-dependency, pure-ANSI terminal framework.
License
Released under the WTFPL License.
