Codepromptforge

Latest version: v1.1.0

Safety actively analyzes 722460 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.1.0

New Features & Enhancements

🎉 Introducing the Optional Web Assistant Module

With this release, CodePromptForge now includes an optional web and cli assistant modules that enables a conversational agent to read and analyze your code. This feature requires Ollama.

Example usage
bash
codepromptforge cli_assistant --base-dir=ModelRegistry --model=llama3.2:3b-instruct-fp16


Example usage
bash
codepromptforge web_assistant --base-dir=ModelRegistry --model=llama3.2:3b-instruct-fp16

0.0.2

✅ **Assistant Registry**:
- A centralized **registry** (`AssistantRegistry`) to manage and retrieve AI assistants dynamically.
- Easily list, register, and fetch assistants by name.

✅ **Modular Assistant Design**:
- Each assistant is implemented in a separate file, making it modular and extensible.
- Only **LLM dependencies** are required, keeping it lightweight.

✅ **Prebuilt `react_assistant`**:
- Uses **LangGraph's ReAct** framework to analyze and modify code intelligently.
- Comes with predefined tools from **CodePromptForge** to interact with the file system.

📦 **How to Install the Assistant Module**
By default, the assistant module is **not installed**. To enable it, use:
bash
pip install codepromptforge[assistant]


🛠 **Example Usage**
python
from codepromptforge.assistant import AssistantRegistry

List available assistants
print(AssistantRegistry.list_assistants())
Expected output: ['react_assistant']

from langchain_ollama import ChatOllama

Initialize an LLM
llm = ChatOllama(
model="qwen2.5:14b",
temperature=0,
num_ctx=80000,
num_gpu=1,
)

Retrieve and use the assistant
agent = AssistantRegistry.get_assistant('react_assistant', llm)

def print_stream(stream):
for s in stream:
message = s["messages"][-1]
if isinstance(message, tuple):
print(message)
else:
message.pretty_print()

Provide a query for the assistant
inputs = {
"messages": [("user", "This is my package named CodePromptForge. Your job is to describe what needs to be modified to improve the current code")]
}

print_stream(agent.stream(inputs, stream_mode="values"))


🚀 **Why Use the Assistant Module?**
- 🧠 **Intelligent Code Analysis**: Automatically reviews and improves code.
- 🔍 **Deep File System Integration**: Uses `CodePromptForge` tools to read/write files.
- ⚡ **Customizable & Extendable**: Register custom assistants with **AssistantRegistry**.

---

🛠 **Other Improvements**
- **Refactored Code Structure**: Improved modularity for better extensibility.
- **Enhanced CLI Error Handling**: More descriptive error messages.
- **Bug Fixes & Stability Improvements**: Ensuring seamless tool execution.

---

🚀 **Upgrade Now!** 🚀
bash
pip install --upgrade codepromptforge

or, to enable assistants:
bash
pip install --upgrade codepromptforge[assistant]


Enjoy the new **AI-powered** CodePromptForge experience! 🎉

0.0.1

🎉 New Features & Enhancements
We are excited to announce the **first stable release** of **CodePromptForge (v0.0.1)**! This release includes significant improvements in tooling, CLI capabilities, and code organization.

---

🔹 Key Features

1️⃣ Added LangChain-Compatible Tools
We've introduced a method to **retrieve tools** dynamically, allowing seamless integration with LangChain. The following tools are now available:

- `get_directory_tree(folder_path)`: Retrieve all files in a given folder (excluding ignored ones).
- `get_file_content(file_path)`: Read a file's content.
- `get_files_in_folder(folder_path)`: List all files in a directory.
- `get_files_recursively(folder_path)`: Retrieve all files within a directory and its subdirectories.
- `find_files(extensions)`: Find all files matching specific extensions.
- `write_file(file_path, content)`: Write or overwrite a file.
- `clean_result_folder(excluded_files)`: Remove unnecessary files from `.result/`.
- `forge_prompt(extensions)`: Generate a combined prompt from selected files.

This enables **AI-assisted code analysis, refactoring, and generation** using the latest LangChain ecosystem.

---

2️⃣ Improved `.gitignore` Handling
- **Automatic detection of `.gitignore` files**: CodePromptForge now respects `.gitignore`, **excluding ignored files** from results.
- **Explicit exclusion support**: Users can still specify files/folders to exclude manually.
- **Prevents accidental inclusion of `.git/` and other unwanted files**.

---

3️⃣ Enhanced CLI Experience
The CLI has been **expanded and improved** with:
- Support for **newly added tools** (e.g., recursive file retrieval, prompt generation).
- **More robust error handling** for missing arguments or invalid directories.
- **Better feedback & structured JSON outputs** where applicable.

🔹 Example Usage:
sh
codepromptforge tree --folder .
codepromptforge file --file main.py
codepromptforge combine --extensions py --output-file merged.txt


---

4️⃣ Code & Architecture Improvements
- **Refactored `CodePromptForge`** to improve maintainability and extensibility.
- **Optimized file operations**, ensuring **faster lookups and safer writes**.
- **Refactored test suite** for **better coverage & reliability**.

---

🐛 Bug Fixes & Stability Improvements
- Fixed **incorrect file inclusion** when generating directory trees.
- Ensured `.result/` cleanup only removes **specified** files.
- CLI now **gracefully handles missing arguments** with clear error messages.
- Fixed a **PathSpec compatibility issue** when loading `.gitignore`.

---

🔮 Future Plans
We are actively working on:
✅ **LangChain integration examples**
✅ **Support for additional file types**
✅ **More AI-driven code review features**

---

🎯 How to Upgrade
To install or upgrade to **v0.0.1**, run:
sh
pip install --upgrade codepromptforge

Or, if using the source:
sh
git pull origin main
pip install -e .


---

💡 Contribute & Feedback
We’d love your feedback! Report issues, suggest improvements, or contribute at:
🔗 [**GitHub Repo**](https://github.com/RobinsonGarcia/CodePromptForge)

Thank you for being part of **CodePromptForge** 🚀✨

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.