What a pattern definition looks like. Each pattern is a single YAML file organized by category.
# Pattern: Fastblocks project skeleton
id: scaffolding/project
name: Fastblocks Project Skeleton
description: Base project structure with Oneiric config, entry point, and settings
version: 1.0
source_repos: [fastblocks, splashstand] # where this pattern was learned from
confidence: 0.95 # how consistently this pattern appears across repos
depends: [] # no dependencies — this is the base pattern
structure:
dirs:
- path: settings/
required: true
- path: templates/base/blocks/
required: true
- path: templates/pages/
required: false
- path: adapters/
required: false
- path: static/
required: false
files:
- path: main.py
required: true
template: entry-point # references a Jinja template
- path: pyproject.toml
required: true
template: pyproject
- path: settings/app.yml
required: true
template: settings-app
- path: settings/adapters.yml
required: false
template: settings-adapters
templates: # Jinja templates for file generation
entry-point: |
from starlette.routing import Route
from oneiric.core.resolution import Resolver
depends = Resolver()
def resolve_dep(key):
candidate = depends.resolve("{{ project_name }}", key)
if candidate is None:
raise RuntimeError(f"Missing dependency: {key}")
factory = getattr(candidate, "factory", None)
return factory() if callable(factory) else candidate
routes = [Route("/", endpoint=homepage)]
app = resolve_dep("app")
pyproject: |
[project]
name = "{{ project_name }}"
requires-python = ">=3.12"
dependencies = [
"fastblocks",
"oneiric",
]
settings-app: |
app:
name: "{{ project_name }}"
title: "{{ project_title }}"
debug: true
slots: # extension points for component patterns
- nav: templates/base/blocks/ # navigation pattern plugs in here
- auth: adapters/ # auth pattern plugs in here
- middleware: main.py # middleware pattern modifies entry point