feat: Add smart package recommendations feature

- Implement onboarding modal with 3-step wizard
  - Category selection (up to 3 categories)
  - OS detection with manual override
  - Experience level selection

- Add intelligent recommendation engine
  - Hybrid scoring algorithm (category 40%, popularity 30%, OS 20%, preset 10%)
  - 7 curated categories with preset packages
  - Support for all platforms (Windows, macOS, Ubuntu, Debian, Arch, Fedora)

- Create recommendation UI components
  - RecommendationsSection with grid layout
  - Package cards with recommendation scores and reasons
  - User profile display with customization options

- Add localStorage-based profile management
  - Persistent user preferences
  - Automatic OS detection
  - Profile CRUD operations via useRecommendationProfile hook

- Implement API endpoint
  - POST /api/recommendations
  - GET /api/recommendations (query params)
  - Request validation and error handling

- Add full i18n support
  - English and Turkish translations
  - Onboarding flow, categories, and UI labels

- Update TypeScript config (lib: es2017 for array.includes)

Closes #1
This commit is contained in:
ersaayan
2025-11-22 16:20:36 +03:00
parent afd4456893
commit 73f9248e98
12 changed files with 2169 additions and 8 deletions
+99
View File
@@ -0,0 +1,99 @@
import { Package, Platform } from './index'
/**
* User category types for package recommendations
*/
export type UserCategory =
| 'development'
| 'design'
| 'multimedia'
| 'system-tools'
| 'gaming'
| 'productivity'
| 'education'
/**
* User experience level
*/
export type ExperienceLevel = 'beginner' | 'intermediate' | 'advanced'
/**
* User profile stored in localStorage
*/
export interface UserProfile {
categories: UserCategory[]
detectedOS?: string
selectedOS?: string // Manual override
experienceLevel?: ExperienceLevel
hasCompletedOnboarding: boolean
createdAt: string
lastUpdated: string
}
/**
* Request payload for recommendation API
*/
export interface RecommendationRequest {
platform_id: string
categories: UserCategory[]
experienceLevel?: ExperienceLevel
limit?: number
}
/**
* Recommended package with score
*/
export interface RecommendedPackage {
id: string
name: string
description: string
version: string
category?: string
license?: string
type: 'gui' | 'cli'
platform?: string | any
platform_id?: string
repository: 'official' | 'third-party' | 'aur'
download_url?: string
lastUpdated?: string
downloads?: number
popularity?: number
popularity_score?: number
tags?: string[]
recommendationScore: number
recommendationReason: string
presetMatch?: boolean
}
/**
* Preset package configuration
*/
export interface PackagePreset {
packageName: string
platforms: string[] // ['windows', 'macos', 'ubuntu', 'arch', 'fedora']
priority: number // 1-10, higher = more important
reason: string // Why this package is recommended
experienceLevel?: ExperienceLevel[] // Target experience levels
}
/**
* Category preset configuration
*/
export interface CategoryPreset {
category: UserCategory
packages: PackagePreset[]
description: string
icon: string
}
/**
* Recommendation response
*/
export interface RecommendationResponse {
recommendations: RecommendedPackage[]
total: number
userProfile: {
categories: UserCategory[]
platform: string
}
}