$ show NickPittas/DirectorsConsole
Director's Console is a full-stack application for cinematic AI prompt engineering and ComfyUI workflow orchestration. It provides a React/TypeScript frontend with three core tabs: Cinema Prompt Engineering (rule-based prompt authoring with LLM enhancement), Storyboard (ComfyUI workflow import, parameter editing, parallel rendering), and Gallery (media browsing, tagging, rating, duplicate detection). The backend consists of two FastAPI services: the CPE API (port 9800) handling cinematography rules, prompt generation, and LLM provider integration, and the Orchestrator API (port 9820) managing project files, gallery metadata, and job group execution across multiple ComfyUI backends. A ComfyUI custom node plugin embeds the prompt engineering UI directly into ComfyUI. The architecture is service-oriented with clear separation of concerns: the CPE backend owns the cinematic knowledge base (80+ film presets, 96 camera angles, 50+ target models) and prompt enhancement pipeline, while the Orchestrator handles distributed generation with parallel job groups, seed strategies, health monitoring, and WebSocket streaming of progress. The frontend uses Zustand for state management, IndexedDB for session draft persistence, and custom WebSocket hooks with exponential backoff reconnection. External dependencies include FastAPI, Uvicorn, aiohttp, httpx, Pydantic, SQLite, Pillow, OpenCV, and various AI model APIs (OpenAI, Google, Antigravity, etc.). Key data flows: users configure cinematic parameters (camera, lighting, movement) via the Cinema Prompt Engineering UI, which generates structured prompts via the rules engine and optionally enhances them through LLM providers. These prompts are injected into ComfyUI workflow templates, which are submitted to the Orchestrator for parallel execution across GPU backends. Generated images/videos are stored in a gallery with metadata (ratings, tags, notes) persisted via a JSON-backed store or SQLite. The system also supports OAuth-based credential storage for AI providers, encrypted with Fernet and machine-ID-derived keys. The codebase is actively developed with a comprehensive test suite (Python pytest and Node.js VM-based TypeScript tests), CI/CD via GitHub Actions, and detailed documentation. While primarily an application, it incorporates a significant data/research component in its curated cinematography database and model-specific prompting guides, making it a hybrid tool for both production use and creative experimentation.
The LLM identified 5 files worth highlighting for reuse:
Provides encrypted credential storage using Fernet symmetric encryption with a key derived from the machine ID (via uuid.getnode) and an optional environment seed. Implements atomic import from localStorage with full validation before writes, preventing corruption. The singleton pattern ensures a single storage instance per process, and errors are reported through a custom CredentialStorageError. This component is self-contained and could be extracted for any application needing secure local credential management.
Manages parallel execution of job groups across multiple ComfyUI backends. Handles submission, cancellation, timeout enforcement, failure isolation, seed variation, and WebSocket event streaming. Uses asyncio for concurrent child job dispatch and maintains per-group state with progress tracking. The design is decoupled from specific backends via a client interface, making it reusable for any distributed task execution system.
Implements session draft persistence using IndexedDB with versioned records, active pointer management, and rollback on failure. Provides transaction-safe operations (save, load, delete) with automatic cleanup of stale drafts. The adapter pattern allows swapping the storage backend without changing the API. This component is reusable for any application requiring robust draft recovery with minimal dependencies.
Core rule engine for cinematographic validation of live-action and animation configurations. Defines ~70 rules with severity levels (hard/warning/info) and auto-correction capabilities. Supports preset application with alias mapping, fallback handling, and override merging. The Rule class pattern (ID, severity, check function) provides a clean, extensible validation framework that could be adapted for any domain-specific constraint system.
Executes ComfyUI workflows as directed acyclic graphs with stream isolation (connected-component analysis) to prevent interference between parallel generation streams. Uses BFS/DFS for dependency resolution and backward tracing from Execute nodes to determine executable subgraphs. The graph execution model is generic and could be reused for any workflow engine that needs isolated execution paths.