A CLI tool to prepare your local files for Claude Projects by copying them to a single directory while respecting .gitignore
rules.
claude-files-demo.mp4
Claude Projects currently only supports uploading individual files, not directories. This tool helps by:
- Copying all your project files into a single
.claude-files
directory - Flattening the directory structure
- Handling filename conflicts intelligently
- Respecting
.gitignore
rules - Skipping unsupported file formats
- Adding source comments to track file origins
You can use the tool directly with npx without installing it:
# Basic usage
npx claude-files [directory]
# Show help
npx claude-files --help
# Ignore specific files or patterns (can be used multiple times)
npx claude-files --ignore "*.test.ts" "docs/**"
# or use the short form
npx claude-files -i "*.test.ts" "docs/**"
# Dry run - show what would be copied without copying
npx claude-files --dry-run
# Verbose output
npx claude-files --verbose
# Skip adding source comments
npx claude-files --no-comments
# Show version
npx claude-files --version
Alternatively, you can install it globally:
npm install -g claude-files
Then use it anywhere:
claude-files
# or
claude-files ./path/to/project
- Creates a
.claude-files
directory in your project - Copies all files while maintaining their readability
- Adds source path comments at the top of each file
- Flattens directory structure for easy upload
When duplicate filenames are found:
project/
src/
constants.ts
utils/
constants.ts
Becomes:
.claude-files/
constants.ts # from src/
utils_constants.ts # from src/utils/
Each file gets a comment header showing its original location:
// Source: src/utils/helpers.js
function helper() {
// ...
}
You can ignore files and directories in multiple ways:
- Using
.gitignore
(automatically respected) - Using
.claude-filesignore
(project-specific ignore rules) - Using command-line arguments with
--ignore
or-i
The ignore patterns follow the same syntax as .gitignore
. For example:
# .claude-filesignore
*.test.ts
docs/**
temp/
- Automatically respects your existing
.gitignore
rules - Adds
.claude-files/
to your.gitignore
if it exists - Uses default ignore patterns for common files
Automatically skips unsupported file formats:
- Images:
.png
,.jpg
,.jpeg
,.webp
- Videos:
.mp4
- Icons:
.ico
- Vector graphics:
.svg
Adds source comments using the correct syntax for each file type:
# Source: src/script.py
<!-- Source: src/index.html -->
/* Source: src/styles.css */
Besides your .gitignore
rules, the following are ignored by default:
node_modules/
.git/
dist/
build/
coverage/
.env
files- Log files
- Lock files (package-lock.json, yarn.lock, etc.)
- System files (.DS_Store, Thumbs.db)
MIT