code-generation-system / quickstart.py
purav-2008's picture
Publishing to public space for live url
d0fdbcd
Raw
History Blame Contribute Delete
3.01 kB
#!/usr/bin/env python3
"""
Quick start script for the AI Code Generation System.
Runs the complete pipeline on sample prompts.
"""
import sys
import json
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from pipeline import Pipeline
from runtime_simulator import validate_config_executable
def main():
"""Run quick start demo."""
print("\n" + "="*70)
print("πŸ€– AI PLATFORM ENGINEER - CODE GENERATION SYSTEM")
print("="*70)
print("\n")
# Initialize pipeline
pipeline = Pipeline(use_llm=False) # Using rule-based for demo
# Example prompts
examples = [
{
"title": "CRM System",
"prompt": "Build a CRM with login, contacts, dashboard, role-based access, and premium plan with payments. Admins can see analytics."
},
{
"title": "E-commerce Platform",
"prompt": "Create an e-commerce platform with product listing, shopping cart, checkout, payment processing, order tracking, and admin inventory management."
},
{
"title": "Edge Case - Vague Prompt",
"prompt": "Build something useful"
}
]
# Process each example
for i, example in enumerate(examples, 1):
print(f"\nπŸ“ Example {i}: {example['title']}")
print(f"Prompt: {example['prompt'][:80]}...")
print("-" * 70)
# Generate
config, exec_log = pipeline.generate(example['prompt'])
# Validate
is_executable, exec_report = validate_config_executable(config)
# Display results
print(f"\nβœ“ Generation Status: {exec_log.get('final_status', 'unknown')}")
print(f"βœ“ Executable: {'YES βœ“' if is_executable else 'NO (with warnings)'}")
print(f"βœ“ Database Tables: {len(config.get('database_schema', []))}")
print(f"βœ“ API Endpoints: {len(config.get('api_schema', []))}")
print(f"βœ“ UI Pages: {len(config.get('ui_schema', []))}")
# Show first 500 chars of config
config_json = json.dumps(config, indent=2)
print(f"\nπŸ“Š Generated Config (first 500 chars):")
print(config_json[:500] + "...\n")
# Show validation report
if exec_report.get("errors"):
print("⚠️ Validation Errors:")
for error in exec_report["errors"][:3]:
print(f" - {error}")
if exec_report.get("warnings"):
print("⚠️ Warnings:")
for warning in exec_report["warnings"][:3]:
print(f" - {warning}")
print("\n" + "="*70)
print("βœ… QUICK START DEMO COMPLETE")
print("="*70)
print("\nπŸ“– Next Steps:")
print(" 1. Run web interface: python web/app.py")
print(" 2. Run evaluation: python evaluation/evaluator.py")
print(" 3. Check README.md for full documentation")
print("\n")
if __name__ == "__main__":
main()