# IGNY8 Current Workflow Status

**Last Updated:** 2025-01-XX  
**Purpose:** Single source of truth for current system state, active work, and recent changes

---

## Current System State

### Workflow Path (Current)

```
PLANNING → WRITER → OPTIMIZE → PUBLISH
```

**Direct Path:** Keywords/Clusters → Ideas → Tasks → Content (no wizard intermediary)

### Removed Features (2025-11-20)

- **Site Builder Wizard** - 6-step guided wizard process completely removed
- **WorkflowState Model** - Backend model and services removed
- **Wizard Routes** - `/sites/builder`, `/sites/builder/preview`, `/sites/blueprints` routes removed
- **Wizard UI Components** - All wizard step components removed from frontend

### Active Features

- ✅ **Site Blueprint APIs** - All backend APIs for creating/managing blueprints still work
- ✅ **Site Builder Models** - SiteBlueprint, PageBlueprint, SiteBlueprintCluster, SiteBlueprintTaxonomy models active
- ✅ **Direct Workflow** - Users can go directly from Planning → Writer → Optimize → Publish
- ✅ **All Core Modules** - Planner, Writer, Optimizer, Publisher all functional

---

## Recent Changes

### Site Builder Wizard Removal (2025-11-20)

**What Was Deleted:**

#### Frontend Files
- `/frontend/src/pages/Sites/Builder/Wizard.tsx`
- `/frontend/src/pages/Sites/Builder/Preview.tsx`
- `/frontend/src/pages/Sites/Builder/Blueprints.tsx`
- All wizard step components (`steps/*.tsx`)
- Wizard components (`components/WizardProgress.tsx`, `components/HelperDrawer.tsx`)
- `/frontend/src/store/builderStore.ts`

#### Backend Files
- `/backend/igny8_core/business/site_building/services/workflow_state_service.py`
- `/backend/igny8_core/business/site_building/services/wizard_context_service.py`
- `/backend/igny8_core/business/site_building/services/validators.py`

#### Backend Model
- `WorkflowState` model removed from `models.py`

#### Database
- Table: `igny8_site_blueprint_workflow_states` (dropped)

### Leftover Code Cleanup (2025-01-XX)

**Additional Cleanup Completed:**

#### Frontend API Functions Removed
- `fetchWizardContext()` - Called non-existent `/workflow/context/` endpoint
- `updateWorkflowStep()` - Called non-existent `/workflow/step/` endpoint

#### TypeScript Interfaces Removed
- `WorkflowState` interface - No longer needed (model removed)
- `WizardContext` interface - No longer needed (wizard removed)
- `workflow_state` field removed from `SiteBlueprint` interface

#### Frontend Components Fixed
- **Planner Dashboard** (`frontend/src/pages/Planner/Dashboard.tsx`):
  - Removed `incompleteBlueprints` state and filtering logic
  - Removed incomplete workflows alert banner
  - Removed unused `Alert` import

**Files Modified:**
1. `frontend/src/services/api.ts` - Removed wizard/workflow functions and interfaces
2. `frontend/src/pages/Planner/Dashboard.tsx` - Removed workflow state references

**Status:** ✅ All leftover wizard/workflow code has been cleaned up

---

## What's Still Active (Site Builder)

### Models Still Active
1. **SiteBlueprint** (`igny8_site_blueprints`)
2. **PageBlueprint** (`igny8_page_blueprints`)
3. **SiteBlueprintCluster** (`igny8_site_blueprint_clusters`)
4. **SiteBlueprintTaxonomy** (`igny8_site_blueprint_taxonomies`)
5. **BusinessType** (`igny8_site_builder_business_types`)
6. **AudienceProfile** (`igny8_site_builder_audience_profiles`)
7. **BrandPersonality** (`igny8_site_builder_brand_personalities`)
8. **HeroImageryDirection** (`igny8_site_builder_hero_imagery`)

### API Endpoints Still Available
- `GET/POST /api/v1/site-builder/blueprints/`
- `GET/POST /api/v1/site-builder/pages/`
- `POST /api/v1/site-builder/blueprints/{id}/generate_structure/`
- `POST /api/v1/site-builder/blueprints/{id}/generate_all_pages/`
- `POST /api/v1/site-builder/blueprints/{id}/clusters/attach`
- `POST /api/v1/site-builder/blueprints/{id}/taxonomies/`
- `GET /api/v1/site-builder/metadata/`

### Services Still Active
- `StructureGenerationService` - AI structure generation
- `PageGenerationService` - Page content generation
- `TaxonomyService` - Taxonomy management
- `SiteBuilderFileService` - File management

---

## Migration & Database State

### Migration State
- All apps have single `0001_initial.py` migrations
- Clean migration state (no migration history)
- Database structure matches current models
- WorkflowState table removed from database

### Database Backup
- **Backup:** `backup_postgres_20251120_232816.sql` (646KB)
- Contains all data except WorkflowState (intentionally excluded)

---

## Current Workflow Details

### Site Setup & Integration (New Flow)

#### Step 1: Add Site (WordPress)
- User adds a new WordPress site from the welcome screen or sites page
- During site creation, user selects:
  - **Industry**: From available industries (e.g., Technology, Healthcare, Finance)
  - **Sectors**: Multiple sectors within the selected industry (e.g., SaaS, E-commerce, Mobile Apps)
  - **Site Name**: Display name for the site
  - **Website Address**: WordPress site URL
- Site is created with industry and sectors already configured

#### Step 2: Integrate Site
- User is redirected to Site Settings → Integrations tab (`/sites/{id}/settings?tab=integrations`)
- **API Key Generation**:
  - User generates a unique API key for the site
  - API key is displayed and can be copied
  - Key is stored securely in the integration credentials
- **Plugin Download**:
  - User downloads the IGNY8 WP Bridge plugin directly from the page
  - Plugin provides deeper WordPress integration than default WordPress app
- **WordPress Configuration**:
  - User enters WordPress site URL
  - User enters WordPress username
  - User enters Application Password (created in WordPress admin)
  - User enables/disables integration and two-way sync
- Integration is saved and connection is tested

### Phase 1: Planning
- Keyword import and management
- Auto-clustering (1 credit per 30 keywords)
- Content idea generation (1 credit per idea)
- Queue ideas to Writer

### Phase 2: Writer
- Task creation from ideas
- Content generation (3 credits per content)
- Image generation (1 credit per image)
- Content review and editing

### Phase 3: Optimize
- Internal linking suggestions
- Content optimization scoring
- Apply improvements

### Phase 4: Publish
- WordPress publishing (via IGNY8 WP Bridge plugin)
- Site deployment (for IGNY8-hosted sites)
- Content validation

---

## Notes

- Site blueprints can still be created/managed through API endpoints
- No guided UI wizard available
- Direct path from Planning to Writer is the standard workflow
- All core functionality remains intact

---

**Last Updated:** 2025-01-XX  
**Status:** Current and Active

