From 406affcfcf5380d02e0363abd73aee43ff391b7b Mon Sep 17 00:00:00 2001 From: Vishesh 'ironeagle' Bangotra Date: Mon, 19 Oct 2026 17:42:55 +0530 Subject: [PATCH] feat: renumber lib reference into 4-pillar anatomy Renumber the 15 reference docs into pillar groups (recipe -> anatomy): - 01 Build Recipe (entry), 02 Composition Root - domains: 10 Layering Rules - contract: 20 Spec-First Routing, 21 CRUD Template, 22 Auth Integration - interfaces/infra: 30 Infra Adapters - UI: 40 UI: Auto-Rendered Admin & Custom Pages (new; @aetoskia packages, client template, x- catalog via react-openapi MCP module) - pipelines: 50 Pipeline Scaffold, 51 Worker & Progress, 52 Human-in-the-Loop - delivery/meta: 90 Drone Pipelines, 91 Versioning & Changelog, 92 Genericity Matrix, 93 Library Registry, 94 Repository Inventory MCP module names are unchanged (NN_ prefix stripped); all cross-references (wiki, templates, hooks, registry) updated; lib index rewritten pillar-first; build recipe bootstraps the client template. Bundle + HTML sites regenerated. --- standards/lib/01_build_recipe/index.html | 426 +++++----- .../index.html | 121 +-- .../index.html | 130 +-- .../index.html | 148 +--- .../index.html | 157 +--- .../index.html | 154 +--- .../index.html | 148 +--- standards/lib/404.html | 28 +- standards/lib/40_ui_admin/index.html | 804 ++++++++++++++++++ .../index.html | 148 +--- .../index.html | 123 +-- .../index.html | 130 +-- .../index.html | 129 +-- .../index.html | 190 +---- .../index.html | 130 +-- .../index.html | 119 +-- .../index.html | 136 +-- standards/lib/index.html | 238 +++++- standards/lib/search/search_index.json | 2 +- standards/mcp/index.json | 2 +- standards/mcp/modules/build_recipe.json | 2 +- standards/mcp/modules/drone_pipelines.json | 2 +- standards/mcp/modules/index.json | 2 +- .../mcp/modules/repository_inventory.json | 2 +- standards/mcp/modules/ui_admin.json | 8 + .../mcp/modules/versioning_and_changelog.json | 2 +- .../modules/wiki_development_releasing.json | 2 +- standards/mcp/modules/wiki_index.json | 2 +- standards/mcp/modules/wiki_mcp_setup.json | 2 +- standards/mcp/modules/wiki_overview.json | 2 +- standards/mcp/modules/wiki_start_an_app.json | 2 +- standards/mcp/nav.json | 35 +- standards/mcp/templates/app/.env.example | 4 +- standards/mcp/templates/app/config.py | 26 +- .../mcp/templates/app/domain/item/models.py | 4 +- .../mcp/templates/app/domain/item/ports/db.py | 20 +- .../mcp/templates/app/domain/job/models.py | 4 +- .../mcp/templates/app/domain/job/ports/db.py | 20 +- .../templates/app/infra/db/repos/__init__.py | 31 + .../templates/app/infra/db/repos/memory.py | 161 ++++ .../templates/app/infra/db/repos/mongo_int.py | 184 ++++ standards/mcp/templates/app/init.py | 29 +- .../mcp/templates/app/interfaces/_common.py | 146 ++++ .../templates/app/interfaces/item/routes.py | 102 ++- .../templates/app/interfaces/job/routes.py | 98 ++- .../mcp/templates/app/interfaces/openapi.py | 3 +- .../app/interfaces/system/__init__.py | 3 + .../templates/app/interfaces/system/routes.py | 13 + standards/mcp/templates/app/main.py | 13 +- standards/mcp/templates/app/openapi.yaml | 548 +++++++++--- .../mcp/templates/app/pipelines/item_sync.py | 2 +- .../app/pipelines/shared/__init__.py | 2 +- .../app/tests/integration/test_item_routes.py | 19 +- standards/mcp/templates/app/worker.py | 2 +- standards/mcp/templates/drone/npm-lib.yaml | 89 ++ standards/src/hooks.py | 2 +- standards/src/lib/01_build_recipe.md | 15 +- ...osition_root.md => 02_composition_root.md} | 0 ...layering_rules.md => 10_layering_rules.md} | 0 ...st_routing.md => 20_spec_first_routing.md} | 0 ...5_crud_template.md => 21_crud_template.md} | 0 ..._integration.md => 22_auth_integration.md} | 0 ...infra_adaptors.md => 30_infra_adaptors.md} | 0 standards/src/lib/40_ui_admin.md | 86 ++ ...ne_scaffold.md => 50_pipeline_scaffold.md} | 0 ..._progress.md => 51_worker_and_progress.md} | 0 ...8_human_in_loop.md => 52_human_in_loop.md} | 0 ...one_pipelines.md => 90_drone_pipelines.md} | 8 +- ...elog.md => 91_versioning_and_changelog.md} | 4 +- ...city_matrix.md => 92_genericity_matrix.md} | 0 ...ary_registry.md => 93_library_registry.md} | 0 ...nventory.md => 94_repository_inventory.md} | 6 +- standards/src/lib/index.md | 48 +- standards/src/templates/README.md | 2 +- .../src/templates/app/pipelines/item_sync.py | 2 +- .../app/pipelines/shared/__init__.py | 2 +- standards/src/templates/app/worker.py | 2 +- standards/src/wiki/01_overview.md | 2 +- standards/src/wiki/03_start_an_app.md | 6 +- .../src/wiki/04_development/02_releasing.md | 6 +- standards/src/wiki/05_mcp_setup.md | 6 +- standards/src/wiki/index.md | 22 +- standards/wiki/01_overview/index.html | 2 +- standards/wiki/03_start_an_app/index.html | 6 +- .../04_development/02_releasing/index.html | 6 +- standards/wiki/05_mcp_setup/index.html | 6 +- standards/wiki/index.html | 22 +- standards/wiki/search/search_index.json | 2 +- 88 files changed, 3017 insertions(+), 2295 deletions(-) rename standards/lib/{03_composition_root => 02_composition_root}/index.html (91%) rename standards/lib/{02_layering_rules => 10_layering_rules}/index.html (88%) rename standards/lib/{04_spec_first_routing => 20_spec_first_routing}/index.html (90%) rename standards/lib/{05_crud_template => 21_crud_template}/index.html (89%) rename standards/lib/{14_auth_integration => 22_auth_integration}/index.html (90%) rename standards/lib/{09_infra_adaptors => 30_infra_adaptors}/index.html (88%) create mode 100644 standards/lib/40_ui_admin/index.html rename standards/lib/{06_pipeline_scaffold => 50_pipeline_scaffold}/index.html (89%) rename standards/lib/{07_worker_and_progress => 51_worker_and_progress}/index.html (92%) rename standards/lib/{08_human_in_loop => 52_human_in_loop}/index.html (91%) rename standards/lib/{10_drone_pipelines => 90_drone_pipelines}/index.html (87%) rename standards/lib/{11_versioning_and_changelog => 91_versioning_and_changelog}/index.html (87%) rename standards/lib/{12_genericity_matrix => 92_genericity_matrix}/index.html (88%) rename standards/lib/{13_library_registry => 93_library_registry}/index.html (89%) rename standards/lib/{15_repository_inventory => 94_repository_inventory}/index.html (86%) create mode 100644 standards/mcp/modules/ui_admin.json create mode 100644 standards/mcp/templates/app/infra/db/repos/memory.py create mode 100644 standards/mcp/templates/app/infra/db/repos/mongo_int.py create mode 100644 standards/mcp/templates/app/interfaces/_common.py create mode 100644 standards/mcp/templates/app/interfaces/system/__init__.py create mode 100644 standards/mcp/templates/app/interfaces/system/routes.py create mode 100644 standards/mcp/templates/drone/npm-lib.yaml rename standards/src/lib/{03_composition_root.md => 02_composition_root.md} (100%) rename standards/src/lib/{02_layering_rules.md => 10_layering_rules.md} (100%) rename standards/src/lib/{04_spec_first_routing.md => 20_spec_first_routing.md} (100%) rename standards/src/lib/{05_crud_template.md => 21_crud_template.md} (100%) rename standards/src/lib/{14_auth_integration.md => 22_auth_integration.md} (100%) rename standards/src/lib/{09_infra_adaptors.md => 30_infra_adaptors.md} (100%) create mode 100644 standards/src/lib/40_ui_admin.md rename standards/src/lib/{06_pipeline_scaffold.md => 50_pipeline_scaffold.md} (100%) rename standards/src/lib/{07_worker_and_progress.md => 51_worker_and_progress.md} (100%) rename standards/src/lib/{08_human_in_loop.md => 52_human_in_loop.md} (100%) rename standards/src/lib/{10_drone_pipelines.md => 90_drone_pipelines.md} (91%) rename standards/src/lib/{11_versioning_and_changelog.md => 91_versioning_and_changelog.md} (96%) rename standards/src/lib/{12_genericity_matrix.md => 92_genericity_matrix.md} (100%) rename standards/src/lib/{13_library_registry.md => 93_library_registry.md} (100%) rename standards/src/lib/{15_repository_inventory.md => 94_repository_inventory.md} (87%) diff --git a/standards/lib/01_build_recipe/index.html b/standards/lib/01_build_recipe/index.html index bb29d66..6967ed2 100644 --- a/standards/lib/01_build_recipe/index.html +++ b/standards/lib/01_build_recipe/index.html @@ -14,8 +14,6 @@ - - @@ -374,7 +372,7 @@
  • - + @@ -396,7 +394,7 @@
  • - + @@ -418,7 +416,7 @@
  • - + @@ -440,7 +438,7 @@
  • - + @@ -462,7 +460,7 @@
  • - + @@ -484,7 +482,7 @@
  • - + @@ -506,7 +504,7 @@
  • - + @@ -528,7 +526,7 @@
  • - + @@ -550,7 +548,7 @@
  • - + @@ -572,7 +570,7 @@
  • - + @@ -594,7 +592,7 @@
  • - + @@ -616,7 +614,7 @@
  • - + @@ -638,7 +636,7 @@
  • - + @@ -660,7 +658,7 @@
  • - + @@ -785,6 +783,10 @@

    The ordered, deterministic checklist for generating a new application of the standard shape. Every step is fixed; only the resource model (step 2), the codegen pass (step 3), and the pipeline family (step 8) need app-specific work.

    +

    The reference pages behind this recipe are organized as an anatomy: the +domains layer, the OpenAPI contract that drives routing and the admin UI, +the interfaces/infra seam, the auto-rendered UI client, and an optional +pipelines layer โ€” see the Standards Reference index.

    This page is served by the standards MCP as docs://modules/build_recipe. The start_app prompt on that server collects the two axes and hands off here; pull exact files with get_app_component.

    @@ -795,204 +797,210 @@ exact files with get_app_component.

    2
    cp -r <docs>/standards/src/templates/app apps/<your-app>
     cd apps/<your-app>
     
    +

    Pair it with the React client template when a UI is needed (auto-rendered +admin from the spec โ€” see 40 โ€“ UI):

    +
    1
    +2
    cp -r <docs>/standards/src/templates/client apps/<your-app>-client
    +cd apps/<your-app>-client && npm install
    +

    Install the internal libraries โ€” editable local checkouts (preferred in development) or the private index (CI / fresh machines). Credentials are environment-only; never commit them.

    -
    1
    -2
    -3
    -4
    -5
    -6
    # local checkouts
    -pip install -e ../aetos/openapi-first -e ../aetos/mongo-ops -e ../aetos/hexa \
    -            -e ../aetos/dagpipe -e ../aetos/doc-forge
    -# private index
    -pip install --extra-index-url \
    -  "https://$PIP_REGISTRY_USERNAME:$PIP_REGISTRY_PASSWORD@pip.aetoskia.com/simple" .
    +
    1
    +2
    +3
    +4
    +5
    +6
    # local checkouts
    +pip install -e ../aetos/openapi-first -e ../aetos/mongo-ops -e ../aetos/hexa \
    +            -e ../aetos/dagpipe -e ../aetos/doc-forge
    +# private index
    +pip install --extra-index-url \
    +  "https://$PIP_REGISTRY_USERNAME:$PIP_REGISTRY_PASSWORD@pip.aetoskia.com/simple" .
     

    ๐Ÿ“‹ Agent prompt (copyable)

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    # Build a new application from the Aetos Standards blueprint
    -
    -You are coding a complete new backend application conforming to the Aetos
    -standard app blueprint. Execute every step in order. Only steps 2โ€“4 use the
    -app-specific details provided by the user; everything else is deterministic.
    -
    -## Before writing any code
    -
    -Connect to the `standards` MCP server and read:
    -- `docs://nav` (the module list)
    -- `docs://modules/genericity_matrix` (Tier A library / Tier B template / Tier C authored)
    -- `docs://modules/layering_rules` (the dependency rules)
    -
    -Then:
    -- call `find_library` with `db`, `di`, `routing`, `ingestion`, `pipeline`, `docs`
    -  and note the Tier A libraries that already exist โ€” never reimplement one;
    -- call `list_app_components()` and pull each file you need with
    -  `get_app_component(kind, resource=..., family=...)` instead of writing it from
    -  scratch.
    -
    -## Steps
    -
    -1. **Scaffold** โ€” copy `standards/src/templates/app/` into `apps/<your-app>/`
    -   (or pull the same tree via `get_app_template`). Keep the tree: `domain/`,
    -   `infra/`, `interfaces/`, `pipelines/`, `tests/`, `scripts/`, plus
    -   `pyproject.toml`, `openapi.yaml`, `config.py`, `init.py`, `main.py`,
    -   `worker.py`, `Dockerfile`, `docker-compose.yaml`, `.env.example`.
    -
    -2. **Author the spec (app-specific)** โ€” write `openapi.yaml`: resources,
    -   schemas, `operationId`s, security, and extension metadata. This is the
    -   contract and drives all routing. Every operation MUST have an `operationId`.
    -
    -3. **Generate the scaffold (codegen)** โ€” from the spec, generate the wire
    -   models and the exact handler signatures:
    -   ```bash
    -   openapi-first models openapi.yaml -o _gen/models.py
    -   openapi-first routes openapi.yaml -o _gen/routes \
    -     --use-models --models-module _gen.models --inject-request --package --template-style
    -   ```
    -   `_gen/models.py` is the **wire contract** (Pydantic, one class per
    -   `components.schemas` entry). `_gen/routes/<resource>/routes.py` lists every
    -   `operationId` with its exact parameter signature. `--template-style` makes
    -   those stubs `async def` with a `body` parameter, matching the handlers you
    -   keep in `interfaces/` (without it they are sync `def` stubs taking
    -   `payload`; both bind the same way). Treat `_gen/` as generated
    -   (never hand-edit it) โ€” the canonical handlers live in `interfaces/`.
    -
    -4. **Write each CRUD slice (app-specific)** โ€” per resource create the four-file
    -   slice: `models.py` (domain model, **no `id`**), `ports/db.py`
    -   (`class XDocument(BaseDocument, X)` โ€” id comes from `BaseDocument`),
    -   `ports/service.py`, and optional `converters.py`. Follow the CRUD template.
    -
    -5. **Wire the composition root** โ€” in `init.py`, build leaf repositories, then
    -   dependent repositories, then services; add infra adapters (db, cache, stores,
    -   progress bus, fetchers). Expose `get_svc` overloads.
    -
    -6. **Add routes** โ€” create `interfaces/<resource>/routes.py` thin handlers whose
    -   names match the `operationId`s (use the signatures from step 3 as your
    -   checklist) and re-export them in `interfaces/openapi.py`. Add the cache
    -   decorator to read endpoints.
    -
    -7. **Bootstrap app and worker** โ€” confirm `main.py` runs the OpenAPI-first app
    -   with its lifespan. If the app has long-running jobs, adapt `worker.py` to poll
    -   the job collection, run the pipeline, and publish progress.
    -
    -8. **Add pipeline families (only if data-driven)** โ€” copy `pipelines/example/`
    -   to `pipelines/<family>/` with `abc.py`, `impl.py`, `pipeline.yaml`,
    -   `resources/`, and reuse `pipelines/shared/` (loader + registry). Register the
    -   root. Add fixtures and a parity test.
    -
    -9. **Add infrastructure only where needed** โ€” Tier A capability: use the
    -   library. Tier B capability: copy the template. Never hand-write a Tier A
    -   library.
    -
    -10. **Tests** โ€” integration tests with fakes at the HTTP edge; unit tests for
    -    domain and pipeline logic; a config-consistency test for rule-driven
    -    pipelines. Include `tests/integration/test_openapi_app_builds.py` (imports
    -    the app, asserts `import main` binds every operation).
    -
    -11. **Scripts and seeds** โ€” operator scripts under `scripts/` using
    -    `init()` / `get_svc()` / `shutdown()`; run as `python -m scripts.<name>`.
    -
    -12. **Docs** โ€” author GSDFC docstrings, generate `.pyi` stubs, mark the package
    -    `py.typed`, and build the docs.
    -
    -**Definition of done:**
    -- `python -c "import main"` succeeds.
    -- `pytest` passes.
    -- The app serves every operation in the spec; the worker drains its queue.
    -- No domain module imports a web framework.
    -- No Tier A library was reimplemented.
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    # Build a new application from the Aetos Standards blueprint
    +
    +You are coding a complete new backend application conforming to the Aetos
    +standard app blueprint. Execute every step in order. Only steps 2โ€“4 use the
    +app-specific details provided by the user; everything else is deterministic.
    +
    +## Before writing any code
    +
    +Connect to the `standards` MCP server and read:
    +- `docs://nav` (the module list)
    +- `docs://modules/genericity_matrix` (Tier A library / Tier B template / Tier C authored)
    +- `docs://modules/layering_rules` (the dependency rules)
    +
    +Then:
    +- call `find_library` with `db`, `di`, `routing`, `ingestion`, `pipeline`, `docs`
    +  and note the Tier A libraries that already exist โ€” never reimplement one;
    +- call `list_app_components()` and pull each file you need with
    +  `get_app_component(kind, resource=..., family=...)` instead of writing it from
    +  scratch.
    +
    +## Steps
    +
    +1. **Scaffold** โ€” copy `standards/src/templates/app/` into `apps/<your-app>/`
    +   (or pull the same tree via `get_app_template`). Keep the tree: `domain/`,
    +   `infra/`, `interfaces/`, `pipelines/`, `tests/`, `scripts/`, plus
    +   `pyproject.toml`, `openapi.yaml`, `config.py`, `init.py`, `main.py`,
    +   `worker.py`, `Dockerfile`, `docker-compose.yaml`, `.env.example`.
    +
    +2. **Author the spec (app-specific)** โ€” write `openapi.yaml`: resources,
    +   schemas, `operationId`s, security, and extension metadata. This is the
    +   contract and drives all routing. Every operation MUST have an `operationId`.
    +
    +3. **Generate the scaffold (codegen)** โ€” from the spec, generate the wire
    +   models and the exact handler signatures:
    +   ```bash
    +   openapi-first models openapi.yaml -o _gen/models.py
    +   openapi-first routes openapi.yaml -o _gen/routes \
    +     --use-models --models-module _gen.models --inject-request --package --template-style
    +   ```
    +   `_gen/models.py` is the **wire contract** (Pydantic, one class per
    +   `components.schemas` entry). `_gen/routes/<resource>/routes.py` lists every
    +   `operationId` with its exact parameter signature. `--template-style` makes
    +   those stubs `async def` with a `body` parameter, matching the handlers you
    +   keep in `interfaces/` (without it they are sync `def` stubs taking
    +   `payload`; both bind the same way). Treat `_gen/` as generated
    +   (never hand-edit it) โ€” the canonical handlers live in `interfaces/`.
    +
    +4. **Write each CRUD slice (app-specific)** โ€” per resource create the four-file
    +   slice: `models.py` (domain model, **no `id`**), `ports/db.py`
    +   (`class XDocument(BaseDocument, X)` โ€” id comes from `BaseDocument`),
    +   `ports/service.py`, and optional `converters.py`. Follow the CRUD template.
    +
    +5. **Wire the composition root** โ€” in `init.py`, build leaf repositories, then
    +   dependent repositories, then services; add infra adapters (db, cache, stores,
    +   progress bus, fetchers). Expose `get_svc` overloads.
    +
    +6. **Add routes** โ€” create `interfaces/<resource>/routes.py` thin handlers whose
    +   names match the `operationId`s (use the signatures from step 3 as your
    +   checklist) and re-export them in `interfaces/openapi.py`. Add the cache
    +   decorator to read endpoints.
    +
    +7. **Bootstrap app and worker** โ€” confirm `main.py` runs the OpenAPI-first app
    +   with its lifespan. If the app has long-running jobs, adapt `worker.py` to poll
    +   the job collection, run the pipeline, and publish progress.
    +
    +8. **Add pipeline families (only if data-driven)** โ€” copy `pipelines/example/`
    +   to `pipelines/<family>/` with `abc.py`, `impl.py`, `pipeline.yaml`,
    +   `resources/`, and reuse `pipelines/shared/` (loader + registry). Register the
    +   root. Add fixtures and a parity test.
    +
    +9. **Add infrastructure only where needed** โ€” Tier A capability: use the
    +   library. Tier B capability: copy the template. Never hand-write a Tier A
    +   library.
    +
    +10. **Tests** โ€” integration tests with fakes at the HTTP edge; unit tests for
    +    domain and pipeline logic; a config-consistency test for rule-driven
    +    pipelines. Include `tests/integration/test_openapi_app_builds.py` (imports
    +    the app, asserts `import main` binds every operation).
    +
    +11. **Scripts and seeds** โ€” operator scripts under `scripts/` using
    +    `init()` / `get_svc()` / `shutdown()`; run as `python -m scripts.<name>`.
    +
    +12. **Docs** โ€” author GSDFC docstrings, generate `.pyi` stubs, mark the package
    +    `py.typed`, and build the docs.
    +
    +**Definition of done:**
    +- `python -c "import main"` succeeds.
    +- `pytest` passes.
    +- The app serves every operation in the spec; the worker drains its queue.
    +- No domain module imports a web framework.
    +- No Tier A library was reimplemented.
     

    ๐Ÿงญ Where the steps land

    @@ -1120,7 +1128,7 @@ the two mechanical parts of the build:


    diff --git a/standards/lib/03_composition_root/index.html b/standards/lib/02_composition_root/index.html similarity index 91% rename from standards/lib/03_composition_root/index.html rename to standards/lib/02_composition_root/index.html index b25ce57..662acd1 100644 --- a/standards/lib/03_composition_root/index.html +++ b/standards/lib/02_composition_root/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -288,32 +284,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -324,71 +298,6 @@ - - - - -
  • @@ -400,7 +309,7 @@
  • - + @@ -422,7 +331,7 @@
  • - + @@ -444,7 +353,7 @@
  • - + @@ -466,7 +375,7 @@
  • - + @@ -488,7 +397,7 @@
  • - + @@ -510,7 +419,7 @@
  • - + @@ -532,7 +441,7 @@
  • - + @@ -554,7 +463,7 @@
  • - + @@ -576,7 +485,7 @@
  • - + @@ -598,7 +507,7 @@
  • - + @@ -620,7 +529,7 @@
  • - + @@ -642,7 +551,7 @@
  • - + diff --git a/standards/lib/02_layering_rules/index.html b/standards/lib/10_layering_rules/index.html similarity index 88% rename from standards/lib/02_layering_rules/index.html rename to standards/lib/10_layering_rules/index.html index 1df16f2..be10471 100644 --- a/standards/lib/02_layering_rules/index.html +++ b/standards/lib/10_layering_rules/index.html @@ -11,10 +11,6 @@ - - - - @@ -266,32 +262,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -302,80 +276,6 @@ - - - - -
  • @@ -387,7 +287,7 @@
  • - + @@ -409,7 +309,7 @@
  • - + @@ -431,7 +331,7 @@
  • - + @@ -453,7 +353,7 @@
  • - + @@ -475,7 +375,7 @@
  • - + @@ -497,7 +397,7 @@
  • - + @@ -519,7 +419,7 @@
  • - + @@ -541,7 +441,7 @@
  • - + @@ -563,7 +463,7 @@
  • - + @@ -585,7 +485,7 @@
  • - + @@ -607,7 +507,7 @@
  • - + @@ -629,7 +529,7 @@
  • - + @@ -651,7 +551,7 @@
  • - + diff --git a/standards/lib/04_spec_first_routing/index.html b/standards/lib/20_spec_first_routing/index.html similarity index 90% rename from standards/lib/04_spec_first_routing/index.html rename to standards/lib/20_spec_first_routing/index.html index 00374ba..5a1b691 100644 --- a/standards/lib/04_spec_first_routing/index.html +++ b/standards/lib/20_spec_first_routing/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -310,32 +306,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -346,98 +320,6 @@ - - - - -
  • @@ -449,7 +331,7 @@
  • - + @@ -471,7 +353,7 @@
  • - + @@ -493,7 +375,7 @@
  • - + @@ -515,7 +397,7 @@
  • - + @@ -537,7 +419,7 @@
  • - + @@ -559,7 +441,7 @@
  • - + @@ -581,7 +463,7 @@
  • - + @@ -603,7 +485,7 @@
  • - + @@ -625,7 +507,7 @@
  • - + @@ -647,7 +529,7 @@
  • - + @@ -669,7 +551,7 @@
  • - + diff --git a/standards/lib/05_crud_template/index.html b/standards/lib/21_crud_template/index.html similarity index 89% rename from standards/lib/05_crud_template/index.html rename to standards/lib/21_crud_template/index.html index 8e87ef5..b8fb594 100644 --- a/standards/lib/05_crud_template/index.html +++ b/standards/lib/21_crud_template/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -332,32 +328,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -368,107 +342,6 @@ - - - - -
  • @@ -480,7 +353,7 @@
  • - + @@ -502,7 +375,7 @@
  • - + @@ -524,7 +397,7 @@
  • - + @@ -546,7 +419,7 @@
  • - + @@ -568,7 +441,7 @@
  • - + @@ -590,7 +463,7 @@
  • - + @@ -612,7 +485,7 @@
  • - + @@ -634,7 +507,7 @@
  • - + @@ -656,7 +529,7 @@
  • - + @@ -678,7 +551,7 @@
  • - + diff --git a/standards/lib/14_auth_integration/index.html b/standards/lib/22_auth_integration/index.html similarity index 90% rename from standards/lib/14_auth_integration/index.html rename to standards/lib/22_auth_integration/index.html index ab38830..d2b1f20 100644 --- a/standards/lib/14_auth_integration/index.html +++ b/standards/lib/22_auth_integration/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -379,7 +375,7 @@
  • - + @@ -401,7 +397,7 @@
  • - + @@ -423,7 +419,7 @@
  • - + @@ -445,7 +441,7 @@
  • - + @@ -467,7 +463,7 @@
  • - + @@ -489,7 +485,7 @@
  • - + @@ -511,7 +507,7 @@
  • - + @@ -530,32 +526,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -566,104 +540,6 @@ - - - - -
  • @@ -675,7 +551,7 @@
  • - + diff --git a/standards/lib/09_infra_adaptors/index.html b/standards/lib/30_infra_adaptors/index.html similarity index 88% rename from standards/lib/09_infra_adaptors/index.html rename to standards/lib/30_infra_adaptors/index.html index 4c49900..6e750c2 100644 --- a/standards/lib/09_infra_adaptors/index.html +++ b/standards/lib/30_infra_adaptors/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -379,7 +375,7 @@
  • - + @@ -401,7 +397,7 @@
  • - + @@ -420,32 +416,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -456,98 +430,6 @@ - - - - -
  • @@ -559,7 +441,7 @@
  • - + @@ -581,7 +463,7 @@
  • - + @@ -603,7 +485,7 @@
  • - + @@ -625,7 +507,7 @@
  • - + @@ -647,7 +529,7 @@
  • - + @@ -669,7 +551,7 @@
  • - + diff --git a/standards/lib/404.html b/standards/lib/404.html index 14027c2..58b1f8c 100644 --- a/standards/lib/404.html +++ b/standards/lib/404.html @@ -260,7 +260,7 @@
  • - + @@ -282,7 +282,7 @@
  • - + @@ -304,7 +304,7 @@
  • - + @@ -326,7 +326,7 @@
  • - + @@ -348,7 +348,7 @@
  • - + @@ -370,7 +370,7 @@
  • - + @@ -392,7 +392,7 @@
  • - + @@ -414,7 +414,7 @@
  • - + @@ -436,7 +436,7 @@
  • - + @@ -458,7 +458,7 @@
  • - + @@ -480,7 +480,7 @@
  • - + @@ -502,7 +502,7 @@
  • - + @@ -524,7 +524,7 @@
  • - + @@ -546,7 +546,7 @@
  • - + diff --git a/standards/lib/40_ui_admin/index.html b/standards/lib/40_ui_admin/index.html new file mode 100644 index 0000000..49d766d --- /dev/null +++ b/standards/lib/40_ui_admin/index.html @@ -0,0 +1,804 @@ + + + + + + + + + + + + + + + + + + + + + UI: Auto-Rendered Admin & Custom Pages - Aetos Standards โ€” Reference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + + +

    UI: Auto-Rendered Admin & Custom Pages

    +

    Summary

    +

    The UI axis of an Aetos app is a published React client, not code written +per application. Two npm packages carry the whole surface:

    + + + + + + + + + + + + + + + + + +
    PackageRole
    @aetoskia/react-openapiRenders a complete admin panel (CRUD tables, forms, filters, sorting, pagination, uploads) from the app's openapi.yaml โ€” zero UI code.
    @aetoskia/react-authAuth contexts and pages (login/register/me) wired to the auth-server, plus the axios client with token handling.
    +

    Both publish to the private registry https://npm.aetoskia.com. The server +spec is the single source of truth: the same openapi.yaml that drives +openapi-first routing drives the admin UI, through x- extension fields +(see below).

    +
    +

    Scaffold

    +
    1
    +2
    +3
    +4
    cp -r <docs>/standards/src/templates/client apps/<your-app>-client
    +cd apps/<your-app>-client
    +npm install          # deps come from npm.aetoskia.com via .npmrc
    +npm run dev
    +
    +

    The client template is a Vite + MUI app with:

    +
      +
    • src/openapi-config.ts โ€” points the renderer at the app's spec and the + auth-server's spec;
    • +
    • .env.example โ€” VITE_API_BASE_URL (app API) and VITE_AUTH_BASE_URL + (auth-server);
    • +
    • a Home page that auto-lists every resource the spec declares, and a + Header/Footer/theme scaffold.
    • +
    +

    Custom pages are ordinary React routes layered on top; the auto-rendered admin +is available per resource at #/resource/<name>.

    +
    +

    x- extensions: how the spec steers the UI

    +

    The admin renderer reads a catalog of OpenAPI extension fields (x-resource, +x-list-columns, x-display-format, x-label, x-order, x-hidden, +x-sortable, x-filterable, x-autocomplete, x-fk, x-ui-type, +x-upload, x-sse, x-profile, and the auth wiring x-server-url / +x-login-path / x-me-path / โ€ฆ) declared on schemas and properties.

    +

    The catalog is canonical in the react-openapi source, not in this doc. +Read it from the MCP bundle:

    +
    docs://modules/react-openapi        # module: specExtensions โ€” the full catalog
    +
    +

    The app's own spec carries the per-resource values; the catalog explains what +each field does. The template's openapi.yaml shows the convention on the +example Item and Job schemas.

    +
    +

    Golden rules

    +
      +
    1. The spec owns the UI. Add a resource or rename a column in + openapi.yaml; the admin follows. Never fork the renderer per app.
    2. +
    3. Custom pages for workflows, auto-render for CRUD. Anything that is + "list / create / edit / delete an entity" is a spec concern; anything that + is a bespoke workflow is a React page.
    4. +
    5. Auth is consumed, never re-implemented. @aetoskia/react-auth holds + tokens and calls the auth-server endpoints declared by the x- wiring; pages + read the context.
    6. +
    7. Publish, don't vendor. UI shared across apps belongs in + @aetoskia/react-openapi or @aetoskia/react-auth (SemVer, tag-triggered + npm release), not copy-pasted into app trees.
    8. +
    +
    +

    Notes

    +
      +
    • The server template ships authless by default (see + 22 โ€“ Auth Integration); the client template pairs + with it and degrades to "no login" until a security scheme is declared.
    • +
    • react/vet is the full-stack reference implementation: spec with x- + extensions, server, and the consuming client in one tree.
    • +
    + + + + + + + + + + + + + +
    +
    + + + + + +
    + + + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/standards/lib/06_pipeline_scaffold/index.html b/standards/lib/50_pipeline_scaffold/index.html similarity index 89% rename from standards/lib/06_pipeline_scaffold/index.html rename to standards/lib/50_pipeline_scaffold/index.html index db823a5..265a6ee 100644 --- a/standards/lib/06_pipeline_scaffold/index.html +++ b/standards/lib/50_pipeline_scaffold/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -354,32 +350,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -390,98 +364,6 @@ - - - - -
  • @@ -493,7 +375,7 @@
  • - + @@ -515,7 +397,7 @@
  • - + @@ -537,7 +419,7 @@
  • - + @@ -559,7 +441,7 @@
  • - + @@ -581,7 +463,7 @@
  • - + @@ -603,7 +485,7 @@
  • - + @@ -625,7 +507,7 @@
  • - + @@ -647,7 +529,7 @@
  • - + @@ -669,7 +551,7 @@
  • - + diff --git a/standards/lib/07_worker_and_progress/index.html b/standards/lib/51_worker_and_progress/index.html similarity index 92% rename from standards/lib/07_worker_and_progress/index.html rename to standards/lib/51_worker_and_progress/index.html index 2951f61..dee00ad 100644 --- a/standards/lib/07_worker_and_progress/index.html +++ b/standards/lib/51_worker_and_progress/index.html @@ -11,10 +11,6 @@ - - - - @@ -110,7 +106,7 @@
    - Worker & Progress + Worker & Progress
    @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -376,32 +372,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -412,71 +386,6 @@ - - - - -
  • @@ -488,7 +397,7 @@
  • - + @@ -510,7 +419,7 @@
  • - + @@ -532,7 +441,7 @@
  • - + @@ -554,7 +463,7 @@
  • - + @@ -576,7 +485,7 @@
  • - + @@ -598,7 +507,7 @@
  • - + @@ -620,7 +529,7 @@
  • - + @@ -642,7 +551,7 @@
  • - + diff --git a/standards/lib/08_human_in_loop/index.html b/standards/lib/52_human_in_loop/index.html similarity index 91% rename from standards/lib/08_human_in_loop/index.html rename to standards/lib/52_human_in_loop/index.html index 9257e1c..17b6ec3 100644 --- a/standards/lib/08_human_in_loop/index.html +++ b/standards/lib/52_human_in_loop/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -379,7 +375,7 @@
  • - + @@ -398,32 +394,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -434,80 +408,6 @@ - - - - -
  • @@ -519,7 +419,7 @@
  • - + @@ -541,7 +441,7 @@
  • - + @@ -563,7 +463,7 @@
  • - + @@ -585,7 +485,7 @@
  • - + @@ -607,7 +507,7 @@
  • - + @@ -629,7 +529,7 @@
  • - + @@ -651,7 +551,7 @@
  • - + diff --git a/standards/lib/10_drone_pipelines/index.html b/standards/lib/90_drone_pipelines/index.html similarity index 87% rename from standards/lib/10_drone_pipelines/index.html rename to standards/lib/90_drone_pipelines/index.html index 381d54c..aa05cb1 100644 --- a/standards/lib/10_drone_pipelines/index.html +++ b/standards/lib/90_drone_pipelines/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -379,7 +375,7 @@
  • - + @@ -401,7 +397,7 @@
  • - + @@ -423,7 +419,7 @@
  • - + @@ -442,32 +438,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -478,71 +452,6 @@ - - - - -
  • @@ -554,7 +463,7 @@
  • - + @@ -576,7 +485,7 @@
  • - + @@ -598,7 +507,7 @@
  • - + @@ -620,7 +529,7 @@
  • - + @@ -642,7 +551,7 @@
  • - + @@ -788,7 +697,7 @@ with from_secret โ€” never commit credentials.

  • check-version โ€” guard: fail unless $DRONE_TAG equals the version in pyproject.toml; then read name / version and query $PIP_REPO_URL/simple/<package>/; if that version already exists, exit - 78 and skip the whole build (see 11 โ€“ Versioning & Changelog).
  • + 78 and skip the whole build (see 91 โ€“ Versioning & Changelog).
  • quality-gate โ€” install the package with its [dev] extras from the private index, then black --check, ruff check, mypy, pydoclint, pytest.
  • @@ -815,7 +724,7 @@ triggered on tag:

  • fetch-tags โ€” resolve the latest tag into LATEST_TAG.txt; fail if there are no tags.
  • check-version โ€” guard: fail unless $DRONE_TAG equals the repo-root - VERSION file (see 11 โ€“ Versioning & Changelog).
  • + VERSION file (see 91 โ€“ Versioning & Changelog).
  • check-remote-image โ€” if aetos/<app>:<tag> already exists locally, exit 78 and skip the build.
  • quality-gate โ€” install from requirements.txt and run @@ -871,14 +780,14 @@ triggered on tag:

    index and the running container against duplicate publishes.
  • Do not drop the tagโ†”version guard. A package needs its pyproject.toml version to equal the tag; a service needs a root VERSION file that equals - the tag. See 11 โ€“ Versioning & Changelog.
  • + the tag. See 91 โ€“ Versioning & Changelog.
  • Do not rename the pipelines; tooling and runbooks key off build-and-publish-pypi and build-and-deploy-service.

  • diff --git a/standards/lib/11_versioning_and_changelog/index.html b/standards/lib/91_versioning_and_changelog/index.html similarity index 87% rename from standards/lib/11_versioning_and_changelog/index.html rename to standards/lib/91_versioning_and_changelog/index.html index a730bd3..bf56263 100644 --- a/standards/lib/11_versioning_and_changelog/index.html +++ b/standards/lib/91_versioning_and_changelog/index.html @@ -11,10 +11,6 @@ - - - - @@ -110,7 +106,7 @@
    - Versioning & Changelog + Versioning & Changelog
    @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -379,7 +375,7 @@
  • - + @@ -401,7 +397,7 @@
  • - + @@ -423,7 +419,7 @@
  • - + @@ -445,7 +441,7 @@
  • - + @@ -464,32 +460,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -500,134 +474,6 @@ - - - - -
  • @@ -639,7 +485,7 @@
  • - + @@ -661,7 +507,7 @@
  • - + @@ -683,7 +529,7 @@
  • - + @@ -705,7 +551,7 @@
  • - + @@ -878,7 +724,7 @@ releases in a Keep a Changelogversion file is the source of truth, the git tag must equal it, and a Drone guard enforces that equality before anything is published. Releases are cut manually; a tag is what triggers the pipeline.

    -

    This page pairs with 10 โ€“ Drone Pipelines: the version +

    This page pairs with 90 โ€“ Drone Pipelines: the version and tag contract is exactly what those two CI shapes consume.


    The version contract

    @@ -1047,7 +893,7 @@ Drone guard turns that silent no-op into a hard failure.


    diff --git a/standards/lib/12_genericity_matrix/index.html b/standards/lib/92_genericity_matrix/index.html similarity index 88% rename from standards/lib/12_genericity_matrix/index.html rename to standards/lib/92_genericity_matrix/index.html index 7d907bc..774f1d0 100644 --- a/standards/lib/12_genericity_matrix/index.html +++ b/standards/lib/92_genericity_matrix/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -379,7 +375,7 @@
  • - + @@ -401,7 +397,7 @@
  • - + @@ -423,7 +419,7 @@
  • - + @@ -445,7 +441,7 @@
  • - + @@ -467,7 +463,7 @@
  • - + @@ -489,7 +485,7 @@
  • - + @@ -508,32 +504,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -544,80 +518,6 @@ - - - - -
  • @@ -629,7 +529,7 @@
  • - + @@ -651,7 +551,7 @@
  • - + diff --git a/standards/lib/13_library_registry/index.html b/standards/lib/93_library_registry/index.html similarity index 89% rename from standards/lib/13_library_registry/index.html rename to standards/lib/93_library_registry/index.html index b5e294d..34351ea 100644 --- a/standards/lib/13_library_registry/index.html +++ b/standards/lib/93_library_registry/index.html @@ -11,8 +11,6 @@ - - @@ -267,7 +265,7 @@
  • - + @@ -289,7 +287,7 @@
  • - + @@ -311,7 +309,7 @@
  • - + @@ -333,7 +331,7 @@
  • - + @@ -355,7 +353,7 @@
  • - + @@ -377,7 +375,7 @@
  • - + @@ -399,7 +397,7 @@
  • - + @@ -421,7 +419,7 @@
  • - + @@ -443,7 +441,7 @@
  • - + @@ -465,7 +463,7 @@
  • - + @@ -487,7 +485,7 @@
  • - + @@ -509,7 +507,7 @@
  • - + @@ -531,7 +529,7 @@
  • - + @@ -550,32 +548,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -586,71 +562,6 @@ - - - - -
  • diff --git a/standards/lib/15_repository_inventory/index.html b/standards/lib/94_repository_inventory/index.html similarity index 86% rename from standards/lib/15_repository_inventory/index.html rename to standards/lib/94_repository_inventory/index.html index 75dfedc..94eed65 100644 --- a/standards/lib/15_repository_inventory/index.html +++ b/standards/lib/94_repository_inventory/index.html @@ -11,10 +11,6 @@ - - - - @@ -269,7 +265,7 @@
  • - + @@ -291,7 +287,7 @@
  • - + @@ -313,7 +309,7 @@
  • - + @@ -335,7 +331,7 @@
  • - + @@ -357,7 +353,7 @@
  • - + @@ -379,7 +375,7 @@
  • - + @@ -401,7 +397,7 @@
  • - + @@ -423,7 +419,7 @@
  • - + @@ -445,7 +441,7 @@
  • - + @@ -467,7 +463,7 @@
  • - + @@ -486,32 +482,10 @@ - - -
  • - - - - - - - - - - +
  • + @@ -522,80 +496,6 @@ - - - - -
  • @@ -607,7 +507,7 @@
  • - + @@ -629,7 +529,7 @@
  • - + @@ -651,7 +551,7 @@
  • - + @@ -767,8 +667,8 @@

    The canonical list of Aetos repositories covered by the CI and versioning standards, with the artifact each one produces, its version source, and its Drone shape. Every entry maps to the contract in -11 โ€“ Versioning & Changelog and the two CI -files in 10 โ€“ Drone Pipelines.

    +91 โ€“ Versioning & Changelog and the two CI +files in 90 โ€“ Drone Pipelines.

    The same data is published machine-readably as the registry://repos MCP resource (and the list_repos tool), sourced from standards/src/repos.json. Paths are relative to the aetos/ workspace root.

    @@ -898,7 +798,7 @@ merged, and the tag is created on the merged commit.


    diff --git a/standards/lib/index.html b/standards/lib/index.html index 9a2ff77..a3240b5 100644 --- a/standards/lib/index.html +++ b/standards/lib/index.html @@ -232,6 +232,19 @@ + + @@ -244,6 +257,88 @@ + + + +
  • @@ -277,7 +372,7 @@
  • - + @@ -299,7 +394,7 @@
  • - + @@ -321,7 +416,7 @@
  • - + @@ -343,7 +438,7 @@
  • - + @@ -365,7 +460,7 @@
  • - + @@ -387,7 +482,7 @@
  • - + @@ -409,7 +504,7 @@
  • - + @@ -431,7 +526,7 @@
  • - + @@ -453,7 +548,7 @@
  • - + @@ -475,7 +570,7 @@
  • - + @@ -497,7 +592,7 @@
  • - + @@ -519,7 +614,7 @@
  • - + @@ -541,7 +636,7 @@
  • - + @@ -563,7 +658,7 @@
  • - + @@ -598,6 +693,77 @@ + + +
  • @@ -615,26 +781,54 @@

    Standards Reference

    The reference half of the Standards description: the enforceable rules, patterns, and the internal library catalog that agents consult while coding.

    +

    The reference is organized as an anatomy โ€” one entry checklist and four +pillars describing what an application is made of, plus delivery/meta pages +and an optional pipelines layer.

    +

    Anatomy

    +
      +
    • Build Recipe โ€” the ordered, agentic checklist for a new app; the entry + point that walks the whole anatomy.
    • +
    +

    Pillar 1 โ€” Domains

      -
    • Build Recipe โ€” the ordered, agentic checklist for a new app.
    • Layering Rules โ€” the strict request โ†’ domain โ†’ repository layering and the rules that enforce it.
    • +
    +

    Pillar 2 โ€” OpenAPI Spec (the contract)

    +
    • Composition Root โ€” a single composition point wiring the whole app.
    • Spec-First Routing โ€” the OpenAPI contract as the routing source of truth.
    • CRUD Template โ€” the standardized generic resource endpoint scaffold.
    • +
    • Auth Integration โ€” consuming the shared auth-server service (spec-driven, + no auth code).
    • +
    +

    Pillar 3 โ€” Interfaces & Infra

    +
      +
    • Infra Adapters โ€” how infrastructure connects without leaking into domain.
    • +
    +

    Pillar 4 โ€” UI

    +
      +
    • UI: Auto-Rendered Admin & Custom Pages โ€” the @aetoskia/react-openapi + admin rendered from the spec's x- extensions, and @aetoskia/react-auth + for auth pages; the client template scaffold.
    • +
    +

    Pipelines (optional layer)

    +
    • Pipeline Scaffold โ€” the deterministic pipeline skeleton for multi-stage jobs.
    • Worker & Progress โ€” queued work, progress reporting, and visibility.
    • Human-in-the-Loop โ€” guardrails and approvals inside automations.
    • -
    • Infra Adapters โ€” how infrastructure connects without leaking into domain.
    • -
    • Drone Pipelines โ€” the two CI shapes: a PyPI package or a Docker deployment.
    • -
    • Versioning & Changelog โ€” SemVer, the tagโ†”version contract, and the release - changelog.
    • +
    +

    Delivery & Meta

    +
      +
    • Drone Pipelines โ€” the two CI shapes: a PyPI/npm package or a Docker + deployment.
    • +
    • Versioning & Changelog โ€” SemVer, the tagโ†”version contract, and the + release changelog.
    • Repository Inventory โ€” every covered repo, its type, version source, and Drone shape.
    • -
    • Genericity Matrix โ€” what is library-backed, template-provided, or authored.
    • -
    • Auth Integration โ€” consuming the shared auth-server service (spec-driven, - no auth code).
    • +
    • Genericity Matrix โ€” what is library-backed, template-provided, or + authored.
    • Library Registry โ€” the catalog of internal libraries behind all of it.

    Read the Wiki for the philosophy and rationale; these pages are the diff --git a/standards/lib/search/search_index.json b/standards/lib/search/search_index.json index f9edc62..d5d2d7a 100644 --- a/standards/lib/search/search_index.json +++ b/standards/lib/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Standards Reference","text":"

    The reference half of the Standards description: the enforceable rules, patterns, and the internal library catalog that agents consult while coding.

    • Build Recipe \u2014 the ordered, agentic checklist for a new app.
    • Layering Rules \u2014 the strict request \u2192 domain \u2192 repository layering and the rules that enforce it.
    • Composition Root \u2014 a single composition point wiring the whole app.
    • Spec-First Routing \u2014 the OpenAPI contract as the routing source of truth.
    • CRUD Template \u2014 the standardized generic resource endpoint scaffold.
    • Pipeline Scaffold \u2014 the deterministic pipeline skeleton for multi-stage jobs.
    • Worker & Progress \u2014 queued work, progress reporting, and visibility.
    • Human-in-the-Loop \u2014 guardrails and approvals inside automations.
    • Infra Adapters \u2014 how infrastructure connects without leaking into domain.
    • Drone Pipelines \u2014 the two CI shapes: a PyPI package or a Docker deployment.
    • Versioning & Changelog \u2014 SemVer, the tag\u2194version contract, and the release changelog.
    • Repository Inventory \u2014 every covered repo, its type, version source, and Drone shape.
    • Genericity Matrix \u2014 what is library-backed, template-provided, or authored.
    • Auth Integration \u2014 consuming the shared auth-server service (spec-driven, no auth code).
    • Library Registry \u2014 the catalog of internal libraries behind all of it.

    Read the Wiki for the philosophy and rationale; these pages are the reference that mirrors the standards MCP bundle.

    "},{"location":"01_build_recipe/","title":"Build Recipe","text":""},{"location":"01_build_recipe/#summary","title":"Summary","text":"

    The ordered, deterministic checklist for generating a new application of the standard shape. Every step is fixed; only the resource model (step 2), the codegen pass (step 3), and the pipeline family (step 8) need app-specific work.

    This page is served by the standards MCP as docs://modules/build_recipe. The start_app prompt on that server collects the two axes and hands off here; pull exact files with get_app_component.

    "},{"location":"01_build_recipe/#bootstrap","title":"\ud83d\ude80 Bootstrap","text":"

    From the standards docs checkout:

    cp -r <docs>/standards/src/templates/app apps/<your-app>\ncd apps/<your-app>\n

    Install the internal libraries \u2014 editable local checkouts (preferred in development) or the private index (CI / fresh machines). Credentials are environment-only; never commit them.

    # local checkouts\npip install -e ../aetos/openapi-first -e ../aetos/mongo-ops -e ../aetos/hexa \\\n            -e ../aetos/dagpipe -e ../aetos/doc-forge\n# private index\npip install --extra-index-url \\\n  \"https://$PIP_REGISTRY_USERNAME:$PIP_REGISTRY_PASSWORD@pip.aetoskia.com/simple\" .\n
    "},{"location":"01_build_recipe/#agent-prompt-copyable","title":"\ud83d\udccb Agent prompt (copyable)","text":"
    # Build a new application from the Aetos Standards blueprint\n\nYou are coding a complete new backend application conforming to the Aetos\nstandard app blueprint. Execute every step in order. Only steps 2\u20134 use the\napp-specific details provided by the user; everything else is deterministic.\n\n## Before writing any code\n\nConnect to the `standards` MCP server and read:\n- `docs://nav` (the module list)\n- `docs://modules/genericity_matrix` (Tier A library / Tier B template / Tier C authored)\n- `docs://modules/layering_rules` (the dependency rules)\n\nThen:\n- call `find_library` with `db`, `di`, `routing`, `ingestion`, `pipeline`, `docs`\n  and note the Tier A libraries that already exist \u2014 never reimplement one;\n- call `list_app_components()` and pull each file you need with\n  `get_app_component(kind, resource=..., family=...)` instead of writing it from\n  scratch.\n\n## Steps\n\n1. **Scaffold** \u2014 copy `standards/src/templates/app/` into `apps/<your-app>/`\n   (or pull the same tree via `get_app_template`). Keep the tree: `domain/`,\n   `infra/`, `interfaces/`, `pipelines/`, `tests/`, `scripts/`, plus\n   `pyproject.toml`, `openapi.yaml`, `config.py`, `init.py`, `main.py`,\n   `worker.py`, `Dockerfile`, `docker-compose.yaml`, `.env.example`.\n\n2. **Author the spec (app-specific)** \u2014 write `openapi.yaml`: resources,\n   schemas, `operationId`s, security, and extension metadata. This is the\n   contract and drives all routing. Every operation MUST have an `operationId`.\n\n3. **Generate the scaffold (codegen)** \u2014 from the spec, generate the wire\n   models and the exact handler signatures:\n   ```bash\n   openapi-first models openapi.yaml -o _gen/models.py\n   openapi-first routes openapi.yaml -o _gen/routes \\\n     --use-models --models-module _gen.models --inject-request --package --template-style\n   ```\n   `_gen/models.py` is the **wire contract** (Pydantic, one class per\n   `components.schemas` entry). `_gen/routes/<resource>/routes.py` lists every\n   `operationId` with its exact parameter signature. `--template-style` makes\n   those stubs `async def` with a `body` parameter, matching the handlers you\n   keep in `interfaces/` (without it they are sync `def` stubs taking\n   `payload`; both bind the same way). Treat `_gen/` as generated\n   (never hand-edit it) \u2014 the canonical handlers live in `interfaces/`.\n\n4. **Write each CRUD slice (app-specific)** \u2014 per resource create the four-file\n   slice: `models.py` (domain model, **no `id`**), `ports/db.py`\n   (`class XDocument(BaseDocument, X)` \u2014 id comes from `BaseDocument`),\n   `ports/service.py`, and optional `converters.py`. Follow the CRUD template.\n\n5. **Wire the composition root** \u2014 in `init.py`, build leaf repositories, then\n   dependent repositories, then services; add infra adapters (db, cache, stores,\n   progress bus, fetchers). Expose `get_svc` overloads.\n\n6. **Add routes** \u2014 create `interfaces/<resource>/routes.py` thin handlers whose\n   names match the `operationId`s (use the signatures from step 3 as your\n   checklist) and re-export them in `interfaces/openapi.py`. Add the cache\n   decorator to read endpoints.\n\n7. **Bootstrap app and worker** \u2014 confirm `main.py` runs the OpenAPI-first app\n   with its lifespan. If the app has long-running jobs, adapt `worker.py` to poll\n   the job collection, run the pipeline, and publish progress.\n\n8. **Add pipeline families (only if data-driven)** \u2014 copy `pipelines/example/`\n   to `pipelines/<family>/` with `abc.py`, `impl.py`, `pipeline.yaml`,\n   `resources/`, and reuse `pipelines/shared/` (loader + registry). Register the\n   root. Add fixtures and a parity test.\n\n9. **Add infrastructure only where needed** \u2014 Tier A capability: use the\n   library. Tier B capability: copy the template. Never hand-write a Tier A\n   library.\n\n10. **Tests** \u2014 integration tests with fakes at the HTTP edge; unit tests for\n    domain and pipeline logic; a config-consistency test for rule-driven\n    pipelines. Include `tests/integration/test_openapi_app_builds.py` (imports\n    the app, asserts `import main` binds every operation).\n\n11. **Scripts and seeds** \u2014 operator scripts under `scripts/` using\n    `init()` / `get_svc()` / `shutdown()`; run as `python -m scripts.<name>`.\n\n12. **Docs** \u2014 author GSDFC docstrings, generate `.pyi` stubs, mark the package\n    `py.typed`, and build the docs.\n\n**Definition of done:**\n- `python -c \"import main\"` succeeds.\n- `pytest` passes.\n- The app serves every operation in the spec; the worker drains its queue.\n- No domain module imports a web framework.\n- No Tier A library was reimplemented.\n
    "},{"location":"01_build_recipe/#where-the-steps-land","title":"\ud83e\udded Where the steps land","text":"

    The steps map onto the layers as follows:

    Step Package / file Depends on 1 \u00b7 Scaffold whole templates/app/ \u2014 2 \u00b7 Spec openapi.yaml \u2014 3 \u00b7 Codegen _gen/ (generated) spec, openapi-first 4 \u00b7 CRUD slices domain/<resource>/ spec, CRUD template 5 \u00b7 Wiring init.py every slice 6 \u00b7 Routes interfaces/<resource>/ services, openapi route registry 7 \u00b7 Bootstrap main.py, worker.py composition root 8 \u00b7 Pipelines pipelines/<family>/, shared/ library pipeline engine 9 \u00b7 Infra infra/ domain ports 10 \u00b7 Tests tests/ app + fixtures 11 \u00b7 Scripts scripts/ composition root 12 \u00b7 Docs docstrings + docs build code, Doc Forge"},{"location":"01_build_recipe/#the-codegen-fast-path-in-detail","title":"\ud83d\udd27 The codegen fast path, in detail","text":"

    openapi-first is spec \u2192 code only (it never generates a spec). Use it to erase the two mechanical parts of the build:

    Generated artifact Replaces Notes _gen/models.py hand-writing Pydantic wire models one class per components.schemas entry _gen/routes/<resource>/routes.py hand-typing handler signatures names == operationIds; request: Request injected

    Rules of the road:

    • Wire models are not domain models. _gen/models.py is the HTTP contract; domain/<resource>/models.py is your business shape. If the spec's schema has a required id: str, keep it off the domain model and let the document get its id from BaseDocument.
    • Use --template-style. Stubs are then async def ...(request, body: ...) matching interfaces/; without it they are sync def ...(payload: ...). Either binds (the router introspects the signature), but --template-style keeps the scaffold consistent with the code you keep.
    • Resource names are sanitized. /fetch-requests \u2192 fetch_requests.py.
    • Multipart bodies expand to UploadFile = File(...) / Form(...) params.
    • _gen/ is disposable. Regenerate on every spec change; git diff shows exactly what moved.
    "},{"location":"01_build_recipe/#definition-of-done","title":"\u26a0\ufe0f Definition of done","text":"
    • python -c \"import main\" succeeds.
    • pytest passes.
    • The app serves the spec's operations; the worker drains its queue.
    • No domain module imports a web framework.
    • No Tier A library was reimplemented.
    "},{"location":"01_build_recipe/#related","title":"Related","text":"
    • 02 \u2013 Layering Rules \u00b7 05 \u2013 CRUD Template \u00b7 06 \u2013 Pipeline Scaffold \u00b7 12 \u2013 Genericity Matrix
    "},{"location":"02_layering_rules/","title":"Layering Rules","text":""},{"location":"02_layering_rules/#summary","title":"Summary","text":"

    The dependency direction is fixed. Violating it is a design defect.

    "},{"location":"02_layering_rules/#allowed-imports","title":"Allowed imports","text":"
    interfaces/*      ->  domain/*            (services, ports, models)\ninterfaces/*      ->  infra/adapters/*    (only read-only value objects)\ndomain/*          ->  domain/*            (same layer)\ndomain/*          ->  pipelines/*         (call a pipeline via a port)\ndomain/*/ports/*  ->  infra/*             (bind adapters + libraries at the seam)\ninfra/adapters/*  ->  domain/ports/*      (implement the interface)\nmain.py/init.py   ->  everything          (composition root only)\n
    "},{"location":"02_layering_rules/#forbidden-imports","title":"Forbidden imports","text":"
    domain/*          ->  interfaces/*        (never)\ndomain/*          ->  fastapi/starlette   (never)\ninfra/adapters/*  ->  interfaces/*        (never)\ninterfaces/*      ->  infra/db/*          (state lives in resources, not imports)\n
    "},{"location":"02_layering_rules/#why","title":"Why","text":"
    • The business logic is testable without a server or an event loop.
    • Adapters can be swapped (in-memory fake, real database) without touching business logic.
    • The HTTP edge stays thin and replaceable.
    "},{"location":"02_layering_rules/#the-portadapter-contract","title":"The port/adapter contract","text":"

    The ports/ package is the seam where the domain meets infrastructure. Each domain/<resource>/ports/ module declares the resource's models/document shape and exposes factory functions that bind a concrete adapter \u2014 so a port module is allowed to import from infra/ and from the persistence libraries. Everything outside ports/ in domain/ stays framework- and driver-free.

    domain/<resource>/ports/db.py       -> document model + create_<resource>_repo()\ndomain/<resource>/ports/service.py  -> service + get_<resource>_service()\ninfra/db/repos/<vendor>.py          -> repository adapter factory\ninfra/adapters/service.py           -> generic CRUD service base\n

    The composition root calls the port factories; nothing else constructs an adapter.

    "},{"location":"02_layering_rules/#enforcement","title":"Enforcement","text":"
    • domain/ must never import the web framework (fastapi / starlette) or interfaces/. Only the ports/ seam, infra/, and the composition root touch drivers.
    • Reviewers (and CI) reject import fastapi inside domain/ or infra/.
    "},{"location":"03_composition_root/","title":"Composition Root","text":""},{"location":"03_composition_root/#summary","title":"Summary","text":"

    All wiring happens in exactly one module. It builds a flat resource registry and exposes it to the HTTP layer and to scripts.

    "},{"location":"03_composition_root/#the-resource-registry","title":"The resource registry","text":"

    init.py returns a plain dict[str, Any]. Keys follow two conventions:

    • <resource>_repo \u2014 a repository adapter for a resource.
    • <resource>_svc \u2014 a service for a resource.

    Plus named infrastructure adaptors:

    • http_cache_store \u2014 response cache backend.
    • progress_bus \u2014 progress/event bus.
    • <vendor>_<kind> \u2014 fetchers, clients, stores.

    The API stores the dict on app.state.db_resources during lifespan startup. Handlers read from it; nothing imports concrete adapters.

    "},{"location":"03_composition_root/#shape","title":"Shape","text":"
    _resources: dict = {}\n_initialized = False\n\nasync def init(settings=None) -> dict:\n    global _initialized\n    if _initialized:\n        return _resources\n\n    await setup_database(uri=settings.mongo_uri, db_name=settings.mongo_db)\n\n    # 1. leaf repositories\n    user_repo = create_user_repo()\n\n    # 2. dependent repositories (dependencies passed by keyword)\n    wallet_repo = create_wallet_repo(user_repo=user_repo)\n\n    # 3. services (build via the DI library, injecting the repo)\n    _resources[\"user_repo\"]   = user_repo\n    _resources[\"wallet_repo\"] = wallet_repo\n    _resources[\"user_svc\"]    = get_user_service(user_repo)\n    _resources[\"wallet_svc\"]  = get_wallet_service(wallet_repo)\n\n    # 4. infrastructure adaptors (optional)\n    _resources[\"http_cache_store\"] = HttpCacheStore(...)\n    _resources[\"progress_bus\"]     = ProgressEventBus()\n\n    _initialized = True\n    return _resources\n\nasync def shutdown() -> None:\n    global _initialized\n    await close_stores(_resources)\n    await shutdown_database()\n    _resources.clear()\n    _initialized = False\n
    "},{"location":"03_composition_root/#typed-accessors","title":"Typed accessors","text":"

    Expose a get_svc(name) helper with one @overload per key so scripts get typing without importing concrete classes:

    @overload\ndef get_svc(name: Literal[\"user_svc\"]) -> UserService: ...\n@overload\ndef get_svc(name: Literal[\"wallet_svc\"]) -> WalletService: ...\n\ndef get_svc(name: str):\n    return _resources[name]\n

    Also expose get_db() (raw database handle) and pure helpers such as compute_fingerprint(payload) (canonical hash used for deduplication).

    "},{"location":"03_composition_root/#rules","title":"Rules","text":"
    • init() is idempotent.
    • The composition root is the only place that imports concrete adapters.
    • Handlers never call init(); they read request.app.state.db_resources.
    • Scripts call init() / shutdown() around their work.
    "},{"location":"04_spec_first_routing/","title":"Spec-First Routing","text":""},{"location":"04_spec_first_routing/#summary","title":"Summary","text":"

    The OpenAPI document is the single source of truth for the HTTP contract. Handlers are bound to it by name; there is no decorator router.

    "},{"location":"04_spec_first_routing/#the-contract","title":"The contract","text":"
    • openapi.yaml (or .json) declares paths, schemas, parameters, responses, and security.
    • A custom operationId names the handler function.
    • The framework (openapi_first) validates requests/responses against the spec and dispatches to the handler whose name equals operationId.
    "},{"location":"04_spec_first_routing/#app-bootstrap","title":"App bootstrap","text":"
    # main.py\nfrom openapi_first.app import OpenAPIFirstApp\n\napp = OpenAPIFirstApp(\n    openapi_path=\"openapi.yaml\",\n    routes_module=interfaces.openapi,   # module whose namespace holds handlers\n    title=\"<App> API\",\n    version=\"0.1.0\",\n    lifespan=lifespan,\n)\n

    lifespan calls the composition root:

    @asynccontextmanager\nasync def lifespan(app):\n    app.state.db_resources = await init()\n    yield\n    await shutdown()\n
    "},{"location":"04_spec_first_routing/#handler-registry","title":"Handler registry","text":"

    interfaces/openapi.py is a flat re-export of every handler, so the framework can resolve operationId across the whole app:

    from interfaces.item.routes import *\nfrom interfaces.wallet.routes import *\nfrom interfaces.progress.sse import *\n
    "},{"location":"04_spec_first_routing/#handler-shape","title":"Handler shape","text":"

    Handlers are thin and synchronous with respect to business logic:

    async def create_item(request: Request, body: dict):\n    svc = request.app.state.db_resources[\"item_svc\"]\n    return await svc.create(Item.model_validate(body))\n

    Generated stubs. openapi-first routes emits this exact shape (async def handlers taking body) when given --template-style; without that flag the stub is def create_item(payload: ItemInput) \u2014 sync, with a payload parameter. Both shapes bind identically: the router resolves handlers by operationId and introspects the FastAPI signature, and it never inspects the request body. Pass --template-style so the generated signatures match the handlers you keep in interfaces/.

    "},{"location":"04_spec_first_routing/#conventions","title":"Conventions","text":"
    • operationId naming: list_<resource>, create_<resource>, get_<resource>, update_<resource>, delete_<resource>.
    • Read-only endpoints may use a cache decorator keyed on path + query + user.
    • Validation errors -> 400; not found -> 404; delete -> 204.
    • Security is declared once in the spec and enforced by the framework; handlers contain no auth code.
    "},{"location":"04_spec_first_routing/#authless-apps","title":"Authless apps","text":"

    Auth is deferred in the standard: the same spec-first app runs with or without it, because security lives entirely in the spec, never in handlers. For an app that needs no auth yet, do not invent per-handler auth checks \u2014 just omit the security keys:

    • Remove the top-level security: block.
    • Remove components.securitySchemes.
    • Do not add security: [] to operations. An explicit empty array is a per-operation override that means \"public\", and it only matters when a global security block exists. Leaving every operation without a security key is the cleanest authless spec.

    Profile endpoints (/users/me) and profile headers (x-profile) still exist in an authless app. Define a stand-in identity in the composition root \u2014 for example get_current_user returns or lazily creates a fixed \"Demo User\" \u2014 so handlers stay auth-agnostic and only the wiring changes when real auth arrives.

    The handlers, services, and composition root are unchanged. When auth is needed later, add the global security block and an introspecting dependency; only handlers that must opt out get security: [].

    "},{"location":"04_spec_first_routing/#codegen","title":"Codegen","text":"

    openapi_first scaffolds models and route stubs from the spec (see the Build Recipe, step 3):

    openapi-first models openapi.yaml -o _gen/models.py\nopenapi-first routes openapi.yaml -o _gen/routes \\\n  --use-models --models-module _gen.models --inject-request --package --template-style\n

    Prefer codegen over hand-writing boilerplate. The result is the wire contract and a set of operationId-named signatures \u2014 not the canonical handlers.

    "},{"location":"05_crud_template/","title":"CRUD Template","text":""},{"location":"05_crud_template/#summary","title":"Summary","text":"

    Every resource follows the same four-file slice. Repetition is intentional: it makes the codebase predictable and generatable.

    "},{"location":"05_crud_template/#the-slice","title":"The slice","text":"
    domain/<resource>/\n    models.py               # pure Pydantic model (no DB fields)\n    ports/\n        db.py               # document model + repository factory\n        service.py          # service class + factory\n        converters.py       # (optional) transforms\n
    "},{"location":"05_crud_template/#the-id-rule-model-vs-document","title":"The id rule (model vs. document)","text":"

    Two different objects, two different jobs:

    Object Lives in Has id? Purpose Domain model domain/<resource>/models.py No business shape, framework-free Document domain/<resource>/ports/db.py Yes (from BaseDocument) Mongo persistence shape

    BaseDocument (mongo-ops) supplies id: Optional[PyObjectId] (aliased to _id) plus created_at / updated_at. The domain model must not declare id; Mongo owns it.

    Trap \u2014 generated wire models. openapi-first models produces the HTTP contract (see the Build Recipe, step 3). Response schemas frequently declare a required id: str, so a generated class is not a domain model. If you write class ItemDocument(Item, BaseDocument) and Item re-exports a required id: str, that field shadows BaseDocument.id and no Mongo _id can ever be set. Fix it one of three ways:

    1. Preferred: keep the domain model id-free (hand-author it from the CRUD template), and keep the required id only on the wire model.
    2. Order the bases so the document wins: class ItemDocument(BaseDocument, Item).
    3. Keep a separate document type and translate with ports/converters.py.
    "},{"location":"05_crud_template/#modelspy","title":"models.py","text":"

    A framework-free Pydantic model describing the business shape (no id).

    class Item(BaseModel):\n    name: str\n    quantity: int = 0\n
    "},{"location":"05_crud_template/#portsdbpy","title":"ports/db.py","text":"

    The persistence model extends the business model and adds database concerns. The repository factory selects the right repository flavour.

    # Item is id-free; BaseDocument adds id/created_at/updated_at.\nclass ItemDocument(Item, BaseDocument):\n    pass\n\ndef create_item_repo(*, owner_repo=None) -> ItemRepository:\n    return repo_factory(\n        collection=\"items\",\n        document=ItemDocument,\n        populate_rules=[PopulateRule(field_name=\"owner\", collection_name=\"users\")],\n        cache=None,               # or a CachedBaseRepository config\n    )\n
    "},{"location":"05_crud_template/#nested-references","title":"Nested references","text":"

    The wire contract often declares a reference as an expanded object (expense.entity: Entity), while the domain model stays id-free. Pick one convention and apply it consistently:

    • Embed (default for small, stable refs) \u2014 store the object as a dict / list[dict] on the document; the API returns it verbatim. No populate wiring.
    • Populate \u2014 store an id and declare a PopulateRule; mongo-ops expands it on read. The referenced repo must be registered with the PopulationEngine.
    • Id only \u2014 store the id and let the client resolve it.

    For populate-backed repositories change a reference with update, not patch: patch rejects changes to populated FK fields by design.

    "},{"location":"05_crud_template/#portsservicepy","title":"ports/service.py","text":"

    The service is built through the DI library, injecting the repository. The generic CRUD base provides create/read/update/patch/delete/search/....

    class ItemService(CrudsServiceAdaptor[Item, ItemDocument]):\n    model = Item\n    schema = ItemDocument\n\ndef get_item_service(repo) -> ItemService:\n    return build(ItemService, instances={\"repo\": repo})\n
    "},{"location":"05_crud_template/#naming-conventions","title":"Naming conventions","text":"Concept Convention collection plural snake case (items) document <Resource>Document repository factory create_<resource>_repo service <Resource>Service service factory get_<resource>_service resource key <resource>_svc operationId list_items, create_item, ..."},{"location":"05_crud_template/#optional-files","title":"Optional files","text":"
    • converters.py \u2014 pure functions mapping between domain types.
    • ports/enrichment.py \u2014 adapts a pipeline into an async callable the service can invoke (used when a resource is populated by a pipeline).
    "},{"location":"06_pipeline_scaffold/","title":"Pipeline Scaffold","text":""},{"location":"06_pipeline_scaffold/#summary","title":"Summary","text":"

    Data-driven processing is expressed as a composition graph. The graph is built by a DI library; execution is driven by a DAG engine. Stages are pure and individually testable.

    "},{"location":"06_pipeline_scaffold/#when-to-use-a-pipeline","title":"When to use a pipeline","text":"

    Use a pipeline when a resource is produced by a multi-step transformation of an input (a document, a file, a message) rather than by a simple CRUD write.

    "},{"location":"06_pipeline_scaffold/#structure-of-a-family","title":"Structure of a family","text":"

    A family is one input shape (e.g. a file format or a message kind). Each family has the same skeleton:

    pipelines/<family>/\n    abc.py            # port contracts (stage interfaces + root interface)\n    impl.py           # concrete stages + root implementation\n    pipeline.yaml     # graph spec: nodes, edges, roots, schema\n    resources/\n        pipeline.yaml # runtime spec consumed by the loader\n        patterns/*.yaml  # rule fragments (pattern registry)\n    banks/<variant>.py   # optional variants that re-pin a few slots\n
    "},{"location":"06_pipeline_scaffold/#shared-scaffolding","title":"Shared scaffolding","text":"
    pipelines/shared/\n    ports.py     # RegistryPort, FinalizePort, etc.\n    loader.py    # build(root_cls) -> wires the graph + engine\n    registry.py  # resolve_root(...) -> root class for a (kind, variant)\n
    "},{"location":"06_pipeline_scaffold/#the-loader","title":"The loader","text":"
    def build(root_cls, *, instances=None, config=None):\n    # merge resources/patterns/*.yaml into a pattern registry\n    # bind registry/config into each graph node by id\n    # build the schema (state) class and the engine\n    root = root_cls()\n    root._engine = Engine(graph, state_cls, payload_cls)\n    return root\n
    "},{"location":"06_pipeline_scaffold/#the-registry","title":"The registry","text":"

    A single lookup replaces hand-rolled if/else selection:

    _FAMILIES = {\n    \"csv\":  {\"acme\": {\"heuristic\": AcmeCsvPipeline}},\n    \"json\": {\"globex\": {\"heuristic\": GlobexJsonPipeline}},\n}\n\ndef resolve_root(kind, variant, mode=\"heuristic\"):\n    return _FAMILIES[kind][variant][mode]\n

    Adding a new variant means adding one class and one registry entry.

    "},{"location":"06_pipeline_scaffold/#driving-a-pipeline","title":"Driving a pipeline","text":"

    Stages are driven explicitly so intermediate state can be persisted:

    pipeline = build(resolve_root(kind, variant))\ncontent = pipeline.ingest.materialize(raw_bytes)\nrecords = pipeline.reader.read(content)\nitems   = pipeline.normalize.build(records)\n
    "},{"location":"06_pipeline_scaffold/#testing","title":"Testing","text":"

    Because stages are pure, test each stage in isolation and test the assembled root against fixture inputs whose expected outputs are stored as golden files. A parity test replays fixtures headlessly.

    "},{"location":"07_worker_and_progress/","title":"Worker & Progress","text":""},{"location":"07_worker_and_progress/#summary","title":"Summary","text":"

    Long-running work runs in a background worker. Jobs are durable documents that move through an explicit status machine. Progress is streamed to clients.

    "},{"location":"07_worker_and_progress/#the-status-machine","title":"The status machine","text":"
    pending -> processing -> completed\n                     \\-> failed    (retried up to N times)\n                     \\-> paused    (waiting for human input)\n
    • pending \u2014 queued, eligible for pickup.
    • processing \u2014 claimed by a worker.
    • paused \u2014 blocked on a human-in-the-loop question.
    • failed \u2014 error; retry_count increments until a max, then skipped.
    • completed \u2014 terminal success.
    "},{"location":"07_worker_and_progress/#the-poll-loop","title":"The poll loop","text":"
    async def poll(resources):\n    backoff = MIN_POLL\n    while True:\n        jobs = await job_svc.search(filter={\"status\": \"pending\"}, limit=100)\n        backoff = MIN_POLL if jobs else min(backoff * 2, MAX_POLL)\n        for job in jobs:\n            if (job.retry_count or 0) >= MAX_RETRIES:\n                continue\n            await job_svc.update_status(job.id, \"processing\")\n            try:\n                await process(job, resources)\n            except PauseForResolution:\n                await job_svc.update_status(job.id, \"paused\")\n            except Exception as e:\n                await job_svc.update_status(\n                    job.id, \"failed\", error=str(e),\n                    retry_count=(job.retry_count or 0) + 1,\n                )\n        await asyncio.sleep(backoff)\n

    Tunables live in environment variables: WORKER_POLL_MIN, WORKER_POLL_MAX, WORKER_MAX_RETRIES.

    "},{"location":"07_worker_and_progress/#progress-events","title":"Progress events","text":"

    A worker publishes structured progress events to a bus (a port). The HTTP edge exposes a streaming endpoint that replays events for a given job id.

    class ProgressEvent(BaseModel):\n    job_id: str\n    step: str\n    status: str            # started | progress | completed | skipped | paused\n    message: dict | None = None\n

    The bus is an in-memory adapter by default; because it is a port, it can be swapped for a durable broker. Emit from the orchestrator at each stage:

    await self.bus.publish(ProgressEvent(job_id=jid, step=\"normalize\",\n                                     status=\"completed\", message={\"count\": n}))\n
    "},{"location":"07_worker_and_progress/#streaming-endpoint","title":"Streaming endpoint","text":"
    async def stream_job_events(request, id):\n    bus = request.app.state.db_resources.get(\"progress_bus\")\n    if bus is None:\n        return {\"events\": []}\n\n    async def gen():\n        sent = 0\n        while True:\n            events = bus.get_events(id)\n            for e in events[sent:]:\n                yield f\"data: {e.model_dump_json(exclude_none=True)}\\n\\n\"\n                sent += 1\n            await asyncio.sleep(0.5)\n\n    return StreamingResponse(gen(), media_type=\"text/event-stream\")\n

    Known limitation. The default in-memory bus is per-process. If the worker and the API run as separate processes, events published by the worker are not visible to the API. For production, back the bus with a shared broker. The port boundary makes this a one-adapter change.

    "},{"location":"08_human_in_loop/","title":"Human-in-the-Loop","text":""},{"location":"08_human_in_loop/#summary","title":"Summary","text":"

    Some inputs are ambiguous and must be resolved by a human before processing can continue. The blueprint models this as a durable pause: an exception is raised, a question is recorded, the job pauses, and later resumes.

    "},{"location":"08_human_in_loop/#the-mechanism","title":"The mechanism","text":"
    1. During processing, a stage raises a domain exception carrying the context needed to ask the question:
    raise PauseForResolution(\n    job_id=jid,\n    reference=\"<stable key for this decision>\",\n    options=[...],\n    context={...},\n)\n
    1. The orchestrator catches it, records a question document, and re-raises so the worker marks the job paused.
    2. A client lists pending questions and answers one:
    GET  /jobs/{id}/questions            -> list pending questions\nPOST /questions/{qid}/resolve  {choice}  -> record the choice\n
    1. When the last pending question is resolved, the resolve endpoint flips the parent job back to pending.
    2. The worker picks it up again, rebuilds a resolution map from previously answered questions, and seeds it into the pipeline so the same decision is not asked twice.
    "},{"location":"08_human_in_loop/#the-question-document","title":"The question document","text":"
    class Question(BaseDocument):\n    job_id: str\n    reference: str            # stable key: stage|field|value\n    status: str               # pending | resolved\n    options: list[dict]\n    context: dict\n    chosen: dict | None = None\n    resolved_at: str | None = None\n
    "},{"location":"08_human_in_loop/#resume-map","title":"Resume map","text":"

    The worker turns answered questions into a lookup keyed by reference, then injects it into the pipeline so that stage can skip re-raising:

    resolved = {q.reference: q.chosen for q in await svc.search(\n    filter={\"job_id\": jid, \"status\": \"resolved\"})}\n\npipeline = build(root, instances={\"pause\": handler}, config={\"resolved\": resolved})\n
    "},{"location":"08_human_in_loop/#resolve-endpoint","title":"Resolve endpoint","text":"
    async def resolve_question(request, id, body):\n    svc = request.app.state.db_resources[\"question_svc\"]\n    q = await svc.read(id)\n    await svc.update(id, {\"chosen\": body[\"chosen\"], \"status\": \"resolved\",\n                          \"resolved_at\": now()})\n\n    pending = await svc.search(filter={\"job_id\": q.job_id, \"status\": \"pending\"},\n                               limit=1)\n    if not pending:\n        jobs = request.app.state.db_resources[\"job_svc\"]\n        job = await jobs.read(q.job_id)\n        if job and job.status == \"paused\":\n            await jobs.update_status(q.job_id, \"pending\")\n    return q\n
    "},{"location":"08_human_in_loop/#cli-parity","title":"CLI parity","text":"

    The same flow is available through scripts/CLI: list, get, create, questions, resolve, retry.

    "},{"location":"09_infra_adaptors/","title":"Infra Adapters","text":""},{"location":"09_infra_adaptors/#summary","title":"Summary","text":"

    All external systems are reached through adapters in infra/. Prefer an existing internal library over writing a new adapter; where no library exists, copy the Tier B scaffold from templates/app. See the Genericity Matrix for the Tier A / B / C split.

    "},{"location":"09_infra_adaptors/#database-mongodb","title":"Database (MongoDB)","text":"
    • A single connection manager owns the client lifecycle. setup_database(uri, db_name) / shutdown_database().
    • A repository factory selects the repository flavour:
    repo_factory(collection, document, engine=None,\n             populate_rules=None, cache=None)\n
    • base repository \u2014 plain CRUD;
    • populating repository \u2014 resolves referenced documents (foreign keys);
    • cached repository \u2014 an LRU/TTL cache in front of reads.

    • Referenced documents are described declaratively:

    PopulateRule(field_name=\"owner\", collection_name=\"users\",\n             nested_rules=[], max_depth=2, projection=None)\n
    • Transactions use a session context manager provided by the library.

    Tier A \u2014 Library (Mongo Ops). Do not write raw Motor calls in the domain; consult the registry and the library's MCP before touching the driver.

    "},{"location":"09_infra_adaptors/#http-response-cache","title":"HTTP response cache","text":"

    Tier B \u2014 template. Copy from templates/app; not a standalone library.

    A generic GET cache sits behind a decorator.

    @cache_response(ttl=60)\nasync def list_items(request): ...\n
    • Keyed on path + query + user.
    • No-op when no store is wired.
    • invalidate(*resources) bumps a generation counter for write-triggered invalidation.
    "},{"location":"09_infra_adaptors/#event-progress-bus","title":"Event / progress bus","text":"

    Tier B \u2014 template. Copy from templates/app.

    A port with an in-memory default adapter (publish, get_events). Swap for a durable broker in production (see Worker & Progress).

    "},{"location":"09_infra_adaptors/#external-clients-ingestion","title":"External clients (ingestion)","text":"

    External fetchers (files, mail, HTTP) are adapters that wrap ingestion libraries. Construct them in the composition root and inject into orchestrators.

    Tier A \u2014 Libraries: Omniread (formats) and Mail Intake (email).

    "},{"location":"09_infra_adaptors/#llm-clients","title":"LLM clients","text":"

    Tier B \u2014 template. Copy the pool scaffold from templates/app.

    When a pipeline calls a model provider, route through a pool adaptor that handles provider selection, retries, and client lifecycle:

    pool = setup_async_pool(provider=settings.llm_provider)\nresult = await pool.complete(model=\"...\", messages=[...])\n

    Providers are selected by LLM_PROVIDER and configured by environment.

    "},{"location":"09_infra_adaptors/#key-value-store","title":"Key-value store","text":"

    Tier B \u2014 template. Copy from templates/app.

    For report/snapshot storage, provide a pluggable store port with a Redis adapter and an in-memory fallback.

    "},{"location":"09_infra_adaptors/#rule","title":"Rule","text":"
    • Tier A (libraries: DB, DI, ingestion, mail, auth, docs, pipelines) \u2014 use the library; writing a private copy is a defect. Query find_library first.
    • Tier B (cache, progress bus, LLM pool, KV store, composition shape, worker, tests) \u2014 these are template code, not libraries: copy them from templates/app rather than searching the registry.
    • Tier C (models, business logic, pipeline families, rules) \u2014 author them yourself.
    "},{"location":"10_drone_pipelines/","title":"Drone Pipelines","text":""},{"location":"10_drone_pipelines/#summary","title":"Summary","text":"

    Every Aetos repository ships a Drone CI definition at .drone.yml. There is exactly one standard per repository, and there are two types of file, chosen by what the repository produces:

    Type File Produces Repos A \u2014 PyPI package templates/drone/python-lib.yaml A wheel + sdist on the private index dagpipe, doc-forge, hexa, mail-intake, mongo-ops, omniread, openapi-first, py-jwt B \u2014 Docker deployment templates/drone/service-docker.yaml An image pushed to the registry and run as a container auth-server

    Both templates run on platform: linux / arm64 with the workspace at /drone/src. Copy the matching template to <repo>/.drone.yml; the Type A file needs no edits, the Type B file needs its placeholders filled in (below).

    Conventions: .drone.yml (not .yaml), one file per repo, secrets injected with from_secret \u2014 never commit credentials.

    "},{"location":"10_drone_pipelines/#type-a-pypi-package-python-libyaml","title":"Type A \u2014 PyPI package (python-lib.yaml)","text":"

    For internal libraries. The file contains two pipelines:

    1. build-and-publish-pypi \u2014 triggered on tag:
    2. check-version \u2014 guard: fail unless $DRONE_TAG equals the version in pyproject.toml; then read name / version and query $PIP_REPO_URL/simple/<package>/; if that version already exists, exit 78 and skip the whole build (see 11 \u2013 Versioning & Changelog).
    3. quality-gate \u2014 install the package with its [dev] extras from the private index, then black --check, ruff check, mypy, pydoclint, pytest.
    4. build-package \u2014 python -m build into dist/.
    5. upload-to-private-pypi \u2014 twine upload to $PIP_REPO_URL.
    6. backfill-pypi-from-tags \u2014 triggered on custom:
    7. fetch-tags \u2014 git fetch --tags --force.
    8. build-and-upload-missing \u2014 walk every tag in version order, skip the ones already on the index, git checkout the rest, verify tag == pyproject version at that commit, build, and upload. This is the disaster-recovery / replay path.

    Secrets: PIP_REPO_URL, PIP_USERNAME, PIP_PASSWORD.

    • Ship as-is. Package name and version come from pyproject.toml, so the same file is reused verbatim across every library.
    "},{"location":"10_drone_pipelines/#type-b-docker-deployment-service-dockeryaml","title":"Type B \u2014 Docker deployment (service-docker.yaml)","text":"

    For a service that ships a container image \u2014 a long-running API/worker, e.g. auth-server. The file contains one pipeline, build-and-deploy-service, triggered on tag:

    • fetch-tags \u2014 resolve the latest tag into LATEST_TAG.txt; fail if there are no tags.
    • check-version \u2014 guard: fail unless $DRONE_TAG equals the repo-root VERSION file (see 11 \u2013 Versioning & Changelog).
    • check-remote-image \u2014 if aetos/<app>:<tag> already exists locally, exit 78 and skip the build.
    • quality-gate \u2014 install from requirements.txt and run black / ruff / mypy / pytest.
    • build-image \u2014 docker build with the private-index build args, tagged aetos/<app>:<tag> and :latest.
    • push-image \u2014 login, re-tag with $REGISTRY_HOST, push both tags.
    • stop-old \u2014 docker rm -f <app>.
    • run-container \u2014 docker run -d --name <app> -p <host>:<container> --restart always with the service's -e environment.

    Secrets: PIP_REPO_URL, PIP_USERNAME, PIP_PASSWORD (service build args), REGISTRY_HOST, REGISTRY_USER, REGISTRY_PASS, plus the service runtime env (for example MONGO_*, JWT_SECRET).

    Placeholders to fill in per repo:

    Placeholder Meaning Example <app> service image / container name auth-server aetos/<app> image repository on the registry aetos/auth-server <host-port> / <container-port> published : in-image port 9003:8000 <ENV_VAR> runtime environment variable MONGO_HOST"},{"location":"10_drone_pipelines/#what-not-to-do","title":"What not to do","text":"
    • Do not hand-roll a third shape. A repo is either Type A or Type B, never both.
    • Do not inline secrets; always use from_secret.
    • Do not drop the check-version / check-remote-image skip \u2014 it guards the index and the running container against duplicate publishes.
    • Do not drop the tag\u2194version guard. A package needs its pyproject.toml version to equal the tag; a service needs a root VERSION file that equals the tag. See 11 \u2013 Versioning & Changelog.
    • Do not rename the pipelines; tooling and runbooks key off build-and-publish-pypi and build-and-deploy-service.
    "},{"location":"10_drone_pipelines/#related","title":"Related","text":"
    • 01 \u2013 Build Recipe \u00b7 09 \u2013 Infra Adapters \u00b7 11 \u2013 Versioning & Changelog \u00b7 13 \u2013 Library Registry
    "},{"location":"11_versioning_and_changelog/","title":"Versioning & Changelog","text":""},{"location":"11_versioning_and_changelog/#summary","title":"Summary","text":"

    Every Aetos artifact \u2014 library or service \u2014 is versioned with Semantic Versioning and documents its releases in a Keep a Changelog file. The version file is the source of truth, the git tag must equal it, and a Drone guard enforces that equality before anything is published. Releases are cut manually; a tag is what triggers the pipeline.

    This page pairs with 10 \u2013 Drone Pipelines: the version and tag contract is exactly what those two CI shapes consume.

    "},{"location":"11_versioning_and_changelog/#the-version-contract","title":"The version contract","text":"Artifact Source of truth Notes Library (PyPI package) version in pyproject.toml check-version also reads it to skip duplicates Service (Docker) VERSION file at the repo root one line, x.y.z; the service reads it (build-arg) \u2014 never hardcode the version

    Rules:

    1. One version per repository. No per-module versions.
    2. Tag = version. The git tag is bare SemVer (0.0.6), no v prefix, and it MUST match the version file byte-for-byte. The Drone guard fails the build otherwise \u2014 this is what stops a tag from silently publishing nothing.
    3. A release is a tag, created after the change is merged. The version bump and the changelog promotion travel inside the merge request (MR); the tag is added on the merged commit and pushed. See Tagging strategy.
    4. Never reuse a tag. If a release is wrong, cut a new patch version.
    "},{"location":"11_versioning_and_changelog/#pre-10-0yz","title":"Pre-1.0 (0.y.z)","text":"

    While a package is 0.y.z, 0.y is treated as the major line:

    • breaking change \u2192 0.(y+1).0
    • new feature \u2192 0.y.(z+1)
    • bug fix \u2192 0.y.(z+1)

    Once a package reaches 1.0.0, normal SemVer applies. Do not ship 1.0.0 until the public API is considered stable.

    "},{"location":"11_versioning_and_changelog/#the-changelog","title":"The changelog","text":"

    CHANGELOG.md at the repo root, in Keep a Changelog form. It always has exactly one open [Unreleased] section with the change categories that apply:

    ## [Unreleased]\n\n### Added\n### Changed\n### Deprecated\n### Removed\n### Fixed\n### Security\n

    On release you promote it \u2014 never delete history:

    ## [0.0.6] - 2026-03-07\n\n### Added\n- ...\n

    and add a link reference at the bottom:

    [Unreleased]: https://git.aetoskia.com/aetos/<repo>/compare/0.0.6...HEAD\n[0.0.6]: https://git.aetoskia.com/aetos/<repo>/compare/0.0.5...0.0.6\n

    Conventions:

    • Write entries for humans: one line each, imperative, referencing the user impact, not the commit hash.
    • Categories: Added, Changed, Deprecated, Removed, Fixed, Security. Omit empty categories.
    • Security fixes get their own entry even if the change is otherwise a bug fix.
    • Keep [Unreleased] current: add an entry in the same change that introduces the behaviour, not later.
    • The [Unreleased] heading is never renamed; copy its content into the new version heading and clear it.
    "},{"location":"11_versioning_and_changelog/#reconcile-before-releasing","title":"Reconcile before releasing","text":"

    [Unreleased] is a draft, not the source of truth. It is only trustworthy when it was maintained alongside each change; a long-running branch or a change that skipped the changelog leaves it stale, so it can silently under-report a release. Verify it against the change before you promote:

    1. List what actually changed since the last release: git log <last-tag>..HEAD and git diff --stat <last-tag>..HEAD.
    2. Compare that against [Unreleased]; add an entry for every user-facing change that is missing.
    3. Always show the proposed additions to the user and wait for approval before promoting. If an entry is ambiguous, ask rather than guess.

    Only then promote. Never cut a release with a known gap between the diff and the changelog.

    "},{"location":"11_versioning_and_changelog/#tagging-strategy-mr-based","title":"Tagging strategy (MR-based)","text":"

    The release version is known while the change is still a merge request, so the bump travels with the change and only the tag is added afterwards:

    1. In the MR \u2014 reconcile [Unreleased] against the change (see Reconcile before releasing) and get the user's approval for any additions. Then set the intended release version: version in pyproject.toml (or the VERSION file) to x.y.z, and promote the changelog (below). Changelog entries and link references name the version/tag, never a commit id.
    2. Merge or squash the MR into main.
    3. Create the tag x.y.z on the resulting commit (the merge/squash commit).
    4. Push the tag (git push origin x.y.z) \u2014 Drone builds the release.

    Because the version bump is inside the tagged commit, the guard's tag == version check can only fail if the wrong commit was tagged.

    "},{"location":"11_versioning_and_changelog/#agent-assisted-tagging","title":"Agent-assisted tagging","text":"

    The agent neither authors nor merges the MR, and never tags before the merge. After the user confirms the MR is merged/squashed and says to proceed:

    1. Wait for that explicit go-ahead.
    2. Find the commit that introduced the version bump:
    3. packages: git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml
    4. services: git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION
    5. Confirm that commit's version file equals x.y.z, then tag only that commit, lightweight and bare: git tag x.y.z <sha>.
    6. Do not push. Ask the user to push the tag: git push origin x.y.z.
    "},{"location":"11_versioning_and_changelog/#release-checklist","title":"Release checklist","text":"
    1. Confirm the quality gate is green and main is up to date.
    2. In the MR: reconcile [Unreleased] against the change being released \u2014 git log <last-tag>..HEAD and git diff --stat <last-tag>..HEAD \u2014 add any missing user-facing entries, and get the user's approval for the additions. Then move every [Unreleased] entry under the new version heading with the target date (## [x.y.z] - YYYY-MM-DD) and restore an empty [Unreleased] on top.
    3. In the MR: add the two compare-link references at the bottom of the changelog, naming the version/tag (never a commit id).
    4. In the MR: set the version file \u2014 pyproject.toml (version = \"x.y.z\") or VERSION \u2014 to the intended release version.
    5. Merge or squash the MR into main.
    6. Create the tag on the resulting commit: lightweight git tag x.y.z.
    7. Push the tag (git push origin x.y.z). Watch Drone: Type A publishes the wheel/sdist, Type B builds and deploys the image; both first assert tag == version.
    8. Do not reuse the tag if the run fails \u2014 fix and cut x.y.(z+1).
    "},{"location":"11_versioning_and_changelog/#why-the-guard-matters","title":"Why the guard matters","text":"

    The version file and the tag are two facts that must agree; nothing in git enforces that by itself. A mismatch is not a theoretical risk \u2014 a package can be tagged 0.0.2 while its pyproject.toml still says 0.0.1, and the publish step (which compares the file against the index) then skips the build entirely, so 0.0.2 never reaches the index while looking like a release. The Drone guard turns that silent no-op into a hard failure.

    "},{"location":"11_versioning_and_changelog/#related","title":"Related","text":"
    • 10 \u2013 Drone Pipelines \u00b7 15 \u2013 Repository Inventory \u00b7 01 \u2013 Build Recipe \u00b7 13 \u2013 Library Registry
    "},{"location":"12_genericity_matrix/","title":"Genericity Matrix","text":""},{"location":"12_genericity_matrix/#summary","title":"Summary","text":"

    This page states precisely what is library-backed, what is template-provided, and what is app-specific and must be authored. Use it to scope a new build and to know, for any given capability, whether to call a library, copy template code, or write it yourself.

    "},{"location":"12_genericity_matrix/#tier-a-library-backed-use-never-reimplement","title":"Tier A \u2014 Library-backed (use; never reimplement)","text":"

    These capabilities already exist as internal libraries. Reach them through the library registry MCP (find_library(capability)) and read the library's own MCP for its API. Writing a private copy of any of these is a defect.

    Capability Library MCP Persistence: repositories, cache, populate, transactions Mongo Ops (mongo_ops) :8007 Dependency injection / composition Hexa (hexa) :8008 Deterministic multi-step transformation engine DAG Pipe (dagpipe) :8006 Spec-first HTTP edge, client, codegen OpenAPI First (openapi_first) :8004 Format-agnostic fetch + parse (HTML, PDF, CSV, XLSX) Omniread (omniread) :8003 Read-only email ingestion Mail Intake (mail_intake) :8002 JWT auth primitives (register, login, introspect) Py JWT (jwtlib) :8005 Documentation build (MkDocs + MCP) Doc Forge (docforge) :8001"},{"location":"12_genericity_matrix/#tier-b-template-provided-copy-from-templatesapp-then-adapt","title":"Tier B \u2014 Template-provided (copy from templates/app, then adapt)","text":"

    These are reusable internal components shipped inside the template \u2014 they are not independent libraries. Copy them as-is, then rename/populate only what is app-specific. They give every app the same wiring shape as the reference app. Fetch them by kind with get_app_component, or the whole tree with get_app_template.

    Component Template location Action Shipped Layering & dependency rule the package layout + import rules keep \u2705 Composition root shape init.py (get_svc/get_db, idempotency) keep \u2705 Spec-first web edge interfaces/openapi.py, thin handlers bound to operationId keep \u2705 CRUD slice pattern domain/<resource>/{models.py, ports/db.py, ports/service.py, converters.py} rename + fill \u2705 Generic CRUD service infra/adapters/service.py (CrudsServiceAdaptor) keep \u2705 Repository factory infra/db/repos/mongo.py (_repo_factory) keep \u2705 Worker poll + status loop worker.py keep \u2705 Progress bus infra/adapters/sse.py (keyed in-memory bus) + an app SSE endpoint keep \u2705 HTTP response cache infra/http_cache.py (cache_response + generation invalidation) keep \u2705 Key-value store infra/adapters/kv.py (port + in-memory + Redis adaptor) keep \u2705 Pipeline scaffold pipelines/shared/{ports,loader,registry}.py + pipelines/<family>/ rename + fill \u2705 Operator scripts scripts/ (init() / get_svc() / shutdown()) rename \u2705 Testing harness integration fakes + fixture-parity pattern keep \u2705 Project scaffolding pyproject.toml, Dockerfile, docker-compose.yaml, .env.example, openapi.yaml rename + fill \u2705"},{"location":"12_genericity_matrix/#tier-b-patterns-port-from-the-reference-app","title":"Tier B (patterns) \u2014 port from the reference app","text":"

    A few Tier B capabilities are real and reusable, but are shaped by the app or the provider, so the template does not ship them verbatim \u2014 copying them blindly would carry app-specific names. Treat them as patterns: lift the shape from the reference app and rename per app.

    Component Reference location Action Shipped Human-in-the-loop durable pause + question document + resolve endpoint + resume map port + reshape \u2717 LLM client pool provider-select + retry/rotation pool scaffold port + reshape \u2717"},{"location":"12_genericity_matrix/#tier-c-app-specific-must-be-authored","title":"Tier C \u2014 App-specific (must be authored)","text":"Artifact Why Resource models the business shape Repository populate/cache rules the relationships Service business logic domain behaviour Pipeline families the transformation graph Pattern/rule resources data-driven policy Fixtures & golden outputs test data"},{"location":"12_genericity_matrix/#the-two-axes","title":"The two axes","text":"

    Everything app-specific reduces to two axes:

    1. Resource model \u2014 the set of resources, their fields, relationships, and the OpenAPI contract.
    2. Pipeline family \u2014 only if inputs require multi-step transformation.

    If you can specify those two axes, the rest of the app follows mechanically: Tier A is imported, Tier B is copied, and Tier C is the only thing you author.

    "},{"location":"13_library_registry/","title":"Library Registry","text":""},{"location":"13_library_registry/#summary","title":"Summary","text":"

    The Aetos ecosystem provides internal libraries for the shared concerns of every application. Use them. Writing a private copy of any capability below is a defect.

    Each library also exposes its own documentation as an MCP server. An AI agent can read a library's full API by connecting to its MCP and reading docs://index, docs://nav, and docs://modules/{module}.

    "},{"location":"13_library_registry/#catalog","title":"Catalog","text":"Library Import Purpose Use instead of MCP DAG Pipe dagpipe Deterministic state-transformation DAG engine hand-rolled orchestration/topological ordering :8006 Hexa hexa Declarative DI / composition-root tooling manual wiring, hand-written factories :8008 Mongo Ops mongo_ops Async MongoDB repositories, cache, populate, transactions raw Motor CRUD and connection lifecycle :8007 Omniread omniread Format-agnostic fetch + parse (HTML, PDF, CSV, XLSX) custom scrapers/parsers :8003 OpenAPI First openapi_first Spec-first FastAPI bootstrap, client, codegen decorator routers and hand-written clients :8004 Mail Intake mail_intake Provider-agnostic read-only email ingestion Gmail OAuth + MIME parsing :8002 Py JWT jwtlib JWT auth primitives (register/login/introspect) password hashing + token code :8005 Doc Forge docforge Docstring compiler \u2192 MkDocs + MCP docs custom doc generators :8001 Doc Weaver doc-weaver JSDoc compiler \u2192 TypeDoc + MCP docs (React/TS) custom TypeScript doc generators :8010 React Auth react-auth JWT-backed React auth UI: provider, login page, profile screens, bearer axios client hand-rolled auth contexts and token handling in React apps :8011 React OpenAPI react-openapi Spec-driven React admin UI (CRUD, tables, forms, SSE) derived from an OpenAPI document per-resource hand-written admin screens :8012 Auth Server (service) Central identity service (register/login/me/logout/introspect) building auth endpoints yourself spec: docs://spec"},{"location":"13_library_registry/#how-to-choose","title":"How to choose","text":"You need to\u2026 Use persist and query documents Mongo Ops compose dependencies Hexa run a multi-step transformation DAG Pipe read/parse an arbitrary input format Omniread expose a contract-first HTTP API OpenAPI First ingest email Mail Intake authenticate users / verify tokens Py JWT (+ Auth Server) generate documentation Doc Forge generate React/TypeScript documentation Doc Weaver authenticate a React front-end React Auth (+ Auth Server) build a React admin UI from an OpenAPI spec React OpenAPI"},{"location":"13_library_registry/#discovery","title":"Discovery","text":"

    A single standards MCP exposes find_library(capability), which returns the matching library, its import name, its \"use instead of\" guidance, and its MCP endpoint (or, for the auth-server service, a spec pointer). It also serves the pinned auth-server OpenAPI contract at docs://spec. Query it before writing any infrastructure.

    "},{"location":"13_library_registry/#notes","title":"Notes","text":"
    • Hexa is a full library with its own MCP server on :8008: read docs://index, docs://nav, and docs://modules/{module} (e.g. docs://modules/hexa.container) to discover the DI surface \u2014 build(cls, *, instances, config) and the PortNode model.
    • Auth Server is a service, not an importable library: it has no MCP bundle by design. Read its client contract from the pinned OpenAPI document via docs://spec and wire it by declaring a bearerAuth security scheme in the app's own spec (see Auth Integration); py-jwt covers the low-level token path.
    • Doc Weaver is the TypeScript counterpart to Doc Forge: it reads JSDoc comments and emits a TypeDoc site plus the same doc-forge-shaped MCP bundle for React packages. Its convention is RDFC (the React Doc-forge Convention), the JSDoc parallel to GSDFC.
    • React Auth and React OpenAPI are front-end libraries (TypeScript, React 18 + MUI + React Router peers), not Python services \u2014 they consume the Auth Server and an OpenAPI document rather than serving one. Each ships a wiki, a TypeDoc site and an MCP bundle like every other library above.
    • Library MCP servers expose documentation resources (not executable tools): they tell an agent the available API surface so it does not invent code.
    "},{"location":"14_auth_integration/","title":"Auth Integration","text":""},{"location":"14_auth_integration/#summary","title":"Summary","text":"

    Authentication is a service, not a library. Every Aetos application shares a single identity service \u2014 the auth-server \u2014 and consumes it through its HTTP contract. An app never implements registration, login, password hashing, or token issuance itself.

    The agent does not need an MCP bundle for the auth-server. It reads the pinned OpenAPI contract (below) and declares a bearer security scheme in its own spec; openapi_first then generates the verifying dependency. No auth code is written.

    "},{"location":"14_auth_integration/#read-the-contract","title":"Read the contract","text":"

    The auth-server OpenAPI document is pinned in the standards bundle and served as an MCP resource:

    docs://spec\n

    It is the authoritative client contract (OpenAPI 3.1). Read it to learn the endpoints and the request/response schemas:

    Endpoint Purpose POST /register Create a user (201, returns PublicUser) POST /login Authenticate and issue a JWT (LoginResponse) GET /me Current user's PublicUser (bearer required) POST /logout Stateless logout (LogoutResponse) POST /introspect Internal token introspection (active, user)

    The pinned snapshot is versioned (currently 0.0.5). If the caller has a live auth-server and needs the current contract, they can pass the full endpoint ({AUTH_SERVER}/openapi.json) and read it directly instead of the pin.

    "},{"location":"14_auth_integration/#wire-it-up-declare-dont-code","title":"Wire it up: declare, don't code","text":"

    Authentication is added by editing the app's own openapi.yaml \u2014 nothing else. Declare a global bearer requirement and point the scheme at the auth server (values come from the environment):

    security:\n  - bearerAuth: []\npaths:\n  # ...\ncomponents:\n  securitySchemes:\n    bearerAuth:\n      type: http\n      scheme: bearer\n      bearerFormat: JWT\n      x-server-url: \"{AUTH_SERVER}\"\n      x-introspect-path: \"/introspect\"\n      x-login-path: \"/login\"\n      x-register-path: \"/register\"\n      x-logout-path: \"/logout\"\n      x-me-path: \"/me\"\n

    openapi_first reads securitySchemes + security and generates a FastAPI dependency that extracts the bearer token, POSTs {\"token\": <jwt>} to {AUTH_SERVER}/introspect, and returns the user when active == true. It raises 401 on an invalid or inactive token and 503 when the auth server is unreachable. The generated handlers receive the authenticated user \u2014 you author no authentication code.

    "},{"location":"14_auth_integration/#public-operations","title":"Public operations","text":"

    A route that must stay open opts out by overriding security with an empty list:

    paths:\n  /health:\n    get:\n      operationId: health\n      security: []        # overrides the global requirement\n      responses:\n        \"200\":\n          description: OK\n
    "},{"location":"14_auth_integration/#environment","title":"Environment","text":"
    AUTH_SERVER=http://localhost:8000     # auth-server base URL\nJWT_SERVER=http://localhost:8000      # jwtlib client base URL (seeding/CLI)\n
    "},{"location":"14_auth_integration/#path-1-jwtlib-client-no-generator","title":"Path 1: jwtlib client (no generator)","text":"

    Apps that do not use a generated dependency verify requests with the py-jwt client:

    from jwtlib.introspection import authenticate_request\n\nauthorized = await authenticate_request(\n    should_skip_authentication,  # allow public paths\n    method,\n    path,\n    authorization_token,         # \"Bearer <jwt>\" or None\n)\n

    authenticate_request POSTs to {JWT_SERVER}/introspect (3 second timeout) and treats {\"active\": true, \"user\": {...}} as valid. Use this for seeding scripts and tests (jwtlib.register_user, jwtlib.login_user).

    "},{"location":"14_auth_integration/#golden-rules","title":"Golden rules","text":"
    1. Never trust an unverified token. Decode through the generated dependency or jwtlib before handling the request.
    2. Treat active: false as unauthenticated, even if the JWT decodes.
    3. Do not implement your own JWT parsing. Revocation and issuer changes must stay centralized in the auth-server.
    4. Do not add auth until the app's outcome is validated. Ship the app authless first; layer the security scheme once the core behaviour works.
    "},{"location":"14_auth_integration/#notes","title":"Notes","text":"
    • The default template is authless on purpose. Add the securitySchemes block above only when auth is required. Pull the shared slice with get_app_component(\"auth\").
    • The auth-server is deployed as a service (no importable package); the client surface is the spec, plus jwtlib for the low-level path.
    "},{"location":"15_repository_inventory/","title":"Repository Inventory","text":""},{"location":"15_repository_inventory/#summary","title":"Summary","text":"

    The canonical list of Aetos repositories covered by the CI and versioning standards, with the artifact each one produces, its version source, and its Drone shape. Every entry maps to the contract in 11 \u2013 Versioning & Changelog and the two CI files in 10 \u2013 Drone Pipelines.

    The same data is published machine-readably as the registry://repos MCP resource (and the list_repos tool), sourced from standards/src/repos.json. Paths are relative to the aetos/ workspace root.

    "},{"location":"15_repository_inventory/#packages-type-a","title":"Packages (Type A)","text":"

    A wheel + sdist published to the private index. Version source is pyproject.toml; Drone file is python-lib.yaml (tag-triggered).

    Repo Path Docs MCP server dagpipe dagpipe lib, wiki dagpipe:8006 doc-forge doc-forge lib, wiki docforge:8001 hexa hexa lib, wiki hexa:8008 mail-intake mail-intake lib, wiki mail_intake:8002 mongo-ops mongo-ops lib, wiki mongo_ops:8007 omniread omniread lib, wiki omniread:8003 openapi-first openapi-first lib, wiki openapi_first:8004 py-jwt py-jwt lib, wiki jwtlib:8005"},{"location":"15_repository_inventory/#services-type-b","title":"Services (Type B)","text":"

    A container image pushed to the registry and run on the Docker host. Version source is the VERSION file; Drone file is service-docker.yaml.

    Repo Path Trigger Docs auth-server auth-server tag api, lib, wiki

    Tag-triggered and enforces tag == VERSION.

    "},{"location":"15_repository_inventory/#required-files-per-repo","title":"Required files per repo","text":"Type Version source Changelog Drone package pyproject.toml CHANGELOG.md python-lib.yaml service VERSION CHANGELOG.md service-docker.yaml

    Every covered repository must be able to satisfy tag == version: the version file (never a commit id) is bumped in the release MR, the MR is merged, and the tag is created on the merged commit.

    "},{"location":"15_repository_inventory/#reading-this-at-runtime","title":"Reading this at runtime","text":"
    • Resource: registry://repos
    • Tool: list_repos()
    • Humans: this page (mirror of standards/src/repos.json).
    "},{"location":"15_repository_inventory/#related","title":"Related","text":"
    • 10 \u2013 Drone Pipelines \u00b7 11 \u2013 Versioning & Changelog \u00b7 13 \u2013 Library Registry
    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Standards Reference","text":"

    The reference half of the Standards description: the enforceable rules, patterns, and the internal library catalog that agents consult while coding.

    The reference is organized as an anatomy \u2014 one entry checklist and four pillars describing what an application is made of, plus delivery/meta pages and an optional pipelines layer.

    "},{"location":"#anatomy","title":"Anatomy","text":"
    • Build Recipe \u2014 the ordered, agentic checklist for a new app; the entry point that walks the whole anatomy.
    "},{"location":"#pillar-1-domains","title":"Pillar 1 \u2014 Domains","text":"
    • Layering Rules \u2014 the strict request \u2192 domain \u2192 repository layering and the rules that enforce it.
    "},{"location":"#pillar-2-openapi-spec-the-contract","title":"Pillar 2 \u2014 OpenAPI Spec (the contract)","text":"
    • Composition Root \u2014 a single composition point wiring the whole app.
    • Spec-First Routing \u2014 the OpenAPI contract as the routing source of truth.
    • CRUD Template \u2014 the standardized generic resource endpoint scaffold.
    • Auth Integration \u2014 consuming the shared auth-server service (spec-driven, no auth code).
    "},{"location":"#pillar-3-interfaces-infra","title":"Pillar 3 \u2014 Interfaces & Infra","text":"
    • Infra Adapters \u2014 how infrastructure connects without leaking into domain.
    "},{"location":"#pillar-4-ui","title":"Pillar 4 \u2014 UI","text":"
    • UI: Auto-Rendered Admin & Custom Pages \u2014 the @aetoskia/react-openapi admin rendered from the spec's x- extensions, and @aetoskia/react-auth for auth pages; the client template scaffold.
    "},{"location":"#pipelines-optional-layer","title":"Pipelines (optional layer)","text":"
    • Pipeline Scaffold \u2014 the deterministic pipeline skeleton for multi-stage jobs.
    • Worker & Progress \u2014 queued work, progress reporting, and visibility.
    • Human-in-the-Loop \u2014 guardrails and approvals inside automations.
    "},{"location":"#delivery-meta","title":"Delivery & Meta","text":"
    • Drone Pipelines \u2014 the two CI shapes: a PyPI/npm package or a Docker deployment.
    • Versioning & Changelog \u2014 SemVer, the tag\u2194version contract, and the release changelog.
    • Repository Inventory \u2014 every covered repo, its type, version source, and Drone shape.
    • Genericity Matrix \u2014 what is library-backed, template-provided, or authored.
    • Library Registry \u2014 the catalog of internal libraries behind all of it.

    Read the Wiki for the philosophy and rationale; these pages are the reference that mirrors the standards MCP bundle.

    "},{"location":"01_build_recipe/","title":"Build Recipe","text":""},{"location":"01_build_recipe/#summary","title":"Summary","text":"

    The ordered, deterministic checklist for generating a new application of the standard shape. Every step is fixed; only the resource model (step 2), the codegen pass (step 3), and the pipeline family (step 8) need app-specific work.

    The reference pages behind this recipe are organized as an anatomy: the domains layer, the OpenAPI contract that drives routing and the admin UI, the interfaces/infra seam, the auto-rendered UI client, and an optional pipelines layer \u2014 see the Standards Reference index.

    This page is served by the standards MCP as docs://modules/build_recipe. The start_app prompt on that server collects the two axes and hands off here; pull exact files with get_app_component.

    "},{"location":"01_build_recipe/#bootstrap","title":"\ud83d\ude80 Bootstrap","text":"

    From the standards docs checkout:

    cp -r <docs>/standards/src/templates/app apps/<your-app>\ncd apps/<your-app>\n

    Pair it with the React client template when a UI is needed (auto-rendered admin from the spec \u2014 see 40 \u2013 UI):

    cp -r <docs>/standards/src/templates/client apps/<your-app>-client\ncd apps/<your-app>-client && npm install\n

    Install the internal libraries \u2014 editable local checkouts (preferred in development) or the private index (CI / fresh machines). Credentials are environment-only; never commit them.

    # local checkouts\npip install -e ../aetos/openapi-first -e ../aetos/mongo-ops -e ../aetos/hexa \\\n            -e ../aetos/dagpipe -e ../aetos/doc-forge\n# private index\npip install --extra-index-url \\\n  \"https://$PIP_REGISTRY_USERNAME:$PIP_REGISTRY_PASSWORD@pip.aetoskia.com/simple\" .\n
    "},{"location":"01_build_recipe/#agent-prompt-copyable","title":"\ud83d\udccb Agent prompt (copyable)","text":"
    # Build a new application from the Aetos Standards blueprint\n\nYou are coding a complete new backend application conforming to the Aetos\nstandard app blueprint. Execute every step in order. Only steps 2\u20134 use the\napp-specific details provided by the user; everything else is deterministic.\n\n## Before writing any code\n\nConnect to the `standards` MCP server and read:\n- `docs://nav` (the module list)\n- `docs://modules/genericity_matrix` (Tier A library / Tier B template / Tier C authored)\n- `docs://modules/layering_rules` (the dependency rules)\n\nThen:\n- call `find_library` with `db`, `di`, `routing`, `ingestion`, `pipeline`, `docs`\n  and note the Tier A libraries that already exist \u2014 never reimplement one;\n- call `list_app_components()` and pull each file you need with\n  `get_app_component(kind, resource=..., family=...)` instead of writing it from\n  scratch.\n\n## Steps\n\n1. **Scaffold** \u2014 copy `standards/src/templates/app/` into `apps/<your-app>/`\n   (or pull the same tree via `get_app_template`). Keep the tree: `domain/`,\n   `infra/`, `interfaces/`, `pipelines/`, `tests/`, `scripts/`, plus\n   `pyproject.toml`, `openapi.yaml`, `config.py`, `init.py`, `main.py`,\n   `worker.py`, `Dockerfile`, `docker-compose.yaml`, `.env.example`.\n\n2. **Author the spec (app-specific)** \u2014 write `openapi.yaml`: resources,\n   schemas, `operationId`s, security, and extension metadata. This is the\n   contract and drives all routing. Every operation MUST have an `operationId`.\n\n3. **Generate the scaffold (codegen)** \u2014 from the spec, generate the wire\n   models and the exact handler signatures:\n   ```bash\n   openapi-first models openapi.yaml -o _gen/models.py\n   openapi-first routes openapi.yaml -o _gen/routes \\\n     --use-models --models-module _gen.models --inject-request --package --template-style\n   ```\n   `_gen/models.py` is the **wire contract** (Pydantic, one class per\n   `components.schemas` entry). `_gen/routes/<resource>/routes.py` lists every\n   `operationId` with its exact parameter signature. `--template-style` makes\n   those stubs `async def` with a `body` parameter, matching the handlers you\n   keep in `interfaces/` (without it they are sync `def` stubs taking\n   `payload`; both bind the same way). Treat `_gen/` as generated\n   (never hand-edit it) \u2014 the canonical handlers live in `interfaces/`.\n\n4. **Write each CRUD slice (app-specific)** \u2014 per resource create the four-file\n   slice: `models.py` (domain model, **no `id`**), `ports/db.py`\n   (`class XDocument(BaseDocument, X)` \u2014 id comes from `BaseDocument`),\n   `ports/service.py`, and optional `converters.py`. Follow the CRUD template.\n\n5. **Wire the composition root** \u2014 in `init.py`, build leaf repositories, then\n   dependent repositories, then services; add infra adapters (db, cache, stores,\n   progress bus, fetchers). Expose `get_svc` overloads.\n\n6. **Add routes** \u2014 create `interfaces/<resource>/routes.py` thin handlers whose\n   names match the `operationId`s (use the signatures from step 3 as your\n   checklist) and re-export them in `interfaces/openapi.py`. Add the cache\n   decorator to read endpoints.\n\n7. **Bootstrap app and worker** \u2014 confirm `main.py` runs the OpenAPI-first app\n   with its lifespan. If the app has long-running jobs, adapt `worker.py` to poll\n   the job collection, run the pipeline, and publish progress.\n\n8. **Add pipeline families (only if data-driven)** \u2014 copy `pipelines/example/`\n   to `pipelines/<family>/` with `abc.py`, `impl.py`, `pipeline.yaml`,\n   `resources/`, and reuse `pipelines/shared/` (loader + registry). Register the\n   root. Add fixtures and a parity test.\n\n9. **Add infrastructure only where needed** \u2014 Tier A capability: use the\n   library. Tier B capability: copy the template. Never hand-write a Tier A\n   library.\n\n10. **Tests** \u2014 integration tests with fakes at the HTTP edge; unit tests for\n    domain and pipeline logic; a config-consistency test for rule-driven\n    pipelines. Include `tests/integration/test_openapi_app_builds.py` (imports\n    the app, asserts `import main` binds every operation).\n\n11. **Scripts and seeds** \u2014 operator scripts under `scripts/` using\n    `init()` / `get_svc()` / `shutdown()`; run as `python -m scripts.<name>`.\n\n12. **Docs** \u2014 author GSDFC docstrings, generate `.pyi` stubs, mark the package\n    `py.typed`, and build the docs.\n\n**Definition of done:**\n- `python -c \"import main\"` succeeds.\n- `pytest` passes.\n- The app serves every operation in the spec; the worker drains its queue.\n- No domain module imports a web framework.\n- No Tier A library was reimplemented.\n
    "},{"location":"01_build_recipe/#where-the-steps-land","title":"\ud83e\udded Where the steps land","text":"

    The steps map onto the layers as follows:

    Step Package / file Depends on 1 \u00b7 Scaffold whole templates/app/ \u2014 2 \u00b7 Spec openapi.yaml \u2014 3 \u00b7 Codegen _gen/ (generated) spec, openapi-first 4 \u00b7 CRUD slices domain/<resource>/ spec, CRUD template 5 \u00b7 Wiring init.py every slice 6 \u00b7 Routes interfaces/<resource>/ services, openapi route registry 7 \u00b7 Bootstrap main.py, worker.py composition root 8 \u00b7 Pipelines pipelines/<family>/, shared/ library pipeline engine 9 \u00b7 Infra infra/ domain ports 10 \u00b7 Tests tests/ app + fixtures 11 \u00b7 Scripts scripts/ composition root 12 \u00b7 Docs docstrings + docs build code, Doc Forge"},{"location":"01_build_recipe/#the-codegen-fast-path-in-detail","title":"\ud83d\udd27 The codegen fast path, in detail","text":"

    openapi-first is spec \u2192 code only (it never generates a spec). Use it to erase the two mechanical parts of the build:

    Generated artifact Replaces Notes _gen/models.py hand-writing Pydantic wire models one class per components.schemas entry _gen/routes/<resource>/routes.py hand-typing handler signatures names == operationIds; request: Request injected

    Rules of the road:

    • Wire models are not domain models. _gen/models.py is the HTTP contract; domain/<resource>/models.py is your business shape. If the spec's schema has a required id: str, keep it off the domain model and let the document get its id from BaseDocument.
    • Use --template-style. Stubs are then async def ...(request, body: ...) matching interfaces/; without it they are sync def ...(payload: ...). Either binds (the router introspects the signature), but --template-style keeps the scaffold consistent with the code you keep.
    • Resource names are sanitized. /fetch-requests \u2192 fetch_requests.py.
    • Multipart bodies expand to UploadFile = File(...) / Form(...) params.
    • _gen/ is disposable. Regenerate on every spec change; git diff shows exactly what moved.
    "},{"location":"01_build_recipe/#definition-of-done","title":"\u26a0\ufe0f Definition of done","text":"
    • python -c \"import main\" succeeds.
    • pytest passes.
    • The app serves the spec's operations; the worker drains its queue.
    • No domain module imports a web framework.
    • No Tier A library was reimplemented.
    "},{"location":"01_build_recipe/#related","title":"Related","text":"
    • 10 \u2013 Layering Rules \u00b7 21 \u2013 CRUD Template \u00b7 22 \u2013 Auth Integration \u00b7 40 \u2013 UI \u00b7 50 \u2013 Pipeline Scaffold \u00b7 92 \u2013 Genericity Matrix
    "},{"location":"02_composition_root/","title":"Composition Root","text":""},{"location":"02_composition_root/#summary","title":"Summary","text":"

    All wiring happens in exactly one module. It builds a flat resource registry and exposes it to the HTTP layer and to scripts.

    "},{"location":"02_composition_root/#the-resource-registry","title":"The resource registry","text":"

    init.py returns a plain dict[str, Any]. Keys follow two conventions:

    • <resource>_repo \u2014 a repository adapter for a resource.
    • <resource>_svc \u2014 a service for a resource.

    Plus named infrastructure adaptors:

    • http_cache_store \u2014 response cache backend.
    • progress_bus \u2014 progress/event bus.
    • <vendor>_<kind> \u2014 fetchers, clients, stores.

    The API stores the dict on app.state.db_resources during lifespan startup. Handlers read from it; nothing imports concrete adapters.

    "},{"location":"02_composition_root/#shape","title":"Shape","text":"
    _resources: dict = {}\n_initialized = False\n\nasync def init(settings=None) -> dict:\n    global _initialized\n    if _initialized:\n        return _resources\n\n    await setup_database(uri=settings.mongo_uri, db_name=settings.mongo_db)\n\n    # 1. leaf repositories\n    user_repo = create_user_repo()\n\n    # 2. dependent repositories (dependencies passed by keyword)\n    wallet_repo = create_wallet_repo(user_repo=user_repo)\n\n    # 3. services (build via the DI library, injecting the repo)\n    _resources[\"user_repo\"]   = user_repo\n    _resources[\"wallet_repo\"] = wallet_repo\n    _resources[\"user_svc\"]    = get_user_service(user_repo)\n    _resources[\"wallet_svc\"]  = get_wallet_service(wallet_repo)\n\n    # 4. infrastructure adaptors (optional)\n    _resources[\"http_cache_store\"] = HttpCacheStore(...)\n    _resources[\"progress_bus\"]     = ProgressEventBus()\n\n    _initialized = True\n    return _resources\n\nasync def shutdown() -> None:\n    global _initialized\n    await close_stores(_resources)\n    await shutdown_database()\n    _resources.clear()\n    _initialized = False\n
    "},{"location":"02_composition_root/#typed-accessors","title":"Typed accessors","text":"

    Expose a get_svc(name) helper with one @overload per key so scripts get typing without importing concrete classes:

    @overload\ndef get_svc(name: Literal[\"user_svc\"]) -> UserService: ...\n@overload\ndef get_svc(name: Literal[\"wallet_svc\"]) -> WalletService: ...\n\ndef get_svc(name: str):\n    return _resources[name]\n

    Also expose get_db() (raw database handle) and pure helpers such as compute_fingerprint(payload) (canonical hash used for deduplication).

    "},{"location":"02_composition_root/#rules","title":"Rules","text":"
    • init() is idempotent.
    • The composition root is the only place that imports concrete adapters.
    • Handlers never call init(); they read request.app.state.db_resources.
    • Scripts call init() / shutdown() around their work.
    "},{"location":"10_layering_rules/","title":"Layering Rules","text":""},{"location":"10_layering_rules/#summary","title":"Summary","text":"

    The dependency direction is fixed. Violating it is a design defect.

    "},{"location":"10_layering_rules/#allowed-imports","title":"Allowed imports","text":"
    interfaces/*      ->  domain/*            (services, ports, models)\ninterfaces/*      ->  infra/adapters/*    (only read-only value objects)\ndomain/*          ->  domain/*            (same layer)\ndomain/*          ->  pipelines/*         (call a pipeline via a port)\ndomain/*/ports/*  ->  infra/*             (bind adapters + libraries at the seam)\ninfra/adapters/*  ->  domain/ports/*      (implement the interface)\nmain.py/init.py   ->  everything          (composition root only)\n
    "},{"location":"10_layering_rules/#forbidden-imports","title":"Forbidden imports","text":"
    domain/*          ->  interfaces/*        (never)\ndomain/*          ->  fastapi/starlette   (never)\ninfra/adapters/*  ->  interfaces/*        (never)\ninterfaces/*      ->  infra/db/*          (state lives in resources, not imports)\n
    "},{"location":"10_layering_rules/#why","title":"Why","text":"
    • The business logic is testable without a server or an event loop.
    • Adapters can be swapped (in-memory fake, real database) without touching business logic.
    • The HTTP edge stays thin and replaceable.
    "},{"location":"10_layering_rules/#the-portadapter-contract","title":"The port/adapter contract","text":"

    The ports/ package is the seam where the domain meets infrastructure. Each domain/<resource>/ports/ module declares the resource's models/document shape and exposes factory functions that bind a concrete adapter \u2014 so a port module is allowed to import from infra/ and from the persistence libraries. Everything outside ports/ in domain/ stays framework- and driver-free.

    domain/<resource>/ports/db.py       -> document model + create_<resource>_repo()\ndomain/<resource>/ports/service.py  -> service + get_<resource>_service()\ninfra/db/repos/<vendor>.py          -> repository adapter factory\ninfra/adapters/service.py           -> generic CRUD service base\n

    The composition root calls the port factories; nothing else constructs an adapter.

    "},{"location":"10_layering_rules/#enforcement","title":"Enforcement","text":"
    • domain/ must never import the web framework (fastapi / starlette) or interfaces/. Only the ports/ seam, infra/, and the composition root touch drivers.
    • Reviewers (and CI) reject import fastapi inside domain/ or infra/.
    "},{"location":"20_spec_first_routing/","title":"Spec-First Routing","text":""},{"location":"20_spec_first_routing/#summary","title":"Summary","text":"

    The OpenAPI document is the single source of truth for the HTTP contract. Handlers are bound to it by name; there is no decorator router.

    "},{"location":"20_spec_first_routing/#the-contract","title":"The contract","text":"
    • openapi.yaml (or .json) declares paths, schemas, parameters, responses, and security.
    • A custom operationId names the handler function.
    • The framework (openapi_first) validates requests/responses against the spec and dispatches to the handler whose name equals operationId.
    "},{"location":"20_spec_first_routing/#app-bootstrap","title":"App bootstrap","text":"
    # main.py\nfrom openapi_first.app import OpenAPIFirstApp\n\napp = OpenAPIFirstApp(\n    openapi_path=\"openapi.yaml\",\n    routes_module=interfaces.openapi,   # module whose namespace holds handlers\n    title=\"<App> API\",\n    version=\"0.1.0\",\n    lifespan=lifespan,\n)\n

    lifespan calls the composition root:

    @asynccontextmanager\nasync def lifespan(app):\n    app.state.db_resources = await init()\n    yield\n    await shutdown()\n
    "},{"location":"20_spec_first_routing/#handler-registry","title":"Handler registry","text":"

    interfaces/openapi.py is a flat re-export of every handler, so the framework can resolve operationId across the whole app:

    from interfaces.item.routes import *\nfrom interfaces.wallet.routes import *\nfrom interfaces.progress.sse import *\n
    "},{"location":"20_spec_first_routing/#handler-shape","title":"Handler shape","text":"

    Handlers are thin and synchronous with respect to business logic:

    async def create_item(request: Request, body: dict):\n    svc = request.app.state.db_resources[\"item_svc\"]\n    return await svc.create(Item.model_validate(body))\n

    Generated stubs. openapi-first routes emits this exact shape (async def handlers taking body) when given --template-style; without that flag the stub is def create_item(payload: ItemInput) \u2014 sync, with a payload parameter. Both shapes bind identically: the router resolves handlers by operationId and introspects the FastAPI signature, and it never inspects the request body. Pass --template-style so the generated signatures match the handlers you keep in interfaces/.

    "},{"location":"20_spec_first_routing/#conventions","title":"Conventions","text":"
    • operationId naming: list_<resource>, create_<resource>, get_<resource>, update_<resource>, delete_<resource>.
    • Read-only endpoints may use a cache decorator keyed on path + query + user.
    • Validation errors -> 400; not found -> 404; delete -> 204.
    • Security is declared once in the spec and enforced by the framework; handlers contain no auth code.
    "},{"location":"20_spec_first_routing/#authless-apps","title":"Authless apps","text":"

    Auth is deferred in the standard: the same spec-first app runs with or without it, because security lives entirely in the spec, never in handlers. For an app that needs no auth yet, do not invent per-handler auth checks \u2014 just omit the security keys:

    • Remove the top-level security: block.
    • Remove components.securitySchemes.
    • Do not add security: [] to operations. An explicit empty array is a per-operation override that means \"public\", and it only matters when a global security block exists. Leaving every operation without a security key is the cleanest authless spec.

    Profile endpoints (/users/me) and profile headers (x-profile) still exist in an authless app. Define a stand-in identity in the composition root \u2014 for example get_current_user returns or lazily creates a fixed \"Demo User\" \u2014 so handlers stay auth-agnostic and only the wiring changes when real auth arrives.

    The handlers, services, and composition root are unchanged. When auth is needed later, add the global security block and an introspecting dependency; only handlers that must opt out get security: [].

    "},{"location":"20_spec_first_routing/#codegen","title":"Codegen","text":"

    openapi_first scaffolds models and route stubs from the spec (see the Build Recipe, step 3):

    openapi-first models openapi.yaml -o _gen/models.py\nopenapi-first routes openapi.yaml -o _gen/routes \\\n  --use-models --models-module _gen.models --inject-request --package --template-style\n

    Prefer codegen over hand-writing boilerplate. The result is the wire contract and a set of operationId-named signatures \u2014 not the canonical handlers.

    "},{"location":"21_crud_template/","title":"CRUD Template","text":""},{"location":"21_crud_template/#summary","title":"Summary","text":"

    Every resource follows the same four-file slice. Repetition is intentional: it makes the codebase predictable and generatable.

    "},{"location":"21_crud_template/#the-slice","title":"The slice","text":"
    domain/<resource>/\n    models.py               # pure Pydantic model (no DB fields)\n    ports/\n        db.py               # document model + repository factory\n        service.py          # service class + factory\n        converters.py       # (optional) transforms\n
    "},{"location":"21_crud_template/#the-id-rule-model-vs-document","title":"The id rule (model vs. document)","text":"

    Two different objects, two different jobs:

    Object Lives in Has id? Purpose Domain model domain/<resource>/models.py No business shape, framework-free Document domain/<resource>/ports/db.py Yes (from BaseDocument) Mongo persistence shape

    BaseDocument (mongo-ops) supplies id: Optional[PyObjectId] (aliased to _id) plus created_at / updated_at. The domain model must not declare id; Mongo owns it.

    Trap \u2014 generated wire models. openapi-first models produces the HTTP contract (see the Build Recipe, step 3). Response schemas frequently declare a required id: str, so a generated class is not a domain model. If you write class ItemDocument(Item, BaseDocument) and Item re-exports a required id: str, that field shadows BaseDocument.id and no Mongo _id can ever be set. Fix it one of three ways:

    1. Preferred: keep the domain model id-free (hand-author it from the CRUD template), and keep the required id only on the wire model.
    2. Order the bases so the document wins: class ItemDocument(BaseDocument, Item).
    3. Keep a separate document type and translate with ports/converters.py.
    "},{"location":"21_crud_template/#modelspy","title":"models.py","text":"

    A framework-free Pydantic model describing the business shape (no id).

    class Item(BaseModel):\n    name: str\n    quantity: int = 0\n
    "},{"location":"21_crud_template/#portsdbpy","title":"ports/db.py","text":"

    The persistence model extends the business model and adds database concerns. The repository factory selects the right repository flavour.

    # Item is id-free; BaseDocument adds id/created_at/updated_at.\nclass ItemDocument(Item, BaseDocument):\n    pass\n\ndef create_item_repo(*, owner_repo=None) -> ItemRepository:\n    return repo_factory(\n        collection=\"items\",\n        document=ItemDocument,\n        populate_rules=[PopulateRule(field_name=\"owner\", collection_name=\"users\")],\n        cache=None,               # or a CachedBaseRepository config\n    )\n
    "},{"location":"21_crud_template/#nested-references","title":"Nested references","text":"

    The wire contract often declares a reference as an expanded object (expense.entity: Entity), while the domain model stays id-free. Pick one convention and apply it consistently:

    • Embed (default for small, stable refs) \u2014 store the object as a dict / list[dict] on the document; the API returns it verbatim. No populate wiring.
    • Populate \u2014 store an id and declare a PopulateRule; mongo-ops expands it on read. The referenced repo must be registered with the PopulationEngine.
    • Id only \u2014 store the id and let the client resolve it.

    For populate-backed repositories change a reference with update, not patch: patch rejects changes to populated FK fields by design.

    "},{"location":"21_crud_template/#portsservicepy","title":"ports/service.py","text":"

    The service is built through the DI library, injecting the repository. The generic CRUD base provides create/read/update/patch/delete/search/....

    class ItemService(CrudsServiceAdaptor[Item, ItemDocument]):\n    model = Item\n    schema = ItemDocument\n\ndef get_item_service(repo) -> ItemService:\n    return build(ItemService, instances={\"repo\": repo})\n
    "},{"location":"21_crud_template/#naming-conventions","title":"Naming conventions","text":"Concept Convention collection plural snake case (items) document <Resource>Document repository factory create_<resource>_repo service <Resource>Service service factory get_<resource>_service resource key <resource>_svc operationId list_items, create_item, ..."},{"location":"21_crud_template/#optional-files","title":"Optional files","text":"
    • converters.py \u2014 pure functions mapping between domain types.
    • ports/enrichment.py \u2014 adapts a pipeline into an async callable the service can invoke (used when a resource is populated by a pipeline).
    "},{"location":"22_auth_integration/","title":"Auth Integration","text":""},{"location":"22_auth_integration/#summary","title":"Summary","text":"

    Authentication is a service, not a library. Every Aetos application shares a single identity service \u2014 the auth-server \u2014 and consumes it through its HTTP contract. An app never implements registration, login, password hashing, or token issuance itself.

    The agent does not need an MCP bundle for the auth-server. It reads the pinned OpenAPI contract (below) and declares a bearer security scheme in its own spec; openapi_first then generates the verifying dependency. No auth code is written.

    "},{"location":"22_auth_integration/#read-the-contract","title":"Read the contract","text":"

    The auth-server OpenAPI document is pinned in the standards bundle and served as an MCP resource:

    docs://spec\n

    It is the authoritative client contract (OpenAPI 3.1). Read it to learn the endpoints and the request/response schemas:

    Endpoint Purpose POST /register Create a user (201, returns PublicUser) POST /login Authenticate and issue a JWT (LoginResponse) GET /me Current user's PublicUser (bearer required) POST /logout Stateless logout (LogoutResponse) POST /introspect Internal token introspection (active, user)

    The pinned snapshot is versioned (currently 0.0.5). If the caller has a live auth-server and needs the current contract, they can pass the full endpoint ({AUTH_SERVER}/openapi.json) and read it directly instead of the pin.

    "},{"location":"22_auth_integration/#wire-it-up-declare-dont-code","title":"Wire it up: declare, don't code","text":"

    Authentication is added by editing the app's own openapi.yaml \u2014 nothing else. Declare a global bearer requirement and point the scheme at the auth server (values come from the environment):

    security:\n  - bearerAuth: []\npaths:\n  # ...\ncomponents:\n  securitySchemes:\n    bearerAuth:\n      type: http\n      scheme: bearer\n      bearerFormat: JWT\n      x-server-url: \"{AUTH_SERVER}\"\n      x-introspect-path: \"/introspect\"\n      x-login-path: \"/login\"\n      x-register-path: \"/register\"\n      x-logout-path: \"/logout\"\n      x-me-path: \"/me\"\n

    openapi_first reads securitySchemes + security and generates a FastAPI dependency that extracts the bearer token, POSTs {\"token\": <jwt>} to {AUTH_SERVER}/introspect, and returns the user when active == true. It raises 401 on an invalid or inactive token and 503 when the auth server is unreachable. The generated handlers receive the authenticated user \u2014 you author no authentication code.

    "},{"location":"22_auth_integration/#public-operations","title":"Public operations","text":"

    A route that must stay open opts out by overriding security with an empty list:

    paths:\n  /health:\n    get:\n      operationId: health\n      security: []        # overrides the global requirement\n      responses:\n        \"200\":\n          description: OK\n
    "},{"location":"22_auth_integration/#environment","title":"Environment","text":"
    AUTH_SERVER=http://localhost:8000     # auth-server base URL\nJWT_SERVER=http://localhost:8000      # jwtlib client base URL (seeding/CLI)\n
    "},{"location":"22_auth_integration/#path-1-jwtlib-client-no-generator","title":"Path 1: jwtlib client (no generator)","text":"

    Apps that do not use a generated dependency verify requests with the py-jwt client:

    from jwtlib.introspection import authenticate_request\n\nauthorized = await authenticate_request(\n    should_skip_authentication,  # allow public paths\n    method,\n    path,\n    authorization_token,         # \"Bearer <jwt>\" or None\n)\n

    authenticate_request POSTs to {JWT_SERVER}/introspect (3 second timeout) and treats {\"active\": true, \"user\": {...}} as valid. Use this for seeding scripts and tests (jwtlib.register_user, jwtlib.login_user).

    "},{"location":"22_auth_integration/#golden-rules","title":"Golden rules","text":"
    1. Never trust an unverified token. Decode through the generated dependency or jwtlib before handling the request.
    2. Treat active: false as unauthenticated, even if the JWT decodes.
    3. Do not implement your own JWT parsing. Revocation and issuer changes must stay centralized in the auth-server.
    4. Do not add auth until the app's outcome is validated. Ship the app authless first; layer the security scheme once the core behaviour works.
    "},{"location":"22_auth_integration/#notes","title":"Notes","text":"
    • The default template is authless on purpose. Add the securitySchemes block above only when auth is required. Pull the shared slice with get_app_component(\"auth\").
    • The auth-server is deployed as a service (no importable package); the client surface is the spec, plus jwtlib for the low-level path.
    "},{"location":"30_infra_adaptors/","title":"Infra Adapters","text":""},{"location":"30_infra_adaptors/#summary","title":"Summary","text":"

    All external systems are reached through adapters in infra/. Prefer an existing internal library over writing a new adapter; where no library exists, copy the Tier B scaffold from templates/app. See the Genericity Matrix for the Tier A / B / C split.

    "},{"location":"30_infra_adaptors/#database-mongodb","title":"Database (MongoDB)","text":"
    • A single connection manager owns the client lifecycle. setup_database(uri, db_name) / shutdown_database().
    • A repository factory selects the repository flavour:
    repo_factory(collection, document, engine=None,\n             populate_rules=None, cache=None)\n
    • base repository \u2014 plain CRUD;
    • populating repository \u2014 resolves referenced documents (foreign keys);
    • cached repository \u2014 an LRU/TTL cache in front of reads.

    • Referenced documents are described declaratively:

    PopulateRule(field_name=\"owner\", collection_name=\"users\",\n             nested_rules=[], max_depth=2, projection=None)\n
    • Transactions use a session context manager provided by the library.

    Tier A \u2014 Library (Mongo Ops). Do not write raw Motor calls in the domain; consult the registry and the library's MCP before touching the driver.

    "},{"location":"30_infra_adaptors/#http-response-cache","title":"HTTP response cache","text":"

    Tier B \u2014 template. Copy from templates/app; not a standalone library.

    A generic GET cache sits behind a decorator.

    @cache_response(ttl=60)\nasync def list_items(request): ...\n
    • Keyed on path + query + user.
    • No-op when no store is wired.
    • invalidate(*resources) bumps a generation counter for write-triggered invalidation.
    "},{"location":"30_infra_adaptors/#event-progress-bus","title":"Event / progress bus","text":"

    Tier B \u2014 template. Copy from templates/app.

    A port with an in-memory default adapter (publish, get_events). Swap for a durable broker in production (see Worker & Progress).

    "},{"location":"30_infra_adaptors/#external-clients-ingestion","title":"External clients (ingestion)","text":"

    External fetchers (files, mail, HTTP) are adapters that wrap ingestion libraries. Construct them in the composition root and inject into orchestrators.

    Tier A \u2014 Libraries: Omniread (formats) and Mail Intake (email).

    "},{"location":"30_infra_adaptors/#llm-clients","title":"LLM clients","text":"

    Tier B \u2014 template. Copy the pool scaffold from templates/app.

    When a pipeline calls a model provider, route through a pool adaptor that handles provider selection, retries, and client lifecycle:

    pool = setup_async_pool(provider=settings.llm_provider)\nresult = await pool.complete(model=\"...\", messages=[...])\n

    Providers are selected by LLM_PROVIDER and configured by environment.

    "},{"location":"30_infra_adaptors/#key-value-store","title":"Key-value store","text":"

    Tier B \u2014 template. Copy from templates/app.

    For report/snapshot storage, provide a pluggable store port with a Redis adapter and an in-memory fallback.

    "},{"location":"30_infra_adaptors/#rule","title":"Rule","text":"
    • Tier A (libraries: DB, DI, ingestion, mail, auth, docs, pipelines) \u2014 use the library; writing a private copy is a defect. Query find_library first.
    • Tier B (cache, progress bus, LLM pool, KV store, composition shape, worker, tests) \u2014 these are template code, not libraries: copy them from templates/app rather than searching the registry.
    • Tier C (models, business logic, pipeline families, rules) \u2014 author them yourself.
    "},{"location":"40_ui_admin/","title":"UI: Auto-Rendered Admin & Custom Pages","text":""},{"location":"40_ui_admin/#summary","title":"Summary","text":"

    The UI axis of an Aetos app is a published React client, not code written per application. Two npm packages carry the whole surface:

    Package Role @aetoskia/react-openapi Renders a complete admin panel (CRUD tables, forms, filters, sorting, pagination, uploads) from the app's openapi.yaml \u2014 zero UI code. @aetoskia/react-auth Auth contexts and pages (login/register/me) wired to the auth-server, plus the axios client with token handling.

    Both publish to the private registry https://npm.aetoskia.com. The server spec is the single source of truth: the same openapi.yaml that drives openapi-first routing drives the admin UI, through x- extension fields (see below).

    "},{"location":"40_ui_admin/#scaffold","title":"Scaffold","text":"
    cp -r <docs>/standards/src/templates/client apps/<your-app>-client\ncd apps/<your-app>-client\nnpm install          # deps come from npm.aetoskia.com via .npmrc\nnpm run dev\n

    The client template is a Vite + MUI app with:

    • src/openapi-config.ts \u2014 points the renderer at the app's spec and the auth-server's spec;
    • .env.example \u2014 VITE_API_BASE_URL (app API) and VITE_AUTH_BASE_URL (auth-server);
    • a Home page that auto-lists every resource the spec declares, and a Header/Footer/theme scaffold.

    Custom pages are ordinary React routes layered on top; the auto-rendered admin is available per resource at #/resource/<name>.

    "},{"location":"40_ui_admin/#x-extensions-how-the-spec-steers-the-ui","title":"x- extensions: how the spec steers the UI","text":"

    The admin renderer reads a catalog of OpenAPI extension fields (x-resource, x-list-columns, x-display-format, x-label, x-order, x-hidden, x-sortable, x-filterable, x-autocomplete, x-fk, x-ui-type, x-upload, x-sse, x-profile, and the auth wiring x-server-url / x-login-path / x-me-path / \u2026) declared on schemas and properties.

    The catalog is canonical in the react-openapi source, not in this doc. Read it from the MCP bundle:

    docs://modules/react-openapi        # module: specExtensions \u2014 the full catalog\n

    The app's own spec carries the per-resource values; the catalog explains what each field does. The template's openapi.yaml shows the convention on the example Item and Job schemas.

    "},{"location":"40_ui_admin/#golden-rules","title":"Golden rules","text":"
    1. The spec owns the UI. Add a resource or rename a column in openapi.yaml; the admin follows. Never fork the renderer per app.
    2. Custom pages for workflows, auto-render for CRUD. Anything that is \"list / create / edit / delete an entity\" is a spec concern; anything that is a bespoke workflow is a React page.
    3. Auth is consumed, never re-implemented. @aetoskia/react-auth holds tokens and calls the auth-server endpoints declared by the x- wiring; pages read the context.
    4. Publish, don't vendor. UI shared across apps belongs in @aetoskia/react-openapi or @aetoskia/react-auth (SemVer, tag-triggered npm release), not copy-pasted into app trees.
    "},{"location":"40_ui_admin/#notes","title":"Notes","text":"
    • The server template ships authless by default (see 22 \u2013 Auth Integration); the client template pairs with it and degrades to \"no login\" until a security scheme is declared.
    • react/vet is the full-stack reference implementation: spec with x- extensions, server, and the consuming client in one tree.
    "},{"location":"50_pipeline_scaffold/","title":"Pipeline Scaffold","text":""},{"location":"50_pipeline_scaffold/#summary","title":"Summary","text":"

    Data-driven processing is expressed as a composition graph. The graph is built by a DI library; execution is driven by a DAG engine. Stages are pure and individually testable.

    "},{"location":"50_pipeline_scaffold/#when-to-use-a-pipeline","title":"When to use a pipeline","text":"

    Use a pipeline when a resource is produced by a multi-step transformation of an input (a document, a file, a message) rather than by a simple CRUD write.

    "},{"location":"50_pipeline_scaffold/#structure-of-a-family","title":"Structure of a family","text":"

    A family is one input shape (e.g. a file format or a message kind). Each family has the same skeleton:

    pipelines/<family>/\n    abc.py            # port contracts (stage interfaces + root interface)\n    impl.py           # concrete stages + root implementation\n    pipeline.yaml     # graph spec: nodes, edges, roots, schema\n    resources/\n        pipeline.yaml # runtime spec consumed by the loader\n        patterns/*.yaml  # rule fragments (pattern registry)\n    banks/<variant>.py   # optional variants that re-pin a few slots\n
    "},{"location":"50_pipeline_scaffold/#shared-scaffolding","title":"Shared scaffolding","text":"
    pipelines/shared/\n    ports.py     # RegistryPort, FinalizePort, etc.\n    loader.py    # build(root_cls) -> wires the graph + engine\n    registry.py  # resolve_root(...) -> root class for a (kind, variant)\n
    "},{"location":"50_pipeline_scaffold/#the-loader","title":"The loader","text":"
    def build(root_cls, *, instances=None, config=None):\n    # merge resources/patterns/*.yaml into a pattern registry\n    # bind registry/config into each graph node by id\n    # build the schema (state) class and the engine\n    root = root_cls()\n    root._engine = Engine(graph, state_cls, payload_cls)\n    return root\n
    "},{"location":"50_pipeline_scaffold/#the-registry","title":"The registry","text":"

    A single lookup replaces hand-rolled if/else selection:

    _FAMILIES = {\n    \"csv\":  {\"acme\": {\"heuristic\": AcmeCsvPipeline}},\n    \"json\": {\"globex\": {\"heuristic\": GlobexJsonPipeline}},\n}\n\ndef resolve_root(kind, variant, mode=\"heuristic\"):\n    return _FAMILIES[kind][variant][mode]\n

    Adding a new variant means adding one class and one registry entry.

    "},{"location":"50_pipeline_scaffold/#driving-a-pipeline","title":"Driving a pipeline","text":"

    Stages are driven explicitly so intermediate state can be persisted:

    pipeline = build(resolve_root(kind, variant))\ncontent = pipeline.ingest.materialize(raw_bytes)\nrecords = pipeline.reader.read(content)\nitems   = pipeline.normalize.build(records)\n
    "},{"location":"50_pipeline_scaffold/#testing","title":"Testing","text":"

    Because stages are pure, test each stage in isolation and test the assembled root against fixture inputs whose expected outputs are stored as golden files. A parity test replays fixtures headlessly.

    "},{"location":"51_worker_and_progress/","title":"Worker & Progress","text":""},{"location":"51_worker_and_progress/#summary","title":"Summary","text":"

    Long-running work runs in a background worker. Jobs are durable documents that move through an explicit status machine. Progress is streamed to clients.

    "},{"location":"51_worker_and_progress/#the-status-machine","title":"The status machine","text":"
    pending -> processing -> completed\n                     \\-> failed    (retried up to N times)\n                     \\-> paused    (waiting for human input)\n
    • pending \u2014 queued, eligible for pickup.
    • processing \u2014 claimed by a worker.
    • paused \u2014 blocked on a human-in-the-loop question.
    • failed \u2014 error; retry_count increments until a max, then skipped.
    • completed \u2014 terminal success.
    "},{"location":"51_worker_and_progress/#the-poll-loop","title":"The poll loop","text":"
    async def poll(resources):\n    backoff = MIN_POLL\n    while True:\n        jobs = await job_svc.search(filter={\"status\": \"pending\"}, limit=100)\n        backoff = MIN_POLL if jobs else min(backoff * 2, MAX_POLL)\n        for job in jobs:\n            if (job.retry_count or 0) >= MAX_RETRIES:\n                continue\n            await job_svc.update_status(job.id, \"processing\")\n            try:\n                await process(job, resources)\n            except PauseForResolution:\n                await job_svc.update_status(job.id, \"paused\")\n            except Exception as e:\n                await job_svc.update_status(\n                    job.id, \"failed\", error=str(e),\n                    retry_count=(job.retry_count or 0) + 1,\n                )\n        await asyncio.sleep(backoff)\n

    Tunables live in environment variables: WORKER_POLL_MIN, WORKER_POLL_MAX, WORKER_MAX_RETRIES.

    "},{"location":"51_worker_and_progress/#progress-events","title":"Progress events","text":"

    A worker publishes structured progress events to a bus (a port). The HTTP edge exposes a streaming endpoint that replays events for a given job id.

    class ProgressEvent(BaseModel):\n    job_id: str\n    step: str\n    status: str            # started | progress | completed | skipped | paused\n    message: dict | None = None\n

    The bus is an in-memory adapter by default; because it is a port, it can be swapped for a durable broker. Emit from the orchestrator at each stage:

    await self.bus.publish(ProgressEvent(job_id=jid, step=\"normalize\",\n                                     status=\"completed\", message={\"count\": n}))\n
    "},{"location":"51_worker_and_progress/#streaming-endpoint","title":"Streaming endpoint","text":"
    async def stream_job_events(request, id):\n    bus = request.app.state.db_resources.get(\"progress_bus\")\n    if bus is None:\n        return {\"events\": []}\n\n    async def gen():\n        sent = 0\n        while True:\n            events = bus.get_events(id)\n            for e in events[sent:]:\n                yield f\"data: {e.model_dump_json(exclude_none=True)}\\n\\n\"\n                sent += 1\n            await asyncio.sleep(0.5)\n\n    return StreamingResponse(gen(), media_type=\"text/event-stream\")\n

    Known limitation. The default in-memory bus is per-process. If the worker and the API run as separate processes, events published by the worker are not visible to the API. For production, back the bus with a shared broker. The port boundary makes this a one-adapter change.

    "},{"location":"52_human_in_loop/","title":"Human-in-the-Loop","text":""},{"location":"52_human_in_loop/#summary","title":"Summary","text":"

    Some inputs are ambiguous and must be resolved by a human before processing can continue. The blueprint models this as a durable pause: an exception is raised, a question is recorded, the job pauses, and later resumes.

    "},{"location":"52_human_in_loop/#the-mechanism","title":"The mechanism","text":"
    1. During processing, a stage raises a domain exception carrying the context needed to ask the question:
    raise PauseForResolution(\n    job_id=jid,\n    reference=\"<stable key for this decision>\",\n    options=[...],\n    context={...},\n)\n
    1. The orchestrator catches it, records a question document, and re-raises so the worker marks the job paused.
    2. A client lists pending questions and answers one:
    GET  /jobs/{id}/questions            -> list pending questions\nPOST /questions/{qid}/resolve  {choice}  -> record the choice\n
    1. When the last pending question is resolved, the resolve endpoint flips the parent job back to pending.
    2. The worker picks it up again, rebuilds a resolution map from previously answered questions, and seeds it into the pipeline so the same decision is not asked twice.
    "},{"location":"52_human_in_loop/#the-question-document","title":"The question document","text":"
    class Question(BaseDocument):\n    job_id: str\n    reference: str            # stable key: stage|field|value\n    status: str               # pending | resolved\n    options: list[dict]\n    context: dict\n    chosen: dict | None = None\n    resolved_at: str | None = None\n
    "},{"location":"52_human_in_loop/#resume-map","title":"Resume map","text":"

    The worker turns answered questions into a lookup keyed by reference, then injects it into the pipeline so that stage can skip re-raising:

    resolved = {q.reference: q.chosen for q in await svc.search(\n    filter={\"job_id\": jid, \"status\": \"resolved\"})}\n\npipeline = build(root, instances={\"pause\": handler}, config={\"resolved\": resolved})\n
    "},{"location":"52_human_in_loop/#resolve-endpoint","title":"Resolve endpoint","text":"
    async def resolve_question(request, id, body):\n    svc = request.app.state.db_resources[\"question_svc\"]\n    q = await svc.read(id)\n    await svc.update(id, {\"chosen\": body[\"chosen\"], \"status\": \"resolved\",\n                          \"resolved_at\": now()})\n\n    pending = await svc.search(filter={\"job_id\": q.job_id, \"status\": \"pending\"},\n                               limit=1)\n    if not pending:\n        jobs = request.app.state.db_resources[\"job_svc\"]\n        job = await jobs.read(q.job_id)\n        if job and job.status == \"paused\":\n            await jobs.update_status(q.job_id, \"pending\")\n    return q\n
    "},{"location":"52_human_in_loop/#cli-parity","title":"CLI parity","text":"

    The same flow is available through scripts/CLI: list, get, create, questions, resolve, retry.

    "},{"location":"90_drone_pipelines/","title":"Drone Pipelines","text":""},{"location":"90_drone_pipelines/#summary","title":"Summary","text":"

    Every Aetos repository ships a Drone CI definition at .drone.yml. There is exactly one standard per repository, and there are two types of file, chosen by what the repository produces:

    Type File Produces Repos A \u2014 PyPI package templates/drone/python-lib.yaml A wheel + sdist on the private index dagpipe, doc-forge, hexa, mail-intake, mongo-ops, omniread, openapi-first, py-jwt B \u2014 Docker deployment templates/drone/service-docker.yaml An image pushed to the registry and run as a container auth-server

    Both templates run on platform: linux / arm64 with the workspace at /drone/src. Copy the matching template to <repo>/.drone.yml; the Type A file needs no edits, the Type B file needs its placeholders filled in (below).

    Conventions: .drone.yml (not .yaml), one file per repo, secrets injected with from_secret \u2014 never commit credentials.

    "},{"location":"90_drone_pipelines/#type-a-pypi-package-python-libyaml","title":"Type A \u2014 PyPI package (python-lib.yaml)","text":"

    For internal libraries. The file contains two pipelines:

    1. build-and-publish-pypi \u2014 triggered on tag:
    2. check-version \u2014 guard: fail unless $DRONE_TAG equals the version in pyproject.toml; then read name / version and query $PIP_REPO_URL/simple/<package>/; if that version already exists, exit 78 and skip the whole build (see 91 \u2013 Versioning & Changelog).
    3. quality-gate \u2014 install the package with its [dev] extras from the private index, then black --check, ruff check, mypy, pydoclint, pytest.
    4. build-package \u2014 python -m build into dist/.
    5. upload-to-private-pypi \u2014 twine upload to $PIP_REPO_URL.
    6. backfill-pypi-from-tags \u2014 triggered on custom:
    7. fetch-tags \u2014 git fetch --tags --force.
    8. build-and-upload-missing \u2014 walk every tag in version order, skip the ones already on the index, git checkout the rest, verify tag == pyproject version at that commit, build, and upload. This is the disaster-recovery / replay path.

    Secrets: PIP_REPO_URL, PIP_USERNAME, PIP_PASSWORD.

    • Ship as-is. Package name and version come from pyproject.toml, so the same file is reused verbatim across every library.
    "},{"location":"90_drone_pipelines/#type-b-docker-deployment-service-dockeryaml","title":"Type B \u2014 Docker deployment (service-docker.yaml)","text":"

    For a service that ships a container image \u2014 a long-running API/worker, e.g. auth-server. The file contains one pipeline, build-and-deploy-service, triggered on tag:

    • fetch-tags \u2014 resolve the latest tag into LATEST_TAG.txt; fail if there are no tags.
    • check-version \u2014 guard: fail unless $DRONE_TAG equals the repo-root VERSION file (see 91 \u2013 Versioning & Changelog).
    • check-remote-image \u2014 if aetos/<app>:<tag> already exists locally, exit 78 and skip the build.
    • quality-gate \u2014 install from requirements.txt and run black / ruff / mypy / pytest.
    • build-image \u2014 docker build with the private-index build args, tagged aetos/<app>:<tag> and :latest.
    • push-image \u2014 login, re-tag with $REGISTRY_HOST, push both tags.
    • stop-old \u2014 docker rm -f <app>.
    • run-container \u2014 docker run -d --name <app> -p <host>:<container> --restart always with the service's -e environment.

    Secrets: PIP_REPO_URL, PIP_USERNAME, PIP_PASSWORD (service build args), REGISTRY_HOST, REGISTRY_USER, REGISTRY_PASS, plus the service runtime env (for example MONGO_*, JWT_SECRET).

    Placeholders to fill in per repo:

    Placeholder Meaning Example <app> service image / container name auth-server aetos/<app> image repository on the registry aetos/auth-server <host-port> / <container-port> published : in-image port 9003:8000 <ENV_VAR> runtime environment variable MONGO_HOST"},{"location":"90_drone_pipelines/#what-not-to-do","title":"What not to do","text":"
    • Do not hand-roll a third shape. A repo is either Type A or Type B, never both.
    • Do not inline secrets; always use from_secret.
    • Do not drop the check-version / check-remote-image skip \u2014 it guards the index and the running container against duplicate publishes.
    • Do not drop the tag\u2194version guard. A package needs its pyproject.toml version to equal the tag; a service needs a root VERSION file that equals the tag. See 91 \u2013 Versioning & Changelog.
    • Do not rename the pipelines; tooling and runbooks key off build-and-publish-pypi and build-and-deploy-service.
    "},{"location":"90_drone_pipelines/#related","title":"Related","text":"
    • 01 \u2013 Build Recipe \u00b7 30 \u2013 Infra Adapters \u00b7 91 \u2013 Versioning & Changelog \u00b7 93 \u2013 Library Registry
    "},{"location":"91_versioning_and_changelog/","title":"Versioning & Changelog","text":""},{"location":"91_versioning_and_changelog/#summary","title":"Summary","text":"

    Every Aetos artifact \u2014 library or service \u2014 is versioned with Semantic Versioning and documents its releases in a Keep a Changelog file. The version file is the source of truth, the git tag must equal it, and a Drone guard enforces that equality before anything is published. Releases are cut manually; a tag is what triggers the pipeline.

    This page pairs with 90 \u2013 Drone Pipelines: the version and tag contract is exactly what those two CI shapes consume.

    "},{"location":"91_versioning_and_changelog/#the-version-contract","title":"The version contract","text":"Artifact Source of truth Notes Library (PyPI package) version in pyproject.toml check-version also reads it to skip duplicates Service (Docker) VERSION file at the repo root one line, x.y.z; the service reads it (build-arg) \u2014 never hardcode the version

    Rules:

    1. One version per repository. No per-module versions.
    2. Tag = version. The git tag is bare SemVer (0.0.6), no v prefix, and it MUST match the version file byte-for-byte. The Drone guard fails the build otherwise \u2014 this is what stops a tag from silently publishing nothing.
    3. A release is a tag, created after the change is merged. The version bump and the changelog promotion travel inside the merge request (MR); the tag is added on the merged commit and pushed. See Tagging strategy.
    4. Never reuse a tag. If a release is wrong, cut a new patch version.
    "},{"location":"91_versioning_and_changelog/#pre-10-0yz","title":"Pre-1.0 (0.y.z)","text":"

    While a package is 0.y.z, 0.y is treated as the major line:

    • breaking change \u2192 0.(y+1).0
    • new feature \u2192 0.y.(z+1)
    • bug fix \u2192 0.y.(z+1)

    Once a package reaches 1.0.0, normal SemVer applies. Do not ship 1.0.0 until the public API is considered stable.

    "},{"location":"91_versioning_and_changelog/#the-changelog","title":"The changelog","text":"

    CHANGELOG.md at the repo root, in Keep a Changelog form. It always has exactly one open [Unreleased] section with the change categories that apply:

    ## [Unreleased]\n\n### Added\n### Changed\n### Deprecated\n### Removed\n### Fixed\n### Security\n

    On release you promote it \u2014 never delete history:

    ## [0.0.6] - 2026-03-07\n\n### Added\n- ...\n

    and add a link reference at the bottom:

    [Unreleased]: https://git.aetoskia.com/aetos/<repo>/compare/0.0.6...HEAD\n[0.0.6]: https://git.aetoskia.com/aetos/<repo>/compare/0.0.5...0.0.6\n

    Conventions:

    • Write entries for humans: one line each, imperative, referencing the user impact, not the commit hash.
    • Categories: Added, Changed, Deprecated, Removed, Fixed, Security. Omit empty categories.
    • Security fixes get their own entry even if the change is otherwise a bug fix.
    • Keep [Unreleased] current: add an entry in the same change that introduces the behaviour, not later.
    • The [Unreleased] heading is never renamed; copy its content into the new version heading and clear it.
    "},{"location":"91_versioning_and_changelog/#reconcile-before-releasing","title":"Reconcile before releasing","text":"

    [Unreleased] is a draft, not the source of truth. It is only trustworthy when it was maintained alongside each change; a long-running branch or a change that skipped the changelog leaves it stale, so it can silently under-report a release. Verify it against the change before you promote:

    1. List what actually changed since the last release: git log <last-tag>..HEAD and git diff --stat <last-tag>..HEAD.
    2. Compare that against [Unreleased]; add an entry for every user-facing change that is missing.
    3. Always show the proposed additions to the user and wait for approval before promoting. If an entry is ambiguous, ask rather than guess.

    Only then promote. Never cut a release with a known gap between the diff and the changelog.

    "},{"location":"91_versioning_and_changelog/#tagging-strategy-mr-based","title":"Tagging strategy (MR-based)","text":"

    The release version is known while the change is still a merge request, so the bump travels with the change and only the tag is added afterwards:

    1. In the MR \u2014 reconcile [Unreleased] against the change (see Reconcile before releasing) and get the user's approval for any additions. Then set the intended release version: version in pyproject.toml (or the VERSION file) to x.y.z, and promote the changelog (below). Changelog entries and link references name the version/tag, never a commit id.
    2. Merge or squash the MR into main.
    3. Create the tag x.y.z on the resulting commit (the merge/squash commit).
    4. Push the tag (git push origin x.y.z) \u2014 Drone builds the release.

    Because the version bump is inside the tagged commit, the guard's tag == version check can only fail if the wrong commit was tagged.

    "},{"location":"91_versioning_and_changelog/#agent-assisted-tagging","title":"Agent-assisted tagging","text":"

    The agent neither authors nor merges the MR, and never tags before the merge. After the user confirms the MR is merged/squashed and says to proceed:

    1. Wait for that explicit go-ahead.
    2. Find the commit that introduced the version bump:
    3. packages: git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml
    4. services: git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION
    5. Confirm that commit's version file equals x.y.z, then tag only that commit, lightweight and bare: git tag x.y.z <sha>.
    6. Do not push. Ask the user to push the tag: git push origin x.y.z.
    "},{"location":"91_versioning_and_changelog/#release-checklist","title":"Release checklist","text":"
    1. Confirm the quality gate is green and main is up to date.
    2. In the MR: reconcile [Unreleased] against the change being released \u2014 git log <last-tag>..HEAD and git diff --stat <last-tag>..HEAD \u2014 add any missing user-facing entries, and get the user's approval for the additions. Then move every [Unreleased] entry under the new version heading with the target date (## [x.y.z] - YYYY-MM-DD) and restore an empty [Unreleased] on top.
    3. In the MR: add the two compare-link references at the bottom of the changelog, naming the version/tag (never a commit id).
    4. In the MR: set the version file \u2014 pyproject.toml (version = \"x.y.z\") or VERSION \u2014 to the intended release version.
    5. Merge or squash the MR into main.
    6. Create the tag on the resulting commit: lightweight git tag x.y.z.
    7. Push the tag (git push origin x.y.z). Watch Drone: Type A publishes the wheel/sdist, Type B builds and deploys the image; both first assert tag == version.
    8. Do not reuse the tag if the run fails \u2014 fix and cut x.y.(z+1).
    "},{"location":"91_versioning_and_changelog/#why-the-guard-matters","title":"Why the guard matters","text":"

    The version file and the tag are two facts that must agree; nothing in git enforces that by itself. A mismatch is not a theoretical risk \u2014 a package can be tagged 0.0.2 while its pyproject.toml still says 0.0.1, and the publish step (which compares the file against the index) then skips the build entirely, so 0.0.2 never reaches the index while looking like a release. The Drone guard turns that silent no-op into a hard failure.

    "},{"location":"91_versioning_and_changelog/#related","title":"Related","text":"
    • 90 \u2013 Drone Pipelines \u00b7 94 \u2013 Repository Inventory \u00b7 01 \u2013 Build Recipe \u00b7 93 \u2013 Library Registry
    "},{"location":"92_genericity_matrix/","title":"Genericity Matrix","text":""},{"location":"92_genericity_matrix/#summary","title":"Summary","text":"

    This page states precisely what is library-backed, what is template-provided, and what is app-specific and must be authored. Use it to scope a new build and to know, for any given capability, whether to call a library, copy template code, or write it yourself.

    "},{"location":"92_genericity_matrix/#tier-a-library-backed-use-never-reimplement","title":"Tier A \u2014 Library-backed (use; never reimplement)","text":"

    These capabilities already exist as internal libraries. Reach them through the library registry MCP (find_library(capability)) and read the library's own MCP for its API. Writing a private copy of any of these is a defect.

    Capability Library MCP Persistence: repositories, cache, populate, transactions Mongo Ops (mongo_ops) :8007 Dependency injection / composition Hexa (hexa) :8008 Deterministic multi-step transformation engine DAG Pipe (dagpipe) :8006 Spec-first HTTP edge, client, codegen OpenAPI First (openapi_first) :8004 Format-agnostic fetch + parse (HTML, PDF, CSV, XLSX) Omniread (omniread) :8003 Read-only email ingestion Mail Intake (mail_intake) :8002 JWT auth primitives (register, login, introspect) Py JWT (jwtlib) :8005 Documentation build (MkDocs + MCP) Doc Forge (docforge) :8001"},{"location":"92_genericity_matrix/#tier-b-template-provided-copy-from-templatesapp-then-adapt","title":"Tier B \u2014 Template-provided (copy from templates/app, then adapt)","text":"

    These are reusable internal components shipped inside the template \u2014 they are not independent libraries. Copy them as-is, then rename/populate only what is app-specific. They give every app the same wiring shape as the reference app. Fetch them by kind with get_app_component, or the whole tree with get_app_template.

    Component Template location Action Shipped Layering & dependency rule the package layout + import rules keep \u2705 Composition root shape init.py (get_svc/get_db, idempotency) keep \u2705 Spec-first web edge interfaces/openapi.py, thin handlers bound to operationId keep \u2705 CRUD slice pattern domain/<resource>/{models.py, ports/db.py, ports/service.py, converters.py} rename + fill \u2705 Generic CRUD service infra/adapters/service.py (CrudsServiceAdaptor) keep \u2705 Repository factory infra/db/repos/mongo.py (_repo_factory) keep \u2705 Worker poll + status loop worker.py keep \u2705 Progress bus infra/adapters/sse.py (keyed in-memory bus) + an app SSE endpoint keep \u2705 HTTP response cache infra/http_cache.py (cache_response + generation invalidation) keep \u2705 Key-value store infra/adapters/kv.py (port + in-memory + Redis adaptor) keep \u2705 Pipeline scaffold pipelines/shared/{ports,loader,registry}.py + pipelines/<family>/ rename + fill \u2705 Operator scripts scripts/ (init() / get_svc() / shutdown()) rename \u2705 Testing harness integration fakes + fixture-parity pattern keep \u2705 Project scaffolding pyproject.toml, Dockerfile, docker-compose.yaml, .env.example, openapi.yaml rename + fill \u2705"},{"location":"92_genericity_matrix/#tier-b-patterns-port-from-the-reference-app","title":"Tier B (patterns) \u2014 port from the reference app","text":"

    A few Tier B capabilities are real and reusable, but are shaped by the app or the provider, so the template does not ship them verbatim \u2014 copying them blindly would carry app-specific names. Treat them as patterns: lift the shape from the reference app and rename per app.

    Component Reference location Action Shipped Human-in-the-loop durable pause + question document + resolve endpoint + resume map port + reshape \u2717 LLM client pool provider-select + retry/rotation pool scaffold port + reshape \u2717"},{"location":"92_genericity_matrix/#tier-c-app-specific-must-be-authored","title":"Tier C \u2014 App-specific (must be authored)","text":"Artifact Why Resource models the business shape Repository populate/cache rules the relationships Service business logic domain behaviour Pipeline families the transformation graph Pattern/rule resources data-driven policy Fixtures & golden outputs test data"},{"location":"92_genericity_matrix/#the-two-axes","title":"The two axes","text":"

    Everything app-specific reduces to two axes:

    1. Resource model \u2014 the set of resources, their fields, relationships, and the OpenAPI contract.
    2. Pipeline family \u2014 only if inputs require multi-step transformation.

    If you can specify those two axes, the rest of the app follows mechanically: Tier A is imported, Tier B is copied, and Tier C is the only thing you author.

    "},{"location":"93_library_registry/","title":"Library Registry","text":""},{"location":"93_library_registry/#summary","title":"Summary","text":"

    The Aetos ecosystem provides internal libraries for the shared concerns of every application. Use them. Writing a private copy of any capability below is a defect.

    Each library also exposes its own documentation as an MCP server. An AI agent can read a library's full API by connecting to its MCP and reading docs://index, docs://nav, and docs://modules/{module}.

    "},{"location":"93_library_registry/#catalog","title":"Catalog","text":"Library Import Purpose Use instead of MCP DAG Pipe dagpipe Deterministic state-transformation DAG engine hand-rolled orchestration/topological ordering :8006 Hexa hexa Declarative DI / composition-root tooling manual wiring, hand-written factories :8008 Mongo Ops mongo_ops Async MongoDB repositories, cache, populate, transactions raw Motor CRUD and connection lifecycle :8007 Omniread omniread Format-agnostic fetch + parse (HTML, PDF, CSV, XLSX) custom scrapers/parsers :8003 OpenAPI First openapi_first Spec-first FastAPI bootstrap, client, codegen decorator routers and hand-written clients :8004 Mail Intake mail_intake Provider-agnostic read-only email ingestion Gmail OAuth + MIME parsing :8002 Py JWT jwtlib JWT auth primitives (register/login/introspect) password hashing + token code :8005 Doc Forge docforge Docstring compiler \u2192 MkDocs + MCP docs custom doc generators :8001 Doc Weaver doc-weaver JSDoc compiler \u2192 TypeDoc + MCP docs (React/TS) custom TypeScript doc generators :8010 React Auth react-auth JWT-backed React auth UI: provider, login page, profile screens, bearer axios client hand-rolled auth contexts and token handling in React apps :8011 React OpenAPI react-openapi Spec-driven React admin UI (CRUD, tables, forms, SSE) derived from an OpenAPI document per-resource hand-written admin screens :8012 Auth Server (service) Central identity service (register/login/me/logout/introspect) building auth endpoints yourself spec: docs://spec"},{"location":"93_library_registry/#how-to-choose","title":"How to choose","text":"You need to\u2026 Use persist and query documents Mongo Ops compose dependencies Hexa run a multi-step transformation DAG Pipe read/parse an arbitrary input format Omniread expose a contract-first HTTP API OpenAPI First ingest email Mail Intake authenticate users / verify tokens Py JWT (+ Auth Server) generate documentation Doc Forge generate React/TypeScript documentation Doc Weaver authenticate a React front-end React Auth (+ Auth Server) build a React admin UI from an OpenAPI spec React OpenAPI"},{"location":"93_library_registry/#discovery","title":"Discovery","text":"

    A single standards MCP exposes find_library(capability), which returns the matching library, its import name, its \"use instead of\" guidance, and its MCP endpoint (or, for the auth-server service, a spec pointer). It also serves the pinned auth-server OpenAPI contract at docs://spec. Query it before writing any infrastructure.

    "},{"location":"93_library_registry/#notes","title":"Notes","text":"
    • Hexa is a full library with its own MCP server on :8008: read docs://index, docs://nav, and docs://modules/{module} (e.g. docs://modules/hexa.container) to discover the DI surface \u2014 build(cls, *, instances, config) and the PortNode model.
    • Auth Server is a service, not an importable library: it has no MCP bundle by design. Read its client contract from the pinned OpenAPI document via docs://spec and wire it by declaring a bearerAuth security scheme in the app's own spec (see Auth Integration); py-jwt covers the low-level token path.
    • Doc Weaver is the TypeScript counterpart to Doc Forge: it reads JSDoc comments and emits a TypeDoc site plus the same doc-forge-shaped MCP bundle for React packages. Its convention is RDFC (the React Doc-forge Convention), the JSDoc parallel to GSDFC.
    • React Auth and React OpenAPI are front-end libraries (TypeScript, React 18 + MUI + React Router peers), not Python services \u2014 they consume the Auth Server and an OpenAPI document rather than serving one. Each ships a wiki, a TypeDoc site and an MCP bundle like every other library above.
    • Library MCP servers expose documentation resources (not executable tools): they tell an agent the available API surface so it does not invent code.
    "},{"location":"94_repository_inventory/","title":"Repository Inventory","text":""},{"location":"94_repository_inventory/#summary","title":"Summary","text":"

    The canonical list of Aetos repositories covered by the CI and versioning standards, with the artifact each one produces, its version source, and its Drone shape. Every entry maps to the contract in 91 \u2013 Versioning & Changelog and the two CI files in 90 \u2013 Drone Pipelines.

    The same data is published machine-readably as the registry://repos MCP resource (and the list_repos tool), sourced from standards/src/repos.json. Paths are relative to the aetos/ workspace root.

    "},{"location":"94_repository_inventory/#packages-type-a","title":"Packages (Type A)","text":"

    A wheel + sdist published to the private index. Version source is pyproject.toml; Drone file is python-lib.yaml (tag-triggered).

    Repo Path Docs MCP server dagpipe dagpipe lib, wiki dagpipe:8006 doc-forge doc-forge lib, wiki docforge:8001 hexa hexa lib, wiki hexa:8008 mail-intake mail-intake lib, wiki mail_intake:8002 mongo-ops mongo-ops lib, wiki mongo_ops:8007 omniread omniread lib, wiki omniread:8003 openapi-first openapi-first lib, wiki openapi_first:8004 py-jwt py-jwt lib, wiki jwtlib:8005"},{"location":"94_repository_inventory/#services-type-b","title":"Services (Type B)","text":"

    A container image pushed to the registry and run on the Docker host. Version source is the VERSION file; Drone file is service-docker.yaml.

    Repo Path Trigger Docs auth-server auth-server tag api, lib, wiki

    Tag-triggered and enforces tag == VERSION.

    "},{"location":"94_repository_inventory/#required-files-per-repo","title":"Required files per repo","text":"Type Version source Changelog Drone package pyproject.toml CHANGELOG.md python-lib.yaml service VERSION CHANGELOG.md service-docker.yaml

    Every covered repository must be able to satisfy tag == version: the version file (never a commit id) is bumped in the release MR, the MR is merged, and the tag is created on the merged commit.

    "},{"location":"94_repository_inventory/#reading-this-at-runtime","title":"Reading this at runtime","text":"
    • Resource: registry://repos
    • Tool: list_repos()
    • Humans: this page (mirror of standards/src/repos.json).
    "},{"location":"94_repository_inventory/#related","title":"Related","text":"
    • 90 \u2013 Drone Pipelines \u00b7 91 \u2013 Versioning & Changelog \u00b7 93 \u2013 Library Registry
    "}]} \ No newline at end of file diff --git a/standards/mcp/index.json b/standards/mcp/index.json index 8bd6584..416cb71 100644 --- a/standards/mcp/index.json +++ b/standards/mcp/index.json @@ -1,6 +1,6 @@ { "project": "standards", "type": "standards", - "modules_count": 23, + "modules_count": 24, "source": "hand-authored" } \ No newline at end of file diff --git a/standards/mcp/modules/build_recipe.json b/standards/mcp/modules/build_recipe.json index e7ebbb6..073a8e1 100644 --- a/standards/mcp/modules/build_recipe.json +++ b/standards/mcp/modules/build_recipe.json @@ -2,7 +2,7 @@ "module": "build_recipe", "content": { "path": "build_recipe", - "docstring": "# Build Recipe\n\n## Summary\n\nThe ordered, deterministic checklist for generating a new application of the\nstandard shape. Every step is fixed; only the resource model (step 2), the\ncodegen pass (step 3), and the pipeline family (step 8) need app-specific work.\n\nThis page is served by the `standards` MCP as `docs://modules/build_recipe`. The\n`start_app` prompt on that server collects the two axes and hands off here; pull\nexact files with `get_app_component`.\n\n---\n\n## ๐Ÿš€ Bootstrap\n\nFrom the standards docs checkout:\n\n```bash\ncp -r /standards/src/templates/app apps/\ncd apps/\n```\n\nInstall the internal libraries โ€” editable local checkouts (preferred in\ndevelopment) or the private index (CI / fresh machines). Credentials are\nenvironment-only; never commit them.\n\n```bash\n# local checkouts\npip install -e ../aetos/openapi-first -e ../aetos/mongo-ops -e ../aetos/hexa \\\n -e ../aetos/dagpipe -e ../aetos/doc-forge\n# private index\npip install --extra-index-url \\\n \"https://$PIP_REGISTRY_USERNAME:$PIP_REGISTRY_PASSWORD@pip.aetoskia.com/simple\" .\n```\n\n---\n\n## ๐Ÿ“‹ Agent prompt (copyable)\n\n````markdown\n# Build a new application from the Aetos Standards blueprint\n\nYou are coding a complete new backend application conforming to the Aetos\nstandard app blueprint. Execute every step in order. Only steps 2โ€“4 use the\napp-specific details provided by the user; everything else is deterministic.\n\n## Before writing any code\n\nConnect to the `standards` MCP server and read:\n- `docs://nav` (the module list)\n- `docs://modules/genericity_matrix` (Tier A library / Tier B template / Tier C authored)\n- `docs://modules/layering_rules` (the dependency rules)\n\nThen:\n- call `find_library` with `db`, `di`, `routing`, `ingestion`, `pipeline`, `docs`\n and note the Tier A libraries that already exist โ€” never reimplement one;\n- call `list_app_components()` and pull each file you need with\n `get_app_component(kind, resource=..., family=...)` instead of writing it from\n scratch.\n\n## Steps\n\n1. **Scaffold** โ€” copy `standards/src/templates/app/` into `apps//`\n (or pull the same tree via `get_app_template`). Keep the tree: `domain/`,\n `infra/`, `interfaces/`, `pipelines/`, `tests/`, `scripts/`, plus\n `pyproject.toml`, `openapi.yaml`, `config.py`, `init.py`, `main.py`,\n `worker.py`, `Dockerfile`, `docker-compose.yaml`, `.env.example`.\n\n2. **Author the spec (app-specific)** โ€” write `openapi.yaml`: resources,\n schemas, `operationId`s, security, and extension metadata. This is the\n contract and drives all routing. Every operation MUST have an `operationId`.\n\n3. **Generate the scaffold (codegen)** โ€” from the spec, generate the wire\n models and the exact handler signatures:\n ```bash\n openapi-first models openapi.yaml -o _gen/models.py\n openapi-first routes openapi.yaml -o _gen/routes \\\n --use-models --models-module _gen.models --inject-request --package --template-style\n ```\n `_gen/models.py` is the **wire contract** (Pydantic, one class per\n `components.schemas` entry). `_gen/routes//routes.py` lists every\n `operationId` with its exact parameter signature. `--template-style` makes\n those stubs `async def` with a `body` parameter, matching the handlers you\n keep in `interfaces/` (without it they are sync `def` stubs taking\n `payload`; both bind the same way). Treat `_gen/` as generated\n (never hand-edit it) โ€” the canonical handlers live in `interfaces/`.\n\n4. **Write each CRUD slice (app-specific)** โ€” per resource create the four-file\n slice: `models.py` (domain model, **no `id`**), `ports/db.py`\n (`class XDocument(BaseDocument, X)` โ€” id comes from `BaseDocument`),\n `ports/service.py`, and optional `converters.py`. Follow the CRUD template.\n\n5. **Wire the composition root** โ€” in `init.py`, build leaf repositories, then\n dependent repositories, then services; add infra adapters (db, cache, stores,\n progress bus, fetchers). Expose `get_svc` overloads.\n\n6. **Add routes** โ€” create `interfaces//routes.py` thin handlers whose\n names match the `operationId`s (use the signatures from step 3 as your\n checklist) and re-export them in `interfaces/openapi.py`. Add the cache\n decorator to read endpoints.\n\n7. **Bootstrap app and worker** โ€” confirm `main.py` runs the OpenAPI-first app\n with its lifespan. If the app has long-running jobs, adapt `worker.py` to poll\n the job collection, run the pipeline, and publish progress.\n\n8. **Add pipeline families (only if data-driven)** โ€” copy `pipelines/example/`\n to `pipelines//` with `abc.py`, `impl.py`, `pipeline.yaml`,\n `resources/`, and reuse `pipelines/shared/` (loader + registry). Register the\n root. Add fixtures and a parity test.\n\n9. **Add infrastructure only where needed** โ€” Tier A capability: use the\n library. Tier B capability: copy the template. Never hand-write a Tier A\n library.\n\n10. **Tests** โ€” integration tests with fakes at the HTTP edge; unit tests for\n domain and pipeline logic; a config-consistency test for rule-driven\n pipelines. Include `tests/integration/test_openapi_app_builds.py` (imports\n the app, asserts `import main` binds every operation).\n\n11. **Scripts and seeds** โ€” operator scripts under `scripts/` using\n `init()` / `get_svc()` / `shutdown()`; run as `python -m scripts.`.\n\n12. **Docs** โ€” author GSDFC docstrings, generate `.pyi` stubs, mark the package\n `py.typed`, and build the docs.\n\n**Definition of done:**\n- `python -c \"import main\"` succeeds.\n- `pytest` passes.\n- The app serves every operation in the spec; the worker drains its queue.\n- No domain module imports a web framework.\n- No Tier A library was reimplemented.\n````\n\n---\n\n## ๐Ÿงญ Where the steps land\n\nThe steps map onto the layers as follows:\n\n| Step | Package / file | Depends on |\n|---------------------|-----------------------------------|---------------------------------------------|\n| 1 ยท Scaffold | whole `templates/app/` | โ€” |\n| 2 ยท Spec | `openapi.yaml` | โ€” |\n| 3 ยท Codegen | `_gen/` (generated) | spec, openapi-first |\n| 4 ยท CRUD slices | `domain//` | spec, CRUD template |\n| 5 ยท Wiring | `init.py` | every slice |\n| 6 ยท Routes | `interfaces//` | services, openapi route registry |\n| 7 ยท Bootstrap | `main.py`, `worker.py` | composition root |\n| 8 ยท Pipelines | `pipelines//`, `shared/` | library pipeline engine |\n| 9 ยท Infra | `infra/` | domain ports |\n| 10 ยท Tests | `tests/` | app + fixtures |\n| 11 ยท Scripts | `scripts/` | composition root |\n| 12 ยท Docs | docstrings + docs build | code, Doc Forge |\n\n---\n\n## ๐Ÿ”ง The codegen fast path, in detail\n\n`openapi-first` is spec โ†’ code only (it never generates a spec). Use it to erase\nthe two mechanical parts of the build:\n\n| Generated artifact | Replaces | Notes |\n|--------------------|----------|-------|\n| `_gen/models.py` | hand-writing Pydantic wire models | one class per `components.schemas` entry |\n| `_gen/routes//routes.py` | hand-typing handler signatures | names == `operationId`s; `request: Request` injected |\n\nRules of the road:\n\n- **Wire models are not domain models.** `_gen/models.py` is the HTTP contract;\n `domain//models.py` is your business shape. If the spec's schema has\n a required `id: str`, keep it off the domain model and let the document get its\n id from `BaseDocument`.\n- **Use `--template-style`.** Stubs are then `async def ...(request, body: ...)`\n matching `interfaces/`; without it they are sync `def ...(payload: ...)`.\n Either binds (the router introspects the signature), but `--template-style`\n keeps the scaffold consistent with the code you keep.\n- **Resource names are sanitized.** `/fetch-requests` โ†’ `fetch_requests.py`.\n- **Multipart bodies expand** to `UploadFile = File(...)` / `Form(...)` params.\n- **`_gen/` is disposable.** Regenerate on every spec change; `git diff` shows\n exactly what moved.\n\n---\n\n## โš ๏ธ Definition of done\n\n- `python -c \"import main\"` succeeds.\n- `pytest` passes.\n- The app serves the spec's operations; the worker drains its queue.\n- No domain module imports a web framework.\n- No Tier A library was reimplemented.\n\n---\n\n## Related\n\n- [02 โ€“ Layering Rules](02_layering_rules.md) ยท [05 โ€“ CRUD Template](05_crud_template.md) ยท [06 โ€“ Pipeline Scaffold](06_pipeline_scaffold.md) ยท [12 โ€“ Genericity Matrix](12_genericity_matrix.md)\n", + "docstring": "# Build Recipe\n\n## Summary\n\nThe ordered, deterministic checklist for generating a new application of the\nstandard shape. Every step is fixed; only the resource model (step 2), the\ncodegen pass (step 3), and the pipeline family (step 8) need app-specific work.\n\nThe reference pages behind this recipe are organized as an anatomy: the\ndomains layer, the OpenAPI contract that drives routing *and* the admin UI,\nthe interfaces/infra seam, the auto-rendered UI client, and an optional\npipelines layer โ€” see the [Standards Reference](index.md) index.\n\nThis page is served by the `standards` MCP as `docs://modules/build_recipe`. The\n`start_app` prompt on that server collects the two axes and hands off here; pull\nexact files with `get_app_component`.\n\n---\n\n## ๐Ÿš€ Bootstrap\n\nFrom the standards docs checkout:\n\n```bash\ncp -r /standards/src/templates/app apps/\ncd apps/\n```\n\nPair it with the React client template when a UI is needed (auto-rendered\nadmin from the spec โ€” see [40 โ€“ UI](40_ui_admin.md)):\n\n```bash\ncp -r /standards/src/templates/client apps/-client\ncd apps/-client && npm install\n```\n\nInstall the internal libraries โ€” editable local checkouts (preferred in\ndevelopment) or the private index (CI / fresh machines). Credentials are\nenvironment-only; never commit them.\n\n```bash\n# local checkouts\npip install -e ../aetos/openapi-first -e ../aetos/mongo-ops -e ../aetos/hexa \\\n -e ../aetos/dagpipe -e ../aetos/doc-forge\n# private index\npip install --extra-index-url \\\n \"https://$PIP_REGISTRY_USERNAME:$PIP_REGISTRY_PASSWORD@pip.aetoskia.com/simple\" .\n```\n\n---\n\n## ๐Ÿ“‹ Agent prompt (copyable)\n\n````markdown\n# Build a new application from the Aetos Standards blueprint\n\nYou are coding a complete new backend application conforming to the Aetos\nstandard app blueprint. Execute every step in order. Only steps 2โ€“4 use the\napp-specific details provided by the user; everything else is deterministic.\n\n## Before writing any code\n\nConnect to the `standards` MCP server and read:\n- `docs://nav` (the module list)\n- `docs://modules/genericity_matrix` (Tier A library / Tier B template / Tier C authored)\n- `docs://modules/layering_rules` (the dependency rules)\n\nThen:\n- call `find_library` with `db`, `di`, `routing`, `ingestion`, `pipeline`, `docs`\n and note the Tier A libraries that already exist โ€” never reimplement one;\n- call `list_app_components()` and pull each file you need with\n `get_app_component(kind, resource=..., family=...)` instead of writing it from\n scratch.\n\n## Steps\n\n1. **Scaffold** โ€” copy `standards/src/templates/app/` into `apps//`\n (or pull the same tree via `get_app_template`). Keep the tree: `domain/`,\n `infra/`, `interfaces/`, `pipelines/`, `tests/`, `scripts/`, plus\n `pyproject.toml`, `openapi.yaml`, `config.py`, `init.py`, `main.py`,\n `worker.py`, `Dockerfile`, `docker-compose.yaml`, `.env.example`.\n\n2. **Author the spec (app-specific)** โ€” write `openapi.yaml`: resources,\n schemas, `operationId`s, security, and extension metadata. This is the\n contract and drives all routing. Every operation MUST have an `operationId`.\n\n3. **Generate the scaffold (codegen)** โ€” from the spec, generate the wire\n models and the exact handler signatures:\n ```bash\n openapi-first models openapi.yaml -o _gen/models.py\n openapi-first routes openapi.yaml -o _gen/routes \\\n --use-models --models-module _gen.models --inject-request --package --template-style\n ```\n `_gen/models.py` is the **wire contract** (Pydantic, one class per\n `components.schemas` entry). `_gen/routes//routes.py` lists every\n `operationId` with its exact parameter signature. `--template-style` makes\n those stubs `async def` with a `body` parameter, matching the handlers you\n keep in `interfaces/` (without it they are sync `def` stubs taking\n `payload`; both bind the same way). Treat `_gen/` as generated\n (never hand-edit it) โ€” the canonical handlers live in `interfaces/`.\n\n4. **Write each CRUD slice (app-specific)** โ€” per resource create the four-file\n slice: `models.py` (domain model, **no `id`**), `ports/db.py`\n (`class XDocument(BaseDocument, X)` โ€” id comes from `BaseDocument`),\n `ports/service.py`, and optional `converters.py`. Follow the CRUD template.\n\n5. **Wire the composition root** โ€” in `init.py`, build leaf repositories, then\n dependent repositories, then services; add infra adapters (db, cache, stores,\n progress bus, fetchers). Expose `get_svc` overloads.\n\n6. **Add routes** โ€” create `interfaces//routes.py` thin handlers whose\n names match the `operationId`s (use the signatures from step 3 as your\n checklist) and re-export them in `interfaces/openapi.py`. Add the cache\n decorator to read endpoints.\n\n7. **Bootstrap app and worker** โ€” confirm `main.py` runs the OpenAPI-first app\n with its lifespan. If the app has long-running jobs, adapt `worker.py` to poll\n the job collection, run the pipeline, and publish progress.\n\n8. **Add pipeline families (only if data-driven)** โ€” copy `pipelines/example/`\n to `pipelines//` with `abc.py`, `impl.py`, `pipeline.yaml`,\n `resources/`, and reuse `pipelines/shared/` (loader + registry). Register the\n root. Add fixtures and a parity test.\n\n9. **Add infrastructure only where needed** โ€” Tier A capability: use the\n library. Tier B capability: copy the template. Never hand-write a Tier A\n library.\n\n10. **Tests** โ€” integration tests with fakes at the HTTP edge; unit tests for\n domain and pipeline logic; a config-consistency test for rule-driven\n pipelines. Include `tests/integration/test_openapi_app_builds.py` (imports\n the app, asserts `import main` binds every operation).\n\n11. **Scripts and seeds** โ€” operator scripts under `scripts/` using\n `init()` / `get_svc()` / `shutdown()`; run as `python -m scripts.`.\n\n12. **Docs** โ€” author GSDFC docstrings, generate `.pyi` stubs, mark the package\n `py.typed`, and build the docs.\n\n**Definition of done:**\n- `python -c \"import main\"` succeeds.\n- `pytest` passes.\n- The app serves every operation in the spec; the worker drains its queue.\n- No domain module imports a web framework.\n- No Tier A library was reimplemented.\n````\n\n---\n\n## ๐Ÿงญ Where the steps land\n\nThe steps map onto the layers as follows:\n\n| Step | Package / file | Depends on |\n|---------------------|-----------------------------------|---------------------------------------------|\n| 1 ยท Scaffold | whole `templates/app/` | โ€” |\n| 2 ยท Spec | `openapi.yaml` | โ€” |\n| 3 ยท Codegen | `_gen/` (generated) | spec, openapi-first |\n| 4 ยท CRUD slices | `domain//` | spec, CRUD template |\n| 5 ยท Wiring | `init.py` | every slice |\n| 6 ยท Routes | `interfaces//` | services, openapi route registry |\n| 7 ยท Bootstrap | `main.py`, `worker.py` | composition root |\n| 8 ยท Pipelines | `pipelines//`, `shared/` | library pipeline engine |\n| 9 ยท Infra | `infra/` | domain ports |\n| 10 ยท Tests | `tests/` | app + fixtures |\n| 11 ยท Scripts | `scripts/` | composition root |\n| 12 ยท Docs | docstrings + docs build | code, Doc Forge |\n\n---\n\n## ๐Ÿ”ง The codegen fast path, in detail\n\n`openapi-first` is spec โ†’ code only (it never generates a spec). Use it to erase\nthe two mechanical parts of the build:\n\n| Generated artifact | Replaces | Notes |\n|--------------------|----------|-------|\n| `_gen/models.py` | hand-writing Pydantic wire models | one class per `components.schemas` entry |\n| `_gen/routes//routes.py` | hand-typing handler signatures | names == `operationId`s; `request: Request` injected |\n\nRules of the road:\n\n- **Wire models are not domain models.** `_gen/models.py` is the HTTP contract;\n `domain//models.py` is your business shape. If the spec's schema has\n a required `id: str`, keep it off the domain model and let the document get its\n id from `BaseDocument`.\n- **Use `--template-style`.** Stubs are then `async def ...(request, body: ...)`\n matching `interfaces/`; without it they are sync `def ...(payload: ...)`.\n Either binds (the router introspects the signature), but `--template-style`\n keeps the scaffold consistent with the code you keep.\n- **Resource names are sanitized.** `/fetch-requests` โ†’ `fetch_requests.py`.\n- **Multipart bodies expand** to `UploadFile = File(...)` / `Form(...)` params.\n- **`_gen/` is disposable.** Regenerate on every spec change; `git diff` shows\n exactly what moved.\n\n---\n\n## โš ๏ธ Definition of done\n\n- `python -c \"import main\"` succeeds.\n- `pytest` passes.\n- The app serves the spec's operations; the worker drains its queue.\n- No domain module imports a web framework.\n- No Tier A library was reimplemented.\n\n---\n\n## Related\n\n- [10 โ€“ Layering Rules](10_layering_rules.md) ยท [21 โ€“ CRUD Template](21_crud_template.md) ยท [22 โ€“ Auth Integration](22_auth_integration.md) ยท [40 โ€“ UI](40_ui_admin.md) ยท [50 โ€“ Pipeline Scaffold](50_pipeline_scaffold.md) ยท [92 โ€“ Genericity Matrix](92_genericity_matrix.md)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/drone_pipelines.json b/standards/mcp/modules/drone_pipelines.json index 26ade26..9cba6e0 100644 --- a/standards/mcp/modules/drone_pipelines.json +++ b/standards/mcp/modules/drone_pipelines.json @@ -2,7 +2,7 @@ "module": "drone_pipelines", "content": { "path": "drone_pipelines", - "docstring": "# Drone Pipelines\n\n## Summary\n\nEvery Aetos repository ships a Drone CI definition at `.drone.yml`. There is\nexactly **one standard per repository**, and there are **two types of file**,\nchosen by what the repository produces:\n\n| Type | File | Produces | Repos |\n|------|------|----------|-------|\n| **A โ€” PyPI package** | `templates/drone/python-lib.yaml` | A wheel + sdist on the private index | `dagpipe`, `doc-forge`, `hexa`, `mail-intake`, `mongo-ops`, `omniread`, `openapi-first`, `py-jwt` |\n| **B โ€” Docker deployment** | `templates/drone/service-docker.yaml` | An image pushed to the registry and run as a container | `auth-server` |\n\nBoth templates run on `platform: linux / arm64` with the workspace at\n`/drone/src`. Copy the matching template to `/.drone.yml`; the Type A file\nneeds no edits, the Type B file needs its placeholders filled in (below).\n\n> Conventions: `.drone.yml` (not `.yaml`), one file per repo, secrets injected\n> with `from_secret` โ€” never commit credentials.\n\n---\n\n## Type A โ€” PyPI package (`python-lib.yaml`)\n\nFor internal libraries. The file contains **two pipelines**:\n\n1. **`build-and-publish-pypi`** โ€” triggered on `tag`:\n - `check-version` โ€” **guard**: fail unless `$DRONE_TAG` equals the version in\n `pyproject.toml`; then read `name` / `version` and query\n `$PIP_REPO_URL/simple//`; if that version already exists, exit\n `78` and skip the whole build (see [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md)).\n - `quality-gate` โ€” install the package with its `[dev]` extras from the\n private index, then `black --check`, `ruff check`, `mypy`, `pydoclint`,\n `pytest`.\n - `build-package` โ€” `python -m build` into `dist/`.\n - `upload-to-private-pypi` โ€” `twine upload` to `$PIP_REPO_URL`.\n2. **`backfill-pypi-from-tags`** โ€” triggered on `custom`:\n - `fetch-tags` โ€” `git fetch --tags --force`.\n - `build-and-upload-missing` โ€” walk every tag in version order, skip the ones\n already on the index, `git checkout` the rest, verify `tag == pyproject\n version` at that commit, build, and upload. This is the disaster-recovery /\n replay path.\n\nSecrets: `PIP_REPO_URL`, `PIP_USERNAME`, `PIP_PASSWORD`.\n\n- **Ship as-is.** Package name and version come from `pyproject.toml`, so the\n same file is reused verbatim across every library.\n\n---\n\n## Type B โ€” Docker deployment (`service-docker.yaml`)\n\nFor a service that ships a container image โ€” a long-running API/worker, e.g.\n`auth-server`. The file contains **one pipeline**, `build-and-deploy-service`,\ntriggered on `tag`:\n\n- `fetch-tags` โ€” resolve the latest tag into `LATEST_TAG.txt`; fail if there\n are no tags.\n- `check-version` โ€” **guard**: fail unless `$DRONE_TAG` equals the repo-root\n `VERSION` file (see [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md)).\n- `check-remote-image` โ€” if `aetos/:` already exists locally, exit\n `78` and skip the build.\n- `quality-gate` โ€” install from `requirements.txt` and run\n `black` / `ruff` / `mypy` / `pytest`.\n- `build-image` โ€” `docker build` with the private-index build args, tagged\n `aetos/:` and `:latest`.\n- `push-image` โ€” login, re-tag with `$REGISTRY_HOST`, push both tags.\n- `stop-old` โ€” `docker rm -f `.\n- `run-container` โ€” `docker run -d --name -p :\n --restart always` with the service's `-e` environment.\n\nSecrets: `PIP_REPO_URL`, `PIP_USERNAME`, `PIP_PASSWORD` (service build args),\n`REGISTRY_HOST`, `REGISTRY_USER`, `REGISTRY_PASS`, plus the service runtime env\n(for example `MONGO_*`, `JWT_SECRET`).\n\nPlaceholders to fill in per repo:\n\n| Placeholder | Meaning | Example |\n|-------------|---------|---------|\n| `` | service image / container name | `auth-server` |\n| `aetos/` | image repository on the registry | `aetos/auth-server` |\n| `` / `` | published : in-image port | `9003:8000` |\n| `` | runtime environment variable | `MONGO_HOST` |\n\n---\n\n## What not to do\n\n- Do not hand-roll a third shape. A repo is either Type A or Type B, never both.\n- Do not inline secrets; always use `from_secret`.\n- Do not drop the `check-version` / `check-remote-image` skip โ€” it guards the\n index and the running container against duplicate publishes.\n- Do not drop the tagโ†”version guard. A package needs its `pyproject.toml`\n version to equal the tag; a service needs a root `VERSION` file that equals\n the tag. See [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md).\n- Do not rename the pipelines; tooling and runbooks key off\n `build-and-publish-pypi` and `build-and-deploy-service`.\n\n---\n\n## Related\n\n- [01 โ€“ Build Recipe](01_build_recipe.md) ยท [09 โ€“ Infra Adapters](09_infra_adaptors.md) ยท [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md) ยท [13 โ€“ Library Registry](13_library_registry.md)\n", + "docstring": "# Drone Pipelines\n\n## Summary\n\nEvery Aetos repository ships a Drone CI definition at `.drone.yml`. There is\nexactly **one standard per repository**, and there are **two types of file**,\nchosen by what the repository produces:\n\n| Type | File | Produces | Repos |\n|------|------|----------|-------|\n| **A โ€” PyPI package** | `templates/drone/python-lib.yaml` | A wheel + sdist on the private index | `dagpipe`, `doc-forge`, `hexa`, `mail-intake`, `mongo-ops`, `omniread`, `openapi-first`, `py-jwt` |\n| **B โ€” Docker deployment** | `templates/drone/service-docker.yaml` | An image pushed to the registry and run as a container | `auth-server` |\n\nBoth templates run on `platform: linux / arm64` with the workspace at\n`/drone/src`. Copy the matching template to `/.drone.yml`; the Type A file\nneeds no edits, the Type B file needs its placeholders filled in (below).\n\n> Conventions: `.drone.yml` (not `.yaml`), one file per repo, secrets injected\n> with `from_secret` โ€” never commit credentials.\n\n---\n\n## Type A โ€” PyPI package (`python-lib.yaml`)\n\nFor internal libraries. The file contains **two pipelines**:\n\n1. **`build-and-publish-pypi`** โ€” triggered on `tag`:\n - `check-version` โ€” **guard**: fail unless `$DRONE_TAG` equals the version in\n `pyproject.toml`; then read `name` / `version` and query\n `$PIP_REPO_URL/simple//`; if that version already exists, exit\n `78` and skip the whole build (see [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md)).\n - `quality-gate` โ€” install the package with its `[dev]` extras from the\n private index, then `black --check`, `ruff check`, `mypy`, `pydoclint`,\n `pytest`.\n - `build-package` โ€” `python -m build` into `dist/`.\n - `upload-to-private-pypi` โ€” `twine upload` to `$PIP_REPO_URL`.\n2. **`backfill-pypi-from-tags`** โ€” triggered on `custom`:\n - `fetch-tags` โ€” `git fetch --tags --force`.\n - `build-and-upload-missing` โ€” walk every tag in version order, skip the ones\n already on the index, `git checkout` the rest, verify `tag == pyproject\n version` at that commit, build, and upload. This is the disaster-recovery /\n replay path.\n\nSecrets: `PIP_REPO_URL`, `PIP_USERNAME`, `PIP_PASSWORD`.\n\n- **Ship as-is.** Package name and version come from `pyproject.toml`, so the\n same file is reused verbatim across every library.\n\n---\n\n## Type B โ€” Docker deployment (`service-docker.yaml`)\n\nFor a service that ships a container image โ€” a long-running API/worker, e.g.\n`auth-server`. The file contains **one pipeline**, `build-and-deploy-service`,\ntriggered on `tag`:\n\n- `fetch-tags` โ€” resolve the latest tag into `LATEST_TAG.txt`; fail if there\n are no tags.\n- `check-version` โ€” **guard**: fail unless `$DRONE_TAG` equals the repo-root\n `VERSION` file (see [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md)).\n- `check-remote-image` โ€” if `aetos/:` already exists locally, exit\n `78` and skip the build.\n- `quality-gate` โ€” install from `requirements.txt` and run\n `black` / `ruff` / `mypy` / `pytest`.\n- `build-image` โ€” `docker build` with the private-index build args, tagged\n `aetos/:` and `:latest`.\n- `push-image` โ€” login, re-tag with `$REGISTRY_HOST`, push both tags.\n- `stop-old` โ€” `docker rm -f `.\n- `run-container` โ€” `docker run -d --name -p :\n --restart always` with the service's `-e` environment.\n\nSecrets: `PIP_REPO_URL`, `PIP_USERNAME`, `PIP_PASSWORD` (service build args),\n`REGISTRY_HOST`, `REGISTRY_USER`, `REGISTRY_PASS`, plus the service runtime env\n(for example `MONGO_*`, `JWT_SECRET`).\n\nPlaceholders to fill in per repo:\n\n| Placeholder | Meaning | Example |\n|-------------|---------|---------|\n| `` | service image / container name | `auth-server` |\n| `aetos/` | image repository on the registry | `aetos/auth-server` |\n| `` / `` | published : in-image port | `9003:8000` |\n| `` | runtime environment variable | `MONGO_HOST` |\n\n---\n\n## What not to do\n\n- Do not hand-roll a third shape. A repo is either Type A or Type B, never both.\n- Do not inline secrets; always use `from_secret`.\n- Do not drop the `check-version` / `check-remote-image` skip โ€” it guards the\n index and the running container against duplicate publishes.\n- Do not drop the tagโ†”version guard. A package needs its `pyproject.toml`\n version to equal the tag; a service needs a root `VERSION` file that equals\n the tag. See [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md).\n- Do not rename the pipelines; tooling and runbooks key off\n `build-and-publish-pypi` and `build-and-deploy-service`.\n\n---\n\n## Related\n\n- [01 โ€“ Build Recipe](01_build_recipe.md) ยท [30 โ€“ Infra Adapters](30_infra_adaptors.md) ยท [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md) ยท [93 โ€“ Library Registry](93_library_registry.md)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/index.json b/standards/mcp/modules/index.json index 9b9e433..92cb6ff 100644 --- a/standards/mcp/modules/index.json +++ b/standards/mcp/modules/index.json @@ -2,7 +2,7 @@ "module": "index", "content": { "path": "index", - "docstring": "# Standards Reference\n\nThe reference half of the Standards description: the enforceable rules,\npatterns, and the internal library catalog that agents consult while coding.\n\n- **Build Recipe** โ€” the ordered, agentic checklist for a new app.\n- **Layering Rules** โ€” the strict request โ†’ domain โ†’ repository layering and\n the rules that enforce it.\n- **Composition Root** โ€” a single composition point wiring the whole app.\n- **Spec-First Routing** โ€” the OpenAPI contract as the routing source of truth.\n- **CRUD Template** โ€” the standardized generic resource endpoint scaffold.\n- **Pipeline Scaffold** โ€” the deterministic pipeline skeleton for multi-stage\n jobs.\n- **Worker & Progress** โ€” queued work, progress reporting, and visibility.\n- **Human-in-the-Loop** โ€” guardrails and approvals inside automations.\n- **Infra Adapters** โ€” how infrastructure connects without leaking into domain.\n- **Drone Pipelines** โ€” the two CI shapes: a PyPI package or a Docker deployment.\n- **Versioning & Changelog** โ€” SemVer, the tagโ†”version contract, and the release\n changelog.\n- **Repository Inventory** โ€” every covered repo, its type, version source, and\n Drone shape.\n- **Genericity Matrix** โ€” what is library-backed, template-provided, or authored.\n- **Auth Integration** โ€” consuming the shared auth-server service (spec-driven,\n no auth code).\n- **Library Registry** โ€” the catalog of internal libraries behind all of it.\n\nRead the **Wiki** for the philosophy and rationale; these pages are the\nreference that mirrors the `standards` MCP bundle.\n", + "docstring": "# Standards Reference\n\nThe reference half of the Standards description: the enforceable rules,\npatterns, and the internal library catalog that agents consult while coding.\n\nThe reference is organized as an **anatomy** โ€” one entry checklist and four\npillars describing what an application is made of, plus delivery/meta pages\nand an optional pipelines layer.\n\n## Anatomy\n\n- **Build Recipe** โ€” the ordered, agentic checklist for a new app; the entry\n point that walks the whole anatomy.\n\n## Pillar 1 โ€” Domains\n\n- **Layering Rules** โ€” the strict request โ†’ domain โ†’ repository layering and\n the rules that enforce it.\n\n## Pillar 2 โ€” OpenAPI Spec (the contract)\n\n- **Composition Root** โ€” a single composition point wiring the whole app.\n- **Spec-First Routing** โ€” the OpenAPI contract as the routing source of truth.\n- **CRUD Template** โ€” the standardized generic resource endpoint scaffold.\n- **Auth Integration** โ€” consuming the shared auth-server service (spec-driven,\n no auth code).\n\n## Pillar 3 โ€” Interfaces & Infra\n\n- **Infra Adapters** โ€” how infrastructure connects without leaking into domain.\n\n## Pillar 4 โ€” UI\n\n- **UI: Auto-Rendered Admin & Custom Pages** โ€” the `@aetoskia/react-openapi`\n admin rendered from the spec's x- extensions, and `@aetoskia/react-auth`\n for auth pages; the client template scaffold.\n\n## Pipelines (optional layer)\n\n- **Pipeline Scaffold** โ€” the deterministic pipeline skeleton for multi-stage\n jobs.\n- **Worker & Progress** โ€” queued work, progress reporting, and visibility.\n- **Human-in-the-Loop** โ€” guardrails and approvals inside automations.\n\n## Delivery & Meta\n\n- **Drone Pipelines** โ€” the two CI shapes: a PyPI/npm package or a Docker\n deployment.\n- **Versioning & Changelog** โ€” SemVer, the tagโ†”version contract, and the\n release changelog.\n- **Repository Inventory** โ€” every covered repo, its type, version source, and\n Drone shape.\n- **Genericity Matrix** โ€” what is library-backed, template-provided, or\n authored.\n- **Library Registry** โ€” the catalog of internal libraries behind all of it.\n\nRead the **Wiki** for the philosophy and rationale; these pages are the\nreference that mirrors the `standards` MCP bundle.\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/repository_inventory.json b/standards/mcp/modules/repository_inventory.json index c80f251..fbd3b0e 100644 --- a/standards/mcp/modules/repository_inventory.json +++ b/standards/mcp/modules/repository_inventory.json @@ -2,7 +2,7 @@ "module": "repository_inventory", "content": { "path": "repository_inventory", - "docstring": "# Repository Inventory\n\n## Summary\n\nThe canonical list of Aetos repositories covered by the CI and versioning\nstandards, with the artifact each one produces, its version source, and its\nDrone shape. Every entry maps to the contract in\n[11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md) and the two CI\nfiles in [10 โ€“ Drone Pipelines](10_drone_pipelines.md).\n\nThe same data is published machine-readably as the `registry://repos` MCP\nresource (and the `list_repos` tool), sourced from `standards/src/repos.json`.\nPaths are relative to the `aetos/` workspace root.\n\n---\n\n## Packages (Type A)\n\nA wheel + sdist published to the private index. Version source is\n`pyproject.toml`; Drone file is `python-lib.yaml` (tag-triggered).\n\n| Repo | Path | Docs | MCP server |\n|------|------|------|------------|\n| `dagpipe` | `dagpipe` | lib, wiki | `dagpipe:8006` |\n| `doc-forge` | `doc-forge` | lib, wiki | `docforge:8001` |\n| `hexa` | `hexa` | lib, wiki | `hexa:8008` |\n| `mail-intake` | `mail-intake` | lib, wiki | `mail_intake:8002` |\n| `mongo-ops` | `mongo-ops` | lib, wiki | `mongo_ops:8007` |\n| `omniread` | `omniread` | lib, wiki | `omniread:8003` |\n| `openapi-first` | `openapi-first` | lib, wiki | `openapi_first:8004` |\n| `py-jwt` | `py-jwt` | lib, wiki | `jwtlib:8005` |\n\n---\n\n## Services (Type B)\n\nA container image pushed to the registry and run on the Docker host. Version\nsource is the `VERSION` file; Drone file is `service-docker.yaml`.\n\n| Repo | Path | Trigger | Docs |\n|------|------|---------|------|\n| `auth-server` | `auth-server` | tag | api, lib, wiki |\n\nTag-triggered and enforces `tag == VERSION`.\n\n---\n\n## Required files per repo\n\n| Type | Version source | Changelog | Drone |\n|------|----------------|-----------|-------|\n| package | `pyproject.toml` | `CHANGELOG.md` | `python-lib.yaml` |\n| service | `VERSION` | `CHANGELOG.md` | `service-docker.yaml` |\n\nEvery covered repository must be able to satisfy `tag == version`:\nthe version file (never a commit id) is bumped in the release MR, the MR is\nmerged, and the tag is created on the merged commit.\n\n---\n\n## Reading this at runtime\n\n- Resource: `registry://repos`\n- Tool: `list_repos()`\n- Humans: this page (mirror of `standards/src/repos.json`).\n\n---\n\n## Related\n\n- [10 โ€“ Drone Pipelines](10_drone_pipelines.md) ยท [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md) ยท [13 โ€“ Library Registry](13_library_registry.md)\n", + "docstring": "# Repository Inventory\n\n## Summary\n\nThe canonical list of Aetos repositories covered by the CI and versioning\nstandards, with the artifact each one produces, its version source, and its\nDrone shape. Every entry maps to the contract in\n[91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md) and the two CI\nfiles in [90 โ€“ Drone Pipelines](90_drone_pipelines.md).\n\nThe same data is published machine-readably as the `registry://repos` MCP\nresource (and the `list_repos` tool), sourced from `standards/src/repos.json`.\nPaths are relative to the `aetos/` workspace root.\n\n---\n\n## Packages (Type A)\n\nA wheel + sdist published to the private index. Version source is\n`pyproject.toml`; Drone file is `python-lib.yaml` (tag-triggered).\n\n| Repo | Path | Docs | MCP server |\n|------|------|------|------------|\n| `dagpipe` | `dagpipe` | lib, wiki | `dagpipe:8006` |\n| `doc-forge` | `doc-forge` | lib, wiki | `docforge:8001` |\n| `hexa` | `hexa` | lib, wiki | `hexa:8008` |\n| `mail-intake` | `mail-intake` | lib, wiki | `mail_intake:8002` |\n| `mongo-ops` | `mongo-ops` | lib, wiki | `mongo_ops:8007` |\n| `omniread` | `omniread` | lib, wiki | `omniread:8003` |\n| `openapi-first` | `openapi-first` | lib, wiki | `openapi_first:8004` |\n| `py-jwt` | `py-jwt` | lib, wiki | `jwtlib:8005` |\n\n---\n\n## Services (Type B)\n\nA container image pushed to the registry and run on the Docker host. Version\nsource is the `VERSION` file; Drone file is `service-docker.yaml`.\n\n| Repo | Path | Trigger | Docs |\n|------|------|---------|------|\n| `auth-server` | `auth-server` | tag | api, lib, wiki |\n\nTag-triggered and enforces `tag == VERSION`.\n\n---\n\n## Required files per repo\n\n| Type | Version source | Changelog | Drone |\n|------|----------------|-----------|-------|\n| package | `pyproject.toml` | `CHANGELOG.md` | `python-lib.yaml` |\n| service | `VERSION` | `CHANGELOG.md` | `service-docker.yaml` |\n\nEvery covered repository must be able to satisfy `tag == version`:\nthe version file (never a commit id) is bumped in the release MR, the MR is\nmerged, and the tag is created on the merged commit.\n\n---\n\n## Reading this at runtime\n\n- Resource: `registry://repos`\n- Tool: `list_repos()`\n- Humans: this page (mirror of `standards/src/repos.json`).\n\n---\n\n## Related\n\n- [90 โ€“ Drone Pipelines](90_drone_pipelines.md) ยท [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md) ยท [93 โ€“ Library Registry](93_library_registry.md)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/ui_admin.json b/standards/mcp/modules/ui_admin.json new file mode 100644 index 0000000..bc4704f --- /dev/null +++ b/standards/mcp/modules/ui_admin.json @@ -0,0 +1,8 @@ +{ + "module": "ui_admin", + "content": { + "path": "ui_admin", + "docstring": "# UI: Auto-Rendered Admin & Custom Pages\n\n## Summary\n\nThe UI axis of an Aetos app is a **published React client**, not code written\nper application. Two npm packages carry the whole surface:\n\n| Package | Role |\n|---|---|\n| `@aetoskia/react-openapi` | Renders a complete admin panel (CRUD tables, forms, filters, sorting, pagination, uploads) **from the app's `openapi.yaml`** โ€” zero UI code. |\n| `@aetoskia/react-auth` | Auth contexts and pages (login/register/me) wired to the auth-server, plus the axios client with token handling. |\n\nBoth publish to the private registry `https://npm.aetoskia.com`. The server\nspec is the single source of truth: the same `openapi.yaml` that drives\n`openapi-first` routing drives the admin UI, through **x- extension fields**\n(see below).\n\n---\n\n## Scaffold\n\n```bash\ncp -r /standards/src/templates/client apps/-client\ncd apps/-client\nnpm install # deps come from npm.aetoskia.com via .npmrc\nnpm run dev\n```\n\nThe client template is a Vite + MUI app with:\n\n- `src/openapi-config.ts` โ€” points the renderer at the app's spec and the\n auth-server's spec;\n- `.env.example` โ€” `VITE_API_BASE_URL` (app API) and `VITE_AUTH_BASE_URL`\n (auth-server);\n- a `Home` page that auto-lists every resource the spec declares, and a\n `Header`/`Footer`/theme scaffold.\n\nCustom pages are ordinary React routes layered on top; the auto-rendered admin\nis available per resource at `#/resource/`.\n\n---\n\n## x- extensions: how the spec steers the UI\n\nThe admin renderer reads a catalog of OpenAPI extension fields (`x-resource`,\n`x-list-columns`, `x-display-format`, `x-label`, `x-order`, `x-hidden`,\n`x-sortable`, `x-filterable`, `x-autocomplete`, `x-fk`, `x-ui-type`,\n`x-upload`, `x-sse`, `x-profile`, and the auth wiring `x-server-url` /\n`x-login-path` / `x-me-path` / โ€ฆ) declared on schemas and properties.\n\n**The catalog is canonical in the react-openapi source, not in this doc.**\nRead it from the MCP bundle:\n\n```\ndocs://modules/react-openapi # module: specExtensions โ€” the full catalog\n```\n\nThe app's own spec carries the per-resource values; the catalog explains what\neach field does. The template's `openapi.yaml` shows the convention on the\nexample `Item` and `Job` schemas.\n\n---\n\n## Golden rules\n\n1. **The spec owns the UI.** Add a resource or rename a column in\n `openapi.yaml`; the admin follows. Never fork the renderer per app.\n2. **Custom pages for workflows, auto-render for CRUD.** Anything that is\n \"list / create / edit / delete an entity\" is a spec concern; anything that\n is a bespoke workflow is a React page.\n3. **Auth is consumed, never re-implemented.** `@aetoskia/react-auth` holds\n tokens and calls the auth-server endpoints declared by the x- wiring; pages\n read the context.\n4. **Publish, don't vendor.** UI shared across apps belongs in\n `@aetoskia/react-openapi` or `@aetoskia/react-auth` (SemVer, tag-triggered\n npm release), not copy-pasted into app trees.\n\n---\n\n## Notes\n\n- The server template ships authless by default (see\n [22 โ€“ Auth Integration](22_auth_integration.md)); the client template pairs\n with it and degrades to \"no login\" until a security scheme is declared.\n- `react/vet` is the full-stack reference implementation: spec with x-\n extensions, server, and the consuming client in one tree.\n", + "objects": {} + } +} \ No newline at end of file diff --git a/standards/mcp/modules/versioning_and_changelog.json b/standards/mcp/modules/versioning_and_changelog.json index 9b0ba38..1739932 100644 --- a/standards/mcp/modules/versioning_and_changelog.json +++ b/standards/mcp/modules/versioning_and_changelog.json @@ -2,7 +2,7 @@ "module": "versioning_and_changelog", "content": { "path": "versioning_and_changelog", - "docstring": "# Versioning & Changelog\n\n## Summary\n\nEvery Aetos artifact โ€” library or service โ€” is versioned with\n[Semantic Versioning](https://semver.org/spec/v2.0.0.html) and documents its\nreleases in a [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) file.\nThe **version file is the source of truth**, the **git tag must equal it**, and\na Drone guard enforces that equality before anything is published. Releases are\ncut manually; a tag is what triggers the pipeline.\n\nThis page pairs with [10 โ€“ Drone Pipelines](10_drone_pipelines.md): the version\nand tag contract is exactly what those two CI shapes consume.\n\n---\n\n## The version contract\n\n| Artifact | Source of truth | Notes |\n|----------|-----------------|-------|\n| Library (PyPI package) | `version` in `pyproject.toml` | `check-version` also reads it to skip duplicates |\n| Service (Docker) | `VERSION` file at the repo root | one line, `x.y.z`; the service **reads** it (build-arg) โ€” never hardcode the version |\n\nRules:\n\n1. **One version per repository.** No per-module versions.\n2. **Tag = version.** The git tag is bare SemVer (`0.0.6`), no `v` prefix, and\n it MUST match the version file byte-for-byte. The Drone guard fails the\n build otherwise โ€” this is what stops a tag from silently publishing nothing.\n3. **A release is a tag, created after the change is merged.** The version bump\n and the changelog promotion travel inside the merge request (MR); the tag is\n added on the merged commit and pushed. See [Tagging strategy](#tagging-strategy-mr-based).\n4. **Never reuse a tag.** If a release is wrong, cut a new patch version.\n\n### Pre-1.0 (0.y.z)\n\nWhile a package is `0.y.z`, **`0.y` is treated as the major line**:\n\n- breaking change โ†’ `0.(y+1).0`\n- new feature โ†’ `0.y.(z+1)`\n- bug fix โ†’ `0.y.(z+1)`\n\nOnce a package reaches `1.0.0`, normal SemVer applies. Do not ship `1.0.0`\nuntil the public API is considered stable.\n\n---\n\n## The changelog\n\n`CHANGELOG.md` at the repo root, in Keep a Changelog form. It always has exactly\none open `[Unreleased]` section with the change categories that apply:\n\n```markdown\n## [Unreleased]\n\n### Added\n### Changed\n### Deprecated\n### Removed\n### Fixed\n### Security\n```\n\nOn release you **promote** it โ€” never delete history:\n\n```markdown\n## [0.0.6] - 2026-03-07\n\n### Added\n- ...\n```\n\nand add a link reference at the bottom:\n\n```markdown\n[Unreleased]: https://git.aetoskia.com/aetos//compare/0.0.6...HEAD\n[0.0.6]: https://git.aetoskia.com/aetos//compare/0.0.5...0.0.6\n```\n\nConventions:\n\n- Write entries for humans: one line each, imperative, referencing the user\n impact, not the commit hash.\n- Categories: **Added**, **Changed**, **Deprecated**, **Removed**, **Fixed**,\n **Security**. Omit empty categories.\n- Security fixes get their own entry even if the change is otherwise a bug fix.\n- Keep `[Unreleased]` current: add an entry in the same change that introduces\n the behaviour, not later.\n- The `[Unreleased]` heading is never renamed; copy its content into the new\n version heading and clear it.\n\n### Reconcile before releasing\n\n`[Unreleased]` is a **draft, not the source of truth**. It is only trustworthy\nwhen it was maintained alongside each change; a long-running branch or a change\nthat skipped the changelog leaves it stale, so it can silently under-report a\nrelease. Verify it against the change before you promote:\n\n1. List what actually changed since the last release:\n `git log ..HEAD` and `git diff --stat ..HEAD`.\n2. Compare that against `[Unreleased]`; add an entry for every user-facing change\n that is missing.\n3. **Always show the proposed additions to the user and wait for approval**\n before promoting. If an entry is ambiguous, ask rather than guess.\n\nOnly then promote. Never cut a release with a known gap between the diff and the\nchangelog.\n\n---\n\n## Tagging strategy (MR-based)\n\nThe release version is known while the change is still a merge request, so the\nbump travels with the change and only the tag is added afterwards:\n\n1. **In the MR** โ€” reconcile `[Unreleased]` against the change (see\n [Reconcile before releasing](#reconcile-before-releasing)) and get the user's\n approval for any additions. Then set the intended release version: `version`\n in `pyproject.toml` (or the `VERSION` file) to `x.y.z`, and promote the\n changelog (below). Changelog entries and link references name the\n **version/tag**, never a commit id.\n2. **Merge or squash** the MR into `main`.\n3. **Create the tag** `x.y.z` on the resulting commit (the merge/squash commit).\n4. **Push the tag** (`git push origin x.y.z`) โ€” Drone builds the release.\n\nBecause the version bump is inside the tagged commit, the guard's\n`tag == version` check can only fail if the wrong commit was tagged.\n\n### Agent-assisted tagging\n\nThe agent neither authors nor merges the MR, and never tags before the merge.\nAfter the user confirms the MR is merged/squashed and says to proceed:\n\n1. **Wait** for that explicit go-ahead.\n2. Find the commit that introduced the version bump:\n - packages:\n `git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml`\n - services:\n `git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION`\n3. Confirm that commit's version file equals `x.y.z`, then tag **only** that\n commit, lightweight and bare: `git tag x.y.z `.\n4. **Do not push.** Ask the user to push the tag: `git push origin x.y.z`.\n\n---\n\n## Release checklist\n\n1. Confirm the quality gate is green and `main` is up to date.\n2. In the MR: reconcile `[Unreleased]` against the change being released โ€”\n `git log ..HEAD` and `git diff --stat ..HEAD` โ€” add any\n missing user-facing entries, and get the user's approval for the additions.\n Then move every `[Unreleased]` entry under the new version heading with the\n target date (`## [x.y.z] - YYYY-MM-DD`) and restore an empty `[Unreleased]`\n on top.\n3. In the MR: add the two compare-link references at the bottom of the\n changelog, naming the version/tag (never a commit id).\n4. In the MR: set the version file โ€” `pyproject.toml` (`version = \"x.y.z\"`) or\n `VERSION` โ€” to the intended release version.\n5. Merge or squash the MR into `main`.\n6. Create the tag on the resulting commit: lightweight `git tag x.y.z`.\n7. Push the tag (`git push origin x.y.z`). Watch Drone: Type A publishes the\n wheel/sdist, Type B builds and deploys the image; both first assert\n `tag == version`.\n8. Do not reuse the tag if the run fails โ€” fix and cut `x.y.(z+1)`.\n\n---\n\n## Why the guard matters\n\nThe version file and the tag are two facts that must agree; nothing in git\nenforces that by itself. A mismatch is not a theoretical risk โ€” a package can be\ntagged `0.0.2` while its `pyproject.toml` still says `0.0.1`, and the publish\nstep (which compares the **file** against the index) then skips the build\nentirely, so `0.0.2` never reaches the index while looking like a release. The\nDrone guard turns that silent no-op into a hard failure.\n\n---\n\n## Related\n\n- [10 โ€“ Drone Pipelines](10_drone_pipelines.md) ยท [15 โ€“ Repository Inventory](15_repository_inventory.md) ยท [01 โ€“ Build Recipe](01_build_recipe.md) ยท [13 โ€“ Library Registry](13_library_registry.md)\n", + "docstring": "# Versioning & Changelog\n\n## Summary\n\nEvery Aetos artifact โ€” library or service โ€” is versioned with\n[Semantic Versioning](https://semver.org/spec/v2.0.0.html) and documents its\nreleases in a [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) file.\nThe **version file is the source of truth**, the **git tag must equal it**, and\na Drone guard enforces that equality before anything is published. Releases are\ncut manually; a tag is what triggers the pipeline.\n\nThis page pairs with [90 โ€“ Drone Pipelines](90_drone_pipelines.md): the version\nand tag contract is exactly what those two CI shapes consume.\n\n---\n\n## The version contract\n\n| Artifact | Source of truth | Notes |\n|----------|-----------------|-------|\n| Library (PyPI package) | `version` in `pyproject.toml` | `check-version` also reads it to skip duplicates |\n| Service (Docker) | `VERSION` file at the repo root | one line, `x.y.z`; the service **reads** it (build-arg) โ€” never hardcode the version |\n\nRules:\n\n1. **One version per repository.** No per-module versions.\n2. **Tag = version.** The git tag is bare SemVer (`0.0.6`), no `v` prefix, and\n it MUST match the version file byte-for-byte. The Drone guard fails the\n build otherwise โ€” this is what stops a tag from silently publishing nothing.\n3. **A release is a tag, created after the change is merged.** The version bump\n and the changelog promotion travel inside the merge request (MR); the tag is\n added on the merged commit and pushed. See [Tagging strategy](#tagging-strategy-mr-based).\n4. **Never reuse a tag.** If a release is wrong, cut a new patch version.\n\n### Pre-1.0 (0.y.z)\n\nWhile a package is `0.y.z`, **`0.y` is treated as the major line**:\n\n- breaking change โ†’ `0.(y+1).0`\n- new feature โ†’ `0.y.(z+1)`\n- bug fix โ†’ `0.y.(z+1)`\n\nOnce a package reaches `1.0.0`, normal SemVer applies. Do not ship `1.0.0`\nuntil the public API is considered stable.\n\n---\n\n## The changelog\n\n`CHANGELOG.md` at the repo root, in Keep a Changelog form. It always has exactly\none open `[Unreleased]` section with the change categories that apply:\n\n```markdown\n## [Unreleased]\n\n### Added\n### Changed\n### Deprecated\n### Removed\n### Fixed\n### Security\n```\n\nOn release you **promote** it โ€” never delete history:\n\n```markdown\n## [0.0.6] - 2026-03-07\n\n### Added\n- ...\n```\n\nand add a link reference at the bottom:\n\n```markdown\n[Unreleased]: https://git.aetoskia.com/aetos//compare/0.0.6...HEAD\n[0.0.6]: https://git.aetoskia.com/aetos//compare/0.0.5...0.0.6\n```\n\nConventions:\n\n- Write entries for humans: one line each, imperative, referencing the user\n impact, not the commit hash.\n- Categories: **Added**, **Changed**, **Deprecated**, **Removed**, **Fixed**,\n **Security**. Omit empty categories.\n- Security fixes get their own entry even if the change is otherwise a bug fix.\n- Keep `[Unreleased]` current: add an entry in the same change that introduces\n the behaviour, not later.\n- The `[Unreleased]` heading is never renamed; copy its content into the new\n version heading and clear it.\n\n### Reconcile before releasing\n\n`[Unreleased]` is a **draft, not the source of truth**. It is only trustworthy\nwhen it was maintained alongside each change; a long-running branch or a change\nthat skipped the changelog leaves it stale, so it can silently under-report a\nrelease. Verify it against the change before you promote:\n\n1. List what actually changed since the last release:\n `git log ..HEAD` and `git diff --stat ..HEAD`.\n2. Compare that against `[Unreleased]`; add an entry for every user-facing change\n that is missing.\n3. **Always show the proposed additions to the user and wait for approval**\n before promoting. If an entry is ambiguous, ask rather than guess.\n\nOnly then promote. Never cut a release with a known gap between the diff and the\nchangelog.\n\n---\n\n## Tagging strategy (MR-based)\n\nThe release version is known while the change is still a merge request, so the\nbump travels with the change and only the tag is added afterwards:\n\n1. **In the MR** โ€” reconcile `[Unreleased]` against the change (see\n [Reconcile before releasing](#reconcile-before-releasing)) and get the user's\n approval for any additions. Then set the intended release version: `version`\n in `pyproject.toml` (or the `VERSION` file) to `x.y.z`, and promote the\n changelog (below). Changelog entries and link references name the\n **version/tag**, never a commit id.\n2. **Merge or squash** the MR into `main`.\n3. **Create the tag** `x.y.z` on the resulting commit (the merge/squash commit).\n4. **Push the tag** (`git push origin x.y.z`) โ€” Drone builds the release.\n\nBecause the version bump is inside the tagged commit, the guard's\n`tag == version` check can only fail if the wrong commit was tagged.\n\n### Agent-assisted tagging\n\nThe agent neither authors nor merges the MR, and never tags before the merge.\nAfter the user confirms the MR is merged/squashed and says to proceed:\n\n1. **Wait** for that explicit go-ahead.\n2. Find the commit that introduced the version bump:\n - packages:\n `git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml`\n - services:\n `git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION`\n3. Confirm that commit's version file equals `x.y.z`, then tag **only** that\n commit, lightweight and bare: `git tag x.y.z `.\n4. **Do not push.** Ask the user to push the tag: `git push origin x.y.z`.\n\n---\n\n## Release checklist\n\n1. Confirm the quality gate is green and `main` is up to date.\n2. In the MR: reconcile `[Unreleased]` against the change being released โ€”\n `git log ..HEAD` and `git diff --stat ..HEAD` โ€” add any\n missing user-facing entries, and get the user's approval for the additions.\n Then move every `[Unreleased]` entry under the new version heading with the\n target date (`## [x.y.z] - YYYY-MM-DD`) and restore an empty `[Unreleased]`\n on top.\n3. In the MR: add the two compare-link references at the bottom of the\n changelog, naming the version/tag (never a commit id).\n4. In the MR: set the version file โ€” `pyproject.toml` (`version = \"x.y.z\"`) or\n `VERSION` โ€” to the intended release version.\n5. Merge or squash the MR into `main`.\n6. Create the tag on the resulting commit: lightweight `git tag x.y.z`.\n7. Push the tag (`git push origin x.y.z`). Watch Drone: Type A publishes the\n wheel/sdist, Type B builds and deploys the image; both first assert\n `tag == version`.\n8. Do not reuse the tag if the run fails โ€” fix and cut `x.y.(z+1)`.\n\n---\n\n## Why the guard matters\n\nThe version file and the tag are two facts that must agree; nothing in git\nenforces that by itself. A mismatch is not a theoretical risk โ€” a package can be\ntagged `0.0.2` while its `pyproject.toml` still says `0.0.1`, and the publish\nstep (which compares the **file** against the index) then skips the build\nentirely, so `0.0.2` never reaches the index while looking like a release. The\nDrone guard turns that silent no-op into a hard failure.\n\n---\n\n## Related\n\n- [90 โ€“ Drone Pipelines](90_drone_pipelines.md) ยท [94 โ€“ Repository Inventory](94_repository_inventory.md) ยท [01 โ€“ Build Recipe](01_build_recipe.md) ยท [93 โ€“ Library Registry](93_library_registry.md)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/wiki_development_releasing.json b/standards/mcp/modules/wiki_development_releasing.json index 2856bab..d7bcf7e 100644 --- a/standards/mcp/modules/wiki_development_releasing.json +++ b/standards/mcp/modules/wiki_development_releasing.json @@ -2,7 +2,7 @@ "module": "wiki_development_releasing", "content": { "path": "wiki_development_releasing", - "docstring": "# Releasing & Versioning\n\nHow to cut a release of any Aetos repository. The rule lives in the reference\npage [Versioning & Changelog](../lib/11_versioning_and_changelog/); this is the\nrunbook you follow.\n\nEvery repository is one of two Drone shapes โ€” a **PyPI package** or a **Docker\ndeployment** ([Drone Pipelines](../lib/10_drone_pipelines/)). Both release the\nsame way: the version bump and changelog promotion go **in the merge request**,\nand the tag is created on the merged commit.\n\n---\n\n## ๐Ÿงพ Before you start\n\n- You have an open **merge request** holding the change, and `main` is green\n (the Drone quality gate passed on the last run).\n- You know whether this is a **breaking**, **feature**, or **fix** release.\n- The version file exists:\n - package โ†’ `version` in `pyproject.toml`\n - service โ†’ `VERSION` at the repo root\n\n---\n\n## ๐Ÿšฆ Pick the next version\n\nThe version file and the tag must be identical. For `0.y.z`, `0.y` is the major\nline (see the reference page); once at `1.0.0`, normal SemVer applies.\n\n| Change | `0.y.z` โ†’ | `1.0.0+` โ†’ |\n|--------|-----------|------------|\n| Breaking | `0.(y+1).0` | `(x+1).0.0` |\n| Feature | `0.y.(z+1)` | `x.(y+1).0` |\n| Fix | `0.y.(z+1)` | `x.y.(z+1)` |\n\n---\n\n## ๐ŸŒฟ Release in the MR\n\nThe version is known while the change is still a merge request, so the bump\nrides along with it. Do all edits **in the MR**:\n\n- **Reconcile the changelog first.** `[Unreleased]` is a **draft, not the source\n of truth**: diff the change against the last tag\n (`git log ..HEAD`, `git diff --stat ..HEAD`) and add an\n entry for every user-facing change that is missing. **Always show the proposed\n additions to the user and wait for approval** before promoting โ€” ask rather\n than guess when an entry is ambiguous.\n\n- **Promote the changelog** in `CHANGELOG.md`: move the (now reconciled)\n `[Unreleased]` content under a new `## [x.y.z] - YYYY-MM-DD` heading, leave a\n fresh empty `[Unreleased]` on top, and add the compare links โ€” naming the\n **version/tag**, never a commit id:\n\n ```markdown\n [Unreleased]: https://git.aetoskia.com/aetos//compare/x.y.z...HEAD\n [x.y.z]: https://git.aetoskia.com/aetos//compare/x.y.(z-1)...x.y.z\n ```\n\n- **Bump the version file** to the intended release version: `version = \"x.y.z\"`\n in `pyproject.toml` (packages) or the `VERSION` file (services).\n\n---\n\n## ๐Ÿท๏ธ Tag the merged commit\n\n1. **Merge or squash** the MR into `main`.\n2. **Create the tag** on the resulting commit: `git tag x.y.z` (lightweight).\n3. **Push the tag** (`git push origin x.y.z`) โ€” Drone builds the release.\n\n### ๐Ÿค– Agent-assisted tagging\n\nThe agent does not author or merge the MR and never tags before the merge. After\nyou confirm the MR is merged/squashed and tell it to proceed, the agent:\n\n1. Waits for that explicit go-ahead.\n2. Finds the commit that introduced the bump:\n - package:\n `git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml`\n - service:\n `git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION`\n3. Verifies that commit's version file equals `x.y.z`, then tags **only** that\n commit: `git tag x.y.z `.\n4. Does **not** push โ€” it asks you to run `git push origin x.y.z`.\n\n---\n\n## ๐Ÿค– What Drone does\n\n- **Type A (package):** asserts `tag == pyproject version`, then skips if that\n version already exists on the index, runs the quality gate, builds, and\n uploads the wheel + sdist.\n- **Type B (service):** asserts `tag == VERSION`, resolves the tag, skips if the\n image already exists, runs the quality gate, builds, pushes, and restarts the\n container.\n\nIf the guard fails, nothing is published โ€” fix the version file, amend the\ncommit, and move the tag **only** if it was never pushed.\n\n---\n\n## ๐Ÿ›Ÿ Backfill / recovery\n\nIf an older tag never published (a past version-file mismatch, an index\noutage):\n\n- **Package:** run the `backfill-pypi-from-tags` pipeline (custom event). It\n checks out every tag, verifies `tag == pyproject version` at that commit,\n and uploads the ones missing from the index. Already-fixed history is never\n rewritten.\n- **Service:** rebuild the image for the missing tag with a fresh commit and a\n new patch version; do not move a published tag.\n\n---\n\n## ๐Ÿ” If a release is wrong\n\n- Never reuse or force-move a pushed tag.\n- Fix forward: bump to the next patch, promote the changelog, tag again.\n\n---\n\n## Related\n\n- [Testing & Quality Gates](01_testing.md) ยท [Versioning & Changelog](../lib/11_versioning_and_changelog/) ยท [Drone Pipelines](../lib/10_drone_pipelines/)\n", + "docstring": "# Releasing & Versioning\n\nHow to cut a release of any Aetos repository. The rule lives in the reference\npage [Versioning & Changelog](../lib/91_versioning_and_changelog/); this is the\nrunbook you follow.\n\nEvery repository is one of two Drone shapes โ€” a **PyPI package** or a **Docker\ndeployment** ([Drone Pipelines](../lib/90_drone_pipelines/)). Both release the\nsame way: the version bump and changelog promotion go **in the merge request**,\nand the tag is created on the merged commit.\n\n---\n\n## ๐Ÿงพ Before you start\n\n- You have an open **merge request** holding the change, and `main` is green\n (the Drone quality gate passed on the last run).\n- You know whether this is a **breaking**, **feature**, or **fix** release.\n- The version file exists:\n - package โ†’ `version` in `pyproject.toml`\n - service โ†’ `VERSION` at the repo root\n\n---\n\n## ๐Ÿšฆ Pick the next version\n\nThe version file and the tag must be identical. For `0.y.z`, `0.y` is the major\nline (see the reference page); once at `1.0.0`, normal SemVer applies.\n\n| Change | `0.y.z` โ†’ | `1.0.0+` โ†’ |\n|--------|-----------|------------|\n| Breaking | `0.(y+1).0` | `(x+1).0.0` |\n| Feature | `0.y.(z+1)` | `x.(y+1).0` |\n| Fix | `0.y.(z+1)` | `x.y.(z+1)` |\n\n---\n\n## ๐ŸŒฟ Release in the MR\n\nThe version is known while the change is still a merge request, so the bump\nrides along with it. Do all edits **in the MR**:\n\n- **Reconcile the changelog first.** `[Unreleased]` is a **draft, not the source\n of truth**: diff the change against the last tag\n (`git log ..HEAD`, `git diff --stat ..HEAD`) and add an\n entry for every user-facing change that is missing. **Always show the proposed\n additions to the user and wait for approval** before promoting โ€” ask rather\n than guess when an entry is ambiguous.\n\n- **Promote the changelog** in `CHANGELOG.md`: move the (now reconciled)\n `[Unreleased]` content under a new `## [x.y.z] - YYYY-MM-DD` heading, leave a\n fresh empty `[Unreleased]` on top, and add the compare links โ€” naming the\n **version/tag**, never a commit id:\n\n ```markdown\n [Unreleased]: https://git.aetoskia.com/aetos//compare/x.y.z...HEAD\n [x.y.z]: https://git.aetoskia.com/aetos//compare/x.y.(z-1)...x.y.z\n ```\n\n- **Bump the version file** to the intended release version: `version = \"x.y.z\"`\n in `pyproject.toml` (packages) or the `VERSION` file (services).\n\n---\n\n## ๐Ÿท๏ธ Tag the merged commit\n\n1. **Merge or squash** the MR into `main`.\n2. **Create the tag** on the resulting commit: `git tag x.y.z` (lightweight).\n3. **Push the tag** (`git push origin x.y.z`) โ€” Drone builds the release.\n\n### ๐Ÿค– Agent-assisted tagging\n\nThe agent does not author or merge the MR and never tags before the merge. After\nyou confirm the MR is merged/squashed and tell it to proceed, the agent:\n\n1. Waits for that explicit go-ahead.\n2. Finds the commit that introduced the bump:\n - package:\n `git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml`\n - service:\n `git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION`\n3. Verifies that commit's version file equals `x.y.z`, then tags **only** that\n commit: `git tag x.y.z `.\n4. Does **not** push โ€” it asks you to run `git push origin x.y.z`.\n\n---\n\n## ๐Ÿค– What Drone does\n\n- **Type A (package):** asserts `tag == pyproject version`, then skips if that\n version already exists on the index, runs the quality gate, builds, and\n uploads the wheel + sdist.\n- **Type B (service):** asserts `tag == VERSION`, resolves the tag, skips if the\n image already exists, runs the quality gate, builds, pushes, and restarts the\n container.\n\nIf the guard fails, nothing is published โ€” fix the version file, amend the\ncommit, and move the tag **only** if it was never pushed.\n\n---\n\n## ๐Ÿ›Ÿ Backfill / recovery\n\nIf an older tag never published (a past version-file mismatch, an index\noutage):\n\n- **Package:** run the `backfill-pypi-from-tags` pipeline (custom event). It\n checks out every tag, verifies `tag == pyproject version` at that commit,\n and uploads the ones missing from the index. Already-fixed history is never\n rewritten.\n- **Service:** rebuild the image for the missing tag with a fresh commit and a\n new patch version; do not move a published tag.\n\n---\n\n## ๐Ÿ” If a release is wrong\n\n- Never reuse or force-move a pushed tag.\n- Fix forward: bump to the next patch, promote the changelog, tag again.\n\n---\n\n## Related\n\n- [Testing & Quality Gates](01_testing.md) ยท [Versioning & Changelog](../lib/91_versioning_and_changelog/) ยท [Drone Pipelines](../lib/90_drone_pipelines/)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/wiki_index.json b/standards/mcp/modules/wiki_index.json index 2738968..aacaf24 100644 --- a/standards/mcp/modules/wiki_index.json +++ b/standards/mcp/modules/wiki_index.json @@ -2,7 +2,7 @@ "module": "wiki_index", "content": { "path": "wiki_index", - "docstring": "# ๐Ÿงฉ Standards โ€” the Aetos App Blueprint\n\nOne reusable architecture for every backend application in the Aetos ecosystem:\na spec-first HTTP edge, a framework-free domain core, a pluggable infrastructure\nlayer, and a single composition root.\n\nFill in **two axes only** and a new app is done: your **resource model**, and\n(if needed) your **pipeline family**. The blueprint itself never names a\nbusiness domain โ€” expenses, health metrics, inventory, and analytics are all\nthe same shape underneath.\n\n> **Doc model:** this wiki is written for humans โ€” how-to guides, the build\n> recipe, and quality gates. The enforceable rules (layering, composition root,\n> CRUD template, pipeline scaffold) and the library registry live in the\n> **reference** pages, mirrored by the machine-readable `standards` MCP bundle.\n> Query `find_library` before writing any infrastructure.\n\n---\n\n## ๐Ÿš€ Key Features\n\n- ๐Ÿงญ **Spec-first routing** โ€” the OpenAPI document, not decorator routers, is\n the source of truth (operationId lookup)\n- ๐Ÿ—๏ธ **One-way layering** โ€” `interfaces โ†’ domain โ†’ infra`, enforced\n- ๐Ÿ”Œ **Single composition root** โ€” every dependency is wired in exactly one place\n- ๐Ÿงฉ **Generic, not app-specific** โ€” reusable rules versus two authoring axes\n- ๐Ÿ“š **Library-backed** โ€” DB, DI, pipelines, ingestion, auth, and docs come from\n internal libraries, never hand-written\n- ๐Ÿšฆ **Explicit state machines** โ€” durable job statuses, progress, and\n human-in-the-loop pauses\n\n---\n\n## ๐Ÿ“ Documentation Structure\n\n| Section | Description |\n|-----------------------------------------------------|--------------------------------------------------------|\n| [Overview](01_overview.md) | Philosophy, the one-way dependency rule, architecture |\n| [App Components](02_components.md) | The component model and how the pieces wire together |\n| [Start an App](03_start_an_app.md) | The entry point: gather the two axes, then build |\n| [Testing & Quality](04_development/01_testing.md) | Test layout and acceptance gates |\n\n**Reference** (separate site, mirrors the MCP bundle): the enforceable\nrules โ€” [Build Recipe](../lib/01_build_recipe/), [Layering](../lib/02_layering_rules/), [Composition\nRoot](../lib/03_composition_root/), [Spec-First\nRouting](../lib/04_spec_first_routing/), [CRUD\nTemplate](../lib/05_crud_template/), [Pipeline\nScaffold](../lib/06_pipeline_scaffold/), [Worker &\nProgress](../lib/07_worker_and_progress/), [Human-in-the-Loop](../lib/08_human_in_loop/),\n[Infra Adapters](../lib/09_infra_adaptors/), [Genericity\nMatrix](../lib/12_genericity_matrix/), [Library\nRegistry](../lib/13_library_registry/).\n\n---\n\n## ๐Ÿ”— Related Resources\n\n- **MCP bundle** โ€” `standards` server on `:8009`: read `docs://index`,\n `docs://nav`, `docs://modules/{module}`; call `find_library(capability)`\n- **Library registry** โ€” the catalog of internal libraries behind every app\n (`libraries.json`, served as `registry://libraries`)\n- **Template** โ€” the runnable skeleton at `standards/src/templates/app/`\n- **Start a build** โ€” invoke the `start_app` prompt on the `standards` server,\n or read the [Start an App](03_start_an_app.md) guide\n\n---\n\nยฉ Aetoskia Internal โ€” `standards`\n", + "docstring": "# ๐Ÿงฉ Standards โ€” the Aetos App Blueprint\n\nOne reusable architecture for every backend application in the Aetos ecosystem:\na spec-first HTTP edge, a framework-free domain core, a pluggable infrastructure\nlayer, and a single composition root.\n\nFill in **two axes only** and a new app is done: your **resource model**, and\n(if needed) your **pipeline family**. The blueprint itself never names a\nbusiness domain โ€” expenses, health metrics, inventory, and analytics are all\nthe same shape underneath.\n\n> **Doc model:** this wiki is written for humans โ€” how-to guides, the build\n> recipe, and quality gates. The enforceable rules (layering, composition root,\n> CRUD template, pipeline scaffold) and the library registry live in the\n> **reference** pages, mirrored by the machine-readable `standards` MCP bundle.\n> Query `find_library` before writing any infrastructure.\n\n---\n\n## ๐Ÿš€ Key Features\n\n- ๐Ÿงญ **Spec-first routing** โ€” the OpenAPI document, not decorator routers, is\n the source of truth (operationId lookup)\n- ๐Ÿ—๏ธ **One-way layering** โ€” `interfaces โ†’ domain โ†’ infra`, enforced\n- ๐Ÿ”Œ **Single composition root** โ€” every dependency is wired in exactly one place\n- ๐Ÿงฉ **Generic, not app-specific** โ€” reusable rules versus two authoring axes\n- ๐Ÿ“š **Library-backed** โ€” DB, DI, pipelines, ingestion, auth, and docs come from\n internal libraries, never hand-written\n- ๐Ÿšฆ **Explicit state machines** โ€” durable job statuses, progress, and\n human-in-the-loop pauses\n\n---\n\n## ๐Ÿ“ Documentation Structure\n\n| Section | Description |\n|-----------------------------------------------------|--------------------------------------------------------|\n| [Overview](01_overview.md) | Philosophy, the one-way dependency rule, architecture |\n| [App Components](02_components.md) | The component model and how the pieces wire together |\n| [Start an App](03_start_an_app.md) | The entry point: gather the two axes, then build |\n| [Testing & Quality](04_development/01_testing.md) | Test layout and acceptance gates |\n\n**Reference** (separate site, mirrors the MCP bundle): the enforceable\nanatomy โ€” start at the [Build Recipe](../lib/01_build_recipe/), then the\npillars: domains ([Layering](../lib/10_layering_rules/)), the OpenAPI\ncontract ([Composition Root](../lib/02_composition_root/),\n[Spec-First Routing](../lib/20_spec_first_routing/), [CRUD\nTemplate](../lib/21_crud_template/), [Auth\nIntegration](../lib/22_auth_integration/)), interfaces & infra ([Infra\nAdapters](../lib/30_infra_adaptors/)), UI ([Auto-Rendered\nAdmin](../lib/40_ui_admin/)), the optional pipelines layer ([Pipeline\nScaffold](../lib/50_pipeline_scaffold/), [Worker &\nProgress](../lib/51_worker_and_progress/), [Human-in-the-Loop](../lib/52_human_in_loop/)),\nand delivery/meta ([Genericity\nMatrix](../lib/92_genericity_matrix/), [Library\nRegistry](../lib/93_library_registry/)).\n\n---\n\n## ๐Ÿ”— Related Resources\n\n- **MCP bundle** โ€” `standards` server on `:8009`: read `docs://index`,\n `docs://nav`, `docs://modules/{module}`; call `find_library(capability)`\n- **Library registry** โ€” the catalog of internal libraries behind every app\n (`libraries.json`, served as `registry://libraries`)\n- **Template** โ€” the runnable skeleton at `standards/src/templates/app/`\n- **Start a build** โ€” invoke the `start_app` prompt on the `standards` server,\n or read the [Start an App](03_start_an_app.md) guide\n\n---\n\nยฉ Aetoskia Internal โ€” `standards`\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/wiki_mcp_setup.json b/standards/mcp/modules/wiki_mcp_setup.json index 75b46f7..ab4920a 100644 --- a/standards/mcp/modules/wiki_mcp_setup.json +++ b/standards/mcp/modules/wiki_mcp_setup.json @@ -2,7 +2,7 @@ "module": "wiki_mcp_setup", "content": { "path": "wiki_mcp_setup", - "docstring": "# ๐Ÿ”Œ MCP Setup\n\nEvery repository ships its documentation as a **Model Context Protocol (MCP)**\nserver, and the `standards` registry server ties them together. The `docs`\nportal runs each one as a FastMCP **streamable-http** app bound to\n`0.0.0.0:`, exposing the endpoint at `/mcp` (see `docs/main.py` and\n`docs/config.yml`).\n\nConnect your agent to the **`standards`** server first: it answers\n`find_library`, `list_repos`, and the `start_app` prompt, so the agent reaches\nfor an internal library instead of reimplementing one (see the\n[Library Registry](../lib/13_library_registry/)).\n\n---\n\n## โ–ถ๏ธ Run the servers locally\n\nFrom the `docs` checkout:\n\n```bash\n.venv\\Scripts\\python.exe main.py # every server\n.venv\\Scripts\\python.exe main.py --servers standards # just the registry\n```\n\n`:8000` is the health endpoint (`GET /healthz`), **not** an MCP server.\n\n---\n\n## ๐Ÿงญ Servers\n\n| Slug | MCP server | Port | localhost | mcp.aetoskia.com |\n|------|------------|------|-----------|------------------|\n| `standards` | `standards` | 8009 | `http://localhost:8009/mcp` | `https://mcp.aetoskia.com/standards/mcp` |\n| `doc-forge` | `docforge` | 8001 | `http://localhost:8001/mcp` | `https://mcp.aetoskia.com/doc-forge/mcp` |\n| `mail-intake` | `mail_intake` | 8002 | `http://localhost:8002/mcp` | `https://mcp.aetoskia.com/mail-intake/mcp` |\n| `omniread` | `omniread` | 8003 | `http://localhost:8003/mcp` | `https://mcp.aetoskia.com/omniread/mcp` |\n| `openapi-first` | `openapi_first` | 8004 | `http://localhost:8004/mcp` | `https://mcp.aetoskia.com/openapi-first/mcp` |\n| `py-jwt` | `jwtlib` | 8005 | `http://localhost:8005/mcp` | `https://mcp.aetoskia.com/py-jwt/mcp` |\n| `dagpipe` | `dagpipe` | 8006 | `http://localhost:8006/mcp` | `https://mcp.aetoskia.com/dagpipe/mcp` |\n| `mongo-ops` | `mongo_ops` | 8007 | `http://localhost:8007/mcp` | `https://mcp.aetoskia.com/mongo-ops/mcp` |\n| `hexa` | `hexa` | 8008 | `http://localhost:8008/mcp` | `https://mcp.aetoskia.com/hexa/mcp` |\n| `doc-weaver` | `doc-weaver` | 8010 | `http://localhost:8010/mcp` | `https://mcp.aetoskia.com/doc-weaver/mcp` |\n| `react-auth` | `react-auth` | 8011 | `http://localhost:8011/mcp` | `https://mcp.aetoskia.com/react-auth/mcp` |\n| `react-openapi` | `react-openapi` | 8012 | `http://localhost:8012/mcp` | `https://mcp.aetoskia.com/react-openapi/mcp` |\n\nThe hosted endpoints are served over HTTPS at `https://mcp.aetoskia.com//mcp`.\nThe tabs below are linked (`content.tabs.link`): switching one switches all of\nthem. Every snippet registers **all twelve** servers, so a single paste is\nenough.\n\n---\n\n## ๐Ÿค– Claude Code\n\nProject-scoped `.mcp.json` at the repo root. The `type` field is required โ€” an\nentry with a `url` but no `type` is read as a stdio server and skipped.\n\n=== \"localhost\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"type\": \"http\", \"url\": \"http://localhost:8009/mcp\" },\n \"doc-forge\": { \"type\": \"http\", \"url\": \"http://localhost:8001/mcp\" },\n \"mail-intake\": { \"type\": \"http\", \"url\": \"http://localhost:8002/mcp\" },\n \"omniread\": { \"type\": \"http\", \"url\": \"http://localhost:8003/mcp\" },\n \"openapi-first\": { \"type\": \"http\", \"url\": \"http://localhost:8004/mcp\" },\n \"py-jwt\": { \"type\": \"http\", \"url\": \"http://localhost:8005/mcp\" },\n \"dagpipe\": { \"type\": \"http\", \"url\": \"http://localhost:8006/mcp\" },\n \"mongo-ops\": { \"type\": \"http\", \"url\": \"http://localhost:8007/mcp\" },\n \"hexa\": { \"type\": \"http\", \"url\": \"http://localhost:8008/mcp\" },\n \"doc-weaver\": { \"type\": \"http\", \"url\": \"http://localhost:8010/mcp\" },\n \"react-auth\": { \"type\": \"http\", \"url\": \"http://localhost:8011/mcp\" },\n \"react-openapi\": { \"type\": \"http\", \"url\": \"http://localhost:8012/mcp\" }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n \"doc-forge\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n \"mail-intake\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n \"omniread\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n \"openapi-first\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n \"py-jwt\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n \"dagpipe\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n \"mongo-ops\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n \"hexa\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n \"doc-weaver\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n \"react-auth\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n \"react-openapi\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n }\n }\n ```\n\nOr add them with the CLI:\n`claude mcp add --transport http standards http://localhost:8009/mcp`.\n\n---\n\n## ๐Ÿค– Codex\n\n`~/.codex/config.toml` (or a project-scoped `.codex/config.toml`).\n\n=== \"localhost\"\n\n ```toml\n [mcp_servers.standards]\n url = \"http://localhost:8009/mcp\"\n\n [mcp_servers.doc-forge]\n url = \"http://localhost:8001/mcp\"\n\n [mcp_servers.mail-intake]\n url = \"http://localhost:8002/mcp\"\n\n [mcp_servers.omniread]\n url = \"http://localhost:8003/mcp\"\n\n [mcp_servers.openapi-first]\n url = \"http://localhost:8004/mcp\"\n\n [mcp_servers.py-jwt]\n url = \"http://localhost:8005/mcp\"\n\n [mcp_servers.dagpipe]\n url = \"http://localhost:8006/mcp\"\n\n [mcp_servers.mongo-ops]\n url = \"http://localhost:8007/mcp\"\n\n [mcp_servers.hexa]\n url = \"http://localhost:8008/mcp\"\n\n [mcp_servers.doc-weaver]\n url = \"http://localhost:8010/mcp\"\n\n [mcp_servers.react-auth]\n url = \"http://localhost:8011/mcp\"\n\n [mcp_servers.react-openapi]\n url = \"http://localhost:8012/mcp\"\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```toml\n [mcp_servers.standards]\n url = \"https://mcp.aetoskia.com/standards/mcp\"\n\n [mcp_servers.doc-forge]\n url = \"https://mcp.aetoskia.com/doc-forge/mcp\"\n\n [mcp_servers.mail-intake]\n url = \"https://mcp.aetoskia.com/mail-intake/mcp\"\n\n [mcp_servers.omniread]\n url = \"https://mcp.aetoskia.com/omniread/mcp\"\n\n [mcp_servers.openapi-first]\n url = \"https://mcp.aetoskia.com/openapi-first/mcp\"\n\n [mcp_servers.py-jwt]\n url = \"https://mcp.aetoskia.com/py-jwt/mcp\"\n\n [mcp_servers.dagpipe]\n url = \"https://mcp.aetoskia.com/dagpipe/mcp\"\n\n [mcp_servers.mongo-ops]\n url = \"https://mcp.aetoskia.com/mongo-ops/mcp\"\n\n [mcp_servers.hexa]\n url = \"https://mcp.aetoskia.com/hexa/mcp\"\n\n [mcp_servers.doc-weaver]\n url = \"https://mcp.aetoskia.com/doc-weaver/mcp\"\n\n [mcp_servers.react-auth]\n url = \"https://mcp.aetoskia.com/react-auth/mcp\"\n\n [mcp_servers.react-openapi]\n url = \"https://mcp.aetoskia.com/react-openapi/mcp\"\n ```\n\nOr add them with the CLI:\n`codex mcp add standards --url http://localhost:8009/mcp`.\n\n---\n\n## ๐Ÿค– Antigravity\n\n`~/.gemini/antigravity/mcp_config.json` (IDE) or\n`~/.gemini/config/mcp_config.json` (CLI). Antigravity uses **`serverUrl`**, not\n`url`, for HTTP endpoints.\n\n=== \"localhost\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"serverUrl\": \"http://localhost:8009/mcp\" },\n \"doc-forge\": { \"serverUrl\": \"http://localhost:8001/mcp\" },\n \"mail-intake\": { \"serverUrl\": \"http://localhost:8002/mcp\" },\n \"omniread\": { \"serverUrl\": \"http://localhost:8003/mcp\" },\n \"openapi-first\": { \"serverUrl\": \"http://localhost:8004/mcp\" },\n \"py-jwt\": { \"serverUrl\": \"http://localhost:8005/mcp\" },\n \"dagpipe\": { \"serverUrl\": \"http://localhost:8006/mcp\" },\n \"mongo-ops\": { \"serverUrl\": \"http://localhost:8007/mcp\" },\n \"hexa\": { \"serverUrl\": \"http://localhost:8008/mcp\" },\n \"doc-weaver\": { \"serverUrl\": \"http://localhost:8010/mcp\" },\n \"react-auth\": { \"serverUrl\": \"http://localhost:8011/mcp\" },\n \"react-openapi\": { \"serverUrl\": \"http://localhost:8012/mcp\" }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"serverUrl\": \"https://mcp.aetoskia.com/standards/mcp\" },\n \"doc-forge\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n \"mail-intake\": { \"serverUrl\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n \"omniread\": { \"serverUrl\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n \"openapi-first\": { \"serverUrl\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n \"py-jwt\": { \"serverUrl\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n \"dagpipe\": { \"serverUrl\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n \"mongo-ops\": { \"serverUrl\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n \"hexa\": { \"serverUrl\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n \"doc-weaver\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n \"react-auth\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n \"react-openapi\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n }\n }\n ```\n\n---\n\n## ๐Ÿค– OpenCode\n\n`opencode.json` (project) or `~/.config/opencode/opencode.json` (global).\n\n=== \"localhost\"\n\n ```json\n {\n \"$schema\": \"https://opencode.ai/config.json\",\n \"mcp\": {\n \"standards\": { \"type\": \"remote\", \"url\": \"http://localhost:8009/mcp\", \"enabled\": true },\n \"doc-forge\": { \"type\": \"remote\", \"url\": \"http://localhost:8001/mcp\", \"enabled\": true },\n \"mail-intake\": { \"type\": \"remote\", \"url\": \"http://localhost:8002/mcp\", \"enabled\": true },\n \"omniread\": { \"type\": \"remote\", \"url\": \"http://localhost:8003/mcp\", \"enabled\": true },\n \"openapi-first\": { \"type\": \"remote\", \"url\": \"http://localhost:8004/mcp\", \"enabled\": true },\n \"py-jwt\": { \"type\": \"remote\", \"url\": \"http://localhost:8005/mcp\", \"enabled\": true },\n \"dagpipe\": { \"type\": \"remote\", \"url\": \"http://localhost:8006/mcp\", \"enabled\": true },\n \"mongo-ops\": { \"type\": \"remote\", \"url\": \"http://localhost:8007/mcp\", \"enabled\": true },\n \"hexa\": { \"type\": \"remote\", \"url\": \"http://localhost:8008/mcp\", \"enabled\": true },\n \"doc-weaver\": { \"type\": \"remote\", \"url\": \"http://localhost:8010/mcp\", \"enabled\": true },\n \"react-auth\": { \"type\": \"remote\", \"url\": \"http://localhost:8011/mcp\", \"enabled\": true },\n \"react-openapi\": { \"type\": \"remote\", \"url\": \"http://localhost:8012/mcp\", \"enabled\": true }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"$schema\": \"https://opencode.ai/config.json\",\n \"mcp\": {\n \"standards\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\", \"enabled\": true },\n \"doc-forge\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\", \"enabled\": true },\n \"mail-intake\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\", \"enabled\": true },\n \"omniread\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\", \"enabled\": true },\n \"openapi-first\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\", \"enabled\": true },\n \"py-jwt\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\", \"enabled\": true },\n \"dagpipe\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\", \"enabled\": true },\n \"mongo-ops\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\", \"enabled\": true },\n \"hexa\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\", \"enabled\": true },\n \"doc-weaver\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\", \"enabled\": true },\n \"react-auth\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\", \"enabled\": true },\n \"react-openapi\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\", \"enabled\": true }\n }\n }\n ```\n\nOr add them with the CLI:\n`opencode mcp add standards --url http://localhost:8009/mcp --global`.\n\n---\n\n## ๐Ÿค– PyCharm (Junie / AI Assistant)\n\n`~/.junie/mcp/mcp.json` (user scope) or `.junie/mcp/mcp.json` (project scope).\nThe same config is reachable from **Settings | Tools | MCP Server โ†’ Manual\nClient Configuration โ†’ Copy HTTP Stream Config**.\n\n=== \"localhost\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"url\": \"http://localhost:8009/mcp\" },\n \"doc-forge\": { \"url\": \"http://localhost:8001/mcp\" },\n \"mail-intake\": { \"url\": \"http://localhost:8002/mcp\" },\n \"omniread\": { \"url\": \"http://localhost:8003/mcp\" },\n \"openapi-first\": { \"url\": \"http://localhost:8004/mcp\" },\n \"py-jwt\": { \"url\": \"http://localhost:8005/mcp\" },\n \"dagpipe\": { \"url\": \"http://localhost:8006/mcp\" },\n \"mongo-ops\": { \"url\": \"http://localhost:8007/mcp\" },\n \"hexa\": { \"url\": \"http://localhost:8008/mcp\" },\n \"doc-weaver\": { \"url\": \"http://localhost:8010/mcp\" },\n \"react-auth\": { \"url\": \"http://localhost:8011/mcp\" },\n \"react-openapi\": { \"url\": \"http://localhost:8012/mcp\" }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n \"doc-forge\": { \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n \"mail-intake\": { \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n \"omniread\": { \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n \"openapi-first\": { \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n \"py-jwt\": { \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n \"dagpipe\": { \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n \"mongo-ops\": { \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n \"hexa\": { \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n \"doc-weaver\": { \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n \"react-auth\": { \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n \"react-openapi\": { \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n }\n }\n ```\n\n---\n\n## โœ… Verify\n\n- Health check: `curl http://localhost:8000/healthz` โ†’ `ok`.\n- Claude Code: `claude mcp list` โ†’ each server โ€ฆ `โœ“ Connected`.\n- Codex: `codex mcp list` โ†’ each server โ€ฆ `http`.\n- OpenCode: `opencode mcp list` โ†’ each server โ€ฆ `connected`.\n- In-session: run `/mcp` to list the connected servers and their tools.\n\n---\n\n## ๐Ÿ“š Reference\n\n- [Library Registry](../lib/13_library_registry/) โ€” the catalog each server\n mirrors, and where `find_library` resolves\n- [Start an App](03_start_an_app.md) โ€” connect `standards`, then invoke\n `start_app`\n- [App Components](02_components.md) โ€” the component model\n\n---\n\n## Related\n\n- [Start an App](03_start_an_app.md) ยท [Testing & Quality](04_development/01_testing.md) ยท [Library Registry](../lib/13_library_registry/)\n", + "docstring": "# ๐Ÿ”Œ MCP Setup\n\nEvery repository ships its documentation as a **Model Context Protocol (MCP)**\nserver, and the `standards` registry server ties them together. The `docs`\nportal runs each one as a FastMCP **streamable-http** app bound to\n`0.0.0.0:`, exposing the endpoint at `/mcp` (see `docs/main.py` and\n`docs/config.yml`).\n\nConnect your agent to the **`standards`** server first: it answers\n`find_library`, `list_repos`, and the `start_app` prompt, so the agent reaches\nfor an internal library instead of reimplementing one (see the\n[Library Registry](../lib/93_library_registry/)).\n\n---\n\n## โ–ถ๏ธ Run the servers locally\n\nFrom the `docs` checkout:\n\n```bash\n.venv\\Scripts\\python.exe main.py # every server\n.venv\\Scripts\\python.exe main.py --servers standards # just the registry\n```\n\n`:8000` is the health endpoint (`GET /healthz`), **not** an MCP server.\n\n---\n\n## ๐Ÿงญ Servers\n\n| Slug | MCP server | Port | localhost | mcp.aetoskia.com |\n|------|------------|------|-----------|------------------|\n| `standards` | `standards` | 8009 | `http://localhost:8009/mcp` | `https://mcp.aetoskia.com/standards/mcp` |\n| `doc-forge` | `docforge` | 8001 | `http://localhost:8001/mcp` | `https://mcp.aetoskia.com/doc-forge/mcp` |\n| `mail-intake` | `mail_intake` | 8002 | `http://localhost:8002/mcp` | `https://mcp.aetoskia.com/mail-intake/mcp` |\n| `omniread` | `omniread` | 8003 | `http://localhost:8003/mcp` | `https://mcp.aetoskia.com/omniread/mcp` |\n| `openapi-first` | `openapi_first` | 8004 | `http://localhost:8004/mcp` | `https://mcp.aetoskia.com/openapi-first/mcp` |\n| `py-jwt` | `jwtlib` | 8005 | `http://localhost:8005/mcp` | `https://mcp.aetoskia.com/py-jwt/mcp` |\n| `dagpipe` | `dagpipe` | 8006 | `http://localhost:8006/mcp` | `https://mcp.aetoskia.com/dagpipe/mcp` |\n| `mongo-ops` | `mongo_ops` | 8007 | `http://localhost:8007/mcp` | `https://mcp.aetoskia.com/mongo-ops/mcp` |\n| `hexa` | `hexa` | 8008 | `http://localhost:8008/mcp` | `https://mcp.aetoskia.com/hexa/mcp` |\n| `doc-weaver` | `doc-weaver` | 8010 | `http://localhost:8010/mcp` | `https://mcp.aetoskia.com/doc-weaver/mcp` |\n| `react-auth` | `react-auth` | 8011 | `http://localhost:8011/mcp` | `https://mcp.aetoskia.com/react-auth/mcp` |\n| `react-openapi` | `react-openapi` | 8012 | `http://localhost:8012/mcp` | `https://mcp.aetoskia.com/react-openapi/mcp` |\n\nThe hosted endpoints are served over HTTPS at `https://mcp.aetoskia.com//mcp`.\nThe tabs below are linked (`content.tabs.link`): switching one switches all of\nthem. Every snippet registers **all twelve** servers, so a single paste is\nenough.\n\n---\n\n## ๐Ÿค– Claude Code\n\nProject-scoped `.mcp.json` at the repo root. The `type` field is required โ€” an\nentry with a `url` but no `type` is read as a stdio server and skipped.\n\n=== \"localhost\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"type\": \"http\", \"url\": \"http://localhost:8009/mcp\" },\n \"doc-forge\": { \"type\": \"http\", \"url\": \"http://localhost:8001/mcp\" },\n \"mail-intake\": { \"type\": \"http\", \"url\": \"http://localhost:8002/mcp\" },\n \"omniread\": { \"type\": \"http\", \"url\": \"http://localhost:8003/mcp\" },\n \"openapi-first\": { \"type\": \"http\", \"url\": \"http://localhost:8004/mcp\" },\n \"py-jwt\": { \"type\": \"http\", \"url\": \"http://localhost:8005/mcp\" },\n \"dagpipe\": { \"type\": \"http\", \"url\": \"http://localhost:8006/mcp\" },\n \"mongo-ops\": { \"type\": \"http\", \"url\": \"http://localhost:8007/mcp\" },\n \"hexa\": { \"type\": \"http\", \"url\": \"http://localhost:8008/mcp\" },\n \"doc-weaver\": { \"type\": \"http\", \"url\": \"http://localhost:8010/mcp\" },\n \"react-auth\": { \"type\": \"http\", \"url\": \"http://localhost:8011/mcp\" },\n \"react-openapi\": { \"type\": \"http\", \"url\": \"http://localhost:8012/mcp\" }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n \"doc-forge\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n \"mail-intake\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n \"omniread\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n \"openapi-first\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n \"py-jwt\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n \"dagpipe\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n \"mongo-ops\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n \"hexa\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n \"doc-weaver\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n \"react-auth\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n \"react-openapi\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n }\n }\n ```\n\nOr add them with the CLI:\n`claude mcp add --transport http standards http://localhost:8009/mcp`.\n\n---\n\n## ๐Ÿค– Codex\n\n`~/.codex/config.toml` (or a project-scoped `.codex/config.toml`).\n\n=== \"localhost\"\n\n ```toml\n [mcp_servers.standards]\n url = \"http://localhost:8009/mcp\"\n\n [mcp_servers.doc-forge]\n url = \"http://localhost:8001/mcp\"\n\n [mcp_servers.mail-intake]\n url = \"http://localhost:8002/mcp\"\n\n [mcp_servers.omniread]\n url = \"http://localhost:8003/mcp\"\n\n [mcp_servers.openapi-first]\n url = \"http://localhost:8004/mcp\"\n\n [mcp_servers.py-jwt]\n url = \"http://localhost:8005/mcp\"\n\n [mcp_servers.dagpipe]\n url = \"http://localhost:8006/mcp\"\n\n [mcp_servers.mongo-ops]\n url = \"http://localhost:8007/mcp\"\n\n [mcp_servers.hexa]\n url = \"http://localhost:8008/mcp\"\n\n [mcp_servers.doc-weaver]\n url = \"http://localhost:8010/mcp\"\n\n [mcp_servers.react-auth]\n url = \"http://localhost:8011/mcp\"\n\n [mcp_servers.react-openapi]\n url = \"http://localhost:8012/mcp\"\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```toml\n [mcp_servers.standards]\n url = \"https://mcp.aetoskia.com/standards/mcp\"\n\n [mcp_servers.doc-forge]\n url = \"https://mcp.aetoskia.com/doc-forge/mcp\"\n\n [mcp_servers.mail-intake]\n url = \"https://mcp.aetoskia.com/mail-intake/mcp\"\n\n [mcp_servers.omniread]\n url = \"https://mcp.aetoskia.com/omniread/mcp\"\n\n [mcp_servers.openapi-first]\n url = \"https://mcp.aetoskia.com/openapi-first/mcp\"\n\n [mcp_servers.py-jwt]\n url = \"https://mcp.aetoskia.com/py-jwt/mcp\"\n\n [mcp_servers.dagpipe]\n url = \"https://mcp.aetoskia.com/dagpipe/mcp\"\n\n [mcp_servers.mongo-ops]\n url = \"https://mcp.aetoskia.com/mongo-ops/mcp\"\n\n [mcp_servers.hexa]\n url = \"https://mcp.aetoskia.com/hexa/mcp\"\n\n [mcp_servers.doc-weaver]\n url = \"https://mcp.aetoskia.com/doc-weaver/mcp\"\n\n [mcp_servers.react-auth]\n url = \"https://mcp.aetoskia.com/react-auth/mcp\"\n\n [mcp_servers.react-openapi]\n url = \"https://mcp.aetoskia.com/react-openapi/mcp\"\n ```\n\nOr add them with the CLI:\n`codex mcp add standards --url http://localhost:8009/mcp`.\n\n---\n\n## ๐Ÿค– Antigravity\n\n`~/.gemini/antigravity/mcp_config.json` (IDE) or\n`~/.gemini/config/mcp_config.json` (CLI). Antigravity uses **`serverUrl`**, not\n`url`, for HTTP endpoints.\n\n=== \"localhost\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"serverUrl\": \"http://localhost:8009/mcp\" },\n \"doc-forge\": { \"serverUrl\": \"http://localhost:8001/mcp\" },\n \"mail-intake\": { \"serverUrl\": \"http://localhost:8002/mcp\" },\n \"omniread\": { \"serverUrl\": \"http://localhost:8003/mcp\" },\n \"openapi-first\": { \"serverUrl\": \"http://localhost:8004/mcp\" },\n \"py-jwt\": { \"serverUrl\": \"http://localhost:8005/mcp\" },\n \"dagpipe\": { \"serverUrl\": \"http://localhost:8006/mcp\" },\n \"mongo-ops\": { \"serverUrl\": \"http://localhost:8007/mcp\" },\n \"hexa\": { \"serverUrl\": \"http://localhost:8008/mcp\" },\n \"doc-weaver\": { \"serverUrl\": \"http://localhost:8010/mcp\" },\n \"react-auth\": { \"serverUrl\": \"http://localhost:8011/mcp\" },\n \"react-openapi\": { \"serverUrl\": \"http://localhost:8012/mcp\" }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"serverUrl\": \"https://mcp.aetoskia.com/standards/mcp\" },\n \"doc-forge\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n \"mail-intake\": { \"serverUrl\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n \"omniread\": { \"serverUrl\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n \"openapi-first\": { \"serverUrl\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n \"py-jwt\": { \"serverUrl\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n \"dagpipe\": { \"serverUrl\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n \"mongo-ops\": { \"serverUrl\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n \"hexa\": { \"serverUrl\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n \"doc-weaver\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n \"react-auth\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n \"react-openapi\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n }\n }\n ```\n\n---\n\n## ๐Ÿค– OpenCode\n\n`opencode.json` (project) or `~/.config/opencode/opencode.json` (global).\n\n=== \"localhost\"\n\n ```json\n {\n \"$schema\": \"https://opencode.ai/config.json\",\n \"mcp\": {\n \"standards\": { \"type\": \"remote\", \"url\": \"http://localhost:8009/mcp\", \"enabled\": true },\n \"doc-forge\": { \"type\": \"remote\", \"url\": \"http://localhost:8001/mcp\", \"enabled\": true },\n \"mail-intake\": { \"type\": \"remote\", \"url\": \"http://localhost:8002/mcp\", \"enabled\": true },\n \"omniread\": { \"type\": \"remote\", \"url\": \"http://localhost:8003/mcp\", \"enabled\": true },\n \"openapi-first\": { \"type\": \"remote\", \"url\": \"http://localhost:8004/mcp\", \"enabled\": true },\n \"py-jwt\": { \"type\": \"remote\", \"url\": \"http://localhost:8005/mcp\", \"enabled\": true },\n \"dagpipe\": { \"type\": \"remote\", \"url\": \"http://localhost:8006/mcp\", \"enabled\": true },\n \"mongo-ops\": { \"type\": \"remote\", \"url\": \"http://localhost:8007/mcp\", \"enabled\": true },\n \"hexa\": { \"type\": \"remote\", \"url\": \"http://localhost:8008/mcp\", \"enabled\": true },\n \"doc-weaver\": { \"type\": \"remote\", \"url\": \"http://localhost:8010/mcp\", \"enabled\": true },\n \"react-auth\": { \"type\": \"remote\", \"url\": \"http://localhost:8011/mcp\", \"enabled\": true },\n \"react-openapi\": { \"type\": \"remote\", \"url\": \"http://localhost:8012/mcp\", \"enabled\": true }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"$schema\": \"https://opencode.ai/config.json\",\n \"mcp\": {\n \"standards\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\", \"enabled\": true },\n \"doc-forge\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\", \"enabled\": true },\n \"mail-intake\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\", \"enabled\": true },\n \"omniread\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\", \"enabled\": true },\n \"openapi-first\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\", \"enabled\": true },\n \"py-jwt\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\", \"enabled\": true },\n \"dagpipe\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\", \"enabled\": true },\n \"mongo-ops\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\", \"enabled\": true },\n \"hexa\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\", \"enabled\": true },\n \"doc-weaver\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\", \"enabled\": true },\n \"react-auth\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\", \"enabled\": true },\n \"react-openapi\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\", \"enabled\": true }\n }\n }\n ```\n\nOr add them with the CLI:\n`opencode mcp add standards --url http://localhost:8009/mcp --global`.\n\n---\n\n## ๐Ÿค– PyCharm (Junie / AI Assistant)\n\n`~/.junie/mcp/mcp.json` (user scope) or `.junie/mcp/mcp.json` (project scope).\nThe same config is reachable from **Settings | Tools | MCP Server โ†’ Manual\nClient Configuration โ†’ Copy HTTP Stream Config**.\n\n=== \"localhost\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"url\": \"http://localhost:8009/mcp\" },\n \"doc-forge\": { \"url\": \"http://localhost:8001/mcp\" },\n \"mail-intake\": { \"url\": \"http://localhost:8002/mcp\" },\n \"omniread\": { \"url\": \"http://localhost:8003/mcp\" },\n \"openapi-first\": { \"url\": \"http://localhost:8004/mcp\" },\n \"py-jwt\": { \"url\": \"http://localhost:8005/mcp\" },\n \"dagpipe\": { \"url\": \"http://localhost:8006/mcp\" },\n \"mongo-ops\": { \"url\": \"http://localhost:8007/mcp\" },\n \"hexa\": { \"url\": \"http://localhost:8008/mcp\" },\n \"doc-weaver\": { \"url\": \"http://localhost:8010/mcp\" },\n \"react-auth\": { \"url\": \"http://localhost:8011/mcp\" },\n \"react-openapi\": { \"url\": \"http://localhost:8012/mcp\" }\n }\n }\n ```\n\n=== \"mcp.aetoskia.com\"\n\n ```json\n {\n \"mcpServers\": {\n \"standards\": { \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n \"doc-forge\": { \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n \"mail-intake\": { \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n \"omniread\": { \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n \"openapi-first\": { \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n \"py-jwt\": { \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n \"dagpipe\": { \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n \"mongo-ops\": { \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n \"hexa\": { \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n \"doc-weaver\": { \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n \"react-auth\": { \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n \"react-openapi\": { \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n }\n }\n ```\n\n---\n\n## โœ… Verify\n\n- Health check: `curl http://localhost:8000/healthz` โ†’ `ok`.\n- Claude Code: `claude mcp list` โ†’ each server โ€ฆ `โœ“ Connected`.\n- Codex: `codex mcp list` โ†’ each server โ€ฆ `http`.\n- OpenCode: `opencode mcp list` โ†’ each server โ€ฆ `connected`.\n- In-session: run `/mcp` to list the connected servers and their tools.\n\n---\n\n## ๐Ÿ“š Reference\n\n- [Library Registry](../lib/93_library_registry/) โ€” the catalog each server\n mirrors, and where `find_library` resolves\n- [Start an App](03_start_an_app.md) โ€” connect `standards`, then invoke\n `start_app`\n- [App Components](02_components.md) โ€” the component model\n\n---\n\n## Related\n\n- [Start an App](03_start_an_app.md) ยท [Testing & Quality](04_development/01_testing.md) ยท [Library Registry](../lib/93_library_registry/)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/wiki_overview.json b/standards/mcp/modules/wiki_overview.json index cb6b610..86d3456 100644 --- a/standards/mcp/modules/wiki_overview.json +++ b/standards/mcp/modules/wiki_overview.json @@ -2,7 +2,7 @@ "module": "wiki_overview", "content": { "path": "wiki_overview", - "docstring": "# Overview\n\nThe blueprint is a **hexagonal (ports & adapters) application** with a\n**spec-first** web edge and a **single composition root**. It favors explicit\nwiring over implicit magic and existing internal libraries over hand-written\ninfrastructure. Start here to build the mental model; the enforceable details\nlive in the reference pages.\n\n---\n\n## ๐Ÿ—๏ธ Architecture\n\n```mermaid\nflowchart LR\n subgraph EDGE[\"interfaces/ โ€” HTTP edge\"]\n OAS[\"openapi.yaml
    operationId contract\"]\n RT[\"/routes.py
    thin handlers\"]\n end\n\n subgraph CORE[\"domain/ โ€” business core\"]\n MD[\"models\"]\n PT[\"ports (adapter binding seam)\"]\n SV[\"services\"]\n end\n\n subgraph INFRA[\"infra/ โ€” adapters\"]\n RP[\"mongo repos (mongo-ops)\"]\n AD[\"cache ยท stores ยท llm ยท mail\"]\n DB[(\"MongoDB\")]\n end\n\n CR[\"init.py
    composition root\"]\n\n OAS --> RT\n RT --> SV\n SV --> PT\n SV --> RP\n PT -. depends on .- RP\n CR --- RT\n CR --- SV\n CR --- RP\n RP --> DB\n AD --- CR\n```\n\nThe rule holds at every edge: code in an outer ring may depend on a ring closer\nto the core, never the reverse. `domain/` never imports a web framework;\nonly its `ports/` seam reaches into `infra/` to bind adapters.\n\n> **Legend** โ€” solid arrows are compile-time calls; dotted arrows are the\n> port/adapter binding, performed by the composition root at startup.\n\n---\n\n## ๐Ÿ”„ The one-way dependency rule\n\n| Ring | May import | Never imports |\n|-------------|------------------------------------|----------------------------------|\n| `interfaces/` | `domain`, framework glue (glue only) | business logic, `infra` directly |\n| `domain/` | its own models + its `ports/` seam (which binds `infra`/libraries) | web frameworks, `interfaces/` |\n| `infra/` | `domain` ports, drivers, libraries | โ€” |\n| `init.py` | everything (the wiring point) | โ€” |\n\n---\n\n## ๐Ÿงญ Core principles\n\n1. **One-way dependencies.** `interfaces -> domain -> infra` is allowed; the\n reverse is forbidden.\n2. **Ports in the domain, adapters in infra.** A service depends on a port; the\n port's factory binds the concrete adapter, and the composition root calls\n those factories.\n3. **One composition root.** Nothing constructs its own dependencies. All\n wiring lives in one module (`init.py`) exposed as a flat resource registry.\n4. **Spec-first.** The HTTP contract is declared in `openapi.yaml`; route\n handlers are looked up by `operationId`. There are no decorator routers.\n5. **Reuse the libraries.** Orchestration, DI, Mongo repositories, ingestion,\n auth, and docs come from internal libraries โ€” see the [Library\n Registry](../lib/13_library_registry/).\n6. **Explicit state machines.** Long-running work moves through explicit,\n durable statuses and can pause for human input.\n\n---\n\n## โš™๏ธ Runtime processes\n\nA standard app may run as up to three processes that share the same composition\nroot:\n\n| Process | Entry point | Responsibility |\n|---------|------------------------|-------------------------------------------|\n| API | `main.py` | serve HTTP; start/stop resources via lifespan |\n| Worker | `worker.py` | poll durable jobs, run pipelines, publish progress |\n| Scripts | `python -m scripts.` | one-shot operator tasks |\n\n---\n\n## โžก๏ธ Read Next\n\n- [02 โ€“ App Components](02_components.md) ยท [03 โ€“ Start an App](03_start_an_app.md)\n", + "docstring": "# Overview\n\nThe blueprint is a **hexagonal (ports & adapters) application** with a\n**spec-first** web edge and a **single composition root**. It favors explicit\nwiring over implicit magic and existing internal libraries over hand-written\ninfrastructure. Start here to build the mental model; the enforceable details\nlive in the reference pages.\n\n---\n\n## ๐Ÿ—๏ธ Architecture\n\n```mermaid\nflowchart LR\n subgraph EDGE[\"interfaces/ โ€” HTTP edge\"]\n OAS[\"openapi.yaml
    operationId contract\"]\n RT[\"/routes.py
    thin handlers\"]\n end\n\n subgraph CORE[\"domain/ โ€” business core\"]\n MD[\"models\"]\n PT[\"ports (adapter binding seam)\"]\n SV[\"services\"]\n end\n\n subgraph INFRA[\"infra/ โ€” adapters\"]\n RP[\"mongo repos (mongo-ops)\"]\n AD[\"cache ยท stores ยท llm ยท mail\"]\n DB[(\"MongoDB\")]\n end\n\n CR[\"init.py
    composition root\"]\n\n OAS --> RT\n RT --> SV\n SV --> PT\n SV --> RP\n PT -. depends on .- RP\n CR --- RT\n CR --- SV\n CR --- RP\n RP --> DB\n AD --- CR\n```\n\nThe rule holds at every edge: code in an outer ring may depend on a ring closer\nto the core, never the reverse. `domain/` never imports a web framework;\nonly its `ports/` seam reaches into `infra/` to bind adapters.\n\n> **Legend** โ€” solid arrows are compile-time calls; dotted arrows are the\n> port/adapter binding, performed by the composition root at startup.\n\n---\n\n## ๐Ÿ”„ The one-way dependency rule\n\n| Ring | May import | Never imports |\n|-------------|------------------------------------|----------------------------------|\n| `interfaces/` | `domain`, framework glue (glue only) | business logic, `infra` directly |\n| `domain/` | its own models + its `ports/` seam (which binds `infra`/libraries) | web frameworks, `interfaces/` |\n| `infra/` | `domain` ports, drivers, libraries | โ€” |\n| `init.py` | everything (the wiring point) | โ€” |\n\n---\n\n## ๐Ÿงญ Core principles\n\n1. **One-way dependencies.** `interfaces -> domain -> infra` is allowed; the\n reverse is forbidden.\n2. **Ports in the domain, adapters in infra.** A service depends on a port; the\n port's factory binds the concrete adapter, and the composition root calls\n those factories.\n3. **One composition root.** Nothing constructs its own dependencies. All\n wiring lives in one module (`init.py`) exposed as a flat resource registry.\n4. **Spec-first.** The HTTP contract is declared in `openapi.yaml`; route\n handlers are looked up by `operationId`. There are no decorator routers.\n5. **Reuse the libraries.** Orchestration, DI, Mongo repositories, ingestion,\n auth, and docs come from internal libraries โ€” see the [Library\n Registry](../lib/93_library_registry/).\n6. **Explicit state machines.** Long-running work moves through explicit,\n durable statuses and can pause for human input.\n\n---\n\n## โš™๏ธ Runtime processes\n\nA standard app may run as up to three processes that share the same composition\nroot:\n\n| Process | Entry point | Responsibility |\n|---------|------------------------|-------------------------------------------|\n| API | `main.py` | serve HTTP; start/stop resources via lifespan |\n| Worker | `worker.py` | poll durable jobs, run pipelines, publish progress |\n| Scripts | `python -m scripts.` | one-shot operator tasks |\n\n---\n\n## โžก๏ธ Read Next\n\n- [02 โ€“ App Components](02_components.md) ยท [03 โ€“ Start an App](03_start_an_app.md)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/modules/wiki_start_an_app.json b/standards/mcp/modules/wiki_start_an_app.json index 4d3b5e3..9cd3151 100644 --- a/standards/mcp/modules/wiki_start_an_app.json +++ b/standards/mcp/modules/wiki_start_an_app.json @@ -2,7 +2,7 @@ "module": "wiki_start_an_app", "content": { "path": "wiki_start_an_app", - "docstring": "# ๐Ÿš€ Start an App\n\nThis is the entry point for building a new application from the blueprint. The\ngoal is one deterministic pass: you supply only the **two axes**, and the agent\ndoes the rest by reading the `standards` MCP, importing Tier A libraries, and\ncopying Tier B template components.\n\n> **Doc model:** this page is the human entry point. The deterministic,\n> machine-facing checklist lives in the reference page\n> [Build Recipe](../lib/01_build_recipe/), served as `docs://modules/build_recipe`.\n\n---\n\n## ๐Ÿงพ What the agent needs from you\n\nGather these before starting โ€” the `start_app` MCP prompt asks for them:\n\n1. **App name + one-line purpose.**\n2. **Axis 1 โ€” resources.** Each resource, its fields, and relationships. Paste\n `openapi.yaml` if you already have it.\n3. **Axis 2 โ€” pipelines.** Only if an input needs a multi-step transformation:\n the families and their input formats (or \"none\").\n4. **Auth needed now?** Default **no**. Auth is deferred (`py-jwt` primitives\n only), and an authless app is just a spec with no `security` keys โ€” see\n [Spec-First Routing โ†’ Authless apps](../lib/04_spec_first_routing/#authless-apps).\n5. **Integrations.** Mongo, ingestion formats, email, LLM provider.\n\nIf you can state axes 1 and 2, the rest is mechanical.\n\n---\n\n## โ–ถ๏ธ How to start\n\nFrom an MCP client connected to the `standards` server:\n\n1. Invoke the **`intake`** prompt (or `start_app` with no arguments) to get the\n intake questions.\n2. Answer them, then invoke **`build`**\n (`build(app_name=..., resources=..., pipelines=..., auth=...)`), or use\n **`start_app`** to intake-and-build in one call.\n3. The prompt hands off to `docs://modules/build_recipe`; the agent scaffolds\n with `get_app_template()` and pulls exact files with\n `get_app_component(kind, resource=..., family=...)`, authoring only the\n app-specific parts.\n4. To validate the standard without touching a real app, invoke **`trial`**\n (`trial(app_name=..., build_path=...)`) to build into a scratch directory,\n prove it builds, and report findings.\n\nManual alternative โ€” copy the skeleton and follow the reference recipe:\n\n```bash\ncp -r /standards/src/templates/app apps/\n```\n\n---\n\n## ๐Ÿ“š Reference\n\n- [Build Recipe](../lib/01_build_recipe/) โ€” the deterministic checklist\n- [Genericity Matrix](../lib/12_genericity_matrix/) โ€” Tier A / B / C\n- [Library Registry](../lib/13_library_registry/) โ€” the Tier A catalog\n- [App Components](02_components.md) โ€” the component model\n\n---\n\n## Related\n\n- [01 โ€“ Overview](01_overview.md) ยท [02 โ€“ App Components](02_components.md) ยท [04 โ€“ Testing & Quality](04_development/01_testing.md)\n", + "docstring": "# ๐Ÿš€ Start an App\n\nThis is the entry point for building a new application from the blueprint. The\ngoal is one deterministic pass: you supply only the **two axes**, and the agent\ndoes the rest by reading the `standards` MCP, importing Tier A libraries, and\ncopying Tier B template components.\n\n> **Doc model:** this page is the human entry point. The deterministic,\n> machine-facing checklist lives in the reference page\n> [Build Recipe](../lib/01_build_recipe/), served as `docs://modules/build_recipe`.\n\n---\n\n## ๐Ÿงพ What the agent needs from you\n\nGather these before starting โ€” the `start_app` MCP prompt asks for them:\n\n1. **App name + one-line purpose.**\n2. **Axis 1 โ€” resources.** Each resource, its fields, and relationships. Paste\n `openapi.yaml` if you already have it.\n3. **Axis 2 โ€” pipelines.** Only if an input needs a multi-step transformation:\n the families and their input formats (or \"none\").\n4. **Auth needed now?** Default **no**. Auth is deferred (`py-jwt` primitives\n only), and an authless app is just a spec with no `security` keys โ€” see\n [Spec-First Routing โ†’ Authless apps](../lib/20_spec_first_routing/#authless-apps).\n5. **Integrations.** Mongo, ingestion formats, email, LLM provider.\n\nIf you can state axes 1 and 2, the rest is mechanical.\n\n---\n\n## โ–ถ๏ธ How to start\n\nFrom an MCP client connected to the `standards` server:\n\n1. Invoke the **`intake`** prompt (or `start_app` with no arguments) to get the\n intake questions.\n2. Answer them, then invoke **`build`**\n (`build(app_name=..., resources=..., pipelines=..., auth=...)`), or use\n **`start_app`** to intake-and-build in one call.\n3. The prompt hands off to `docs://modules/build_recipe`; the agent scaffolds\n with `get_app_template()` and pulls exact files with\n `get_app_component(kind, resource=..., family=...)`, authoring only the\n app-specific parts.\n4. To validate the standard without touching a real app, invoke **`trial`**\n (`trial(app_name=..., build_path=...)`) to build into a scratch directory,\n prove it builds, and report findings.\n\nManual alternative โ€” copy the skeleton and follow the reference recipe:\n\n```bash\ncp -r /standards/src/templates/app apps/\n```\n\n---\n\n## ๐Ÿ“š Reference\n\n- [Build Recipe](../lib/01_build_recipe/) โ€” the deterministic checklist\n- [Genericity Matrix](../lib/92_genericity_matrix/) โ€” Tier A / B / C\n- [Library Registry](../lib/93_library_registry/) โ€” the Tier A catalog\n- [App Components](02_components.md) โ€” the component model\n\n---\n\n## Related\n\n- [01 โ€“ Overview](01_overview.md) ยท [02 โ€“ App Components](02_components.md) ยท [04 โ€“ Testing & Quality](04_development/01_testing.md)\n", "objects": {} } } \ No newline at end of file diff --git a/standards/mcp/nav.json b/standards/mcp/nav.json index f5656db..9af782e 100644 --- a/standards/mcp/nav.json +++ b/standards/mcp/nav.json @@ -4,16 +4,16 @@ "resource": "docs://modules/build_recipe", "title": "Build Recipe" }, - { - "module": "layering_rules", - "resource": "docs://modules/layering_rules", - "title": "Layering Rules" - }, { "module": "composition_root", "resource": "docs://modules/composition_root", "title": "Composition Root" }, + { + "module": "layering_rules", + "resource": "docs://modules/layering_rules", + "title": "Layering Rules" + }, { "module": "spec_first_routing", "resource": "docs://modules/spec_first_routing", @@ -24,6 +24,21 @@ "resource": "docs://modules/crud_template", "title": "CRUD Template" }, + { + "module": "auth_integration", + "resource": "docs://modules/auth_integration", + "title": "Auth Integration" + }, + { + "module": "infra_adaptors", + "resource": "docs://modules/infra_adaptors", + "title": "Infra Adapters" + }, + { + "module": "ui_admin", + "resource": "docs://modules/ui_admin", + "title": "UI: Auto-Rendered Admin & Custom Pages" + }, { "module": "pipeline_scaffold", "resource": "docs://modules/pipeline_scaffold", @@ -39,11 +54,6 @@ "resource": "docs://modules/human_in_loop", "title": "Human-in-the-Loop" }, - { - "module": "infra_adaptors", - "resource": "docs://modules/infra_adaptors", - "title": "Infra Adapters" - }, { "module": "drone_pipelines", "resource": "docs://modules/drone_pipelines", @@ -64,11 +74,6 @@ "resource": "docs://modules/library_registry", "title": "Library Registry" }, - { - "module": "auth_integration", - "resource": "docs://modules/auth_integration", - "title": "Auth Integration" - }, { "module": "repository_inventory", "resource": "docs://modules/repository_inventory", diff --git a/standards/mcp/templates/app/.env.example b/standards/mcp/templates/app/.env.example index a4f8c32..4f8cccb 100644 --- a/standards/mcp/templates/app/.env.example +++ b/standards/mcp/templates/app/.env.example @@ -1,7 +1,9 @@ DEBUG=false +REPO_BACKEND=memory MONGO_URI=mongodb://localhost:27017 MONGO_DB=app_template +PORT=8000 WORKER_POLL_SECONDS=30 WORKER_MAX_RETRIES=3 AUTH_SERVER=http://localhost:8000 -JWT_SERVER=http://localhost:8000 \ No newline at end of file +JWT_SERVER=http://localhost:8000 diff --git a/standards/mcp/templates/app/config.py b/standards/mcp/templates/app/config.py index a163e38..9cab0b2 100644 --- a/standards/mcp/templates/app/config.py +++ b/standards/mcp/templates/app/config.py @@ -3,6 +3,23 @@ App configuration loaded from environment โ€” a Settings dataclass with defaults plus a singleton settings instance populated from OS environment variables at import time. + +--- + +The template reads these knobs: + +- ``repo_backend`` โ€” ``memory`` (default, zero-dependency process-local store) + or ``mongo`` (persistent, via the shared mongo-ops connection manager). +- ``mongo_uri`` / ``mongo_db`` โ€” connection targets when the Mongo backend is + selected. +- ``port`` โ€” the port uvicorn binds (keep in sync with the OpenAPI + ``servers:`` entry and the client's ``VITE_API_BASE_URL``). +- ``worker_poll_seconds`` / ``worker_max_retries`` โ€” background worker cadence. + +``AUTH_SERVER`` is intentionally *not* re-exported here: ``openapi_first`` +resolves ``{AUTH_SERVER}`` straight from the process environment when the +application is built, so the env var remains the single source of truth for +the generated bearer-JWT introspection dependency. """ import os from dataclasses import dataclass @@ -14,23 +31,30 @@ class Settings: Attributes: debug (bool): Enable debug behavior. Defaults to False. + repo_backend (str): Persistence flavour, ``memory`` or ``mongo``. + Defaults to ``memory``. mongo_uri (str): MongoDB connection URI. Defaults to mongodb://localhost:27017. mongo_db (str): MongoDB database name. Defaults to app_template. + port (int): Local HTTP port. Defaults to 8000. worker_poll_seconds (int): Worker poll interval in seconds. Defaults to 30. worker_max_retries (int): Maximum job retries before skipping. Defaults to 3. """ debug: bool = False + repo_backend: str = "memory" mongo_uri: str = "mongodb://localhost:27017" mongo_db: str = "app_template" + port: int = 8000 worker_poll_seconds: int = 30 worker_max_retries: int = 3 settings = Settings( debug=os.environ.get("DEBUG", "").lower() in ("1", "true", "yes"), + repo_backend=os.environ.get("REPO_BACKEND", "memory").lower(), mongo_uri=os.environ.get("MONGO_URI", "mongodb://localhost:27017"), mongo_db=os.environ.get("MONGO_DB", "app_template"), + port=int(os.environ.get("PORT", "8000")), worker_poll_seconds=int(os.environ.get("WORKER_POLL_SECONDS", "30")), worker_max_retries=int(os.environ.get("WORKER_MAX_RETRIES", "3")), -) \ No newline at end of file +) diff --git a/standards/mcp/templates/app/domain/item/models.py b/standards/mcp/templates/app/domain/item/models.py index 63c3875..0a8cc54 100644 --- a/standards/mcp/templates/app/domain/item/models.py +++ b/standards/mcp/templates/app/domain/item/models.py @@ -9,11 +9,13 @@ class Item(BaseModel): """A single countable resource. Attributes: + id (int | None): Server-assigned identifier. Defaults to None. name (str): Item name. quantity (int): Item quantity. Defaults to 1. """ + id: int | None = None name: str quantity: int = Field(default=1) - model_config = {"extra": "ignore"} \ No newline at end of file + model_config = {"extra": "ignore"} diff --git a/standards/mcp/templates/app/domain/item/ports/db.py b/standards/mcp/templates/app/domain/item/ports/db.py index d8905d2..ce08f65 100644 --- a/standards/mcp/templates/app/domain/item/ports/db.py +++ b/standards/mcp/templates/app/domain/item/ports/db.py @@ -1,21 +1,25 @@ """# Summary -Mongo persistence for items: document schema and repository factory. +Items persistence ports โ€” integer-id document and repository factory. """ -from mongo_ops import BaseDocument, BaseRepository +from mongo_ops import BaseDocument +from pydantic import Field from domain.item.models import Item -from infra.db.repos.mongo import _repo_factory as mongo_repo_factory +from infra.db.repos import create_repo class ItemDocument(Item, BaseDocument): - """Mongo document form of :class:`Item`.""" + """Persisted item document. The integer ``id`` shadows the ObjectId.""" + + id: int | None = Field(default=None, validation_alias="_id") -def create_item_repo() -> BaseRepository: - """Create the Mongo-backed item repository. +def create_item_repo(): + """Create the item repository selected by ``settings.repo_backend``. Returns: - BaseRepository: Repository wired to the ``items`` collection. + IntIdMemoryRepository | IntIdMongoRepository: Repository wired to the + ``items`` collection/store. """ - return mongo_repo_factory("items", ItemDocument) \ No newline at end of file + return create_repo("items", ItemDocument) diff --git a/standards/mcp/templates/app/domain/job/models.py b/standards/mcp/templates/app/domain/job/models.py index 968d8c2..f90881b 100644 --- a/standards/mcp/templates/app/domain/job/models.py +++ b/standards/mcp/templates/app/domain/job/models.py @@ -11,6 +11,7 @@ class Job(BaseModel): """A unit of background work. Attributes: + id (int | None): Server-assigned identifier. Defaults to None. name (str): Job name. status (str): Lifecycle status. Defaults to "pending". retry_count (int): Times the job failed. Defaults to 0. @@ -18,10 +19,11 @@ class Job(BaseModel): payload (dict | None): Arbitrary job payload. Defaults to None. """ + id: int | None = None name: str status: Literal["pending", "processing", "done", "failed"] = "pending" retry_count: int = Field(default=0) error_message: str | None = None payload: dict | None = None - model_config = {"extra": "ignore"} \ No newline at end of file + model_config = {"extra": "ignore"} diff --git a/standards/mcp/templates/app/domain/job/ports/db.py b/standards/mcp/templates/app/domain/job/ports/db.py index c085eb3..f437b3c 100644 --- a/standards/mcp/templates/app/domain/job/ports/db.py +++ b/standards/mcp/templates/app/domain/job/ports/db.py @@ -1,21 +1,25 @@ """# Summary -Mongo persistence for jobs: document schema and repository factory. +Jobs persistence ports โ€” integer-id document and repository factory. """ -from mongo_ops import BaseDocument, BaseRepository +from mongo_ops import BaseDocument +from pydantic import Field from domain.job.models import Job -from infra.db.repos.mongo import _repo_factory as mongo_repo_factory +from infra.db.repos import create_repo class JobDocument(Job, BaseDocument): - """Mongo document form of :class:`Job`.""" + """Persisted job document. The integer ``id`` shadows the ObjectId.""" + + id: int | None = Field(default=None, validation_alias="_id") -def create_job_repo() -> BaseRepository: - """Create the Mongo-backed job repository. +def create_job_repo(): + """Create the job repository selected by ``settings.repo_backend``. Returns: - BaseRepository: Repository wired to the ``jobs`` collection. + IntIdMemoryRepository | IntIdMongoRepository: Repository wired to the + ``jobs`` collection/store. """ - return mongo_repo_factory("jobs", JobDocument) \ No newline at end of file + return create_repo("jobs", JobDocument) diff --git a/standards/mcp/templates/app/infra/db/repos/__init__.py b/standards/mcp/templates/app/infra/db/repos/__init__.py index e69de29..d2a94a5 100644 --- a/standards/mcp/templates/app/infra/db/repos/__init__.py +++ b/standards/mcp/templates/app/infra/db/repos/__init__.py @@ -0,0 +1,31 @@ +"""# Summary + +Repository factory โ€” picks the in-memory or Mongo integer-id adapter based +on ``settings.repo_backend``. + +--- + +Every domain slice calls :func:`create_repo` so the backend choice lives in +one place: ``REPO_BACKEND=memory`` (default) yields the zero-dependency +process-local store; ``REPO_BACKEND=mongo`` yields the persistent adapter. +""" +from typing import Any + +from config import settings +from infra.db.repos.memory import IntIdMemoryRepository +from infra.db.repos.mongo_int import IntIdMongoRepository + + +def create_repo(collection: str, document_cls: type[Any]): + """Create the integer-id repository selected by ``settings.repo_backend``. + + Args: + collection (str): Collection / store name for the resource. + document_cls (type[Any]): Document model bound to the repository. + + Returns: + IntIdMemoryRepository | IntIdMongoRepository: The configured repository. + """ + if settings.repo_backend == "mongo": + return IntIdMongoRepository(collection, document_cls) + return IntIdMemoryRepository(document_cls) diff --git a/standards/mcp/templates/app/infra/db/repos/memory.py b/standards/mcp/templates/app/infra/db/repos/memory.py new file mode 100644 index 0000000..1e55546 --- /dev/null +++ b/standards/mcp/templates/app/infra/db/repos/memory.py @@ -0,0 +1,161 @@ +"""# Summary + +In-memory integer-id repository โ€” the zero-dependency persistence adapter. + +--- + +One process-local dictionary per resource, keyed by auto-incrementing integer +``id``. The wire contract (``openapi.yaml``) declares integer primary keys, +so this adapter speaks integers end-to-end and is the default backend +(``REPO_BACKEND=memory``). + +The method surface mirrors the mongo-ops repository duck-type consumed by +``infra.adapters.service.CrudsServiceAdaptor``: ``create``, ``get_by_id``, +``get_many``, ``update``, ``patch``, ``delete``. + +Notes: + Not thread-safe and not durable โ€” deliberately. Swap to the Mongo + adapter via ``REPO_BACKEND=mongo`` without touching domain code. +""" +from typing import Any + +from pydantic import BaseModel + + +class IntIdMemoryRepository: + """Dictionary-backed repository with auto-increment integer ids. + + Attributes: + document_cls (type[BaseModel]): Document model instantiated for + every stored record. + """ + + def __init__(self, document_cls: type[BaseModel]): + """Initialize an empty store for ``document_cls``. + + Args: + document_cls (type[BaseModel]): Document model bound to this repo. + """ + self.document_cls = document_cls + self._docs: dict[int, BaseModel] = {} + self._seq = 0 + + def _to_doc(self, data: Any) -> BaseModel: + """Coerce ``data`` into a document instance. + + Args: + data (Any): Document instance or field mapping. + + Returns: + BaseModel: Document built from ``data``. + """ + if isinstance(data, self.document_cls): + return data + return self.document_cls(**dict(data)) + + async def create(self, data: Any) -> BaseModel: + """Persist a new document with a freshly allocated integer id. + + Args: + data (Any): Document instance or field mapping (id ignored). + + Returns: + BaseModel: The stored document with ``id`` assigned. + """ + doc = self._to_doc(data) + self._seq += 1 + doc.id = self._seq + self._docs[doc.id] = doc + return doc + + async def get_by_id(self, id: int) -> BaseModel | None: + """Fetch one document by integer id. + + Args: + id (int): Document identifier. + + Returns: + BaseModel | None: The stored document, or ``None`` when absent. + """ + return self._docs.get(int(id)) + + async def get_many(self, filter: dict | None = None, **_: Any) -> list[BaseModel]: + """List documents, optionally filtered by top-level equality. + + Args: + filter (dict | None): Equality filter on document fields. + + Returns: + list[BaseModel]: Matching documents in insertion order. + """ + docs = list(self._docs.values()) + if filter: + docs = [d for d in docs if all(getattr(d, k, None) == v for k, v in filter.items())] + return docs + + async def update(self, id: int, data: Any) -> BaseModel | None: + """Replace a document by integer id. + + Args: + id (int): Document identifier. + data (Any): Replacement document or field mapping. + + Returns: + BaseModel | None: The stored document, or ``None`` when absent. + """ + if int(id) not in self._docs: + return None + doc = self._to_doc(data) + doc.id = int(id) + self._docs[doc.id] = doc + return doc + + async def patch(self, id: int, data: dict) -> BaseModel | None: + """Partially update a document by integer id. + + Args: + id (int): Document identifier. + data (dict): Fields to merge into the stored document. + + Returns: + BaseModel | None: The stored document, or ``None`` when absent. + """ + current = self._docs.get(int(id)) + if current is None: + return None + merged = current.model_dump() + merged.update(data) + doc = self.document_cls(**merged) + doc.id = int(id) + self._docs[doc.id] = doc + return doc + + async def delete(self, id: int) -> bool: + """Delete a document by integer id. + + Args: + id (int): Document identifier. + + Returns: + bool: ``True`` when a document was removed. + """ + return self._docs.pop(int(id), None) is not None + + async def delete_many(self, filter: dict | None = None) -> int: + """Delete every document (optionally filtered by equality). + + Args: + filter (dict | None): Equality filter on document fields. + + Returns: + int: Number of documents removed. + """ + victims = await self.get_many(filter) + for doc in victims: + self._docs.pop(doc.id, None) + return len(victims) + + def clear(self) -> None: + """Remove every document and reset the id counter.""" + self._docs.clear() + self._seq = 0 diff --git a/standards/mcp/templates/app/infra/db/repos/mongo_int.py b/standards/mcp/templates/app/infra/db/repos/mongo_int.py new file mode 100644 index 0000000..b2d13b6 --- /dev/null +++ b/standards/mcp/templates/app/infra/db/repos/mongo_int.py @@ -0,0 +1,184 @@ +"""# Summary + +MongoDB integer-id repository โ€” the persistent persistence adapter. + +--- + +The wire contract declares integer primary keys, while mongo-ops' +``BaseRepository`` allocates ``ObjectId`` keys. This adapter therefore talks +to the shared ``MongoConnectionManager`` database directly (the Tier A +connection lifecycle is reused; only the id strategy differs) and stores +records with auto-incrementing integer ``_id`` values allocated from a +``_counters`` collection. + +The method surface mirrors the in-memory adapter exactly, so +``CrudsServiceAdaptor`` and the domain services are backend-agnostic. +""" +from typing import Any + +from mongo_ops import MongoConnectionManager +from pydantic import BaseModel + + +class IntIdMongoRepository: + """Motor-backed repository with auto-increment integer ids. + + Attributes: + collection (str): MongoDB collection name. + document_cls (type[BaseModel]): Document model bound to this repo. + """ + + def __init__(self, collection: str, document_cls: type[BaseModel]): + """Bind the repository to a collection and document model. + + Args: + collection (str): Collection name to operate on. + document_cls (type[BaseModel]): Document model persisted here. + """ + self.collection = collection + self.document_cls = document_cls + + @property + def _col(self): + """AsyncIOMotorCollection: The live collection handle.""" + return MongoConnectionManager._database[self.collection] + + async def _next_id(self) -> int: + """Allocate the next integer id from the shared counters collection. + + Returns: + int: A monotonically increasing identifier. + """ + counters = MongoConnectionManager._database["_counters"] + doc = await counters.find_one_and_update( + {"_id": self.collection}, + {"$inc": {"seq": 1}}, + upsert=True, + return_document=True, + ) + return int(doc["seq"]) + + def _to_doc(self, data: Any) -> BaseModel: + """Coerce ``data`` into a document instance. + + Args: + data (Any): Document instance or field mapping. + + Returns: + BaseModel: Document built from ``data``. + """ + if isinstance(data, self.document_cls): + return data + return self.document_cls(**dict(data)) + + def _to_payload(self, doc: BaseModel, id: int | None = None) -> dict: + """Serialize a document into a Mongo-ready payload. + + Args: + doc (BaseModel): Document to serialize. + id (int | None): Explicit ``_id``; taken from the doc when omitted. + + Returns: + dict: Mapping with an integer ``_id`` key. + """ + payload = doc.model_dump() + payload.pop("id", None) + payload["_id"] = id if id is not None else doc.id + return payload + + async def create(self, data: Any) -> BaseModel: + """Persist a new document with a freshly allocated integer id. + + Args: + data (Any): Document instance or field mapping (id ignored). + + Returns: + BaseModel: The stored document with ``id`` assigned. + """ + doc = self._to_doc(data) + new_id = await self._next_id() + await self._col.insert_one(self._to_payload(doc, new_id)) + doc.id = new_id + return doc + + async def get_by_id(self, id: int) -> BaseModel | None: + """Fetch one document by integer id. + + Args: + id (int): Document identifier. + + Returns: + BaseModel | None: The stored document, or ``None`` when absent. + """ + raw = await self._col.find_one({"_id": int(id)}) + return self.document_cls.model_validate(raw) if raw else None + + async def get_many(self, filter: dict | None = None, **_: Any) -> list[BaseModel]: + """List documents, optionally filtered by top-level equality. + + Args: + filter (dict | None): Equality filter on document fields. + + Returns: + list[BaseModel]: Matching documents in insertion order. + """ + cursor = self._col.find(filter or {}) + return [self.document_cls.model_validate(raw) async for raw in cursor] + + async def update(self, id: int, data: Any) -> BaseModel | None: + """Replace a document by integer id. + + Args: + id (int): Document identifier. + data (Any): Replacement document or field mapping. + + Returns: + BaseModel | None: The stored document, or ``None`` when absent. + """ + doc = self._to_doc(data) + payload = self._to_payload(doc, int(id)) + result = await self._col.replace_one({"_id": int(id)}, payload) + if result.matched_count == 0: + return None + doc.id = int(id) + return doc + + async def patch(self, id: int, data: dict) -> BaseModel | None: + """Partially update a document by integer id. + + Args: + id (int): Document identifier. + data (dict): Fields to merge into the stored document. + + Returns: + BaseModel | None: The stored document, or ``None`` when absent. + """ + updates = {k: v for k, v in data.items() if k != "id"} + result = await self._col.update_one({"_id": int(id)}, {"$set": updates}) + if result.matched_count == 0: + return None + return await self.get_by_id(id) + + async def delete(self, id: int) -> bool: + """Delete a document by integer id. + + Args: + id (int): Document identifier. + + Returns: + bool: ``True`` when a document was removed. + """ + result = await self._col.delete_one({"_id": int(id)}) + return result.deleted_count > 0 + + async def delete_many(self, filter: dict | None = None) -> int: + """Delete every document (optionally filtered by equality). + + Args: + filter (dict | None): Equality filter on document fields. + + Returns: + int: Number of documents removed. + """ + result = await self._col.delete_many(filter or {}) + return result.deleted_count diff --git a/standards/mcp/templates/app/init.py b/standards/mcp/templates/app/init.py index 46b1a7f..83f3c74 100644 --- a/standards/mcp/templates/app/init.py +++ b/standards/mcp/templates/app/init.py @@ -1,8 +1,15 @@ """# Summary -Infrastructure initialization โ€” connects MongoDB and wires all repos and services. -Shared bootstrap for both the FastAPI app and the worker, guarded against -repeated initialization via a module-level flag. +Composition root โ€” connects MongoDB (when selected), wires all repos and +services, and returns the resources dict. Shared bootstrap for the FastAPI +app, the worker and the seed/drop scripts, guarded against repeated +initialization via a module-level flag. + +--- + +The ``memory`` backend skips the Mongo connection entirely โ€” repos are +process-local dictionaries, so a plain ``uvicorn main:app`` runs with zero +external services. """ from typing import Any @@ -18,18 +25,21 @@ _initialized: bool = False async def init() -> dict[str, Any]: - """Connect MongoDB, wire all repos and services, and return the resources dict. + """Wire all repos and services, and return the resources dict. Idempotent: repeated calls short-circuit and return the cached resources. + Only the ``mongo`` backend performs a network connection here. Returns: - Dict[str, Any]: Named services keyed by resource name. + Dict[str, Any]: Named services keyed by resource name + (``_svc`` and ``_repo``). """ global _resources, _initialized if _initialized: return _resources - await setup_database(uri=settings.mongo_uri, db_name=settings.mongo_db) + if settings.repo_backend == "mongo": + await setup_database(uri=settings.mongo_uri, db_name=settings.mongo_db) item_repo = create_item_repo() job_repo = create_job_repo() @@ -44,8 +54,9 @@ async def init() -> dict[str, Any]: async def shutdown() -> None: - """Disconnect MongoDB and reset the resources cache.""" + """Disconnect MongoDB (if connected) and reset the resources cache.""" global _initialized - await shutdown_database() + if settings.repo_backend == "mongo": + await shutdown_database() _resources.clear() - _initialized = False \ No newline at end of file + _initialized = False diff --git a/standards/mcp/templates/app/interfaces/_common.py b/standards/mcp/templates/app/interfaces/_common.py new file mode 100644 index 0000000..428cacc --- /dev/null +++ b/standards/mcp/templates/app/interfaces/_common.py @@ -0,0 +1,146 @@ +"""# Summary + +Shared interface helpers โ€” service resolution, serialization, pagination and +foreign-key expansion used by every route module. + +--- + +FK fields on the wire may arrive either as a bare integer id (from an +``x-fk`` picker) or as an already-expanded object. The wire contract always +*returns* fully expanded objects, so create/update handlers normalize the +input through :func:`expand_ref` before persisting. +""" +from fastapi import HTTPException, Request + + +def svc(request: Request, name: str): + """Resolve a CRUD service from app state by resource name. + + Args: + request (Request): Incoming request whose app.state carries resources. + name (str): Resource key suffix, e.g. ``"parent"`` โ†’ ``parent_svc``. + + Returns: + Any: The named CRUD service. + """ + return request.app.state.db_resources[f"{name}_svc"] + + +def dump(doc) -> dict: + """Serialize a document to a JSON-ready mapping with an integer id. + + Args: + doc (Any): Pydantic document to serialize. + + Returns: + dict: JSON-mode mapping (``by_alias`` so ``_id`` maps back to ``id``). + """ + return doc.model_dump(mode="json", by_alias=True) + + +def paginate(items: list, limit: int, offset: int) -> dict: + """Slice ``items`` into the ``{total, items}`` pagination envelope. + + A ``limit`` of 0 means "all remaining items" (used by react-openapi for + FK option lists and counts). + + Args: + items (list): Full result list. + limit (int): Page size; ``0`` returns everything after ``offset``. + offset (int): Number of items to skip. + + Returns: + dict: ``{"total": int, "items": list}``. + """ + offset = max(offset, 0) + page = items[offset:] if limit == 0 else items[offset : offset + limit] + return {"total": len(items), "items": page} + + +async def expand_ref(svc_obj, value, label: str) -> dict | None: + """Normalize a foreign-key reference into a fully expanded object. + + Args: + svc_obj (Any): Target resource CRUD service used for lookups. + value (dict | int | None): Bare id, ``{"id": N}`` stub, or full object. + label (str): Human label used in 422 error messages. + + Returns: + dict | None: Expanded object, or ``None`` when ``value`` is ``None``. + + Raises: + HTTPException: 422 when the reference cannot be resolved to a document. + """ + if value is None: + return None + if isinstance(value, dict): + if set(value.keys()) == {"id"}: + value = value["id"] + else: + return value + if isinstance(value, int): + doc = await svc_obj.read(value) + if doc is None: + raise HTTPException(status_code=422, detail=f"{label} {value} not found") + return dump(doc) + raise HTTPException(status_code=422, detail=f"invalid {label} reference") + + +async def expand_ref_list(svc_obj, value, label: str) -> list[dict]: + """Normalize a list foreign-key reference into expanded objects. + + Args: + svc_obj (Any): Target resource CRUD service used for lookups. + value (list | None): List of bare ids, stubs, or full objects. + label (str): Human label used in 422 error messages. + + Returns: + list[dict]: Expanded objects. + + Raises: + HTTPException: 422 when any reference cannot be resolved. + """ + if value is None: + return [] + if not isinstance(value, list): + raise HTTPException(status_code=422, detail=f"invalid {label} list") + results = [] + for entry in value: + results.append(await expand_ref(svc_obj, entry, label)) + return results + + +async def read_or_404(svc_obj, id: int, label: str): + """Read a document by id or raise a 404 HTTPException. + + Args: + svc_obj (Any): CRUD service to read from. + id (int): Document identifier. + label (str): Human label used in the 404 detail message. + + Returns: + Any: The found document. + + Raises: + HTTPException: 404 when no document matches ``id``. + """ + doc = await svc_obj.read(id) + if doc is None: + raise HTTPException(status_code=404, detail=f"{label} not found") + return doc + + +async def delete_or_404(svc_obj, id: int, label: str) -> None: + """Delete a document by id or raise a 404 HTTPException. + + Args: + svc_obj (Any): CRUD service to delete from. + id (int): Document identifier. + label (str): Human label used in the 404 detail message. + + Raises: + HTTPException: 404 when no document matches ``id``. + """ + ok = await svc_obj.delete(id) + if not ok: + raise HTTPException(status_code=404, detail=f"{label} not found") diff --git a/standards/mcp/templates/app/interfaces/item/routes.py b/standards/mcp/templates/app/interfaces/item/routes.py index 995f782..ae067aa 100644 --- a/standards/mcp/templates/app/interfaces/item/routes.py +++ b/standards/mcp/templates/app/interfaces/item/routes.py @@ -2,41 +2,89 @@ Item route handlers โ€” names must match openapi.yaml operationIds. """ -from fastapi import Request -from fastapi.responses import JSONResponse +from fastapi import Request, Response -from domain.item.models import Item +from interfaces._common import delete_or_404, dump, paginate, read_or_404, svc -def svc(request: Request): - """Resolve the item CRUD service from app state.""" - return request.app.state.db_resources["item_svc"] +async def list_items(request: Request, limit: int = 20, offset: int = 0) -> dict: + """List items (paginated). ``limit=0`` returns all remaining items. + + Args: + request (Request): Incoming request. + limit (int): Page size. Defaults to 20. + offset (int): Items to skip. Defaults to 0. + + Returns: + dict: ``{"total": int, "items": list[Item]}``. + """ + docs = await svc(request, "item").search({}) + return paginate([dump(d) for d in docs], limit, offset) -async def create_item(request: Request, body: dict): - """Create an item from the request body.""" - data = body.model_dump() if hasattr(body, "model_dump") else dict(body) - doc = await svc(request).create(Item(**data)) - return JSONResponse(status_code=201, content=doc.model_dump(mode="json", by_alias=True)) +async def create_item(request: Request, body: dict, response: Response) -> dict: + """Create an item. + + Args: + request (Request): Incoming request. + body (dict): Item fields (``id`` ignored). + response (Response): Response object; set to 201 on success. + + Returns: + dict: The created item. + """ + response.status_code = 201 + body.pop("id", None) + doc = await svc(request, "item").create(body) + return dump(doc) -async def get_item(request: Request, id: str): - """Fetch one item by id.""" - doc = await svc(request).read(id) - if doc is None: - return JSONResponse(status_code=404, content={"detail": "item not found"}) - return doc.model_dump(mode="json", by_alias=True) +async def get_item(request: Request, id: int) -> dict: + """Fetch one item by id. + + Args: + request (Request): Incoming request. + id (int): Item identifier. + + Returns: + dict: The item document. + + Raises: + HTTPException: 404 when the item does not exist. + """ + return dump(await read_or_404(svc(request, "item"), id, "item")) -async def list_items(request: Request): - """List all items.""" - docs = await svc(request).search({}) - return [d.model_dump(mode="json", by_alias=True) for d in docs] +async def update_item(request: Request, id: int, body: dict) -> dict: + """Replace an item by id. + + Args: + request (Request): Incoming request. + id (int): Item identifier. + body (dict): Full replacement payload. + + Returns: + dict: The updated item. + + Raises: + HTTPException: 404 when the item does not exist. + """ + await read_or_404(svc(request, "item"), id, "item") + body.pop("id", None) + doc = await svc(request, "item").update(id, body) + return dump(doc) -async def delete_item(request: Request, id: str): - """Delete one item by id.""" - ok = await svc(request).delete(id) - if not ok: - return JSONResponse(status_code=404, content={"detail": "item not found"}) - return {"deleted": True} \ No newline at end of file +async def delete_item(request: Request, id: int, response: Response) -> None: + """Delete an item by id. + + Args: + request (Request): Incoming request. + id (int): Item identifier. + response (Response): Response object; set to 204 on success. + + Raises: + HTTPException: 404 when the item does not exist. + """ + await delete_or_404(svc(request, "item"), id, "item") + response.status_code = 204 diff --git a/standards/mcp/templates/app/interfaces/job/routes.py b/standards/mcp/templates/app/interfaces/job/routes.py index 3d4f80f..78aacc8 100644 --- a/standards/mcp/templates/app/interfaces/job/routes.py +++ b/standards/mcp/templates/app/interfaces/job/routes.py @@ -2,33 +2,89 @@ Job route handlers โ€” names must match openapi.yaml operationIds. """ -from fastapi import Request -from fastapi.responses import JSONResponse +from fastapi import Request, Response -from domain.job.models import Job +from interfaces._common import delete_or_404, dump, paginate, read_or_404, svc -def svc(request: Request): - """Resolve the job CRUD service from app state.""" - return request.app.state.db_resources["job_svc"] +async def list_jobs(request: Request, limit: int = 20, offset: int = 0) -> dict: + """List jobs (paginated). ``limit=0`` returns all remaining items. + + Args: + request (Request): Incoming request. + limit (int): Page size. Defaults to 20. + offset (int): Items to skip. Defaults to 0. + + Returns: + dict: ``{"total": int, "items": list[Job]}``. + """ + docs = await svc(request, "job").search({}) + return paginate([dump(d) for d in docs], limit, offset) -async def create_job(request: Request, body: dict): - """Create a job from the request body.""" - data = body.model_dump() if hasattr(body, "model_dump") else dict(body) - doc = await svc(request).create(Job(**data)) - return JSONResponse(status_code=201, content=doc.model_dump(mode="json", by_alias=True)) +async def create_job(request: Request, body: dict, response: Response) -> dict: + """Create a job. + + Args: + request (Request): Incoming request. + body (dict): Job fields (``id`` ignored). + response (Response): Response object; set to 201 on success. + + Returns: + dict: The created job. + """ + response.status_code = 201 + body.pop("id", None) + doc = await svc(request, "job").create(body) + return dump(doc) -async def get_job(request: Request, id: str): - """Fetch one job by id.""" - doc = await svc(request).read(id) - if doc is None: - return JSONResponse(status_code=404, content={"detail": "job not found"}) - return doc.model_dump(mode="json", by_alias=True) +async def get_job(request: Request, id: int) -> dict: + """Fetch one job by id. + + Args: + request (Request): Incoming request. + id (int): Job identifier. + + Returns: + dict: The job document. + + Raises: + HTTPException: 404 when the job does not exist. + """ + return dump(await read_or_404(svc(request, "job"), id, "job")) -async def list_jobs(request: Request): - """List all jobs.""" - docs = await svc(request).search({}) - return [d.model_dump(mode="json", by_alias=True) for d in docs] \ No newline at end of file +async def update_job(request: Request, id: int, body: dict) -> dict: + """Replace a job by id. + + Args: + request (Request): Incoming request. + id (int): Job identifier. + body (dict): Full replacement payload. + + Returns: + dict: The updated job. + + Raises: + HTTPException: 404 when the job does not exist. + """ + await read_or_404(svc(request, "job"), id, "job") + body.pop("id", None) + doc = await svc(request, "job").update(id, body) + return dump(doc) + + +async def delete_job(request: Request, id: int, response: Response) -> None: + """Delete a job by id. + + Args: + request (Request): Incoming request. + id (int): Job identifier. + response (Response): Response object; set to 204 on success. + + Raises: + HTTPException: 404 when the job does not exist. + """ + await delete_or_404(svc(request, "job"), id, "job") + response.status_code = 204 diff --git a/standards/mcp/templates/app/interfaces/openapi.py b/standards/mcp/templates/app/interfaces/openapi.py index 489f65a..0c2f6a7 100644 --- a/standards/mcp/templates/app/interfaces/openapi.py +++ b/standards/mcp/templates/app/interfaces/openapi.py @@ -6,4 +6,5 @@ re-exports every route handler from the subpackages into one flat namespace. """ # ruff: noqa: F403 from interfaces.item.routes import * -from interfaces.job.routes import * \ No newline at end of file +from interfaces.job.routes import * +from interfaces.system.routes import * diff --git a/standards/mcp/templates/app/interfaces/system/__init__.py b/standards/mcp/templates/app/interfaces/system/__init__.py new file mode 100644 index 0000000..88b0746 --- /dev/null +++ b/standards/mcp/templates/app/interfaces/system/__init__.py @@ -0,0 +1,3 @@ +"""# Summary + +System interfaces.""" diff --git a/standards/mcp/templates/app/interfaces/system/routes.py b/standards/mcp/templates/app/interfaces/system/routes.py new file mode 100644 index 0000000..1f64931 --- /dev/null +++ b/standards/mcp/templates/app/interfaces/system/routes.py @@ -0,0 +1,13 @@ +"""# Summary + +System route handlers โ€” health probe and other non-resource endpoints. +""" + + +async def health() -> dict: + """Liveness probe โ€” public, unauthenticated. + + Returns: + dict: ``{"status": "ok", "service": "app-template"}``. + """ + return {"status": "ok", "service": "app-template"} diff --git a/standards/mcp/templates/app/main.py b/standards/mcp/templates/app/main.py index a569f7b..fb95627 100644 --- a/standards/mcp/templates/app/main.py +++ b/standards/mcp/templates/app/main.py @@ -3,6 +3,12 @@ FastAPI application bootstrap โ€” uses OpenAPIFirstApp for spec-driven routing. Handlers are looked up by operationId in interfaces.openapi, so no router tables are declared here; the lifespan initializes and shuts down app resources. + +--- + +``load_dotenv()`` runs before the app is constructed so ``{AUTH_SERVER}`` in +``openapi.yaml``'s bearer-JWT security scheme resolves from ``.env`` at build +time (openapi_first resolves env placeholders when the spec is loaded). """ # ruff: noqa: E402 import logging @@ -12,8 +18,6 @@ from dotenv import load_dotenv from openapi_first.app import OpenAPIFirstApp from starlette.middleware.cors import CORSMiddleware -from init import init, shutdown - load_dotenv() logging.basicConfig( @@ -22,6 +26,7 @@ logging.basicConfig( ) import interfaces.openapi as openapi_routes +from init import init, shutdown logger = logging.getLogger(__name__) @@ -47,9 +52,9 @@ async def lifespan(app: OpenAPIFirstApp): app = OpenAPIFirstApp( openapi_path="openapi.yaml", routes_module=openapi_routes, - title="Item API", + title="App Template API", version="0.1.0", lifespan=lifespan, ) -app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"]) \ No newline at end of file +app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"]) diff --git a/standards/mcp/templates/app/openapi.yaml b/standards/mcp/templates/app/openapi.yaml index 652471a..015b716 100644 --- a/standards/mcp/templates/app/openapi.yaml +++ b/standards/mcp/templates/app/openapi.yaml @@ -1,161 +1,451 @@ -openapi: 3.0.3 +openapi: 3.1.0 + info: - title: Item API + title: App Template API version: 0.1.0 -paths: - /items: - get: - operationId: list_items - summary: List items - responses: - "200": - description: OK - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Item" - post: - operationId: create_item - summary: Create an item - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ItemInput" - responses: - "201": - description: Created - content: - application/json: - schema: - $ref: "#/components/schemas/Item" - /items/{id}: - get: - operationId: get_item - summary: Get an item - parameters: - - name: id - in: path - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/Item" - "404": - description: Not found - delete: - operationId: delete_item - summary: Delete an item - parameters: - - name: id - in: path - required: true - schema: - type: string - responses: - "200": - description: Deleted - "404": - description: Not found - /jobs: - get: - operationId: list_jobs - summary: List jobs - responses: - "200": - description: OK - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Job" - post: - operationId: create_job - summary: Create a job - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/JobInput" - responses: - "201": - description: Created - content: - application/json: - schema: - $ref: "#/components/schemas/Job" - /jobs/{id}: - get: - operationId: get_job - summary: Get a job - parameters: - - name: id - in: path - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/Job" - "404": - description: Not found + description: | + App template API โ€” OpenAPI-first backend pairing with the client template + and the @aetoskia/react-openapi admin panel renderer. Resources are driven + by OpenAPI x- extension fields; auth is bearer JWT introspected against + the auth-server. Item and Job are example domains โ€” replace them with + your own, keeping the x- conventions documented in the react-openapi MCP + bundle (module react-openapi, object specExtensions). + +servers: + - url: http://localhost:8000 + +security: + - bearerAuth: [] + components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + x-server-url: "{AUTH_SERVER}" + x-introspect-path: "/introspect" + x-login-path: "/login" + x-register-path: "/register" + x-logout-path: "/logout" + x-me-path: "/me" + schemas: Item: type: object - required: [name, quantity] + x-resource: items + x-primary-key: id + x-display-format: "{name} ร— {quantity}" + x-list-columns: [name, quantity] properties: id: - type: string - name: - type: string - quantity: type: integer - ItemInput: - type: object - required: [name] - properties: + readOnly: true + x-order: 0 + x-hidden: { form: true, list: true } + x-label: "ID" name: type: string + x-order: 1 + x-label: "Name" + x-description: "Item name" + x-filterable: true + x-sortable: true + x-autocomplete: token quantity: type: integer default: 1 + x-order: 2 + x-label: "Quantity" + x-description: "How many units" + x-sortable: true + required: [id, name] + Job: type: object - required: [name, status] + x-resource: jobs + x-primary-key: id + x-display-format: "{name} [{status}]" + x-list-columns: [name, status, retry_count] properties: id: - type: string + type: integer + readOnly: true + x-order: 0 + x-hidden: { form: true, list: true } + x-label: "ID" name: type: string + x-order: 1 + x-label: "Name" + x-description: "Job name" + x-filterable: true + x-autocomplete: token status: type: string enum: [pending, processing, done, failed] + x-order: 2 + x-label: "Status" + x-description: "Lifecycle status" + x-filterable: true retry_count: type: integer + readOnly: true + x-order: 3 + x-label: "Retries" error_message: type: string + readOnly: true + x-order: 4 + x-label: "Last Error" payload: type: object - JobInput: + x-order: 5 + x-label: "Payload" + x-description: "Arbitrary job payload" + required: [id, name, status] + + ErrorBody: type: object - required: [name] properties: - name: + detail: type: string - payload: - type: object \ No newline at end of file + required: [detail] + + HTTPValidationError: + type: object + properties: + detail: + type: array + items: + $ref: '#/components/schemas/ValidationError' + + ValidationError: + type: object + properties: + loc: + type: array + items: + type: string + msg: + type: string + type: + type: string + required: [loc, msg, type] + + responses: + Unauthorized: + description: Not authenticated + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + Forbidden: + description: Insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + NotFound: + description: Resource not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + ValidationError: + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + InternalServerError: + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + +paths: + /health: + get: + summary: Liveness probe (public, unauthenticated) + operationId: health + security: [] + responses: + '200': + description: Service is alive + content: + application/json: + schema: + type: object + properties: + status: + type: string + service: + type: string + + /items: + get: + summary: List items (paginated) + operationId: list_items + parameters: + - in: query + name: limit + schema: {type: integer, default: 20} + - in: query + name: offset + schema: {type: integer, default: 0} + responses: + '200': + description: Paginated list of items + content: + application/json: + schema: + type: object + properties: + total: + type: integer + items: + type: array + items: + $ref: '#/components/schemas/Item' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + post: + summary: Create an item + operationId: create_item + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + responses: + '201': + description: Item created + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + /items/{id}: + get: + operationId: get_item + parameters: + - name: id + in: path + required: true + schema: {type: integer} + responses: + '200': + description: Single item + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + put: + operationId: update_item + parameters: + - name: id + in: path + required: true + schema: {type: integer} + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + responses: + '200': + description: Item updated + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + delete: + operationId: delete_item + parameters: + - name: id + in: path + required: true + schema: {type: integer} + responses: + '204': + description: Item deleted + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + + /jobs: + get: + summary: List jobs (paginated) + operationId: list_jobs + parameters: + - in: query + name: limit + schema: {type: integer, default: 20} + - in: query + name: offset + schema: {type: integer, default: 0} + responses: + '200': + description: Paginated list of jobs + content: + application/json: + schema: + type: object + properties: + total: + type: integer + items: + type: array + items: + $ref: '#/components/schemas/Job' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + post: + summary: Create a job + operationId: create_job + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Job' + responses: + '201': + description: Job created + content: + application/json: + schema: + $ref: '#/components/schemas/Job' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + /jobs/{id}: + get: + operationId: get_job + parameters: + - name: id + in: path + required: true + schema: {type: integer} + responses: + '200': + description: Single job + content: + application/json: + schema: + $ref: '#/components/schemas/Job' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + put: + operationId: update_job + parameters: + - name: id + in: path + required: true + schema: {type: integer} + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Job' + responses: + '200': + description: Job updated + content: + application/json: + schema: + $ref: '#/components/schemas/Job' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' + delete: + operationId: delete_job + parameters: + - name: id + in: path + required: true + schema: {type: integer} + responses: + '204': + description: Job deleted + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/ValidationError' + '500': + $ref: '#/components/responses/InternalServerError' diff --git a/standards/mcp/templates/app/pipelines/item_sync.py b/standards/mcp/templates/app/pipelines/item_sync.py index ff71c0c..0644e46 100644 --- a/standards/mcp/templates/app/pipelines/item_sync.py +++ b/standards/mcp/templates/app/pipelines/item_sync.py @@ -5,7 +5,7 @@ Item-sync pipeline โ€” the demo pipeline axis of the blueprint. Runs on the worker, consumes a pending job, and materializes its payload as an item. Steps are plain async functions here; once the chain branches or needs deterministic replay, wrap the steps in a dagpipe DAG (see standards -"06_pipeline_scaffold"). +"50_pipeline_scaffold"). """ import logging diff --git a/standards/mcp/templates/app/pipelines/shared/__init__.py b/standards/mcp/templates/app/pipelines/shared/__init__.py index 8aef39c..0746f21 100644 --- a/standards/mcp/templates/app/pipelines/shared/__init__.py +++ b/standards/mcp/templates/app/pipelines/shared/__init__.py @@ -1,5 +1,5 @@ """# Summary Shared pipeline scaffolding โ€” ports, loader, and registry reused by every -pipeline family. See standards "06_pipeline_scaffold". +pipeline family. See standards "50_pipeline_scaffold". """ diff --git a/standards/mcp/templates/app/tests/integration/test_item_routes.py b/standards/mcp/templates/app/tests/integration/test_item_routes.py index 3525d88..e9e6936 100644 --- a/standards/mcp/templates/app/tests/integration/test_item_routes.py +++ b/standards/mcp/templates/app/tests/integration/test_item_routes.py @@ -8,14 +8,25 @@ import interfaces.openapi as routes_module def test_openapi_app_builds(): """The spec-first app must build and plant each route handler.""" module = importlib.import_module(routes_module.__name__) - for operation in ("create_item", "get_item", "list_items", "delete_item", - "create_job", "get_job", "list_jobs"): + for operation in ( + "health", + "list_items", + "create_item", + "get_item", + "update_item", + "delete_item", + "list_jobs", + "create_job", + "get_job", + "update_job", + "delete_job", + ): assert hasattr(module, operation) app = OpenAPIFirstApp( openapi_path="openapi.yaml", routes_module=module, - title="Item API", + title="App Template API", version="0.1.0", ) - assert app is not None \ No newline at end of file + assert app is not None diff --git a/standards/mcp/templates/app/worker.py b/standards/mcp/templates/app/worker.py index c7fda13..9e1d0d6 100644 --- a/standards/mcp/templates/app/worker.py +++ b/standards/mcp/templates/app/worker.py @@ -7,7 +7,7 @@ the API axis, workers consume them on a fixed cadence. Notes: - This process is separate from the API process. Any in-memory event bus is per process โ€” if the pipeline must surface live progress to the API, swap the bus - adaptor for a broker-backed one (see standards 07_worker_and_progress). + adaptor for a broker-backed one (see standards 51_worker_and_progress). """ import asyncio import logging diff --git a/standards/mcp/templates/drone/npm-lib.yaml b/standards/mcp/templates/drone/npm-lib.yaml new file mode 100644 index 0000000..a581e10 --- /dev/null +++ b/standards/mcp/templates/drone/npm-lib.yaml @@ -0,0 +1,89 @@ +--- +kind: pipeline +type: docker +name: build-and-publish-npm + +platform: + os: linux + arch: arm64 + +workspace: + path: /drone/src + +steps: + - name: check-version + image: node:22-alpine + environment: + NPM_REPO_URL: + from_secret: NPM_REPO_URL + NPM_USERNAME: + from_secret: NPM_USERNAME + NPM_PASSWORD: + from_secret: NPM_PASSWORD + commands: + - apk add --no-cache curl + - PACKAGE_NAME=$(node -p "require('./package.json').name") + - VERSION=$(node -p "require('./package.json').version") + - | + if [ "$DRONE_TAG" != "$VERSION" ]; then + echo "Tag '$DRONE_TAG' does not match package.json version '$VERSION'; refusing to publish." + exit 1 + fi + - echo "registry=$NPM_REPO_URL" > /tmp/.npmrc + - echo "_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> /tmp/.npmrc + - echo "Checking if $PACKAGE_NAME@$VERSION exists on $NPM_REPO_URL ..." + - | + if npm view "$PACKAGE_NAME@$VERSION" version --userconfig /tmp/.npmrc >/dev/null 2>&1; then + echo "$PACKAGE_NAME@$VERSION already exists; skipping build." + exit 78 + else + echo "New version detected: $PACKAGE_NAME@$VERSION" + fi + + - name: quality-gate + image: node:22-alpine + environment: + NPM_REPO_URL: + from_secret: NPM_REPO_URL + NPM_USERNAME: + from_secret: NPM_USERNAME + NPM_PASSWORD: + from_secret: NPM_PASSWORD + commands: + - | + if [ -z "$NPM_REPO_URL" ] || [ -z "$NPM_USERNAME" ] || [ -z "$NPM_PASSWORD" ]; then + echo "NPM_REPO_URL / NPM_USERNAME / NPM_PASSWORD are not set" >&2 + exit 1 + fi + - echo "registry=$NPM_REPO_URL" > .npmrc + - echo "_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc + - npm install + - echo "Running quality gate..." + - npm run quality-gate + + - name: build-package + image: node:22-alpine + commands: + - npm install + - echo "Building npm package..." + - npm run build + - ls -l dist + + - name: publish-to-private-npm + image: node:22-alpine + environment: + NPM_REPO_URL: + from_secret: NPM_REPO_URL + NPM_USERNAME: + from_secret: NPM_USERNAME + NPM_PASSWORD: + from_secret: NPM_PASSWORD + commands: + - echo "registry=$NPM_REPO_URL" > .npmrc + - echo "_auth=$(echo -n "$NPM_USERNAME:$NPM_PASSWORD" | base64 | tr -d '\n')" >> .npmrc + - echo "Publishing to private npm at $NPM_REPO_URL ..." + - npm publish --access restricted + +trigger: + event: + - tag diff --git a/standards/src/hooks.py b/standards/src/hooks.py index ccd4131..aa48e90 100644 --- a/standards/src/hooks.py +++ b/standards/src/hooks.py @@ -1,7 +1,7 @@ """MkDocs hook: rebase cross-kind links to the repository root. The standards wiki links to the sibling library reference with -source-relative paths such as ``../lib/13_library_registry/``. MkDocs only +source-relative paths such as ``../lib/93_library_registry/``. MkDocs only rewrites links whose target lives inside ``docs_dir``, so those links are emitted verbatim and, under ``use_directory_urls``, resolve into ``/standards/wiki/lib/...`` and break. diff --git a/standards/src/lib/01_build_recipe.md b/standards/src/lib/01_build_recipe.md index 1cf3157..2d41ec0 100644 --- a/standards/src/lib/01_build_recipe.md +++ b/standards/src/lib/01_build_recipe.md @@ -6,6 +6,11 @@ The ordered, deterministic checklist for generating a new application of the standard shape. Every step is fixed; only the resource model (step 2), the codegen pass (step 3), and the pipeline family (step 8) need app-specific work. +The reference pages behind this recipe are organized as an anatomy: the +domains layer, the OpenAPI contract that drives routing *and* the admin UI, +the interfaces/infra seam, the auto-rendered UI client, and an optional +pipelines layer โ€” see the [Standards Reference](index.md) index. + This page is served by the `standards` MCP as `docs://modules/build_recipe`. The `start_app` prompt on that server collects the two axes and hands off here; pull exact files with `get_app_component`. @@ -21,6 +26,14 @@ cp -r /standards/src/templates/app apps/ cd apps/ ``` +Pair it with the React client template when a UI is needed (auto-rendered +admin from the spec โ€” see [40 โ€“ UI](40_ui_admin.md)): + +```bash +cp -r /standards/src/templates/client apps/-client +cd apps/-client && npm install +``` + Install the internal libraries โ€” editable local checkouts (preferred in development) or the private index (CI / fresh machines). Credentials are environment-only; never commit them. @@ -194,4 +207,4 @@ Rules of the road: ## Related -- [02 โ€“ Layering Rules](02_layering_rules.md) ยท [05 โ€“ CRUD Template](05_crud_template.md) ยท [06 โ€“ Pipeline Scaffold](06_pipeline_scaffold.md) ยท [12 โ€“ Genericity Matrix](12_genericity_matrix.md) +- [10 โ€“ Layering Rules](10_layering_rules.md) ยท [21 โ€“ CRUD Template](21_crud_template.md) ยท [22 โ€“ Auth Integration](22_auth_integration.md) ยท [40 โ€“ UI](40_ui_admin.md) ยท [50 โ€“ Pipeline Scaffold](50_pipeline_scaffold.md) ยท [92 โ€“ Genericity Matrix](92_genericity_matrix.md) diff --git a/standards/src/lib/03_composition_root.md b/standards/src/lib/02_composition_root.md similarity index 100% rename from standards/src/lib/03_composition_root.md rename to standards/src/lib/02_composition_root.md diff --git a/standards/src/lib/02_layering_rules.md b/standards/src/lib/10_layering_rules.md similarity index 100% rename from standards/src/lib/02_layering_rules.md rename to standards/src/lib/10_layering_rules.md diff --git a/standards/src/lib/04_spec_first_routing.md b/standards/src/lib/20_spec_first_routing.md similarity index 100% rename from standards/src/lib/04_spec_first_routing.md rename to standards/src/lib/20_spec_first_routing.md diff --git a/standards/src/lib/05_crud_template.md b/standards/src/lib/21_crud_template.md similarity index 100% rename from standards/src/lib/05_crud_template.md rename to standards/src/lib/21_crud_template.md diff --git a/standards/src/lib/14_auth_integration.md b/standards/src/lib/22_auth_integration.md similarity index 100% rename from standards/src/lib/14_auth_integration.md rename to standards/src/lib/22_auth_integration.md diff --git a/standards/src/lib/09_infra_adaptors.md b/standards/src/lib/30_infra_adaptors.md similarity index 100% rename from standards/src/lib/09_infra_adaptors.md rename to standards/src/lib/30_infra_adaptors.md diff --git a/standards/src/lib/40_ui_admin.md b/standards/src/lib/40_ui_admin.md new file mode 100644 index 0000000..bb5743d --- /dev/null +++ b/standards/src/lib/40_ui_admin.md @@ -0,0 +1,86 @@ +# UI: Auto-Rendered Admin & Custom Pages + +## Summary + +The UI axis of an Aetos app is a **published React client**, not code written +per application. Two npm packages carry the whole surface: + +| Package | Role | +|---|---| +| `@aetoskia/react-openapi` | Renders a complete admin panel (CRUD tables, forms, filters, sorting, pagination, uploads) **from the app's `openapi.yaml`** โ€” zero UI code. | +| `@aetoskia/react-auth` | Auth contexts and pages (login/register/me) wired to the auth-server, plus the axios client with token handling. | + +Both publish to the private registry `https://npm.aetoskia.com`. The server +spec is the single source of truth: the same `openapi.yaml` that drives +`openapi-first` routing drives the admin UI, through **x- extension fields** +(see below). + +--- + +## Scaffold + +```bash +cp -r /standards/src/templates/client apps/-client +cd apps/-client +npm install # deps come from npm.aetoskia.com via .npmrc +npm run dev +``` + +The client template is a Vite + MUI app with: + +- `src/openapi-config.ts` โ€” points the renderer at the app's spec and the + auth-server's spec; +- `.env.example` โ€” `VITE_API_BASE_URL` (app API) and `VITE_AUTH_BASE_URL` + (auth-server); +- a `Home` page that auto-lists every resource the spec declares, and a + `Header`/`Footer`/theme scaffold. + +Custom pages are ordinary React routes layered on top; the auto-rendered admin +is available per resource at `#/resource/`. + +--- + +## x- extensions: how the spec steers the UI + +The admin renderer reads a catalog of OpenAPI extension fields (`x-resource`, +`x-list-columns`, `x-display-format`, `x-label`, `x-order`, `x-hidden`, +`x-sortable`, `x-filterable`, `x-autocomplete`, `x-fk`, `x-ui-type`, +`x-upload`, `x-sse`, `x-profile`, and the auth wiring `x-server-url` / +`x-login-path` / `x-me-path` / โ€ฆ) declared on schemas and properties. + +**The catalog is canonical in the react-openapi source, not in this doc.** +Read it from the MCP bundle: + +``` +docs://modules/react-openapi # module: specExtensions โ€” the full catalog +``` + +The app's own spec carries the per-resource values; the catalog explains what +each field does. The template's `openapi.yaml` shows the convention on the +example `Item` and `Job` schemas. + +--- + +## Golden rules + +1. **The spec owns the UI.** Add a resource or rename a column in + `openapi.yaml`; the admin follows. Never fork the renderer per app. +2. **Custom pages for workflows, auto-render for CRUD.** Anything that is + "list / create / edit / delete an entity" is a spec concern; anything that + is a bespoke workflow is a React page. +3. **Auth is consumed, never re-implemented.** `@aetoskia/react-auth` holds + tokens and calls the auth-server endpoints declared by the x- wiring; pages + read the context. +4. **Publish, don't vendor.** UI shared across apps belongs in + `@aetoskia/react-openapi` or `@aetoskia/react-auth` (SemVer, tag-triggered + npm release), not copy-pasted into app trees. + +--- + +## Notes + +- The server template ships authless by default (see + [22 โ€“ Auth Integration](22_auth_integration.md)); the client template pairs + with it and degrades to "no login" until a security scheme is declared. +- `react/vet` is the full-stack reference implementation: spec with x- + extensions, server, and the consuming client in one tree. diff --git a/standards/src/lib/06_pipeline_scaffold.md b/standards/src/lib/50_pipeline_scaffold.md similarity index 100% rename from standards/src/lib/06_pipeline_scaffold.md rename to standards/src/lib/50_pipeline_scaffold.md diff --git a/standards/src/lib/07_worker_and_progress.md b/standards/src/lib/51_worker_and_progress.md similarity index 100% rename from standards/src/lib/07_worker_and_progress.md rename to standards/src/lib/51_worker_and_progress.md diff --git a/standards/src/lib/08_human_in_loop.md b/standards/src/lib/52_human_in_loop.md similarity index 100% rename from standards/src/lib/08_human_in_loop.md rename to standards/src/lib/52_human_in_loop.md diff --git a/standards/src/lib/10_drone_pipelines.md b/standards/src/lib/90_drone_pipelines.md similarity index 91% rename from standards/src/lib/10_drone_pipelines.md rename to standards/src/lib/90_drone_pipelines.md index 5364b0b..bcca08e 100644 --- a/standards/src/lib/10_drone_pipelines.md +++ b/standards/src/lib/90_drone_pipelines.md @@ -28,7 +28,7 @@ For internal libraries. The file contains **two pipelines**: - `check-version` โ€” **guard**: fail unless `$DRONE_TAG` equals the version in `pyproject.toml`; then read `name` / `version` and query `$PIP_REPO_URL/simple//`; if that version already exists, exit - `78` and skip the whole build (see [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md)). + `78` and skip the whole build (see [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md)). - `quality-gate` โ€” install the package with its `[dev]` extras from the private index, then `black --check`, `ruff check`, `mypy`, `pydoclint`, `pytest`. @@ -57,7 +57,7 @@ triggered on `tag`: - `fetch-tags` โ€” resolve the latest tag into `LATEST_TAG.txt`; fail if there are no tags. - `check-version` โ€” **guard**: fail unless `$DRONE_TAG` equals the repo-root - `VERSION` file (see [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md)). + `VERSION` file (see [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md)). - `check-remote-image` โ€” if `aetos/:` already exists locally, exit `78` and skip the build. - `quality-gate` โ€” install from `requirements.txt` and run @@ -92,7 +92,7 @@ Placeholders to fill in per repo: index and the running container against duplicate publishes. - Do not drop the tagโ†”version guard. A package needs its `pyproject.toml` version to equal the tag; a service needs a root `VERSION` file that equals - the tag. See [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md). + the tag. See [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md). - Do not rename the pipelines; tooling and runbooks key off `build-and-publish-pypi` and `build-and-deploy-service`. @@ -100,4 +100,4 @@ Placeholders to fill in per repo: ## Related -- [01 โ€“ Build Recipe](01_build_recipe.md) ยท [09 โ€“ Infra Adapters](09_infra_adaptors.md) ยท [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md) ยท [13 โ€“ Library Registry](13_library_registry.md) +- [01 โ€“ Build Recipe](01_build_recipe.md) ยท [30 โ€“ Infra Adapters](30_infra_adaptors.md) ยท [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md) ยท [93 โ€“ Library Registry](93_library_registry.md) diff --git a/standards/src/lib/11_versioning_and_changelog.md b/standards/src/lib/91_versioning_and_changelog.md similarity index 96% rename from standards/src/lib/11_versioning_and_changelog.md rename to standards/src/lib/91_versioning_and_changelog.md index 7fa373a..9503db8 100644 --- a/standards/src/lib/11_versioning_and_changelog.md +++ b/standards/src/lib/91_versioning_and_changelog.md @@ -9,7 +9,7 @@ The **version file is the source of truth**, the **git tag must equal it**, and a Drone guard enforces that equality before anything is published. Releases are cut manually; a tag is what triggers the pipeline. -This page pairs with [10 โ€“ Drone Pipelines](10_drone_pipelines.md): the version +This page pairs with [90 โ€“ Drone Pipelines](90_drone_pipelines.md): the version and tag contract is exactly what those two CI shapes consume. --- @@ -178,4 +178,4 @@ Drone guard turns that silent no-op into a hard failure. ## Related -- [10 โ€“ Drone Pipelines](10_drone_pipelines.md) ยท [15 โ€“ Repository Inventory](15_repository_inventory.md) ยท [01 โ€“ Build Recipe](01_build_recipe.md) ยท [13 โ€“ Library Registry](13_library_registry.md) +- [90 โ€“ Drone Pipelines](90_drone_pipelines.md) ยท [94 โ€“ Repository Inventory](94_repository_inventory.md) ยท [01 โ€“ Build Recipe](01_build_recipe.md) ยท [93 โ€“ Library Registry](93_library_registry.md) diff --git a/standards/src/lib/12_genericity_matrix.md b/standards/src/lib/92_genericity_matrix.md similarity index 100% rename from standards/src/lib/12_genericity_matrix.md rename to standards/src/lib/92_genericity_matrix.md diff --git a/standards/src/lib/13_library_registry.md b/standards/src/lib/93_library_registry.md similarity index 100% rename from standards/src/lib/13_library_registry.md rename to standards/src/lib/93_library_registry.md diff --git a/standards/src/lib/15_repository_inventory.md b/standards/src/lib/94_repository_inventory.md similarity index 87% rename from standards/src/lib/15_repository_inventory.md rename to standards/src/lib/94_repository_inventory.md index ae130bb..b6f0989 100644 --- a/standards/src/lib/15_repository_inventory.md +++ b/standards/src/lib/94_repository_inventory.md @@ -5,8 +5,8 @@ The canonical list of Aetos repositories covered by the CI and versioning standards, with the artifact each one produces, its version source, and its Drone shape. Every entry maps to the contract in -[11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md) and the two CI -files in [10 โ€“ Drone Pipelines](10_drone_pipelines.md). +[91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md) and the two CI +files in [90 โ€“ Drone Pipelines](90_drone_pipelines.md). The same data is published machine-readably as the `registry://repos` MCP resource (and the `list_repos` tool), sourced from `standards/src/repos.json`. @@ -68,4 +68,4 @@ merged, and the tag is created on the merged commit. ## Related -- [10 โ€“ Drone Pipelines](10_drone_pipelines.md) ยท [11 โ€“ Versioning & Changelog](11_versioning_and_changelog.md) ยท [13 โ€“ Library Registry](13_library_registry.md) +- [90 โ€“ Drone Pipelines](90_drone_pipelines.md) ยท [91 โ€“ Versioning & Changelog](91_versioning_and_changelog.md) ยท [93 โ€“ Library Registry](93_library_registry.md) diff --git a/standards/src/lib/index.md b/standards/src/lib/index.md index 9631f7e..8bd29c9 100644 --- a/standards/src/lib/index.md +++ b/standards/src/lib/index.md @@ -3,26 +3,56 @@ The reference half of the Standards description: the enforceable rules, patterns, and the internal library catalog that agents consult while coding. -- **Build Recipe** โ€” the ordered, agentic checklist for a new app. +The reference is organized as an **anatomy** โ€” one entry checklist and four +pillars describing what an application is made of, plus delivery/meta pages +and an optional pipelines layer. + +## Anatomy + +- **Build Recipe** โ€” the ordered, agentic checklist for a new app; the entry + point that walks the whole anatomy. + +## Pillar 1 โ€” Domains + - **Layering Rules** โ€” the strict request โ†’ domain โ†’ repository layering and the rules that enforce it. + +## Pillar 2 โ€” OpenAPI Spec (the contract) + - **Composition Root** โ€” a single composition point wiring the whole app. - **Spec-First Routing** โ€” the OpenAPI contract as the routing source of truth. - **CRUD Template** โ€” the standardized generic resource endpoint scaffold. +- **Auth Integration** โ€” consuming the shared auth-server service (spec-driven, + no auth code). + +## Pillar 3 โ€” Interfaces & Infra + +- **Infra Adapters** โ€” how infrastructure connects without leaking into domain. + +## Pillar 4 โ€” UI + +- **UI: Auto-Rendered Admin & Custom Pages** โ€” the `@aetoskia/react-openapi` + admin rendered from the spec's x- extensions, and `@aetoskia/react-auth` + for auth pages; the client template scaffold. + +## Pipelines (optional layer) + - **Pipeline Scaffold** โ€” the deterministic pipeline skeleton for multi-stage jobs. - **Worker & Progress** โ€” queued work, progress reporting, and visibility. - **Human-in-the-Loop** โ€” guardrails and approvals inside automations. -- **Infra Adapters** โ€” how infrastructure connects without leaking into domain. -- **Drone Pipelines** โ€” the two CI shapes: a PyPI package or a Docker deployment. -- **Versioning & Changelog** โ€” SemVer, the tagโ†”version contract, and the release - changelog. + +## Delivery & Meta + +- **Drone Pipelines** โ€” the two CI shapes: a PyPI/npm package or a Docker + deployment. +- **Versioning & Changelog** โ€” SemVer, the tagโ†”version contract, and the + release changelog. - **Repository Inventory** โ€” every covered repo, its type, version source, and Drone shape. -- **Genericity Matrix** โ€” what is library-backed, template-provided, or authored. -- **Auth Integration** โ€” consuming the shared auth-server service (spec-driven, - no auth code). +- **Genericity Matrix** โ€” what is library-backed, template-provided, or + authored. - **Library Registry** โ€” the catalog of internal libraries behind all of it. Read the **Wiki** for the philosophy and rationale; these pages are the -reference that mirrors the `standards` MCP bundle. \ No newline at end of file +reference that mirrors the `standards` MCP bundle. diff --git a/standards/src/templates/README.md b/standards/src/templates/README.md index 552c375..ffd7496 100644 --- a/standards/src/templates/README.md +++ b/standards/src/templates/README.md @@ -68,7 +68,7 @@ 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 "06_pipeline_scaffold". +a root class. See standards "50_pipeline_scaffold". ## What to keep, what to replace diff --git a/standards/src/templates/app/pipelines/item_sync.py b/standards/src/templates/app/pipelines/item_sync.py index ff71c0c..0644e46 100644 --- a/standards/src/templates/app/pipelines/item_sync.py +++ b/standards/src/templates/app/pipelines/item_sync.py @@ -5,7 +5,7 @@ Item-sync pipeline โ€” the demo pipeline axis of the blueprint. Runs on the worker, consumes a pending job, and materializes its payload as an item. Steps are plain async functions here; once the chain branches or needs deterministic replay, wrap the steps in a dagpipe DAG (see standards -"06_pipeline_scaffold"). +"50_pipeline_scaffold"). """ import logging diff --git a/standards/src/templates/app/pipelines/shared/__init__.py b/standards/src/templates/app/pipelines/shared/__init__.py index 8aef39c..0746f21 100644 --- a/standards/src/templates/app/pipelines/shared/__init__.py +++ b/standards/src/templates/app/pipelines/shared/__init__.py @@ -1,5 +1,5 @@ """# Summary Shared pipeline scaffolding โ€” ports, loader, and registry reused by every -pipeline family. See standards "06_pipeline_scaffold". +pipeline family. See standards "50_pipeline_scaffold". """ diff --git a/standards/src/templates/app/worker.py b/standards/src/templates/app/worker.py index c7fda13..9e1d0d6 100644 --- a/standards/src/templates/app/worker.py +++ b/standards/src/templates/app/worker.py @@ -7,7 +7,7 @@ the API axis, workers consume them on a fixed cadence. Notes: - This process is separate from the API process. Any in-memory event bus is per process โ€” if the pipeline must surface live progress to the API, swap the bus - adaptor for a broker-backed one (see standards 07_worker_and_progress). + adaptor for a broker-backed one (see standards 51_worker_and_progress). """ import asyncio import logging diff --git a/standards/src/wiki/01_overview.md b/standards/src/wiki/01_overview.md index acb07dd..4d221c4 100644 --- a/standards/src/wiki/01_overview.md +++ b/standards/src/wiki/01_overview.md @@ -76,7 +76,7 @@ only its `ports/` seam reaches into `infra/` to bind adapters. handlers are looked up by `operationId`. There are no decorator routers. 5. **Reuse the libraries.** Orchestration, DI, Mongo repositories, ingestion, auth, and docs come from internal libraries โ€” see the [Library - Registry](../lib/13_library_registry/). + Registry](../lib/93_library_registry/). 6. **Explicit state machines.** Long-running work moves through explicit, durable statuses and can pause for human input. diff --git a/standards/src/wiki/03_start_an_app.md b/standards/src/wiki/03_start_an_app.md index 151ef87..49c73ed 100644 --- a/standards/src/wiki/03_start_an_app.md +++ b/standards/src/wiki/03_start_an_app.md @@ -22,7 +22,7 @@ Gather these before starting โ€” the `start_app` MCP prompt asks for them: the families and their input formats (or "none"). 4. **Auth needed now?** Default **no**. Auth is deferred (`py-jwt` primitives only), and an authless app is just a spec with no `security` keys โ€” see - [Spec-First Routing โ†’ Authless apps](../lib/04_spec_first_routing/#authless-apps). + [Spec-First Routing โ†’ Authless apps](../lib/20_spec_first_routing/#authless-apps). 5. **Integrations.** Mongo, ingestion formats, email, LLM provider. If you can state axes 1 and 2, the rest is mechanical. @@ -57,8 +57,8 @@ cp -r /standards/src/templates/app apps/ ## ๐Ÿ“š Reference - [Build Recipe](../lib/01_build_recipe/) โ€” the deterministic checklist -- [Genericity Matrix](../lib/12_genericity_matrix/) โ€” Tier A / B / C -- [Library Registry](../lib/13_library_registry/) โ€” the Tier A catalog +- [Genericity Matrix](../lib/92_genericity_matrix/) โ€” Tier A / B / C +- [Library Registry](../lib/93_library_registry/) โ€” the Tier A catalog - [App Components](02_components.md) โ€” the component model --- diff --git a/standards/src/wiki/04_development/02_releasing.md b/standards/src/wiki/04_development/02_releasing.md index 1e500a1..baee8d1 100644 --- a/standards/src/wiki/04_development/02_releasing.md +++ b/standards/src/wiki/04_development/02_releasing.md @@ -1,11 +1,11 @@ # Releasing & Versioning How to cut a release of any Aetos repository. The rule lives in the reference -page [Versioning & Changelog](../lib/11_versioning_and_changelog/); this is the +page [Versioning & Changelog](../lib/91_versioning_and_changelog/); this is the runbook you follow. Every repository is one of two Drone shapes โ€” a **PyPI package** or a **Docker -deployment** ([Drone Pipelines](../lib/10_drone_pipelines/)). Both release the +deployment** ([Drone Pipelines](../lib/90_drone_pipelines/)). Both release the same way: the version bump and changelog promotion go **in the merge request**, and the tag is created on the merged commit. @@ -122,4 +122,4 @@ outage): ## Related -- [Testing & Quality Gates](01_testing.md) ยท [Versioning & Changelog](../lib/11_versioning_and_changelog/) ยท [Drone Pipelines](../lib/10_drone_pipelines/) +- [Testing & Quality Gates](01_testing.md) ยท [Versioning & Changelog](../lib/91_versioning_and_changelog/) ยท [Drone Pipelines](../lib/90_drone_pipelines/) diff --git a/standards/src/wiki/05_mcp_setup.md b/standards/src/wiki/05_mcp_setup.md index 4e50a0c..017adff 100644 --- a/standards/src/wiki/05_mcp_setup.md +++ b/standards/src/wiki/05_mcp_setup.md @@ -9,7 +9,7 @@ portal runs each one as a FastMCP **streamable-http** app bound to Connect your agent to the **`standards`** server first: it answers `find_library`, `list_repos`, and the `start_app` prompt, so the agent reaches for an internal library instead of reimplementing one (see the -[Library Registry](../lib/13_library_registry/)). +[Library Registry](../lib/93_library_registry/)). --- @@ -356,7 +356,7 @@ Client Configuration โ†’ Copy HTTP Stream Config**. ## ๐Ÿ“š Reference -- [Library Registry](../lib/13_library_registry/) โ€” the catalog each server +- [Library Registry](../lib/93_library_registry/) โ€” the catalog each server mirrors, and where `find_library` resolves - [Start an App](03_start_an_app.md) โ€” connect `standards`, then invoke `start_app` @@ -366,4 +366,4 @@ Client Configuration โ†’ Copy HTTP Stream Config**. ## Related -- [Start an App](03_start_an_app.md) ยท [Testing & Quality](04_development/01_testing.md) ยท [Library Registry](../lib/13_library_registry/) +- [Start an App](03_start_an_app.md) ยท [Testing & Quality](04_development/01_testing.md) ยท [Library Registry](../lib/93_library_registry/) diff --git a/standards/src/wiki/index.md b/standards/src/wiki/index.md index ee9bb80..8d4f736 100644 --- a/standards/src/wiki/index.md +++ b/standards/src/wiki/index.md @@ -41,15 +41,19 @@ the same shape underneath. | [Testing & Quality](04_development/01_testing.md) | Test layout and acceptance gates | **Reference** (separate site, mirrors the MCP bundle): the enforceable -rules โ€” [Build Recipe](../lib/01_build_recipe/), [Layering](../lib/02_layering_rules/), [Composition -Root](../lib/03_composition_root/), [Spec-First -Routing](../lib/04_spec_first_routing/), [CRUD -Template](../lib/05_crud_template/), [Pipeline -Scaffold](../lib/06_pipeline_scaffold/), [Worker & -Progress](../lib/07_worker_and_progress/), [Human-in-the-Loop](../lib/08_human_in_loop/), -[Infra Adapters](../lib/09_infra_adaptors/), [Genericity -Matrix](../lib/12_genericity_matrix/), [Library -Registry](../lib/13_library_registry/). +anatomy โ€” start at the [Build Recipe](../lib/01_build_recipe/), then the +pillars: domains ([Layering](../lib/10_layering_rules/)), the OpenAPI +contract ([Composition Root](../lib/02_composition_root/), +[Spec-First Routing](../lib/20_spec_first_routing/), [CRUD +Template](../lib/21_crud_template/), [Auth +Integration](../lib/22_auth_integration/)), interfaces & infra ([Infra +Adapters](../lib/30_infra_adaptors/)), UI ([Auto-Rendered +Admin](../lib/40_ui_admin/)), the optional pipelines layer ([Pipeline +Scaffold](../lib/50_pipeline_scaffold/), [Worker & +Progress](../lib/51_worker_and_progress/), [Human-in-the-Loop](../lib/52_human_in_loop/)), +and delivery/meta ([Genericity +Matrix](../lib/92_genericity_matrix/), [Library +Registry](../lib/93_library_registry/)). --- diff --git a/standards/wiki/01_overview/index.html b/standards/wiki/01_overview/index.html index da8fd90..afc06d9 100644 --- a/standards/wiki/01_overview/index.html +++ b/standards/wiki/01_overview/index.html @@ -772,7 +772,7 @@ port/adapter binding, performed by the composition root at startup.

  • Spec-first. The HTTP contract is declared in openapi.yaml; route handlers are looked up by operationId. There are no decorator routers.
  • Reuse the libraries. Orchestration, DI, Mongo repositories, ingestion, - auth, and docs come from internal libraries โ€” see the Library + auth, and docs come from internal libraries โ€” see the Library Registry.
  • Explicit state machines. Long-running work moves through explicit, durable statuses and can pause for human input.
  • diff --git a/standards/wiki/03_start_an_app/index.html b/standards/wiki/03_start_an_app/index.html index a140102..5c3decf 100644 --- a/standards/wiki/03_start_an_app/index.html +++ b/standards/wiki/03_start_an_app/index.html @@ -693,7 +693,7 @@ machine-facing checklist lives in the reference page the families and their input formats (or "none").
  • Auth needed now? Default no. Auth is deferred (py-jwt primitives only), and an authless app is just a spec with no security keys โ€” see - Spec-First Routing โ†’ Authless apps.
  • + Spec-First Routing โ†’ Authless apps.
  • Integrations. Mongo, ingestion formats, email, LLM provider.
  • If you can state axes 1 and 2, the rest is mechanical.

    @@ -721,8 +721,8 @@ machine-facing checklist lives in the reference page

    ๐Ÿ“š Reference


    diff --git a/standards/wiki/04_development/02_releasing/index.html b/standards/wiki/04_development/02_releasing/index.html index d590f0f..01b2662 100644 --- a/standards/wiki/04_development/02_releasing/index.html +++ b/standards/wiki/04_development/02_releasing/index.html @@ -723,10 +723,10 @@

    Releasing & Versioning

    How to cut a release of any Aetos repository. The rule lives in the reference -page Versioning & Changelog; this is the +page Versioning & Changelog; this is the runbook you follow.

    Every repository is one of two Drone shapes โ€” a PyPI package or a Docker -deployment (Drone Pipelines). Both release the +deployment (Drone Pipelines). Both release the same way: the version bump and changelog promotion go in the merge request, and the tag is created on the merged commit.


    @@ -851,7 +851,7 @@ outage):


    diff --git a/standards/wiki/05_mcp_setup/index.html b/standards/wiki/05_mcp_setup/index.html index 8bb236b..fa84131 100644 --- a/standards/wiki/05_mcp_setup/index.html +++ b/standards/wiki/05_mcp_setup/index.html @@ -738,7 +738,7 @@ portal runs each one as a FastMCP streamable-http app bound to

    Connect your agent to the standards server first: it answers find_library, list_repos, and the start_app prompt, so the agent reaches for an internal library instead of reimplementing one (see the -Library Registry).

    +Library Registry).


    โ–ถ๏ธ Run the servers locally

    From the docs checkout:

    @@ -1328,7 +1328,7 @@ Client Configuration โ†’ Copy HTTP Stream Config.


    ๐Ÿ“š Reference

    Reference (separate site, mirrors the MCP bundle): the enforceable -rules โ€” Build Recipe, Layering, Composition -Root, Spec-First -Routing, CRUD -Template, Pipeline -Scaffold, Worker & -Progress, Human-in-the-Loop, -Infra Adapters, Genericity -Matrix, Library -Registry.

    +anatomy โ€” start at the Build Recipe, then the +pillars: domains (Layering), the OpenAPI +contract (Composition Root, +Spec-First Routing, CRUD +Template, Auth +Integration), interfaces & infra (Infra +Adapters), UI (Auto-Rendered +Admin), the optional pipelines layer (Pipeline +Scaffold, Worker & +Progress, Human-in-the-Loop), +and delivery/meta (Genericity +Matrix, Library +Registry).


      diff --git a/standards/wiki/search/search_index.json b/standards/wiki/search/search_index.json index d24affe..8eb2d22 100644 --- a/standards/wiki/search/search_index.json +++ b/standards/wiki/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"\ud83e\udde9 Standards \u2014 the Aetos App Blueprint","text":"

      One reusable architecture for every backend application in the Aetos ecosystem: a spec-first HTTP edge, a framework-free domain core, a pluggable infrastructure layer, and a single composition root.

      Fill in two axes only and a new app is done: your resource model, and (if needed) your pipeline family. The blueprint itself never names a business domain \u2014 expenses, health metrics, inventory, and analytics are all the same shape underneath.

      Doc model: this wiki is written for humans \u2014 how-to guides, the build recipe, and quality gates. The enforceable rules (layering, composition root, CRUD template, pipeline scaffold) and the library registry live in the reference pages, mirrored by the machine-readable standards MCP bundle. Query find_library before writing any infrastructure.

      "},{"location":"#key-features","title":"\ud83d\ude80 Key Features","text":"
      • \ud83e\udded Spec-first routing \u2014 the OpenAPI document, not decorator routers, is the source of truth (operationId lookup)
      • \ud83c\udfd7\ufe0f One-way layering \u2014 interfaces \u2192 domain \u2192 infra, enforced
      • \ud83d\udd0c Single composition root \u2014 every dependency is wired in exactly one place
      • \ud83e\udde9 Generic, not app-specific \u2014 reusable rules versus two authoring axes
      • \ud83d\udcda Library-backed \u2014 DB, DI, pipelines, ingestion, auth, and docs come from internal libraries, never hand-written
      • \ud83d\udea6 Explicit state machines \u2014 durable job statuses, progress, and human-in-the-loop pauses
      "},{"location":"#documentation-structure","title":"\ud83d\udcc1 Documentation Structure","text":"Section Description Overview Philosophy, the one-way dependency rule, architecture App Components The component model and how the pieces wire together Start an App The entry point: gather the two axes, then build Testing & Quality Test layout and acceptance gates

      Reference (separate site, mirrors the MCP bundle): the enforceable rules \u2014 Build Recipe, Layering, Composition Root, Spec-First Routing, CRUD Template, Pipeline Scaffold, Worker & Progress, Human-in-the-Loop, Infra Adapters, Genericity Matrix, Library Registry.

      "},{"location":"#related-resources","title":"\ud83d\udd17 Related Resources","text":"
      • MCP bundle \u2014 standards server on :8009: read docs://index, docs://nav, docs://modules/{module}; call find_library(capability)
      • Library registry \u2014 the catalog of internal libraries behind every app (libraries.json, served as registry://libraries)
      • Template \u2014 the runnable skeleton at standards/src/templates/app/
      • Start a build \u2014 invoke the start_app prompt on the standards server, or read the Start an App guide

      \u00a9 Aetoskia Internal \u2014 standards

      "},{"location":"01_overview/","title":"Overview","text":"

      The blueprint is a hexagonal (ports & adapters) application with a spec-first web edge and a single composition root. It favors explicit wiring over implicit magic and existing internal libraries over hand-written infrastructure. Start here to build the mental model; the enforceable details live in the reference pages.

      "},{"location":"01_overview/#architecture","title":"\ud83c\udfd7\ufe0f Architecture","text":"
      flowchart LR\n    subgraph EDGE[\"interfaces/ \u2014 HTTP edge\"]\n        OAS[\"openapi.yaml<br/>operationId contract\"]\n        RT[\"<resource>/routes.py<br/>thin handlers\"]\n    end\n\n    subgraph CORE[\"domain/ \u2014 business core\"]\n        MD[\"models\"]\n        PT[\"ports (adapter binding seam)\"]\n        SV[\"services\"]\n    end\n\n    subgraph INFRA[\"infra/ \u2014 adapters\"]\n        RP[\"mongo repos (mongo-ops)\"]\n        AD[\"cache \u00b7 stores \u00b7 llm \u00b7 mail\"]\n        DB[(\"MongoDB\")]\n    end\n\n    CR[\"init.py<br/>composition root\"]\n\n    OAS --> RT\n    RT --> SV\n    SV --> PT\n    SV --> RP\n    PT -. depends on .- RP\n    CR --- RT\n    CR --- SV\n    CR --- RP\n    RP --> DB\n    AD --- CR

      The rule holds at every edge: code in an outer ring may depend on a ring closer to the core, never the reverse. domain/ never imports a web framework; only its ports/ seam reaches into infra/ to bind adapters.

      Legend \u2014 solid arrows are compile-time calls; dotted arrows are the port/adapter binding, performed by the composition root at startup.

      "},{"location":"01_overview/#the-one-way-dependency-rule","title":"\ud83d\udd04 The one-way dependency rule","text":"Ring May import Never imports interfaces/ domain, framework glue (glue only) business logic, infra directly domain/ its own models + its ports/ seam (which binds infra/libraries) web frameworks, interfaces/ infra/ domain ports, drivers, libraries \u2014 init.py everything (the wiring point) \u2014"},{"location":"01_overview/#core-principles","title":"\ud83e\udded Core principles","text":"
      1. One-way dependencies. interfaces -> domain -> infra is allowed; the reverse is forbidden.
      2. Ports in the domain, adapters in infra. A service depends on a port; the port's factory binds the concrete adapter, and the composition root calls those factories.
      3. One composition root. Nothing constructs its own dependencies. All wiring lives in one module (init.py) exposed as a flat resource registry.
      4. Spec-first. The HTTP contract is declared in openapi.yaml; route handlers are looked up by operationId. There are no decorator routers.
      5. Reuse the libraries. Orchestration, DI, Mongo repositories, ingestion, auth, and docs come from internal libraries \u2014 see the Library Registry.
      6. Explicit state machines. Long-running work moves through explicit, durable statuses and can pause for human input.
      "},{"location":"01_overview/#runtime-processes","title":"\u2699\ufe0f Runtime processes","text":"

      A standard app may run as up to three processes that share the same composition root:

      Process Entry point Responsibility API main.py serve HTTP; start/stop resources via lifespan Worker worker.py poll durable jobs, run pipelines, publish progress Scripts python -m scripts.<name> one-shot operator tasks"},{"location":"01_overview/#read-next","title":"\u27a1\ufe0f Read Next","text":"
      • 02 \u2013 App Components \u00b7 03 \u2013 Start an App
      "},{"location":"02_components/","title":"App Components","text":"

      What ships in every standard app, and how the pieces relate. This is the blueprint's component model \u2014 templates/app/ is a runnable instance of it.

      "},{"location":"02_components/#component-model","title":"\ud83d\uddc2\ufe0f Component model","text":"

      The blueprint has two orthogonal views: runtime flow (who calls whom) and composition-root wiring (who constructs whom). Keeping them separate makes the layering visible instead of hiding it behind a hub.

      "},{"location":"02_components/#runtime-flow","title":"\ud83d\udd00 Runtime flow","text":"

      Who calls whom at request and job time:

      %%{init: {\"flowchart\": {\"nodeSpacing\": 50, \"rankSpacing\": 80}}}%%\nflowchart TB\n    subgraph REQ[\"Request path \u2014 API process\"]\n        direction LR\n        CL([\"Client<br/>operationId\"]) --> RT[\"interfaces/&lt;resource&gt;/routes.py\"]\n        RT --> SVC[\"&lt;resource&gt;_svc\"]\n        SVC --> REPO[\"&lt;resource&gt;_repo\"]\n    end\n\n    subgraph WRK[\"Background path \u2014 worker process\"]\n        direction LR\n        W[\"worker.py\"] --> JSVC[\"job_svc\"]\n        W --> PIPE[\"pipelines/&lt;family&gt;\"]\n        PIPE --> ISVC[\"item_svc\"]\n        JSVC --> JREPO[\"job_repo\"]\n        ISVC --> IREPO[\"item_repo\"]\n    end\n\n    subgraph INFRA[\"infra/ \u2014 adapters\"]\n        MONGO[(\"MongoDB / mongo_ops\")]\n    end\n\n    REPO --> MONGO\n    JREPO --> MONGO\n    IREPO --> MONGO

      Legend \u2014 solid arrows are runtime calls. Nothing is self-constructed.

      "},{"location":"02_components/#composition-root-wiring","title":"\ud83e\uddf5 Composition-root wiring","text":"

      Who constructs what at startup:

      %%{init: {\"flowchart\": {\"nodeSpacing\": 50, \"rankSpacing\": 80}}}%%\nflowchart TB\n    INIT[\"init.py \u2014 composition root\"]\n    SETUP[\"infra/db/setup.py\"]\n    FACT[\"domain/*/ports/*<br/>factory seams\"]\n    REPOS[\"repos<br/>infra/db/repos/mongo.py\"]\n    SVCES[\"services<br/>CrudsServiceAdaptor\"]\n    STATE[\"app.state.db_resources\"]\n    HEXA[\"hexa.build\"]\n    RT[\"routes.py\"]\n    WK[\"worker.py\"]\n\n    INIT --> SETUP\n    INIT --> FACT\n    FACT --> REPOS\n    FACT --> SVCES\n    REPOS --> SVCES\n    HEXA -.-> SVCES\n    INIT --> STATE\n    STATE --> RT\n    INIT --> WK

      Legend \u2014 init.py is the only place that imports concrete adapters. The ports/ factory seams bind infra; the API reads resources from app.state.db_resources, the worker calls init() directly.

      "},{"location":"02_components/#component-roles","title":"\ud83d\udce6 Component roles","text":""},{"location":"02_components/#1-interfaces-the-edge","title":"1. interfaces/ \u2014 the edge","text":"

      Thin handlers bound to openapi.yaml operationIds. They parse the request, call a service, and shape the response. No business rules, no I/O.

      • interfaces/openapi.py re-exports every route module so the OpenAPI-first app can resolve handlers.
      • Routes may mount the cache decorator on read endpoints.
      "},{"location":"02_components/#2-domain-the-core","title":"2. domain/ \u2014 the core","text":"

      Models, ports, and services (use cases). No framework imports. The ports/ package is the one seam allowed to reach into infra/: each port module declares the document shape and a factory that binds the adapter.

      • <aggregate>/models.py \u2014 dataclasses, enums, document shapes.
      • <aggregate>/ports/db.py \u2014 document model + create_<aggregate>_repo().
      • <aggregate>/ports/service.py \u2014 service + get_<aggregate>_service(repo).
      • Services compose ports and enforce the business rules; the port factories bind the implementations, and the composition root calls them.
      "},{"location":"02_components/#3-infra-the-adapters","title":"3. infra/ \u2014 the adapters","text":"

      Concrete implementations of the domain ports plus cross-cutting infrastructure:

      • db/ \u2014 mongo-ops repositories and the connection lifecycle.
      • adapters/ \u2014 cache store, progress bus, storages, fetchers (library-backed).
      • Anything else the domain needs, implemented against its ports.
      "},{"location":"02_components/#4-pipelines-data-driven-families-optional","title":"4. pipelines/ \u2014 data-driven families (optional)","text":"

      Extraction and enrichment families, each a deterministic step chain (abc.py / impl.py / pipeline.yaml / resources/). Roots are registered in the pattern registry and driven either by a worker job or a CLI.

      "},{"location":"02_components/#5-workerpy-the-job-worker-optional","title":"5. worker.py \u2014 the job worker (optional)","text":"

      A separate process that polls durable job collections, runs pipeline roots, and publishes progress to the progress bus. It shares the same composition root as the API.

      "},{"location":"02_components/#6-initpy-the-composition-root","title":"6. init.py \u2014 the composition root","text":"

      The only place anything is constructed: leaf repositories \u2192 dependent repositories \u2192 services \u2192 adapters. Exposes get_svc overloads and starts / stops resources on the app lifespan.

      "},{"location":"02_components/#how-the-request-flows","title":"\ud83d\udd17 How the request flows","text":"
      sequenceDiagram\n    participant C as Client\n    participant R as route (interfaces)\n    participant S as service (port factory / adapter)\n    participant P as repo (infra)\n    participant DB as MongoDB\n\n    C->>R: POST /items (operationId)\n    R->>S: svc.create(payload)\n    S->>P: repo.insert(doc)\n    P->>DB: insert\n    DB-->>P: ack\n    P-->>S: doc\n    S-->>R: result\n    R-->>C: 200 JSON
      "},{"location":"02_components/#related","title":"Related","text":"
      • 01 \u2013 Overview \u00b7 03 \u2013 Start an App \u00b7 04 \u2013 Testing & Quality
      "},{"location":"03_start_an_app/","title":"\ud83d\ude80 Start an App","text":"

      This is the entry point for building a new application from the blueprint. The goal is one deterministic pass: you supply only the two axes, and the agent does the rest by reading the standards MCP, importing Tier A libraries, and copying Tier B template components.

      Doc model: this page is the human entry point. The deterministic, machine-facing checklist lives in the reference page Build Recipe, served as docs://modules/build_recipe.

      "},{"location":"03_start_an_app/#what-the-agent-needs-from-you","title":"\ud83e\uddfe What the agent needs from you","text":"

      Gather these before starting \u2014 the start_app MCP prompt asks for them:

      1. App name + one-line purpose.
      2. Axis 1 \u2014 resources. Each resource, its fields, and relationships. Paste openapi.yaml if you already have it.
      3. Axis 2 \u2014 pipelines. Only if an input needs a multi-step transformation: the families and their input formats (or \"none\").
      4. Auth needed now? Default no. Auth is deferred (py-jwt primitives only), and an authless app is just a spec with no security keys \u2014 see Spec-First Routing \u2192 Authless apps.
      5. Integrations. Mongo, ingestion formats, email, LLM provider.

      If you can state axes 1 and 2, the rest is mechanical.

      "},{"location":"03_start_an_app/#how-to-start","title":"\u25b6\ufe0f How to start","text":"

      From an MCP client connected to the standards server:

      1. Invoke the intake prompt (or start_app with no arguments) to get the intake questions.
      2. Answer them, then invoke build (build(app_name=..., resources=..., pipelines=..., auth=...)), or use start_app to intake-and-build in one call.
      3. The prompt hands off to docs://modules/build_recipe; the agent scaffolds with get_app_template() and pulls exact files with get_app_component(kind, resource=..., family=...), authoring only the app-specific parts.
      4. To validate the standard without touching a real app, invoke trial (trial(app_name=..., build_path=...)) to build into a scratch directory, prove it builds, and report findings.

      Manual alternative \u2014 copy the skeleton and follow the reference recipe:

      cp -r <docs>/standards/src/templates/app apps/<your-app>\n
      "},{"location":"03_start_an_app/#reference","title":"\ud83d\udcda Reference","text":"
      • Build Recipe \u2014 the deterministic checklist
      • Genericity Matrix \u2014 Tier A / B / C
      • Library Registry \u2014 the Tier A catalog
      • App Components \u2014 the component model
      "},{"location":"03_start_an_app/#related","title":"Related","text":"
      • 01 \u2013 Overview \u00b7 02 \u2013 App Components \u00b7 04 \u2013 Testing & Quality
      "},{"location":"05_mcp_setup/","title":"\ud83d\udd0c MCP Setup","text":"

      Every repository ships its documentation as a Model Context Protocol (MCP) server, and the standards registry server ties them together. The docs portal runs each one as a FastMCP streamable-http app bound to 0.0.0.0:<port>, exposing the endpoint at /mcp (see docs/main.py and docs/config.yml).

      Connect your agent to the standards server first: it answers find_library, list_repos, and the start_app prompt, so the agent reaches for an internal library instead of reimplementing one (see the Library Registry).

      "},{"location":"05_mcp_setup/#run-the-servers-locally","title":"\u25b6\ufe0f Run the servers locally","text":"

      From the docs checkout:

      .venv\\Scripts\\python.exe main.py                      # every server\n.venv\\Scripts\\python.exe main.py --servers standards   # just the registry\n

      :8000 is the health endpoint (GET /healthz), not an MCP server.

      "},{"location":"05_mcp_setup/#servers","title":"\ud83e\udded Servers","text":"Slug MCP server Port localhost mcp.aetoskia.com standards standards 8009 http://localhost:8009/mcp https://mcp.aetoskia.com/standards/mcp doc-forge docforge 8001 http://localhost:8001/mcp https://mcp.aetoskia.com/doc-forge/mcp mail-intake mail_intake 8002 http://localhost:8002/mcp https://mcp.aetoskia.com/mail-intake/mcp omniread omniread 8003 http://localhost:8003/mcp https://mcp.aetoskia.com/omniread/mcp openapi-first openapi_first 8004 http://localhost:8004/mcp https://mcp.aetoskia.com/openapi-first/mcp py-jwt jwtlib 8005 http://localhost:8005/mcp https://mcp.aetoskia.com/py-jwt/mcp dagpipe dagpipe 8006 http://localhost:8006/mcp https://mcp.aetoskia.com/dagpipe/mcp mongo-ops mongo_ops 8007 http://localhost:8007/mcp https://mcp.aetoskia.com/mongo-ops/mcp hexa hexa 8008 http://localhost:8008/mcp https://mcp.aetoskia.com/hexa/mcp doc-weaver doc-weaver 8010 http://localhost:8010/mcp https://mcp.aetoskia.com/doc-weaver/mcp react-auth react-auth 8011 http://localhost:8011/mcp https://mcp.aetoskia.com/react-auth/mcp react-openapi react-openapi 8012 http://localhost:8012/mcp https://mcp.aetoskia.com/react-openapi/mcp

      The hosted endpoints are served over HTTPS at https://mcp.aetoskia.com/<slug>/mcp. The tabs below are linked (content.tabs.link): switching one switches all of them. Every snippet registers all twelve servers, so a single paste is enough.

      "},{"location":"05_mcp_setup/#claude-code","title":"\ud83e\udd16 Claude Code","text":"

      Project-scoped .mcp.json at the repo root. The type field is required \u2014 an entry with a url but no type is read as a stdio server and skipped.

      localhostmcp.aetoskia.com
      {\n  \"mcpServers\": {\n    \"standards\": { \"type\": \"http\", \"url\": \"http://localhost:8009/mcp\" },\n    \"doc-forge\": { \"type\": \"http\", \"url\": \"http://localhost:8001/mcp\" },\n    \"mail-intake\": { \"type\": \"http\", \"url\": \"http://localhost:8002/mcp\" },\n    \"omniread\": { \"type\": \"http\", \"url\": \"http://localhost:8003/mcp\" },\n    \"openapi-first\": { \"type\": \"http\", \"url\": \"http://localhost:8004/mcp\" },\n    \"py-jwt\": { \"type\": \"http\", \"url\": \"http://localhost:8005/mcp\" },\n    \"dagpipe\": { \"type\": \"http\", \"url\": \"http://localhost:8006/mcp\" },\n    \"mongo-ops\": { \"type\": \"http\", \"url\": \"http://localhost:8007/mcp\" },\n    \"hexa\": { \"type\": \"http\", \"url\": \"http://localhost:8008/mcp\" },\n    \"doc-weaver\": { \"type\": \"http\", \"url\": \"http://localhost:8010/mcp\" },\n    \"react-auth\": { \"type\": \"http\", \"url\": \"http://localhost:8011/mcp\" },\n    \"react-openapi\": { \"type\": \"http\", \"url\": \"http://localhost:8012/mcp\" }\n  }\n}\n
      {\n  \"mcpServers\": {\n    \"standards\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n    \"doc-forge\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n    \"mail-intake\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n    \"omniread\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n    \"openapi-first\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n    \"py-jwt\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n    \"dagpipe\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n    \"mongo-ops\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n    \"hexa\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n    \"doc-weaver\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n    \"react-auth\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n    \"react-openapi\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n  }\n}\n

      Or add them with the CLI: claude mcp add --transport http standards http://localhost:8009/mcp.

      "},{"location":"05_mcp_setup/#codex","title":"\ud83e\udd16 Codex","text":"

      ~/.codex/config.toml (or a project-scoped .codex/config.toml).

      localhostmcp.aetoskia.com
      [mcp_servers.standards]\nurl = \"http://localhost:8009/mcp\"\n\n[mcp_servers.doc-forge]\nurl = \"http://localhost:8001/mcp\"\n\n[mcp_servers.mail-intake]\nurl = \"http://localhost:8002/mcp\"\n\n[mcp_servers.omniread]\nurl = \"http://localhost:8003/mcp\"\n\n[mcp_servers.openapi-first]\nurl = \"http://localhost:8004/mcp\"\n\n[mcp_servers.py-jwt]\nurl = \"http://localhost:8005/mcp\"\n\n[mcp_servers.dagpipe]\nurl = \"http://localhost:8006/mcp\"\n\n[mcp_servers.mongo-ops]\nurl = \"http://localhost:8007/mcp\"\n\n[mcp_servers.hexa]\nurl = \"http://localhost:8008/mcp\"\n\n[mcp_servers.doc-weaver]\nurl = \"http://localhost:8010/mcp\"\n\n[mcp_servers.react-auth]\nurl = \"http://localhost:8011/mcp\"\n\n[mcp_servers.react-openapi]\nurl = \"http://localhost:8012/mcp\"\n
      [mcp_servers.standards]\nurl = \"https://mcp.aetoskia.com/standards/mcp\"\n\n[mcp_servers.doc-forge]\nurl = \"https://mcp.aetoskia.com/doc-forge/mcp\"\n\n[mcp_servers.mail-intake]\nurl = \"https://mcp.aetoskia.com/mail-intake/mcp\"\n\n[mcp_servers.omniread]\nurl = \"https://mcp.aetoskia.com/omniread/mcp\"\n\n[mcp_servers.openapi-first]\nurl = \"https://mcp.aetoskia.com/openapi-first/mcp\"\n\n[mcp_servers.py-jwt]\nurl = \"https://mcp.aetoskia.com/py-jwt/mcp\"\n\n[mcp_servers.dagpipe]\nurl = \"https://mcp.aetoskia.com/dagpipe/mcp\"\n\n[mcp_servers.mongo-ops]\nurl = \"https://mcp.aetoskia.com/mongo-ops/mcp\"\n\n[mcp_servers.hexa]\nurl = \"https://mcp.aetoskia.com/hexa/mcp\"\n\n[mcp_servers.doc-weaver]\nurl = \"https://mcp.aetoskia.com/doc-weaver/mcp\"\n\n[mcp_servers.react-auth]\nurl = \"https://mcp.aetoskia.com/react-auth/mcp\"\n\n[mcp_servers.react-openapi]\nurl = \"https://mcp.aetoskia.com/react-openapi/mcp\"\n

      Or add them with the CLI: codex mcp add standards --url http://localhost:8009/mcp.

      "},{"location":"05_mcp_setup/#antigravity","title":"\ud83e\udd16 Antigravity","text":"

      ~/.gemini/antigravity/mcp_config.json (IDE) or ~/.gemini/config/mcp_config.json (CLI). Antigravity uses serverUrl, not url, for HTTP endpoints.

      localhostmcp.aetoskia.com
      {\n  \"mcpServers\": {\n    \"standards\": { \"serverUrl\": \"http://localhost:8009/mcp\" },\n    \"doc-forge\": { \"serverUrl\": \"http://localhost:8001/mcp\" },\n    \"mail-intake\": { \"serverUrl\": \"http://localhost:8002/mcp\" },\n    \"omniread\": { \"serverUrl\": \"http://localhost:8003/mcp\" },\n    \"openapi-first\": { \"serverUrl\": \"http://localhost:8004/mcp\" },\n    \"py-jwt\": { \"serverUrl\": \"http://localhost:8005/mcp\" },\n    \"dagpipe\": { \"serverUrl\": \"http://localhost:8006/mcp\" },\n    \"mongo-ops\": { \"serverUrl\": \"http://localhost:8007/mcp\" },\n    \"hexa\": { \"serverUrl\": \"http://localhost:8008/mcp\" },\n    \"doc-weaver\": { \"serverUrl\": \"http://localhost:8010/mcp\" },\n    \"react-auth\": { \"serverUrl\": \"http://localhost:8011/mcp\" },\n    \"react-openapi\": { \"serverUrl\": \"http://localhost:8012/mcp\" }\n  }\n}\n
      {\n  \"mcpServers\": {\n    \"standards\": { \"serverUrl\": \"https://mcp.aetoskia.com/standards/mcp\" },\n    \"doc-forge\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n    \"mail-intake\": { \"serverUrl\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n    \"omniread\": { \"serverUrl\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n    \"openapi-first\": { \"serverUrl\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n    \"py-jwt\": { \"serverUrl\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n    \"dagpipe\": { \"serverUrl\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n    \"mongo-ops\": { \"serverUrl\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n    \"hexa\": { \"serverUrl\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n    \"doc-weaver\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n    \"react-auth\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n    \"react-openapi\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n  }\n}\n
      "},{"location":"05_mcp_setup/#opencode","title":"\ud83e\udd16 OpenCode","text":"

      opencode.json (project) or ~/.config/opencode/opencode.json (global).

      localhostmcp.aetoskia.com
      {\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"standards\": { \"type\": \"remote\", \"url\": \"http://localhost:8009/mcp\", \"enabled\": true },\n    \"doc-forge\": { \"type\": \"remote\", \"url\": \"http://localhost:8001/mcp\", \"enabled\": true },\n    \"mail-intake\": { \"type\": \"remote\", \"url\": \"http://localhost:8002/mcp\", \"enabled\": true },\n    \"omniread\": { \"type\": \"remote\", \"url\": \"http://localhost:8003/mcp\", \"enabled\": true },\n    \"openapi-first\": { \"type\": \"remote\", \"url\": \"http://localhost:8004/mcp\", \"enabled\": true },\n    \"py-jwt\": { \"type\": \"remote\", \"url\": \"http://localhost:8005/mcp\", \"enabled\": true },\n    \"dagpipe\": { \"type\": \"remote\", \"url\": \"http://localhost:8006/mcp\", \"enabled\": true },\n    \"mongo-ops\": { \"type\": \"remote\", \"url\": \"http://localhost:8007/mcp\", \"enabled\": true },\n    \"hexa\": { \"type\": \"remote\", \"url\": \"http://localhost:8008/mcp\", \"enabled\": true },\n    \"doc-weaver\": { \"type\": \"remote\", \"url\": \"http://localhost:8010/mcp\", \"enabled\": true },\n    \"react-auth\": { \"type\": \"remote\", \"url\": \"http://localhost:8011/mcp\", \"enabled\": true },\n    \"react-openapi\": { \"type\": \"remote\", \"url\": \"http://localhost:8012/mcp\", \"enabled\": true }\n  }\n}\n
      {\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"standards\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\", \"enabled\": true },\n    \"doc-forge\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\", \"enabled\": true },\n    \"mail-intake\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\", \"enabled\": true },\n    \"omniread\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\", \"enabled\": true },\n    \"openapi-first\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\", \"enabled\": true },\n    \"py-jwt\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\", \"enabled\": true },\n    \"dagpipe\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\", \"enabled\": true },\n    \"mongo-ops\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\", \"enabled\": true },\n    \"hexa\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\", \"enabled\": true },\n    \"doc-weaver\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\", \"enabled\": true },\n    \"react-auth\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\", \"enabled\": true },\n    \"react-openapi\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\", \"enabled\": true }\n  }\n}\n

      Or add them with the CLI: opencode mcp add standards --url http://localhost:8009/mcp --global.

      "},{"location":"05_mcp_setup/#pycharm-junie-ai-assistant","title":"\ud83e\udd16 PyCharm (Junie / AI Assistant)","text":"

      ~/.junie/mcp/mcp.json (user scope) or .junie/mcp/mcp.json (project scope). The same config is reachable from Settings | Tools | MCP Server \u2192 Manual Client Configuration \u2192 Copy HTTP Stream Config.

      localhostmcp.aetoskia.com
      {\n  \"mcpServers\": {\n    \"standards\": { \"url\": \"http://localhost:8009/mcp\" },\n    \"doc-forge\": { \"url\": \"http://localhost:8001/mcp\" },\n    \"mail-intake\": { \"url\": \"http://localhost:8002/mcp\" },\n    \"omniread\": { \"url\": \"http://localhost:8003/mcp\" },\n    \"openapi-first\": { \"url\": \"http://localhost:8004/mcp\" },\n    \"py-jwt\": { \"url\": \"http://localhost:8005/mcp\" },\n    \"dagpipe\": { \"url\": \"http://localhost:8006/mcp\" },\n    \"mongo-ops\": { \"url\": \"http://localhost:8007/mcp\" },\n    \"hexa\": { \"url\": \"http://localhost:8008/mcp\" },\n    \"doc-weaver\": { \"url\": \"http://localhost:8010/mcp\" },\n    \"react-auth\": { \"url\": \"http://localhost:8011/mcp\" },\n    \"react-openapi\": { \"url\": \"http://localhost:8012/mcp\" }\n  }\n}\n
      {\n  \"mcpServers\": {\n    \"standards\": { \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n    \"doc-forge\": { \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n    \"mail-intake\": { \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n    \"omniread\": { \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n    \"openapi-first\": { \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n    \"py-jwt\": { \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n    \"dagpipe\": { \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n    \"mongo-ops\": { \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n    \"hexa\": { \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n    \"doc-weaver\": { \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n    \"react-auth\": { \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n    \"react-openapi\": { \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n  }\n}\n
      "},{"location":"05_mcp_setup/#verify","title":"\u2705 Verify","text":"
      • Health check: curl http://localhost:8000/healthz \u2192 ok.
      • Claude Code: claude mcp list \u2192 each server \u2026 \u2713 Connected.
      • Codex: codex mcp list \u2192 each server \u2026 http.
      • OpenCode: opencode mcp list \u2192 each server \u2026 connected.
      • In-session: run /mcp to list the connected servers and their tools.
      "},{"location":"05_mcp_setup/#reference","title":"\ud83d\udcda Reference","text":"
      • Library Registry \u2014 the catalog each server mirrors, and where find_library resolves
      • Start an App \u2014 connect standards, then invoke start_app
      • App Components \u2014 the component model
      "},{"location":"05_mcp_setup/#related","title":"Related","text":"
      • Start an App \u00b7 Testing & Quality \u00b7 Library Registry
      "},{"location":"04_development/01_testing/","title":"Testing & Quality Gates","text":"

      Two suites run under pytest with asyncio auto mode: integration (the HTTP edge against fakes) and unit (pure domain and pipeline logic). Finish a blueprint app only when every gate below passes.

      "},{"location":"04_development/01_testing/#layout","title":"\ud83d\uddc2\ufe0f Layout","text":"
      tests/\n    integration/     # TestClient(app) + mocked resources\n    unit/            # models, converters, pipeline stages/roots\n    conftest.py      # fixtures\n
      "},{"location":"04_development/01_testing/#integration-tests","title":"\ud83d\ude80 Integration tests","text":"
      • Build the app with TestClient.
      • Replace app.state.db_resources with fake repositories/services so no database is required.
      • Patch the auth introspection call (httpx.AsyncClient.post) to return a canned identity.
      • Assert status codes and bodies for list/get/create/update/delete, plus 400, 404, 204, and the streaming endpoint's fallback.
      client = TestClient(app)\napp.state.db_resources = {\"item_svc\": FakeItemService(), ...}\n\ndef test_create_item():\n    r = client.post(\"/items\", json={\"name\": \"x\"})\n    assert r.status_code == 200\n
      "},{"location":"04_development/01_testing/#unit-tests","title":"\ud83e\uddea Unit tests","text":"
      • Domain models and converters: pure, no I/O.
      • Pipeline stages: feed a fixture state, assert the transformed state.
      • Assembled pipeline roots: fixture parity \u2014 replay a stored fixture input and compare against a golden output file.
      "},{"location":"04_development/01_testing/#config-consistency-tests","title":"\ud83d\udd10 Config-consistency tests","text":"

      For rule-driven pipelines, add a test that cross-references rules against the declared pattern registry: every flag emitted must be defined; every defined flag must be reachable. This catches drift without running the pipeline.

      "},{"location":"04_development/01_testing/#quality-gates","title":"\u2705 Quality gates","text":"

      A definition of done for any standard app:

      • python -c \"import main\" succeeds.
      • pytest passes.
      • The app serves the spec's operations; the worker drains its queue.
      • No domain module imports a web framework.
      • No infrastructure was reimplemented that a library already provides.
      "},{"location":"04_development/01_testing/#conventions","title":"\ud83d\udca1 Conventions","text":"
      • asyncio_mode = \"auto\"; no manual event loops.
      • Fixtures are checked into the repo (inputs + golden outputs).
      • Tests skip (not fail) when a required fixture is absent.
      • Do not mock the domain; mock only the infrastructure edge.
      "},{"location":"04_development/01_testing/#related","title":"Related","text":"
      • 02 \u2013 App Components \u00b7 03 \u2013 Start an App \u00b7 Overview
      "},{"location":"04_development/02_releasing/","title":"Releasing & Versioning","text":"

      How to cut a release of any Aetos repository. The rule lives in the reference page Versioning & Changelog; this is the runbook you follow.

      Every repository is one of two Drone shapes \u2014 a PyPI package or a Docker deployment (Drone Pipelines). Both release the same way: the version bump and changelog promotion go in the merge request, and the tag is created on the merged commit.

      "},{"location":"04_development/02_releasing/#before-you-start","title":"\ud83e\uddfe Before you start","text":"
      • You have an open merge request holding the change, and main is green (the Drone quality gate passed on the last run).
      • You know whether this is a breaking, feature, or fix release.
      • The version file exists:
      • package \u2192 version in pyproject.toml
      • service \u2192 VERSION at the repo root
      "},{"location":"04_development/02_releasing/#pick-the-next-version","title":"\ud83d\udea6 Pick the next version","text":"

      The version file and the tag must be identical. For 0.y.z, 0.y is the major line (see the reference page); once at 1.0.0, normal SemVer applies.

      Change 0.y.z \u2192 1.0.0+ \u2192 Breaking 0.(y+1).0 (x+1).0.0 Feature 0.y.(z+1) x.(y+1).0 Fix 0.y.(z+1) x.y.(z+1)"},{"location":"04_development/02_releasing/#release-in-the-mr","title":"\ud83c\udf3f Release in the MR","text":"

      The version is known while the change is still a merge request, so the bump rides along with it. Do all edits in the MR:

      • Reconcile the changelog first. [Unreleased] is a draft, not the source of truth: diff the change against the last tag (git log <last-tag>..HEAD, git diff --stat <last-tag>..HEAD) and add an entry for every user-facing change that is missing. Always show the proposed additions to the user and wait for approval before promoting \u2014 ask rather than guess when an entry is ambiguous.

      • Promote the changelog in CHANGELOG.md: move the (now reconciled) [Unreleased] content under a new ## [x.y.z] - YYYY-MM-DD heading, leave a fresh empty [Unreleased] on top, and add the compare links \u2014 naming the version/tag, never a commit id:

      [Unreleased]: https://git.aetoskia.com/aetos/<repo>/compare/x.y.z...HEAD\n[x.y.z]: https://git.aetoskia.com/aetos/<repo>/compare/x.y.(z-1)...x.y.z\n
      • Bump the version file to the intended release version: version = \"x.y.z\" in pyproject.toml (packages) or the VERSION file (services).
      "},{"location":"04_development/02_releasing/#tag-the-merged-commit","title":"\ud83c\udff7\ufe0f Tag the merged commit","text":"
      1. Merge or squash the MR into main.
      2. Create the tag on the resulting commit: git tag x.y.z (lightweight).
      3. Push the tag (git push origin x.y.z) \u2014 Drone builds the release.
      "},{"location":"04_development/02_releasing/#agent-assisted-tagging","title":"\ud83e\udd16 Agent-assisted tagging","text":"

      The agent does not author or merge the MR and never tags before the merge. After you confirm the MR is merged/squashed and tell it to proceed, the agent:

      1. Waits for that explicit go-ahead.
      2. Finds the commit that introduced the bump:
      3. package: git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml
      4. service: git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION
      5. Verifies that commit's version file equals x.y.z, then tags only that commit: git tag x.y.z <sha>.
      6. Does not push \u2014 it asks you to run git push origin x.y.z.
      "},{"location":"04_development/02_releasing/#what-drone-does","title":"\ud83e\udd16 What Drone does","text":"
      • Type A (package): asserts tag == pyproject version, then skips if that version already exists on the index, runs the quality gate, builds, and uploads the wheel + sdist.
      • Type B (service): asserts tag == VERSION, resolves the tag, skips if the image already exists, runs the quality gate, builds, pushes, and restarts the container.

      If the guard fails, nothing is published \u2014 fix the version file, amend the commit, and move the tag only if it was never pushed.

      "},{"location":"04_development/02_releasing/#backfill-recovery","title":"\ud83d\udedf Backfill / recovery","text":"

      If an older tag never published (a past version-file mismatch, an index outage):

      • Package: run the backfill-pypi-from-tags pipeline (custom event). It checks out every tag, verifies tag == pyproject version at that commit, and uploads the ones missing from the index. Already-fixed history is never rewritten.
      • Service: rebuild the image for the missing tag with a fresh commit and a new patch version; do not move a published tag.
      "},{"location":"04_development/02_releasing/#if-a-release-is-wrong","title":"\ud83d\udd01 If a release is wrong","text":"
      • Never reuse or force-move a pushed tag.
      • Fix forward: bump to the next patch, promote the changelog, tag again.
      "},{"location":"04_development/02_releasing/#related","title":"Related","text":"
      • Testing & Quality Gates \u00b7 Versioning & Changelog \u00b7 Drone Pipelines
      "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"\ud83e\udde9 Standards \u2014 the Aetos App Blueprint","text":"

      One reusable architecture for every backend application in the Aetos ecosystem: a spec-first HTTP edge, a framework-free domain core, a pluggable infrastructure layer, and a single composition root.

      Fill in two axes only and a new app is done: your resource model, and (if needed) your pipeline family. The blueprint itself never names a business domain \u2014 expenses, health metrics, inventory, and analytics are all the same shape underneath.

      Doc model: this wiki is written for humans \u2014 how-to guides, the build recipe, and quality gates. The enforceable rules (layering, composition root, CRUD template, pipeline scaffold) and the library registry live in the reference pages, mirrored by the machine-readable standards MCP bundle. Query find_library before writing any infrastructure.

      "},{"location":"#key-features","title":"\ud83d\ude80 Key Features","text":"
      • \ud83e\udded Spec-first routing \u2014 the OpenAPI document, not decorator routers, is the source of truth (operationId lookup)
      • \ud83c\udfd7\ufe0f One-way layering \u2014 interfaces \u2192 domain \u2192 infra, enforced
      • \ud83d\udd0c Single composition root \u2014 every dependency is wired in exactly one place
      • \ud83e\udde9 Generic, not app-specific \u2014 reusable rules versus two authoring axes
      • \ud83d\udcda Library-backed \u2014 DB, DI, pipelines, ingestion, auth, and docs come from internal libraries, never hand-written
      • \ud83d\udea6 Explicit state machines \u2014 durable job statuses, progress, and human-in-the-loop pauses
      "},{"location":"#documentation-structure","title":"\ud83d\udcc1 Documentation Structure","text":"Section Description Overview Philosophy, the one-way dependency rule, architecture App Components The component model and how the pieces wire together Start an App The entry point: gather the two axes, then build Testing & Quality Test layout and acceptance gates

      Reference (separate site, mirrors the MCP bundle): the enforceable anatomy \u2014 start at the Build Recipe, then the pillars: domains (Layering), the OpenAPI contract (Composition Root, Spec-First Routing, CRUD Template, Auth Integration), interfaces & infra (Infra Adapters), UI (Auto-Rendered Admin), the optional pipelines layer (Pipeline Scaffold, Worker & Progress, Human-in-the-Loop), and delivery/meta (Genericity Matrix, Library Registry).

      "},{"location":"#related-resources","title":"\ud83d\udd17 Related Resources","text":"
      • MCP bundle \u2014 standards server on :8009: read docs://index, docs://nav, docs://modules/{module}; call find_library(capability)
      • Library registry \u2014 the catalog of internal libraries behind every app (libraries.json, served as registry://libraries)
      • Template \u2014 the runnable skeleton at standards/src/templates/app/
      • Start a build \u2014 invoke the start_app prompt on the standards server, or read the Start an App guide

      \u00a9 Aetoskia Internal \u2014 standards

      "},{"location":"01_overview/","title":"Overview","text":"

      The blueprint is a hexagonal (ports & adapters) application with a spec-first web edge and a single composition root. It favors explicit wiring over implicit magic and existing internal libraries over hand-written infrastructure. Start here to build the mental model; the enforceable details live in the reference pages.

      "},{"location":"01_overview/#architecture","title":"\ud83c\udfd7\ufe0f Architecture","text":"
      flowchart LR\n    subgraph EDGE[\"interfaces/ \u2014 HTTP edge\"]\n        OAS[\"openapi.yaml<br/>operationId contract\"]\n        RT[\"<resource>/routes.py<br/>thin handlers\"]\n    end\n\n    subgraph CORE[\"domain/ \u2014 business core\"]\n        MD[\"models\"]\n        PT[\"ports (adapter binding seam)\"]\n        SV[\"services\"]\n    end\n\n    subgraph INFRA[\"infra/ \u2014 adapters\"]\n        RP[\"mongo repos (mongo-ops)\"]\n        AD[\"cache \u00b7 stores \u00b7 llm \u00b7 mail\"]\n        DB[(\"MongoDB\")]\n    end\n\n    CR[\"init.py<br/>composition root\"]\n\n    OAS --> RT\n    RT --> SV\n    SV --> PT\n    SV --> RP\n    PT -. depends on .- RP\n    CR --- RT\n    CR --- SV\n    CR --- RP\n    RP --> DB\n    AD --- CR

      The rule holds at every edge: code in an outer ring may depend on a ring closer to the core, never the reverse. domain/ never imports a web framework; only its ports/ seam reaches into infra/ to bind adapters.

      Legend \u2014 solid arrows are compile-time calls; dotted arrows are the port/adapter binding, performed by the composition root at startup.

      "},{"location":"01_overview/#the-one-way-dependency-rule","title":"\ud83d\udd04 The one-way dependency rule","text":"Ring May import Never imports interfaces/ domain, framework glue (glue only) business logic, infra directly domain/ its own models + its ports/ seam (which binds infra/libraries) web frameworks, interfaces/ infra/ domain ports, drivers, libraries \u2014 init.py everything (the wiring point) \u2014"},{"location":"01_overview/#core-principles","title":"\ud83e\udded Core principles","text":"
      1. One-way dependencies. interfaces -> domain -> infra is allowed; the reverse is forbidden.
      2. Ports in the domain, adapters in infra. A service depends on a port; the port's factory binds the concrete adapter, and the composition root calls those factories.
      3. One composition root. Nothing constructs its own dependencies. All wiring lives in one module (init.py) exposed as a flat resource registry.
      4. Spec-first. The HTTP contract is declared in openapi.yaml; route handlers are looked up by operationId. There are no decorator routers.
      5. Reuse the libraries. Orchestration, DI, Mongo repositories, ingestion, auth, and docs come from internal libraries \u2014 see the Library Registry.
      6. Explicit state machines. Long-running work moves through explicit, durable statuses and can pause for human input.
      "},{"location":"01_overview/#runtime-processes","title":"\u2699\ufe0f Runtime processes","text":"

      A standard app may run as up to three processes that share the same composition root:

      Process Entry point Responsibility API main.py serve HTTP; start/stop resources via lifespan Worker worker.py poll durable jobs, run pipelines, publish progress Scripts python -m scripts.<name> one-shot operator tasks"},{"location":"01_overview/#read-next","title":"\u27a1\ufe0f Read Next","text":"
      • 02 \u2013 App Components \u00b7 03 \u2013 Start an App
      "},{"location":"02_components/","title":"App Components","text":"

      What ships in every standard app, and how the pieces relate. This is the blueprint's component model \u2014 templates/app/ is a runnable instance of it.

      "},{"location":"02_components/#component-model","title":"\ud83d\uddc2\ufe0f Component model","text":"

      The blueprint has two orthogonal views: runtime flow (who calls whom) and composition-root wiring (who constructs whom). Keeping them separate makes the layering visible instead of hiding it behind a hub.

      "},{"location":"02_components/#runtime-flow","title":"\ud83d\udd00 Runtime flow","text":"

      Who calls whom at request and job time:

      %%{init: {\"flowchart\": {\"nodeSpacing\": 50, \"rankSpacing\": 80}}}%%\nflowchart TB\n    subgraph REQ[\"Request path \u2014 API process\"]\n        direction LR\n        CL([\"Client<br/>operationId\"]) --> RT[\"interfaces/&lt;resource&gt;/routes.py\"]\n        RT --> SVC[\"&lt;resource&gt;_svc\"]\n        SVC --> REPO[\"&lt;resource&gt;_repo\"]\n    end\n\n    subgraph WRK[\"Background path \u2014 worker process\"]\n        direction LR\n        W[\"worker.py\"] --> JSVC[\"job_svc\"]\n        W --> PIPE[\"pipelines/&lt;family&gt;\"]\n        PIPE --> ISVC[\"item_svc\"]\n        JSVC --> JREPO[\"job_repo\"]\n        ISVC --> IREPO[\"item_repo\"]\n    end\n\n    subgraph INFRA[\"infra/ \u2014 adapters\"]\n        MONGO[(\"MongoDB / mongo_ops\")]\n    end\n\n    REPO --> MONGO\n    JREPO --> MONGO\n    IREPO --> MONGO

      Legend \u2014 solid arrows are runtime calls. Nothing is self-constructed.

      "},{"location":"02_components/#composition-root-wiring","title":"\ud83e\uddf5 Composition-root wiring","text":"

      Who constructs what at startup:

      %%{init: {\"flowchart\": {\"nodeSpacing\": 50, \"rankSpacing\": 80}}}%%\nflowchart TB\n    INIT[\"init.py \u2014 composition root\"]\n    SETUP[\"infra/db/setup.py\"]\n    FACT[\"domain/*/ports/*<br/>factory seams\"]\n    REPOS[\"repos<br/>infra/db/repos/mongo.py\"]\n    SVCES[\"services<br/>CrudsServiceAdaptor\"]\n    STATE[\"app.state.db_resources\"]\n    HEXA[\"hexa.build\"]\n    RT[\"routes.py\"]\n    WK[\"worker.py\"]\n\n    INIT --> SETUP\n    INIT --> FACT\n    FACT --> REPOS\n    FACT --> SVCES\n    REPOS --> SVCES\n    HEXA -.-> SVCES\n    INIT --> STATE\n    STATE --> RT\n    INIT --> WK

      Legend \u2014 init.py is the only place that imports concrete adapters. The ports/ factory seams bind infra; the API reads resources from app.state.db_resources, the worker calls init() directly.

      "},{"location":"02_components/#component-roles","title":"\ud83d\udce6 Component roles","text":""},{"location":"02_components/#1-interfaces-the-edge","title":"1. interfaces/ \u2014 the edge","text":"

      Thin handlers bound to openapi.yaml operationIds. They parse the request, call a service, and shape the response. No business rules, no I/O.

      • interfaces/openapi.py re-exports every route module so the OpenAPI-first app can resolve handlers.
      • Routes may mount the cache decorator on read endpoints.
      "},{"location":"02_components/#2-domain-the-core","title":"2. domain/ \u2014 the core","text":"

      Models, ports, and services (use cases). No framework imports. The ports/ package is the one seam allowed to reach into infra/: each port module declares the document shape and a factory that binds the adapter.

      • <aggregate>/models.py \u2014 dataclasses, enums, document shapes.
      • <aggregate>/ports/db.py \u2014 document model + create_<aggregate>_repo().
      • <aggregate>/ports/service.py \u2014 service + get_<aggregate>_service(repo).
      • Services compose ports and enforce the business rules; the port factories bind the implementations, and the composition root calls them.
      "},{"location":"02_components/#3-infra-the-adapters","title":"3. infra/ \u2014 the adapters","text":"

      Concrete implementations of the domain ports plus cross-cutting infrastructure:

      • db/ \u2014 mongo-ops repositories and the connection lifecycle.
      • adapters/ \u2014 cache store, progress bus, storages, fetchers (library-backed).
      • Anything else the domain needs, implemented against its ports.
      "},{"location":"02_components/#4-pipelines-data-driven-families-optional","title":"4. pipelines/ \u2014 data-driven families (optional)","text":"

      Extraction and enrichment families, each a deterministic step chain (abc.py / impl.py / pipeline.yaml / resources/). Roots are registered in the pattern registry and driven either by a worker job or a CLI.

      "},{"location":"02_components/#5-workerpy-the-job-worker-optional","title":"5. worker.py \u2014 the job worker (optional)","text":"

      A separate process that polls durable job collections, runs pipeline roots, and publishes progress to the progress bus. It shares the same composition root as the API.

      "},{"location":"02_components/#6-initpy-the-composition-root","title":"6. init.py \u2014 the composition root","text":"

      The only place anything is constructed: leaf repositories \u2192 dependent repositories \u2192 services \u2192 adapters. Exposes get_svc overloads and starts / stops resources on the app lifespan.

      "},{"location":"02_components/#how-the-request-flows","title":"\ud83d\udd17 How the request flows","text":"
      sequenceDiagram\n    participant C as Client\n    participant R as route (interfaces)\n    participant S as service (port factory / adapter)\n    participant P as repo (infra)\n    participant DB as MongoDB\n\n    C->>R: POST /items (operationId)\n    R->>S: svc.create(payload)\n    S->>P: repo.insert(doc)\n    P->>DB: insert\n    DB-->>P: ack\n    P-->>S: doc\n    S-->>R: result\n    R-->>C: 200 JSON
      "},{"location":"02_components/#related","title":"Related","text":"
      • 01 \u2013 Overview \u00b7 03 \u2013 Start an App \u00b7 04 \u2013 Testing & Quality
      "},{"location":"03_start_an_app/","title":"\ud83d\ude80 Start an App","text":"

      This is the entry point for building a new application from the blueprint. The goal is one deterministic pass: you supply only the two axes, and the agent does the rest by reading the standards MCP, importing Tier A libraries, and copying Tier B template components.

      Doc model: this page is the human entry point. The deterministic, machine-facing checklist lives in the reference page Build Recipe, served as docs://modules/build_recipe.

      "},{"location":"03_start_an_app/#what-the-agent-needs-from-you","title":"\ud83e\uddfe What the agent needs from you","text":"

      Gather these before starting \u2014 the start_app MCP prompt asks for them:

      1. App name + one-line purpose.
      2. Axis 1 \u2014 resources. Each resource, its fields, and relationships. Paste openapi.yaml if you already have it.
      3. Axis 2 \u2014 pipelines. Only if an input needs a multi-step transformation: the families and their input formats (or \"none\").
      4. Auth needed now? Default no. Auth is deferred (py-jwt primitives only), and an authless app is just a spec with no security keys \u2014 see Spec-First Routing \u2192 Authless apps.
      5. Integrations. Mongo, ingestion formats, email, LLM provider.

      If you can state axes 1 and 2, the rest is mechanical.

      "},{"location":"03_start_an_app/#how-to-start","title":"\u25b6\ufe0f How to start","text":"

      From an MCP client connected to the standards server:

      1. Invoke the intake prompt (or start_app with no arguments) to get the intake questions.
      2. Answer them, then invoke build (build(app_name=..., resources=..., pipelines=..., auth=...)), or use start_app to intake-and-build in one call.
      3. The prompt hands off to docs://modules/build_recipe; the agent scaffolds with get_app_template() and pulls exact files with get_app_component(kind, resource=..., family=...), authoring only the app-specific parts.
      4. To validate the standard without touching a real app, invoke trial (trial(app_name=..., build_path=...)) to build into a scratch directory, prove it builds, and report findings.

      Manual alternative \u2014 copy the skeleton and follow the reference recipe:

      cp -r <docs>/standards/src/templates/app apps/<your-app>\n
      "},{"location":"03_start_an_app/#reference","title":"\ud83d\udcda Reference","text":"
      • Build Recipe \u2014 the deterministic checklist
      • Genericity Matrix \u2014 Tier A / B / C
      • Library Registry \u2014 the Tier A catalog
      • App Components \u2014 the component model
      "},{"location":"03_start_an_app/#related","title":"Related","text":"
      • 01 \u2013 Overview \u00b7 02 \u2013 App Components \u00b7 04 \u2013 Testing & Quality
      "},{"location":"05_mcp_setup/","title":"\ud83d\udd0c MCP Setup","text":"

      Every repository ships its documentation as a Model Context Protocol (MCP) server, and the standards registry server ties them together. The docs portal runs each one as a FastMCP streamable-http app bound to 0.0.0.0:<port>, exposing the endpoint at /mcp (see docs/main.py and docs/config.yml).

      Connect your agent to the standards server first: it answers find_library, list_repos, and the start_app prompt, so the agent reaches for an internal library instead of reimplementing one (see the Library Registry).

      "},{"location":"05_mcp_setup/#run-the-servers-locally","title":"\u25b6\ufe0f Run the servers locally","text":"

      From the docs checkout:

      .venv\\Scripts\\python.exe main.py                      # every server\n.venv\\Scripts\\python.exe main.py --servers standards   # just the registry\n

      :8000 is the health endpoint (GET /healthz), not an MCP server.

      "},{"location":"05_mcp_setup/#servers","title":"\ud83e\udded Servers","text":"Slug MCP server Port localhost mcp.aetoskia.com standards standards 8009 http://localhost:8009/mcp https://mcp.aetoskia.com/standards/mcp doc-forge docforge 8001 http://localhost:8001/mcp https://mcp.aetoskia.com/doc-forge/mcp mail-intake mail_intake 8002 http://localhost:8002/mcp https://mcp.aetoskia.com/mail-intake/mcp omniread omniread 8003 http://localhost:8003/mcp https://mcp.aetoskia.com/omniread/mcp openapi-first openapi_first 8004 http://localhost:8004/mcp https://mcp.aetoskia.com/openapi-first/mcp py-jwt jwtlib 8005 http://localhost:8005/mcp https://mcp.aetoskia.com/py-jwt/mcp dagpipe dagpipe 8006 http://localhost:8006/mcp https://mcp.aetoskia.com/dagpipe/mcp mongo-ops mongo_ops 8007 http://localhost:8007/mcp https://mcp.aetoskia.com/mongo-ops/mcp hexa hexa 8008 http://localhost:8008/mcp https://mcp.aetoskia.com/hexa/mcp doc-weaver doc-weaver 8010 http://localhost:8010/mcp https://mcp.aetoskia.com/doc-weaver/mcp react-auth react-auth 8011 http://localhost:8011/mcp https://mcp.aetoskia.com/react-auth/mcp react-openapi react-openapi 8012 http://localhost:8012/mcp https://mcp.aetoskia.com/react-openapi/mcp

      The hosted endpoints are served over HTTPS at https://mcp.aetoskia.com/<slug>/mcp. The tabs below are linked (content.tabs.link): switching one switches all of them. Every snippet registers all twelve servers, so a single paste is enough.

      "},{"location":"05_mcp_setup/#claude-code","title":"\ud83e\udd16 Claude Code","text":"

      Project-scoped .mcp.json at the repo root. The type field is required \u2014 an entry with a url but no type is read as a stdio server and skipped.

      localhostmcp.aetoskia.com
      {\n  \"mcpServers\": {\n    \"standards\": { \"type\": \"http\", \"url\": \"http://localhost:8009/mcp\" },\n    \"doc-forge\": { \"type\": \"http\", \"url\": \"http://localhost:8001/mcp\" },\n    \"mail-intake\": { \"type\": \"http\", \"url\": \"http://localhost:8002/mcp\" },\n    \"omniread\": { \"type\": \"http\", \"url\": \"http://localhost:8003/mcp\" },\n    \"openapi-first\": { \"type\": \"http\", \"url\": \"http://localhost:8004/mcp\" },\n    \"py-jwt\": { \"type\": \"http\", \"url\": \"http://localhost:8005/mcp\" },\n    \"dagpipe\": { \"type\": \"http\", \"url\": \"http://localhost:8006/mcp\" },\n    \"mongo-ops\": { \"type\": \"http\", \"url\": \"http://localhost:8007/mcp\" },\n    \"hexa\": { \"type\": \"http\", \"url\": \"http://localhost:8008/mcp\" },\n    \"doc-weaver\": { \"type\": \"http\", \"url\": \"http://localhost:8010/mcp\" },\n    \"react-auth\": { \"type\": \"http\", \"url\": \"http://localhost:8011/mcp\" },\n    \"react-openapi\": { \"type\": \"http\", \"url\": \"http://localhost:8012/mcp\" }\n  }\n}\n
      {\n  \"mcpServers\": {\n    \"standards\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n    \"doc-forge\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n    \"mail-intake\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n    \"omniread\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n    \"openapi-first\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n    \"py-jwt\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n    \"dagpipe\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n    \"mongo-ops\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n    \"hexa\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n    \"doc-weaver\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n    \"react-auth\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n    \"react-openapi\": { \"type\": \"http\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n  }\n}\n

      Or add them with the CLI: claude mcp add --transport http standards http://localhost:8009/mcp.

      "},{"location":"05_mcp_setup/#codex","title":"\ud83e\udd16 Codex","text":"

      ~/.codex/config.toml (or a project-scoped .codex/config.toml).

      localhostmcp.aetoskia.com
      [mcp_servers.standards]\nurl = \"http://localhost:8009/mcp\"\n\n[mcp_servers.doc-forge]\nurl = \"http://localhost:8001/mcp\"\n\n[mcp_servers.mail-intake]\nurl = \"http://localhost:8002/mcp\"\n\n[mcp_servers.omniread]\nurl = \"http://localhost:8003/mcp\"\n\n[mcp_servers.openapi-first]\nurl = \"http://localhost:8004/mcp\"\n\n[mcp_servers.py-jwt]\nurl = \"http://localhost:8005/mcp\"\n\n[mcp_servers.dagpipe]\nurl = \"http://localhost:8006/mcp\"\n\n[mcp_servers.mongo-ops]\nurl = \"http://localhost:8007/mcp\"\n\n[mcp_servers.hexa]\nurl = \"http://localhost:8008/mcp\"\n\n[mcp_servers.doc-weaver]\nurl = \"http://localhost:8010/mcp\"\n\n[mcp_servers.react-auth]\nurl = \"http://localhost:8011/mcp\"\n\n[mcp_servers.react-openapi]\nurl = \"http://localhost:8012/mcp\"\n
      [mcp_servers.standards]\nurl = \"https://mcp.aetoskia.com/standards/mcp\"\n\n[mcp_servers.doc-forge]\nurl = \"https://mcp.aetoskia.com/doc-forge/mcp\"\n\n[mcp_servers.mail-intake]\nurl = \"https://mcp.aetoskia.com/mail-intake/mcp\"\n\n[mcp_servers.omniread]\nurl = \"https://mcp.aetoskia.com/omniread/mcp\"\n\n[mcp_servers.openapi-first]\nurl = \"https://mcp.aetoskia.com/openapi-first/mcp\"\n\n[mcp_servers.py-jwt]\nurl = \"https://mcp.aetoskia.com/py-jwt/mcp\"\n\n[mcp_servers.dagpipe]\nurl = \"https://mcp.aetoskia.com/dagpipe/mcp\"\n\n[mcp_servers.mongo-ops]\nurl = \"https://mcp.aetoskia.com/mongo-ops/mcp\"\n\n[mcp_servers.hexa]\nurl = \"https://mcp.aetoskia.com/hexa/mcp\"\n\n[mcp_servers.doc-weaver]\nurl = \"https://mcp.aetoskia.com/doc-weaver/mcp\"\n\n[mcp_servers.react-auth]\nurl = \"https://mcp.aetoskia.com/react-auth/mcp\"\n\n[mcp_servers.react-openapi]\nurl = \"https://mcp.aetoskia.com/react-openapi/mcp\"\n

      Or add them with the CLI: codex mcp add standards --url http://localhost:8009/mcp.

      "},{"location":"05_mcp_setup/#antigravity","title":"\ud83e\udd16 Antigravity","text":"

      ~/.gemini/antigravity/mcp_config.json (IDE) or ~/.gemini/config/mcp_config.json (CLI). Antigravity uses serverUrl, not url, for HTTP endpoints.

      localhostmcp.aetoskia.com
      {\n  \"mcpServers\": {\n    \"standards\": { \"serverUrl\": \"http://localhost:8009/mcp\" },\n    \"doc-forge\": { \"serverUrl\": \"http://localhost:8001/mcp\" },\n    \"mail-intake\": { \"serverUrl\": \"http://localhost:8002/mcp\" },\n    \"omniread\": { \"serverUrl\": \"http://localhost:8003/mcp\" },\n    \"openapi-first\": { \"serverUrl\": \"http://localhost:8004/mcp\" },\n    \"py-jwt\": { \"serverUrl\": \"http://localhost:8005/mcp\" },\n    \"dagpipe\": { \"serverUrl\": \"http://localhost:8006/mcp\" },\n    \"mongo-ops\": { \"serverUrl\": \"http://localhost:8007/mcp\" },\n    \"hexa\": { \"serverUrl\": \"http://localhost:8008/mcp\" },\n    \"doc-weaver\": { \"serverUrl\": \"http://localhost:8010/mcp\" },\n    \"react-auth\": { \"serverUrl\": \"http://localhost:8011/mcp\" },\n    \"react-openapi\": { \"serverUrl\": \"http://localhost:8012/mcp\" }\n  }\n}\n
      {\n  \"mcpServers\": {\n    \"standards\": { \"serverUrl\": \"https://mcp.aetoskia.com/standards/mcp\" },\n    \"doc-forge\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n    \"mail-intake\": { \"serverUrl\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n    \"omniread\": { \"serverUrl\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n    \"openapi-first\": { \"serverUrl\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n    \"py-jwt\": { \"serverUrl\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n    \"dagpipe\": { \"serverUrl\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n    \"mongo-ops\": { \"serverUrl\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n    \"hexa\": { \"serverUrl\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n    \"doc-weaver\": { \"serverUrl\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n    \"react-auth\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n    \"react-openapi\": { \"serverUrl\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n  }\n}\n
      "},{"location":"05_mcp_setup/#opencode","title":"\ud83e\udd16 OpenCode","text":"

      opencode.json (project) or ~/.config/opencode/opencode.json (global).

      localhostmcp.aetoskia.com
      {\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"standards\": { \"type\": \"remote\", \"url\": \"http://localhost:8009/mcp\", \"enabled\": true },\n    \"doc-forge\": { \"type\": \"remote\", \"url\": \"http://localhost:8001/mcp\", \"enabled\": true },\n    \"mail-intake\": { \"type\": \"remote\", \"url\": \"http://localhost:8002/mcp\", \"enabled\": true },\n    \"omniread\": { \"type\": \"remote\", \"url\": \"http://localhost:8003/mcp\", \"enabled\": true },\n    \"openapi-first\": { \"type\": \"remote\", \"url\": \"http://localhost:8004/mcp\", \"enabled\": true },\n    \"py-jwt\": { \"type\": \"remote\", \"url\": \"http://localhost:8005/mcp\", \"enabled\": true },\n    \"dagpipe\": { \"type\": \"remote\", \"url\": \"http://localhost:8006/mcp\", \"enabled\": true },\n    \"mongo-ops\": { \"type\": \"remote\", \"url\": \"http://localhost:8007/mcp\", \"enabled\": true },\n    \"hexa\": { \"type\": \"remote\", \"url\": \"http://localhost:8008/mcp\", \"enabled\": true },\n    \"doc-weaver\": { \"type\": \"remote\", \"url\": \"http://localhost:8010/mcp\", \"enabled\": true },\n    \"react-auth\": { \"type\": \"remote\", \"url\": \"http://localhost:8011/mcp\", \"enabled\": true },\n    \"react-openapi\": { \"type\": \"remote\", \"url\": \"http://localhost:8012/mcp\", \"enabled\": true }\n  }\n}\n
      {\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"standards\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/standards/mcp\", \"enabled\": true },\n    \"doc-forge\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\", \"enabled\": true },\n    \"mail-intake\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\", \"enabled\": true },\n    \"omniread\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/omniread/mcp\", \"enabled\": true },\n    \"openapi-first\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\", \"enabled\": true },\n    \"py-jwt\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\", \"enabled\": true },\n    \"dagpipe\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\", \"enabled\": true },\n    \"mongo-ops\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\", \"enabled\": true },\n    \"hexa\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/hexa/mcp\", \"enabled\": true },\n    \"doc-weaver\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\", \"enabled\": true },\n    \"react-auth\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\", \"enabled\": true },\n    \"react-openapi\": { \"type\": \"remote\", \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\", \"enabled\": true }\n  }\n}\n

      Or add them with the CLI: opencode mcp add standards --url http://localhost:8009/mcp --global.

      "},{"location":"05_mcp_setup/#pycharm-junie-ai-assistant","title":"\ud83e\udd16 PyCharm (Junie / AI Assistant)","text":"

      ~/.junie/mcp/mcp.json (user scope) or .junie/mcp/mcp.json (project scope). The same config is reachable from Settings | Tools | MCP Server \u2192 Manual Client Configuration \u2192 Copy HTTP Stream Config.

      localhostmcp.aetoskia.com
      {\n  \"mcpServers\": {\n    \"standards\": { \"url\": \"http://localhost:8009/mcp\" },\n    \"doc-forge\": { \"url\": \"http://localhost:8001/mcp\" },\n    \"mail-intake\": { \"url\": \"http://localhost:8002/mcp\" },\n    \"omniread\": { \"url\": \"http://localhost:8003/mcp\" },\n    \"openapi-first\": { \"url\": \"http://localhost:8004/mcp\" },\n    \"py-jwt\": { \"url\": \"http://localhost:8005/mcp\" },\n    \"dagpipe\": { \"url\": \"http://localhost:8006/mcp\" },\n    \"mongo-ops\": { \"url\": \"http://localhost:8007/mcp\" },\n    \"hexa\": { \"url\": \"http://localhost:8008/mcp\" },\n    \"doc-weaver\": { \"url\": \"http://localhost:8010/mcp\" },\n    \"react-auth\": { \"url\": \"http://localhost:8011/mcp\" },\n    \"react-openapi\": { \"url\": \"http://localhost:8012/mcp\" }\n  }\n}\n
      {\n  \"mcpServers\": {\n    \"standards\": { \"url\": \"https://mcp.aetoskia.com/standards/mcp\" },\n    \"doc-forge\": { \"url\": \"https://mcp.aetoskia.com/doc-forge/mcp\" },\n    \"mail-intake\": { \"url\": \"https://mcp.aetoskia.com/mail-intake/mcp\" },\n    \"omniread\": { \"url\": \"https://mcp.aetoskia.com/omniread/mcp\" },\n    \"openapi-first\": { \"url\": \"https://mcp.aetoskia.com/openapi-first/mcp\" },\n    \"py-jwt\": { \"url\": \"https://mcp.aetoskia.com/py-jwt/mcp\" },\n    \"dagpipe\": { \"url\": \"https://mcp.aetoskia.com/dagpipe/mcp\" },\n    \"mongo-ops\": { \"url\": \"https://mcp.aetoskia.com/mongo-ops/mcp\" },\n    \"hexa\": { \"url\": \"https://mcp.aetoskia.com/hexa/mcp\" },\n    \"doc-weaver\": { \"url\": \"https://mcp.aetoskia.com/doc-weaver/mcp\" },\n    \"react-auth\": { \"url\": \"https://mcp.aetoskia.com/react-auth/mcp\" },\n    \"react-openapi\": { \"url\": \"https://mcp.aetoskia.com/react-openapi/mcp\" }\n  }\n}\n
      "},{"location":"05_mcp_setup/#verify","title":"\u2705 Verify","text":"
      • Health check: curl http://localhost:8000/healthz \u2192 ok.
      • Claude Code: claude mcp list \u2192 each server \u2026 \u2713 Connected.
      • Codex: codex mcp list \u2192 each server \u2026 http.
      • OpenCode: opencode mcp list \u2192 each server \u2026 connected.
      • In-session: run /mcp to list the connected servers and their tools.
      "},{"location":"05_mcp_setup/#reference","title":"\ud83d\udcda Reference","text":"
      • Library Registry \u2014 the catalog each server mirrors, and where find_library resolves
      • Start an App \u2014 connect standards, then invoke start_app
      • App Components \u2014 the component model
      "},{"location":"05_mcp_setup/#related","title":"Related","text":"
      • Start an App \u00b7 Testing & Quality \u00b7 Library Registry
      "},{"location":"04_development/01_testing/","title":"Testing & Quality Gates","text":"

      Two suites run under pytest with asyncio auto mode: integration (the HTTP edge against fakes) and unit (pure domain and pipeline logic). Finish a blueprint app only when every gate below passes.

      "},{"location":"04_development/01_testing/#layout","title":"\ud83d\uddc2\ufe0f Layout","text":"
      tests/\n    integration/     # TestClient(app) + mocked resources\n    unit/            # models, converters, pipeline stages/roots\n    conftest.py      # fixtures\n
      "},{"location":"04_development/01_testing/#integration-tests","title":"\ud83d\ude80 Integration tests","text":"
      • Build the app with TestClient.
      • Replace app.state.db_resources with fake repositories/services so no database is required.
      • Patch the auth introspection call (httpx.AsyncClient.post) to return a canned identity.
      • Assert status codes and bodies for list/get/create/update/delete, plus 400, 404, 204, and the streaming endpoint's fallback.
      client = TestClient(app)\napp.state.db_resources = {\"item_svc\": FakeItemService(), ...}\n\ndef test_create_item():\n    r = client.post(\"/items\", json={\"name\": \"x\"})\n    assert r.status_code == 200\n
      "},{"location":"04_development/01_testing/#unit-tests","title":"\ud83e\uddea Unit tests","text":"
      • Domain models and converters: pure, no I/O.
      • Pipeline stages: feed a fixture state, assert the transformed state.
      • Assembled pipeline roots: fixture parity \u2014 replay a stored fixture input and compare against a golden output file.
      "},{"location":"04_development/01_testing/#config-consistency-tests","title":"\ud83d\udd10 Config-consistency tests","text":"

      For rule-driven pipelines, add a test that cross-references rules against the declared pattern registry: every flag emitted must be defined; every defined flag must be reachable. This catches drift without running the pipeline.

      "},{"location":"04_development/01_testing/#quality-gates","title":"\u2705 Quality gates","text":"

      A definition of done for any standard app:

      • python -c \"import main\" succeeds.
      • pytest passes.
      • The app serves the spec's operations; the worker drains its queue.
      • No domain module imports a web framework.
      • No infrastructure was reimplemented that a library already provides.
      "},{"location":"04_development/01_testing/#conventions","title":"\ud83d\udca1 Conventions","text":"
      • asyncio_mode = \"auto\"; no manual event loops.
      • Fixtures are checked into the repo (inputs + golden outputs).
      • Tests skip (not fail) when a required fixture is absent.
      • Do not mock the domain; mock only the infrastructure edge.
      "},{"location":"04_development/01_testing/#related","title":"Related","text":"
      • 02 \u2013 App Components \u00b7 03 \u2013 Start an App \u00b7 Overview
      "},{"location":"04_development/02_releasing/","title":"Releasing & Versioning","text":"

      How to cut a release of any Aetos repository. The rule lives in the reference page Versioning & Changelog; this is the runbook you follow.

      Every repository is one of two Drone shapes \u2014 a PyPI package or a Docker deployment (Drone Pipelines). Both release the same way: the version bump and changelog promotion go in the merge request, and the tag is created on the merged commit.

      "},{"location":"04_development/02_releasing/#before-you-start","title":"\ud83e\uddfe Before you start","text":"
      • You have an open merge request holding the change, and main is green (the Drone quality gate passed on the last run).
      • You know whether this is a breaking, feature, or fix release.
      • The version file exists:
      • package \u2192 version in pyproject.toml
      • service \u2192 VERSION at the repo root
      "},{"location":"04_development/02_releasing/#pick-the-next-version","title":"\ud83d\udea6 Pick the next version","text":"

      The version file and the tag must be identical. For 0.y.z, 0.y is the major line (see the reference page); once at 1.0.0, normal SemVer applies.

      Change 0.y.z \u2192 1.0.0+ \u2192 Breaking 0.(y+1).0 (x+1).0.0 Feature 0.y.(z+1) x.(y+1).0 Fix 0.y.(z+1) x.y.(z+1)"},{"location":"04_development/02_releasing/#release-in-the-mr","title":"\ud83c\udf3f Release in the MR","text":"

      The version is known while the change is still a merge request, so the bump rides along with it. Do all edits in the MR:

      • Reconcile the changelog first. [Unreleased] is a draft, not the source of truth: diff the change against the last tag (git log <last-tag>..HEAD, git diff --stat <last-tag>..HEAD) and add an entry for every user-facing change that is missing. Always show the proposed additions to the user and wait for approval before promoting \u2014 ask rather than guess when an entry is ambiguous.

      • Promote the changelog in CHANGELOG.md: move the (now reconciled) [Unreleased] content under a new ## [x.y.z] - YYYY-MM-DD heading, leave a fresh empty [Unreleased] on top, and add the compare links \u2014 naming the version/tag, never a commit id:

      [Unreleased]: https://git.aetoskia.com/aetos/<repo>/compare/x.y.z...HEAD\n[x.y.z]: https://git.aetoskia.com/aetos/<repo>/compare/x.y.(z-1)...x.y.z\n
      • Bump the version file to the intended release version: version = \"x.y.z\" in pyproject.toml (packages) or the VERSION file (services).
      "},{"location":"04_development/02_releasing/#tag-the-merged-commit","title":"\ud83c\udff7\ufe0f Tag the merged commit","text":"
      1. Merge or squash the MR into main.
      2. Create the tag on the resulting commit: git tag x.y.z (lightweight).
      3. Push the tag (git push origin x.y.z) \u2014 Drone builds the release.
      "},{"location":"04_development/02_releasing/#agent-assisted-tagging","title":"\ud83e\udd16 Agent-assisted tagging","text":"

      The agent does not author or merge the MR and never tags before the merge. After you confirm the MR is merged/squashed and tell it to proceed, the agent:

      1. Waits for that explicit go-ahead.
      2. Finds the commit that introduced the bump:
      3. package: git log -S 'version = \"x.y.z\"' -n 1 --format='%H %s' -- pyproject.toml
      4. service: git log -S 'x.y.z' -n 1 --format='%H %s' -- VERSION
      5. Verifies that commit's version file equals x.y.z, then tags only that commit: git tag x.y.z <sha>.
      6. Does not push \u2014 it asks you to run git push origin x.y.z.
      "},{"location":"04_development/02_releasing/#what-drone-does","title":"\ud83e\udd16 What Drone does","text":"
      • Type A (package): asserts tag == pyproject version, then skips if that version already exists on the index, runs the quality gate, builds, and uploads the wheel + sdist.
      • Type B (service): asserts tag == VERSION, resolves the tag, skips if the image already exists, runs the quality gate, builds, pushes, and restarts the container.

      If the guard fails, nothing is published \u2014 fix the version file, amend the commit, and move the tag only if it was never pushed.

      "},{"location":"04_development/02_releasing/#backfill-recovery","title":"\ud83d\udedf Backfill / recovery","text":"

      If an older tag never published (a past version-file mismatch, an index outage):

      • Package: run the backfill-pypi-from-tags pipeline (custom event). It checks out every tag, verifies tag == pyproject version at that commit, and uploads the ones missing from the index. Already-fixed history is never rewritten.
      • Service: rebuild the image for the missing tag with a fresh commit and a new patch version; do not move a published tag.
      "},{"location":"04_development/02_releasing/#if-a-release-is-wrong","title":"\ud83d\udd01 If a release is wrong","text":"
      • Never reuse or force-move a pushed tag.
      • Fix forward: bump to the next patch, promote the changelog, tag again.
      "},{"location":"04_development/02_releasing/#related","title":"Related","text":"
      • Testing & Quality Gates \u00b7 Versioning & Changelog \u00b7 Drone Pipelines
      "}]} \ No newline at end of file