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:
@@ -1,16 +1,19 @@
|
||||
# Application Template
|
||||
|
||||
A minimal, runnable skeleton of the standardized architecture. It demonstrates
|
||||
both axes of the blueprint (see `standards`):
|
||||
A runnable sample of the standardized architecture — the **vet** veterinary
|
||||
clinic domain, kept as the standards' reference sample. It demonstrates both
|
||||
axes of the blueprint (see `standards`):
|
||||
|
||||
1. **Resource axis** — items and jobs, each a Claude-style generic CRUD slice
|
||||
(model → document → repo → service → route), all driven from `openapi.yaml`.
|
||||
2. **Pipeline axis** — a background `worker.py` that polls pending jobs and runs
|
||||
a pipeline; `pipelines/example/` shows the reusable family skeleton and
|
||||
`pipelines/item_sync.py` the simple end-to-end form.
|
||||
1. **Resource axis** — five domain aggregates (parents, pets, treatments,
|
||||
vets, appointments) plus a **jobs** queue, each a CRUD slice
|
||||
(model → document → repo → service → route), all driven from
|
||||
`openapi.yaml`. x- extension fields on the spec drive the admin client.
|
||||
2. **Pipeline axis** — a background `worker.py` that polls pending jobs and
|
||||
dispatches by `job.kind`; `pipelines/appointment_reminder/` is the worked
|
||||
family and `pipelines/shared/` the reusable scaffold.
|
||||
|
||||
Everything here is deliberately small so an agent can rewrite each file rather
|
||||
than delete unused code. The domain is a neutral "item", not an app noun.
|
||||
Copy a slice, replace the domain with your own — the layer structure, wiring
|
||||
patterns and tests stay.
|
||||
|
||||
## Internal dependencies
|
||||
|
||||
@@ -38,11 +41,19 @@ The app depends on the internal Aetos libraries (`openapi-first`, `mongo-ops`,
|
||||
cd apps/<your-app>
|
||||
|
||||
1. `pyproject.toml` — rename the package; keep the internal library pins.
|
||||
2. `config.py` — replace/add settings consumed by your domain.
|
||||
3. `openapi.yaml` — replace the `Item`/`Job` resources with your resources.
|
||||
4. `domain/` — rename `item` and `job` slices to your aggregates.
|
||||
5. `pipelines/` — replace the demo with your pipeline (see below).
|
||||
6. `tests/` — keep the two test files as the pattern for your own.
|
||||
2. `config.py` — replace/add settings consumed by your domain (keep the
|
||||
worker knobs if you run jobs).
|
||||
3. `openapi.yaml` — replace the vet resources with yours; keep the x-
|
||||
extension conventions on schemas and fields.
|
||||
4. `domain/` — replace each aggregate slice with your own; copy
|
||||
`domain/parents/` as the simplest pattern, `domain/appointments/` when you
|
||||
need FK expansion.
|
||||
5. `interfaces/` — one `routes.py` per resource re-exported from
|
||||
`openapi.py`; keep `_common.py` as-is.
|
||||
6. `pipelines/` — replace the appointment_reminder family with yours (see
|
||||
below); keep `pipelines/shared/` as-is.
|
||||
7. `tests/` — keep `test_openapi_app_builds.py`; adapt the unit tests as
|
||||
patterns for your own.
|
||||
|
||||
Install and run:
|
||||
|
||||
@@ -53,8 +64,7 @@ Install and run:
|
||||
|
||||
## Pipeline families
|
||||
|
||||
`pipelines/item_sync.py` is the smallest possible pipeline (plain async steps).
|
||||
When a family needs its own stages, copy `pipelines/example/`:
|
||||
Copy `pipelines/appointment_reminder/` as the family pattern:
|
||||
|
||||
pipelines/<family>/
|
||||
abc.py # port contracts
|
||||
@@ -68,7 +78,8 @@ When a family needs its own stages, copy `pipelines/example/`:
|
||||
|
||||
The shared loader wires the root through the DI library (`hexa.build`) and merges
|
||||
the pattern fragments; the registry resolves a `(kind, variant, mode)` triple to
|
||||
a root class. See standards "50_pipeline_scaffold".
|
||||
a root class. The worker maps `job.kind` to a handler in its `HANDLERS`
|
||||
dispatch table. See standards "50_pipeline_scaffold" and "51_worker_and_progress".
|
||||
|
||||
## What to keep, what to replace
|
||||
|
||||
@@ -79,9 +90,10 @@ a root class. See standards "50_pipeline_scaffold".
|
||||
| openapi-first routing | Paths, schemas, operationIds |
|
||||
| mongo-ops repo factory | Collections, doc models |
|
||||
| generic CRUD adaptor | Nothing (reuse as-is) |
|
||||
| `interfaces/_common.py` | Nothing (reuse as-is) |
|
||||
| `pipelines/shared/` | Nothing (reuse as-is) |
|
||||
| `pipelines/example/` | Family name, stages, patterns |
|
||||
| worker poll + status loop | Job payloads, pipeline steps |
|
||||
| `pipelines/appointment_reminder/` | Family name, stages, patterns |
|
||||
| worker poll + dispatch loop | Job kinds, payloads, pipeline steps |
|
||||
| `scripts/` | Task bodies |
|
||||
|
||||
## Where the internal libraries slot in
|
||||
@@ -95,4 +107,4 @@ a root class. See standards "50_pipeline_scaffold".
|
||||
|
||||
Confirm current endpoints and ownership with the `standards` registry MCP tools:
|
||||
`find_library("pipeline")`, `find_library("auth")`, or
|
||||
`get_app_component("pipeline-abc", family="csv")`.
|
||||
`get_app_component("pipeline-abc")`.
|
||||
|
||||
Reference in New Issue
Block a user