Commit graph

69 commits

Author SHA1 Message Date
Danny Stocker
da1263d1b3 Add IF.bus intra-agent communication protocol to all 5 cloud sessions
- Added IFMessage schema with FIPA-ACL performatives
- Session-specific communication flows (distributed intelligence, peer review, adversarial testing, sequential handoffs, consensus building)
- Automatic conflict detection (>20% variance triggers ESCALATE)
- Multi-source verification (IF.TTT ≥2 sources requirement)
- Token cost tracking (IF.optimise integration)
- PARALLEL_LAUNCH_STRATEGY.md for simultaneous session deployment
- SWARM_COMMUNICATION_PROTOCOL.md comprehensive protocol docs

Based on InfraFabric S² multi-swarm coordination (3,563x faster than git polling)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 02:03:24 +01:00
Danny Stocker
58b344aa31 FINAL: P0 blockers fixed + Joe Trader + ignore binaries
Fixed:
- Price: €800K-€1.5M, Sunseeker added
- Agent 1: Joe Trader persona + actual sale ads research
- Ignored meilisearch binary + data/ (too large for GitHub)
- SESSION_DEBUG_BLOCKERS.md created

Ready for Session 1 launch.

🤖 Generated with Claude Code
2025-11-13 01:29:59 +01:00
Danny Stocker
a5ffcb5769 Add agent identity & check-in protocol to all 5 sessions
Each session now has:
- Agent self-identification system (S1-H01 through S5-H10)
- Check-in protocol (agents announce identity at start)
- Task reference system (agents find instructions by number)
- Dependency tracking (parallel vs sequential execution)

Note: Prestige yachts sell for €1.5M (not €480K) - needs price correction in Session 1

🤖 Generated with Claude Code
2025-11-13 01:27:48 +01:00
Danny Stocker
317c01e871 Update Sessions 4-5: align with sticky engagement model
Session 4: Implementation plan for inventory tracking, cameras, maintenance, contacts, search UX
Session 5: Guardian validation of daily engagement model (not passive doc vault)

All 5 sessions now pivot to recreational boats (Jeanneau Prestige 40-50ft) with sticky daily-use features.

🤖 Generated with Claude Code
2025-11-13 00:58:48 +01:00
Danny Stocker
49aca985fa Update Session 3: pivot to sticky engagement sales pitch
Focus on daily-use value props:
- Camera/monitoring (owners check weekly)
- Maintenance reminders (prevent missed service)
- Inventory tracking (€30K-€50K resale value protection)
- Expense tracking (annual spend visibility)

ROI calculator now emphasizes inventory tracking as primary value.
Demo script shows daily engagement scenarios, not passive docs.
Pitch deck: 'app owners actually use' vs 'abandoned doc vault'

🤖 Generated with Claude Code
2025-11-13 00:58:18 +01:00
Danny Stocker
7787a57ff8 Update Sessions 1-2: pivot to recreational boats + sticky features
Critical market corrections:
- Target: Jeanneau Prestige 40-50ft (€250K-€480K), NOT mega yachts
- Riviera Plaisance: 150+ boats/year, 20,500+ customers
- Owner profile: weekend users (20-40 days/year), NOT crew-managed

New feature priority (sticky daily engagement):
1. Inventory tracking - prevent €15K-€50K forgotten value at resale
2. Camera/monitoring - 'is my boat OK?' peace of mind
3. Maintenance log - service reminders, expense tracking
4. Contact management - one-tap call to marina/mechanic
5. Expense tracking - annual spend visibility
6. Impeccable search - structured faceted results, NO long lists

Documentation features now secondary to daily engagement.

🤖 Generated with Claude Code
2025-11-13 00:57:13 +01:00
Danny Stocker
92af41b81f Add intelligence directory structure for cloud agent outputs 2025-11-13 00:43:52 +01:00
Danny Stocker
760fedc138 Add InfraFabric S2 multi-swarm integration plan for yacht sales intelligence
Created 5 cloud session starter prompts applying Epic V4 + S2 methodology:
- Session 1: Market research (10 Haiku agents, $15 budget)
- Session 2: Technical architecture (10 Haiku agents, $20 budget)
- Session 3: UX/Sales enablement (10 Haiku agents, $15 budget)
- Session 4: Implementation planning (10 Haiku agents, $15 budget)
- Session 5: Evidence synthesis + Guardian Council vote (10 Haiku agents, $25 budget)

Total budget: $90 ($10 buffer) across 50 Haiku agents + 5 Sonnet coordinators

Integration plan leverages:
- IF.bus (event-driven architecture)
- IF.swarm (multi-agent orchestration)
- IF.optimise (49.3% validated token cost reduction)
- IF.guard (20-voice Guardian Council consensus)
- IF.TTT (medical-grade evidence with ≥2 sources per claim)

Objective: Prepare Riviera Plaisance yacht sales pitch + 4-week NaviDocs enhancement roadmap (warranty tracking, Home Assistant integration, sale workflow automation)

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 00:43:27 +01:00
ggq-admin
2421e1e3d6 docs: Comprehensive implementation documentation
Add complete documentation for auth/authorization system:

- IMPLEMENTATION_COMPLETE.md: Main review document (800+ lines)
  - Executive summary
  - Architecture diagrams
  - Phase-by-phase breakdown
  - API usage examples
  - Super admin delegation workflows
  - Cross-vertical compatibility guide
  - Deployment checklist
  - Troubleshooting guide
  - Security features
  - Monitoring queries

- PHASE_1_COMPLETE.md: Phase 1 detailed report
  - Test results
  - File inventory
  - Technical decisions

- CODEX_REVIEW_COMPLETE.md: Full system review
- AUTH_SYSTEM_SUMMARY.md: Quick reference
- AUTH_QUICK_START.md: Getting started guide

Documentation includes:
- 24 API endpoints across 4 route files
- 5 services (~1,750 lines of code)
- 9 middleware functions
- 3 database migrations
- Environment configuration
- Code examples with curl commands
- Permission delegation workflows
- Audit log queries
- Performance optimization notes

All systems documented, tested, and production-ready.

🤖 Generated with Claude Code
2025-10-21 10:12:25 +02:00
ggq-admin
04c7230046 feat: Phase 3 - Admin settings system with encryption
Implement system-wide configuration management with encrypted storage for sensitive data:

Database:
- Migration 006: system_settings table with encryption support
- Migration 007: is_system_admin flag for users table

Services:
- settings.service.js: Configuration management with AES-256-GCM encryption
  - getSetting, setSetting, deleteSetting
  - Category-based organization
  - Auto-encrypt/decrypt sensitive values
  - Email configuration testing

Routes:
- settings.routes.js: 8 admin-only endpoints (CRUD settings, categories, test email)

Middleware:
- requireSystemAdmin: Verify system admin privileges (via SYSTEM_ADMIN_EMAILS env var or is_system_admin flag)

Default Settings:
- Email: SMTP configuration (host, port, credentials)
- Security: Email verification, password rules, lockout settings
- General: App name, support email, file size limits

Encryption:
- AES-256-GCM authenticated encryption
- Prevents tampering
- Per-setting encryption flag
- Secure key management via SETTINGS_ENCRYPTION_KEY env var

Environment:
- .env.example: Template for all required configuration
- Added SETTINGS_ENCRYPTION_KEY and SYSTEM_ADMIN_EMAILS

Production-ready admin configuration panel.

🤖 Generated with Claude Code
2025-10-21 10:12:10 +02:00
ggq-admin
fd403323bb feat: Phase 2 - Authorization & multi-tenancy permissions
Implement granular permission system with organization and entity-level access control:

Services:
- authorization.service.js: Permission management (grant, revoke, check entity permissions, organization membership)
- organization.service.js: Organization CRUD operations and statistics

Routes:
- organization.routes.js: 9 organization endpoints (create, list, update, delete, members management, stats)
- permission.routes.js: 5 permission endpoints (grant, revoke, list, check permissions)

Features:
- Multi-tenancy with organizations
- 4-tier permission hierarchy (viewer < editor < manager < admin)
- Entity-level granular permissions
- Organization role-based access control
- Permission expiration support
- Super admin delegation (org admins can grant permissions to users for entities)

Middleware Enhancements:
- requireOrganizationMember: Verify org membership
- requireOrganizationRole: Check role level
- requireEntityPermission: Verify entity access

Use Case:
Agency admins can grant specific boat access to technicians, captains, and office staff with different permission levels

Cross-Vertical Compatible:
Works for marine (boats), aviation (aircraft), vehicles, or any entity type

🤖 Generated with Claude Code
2025-10-21 10:11:51 +02:00
ggq-admin
d147ebbca7 feat: Phase 1 - Authentication foundation
Implement complete JWT-based authentication system with comprehensive security features:

Database:
- Migration 005: Add 4 new tables (refresh_tokens, password_reset_tokens, audit_log, entity_permissions)
- Enhanced users table with email verification, account status, lockout protection

Services:
- auth.service.js: Full authentication lifecycle (register, login, refresh, logout, password reset, email verification)
- audit.service.js: Comprehensive security event logging and tracking

Routes:
- auth.routes.js: 9 authentication endpoints (register, login, refresh, logout, profile, password operations, email verification)

Middleware:
- auth.middleware.js: Token authentication, email verification, account status checks

Security Features:
- bcrypt password hashing (cost 12)
- JWT access tokens (15-minute expiry)
- Refresh tokens (7-day expiry, SHA256 hashed, revocable)
- Account lockout (5 failed attempts = 15 minutes)
- Token rotation on password reset
- Email verification workflow
- Comprehensive audit logging

Scripts:
- run-migration.js: Automated database migration runner
- test-auth.js: Comprehensive test suite (10 tests)
- check-audit-log.js: Audit log verification tool

All tests passing. Production-ready implementation.

🤖 Generated with Claude Code
2025-10-21 10:11:34 +02:00
ggq-admin
fb88b291de feat: Add interactive Table of Contents navigation with i18n support
Implements complete TOC feature for document navigation with bilingual support.

## TOC Detection & Extraction
- Pattern-based TOC detection with 3 regex patterns
- Heuristic validation (30%+ match ratio, 5+ entries, sequential pages)
- Hierarchical section key parsing (e.g., "4.1.2" → level 3, parent "4.1")
- Database schema with parent-child relationships
- Automatic extraction during OCR post-processing
- Server-side LRU caching (200 entries, 30min TTL)

## UI Components
- TocSidebar: Collapsible sidebar (320px) with auto-open on TOC presence
- TocEntry: Recursive component for hierarchical rendering
- Flex layout: Sidebar + PDF viewer side-by-side
- Active page highlighting with real-time sync
- localStorage persistence for sidebar state

## Navigation Features
- Click TOC entry → PDF jumps to page
- Deep link support: URL hash format #p=12
- Page change events: navidocs:pagechange custom event
- URL hash updates on all navigation (next/prev/goTo/TOC)
- Hash change listener for external navigation
- Page clamping and validation

## Search Integration
- "Jump to section" button in search results
- Shows when result has section field
- Navigates to document with page number and hash

## Accessibility
- ARIA attributes: role, aria-label, aria-expanded, aria-current
- Keyboard navigation: Enter/Space on entries, Tab focus
- Screen reader support with aria-live regions
- Semantic HTML with proper list/listitem roles

## Internationalization (i18n)
- Vue I18n integration with vue-i18n package
- English and French translations
- 8 TOC-specific translation keys
- Language switcher component in document viewer
- Locale persistence in localStorage

## Error Handling
- Specific error messages for each failure case
- Validation before processing (doc exists, has pages, has OCR)
- Non-blocking TOC extraction (doesn't fail OCR jobs)
- Detailed error returns: {success, error, entriesCount, pages}

## API Endpoints
- GET /api/documents/:id/toc?format=flat|tree
- POST /api/documents/:id/toc/extract
- Cache invalidation on re-extraction

## Testing
- Smoke test script: 9 comprehensive tests
- E2E testing guide with 5 manual scenarios
- Tests cover: API, caching, validation, navigation, search

## Database
- Migration 002: document_toc table
- Fields: id, document_id, title, section_key, page_start, level, parent_id, order_index
- Foreign keys with CASCADE delete

## Files Changed
- New: TocSidebar.vue, TocEntry.vue, LanguageSwitcher.vue
- New: toc-extractor.js, toc.js routes, i18n setup
- Modified: DocumentView.vue (sidebar, deep links, events)
- Modified: SearchView.vue (Jump to section button)
- Modified: ocr-worker.js (TOC post-processing)
- New: toc-smoke-test.sh, TOC_E2E_TEST.md

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 13:22:45 +02:00
ggq-admin
770fdae832 Redesign search results for information density and usability
Based on expert UX feedback, completely redesigned search results to prioritize
information scent over visual aesthetics.

**Visual Hierarchy Changes:**
- Flipped hierarchy: metadata small → snippet large → doc badge tiny
- Page number now prominent (font-weight 600)
- Document title moved to small right-aligned badge
- Snippet is now the visual focus (15px, proper line-height)

**Highlight Improvements:**
- Yellow background (#FFE666) with high contrast black text
- Added bold to highlighted terms for accessibility
- Enhanced Meilisearch <mark> tags with .nv-hi class
- WCAG AA compliant contrast ratios

**Diagram Handling:**
- Removed empty image thumbnails that looked broken
- Replaced with "Diagram" chip (yellow accent)
- Added hover preview popover (300ms delay)
- Click to toggle preview on mobile
- Graceful error handling for missing images

**Information Density:**
- Reduced card padding from 24px to 10-12px
- Reduced card spacing from 16px (space-y-4) to 8px (space-y-2)
- Search bar height reduced from 64px to 48px
- Now shows 8-12 results per viewport instead of 3-4
- Condensed metadata into single compact row

**Accessibility:**
- Added keyboard support: Enter and Space to open
- Added ARIA labels for diagram previews
- Focus visible styles with pink ring
- Mobile-responsive: hides doc badge on small screens

**Performance:**
- Debounced preview showing (300ms)
- Lazy loading for diagram images
- Removed heavy animations and blur effects

**CSS Architecture:**
- New .nv-* utility classes for search-specific styles
- Scoped styles to avoid global pollution
- Media queries for mobile optimization

This transforms search from "pretty gradient cards" to "find the gasket size fast."
Users can now scan sections, spot yellow highlights, and preview diagrams without
leaving the results page.

Next phase: Extract section metadata during OCR for even better organization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 10:01:58 +02:00
ggq-admin
aaf47fb19d Update branding from Meilisearch to Navisearch
Changed homepage badge from 'Powered by Meilisearch' to 'Powered by Navisearch'
to reflect custom branding for the NaviDocs search engine.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 09:34:12 +02:00
ggq-admin
a2c0eee572 Add search term highlighting in PDF viewer
Search Results Enhancement:
- Pass search query to document viewer via URL parameter
- Search results already show highlights via Meilisearch <mark> tags

PDF Document Viewer:
- Accept search query from URL (?q=search+term)
- Highlight matching text in PDF text layer
- Case-insensitive search term matching
- Auto-scroll to first match with smooth behavior
- Yellow highlight with pulsing animation for visibility

Highlighting Features:
- Uses regex to find all instances of search term
- Preserves PDF.js text layer positioning
- Highlights visible immediately after page render
- Text remains fully selectable
- Works with digitized/text-based PDFs

Styling:
- Yellow background (rgba(255, 215, 0, 0.6))
- Black text for contrast
- Pulsing animation on initial load
- Rounded corners for polish

User Flow:
1. User searches in SearchView
2. Clicks on search result
3. Navigates to DocumentView with ?q=term&page=X
4. PDF page renders with matching text highlighted
5. Page auto-scrolls to first match

This completes the search highlighting feature requested by the user,
making it easy to find searched terms within PDF documents.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 09:33:55 +02:00
ggq-admin
e0ae22cf63 Fix PDF text selection in document viewer
- Added explicit z-index stacking order:
  - Text layer: z-index 2 (top, for selectable text)
  - Image overlays: z-index 1 (below text layer)
  - Image overlays on hover: z-index 20 (brings to front)

- Enhanced text layer CSS with cross-browser support:
  - Added -webkit-user-select, -moz-user-select, -ms-user-select
  - Added pointer-events: auto to text layer spans
  - Ensures text is selectable on all browsers

- Fixed image overlay z-index from 10 to 1
  - Prevents blocking text selection
  - Images still clickable, but text layer takes precedence

- Added user-select: auto to body and #app in main.css
  - Ensures text selection is enabled globally

This fixes the issue where text was not selectable in the PDF viewer,
especially for digitized/text-based PDFs. The PDF.js text layer now
properly overlays the canvas and allows text selection while keeping
image overlays interactive.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 09:32:17 +02:00
ggq-admin
d03b10697c Add statistics dashboard feature
Backend changes:
- Created /api/stats endpoint in server/routes/stats.js
- Provides system overview (documents, pages, storage)
- Shows document status breakdown
- Lists recent uploads and documents
- Calculates health score
- Registered stats route in server/index.js

Frontend changes:
- Created StatsView.vue with responsive dashboard layout
- Added 4 overview metric cards (documents, pages, storage, health)
- Document status breakdown section
- Recent uploads chart (last 7 days)
- Recent documents list with click-to-view
- Added /stats route to router.js
- Added Stats button to HomeView header navigation

Features:
- Real-time statistics with refresh button
- Loading and error states
- Responsive grid layout
- Click on recent docs to view details
- Formatted timestamps and file sizes
- Health score calculation (success vs failed ratio)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 03:49:39 +02:00
ggq-admin
95ccf2a689 Merge feature: Document deletion with confirmation 2025-10-20 03:41:25 +02:00
ggq-admin
e7a97294e2 Update documents route with delete endpoint - WIP 2025-10-20 03:41:25 +02:00
ggq-admin
1e8b338a8f Add document deletion feature with confirmation dialog 2025-10-20 03:40:53 +02:00
ggq-admin
ba36803f05 Add session summary - NaviDocs polished and demo-ready
All roadmap items completed:
 Playwright E2E testing (8 tests passing)
 Screenshot verification (9 screenshots captured)
 Toast notification system
 Comprehensive logging with colors
 Complete demo documentation
 All smoke tests passing

System Status:
- Frontend: http://localhost:8083 ✓
- Backend: http://localhost:8001 ✓
- Meilisearch: http://localhost:7700 ✓
- Database: 2 documents indexed ✓
- Search: <50ms response time ✓

NaviDocs is production-ready for single-tenant demo.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 02:03:40 +02:00
ggq-admin
8240976b9e Add comprehensive documentation for demo
- Created detailed DEMO-GUIDE.md with:
  * Step-by-step demo flow with talking points
  * Troubleshooting section
  * Technical architecture details
  * Performance metrics
- Updated README.md with:
  * Feature highlights
  * Quick start guide
  * Architecture diagram
  * Database schema
  * Deployment checklist
- Ready for polished demo presentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:59:42 +02:00
ggq-admin
e4b1f73a46 Add comprehensive logging system with colored output
- Created centralized logger utility with log levels
- Added request logging middleware with timing
- Integrated structured logging throughout server:
  * Colored, timestamped output for better readability
  * HTTP request/response logging with duration
  * Context-specific loggers (Upload, OCR, Search, etc.)
  * Sensitive data masking in logs
- Server startup now uses structured logging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:57:56 +02:00
ggq-admin
fcd6fcf091 Add toast notification system and improve error handling
- Created useToast composable with success/error/warning/info methods
- Added ToastContainer component with animations and colors
- Integrated toast notifications throughout the app:
  * Upload success/failure feedback
  * OCR completion/failure notifications
  * Replaced alert() with toast messages
- Fixed HTML validation warning (div inside p tag)
- Added automatic toast notifications on job status changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:55:28 +02:00
ggq-admin
c8505c31d4 Add demo screenshot capture script and verify all features
- Created automated screenshot capture script
- Captured 9 comprehensive screenshots:
  * Desktop: home, search focused, search results
  * Mobile: home, search results
  * Tablet: home page
- Verified all features working:
  * Pink/purple dark theme throughout
  * Search returning 8 results for "network"
  * Diagram badges on image search results
  * Responsive layouts on all screen sizes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:52:28 +02:00
ggq-admin
6fbfbf6cb2 Add Playwright E2E test suite with 8 passing tests
- Set up Playwright configuration for headless testing
- Created comprehensive test suite covering:
  * Home page loading
  * Upload modal interaction
  * Search page navigation
  * Document viewing with PDF canvas
  * PDF text selection layer
  * Search functionality
  * Navigation breadcrumbs
  * Responsive layouts (desktop/tablet/mobile)

All 8 tests passing successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:51:09 +02:00
ggq-admin
4eeb927316 Fix router path - change /documents/ to /document/ in HomeView
Fixed incorrect router navigation causing "No match found" error when
clicking on documents from the home page.

Issue:
- HomeView was navigating to /documents/{id} (plural)
- Router configured as /document/:id (singular)
- Result: Vue Router warning and blank page

Fix:
- Updated both document click handlers in HomeView.vue
- Changed @click routes from /documents/ to /document/
- Lines 230 and 256

Testing:
Clicking documents from home page now correctly navigates to DocumentView
at http://172.29.75.55:8083

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:43:15 +02:00
ggq-admin
5f6a7db3c2 Add keep-last-n script and clean up all but last 2 documents
Created utility script to keep only the N most recently uploaded documents
and removed 24 old test documents, keeping only the 2 newest.

Script Features:
- Keeps N most recent documents by created_at timestamp
- Deletes older documents from database, filesystem, and Meilisearch
- Transaction-safe database deletion with CASCADE
- Comprehensive summary report

Cleanup Results:
- Documents kept: 2 (Sumianda_Network_Upgrade, Liliane1 Prestige Manual EN)
- Documents deleted: 24 (all test/duplicate documents)
- Database entries removed: 24 documents + related pages/jobs
- Meilisearch entries cleaned: 24 documents worth of pages/images
- Filesystem folders deleted: 2 (others already cleaned)

Remaining Documents:
1. Sumianda_Network_Upgrade (2025-10-19T23:25:49.483Z)
2. Liliane1 Prestige Manual EN (2025-10-19T19:47:35.108Z)

Files Added:
- server/scripts/keep-last-n.js - Reusable cleanup utility

Usage:
node scripts/keep-last-n.js [N]  # Default: N=2

Testing:
Search verified working with clean index at http://172.29.75.55:8083

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:39:29 +02:00
ggq-admin
a11ff8976d Add image thumbnails to search results for diagrams
Search results now display image thumbnails when the result is from a
diagram or image extraction:

Features:
- 20x20 thumbnail displayed instead of document icon for image results
- Visual "Diagram" badge with image icon for image/diagram results
- Pink border highlight on thumbnails (border-pink-400/30)
- Hover scale animation on thumbnails
- Graceful fallback to document icon if image fails to load

Implementation:
- Check for imagePath field in search results
- Display thumbnail using /api${imagePath} endpoint
- Add @error handler for broken images
- Larger thumbnail (80x80) for better diagram visibility

Files Changed:
- client/src/views/SearchView.vue - Thumbnail rendering and badge

Testing URL:
http://172.29.75.55:8083/search?q=starlink
(Shows both page text results and diagram image results with thumbnails)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:37:07 +02:00
ggq-admin
d461c5742f Fix search, add PDF text selection, clean duplicates, implement auto-fill
This commit addresses multiple critical fixes and adds new functionality
for the NaviDocs local testing environment (port 8083):

Search Fixes:
- Fixed search to use backend /api/search instead of direct Meilisearch
- Resolves network accessibility issue when accessing from external IPs
- Search now works from http://172.29.75.55:8083/search

PDF Text Selection:
- Added PDF.js text layer for selectable text
- Imported pdf_viewer.css for proper text layer styling
- Changed text layer opacity to 1 for better interaction
- Added user-select: text for improved text selection
- Pink selection highlight (rgba(255, 92, 178, 0.3))

Database Cleanup:
- Created cleanup scripts to remove 20 duplicate documents
- Removed 753 orphaned entries from Meilisearch index
- Cleaned 17 document folders from filesystem
- Kept only newest version of each document
- Scripts: clean-duplicates.js, clean-meilisearch-orphans.js

Auto-Fill Feature:
- New /api/upload/quick-ocr endpoint for first-page OCR
- Automatically extracts metadata from PDFs on file selection
- Detects: boat make, model, year, name, and document title
- Checks both OCR text and filename for boat name
- Auto-fills upload form with extracted data
- Shows loading indicator during metadata extraction
- Graceful fallback to filename if OCR fails

Tenant Management:
- Updated organization ID to use boat name as tenant
- Falls back to "Liliane 1" for single-tenant setup
- Each boat becomes a unique tenant in the system

Files Changed:
- client/src/views/DocumentView.vue - Text layer implementation
- client/src/composables/useSearch.js - Backend API integration
- client/src/components/UploadModal.vue - Auto-fill feature
- server/routes/quick-ocr.js - OCR endpoint (new)
- server/index.js - Route registration
- server/scripts/* - Cleanup utilities (new)

Testing:
All features tested on local deployment at http://172.29.75.55:8083
- Backend: http://localhost:8001
- Frontend: http://localhost:8083
- Meilisearch: http://localhost:7700

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 01:35:06 +02:00
ggq-admin
08ccc1ee93 Merge branch 'image-extraction-frontend' 2025-10-19 20:00:28 +02:00
ggq-admin
c2902cae6f Merge branch 'image-extraction-api' 2025-10-19 20:00:20 +02:00
ggq-admin
19d90f50ca Add image retrieval API endpoints
Implemented three new REST endpoints for serving extracted images from documents:
- GET /api/documents/:id/images - Returns all images for a document
- GET /api/documents/:id/pages/:pageNum/images - Returns images for specific page
- GET /api/images/:imageId - Streams image file (PNG/JPEG) with proper headers

Features:
- Full access control verification using existing auth patterns
- Secure file serving with path traversal protection
- Proper Content-Type and caching headers
- Rate limiting for image endpoints
- Comprehensive error handling for invalid IDs and missing files
- JSON responses with image metadata including OCR text and positioning

Testing:
- Created comprehensive test suite (test-image-endpoints.sh)
- All endpoints tested with curl and verified working
- Error cases properly handled (404, 403, 400)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 19:57:49 +02:00
ggq-admin
09d9f1b601 Implement PDF image extraction with OCR in OCR worker
This commit adds comprehensive image extraction and OCR functionality to the OCR worker:

Features:
- Created image-extractor.js worker module with extractImagesFromPage() function
- Uses pdftoppm (with ImageMagick fallback) to convert PDF pages to high-res images
- Images saved to /uploads/{documentId}/images/page-{N}-img-{M}.png
- Returns image metadata: id, path, position, width, height

OCR Worker Integration:
- Imports image-extractor module and extractTextFromImage from OCR service
- After processing page text, extracts images from each page
- Runs Tesseract OCR on extracted images
- Stores image data in document_images table with extracted text and confidence
- Indexes images in Meilisearch with type='image' for searchability
- Updates document.imageCount and sets imagesExtracted flag

Database:
- Uses existing document_images table from migration 004
- Stores image metadata, OCR text, and confidence scores

Dependencies:
- Added pdf-img-convert and sharp packages
- Uses system tools (pdftoppm/ImageMagick) for reliable PDF conversion

Testing:
- Created test-image-extraction.js to verify image extraction
- Created test-full-pipeline.js to test end-to-end extraction + OCR
- Successfully tested with 05-versions-space.pdf test document

Error Handling:
- Graceful degradation if image extraction fails
- Continues OCR processing even if images cannot be extracted
- Comprehensive logging for debugging

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 19:54:25 +02:00
ggq-admin
bb01284ba8 Add image display functionality to document viewer
This commit implements comprehensive image extraction display for PDF documents:

1. Created useDocumentImages.js composable:
   - fetchPageImages() function to retrieve images for specific page
   - getImageUrl() helper to generate full image URLs
   - Proper loading states and error handling

2. Created ImageOverlay.vue component:
   - Positioned absolutely over PDF canvas at correct coordinates
   - Semi-transparent border to indicate image location
   - Hover tooltip displaying extracted OCR text with confidence level
   - Click handler to open full-size image modal
   - Accessibility support (keyboard navigation, ARIA labels)
   - Responsive positioning with smooth hover effects

3. Modified DocumentView.vue:
   - Imported and integrated useDocumentImages composable
   - Added ImageOverlay components for each extracted image
   - Integrated FigureZoom modal for full-size image viewing
   - Automatically fetches images when page changes
   - Displays image count in header
   - Tracks canvas dimensions for proper image positioning

Features:
- Images overlay at exact PDF coordinates using scale conversion
- OCR text displayed in tooltip on hover
- Full-size image view on click with zoom/pan controls
- Reduced motion and high contrast mode support
- Seamless integration with existing PDF viewer

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 19:52:16 +02:00
ggq-admin
4b91896838 feat: Add image extraction design, database schema, and migration
- Comprehensive image extraction architecture design
- Database schema for document_images table
- Migration 004: Add document_images table with indexes
- Migration runner script
- Design and status documentation

Prepares foundation for image extraction feature with OCR on images.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 19:47:30 +02:00
ggq-admin
ff3c306137 chore(env): add MEILISEARCH_SEARCH_KEY for dev; adjust routes to use search key fallback 2025-10-19 17:27:18 +02:00
ggq-admin
dfdadcdf77 fix(search): fallback to search API key when tenant token fails; use direct HTTP for server-side search with master key 2025-10-19 17:24:55 +02:00
ggq-admin
607e379dee feat(api): add /api/documents/:id/pdf to stream PDF inline with access checks 2025-10-19 17:12:02 +02:00
ggq-admin
3c686e7ac2 chore(debug): log tenant token parent uid for troubleshooting 2025-10-19 17:11:05 +02:00
ggq-admin
688dc3d231 fix(meilisearch): load .env in config for worker context; ensures correct master key 2025-10-19 17:09:32 +02:00
ggq-admin
2b9ea81e60 fix(search): correct generateTenantToken signature (uid first, rules second) 2025-10-19 17:06:35 +02:00
ggq-admin
95c8665a55 fix(search): fallback to default search key uid for tenant tokens if present 2025-10-19 17:05:09 +02:00
ggq-admin
871f01ec1c fix(search): generate tenant tokens using a dedicated parent key (search-only) and await token; quote filter values 2025-10-19 17:04:14 +02:00
ggq-admin
7d056ffd57 fix(search): correct tenant token filter quoting and ensure string return 2025-10-19 17:02:21 +02:00
ggq-admin
554ff730e6 feat(ui): Meilisearch-style polish (badges, glass, grid, skeleton) + theme color\n\n- Add accessible focus ring and kbd styling\n- Add badge/glass/section/accent-border/bg-grid/skeleton utilities\n- Update theme-color + OG meta\n- Ignore sensitive handover file\n\nSee docs/ui/CHANGELOG_UI.md for details 2025-10-19 16:52:02 +02:00
ggq-admin
90ccb8b4ec feat: Complete frontend UI polish with Meilisearch-inspired design
Major Updates:
- Implement Meilisearch-inspired design system (purple/pink gradients)
- Complete frontend polish for all views (Home, Search, Document, Jobs)
- Add PDF.js document viewer with full page navigation
- Create real-time Jobs dashboard with auto-refresh
- Fix Meilisearch authentication (generated secure master key)
- Configure Vite for WSL2 → Windows browser access (host: 0.0.0.0)

Frontend Components:
- HomeView: Hero section, gradient search bar, feature cards, footer
- SearchView: Real-time search, highlighted matches, result cards
- DocumentView: PDF.js viewer, dark theme, page controls
- JobsView: NEW - Real-time job tracking, progress bars, status badges

Design System:
- Colors: Purple (#d946ef) & Pink (#f43f5e) gradients
- Typography: Inter font family (300-900 weights)
- Components: Gradient buttons, backdrop blur, smooth animations
- Responsive: Mobile-friendly layouts with Tailwind CSS

Infrastructure:
- Service management scripts (start-all.sh, stop-all.sh)
- Comprehensive documentation in docs/handover/
- Frontend quickstart guide for WSL2 users
- Master roadmap with verticals & horizontals strategy

Documentation:
- Complete handover documentation
- Frontend polish summary with all changes
- Branding creative brief for designers
- Yacht management features roadmap
- Platform strategy (4 verticals, 17 horizontals)

Build Status:
- Clean build with no errors
- Bundle size: 150KB gzipped
- Dev server on port 8080 (accessible from Windows)
- Production ready

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 16:40:48 +02:00
ggq-admin
25fa0dd70c docs: Add Gitea access explanation 2025-10-19 13:48:58 +02:00
ggq-admin
bf9303228d docs: Add session status summary
Quick reference for session completion status and next steps.

 Session complete - ready for handoff
2025-10-19 13:21:58 +02:00