A CLI utility to generate prompts from project source code.
Project description
Anti-Cursor
Anti-Cursor is a Python CLI utility designed to generate Markdown prompts that provide a comprehensive overview of a project's source code. This tool is particularly useful for interacting with large language models (LLMs), such as GPT, by enabling them to reason about the structure and implementation of a project.
The generated prompt includes:
- A detailed file structure to help LLMs understand how the project is organized.
- The source code of each file, allowing LLMs to analyze and reason about the project's functionality.
This utility is ideal for tasks such as:
- Debugging or reviewing code with LLMs.
- Generating documentation for projects.
- Summarizing project structure and implementation.
Features
- Accepts either a local directory path or a GitHub repository URL as input.
- Generates a Markdown prompt with:
- A clear introduction to assist LLMs in understanding the context.
- A detailed, tree-like representation of the project's file structure.
- Code listings from individual source files (excluding files ignored by
.gitignore).
- Supports multiple output targets:
- Save the prompt to a file (
prompt.md). - Output the prompt directly to the terminal.
- Copy the prompt to the clipboard for easy sharing.
- Save the prompt to a file (
- Clean architecture with clear separation between CLI, core logic, and file parsing.
- Unit tests ensure proper functionality.
Installation
From Source
-
Clone the repository:
git clone https://github.com/Alexander-Ploskin/anti-cursor.git
-
Install dependencies:
sudo apt-get install xclip # Required for clipboard functionality on Linux pip install poetry poetry install
From PyPI
Install the package directly from PyPI:
pip install anti-cursor
Usage
Run the CLI tool using:
anti-cursor <source> [--target <target>]
Where <source> is either a local directory path or a GitHub repository URL, and <target> specifies where to save or display the generated prompt.
Target Options
The --target option allows you to specify where the generated prompt should go:
file: Save the prompt to a file namedprompt.md.terminal: Output the prompt directly in the terminal.clipboard: Copy the prompt to your system clipboard (default).
Examples
-
Generate a prompt from a local directory and output it to the terminal:
anti-cursor . --target terminal
-
Generate a prompt from a GitHub repository and copy it to the clipboard:
anti-cursor https://github.com/Alexander-Ploskin/anti-cursor --target clipboard
-
Generate a prompt from a local directory and save it to
prompt.md:anti-cursor ./my_project --target file
Example of Generated Prompt
Below is an example of what the generated Markdown prompt might look like:
## Project Source Code Prompt
Below is the source code of the considered project. The prompt begins with an organized view of the project's file structure, showing how the code is organized across directories and files. Following this overview, the complete source code for each file is provided, allowing for an in-depth understanding of the project's implementation.
### Project Structure
./
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml
└── src/
├── __init__.py
├── cli.py
├── project_parser.py
└── prompt_generator.py
### Source Code Files
#### README.md
#### src/cli.py
import click
from src.prompt_generator import generate_prompt...
...
This example demonstrates how Anti-Cursor organizes and presents both project structure and source code in an LLM-friendly format.
Contributing
Contributions are welcome! If you have suggestions or find issues, feel free to open an issue or submit a pull request on GitHub.
License
This project is licensed under the Apache License 2.0. See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anti_cursor-1.0.1.tar.gz.
File metadata
- Download URL: anti_cursor-1.0.1.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c240f0c93ab1755b23556179978d689d1250b1217766277d23f39d1a990780bf
|
|
| MD5 |
f7a95605c3f67d5406523c522f53b70d
|
|
| BLAKE2b-256 |
be1ca4e39f7d3e8f9c942e828f51a5dd915f0bc64feb5b12be1c4de38992b2fb
|
File details
Details for the file anti_cursor-1.0.1-py3-none-any.whl.
File metadata
- Download URL: anti_cursor-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27a4f39b8e2a59e15fef84f6af4bebf54b3d568ca03433572e56e40f766454a4
|
|
| MD5 |
9c04e46e8731291dc4b7a8f29622c2e2
|
|
| BLAKE2b-256 |
a9dc40c75e775190e6ef2d706fe2e3eda2b09f9c5231bf1a63241b3a43483082
|