Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,19 @@
"Agent(*)",
"Skill(*)"
]
},
"hooks": {
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash tools/nlm/auto-query.sh",
"timeout": 10
}
]
}
]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data/

# ── Generated outputs ──
output/
exports/
*.pdf
*.log
/tmp/
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.3
3.12.10
Binary file added DaivAI_Phase1_Deep_Audit_Report.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: help install test lint typecheck format audit all clean run backup backup-gdrive backup-setup

PYTHON ?= python3
UV ?= uv
PYTHON ?= $(UV) run python3

help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
Expand Down
4 changes: 2 additions & 2 deletions apps/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "daivai"
name = "daivai-apps"
version = "1.0.0"
description = "AI-powered Vedic astrology — CLI, Web, and Telegram."
requires-python = ">=3.12"
Expand All @@ -23,7 +23,7 @@ web = [
"sqlmodel>=0.0.22",
]
telegram = ["python-telegram-bot>=21.0"]
all = ["daivai[web,telegram]"]
all = ["daivai-apps[web,telegram]"]

[project.scripts]
daivai = "daivai_app.cli.main:cli"
Expand Down
3 changes: 2 additions & 1 deletion apps/src/daivai_app/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging
import sys
from typing import cast

import click
from rich.console import Console
Expand Down Expand Up @@ -34,7 +35,7 @@ def _load_chart_from_args(
console.print(f"[red]Chart file not found: {chart}[/red]")
sys.exit(1)
data = json.loads(path.read_text())
return ChartData.model_validate(data)
return cast(ChartData, ChartData.model_validate(data))

if not all([name, dob, tob]):
console.print("[red]Provide --name, --dob, --tob (and --place or --chart)[/red]")
Expand Down
4 changes: 2 additions & 2 deletions apps/src/daivai_app/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import time
from datetime import datetime, timedelta
from pathlib import Path
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, cast
from zoneinfo import ZoneInfo


Expand Down Expand Up @@ -40,7 +40,7 @@ def _load_chart(chart_path: str = "charts/manish.json") -> ChartData | None:
if not path.exists():
logger.error("Chart not found: %s", path)
return None
return ChartData.model_validate_json(path.read_text())
return cast("ChartData", ChartData.model_validate_json(path.read_text()))


def _send_telegram_message(token: str, chat_id: str, message: str) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions apps/src/daivai_app/telegram/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import logging
from pathlib import Path
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, cast


if TYPE_CHECKING:
Expand Down Expand Up @@ -58,7 +58,7 @@ def _load_chart(chart_path: str | None = None) -> ChartData | None:
if not path.exists():
return None

return ChartData.model_validate_json(path.read_text())
return cast("ChartData", ChartData.model_validate_json(path.read_text()))


async def handle_start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
Expand Down
4 changes: 2 additions & 2 deletions apps/src/daivai_app/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ async def auth_required_handler(request: Request, exc: _AuthRequiredError) -> Re
@app.exception_handler(404)
async def not_found(request: Request, exc: Exception) -> Response:
return templates.TemplateResponse(
"error.html", {"request": request, "code": 404}, status_code=404
request, "error.html", context={"code": 404}, status_code=404
)

@app.exception_handler(500)
async def server_error(request: Request, exc: Exception) -> Response:
logger.exception("Internal server error: %s", exc)
return templates.TemplateResponse(
"error.html", {"request": request, "code": 500}, status_code=500
request, "error.html", context={"code": 500}, status_code=500
)

# ── Register routes ──
Expand Down
14 changes: 7 additions & 7 deletions apps/src/daivai_app/web/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import os
from datetime import datetime
from pathlib import Path
from typing import Any
from typing import Any, cast

from sqlmodel import Field, Session, SQLModel, create_engine, select


class User(SQLModel, table=True):
class User(SQLModel, table=True): # type: ignore[call-arg]
"""Google OAuth user."""

id: int | None = Field(default=None, primary_key=True)
Expand All @@ -27,7 +27,7 @@ class User(SQLModel, table=True):
last_login: datetime = Field(default_factory=datetime.now)


class Client(SQLModel, table=True):
class Client(SQLModel, table=True): # type: ignore[call-arg]
"""A person whose chart has been computed."""

id: int | None = Field(default=None, primary_key=True)
Expand All @@ -45,7 +45,7 @@ class Client(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.now)


class DailyCache(SQLModel, table=True):
class DailyCache(SQLModel, table=True): # type: ignore[call-arg]
"""Cached daily guidance to avoid recomputation."""

id: int | None = Field(default=None, primary_key=True)
Expand Down Expand Up @@ -98,7 +98,7 @@ def get_or_create_user(
session.add(user)
session.commit()
session.refresh(user)
return user
return cast(User, user)

user = User(
google_id=google_id,
Expand All @@ -119,7 +119,7 @@ def get_or_create_user(
def get_user_by_id(user_id: int) -> User | None:
"""Fetch a user by primary key."""
with get_session() as session:
return session.get(User, user_id)
return cast(User | None, session.get(User, user_id))


# ── Client CRUD ──────────────────────────────────────────────────────────
Expand Down Expand Up @@ -158,7 +158,7 @@ def create_client(
def get_client(client_id: int) -> Client | None:
"""Fetch a client by ID."""
with get_session() as session:
return session.get(Client, client_id)
return cast(Client | None, session.get(Client, client_id))


def get_clients_for_user(user_id: int) -> list[Client]:
Expand Down
12 changes: 6 additions & 6 deletions apps/src/daivai_app/web/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async def home(request: Request) -> Response:
return RedirectResponse(url="/dashboard", status_code=302)
error = request.query_params.get("error", "")
return templates.TemplateResponse(
request,
"login.html",
{
"request": request,
context={
"error": error,
},
)
Expand All @@ -69,9 +69,9 @@ async def dashboard(request: Request) -> Response:
}
)
return templates.TemplateResponse(
request,
"dashboard.html",
{
"request": request,
context={
"user": user,
"clients": client_data,
},
Expand All @@ -82,9 +82,9 @@ async def new_client_form(request: Request) -> Response:
"""Show the birth data input form."""
user = require_auth(request)
return templates.TemplateResponse(
request,
"input_form.html",
{
"request": request,
context={
"user": user,
},
)
Expand Down
20 changes: 10 additions & 10 deletions apps/src/daivai_app/web/routes_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ async def client_overview(request: Request, client_id: int) -> Response:
ctx = build_chart_context(chart_data)

return templates.TemplateResponse(
request,
"overview.html",
{
"request": request,
context={
"user": user,
"client": client,
"chart": chart_data,
Expand All @@ -70,9 +70,9 @@ async def dasha_page(request: Request, client_id: int) -> Response:
ctx = build_chart_context(chart_data)

return templates.TemplateResponse(
request,
"dasha.html",
{
"request": request,
context={
"user": user,
"client": client,
"chart": chart_data,
Expand All @@ -92,9 +92,9 @@ async def ratna_page(request: Request, client_id: int) -> Response:
ctx = build_chart_context(chart_data)

return templates.TemplateResponse(
request,
"ratna.html",
{
"request": request,
context={
"user": user,
"client": client,
"chart": chart_data,
Expand Down Expand Up @@ -155,9 +155,9 @@ async def daily_page(request: Request, client_id: int) -> Response:
suggestion = compute_daily_suggestion(chart)

return templates.TemplateResponse(
request,
"daily.html",
{
"request": request,
context={
"user": user,
"client": client,
"chart": chart_data,
Expand Down Expand Up @@ -187,9 +187,9 @@ async def navamsha_page(request: Request, client_id: int) -> Response:
vargottam = get_vargottam_planets(chart)

return templates.TemplateResponse(
request,
"navamsha.html",
{
"request": request,
context={
"user": user,
"client": client,
"chart": chart_data,
Expand Down
16 changes: 8 additions & 8 deletions apps/src/daivai_app/web/routes_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ async def match_form(request: Request) -> Response:
"""Show the two-person compatibility form."""
user = require_auth(request)
return templates.TemplateResponse(
request,
"match_form.html",
{
"request": request,
context={
"user": user,
},
)
Expand Down Expand Up @@ -94,9 +94,9 @@ async def match_result(
)

return templates.TemplateResponse(
request,
"match_result.html",
{
"request": request,
context={
"user": user,
"name1": name1,
"name2": name2,
Expand All @@ -111,9 +111,9 @@ async def muhurta_form(request: Request) -> Response:
"""Show the muhurta search form."""
user = require_auth(request)
return templates.TemplateResponse(
request,
"muhurta_form.html",
{
"request": request,
context={
"user": user,
},
)
Expand Down Expand Up @@ -149,9 +149,9 @@ async def muhurta_result(
purpose_hi = _PURPOSE_HINDI.get(purpose, purpose)

return templates.TemplateResponse(
request,
"muhurta_result.html",
{
"request": request,
context={
"user": user,
"results": results,
"purpose_hi": purpose_hi,
Expand Down
Loading
Loading