Skip to main content

Module system_generator

Module system_generator 

Source
Expand description

System Generator - Natural Language to Entire System Generation

This module provides functionality to generate complete backend systems from natural language descriptions, including:

  • 20-30 REST endpoints (OpenAPI 3.1 spec)
  • 4-5 personas (driver, rider, admin, dispatcher, support)
  • 6-10 lifecycle states (trip: requested, matched, in_progress, completed, cancelled)
  • WebSocket topics (location_updates, trip_status, surge_alerts)
  • Payment failure scenarios (insufficient_funds, card_declined, network_error)
  • Surge pricing chaos profiles (peak_hours, event_surge, weather_surge)
  • Full OpenAPI specification
  • Mock backend configuration (mockforge.yaml)
  • GraphQL schema (optional)
  • TypeScript/Go/Rust typings
  • CI pipeline templates (GitHub Actions, GitLab CI)

§Features

  • Versioned Draft Artifacts: Generates v1, v2, etc. (never mutates existing)
  • Deterministic Mode Integration: Honors workspace ai.deterministic_mode setting
  • System Coherence Validation: Ensures personas match endpoints, lifecycles match entities

§Example Usage

use mockforge_core::ai_studio::system_generator::{SystemGenerator, SystemGenerationRequest};
use mockforge_core::intelligent_behavior::IntelligentBehaviorConfig;

async fn example() -> mockforge_core::Result<()> {
    let config = IntelligentBehaviorConfig::default();
    let generator = SystemGenerator::new(config);

    let request = SystemGenerationRequest {
        description: "I'm building a ride-sharing app".to_string(),
        output_formats: vec!["openapi".to_string(), "personas".to_string()],
        workspace_id: Some("workspace-123".to_string()),
    };

    let system = generator.generate(&request).await?;
    Ok(())
}

Structs§

AppliedSystem
Result of applying a system design
GeneratedSystem
Generated system with all artifacts
SystemArtifact
System artifact (OpenAPI spec, persona, lifecycle, etc.)
SystemGenerationRequest
Request for system generation
SystemGenerator
System Generator Engine
SystemMetadata
System generation metadata