{"id":26554045,"url":"https://github.com/deniskropp/gemini-repo-cli","last_synced_at":"2025-09-17T09:52:08.418Z","repository":{"id":283353158,"uuid":"951461433","full_name":"deniskropp/gemini-repo-cli","owner":"deniskropp","description":"Gemini CLI for repo-level operations","archived":false,"fork":false,"pushed_at":"2025-06-11T19:36:50.000Z","size":81,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-17T06:05:43.467Z","etag":null,"topics":["cli","code-generation","gemini-ai","genai","generated-content","generative-ai","repo-level"],"latest_commit_sha":null,"homepage":"","language":"Python","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/deniskropp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","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":"2025-03-19T18:02:24.000Z","updated_at":"2025-08-27T09:10:13.000Z","dependencies_parsed_at":"2025-05-03T03:33:10.858Z","dependency_job_id":null,"html_url":"https://github.com/deniskropp/gemini-repo-cli","commit_stats":null,"previous_names":["deniskropp/gemini-repo-cli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deniskropp/gemini-repo-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniskropp%2Fgemini-repo-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniskropp%2Fgemini-repo-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniskropp%2Fgemini-repo-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniskropp%2Fgemini-repo-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deniskropp","download_url":"https://codeload.github.com/deniskropp/gemini-repo-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deniskropp%2Fgemini-repo-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275572712,"owners_count":25489094,"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-09-17T02:00:09.119Z","response_time":84,"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":["cli","code-generation","gemini-ai","genai","generated-content","generative-ai","repo-level"],"created_at":"2025-03-22T09:39:56.048Z","updated_at":"2025-09-17T09:52:08.409Z","avatar_url":"https://github.com/deniskropp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gemini Repo CLI\n\nA command-line tool to generate content for a target file using Large Language Models (LLMs), leveraging existing repository files as context.  Currently supports Google Gemini and local Ollama models.\n\nDon't miss the [showcase](awesome-repo-cli.md)!\n\n## 🎉 What's New! 🎉\n\n* **Ollama Support!** You can now use local Ollama models for content generation. This allows for offline usage and greater control over your LLM.\n* **Improved Logging:** Structured JSON logging provides better debugging and monitoring capabilities.\n* **More Gemini Models:**  You can now specify different Gemini models, including the latest `gemini-2.0-flash`.\n\n## Features\n\n* Generates content based on a given prompt.\n* Uses specified files from a repository as context for content generation.\n* Supports specifying the LLM provider (Gemini or Ollama) and model to use.\n* Outputs generated content to the console or a file.\n* Uses structured JSON logging for better debugging and monitoring.\n\n## Getting Started\n\n### Prerequisites\n\n* Python 3.8 or higher\n* pip (Python package installer)\n* For Gemini: A Google Gemini API Key (from [Google AI Studio](https://makersuite.google.com/app/apikey))\n* For Ollama: A local installation of [Ollama](https://ollama.com/) and a compatible model pulled (e.g., `ollama pull qwen2.5-coder:1.5b`).\n\n### Installation\n\n1. **Clone the Repository:**\n\n    ```bash\n    gh repo clone deniskropp/gemini-repo-cli\n    cd gemini-repo-cli\n    ```\n\n2. **Install Dependencies:**\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n3. **Install the CLI tool:**\n\n    ```bash\n    pip install -e .\n    ```\n\n    *(Run this from the same directory where `setup.py` exists.)*\n\n### Configuration\n\n#### Gemini\n\n1. **Set the Gemini API Key:**\n\n    You **must** set your Google Gemini API key as an environment variable.\n\n    ```bash\n    export GEMINI_API_KEY=\"YOUR_GEMINI_API_KEY\"\n    ```\n\n    *(Replace `YOUR_GEMINI_API_KEY` with your actual API key.) You might want to add this line to your `.bashrc` or `.zshrc` file for persistence.*\n\n#### Ollama\n\n1. **Ensure Ollama is running:**\n\n    Start your local Ollama server.  The default host is `http://localhost:11434`.\n\n2. **Pull a model:**\n\n    Use the `ollama pull` command to download a model to your local machine. For example:\n\n    ```bash\n    ollama pull qwen2.5-coder:1.5b\n    ```\n\n## Usage\n\n```bash\ngemini-repo-cli \u003crepo_name\u003e \u003ctarget_file_name\u003e \u003cprompt\u003e [--provider \u003cprovider\u003e] [--files \u003cfile_path1\u003e \u003cfile_path2\u003e ...] [--output \u003coutput_file\u003e] [--gemini-api-key \u003capi_key\u003e] [--gemini-model \u003cmodel_name\u003e] [--ollama-model \u003cmodel_name\u003e] [--ollama-host \u003chost\u003e] [--debug]\n```\n\n### Arguments\n\n* `\u003crepo_name\u003e`: The name of the repository (used for context).\n* `\u003ctarget_file_name\u003e`: The name of the target file to generate.\n* `\u003cprompt\u003e`: The prompt to guide the content generation.\n\n### Options\n\n* `--provider \u003cprovider\u003e`: The LLM provider to use.  Choices are `gemini` (default) or `ollama`.\n* `--files \u003cfile_path1\u003e \u003cfile_path2\u003e ...`: A list of file paths to include in the prompt as context (space-separated).\n* `--output \u003coutput_file\u003e`: The path to the file where the generated content will be written. If not provided, output to stdout.\n* `--debug`: Enable debug logging.\n\n#### Gemini Options (used if `--provider=gemini`)\n\n* `--gemini-api-key \u003capi_key\u003e`: The Google Gemini API key. If not provided, it will be read from the `GEMINI_API_KEY` environment variable.\n* `--gemini-model \u003cmodel_name\u003e`: The name of the Gemini model to use. Defaults to `gemini-2.0-flash`.  Consider trying `gemini-1.5-pro-latest` for more advanced tasks!\n\n#### Ollama Options (used if `--provider=ollama`)\n\n* `--ollama-model \u003cmodel_name\u003e`: The name of the Ollama model to use. Defaults to `qwen2.5-coder:1.5b`.\n* `--ollama-host \u003chost\u003e`: The Ollama host URL (e.g., `http://localhost:11434`). If not provided, it will use the default or the `OLLAMA_HOST` environment variable.\n\n### Examples\n\n#### Gemini Examples\n\n1. **Generate content and print to stdout:**\n\n    ```bash\n    gemini-repo-cli my-project my_new_file.py \"Implement a function to calculate the factorial of a number.\" --files utils.py helper.py\n    ```\n\n2. **Generate content and write to a file:**\n\n    ```bash\n    gemini-repo-cli my-project my_new_file.py \"Implement a function to calculate the factorial of a number.\" --files utils.py helper.py --output factorial.py\n    ```\n\n3. **Specify the API key and model name:**\n\n    ```bash\n    gemini-repo-cli my-project my_new_file.py \"Implement a function to calculate the factorial of a number.\" --gemini-api-key YOUR_API_KEY --gemini-model gemini-1.5-pro-latest\n    ```\n\n#### Ollama Examples\n\n1. **Generate content using Ollama and print to stdout:**\n\n    ```bash\n    gemini-repo-cli my-project my_new_file.py \"Implement a function to calculate the factorial of a number.\" --provider ollama --files utils.py helper.py\n    ```\n\n2. **Specify the Ollama model:**\n\n    ```bash\n    gemini-repo-cli my-project my_new_file.py \"Implement a function to calculate the factorial of a number.\" --provider ollama --ollama-model codellama:34b --files utils.py\n    ```\n\n3. **Specify the Ollama host (if not the default):**\n\n    ```bash\n    gemini-repo-cli my-project my_new_file.py \"Implement a function to calculate the factorial of a number.\" --provider ollama --ollama-host http://my-ollama-server:11434 --files utils.py\n    ```\n\n## Troubleshooting\n\n* **Gemini API Key Issues:** Double-check that your `GEMINI_API_KEY` environment variable is correctly set and that the API key is valid.\n* **Ollama Connection Errors:** Ensure that your Ollama server is running and accessible at the specified host and port.  Verify that the model you are trying to use has been pulled.\n* **Context Issues:**  Make sure the file paths specified with `--files` are correct and that the files exist in your repository.\n* **General Errors:** Enable debug logging with the `--debug` flag for more detailed error messages.\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](docs/contributing.md) for guidelines.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeniskropp%2Fgemini-repo-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeniskropp%2Fgemini-repo-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeniskropp%2Fgemini-repo-cli/lists"}