#!/usr/bin/env python3 """Initialize a guardrailed project with manifest.""" import argparse import json import os from datetime import datetime def create_manifest(name: str, path: str) -> dict: """Create initial project manifest structure.""" return { "project": { "name": name, "version": "0.1.0", "created_at": datetime.now().isoformat(), "description": f"{name} - A guardrailed project" }, "state": { "current_phase": "DESIGN_PHASE", "approval_status": { "manifest_approved": False, "approved_by": None, "approved_at": None }, "revision_history": [ { "action": "PROJECT_INITIALIZED", "timestamp": datetime.now().isoformat(), "details": f"Project {name} created" } ] }, "entities": { "pages": [], "components": [], "api_endpoints": [], "database_tables": [] }, "dependencies": { "component_to_page": {}, "api_to_component": {}, "table_to_api": {} } } def main(): parser = argparse.ArgumentParser(description="Initialize guardrailed project") parser.add_argument("--name", required=True, help="Project name") parser.add_argument("--path", required=True, help="Project path") args = parser.parse_args() manifest_path = os.path.join(args.path, "project_manifest.json") if os.path.exists(manifest_path): print(f"Warning: Manifest already exists at {manifest_path}") print("Use --force to overwrite (not implemented)") return 1 manifest = create_manifest(args.name, args.path) with open(manifest_path, "w") as f: json.dump(manifest, f, indent=2) print(f"Initialized guardrailed project: {args.name}") print(f"Manifest created at: {manifest_path}") print(f"Current phase: DESIGN_PHASE") return 0 if __name__ == "__main__": exit(main())