Skip to content

Commit aa6ab2f

Browse files
committed
add agent.md file with initial content.
1 parent 7e511a3 commit aa6ab2f

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# AGENTS.md
2+
3+
## Purpose
4+
5+
This document outlines the architectural and development principles for contributors to the `plugin_loopstructural` QGIS plugin. The plugin provides a thin, modular interface to the `map2loop` and `LoopStructural` libraries, enabling geological modeling workflows within QGIS.
6+
7+
---
8+
9+
## Design Philosophy
10+
11+
### 🔹 Thin Interface Layer
12+
- The plugin **must not** reimplement or duplicate functionality from `map2loop` or `LoopStructural`.
13+
- All core logic and enhancements should be contributed upstream to the respective libraries.
14+
- The plugin should focus on **UI integration**, **data flow orchestration**, and **user interaction**.
15+
16+
### 🔹 Modularity
17+
- UI components (dialogs, panels, actions) live under the `loopstructural/gui/` package and should be encapsulated in their own classes.
18+
- Business logic and orchestration are located in `loopstructural/main/` and `loopstructural/toolbelt/` where adapters and services wrap external libraries.
19+
- Processing algorithms and QGIS provider integration are in `loopstructural/processing/` and should be isolated from UI code.
20+
- Avoid tight coupling between components. Use signals/slots or event-driven patterns where appropriate.
21+
22+
### 🔹 Object-Oriented Design
23+
- Use classes with clear responsibilities and interfaces.
24+
- Prefer composition over inheritance unless subclassing is semantically appropriate.
25+
- Encapsulate interactions with external libraries in dedicated adapter or service classes (e.g., `loopstructural.main.Map2LoopService`, `loopstructural.main.LoopStructuralRunner`).
26+
27+
---
28+
29+
## Development Guidelines
30+
31+
### ✅ Code Quality
32+
- All code must pass the repository's pre-commit checks (formatting, linting, import sorting).
33+
- Use type hints and docstrings for all public methods and classes.
34+
- Follow PEP8 and QGIS plugin development best practices.
35+
36+
### 🧪 Testing
37+
- All new code must include **unit tests** and, where applicable, **integration tests**.
38+
- Tests live under the `tests/` package and are runnable with `pytest`.
39+
- Mock external dependencies (`map2loop`, `LoopStructural`) in unit tests.
40+
41+
### 🧩 Current Plugin Structure
42+
43+
```
44+
plugin_loopstructural/
45+
├── loopstructural/ # plugin package
46+
│ ├── __init__.py
47+
│ ├── __about__.py
48+
│ ├── plugin_main.py # QGIS plugin entry and bootstrap
49+
│ ├── gui/ # UI dialogs, widgets, and panels
50+
│ ├── main/ # controllers, managers, adapters (service layer)
51+
│ ├── processing/ # QGIS processing provider and algorithms
52+
│ ├── toolbelt/ # utilities, env parsing, preferences, logging
53+
│ ├── resources/ # icons, translations, help files
54+
│ └── requirements.txt
55+
├── docs/
56+
├── requirements/
57+
├── tests/
58+
└── README.md
59+
```
60+
61+
Notes on mapping older concepts:
62+
- What used to be called `services/` and `controllers/` is implemented across `loopstructural/main/` and `loopstructural/toolbelt/`.
63+
- UI remains in `loopstructural/gui/` (dialogs, `.ui` files, widget classes).
64+
- Processing-specific code and QGIS provider live under `loopstructural/processing/`.
65+
66+
---
67+
68+
## Contribution Workflow
69+
70+
1. Fork the repository and create a feature branch.
71+
2. Implement changes following the design and code quality guidelines.
72+
3. Add or update tests under `tests/` and ensure they run with `pytest`.
73+
4. Run pre-commit hooks (e.g. `pre-commit run --all-files`) and ensure all checks pass.
74+
5. Submit a pull request with a clear description of the changes and rationale. Link to upstream libraries if behavior is moved upstream.
75+
76+
---
77+
78+
## Future Enhancements
79+
80+
- Support for asynchronous or background processing of long-running tasks (consider using QGIS background task framework).
81+
- Improved error handling and user feedback.
82+
- Internationalization (i18n) support and keeping `.ts`/.qm translation files in `loopstructural/resources/i18n/`.
83+
- Better separation of concerns between UI, processing algorithms and adapters to facilitate unit testing.
84+
85+
---
86+
87+
## Contact
88+
89+
For questions or contributions to the upstream libraries:
90+
- `map2loop`
91+
- `LoopStructural`
92+
93+
---

0 commit comments

Comments
 (0)