{"id":31433849,"url":"https://github.com/temrb/generate-project-context","last_synced_at":"2025-10-09T07:18:03.038Z","repository":{"id":316827794,"uuid":"1065011120","full_name":"temrb/generate-project-context","owner":"temrb","description":"A small, opinionated CLI tool that packages project source files into a single context file suitable for use with Large Language Models (LLMs). It auto-detects common project types, applies smart include/exclude filters, and can output text, Markdown, or JSON.","archived":false,"fork":false,"pushed_at":"2025-09-26T23:19:27.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-27T01:16:38.625Z","etag":null,"topics":["ai","llm","utility"],"latest_commit_sha":null,"homepage":"","language":"Python","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/temrb.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-26T23:04:41.000Z","updated_at":"2025-09-26T23:22:47.000Z","dependencies_parsed_at":"2025-09-28T14:33:14.375Z","dependency_job_id":null,"html_url":"https://github.com/temrb/generate-project-context","commit_stats":null,"previous_names":["temrb/generate-project-context"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/temrb/generate-project-context","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temrb%2Fgenerate-project-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temrb%2Fgenerate-project-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temrb%2Fgenerate-project-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temrb%2Fgenerate-project-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/temrb","download_url":"https://codeload.github.com/temrb/generate-project-context/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temrb%2Fgenerate-project-context/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000985,"owners_count":26082972,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ai","llm","utility"],"created_at":"2025-09-30T12:01:09.478Z","updated_at":"2025-10-09T07:18:03.021Z","avatar_url":"https://github.com/temrb.png","language":"Python","funding_links":[],"categories":["Code Analysis \u0026 Search"],"sub_categories":["Other IDEs"],"readme":"# AI Context Generator\n\n![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)\n![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)\n[![Version](https://img.shields.io/badge/version-5.0.0-brightgreen.svg)]()\n\nA small, opinionated CLI tool that packages project source files into a single context file suitable for use with Large Language Models (LLMs). It auto-detects common project types, applies smart include/exclude filters, and can output text, Markdown, or JSON.\n\n---\n\n## Quick overview\n\n- Scans your project files and writes a single, easy-to-read context file.\n- Keeps all generator tooling in `.context/` and writes outputs to `.context/generated/`.\n- Supports presets (Python, JavaScript, Go, Rust, etc.), custom include/exclude patterns, file-size limits, and experimental minification.\n\n---\n\n## Repo layout (convention)\n\n```\n\nyour-project/\n├── .context/\n│   ├── generate.py          # generator (downloaded or copied)\n│   ├── .ai-context.yml      # optional config\n│   └── generated/           # outputs (gitignored by installer)\n├── src/\n└── ...\n\n```\n\n## Install\n\nTwo simple options: copy the `.context` folder from the repo (recommended) or manually download the generator. Run from your **project root**:\n\n#### MacOS / Linux / WSL / Git Bash\n\n```bash\ngit clone --depth=1 https://github.com/temrb/generate-project-context.git tmp_repo \\\n  \u0026\u0026 rm -rf .context \\\n  \u0026\u0026 mv tmp_repo/.context ./ \\\n  \u0026\u0026 rm -rf tmp_repo \\\n  \u0026\u0026 chmod +x .context/generate.py || true\n```\n\n- `rm -rf .context` ensures any existing `.context` is replaced cleanly.\n- `chmod +x` may fail silently on filesystems that don’t support execute bits — you can always run with `python3 .context/generate.py`.\n\n#### Windows PowerShell\n\n```powershell\ngit clone --depth=1 https://github.com/temrb/generate-project-context.git tmp_repo\nRemove-Item -Recurse -Force .context -ErrorAction SilentlyContinue\nMove-Item tmp_repo/.context . -Force\nRemove-Item tmp_repo -Recurse -Force\n```\n\n- Existing `.context` is removed before copying to avoid merge/nesting issues.\n\nBoth commands copy the `.context` folder (including `generate.py`) into your project. PowerShell doesn’t require `chmod`, but if you later run the generator from a Unix-like shell you can add execute permissions with `chmod +x .context/generate.py`.\n\n**Tip:** Add generated outputs directory to `.gitignore` if not already ignored:\n\n```bash\necho \".context/generated/\" \u003e\u003e .gitignore\n```\n\n## Optional deps\n\n```bash\npip3 install pyyaml chardet tqdm\n```\n\n- `pyyaml` — read `.ai-context.yml` configs\n- `chardet` — improve encoding detection\n- `tqdm` — progress bars\n\nThe generator runs without them but with reduced functionality (you’ll see warnings).\n\n---\n\n## Usage\n\nFrom your project root:\n\n```bash\n# Basic (auto-detect project type)\npython3 .context/generate.py\n\n# Scan specific directories\npython3 .context/generate.py src/ tests/\n\n# Use a preset\npython3 .context/generate.py --preset python\n\n# Output markdown with a custom filename (placed in .context/generated/)\npython3 .context/generate.py --output api_docs.md --format markdown\n\n# Enable experimental minification\npython3 .context/generate.py --minify\n\n# Dry run (list files that would be processed)\npython3 .context/generate.py --dry-run --verbose\n```\n\n---\n\n## Configuration\n\nCreate `.context/.ai-context.yml` to pin reproducible runs:\n\n```yaml\npreset: python\npaths:\n  - src\n  - lib\noutput: context.md # written to .context/generated/\ninclude:\n  - '*.md'\n  - 'Dockerfile'\nexclude:\n  - '*_test.py'\n  - 'experiments/*'\nmax_file_size_mb: 2\nformat: markdown # text, markdown, json\nminify: false\nverbose: false\n```\n\n**Priority:** CLI options \u003e config file \u003e presets \u003e built-in defaults\n\n---\n\n## CLI flags (summary)\n\n- `paths` — directories/files to scan (default: project root)\n- `-o, --output` — output filename (default: `.context/generated/context.txt`)\n- `--preset` — project preset (auto | python | javascript | java | go | rust | ...)\n- `--include` / `--exclude` — glob patterns\n- `--max-file-size-mb` — skip large files (default: 1 MB)\n- `--format` — `text` | `markdown` | `json`\n- `--minify` — experimental comment/whitespace removal\n- `--dry-run` — list files without generating\n- `-v, --verbose` — verbose logging\n- `--version` — show version\n\n---\n\n## Output formats\n\n- **Text**: plain, human-readable sections with file separators.\n- **Markdown**: syntax-highlighted fenced code blocks per file.\n- **JSON**: `metadata` + `files[]` with `path`, `size`, `encoding`, `content`.\n\nOutputs are placed in `.context/generated/` by default.\n\n---\n\n## Behavior notes \u0026 edge cases\n\n- Skips common binary extensions (images, archives, compiled artifacts).\n- Encoding attempts: UTF-8 → chardet (if installed) → latin-1.\n- Skips empty/whitespace-only files.\n- Always excludes `.context/` (self-exclusion).\n- Minification is experimental — use with caution for production code review.\n\n---\n\n## Troubleshooting\n\n- **Config present but not loaded**\n\n  ```text\n  Warning: Config file .context/.ai-context.yml exists but PyYAML is not installed\n  ```\n\n  Fix: `pip install pyyaml`\n\n- **Garbled text in output**\n  Fix: `pip install chardet`\n\n- **No progress bar**\n  Fix: `pip install tqdm`\n\n- **Output missing expected files**\n\n  - Ensure include/exclude patterns are correct and relative to the project root.\n  - Check `--max-file-size-mb` (defaults to 1 MB).\n\n---\n\n## Contributing\n\nPRs welcome. Ideas:\n\n- More accurate language-specific minifiers\n- Additional presets and smarter detection\n- Improved binary detection and performance tweaks\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftemrb%2Fgenerate-project-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftemrb%2Fgenerate-project-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftemrb%2Fgenerate-project-context/lists"}