syntaxai/tdd.md · main · sama.profile.toml

sama.profile.toml 56 lines · 2208 bytes raw
# SAMA v2 profile — declares this repo's filename prefixes and how
# they map to the four canonical layers (Pure 0 / Core 1 / Adapter 2 /
# Entry 3). See https://tdd.md/sama/v2 §2 for the profile mechanism
# and https://tdd.md/sama/v2 §1.1 for the canonical layer table.
#
# Order in each `sublayers` array is the dependency order: later
# entries may import earlier entries, never the reverse (§2.2).

sama_version = "2.0"
profile = "tdd-md"

# Layer 0 — Pure. Types, constants, pure registries, pure parsers.
# No I/O, no side effects. Prefix lex-FIRST (`a31_`) so SAMA v2 §4.1's
# "lexicographic prefix order equals layer order" holds across the
# whole profile.
[layers.0]
prefixes = ["a31_"]

# Layer 1 — Core. Domain logic and pure render. No network, disk,
# clock, or framework.
#   - b32_ holds pure domain logic (judging math, session HMAC,
#     anchor extraction, edit-target resolution, both SAMA verifiers).
#   - b51_ holds pure HTML render functions (markdown → string,
#     page chrome, no I/O).
# b51 may import b32 (render uses logic); b32 must never import b51.
[layers.1]
sublayers = [
  { name = "logic",  prefix = "b32_" },
  { name = "render", prefix = "b51_" },
]

# Layer 2 — Adapter. The boundary. External input is parsed here.
# DB, network, filesystem, framework bindings.
#   - c13_ holds SQLite primitives (the bun:sqlite Database wrapper).
#   - c14_ holds HTTP / git / filesystem orchestrators that may compose
#     c13 primitives (e.g. c14_judge runs git clone + saveRun() to db).
# c14 may import c13; c13 must never import c14.
[layers.2]
sublayers = [
  { name = "data", prefix = "c13_" },
  { name = "io",   prefix = "c14_" },
]

# Layer 3 — Entry. Outermost shell: server bootstrap, route table,
# handlers. Prefix lex-LAST (`d{11,21}_`) so the whole prefix scheme
# sorts in layer order.
#   - d21_ holds HTTP handlers and the Bun.serve route table (d21_app).
#   - d11_ wait — d11 lex-sorts before d21. Within Layer 3 sublayer
#     ordering [handlers, server] means server (later) may import
#     handlers, which matches c11_server importing c21_app.
[layers.3]
sublayers = [
  { name = "handlers", prefix = "d21_" },
  { name = "server",   prefix = "d11_" },
]