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.
This commit is contained in:
2025-09-20 00:02:03 +02:00
parent 63939e2c68
commit bb5ea6f873
14 changed files with 343 additions and 1982 deletions

View File

@@ -1,11 +1,13 @@
# AGENTS.md - Developer Guide for Insertr
## Build/Test Commands
- `just dev` - Full-stack development (recommended)
- `just dev` - Full-stack development with auto-enhanced demo sites (recommended)
- `just serve` - API server only with multi-site hosting
- `just build` - Build entire project (Go binary + JS library)
- `just build-lib` - Build JS library only
- `just enhance` - CLI enhancement of static sites
For running and testing our application read our justfile.
For complete command reference, see the justfile.
## Code Style Guidelines
@@ -22,8 +24,34 @@ For running and testing our application read our justfile.
- Use `const`/`let`, avoid `var`
- Prefer template literals over string concatenation
- Export classes/functions explicitly, avoid default exports when multiple exports exist
- NO COMMENTS unless explicitly asked - keep code clean and self-documenting
- HTML-first approach: preserve element attributes and styling perfectly
### Database
- Use `sqlc` for Go database code generation
- SQL files in `db/queries/`, schemas in `db/{sqlite,postgresql}/schema.sql`
- SQL files in `db/queries/`, schemas in `db/{sqlite,postgresql}/setup.sql`
- Version history implemented with full rollback capabilities
- Run `just sqlc` after schema changes
- Multi-database support: SQLite for development, PostgreSQL for production
## Current Architecture
### Frontend (Library)
- **StyleAware Editor**: Rich text editing with automatic style detection
- **HTML Preservation**: Perfect fidelity editing that maintains all element attributes
- **Style Detection Engine**: Automatically generates formatting options from detected CSS
- **Link Management**: Popup-based configuration for complex multi-property elements
- **Zero Dependencies**: No markdown libraries - HTML-first approach
### Backend (Go Binary)
- **Multi-Site Server**: Hosts and auto-enhances multiple static sites
- **Real-Time Enhancement**: Content changes trigger immediate file updates
- **Full REST API**: Complete CRUD operations with version control
- **Authentication**: Mock (dev) + Authentik OIDC (production)
- **Database Layer**: SQLite/PostgreSQL with full version history
### Key Principles
- **HTML-First**: No lossy markdown conversion - perfect attribute preservation
- **Zero Configuration**: Just add `class="insertr"` to any element
- **Style-Aware**: Automatically detect and offer CSS-based formatting options
- **Performance**: Regular visitors get pure static HTML with zero CMS overhead