- Install @libsql/client@^0.17.2 to server package - Create skill-registry-schema.ts with 4 sqliteTable definitions (skills, skillVersions, skillFiles, communityRatings) - Create skill-registry-db.ts with lazy singleton getSkillRegistryDb() and resetSkillRegistryDb() - Add resolveSkillRegistryDbPath() and resolveSkillCacheDir() to home-paths.ts - Add skill-registry-schema.test.ts with 8 passing tests (TDD green)
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { sqliteTable, text, integer, real } from "drizzle-orm/sqlite-core";
|
|
|
|
export const skills = sqliteTable("skills", {
|
|
id: text("id").primaryKey(),
|
|
sourceId: text("source_id").notNull(),
|
|
name: text("name").notNull(),
|
|
description: text("description"),
|
|
sourceUrl: text("source_url"),
|
|
activeVersionId: text("active_version_id"),
|
|
removedAt: integer("removed_at"), // unix ms, nullable — soft-delete
|
|
createdAt: integer("created_at").notNull(),
|
|
updatedAt: integer("updated_at").notNull(),
|
|
});
|
|
|
|
export const skillVersions = sqliteTable("skill_versions", {
|
|
id: text("id").primaryKey(),
|
|
skillId: text("skill_id").notNull(),
|
|
version: text("version").notNull(),
|
|
fetchedAt: integer("fetched_at").notNull(),
|
|
cacheDir: text("cache_dir"),
|
|
});
|
|
|
|
export const skillFiles = sqliteTable("skill_files", {
|
|
id: text("id").primaryKey(),
|
|
versionId: text("version_id").notNull(),
|
|
path: text("path").notNull(),
|
|
kind: text("kind").notNull(), // "skill" | "reference" | "script" | "asset"
|
|
sizeBytes: integer("size_bytes"),
|
|
});
|
|
|
|
export const communityRatings = sqliteTable("community_ratings", {
|
|
id: text("id").primaryKey(),
|
|
skillId: text("skill_id").notNull(),
|
|
fetchedAt: integer("fetched_at").notNull(),
|
|
averageRating: real("average_rating"),
|
|
ratingCount: integer("rating_count"),
|
|
source: text("source"),
|
|
});
|