copycodebase
v2.1.1
Published
A cross-platform CLI tool and library to read and copy project codebase to clipboard
Maintainers
Readme
copycodebase
A cross-platform CLI tool and library to read and copy your project codebase to the clipboard with ignore list support, large file detection, and detailed summary output.
Installation
pnpm add -g copycodebaseUsage
CLI
-** Copy entire project codebase (respecting ignore list)**:
copycodebase ./your-projectThis command reads the entire codebase of ./your-project, skipping files and folders specified in the ignore list (ignore-list.json). It detects large files (>10 MB) and prompts you whether to ignore them during copy. After completion, it copies all included files' content to clipboard and prints a clear summary showing which files were copied or ignored, presented in a tree structure.
- Interactive mode to update ignore list:
copycodebase ./your-project --ignoreThis launches an interactive prompt allowing you to select files and directories to ignore within the project. Large files are specially grouped with their sizes shown to aid your choice. Your selections are saved to ignore-list.json for persistent ignores.
Library Usage
You can also use this tool as a library in your Node.js projects:
const { getCodebase, interactiveIgnoreList } = require('copycodebase');
(async () => {
// Interactive mode to update ignore list
await interactiveIgnoreList('./your-project', './ignore-list.json');
// Get codebase content and stats
const { rootNode, stats } = await getCodebase(
'./your-project',
'./ignore-list.json',
);
console.log(JSON.stringify(rootNode, null, 2));
console.log(stats);
})();Features
- Ignore list support combining default common ignores (like
node_modules,.git) with your custom ignores. - Large file detection: prompts to ignore files larger than 10 MB when copying.
- Detailed summary: shows copied and ignored files with project tree structure and status icons.
- Clipboard integration: copies included files’ content for easy pasting.
- Integrated with Changesets for versioning and changelog automation.
Configuration
- .%changeset/config.json configures changelog generation, base branch, and publishing access.
- ESLint (.eslintrc.json) and Prettier (.prettierrc) help maintain consistent code style.
- .gitignore includes typical entries like
node_modulesand lock files. - ignore-list.json contains your custom ignores and merges internally with defaults.
Development
- Test with Jest (pnpm test).
- Lint with ESLint (pnpm run lint).
- Format with Prettier (pnpm run format).
- Use Changesets commands for versioning (pnpm run changeset, pnpm run version-packages).
- Publish recursively with
pnpm run publish-packages.
License
ISC
Additional Notes
- Ensure you run the CLI from the project root for correct relative path handling.
- Large files are detected and can be interactively excluded to avoid bloating your clipboard content.
- The summary printout helps you verify what was included or excluded in each run.
