#!/usr/bin/env python3 """ CC Project Starter Quickly start a new project with template and memory update """ import json import shutil from datetime import datetime from pathlib import Path ZONE = Path(__file__).parent MEMORY_FILE = ZONE / "memory.json" TEMPLATE_DIR = ZONE / "projects" / "_template" PROJECTS_DIR = ZONE / "projects" def start_project(project_name, goal): """Start a new project""" # Load memory with open(MEMORY_FILE, 'r') as f: memory = json.load(f) # Create project folder project_slug = project_name.lower().replace(' ', '-') project_dir = PROJECTS_DIR / project_slug if project_dir.exists(): print(f"⚠️ Project {project_name} already exists at {project_dir}") return # Copy template shutil.copytree(TEMPLATE_DIR, project_dir) print(f"✅ Created project folder: {project_dir}") # Update template with project info template_file = project_dir / "PROJECT_TEMPLATE.md" with open(template_file, 'r') as f: content = f.read() today = datetime.now().strftime('%Y-%m-%d') content = content.replace('[PROJECT NAME]', project_name) content = content.replace('[DATE]', today) content = content.replace('[What are we building and why?]', goal) content = content.replace('[in_progress/completed/paused]', 'in_progress') content = content.replace('[COUNT]', '0') # Rename to project name project_file = project_dir / f"{project_slug}.md" with open(project_file, 'w') as f: f.write(content) template_file.unlink() # Remove template file print(f"✅ Created project file: {project_file}") # Update memory if project_slug not in memory.get('active_projects', []): if 'active_projects' not in memory: memory['active_projects'] = [] memory['active_projects'].append(project_slug) if 'project_notes' not in memory: memory['project_notes'] = {} memory['project_notes'][project_slug] = { 'status': 'in_progress', 'started': today, 'goal': goal, 'location': str(project_dir), 'key_decisions': [] } memory['quick_context'] = f"Starting new project: {project_name}" # Save memory with open(MEMORY_FILE, 'w') as f: json.dump(memory, f, indent=2) print(f"✅ Memory updated!") print(f"\n🚀 Project '{project_name}' is ready!") print(f"📂 Location: {project_dir}") print(f"📝 Next: Edit {project_file} and start coding with CC!") if __name__ == "__main__": import sys if len(sys.argv) < 3: print("Usage: python start_project.py ") print("\nExample:") print(' python start_project.py "Web Scraper" "Build a tool to scrape product prices"') sys.exit(1) project_name = sys.argv[1] goal = sys.argv[2] start_project(project_name, goal)