Metadata-Version: 2.5
Name: aa-doctrinehub
Version: 1.0.4
Summary: Doctrines, fittings and member compliance for Alliance Auth
Author: Maddog Broekman
License: MIT License
        
        Copyright (c) 2026 Machiel Broekman
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: aa_doctrinehub,allianceauth,doctrines,eveonline,fittings
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: <3.14,>=3.11
Requires-Dist: allianceauth>=5
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: requests>=2.31
Description-Content-Type: text/markdown

# AA Doctrine Hub

Doctrines, fittings and member compliance for [Alliance Auth](https://gitlab.com/allianceauth/allianceauth).
A modern successor to the community Fittings app.

## Features

- **Doctrines & Fittings Catalogue:** Doctrines with fittings, roles (DPS, logistics, tackle, ...), required or optional flags, and target counts; fittings keep full version history with author, timestamp, change note, and version diffs.
- **EFT & Multibuy:** EFT import and export, slot validation against hull limits, and multibuy text for single fits or full doctrines.
- **Doctrine Builder & Visibility Controls:** Create/edit local doctrines, categories, and fittings directly in the frontend **Doctrine Builder** tab, including per-category and per-fitting **Visible / Hidden** toggles (`is_available`) for Doctrine Hub views and category filter dropdowns, plus Auth-group restrictions (`visible_to_groups`).
- **External Auth Import:** Scrape doctrines, fittings, and categories from another Alliance Auth instance via **Settings → Import from External Auth** using a one-time `sessionid` cookie (never stored).
- **Eligibility & Compliance (ESI):** Own 4-hourly ESI sync (`CharacterSkillSnapshot`, `CharacterSkill`, `CharacterImplant`, `CharacterAsset` — no external plugins), per-character/account traffic lights, EVE skill plan export, coverage overview, and recursive `AND`/`OR`/`AT_LEAST` compliance rules with automatic or approval-based Auth group grants.
- **Hangars & SRP:** Check fitted doctrine ships in member hangars, push doctrine ship shortages to `aa-industry`, and compare SRP killmails against doctrine fits.
- **Modern SPA UI:** React 19 + Tailwind CSS v4 + shadcn/ui single-page app with installed version badge, following the active Alliance Auth light/dark theme.

## Installation

1. Install the package in your Auth virtual environment:

   ```bash
   pip install aa-doctrinehub
   ```

2. Add `"aa_doctrinehub"` to `INSTALLED_APPS` in `local.py`. Also add `"eveuniverse"` if it isn't already
   installed for another app — Doctrine Hub uses it when present to resolve ship/item names to type ids,
   icons and skill/slot data, and falls back to public ESI calls when it is not.

3. Add the periodic tasks to `local.py`:

   ```python
   CELERYBEAT_SCHEDULE["aa_doctrinehub_sync_character_snapshots"] = {
       "task": "aa_doctrinehub.tasks.sync_character_snapshots",
       "schedule": crontab(minute="0", hour="*/4"),
   }
   CELERYBEAT_SCHEDULE["aa_doctrinehub_evaluate_compliance_rules"] = {
       "task": "aa_doctrinehub.tasks.evaluate_compliance_rules",
       "schedule": crontab(minute="15", hour="*/4"),
   }
   ```

4. Run migrations and collect static files, then restart Auth and the Celery workers:

   ```bash
   python manage.py migrate
   python manage.py collectstatic --noinput
   ```

## Periodic tasks (CELERYBEAT_SCHEDULE)

| Name | Task | Schedule | What it does |
| --- | --- | --- | --- |
| `aa_doctrinehub_sync_character_snapshots` | `aa_doctrinehub.tasks.sync_character_snapshots` | every 4 hours | Syncs skills, implants, and assets from ESI for all linked characters (no external plugins). |
| `aa_doctrinehub_evaluate_compliance_rules` | `aa_doctrinehub.tasks.evaluate_compliance_rules` | every 4 hours | Evaluates active compliance rules across all account characters and applies automatic Auth group grants/revocations. |

## Permissions

| Permission | For |
| --- | --- |
| `aa_doctrinehub.basic_access` | Members: see doctrines, fittings, and Hangars & SRP |
| `aa_doctrinehub.manage_doctrines` | Doctrine managers: Doctrine Builder (local doctrines, category/fitting availability toggles), import fittings, External Auth import settings |
| `aa_doctrinehub.view_compliance` | FCs and leadership: coverage overview and member compliance status |
| `aa_doctrinehub.manage_rules` | Compliance rules, Discord notification config, and Auth group assignments |

## Settings

| Setting | Default | Description |
| --- | --- | --- |
| `DOCTRINEHUB_APP_NAME` | `"Doctrines"` | Name in the menu, page title, and SPA header |

Functional configuration (External Auth import, compliance rules, Discord notification settings, and category/fitting availability toggles) lives in the frontend UI (`Settings`, `Rules & Groups`, and `Doctrine Builder`), not in Django admin.

## Development

```bash
uv sync
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run mypy aa_doctrinehub
```

Frontend (React 19 + Vite + Tailwind v4 + shadcn/ui), output goes to `aa_doctrinehub/static/aa_doctrinehub/spa/`:

```bash
cd frontend && npm install && npm run build
```

On Windows with the workspace on Google Drive, use `frontend/build.ps1` (builds on a local disk).
