Name | repoGhost JSON |
Version |
0.1.6
JSON |
| download |
home_page | None |
Summary | CLI tool to summarize code in a repo. |
upload_time | 2025-01-28 22:19:26 |
maintainer | None |
docs_url | None |
author | George |
requires_python | >=3.8 |
license | MIT License
Copyright (c) 2025 <George Stander>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
openai
repo
summaries
cli
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 👻 repoGhost
`repoGhost` is a command-line tool to scan a local code repository, split files into chunks, and summarize each chunk using an LLM (e.g., GPT-4). Summaries are stored in `summaries.json`, and repeated runs skip unchanged files to save cost.
## Features
- **Hash-based caching**: Skips unchanged files (no repeated LLM calls).
- **Auto `.gitignore`**: Automatically adds the cache and summary files to `.gitignore` if found.
- **Clipboard**: Copies the last summary to your clipboard for easy reference.
- **Configurable chunk size**: Choose how many lines per chunk.
## Installation
```bash
pip install repoGhost
```
## Usage
```bash
repoGhost --repo_path /path/to/your/repo --lines_per_chunk 30
```
### Command-Line Arguments
- `--repo_path`: Path to the local repo (default `./my_repo`).
- `--lines_per_chunk`: Lines per chunk for summarizing (default `30`).
### Example
```bash
repoGhost --repo_path ./my_project --lines_per_chunk 50
```
This generates two files in the specified repo path:
- `hash_cache.json`: Contains file hashes and chunk summaries (used to skip unchanged files).
- `summaries.json`: Contains all chunk summaries (the final output).
The last chunk’s summary is copied to your clipboard automatically.
## Constants
In the code, the following constants can be modified to suit your needs:
```python
EXCLUDED_DIRS = {
"migrations",
"static",
"media",
"__pycache__",
".git",
"venv",
"node_modules",
}
EXCLUDED_EXTENSIONS = {
".pyc", ".css", ".scss", ".png", ".jpg", ".jpeg", ".svg", ".sqlite3"
}
EXCLUDED_FILES = {"manage.py", "wsgi.py", "asgi.py", "package-lock.json"}
VALID_EXTENSIONS = {".py", ".js", ".html", ".json"}
```
Feel free to **add or remove** items based on the files you want to skip or process.
## Customizing the Prompt & Model
Inside the script, the `summarize_chunk` function calls an OpenAI model:
```python
openai.ChatCompletion.create(
model="gpt-4o", # or your custom model name
messages=[
{"role": "user", "content": f"Please summarize this code chunk concisely:\n\n{chunk}"}
],
temperature=0.3,
max_tokens=150
)
```
You can **modify**:
- The `model` parameter (e.g., `gpt-3.5-turbo`, `gpt-4`, `gpt-4o-mini`, etc.).
- The prompt text (if you want a different style of summary).
- The `temperature` or `max_tokens` values.
## OpenAI API Key
You need an `OPENAI_API_KEY` set in your environment variables for the script to call OpenAI’s API. For instance:
```bash
export OPENAI_API_KEY="sk-1234..."
```
Then run:
```bash
repoGhost --repo_path /path/to/repo
```
## Requirements
See `requirements.txt`. Python 3.7+ recommended.
- `openai`
- `pyperclip`
- `rich`
## Development / Local Install
1. Clone this repo:
```bash
git clone https://github.com/georgestander/repoGhost.git
cd repoGhost
```
2. Install in editable mode:
```bash
pip install -e .
```
3. Verify the CLI is installed:
```bash
repoGhost --help
```
## License
MIT License.
Raw data
{
"_id": null,
"home_page": null,
"name": "repoGhost",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "openai, repo, summaries, cli",
"author": "George",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/30/56/6de61148ec8e29617e66b10d01c392d1ca43dbb671c58065f21412d3d9a3/repoghost-0.1.6.tar.gz",
"platform": null,
"description": "# \ud83d\udc7b repoGhost\n\n`repoGhost` is a command-line tool to scan a local code repository, split files into chunks, and summarize each chunk using an LLM (e.g., GPT-4). Summaries are stored in `summaries.json`, and repeated runs skip unchanged files to save cost.\n\n## Features\n\n- **Hash-based caching**: Skips unchanged files (no repeated LLM calls).\n- **Auto `.gitignore`**: Automatically adds the cache and summary files to `.gitignore` if found.\n- **Clipboard**: Copies the last summary to your clipboard for easy reference.\n- **Configurable chunk size**: Choose how many lines per chunk.\n\n## Installation\n\n```bash\npip install repoGhost\n```\n\n\n## Usage\n\n```bash\nrepoGhost --repo_path /path/to/your/repo --lines_per_chunk 30\n```\n\n### Command-Line Arguments\n- `--repo_path`: Path to the local repo (default `./my_repo`).\n- `--lines_per_chunk`: Lines per chunk for summarizing (default `30`).\n\n### Example\n\n```bash\nrepoGhost --repo_path ./my_project --lines_per_chunk 50\n```\n\nThis generates two files in the specified repo path:\n- `hash_cache.json`: Contains file hashes and chunk summaries (used to skip unchanged files).\n- `summaries.json`: Contains all chunk summaries (the final output).\n\nThe last chunk\u2019s summary is copied to your clipboard automatically.\n\n## Constants\n\nIn the code, the following constants can be modified to suit your needs:\n\n```python\nEXCLUDED_DIRS = {\n \"migrations\",\n \"static\",\n \"media\",\n \"__pycache__\",\n \".git\",\n \"venv\",\n \"node_modules\",\n}\nEXCLUDED_EXTENSIONS = {\n \".pyc\", \".css\", \".scss\", \".png\", \".jpg\", \".jpeg\", \".svg\", \".sqlite3\"\n}\nEXCLUDED_FILES = {\"manage.py\", \"wsgi.py\", \"asgi.py\", \"package-lock.json\"}\nVALID_EXTENSIONS = {\".py\", \".js\", \".html\", \".json\"}\n```\n\nFeel free to **add or remove** items based on the files you want to skip or process.\n\n## Customizing the Prompt & Model\n\nInside the script, the `summarize_chunk` function calls an OpenAI model:\n\n```python\nopenai.ChatCompletion.create(\n model=\"gpt-4o\", # or your custom model name\n messages=[\n {\"role\": \"user\", \"content\": f\"Please summarize this code chunk concisely:\\n\\n{chunk}\"}\n ],\n temperature=0.3,\n max_tokens=150\n)\n```\n\nYou can **modify**:\n- The `model` parameter (e.g., `gpt-3.5-turbo`, `gpt-4`, `gpt-4o-mini`, etc.).\n- The prompt text (if you want a different style of summary).\n- The `temperature` or `max_tokens` values.\n\n## OpenAI API Key\n\nYou need an `OPENAI_API_KEY` set in your environment variables for the script to call OpenAI\u2019s API. For instance:\n\n```bash\nexport OPENAI_API_KEY=\"sk-1234...\"\n```\n\nThen run:\n\n```bash\nrepoGhost --repo_path /path/to/repo\n```\n\n## Requirements\n\nSee `requirements.txt`. Python 3.7+ recommended.\n\n- `openai`\n- `pyperclip`\n- `rich`\n\n## Development / Local Install\n\n1. Clone this repo:\n ```bash\n git clone https://github.com/georgestander/repoGhost.git\n cd repoGhost\n ```\n2. Install in editable mode:\n ```bash\n pip install -e .\n ```\n3. Verify the CLI is installed:\n ```bash\n repoGhost --help\n ```\n\n## License\n\nMIT License.\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 <George Stander>\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "CLI tool to summarize code in a repo.",
"version": "0.1.6",
"project_urls": null,
"split_keywords": [
"openai",
" repo",
" summaries",
" cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "783faac95c229fe0af8265c0a06cbf256460c312964625c11ac37fdf5d07ee38",
"md5": "cc0c8b58d0d2a3fe8cd6b2172679f767",
"sha256": "3fb24addf66c041e19eabe9a97c767f1e0c1e8c4e367f3669680cb4808757f28"
},
"downloads": -1,
"filename": "repoGhost-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cc0c8b58d0d2a3fe8cd6b2172679f767",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7848,
"upload_time": "2025-01-28T22:19:24",
"upload_time_iso_8601": "2025-01-28T22:19:24.861466Z",
"url": "https://files.pythonhosted.org/packages/78/3f/aac95c229fe0af8265c0a06cbf256460c312964625c11ac37fdf5d07ee38/repoGhost-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "30566de61148ec8e29617e66b10d01c392d1ca43dbb671c58065f21412d3d9a3",
"md5": "73f0e862c69c0b9f470c79e8f098a065",
"sha256": "0e3c77c060c070f83175d24228024a798ac1de66e364deee5b4290f166ed600b"
},
"downloads": -1,
"filename": "repoghost-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "73f0e862c69c0b9f470c79e8f098a065",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6908,
"upload_time": "2025-01-28T22:19:26",
"upload_time_iso_8601": "2025-01-28T22:19:26.391582Z",
"url": "https://files.pythonhosted.org/packages/30/56/6de61148ec8e29617e66b10d01c392d1ca43dbb671c58065f21412d3d9a3/repoghost-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-28 22:19:26",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "repoghost"
}