{"id":21164219,"url":"https://github.com/laiso/askrepo","last_synced_at":"2026-01-28T01:37:53.774Z","repository":{"id":260887891,"uuid":"882626210","full_name":"laiso/askrepo","owner":"laiso","description":"Source code reading with LLM.","archived":false,"fork":false,"pushed_at":"2025-05-30T12:34:32.000Z","size":94,"stargazers_count":221,"open_issues_count":3,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-25T10:53:10.482Z","etag":null,"topics":["codeanalyzer","gemini","llm"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/askrepo","language":"TypeScript","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/laiso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-11-03T10:21:53.000Z","updated_at":"2025-09-12T09:59:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"41059e72-72fa-4a7f-95f1-2ee17955deb4","html_url":"https://github.com/laiso/askrepo","commit_stats":null,"previous_names":["laiso/askrepo"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/laiso/askrepo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laiso%2Faskrepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laiso%2Faskrepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laiso%2Faskrepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laiso%2Faskrepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laiso","download_url":"https://codeload.github.com/laiso/askrepo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laiso%2Faskrepo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28831902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T23:29:49.665Z","status":"ssl_error","status_checked_at":"2026-01-27T23:25:58.379Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["codeanalyzer","gemini","llm"],"created_at":"2024-11-20T14:01:18.361Z","updated_at":"2026-01-28T01:37:53.770Z","avatar_url":"https://github.com/laiso.png","language":"TypeScript","funding_links":[],"categories":["A01_文本生成_文本对话"],"sub_categories":["大语言对话模型及数据"],"readme":"# askrepo - Source code reading with LLM\n\nThis program reads the content of Git-managed text files in a specified\ndirectory, sends it to the Google Gemini API, and provides answers to questions\nbased on the specified prompt. It supports streaming responses for real-time\nfeedback.\n\n## Usage\n\n```bash\n❯ askrepo --help\nUsage: askrepo [options] [base_path]\n\nArguments:\n  base_path                  Directory containing source code files\n\nOptions:\n  -p, --prompt \u003cTEXT\u003e        Question to ask about the source code [default: \"Explain the code in the files provided\"]\n  -m, --model \u003cTEXT\u003e         Google AI model to use [default: \"gemini-1.5-flash\"]\n  -a, --api-key \u003cTEXT\u003e       Google API key\n  -u, --base-url \u003cTEXT\u003e      API endpoint URL [default: \"https://generativelanguage.googleapis.com/v1beta/models/\"]\n  --stream                   Enable/disable streaming mode [default: true]\n  -v, --verbose              Enable verbose output\n  -h, --help                 Show help\n```\n\n## Installation\n\n### Using Deno\n\n#### Run directly without installation\n\n```bash\n# Run directly using Deno\nexport GOOGLE_API_KEY=\"YOUR_API_KEY\"\ndeno run -A jsr:@laiso/askrepo --prompt \"What is this code doing?\"  ../your-repo/src\n```\n\n#### Install globally\n\n```bash\n# Install globally using Deno\ndeno install -A --global jsr:@laiso/askrepo\n\n# Make sure $HOME/.deno/bin is in your PATH\nexport PATH=\"$HOME/.deno/bin:$PATH\"\n\n# Then run the command\nexport GOOGLE_API_KEY=\"YOUR_API_KEY\"\naskrepo --prompt \"What is the purpose of this code?\" ../your-repo/src\n```\n\n### Gemini API Key\n\nA Gemini API key is required to run this program. You can get it from:\n\nhttps://aistudio.google.com/app/apikey\n\n## Examples\n\n### Using Google Gemini API (default)\n\n```bash\nexport GOOGLE_API_KEY=\"YOUR_API_KEY\"\naskrepo --prompt \"What is the purpose of this code?\" ../your-repo/src\n\n# Using short options\naskrepo -p \"What is the purpose of this code?\" -m \"gemini-2.0-flash\" ../your-repo/src\n```\n\n### Using OpenAI API\n\n```bash\nexport OPENAI_API_KEY=\"YOUR_OPENAI_API_KEY\"\naskrepo --prompt \"What is the purpose of this code?\" \\\n  --model \"o3-mini\" \\\n  --base-url \"https://api.openai.com/v1/chat/completions\" \\\n  ../your-repo/src\n\n# Using short options\naskrepo -p \"What is the purpose of this code?\" \\\n  -m \"o3-mini\" \\\n  -u \"https://api.openai.com/v1/chat/completions\" \\\n  ../your-repo/src\n```\n\n## Development\n\n```bash\n# Run the project in development mode\ndeno run -A mod.ts --prompt \"Find bugs in this code\" ./src\n```\n\n## Run Tests\n\n```bash\n# Run tests\ndeno test\n```\n\n## Implementation Details\n\n### Git-managed File Tracking\n\nThe tool uses the `.gitignore` parser to determine which files to include:\n\n- Scans directories recursively while respecting `.gitignore` rules at each\n  level\n- Skips binary files, hidden files, and `node_modules` directories\n- Caches `.gitignore` rules to optimize performance\n\n### Binary File Detection\n\nFiles are identified as binary through two complementary methods:\n\n1. **Extension-based detection**: Checks if the file extension matches known\n   binary formats (jpg, png, etc.)\n2. **Content-based detection**:\n   - Looks for null bytes in the first 1024 bytes\n   - Identifies binary file signatures (magic numbers) for common formats like\n     JPEG, PNG, and GIF\n\n### File Content Processing\n\n- Reads text content from all non-binary tracked files\n- Double-escapes content to ensure proper JSON formatting\n- Combines file content into a tab-separated format with filename references\n\n### LLM Integration\n\n- Constructs a structured prompt that includes:\n  - File paths and their contents\n  - The user's question\n  - Instructions for the model to reference specific files in its response\n- Supports both Google's Generative AI models (Gemini) and OpenAI-compatible\n  APIs\n\n### Streaming Response Handling\n\n- Uses Deno's native fetch API with streaming support\n- Processes chunk-based responses in real-time\n- Parses SSE (Server-Sent Events) data format from the API\n- Handles both streamed and non-streamed responses\n\n### Command Line Interface\n\n- Built on Deno's standard library for parsing arguments\n- Provides sensible defaults for all options\n- Auto-detects API keys from environment variables\n- Supports both standard and shorthand options\n- Returns helpful error messages for invalid inputs\n\n## Features\n\n- Streaming support for real-time AI responses\n- Flexible API endpoint configuration\n- Improved response parsing for different formats\n- Support for both streaming and non-streaming modes\n- Default to the latest Gemini model (gemini-2.0-flash), but can be configured\n  to use other models\n- Support for OpenAI Compatible API\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaiso%2Faskrepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaiso%2Faskrepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaiso%2Faskrepo/lists"}