How sahil-ladhania/preflight works
Preflight is a marketing-compliance workflow: teams capture intent, freeze applicable constraints, generate assets, and review a rule-by-rule evidence ledger. The graph includes the documented campaign stages and the sampled backend paths for campaign orchestration, judgement, rulebook changes, and workbench chat, alongside the rule engine and shared contracts. The README documents the product journey; source excerpts and the SOURCE INDEX support only the cited internal calls. Several UI/API and unsampled subsystem connections are therefore omitted.
Main entry points: judge.service.ts Judgement evaluation · campaigns.service.ts Campaign orchestration · generate.service.ts Asset generation · workbench.service.ts Workbench chat
Components 22
Product experience
- Workbench UI
apps/preflight-web/src/features/workbench/Workbench.tsx - Campaign UI
apps/preflight-web/src/features/campaign/Campaign.tsx - Overview
apps/preflight-web/src/features/overview/Overview.tsx - Rulebook UI
apps/preflight-web/src/features/rulebook/Rulebook.tsx - Web app shell
apps/preflight-web/src/App.tsx
Campaign workflow
- API routing
apps/preflight-backend/src/app.ts - Campaign handlers
apps/preflight-backend/src/features/campaigns/campaigns.controller.ts - Campaign orchestration
apps/preflight-backend/src/features/campaigns/campaigns.service.ts - Brief extraction
apps/preflight-backend/src/features/campaigns/extract.service.ts - Constraint compile
apps/preflight-backend/src/features/campaigns/compile.service.ts - Asset generation
apps/preflight-backend/src/features/campaigns/generate.service.ts
Review and governance
- Findings and decisions
apps/preflight-backend/src/features/findings/findings.service.ts - Judgement evaluation
apps/preflight-backend/src/features/findings/judge.service.ts - Rulebook management
apps/preflight-backend/src/features/rules/rules.service.ts - Rule change record
apps/preflight-backend/src/features/rulebook-changes/rulebook-changes.service.ts
Agent runtime
- Workbench chat
apps/preflight-backend/src/features/workbench/workbench.service.ts - Agent run record
apps/preflight-backend/src/features/agent-runs/agent-runs.service.ts - Agent invocation
apps/preflight-backend/src/lib/gitagent.ts
Rules and contracts
- Deterministic checks
packages/rules/src/run-deterministic.ts - Shared API contracts
packages/schemas/src/brief.ts
Other components
- Marketing team
- PostgreSQL
Connections 23
- Marketing team → Workbench UI: captures intent
- Marketing team → Campaign UI: builds campaign
- Campaign UI → Campaign handlers: requests stages
- Workbench UI → Workbench chat: sends chat
- Rulebook UI → Rulebook management: manages rules
- API routing → Campaign handlers: mounts routes
apps/preflight-backend/src/app.ts - Campaign handlers → Campaign orchestration: invokes stages
apps/preflight-backend/src/features/campaigns/campaigns.controller.ts - Campaign orchestration → Brief extraction: extracts brief
- Campaign orchestration → Constraint compile: freezes constraints
- Campaign orchestration → Asset generation: generates assets
- Asset generation → Deterministic checks: checks copy
apps/preflight-backend/src/features/campaigns/generate.service.ts - Asset generation → Judgement evaluation: evaluates findings
apps/preflight-backend/src/features/campaigns/generate.service.ts - Findings and decisions → Judgement evaluation: requests evaluation
apps/preflight-backend/src/features/findings/findings.service.ts - Judgement evaluation → Agent run record: records run
apps/preflight-backend/src/features/findings/judge.service.ts - Judgement evaluation → Agent invocation: invokes judge
apps/preflight-backend/src/features/findings/judge.service.ts - Workbench chat → Agent run record: records run
apps/preflight-backend/src/features/workbench/workbench.service.ts - Workbench chat → Agent invocation: invokes agent
apps/preflight-backend/src/features/workbench/workbench.service.ts - Rulebook management → Rule change record: records changes
apps/preflight-backend/src/features/rules/rules.service.ts - Asset generation → PostgreSQL: persists assets
- Agent run record → PostgreSQL: writes run rows
apps/preflight-backend/src/features/agent-runs/agent-runs.service.ts - Judgement evaluation → PostgreSQL: reads and updates
apps/preflight-backend/src/features/findings/judge.service.ts - Marketing team → Overview: reviews ledger
- Marketing team → Rulebook UI: declares constraints