Ailan-Pharo-Client

Details

Source
GitHub
Dialect
pharo (25% confidence)
Created
Nov. 30, 2025
Updated
Dec. 1, 2025

README excerpt

# Ailan Pharo Client

**Ailan Pharo Client** is a Pharo Smalltalk IDE plugin that integrates with an external AI Refactoring Agent. It extends the Calypso System Browser, allowing developers to right-click on any method and request an intelligent refactoring analysis from a local LLM-based agent.

## 🚀 Features

* **Seamless Integration:** Adds a "Send to Refactor Server" option to the standard Calypso method context menu.
* **Context Aware:** Captures the selected method's source code, selector, and class name.
* **Asynchronous Processing:** Sends HTTP requests in the background to avoid freezing the Pharo UI.
* **Instant Feedback:** Provides UI notifications (Growl/Alerts) for request status and errors.
* **Robust Networking:** Handles timeouts and connection errors gracefully.

## 🛠 Prerequisites

This client is the frontend for the Ailan Agentic System. You **must** have the backend server running for this plugin to work.

1.  **Pharo 10/11/12 Image**: [Download Pharo](https://pharo.org/download)
2.  **Refactor Agent Server**:
    * Repository: [kaggle-capstone-pharo-agent](https://github.com/bartom21/kaggle-capstone-pharo-agent)
    * Ensure the server is running on `http://localhost:8000`.

## 📦 Installation

### Option 1: Using Iceberg (Recommended for Development)
1.  Open **Iceberg** in your Pharo image.
2.  Add a new repository: `Clone from remote`.
3.  Paste the URL: `https://github.com/bartom21/Ailan-Pharo-Client.git`
4.  Double-click the repository.
5.  Right-click the `MyProject-Core` package (or your specific package name) and select **Load**.

### Option 2: Metacello (Script)
*Note: Ensure you have a Baseline created for the project. If not, use Option 1.*

```smalltalk
Metacello new
    baseline: 'AilanClient';
    repository: 'github://bartom21/Ailan-Pharo-Client:main/src';
    load.
```
## 📖 Usage

1.  **Start the Backend:** Ensure your python server is running (`uvicorn app.main:app --reload` or similar).
2.  **Open Pharo:** Open the System Browser (Calypto).
3.  **Select a Method:** Click on any method you wish to refactor in the method list pane.
4.  **Context Menu:** Right-click the selected method.
5.  **Execute:** Select **"Send to Refactor Server"**.
    * **Status:** You will see a notification: *"Refactor request scheduled..."*
    * **Success:** A notification will appear confirming the request was sent.
    * **Failure:** If the server is down or times out (60s), an alert window will pop up with the error details.

## 🏗 Architecture

This project uses the **Commander 2** design pattern standard in Pharo 9+:

* **`SendRefactorRequestCommand`**: The core command class inheriting from `SycMethodCommand`.
* **`ZnClient` (Zinc HTTP)**: Handles the HTTP communication with the REST API.
* **`STON`**: Handles JSON serialization/deserialization of the method metadata.

### Configuration
Currently, the endpoint is hardcoded to `http://localhost:8000/api/v1/refactor`.
To change this, modify the `SendRefactorRequestCommand >> sendRequestFor:` method in the Pharo image.

## 🤝 Contributing

Contributions are welcome! Please fork the repository and submit a Pull Request.

1.  Fork the Project
2.  Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3.  Commit your Changes via Iceberg
4.  Push to the Branch
5.  Open a Pull Request
← Back to results