Commit Graph

101 Commits

Author SHA1 Message Date
b25663f76b Unify all formatting buttons to use consistent three-layer architecture
- Remove .insertr-default-style special styling (blue background, border, dot indicator)
- Make ALL buttons use .insertr-style-preview with unified appearance
- Maintain authentic style previews in isolated .insertr-style-sample layer
- Bold buttons show bold text, .brand buttons show green uppercase text, etc.
- Eliminate visual inconsistency between semantic and detected style buttons
- Simplify CSS by removing ~50 lines of duplicate button styling
- Provide consistent professional toolbar appearance across all formatting options
2025-09-22 14:18:57 +02:00
479a537f21 Fix button alignment issue in three-layer architecture
- Move padding from .insertr-button-frame to .insertr-style-btn.insertr-style-preview
- Add align-items and justify-content to button container for proper centering
- Remove width: 100% from button frame to prevent unnecessary stretching
- Fix off-center text in default Bold, Italic, and Link buttons
- Maintain style isolation while ensuring consistent button alignment
2025-09-21 22:19:47 +02:00
948ab241ec Fix whitespace issue in default formatting buttons
- Add margin/padding reset to .insertr-style-sample to prevent browser defaults
- Remove unused .insertr-default-preview CSS that was causing confusion
- Ensure consistent spacing across all button types (default vs detected styles)
- Clean up legacy CSS classes that are no longer used with three-layer architecture
2025-09-21 22:13:49 +02:00
551b3fa301 Implement three-layer button architecture for consistent formatting button styling
- Add button frame isolation layer to prevent site CSS from affecting toolbar appearance
- Create style sample container for authentic style previews without layout interference
- Update CSS with proper containment boundaries and !important rules for button structure
- Preserve all authentic styling (color, weight, transform, decoration) in isolated preview
- Fix inconsistent button appearance across different site stylesheets (e.g. .brand class)
- Maintain professional toolbar UX while showing accurate style previews
2025-09-21 22:06:35 +02:00
0cfce1c95a Implement professional smart formatting with toggle logic and whitespace preservation 2025-09-21 21:55:08 +02:00
d44bdd41b4 feat: unify link editing interfaces with comprehensive polish
Multi-Property Editor Polish:
- Add comprehensive form styling (.insertr-form-group, .insertr-form-input, etc.)
- Professional layout with titles, validation, auto-focus, and help text
- Enhanced link/button/image editors with real-time validation
- Consistent spacing, colors, and visual hierarchy

Smart Default Formatting:
- Add Bold, Italic, Link options when not detected in content
- Intelligent detection respects existing developer styles
- Visual distinction for default vs detected styles with info-colored borders
- Content-aware: only adds to elements that benefit from text formatting

Link Interface Unification:
- Create shared createLinkConfigurationForm() component
- Eliminate code duplication between direct editing and popup creation
- Update createLinkEditor() and showLinkConfigPopup() to use shared component
- Fix link button styling to match other style buttons with preview content

Benefits:
- Consistent professional editing experience across all interfaces
- Reduced maintenance burden through code unification
- Enhanced UX with validation, keyboard shortcuts, and visual feedback
- Maintains CLASSES.md philosophy while improving out-of-box experience
2025-09-21 20:47:22 +02:00
b75eda2a87 feat: complete HTML-first architecture implementation (Phase 1 & 2)
Major architectural simplification removing content type complexity:

Database Schema:
- Remove 'type' field from content and content_versions tables
- Simplify to pure HTML storage with html_content + original_template
- Regenerate all sqlc models for SQLite and PostgreSQL

API Simplification:
- Remove content type routing and validation
- Eliminate type-specific handlers (text/markdown/structured)
- Unified HTML-first approach for all content operations
- Simplify CreateContent and UpdateContent to HTML-only

Backend Enhancements:
- Update enhancer to only generate data-content-id (no data-content-type)
- Improve container expansion utilities with comprehensive block/inline rules
- Add Phase 3 preparation with boundary-respecting traversal logic
- Strengthen element classification for viable children detection

Documentation:
- Update TODO.md to reflect Phase 1-3 completion status
- Add WORKING_ON.md documenting the architectural transformation
- Mark container expansion and HTML-first architecture as complete

This completes the transition to a unified HTML-first content management system
with automatic style detection and element-based behavior, eliminating the
complex multi-type system in favor of semantic HTML-driven editing.
2025-09-21 19:23:54 +02:00
b5e601d09f feat: implement Phase 3 container transformation with CLASSES.md compliance
- Add backend container transformation in engine.go following syntactic sugar specification
- Containers with .insertr get class removed and viable children get .insertr added
- Remove incorrect frontend container expansion - frontend only finds enhanced elements
- Fix StyleAwareEditor hasMultiPropertyElements runtime error
- Add addClass/removeClass methods to ContentEngine for class manipulation
- Update frontend to match HTML-first approach with no runtime container logic
- Test verified: container <section class='insertr'> transforms to individual h1.insertr, p.insertr, button.insertr

This completes the container expansion functionality per CLASSES.md:
Developer convenience (one .insertr enables section editing) + granular control (individual element editing)
2025-09-21 19:17:12 +02:00
4ef032cad6 refactor: simplify CSS variables by removing 10 unused/redundant variables
- Remove 6 unused z-index variables (dropdown, sticky, fixed, popover)
- Remove unused font-size-lg and bg-dark variables
- Remove 4 overly-specific input variables, use existing spacing/color vars
- Consolidate form styling to use core variables for consistency
- Add internal CSS file to gitignore to prevent auto-generation conflicts
- Reduces variable count from 38→28 (26% reduction) for easier maintenance
2025-09-20 22:03:08 +02:00
eb812fa78a feat: dramatically improve structural differentiation with sibling context
- Add sibling context detection to identify unique heading content
- Include parent container context with enhanced class filtering
- Look for heading siblings (h1-h6) that provide unique container context
- Extract up to 12 chars of sibling heading text for differentiation

Results:
 Collision Elimination: From 8 collisions to 0 collisions
 Unique Base IDs: Each element gets distinct ID (no -1, -2, -3 suffixes)
 Better Context: 'Example 1', 'Example 2' headings provide unique signatures
 Maintained Stability: Same elements still get same IDs across runs

Before: index-p-cad2a8, index-p-cad2a8-1, index-p-cad2a8-2... (8 collisions)
After: index-p-1198e8, index-p-215de9, index-p-604e11... (0 collisions)
2025-09-20 21:49:48 +02:00
b5225c1388 feat: implement structural IDs with database-first existence checking
- Remove content preview from ID generation for stable structural IDs
- Implement database-first approach to check content existence before creation
- Add enhanced DOM path, semantic context, and precise sibling indexing
- Replace HTML attribute checking with reliable database lookups
- Add collision handling with increment counters for similar elements

Fixes:
 UNIQUE constraint errors eliminated (multiple enhancement runs work)
 Structural stability (same element keeps same ID regardless of content changes)
 Database-driven workflow (single source of truth for content existence)
 Enhanced collision resistance with detailed structural differentiation

Results: No more 'Failed to store content' errors, stable enhance workflow.
2025-09-20 21:39:40 +02:00
369d516381 docs: finalize Phase 3a documentation and remove --clean-db references
- Remove --clean-db flag references from all documentation
- Update SERVER_UPDATE.md with enhanced deterministic ID generation achievements
- Mark Phase 3a as COMPLETE & PRODUCTION READY
- Document enhance button workflow completion
- Clean up development workflow examples

Phase 3a HTML-first architecture implementation is now fully documented and complete.
2025-09-20 21:25:47 +02:00
c7ff63a87d feat: implement enhanced deterministic ID generation system
- Replace random UUID with 6-component deterministic signature
- Use filePath|domPath|tag|classes|contentPreview|siblingIndex for uniqueness
- Enhance sibling positioning with insertr-aware index calculation
- Improve DOM path generation with meaningful class inclusion
- Restore ID consistency across enhancement runs for reliable content injection

Results:
 ID Consistency: Same elements always get same IDs (index-p-639460)
 Collision Resistance: Different elements get different IDs (4c7206, 23df20, 5a975d)
 File Scoping: Same structure in different files gets different IDs
 Enhanced Workflow: API edit → enhance button → content injected successfully

Fixes enhance button by ensuring API content IDs match enhancement-generated IDs.
2025-09-20 18:05:13 +02:00
1b5c673466 fix: implement deterministic ID generation for consistent content injection
- Replace random UUID suffix with deterministic hash-based signature
- Use element DOM path, sibling position, and content preview for uniqueness
- Ensure same elements always get the same content ID across enhancements
- Fix critical bug where content updates weren't being injected into static files

This resolves the enhance button workflow: API content updates → enhance trigger → static file injection.
2025-09-20 17:53:04 +02:00
6f682372b5 fix: resolve content update payload parsing and add update vs create logic
- Extract content from formData.content instead of passing whole object
- Add logic to call updateContent() for existing content vs createContent() for new
- Fix 400 Invalid JSON error caused by sending object instead of string
- Handle different formData formats: string, {content: string}, {text: string}

The frontend was sending html_content as {type:'html', content:'...'} object
but server expected a plain string. Now properly extracts the content value.
2025-09-20 17:40:23 +02:00
2177055c76 feat: Complete HTML-first architecture implementation with API integration
- Replace value field with html_content for direct HTML storage
- Add original_template field for style detection preservation
- Remove all markdown processing from injector (delete markdown.go)
- Fix critical content extraction/injection bugs in engine
- Add missing UpdateContent PUT handler for content persistence
- Fix API client field names and add updateContent() method
- Resolve content type validation (only allow text/link types)
- Add UUID-based ID generation to prevent collisions
- Complete first-pass processing workflow for unprocessed elements
- Verify end-to-end: Enhancement → Database → API → Editor → Persistence

All 37 files updated for HTML-first content management system.
Phase 3a implementation complete and production ready.
2025-09-20 16:42:00 +02:00
bb5ea6f873 Complete library cleanup and documentation overhaul
## Library Code Cleanup (~1,200+ lines removed)
- Remove legacy markdown system (markdown.js, previewer.js)
- Delete unused EditContext code from ui/editor.js (~400 lines)
- Remove version history UI components from form-renderer.js (~180 lines)
- Clean unused CSS styles from insertr.css (~120 lines)
- Update package.json dependencies (remove marked, turndown)

## Documentation Updates
- README.md: Update from markdown to HTML-first approach
- AGENTS.md: Add current architecture guidance and HTML-first principles
- TODO.md: Complete rewrite with realistic roadmap and current status
- demos/README.md: Update for development demo server usage

## System Reality Alignment
- All documentation now reflects current working system
- Removed aspirational features in favor of actual capabilities
- Clear separation between development and production workflows
- Accurate description of style-aware editor with HTML preservation

## Code Cleanup Benefits
- Simplified codebase focused on HTML-first approach
- Removed markdown conversion complexity
- Cleaner build process without unused dependencies
- Better alignment between frontend capabilities and documentation

Ready for Phase 3a server updates with clean foundation.
2025-09-20 00:02:03 +02:00
63939e2c68 Add Phase 3a server update planning document
- Document HTML-first API architecture vision
- Define template lifecycle management system
- Plan schema updates for content and template storage
- Outline development vs production mode handling
- Specify implementation tasks and priorities
2025-09-20 00:01:20 +02:00
01c8dcca76 feat: Implement dynamic style preview buttons
- Add JavaScript-based style copying from original elements to toolbar buttons
- Use getComputedStyle() to dynamically apply color, font-weight, text-decoration, text-transform
- Preserve button clickability with protected backgrounds and hover states
- Support any CSS framework/custom styles without hardcoded mappings
- Add comprehensive documentation to TODO.md for future enhancements

Examples:
- 'Emphasis' button now shows red bold text (from .emph class)
- 'Highlight' button displays with style preview while remaining clickable
- 'Brand' button demonstrates text-transform and color changes

This provides intuitive visual feedback so users immediately understand
what each formatting button will do to their content.
2025-09-19 20:48:01 +02:00
d317e2e1d9 refactor: Replace multi-property forms with popup-based link configuration
- Remove clunky multi-property editor with separate text + URL inputs
- Implement single rich text editor (contentEditable) for all content
- Add popup-based link configuration: select text → click 🔗 Link → configure
- Filter out link styles from formatting toolbar (links use popup, not buttons)
- Consolidate CSS: remove separate style-aware-editor.css, integrate into insertr.css
- Clean up 200+ lines of unused multi-property form code and styles
- Fix duplicate link style detection (no more 'Fancy Link' + 'Link' buttons)

Result: Much cleaner UX similar to modern editors where formatting uses
toolbar buttons and complex elements (links) use dedicated popups.
2025-09-19 20:16:33 +02:00
bf2927fec2 fix: Update positionForm to support new StyleAwareEditor class names
- Fix TypeError when accessing form.style by adding fallback selectors
- Support both legacy (.insertr-edit-form) and new editor class names
- Add null checks to prevent crashes when form element is not found
- Ensure ensureModalVisible works with all editor types

Resolves positioning error when opening style-aware editor interface.
2025-09-19 19:41:30 +02:00
3c4e83b302 feat: Implement complete style-aware editor interface (Phase 2)
- Add StyleAwareEditor class with intelligent editing strategy detection
- Implement three editing modes: simple text, rich content, multi-property forms
- Create dynamic formatting toolbar with buttons for detected styles
- Add multi-property editing forms for complex elements (links, images, buttons)
- Integrate contentEditable with style application/removal functionality
- Replace markdown-based editor.js with style-aware architecture
- Add comprehensive CSS styling for modern, responsive editor interface
- Support fallback editing for error cases with graceful degradation
- Enable real-time style application to selected text in rich editor
- Preserve all element attributes and structure during editing workflow

Complete implementation of CLASSES.md style preservation specification.
Phase 2 foundation ready for final testing and refinement.
2025-09-19 19:37:39 +02:00
67f9f242b5 feat: Implement complete style detection and preservation foundation
- Add StyleDetectionEngine with one-layer-deep nested element analysis
- Add HTMLPreservationEngine for direct HTML manipulation without lossy conversion
- Implement structure-preserving content parsing that maintains element positions
- Add multi-property element support for links (href + content), images (src + alt), buttons
- Create comprehensive test suite with real DOM element validation
- Replace markdown-based system foundation with HTML-first architecture
- Preserve all element attributes (classes, IDs, data-*, aria-*) during editing
- Generate human-readable style names from detected nested elements
- Support template extraction with multiple insertion points for complex elements

Foundation complete for Phase 2 style-aware editor interface per CLASSES.md specification.
2025-09-19 19:33:56 +02:00
968e64a57e refactor: Complete UI cleanup and simplify editor architecture
- Remove complex style preservation system from editor
- Simplify markdown conversion back to straightforward approach
- Remove StyleContext class and style-aware conversion methods
- Switch content type from 'html' back to 'markdown' for consistency
- Clean up editor workflow to focus on core markdown editing
- Remove ~500 lines of unnecessary style complexity

This completes the UI unification cleanup by removing the overly complex
style preservation system that was making the editor harder to maintain.
2025-09-19 16:15:56 +02:00
b7998a4b3c feat: Implement HTML-first style preservation system
- Add StyleContext class for extracting and applying HTML attributes/styles
- Enhance MarkdownConverter with style-aware conversion methods
- Switch backend storage from markdown to HTML with 'html' content type
- Update editor workflow to preserve CSS classes, IDs, and attributes
- Maintain markdown editing UX while storing HTML for style preservation
- Support complex attributes like rel, data-*, aria-*, etc.

This enables editing styled content like <a class="fancy" rel="me">text</a>
while preserving all styling attributes through the markdown editing process.
2025-09-19 16:03:05 +02:00
00c2ba34e6 feat: Implement syntactic sugar and site-specific discovery config
- Add syntactic sugar for container transformation: .insertr containers → children get .insertr
- Fix discovery auto-running when disabled with site-specific config loading
- Add comprehensive styling test examples for HTML attribute preservation
- Include test input for syntactic sugar validation
- Update discovery defaults to respect developer intent (disabled by default)
2025-09-19 15:57:28 +02:00
2a0915dda0 build: Update library assets with UI visibility fix
- Rebuild JavaScript library with delayed control panel initialization
- Update server assets to include latest UI behavior changes
- Ensure built assets reflect invisible UI for regular visitors

The control panel now only appears after gate activation, maintaining
the invisible CMS principle for end users.
2025-09-17 19:12:52 +02:00
988f99f58b fix: Hide control panel from regular visitors
- Move control panel initialization from start() to startEditor()
- Ensure UI only appears after successful gate activation
- Regular visitors now see zero indication of insertr presence
- Maintains 'invisible CMS' principle for end users

User Experience:
- Before gate: Website appears completely normal
- After gate: Control panel slides in for authenticated editors
- Gates remain the only trigger mechanism for editors
2025-09-17 17:08:35 +02:00
39b9c533fd refactor: Extract UI into dedicated control panel module
- Create InsertrControlPanel class for unified UI management
- Separate business logic from presentation layer
- Remove DOM manipulation from auth.js and editor.js
- Add comprehensive CSS for status indicators and editing effects
- Implement consistent kebab-case file naming
- Add event-driven communication between core and UI layers

UI Architecture:
- Unified control panel with status indicator and action buttons
- Color-coded status dots (gray/blue/green for visitor/auth/editing)
- Professional editing hover effects with tooltips
- Responsive design for mobile devices
- Proper z-index and accessibility management

Business Logic:
- Pure auth.js focused on authentication state and OAuth flows
- Pure editor.js focused on content editing workflow
- Event emitters for state changes between modules
- Clean separation of concerns and testable architecture
2025-09-17 16:52:49 +02:00
10c755efca Simplify CSS architecture by removing cascade layers and !important declarations
- Remove @layer declarations and complex hybrid approach
- Eliminate all !important usage - rely on natural CSS specificity
- Add explicit color declarations to prevent inheritance issues
- Class selectors (0,0,1,0) naturally beat universal selectors (0,0,0,0)
- Fixes white-on-white modal issues on sites with CSS resets
- Works in all browsers without 2022+ cascade layer requirements
- Cleaner, more maintainable CSS architecture
2025-09-17 16:32:46 +02:00
a08ddf7706 Add Norwegian Devigo demo with MIME type fixes
- Add production Norwegian sales training website demo
- Create placeholder CSS files for Hugo @import statements
- Update .gitignore to exclude *_enhanced/ directories
- Fix CSS MIME type issues for extensionless files in /css/ paths
2025-09-17 16:07:57 +02:00
1bf597266e Implement hybrid CSS architecture to fix white-on-white modal issue on sites with CSS resets
- Migrate from inline CSS to external insertr.css with cascade layer architecture
- Add CSS CDN serving capability (ServeInsertrCSS handler and /insertr.css route)
- Implement hybrid approach: @layer insertr for modern browsers + html body selectors for legacy browsers
- Remove scattered inline CSS from JavaScript modules for better maintainability
- Solve form element spacing conflicts with aggressive site CSS resets like '* {margin:0; padding:0}'
- Enable proper CSS caching and separation of concerns
2025-09-17 14:39:34 +02:00
cd202ebb1d Migrate to Chi router and add Norwegian Devigo demo
Major improvements:
- Replace Gorilla Mux with Chi v5 router for better performance and cleaner code
- Fix CSS/JS MIME type issues that prevented proper asset loading
- Add built-in CORS middleware replacing manual OPTIONS handlers
- Simplify routing with nested route syntax
- Update URL parameter extraction from mux.Vars to chi.URLParam

New Devigo demo:
- Add production Norwegian sales training website (devigo.no)
- Real-world Hugo-generated content with TailwindCSS
- 39 insertr-enhanced elements for comprehensive CMS testing
- Demonstrates international language support and B2B use cases
- Fixed asset paths for localhost serving compatibility

Technical benefits:
- Automatic MIME type detection for static files
- Reduced code complexity with built-in middleware
- Better performance with lighter dependency stack
- Production-ready CORS handling
2025-09-17 13:34:36 +02:00
12c6ec8048 Replace broken video/image references with CSS placeholders
- Replace non-working video elements with gradient placeholders showing app previews
- Replace missing images with styled placeholder divs maintaining layout
- Add emoji icons (📱 🎤) for visual appeal without external dependencies
- Maintain responsive design and visual hierarchy
- Keep all content IDs working for Insertr enhancement (40 content elements)
- Reduce demo to 48KB total with no missing media dependencies
2025-09-17 12:28:52 +02:00
67aa6ed954 Optimize dan-eden-portfolio demo for production use
- Remove all Next.js JavaScript framework dependencies (~1.9MB)
- Strip social media tracking and analytics scripts
- Preserve visual design with essential CSS files only (24KB)
- Keep video elements with local file references instead of external Mux streams
- Reduce HTML from 30KB minified to 5.5KB formatted (82% reduction)
- Maintain responsive design and content structure for realistic demo
- Ensure compatibility with Insertr content editing system
2025-09-17 12:25:49 +02:00
fb7df5a5c5 Clean up dan-eden-portfolio demo site
- Replace minified scraped HTML with clean, readable portfolio demo
- Remove all Next.js assets and dependencies (_next/, fonts, images)
- Create hand-crafted HTML with proper structure and modern CSS
- Maintain portfolio theme with projects, timeline, and professional content
- Reduce from 30KB minified to 6KB clean, readable HTML
- Update README to reflect new clean demo purpose
2025-09-17 00:11:27 +02:00
71561316da Fix demo site auto-enhancement and content persistence
- Restructure demo directory from test-sites/ to demos/ with flattened layout
- Add auto-enhancement on server startup for all sites with auto_enhance: true
- Fix inconsistent content ID generation that prevented dan-eden-portfolio content persistence
- Update server configuration to enhance from source to separate output directories
- Remove manual enhancement from justfile in favor of automatic server enhancement
- Clean up legacy test files and unused restore command
- Update build system to use CDN endpoint instead of file copying
2025-09-17 00:07:40 +02:00
1fa607c47c Fix site_id isolation for demo sites
- Auto-derive site_id from demo directory paths (demos/demo-site -> 'demo', demos/simple/test-simple -> 'simple')
- Add validation requiring explicit site_id for non-demo paths with helpful error messages
- Remove JavaScript 'demo' fallback and add proper error messaging for missing site_id
- Ensure each demo site uses isolated content namespace to prevent content mixing

Resolves issue where /sites/simple and /sites/demo both used site_id=demo
2025-09-16 22:23:41 +02:00
fe00a13780 Simplify script injection to single script with data attribute configuration
- Replace dual script injection (external + inline) with single script approach
- Pass site configuration via data attributes instead of inline JavaScript
- Update library auto-initialization to read config from script data attributes
- Reduce HTML bloat by eliminating 30+ lines of inline initialization code
- Maintain future-proof CDN compatibility and duplication prevention

Enhanced files now contain only one clean script tag with configuration.
2025-09-16 20:10:53 +02:00
a3fc3089d2 Simplify development workflow and fix content editing conflicts
- Replace complex multi-server setup (live-server + API) with unified Go server
- Serve all sites at /sites/{site_id} endpoints, eliminating port conflicts
- Fix content-type middleware to serve proper MIME types for static files
- Prevent script injection duplication with future-proof CDN-compatible detection
- Remove auto page reload from enhance button to eliminate editing interruptions
- Enable seamless content editing workflow with manual enhancement control

Development now requires only 'just dev' instead of complex demo commands.
All sites immediately available at localhost:8080 without hot reload conflicts.
2025-09-16 19:10:57 +02:00
eabb7b16e8 Clean up legacy code after unified architecture implementation
- Remove obsolete cmd/auto_enhance.go command (replaced by unified enhance)
- Implement EnhanceInPlace method using unified pipeline
- Remove generated demo files from git tracking
- Verify all functionality works after cleanup:
  * go build successful
  * enhance command working correctly
  * unified pipeline (discovery → ID generation → content injection) verified
  * clean command structure (only enhance, serve, restore commands)

The codebase is now clean with no legacy auto-enhance references or stub implementations. All functionality consolidated into the unified Discoverer + Enhancer architecture.
2025-09-16 18:40:00 +02:00
27a619b452 Simplify demo workflow to use unified enhancement command
- Replace complex two-step process (auto-enhance + enhance) with single enhance command
- Eliminate temporary directory management and cleanup
- Direct input → output enhancement using unified Discoverer + Enhancer pipeline
- Verified working on simple test site with proper:
  * Element discovery (h1, p elements get insertr class)
  * Container expansion (div with multiple children)
  * ID generation (deterministic data-content-id attributes)
  * Content type detection (text, markdown types)

The justfile workflow is now much cleaner and matches our documented single-command approach.
2025-09-16 16:52:12 +02:00
35855ac0f5 Implement unified Discoverer + Enhancer architecture
- Rename AutoEnhancer to Discoverer with clear element discovery focus
- Implement unified enhancement pipeline in Enhancer:
  * Phase 1: Element Discovery (configurable, respects existing insertr classes)
  * Phase 2: ID Generation via engine
  * Phase 3: Content Injection via engine
- Add EnhancementConfig and DiscoveryConfig for flexible configuration
- Update all method names and references (discoverNode, DiscoveryResult, etc.)
- Support both manual class insertion and automatic discovery
- Maintain single enhance command interface while providing unified internal pipeline
- Update all constructors to use new configuration-based approach

This establishes the clean Discoverer + Enhancer architecture discussed, with discovery as configurable first phase and enhancement as unified pipeline.
2025-09-16 16:50:07 +02:00
d877366be0 Consolidate type definitions and fix API contract
- Move all ContentItem, ContentClient, ContentResponse types to engine/types.go as single source of truth
- Remove duplicate type definitions from content/types.go
- Update all imports across codebase to use engine types
- Enhance engine to extract existing data-content-id from HTML markup
- Simplify frontend to always send html_markup, let server handle ID extraction/generation
- Fix contentId reference errors in frontend error handling
- Add getAttribute helper method to engine for ID extraction
- Add GetAllContent method to engine.DatabaseClient
- Update enhancer to use engine.ContentClient interface
- All builds and API endpoints verified working

This resolves the 400 Bad Request errors and creates a unified architecture where the server is the single source of truth for all ID generation and content type management.
2025-09-16 16:45:29 +02:00
d0ac3088b4 refactor: consolidate database structure and move injector to engine
Database Structure Cleanup:
- Move all SQL files from ./db/ to ./internal/db/
- Update sqlc.yaml to use new paths (preserving schema+setup.sql hack)
- Consolidate database-related code in single directory
- Remove empty ./db/ directory

Injector Migration:
- Move injector.go from content package to engine package
- Update ContentClient interface to return map instead of slice for GetBulkContent
- Update database client implementation to match interface
- Remove injector dependency from enhancer (stub implementation)

Demo-Site Consolidation:
- Move demo-site to test-sites/demo-site for better organization
- Update build scripts to use new demo-site location
- Maintain all functionality while improving project structure

This continues the unified architecture consolidation by moving core content
processing logic to the engine and organizing related files properly.
2025-09-16 15:39:25 +02:00
27179dc943 refactor: remove legacy parser system and migrate to unified engine
- Remove internal/parser package and all legacy ID generation logic
- Update enhancer and auto_enhancer to use unified engine functions
- Migrate utility functions (FindViableChildren, HasEditableContent) to engine
- Create stub enhancer implementation that uses unified engine architecture
- Ensure all enhancement workflows now go through single unified system
- Remove parser dependencies and consolidate content processing logic

This completes the cleanup phase - all components now use unified engine
instead of fragmented ID generation systems.
2025-09-16 15:18:40 +02:00
84c90f428d feat: implement unified content engine to eliminate ID generation inconsistencies
- Create internal/engine module as single source of truth for content processing
- Consolidate 4 separate ID generation systems into one unified engine
- Update API handlers to use engine for consistent server-side ID generation
- Remove frontend client-side ID generation, delegate to server engine
- Ensure identical HTML markup + file path produces identical content IDs
- Resolve content persistence failures caused by ID fragmentation between manual editing and enhancement processes
2025-09-16 15:04:27 +02:00
c1bc28d107 feat: ignore generated demo directories and remove tracked demo files
- Add gitignore patterns for CLI-generated demo directories (*-demo/, *-enhanced/, etc.)
- Remove previously tracked demo files that are now auto-generated
- Demo sites will be auto-created on-demand by CLI during just demo commands
2025-09-16 13:49:26 +02:00
33ba53fb50 feat: implement auto-injection of insertr.js with site-specific configuration
• Add /insertr.js endpoint to serve JavaScript library from API server
• Implement demo gate auto-injection for sites without existing gates
• Add dynamic site ID injection using per-demo configuration files
• Fix CORS middleware to support localhost origins on any port
• Update demo commands to use individual insertr.yaml configs
• Resolve content persistence issues by matching site IDs between injection and enhancement
• Enable complete edit/save workflow for demo sites with proper namespace isolation
2025-09-11 20:58:21 +02:00
cf3d304fdc feat: implement zero-configuration auto-enhancement demo workflow
- Add intelligent auto-enhancement that detects viable content elements
- Replace manual enhancement with automated container-first detection
- Support inline formatting (strong, em, span, links) within editable content
- Streamline demo workflow: just demo shows options, auto-enhances on demand
- Clean up legacy commands and simplify directory structure
- Auto-enhancement goes directly from source to demo-ready (no intermediate dirs)
- Add Dan Eden portfolio and simple test sites for real-world validation
- Auto-enhanced 40 elements in Dan Eden portfolio, 5 in simple site
- Achieve true zero-configuration CMS experience
2025-09-11 19:33:21 +02:00