feat: implement multi-tool package architecture with manual tool registry

BREAKING CHANGE: Complete refactoring from single-tool to multi-tool package support

Database Schema:
- Split Tool model into Package (1) and Tool (many) with one-to-many relationship
- Package stores npm metadata and package-level tpmjs fields (category, env, frameworks, tier)
- Tool stores individual tool exports with tool-level metadata (exportName, description, parameters, returns, aiAgent)
- Unique constraint on (packageId, exportName) to prevent duplicate tools
- Cascade deletes when packages are removed

Type System:
- Updated tpmjs field schema to support tools array
- Each tool has exportName, description, parameters, returns, aiAgent
- Package-level fields: category, env, frameworks shared across all tools
- Backward compatible with legacy single-tool format (auto-migrates to exportName: "default")

API Updates:
- Updated all /api/tools routes to query Tool model with Package relations
- Updated /api/tools/[slug] to accept package/export path segments
- Updated tool-executor-agent to use actual exportName instead of hardcoded "default"
- Updated metrics sync to calculate quality scores per Tool

Frontend Updates:
- Updated tool search page to display exportName as primary heading
- Updated tool detail pages to show package name as secondary info
- Removed tag-based filtering (tags moved to package level)

Manual Tool Registry:
- Added manual-tools.ts with 23 curated tools from major providers
- Created sync-manual-tools.ts script to sync manual tools to database
- Added MANUAL_TOOLS.md documentation for manual tool system
- Added GitHub workflow for automated daily sync
- Includes tools from: Vercel, Exa, Firecrawl, AWS Bedrock, Perplexity, Tavily, Superagent, Valyu

Playground Updates:
- Updated tool loader to load multiple tools per package
- Added sanitizeToolName for OpenAI API compatibility

Sync System Updates:
- Updated changes feed sync to handle multi-tool packages
- Updated keyword sync to upsert multiple tools per package
- Added orphaned tool deletion when tools removed from package.json

Migration Strategy:
- Database uses same Neon instance for dev and prod
- Schema updated via prisma db push (no migration files yet)
- All data repopulates from npm via sync system

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ajax Davis 2025-12-04 06:39:58 +10:00
parent f59c2c5123
commit 141a64d888
31 changed files with 3783 additions and 786 deletions

View file

@ -1,7 +1,6 @@
{
"name": "@tpmjs/hello",
"version": "0.0.1",
"private": true,
"version": "0.0.2",
"description": "Example TPMJS tools - Hello World and Hello Name",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@ -11,17 +10,68 @@
"clean": "rm -rf dist",
"type-check": "tsc --noEmit"
},
"keywords": ["tpmjs-tool", "ai-sdk", "hello", "example"],
"keywords": [
"tpmjs-tool",
"ai-sdk",
"hello",
"example"
],
"tpmjs": {
"category": "text-analysis",
"description": "Simple greeting tools - Hello World and personalized Hello Name greetings"
"frameworks": [
"vercel-ai"
],
"tools": [
{
"exportName": "helloWorldTool",
"description": "Returns a simple 'Hello, World!' greeting with optional timestamp and customizable message",
"parameters": [
{
"name": "includeTimestamp",
"type": "boolean",
"description": "Whether to include the current timestamp in the greeting",
"required": false
}
],
"returns": {
"type": "string",
"description": "A greeting message, optionally with timestamp"
}
},
{
"exportName": "helloNameTool",
"description": "Returns a personalized greeting with the provided name",
"parameters": [
{
"name": "name",
"type": "string",
"description": "The name to greet",
"required": true
},
{
"name": "formal",
"type": "boolean",
"description": "Whether to use formal greeting (Mr./Ms.)",
"required": false
}
],
"returns": {
"type": "string",
"description": "A personalized greeting message"
}
}
]
},
"dependencies": {
"ai": "6.0.0-beta.124"
},
"devDependencies": {
"@tpmjs/tsconfig": "workspace:*",
"tsx": "^4.20.6",
"typescript": "^5.9.3"
},
"files": ["dist", "README.md"]
"files": [
"dist",
"README.md"
]
}