Build Standards
Reference material for every Mandantis package author — integration patterns, build-package scaffolding, governance conventions, kill-switch discipline. 4 locked patterns · 3 build-package tiers · 6 monorepo commands.
01 · Integration Patterns (DEC-003)
4 locked patterns
Every system interaction uses one of these patterns. No new pattern without a DEC-NNN register entry — pattern discipline is the governance mechanism.
-
mgp-apiSystem/automation caller. Service principal. All DB/Xero/Stripe calls. No UI touches data stores directly.
-
mgp-mcpAI model caller. OBO/delegated auth. Explicit tool allow list. Class 3 default.
-
mgp-webhookInbound event ingress. HMAC verified. Sub-pattern of mgp-api.
-
mgp-portal-apiAuthenticated human REST. WorkOS AuthKit / CF Access. No AI. Define before portal build.
02 · Build Package Standard
Tier 1 / 2 / 3 file checklist
Every package scaffold starts from templates/new-package/. Tier 1 is mandatory; Tier 2 & 3 apply when the package deploys an agent or integrates external systems.
Tier 1
Mandatory — every packageCLAUDE.mdsession brief · read firstREADME.mdbuild-sequence.mdordered steps per Featurepackage.jsonmandantis.ba_capability declaredwrangler.tomltsconfig.jsonextends ../../tsconfig.base.jsondocs/decision-log.md
Tier 2
If the package deploys an agentdocs/agent-brief.mddocs/data-flow.mddocs/tool-manifest.mddocs/test-plan.md
Tier 3
If the package integrates external systemsdocs/integration-register.md
03 · GitHub Projects Lifecycle
Work-item conventions
Shared vocabulary across every Mandantis repo. Principal-only actions highlighted.
States
- Open
- In Progress
- In Review
- Closed (Principal only)
Labels
[epic][feature][story][task][decision]
Comment prefixes
[QUESTION][DECISION-REQUIRED][DEVIATION][BLOCKER][ESCALATION-PROPOSED][ESCALATION-CONFIRMED][PRINCIPAL-MERGE]
Milestones
2026-S## (sprint) or 2026-W## (week)
04 · Kill-switch Pattern (DEC-004)
Every Worker has a kill switch
Read-only check against a Cloudflare KV key. The key lives in the shared mandantis-platform namespace; the Worker never writes to it. /health is exempt so oncall can probe during maintenance.
// src/middleware/kill-switch.ts
import type { Context, Next } from 'hono'
export const KILL_SWITCH_KEY = 'service:<package>:enabled'
export interface KVGetter {
get(key: string): Promise<string | null>
}
export async function killSwitchMiddleware(
c: Context<{ Bindings: { KILL_SWITCHES: KVGetter } }>,
next: Next,
): Promise<Response | undefined> {
if (c.req.path === '/health') {
await next()
return
}
const value = await c.env.KILL_SWITCHES.get(KILL_SWITCH_KEY)
if (value === 'false') {
return c.html(maintenanceHtml(), 503)
}
await next()
}
05 · Monorepo Commands
Run from repo root
| Install | pnpm install | install + link workspace deps |
|---|---|---|
| Typecheck | pnpm typecheck | tsc --noEmit across all packages |
| Lint | pnpm lint | eslint with --max-warnings=0 |
| Test | pnpm test | vitest across all projects |
| Build | pnpm build | turbo build — tsc emits to dist/ |
| Format check | pnpm format:check | prettier --check (CI-gated) |