Files
insertr/AGENTS.md
Joakim b0c4a33a7c feat: implement unified editor with content persistence and server-side upsert
- Replace dual update systems with single markdown-first editor architecture
- Add server-side upsert to eliminate 404 errors on PUT operations
- Fix content persistence race condition between preview and save operations
- Remove legacy updateElementContent system entirely
- Add comprehensive authentication with JWT scaffolding and dev mode
- Implement EditContext.updateOriginalContent() for proper baseline management
- Enable markdown formatting in all text elements (h1-h6, p, div, etc)
- Clean terminology: remove 'unified' references from codebase

Technical changes:
* core/editor.js: Remove legacy update system, unify content types as markdown
* ui/Editor.js: Add updateOriginalContent() method to fix save persistence
* ui/Previewer.js: Clean live preview system for all content types
* api/handlers.go: Implement UpsertContent for idempotent PUT operations
* auth/*: Complete authentication service with OAuth scaffolding
* db/queries/content.sql: Add upsert query with ON CONFLICT handling
* Schema: Remove type constraints, rely on server-side validation

Result: Clean content editing with persistent saves, no 404 errors, markdown support in all text elements
2025-09-10 20:19:54 +02:00

31 lines
1.2 KiB
Markdown

# AGENTS.md - Developer Guide for Insertr
## Build/Test Commands
- `just dev` - Full-stack development (recommended)
- `just build` - Build entire project (Go binary + JS library)
- `just build-lib` - Build JS library only
- `just test` - Run tests (placeholder, no actual tests yet)
- `just lint` - Run linting (placeholder, no actual linting yet)
- `just air` - Hot reload Go backend only
- `go test ./...` - Run Go tests (when available)
## Code Style Guidelines
### Go (Backend)
- Use standard Go formatting (`gofmt`)
- Package imports: stdlib → third-party → internal
- Error handling: always check and handle errors
- Naming: camelCase for local vars, PascalCase for exported
- Comments: package-level comments, exported functions documented
### JavaScript (Frontend)
- ES6+ modules, no CommonJS
- camelCase for variables/functions, PascalCase for classes
- Use `const`/`let`, avoid `var`
- Prefer template literals over string concatenation
- Export classes/functions explicitly, avoid default exports when multiple exports exist
### Database
- Use `sqlc` for Go database code generation
- SQL files in `db/queries/`, schemas in `db/{sqlite,postgresql}/schema.sql`
- Run `just sqlc` after schema changes