**Database Schema:** - Add npmReadme, npmKeywords, npmAuthor, npmMaintainers fields to Tool model **NPM Client:** - Add fetchLatestPackageWithMetadata() function to fetch README and top-level metadata - Export new PackageVersionWithReadme type **Sync Workers:** - Update keyword and changes sync to fetch and store README content - Store author, maintainers, and keywords from package.json **UI Components:** - Create Markdown component using react-markdown with GitHub Flavored Markdown - Add rehype-sanitize for security and remark-gfm for tables/strikethrough support **Tool Detail Page:** - Convert from createElement to JSX for better maintainability - Display README in a dedicated card with proper markdown rendering - Show NPM keywords, author, and maintainers in sidebar - Add ThemeToggle to header - Improve layout with better spacing and organization This brings the tool detail pages much closer to NPM's package pages, providing users with comprehensive information about each tool including the full README documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
94 lines
3.4 KiB
Text
94 lines
3.4 KiB
Text
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
/// Main tools table - stores all discovered NPM packages with TPMJS metadata
|
|
model Tool {
|
|
id String @id @default(cuid())
|
|
|
|
// NPM Metadata
|
|
npmPackageName String @unique @map("npm_package_name") @db.VarChar(214)
|
|
npmVersion String @map("npm_version") @db.VarChar(50)
|
|
npmPublishedAt DateTime @map("npm_published_at")
|
|
npmDescription String? @map("npm_description") @db.Text
|
|
npmRepository Json? @map("npm_repository") @db.JsonB
|
|
npmHomepage String? @map("npm_homepage") @db.Text
|
|
npmLicense String? @map("npm_license") @db.VarChar(50)
|
|
npmKeywords String[] @default([]) @map("npm_keywords") @db.Text
|
|
npmReadme String? @map("npm_readme") @db.Text
|
|
npmAuthor Json? @map("npm_author") @db.JsonB
|
|
npmMaintainers Json? @map("npm_maintainers") @db.JsonB
|
|
|
|
// TPMJS Metadata (from package.json tpmjs field)
|
|
category String @db.VarChar(50)
|
|
description String @db.Text
|
|
example String @db.Text
|
|
parameters Json? @db.JsonB
|
|
returns Json? @db.JsonB
|
|
authentication Json? @db.JsonB
|
|
pricing Json? @db.JsonB
|
|
frameworks String[] @db.Text
|
|
links Json? @db.JsonB
|
|
tags String[] @db.Text
|
|
status String? @db.VarChar(20)
|
|
aiAgent Json? @map("ai_agent") @db.JsonB
|
|
|
|
// Discovery Metadata
|
|
discoveryMethod String @map("discovery_method") @db.VarChar(20) // 'keyword' | 'changes-feed'
|
|
isOfficial Boolean @default(false) @map("is_official")
|
|
tier String @db.VarChar(20) // 'minimal' | 'rich'
|
|
|
|
// Metrics
|
|
npmDownloadsLastMonth Int? @default(0) @map("npm_downloads_last_month")
|
|
githubStars Int? @default(0) @map("github_stars")
|
|
qualityScore Decimal? @map("quality_score") @db.Decimal(3, 2) // 0.00 to 1.00
|
|
|
|
// Timestamps
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
@@index([category])
|
|
@@index([isOfficial])
|
|
@@index([qualityScore])
|
|
@@index([npmDownloadsLastMonth])
|
|
@@index([createdAt])
|
|
@@map("tools")
|
|
}
|
|
|
|
/// Sync checkpoints - tracks progress of sync workers
|
|
model SyncCheckpoint {
|
|
id String @id @default(cuid())
|
|
|
|
source String @unique @db.VarChar(50) // 'changes-feed' | 'keyword-search' | 'metrics'
|
|
checkpoint Json @db.JsonB // Stores last sequence, timestamp, etc.
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
@@map("sync_checkpoints")
|
|
}
|
|
|
|
/// Sync logs - audit trail of sync operations
|
|
model SyncLog {
|
|
id String @id @default(cuid())
|
|
|
|
source String @db.VarChar(50) // 'changes-feed' | 'keyword-search' | 'metrics'
|
|
status String @db.VarChar(20) // 'success' | 'error' | 'partial'
|
|
processed Int @default(0) // Number of packages processed
|
|
skipped Int @default(0) // Number of packages skipped
|
|
errors Int @default(0) // Number of errors encountered
|
|
message String? @db.Text // Error message or summary
|
|
metadata Json? @db.JsonB // Additional context
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
@@index([source])
|
|
@@index([status])
|
|
@@index([createdAt])
|
|
@@map("sync_logs")
|
|
}
|