{"id":26895895,"url":"https://github.com/magarcia/gitingest","last_synced_at":"2025-05-12T20:18:15.910Z","repository":{"id":276632906,"uuid":"929856515","full_name":"magarcia/gitingest","owner":"magarcia","description":"A CLI tool to turn any Git repository into a simple text digest of its codebase to feed on LLM","archived":false,"fork":false,"pushed_at":"2025-02-16T15:04:27.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T04:17:40.818Z","etag":null,"topics":["cli","git","llm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magarcia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2025-02-09T15:12:14.000Z","updated_at":"2025-02-16T15:04:30.000Z","dependencies_parsed_at":"2025-02-16T15:31:12.648Z","dependency_job_id":null,"html_url":"https://github.com/magarcia/gitingest","commit_stats":null,"previous_names":["magarcia/gitingest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magarcia%2Fgitingest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magarcia%2Fgitingest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magarcia%2Fgitingest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magarcia%2Fgitingest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magarcia","download_url":"https://codeload.github.com/magarcia/gitingest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246574849,"owners_count":20799221,"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":["cli","git","llm"],"created_at":"2025-04-01T02:59:00.943Z","updated_at":"2025-04-01T02:59:01.564Z","avatar_url":"https://github.com/magarcia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Ingest \n\n[![npm version](https://img.shields.io/npm/v/@magarcia/gitingest.svg)](https://npmjs.com/package/@magarcia/gitingest)\n[![npm downloads](https://img.shields.io/npm/dm/@magarcia/gitingest)](https://npmjs.com/package/@magarcia/gitingest)\n\nTurn any Git repository into a simple text digest of its codebase.\n\nThis is useful for feeding a codebase into any LLM.\n\nInspired by [gitingest.com](https://gitingest.com/)\n\n## Features\n\n- Extracts text content from all files in a git repository\n- Generates a tree structure of the repository\n- Respects `.gitignore` rules\n- Supports additional ignore patterns via `--ignore` flag\n- Automatically detects and skips binary files\n- Provides clear file separation in output\n- Supports multiple repository input formats:\n  - Local directory\n  - Git URLs (HTTPS and SSH)\n  - GitHub web URLs (with branch support)\n  - GitLab web URLs (with branch support)\n- Optional clipboard support\n- Built-in help with examples (`--help`)\n- Cross-platform support (Windows, macOS, Linux)\n- Written in TypeScript with full type safety\n\n## Requirements\n\n- Node.js \u003e= 12.0.0\n- Git installed and available in PATH\n\n## Installation\n\n```bash\nnpm install -g @magarcia/gitingest\n```\n\n## Usage\n\nOnce installed, the tool can be executed as `git ingest`.\n\n### Basic Usage\n\n```bash\n# Show help and available options\ngit ingest --help\n\n# Process current directory\ngit ingest\n\n# Process specific local directory\ngit ingest /path/to/repo\n\n# Copy output to clipboard instead of printing\ngit ingest -c\ngit ingest --copy\n\n# Ignore specific files or patterns\ngit ingest --ignore \"*.log\"\ngit ingest --ignore \"temp/*\" --ignore \"docs/*.md\"\n```\n\n### Remote Repositories\n\nThe tool supports various repository URL formats:\n\n```bash\n# GitHub URLs\ngit ingest https://github.com/username/repo\ngit ingest https://github.com/username/repo/tree/branch\n\n# GitLab URLs\ngit ingest https://gitlab.com/username/repo\ngit ingest https://gitlab.com/username/repo/-/tree/branch\n\n# Direct Git URLs\ngit ingest git@github.com:username/repo.git\ngit ingest https://github.com/username/repo.git\n\n# With ignore patterns\ngit ingest https://github.com/username/repo --ignore \"*.test.js\" --ignore \"dist/*\"\n```\n\nWhen using a remote repository URL:\n1. The repository is cloned to a temporary directory\n2. Content is extracted\n3. Temporary directory is automatically cleaned up\n\n### Ignore Patterns\n\nThe tool supports ignoring files and directories using glob patterns:\n\n```bash\n# Ignore all log files\ngit ingest --ignore \"*.log\"\n\n# Ignore multiple patterns\ngit ingest --ignore \"temp/*\" --ignore \"docs/*.md\"\n\n# Ignore test files in any directory\ngit ingest --ignore \"**/*.test.js\"\n```\n\nIgnore patterns:\n- Can be specified multiple times with `--ignore`\n- Use the same glob syntax as `.gitignore`\n- Are applied in addition to existing `.gitignore` rules\n- Affect both content extraction and tree structure\n\n### Output Format\n\nThe tool generates two main sections:\n1. Repository Tree Structure: A visual representation of the repository's file structure\n2. Repository Content: The actual content of text files\n\nExample output:\n```\nRepository Tree Structure:\n├── src\n│   ├── index.ts\n│   └── utils.ts\n├── package.json\n└── README.md\n\nRepository Content:\nFile: src/index.ts\n[content...]\n\nFile: src/utils.ts\n[content...]\n```\n\n## API\n\nThe package also exports functions that you can use in your own code:\n\n```typescript\nimport { extractRepositoryContent } from '@magarcia/gitingest';\n\n// Extract content from a local repository\nconst { content, tree } = extractRepositoryContent('/path/to/repo');\nconsole.log('Tree structure:', tree);\nconsole.log('Content:', content);\n```\n\n### Functions\n\n#### `extractRepositoryContent(repoPath: string): { content: string, tree: string }`\n\nExtracts text content and tree structure from a local git repository.\n\n- `repoPath`: Path to the local git repository\n- Returns an object with:\n  - `content`: Concatenated text content from all files\n  - `tree`: Visual tree structure of the repository\n\n## Development\n\nTo contribute to this project, please follow these steps:\n\n1.  Fork the repository.\n2.  Create a new branch for your feature or bug fix.\n3.  Make your changes.\n4.  Submit a pull request.\n\n### Prerequisites\n\n- Node.js (v14 or later)\n- npm or yarn\n\n### Setup\n\n1. Clone the repository\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n### Scripts\n\n- `npm run build` - Builds the TypeScript code\n- `npm run dev` - Runs the tool in development mode\n\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a new Pull Request\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagarcia%2Fgitingest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagarcia%2Fgitingest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagarcia%2Fgitingest/lists"}