{"id":51033686,"url":"https://github.com/richie-rich90454/gitinspect","last_synced_at":"2026-06-22T03:01:48.282Z","repository":{"id":361336850,"uuid":"1252184375","full_name":"richie-rich90454/gitinspect","owner":"richie-rich90454","description":"A repository preview tool","archived":false,"fork":false,"pushed_at":"2026-05-30T07:21:59.000Z","size":98,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-30T08:08:54.034Z","etag":null,"topics":["agent","agentic-ai","ai","git","go","mcp","mcp-server","tools","vibe-coding"],"latest_commit_sha":null,"homepage":"https://richie-rich90454.github.io/gitinspect/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richie-rich90454.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","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},"funding":{"github":"richie-rich90454"}},"created_at":"2026-05-28T09:14:57.000Z","updated_at":"2026-05-30T07:22:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/richie-rich90454/gitinspect","commit_stats":null,"previous_names":["richie-rich90454/gitinspect"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/richie-rich90454/gitinspect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-rich90454%2Fgitinspect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-rich90454%2Fgitinspect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-rich90454%2Fgitinspect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-rich90454%2Fgitinspect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richie-rich90454","download_url":"https://codeload.github.com/richie-rich90454/gitinspect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-rich90454%2Fgitinspect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34632723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"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":["agent","agentic-ai","ai","git","go","mcp","mcp-server","tools","vibe-coding"],"created_at":"2026-06-22T03:01:45.875Z","updated_at":"2026-06-22T03:01:48.277Z","avatar_url":"https://github.com/richie-rich90454.png","language":"Go","funding_links":["https://github.com/sponsors/richie-rich90454"],"categories":[],"sub_categories":[],"readme":"# gitinspect\n\nA CLI tool (and optional HTTP/MCP server) that turns any Git repository — local path or remote URL — into a structured, token-efficient snapshot optimized for LLMs and AI agents. Works with any Git host using shallow clones.\n\n## Badges\n\n![Go Version](https://img.shields.io/github/go-mod/go-version/richie-rich90454/gitinspect)\n![License](https://img.shields.io/badge/license-Apache--2.0-blue)\n![Build Status](https://github.com/richie-rich90454/gitinspect/actions/workflows/ci.yml/badge.svg)\n![Release](https://img.shields.io/github/v/release/richie-rich90454/gitinspect)\n\n## Features\n\n### Token Budget Management\n\nEstimate tokens as `len(content)/4`. Sort files by priority. Stop when the budget is exceeded. Never waste context window space on irrelevant files.\n\n### AI Agent Ready (MCP)\n\nBuilt-in MCP server over stdio. Works with Claude, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible agent. Two tools: `inspect_repo` for full snapshots, `list_repo_files` for lightweight file listings.\n\n### Any Git Host\n\nGitHub, GitLab, Bitbucket, self-hosted — works with any Git repository. Remote repos use shallow clone (`--depth 1`) and are cached by commit hash.\n\n### Smart File Priority\n\nFiles are sorted by importance: README first, then entry points (`main.*`), then manifests (`go.mod`, `package.json`, etc.), then build files (`Makefile`, `Dockerfile`), then everything else.\n\n### Dependency Extraction\n\nAutomatically parse `go.mod`, `package.json`, `Cargo.toml`, `requirements.txt`, and `Gemfile` for dependency awareness.\n\n### Binary File Detection\n\nAutomatically skips binary files (images, executables, archives, fonts, etc.) and non-UTF-8 content. No garbled output.\n\n### Comment Stripping\n\nRemove single-line comments and blank lines based on file extension. Supports `//` (Go, C, JS, Java, Rust, etc.), `#` (Python, Shell, YAML, Ruby, etc.), `--` (SQL, Lua, Haskell), and `;` (Assembly).\n\n### Multiple Output Formats\n\nJSON (default), plain text, or YAML. Perfect for piping into LLMs, saving to files, or programmatic consumption.\n\n## Installation\n\n### Quick Install (macOS / Linux)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/richie-rich90454/gitinspect/main/install.sh | bash\n```\n\nOr with `wget`:\n\n```bash\nwget -qO- https://raw.githubusercontent.com/richie-rich90454/gitinspect/main/install.sh | bash\n```\n\n\u003e 💡 Set `INSTALL_DIR` to change the install location (default: `/usr/local/bin`):\n\u003e ```bash\n\u003e curl -fsSL ... | INSTALL_DIR=~/.local/bin bash\n\u003e ```\n\n### Homebrew (macOS / Linux)\n\n```bash\nbrew tap richie-rich90454/tap\nbrew install gitinspect\n```\n\n### Scoop (Windows)\n\n```bash\nscoop bucket add gitinspect https://github.com/richie-rich90454/scoop-bucket\nscoop install gitinspect\n```\n\n### Go Install\n\n```bash\ngo install github.com/richie-rich90454/gitinspect/cmd/gitinspect@latest\n```\n\n### Binary Download\n\nDownload the latest binary for your platform from the [Releases page](https://github.com/richie-rich90454/gitinspect/releases).\n\n### Debian / RPM / APK\n\n```bash\nsudo dpkg -i gitinspect_*_linux_amd64.deb\nsudo rpm -i gitinspect_*_linux_amd64.rpm\nsudo apk add gitinspect_*_linux_amd64.apk\n```\n\n## Usage\n\n### Commands\n\n```\ngitinspect inspect [flags] \u003crepo-path-or-url\u003e   Inspect a repository\ngitinspect serve [flags]                          Start HTTP server\ngitinspect mcp                                     Start MCP server (for AI agents)\ngitinspect version                                 Print version\n```\n\n### Local Repository\n\n```bash\ngitinspect inspect /path/to/repo\n```\n\n### Remote Repository\n\n```bash\ngitinspect inspect https://github.com/user/repo.git\n```\n\n### With Options\n\n```bash\ngitinspect inspect --format text --max-tokens 10000 --strip /path/to/repo\ngitinspect inspect --include \"**/*.go\" --exclude \"**/vendor/*\" .\n```\n\n### HTTP Server Mode\n\n```bash\ngitinspect serve --port 8080 --api-key my-secret-key --max-concurrent 8\n```\n\nThen send a POST request:\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer my-secret-key\" \\\n  -d '{\"repo\": \"https://github.com/user/repo.git\", \"format\": \"json\"}' \\\n  http://localhost:8080/inspect\n```\n\nUse `--api-key` to require authentication on all requests. Use `--max-concurrent` to control how many remote fetches run in parallel (default: 4).\n\n## AI Agent Integration (MCP)\n\ngitinspect includes a built-in **Model Context Protocol (MCP)** server, making it directly invokable by AI coding agents.\n\n### Starting the MCP Server\n\n```bash\ngitinspect mcp\n```\n\nThis starts an MCP server over stdio — the standard transport for AI agent integration.\n\n### Configuring in AI Agents\n\nAdd to your agent's MCP config file:\n\n```json\n{\n  \"mcpServers\": {\n    \"gitinspect\": {\n      \"command\": \"gitinspect\",\n      \"args\": [\"mcp\"]\n    }\n  }\n}\n```\n\nWorks with Claude Desktop, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible agent.\n\n### MCP Tools\n\n**`inspect_repo`** — Inspect a Git repo and return a structured snapshot with file contents, dependencies, and stats. Supports `format`, `max_tokens`, `max_files`, `include`, `exclude`, `strip`, `no_cache` parameters.\n\n**`list_repo_files`** — List all files with priority scores and token estimates, without reading file contents. Useful for deciding which files to inspect before reading them.\n\n## CLI Flags\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `--format` | `json` | Output format: `json`, `text`, `yaml` |\n| `--max-tokens` | `6000` | Maximum token budget |\n| `--max-files` | `0` | Maximum number of files (0 = unlimited) |\n| `--include` | (none) | Include glob patterns (repeatable) |\n| `--exclude` | (none) | Exclude glob patterns (repeatable) |\n| `--strip` | `false` | Strip comments and blank lines |\n| `--no-cache` | `false` | Disable cache |\n| `--quiet` | `false` | Suppress progress output (for scripting) |\n| `--port` | `8080` | HTTP server port (serve command) |\n| `--api-key` | (none) | API key for HTTP server authentication |\n| `--max-concurrent` | `4` | Maximum concurrent remote fetches |\n\n## Output Examples\n\n### JSON (default)\n\n```bash\ngitinspect inspect --format json .\n```\n\n```json\n{\n  \"tree\": {\n    \"README.md\": \"# my-project\\nA cool project.\\n\",\n    \"main.go\": \"package main\\n\\nfunc main() {\\n\\tprintln(\\\"hello\\\")\\n}\\n\",\n    \"go.mod\": \"module github.com/user/project\\n\\ngo 1.25\\n\"\n  },\n  \"stats\": {\n    \"file_count\": 3,\n    \"total_bytes\": 120,\n    \"total_tokens\": 30,\n    \"truncated\": false\n  },\n  \"dependencies\": [\n    \"github.com/go-git/go-git/v5@v5.12.0\"\n  ],\n  \"version\": \"0.1.0\"\n}\n```\n\n### Text\n\n```bash\ngitinspect inspect --format text .\n```\n\n```\nFile: README.md\n---\n# my-project\nA cool project.\n\nFile: go.mod\n---\nmodule github.com/user/project\n\ngo 1.25\n\nFile: main.go\n---\npackage main\n\nfunc main() {\n        println(\"hello\")\n}\n```\n\n### YAML\n\n```bash\ngitinspect inspect --format yaml .\n```\n\n```yaml\ntree:\n  README.md: |\n    # my-project\n  go.mod: |\n    module github.com/user/project\n  main.go: |\n    package main\nstats:\n  file_count: 3\n  total_bytes: 120\n  total_tokens: 30\n  truncated: false\ndependencies:\n  - github.com/go-git/go-git/v5@v5.12.0\nversion: 0.1.0\n```\n\n## File Priority\n\nFiles are sorted by priority before inclusion. Higher-priority files are included first within the token budget:\n\n| Priority | Files |\n|----------|-------|\n| 4 (highest) | `README*` |\n| 3 | `main.*`, `cmd/*/main.*` |\n| 2 | `go.mod`, `package.json`, `Cargo.toml`, `setup.py`, `Gemfile`, `requirements.txt` |\n| 1 | `Makefile`, `Dockerfile`, `docker-compose.yml` |\n| 0 | All other files |\n\n## Token Budget\n\nTokens are estimated as `ceil(len(content) / 4)`. When the budget is exceeded:\n\n1. Files are added in priority order\n2. If a file would exceed the remaining budget, it is truncated (first 1000 + last 500 chars with a truncation marker)\n3. If a single file alone exceeds the entire budget, it is included but truncated\n4. `stats.truncated` is set to `true` in the output\n\n\u003e **Note:** If `--max-tokens` is 0 or negative, it defaults to 6000.\n\n## Dependency Extraction\n\nSupported manifest files:\n\n| File | Format | Example Output |\n|------|--------|----------------|\n| `go.mod` | Go modules | `github.com/go-git/go-git/v5@v5.12.0` |\n| `package.json` | Node.js | `react@^18.0.0` |\n| `Cargo.toml` | Rust | `serde@1.0` |\n| `requirements.txt` | Python | `flask==2.0` |\n| `Gemfile` | Ruby | `rails` |\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.\n\n## License\n\nApache License 2.0 — See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichie-rich90454%2Fgitinspect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichie-rich90454%2Fgitinspect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichie-rich90454%2Fgitinspect/lists"}