kpaa / tasks.py
scvcoder's picture
Cleanup: dead code, route deletion (/info, /chat, /api/*), comment polish, auth mode docs, URL rename
9344f01 verified
"""Cross-platform task runner. Run via `invoke <task>` after `pip install invoke`.
Replaces the role of a Makefile so Windows/Mac/Linux users get the same UX.
"""
from __future__ import annotations
from invoke import task
@task
def install(c):
"""Editable install with dev + llm extras."""
c.run('pip install -e ".[dev,llm]"')
@task
def lint(c):
c.run("ruff check src/ tests/")
@task
def fmt(c):
c.run("ruff format src/ tests/")
@task
def test(c):
c.run("pytest tests/ -v")
@task(help={"q": "Question to send through the pipeline"})
def smoke(c, q="매장 CCTV 안내문구 어떻게 써요?"):
"""Run a single end-to-end smoke through the RAG pipeline."""
c.run(f'python -m kpaa smoke "{q}"')
@task
def evalq(c):
"""Run golden-question evaluation."""
c.run("python -m kpaa eval")
@task
def serve(c):
"""Start the FastAPI backend on :8000."""
c.run("python -m kpaa serve")
@task
def up(c):
c.run("docker compose up -d")
@task
def down(c):
c.run("docker compose down")
@task(help={"since": "YYYY-MM-DD; only fetch cases registered after this date"})
def refresh_cases(c, since=""):
cmd = "python -m kpaa refresh-cases"
if since:
cmd += f" --since {since}"
c.run(cmd)