Переглянути джерело

Version 0.8.0: Dashboard complete with import/export, version endpoint

- Add __version__ = 0.8.0 to __init__.py
- Expose version in /health and / root endpoints
- Update README.md: full docs for dashboard, person schema, import/export format, env vars
- Update PROJECT.md: mark Phase 8 (Dashboard) as completed
- Update test_server.py to check version field in health response
Lukas Goldschmidt 1 місяць тому
батько
коміт
1a63f651e7
5 змінених файлів з 98 додано та 11 видалено
  1. 0 1
      PROJECT.md
  2. 88 8
      README.md
  3. 3 0
      src/astro_mcp/__init__.py
  4. 3 1
      src/astro_mcp/server.py
  5. 4 1
      tests/test_server.py

+ 0 - 1
PROJECT.md

@@ -151,5 +151,4 @@ services:
 - 102 tests passing
 
 ### Remaining
-- Phase 8: Dashboard (Jinja2 + vanilla JS for person management)
 - Phase 9: Final integration + docs

+ 88 - 8
README.md

@@ -4,6 +4,8 @@ MCP server for astrological chart calculations. Consumes `ephemeris-mcp:get_sky_
 via MCP-over-SSE client and exposes calculated astrological data (natal charts, transits,
 synastry, transit previews) as structured JSON tools.
 
+**Version: 0.8.0**
+
 ## Quick Start
 
 ```bash
@@ -23,6 +25,18 @@ docker compose up --build
 
 Health check: `GET http://localhost:7016/health`
 
+## Configuration (.env)
+
+| Variable | Default | Description |
+|---|---|---|
+| `ASTRO_HOST` | `0.0.0.0` | Bind address |
+| `ASTRO_PORT` | `7016` | Listen port |
+| `ASTRO_DATA_DIR` | `./data` | SQLite DB directory |
+| `ASTRO_LOG_DIR` | `./logs` | Log file directory |
+| `EPHEMERIS_MCP_URL` | `http://192.168.0.200:7015/mcp/sse` | Ephemeris MCP endpoint |
+| `GEONAMES_USERNAME` | *(empty)* | GeoNames username for birthplace autocomplete |
+| `DASHBOARD_24H_TIME` | `true` | Use 24h time format in forms (false = 12h with AM/PM) |
+
 ## MCP Endpoint
 
 SSE transport at `http://localhost:7016/mcp/sse`
@@ -34,12 +48,12 @@ SSE transport at `http://localhost:7016/mcp/sse`
 | Tool | Description |
 |---|---|
 | `get_planetary_positions` | Planetary positions with zodiac signs, degrees, retrograde flags |
-| `calculate_natal_chart` | Complete natal chart (planets, houses, aspects, angles). Params: birth_datetime, latitude, longitude |
-| `calculate_transit_chart` | Transit chart with natal-to-transit aspects. Params: birth_datetime, transit_datetime, latitude, longitude, transit_latitude, transit_longitude |
-| `calculate_synastry_chart` | Relationship chart for two people. Params: person1_datetime/lat/lon, person2_datetime/lat/lon |
-| `calculate_composite_chart` | Composite chart via midpoint method. Params: same as synastry |
-| `get_transit_preview` | Daily transit-to-natal aspect snapshot. Params: birth_datetime, latitude, longitude, start_date, end_date |
-| `person_manage` | CRUD for persons database (name, nickname, birthplace, birth_datetime, lat/lon, elevation) |
+| `calculate_natal_chart` | Complete natal chart (planets, houses, aspects, angles) |
+| `calculate_transit_chart` | Transit chart with natal-to-transit aspects |
+| `calculate_synastry_chart` | Relationship chart for two people |
+| `calculate_composite_chart` | Composite chart via midpoint method |
+| `get_transit_preview` | Daily transit-to-natal aspect snapshot with significance scoring |
+| `person_manage` | CRUD for persons database |
 | `list_house_systems` | List supported house systems |
 
 ### _byId tools (database-backed)
@@ -55,9 +69,37 @@ database) instead of raw birth data. All other optional parameters override the
 | `calculate_composite_chart_by_id` | Composite chart for person1_id + person2_id |
 | `get_transit_preview_by_id` | Transit preview by person_id + date range |
 
-### Person database
+## Person Database
+
+### Schema
+
+```sql
+CREATE TABLE persons (
+    id              TEXT PRIMARY KEY,
+    name            TEXT NOT NULL,
+    nickname        TEXT UNIQUE,
+    birth_datetime  TEXT NOT NULL,
+    latitude        REAL NOT NULL,
+    longitude       REAL NOT NULL,
+    elevation       REAL DEFAULT 0.0,
+    birthplace      TEXT,
+    alive           BOOLEAN DEFAULT 1,
+    private         BOOLEAN DEFAULT 0,
+    gender          TEXT,
+    description     TEXT,
+    notes           TEXT,
+    timezone        TEXT,
+    birth_time_known BOOLEAN DEFAULT 1,
+    created_at      TEXT NOT NULL,
+    updated_at      TEXT
+);
+```
+
+All columns added via non-destructive `ALTER TABLE` migrations.
 
-`person_manage` supports actions: `add`, `get` (by id or nickname), `list`, `update`, `delete`.
+### person_manage tool
+
+Supports actions: `add`, `get` (by id or nickname), `list`, `update`, `delete`.
 
 Example workflow:
 ```
@@ -73,3 +115,41 @@ calculate_transit_chart_by_id(person_id="abc12345", transit_datetime="2026-06-02
 ## Dashboard
 
 Person management dashboard at `http://localhost:7016/dashboard`
+
+### Features
+
+- **Person list** with name, nickname, birth date, location, gender, status badges
+- **Add/Edit form** with:
+  - Native date picker + time input (12h or 24h based on `DASHBOARD_24H_TIME`)
+  - Timezone select with 50+ IANA zones grouped by region
+  - Live UTC offset display (e.g. "UTC+01:00 (CEST)")
+  - GeoNames autocomplete for birthplace (requires `GEONAMES_USERNAME`) — auto-fills lat/lon/elevation/timezone
+- **Detail view** with all fields, notes, metadata
+- **Export** individual persons or all persons as JSON
+- **Import** persons from JSON file (single object or array)
+- **Delete** with confirmation dialog
+
+### Import/Export Format
+
+```json
+[
+  {
+    "name": "John Doe",
+    "nickname": "john",
+    "birth_datetime": "1990-05-15T08:30:00+02:00",
+    "birthplace": "Vienna, Austria",
+    "latitude": 48.2082,
+    "longitude": 16.3738,
+    "elevation": 171,
+    "alive": true,
+    "private": false,
+    "gender": "male",
+    "description": "A sample person",
+    "notes": "Some notes here",
+    "timezone": "Europe/Vienna",
+    "birth_time_known": true
+  }
+]
+```
+
+Required fields: `name`, `birth_datetime`, `latitude`, `longitude`. All others are optional.

+ 3 - 0
src/astro_mcp/__init__.py

@@ -0,0 +1,3 @@
+"""astro-mcp: MCP server for astrological chart calculations."""
+
+__version__ = "0.8.0"

+ 3 - 1
src/astro_mcp/server.py

@@ -10,6 +10,7 @@ from mcp.server.fastmcp import FastMCP
 from mcp.server.transport_security import TransportSecuritySettings
 
 from . import config
+from . import __version__
 
 logger = logging.getLogger("astro-mcp")
 
@@ -71,12 +72,13 @@ def create_app() -> FastAPI:
 
     @app.get("/health")
     def health() -> dict:
-        return {"ok": True, "server": "astro-mcp", "port": config.PORT}
+        return {"ok": True, "server": "astro-mcp", "version": __version__, "port": config.PORT}
 
     @app.get("/")
     def root() -> dict:
         return {
             "server": "astro-mcp",
+            "version": __version__,
             "status": "ready",
             "tools": _tool_names(),
             "mcp": {

+ 4 - 1
tests/test_server.py

@@ -10,7 +10,10 @@ def test_health_endpoint_smoke() -> None:
     res = client.get("/health")
     assert res.status_code == 200
     data = res.json()
-    assert data == {"ok": True, "server": "astro-mcp", "port": 7016}
+    assert data["ok"] is True
+    assert data["server"] == "astro-mcp"
+    assert data["port"] == 7016
+    assert "version" in data
 
 
 def test_root_lists_tools() -> None: