{"id":19548992,"url":"https://github.com/ashwin-pc/merge_files","last_synced_at":"2025-06-19T05:36:54.096Z","repository":{"id":247567517,"uuid":"823096417","full_name":"ashwin-pc/merge_files","owner":"ashwin-pc","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-22T03:31:58.000Z","size":23,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T22:07:53.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashwin-pc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-02T12:17:48.000Z","updated_at":"2025-03-29T16:09:46.000Z","dependencies_parsed_at":"2025-04-26T20:42:15.816Z","dependency_job_id":null,"html_url":"https://github.com/ashwin-pc/merge_files","commit_stats":null,"previous_names":["ashwin-pc/merge_files"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ashwin-pc/merge_files","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwin-pc%2Fmerge_files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwin-pc%2Fmerge_files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwin-pc%2Fmerge_files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwin-pc%2Fmerge_files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashwin-pc","download_url":"https://codeload.github.com/ashwin-pc/merge_files/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwin-pc%2Fmerge_files/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260695612,"owners_count":23048115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T03:57:36.709Z","updated_at":"2025-06-19T05:36:49.083Z","avatar_url":"https://github.com/ashwin-pc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Combination Tool\n\n## Overview\n\nThe File Combination Tool is a Node.js script that combines multiple files from a specified directory (and its subdirectories) or a GitHub repository folder into a single output file. It supports various programming languages and file types, providing options to include or exclude specific files or directories, remove header comments, and output statistics about the largest files and folders processed.\n\n## Features\n\n- Combine multiple files into a single output file\n- Support for both local directories and GitHub repositories\n- Process specific files/folders or all files in the base directory/repository\n- Exclude files/folders based on patterns\n- Remove specified header patterns from files\n- Output statistics on the 20 largest files processed\n- Output statistics on the 10 largest root-level folders processed\n- Estimate the total number of tokens in the combined output\n- Colorized console output for improved readability\n\n## Installation\n\nYou can use this tool without installation via npx, or you can install it globally on your system.\n\n### Using npx (recommended)\n\nNo installation required. Simply run the tool using npx:\n\n```\nnpx file-combination-tool [options]\n```\n\n### Global Installation\n\nTo install the tool globally, run:\n\n```\nnpm install -g file-combination-tool\n```\n\nThen you can use it from anywhere:\n\n```\nfile-combination-tool [options]\n```\n\n### Local Installation\n\nIf you want to clone the repository and run it locally:\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/your-username/file-combination-tool.git\n   cd file-combination-tool\n   ```\n\n2. Install dependencies:\n   ```\n   npm install\n   ```\n\n3. Run the tool:\n   ```\n   node cli.js [options]\n   ```\n\n## Usage\n\n### Local Directory\n\nTo combine all supported files in the current directory:\n\n```\nnpx file-combination-tool\n```\n\nThis will create a file named `combined_[current-directory-name].txt` in the current directory.\n\n### GitHub Repository\n\nTo combine files from a GitHub repository:\n\n```\nnpx file-combination-tool --githubUrl https://github.com/username/repo/tree/branch/path/to/folder --githubToken YOUR_GITHUB_TOKEN\n```\n\nReplace `YOUR_GITHUB_TOKEN` with a valid GitHub Personal Access Token.\n\n\u003e The token is optional, but you do run the risk of running into rate limits without it.\n\n### Command-line Arguments\n\n```\nnpx file-combination-tool [options]\n```\n\nOptions (all are optional):\n- `--baseDir`, `-b`: Base directory to process files from (default: current directory)\n- `--githubUrl`, `-g`: GitHub URL to process files from\n- `--githubToken`, `-t`: GitHub Personal Access Token for authentication\n- `--include`, `-i`: Files or folders to include (comma-separated)\n- `--exclude`, `-e`: Patterns to exclude (comma-separated, default: 'node_modules/,venv/,.git/')\n- `--extensions`, `-x`: File extensions to process (comma-separated, default: .js,.ts,.jsx,.tsx,.py,.rb,.java,.c,.cpp,.cs,.php,.go,.rs,.swift,.kt,.md)\n- `--output`, `-o`: Output file name (default: combined_[baseDir-name].txt)\n- `--config`, `-c`: Path to config file (if using a config file instead of command-line args)\n\nExamples:\n\n1. Combine Python files:\n   ```\n   npx file-combination-tool --extensions .py\n   ```\n\n2. Combine Java and Kotlin files:\n   ```\n   npx file-combination-tool --extensions .java,.kt\n   ```\n\n3. Exclude additional patterns:\n   ```\n   npx file-combination-tool --exclude \"test/,*.spec.js\"\n   ```\n\n4. Specify output file:\n   ```\n   npx file-combination-tool --output combined-project.txt\n   ```\n\n5. Combine files from a different directory:\n   ```\n   npx file-combination-tool --baseDir ../another-project\n   ```\n\n### Config File\n\nFor more complex scenarios, you can use a config file:\n\n```\nnpx file-combination-tool --config path/to/your/config.json\n```\n\nConfig file structure:\n\n```json\n{\n  \"baseDir\": \"/path/to/your/base/directory\",\n  \"githubUrl\": \"https://github.com/username/repo/tree/branch/path/to/folder\",\n  \"githubToken\": \"YOUR_GITHUB_TOKEN\",\n  \"include\": [\"folder1\", \"folder2/file.py\"],\n  \"exclude\": [\"test/\", \"*.spec.py\"],\n  \"extensions\": [\".py\", \".pyx\"],\n  \"output\": \"combined_output.txt\",\n  \"headerPatterns\": [\n    \"#.*\",\n    \"'''[\\\\s\\\\S]*?'''\",\n    '\"\"\"[\\\\s\\\\S]*?\"\"\"'\n  ]\n}\n```\n\n## Supported Languages\n\nThe tool supports the following file extensions by default:\n.js, .ts, .jsx, .tsx, .py, .rb, .java, .c, .cpp, .cs, .php, .go, .rs, .swift, .kt, .md\n\nYou can specify additional file extensions using the `--extensions` option or in the config file.\n\n## Output\n\nThe script will generate:\n\n1. A combined file containing the content of all processed files.\n2. Colorized console output showing:\n   - Progress of file processing\n   - The 20 largest files processed (by size)\n   - The 10 largest root-level folders processed\n   - The estimated total number of tokens in the combined output\n\n## Limitations\n\n- The token counting is a simple estimate and may not match exactly with more sophisticated tokenization methods.\n- Header removal patterns are predefined for common languages. For other languages, you may need to specify custom patterns.\n- When using the GitHub functionality, be aware of API rate limits, especially for large repositories.\n\n## Contributing\n\nContributions to improve the tool are welcome. Please feel free to submit issues or pull requests on the project's repository.\n\n## License\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashwin-pc%2Fmerge_files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashwin-pc%2Fmerge_files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashwin-pc%2Fmerge_files/lists"}