feat: platform generalization — Company Blueprint system (Paperclip OS)
Transforms Canifa-specific codebase into a generic AI Company platform
that can instantiate any business type from a YAML Company Blueprint.
Core additions:
- backend/schemas/blueprint.py: CompanyBlueprint, BlueprintRole,
BlueprintPipelineNode, BlueprintSummary Pydantic models with
reports_to cross-validation via @model_validator(mode='after')
- backend/services/blueprint_service.py: load/list/validate blueprints,
deploy_company_from_blueprint() with 2-pass agent seeding for FK safety
- backend/blueprints/: 4 YAML blueprints (fashion-retail, software-studio,
ecommerce-brand, marketing-agency) with roles, pipeline DAGs, nocobase_collections
- backend/tests/test_blueprint_e2e.py: 5 E2E tests — all pass
API changes:
- GET /companies/blueprints → List[BlueprintSummary] (with role_count)
- GET /companies/blueprints/{name} → full blueprint detail
- POST /companies/from-blueprint → deploy company from blueprint
- POST /pipelines/run accepts blueprint_id to drive orchestrator DAG
Orchestrator:
- ProjectOrchestrator now accepts pipeline_spec: list[dict] | None
- topological_sort_stages() (Kahn's BFS) derives parallel stages from blueprint DAG
- Falls back to PIPELINE_STAGES if no spec provided
De-branded:
- Removed all "Canifa" strings from models/services/api/tasks source files
- run_logs.py demo data → generic "Demo Brand/Server/Landing Page"
- agents.py demo HTML → "Demo Company"
- seed_db.py → uses deploy_company_from_blueprint("fashion-retail")
NocoBase:
- NocoBaseConnector: params-based init + from_company() classmethod
- company_secrets: UniqueConstraint('company_id', 'key') instead of global unique
Frontend:
- OnboardingWizard: blueprint picker with org-chart preview + DAG layer render
- blueprints.ts API client
- Companies.tsx: blueprint badge on company cards
Co-Authored-By:
Claude Opus 4.8 <noreply@anthropic.com>
Showing
backend/schemas/blueprint.py
0 → 100644
This diff is collapsed.
Please register or sign in to comment