NVR-Editor is a terminal-based Python code editor designed for efficient and streamlined development directly from the command line. This tools AST merging functionality is a python implementation of the AST merging methodology from the aiCoder project
- AI-Driven Refactoring: Leverages advanced Abstract Syntax Tree (AST) merging for seamless code integration and editing.
- Terminal-Based Interface: Operate entirely within the terminal, eliminating the need for external GUI-based editors.
- Plugin Support: Extend functionality through a flexible plugin system.
- Customizable Configuration: Adjust settings via a
config.json
file to tailor the editor to your preferences.
To use the granite3.1-dense model with Ollama, follow these steps:
Ensure that you have Ollama installed. If it's not already installed, download it from the Ollama website and follow the installation instructions for your platform.
Ollama provides a simple command-line interface to download and use models. To download the granite3.1-dense model:
-
Open your terminal.
-
Run the following command:
ollama pull granite3.1-dense
This command will fetch the granite3.1-dense model and prepare it for use.
To ensure the model is downloaded and available for use, run:
ollama list
This will display a list of models installed on your system. Ensure that granite3.1-dense is listed.
To test granite3.1-dense directly from Ollama, you can run:
ollama chat granite3.1-dense
This opens an interactive chat with the model to verify its capabilities.
- Visit the Ollama Documentation for detailed instructions and troubleshooting.
- Explore the granite3.1-dense GitHub Repository (if available) for technical details and model-specific configurations.
Unlike traditional editors that rely on line-by-line merging, which can introduce conflicts and inconsistencies:
- AST Merging understands the structure of your Python code, treating it as a logical tree rather than raw text.
- This means:
- Fewer Merge Conflicts: Changes are merged at the function or block level instead of arbitrary lines.
- Intelligent Refactoring: Automatically handles imports, function renaming, or structural changes.
- Semantic Awareness: Ensures code remains valid and functional after edits, even in complex scenarios.
-
Clone the Repository:
git clone https://github.com/Nissyyy04/NVR-Editor.git
-
Navigate to the Project Directory:
cd NVR-Editor
-
Install Dependencies:
Ensure you have Python installed, then install the required packages:
pip install -r requirements.txt
Run the main script to start the editor:
python main.py
Upon launch, NVR-Editor will load with the default configuration specified in config.json
.
Modify the config.json
file to customize editor settings.
Extend NVR-Editor's functionality by adding plugins to the Plugins
directory. Each plugin should be a Python script with a specific structure. Below is an example of a simple plugin:
Plugins/
└── test_plugin/
├── __init__.py
└── test_plugin.py
from textual.app import App
from textual.widgets import Label
class TestPlugin():
def __init__(self, app: App):
self.app = app
self.app.mount(Label("Hello from Test Plugin").set_styles("width: 100%; text-align: center;"))
- Create a new directory under
Plugins/
with your plugin name. - Add your plugin script inside the directory.
- Define the appropriate hooks like
on_startup()
andon_keypress()
to integrate with NVR-Editor.
NVR-Editor provides:
- Context-Aware Suggestions: Suggests improvements or fixes based on the code's purpose.
- Error Resolution: Identifies and proposes solutions for syntax or logical errors.
- Code Optimization: Recommends better practices and optimizations based on Pythonic principles.
The AI integrates seamlessly into your workflow:
- On-the-Fly Syntax Updates: Modify your code without worrying about structural integrity.
- AI-Driven Snippets: Insert pre-tested, contextually appropriate snippets for repetitive tasks.
This project is licensed under the Apache License 2.0.
For more details, visit the GitHub repository.