Phase 7: serve the vet sample from the template tools and docs

- build.py: _TEMPLATE_COMPONENTS rewritten around the vet sample (53 kinds —
  per-resource slices, jobs, worked appointment_reminder family, tests);
  seed tokens dropped from the manifest ('sample: vet' instead)
- registry.py: get_app_component(kind) no longer renames item/example seeds;
  prompts and tool docs updated to 'copy a slice and adapt'
- templates/README.md, 01_build_recipe, 40_ui_admin, wiki/03 updated off the
  old seed scheme; repo inventory/config now exclude vet (docs move under
  standards; react/vet itself is deleted in a later phase)
- regenerated MCP bundle, vendored templates, and site output
This commit is contained in:
2026-10-20 14:58:17 +05:30
parent 56aa1322fb
commit 0cb35d10a6
107 changed files with 3292 additions and 937 deletions

View File

@@ -0,0 +1,37 @@
"""# Summary
Jobs domain — the worker's queue. Each job is a unit of pipeline work the
background worker claims and executes.
"""
from typing import Literal
from pydantic import BaseModel
from domain.parents.models import Metadata
class Job(BaseModel):
"""A unit of background work.
Attributes:
id (int | None): Server-assigned identifier. Defaults to None.
name (str): Human label for the job.
kind (str): Dispatch key — selects the pipeline (e.g.
``appointment_reminder``).
status (str): Lifecycle status. Defaults to ``pending``.
payload (dict | None): Job-specific input. Defaults to None.
retry_count (int): Failed attempts so far. Defaults to 0.
error_message (str | None): Last failure detail. Defaults to None.
metadata (Metadata | None): Presentation metadata. Defaults to None.
"""
id: int | None = None
name: str
kind: str
status: Literal["pending", "processing", "done", "failed"] = "pending"
payload: dict | None = None
retry_count: int = 0
error_message: str | None = None
metadata: Metadata | None = None
model_config = {"extra": "ignore"}

View File

@@ -0,0 +1,27 @@
"""# Summary
Jobs persistence ports — integer-id document and repository factory.
"""
from mongo_ops import BaseDocument
from pydantic import Field
from config import settings
from domain.jobs.models import Job
from infra.db.repos import create_repo
class JobDocument(Job, BaseDocument):
"""Persisted job document. The integer ``id`` shadows the ObjectId."""
id: int | None = Field(default=None, validation_alias="_id")
def create_job_repo():
"""Create the job repository selected by ``settings.repo_backend``.
Returns:
IntIdMemoryRepository | IntIdMongoRepository: Repository wired to the
``jobs`` collection/store.
"""
_ = settings # backend chosen centrally by create_repo
return create_repo("jobs", JobDocument)

View File

@@ -0,0 +1,33 @@
"""# Summary
CRUD service wiring for the job aggregate via the hexa container.
"""
from hexa import build
from domain.jobs.models import Job
from domain.jobs.ports.db import JobDocument
from infra.adapters.service import CrudsServiceAdaptor
class JobCrudsService(CrudsServiceAdaptor[Job, JobDocument]):
"""Job CRUD service resolving :class:`JobDocument` from a repo.
Notes:
Instances are created by :func:`get_job_service`. The ``model`` and
``schema`` class attributes bind the domain model and its document type.
"""
model = Job
schema = JobDocument
def get_job_service(repo) -> JobCrudsService:
"""Build a job CRUD service wired to ``repo``.
Args:
repo (Any): Integer-id job repository from :func:`create_job_repo`.
Returns:
JobCrudsService: Ready-to-use job CRUD service.
"""
return build(JobCrudsService, instances={"repo": repo})