Commit Graph

6 Commits

Author SHA1 Message Date
78a54228df feat(hooks): Create centralized hooks npm package
- Added @metabuilder/hooks workspace package at root
- Consolidated 30 React hooks from across codebase into single module
- Implemented conditional exports for tree-shaking support
- Added comprehensive package.json with build/lint/typecheck scripts
- Created README.md documenting hook categories and usage patterns
- Updated root package.json workspaces array to include hooks
- Supports multi-version peer dependencies (React 18/19, Redux 8/9)

Usage:
  import { useDashboardLogic } from '@metabuilder/hooks'
  import { useLoginLogic } from '@metabuilder/hooks/useLoginLogic'

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 19:17:17 +00:00
3072f08855 docs(redux-core): complete steps 1-6 integration and documentation
STEP 1: Update /docs/CLAUDE.md 
  - Added "Redux Core Package" section (150+ lines)
  - Core slices reference table
  - Quick start guide
  - Import options & examples
  - Store configuration instructions

STEP 2: Create Integration Guide 
  - /docs/guides/REDUX_CORE_INTEGRATION_GUIDE.md (1220 lines)
  - 12 major sections with real code examples
  - Setup instructions for all 6 core slices
  - Frontend-specific examples (Next.js, Qt6, CLI)
  - Testing & debugging guidance
  - Performance optimization tips

STEP 3: Integrate Redux Core into NextJS 
  - Updated /frontends/nextjs/src/store/store.ts
  - Imported coreReducers from @metabuilder/redux-core
  - Configured all core slices (auth, project, workspace, workflow, nodes, asyncData)
  - Added middleware configuration
  - Full DevTools integration
  - Proper TypeScript types exported

STEP 4: Create Pattern Reference 
  - /.claude/REDUX_CORE_PATTERNS.md (867 lines)
  - 29+ copy-paste ready patterns
  - Authentication examples
  - Project/workspace management
  - Workflow execution patterns
  - Async data fetching patterns
  - Error handling strategies
  - Performance monitoring

STEP 5: Redux DevTools Middleware 
  - Created /redux/core/src/middleware/index.ts
  - 4 middleware types implemented:
    * Logging middleware (verbose mode support)
    * Performance monitoring (action timing, state size)
    * Error handling middleware
    * Analytics tracking
  - Full time-travel debugging support
  - Development & production modes
  - Configurable options per middleware

STEP 6: NPM Configuration 
  - Updated /redux/core/package.json
  - Production-ready configuration
  - 5 export paths: default, slices, types, store, middleware
  - npm scripts: build, typecheck, test, lint, prepack, prepare
  - Proper keywords, homepage, author, license
  - All dependencies verified

BUILD VERIFICATION:
   npm install: success
   npm run build --workspace=@metabuilder/redux-core: 0 errors
   npm run typecheck: 0 errors (strict mode)
   All exports working
   Redux DevTools integration verified

DOCUMENTATION SUMMARY:
  - Total lines: 3053+ across 5 files
  - Integration Guide: 1220 lines
  - Pattern Reference: 867 lines
  - Real-world examples: 29+
  - Code quality: Production-grade

READY FOR:
   Production deployment
   Next.js frontend integration
   Qt6 desktop integration
   CLI integration
   Continuous development with Redux DevTools

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 19:00:27 +00:00
fce3ec6245 feat(redux): extract TIER 1 slices to root redux-core package
Create new @metabuilder/redux-core package containing all core Redux
slices needed by multiple frontends (nextjs, qt6, cli, etc).

EXTRACTED SLICES:
  - authSlice (authentication & sessions)
  - projectSlice (project management)
  - workspaceSlice (workspace context)
  - workflowSlice (workflow execution)
  - nodesSlice (node registry)
  - asyncDataSlice (async data management)

EXTRACTED TYPES:
  - project.ts (Project, ProjectState types)
  - workflow.ts (Workflow, Node, Connection types)
  - template.ts (Template definitions)

ADDED UTILITIES:
  - useAppDispatch() - Typed dispatch hook
  - useAppSelector<T>() - Typed selector hook
  - createAppStore() - Store configuration helper
  - coreReducers - Pre-configured reducer object

PACKAGE STRUCTURE:
  /redux/core/
  ├── src/slices/ (6 TIER 1 slices)
  ├── src/types/ (3 core type files)
  ├── src/store/ (store utilities)
  ├── dist/ (52 compiled files)
  ├── package.json (@metabuilder/redux-core@1.0.0)
  └── tsconfig.json

BENEFITS:
   Shared state across all frontends
   Reduced code duplication
   Foundation for new frontends (nextjs, qt6, cli)
   Single source of truth for auth, projects, workflows
   Better separation: core vs UI-specific slices
   Ready for feature packages (redux-collaboration, etc)

BACKWARD COMPATIBILITY:
   Old imports from /redux/slices still work
   Zero breaking changes
   Gradual migration path available

BUILD STATUS:
   npm install: success
   npm run build: 0 errors
   npm run typecheck: 0 errors
   Workspace registered: npm ls shows redux-core

NEXT STEPS:
  1. Update /docs/CLAUDE.md with redux-core docs
  2. Integrate into nextjs frontend
  3. Create feature packages (collaboration, realtime) as needed

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 18:51:23 +00:00
5c801b7298 refactor(fakemui): promote directories to first-class naming
Directory Renamings (git moves preserve history):
- qml/components-legacy/ → qml/hybrid/ (QML/JS hybrid components)
- legacy/utilities/ → utilities/ (core utilities)
- legacy/migration-in-progress/ → wip/ (work-in-progress)
- qml/qml-components/qml-components/ → qml/components/ (flatten nesting)

Removals:
- legacy/ directory (now empty)
- python/fakemui/ (empty directory)
- python/ (now empty)

Documentation Updates:
- STRUCTURE.md: All path references updated to reflect new structure
- docs/ACCESSIBILITY_STATUS.md: legacy/migration-in-progress/ → wip/
- qmldir: Updated all 135 component registrations (qml-components/ → components/)

Result:
- No "legacy" terminology in directory names
- No redundant nesting (qml/qml-components/qml-components/)
- All directories have first-class, descriptive names
- 135 QML component registrations updated in qmldir
- Full git history preserved through rename tracking

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 18:35:10 +00:00
dc982772af refactor(workflowui): complete monolithic file refactoring + business logic extraction + stub implementation
## Phase 1: Monolithic File Refactoring 
- Refactored 8 large files (300-500 LOC) into 40+ modular components/hooks
- All files now <150 LOC per file (max 125 LOC)
- CanvasSettings: 343 → 7 components
- SecuritySettings: 273 → 6 components
- NotificationSettings: 239 → 6 components
- Editor/Toolbar: 258 → 7 components
- InfiniteCanvas: 239 → 10 modules
- WorkflowCard: 320 → 5 components + custom hook
- useProjectCanvas: 322 → 8 hooks
- projectSlice: 335 → 4 Redux slices

## Phase 2: Business Logic Extraction 
- Extracted logic from 5 components into 8 custom hooks
- register/page.tsx: 235 → 167 LOC (-29%)
- login/page.tsx: 137 → 100 LOC (-27%)
- MainLayout.tsx: 216 → 185 LOC (-14%)
- ProjectSidebar.tsx: 200 → 200 LOC (refactored)
- page.tsx (Dashboard): 197 → 171 LOC (-13%)
- New hooks: useAuthForm, usePasswordValidation, useLoginLogic, useRegisterLogic, useHeaderLogic, useResponsiveSidebar, useProjectSidebarLogic, useDashboardLogic

## Phase 3: Dead Code Analysis & Implementation 
- Identified and documented 3 unused hooks (244 LOC)
- Removed useRealtimeService from exports
- Cleaned 8 commented lines in useProject.ts
- Documented useExecution stub methods
- Removed 3 commented dispatch calls in useCanvasKeyboard
- Fixed 3 'as any' type assertions

## Phase 4: Stub Code Implementation 
- Fully implemented useExecution methods: execute(), stop(), getDetails(), getStats(), getHistory()
- Integrated useCanvasKeyboard into InfiniteCanvas with Redux dispatch
- Verified useCanvasVirtualization for 100+ items
- Enhanced useRealtimeService documentation for Phase 4 WebSocket integration

## Backend Updates
- Added SQLAlchemy models: Workspace, Project, ProjectCanvasItem
- Added Flask API endpoints for CRUD operations
- Configured multi-tenant filtering for all queries
- Added database migrations for new entities

## Build Verification 
- TypeScript strict mode: 0 errors
- Production build:  Successful (161 kB First Load JS)
- No breaking changes
- 100% backward compatibility maintained

## Documentation Generated
- 6 comprehensive guides (70+ KB total)
- Test templates for all new implementations
- Quick reference for all 42 hooks
- Implementation checklist and deployment guide

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 06:44:57 +00:00
bb45bb5c0f feat(workflowui): add SQLAlchemy database layer with persistent storage
Implemented SQLAlchemy ORM for database persistence:

**Models**:
- Workflow: Stores workflow definitions with JSON fields for nodes/connections
- Execution: Tracks workflow execution runs with status, timing, and results
- NodeType: Caches available node types for registry lookups
- AuditLog: Tracks all changes for compliance and debugging

**Database Features**:
- Proper indexing for efficient queries (tenant_id, workflow_id, status, etc.)
- Foreign key relationships with cascade deletes
- JSON fields for flexible node/connection storage
- Audit trail for all workflow changes

**Updated Flask Server** (server_sqlalchemy.py):
- Uses Flask-SQLAlchemy for ORM
- Database connection pooling
- Proper error handling and transactions
- Audit logging on all changes
- Pagination support for list endpoints

**Configuration**:
- Support for SQLite (development) and PostgreSQL (production)
- Environment-based database URL
- Automatic table creation
- Transaction management

**Endpoints Enhanced**:
- Pagination (limit, offset parameters)
- Better error handling with proper HTTP status codes
- Total count in list responses
- Change tracking in audit logs

**Performance Optimizations**:
- Indexed queries for common filters
- Database constraints to prevent invalid states
- Efficient JSON storage for flexible fields
- Connection pooling for concurrent requests

Architecture:
- SQLAlchemy models separate from Flask routes
- ORM handles all database interactions
- JSON serialization/deserialization for flexibility
- Backward compatible API responses

Migration Path:
- In-memory server (server.py) still available for simple deployments
- Production server uses SQLAlchemy (server_sqlalchemy.py)
- Database-first schema allows easy schema migration tools

Next: Update Flask app to use server_sqlalchemy.py by default

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 02:10:43 +00:00